* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with sysMonDash. If not, see <http://www.gnu.org/licenses/>. */ use SMD\Core\Config; use SMD\Core\ConfigData; use SMD\Core\Init; use SMD\Core\Session; use SMD\Html\Html; use SMD\Http\Request; use SMD\Http\Response; use SMD\Storage\XmlHandler; define('APP_ROOT', '..'); require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; Init::start(false); $hash = Request::analyze('hash'); $hashOk = $hash === Session::getConfig()->getHash() || Session::getConfig()->getHash() === ''; $passOK = $hash === (string) Session::getConfig()->getConfigPassword(); if (!$hashOk && !$passOK) { Response::printJSON('Hash de configuración incorrecto'); } $siteLanguage = Request::analyze('site_language'); $siteTitle = Request::analyze('site_title'); $eventRefresh = Request::analyze('event_refresh', 10); $eventNewItemTime = Request::analyze('event_new_item_time', 900); $eventMaxItems = Request::analyze('event_max_items', 200); $eventNewItemAudio = Request::analyze('event_new_item_audio', false, false, true); $showColLastCheck = Request::analyze('col_last_check', false, false, true); $showColHost = Request::analyze('col_host', false, false, true); $showColService = Request::analyze('col_service', false, false, true);
* sysMonDash is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with sysMonDash. If not, see <http://www.gnu.org/licenses/>. */ use SMD\Api\Api; use SMD\Core\Init; use SMD\Http\Request; use SMD\Http\Response; use SMD\Util\Json; define('APP_ROOT', '.'); require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; Init::start(); $apiToken = Request::analyze('token'); $action = Request::analyze('action', 0); $Api = new Api(); if (!$Api->checkToken($apiToken)) { Response::printJSON('Token inválido'); } $data = null; switch ($action) { case Api::ACTION_EVENTS: $data = $Api->getEvents(); break; case Api::ACTION_DOWNTIMES: $data = $Api->getDowntimes(); break; case Api::ACTION_CHECK: