// Routes for dispatcher (part 4) + some fix
This commit is contained in:
@@ -75,7 +75,6 @@ function includeDatepicker($id, $time = false)
|
||||
function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL)
|
||||
{
|
||||
$defines = array();
|
||||
$defines['_PS_DIRECTORY_'] = ($baseUrls AND $baseUrls['_PS_DIRECTORY_']) ? $baseUrls['_PS_DIRECTORY_'] : _PS_DIRECTORY_;
|
||||
$defines['_MEDIA_SERVER_1_'] = ($baseUrls AND isset($baseUrls['_MEDIA_SERVER_1_'])) ? $baseUrls['_MEDIA_SERVER_1_'] : _MEDIA_SERVER_1_;
|
||||
$defines['_MEDIA_SERVER_2_'] = ($baseUrls AND isset($baseUrls['_MEDIA_SERVER_2_'])) ? $baseUrls['_MEDIA_SERVER_2_'] : _MEDIA_SERVER_2_;
|
||||
$defines['_MEDIA_SERVER_3_'] = ($baseUrls AND isset($baseUrls['_MEDIA_SERVER_3_'])) ? $baseUrls['_MEDIA_SERVER_3_'] : _MEDIA_SERVER_3_;
|
||||
|
||||
+1
-2
@@ -34,8 +34,7 @@ if (isset($_GET['logout']))
|
||||
|
||||
if (!$cookie->isLoggedBack())
|
||||
{
|
||||
$destination = substr($_SERVER['REQUEST_URI'], strlen(dirname($_SERVER['SCRIPT_NAME'])) + 1);
|
||||
Tools::redirectAdmin('login.php'.(empty($destination) || ($destination == 'index.php?logout') ? '' : '?redirect='.$destination));
|
||||
Tools::redirectAdmin('login.php?redirect='.$_SERVER['REQUEST_URI']);
|
||||
}
|
||||
|
||||
// Set current index
|
||||
|
||||
+2
-4
@@ -51,10 +51,8 @@ if ((empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off')
|
||||
.'<br/><br/><a href="https://'.Tools::getServerName().$_SERVER['REQUEST_URI'].'">https://'.Tools::getServerName().$_SERVER['REQUEST_URI'].'</a>';
|
||||
}
|
||||
|
||||
$cookie = new Cookie('psAdmin', substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__), -10));
|
||||
if (!isset($cookie->id_lang))
|
||||
$cookie->id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
$iso = strtolower(Language::getIsoById((int)($cookie->id_lang)));
|
||||
$cookie = Context::getContext()->cookie;
|
||||
$iso = strtolower(Language::getIsoById(Context::getContext()->language->id));
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
|
||||
|
||||
|
||||
@@ -38,17 +38,19 @@ class AdminLanguages extends AdminTab
|
||||
$this->fieldImageSettings = array(array('name' => 'flag', 'dir' => 'l'), array('name' => 'no-picture', 'dir' => 'p'));
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_lang' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'flag' => array('title' => $this->l('Logo'), 'align' => 'center', 'image' => 'l', 'orderby' => false, 'search' => false),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 120),
|
||||
'iso_code' => array('title' => $this->l('ISO code'), 'width' => 70, 'align' => 'center'),
|
||||
'language_code' => array('title' => $this->l('Language code'), 'width' => 70, 'align' => 'center'),
|
||||
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'));
|
||||
'id_lang' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'flag' => array('title' => $this->l('Logo'), 'align' => 'center', 'image' => 'l', 'orderby' => false, 'search' => false),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 120),
|
||||
'iso_code' => array('title' => $this->l('ISO code'), 'width' => 70, 'align' => 'center'),
|
||||
'language_code' => array('title' => $this->l('Language code'), 'width' => 70, 'align' => 'center'),
|
||||
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'),
|
||||
);
|
||||
|
||||
$this->optionTitle = $this->l('Languages options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_LANG_DEFAULT' => array('title' => $this->l('Default language:'), 'desc' => $this->l('The default language used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_lang', 'list' => Language::getlanguages(false)),
|
||||
'PS_LANG_DEFAULT' => array('title' => $this->l('Default language:'), 'desc' => $this->l('The default language used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_lang', 'list' => Language::getlanguages(false)),
|
||||
);
|
||||
$this->_group = 'GROUP BY a.id_lang';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class AdminPreferences extends AdminTab
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
Tools::clearCache($smarty);
|
||||
Tools::clearCache($this->context->smarty);
|
||||
|
||||
/* Check required fields */
|
||||
foreach ($fields AS $field => $values)
|
||||
@@ -289,7 +289,6 @@ class AdminPreferences extends AdminTab
|
||||
else
|
||||
$tab[$key] = Tools::getValue($key, Configuration::get($key));
|
||||
}
|
||||
$tab['_PS_DIRECTORY_'] = _PS_DIRECTORY_;
|
||||
$tab['_MEDIA_SERVER_1_'] = _MEDIA_SERVER_1_;
|
||||
$tab['_MEDIA_SERVER_2_'] = _MEDIA_SERVER_2_;
|
||||
$tab['_MEDIA_SERVER_3_'] = _MEDIA_SERVER_3_;
|
||||
|
||||
@@ -34,19 +34,19 @@ class AdminShopUrl extends AdminTab
|
||||
$this->className = 'ShopUrl';
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->_select = 's.name shop_name';
|
||||
$this->_select = 's.name AS shop_name, CONCAT(a.physical_uri, a.virtual_uri) AS uri';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'shop` s ON (s.id_shop = a.id_shop)';
|
||||
$this->_listSkipDelete = array(1);
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_shop_url' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'domain' => array('title' => $this->l('Domain'), 'width' => 130, 'filter_key' => 'domain'),
|
||||
'domain_ssl' => array('title' => $this->l('Domain SSL'), 'width' => 130, 'filter_key' => 'domain'),
|
||||
'uri' => array('title' => $this->l('Uri'), 'width' => 130, 'filter_key' => 'uri'),
|
||||
'shop_name' => array('title' => $this->l('Shop name'), 'width' => 70),
|
||||
'main' => array('title' => $this->l('Main URL'), 'align' => 'center', 'activeVisu' => 'main', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'main'),
|
||||
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active'));
|
||||
$this->_fieldsOptions = array('_PS_DIRECTORY_' => array('title' => $this->l('PS directory'), 'desc' => $this->l('Name of the PrestaShop directory on your Web server, bracketed by forward slashes (e.g., /shop/)'), 'validation' => 'isUrl', 'type' => 'text', 'size' => 20, 'default' => _PS_DIRECTORY_, 'visibility' => Shop::CONTEXT_ALL));
|
||||
'id_shop_url' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'domain' => array('title' => $this->l('Domain'), 'width' => 130, 'filter_key' => 'domain'),
|
||||
'domain_ssl' => array('title' => $this->l('Domain SSL'), 'width' => 130, 'filter_key' => 'domain'),
|
||||
'uri' => array('title' => $this->l('Uri'), 'width' => 130, 'filter_key' => 'uri'),
|
||||
'shop_name' => array('title' => $this->l('Shop name'), 'width' => 70),
|
||||
'main' => array('title' => $this->l('Main URL'), 'align' => 'center', 'activeVisu' => 'main', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'main'),
|
||||
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active'),
|
||||
);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
@@ -66,15 +66,6 @@ class AdminShopUrl extends AdminTab
|
||||
|
||||
Tools::generateHtaccess(dirname(__FILE__).'/../../.htaccess', Configuration::get('PS_REWRITING_SETTINGS'), Configuration::get('PS_HTACCESS_CACHE_CONTROL'), Configuration::get('PS_HTACCESS_SPECIFIC'));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitOptions'.$this->table))
|
||||
{
|
||||
$baseUrls = array();
|
||||
if ($_PS_DIRECTORY_ = Tools::getValue('_PS_DIRECTORY_'))
|
||||
$baseUrls['_PS_DIRECTORY_'] = $_PS_DIRECTORY_;
|
||||
rewriteSettingsFile($baseUrls, NULL, NULL);
|
||||
unset($this->_fieldsGeneral['_PS_DIRECTORY_']);
|
||||
}
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -90,6 +81,30 @@ class AdminShopUrl extends AdminTab
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo <<<EOF
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$().ready(function()
|
||||
{
|
||||
$('#domain, #physical_uri, #virtual_uri').keyup(function()
|
||||
{
|
||||
var domain = $('#domain').val();
|
||||
var physical = $('#physical_uri').val();
|
||||
var virtual = $('#virtual_uri').val();
|
||||
var url = 'http://';
|
||||
url += ((domain) ? domain : '???');
|
||||
if (physical)
|
||||
url += '/'+physical;
|
||||
if (virtual)
|
||||
url += '/'+virtual;
|
||||
url = url.replace(/\/+/g, "/");
|
||||
$('#final_url').val(url);
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
EOF;
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
@@ -103,11 +118,20 @@ class AdminShopUrl extends AdminTab
|
||||
<div class="margin-form">
|
||||
<input type="text" name="domain_ssl" id="domain_ssl" value="'.$this->getFieldValue($obj, 'domain_ssl').'" />
|
||||
</div>
|
||||
<label for="uri">'.$this->l('URI').'</label>
|
||||
<label for="physical_uri">'.$this->l('Physical URI').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="uri" id="uri" value="'.$this->getFieldValue($obj, 'uri').'" />
|
||||
<input type="text" name="physical_uri" id="physical_uri" value="'.$this->getFieldValue($obj, 'physical_uri').'" />
|
||||
<p>'.$this->l('Folder of your store ex: ipods for http://yourshopname.com/ipods/, leave empty if no folder.').'<br /><b>'.$this->l('URL Rewrite must be activated to use this feature.').'</b></p>
|
||||
</div>
|
||||
<label for="virtual_uri">'.$this->l('Virtual URI').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="virtual_uri" id="virtual_uri" value="'.$this->getFieldValue($obj, 'virtual_uri').'" />
|
||||
<p>'.$this->l('Folder of your store ex: ipods for http://yourshopname.com/ipods/, leave empty if no folder.').'<br /><b>'.$this->l('URL Rewrite must be activated to use this feature.').'</b></p>
|
||||
</div>
|
||||
<label>'.$this->l('Your final URL will be').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" readonly="readonly" id="final_url" style="width: 400px" value="'.$obj->getURL().'" />
|
||||
</div>
|
||||
<label for="id_shop">'.$this->l('Shop').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_shop" id="id_shop">';
|
||||
|
||||
Reference in New Issue
Block a user