Changeset 3871


Ignore:
Timestamp:
06/25/11 11:27:27 (11 months ago)
Author:
benedikt
Message:
  • [DIST] Added Debian Wheezy support
  • [ENGINE] Fixed Alias Manager copied file not longer available
  • [ENGINE] Replaced hard coded Autoreply Values in master.cf
  • [GUI] Added Exception if phptmp is not writable
  • [GUI] Added Method fetchAll() to ispCP_Database_ResultSet
  • [GUI] Improved l18n handling
  • [GUI] Refactored inlcudes
Location:
trunk
Files:
6 added
1 deleted
35 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/CHANGELOG

    r3868 r3871  
    11ispCP ω 1.1.0 ChangeLog 
    22~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     3 
     42011-06-25 Benedikt Heintel 
     5        - DISTS: 
     6                * Added Debian Wheezy support 
     7        - ENGINE: 
     8                * Fixed Alias Manager copied file not longer available 
     9                * Replaced hard coded Autoreply Values in master.cf 
     10        - GUI: 
     11                * Added Exception if phptmp is not writable 
     12                * Added Method fetchAll() to ispCP_Database_ResultSet 
     13                * Improved l18n handling 
     14                * Refactored inlcudes 
     15 
    3162011-06-22 Benedikt Heintel 
    417    - DISTS: 
  • trunk/configs/centos/postfix/master.cf

    r3762 r3871  
    7676# ispCP autoresponder 
    7777ispcp-arpl unix  -      n       n       -       -       pipe 
    78   flags=O user=vmail argv=/var/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     78  flags=O user={ARPL_USER} argv={ARPL_PATH} 
    7979 
    8080# TLS - Activate, if TLS is avaiable/used 
  • trunk/configs/common/database/spamassassin.sql

    r3845 r3871  
    4545) TYPE=InnoDB; 
    4646 
    47 INSERT INTO bayes_global_vars VALUES ('VERSION','3'); 
     47INSERT IGNORE INTO bayes_global_vars VALUES ('VERSION','3'); 
    4848 
    4949CREATE TABLE IF NOT EXISTS bayes_seen ( 
  • trunk/configs/debian/postfix/master.cf

    r3762 r3871  
    7676# ispCP autoresponder 
    7777ispcp-arpl unix  -      n       n       -       -       pipe 
    78   flags=O user=vmail argv=/var/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     78  flags=O user={ARPL_USER}:{ARPL_GROUP} argv={ARPL_PATH} 
    7979 
    8080# TLS - Activate, if TLS is avaiable/used 
  • trunk/configs/fedora/postfix/master.cf

    r3762 r3871  
    7676# ispCP autoresponder 
    7777ispcp-arpl unix  -      n       n       -       -       pipe 
    78   flags=O user=vmail argv=/var/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     78  flags=O user={ARPL_USER}:{ARPL_GROUP} argv={ARPL_PATH} 
    7979 
    8080# TLS - Activate, if TLS is avaiable/used 
  • trunk/configs/freebsd/postfix/master.cf

    r3762 r3871  
    7676# ispCP autoresponder 
    7777ispcp-arpl unix  -      n       n       -       -       pipe 
    78   flags=O user=vmail argv=/usr/local/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     78  flags=O user={ARPL_USER}:{ARPL_GROUP} argv={ARPL_PATH} 
    7979 
    8080# TLS - Activate, if TLS is avaiable/used 
  • trunk/configs/gentoo/postfix/master.cf

    r3762 r3871  
    7676# ispCP autoresponder 
    7777ispcp-arpl unix  -      n       n       -       -       pipe 
    78   flags=O user=vmail argv=/var/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     78  flags=O user={ARPL_USER}:{ARPL_GROUP} argv={ARPL_PATH} 
    7979 
    8080# TLS - Activate, if TLS is avaiable/used 
  • trunk/configs/openbsd/postfix/master.cf

    r3762 r3871  
    7676# ISPCP autoresponder 
    7777ispcp-arpl unix  -      n       n       -       -       pipe 
    78   flags=O user=vmail argv=/var/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     78  flags=O user={ARPL_USER}:{ARPL_GROUP} argv={ARPL_PATH} 
    7979 
    8080# TLS - Activate, if TLS is avaiable/used 
  • trunk/configs/opensuse/postfix/master.cf

    r3762 r3871  
    121121 
    122122ispcp-arpl unix  -      n       n       -       -       pipe 
    123   flags=O user=vmail argv=/srv/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     123  flags=O user={ARPL_USER}:{ARPL_GROUP} argv={ARPL_PATH} 
    124124 
    125125# ==================================================================== 
  • trunk/configs/redhat/postfix/master.cf

    r3762 r3871  
    7676# ispCP autoresponder 
    7777ispcp-arpl unix  -      n       n       -       -       pipe 
    78   flags=O user=vmail argv=/var/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     78  flags=O user={ARPL_USER}:{ARPL_GROUP} argv={ARPL_PATH} 
    7979 
    8080# TLS - Activate, if TLS is avaiable/used 
  • trunk/configs/ubuntu/postfix/master.cf

    r3762 r3871  
    7676# ispCP autoresponder 
    7777ispcp-arpl unix  -      n       n       -       -       pipe 
    78   flags=O user=vmail argv=/var/www/ispcp/engine/messenger/ispcp-arpl-msgr 
     78  flags=O user={ARPL_USER}:{ARPL_GROUP} argv={ARPL_PATH} 
    7979 
    8080# TLS - Activate, if TLS is avaiable/used 
  • trunk/docs/Debian/INSTALL

    r3733 r3871  
    1818--------------- 
    1919ispCP ω Version:        1.1.0 
    20 INSTALL Script:         2.8 
     20INSTALL Script:         2.9 
    2121Maintainer:                     Benedikt Heintel 
    2222Homepage:                       http://www.isp-contol.net 
     
    3535All Lenny required packages are listed in ./docs/Debian/debian-packages-lenny 
    3636All Squeeze required packages are listed in ./docs/Debian/debian-packages-squeeze 
     37All Wheezy required packages are listed in ./docs/Debian/debian-packages-wheezy 
    3738 
    3839================================================================================ 
     
    7677        deb     http://security.debian.org/     squeeze/updates main contrib non-free 
    7778 
     79   Wheezy: 
     80        deb     http://ftp.debian.org/debian/   wheezy  main contrib non-free 
     81        deb     http://security.debian.org/     wheezy/updates main contrib non-free 
     82 
    7883   Install all required packages: 
    7984 
     
    143148        deb     http://ftp.debian.org/debian/   squeeze main contrib non-free 
    144149        deb     http://security.debian.org/     squeeze/updates main contrib non-free 
     150 
     151   Wheezy: 
     152        deb     http://ftp.debian.org/debian/   wheezy  main contrib non-free 
     153        deb     http://security.debian.org/     wheezy/updates main contrib non-free 
    145154 
    146155   Install all required packages: 
  • trunk/docs/Debian/debian-packages-wheezy

    r3279 r3871  
    4545libnet-netmask-perl 
    4646libnet-smtp-server-perl 
    47 libperl5.10 
     47libperl5.12 
    4848libsasl2-2 
    4949libsasl2-modules 
  • trunk/engine/ispcp-als-mngr

    r3762 r3871  
    18061806 
    18071807        $rs = sys_command("$main::cfg{'CMD_CP'} -p " . 
    1808                 "$root_dir/gui/errordocs/inc/error_top.jpg $www_dir/$als_name/errors/inc/"); 
    1809         return $rs if ($rs != 0); 
    1810  
    1811         $rs = sys_command("$main::cfg{'CMD_CP'} -p " . 
    18121808                "$root_dir/gui/errordocs/inc/errordocs.js $www_dir/$als_name/errors/inc/"); 
    18131809        return $rs if ($rs != 0); 
     
    18151811        $rs = sys_command("$main::cfg{'CMD_CP'} -p " . 
    18161812                "$root_dir/gui/errordocs/inc/errordocs.css $www_dir/$als_name/errors/inc/"); 
    1817         return $rs if ($rs != 0); 
    1818  
    1819         $rs = setfmode( 
    1820                 "$www_dir/$als_name/errors/inc/error_top.jpg", 
    1821                 $sys_user, 
    1822                 $sys_group, 
    1823                 0644 
    1824         ); 
    18251813        return $rs if ($rs != 0); 
    18261814 
  • trunk/engine/ispcp_common_code.pl

    r3845 r3871  
    4545                File::Temp => 'qw(tempdir)', 
    4646                File::Copy::Recursive => 'qw(rcopy)', 
    47                 Net::LibIDN => 'qw/idn_to_ascii idn_to_unicode/' 
     47                Net::LibIDN => 'qw(idn_to_ascii idn_to_unicode)' 
    4848        ); 
    4949 
     
    126126 
    127127        map {s/'/\\'/g, chop} 
    128                 my $db_pass_key = gen_sys_rand_num(32), 
    129                 my $db_pass_iv = gen_sys_rand_num(8); 
     128                my $db_pass_key = gen_sys_rand_num(32, ''), 
     129                my $db_pass_iv = gen_sys_rand_num(8, ''); 
    130130 
    131131        $main::db_pass_key = $db_pass_key; 
  • trunk/engine/ispcp_common_methods.pl

    r3845 r3871  
    11#!/usr/bin/perl 
    22 
    3 # ispCP ω (OMEGA) a Virtual Hosting Control Panel 
    4 # Copyright (C) 2001-2006 by moleSoftware GmbH - http://www.molesoftware.com 
    5 # Copyright (C) 2006-2011 by ispCP | http://ispcp.net 
    6 # 
    7 # Version: $Id$ 
    8 # 
    9 # The contents of this file are subject to the Mozilla Public License 
    10 # Version 1.1 (the "License"); you may not use this file except in 
    11 # compliance with the License. You may obtain a copy of the License at 
    12 # http://www.mozilla.org/MPL/ 
    13 # 
    14 # Software distributed under the License is distributed on an "AS IS" 
    15 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 
    16 # License for the specific language governing rights and limitations 
    17 # under the License. 
    18 # 
    19 # The Original Code is "VHCS - Virtual Hosting Control System". 
    20 # 
    21 # The Initial Developer of the Original Code is moleSoftware GmbH. 
    22 # Portions created by Initial Developer are Copyright (C) 2001-2006 
    23 # by moleSoftware GmbH. All Rights Reserved. 
    24 # Portions created by the ispCP Team are Copyright (C) 2006-2011 by 
    25 # isp Control Panel. All Rights Reserved. 
     3=head1 NAME 
     4 
     5isPCP Common Methods 
     6 
     7=head1 DESCRIPTION 
     8 
     9This file contains common methods widely used in ispCP Engine files 
     10 
     11=head1 COPYRIGHT 
     12 
     13ispCP ω (OMEGA) a Virtual Hosting Control Panel 
     14Copyright (C) 2001-2006 by moleSoftware GmbH - L<http://www.molesoftware.com> 
     15Copyright (C) 2006-2011 by ispCP | L<http://ispcp.net> 
     16 
     17=head1 VERSION 
     18 
     19Version: $Id$ 
     20 
     21=head1 LICENSE 
     22 
     23The contents of this file are subject to the Mozilla Public License 
     24Version 1.1 (the "License"); you may not use this file except in 
     25compliance with the License. You may obtain a copy of the License at 
     26L<http://www.mozilla.org/MPL/> 
     27 
     28Software distributed under the License is distributed on an "AS IS" 
     29basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 
     30License for the specific language governing rights and limitations 
     31under the License. 
     32 
     33The Original Code is "VHCS - Virtual Hosting Control System". 
     34 
     35The Initial Developer of the Original Code is moleSoftware GmbH. 
     36Portions created by Initial Developer are Copyright (C) 2001-2006 
     37by moleSoftware GmbH. All Rights Reserved. 
     38Portions created by the ispCP Team are Copyright (C) 2006-2011 by 
     39isp Control Panel. All Rights Reserved. 
     40 
     41=cut 
    2642 
    2743# Hide the "used only once: possible typo" warnings 
     
    917933} 
    918934 
    919 sub gen_sys_rand_num { 
    920  
    921         push_el(\@main::el, 'gen_sys_rand_num()', 'Starting...'); 
    922  
    923         my ($len) = @_; 
     935=head2 generateRandomChars(length, exclude) 
     936 
     937Generates a random string with specified length generated by the pseudo number generator. 
     938 
     939=item length 
     940 
     941Length of random string. 
     942 
     943=item exclude 
     944 
     945List of values to be excluded. 
     946 
     947=cut 
     948 
     949sub generateRandomChars { 
     950 
     951        push_el(\@main::el, 'generateRandomChars()', 'Starting...'); 
     952 
     953        my ($len, $exclude) = @_; 
    924954 
    925955        if (!defined $len || $len eq '') { 
    926956                push_el( 
    927                         \@main::el, 'gen_sys_rand_num()', 
     957                        \@main::el, 'generateRandomChars()', 
    928958                        "[ERROR] Undefined input data, len: |$len| !" 
    929959                ); 
    930960 
    931961                return (-1, ''); 
     962        } 
     963 
     964        if (0 >= $len ) { 
     965                push_el( 
     966                        \@main::el, 'generateRandomChars()', 
     967                        "[ERROR] Input data length '$len' is zero or negative !" 
     968                ); 
     969 
     970                return (-1, ''); 
     971        } 
     972 
     973        if (!defined $exclude) { 
     974        $exclude = ''; 
     975    } else { 
     976        my @excludeList = split('', $exclude); 
    932977    } 
    933  
    934         if (0 >= $len ) { 
    935                 push_el( 
    936                         \@main::el, 'gen_sys_rand_num()', 
    937                         "[ERROR] Input data length '$len' is zero or negative !" 
    938                 ); 
    939  
    940                 return (-1, ''); 
    941         } 
    942978 
    943979        my $pool_size = 0; 
     
    950986                if ($pool_size <= ($len + 10)) { 
    951987                        push_el( 
    952                                 \@main::el, 'gen_sys_rand_num()', 
     988                                \@main::el, 'generateRandomChars()', 
    953989                                "[WARNING] entropy pool is $pool_size, but we require more or less $len" 
    954990                        ); 
     
    958994        if (-e '/dev/urandom') { 
    959995                push_el( 
    960                         \@main::el, 'gen_sys_rand_num()', 
     996                        \@main::el, 'generateRandomChars()', 
    961997                        "[NOTICE] seeding the entropy pool (possible current size: $pool_size)" 
    962998                ); 
     
    9851021 
    9861022                push_el( 
    987                         \@main::el, 'gen_sys_rand_num()', 
     1023                        \@main::el, 'generateRandomChars()', 
    9881024                        "[NOTICE] new entropy pool size is $pool_size" 
    9891025                ); 
     
    10011037                if (!defined $rs) { 
    10021038                        push_el( 
    1003                                 \@main::el, 'gen_sys_rand_num()', 
     1039                                \@main::el, 'generateRandomChars()', 
    10041040                                "[ERROR] Couldn't open the pseudo-random characters generator: $!" 
    10051041                        ); 
     
    10091045        } 
    10101046 
    1011         my ($i, $rdata, $rc, $rci) = (0, undef, undef, undef); 
     1047        my ($i, $rdata, $rc, $asciiValue) = (0, undef, undef, undef); 
    10121048 
    10131049        while ($i <= $len) { 
    10141050 
    10151051                read(F, $rc, 1); 
    1016                 $rci = ord($rc); 
    1017  
    1018                 # Excludes all chars below Space (incl.) and bove }, 
    1019                 # the escape char (\) and the ' 
    1020                 next if ($rci <= 32 || $rci >= 126 || $rci == 92 || $rci == 39); 
     1052                $asciiValue = ord($rc); 
     1053 
     1054        # Test all chars from the $exclude list 
     1055                foreach (@excludeList) { 
     1056                    if (ord($_) == ord($rc)) { 
     1057                # Set ASCII value to a disallowed value 
     1058                        $asciiValue = 0; 
     1059                    } 
     1060                } 
     1061                # Excludes all chars below Space (incl.) and above ~, the escape char (\) and the ' 
     1062                next if ($asciiValue <= 32 || $asciiValue >= 126 || $asciiValue == 92 || $asciiValue == 39); 
    10211063 
    10221064                $rdata .= $rc; 
     
    10271069        close(F); 
    10281070 
    1029         push_el(\@main::el, 'gen_sys_rand_num()', 'Ending...'); 
     1071        push_el(\@main::el, 'generateRandomChars()', 'Ending...'); 
    10301072 
    10311073        return (0, $rdata); 
  • trunk/engine/setup/ispcp-setup

    r3845 r3871  
    226226                } else { 
    227227                        $cmd = "$main::cfg{'CMD_USERADD'} -c vmail-user -g $gid -s " . 
    228                         "/bin/false $fuid"; 
     228                        "/bin/false -r $fuid"; 
    229229                } 
    230230 
  • trunk/engine/setup/ispcp-setup-methods.pl

    r3852 r3871  
    310310 
    311311        if (!defined $pass1  || $pass1 eq '') { 
    312                 $dbPassword = gen_sys_rand_num(18); 
    313                 $dbPassword =~ s/('|"|`|#|;)//g; 
     312                $dbPassword = generateRandomChars(18, '\'"`#; '); 
    314313                $main::ua{'db_ftp_password'} = $dbPassword; 
    315314                printNotice($dbPassword); 
     
    556555 
    557556        if (!defined $pass1 || $pass1 eq '') { 
    558                 my $dbPassword = gen_sys_rand_num(18); 
    559                 $dbPassword =~ s/('|"|`|#|;)//g; 
     557                my $dbPassword = generateRandomChars(18, '\'"`#; '); 
    560558                $main::ua{'db_pma_password'} = $dbPassword; 
    561559                printNotice($dbPassword); 
     
    21922190        # master.cf 
    21932191 
     2192        # Loading the template from /etc/ispcp/postfix/ 
     2193        ($rs, $cfgTpl) = get_file("$cfgDir/master.cf"); 
     2194        return $rs if ($rs != 0); 
     2195 
     2196        # Building the file 
     2197        ($rs, $$cfg) = prep_tpl( 
     2198                { 
     2199                        '{ARPL_USER}'   => $main::cfg{'MTA_MAILBOX_UID_NAME'}, 
     2200                        '{ARPL_GROUP}'  => $main::cfg{'MTA_MAILBOX_GID_NAME'}, 
     2201                        '{ARPL_PATH}'   => $main::cfg{'ROOT_DIR'}."/engine/messenger/ispcp-arpl-msgr", 
     2202                }, 
     2203                $cfgTpl 
     2204        ); 
     2205        return $rs if ($rs != 0); 
     2206 
    21942207        # Storing the new file in the working directory 
    2195         $rs = sys_command("$main::cfg{'CMD_CP'} -pf $cfgDir/master.cf $wrkDir/"); 
     2208        $rs = store_file( 
     2209                "$wrkDir/master.cf", $$cfg, $main::cfg{'ROOT_USER'}, 
     2210                $main::cfg{'ROOT_GROUP'}, 0644 
     2211        ); 
    21962212        return $rs if ($rs != 0); 
    21972213 
     
    29552971        # Getting blowfish secret 
    29562972        if(!defined $blowfishSecret) { 
    2957                 $blowfishSecret = gen_sys_rand_num(31); 
     2973                $blowfishSecret = generateRandomChars(31, ''); 
    29582974                $blowfishSecret =~ s/'/\\'/gi; 
    29592975        } 
  • trunk/gui/admin/settings_ports.php

    r3846 r3871  
    320320 * @since 1.0.7 
    321321 * @author Laurent declercq (nuxwin) <laurent.declercq@ispcp.net> 
    322  * @param ispCP_TemplateEngine $tpl Reference to a pTemplate instance 
     322 * @param ispCP_TemplateEngine $tpl Reference to a template instance 
    323323 * @return void; 
    324324 */ 
  • trunk/gui/client/dns_edit.php

    r3846 r3871  
    2727 
    2828require_once '../include/ispcp-lib.php'; 
    29 require_once '../include/Net_DNS/DNS.php'; 
     29require_once '../include/Net/DNS/DNS.php'; 
    3030 
    3131check_login(__FILE__); 
  • trunk/gui/client/language.php

    r3868 r3871  
    4040if (isset($_POST['uaction']) && $_POST['uaction'] === 'save_lang') { 
    4141        $user_id = $_SESSION['user_id']; 
    42         $user_lang = $_POST['def_language']; 
     42        $user_lang = clean_input($_POST['def_language']); 
    4343        $query = " 
    4444                UPDATE 
     
    5151 
    5252        exec_query($sql, $query, array($user_lang, $user_id)); 
    53         unset($_SESSION['user_def_lang']); 
    54         $_SESSION['user_def_lang'] = $user_lang; 
     53 
     54        if(!isset($_SESSION['logged_from_id'])) { 
     55                unset($_SESSION['user_def_lang']); 
     56                $_SESSION['user_def_lang'] = $user_lang; 
     57        } 
     58 
    5559        set_page_message(tr('User language updated successfully!'), 'success'); 
    5660} 
  • trunk/gui/client/mail_accounts.php

    r3852 r3871  
    106106 * Must be documented 
    107107 * 
    108  * @param ispCP_TemplateEngine $tpl pTemplate instance 
     108 * @param ispCP_TemplateEngine $tpl template instance 
    109109 * @param int $mail_id 
    110110 * @param string $mail_type 
     
    165165 * Must be documented 
    166166 * 
    167  * @param ispCP_TemplateEngine $tpl reference to pTemplate object 
     167 * @param ispCP_TemplateEngine $tpl reference to template object 
    168168 * @param ispCP_Database $sql reference to ispcp_Database object 
    169169 * @param int $dmn_id domain name id 
     
    376376 * Must be documented 
    377377 * 
    378  * @param ispCP_TemplateEngine $tpl reference to the pTemplate object 
     378 * @param ispCP_TemplateEngine $tpl reference to the template object 
    379379 * @param ispCP_Database $sql reference to the ispCP_Database object 
    380380 * @param int $dmn_id domain name id 
     
    486486 * Must be documented 
    487487 * 
    488  * @param ispCP_TemplateEngine $tpl reference to pTemplate object 
     488 * @param ispCP_TemplateEngine $tpl reference to template object 
    489489 * @param ispCP_Database $sql reference to the ispCP_Database object 
    490490 * @param int $dmn_id domain name id; 
     
    593593 * Must be documented 
    594594 * 
    595  * @param ispCP_TemplateEngine $tpl Reference to the pTemplate object 
     595 * @param ispCP_TemplateEngine $tpl Reference to the template object 
    596596 * @param ispCP_Database $sql Reference to the ispCP_Database object 
    597597 * @param int $user_id Customer id 
  • trunk/gui/client/protected_areas_add.php

    r3846 r3871  
    209209 
    210210/** 
    211  * @param ispCP_pTemplate $tpl 
     211 * @param ispCP_TemplateEngine $tpl 
    212212 * @param ispCP_Database $sql 
    213213 * @param int $dmn_id 
  • trunk/gui/client/protected_user_assign.php

    r3846 r3871  
    7272 
    7373/** 
    74  * @param ispCP_pTemplate $tpl 
     74 * @param ispCP_TemplateEngine $tpl 
    7575 * @param ispCP_Database $sql 
    7676 * @param int $dmn_id 
  • trunk/gui/include/admin-functions.php

    r3841 r3871  
    342342 
    343343/** 
    344  * @param ispCP_pTemplate $tpl 
     344 * @param ispCP_TemplateEngine $tpl 
    345345 * @param ispCP_Database $sql 
    346346 * @return void 
     
    439439 
    440440/** 
    441  * @param ispCP_pTemplate $tpl 
     441 * @param ispCP_TemplateEngine $tpl 
    442442 * @param ispCP_Database $sql 
    443443 */ 
     
    531531 
    532532/** 
    533  * @param ispCP_pTemplate $tpl 
     533 * @param ispCP_TemplateEngine $tpl 
    534534 * @param ispCP_Database $sql 
    535535 */ 
     
    786786 
    787787/** 
    788  * @param ispCP_pTemplate $tpl 
     788 * @param ispCP_TemplateEngine $tpl 
    789789 * @param ispCP_Database $sql 
    790790 */ 
     
    24362436 * @todo use template(s) instead of hardcoded (X)HTML 
    24372437 * @todo possible SESSION hijackin for $_SESSION['user_theme'] 
    2438  * @param ispCP_pTemplate $tpl 
     2438 * @param ispCP_TemplateEngine $tpl 
    24392439 * @param ispCP_Database $sql 
    24402440 * @param int $user_id 
  • trunk/gui/include/functions.ticket_system.php

    r3841 r3871  
    167167 
    168168        if ($userLevel < 1 || $userLevel > 2) 
    169                 throw new ispCP_Exception("ERROR: User level is not valid!"); 
     169                throw new ispCP_Exception("User level is not valid!"); 
    170170 
    171171        $ticket_date = time(); 
  • trunk/gui/include/ispCP/Database/ResultSet.php

    r3762 r3871  
    7777                if(!($stmt instanceof PDOStatement)) { 
    7878                        throw new ispCP_Exception_Database( 
    79                                 'Error: Argument passed to ' . __METHOD__ . '() must be a ' . 
     79                                'Argument passed to ' . __METHOD__ . '() must be a ' . 
    8080                                        'PDOStatement object!' 
    8181                        ); 
     
    8686 
    8787        /** 
    88          * Php overloading 
    89          * 
    90          * Php overloading method that allows to fetch the first row in the result 
     88         * PHP overloading 
     89         * 
     90         * PHP overloading method that allows to fetch the first row in the result 
    9191         * set or check if one row exist in the result set 
    9292         * 
     
    115115                } 
    116116 
    117                 throw new ispCP_Exception_Database("Error: Unknown parameter: `$param`"); 
     117                throw new ispCP_Exception_Database("Unknown parameter: `$param`"); 
    118118        } 
    119119 
     
    184184         * how the row is returned. 
    185185         * 
    186          * @param int $fetchStyle 
     186         * @param int $fetchStyle Controls how the next row will be returned to the 
     187         * caller. This value must be one of the PDO::FETCH_* constants 
    187188         * @return mixed The return value of this function on success depends on the 
    188189         * fetch style. In all cases, FALSE is returned on failure. 
     
    197198 
    198199        /** 
     200         * Fetches all rows from the current result set 
     201         * 
     202         * Fetches all rows from the result set. The fetch_style parameter 
     203         * determines how the rows are returned. 
     204         * 
     205         * @param int $fetchStyle Controls how the next row will be returned to the 
     206         * caller. This value must be one of the PDO::FETCH_* constants 
     207         * @return mixed The return value of this function on success depends on the 
     208         * fetch style. In all cases, FALSE is returned on failure. 
     209         * @todo Finish fetch style implementation 
     210         */ 
     211        public function fetchAll($fetchStyle = null) { 
     212                 
     213                $fetchStyle = is_null($fetchStyle) ? $this->_fetchMode : $fetchStyle; 
     214 
     215                return $this->_stmt->fetchAll($fetchStyle); 
     216        } 
     217 
     218        /** 
    199219         * Fetches the next row from the current result set 
    200220         * 
  • trunk/gui/include/ispCP/Exception/Writer/Browser.php

    r3825 r3871  
    4444 * 
    4545 * The given template should be a template file that can be treated by a 
    46  * pTemplate object. 
     46 * template object. 
    4747 * 
    4848 * <b>Note:</b> Will be improved later. 
  • trunk/gui/include/ispCP/Initializer.php

    r3857 r3871  
    3939 * @author      Laurent declercq <laurent.declercq@ispcp.net> 
    4040 * @since       1.0.7 
    41  * @version     1.1.2 
     41 * @version     1.1.3 
    4242 */ 
    4343class ispCP_Initializer { 
     
    158158                $this->_setIncludePath(); 
    159159 
    160                 // Create or restore the session 
    161                 $this->_initializeSession(); 
    162  
    163160                // Establish the connection to the database 
    164161                $this->_initializeDatabase(); 
     
    176173                // Initialize output buffering 
    177174                $this->_initializeOutputBuffering(); 
     175 
     176                // Create or restore the session 
     177                $this->_initializeSession(); 
    178178 
    179179                // Initialize internationalization libraries 
     
    354354         */ 
    355355        protected function _initializeSession() { 
     356 
     357        if (!is_writable($this->_config->GUI_ROOT_DIR . '/phptmp')) { 
     358            throw new ispCP_Exception('The directory '. $this->_config->GUI_ROOT_DIR . '/phptmp must be writable.'); 
     359        } 
    356360 
    357361                session_name('ispCP'); 
     
    558562         * execution context are loaded. 
    559563         * 
    560          * <b>Note:</b> Not used at this moment (testing in progress...) 
     564         * <b>Note:</b> Not used at this moment 
    561565         * 
    562566         * @return void 
  • trunk/gui/include/ispCP/Update.php

    r3762 r3871  
    198198                        $sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
    199199 
     200                        // Checks if a database updated previously failed 
    200201                        if(isset($dbConfig->FAILED_UPDATE)) { 
    201202                                list($failedUpdate, $queryNb) = $dbConfig->FAILED_UPDATE; 
    202203                        } else { 
    203204                                $failedUpdate = 'inexistent'; 
     205                                $queryNb = -1; 
    204206                        } 
    205207 
    206                         try { 
    207  
    208                                 // We execute all SQL statements 
    209                                 foreach($queryArray as $index => $query) { 
    210                                         // Query was already applied with success ? 
    211                                         if($functionName == $failedUpdate && $index < $queryNb) { 
    212                                                 continue; 
     208                        // We execute all SQL statements 
     209                        foreach($queryArray as $index => $query) { 
     210 
     211                                // Query was already applied with success ? 
     212                                if ($functionName == $failedUpdate && $index < $queryNb) { 
     213                                        continue; 
     214                                } 
     215 
     216                                try { 
     217                                        $sql->query($query); 
     218                                        unset($dbConfig->FAILED_UPDATE); 
     219 
     220                                        // Update revision 
     221                                        $dbConfig->set($this->_databaseVariableName, $newVersion); 
     222 
     223                                } catch (PDOException $e) { 
     224 
     225                                        // Store the query number and function name that wraps it 
     226                                        $dbConfig->FAILED_UPDATE = "$functionName;$index"; 
     227 
     228                                        // Prepare error message 
     229                                        $errorMessage =  sprintf($this->_errorMessage, $newVersion); 
     230 
     231                                        // Extended error message 
     232                                        if(PHP_SAPI != 'cli') { 
     233                                                $errorMessage .= ':<br /><br />' . $e->getMessage() . 
     234                                                        '<br /><br />Query: ' . trim($query); 
     235                                        } else { 
     236                                                $errorMessage .= ":\n\n" . $e->getMessage() . 
     237                                                        "\nQuery: " . trim($query); 
    213238                                        } 
    214239 
    215                                         $sql->query($query); 
     240                                        $this->_addErrorMessage($errorMessage); 
     241 
     242                                        // An error occurred, we stop here ! 
     243                                        return false; 
    216244                                } 
    217  
    218                                 unset($dbConfig->FAILED_UPDATE); 
    219  
    220                                 // Update revision 
    221                                 $dbConfig->set($this->_databaseVariableName, $newVersion); 
    222  
    223                         } catch (PDOException $e) { 
    224  
    225                                 // Store the query number and function name that wraps it 
    226                                 $dbConfig->FAILED_UPDATE = "$functionName;$index"; 
    227  
    228                                 // Prepare error message 
    229                                 $errorMessage =  sprintf($this->_errorMessage, $newVersion); 
    230  
    231                                 // Extended error message 
    232                                 if(PHP_SAPI != 'cli') { 
    233                                         $errorMessage .= ':<br /><br />' . $e->getMessage() . 
    234                                                 '<br /><br />Query: ' . trim($query); 
    235                                 } else { 
    236                                         $errorMessage .= ":\n\n" . $e->getMessage() . 
    237                                                 "\nQuery: " . trim($query); 
    238                                 } 
    239  
    240                                 $this->_addErrorMessage($errorMessage); 
    241  
    242                                 // An error occurred, we stop here ! 
    243                                 return false; 
    244245                        } 
    245246 
  • trunk/gui/include/ispcp-functions.php

    r3762 r3871  
    389389 
    390390/** 
    391  * Should be documented 
     391 * Decodes a String from IDNA format to UTF8 
    392392 * 
    393393 * @param  $input 
     
    398398        if (function_exists('idn_to_unicode')) { 
    399399                return idn_to_utf8($input, IDNA_USE_STD3_RULES); 
    400         } 
    401  
    402         $IDN = new idna_convert(); 
    403         $output = $IDN->decode($input); 
    404  
    405         return ($output == false) ? $input : $output; 
    406 } 
    407  
    408 /** 
    409  * Should be documented 
     400        } else { 
     401 
     402                $IDNA = new Net_IDNA2(); 
     403                $output = $IDNA->decode($input); 
     404 
     405                return ($output == false) ? $input : $output; 
     406        } 
     407} 
     408 
     409/** 
     410 * Encodes a String from IDNA format ASCII 
    410411 * 
    411412 * @param  $input 
     
    416417        if (function_exists('idn_to_ascii')) { 
    417418                return idn_to_ascii($input); 
    418         } 
    419  
    420         $IDN = new idna_convert(); 
    421         $output = $IDN->encode($input); 
    422  
    423         return $output; 
    424 } 
    425  
    426 /** 
    427  * Should be documented 
     419        } else { 
     420 
     421                $IDNA = new Net_IDNA2(); 
     422                $output = $IDNA->encode($input); 
     423 
     424                return $output; 
     425        } 
     426} 
     427 
     428/** 
     429 * Check wether a given String is a number or not. 
    428430 * 
    429431 * @param $integer Number to be checked 
     
    431433 */ 
    432434function is_number($number) { 
    433  
    434435        return (bool) preg_match('/^[0-9]+$/D', $number); 
    435436} 
  • trunk/gui/include/ispcp-lib.php

    r3775 r3871  
    100100 * Include ispCP common functions 
    101101 */ 
    102 require_once 'net_idna/idna_convert.class.php'; 
     102require_once 'Net/IDNA2.php'; 
    103103require_once INCLUDEPATH . '/ispcp-functions.php'; 
    104104 
  • trunk/gui/include/login-functions.php

    r3762 r3871  
    365365 
    366366        deny_access(); 
    367         return true; 
     367        return; 
    368368} 
    369369 
     
    571571 
    572572        deny_access(); 
     573    return; 
    573574} 
    574575 
  • trunk/gui/lostpassword.php

    r3775 r3871  
    4141// check if GD library is available 
    4242if (!check_gd()) { 
    43         throw new ispCP_Exception(tr("ERROR: php-extension 'gd' not loaded!")); 
     43        throw new ispCP_Exception(tr("PHP Extension 'gd' not loaded!")); 
    4444} 
    4545 
    4646// check if captch fonts exist 
    4747if (!captcha_fontfile_exists()) { 
    48         throw new ispCP_Exception(tr("ERROR: captcha fontfile not found!")); 
     48        throw new ispCP_Exception(tr("Captcha fontfile not found!")); 
    4949} 
    5050 
  • trunk/gui/orderpanel/package_info.php

    r3841 r3871  
    6363 
    6464/** 
    65  * @param ispCP_pTemplate $tpl 
     65 * @param ispCP_TemplateEngine $tpl 
    6666 * @param ispCP_Database $sql 
    6767 * @param int $user_id 
  • trunk/gui/reseller/language.php

    r3868 r3871  
    4747        $user_id = $_SESSION['user_id']; 
    4848 
    49         $user_lang = $_POST['def_language']; 
     49        $user_lang = clean_input($_POST['def_language']); 
    5050 
    5151        $query = " 
     
    6060        exec_query($sql, $query, array($user_lang, $user_id)); 
    6161 
    62         unset($_SESSION['user_def_lang']); 
    63         $_SESSION['user_def_lang'] = $user_lang; 
     62        if(!isset($_SESSION['logged_from_id'])) { 
     63                unset($_SESSION['user_def_lang']); 
     64                $_SESSION['user_def_lang'] = $user_lang; 
     65        } 
    6466        set_page_message(tr('User language updated successfully!'), 'success'); 
    6567} 
Note: See TracChangeset for help on using the changeset viewer.