Changeset 660
- 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
| r659 |
r660 |
|
| 10 | 10 | | * gui: disable stats-alias in client menu | |
|---|
| 11 | 11 | \_________________________________________________________________/ |
|---|
| | 12 | |
|---|
| | 13 | 2007-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 |
|---|
| 12 | 21 | |
|---|
| 13 | 22 | 2007-06-17 Raphael Geissert |
|---|
| r653 |
r660 |
|
| 34 | 34 | libnet-dns-perl |
|---|
| 35 | 35 | libnet-netmask-perl |
|---|
| 36 | | libnet-perl |
|---|
| 37 | 36 | libnet-smtp-server-perl |
|---|
| 38 | 37 | libperl5.8 |
|---|
| r659 |
r660 |
|
| 1665 | 1665 | { |
|---|
| 1666 | 1666 | 'key' => $main::db_pass_key, |
|---|
| 1667 | | 'keysize' => 32, |
|---|
| | 1667 | 'keysize' => 32, |
|---|
| 1668 | 1668 | 'cipher' => 'Blowfish', |
|---|
| 1669 | 1669 | 'iv' => $main::db_pass_iv, |
|---|
| r645 |
r660 |
|
| 462 | 462 | 'TR_TOTAL_MAIL_ACCOUNTS' => tr('Mails total'), |
|---|
| 463 | 463 | '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), |
|---|
| 465 | 465 | ) |
|---|
| 466 | 466 | ); |
|---|
| r645 |
r660 |
|
| 63 | 63 | $tpl -> assign('ACTION_LINK', ''); |
|---|
| 64 | 64 | $tpl -> assign( array( |
|---|
| 65 | | 'ACTION' => tr(''), |
|---|
| | 65 | 'ACTION' => '', |
|---|
| 66 | 66 | 'ICON' => "parent", |
|---|
| 67 | 67 | 'DIR_NAME' => tr('Parent Directory'), |
|---|
| r617 |
r660 |
|
| 30 | 30 | * @return translated or original string |
|---|
| 31 | 31 | **/ |
|---|
| 32 | | function tr($msgid, $js = false) { |
|---|
| 33 | | global $sql, $default_lang, $cfg; |
|---|
| | 32 | function tr($msgid, $as_is = false) { |
|---|
| | 33 | global $sql, $default_lang, $cfg; |
|---|
| | 34 | static $cache; |
|---|
| 34 | 35 | |
|---|
| 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'; |
|---|
| 36 | 38 | |
|---|
| 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; |
|---|
| 43 | 43 | |
|---|
| 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';"); |
|---|
| 47 | 49 | |
|---|
| 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; |
|---|
| 62 | 78 | } |
|---|
| 63 | 79 | |
|---|
| … | … | |
| 75 | 91 | function replace_html($string) { |
|---|
| 76 | 92 | |
|---|
| 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 | ); |
|---|
| 84 | 100 | |
|---|
| 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 | ); |
|---|
| 92 | 108 | |
|---|
| 93 | 109 | $string = preg_replace($pattern, $replacement, $string); |
|---|
| r657 |
r660 |
|
| 354 | 354 | while (!$rs -> EOF) { |
|---|
| 355 | 355 | |
|---|
| 356 | | |
|---|
| 357 | | |
|---|
| 358 | 356 | if ($rs -> fields['domain_status'] == $cfg['ITEM_OK_STATUS']){ |
|---|
| 359 | 357 | |
|---|
| r655 |
r660 |
|
| 219 | 219 | <tr> |
|---|
| 220 | 220 | <td width="25" align="center"> </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> |
|---|
| 222 | 222 | <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> |
|---|
| 223 | 223 | <td class="{USR_CLASS}" align="center">{USER_CREATED_ON}</td> |
|---|
| r655 |
r660 |
|
| 115 | 115 | <tr> |
|---|
| 116 | 116 | <td align="center"> </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> |
|---|
| 118 | 118 | <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> |
|---|
| 119 | 119 | <td class="{CLASS_TYPE_ROW}" width="90" align="center">{CREATION_DATE}</td> |
|---|
| r659 |
r660 |
|
| 1 | 1 | #!/usr/bin/perl |
|---|
| 2 | | |
|---|
| 3 | | use FindBin; |
|---|
| 4 | | |
|---|
| 5 | | use lib "$FindBin::Bin/../engine"; |
|---|
| 6 | | require 'ispcp_common_code.pl'; |
|---|
| 7 | 2 | |
|---|
| 8 | 3 | use strict; |
|---|
| … | … | |
| 61 | 56 | |
|---|
| 62 | 57 | return $rs if ($rs != 0); |
|---|
| | 58 | |
|---|
| | 59 | |
|---|
| | 60 | sub 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 | } |
|---|
|