Пример #1
0
 /**
  * @param StorageInterface $Storage
  * @param ConfigData $Config
  */
 public static function saveConfig(StorageInterface $Storage, ConfigData $Config = null)
 {
     copy(XML_CONFIG_FILE, XML_CONFIG_FILE . '.bak');
     $ConfigData = is_null($Config) ? self::getConfig() : $Config;
     $Config->setHash();
     $Config->setConfigHash();
     $Storage->setItems($ConfigData);
     $Storage->save('config');
     Session::setConfigTime(0);
     self::loadConfig($Storage);
 }
Пример #2
0
 /**
  * Cargar la configuración
  */
 private static function loadConfig()
 {
     try {
         Config::loadConfig(new XmlHandler(XML_CONFIG_FILE));
     } catch (\Exception $e) {
         error_log(Language::t($e->getMessage()));
         Session::setConfig(new ConfigData());
         if (self::getCurrentScript() !== 'config.php') {
             header('Location: config.php');
         }
     }
 }
Пример #3
0
$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');
}
Пример #4
0
 /**
  * Comprobar si la configuración se ha actualizado
  * 
  * @return bool
  */
 public static function checkConfigRefresh()
 {
     return time() - Session::getConfigTime() <= Config::getConfig()->getRefreshValue();
 }
Пример #5
0
 /**
  * Seleccionar el backend
  *
  * @return BackendInterface[]
  */
 public function getBackends()
 {
     $backends = !Util::checkConfigRefresh() ? Session::getActiveBackends() : array();
     if (count($backends) > 0) {
         return $backends;
     }
     foreach (Config::getConfig()->getBackend() as $Backend) {
         /** @var $Backend ConfigBackendLivestatus|ConfigBackendStatus|ConfigBackendZabbix|ConfigBackendSMD */
         if ($Backend->isActive()) {
             switch ($Backend->getType()) {
                 case ConfigBackend::TYPE_LIVESTATUS:
                     $backends[] = new Livestatus($Backend);
                     break;
                 case ConfigBackend::TYPE_CHECKMK:
                     $backends[] = new CheckMK($Backend);
                     break;
                 case ConfigBackend::TYPE_STATUS:
                     $backends[] = new Status($Backend);
                     break;
                 case ConfigBackend::TYPE_ZABBIX:
                     $backends[] = new Zabbix($Backend);
                     break;
                 case ConfigBackend::TYPE_SMD && $this->callType !== self::CALL_TYPE_API ? true : false:
                     $backends[] = new SMD($Backend);
                     break;
             }
         }
     }
     Session::setActiveBackends($backends);
     return $backends;
 }
Пример #6
0
                        <?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 
Пример #7
0
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>sysMonDash :: <?php 
echo Config::getConfig()->getPageTitle();
?>
</title>
    <meta name="author" content="Rubén Domínguez">
    <link rel="icon" type="image/png" href="imgs/logo_small.png">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/reset.min.css">
    <link rel="stylesheet" type="text/css" href="css/pure-min.css">
    <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="css/styles.min.css?v=<?php 
echo Session::getCssHash();
?>
">
</head>
<body>
<div id="logo">
    <img src="imgs/logo.png"/>
    <div id="hora"><h1></h1></div>
    <div id="titulo">
        <h1><?php 
echo Config::getConfig()->getPageTitle();
?>
</h1>
        <h2><?php 
echo Language::t('Dpto. Sistemas');
?>