[-] BO : fixed #PSFV-727 (issue #4)

This commit is contained in:
lLefevre
2012-04-05 10:06:17 +00:00
parent 9663b86ee2
commit 336c0f4d7f
6 changed files with 3820 additions and 4195 deletions
@@ -81,9 +81,9 @@
<p><span>{l s='For security reasons, you cannot connect to the Back Office until after you have:'}<br /><br />
<ul>
<li>{l s='deleted the /install folder'}</li>
<li>{l s='renamed the /admin folder (e.g. /admin123)'}{$randomNb}</li>
<li>{l s='renamed the /admin folder (e.g. /admin123%d)' sprintf=$randomNb}</li>
</ul>
<br />{l s='Please then access this page by the new URL (e.g. http://www.yoursite.com/admin123)'}{$randomNb}</span></p>
<br />{l s='Please then access this page by the new URL (e.g. http://www.yoursite.com/admin123%d)' sprintf=$randomNb}</span></p>
</div>
{/if}
<div id="forgot_password" style="display:none">
+10 -1
View File
@@ -39,7 +39,7 @@ class TranslateCore
* @param bool $htmlentities
* @return string
*/
public static function getAdminTranslation($string, $class = 'AdminTab', $addslashes = false, $htmlentities = true)
public static function getAdminTranslation($string, $class = 'AdminTab', $addslashes = false, $htmlentities = true, $sprintf = false)
{
static $modules_tabs = null;
@@ -73,6 +73,15 @@ class TranslateCore
$str = Translate::getGenericAdminTranslation($string, $key, $_LANGADM);
$str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str;
if ($sprintf)
{
if (!is_array($sprintf))
$sprintf = array($sprintf);
$str = vsprintf($str, $sprintf);
}
return str_replace('"', '&quot;', ($addslashes ? addslashes($str) : stripslashes($str)));
}
+5 -4
View File
@@ -31,11 +31,12 @@ $smarty->debugging_ctrl = 'NONE';
function smartyTranslate($params, &$smarty)
{
$htmlentities = !isset($params['js']);
$pdf = isset($params['pdf']);
$pdf = isset($params['pdf']);
$addslashes = isset($params['slashes']);
$sprintf = isset($params['sprintf']) ? $params['sprintf'] : false;
if ($pdf)
return Translate::getPdfTranslation($params['s']);
if ($pdf)
return Translate::getPdfTranslation($params['s']);
$filename = ((!isset($smarty->compiler_object) || !is_object($smarty->compiler_object->template)) ? $smarty->template_resource : $smarty->compiler_object->template->getTemplateFilepath());
@@ -64,5 +65,5 @@ function smartyTranslate($params, &$smarty)
$class = null;
}
return Translate::getAdminTranslation($params['s'], $class, $addslashes, $htmlentities);
return Translate::getAdminTranslation($params['s'], $class, $addslashes, $htmlentities, $sprintf);
}
@@ -54,7 +54,7 @@ class AdminTranslationsControllerCore extends AdminController
include_once(_PS_ADMIN_DIR_.'/../tools/tar/Archive_Tar.php');
include_once(_PS_ADMIN_DIR_.'/../tools/pear/PEAR.php');
self::$tpl_regexp = '/\{l s=\''._PS_TRANS_PATTERN_.'\'( mod=\'.+\')?( js=1)?\}/U';
self::$tpl_regexp = '/\{l s=\''._PS_TRANS_PATTERN_.'\'( sprintf=.*)?( mod=\'.+\')?( js=1)?\}/U';
// added ? after spaces because some peoples forget them. see PSCFI-2501
self::$php_regexp = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
}
@@ -923,7 +923,7 @@ class AdminTranslationsControllerCore extends AdminController
$content = fread($fd, filesize($tpl));
/* Search language tags (eg {l s='to translate'}) */
$regex = '/\{l s=\''._PS_TRANS_PATTERN_.'\'( js=1)?\}/U';
$regex = '/\{l s=\''._PS_TRANS_PATTERN_.'\'( sprintf=.*)?( js=1)?\}/U';
preg_match_all($regex, $content, $matches);
/* Get string translation */
@@ -1112,7 +1112,7 @@ class AdminTranslationsControllerCore extends AdminController
$content = fread($fd, filesize($tpl));
/* Search language tags (eg {l s='to translate'}) */
$regex = '/\{l s=\''._PS_TRANS_PATTERN_.'\'( js=1)?( slashes=1)?\}/U';
$regex = '/\{l s=\''._PS_TRANS_PATTERN_.'\'( sprintf=.*)?( js=1)?( slashes=1)?\}/U';
preg_match_all($regex, $content, $matches);
/* Get string translation for each tpl file */
@@ -1950,7 +1950,7 @@ class AdminTranslationsControllerCore extends AdminController
// parse pdf template
/* Search language tags (eg {l s='to translate'}) */
$regex = '/\{l s=\''._PS_TRANS_PATTERN_.'\'( js=1)?( pdf=\'true\')?\}/U';
$regex = '/\{l s=\''._PS_TRANS_PATTERN_.'\'( sprintf=.*)?( js=1)?( pdf=\'true\')?\}/U';
$default_template_files = glob(_PS_PDF_DIR_.'*.tpl');
$override_template_files = glob(_PS_THEME_DIR_.'pdf/*.tpl');
+3797 -4182
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1734,17 +1734,17 @@ $_LANGADM['AdminLocalizationdfcfc43722eef1eab1e4a12e50a068b1'] = 'Devises';
$_LANGADM['AdminLocalizatione657649e06a7d29f40d6c21902be2478'] = 'Devise par défaut utilisée dans la boutique';
$_LANGADM['AdminLocalizationeedffe39822101d8aaeaf3b1a1661926'] = 'Contenu à importer :';
$_LANGADM['AdminLocalizationf45093072dc38d0cf37441ea63e2ad68'] = 'Unité de mesure :';
$_LANGADM['AdminLogin006ea065dd9ea34bf67b915ec0992c9d'] = 'Veuillez alors accéder à la page par la nouvelle URL, par exemple http://www.domaine.fr/admin';
$_LANGADM['AdminLogin01a569ddc6cf67ddec2a683f0a5f5956'] = 'Mot de passe oublié ?';
$_LANGADM['AdminLogin0206fb59f6e0cd0d3d271b58e9109dca'] = 'Mot de passe perdu ?';
$_LANGADM['AdminLogin07213a0161f52846ab198be103b5ab43'] = 'erreurs';
$_LANGADM['AdminLogin1275ef322ce3f7031bda58ed008bef45'] = 'renommé le dossier /admin';
$_LANGADM['AdminLogin345d82a66ff0b2acff929bbab85ed936'] = 'renommé le dossier /admin (ex : /admin123%d)';
$_LANGADM['AdminLogin34bdd7b9823059fa742afab7be9d4c58'] = 'Votre mot de passe vous a été envoyé par e-mail';
$_LANGADM['AdminLogin362b56674d07160fab60725a927bbf13'] = 'supprimé le dossier /install';
$_LANGADM['AdminLogin463e58c1d35fb5a4a8d717c99a60d257'] = 'Retour à la connexion';
$_LANGADM['AdminLogin485f5be5d5e3cd5d46ab3cd3792765c8'] = 'Veuillez saisir l\'adresse e-mail indiquée à lors de votre inscription afin de recevoir vos codes d\'accès par e-mail.';
$_LANGADM['AdminLogin4ce81305b7edb043d0a7a5c75cab17d0'] = 'Il y a';
$_LANGADM['AdminLogin6357d3551190ec7e79371a8570121d3a'] = 'Il y a';
$_LANGADM['AdminLogin69f4ac57f3127f55fffc6a5e65fd2a21'] = 'Veuillez alors accéder à la page par la nouvelle URL, par exemple http://www.domaine.fr/admin123%d';
$_LANGADM['AdminLogin78e365acb087fd1f8d494dae0001de10'] = 'Adresse e-mail :';
$_LANGADM['AdminLogin94966d90747b97d1f0f206c98a8b1ac3'] = 'Envoyer';
$_LANGADM['AdminLoginafbbe4ce0486fac5cfb8685e4fcb2b8a'] = 'Pour des raisons de sécurité, vous ne pouvez pas vous connecter tant que vous n\'avez pas :';