Michael RICOIS eb4ee2af4a Admin
2017-11-08 16:47:54 +01:00

50 lines
1.6 KiB
PHP

<?php
class AdminGuide extends AdminTab
{
public function display()
{
global $smarty;
if(Configuration::get('PS_REWRITING_SETTINGS')) {
$module_name = Module::getModuleNameFromClass('AdminGuide');
$langs = Language::getLanguages(true);
$urls_i18n = array(
'fr' => 'guide',
'en' => 'guide',
);
$str_rewrite_rules =
"RewriteRule ^guide$ ".__PS_BASE_URI__."modules/purchaseguide/rubrique.php [QSA,L]". "\n" .
"RewriteRule ^guide/([0-9]+)\-([a-zA-Z0-9-]*)$ ".__PS_BASE_URI__."modules/purchaseguide/rubrique.php?cid=$1 [QSA,L]". "\n" .
"RewriteRule ^guide/([0-9]+)\-([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)$ ".__PS_BASE_URI__."modules/purchaseguide/rubrique.php?cid=$1&sid=$3 [QSA,L]". "\n" .
"RewriteRule ^guide/([0-9]+)\-([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)$ ".__PS_BASE_URI__."modules/purchaseguide/post.php?cid=$1&sid=$3&id=$5 [QSA,L]";
if(count($langs) > 1) {
$rewrite_rules = '';
foreach($langs as $lang) {
if(isset($urls_i18n[$lang['iso_code']])) {
$index = $lang['iso_code'];
} else {
$index = 'en';
}
$rewrite_rules .= sprintf($str_rewrite_rules, $lang['iso_code'].'/'.$urls_i18n[$index]);
}
} else {
if(isset($urls_i18n[$langs[0]['iso_code']])) {
$index = $langs[0]['iso_code'];
} else {
$index = 'en';
}
$rewrite_rules = sprintf($str_rewrite_rules, $urls_i18n[$index]);
}
$smarty->assign('rewrite_rules', htmlentities($rewrite_rules));
echo $smarty->fetch(__DIR__.'/views/templates/admin/home_adminguide.tpl');
}
}
}