[+] BO : New AdminController system, including smarty backoffice, thanks to Raphael and Thomas
This commit is contained in:
+147
-16
@@ -224,14 +224,6 @@ function translate($string)
|
||||
return str_replace('"', '"', stripslashes($str));
|
||||
}
|
||||
|
||||
function recursiveTab($id_tab, $tabs)
|
||||
{
|
||||
$adminTab = Tab::getTab((int)Context::getContext()->language->id, $id_tab);
|
||||
$tabs[]= $adminTab;
|
||||
if ($adminTab['id_parent'] > 0)
|
||||
$tabs = recursiveTab($adminTab['id_parent'], $tabs);
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new Tab object
|
||||
@@ -244,22 +236,21 @@ function checkingTab($tab)
|
||||
$tab = trim($tab);
|
||||
if (!Validate::isTabName($tab))
|
||||
return false;
|
||||
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT id_tab, module FROM `'._DB_PREFIX_.'tab` WHERE class_name = \''.pSQL($tab).'\'');
|
||||
if (!$row['id_tab'])
|
||||
{
|
||||
if (isset(AdminTab::$tabParenting[$tab]))
|
||||
Tools::redirectAdmin('?tab='.AdminTab::$tabParenting[$tab].'&token='.Tools::getAdminTokenLite(AdminTab::$tabParenting[$tab]));
|
||||
echo Tools::displayError('Tab cannot be found.');
|
||||
echo sprintf(Tools::displayError('Tab %s cannot be found.'),$tab);
|
||||
return false;
|
||||
}
|
||||
if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php'))
|
||||
include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php');
|
||||
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php'))
|
||||
include_once(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php');
|
||||
if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.Dispatcher::$controllers[$tab].'.php'))
|
||||
include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.Dispatcher::$controllers[$tab].'.php');
|
||||
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.Dispatcher::$controllers[$tab].'.php'))
|
||||
include_once(_PS_ADMIN_DIR_.'/tabs/'.Dispatcher::$controllers[$tab].'.php');
|
||||
if (!class_exists($tab, false) OR !$row['id_tab'])
|
||||
{
|
||||
echo Tools::displayError('Tab file cannot be found.');
|
||||
echo sprintf(Tools::displayError('Tab file %s cannot be found.'),$tab);
|
||||
return false;
|
||||
}
|
||||
$adminObj = new $tab;
|
||||
@@ -424,4 +415,144 @@ function generateShopList()
|
||||
$html .= '</select>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* for retrocompatibility with old AdminTab, old index.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function runAdminTab()
|
||||
{
|
||||
|
||||
require_once(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
require_once(_PS_ADMIN_DIR_.'/functions.php');
|
||||
require_once(_PS_ADMIN_DIR_.'/init.php');
|
||||
if (empty($tab) and !sizeof($_POST))
|
||||
{
|
||||
$tab = 'AdminHome';
|
||||
$_POST['tab'] = 'AdminHome';
|
||||
$_POST['token'] = Tools::getAdminTokenLite($tab);
|
||||
}
|
||||
// $tab = $_REQUEST['tab'];
|
||||
if ($adminObj = checkingTab($tab))
|
||||
{
|
||||
// init is different for new tabs (AdminController) and old tabs (AdminTab)
|
||||
if ($adminObj instanceof AdminController)
|
||||
{
|
||||
$adminObj->path = dirname($_SERVER["PHP_SELF"]);
|
||||
$adminObj->run();
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(_PS_ADMIN_DIR_.'/header.inc.php');
|
||||
$isoUser = Context::getContext()->language->id;
|
||||
$tabs = array();
|
||||
$tabs = Tab::recursiveTab($adminObj->id, $tabs);
|
||||
$tabs = array_reverse($tabs);
|
||||
$bread = '';
|
||||
foreach ($tabs AS $key => $item)
|
||||
$bread .= ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" alt=">" />
|
||||
'.((sizeof($tabs) - 1 > $key)
|
||||
? '<a href="?tab='.$item['class_name'].'&token='.Tools::getAdminToken($item['class_name'].intval($item['id_tab']).(int)Context::getContext()->employee->id).'">'
|
||||
: '').'
|
||||
'.$item['name'].((sizeof($tabs) - 1 > $key) ? '</a>' : '');
|
||||
|
||||
// @TODO : a way to desactivate this feature
|
||||
echo'<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$.ajax({
|
||||
type: \'POST\',
|
||||
url: \'ajax.php\',
|
||||
data: \'helpAccess=1&item='.$item['class_name'].'&isoUser='.$isoUser.'&country='.Context::getContext()->country->iso_code.'&version='._PS_VERSION_.'\',
|
||||
async : true,
|
||||
success: function(msg) {
|
||||
$("#help-button").html(msg);
|
||||
$("#help-button").fadeIn("slow");
|
||||
}
|
||||
});
|
||||
});</script>';
|
||||
|
||||
echo '<div class="path_bar">
|
||||
<div id="help-button" class="floatr" style="display: none; font-family: Verdana; font-size: 10px; margin-right: 4px; margin-top: 4px;">
|
||||
</div>
|
||||
<a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).(int)Context::getContext()->employee->id).'">'.translate('Back Office').'</a>
|
||||
'.$bread;
|
||||
echo '
|
||||
</div>';
|
||||
|
||||
|
||||
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL)
|
||||
{
|
||||
echo '<div class="multishop_info">';
|
||||
if (Context::shop() == Shop::CONTEXT_GROUP)
|
||||
printf(translate('You are configuring your store for group shop %s'), '<b>'.Context::getContext()->shop->getGroup()->name.'</b>');
|
||||
elseif (Context::shop() == Shop::CONTEXT_SHOP)
|
||||
printf(translate('You are configuring your store for shop %s'), '<b>'.Context::getContext()->shop->name.'</b>');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (Validate::isLoadedObject($adminObj))
|
||||
{
|
||||
if ($adminObj->checkToken())
|
||||
{
|
||||
/* Filter memorization */
|
||||
if (isset($_POST) AND !empty($_POST) AND isset($adminObj->table))
|
||||
foreach ($_POST AS $key => $value)
|
||||
if (is_array($adminObj->table))
|
||||
{
|
||||
foreach ($adminObj->table AS $table)
|
||||
if (strncmp($key, $table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
|
||||
$cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
elseif (strncmp($key, $adminObj->table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
|
||||
$cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
|
||||
if (isset($_GET) AND !empty($_GET) AND isset($adminObj->table))
|
||||
foreach ($_GET AS $key => $value)
|
||||
if (is_array($adminObj->table))
|
||||
{
|
||||
foreach ($adminObj->table AS $table)
|
||||
if (strncmp($key, $table.'OrderBy', 7) === 0 OR strncmp($key, $table.'Orderway', 8) === 0)
|
||||
$cookie->$key = $value;
|
||||
}
|
||||
elseif (strncmp($key, $adminObj->table.'OrderBy', 7) === 0 OR strncmp($key, $adminObj->table.'Orderway', 12) === 0)
|
||||
$cookie->$key = $value;
|
||||
$adminObj->displayConf();
|
||||
$adminObj->postProcess();
|
||||
$adminObj->displayErrors();
|
||||
$adminObj->display();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If this is an XSS attempt, then we should only display a simple, secure page
|
||||
ob_clean();
|
||||
|
||||
// ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
|
||||
$url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$adminObj->token.'$2', $_SERVER['REQUEST_URI']);
|
||||
if (false === strpos($url, '?token=') AND false === strpos($url, '&token='))
|
||||
$url .= '&token='.$adminObj->token;
|
||||
|
||||
$message = translate('Invalid security token');
|
||||
echo '<html><head><title>'.$message.'</title></head><body style="font-family:Arial,Verdana,Helvetica,sans-serif;background-color:#EC8686">
|
||||
<div style="background-color:#FAE2E3;border:1px solid #000000;color:#383838;font-weight:700;line-height:20px;margin:0 0 10px;padding:10px 15px;width:500px">
|
||||
<img src="../img/admin/error2.png" style="margin:-4px 5px 0 0;vertical-align:middle">
|
||||
'.$message.'
|
||||
</div>';
|
||||
echo '<a href="'.htmlentities($url).'" method="get" style="float:left;margin:10px">
|
||||
<input type="button" value="'.Tools::htmlentitiesUTF8(translate('I understand the risks and I really want to display this page')).'" style="height:30px;margin-top:5px" />
|
||||
</a>
|
||||
<a href="index.php" method="get" style="float:left;margin:10px">
|
||||
<input type="button" value="'.Tools::htmlentitiesUTF8(translate('Take me out of here!')).'" style="height:40px" />
|
||||
</a>
|
||||
</body></html>';
|
||||
die;
|
||||
}
|
||||
}
|
||||
include(_PS_ADMIN_DIR_.'/footer.inc.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+14
-12
@@ -75,7 +75,7 @@ echo '
|
||||
html = "";
|
||||
nb_notifs = 0;
|
||||
$.each(json.order, function(property, value) {
|
||||
html += "<li>'.translate('A new order has been made on your shop.').'<br />'.translate('Order number : ').'<strong>#" + parseInt(value.id_order) + "</strong><br />'.translate('Total : ').'<strong>" + value.total_paid_real + "</strong><br />'.translate('From : ').'<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?tab=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">'.translate('Click here to see that order').'</a></li>";
|
||||
html += "<li>'.translate('A new order has been made on your shop.').'<br />'.translate('Order number : ').'<strong>#" + parseInt(value.id_order) + "</strong><br />'.translate('Total : ').'<strong>" + value.total_paid_real + "</strong><br />'.translate('From : ').'<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?controller=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">'.translate('Click here to see that order').'</a></li>";
|
||||
});
|
||||
if (html != "")
|
||||
{
|
||||
@@ -94,7 +94,7 @@ echo '
|
||||
html = "";
|
||||
nb_notifs = 0;
|
||||
$.each(json.customer, function(property, value) {
|
||||
html += "<li>'.translate('A new customer registered on your shop.').'<br />'.translate('Customer name : ').'<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?tab=AdminCustomers&token='.Tools::getAdminTokenLite('AdminCustomers').'&viewcustomer&id_customer=" + parseInt(value.id_customer) + "\">'.translate('Click here to see that customer').'</a></li>";
|
||||
html += "<li>'.translate('A new customer registered on your shop.').'<br />'.translate('Customer name : ').'<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?controller=AdminCustomers&token='.Tools::getAdminTokenLite('AdminCustomers').'&viewcustomer&id_customer=" + parseInt(value.id_customer) + "\">'.translate('Click here to see that customer').'</a></li>";
|
||||
});
|
||||
if (html != "")
|
||||
{
|
||||
@@ -113,7 +113,7 @@ echo '
|
||||
html = "";
|
||||
nb_notifs = 0;
|
||||
$.each(json.message, function(property, value) {
|
||||
html += "<li>'.translate('A new message posted on your shop.').'<br />'.translate('From : ').'<strong>" + value.customer_name + "</strong><br />'.translate('Excerpt : ').'<strong>" + value.message_customer + "</strong><br /><a href=\"index.php?tab=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">'.translate('Click here to see that message').'</a></li>";
|
||||
html += "<li>'.translate('A new message posted on your shop.').'<br />'.translate('From : ').'<strong>" + value.customer_name + "</strong><br />'.translate('Excerpt : ').'<strong>" + value.message_customer + "</strong><br /><a href=\"index.php?controller=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">'.translate('Click here to see that message').'</a></li>";
|
||||
});
|
||||
if (html != "")
|
||||
{
|
||||
@@ -192,7 +192,7 @@ echo ' var html = "";
|
||||
<h3>'.translate('Last orders').'</h3>
|
||||
<p class="no_notifs">'.translate('No new orders has been made on your shop').'</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'">'.translate('Show all orders').'</a></p>
|
||||
<p><a href="index.php?controller=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'">'.translate('Show all orders').'</a></p>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
@@ -203,7 +203,7 @@ echo ' var html = "";
|
||||
<h3>'.translate('Last customers').'</h3>
|
||||
<p class="no_notifs">'.translate('No new customers registered on your shop').'</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminCustomers&token='.Tools::getAdminTokenLite('AdminCustomers').'">'.translate('Show all customers').'</a></p>
|
||||
<p><a href="index.php?controller=AdminCustomers&token='.Tools::getAdminTokenLite('AdminCustomers').'">'.translate('Show all customers').'</a></p>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
@@ -214,7 +214,7 @@ echo ' var html = "";
|
||||
<h3>'.translate('Last messages').'</h3>
|
||||
<p class="no_notifs">'.translate('No new messages posted on your shop').'</p>
|
||||
<ul id="list_messages_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminMessages&token='.Tools::getAdminTokenLite('AdminMessages').'">'.translate('Show all messages').'</a></p>
|
||||
<p><a href="index.php?controller=AdminMessages&token='.Tools::getAdminTokenLite('AdminMessages').'">'.translate('Show all messages').'</a></p>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
@@ -223,10 +223,10 @@ echo ' var html = "";
|
||||
[ <a href="index.php?logout" id="header_logout"><span>'.translate('logout').'</span></a> ]';
|
||||
if (Context::getContext()->shop->getBaseURL())
|
||||
echo '- <a href="'.Context::getContext()->shop->getBaseURL().'" id="header_foaccess" target="_blank" title="'.translate('View my shop').'"><span>'.translate('View my shop').'</span></a>';
|
||||
echo ' - <a href="index.php?tab=AdminEmployees&id_employee='.(int)Context::getContext()->employee->id.'&updateemployee&token='.Tools::getAdminTokenLite('AdminEmployees').'" style="font-size: 10px;"><img src="../img/admin/employee.gif" alt="" /> '.translate('My preferences').'</a>
|
||||
echo ' - <a href="index.php?controller=AdminEmployees&id_employee='.(int)Context::getContext()->employee->id.'&updateemployee&token='.Tools::getAdminTokenLite('AdminEmployees').'" style="font-size: 10px;"><img src="../img/admin/employee.gif" alt="" /> '.translate('My preferences').'</a>
|
||||
</span></div>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?tab=AdminSearch&token='.Tools::getAdminTokenLite('AdminSearch').'">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token='.Tools::getAdminTokenLite('AdminSearch').'">
|
||||
<input type="text" name="bo_query" id="bo_query"
|
||||
value="'.Tools::safeOutput(Tools::stripslashes(Tools::getValue('bo_query'))).'"
|
||||
/>
|
||||
@@ -256,7 +256,7 @@ echo ' var html = "";
|
||||
<option value="0">'.translate('Quick Access').'</option>';
|
||||
foreach (QuickAccess::getQuickAccesses(Context::getContext()->language->id) AS $quick)
|
||||
{
|
||||
preg_match('/tab=(.+)(&.+)?$/', $quick['link'], $adminTab);
|
||||
preg_match('/controller=(.+)(&.+)?$/', $quick['link'], $adminTab);
|
||||
if (isset($adminTab[1]))
|
||||
{
|
||||
if (strpos($adminTab[1], '&'))
|
||||
@@ -282,15 +282,16 @@ $id_parent_tab_current = (int)(Tab::getCurrentParentId());
|
||||
$tabs = Tab::getTabs(Context::getContext()->language->id, 0);
|
||||
$echoLis = '';
|
||||
$mainsubtablist = '';
|
||||
|
||||
foreach ($tabs AS $t)
|
||||
if (checkTabRights($t['id_tab']) === true)
|
||||
{
|
||||
$img = (Tools::file_exists_cache(_PS_ADMIN_DIR_.'/themes/'.Context::getContext()->employee->bo_theme.'/img/t/'.$t['class_name'].'.gif') ? 'themes/'.Context::getContext()->employee->bo_theme.'/img/' : _PS_IMG_).'t/'.$t['class_name'].'.gif';
|
||||
if (trim($t['module']) != '')
|
||||
$img = _MODULE_DIR_.$t['module'].'/'.$t['class_name'].'.gif';
|
||||
$current = (($t['class_name'] == $tab) OR ($id_parent_tab_current == $t['id_tab']));
|
||||
$current = ((strtolower($t['class_name']) == $tab) OR ($id_parent_tab_current == $t['id_tab']));
|
||||
echo '<li class="submenu_size '.($current ? 'active' : '').'" id="maintab'.$t['id_tab'].'">
|
||||
<a href="index.php?tab='.$t['class_name'].'&token='.Tools::getAdminToken($t['class_name'].(int)($t['id_tab']).(int)Context::getContext()->employee->id).'">
|
||||
<a href="index.php?controller='.$t['class_name'].'&token='.Tools::getAdminToken($t['class_name'].(int)($t['id_tab']).(int)Context::getContext()->employee->id).'">
|
||||
<img src="'.$img.'" alt="" /> '.$t['name'].'
|
||||
</a>
|
||||
</li>';
|
||||
@@ -298,7 +299,8 @@ foreach ($tabs AS $t)
|
||||
$subTabs = Tab::getTabs(Context::getContext()->language->id, (int)$t['id_tab']);
|
||||
foreach ($subTabs AS $t2)
|
||||
if (checkTabRights($t2['id_tab']) === true)
|
||||
$echoLi .= '<li><a href="index.php?tab='.$t2['class_name'].'&token='.Tools::getAdminTokenLite($t2['class_name']).'">'.$t2['name'].'</a></li>';
|
||||
$echoLi .= '<li><a href="index.php?controller='.$t2['class_name'].'&token='.Tools::getAdminTokenLite($t2['class_name']).'">'.$t2['name'].'</a></li>';
|
||||
|
||||
if ($current)
|
||||
$mainsubtablist = $echoLi;
|
||||
$echoLis .= '<div id="tab'.(int)($t['id_tab']).'_subtabs" style="display:none">'.$echoLi.'</div>';
|
||||
|
||||
+2
-129
@@ -26,133 +26,6 @@
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
include(_PS_ADMIN_DIR_.'/functions.php');
|
||||
include(_PS_ADMIN_DIR_.'/init.php');
|
||||
if (empty($tab) and !sizeof($_POST))
|
||||
{
|
||||
$tab = 'AdminHome';
|
||||
$_POST['tab'] = 'AdminHome';
|
||||
$_POST['token'] = Tools::getAdminTokenLite($tab);
|
||||
}
|
||||
|
||||
if ($adminObj = checkingTab($tab))
|
||||
{
|
||||
// init is different for new tabs (AdminController) and old tabs (AdminTab)
|
||||
if ($adminObj instanceof AdminController)
|
||||
{
|
||||
$adminObj->path = dirname($_SERVER["PHP_SELF"]);
|
||||
$adminObj->run();
|
||||
}
|
||||
else
|
||||
{
|
||||
include(_PS_ADMIN_DIR_.'/header.inc.php');
|
||||
$isoUser = Context::getContext()->language->id;
|
||||
$tabs = array();
|
||||
$tabs = recursiveTab($adminObj->id, $tabs);
|
||||
$tabs = array_reverse($tabs);
|
||||
$bread = '';
|
||||
foreach ($tabs AS $key => $item)
|
||||
$bread .= ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" alt=">" />
|
||||
'.((sizeof($tabs) - 1 > $key)
|
||||
? '<a href="?tab='.$item['class_name'].'&token='.Tools::getAdminToken($item['class_name'].intval($item['id_tab']).(int)Context::getContext()->employee->id).'">'
|
||||
: '').'
|
||||
'.$item['name'].((sizeof($tabs) - 1 > $key) ? '</a>' : '');
|
||||
// @TODO : a way to desactivate this feature
|
||||
echo'<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$.ajax({
|
||||
type: \'POST\',
|
||||
url: \'ajax.php\',
|
||||
data: \'helpAccess=1&item='.$item['class_name'].'&isoUser='.$isoUser.'&country='.Context::getContext()->country->iso_code.'&version='._PS_VERSION_.'\',
|
||||
async : true,
|
||||
success: function(msg) {
|
||||
$("#help-button").html(msg);
|
||||
$("#help-button").fadeIn("slow");
|
||||
}
|
||||
});
|
||||
});</script>';
|
||||
|
||||
echo '<div class="path_bar">
|
||||
<div id="help-button" class="floatr" style="display: none; font-family: Verdana; font-size: 10px; margin-right: 4px; margin-top: 4px;">
|
||||
</div>
|
||||
<a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).(int)Context::getContext()->employee->id).'">'.translate('Back Office').'</a>
|
||||
'.$bread;
|
||||
echo '
|
||||
</div>';
|
||||
|
||||
|
||||
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL)
|
||||
{
|
||||
echo '<div class="multishop_info">';
|
||||
if (Context::shop() == Shop::CONTEXT_GROUP)
|
||||
printf(translate('You are configuring your store for group shop %s'), '<b>'.Context::getContext()->shop->getGroup()->name.'</b>');
|
||||
elseif (Context::shop() == Shop::CONTEXT_SHOP)
|
||||
printf(translate('You are configuring your store for shop %s'), '<b>'.Context::getContext()->shop->name.'</b>');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (Validate::isLoadedObject($adminObj))
|
||||
{
|
||||
if ($adminObj->checkToken())
|
||||
{
|
||||
/* Filter memorization */
|
||||
if (isset($_POST) AND !empty($_POST) AND isset($adminObj->table))
|
||||
foreach ($_POST AS $key => $value)
|
||||
if (is_array($adminObj->table))
|
||||
{
|
||||
foreach ($adminObj->table AS $table)
|
||||
if (strncmp($key, $table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
|
||||
$cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
elseif (strncmp($key, $adminObj->table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
|
||||
$cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
|
||||
if (isset($_GET) AND !empty($_GET) AND isset($adminObj->table))
|
||||
foreach ($_GET AS $key => $value)
|
||||
if (is_array($adminObj->table))
|
||||
{
|
||||
foreach ($adminObj->table AS $table)
|
||||
if (strncmp($key, $table.'OrderBy', 7) === 0 OR strncmp($key, $table.'Orderway', 8) === 0)
|
||||
$cookie->$key = $value;
|
||||
}
|
||||
elseif (strncmp($key, $adminObj->table.'OrderBy', 7) === 0 OR strncmp($key, $adminObj->table.'Orderway', 12) === 0)
|
||||
$cookie->$key = $value;
|
||||
$adminObj->displayConf();
|
||||
$adminObj->postProcess();
|
||||
$adminObj->displayErrors();
|
||||
$adminObj->display();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If this is an XSS attempt, then we should only display a simple, secure page
|
||||
ob_clean();
|
||||
|
||||
// ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
|
||||
$url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$adminObj->token.'$2', $_SERVER['REQUEST_URI']);
|
||||
if (false === strpos($url, '?token=') AND false === strpos($url, '&token='))
|
||||
$url .= '&token='.$adminObj->token;
|
||||
|
||||
$message = translate('Invalid security token');
|
||||
echo '<html><head><title>'.$message.'</title></head><body style="font-family:Arial,Verdana,Helvetica,sans-serif;background-color:#EC8686">
|
||||
<div style="background-color:#FAE2E3;border:1px solid #000000;color:#383838;font-weight:700;line-height:20px;margin:0 0 10px;padding:10px 15px;width:500px">
|
||||
<img src="../img/admin/error2.png" style="margin:-4px 5px 0 0;vertical-align:middle">
|
||||
'.$message.'
|
||||
</div>';
|
||||
echo '<a href="'.htmlentities($url).'" method="get" style="float:left;margin:10px">
|
||||
<input type="button" value="'.Tools::htmlentitiesUTF8(translate('I understand the risks and I really want to display this page')).'" style="height:30px;margin-top:5px" />
|
||||
</a>
|
||||
<a href="index.php" method="get" style="float:left;margin:10px">
|
||||
<input type="button" value="'.Tools::htmlentitiesUTF8(translate('Take me out of here!')).'" style="height:40px" />
|
||||
</a>
|
||||
</body></html>';
|
||||
die;
|
||||
}
|
||||
}
|
||||
include(_PS_ADMIN_DIR_.'/footer.inc.php');
|
||||
}
|
||||
}
|
||||
|
||||
require(dirname(__FILE__).'/../config/config.inc.php');
|
||||
Dispatcher::getInstance()->dispatch();
|
||||
|
||||
|
||||
+21
-3
@@ -28,6 +28,20 @@
|
||||
ob_start();
|
||||
$timerStart = microtime(true);
|
||||
|
||||
{
|
||||
if (!isset($_GET['controller']) && isset($_GET['tab'])){
|
||||
$_GET['controller'] = $_GET['tab'];
|
||||
}
|
||||
if (!isset($_POST['controller']) && isset($_POST['tab']))
|
||||
$_POST['controller'] = $_POST['tab'];
|
||||
|
||||
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
|
||||
$_REQUEST['controller'] = $_REQUEST['tab'];
|
||||
}
|
||||
// $_GET['tab'] = $_GET['controller'];
|
||||
// $_POST['tab'] = $_POST['controller'];
|
||||
// $_REQUEST['tab'] = $_REQUEST['controller'];
|
||||
|
||||
$context = Context::getContext();
|
||||
if (isset($_GET['logout']))
|
||||
$context->employee->logout();
|
||||
@@ -38,6 +52,11 @@ if (!isset($context->employee) || !$context->employee->isLoggedBack())
|
||||
|
||||
// Set current index
|
||||
$currentIndex = $_SERVER['SCRIPT_NAME'].(($tab = Tools::getValue('tab')) ? '?tab='.$tab : '');
|
||||
if (empty($tab))
|
||||
{
|
||||
$currentIndex = $_SERVER['SCRIPT_NAME'].(($controller = Tools::getValue('controller')) ? '?controller='.$controller: '');
|
||||
$tab = $controller;
|
||||
}
|
||||
if ($back = Tools::getValue('back'))
|
||||
$currentIndex .= '&back='.urlencode($back);
|
||||
AdminTab::$currentIndex = $currentIndex;
|
||||
@@ -56,7 +75,7 @@ define('_PS_BASE_URL_', Tools::getShopDomain(true));
|
||||
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
|
||||
|
||||
$path = dirname(__FILE__).'/themes/';
|
||||
if (empty($context->employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin.css'))
|
||||
if (empty($context->employee->bo_theme) OR !file_exists($path.$context->employee->bo_theme.'/admin.css'))
|
||||
{
|
||||
if (file_exists($path.'oldschool/admin.css'))
|
||||
$context->employee->bo_theme = 'oldschool';
|
||||
@@ -84,7 +103,6 @@ if (Shop::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
|
||||
}
|
||||
|
||||
$context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$context->country = $defaultCountry;
|
||||
|
||||
$shopID = '';
|
||||
if ($context->cookie->shopContext)
|
||||
@@ -93,4 +111,4 @@ if ($context->cookie->shopContext)
|
||||
if (count($split) == 2 && $split[0] == 's')
|
||||
$shopID = (int)$split[1];
|
||||
}
|
||||
$context->shop = new Shop($shopID);
|
||||
$context->shop = new Shop($shopID);
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminTools extends AdminController
|
||||
{
|
||||
public $template = 'adminTools.tpl';
|
||||
public function __construct()
|
||||
{
|
||||
$this->className = 'AdminTools';
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$iso}" lang="{$iso}">
|
||||
<head>
|
||||
@@ -112,7 +111,7 @@
|
||||
<h3>{l s='Last orders'}</h3>
|
||||
<p class="no_notifs">{l s='No new orders has been made on your shop'}</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminOrders&token={$token_admin_orders}">{l s='Show all orders'}</a></p>
|
||||
<p><a href="index.php?controller=AdminOrders&token={$token_admin_orders}">{l s='Show all orders'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -125,7 +124,7 @@
|
||||
<h3>{l s='Last customers'}</h3>
|
||||
<p class="no_notifs">{l s='No new customers registered on your shop'}</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminCustomers&token={$token_admin_customers}">{l s='Show all customers'}</a></p>
|
||||
<p><a href="index.php?controller=AdminCustomers&token={$token_admin_customers}">{l s='Show all customers'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -138,7 +137,7 @@
|
||||
<h3>{l s='Last messages'}</h3>
|
||||
<p class="no_notifs">{l s='No new messages posted on your shop'}</p>
|
||||
<ul id="list_messages_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminMessages&token={$token_admin_messages}">{l s='Show all messages'}</a></p>
|
||||
<p><a href="index.php?controller=AdminMessages&token={$token_admin_messages}">{l s='Show all messages'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -151,10 +150,10 @@
|
||||
{if {$base_url}}
|
||||
- <a href="{$base_url}" id="header_foaccess" target="_blank" title="{l s='View my shop'}"><span>{l s='View my shop'}</span></a>
|
||||
{/if}
|
||||
- <a href="index.php?tab=AdminEmployees&id_employee={$employee->id}&updateemployee&token={$token_admin_employees}" style="font-size: 10px;"><img src="../img/admin/employee.gif" alt="" /> {l s='My preferences'}</a>
|
||||
- <a href="index.php?controller=AdminEmployees&id_employee={$employee->id}&updateemployee&token={$token_admin_employees}" style="font-size: 10px;"><img src="../img/admin/employee.gif" alt="" /> {l s='My preferences'}</a>
|
||||
</span></div>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?tab=AdminSearch&token={$token_admin_search}">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token={$token_admin_search}">
|
||||
<input type="text" name="bo_query" id="bo_query" value="{$bo_query}" />
|
||||
<select name="bo_search_type" id="bo_search_type">
|
||||
<option value="0">{l s='everywhere'}</option>
|
||||
@@ -197,7 +196,7 @@
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
<li class="submenu_size {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<a href="index.php?tab={$t.class_name}&token={$t.token}">
|
||||
<a href="index.php?controller={$t.class_name}&token={$t.token}">
|
||||
<img src="{$t.img}" alt="" /> {$t.name}
|
||||
</a>
|
||||
</li>
|
||||
@@ -206,7 +205,7 @@
|
||||
{foreach $tabs AS $t}
|
||||
<div id="tab{$t.id_tab}_subtabs" style="display:none">
|
||||
{foreach $t.sub_tabs AS $t2}
|
||||
<li><a href="index.php?tab={$t2.class_name}&token={$t2.token}">{$t2.name}</a></li>
|
||||
<li><a href="index.php?controller={$t2.class_name}&token={$t2.token}">{$t2.name}</a></li>
|
||||
{/foreach}
|
||||
{if $t.current}
|
||||
{assign var='mainsubtab' value=$t}
|
||||
@@ -232,7 +231,7 @@
|
||||
<ul id="submenu" {if isset($mainsubtab)}class="withLeftBorder clearfix"{/if}>
|
||||
{if isset($mainsubtab)}
|
||||
{foreach $mainsubtab.sub_tabs AS $t}
|
||||
<li><a href="index.php?tab={$t.class_name}&token={$t.token}">{$t.name}</a></li>
|
||||
<li><a href="index.php?controller={$t.class_name}&token={$t.token}">{$t.name}</a></li>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</ul>
|
||||
@@ -244,16 +243,19 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* We should display breadcrumb only if needed *}
|
||||
{if count($tabs_breadcrumb)>1}
|
||||
<div class="path_bar">
|
||||
<div id="help-button" class="floatr" style="display: none; font-family: Verdana; font-size: 10px; margin-right: 4px; margin-top: 4px;"></div>
|
||||
<a href="?token={$home_token}">{l s='Back Office'}</a>
|
||||
{foreach $tabs_breadcrumb AS $item}
|
||||
<img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" alt=">" />
|
||||
{if isset($item.token)}<a href="?tab={$item.class_name}&token={$item.token}">{/if}
|
||||
{if isset($item.token)}<a href="?controller={$item.class_name}&token={$item.token}">{/if}
|
||||
{$item.name}
|
||||
{if isset($item.token)}</a>{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{if $is_multishop}
|
||||
<div class="multishop_info">
|
||||
{if $shop_context == 'group'}
|
||||
|
||||
@@ -25,5 +25,52 @@
|
||||
*}
|
||||
|
||||
{include file='header.tpl'}
|
||||
{if count($warnings)}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#linkSeeMore').unbind('click').click(function(){
|
||||
$('#seeMore').show('slow');
|
||||
$(this).hide();
|
||||
$('#linkHide').show();
|
||||
return false;
|
||||
});
|
||||
$('#linkHide').unbind('click').click(function(){
|
||||
$('#seeMore').hide('slow');
|
||||
$(this).hide();
|
||||
$('#linkSeeMore').show();
|
||||
return false;
|
||||
});
|
||||
$('#hideWarn').unbind('click').click(function(){
|
||||
$('.warn').hide('slow', function (){
|
||||
$('.warn').remove();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="warn">
|
||||
<span style="float:right">
|
||||
<a id="hideWarn" href=""><img alt="X" src="../img/admin/close.png" /></a>
|
||||
</span>
|
||||
<img src="../img/admin/warn2.png" />
|
||||
{if count($warnings) > 1}
|
||||
{l s='There are'} {count($warnings)} {l s='warnings'}
|
||||
{else}
|
||||
{l s='There is'} {count($warnings)} {l s='warning'}
|
||||
{/if}
|
||||
<span style="margin-left:20px;" id="labelSeeMore">
|
||||
<a id="linkSeeMore" href="#" style="text-decoration:underline">{l s='Click here to see more'}</a>
|
||||
<a id="linkHide" href="#" style="text-decoration:underline;display:none">{l s='Hide warning'}</a>
|
||||
</span>
|
||||
<ul style="display:none;" id="seeMore">
|
||||
{foreach $warnings item=warning}
|
||||
<li>{$warning}</mo>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{$content}
|
||||
{include file='footer.tpl'}
|
||||
|
||||
{include file='footer.tpl'}
|
||||
|
||||
Reference in New Issue
Block a user