// Context part 31
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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))' : ''));
|
||||
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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 à 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 à 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>
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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™ - '.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).'. '.htmlentities($employee->lastname, ENT_COMPAT, 'UTF-8').'
|
||||
'.Tools::substr(Context::getContext()->employee->firstname, 0, 1).'. '.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' : '').'">> '.$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(){}
|
||||
|
||||
@@ -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=">" />
|
||||
'.((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>';
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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']))
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -168,10 +168,12 @@ class CookieCore
|
||||
/**
|
||||
* Check customer informations saved into cookie and return customer validity
|
||||
*
|
||||
* @deprecated as of version 1.5 use Customer::isLogged() instead
|
||||
* @return boolean customer validity
|
||||
*/
|
||||
public function isLogged($withGuest = false)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
if (!$withGuest AND $this->is_guest == 1)
|
||||
return false;
|
||||
|
||||
@@ -184,10 +186,12 @@ class CookieCore
|
||||
/**
|
||||
* Check employee informations saved into cookie and return employee validity
|
||||
*
|
||||
* @deprecated as of version 1.5 use Employee::isLoggedBack() instead
|
||||
* @return boolean employee validity
|
||||
*/
|
||||
public function isLoggedBack()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
/* Employee is valid only if it can be load and if cookie password is the same as database one */
|
||||
return ($this->id_employee
|
||||
AND Validate::isUnsignedId($this->id_employee)
|
||||
@@ -198,6 +202,7 @@ class CookieCore
|
||||
|
||||
/**
|
||||
* Delete cookie
|
||||
* As of version 1.5 don't call this function, use Customer::logout() or Employee::logout() instead;
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
@@ -210,7 +215,8 @@ class CookieCore
|
||||
|
||||
/**
|
||||
* Soft logout, delete everything links to the customer
|
||||
* but leave there affiliate's informations
|
||||
* but leave there affiliate's informations.
|
||||
* As of version 1.5 don't call this function, use Customer::mylogout() instead;
|
||||
*/
|
||||
public function mylogout()
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ class CustomerCore extends ObjectModel
|
||||
public $passwd;
|
||||
|
||||
/** @var datetime Password */
|
||||
public $last_passwd_gen;
|
||||
public $last_passwd_gen;
|
||||
|
||||
/** @var boolean Status */
|
||||
public $active = true;
|
||||
@@ -620,4 +620,24 @@ class CustomerCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
if (isset(Context::getContext()->cookie))
|
||||
Context::getContext()->cookie->logout();
|
||||
$this->logged = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Soft logout, delete everything links to the customer
|
||||
* but leave there affiliate's informations
|
||||
*/
|
||||
public function mylogout()
|
||||
{
|
||||
if (isset(Context::getContext()->cookie))
|
||||
Context::getContext()->cookie->mylogout();
|
||||
$this->logged = 0;
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,8 @@ class EmployeeCore extends ObjectModel
|
||||
/** @var boolean show screencast */
|
||||
public $show_screencast = 1;
|
||||
|
||||
public $remote_addr;
|
||||
|
||||
protected $fieldsRequired = array('lastname', 'firstname', 'email', 'passwd', 'id_profile', 'id_lang');
|
||||
protected $fieldsSize = array('lastname' => 32, 'firstname' => 32, 'email' => 128, 'passwd' => 32, 'bo_color' => 32, 'bo_theme' => 32);
|
||||
protected $fieldsValidate = array('lastname' => 'isName', 'firstname' => 'isName', 'email' => 'isEmail', 'id_lang' => 'isUnsignedInt',
|
||||
@@ -209,4 +211,29 @@ class EmployeeCore extends ObjectModel
|
||||
$this->passwd = Tools::encrypt($passwd);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check employee informations saved into cookie and return employee validity
|
||||
*
|
||||
* @return boolean employee validity
|
||||
*/
|
||||
public function isLoggedBack()
|
||||
{
|
||||
/* Employee is valid only if it can be load and if cookie password is the same as database one */
|
||||
return ($this->id
|
||||
AND Validate::isUnsignedId($this->id)
|
||||
AND Employee::checkPassword($this->id, $this->passwd)
|
||||
AND (!isset($this->remote_addr) OR $this->remote_addr == ip2long(Tools::getRemoteAddr()) OR !Configuration::get('PS_COOKIE_CHECKIP'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
if (isset(Context::getContext()->cookie))
|
||||
Context::getContext()->cookie->logout();
|
||||
$this->id = null;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class FrontControllerCore
|
||||
$link = new Link($protocol_link, $protocol_content);
|
||||
$this->context->link = $link;
|
||||
|
||||
if ($this->auth AND !$this->context->cookie->isLogged($this->guestAllowed))
|
||||
if ($this->auth AND !$this->context->customer->isLogged($this->guestAllowed))
|
||||
Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : ''));
|
||||
|
||||
/* Theme is missing or maintenance */
|
||||
@@ -144,14 +144,14 @@ class FrontControllerCore
|
||||
if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault))
|
||||
$this->context->country = $newDefault;
|
||||
|
||||
if (isset($_GET['logout']) OR ($this->context->cookie->logged AND Customer::isBanned((int)$this->context->cookie->id_customer)))
|
||||
if (isset($_GET['logout']) OR ($this->context->customer->logged AND Customer::isBanned($this->context->customer->id)))
|
||||
{
|
||||
$this->context->cookie->logout();
|
||||
$this->context->customer->logout();
|
||||
Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
|
||||
}
|
||||
elseif (isset($_GET['mylogout']))
|
||||
{
|
||||
$this->context->cookie->mylogout();
|
||||
$this->context->customer->mylogout();
|
||||
Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
|
||||
}
|
||||
|
||||
@@ -290,8 +290,8 @@ class FrontControllerCore
|
||||
// Deprecated
|
||||
$this->context->smarty->assign(array(
|
||||
'id_currency_cookie' => (int)$currency->id,
|
||||
'logged' => $this->context->cookie->isLogged(),
|
||||
'customerName' => ($this->context->cookie->logged ? $this->context->cookie->customer_firstname.' '.$this->context->cookie->customer_lastname : false)
|
||||
'logged' => $this->context->customer->isLogged(),
|
||||
'customerName' => ($this->context->customer->logged ? $this->context->cookie->customer_firstname.' '.$this->context->cookie->customer_lastname : false)
|
||||
));
|
||||
|
||||
// TODO for better performances (cache usage), remove these assign and use a smarty function to get the right media server in relation to the full ressource name
|
||||
|
||||
@@ -284,8 +284,10 @@ class ToolsCore
|
||||
*
|
||||
* @return string iso code
|
||||
*/
|
||||
public static function setCookieLanguage($cookie)
|
||||
public static function setCookieLanguage($cookie = null)
|
||||
{
|
||||
if (!$cookie)
|
||||
$cookie = Context::getContext()->cookie;
|
||||
/* If language does not exist or is disabled, erase it */
|
||||
if ($cookie->id_lang)
|
||||
{
|
||||
|
||||
@@ -121,14 +121,12 @@ else
|
||||
if (isset($cookie->id_customer) && (int)$cookie->id_customer)
|
||||
{
|
||||
$customer = new Customer($cookie->id_customer);
|
||||
$customer->id_guest = $cookie->id_guest;
|
||||
$customer->logged = $cookie->logged;
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
$customer = new Customer();
|
||||
$customer->id_guest = $cookie->id_guest;
|
||||
}
|
||||
|
||||
$customer->id_guest = $cookie->id_guest;
|
||||
Context::getContext()->customer = $customer;
|
||||
}
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ class AuthControllerCore extends FrontController
|
||||
$this->context->cookie->customer_firstname = $customer->firstname;
|
||||
$this->context->cookie->passwd = $customer->passwd;
|
||||
$this->context->cookie->logged = 1;
|
||||
$customer->logged = 1;
|
||||
$this->context->cookie->email = $customer->email;
|
||||
$this->context->cookie->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
/* Update cart address */
|
||||
@@ -251,6 +252,7 @@ class AuthControllerCore extends FrontController
|
||||
$this->context->cookie->customer_lastname = $customer->lastname;
|
||||
$this->context->cookie->customer_firstname = $customer->firstname;
|
||||
$this->context->cookie->logged = 1;
|
||||
$customer->logged = 1;
|
||||
$this->context->cookie->is_guest = $customer->isGuest();
|
||||
$this->context->cookie->passwd = $customer->passwd;
|
||||
$this->context->cookie->email = $customer->email;
|
||||
|
||||
@@ -36,8 +36,7 @@ class getFileControllerCore extends FrontController
|
||||
|
||||
public function process()
|
||||
{
|
||||
$cookie = $this->context->cookie;
|
||||
if ($cookie->isLoggedBack() AND Tools::getValue('file'))
|
||||
if (isset($this->context->employee) && $this->context->employee->isLoggedBack() AND Tools::getValue('file'))
|
||||
{
|
||||
/* Admin can directly access to file */
|
||||
$filename = Tools::getValue('file');
|
||||
@@ -62,11 +61,10 @@ class getFileControllerCore extends FrontController
|
||||
if (!($key = Tools::getValue('key')))
|
||||
$this->displayCustomError('Invalid key.');
|
||||
|
||||
$cookie = new Cookie('ps');
|
||||
Tools::setCookieLanguage();
|
||||
if (!$cookie->isLogged() AND !Tools::getValue('secure_key') AND !Tools::getValue('id_order'))
|
||||
if (!$this->context->customer->isLogged() AND !Tools::getValue('secure_key') AND !Tools::getValue('id_order'))
|
||||
Tools::redirect('index.php?controller=authentication&back=get-file.php&key='.$key);
|
||||
elseif (!$cookie->isLogged() AND Tools::getValue('secure_key') AND Tools::getValue('id_order'))
|
||||
elseif (!$this->context->customer->isLogged() AND Tools::getValue('secure_key') AND Tools::getValue('id_order'))
|
||||
{
|
||||
$order = new Order((int)Tools::getValue('id_order'));
|
||||
if (!Validate::isLoadedObject($order))
|
||||
|
||||
@@ -76,7 +76,7 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
'id_order_formatted' => sprintf('#%06d', $this->id_order)
|
||||
));
|
||||
/* If guest we clear the cookie for security reason */
|
||||
$this->context->cookie->logout();
|
||||
$this->context->customer->logout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class OrderControllerCore extends ParentOrderController
|
||||
if ($this->context->customer->is_guest)
|
||||
{
|
||||
$email = $this->context->customer->email;
|
||||
$this->context->cookie->logout(); // If guest we clear the cookie for security reason
|
||||
$this->context->customer->logout(); // If guest we clear the cookie for security reason
|
||||
Tools::redirect('index.php?controller=guest-tracking&id_order='.(int)$id_order.'&email='.urlencode($email));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -149,13 +149,13 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
{
|
||||
$email = $this->context->customer->email;
|
||||
if ($this->context->customer->is_guest)
|
||||
$this->context->cookie->logout(); // If guest we clear the cookie for security reason
|
||||
$this->context->customer->logout(); // If guest we clear the cookie for security reason
|
||||
die('freeorder:'.$id_order.':'.$email);
|
||||
}
|
||||
exit;
|
||||
break;
|
||||
case 'updateAddressesSelected':
|
||||
if ($this->context->cookie->isLogged(true))
|
||||
if ($this->context->customer->isLogged(true))
|
||||
{
|
||||
$id_address_delivery = (int)(Tools::getValue('id_address_delivery'));
|
||||
$id_address_invoice = (int)(Tools::getValue('id_address_invoice'));
|
||||
|
||||
@@ -290,7 +290,7 @@ class ParentOrderControllerCore extends FrontController
|
||||
//if guest checkout disabled and flag is_guest in cookies is actived
|
||||
if(Configuration::get('PS_GUEST_CHECKOUT_ENABLED') == 0 AND ((int)$this->context->customer->is_guest != Configuration::get('PS_GUEST_CHECKOUT_ENABLED')))
|
||||
{
|
||||
$this->context->cookie->logout();
|
||||
$this->context->customer->logout();
|
||||
Tools::redirect('');
|
||||
}
|
||||
elseif (!Customer::getAddressesTotalById($this->context->customer->id))
|
||||
|
||||
@@ -37,9 +37,7 @@ class PdfInvoiceControllerCore extends FrontController
|
||||
public function process()
|
||||
{
|
||||
parent::process();
|
||||
|
||||
$cookie = $this->context->cookie;
|
||||
if (!$cookie->isLogged() AND !Tools::getValue('secure_key'))
|
||||
if (!$this->context->customer->isLogged() AND !Tools::getValue('secure_key'))
|
||||
Tools::redirect('index.php?controller=authentication&back=pdf-invoice');
|
||||
if (!(int)(Configuration::get('PS_INVOICE')))
|
||||
die(Tools::displayError('Invoices are disabled in this shop.'));
|
||||
@@ -47,7 +45,7 @@ class PdfInvoiceControllerCore extends FrontController
|
||||
$order = new Order((int)($_GET['id_order']));
|
||||
if (!isset($order) OR !Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Invoice not found'));
|
||||
elseif ((isset($cookie->id_customer) AND $order->id_customer != $cookie->id_customer) OR (Tools::isSubmit('secure_key') AND $order->secure_key != Tools::getValue('secure_key')))
|
||||
elseif ((isset($this->context->customer->id) AND $order->id_customer != $this->context->customer->id) OR (Tools::isSubmit('secure_key') AND $order->secure_key != Tools::getValue('secure_key')))
|
||||
die(Tools::displayError('Invoice not found'));
|
||||
elseif (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number)
|
||||
die(Tools::displayError('No invoice available'));
|
||||
|
||||
@@ -38,15 +38,14 @@ class PdfOrderReturnControllerCore extends FrontController
|
||||
{
|
||||
parent::process();
|
||||
|
||||
$cookie = $this->context->cookie;
|
||||
if (!$cookie->isLogged())
|
||||
if (!$this->context->customer->isLogged())
|
||||
Tools::redirect('index.php?controller=authentication&back=order-follow');
|
||||
|
||||
if (isset($_GET['id_order_return']) AND Validate::isUnsignedId($_GET['id_order_return']))
|
||||
$orderReturn = new OrderReturn((int)($_GET['id_order_return']));
|
||||
if (!isset($orderReturn) OR !Validate::isLoadedObject($orderReturn))
|
||||
die(Tools::displayError('Order return not found'));
|
||||
else if ($orderReturn->id_customer != $cookie->id_customer)
|
||||
else if ($orderReturn->id_customer != $this->context->customer->id)
|
||||
die(Tools::displayError('Order return not found'));
|
||||
else if ($orderReturn->state < 2)
|
||||
die(Tools::displayError('Order return not confirmed'));
|
||||
|
||||
@@ -38,15 +38,14 @@ class PdfOrderSlipControllerCore extends FrontController
|
||||
{
|
||||
parent::process();
|
||||
|
||||
$cookie = $this->context->cookie;
|
||||
if (!$cookie->isLogged())
|
||||
if (!$this->context->customer->isLogged())
|
||||
Tools::redirect('index.php?controller=authentication&back=order-follow');
|
||||
|
||||
if (isset($_GET['id_order_slip']) AND Validate::isUnsignedId($_GET['id_order_slip']))
|
||||
$orderSlip = new OrderSlip((int)($_GET['id_order_slip']));
|
||||
if (!isset($orderSlip) OR !Validate::isLoadedObject($orderSlip))
|
||||
die(Tools::displayError('Order return not found'));
|
||||
elseif ($orderSlip->id_customer != $cookie->id_customer)
|
||||
elseif ($orderSlip->id_customer != $this->context->customer->id)
|
||||
die(Tools::displayError('Order return not found'));
|
||||
$order = new Order((int)($orderSlip->id_order));
|
||||
if (!Validate::isLoadedObject($order))
|
||||
|
||||
@@ -32,7 +32,7 @@ include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
include(dirname(__FILE__).'/bankwire.php');
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
Tools::redirect('index.php?controller=authentication&back=order.php');
|
||||
$bankwire = new BankWire();
|
||||
echo $bankwire->execPayment($cart);
|
||||
|
||||
@@ -58,7 +58,7 @@ class BlockMyAccount extends Module
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
if (!$params['cookie']->isLogged())
|
||||
if ($this->context->customer->isLogged())
|
||||
return false;
|
||||
$this->context->smarty->assign(array(
|
||||
'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')),
|
||||
|
||||
@@ -62,10 +62,10 @@ class BlockUserInfo extends Module
|
||||
$this->context->smarty->assign(array(
|
||||
'cart' => $this->context->cart,
|
||||
'cart_qties' => $this->context->cart->nbProducts(),
|
||||
'logged' => $this->context->cookie->isLogged(),
|
||||
'customerName' => ($this->context->cookie->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
|
||||
'firstName' => ($this->context->cookie->logged ? $this->context->customer->firstname : false),
|
||||
'lastName' => ($this->context->cookie->logged ? $this->context->customer->lastname : false),
|
||||
'logged' => $this->context->customer->isLogged(),
|
||||
'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
|
||||
'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
|
||||
'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
|
||||
'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
|
||||
));
|
||||
return $this->display(__FILE__, 'blockuserinfo.tpl');
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
<div id="header_user">
|
||||
<p id="header_user_info">
|
||||
{l s='Welcome' mod='blockuserinfo'},
|
||||
{if $cookie->isLogged()}
|
||||
<span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span>
|
||||
{if $logged}
|
||||
<span>{$firstName} {$lastName}</span>
|
||||
(<a href="{$link->getPageLink('index', true, NULL, "mylogout")}" title="{l s='Log me out' mod='blockuserinfo'}">{l s='Log out' mod='blockuserinfo'}</a>)
|
||||
{else}
|
||||
<a href="{$link->getPageLink('my-account', true)}">{l s='Log in' mod='blockuserinfo'}</a>
|
||||
|
||||
@@ -178,26 +178,26 @@ class BlockWishList extends Module
|
||||
global $errors;
|
||||
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
if ($params['cookie']->isLogged())
|
||||
if ($this->context->customer->isLogged())
|
||||
{
|
||||
$wishlists = Wishlist::getByIdCustomer($params['cookie']->id_customer);
|
||||
if (empty($params['cookie']->id_wishlist) === true ||
|
||||
WishList::exists($params['cookie']->id_wishlist, $params['cookie']->id_customer) === false)
|
||||
$wishlists = Wishlist::getByIdCustomer($this->context->customer->id);
|
||||
if (empty($this->context->cookie->id_wishlist) === true ||
|
||||
WishList::exists($this->context->cookie->id_wishlist, $this->context->customer->id) === false)
|
||||
{
|
||||
if (!sizeof($wishlists))
|
||||
$id_wishlist = false;
|
||||
else
|
||||
{
|
||||
$id_wishlist = (int)($wishlists[0]['id_wishlist']);
|
||||
$params['cookie']->id_wishlist = (int)($id_wishlist);
|
||||
$this->context->cookie->id_wishlist = (int)($id_wishlist);
|
||||
}
|
||||
}
|
||||
else
|
||||
$id_wishlist = $params['cookie']->id_wishlist;
|
||||
$id_wishlist = $this->context->cookie->id_wishlist;
|
||||
$this->context->smarty->assign(array(
|
||||
'id_wishlist' => $id_wishlist,
|
||||
'isLogged' => true,
|
||||
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $params['cookie']->id_customer, $params['cookie']->id_lang, null, true)),
|
||||
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $this->context->customer->id, $this->context->language->id, null, true)),
|
||||
'wishlists' => $wishlists,
|
||||
'ptoken' => Tools::getToken(false)));
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ $quantity = (int)(Tools::getValue('quantity'));
|
||||
$id_product_attribute = (int)(Tools::getValue('id_product_attribute'));
|
||||
if (Configuration::get('PS_TOKEN_ENABLE') == 1 AND
|
||||
strcmp(Tools::getToken(false), Tools::getValue('token')) AND
|
||||
$context->cookie->isLogged() === true)
|
||||
$context->customer->isLogged() === true)
|
||||
echo Tools::displayError('Invalid token');
|
||||
if ($context->cookie->isLogged())
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
if ($id_wishlist AND WishList::exists($id_wishlist, $context->customer->id) === true)
|
||||
$context->cookie->id_wishlist = (int)($id_wishlist);
|
||||
|
||||
@@ -32,7 +32,7 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
$context = Context::getContext();
|
||||
if ($context->cookie->isLogged())
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
$action = Tools::getValue('action');
|
||||
$id_wishlist = (int)Tools::getValue('id_wishlist');
|
||||
|
||||
@@ -35,7 +35,7 @@ include_once(dirname(__FILE__).'/WishList.php');
|
||||
$context = Context::getContext();
|
||||
$errors = array();
|
||||
|
||||
if ($cookie->isLogged())
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
$add = Tools::getIsset('add');
|
||||
$add = (empty($add) === false ? 1 : 0);
|
||||
|
||||
@@ -29,12 +29,14 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Configuration::get('PS_TOKEN_ENABLE') == 1 AND
|
||||
strcmp(Tools::getToken(false), Tools::getValue('token')) AND
|
||||
$context->cookie->isLogged() === true)
|
||||
$context->customer->isLogged() === true)
|
||||
exit(Tools::displayError('invalid token',false));
|
||||
|
||||
if ($context->cookie->isLogged())
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
$id_wishlist = (int)(Tools::getValue('id_wishlist'));
|
||||
if (empty($id_wishlist) === true)
|
||||
|
||||
@@ -32,7 +32,7 @@ include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
include(dirname(__FILE__).'/cheque.php');
|
||||
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
Tools::redirect('index.php?controller=authentication&back=order.php');
|
||||
|
||||
$cheque = new Cheque();
|
||||
|
||||
@@ -33,7 +33,7 @@ require_once(dirname(__FILE__).'/../../init.php');
|
||||
|
||||
require_once(dirname(__FILE__).'/FavoriteProduct.php');
|
||||
|
||||
if (!Context::getContext()->cookie->isLogged())
|
||||
if (!Context::getContext()->customer->isLogged())
|
||||
Tools::redirect('authentication.php?back=modules/favoriteproducts/favoriteproducts.php');
|
||||
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
|
||||
@@ -78,7 +78,7 @@ class FavoriteProducts extends Module
|
||||
{
|
||||
include_once(dirname(__FILE__).'/FavoriteProduct.php');
|
||||
|
||||
$favoriteProducts = FavoriteProduct::getFavoriteProducts((int)$this->context->cookie->id_customer, (int)$this->context->cookie->id_lang);
|
||||
$favoriteProducts = FavoriteProduct::getFavoriteProducts($this->context->customer->id, $this->context->language->id);
|
||||
|
||||
$this->context->smarty->assign(array('favorite_products' => $favoriteProducts));
|
||||
|
||||
@@ -95,8 +95,8 @@ class FavoriteProducts extends Module
|
||||
include_once(dirname(__FILE__).'/FavoriteProduct.php');
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'isCustomerFavoriteProduct' => (FavoriteProduct::isCustomerFavoriteProduct((int)($this->context->cookie->id_customer), Tools::getValue('id_product')) ? 1 : 0),
|
||||
'isLogged' => (int)$this->context->cookie->id_customer));
|
||||
'isCustomerFavoriteProduct' => (FavoriteProduct::isCustomerFavoriteProduct($this->context->customer->id, Tools::getValue('id_product')) ? 1 : 0),
|
||||
'isLogged' => (int)$this->context->customer->logged));
|
||||
|
||||
return $this->display(__FILE__, 'favoriteproducts-extra.tpl');
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/gcheckout.php');
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
Tools::redirect('index.php?controller=authentication&back=order.php');
|
||||
elseif (!$cart->getOrderTotal(true, Cart::BOTH))
|
||||
Tools::displayError('Error: Empty cart');
|
||||
|
||||
@@ -32,7 +32,7 @@ include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/hipay.php');
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
Tools::redirect('index.php?controller=authentication&back=order.php');
|
||||
|
||||
$hipay = new HiPay();
|
||||
|
||||
@@ -34,10 +34,10 @@ require_once(dirname(__FILE__).'/../../init.php');
|
||||
include_once(dirname(__FILE__).'/LoyaltyModule.php');
|
||||
include_once(dirname(__FILE__).'/LoyaltyStateModule.php');
|
||||
|
||||
if (!$cookie->isLogged())
|
||||
$context = Context::getContext();
|
||||
if (!$context->customer->isLogged())
|
||||
Tools::redirect('index.php?controller=authentication&back=modules/loyalty/loyalty-program.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(_PS_CSS_DIR_.'jquery.cluetip.css', 'all');
|
||||
$context->controller->addJS(array(_PS_JS_DIR_.'jquery/jquery.dimensions.js',_PS_JS_DIR_.'jquery/jquery.cluetip.js'));
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ if (!$id_product = (int)(Tools::getValue('id_product')))
|
||||
die ('0');
|
||||
$id_product_attribute = (int)(Tools::getValue('id_product_attribute'));
|
||||
|
||||
if (!$cookie->isLogged())
|
||||
if (!Context::getContext()->customer->isLogged())
|
||||
{
|
||||
$customer_email = trim(Tools::getValue('customer_email'));
|
||||
if (empty($customer_email) OR !Validate::isEmail($customer_email))
|
||||
@@ -53,7 +53,7 @@ if (!$cookie->isLogged())
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_customer = (int)($cookie->id_customer);
|
||||
$id_customer = (int)Context::getContext()->customer->id;
|
||||
$customer_email = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/../../modules/mailalerts/mailalerts.php');
|
||||
|
||||
if (!$cookie->isLogged())
|
||||
if (!Context::getContext()->customer->isLogged())
|
||||
die('0');
|
||||
|
||||
$id_customer = (int)($cookie->id_customer);
|
||||
$id_customer = (int)(Context::getContext()->customer->id);
|
||||
if (!$id_product = (int)(Tools::getValue('id_product')))
|
||||
die ('0');
|
||||
$id_product_attribute = (int)(Tools::getValue('id_product_attribute'));
|
||||
|
||||
@@ -258,7 +258,7 @@ class MailAlerts extends Module
|
||||
$id_product = (int)($params['product']->id);
|
||||
$id_product_attribute = 0;
|
||||
|
||||
if (!$this->context->cookie->isLogged())
|
||||
if (!$this->context->customer->isLogged())
|
||||
$this->context->smarty->assign('email', 1);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -34,24 +34,24 @@ include_once(dirname(__FILE__).'/mailalerts.php');
|
||||
|
||||
$errors = array();
|
||||
|
||||
if ($cookie->isLogged())
|
||||
if (Context::getContext()->customer->isLogged())
|
||||
{
|
||||
if (Tools::getValue('action') == 'delete')
|
||||
{
|
||||
$id_customer = (int)($cookie->id_customer);
|
||||
$id_customer = (int)(Context::getContext()->customer->id);
|
||||
if (!$id_product = (int)(Tools::getValue('id_product')))
|
||||
$errors[] = Tools::displayError('You must have a product to delete an alert.');
|
||||
$id_product_attribute = (int)(Tools::getValue('id_product_attribute'));
|
||||
$customer = new Customer((int)($id_customer));
|
||||
MailAlerts::deleteAlert((int)($id_customer), 0, (int)($id_product), (int)($id_product_attribute));
|
||||
}
|
||||
$smarty->assign('alerts', MailAlerts::getProductsAlerts((int)($cookie->id_customer), (int)($cookie->id_lang)));
|
||||
$smarty->assign('alerts', MailAlerts::getProductsAlerts(Context::getContext()->customer->id, (int)Context::getContext()->language->id));
|
||||
}
|
||||
else
|
||||
$errors[] = Tools::displayError('You must be logged in to manage your alerts.');
|
||||
|
||||
$smarty->assign(array(
|
||||
'id_customer' => (int)($cookie->id_customer),
|
||||
'id_customer' => (int)(Context::getContext()->customer->id),
|
||||
'errors' => $errors
|
||||
));
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ function displayConfirm()
|
||||
{
|
||||
global $ppExpress, $payerID;
|
||||
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
die('Not logged');
|
||||
if (!$payerID AND !$payerID = Tools::htmlentitiesUTF8(strval(Tools::getValue('payerID'))))
|
||||
die('No payer ID');
|
||||
@@ -127,7 +127,7 @@ function submitConfirm()
|
||||
{
|
||||
global $ppExpress;
|
||||
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
die('Not logged');
|
||||
elseif (!$currency = (int)(Tools::getValue('currency_payement')))
|
||||
die('No currency');
|
||||
@@ -187,6 +187,7 @@ function submitAccount()
|
||||
$context->cookie->customer_firstname = $customer->firstname;
|
||||
$context->cookie->passwd = $customer->passwd;
|
||||
$context->cookie->logged = 1;
|
||||
$customer->logged = 1;
|
||||
$context->cookie->email = $customer->email;
|
||||
Module::hookExec('createAccount', array(
|
||||
'_POST' => $_POST,
|
||||
@@ -232,6 +233,7 @@ function submitLogin()
|
||||
$context->cookie->customer_lastname = $customer->lastname;
|
||||
$context->cookie->customer_firstname = $customer->firstname;
|
||||
$context->cookie->logged = 1;
|
||||
$customer->logged = 1;
|
||||
$context->cookie->passwd = $customer->passwd;
|
||||
$context->cookie->email = $customer->email;
|
||||
if (Configuration::get('PS_CART_FOLLOWING') AND (empty($context->cookie->id_cart) OR Cart::getNbProducts($context->cookie->id_cart) == 0))
|
||||
@@ -252,11 +254,13 @@ function displayLogin()
|
||||
// Customer exists, login form
|
||||
|
||||
// If customer already logged, check if same mail than PayPal, and go through, or unlog
|
||||
if (Context::getContext()->cookie->isLogged(true) AND isset($result['EMAIL']) AND Context::getContext()->cookie->email == $result['EMAIL'])
|
||||
if (Context::getContext()->customer->isLogged(true) AND isset($result['EMAIL']) AND Context::getContext()->customer->email == $result['EMAIL'])
|
||||
displayProcess($payerID);
|
||||
elseif (Context::getContext()->cookie->isLogged(true))
|
||||
elseif (Context::getContext()->customer->isLogged(true))
|
||||
{
|
||||
Context::getContext()->cookie->makeNewLog();
|
||||
|
||||
Context::getContext()->customer = new Customer();
|
||||
}
|
||||
// Smarty assigns
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'email' => $email,
|
||||
@@ -279,9 +283,11 @@ function displayAccount()
|
||||
// Customer does not exists, signup form
|
||||
|
||||
// If customer already logged, unlog him
|
||||
if (Context::getContext()->cookie->isLogged(true))
|
||||
if (Context::getContext()->customer->isLogged(true))
|
||||
{
|
||||
Context::getContext()->cookie->makeNewLog();
|
||||
|
||||
Context::getContext()->customer = new Customer();
|
||||
}
|
||||
// Generate years, months and days
|
||||
if (isset($_POST['years']) AND is_numeric($_POST['years']))
|
||||
$selectedYears = (int)($_POST['years']);
|
||||
@@ -332,7 +338,7 @@ function displayAccount()
|
||||
|
||||
// #####
|
||||
// Process !!
|
||||
/*if (!Context::getContext()->cookie->isLogged(true))
|
||||
/*if (!Context::getContext()->customer->isLogged(true))
|
||||
{
|
||||
displayAccount();
|
||||
die('Not logged');
|
||||
|
||||
@@ -73,7 +73,7 @@ function displayConfirm()
|
||||
{
|
||||
global $ppPayment;
|
||||
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
{
|
||||
header('location:../../../'); exit;
|
||||
die('Not logged');
|
||||
@@ -109,7 +109,7 @@ function submitConfirm()
|
||||
{
|
||||
global $ppPayment;
|
||||
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
{
|
||||
header('location:../../../'); exit;
|
||||
die('Not logged');
|
||||
@@ -128,7 +128,7 @@ function submitConfirm()
|
||||
function validOrder()
|
||||
{
|
||||
global $ppPayment;
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
{
|
||||
header('location:../../../'); exit;
|
||||
die('Not logged');
|
||||
@@ -151,7 +151,7 @@ function validOrder()
|
||||
// #####
|
||||
// Process !!
|
||||
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
if (!Context::getContext()->customer->isLogged(true))
|
||||
die('Not logged');
|
||||
elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH))
|
||||
die('Empty cart');
|
||||
|
||||
@@ -209,7 +209,7 @@ class PayPal extends PaymentModule
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
if (Configuration::get('PAYPAL_EXPRESS_CHECKOUT') AND !$this->context->cookie->isLogged(true) AND $this->_isPayPalAPIAvailable())
|
||||
if (Configuration::get('PAYPAL_EXPRESS_CHECKOUT') AND !$this->context->customer->isLogged(true) AND $this->_isPayPalAPIAvailable())
|
||||
{
|
||||
$this->context->smarty->assign('logo', $this->getLogo(true));
|
||||
return $this->display(__FILE__, 'express/shopping_cart.tpl');
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<a href="#idTab5">{l s='Read user reviews' mod='productcomments'} ({$nbComments})</a><br/>
|
||||
{if ($too_early == false AND ($cookie->isLogged() OR $allow_guests))}
|
||||
{if ($too_early == false AND ($logged OR $allow_guests))}
|
||||
<a id="new_comment_btn" href="#new_comment_form">{l s='Give your advice' mod='productcomments'}</a>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -111,7 +111,7 @@
|
||||
<input name="title" type="text" value=""/><br/>
|
||||
<label for="content">{l s='Comment' mod='productcomments'} *:</label>
|
||||
<textarea name="content"></textarea>
|
||||
{if $allow_guests == true && $cookie->isLogged() == false}
|
||||
{if $allow_guests == true && $logged == 0}
|
||||
<label>{l s='Your name:' mod='productcomments'} *:</label>
|
||||
<input name="customer_name" type="text" value=""/><br/>
|
||||
{/if}
|
||||
|
||||
@@ -606,7 +606,7 @@ class ProductComments extends Module
|
||||
$image = Product::getCover((int)($_GET['id_product']));
|
||||
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'logged' => (int)Context::getContext()->cookie->id_customer,
|
||||
'logged' => (int)Context::getContext()->customer->isLogged(true),
|
||||
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
|
||||
'productcomment_cover' => (int)Tools::getValue('id_product').'-'.(int)$image['id_image'],
|
||||
'mediumSize' => Image::getSize('medium'),
|
||||
@@ -690,7 +690,7 @@ class ProductComments extends Module
|
||||
$averageTotal = count($averages) ? ($averageTotal / count($averages)) : 0;
|
||||
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'logged' => (int)Context::getContext()->cookie->id_customer,
|
||||
'logged' => (int)Context::getContext()->customer->isLogged(true),
|
||||
'action_url' => '',
|
||||
'comments' => ProductComment::getByProduct((int)Tools::getValue('id_product'), 1, null, Context::getContext()->cookie->id_customer),
|
||||
'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), Context::getContext()->language->id),
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
{if $comment.total_advice > 0}
|
||||
<li>{$comment.total_useful} {l s='out of' mod='productcomments'} {$comment.total_advice} {l s='people found this review useful' mod='productcomments'}</li>
|
||||
{/if}
|
||||
{if $cookie->isLogged() == true}
|
||||
{if $logged == 1}
|
||||
{if !$comment.customer_advice}
|
||||
<li>{l s='Was this comment useful to you?' mod='productcomments'}<button class="usefulness_btn" id="comment_useful_yes_{$comment.id_product_comment}">{l s='yes' mod='productcomments'}</button><button class="usefulness_btn" id="comment_useful_no_{$comment.id_product_comment}">{l s='no' mod='productcomments'}</button></li>
|
||||
{/if}
|
||||
|
||||
@@ -27,13 +27,10 @@
|
||||
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../../init.php');
|
||||
/*
|
||||
if (!$cookie->isLogged())
|
||||
Tools::redirect('../../authentication.php?back=modules/referralprogram/referralprogram-program.php');
|
||||
*/
|
||||
|
||||
$shop_name = htmlentities(Configuration::get('PS_SHOP_NAME'), NULL, 'utf-8');
|
||||
$shop_url = Tools::getHttpHost(true, true);
|
||||
$customer = new Customer((int)($cookie->id_customer));
|
||||
$customer = Context::getContext()->customer;
|
||||
|
||||
if (!preg_match("#.*\.html$#Ui", Tools::getValue('mail')) OR !preg_match("#.*\.html$#Ui", Tools::getValue('mail')))
|
||||
die(Tools::displayError());
|
||||
@@ -49,7 +46,7 @@ $file = str_replace('{email}', $customer->email, $file);
|
||||
$file = str_replace('{firstname_friend}', 'XXXXX', $file);
|
||||
$file = str_replace('{lastname_friend}', 'xxxxxx', $file);
|
||||
$file = str_replace('{link}', 'authentication.php?create_account=1', $file);
|
||||
$file = str_replace('{discount}', Discount::display((float)(Configuration::get('REFERRAL_DISCOUNT_VALUE_' . $cookie->id_currency)), (int)(Configuration::get('REFERRAL_DISCOUNT_TYPE')), new Currency($cookie->id_currency)), $file);
|
||||
$file = str_replace('{discount}', Discount::display((float)(Configuration::get('REFERRAL_DISCOUNT_VALUE_' . Context::getContext()->currency->id)), (int)(Configuration::get('REFERRAL_DISCOUNT_TYPE')), Context::getContext()->currency), $file);
|
||||
|
||||
echo $file;
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@ require_once(dirname(__FILE__).'/../../init.php');
|
||||
|
||||
include_once(dirname(__FILE__).'/ReferralProgramModule.php');
|
||||
|
||||
if (!$cookie->isLogged())
|
||||
$context = Context::getContext();
|
||||
if (!$context->customer->isLogged())
|
||||
Tools::redirect('index.php?controller=authentication&back=modules/referralprogram/referralprogram-program.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(_PS_CSS_DIR_.'thickbox.css', 'all');
|
||||
$context->controller->addJS(array(_PS_JS_DIR_.'jquery/thickbox-modified.js',_PS_JS_DIR_.'jquery/jquery.idTabs.modified.js'));
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ class TrustedShopsRating extends AbsTrustedShops
|
||||
{
|
||||
$buyer_email = '';
|
||||
|
||||
if (Context::getContext()->cookie->isLogged())
|
||||
if (Context::getContext()->customer->isLogged())
|
||||
{
|
||||
if (empty($id_order) && !empty(Context::getContext()->customer->id))
|
||||
$id_order = $this->_getLastOrderId(Context::getContext()->customer->id);
|
||||
|
||||
Reference in New Issue
Block a user