// Context part 31

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8087 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-08-17 10:07:12 +00:00
parent b8706ddd8a
commit cb3d802346
57 changed files with 200 additions and 165 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ if (empty($tab) and !sizeof($_POST))
}
if ($adminObj = checkingTab($tab))
{
$isoUser = Language::getIsoById(intval($cookie->id_lang));
$isoUser = Context::getContext()->language->iso_code;
if (Validate::isLoadedObject($adminObj))
{
+7 -7
View File
@@ -626,8 +626,8 @@ if (Tools::isSubmit('getAdminHomeElement'))
$result = array();
$protocol = (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http';
$isoUser = Language::getIsoById(intval($cookie->id_lang));
$isoCountry = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
$isoUser = Context::getContext()->language->iso_code;
$isoCountry = Context::getContext()->country->iso_code;
$stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5)));
// SCREENCAST
@@ -637,7 +637,7 @@ if (Tools::isSubmit('getAdminHomeElement'))
$result['screencast'] = 'NOK';
// PREACTIVATION
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&date_creation='._PS_CREATION_DATE_.'&v='._PS_VERSION_.'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&date_creation='._PS_CREATION_DATE_.'&v='._PS_VERSION_.'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
if (!$content)
$result['partner_preactivation'] = 'NOK';
else
@@ -663,7 +663,7 @@ if (Tools::isSubmit('getAdminHomeElement'))
}
// PREACTIVATION PAYPAL WARNING
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.Tools::strtolower(Language::getIsoById(intval($cookie->id_lang))).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.Tools::strtolower(Context::getContext()->language->iso_code).'&id_lang='.(int)Context::getContext().'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
$content = explode('|', $content);
if ($content[0] == 'OK')
Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', $content[1]);
@@ -671,7 +671,7 @@ if (Tools::isSubmit('getAdminHomeElement'))
Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', '');
// DISCOVER PRESTASHOP
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $stream_context);
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id, false, $stream_context);
if (!$content)
$result['discover_prestashop'] = 'NOK';
else
@@ -685,7 +685,7 @@ if (Tools::isSubmit('getAdminHomeElement'))
if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3))
$result['discover_prestashop'] .= '<iframe frameborder="no" style="margin: 0px; padding: 0px; width: 315px; height: 290px;" src="'.$protocol.'://www.prestashop.com/rss/news2.php?v='._PS_VERSION_.'&lang='.$isoUser.'"></iframe>';
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $stream_context);
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id, false, $stream_context);
$content = explode('|', $content);
if ($content[0] == 'OK')
$result['discover_prestashop'] .= $content[1];
@@ -696,7 +696,7 @@ if (Tools::isSubmit('getAdminHomeElement'))
if (Tools::isSubmit('getChildrenCategories') && Tools::getValue('id_category_parent'))
{
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat', array()), $cookie->id_lang);
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat', array()), Context::getContext()->language->id);
die(Tools::jsonEncode($children_categories));
}
+1 -1
View File
@@ -57,7 +57,7 @@ $items = Db::getInstance()->ExecuteS('
SELECT p.`id_product`, `reference`, pl.name
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product)
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\') AND pl.id_lang = '.(int)($cookie->id_lang).
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\') AND pl.id_lang = '.(int)Context::getContext()->language->id.
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''));
+2 -4
View File
@@ -29,12 +29,10 @@ define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
/* Header can't be included, so cookie must be created here */
$cookie = new Cookie('psAdmin');
if (!$cookie->id_employee)
if (!Context::getContext()->employee->isLoggedBack())
Tools::redirectAdmin('login.php');
$tabAccess = Profile::getProfileAccess($cookie->profile, Tab::getIdFromClassName('AdminBackup'));
$tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminBackup'));
if ($tabAccess['view'] !== '1')
die (Tools::displayError('You do not have permission to view here'));
+1 -2
View File
@@ -27,7 +27,6 @@
define('PS_ADMIN_DIR', getcwd());
include_once(dirname(__FILE__).'/../config/config.inc.php');
$cookie = new Cookie('psAdmin');
$module = Tools::getValue('module');
$render = Tools::getValue('render');
@@ -39,7 +38,7 @@ $height = Tools::getValue('height');
$id_employee = Tools::getValue('id_employee');
$id_lang = Tools::getValue('id_lang');
if ($cookie->id_employee != $id_employee)
if (Context::getContext()->employee->id != $id_employee)
die;
if (!Tools::file_exists_cache($module_path = dirname(__FILE__).'/../modules/'.$module.'/'.$module.'.php'))
+1 -1
View File
@@ -34,7 +34,7 @@ echo ' </div>
<span style="font-size:10px">'.translate('Load time:').' '.number_format(microtime(true) - $timerStart, 3, '.', '').'s</span>
</div>
<div style="float:right;height:40px;margin-right:10px;line-height:38px;vertical-align:middle">';
if (strtoupper(Language::getIsoById($cookie->id_lang)) == 'FR') echo '<span style="color: #812143; font-weight: bold;">Questions / Renseignements / Formations :</span> <strong>+33 (0)1.40.18.30.04</strong> de 09h &agrave; 18h ';
if (strtoupper(Context::getContext()->language->iso_code) == 'FR') echo '<span style="color: #812143; font-weight: bold;">Questions / Renseignements / Formations :</span> <strong>+33 (0)1.40.18.30.04</strong> de 09h &agrave; 18h ';
echo ' | <a href="http://www.prestashop.com/en/contact_us/" target="_blank" class="footer_link">'.translate('Contact').'</a>
| <a href="http://forge.prestashop.com" target="_blank" class="footer_link">'.translate('Bug Tracker').'</a>
+2 -2
View File
@@ -25,8 +25,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
include_once(dirname(__FILE__).'/../config/config.inc.php');
$cookie = new Cookie('psAdmin');
$module = Tools::getValue('module');
$render = Tools::getValue('render');
@@ -41,7 +41,7 @@ $dir = Tools::getValue('dir', 0); // Should be a String : Either ASC or DESC
$id_employee = (int)(Tools::getValue('id_employee'));
$id_lang = (int)(Tools::getValue('id_lang'));
if ($cookie->id_employee != $id_employee)
if (Context::getContext()->employee->id != $id_employee)
die;
if (!Validate::isModuleName($module))
+12 -12
View File
@@ -41,7 +41,7 @@ echo '
<link type="text/css" rel="stylesheet" href="'._PS_JS_DIR_.'jquery/datepicker/datepicker.css" />
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'admin.css" />
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'jquery.cluetip.css" />
<link type="text/css" rel="stylesheet" href="themes/'.$employee->bo_theme.'/admin.css" />
<link type="text/css" rel="stylesheet" href="themes/'.Context::getContext()->employee->bo_theme.'/admin.css" />
<title>PrestaShop&trade; - '.translate('Administration panel').'</title>
<script type="text/javascript">
var helpboxes = '.Configuration::get('PS_HELPBOX').';
@@ -61,20 +61,20 @@ echo '
<![endif]-->
<style type="text/css">
div#header_infos, div#header_infos a#header_shopname, div#header_infos a#header_logout, div#header_infos a#header_foaccess {
color:'.(Tools::getBrightness(empty($employee->bo_color) ? '#FFFFFF' : $employee->bo_color) < 128 ? 'white' : '#383838').'
color:'.(Tools::getBrightness(empty(Context::getContext()->employee->bo_color) ? '#FFFFFF' : Context::getContext()->employee->bo_color) < 128 ? 'white' : '#383838').'
}
</style>
</head>
<body '.((!empty($employee->bo_color)) ? 'style="background:'.Tools::htmlentitiesUTF8($employee->bo_color).'"' : '').'>
<body '.((!empty(Context::getContext()->employee->bo_color)) ? 'style="background:'.Tools::htmlentitiesUTF8(Context::getContext()->employee->bo_color).'"' : '').'>
<div id="top_container">
<div id="container">
<div id="header_infos"><span>
<a id="header_shopname" href="index.php"><span>'.Configuration::get('PS_SHOP_NAME').'</span></a><br />
'.Tools::substr($employee->firstname, 0, 1).'.&nbsp;'.htmlentities($employee->lastname, ENT_COMPAT, 'UTF-8').'
'.Tools::substr(Context::getContext()->employee->firstname, 0, 1).'.&nbsp;'.htmlentities(Context::getContext()->employee->lastname, ENT_COMPAT, 'UTF-8').'
[ <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)$cookie->id_employee.'&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?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>
</span></div>
<div id="header_search">
<form method="post" action="index.php?tab=AdminSearch&token='.Tools::getAdminTokenLite('AdminSearch').'">
@@ -105,14 +105,14 @@ echo '
</script>
<select onchange="quickSelect(this);" id="quick_select">
<option value="0">'.translate('Quick Access').'</option>';
foreach (QuickAccess::getQuickAccesses((int)($cookie->id_lang)) AS $quick)
foreach (QuickAccess::getQuickAccesses(Context::getContext()->language->id) AS $quick)
{
preg_match('/tab=(.+)(&.+)?$/', $quick['link'], $adminTab);
if (isset($adminTab[1]))
{
if (strpos($adminTab[1], '&'))
$adminTab[1] = substr($adminTab[1], 0, strpos($adminTab[1], '&'));
$quick['link'] .= '&token='.Tools::getAdminToken($adminTab[1].(int)(Tab::getIdFromClassName($adminTab[1])).(int)($cookie->id_employee));
$quick['link'] .= '&token='.Tools::getAdminToken($adminTab[1].(int)(Tab::getIdFromClassName($adminTab[1])).(int)(Context::getContext()->employee->id));
}
echo '<option value="'.$quick['link'].($quick['new_window'] ? '_blank' : '').'">&gt; '.$quick['name'].'</option>';
}
@@ -130,23 +130,23 @@ if (empty($tab))
echo '<div class="mainsubtablist" style="display:none"></div>';
$id_parent_tab_current = (int)(Tab::getCurrentParentId());
$tabs = Tab::getTabs((int)$cookie->id_lang, 0);
$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/'.$employee->bo_theme.'/img/t/'.$t['class_name'].'.gif') ? 'themes/'.$employee->bo_theme.'/img/' : _PS_IMG_).'t/'.$t['class_name'].'.gif';
$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']));
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)($cookie->id_employee)).'">
<a href="index.php?tab='.$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>';
$echoLi = '';
$subTabs = Tab::getTabs((int)$cookie->id_lang, (int)$t['id_tab']);
$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>';
@@ -155,7 +155,7 @@ foreach ($tabs AS $t)
$echoLis .= '<div id="tab'.(int)($t['id_tab']).'_subtabs" style="display:none">'.$echoLi.'</div>';
}
echo ' </ul>'.$echoLis;
if ($employee->bo_uimode == 'hover')
if (Context::getContext()->employee->bo_uimode == 'hover')
echo ' <script type="text/javascript">
$("#menu li").hoverIntent({over:hoverTabs,timeout:100,out:outTabs});
function outTabs(){}
+4 -4
View File
@@ -40,7 +40,7 @@ if (empty($tab) and !sizeof($_POST))
if ($adminObj = checkingTab($tab))
{
$isoUser = Language::getIsoById(intval($cookie->id_lang));
$isoUser = Context::getContext()->language->id;
$tabs = array();
$tabs = recursiveTab($adminObj->id, $tabs);
$tabs = array_reverse($tabs);
@@ -49,7 +49,7 @@ if (empty($tab) and !sizeof($_POST))
foreach ($tabs AS $key => $item)
$bread .= ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" alt="&gt;" />
'.((sizeof($tabs) - 1 > $key)
? '<a href="?tab='.$item['class_name'].'&token='.Tools::getAdminToken($item['class_name'].intval($item['id_tab']).intval($cookie->id_employee)).'">'
? '<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
@@ -59,7 +59,7 @@ if (empty($tab) and !sizeof($_POST))
$.ajax({
type: \'POST\',
url: \'ajax.php\',
data: \'helpAccess=1&item='.$item['class_name'].'&isoUser='.$isoUser.'&country='.Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')).'&version='._PS_VERSION_.'\',
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);
@@ -72,7 +72,7 @@ if (empty($tab) and !sizeof($_POST))
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)).intval($cookie->id_employee)).'">'.translate('Back Office').'</a>
<a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).(int)Context::getContext()->employee->id).'">'.translate('Back Office').'</a>
'.$bread;
echo '
</div>';
+9 -11
View File
@@ -30,12 +30,11 @@ $timerStart = microtime(true);
$context = Context::getContext();
if (isset($_GET['logout']))
$cookie->logout();
$context->employee->logout();
if (!$cookie->isLoggedBack())
{
if (!$context->employee->isLoggedBack())
Tools::redirectAdmin('login.php?redirect='.$_SERVER['REQUEST_URI']);
}
// Set current index
$currentIndex = $_SERVER['SCRIPT_NAME'].(($tab = Tools::getValue('tab')) ? '?tab='.$tab : '');
@@ -43,8 +42,7 @@ if ($back = Tools::getValue('back'))
$currentIndex .= '&back='.urlencode($back);
AdminTab::$currentIndex = $currentIndex;
$iso = $language->iso_code;
$iso = $context->language->iso_code;
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
@@ -58,12 +56,12 @@ define('_PS_BASE_URL_', Tools::getShopDomain(true));
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
$path = dirname(__FILE__).'/themes/';
if (empty($employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin.css'))
if (empty($context->employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin.css'))
{
if (file_exists($path.'oldschool/admin.css'))
$employee->bo_theme = 'oldschool';
$context->employee->bo_theme = 'oldschool';
elseif (file_exists($path.'origins/admin.css'))
$employee->bo_theme = 'origins';
$context->employee->bo_theme = 'origins';
else
foreach (scandir($path) as $theme)
if ($theme[0] != '.' AND file_exists($path.$theme.'/admin.css'))
@@ -71,13 +69,13 @@ if (empty($employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin
$employee->bo_theme = $theme;
break;
}
$employee->update();
$context->employee->update();
}
// Change shop context ?
if (Shop::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
{
$cookie->shopContext = Tools::getValue('setShopContext');
$context->cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);
$query = (isset($url['query'])) ? $url['query'] : '';
parse_str($query, $parseQuery);
+4 -4
View File
@@ -74,20 +74,20 @@ if (Tools::isSubmit('Submit'))
{
/* Seeking for employee */
$employee = new Employee();
$employee = $employee->getByemail($email, $passwd);
if (!$employee)
if (!$employee->getByemail($email, $passwd))
{
$errors[] = Tools::displayError('Employee does not exist or password is incorrect.');
$cookie->logout();
$employee->logout();
}
else
{
$employee->remote_addr = ip2long(Tools::getRemoteAddr());
/* Creating cookie */
$cookie->id_employee = $employee->id;
$cookie->email = $employee->email;
$cookie->profile = $employee->id_profile;
$cookie->passwd = $employee->passwd;
$cookie->remote_addr = ip2long(Tools::getRemoteAddr());
$cookie->remote_addr = $employee->remote_addr;
$cookie->write();
/* Redirect to admin panel */
if (isset($_GET['redirect']))
-2
View File
@@ -30,8 +30,6 @@ define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(PS_ADMIN_DIR.'/functions.php');
$cookie = new Cookie('psAdmin', substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__), -10));
$errors = array();
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
+1 -9
View File
@@ -29,17 +29,9 @@ define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
/* Header can't be included, so cookie must be created here */
$context = Context::getContext();
$cookie = new Cookie('psAdmin');
if (!$cookie->id_employee)
if (!Context::getContext()->employee->id)
Tools::redirectAdmin('login.php');
$context->employee = new Employee($cookie->id_employee);
$context->language = new Language($context->employee->id_lang);
$context->country = $defaultCountry;
$functionArray = array(
'pdf' => 'generateInvoicePDF',
'id_order_slip' => 'generateOrderSlipPDF',
+1 -5
View File
@@ -29,11 +29,7 @@ define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
if (!class_exists('Cookie'))
exit();
$cookie = new Cookie('psAdmin', substr($_SERVER['SCRIPT_NAME'], strlen(__PS_BASE_URI__), -10));
if (!$cookie->isLoggedBack())
if (!isset(Context::getContext()->employee) || !Context::getContext()->employee->isLoggedBack())
die;
if (isset($_FILES['virtual_product_file']) AND is_uploaded_file($_FILES['virtual_product_file']['tmp_name']) AND