Changeset 660

Show
Ignore:
Timestamp:
06/19/07 00:29:52 (1 year ago)
Author:
raphael
Message:

Fixed #407: Initialization vector must be exactly 8 bytes long when using the Blowfish cipher
Removed libnet-perl from Ubuntu fesity's packages list
Fixed #408: Typo in i18n.php and object to string conversion
Improved tr() function

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CHANGELOG

    r659 r660  
    1010|               * gui: disable stats-alias in client menu         | 
    1111\_________________________________________________________________/ 
     12 
     132007-06-18 Raphael Geissert 
     14        - INSTALLATION: 
     15                * Fixed #407: Initialization vector must be exactly 8 bytes long when using the Blowfish cipher 
     16        - DOCS: 
     17                * Removed libnet-perl from Ubuntu fesity's packages list 
     18        - GUI: 
     19                * Fixed #408: Typo in i18n.php and object to string conversion 
     20                * Improved tr() function 
    1221 
    13222007-06-17 Raphael Geissert 
  • trunk/docs/Ubuntu/ubuntu-packages-feisty

    r653 r660  
    3434libnet-dns-perl 
    3535libnet-netmask-perl 
    36 libnet-perl 
    3736libnet-smtp-server-perl 
    3837libperl5.8 
  • trunk/engine/ispcp_common_code.pl

    r659 r660  
    16651665                                    { 
    16661666                                        'key'             => $main::db_pass_key, 
    1667                                                                                'keysize'                => 32, 
     1667                                        'keysize'       => 32, 
    16681668                                        'cipher'          => 'Blowfish', 
    16691669                                        'iv'              => $main::db_pass_iv, 
  • trunk/gui/client/email_accounts.php

    r645 r660  
    462462                        'TR_TOTAL_MAIL_ACCOUNTS' => tr('Mails total'), 
    463463                        'TR_DELETE' => tr('Delete'), 
    464                                                 'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete', 1), 
     464                                                'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete', true), 
    465465                     ) 
    466466              ); 
  • trunk/gui/client/ftp_choose_dir.php

    r645 r660  
    6363        $tpl -> assign('ACTION_LINK', ''); 
    6464        $tpl -> assign( array( 
    65                                 'ACTION' => tr('')
     65                                'ACTION' => ''
    6666                                'ICON' => "parent", 
    6767                                'DIR_NAME' => tr('Parent Directory'), 
  • trunk/gui/include/i18n.php

    r617 r660  
    3030 *      @return                                 translated or original string 
    3131 **/ 
    32 function tr($msgid, $js = false) { 
    33         global $sql, $default_lang, $cfg; 
     32function tr($msgid, $as_is = false) { 
     33    global $sql, $default_lang, $cfg; 
     34    static $cache; 
    3435 
    35         $default_lang = (isset($_SESSION['user_def_lang'])) ? $_SESSION['user_def_lang'] : $cfg['USER_INITIAL_LANG']; 
     36    $lang = (isset($_SESSION['user_def_lang'])) ? $_SESSION['user_def_lang'] : $cfg['USER_INITIAL_LANG']; 
     37    $encoding = 'UTF-8'; 
    3638 
    37         if (!$sql) { 
    38                 return ($js ? $msgid : replace_html(htmlentities($msgid, ENT_COMPAT, "UTF-8"))); 
    39         } else { 
    40                 $table          = $default_lang; 
    41                 $encoding       = $sql->Execute("SELECT `msqstr` FROM `$table` WHERE `msgid` = 'encoding';"); 
    42                 $res            = $sql->Execute("SELECT `msgstr` FROM `$table` WHERE `msgid` = '$msgid';"); 
     39    if (isset($cache[$lang][$msgid])) { 
     40        $msgstr = $cache[$lang][$msgid]; 
     41    } else { 
     42        $msgstr = $msgid; 
    4343 
    44                 if (!$encoding) { 
    45                         $encoding = "UTF-8"; 
    46                 } 
     44        if ($sql) { 
     45            if (!$as_is) { 
     46                $encoding = tr('encoding'); 
     47            } 
     48            $msg_res = $sql->Execute("SELECT `msgstr` FROM `$lang` WHERE `msgid` = '$msgid';"); 
    4749 
    48                 if (!$res) { 
    49                         return ($js ? $msgid : replace_html(htmlentities($msgid, ENT_COMPAT, $encoding))); 
    50                 } elseif ($res->RowCount() == 0) { 
    51                         return ($js ? $msgid : replace_html(htmlentities($msgid, ENT_COMPAT, $encoding))); 
    52                 } else { 
    53                         $data = $res->FetchRow(); 
    54                         if ($data['msgstr'] == '') { 
    55                                 return ($js ? $msgid : replace_html(htmlentities($msgid, ENT_COMPAT, $encoding))); 
    56                         } 
    57                         else { 
    58                                 return ($js ? $data['msgstr'] : replace_html(htmlentities($data['msgstr'], ENT_COMPAT, $encoding))); 
    59                         } 
    60                 } 
    61         } 
     50            if ($msg_res && $msg_res->RowCount() > 0) { 
     51                $msg_d = $msg_res->FetchRow(); 
     52                if ($msg_d['msgstr'] != '') { 
     53                    $msgstr = $msg_d['msgstr']; 
     54                } 
     55            } 
     56        } 
     57    } 
     58 
     59    if ($msgid == 'encoding' && $msgstr == $msgid) { 
     60        $msgstr = $encoding; 
     61    } 
     62 
     63    $cache[$lang][$msgid] = $msgstr; 
     64 
     65    // Replace values 
     66    if (func_num_args() > 2) { 
     67        $argv = func_get_args(); 
     68        unset($argv[0]); //msgid 
     69        unset($argv[1]); //as_is 
     70        $msgstr = vsprintf($msgstr, $argv); 
     71    } 
     72 
     73    if (!$as_is) { 
     74        $msgstr = replace_html(htmlentities($msgstr, ENT_COMPAT, $encoding)); 
     75    } 
     76 
     77    return $msgstr; 
    6278} 
    6379 
     
    7591function replace_html($string) { 
    7692 
    77        $pattern = array ( 
    78                                                "=<b>=is"
    79                                                "=</b>=is"
    80                                                "=<i>=is"
    81                                                "=</i>=is"
    82                                                 "=<br>=is" 
    83                                         ); 
     93    $pattern = array ( 
     94                        '=<b>=is'
     95                        '=</b>=is'
     96                        '=<i>=is'
     97                        '=</i>=is'
     98                        '=<br>=is' 
     99                    ); 
    84100 
    85        $replacement = array ( 
    86                                                        "<b>"
    87                                                        "</b>"
    88                                                        "<i>"
    89                                                        "</i>"
    90                                                         "<br />" 
    91                                                 ); 
     101    $replacement = array ( 
     102                            '<b>'
     103                            '</b>'
     104                            '<i>'
     105                            '</i>'
     106                            '<br />' 
     107                        ); 
    92108 
    93109        $string = preg_replace($pattern, $replacement, $string); 
  • trunk/gui/reseller/users.php

    r657 r660  
    354354                while (!$rs -> EOF) { 
    355355 
    356  
    357  
    358356                        if ($rs -> fields['domain_status'] == $cfg['ITEM_OK_STATUS']){ 
    359357 
  • trunk/gui/themes/omega_original/admin/manage_users.tpl

    r655 r660  
    219219        <tr> 
    220220          <td width="25" align="center">&nbsp;</td> 
    221           <td class="{USR_CLASS}" align="center"><a href="#" onClick="action_status('{URL_CHNAGE_STATUS}')" class="link"><img src="{THEME_COLOR_PATH}/images/icons/{STATUS_ICON}" width="18" height="18" border="0" /></a></td> 
     221          <td class="{USR_CLASS}" align="center"><a href="#" onClick="action_status('{URL_CHNAGE_STATUS}')" class="link"><img src="{THEME_COLOR_PATH}/images/icons/{STATUS_ICON}" width="16" height="16" border="0" /></a></td> 
    222222          <td class="{USR_CLASS}"><a href="http://www.{USR_USERNAME}/" target="_blank" class="link"><img src="{THEME_COLOR_PATH}/images/icons/goto.png" width="18" height="18" border="0"/></a><a href="{URL_EDIT_USR}" class="link">{USR_USERNAME} </a> </td> 
    223223          <td class="{USR_CLASS}" align="center">{USER_CREATED_ON}</td> 
  • trunk/gui/themes/omega_original/reseller/users.tpl

    r655 r660  
    115115                      <tr> 
    116116                        <td align="center">&nbsp;</td> 
    117                         <td class="{CLASS_TYPE_ROW}" align="center"><a href="#" onClick="change_status('{URL_CHANGE_STATUS}')"><img src="{THEME_COLOR_PATH}/images/icons/{STATUS_ICON}" width="18" height="18" border="0"></a></td> 
     117                        <td class="{CLASS_TYPE_ROW}" align="center"><a href="#" onClick="change_status('{URL_CHANGE_STATUS}')"><img src="{THEME_COLOR_PATH}/images/icons/{STATUS_ICON}" width="16" height="16" border="0"></a></td> 
    118118                        <td class="{CLASS_TYPE_ROW}"><a href="http://www.{NAME}/" target="_blank" class="link"><img src="{THEME_COLOR_PATH}/images/icons/goto.png" width="18" height="18" border="0"/></a><a href="edit_user.php?edit_id={USER_ID}" class="link">{NAME}</a></td> 
    119119                        <td class="{CLASS_TYPE_ROW}" width="90" align="center">{CREATION_DATE}</td> 
  • trunk/keys/rpl.pl

    r659 r660  
    11#!/usr/bin/perl 
    2  
    3 use FindBin; 
    4  
    5 use lib "$FindBin::Bin/../engine"; 
    6 require 'ispcp_common_code.pl'; 
    72 
    83use strict; 
     
    6156 
    6257return $rs if ($rs != 0); 
     58 
     59 
     60sub gen_sys_rand_num { 
     61 
     62    my ($len) = @_; 
     63 
     64    if (!defined($len) || ($len eq '')) { 
     65 
     66        print STDERR "gen_sys_rand_num() ERROR: Undefined input data, len: |$len| !"; 
     67 
     68        return (-1, ''); 
     69 
     70    } 
     71 
     72    if (0 >= $len ) { 
     73 
     74        print STDERR "gen_sys_rand_num() ERROR: Input data length '$len' is zero or negative !"; 
     75 
     76        return (-1, ''); 
     77 
     78    } 
     79     
     80    my $rs = open(F, '<', '/dev/random'); 
     81 
     82    if (!defined($rs)) { 
     83 
     84        print STDERR "gen_sys_rand_num() ERROR: Couldn't open the pseudo-random characters generator"; 
     85 
     86        return (-1, ''); 
     87     
     88    } 
     89     
     90    my ($i, $rdata, $rc, $rci) = (0, undef, undef, undef); 
     91     
     92    while ($i < $len) { 
     93 
     94        read(F, $rc, 1); 
     95         
     96        $rci = ord($rc); 
     97         
     98        next if ($rci <= 32 || $rci >= 125 || $rci == 92 ); 
     99         
     100        $rdata .= $rc; 
     101        $rc = undef; 
     102        $i++; 
     103 
     104    } 
     105     
     106    close(F); 
     107 
     108    return (0, $rdata); 
     109 
     110}