/** * Obtener los datos para la cabcera de la página */ public function getResourcesLinks() { $cssVersionHash = 'v=' . md5(implode(Util::getVersion()) . Util::resultsCardsIsEnabled()); $this->view->assign('cssLink', Init::$WEBROOT . '/css/css.php?' . $cssVersionHash); $jsVersionHash = 'v=' . md5(implode(Util::getVersion())); $this->view->assign('jsLink', Init::$WEBROOT . '/js/js.php?' . $jsVersionHash); $themeInfo = Themes::getThemeInfo(); if (isset($themeInfo['js'])) { $themeJsBase = 'b=' . urlencode(Themes::$themePath . DIRECTORY_SEPARATOR . 'js'); $themeJsFiles = 'f=' . urlencode(implode(',', $themeInfo['js'])); $this->view->assign('jsLinkTheme', Init::$WEBROOT . '/js/js.php?' . $themeJsFiles . '&' . $themeJsBase . '&' . $jsVersionHash); } if (isset($themeInfo['css'])) { if (!\SP\Util::resultsCardsIsEnabled()) { array_push($themeInfo['css'], 'search-grid.min.css'); } $themeCssBase = 'b=' . urlencode(Themes::$themePath . DIRECTORY_SEPARATOR . 'css'); $themeCssFiles = 'f=' . urlencode(implode(',', $themeInfo['css'])); $this->view->assign('cssLinkTheme', Init::$WEBROOT . '/css/css.php?' . $themeCssFiles . '&' . $themeCssBase . '&' . $jsVersionHash); } }
/** * Comrpueba y actualiza la versión de la aplicación. */ private static function checkVersion() { if (substr(self::$_SUBURI, -9) != 'index.php' || Request::analyze('logout', 0) === 1) { return; } $update = false; $configVersion = (int) str_replace('.', '', Config::getValue('version')); $databaseVersion = (int) str_replace('.', '', ConfigDB::getValue('version')); $appVersion = (int) implode(Util::getVersion(true)); if ($databaseVersion < $appVersion && Request::analyze('nodbupgrade', 0) === 0) { if (Upgrade::needDBUpgrade($databaseVersion)) { if (!self::checkMaintenanceMode(true)) { if (Config::getValue('upgrade_key', 0) === 0) { Config::setValue('upgrade_key', sha1(uniqid(mt_rand(), true))); Config::setValue('maintenance', true); } self::initError(_('La aplicación necesita actualizarse'), sprintf(_('Si es un administrador pulse en el enlace: %s'), '<a href="index.php?upgrade=1&a=upgrade">' . _('Actualizar') . '</a>')); } $action = Request::analyze('a'); $hash = Request::analyze('h'); if ($action === 'upgrade' && $hash === Config::getValue('upgrade_key', 0)) { if (Upgrade::doUpgrade($databaseVersion)) { ConfigDB::setValue('version', $appVersion); Config::setValue('maintenance', false); Config::deleteParam('upgrade_key'); $update = true; } } else { $controller = new Controller\MainC(); $controller->getUpgrade(); $controller->view(); exit; } } } if ($configVersion < $appVersion && Upgrade::needConfigUpgrade($appVersion) && Upgrade::upgradeConfig($appVersion)) { Config::setValue('version', $appVersion); $update = true; } if ($update === true) { $log = new Log(_('Actualización')); $log->addDescription(_('Actualización de versión realizada.')); $log->addDescription(_('Versión') . ': ' . $appVersion); $log->writeLog(); Email::sendEmail($log); self::$UPDATED = true; } }