Changeset 3871 for trunk/gui


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/gui
Files:
5 added
1 deleted
18 edited
1 moved

Legend:

Unmodified
Added
Removed
  • 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.