public function initContent() { if (!Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) { // You can uncomment these lines if you want to force https even from localhost and automatically redirect // header('HTTP/1.1 301 Moved Permanently'); // header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']); // exit(); $clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'), explode(',', Configuration::get('PS_MAINTENANCE_IP')))); // If ssl is enabled, https protocol is required. Exception for maintenance and local (127.0.0.1) IP if ($clientIsMaintenanceOrLocal) { $warningSslMessage = Tools::displayError('SSL is activated. However, your IP is allowed to enter unsecure mode for maintenance or local IP issues.'); } else { $url = 'https://' . Tools::safeOutput(Tools::getServerName()) . Tools::safeOutput($_SERVER['REQUEST_URI']); $warningSslMessage = sprintf(Translate::ppTags(Tools::displayError('SSL is activated. Please connect using the following link to [1]log into secure mode (https://)[/1]', false), array('<a href="%s">')), $url); } $this->context->smarty->assign('warningSslMessage', $warningSslMessage); } if (file_exists(_PS_ADMIN_DIR_ . '/../install')) { $this->context->smarty->assign('wrong_install_name', true); } if (basename(_PS_ADMIN_DIR_) == 'admin' && file_exists(_PS_ADMIN_DIR_ . '/../admin/')) { $rand = 'admin' . sprintf('%03d', rand(0, 999)) . Tools::strtolower(Tools::passwdGen(6)) . '/'; if (@rename(_PS_ADMIN_DIR_ . '/../admin/', _PS_ADMIN_DIR_ . '/../' . $rand)) { Tools::redirectAdmin('../' . $rand); } else { $this->context->smarty->assign(array('wrong_folder_name' => true)); } } else { $rand = basename(_PS_ADMIN_DIR_) . '/'; } $this->context->smarty->assign(array('randomNb' => $rand, 'adminUrl' => Tools::getCurrentUrlProtocolPrefix() . Tools::getShopDomain() . __PS_BASE_URI__ . $rand)); // Redirect to admin panel if (Tools::isSubmit('redirect') && Validate::isControllerName(Tools::getValue('redirect'))) { $this->context->smarty->assign('redirect', Tools::getValue('redirect')); } else { $tab = new Tab((int) $this->context->employee->default_tab); $this->context->smarty->assign('redirect', $this->context->link->getAdminLink($tab->class_name)); } if ($nb_errors = count($this->errors)) { $this->context->smarty->assign(array('errors' => $this->errors, 'nbErrors' => $nb_errors, 'shop_name' => Tools::safeOutput(Configuration::get('PS_SHOP_NAME')), 'disableDefaultErrorOutPut' => true)); } if ($email = Tools::getValue('email')) { $this->context->smarty->assign('email', $email); } if ($password = Tools::getValue('password')) { $this->context->smarty->assign('password', $password); } $this->setMedia(); $this->initHeader(); parent::initContent(); $this->initFooter(); //force to disable modals $this->context->smarty->assign('modals', null); }