2016-01-04 12:48:08 +01:00
< ? php
class FrontController extends FrontControllerCore {
public function __construct () {
global $useSSL ;
2017-03-09 10:53:26 +01:00
if ( $_SERVER [ 'SERVER_PORT' ] == _PS_SSL_PORT_ || ! empty ( $_SERVER [ 'HTTPS' ]) && strtolower ( $_SERVER [ 'HTTPS' ]) == 'on' || ( isset ( $_SERVER [ 'HTTP_X_FORWARDED_PROTO' ]) && $_SERVER [ 'HTTP_X_FORWARDED_PORT' ] == '443' ) || Configuration :: get ( 'PS_SSL_ENABLED' )) {
2016-01-04 12:48:08 +01:00
$useSSL = $this -> ssl = TRUE ;
} else {
$useSSL = $this -> ssl ;
}
}
2017-03-08 16:10:35 +01:00
2016-01-04 12:48:08 +01:00
public function displayHeader ()
{
self :: $smarty -> assign ( array (
'HOOK_TOP_MENU' => Module :: hookExec ( 'topMenu' ),
));
parent :: displayHeader ();
}
2017-03-08 16:10:35 +01:00
public function init () {
2016-01-04 12:48:08 +01:00
global $useSSL , $cookie , $smarty , $cart , $iso , $defaultCountry , $protocol_link , $protocol_content , $link , $css_files , $js_files , $site_version ;
if ( self :: $initialized )
return ;
self :: $initialized = true ;
$css_files = array ();
$js_files = array ();
if ( $this -> ssl AND ! Tools :: usingSecureMode () AND Configuration :: get ( 'PS_SSL_ENABLED' ))
{
header ( 'HTTP/1.1 301 Moved Permanently' );
header ( 'Location: ' . Tools :: getShopDomainSsl ( true ) . $_SERVER [ 'REQUEST_URI' ]);
exit ();
}
2017-03-08 16:10:35 +01:00
2016-01-04 12:48:08 +01:00
ob_start ();
/* Loading default country */
$defaultCountry = new Country (( int ) Configuration :: get ( 'PS_COUNTRY_DEFAULT' ), Configuration :: get ( 'PS_LANG_DEFAULT' ));
$cookieLifetime = ( time () + ((( int ) Configuration :: get ( 'PS_COOKIE_LIFETIME_FO' ) > 0 ? ( int ) Configuration :: get ( 'PS_COOKIE_LIFETIME_FO' ) : 1 ) * 3600 ));
$cookie = new Cookie ( 'ps' , '' , $cookieLifetime );
$link = new Link ();
if ( $this -> auth AND ! $cookie -> isLogged ( $this -> guestAllowed ))
Tools :: redirect ( 'authentication.php' . ( $this -> authRedirection ? '?back=' . $this -> authRedirection : '' ));
/* Theme is missing or maintenance */
if ( ! is_dir ( _PS_THEME_DIR_ ))
die ( Tools :: displayError ( 'Current theme unavailable. Please check your theme directory name and permissions.' ));
elseif ( basename ( $_SERVER [ 'PHP_SELF' ]) != 'disabled.php' AND ! ( int )( Configuration :: get ( 'PS_SHOP_ENABLE' )))
$this -> maintenance = true ;
elseif ( Configuration :: get ( 'PS_GEOLOCATION_ENABLED' ))
$this -> geolocationManagement ();
// Switch language if needed and init cookie language
if ( $iso = Tools :: getValue ( 'isolang' ) AND Validate :: isLanguageIsoCode ( $iso ) AND ( $id_lang = ( int )( Language :: getIdByIso ( $iso ))))
$_GET [ 'id_lang' ] = $id_lang ;
Tools :: switchLanguage ();
Tools :: setCookieLanguage ();
/* attribute id_lang is often needed, so we create a constant for performance reasons */
if ( ! defined ( '_USER_ID_LANG_' ))
define ( '_USER_ID_LANG_' , ( int ) $cookie -> id_lang );
if ( isset ( $_GET [ 'logout' ]) OR ( $cookie -> logged AND Customer :: isBanned (( int ) $cookie -> id_customer )))
{
$cookie -> logout ();
Tools :: redirect ( isset ( $_SERVER [ 'HTTP_REFERER' ]) ? $_SERVER [ 'HTTP_REFERER' ] : NULL );
}
elseif ( isset ( $_GET [ 'mylogout' ]))
{
$cookie -> mylogout ();
Tools :: redirect ( isset ( $_SERVER [ 'HTTP_REFERER' ]) ? $_SERVER [ 'HTTP_REFERER' ] : NULL );
}
global $currency ;
$currency = Tools :: setCurrency ();
2017-03-08 16:10:35 +01:00
2016-01-04 12:48:08 +01:00
/* Cart already exists */
if (( int ) $cookie -> id_cart )
{
$cart = new Cart (( int ) $cookie -> id_cart );
if ( $cart -> OrderExists ())
unset ( $cookie -> id_cart , $cart , $cookie -> checkedTOS );
/* Delete product of cart, if user can't make an order from his country */
elseif ( intval ( Configuration :: get ( 'PS_GEOLOCATION_ENABLED' )) AND
! in_array ( strtoupper ( $cookie -> iso_code_country ), explode ( ';' , Configuration :: get ( 'PS_ALLOWED_COUNTRIES' ))) AND
$cart -> nbProducts () AND intval ( Configuration :: get ( 'PS_GEOLOCATION_NA_BEHAVIOR' )) != - 1 AND
! self :: isInWhitelistForGeolocation ())
unset ( $cookie -> id_cart , $cart );
elseif ( $cookie -> id_customer != $cart -> id_customer OR $cookie -> id_lang != $cart -> id_lang OR $cookie -> id_currency != $cart -> id_currency )
{
if ( $cookie -> id_customer )
$cart -> id_customer = ( int )( $cookie -> id_customer );
$cart -> id_lang = ( int )( $cookie -> id_lang );
$cart -> id_currency = ( int )( $cookie -> id_currency );
$cart -> update ();
}
/* Select an address if not set */
if ( isset ( $cart ) && ( ! isset ( $cart -> id_address_delivery ) || $cart -> id_address_delivery == 0 ||
! isset ( $cart -> id_address_invoice ) || $cart -> id_address_invoice == 0 ) && $cookie -> id_customer )
{
$to_update = false ;
if ( ! isset ( $cart -> id_address_delivery ) || $cart -> id_address_delivery == 0 )
{
$to_update = true ;
if ( $_id_address = ( int ) Db :: getInstance () -> getValue ( '
SELECT `id_address_delivery`
FROM `'._DB_PREFIX_.'cart`
WHERE `id_address_delivery` != 0
AND `id_customer` = '.(int) $cart->id_customer.'
ORDER BY `date_upd` DESC
' )) {
$cart -> id_address_delivery = $_id_address ;
} else {
$cart -> id_address_delivery = ( int ) Address :: getFirstCustomerAddressId ( $cart -> id_customer );
}
}
if ( ! isset ( $cart -> id_address_invoice ) || $cart -> id_address_invoice == 0 )
{
$to_update = true ;
if ( $_id_address = ( int ) Db :: getInstance () -> getValue ( '
SELECT `id_address_invoice`
FROM `'._DB_PREFIX_.'cart`
WHERE `id_address_invoice` != 0
AND `id_customer` = '.(int) $cart->id_customer.'
ORDER BY `date_upd` DESC
' )) {
$cart -> id_address_invoice = $_id_address ;
} else {
$cart -> id_address_invoice = ( int ) Address :: getFirstCustomerAddressId ( $cart -> id_customer );
}
}
if ( $to_update )
$cart -> update ();
}
}
if ( ! isset ( $cart ) OR ! $cart -> id )
{
$cart = new Cart ();
$cart -> id_lang = ( int )( $cookie -> id_lang );
$cart -> id_currency = ( int )( $cookie -> id_currency );
$cart -> id_guest = ( int )( $cookie -> id_guest );
if ( $cookie -> id_customer )
{
$cart -> id_customer = ( int )( $cookie -> id_customer );
if ( $_id_address = ( int ) Db :: getInstance () -> getValue ( '
SELECT `id_address_delivery`
FROM `'._DB_PREFIX_.'cart`
WHERE `id_address_delivery` != 0
AND `id_customer` = '.(int) $cart->id_customer.'
ORDER BY `date_upd` DESC
' )) {
$cart -> id_address_delivery = $_id_address ;
} else {
$cart -> id_address_delivery = ( int )( Address :: getFirstCustomerAddressId ( $cart -> id_customer ));
}
$cart -> id_address_invoice = $cart -> id_address_delivery ;
}
else
{
$cart -> id_address_delivery = 0 ;
$cart -> id_address_invoice = 0 ;
}
}
2017-03-08 16:10:35 +01:00
2016-01-04 12:48:08 +01:00
if ( ! $cart -> nbProducts ())
$cart -> id_carrier = NULL ;
if ( isset ( $site_version )) {
if ( $site_version == 'com' ) {
$locale = 'fr_FR.UTF-8' ;
} else {
$locale = strtolower ( $site_version ) . '_' . strtoupper ( $site_version ) . '.UTF-8' ;
}
} else {
$locale = strtolower ( Configuration :: get ( 'PS_LOCALE_LANGUAGE' )) . '_' . strtoupper ( Configuration :: get ( 'PS_LOCALE_COUNTRY' ) . '.UTF-8' );
}
setlocale ( LC_COLLATE , $locale );
setlocale ( LC_CTYPE , $locale );
setlocale ( LC_TIME , $locale );
setlocale ( LC_NUMERIC , 'en_US.UTF-8' );
if ( Validate :: isLoadedObject ( $currency ))
$smarty -> ps_currency = $currency ;
if ( Validate :: isLoadedObject ( $ps_language = new Language (( int ) $cookie -> id_lang )))
$smarty -> ps_language = $ps_language ;
/* get page name to display it in body id */
$page_name = ( isset ( $this -> php_self ) ? preg_replace ( '/\.php$/' , '' , $this -> php_self ) : '' );
if ( preg_match ( '#^' . __PS_BASE_URI__ . 'modules/([a-zA-Z0-9_-]+?)/(.*)$#' , $_SERVER [ 'REQUEST_URI' ], $m ))
$page_name = 'module-' . $m [ 1 ] . '-' . str_replace ( array ( '.php' , '/' ), array ( '' , '-' ), $m [ 2 ]);
$smarty -> assign ( Tools :: getMetaTags ( $cookie -> id_lang , $page_name ));
$smarty -> assign ( 'request_uri' , Tools :: safeOutput ( urldecode ( $_SERVER [ 'REQUEST_URI' ])));
/* Breadcrumb */
$navigationPipe = ( Configuration :: get ( 'PS_NAVIGATION_PIPE' ) ? Configuration :: get ( 'PS_NAVIGATION_PIPE' ) : '>' );
$smarty -> assign ( 'navigationPipe' , $navigationPipe );
2017-03-08 16:10:35 +01:00
//$protocol_link = (Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://' : 'http://';
2017-03-08 17:19:26 +01:00
$protocol_link = ( isset ( $_SERVER [ 'HTTP_X_FORWARDED_PROTO' ]) && $_SERVER [ 'HTTP_X_FORWARDED_PORT' ] == '443' ) ? 'https://' : 'http://' ;
2016-01-04 12:48:08 +01:00
2017-03-08 17:27:37 +01:00
$useSSL = (( isset ( $this -> ssl ) AND $this -> ssl AND Configuration :: get ( 'PS_SSL_ENABLED' )) OR Tools :: usingSecureMode () || $protocol_link == 'https://' ) ? true : false ;
2016-01-04 12:48:08 +01:00
$protocol_content = ( $useSSL ) ? 'https://' : 'http://' ;
if ( ! defined ( '_PS_BASE_URL_' ))
define ( '_PS_BASE_URL_' , Tools :: getShopDomain ( true ));
if ( ! defined ( '_PS_BASE_URL_SSL_' ))
define ( '_PS_BASE_URL_SSL_' , Tools :: getShopDomainSsl ( true ));
$link -> preloadPageLinks ();
$this -> canonicalRedirection ();
Product :: initPricesComputation ();
$display_tax_label = $defaultCountry -> display_tax_label ;
if ( $cart -> { Configuration :: get ( 'PS_TAX_ADDRESS_TYPE' )})
{
$infos = Address :: getCountryAndState (( int )( $cart -> { Configuration :: get ( 'PS_TAX_ADDRESS_TYPE' )}));
$country = new Country (( int ) $infos [ 'id_country' ]);
if ( Validate :: isLoadedObject ( $country ))
$display_tax_label = $country -> display_tax_label ;
}
2017-06-19 11:05:46 +02:00
// @Override Antadis - prevent double fb tracking on registration if customer already exists
if ( $cookie -> isLogged ()) {
$customer = new Customer (( int ) $cookie -> id_customer );
$accountCreationDateTime = new DateTime ( $customer -> date_add );
$nowDateTime = new DateTime ();
$maxTrackingDateInterval = new DateInterval ( 'PT5S' ); //5 seconds
if ( $nowDateTime < $accountCreationDateTime -> add ( $maxTrackingDateInterval )) {
$smarty -> assign ( array ( 'facebook_validation' => true ));
}
}
2016-01-04 12:48:08 +01:00
$smarty -> assign ( array (
'link' => $link ,
'cart' => $cart ,
'currency' => $currency ,
'cookie' => $cookie ,
'page_name' => $page_name ,
'base_dir' => _PS_BASE_URL_ . __PS_BASE_URI__ ,
'base_dir_ssl' => $protocol_link . Tools :: getShopDomainSsl () . __PS_BASE_URI__ ,
'content_dir' => $protocol_content . (( $useSSL ) ? Tools :: getShopDomainSsl () : Tools :: getShopDomain ()) . __PS_BASE_URI__ ,
'tpl_dir' => _PS_THEME_DIR_ ,
'modules_dir' => _MODULE_DIR_ ,
'mail_dir' => _MAIL_DIR_ ,
'lang_iso' => $ps_language -> iso_code ,
'come_from' => Tools :: getHttpHost ( true , true ) . Tools :: htmlentitiesUTF8 ( str_replace ( '\'' , '' , urldecode ( $_SERVER [ 'REQUEST_URI' ]))),
'cart_qties' => ( int ) $cart -> nbProducts (),
'currencies' => Currency :: getCurrencies (),
'languages' => Language :: getLanguages (),
'priceDisplay' => Product :: getTaxCalculationMethod (),
'add_prod_display' => ( int ) Configuration :: get ( 'PS_ATTRIBUTE_CATEGORY_DISPLAY' ),
'shop_name' => Configuration :: get ( 'PS_SHOP_NAME' ),
'roundMode' => ( int ) Configuration :: get ( 'PS_PRICE_ROUND_MODE' ),
'use_taxes' => ( int ) Configuration :: get ( 'PS_TAX' ),
'display_tax_label' => ( bool ) $display_tax_label ,
'vat_management' => ( int ) Configuration :: get ( 'VATNUMBER_MANAGEMENT' ),
'opc' => ( bool ) Configuration :: get ( 'PS_ORDER_PROCESS_TYPE' ),
'PS_CATALOG_MODE' => ( bool ) Configuration :: get ( 'PS_CATALOG_MODE' ),
));
// Deprecated
$smarty -> assign ( array (
'id_currency_cookie' => ( int ) $currency -> id ,
'logged' => $cookie -> isLogged (),
'customerName' => ( $cookie -> logged ? $cookie -> customer_firstname . ' ' . $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
$assignArray = array (
'img_ps_dir' => _PS_IMG_ ,
'img_cat_dir' => _THEME_CAT_DIR_ ,
'img_lang_dir' => _THEME_LANG_DIR_ ,
'img_prod_dir' => _THEME_PROD_DIR_ ,
'img_manu_dir' => _THEME_MANU_DIR_ ,
'img_sup_dir' => _THEME_SUP_DIR_ ,
'img_ship_dir' => _THEME_SHIP_DIR_ ,
'img_store_dir' => _THEME_STORE_DIR_ ,
'img_col_dir' => _THEME_COL_DIR_ ,
'img_dir' => _THEME_IMG_DIR_ ,
'css_dir' => _THEME_CSS_DIR_ ,
'js_dir' => _THEME_JS_DIR_ ,
'pic_dir' => _THEME_PROD_PIC_DIR_
);
2017-03-08 17:19:26 +01:00
foreach ( $assignArray as $assignKey => $assignValue ) {
if ( substr ( $assignValue , 0 , 1 ) == '/' && $protocol_link == 'https://' ) {
2017-03-08 16:10:35 +01:00
$smarty -> assign ( $assignKey , $protocol_link . Tools :: getMediaServer ( $assignValue ) . $assignValue );
2017-03-08 17:19:26 +01:00
} elseif ( substr ( $assignValue , 0 , 1 ) == '/' OR $protocol_content == 'https://' ) {
$smarty -> assign ( $assignKey , $protocol_content . Tools :: getMediaServer ( $assignValue ) . $assignValue );
} else {
2016-01-04 12:48:08 +01:00
$smarty -> assign ( $assignKey , $assignValue );
2017-03-08 17:19:26 +01:00
}
}
2016-01-04 12:48:08 +01:00
// setting properties from global var
self :: $cookie = $cookie ;
self :: $cart = $cart ;
self :: $smarty = $smarty ;
self :: $link = $link ;
if ( $this -> maintenance )
$this -> displayMaintenancePage ();
if ( $this -> restrictedCountry )
$this -> displayRestrictedCountryPage ();
//live edit
if ( Tools :: isSubmit ( 'live_edit' ) AND $ad = Tools :: getValue ( 'ad' ) AND ( Tools :: getValue ( 'liveToken' ) == sha1 ( Tools :: getValue ( 'ad' ) . _COOKIE_KEY_ )))
if ( ! is_dir ( _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . $ad ))
die ( Tools :: displayError ());
$this -> iso = $iso ;
$this -> setMedia ();
}
2017-03-08 16:10:35 +01:00
2016-01-04 12:48:08 +01:00
protected function canonicalRedirection () {
global $link , $cookie ;
if ( Configuration :: get ( 'PS_CANONICAL_REDIRECT' )) {
// Automatically redirect to the canonical URL if needed
if ( isset ( $this -> php_self ) && ! empty ( $this -> php_self )) {
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
$canonicalURL = $link -> getPageLink ( $this -> php_self , $this -> ssl , $cookie -> id_lang );
2017-03-09 10:53:26 +01:00
if ( ! Tools :: getValue ( 'ajax' ) && ! preg_match ( '/^' . Tools :: pRegexp ( $canonicalURL , '/' ) . '([&?].*)?$/' , (( $_SERVER [ 'SERVER_PORT' ] == _PS_SSL_PORT_ || ! empty ( $_SERVER [ 'HTTPS' ]) && strtolower ( $_SERVER [ 'HTTPS' ]) == 'on' || ( isset ( $_SERVER [ 'HTTP_X_FORWARDED_PROTO' ]) && $_SERVER [ 'HTTP_X_FORWARDED_PORT' ] == '443' ) || Configuration :: get ( 'PS_SSL_ENABLED' )) ? 'https://' : 'http://' ) . $_SERVER [ 'HTTP_HOST' ] . $_SERVER [ 'REQUEST_URI' ])) {
2016-01-04 12:48:08 +01:00
header ( 'HTTP/1.0 301 Moved' );
$params = '' ;
$excludedKey = array ( 'isolang' , 'id_lang' );
foreach ( $_GET as $key => $value ) {
if ( ! in_array ( $key , $excludedKey )) {
$params .= ( $params == '' ? '?' : '&' ) . $key . '=' . $value ;
}
}
if ( defined ( '_PS_MODE_DEV_' ) && _PS_MODE_DEV_ && $_SERVER [ 'REQUEST_URI' ] != __PS_BASE_URI__ ) {
die ( '[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . $params . '">' . $canonicalURL . $params . '</a>' );
}
Tools :: redirectLink ( $canonicalURL . $params );
}
}
}
}
public function preProcess () {
/* ini_set ( 'display_errors' , 'on' );
$cmd = 'cd ' . _PS_ROOT_DIR_ . '/themes/site/css/ && /home/www/bebeboutik.com/node_modules/less/bin/lessc --line-numbers=all style.less > style.css' ;
exec ( $cmd ); */
global $page_name , $cookie ;
if ( ! isset ( $this -> php_self )) {
$this -> php_self = strtolower ( basename ( $_SERVER [ 'PHP_SELF' ]));
}
if ( $this -> php_self == '404.php' ) {
$page_name = 'page-404' ;
} else {
if ( preg_match ( '#^' . __PS_BASE_URI__ . 'modules/([a-zA-Z0-9_-]+?)/([^?]*)(\?(.*))?$#' , strtolower ( $_SERVER [ 'REQUEST_URI' ]), $m )) {
$page_name = 'module-' . $m [ 1 ] . '-' . str_replace ( array ( '.php' , '/' ), array ( '' , '-' ), $m [ 2 ]);
} else {
$page_name = preg_replace ( '/\.php$/' , '' , $this -> php_self );
}
}
self :: $smarty -> assign ( array ( 'page_name' => $page_name ));
$displayLeft = array (
/*'page-404',*/ 'address' , 'addresses' , /*'authentication',*/ 'best-sales' ,
'breadcrumb' , /*'category',*/ 'category-cms-tree-branch' ,
'category-tree-branch' , 'cms' , 'contact-form' , 'discount' ,
'errors' , 'footer' , 'guest-tracking' , 'header' , 'history' ,
'identity' , /*'index',*/ 'maintenance' , 'manufacturer' ,
'manufacturer-list' , 'my-account' , 'new-products' , 'order' ,
'order-address' , 'order-carrier' , 'order-confirmation' ,
'order-detail' , 'order-follow' , 'order-opc' ,
'order-opc-new-account' , 'order-payment' , 'order-return' ,
'order-slip' , 'order-steps' , 'pagination' , /*'password',*/ 'payment' ,
'prices-drop' , /*'product',*/ 'product-compare' , 'product-list' ,
'products-comparison' , 'product-sort' , 'restricted-country' ,
'scenes' , 'search' , 'shopping-cart' , 'shopping-cart-product-line' ,
'sitemap' , 'store_infos' , 'stores' , 'supplier' , 'supplier-list' ,
'module-privatesales-salechange' , 'module-invite-invite-program' ,
'module-referralprogram-referral-program' , 'module-cheque-payment' ,
'module-bankwire-payment' , 'module-invite-invite-rules' ,
'module-advsendtoafriend-sendtoafriend-form' , 'featured' ,
'list-tag-sales' ,
2016-02-23 17:33:08 +01:00
'module-contactform-provider' ,
2016-02-24 16:11:24 +01:00
'module-contactform-press' ,
2016-02-24 16:03:29 +01:00
'module-ant_support-help' ,
'module-ant_support_form-support' ,
2016-04-06 15:52:14 +02:00
'module-paypal-express_checkout-payment' ,
2016-05-02 15:30:12 +02:00
'module-paymentinfo-manage' ,
2016-01-04 12:48:08 +01:00
);
$displayRight = array (
/* 'page-404' , 'address' , 'addresses' , 'authentication' , 'best-sales' ,
'breadcrumb' , 'category' , 'category-cms-tree-branch' ,
'category-tree-branch' , 'cms' , 'contact-form' , 'discount' ,
'errors' , 'footer' , 'guest-tracking' , 'header' , 'history' ,
'identity' , 'index' , 'maintenance' , 'manufacturer' ,
'manufacturer-list' , 'my-account' , 'new-products' , 'order' ,
'order-address' , 'order-carrier' , 'order-confirmation' ,
'order-detail' , 'order-follow' , 'order-opc' ,
'order-opc-new-account' , 'order-payment' , 'order-return' ,
'order-slip' , 'order-steps' , 'pagination' , 'password' , 'payment' ,
'prices-drop' , 'product' , 'product-compare' , 'product-list' ,
'products-comparison' , 'product-sort' , 'restricted-country' ,
'scenes' , 'search' , 'shopping-cart' , 'shopping-cart-product-line' ,
'sitemap' , 'store_infos' , 'stores' , 'supplier' , 'supplier-list' ,
'module-privatesales-salechange' , 'module-invite-invite-program' ,
'module-referralprogram-referral-program' , 'module-cheque-payment' ,
'module-bankwire-payment' , 'module-invite-invite-rules' ,
'module-advsendtoafriend-sendtoafriend-form' , 'featured' ,
'list-tag-sales' , */
);
2017-03-08 16:10:35 +01:00
2016-01-04 12:48:08 +01:00
$countCols = count ( array_keys ( $displayLeft + $displayRight , $page_name ));
$addclass = '' ;
if ( $page_name == 'index' ) {
if ( isset ( $_GET [ 'ventes-bebe' ])) {
$addclass = ' vp-bebe' ;
} elseif ( isset ( $_GET [ 'ventes-enfant' ])) {
$addclass = ' vp-enfant' ;
} elseif ( isset ( $_GET [ 'ventes-maman' ])) {
$addclass = ' vp-maman' ;
} else {
$addclass = ' vp-home' ;
}
}
$bodyClass = 'singleCol' . $addclass ;
if ( $countCols == 1 ) {
$bodyClass = 'doubleCol' . $addclass ;
} elseif ( $countCols == 2 ) {
$bodyClass = 'tripleCol' . $addclass ;
}
self :: $smarty -> assign ( array (
'displayLeft' => $displayLeft ,
'displayRight' => $displayRight ,
'bodyClass' => $bodyClass ,
));
if ( $page_name == 'index' && $cookie -> isLogged () ) {
self :: $smarty -> assign ( 'SKINSTATIC_COLUMNS' , file_get_contents ( _PS_ROOT_DIR_ . '/themes/site/skinstatic_cache/columns_1_' . $cookie -> id_lang . '.html' ));
} else if ( $page_name == 'index' ){
self :: $smarty -> assign ( 'SKINSTATIC_COLUMNS' , file_get_contents ( _PS_ROOT_DIR_ . '/themes/site/skinstatic_cache/columns_0_' . $cookie -> id_lang . '.html' ));
}
Module :: hookExec ( 'preprocess' );
parent :: preProcess ();
}
public function setMedia () {
global $cookie ;
2016-06-06 12:35:00 +02:00
Tools :: addCSS ( _THEME_CSS_DIR_ . 'style.css?v=31' );
2016-01-04 12:48:08 +01:00
2017-03-09 11:37:44 +01:00
Tools :: addJS ( array ( Tools :: getShopDomain ( true ) . _PS_JS_DIR_ . 'scripts.js' ));
2016-01-04 12:48:08 +01:00
if ( Tools :: isSubmit ( 'live_edit' ) AND Tools :: getValue ( 'ad' ) AND ( Tools :: getValue ( 'liveToken' ) == sha1 ( Tools :: getValue ( 'ad' ) . _COOKIE_KEY_ ))) {
Tools :: addJS ( array (
2017-03-09 11:37:44 +01:00
Tools :: getShopDomain ( true ) . _PS_JS_DIR_ . 'jquery/jquery-ui-1.8.10.custom.min.js' ,
Tools :: getShopDomain ( true ) . _PS_JS_DIR_ . 'jquery/jquery.fancybox-1.3.4.js' ,
Tools :: getShopDomain ( true ) . _PS_JS_DIR_ . 'hookLiveEdit.js' )
2016-01-04 12:48:08 +01:00
);
Tools :: addCSS ( _PS_CSS_DIR_ . 'jquery.fancybox-1.3.4.css' );
}
$language = new Language ( $cookie -> id_lang );
if ( $language -> is_rtl ) {
Tools :: addCSS ( _THEME_CSS_DIR_ . 'rtl.css' );
}
}
}