diff --git a/classes/Context.php b/classes/Context.php index a41986e7f..83bf3bfbb 100644 --- a/classes/Context.php +++ b/classes/Context.php @@ -104,7 +104,7 @@ class ContextCore * @var boolean|string touch pad device of the customer */ protected $touchpad_device; - + public function getMobileDevice() { if (is_null($this->mobile_device)) @@ -117,10 +117,10 @@ class ContextCore return $this->mobile_device; } - + protected function checkMobileContext() { - return file_exists(_PS_THEME_MOBILE_DIR_) + return file_exists(_PS_THEME_MOBILE_DIR_) && Configuration::get('PS_ALLOW_MOBILE_DEVICE') && isset($_SERVER['HTTP_USER_AGENT']); } @@ -146,7 +146,7 @@ class ContextCore } return $this->touchpad_device; } - + /** * Get a singleton context * diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index e40884983..697065abe 100755 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -325,7 +325,7 @@ class FrontControllerCore extends Controller 'b2b_enable' => (bool)Configuration::get('PS_B2B_ENABLE'), 'request' => $link->getPaginationLink(false, false, false, true) )); - + // Add the tpl files directory for mobile if ($this->context->getMobileDevice() != false) $this->context->smarty->assign(array( @@ -339,7 +339,7 @@ class FrontControllerCore extends Controller 'customerName' => ($this->context->customer->logged ? $this->context->cookie->customer_firstname.' '.$this->context->cookie->customer_lastname : false) )); - $assignArray = array( + $assign_array = array( 'img_ps_dir' => _PS_IMG_, 'img_cat_dir' => _THEME_CAT_DIR_, 'img_lang_dir' => _THEME_LANG_DIR_, @@ -354,16 +354,16 @@ class FrontControllerCore extends Controller 'js_dir' => _THEME_JS_DIR_, 'pic_dir' => _THEME_PROD_PIC_DIR_ ); - + // Add the images directory for mobile if ($this->context->getMobileDevice() != false) - $assignArray['img_mobile_dir'] = _THEME_MOBILE_IMG_DIR_; + $assign_array['img_mobile_dir'] = _THEME_MOBILE_IMG_DIR_; - foreach ($assignArray as $assignKey => $assignValue) - if (substr($assignValue, 0, 1) == '/' || $protocol_content == 'https://') - $this->context->smarty->assign($assignKey, $protocol_content.Tools::getMediaServer($assignValue).$assignValue); + foreach ($assign_array as $assign_key => $assign_value) + if (substr($assign_value, 0, 1) == '/' || $protocol_content == 'https://') + $this->context->smarty->assign($assign_key, $protocol_content.Tools::getMediaServer($assign_value).$assign_value); else - $this->context->smarty->assign($assignKey, $assignValue); + $this->context->smarty->assign($assign_key, $assign_value); /* * These shortcuts are DEPRECATED as of version 1.5. @@ -958,7 +958,7 @@ class FrontControllerCore extends Controller { if ($this->context->getMobileDevice() != false) $this->setMobileTemplate($template); - else + else parent::setTemplate($template); } @@ -970,8 +970,8 @@ class FrontControllerCore extends Controller { $mobile_template = ''; $tpl_file = basename($template); - $dirname = dirname($template).(substr(dirname($template), -1, 1) == '/' ? '' : '/'); - + $dirname = dirname($template).(substr(dirname($template), -1, 1) == '/' ? '' : '/'); + if ($dirname == _PS_THEME_DIR_) { if (file_exists(_PS_THEME_MOBILE_DIR_.$tpl_file))