/** * Constructor * * @param $template \SP\Template con instancia de plantilla * @param null $page El nombre de página para la clase del body * @param bool $initialize Si es una inicialización completa */ public function __construct(\SP\Template $template = null, $page = null, $initialize = true) { parent::__construct($template); if ($initialize) { $this->view->assign('startTime', microtime()); $this->view->addTemplate('header'); $this->view->addTemplate('body-start'); $this->view->assign('sk', SessionUtil::getSessionKey(true)); $this->view->assign('appInfo', Util::getAppInfo()); $this->view->assign('appVersion', Util::getVersionString()); $this->view->assign('isDemoMode', Util::demoIsEnabled()); $this->view->assign('page', $page); $this->view->assign('loggedIn', \SP\Init::isLoggedIn()); $this->view->assign('logoIcon', Init::$WEBURI . '/imgs/logo.png'); $this->view->assign('logoNoText', Init::$WEBURI . '/imgs/logo.svg'); $this->view->assign('logo', Init::$WEBURI . '/imgs/logo_full.svg'); $this->view->assign('httpsEnabled', Util::httpsEnabled()); // Cargar la clave pública en la sesión SessionUtil::loadPublicKey(); $this->getResourcesLinks(); $this->setResponseHeaders(); } }
/** * Comprobar y forzar (si es necesario) la coneción HTTPS */ private static function checkHttps() { if (Util::forceHttpsIsEnabled() && !Util::httpsEnabled()) { $port = $_SERVER['SERVER_PORT'] != 443 ? ':' . $_SERVER['SERVER_PORT'] : ''; $fullUrl = 'https://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']; header('Location: ' . $fullUrl); } }