/** * Cargar la configuración desde el archivo * * @param StorageInterface $Storage */ public static function loadConfig(StorageInterface $Storage) { if (Util::checkReload() || gettype(Session::getConfig()) !== 'object' || time() >= Session::getConfigTime() + self::TIMEOUT_REFRESH) { Session::setConfig(self::arrayMapper($Storage)); Session::setConfigTime(time()); } }
$ConfigData->setLanguage($siteLanguage); $ConfigData->setPageTitle($siteTitle); $ConfigData->setRefreshValue($eventRefresh); $ConfigData->setNewItemTime($eventNewItemTime); $ConfigData->setMaxDisplayItems($eventMaxItems); $ConfigData->setNewItemAudioEnabled($eventNewItemAudio); $ConfigData->setColLastcheck($showColLastCheck); $ConfigData->setColHost($showColHost); $ConfigData->setColService($showColService); $ConfigData->setColStatusInfo($showColInfo); $ConfigData->setColBackend($showColBackend); $ConfigData->setShowScheduled($showScheduled); $ConfigData->setRegexHostShow($regexHostShow); $ConfigData->setRegexServiceNoShow($regexServicesNoShow); $ConfigData->setCriticalItems(explode(',', $criticalItems)); $ConfigData->setBackend($Backends); $ConfigData->setClientURL($specialClientURL); $ConfigData->setRemoteServer($specialRemoteServerURL); $ConfigData->setMonitorServerUrl($specialMonitorServerUrl); $ConfigData->setAPIToken($specialAPIToken); if (!empty($specialConfigPass) && $specialConfigPass !== (string) Session::getConfig()->getConfigPassword()) { $ConfigData->setConfigPassword(sha1($specialConfigPass)); } else { $ConfigData->setConfigPassword($specialConfigPass); } try { Config::saveConfig(new XmlHandler(XML_CONFIG_FILE), $ConfigData); Response::printJSON('Configuración guardada', 0); } catch (Exception $e) { Response::printJSON('Error al guardar la configuración'); }
<?php echo Language::t('Volver'); ?> </button> <button type="submit" class="button-success pure-button pure-button-primary"> <i class="fa fa-floppy-o fa-lg"></i> <?php echo Language::t('Guardar'); ?> </button> </div> <input type="hidden" name="hash" value="<?php echo $passOK ? Session::getConfig()->getConfigPassword() : $hash; ?> "/> </form> <?php include TPL_PATH . DIRECTORY_SEPARATOR . 'config-backends-tpl.phtml'; ?> <div id="warn-save"> <i class="fa fa-warning" aria-hidden="true" title="<?php echo Language::t('No olvide guardar la configuración'); ?> "></i> </div> <?php