2010-09-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: in function "get_agent_module_info" added
the return "status" and "alert_value".
* include/auth/mysql.php: in function "process_user_login" cleaned the
source code style.
* include/functions_ui.php: in function "print_timestamp" added in the
parameter $option the check of units ('large' and 'tiny' at the moment).
Added the function "print_group_icon2" that it is the same of
"print_group_icon" but it has a new parameter $path for to set the images
path.
* include/functions.php: in function "human_time_comparation" added the
parameter $units to set the type return text for time unit (at the moment
only "large" and "tiny"). And in the function "human_time_description_raw"
added the paramter $units for to set the type of return text for units, at
the moment only "large" and "tiny".
* include/functions_db.php, operation/agentes/ver_agente.php: cleaned source
code.
* mobile/index.php, mobile/operation/agents,
mobile/operation/agents/view_agents.php, mobile/include/db.class.php,
mobile/include/style, mobile/include/style/main.css,
mobile/include/user.class.php, mobile/include/functions_web.php,
mobile/include/system.class.php, mobile/images/bricks.png,
mobile/images/up.png, mobile/images/zoom.png, mobile/images/down.png: added
first version of file for Pandora Mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3246 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-15 17:54:59 +02:00
|
|
|
<?php
|
2021-11-04 16:28:15 +01:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
2010-09-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: in function "get_agent_module_info" added
the return "status" and "alert_value".
* include/auth/mysql.php: in function "process_user_login" cleaned the
source code style.
* include/functions_ui.php: in function "print_timestamp" added in the
parameter $option the check of units ('large' and 'tiny' at the moment).
Added the function "print_group_icon2" that it is the same of
"print_group_icon" but it has a new parameter $path for to set the images
path.
* include/functions.php: in function "human_time_comparation" added the
parameter $units to set the type return text for time unit (at the moment
only "large" and "tiny"). And in the function "human_time_description_raw"
added the paramter $units for to set the type of return text for units, at
the moment only "large" and "tiny".
* include/functions_db.php, operation/agentes/ver_agente.php: cleaned source
code.
* mobile/index.php, mobile/operation/agents,
mobile/operation/agents/view_agents.php, mobile/include/db.class.php,
mobile/include/style, mobile/include/style/main.css,
mobile/include/user.class.php, mobile/include/functions_web.php,
mobile/include/system.class.php, mobile/images/bricks.png,
mobile/images/up.png, mobile/images/zoom.png, mobile/images/down.png: added
first version of file for Pandora Mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3246 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-15 17:54:59 +02:00
|
|
|
// ==================================================
|
2020-11-27 13:52:35 +01:00
|
|
|
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
2010-09-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: in function "get_agent_module_info" added
the return "status" and "alert_value".
* include/auth/mysql.php: in function "process_user_login" cleaned the
source code style.
* include/functions_ui.php: in function "print_timestamp" added in the
parameter $option the check of units ('large' and 'tiny' at the moment).
Added the function "print_group_icon2" that it is the same of
"print_group_icon" but it has a new parameter $path for to set the images
path.
* include/functions.php: in function "human_time_comparation" added the
parameter $units to set the type return text for time unit (at the moment
only "large" and "tiny"). And in the function "human_time_description_raw"
added the paramter $units for to set the type of return text for units, at
the moment only "large" and "tiny".
* include/functions_db.php, operation/agentes/ver_agente.php: cleaned source
code.
* mobile/index.php, mobile/operation/agents,
mobile/operation/agents/view_agents.php, mobile/include/db.class.php,
mobile/include/style, mobile/include/style/main.css,
mobile/include/user.class.php, mobile/include/functions_web.php,
mobile/include/system.class.php, mobile/images/bricks.png,
mobile/images/up.png, mobile/images/zoom.png, mobile/images/down.png: added
first version of file for Pandora Mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3246 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-15 17:54:59 +02:00
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
// This program 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.
|
2019-01-30 16:18:44 +01:00
|
|
|
// Set character encoding to UTF-8 - fixes a lot of multibyte character
|
|
|
|
// headaches
|
|
|
|
if (function_exists('mb_internal_encoding')) {
|
|
|
|
mb_internal_encoding('UTF-8');
|
2012-01-10 05:46:09 +01:00
|
|
|
}
|
|
|
|
|
2016-09-30 10:32:48 +02:00
|
|
|
$develop_bypass = 0;
|
2010-09-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: in function "get_agent_module_info" added
the return "status" and "alert_value".
* include/auth/mysql.php: in function "process_user_login" cleaned the
source code style.
* include/functions_ui.php: in function "print_timestamp" added in the
parameter $option the check of units ('large' and 'tiny' at the moment).
Added the function "print_group_icon2" that it is the same of
"print_group_icon" but it has a new parameter $path for to set the images
path.
* include/functions.php: in function "human_time_comparation" added the
parameter $units to set the type return text for time unit (at the moment
only "large" and "tiny"). And in the function "human_time_description_raw"
added the paramter $units for to set the type of return text for units, at
the moment only "large" and "tiny".
* include/functions_db.php, operation/agentes/ver_agente.php: cleaned source
code.
* mobile/index.php, mobile/operation/agents,
mobile/operation/agents/view_agents.php, mobile/include/db.class.php,
mobile/include/style, mobile/include/style/main.css,
mobile/include/user.class.php, mobile/include/functions_web.php,
mobile/include/system.class.php, mobile/images/bricks.png,
mobile/images/up.png, mobile/images/zoom.png, mobile/images/down.png: added
first version of file for Pandora Mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3246 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-15 17:54:59 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'include/ui.class.php';
|
|
|
|
require_once 'include/system.class.php';
|
|
|
|
require_once 'include/db.class.php';
|
|
|
|
require_once 'include/user.class.php';
|
2013-03-15 15:50:47 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
/*
|
|
|
|
Info:
|
2018-11-23 10:33:18 +01:00
|
|
|
* The classes above doesn't start any session before it's properly
|
|
|
|
* configured into the file below, but it's important the classes
|
|
|
|
* exist at the time the session is started for things like
|
|
|
|
* serializing objects stored into the session.
|
|
|
|
*/
|
|
|
|
require_once '../include/config.php';
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'operation/home.php';
|
|
|
|
require_once 'operation/tactical.php';
|
|
|
|
require_once 'operation/groups.php';
|
|
|
|
require_once 'operation/events.php';
|
|
|
|
require_once 'operation/alerts.php';
|
|
|
|
require_once 'operation/agents.php';
|
|
|
|
require_once 'operation/modules.php';
|
|
|
|
require_once 'operation/module_graph.php';
|
|
|
|
require_once 'operation/agent.php';
|
|
|
|
require_once 'operation/visualmaps.php';
|
|
|
|
require_once 'operation/visualmap.php';
|
2023-04-12 14:48:19 +02:00
|
|
|
require_once 'operation/server_status.php';
|
2023-04-13 16:27:13 +02:00
|
|
|
require_once 'operation/services.php';
|
2023-04-18 17:05:08 +02:00
|
|
|
require_once 'operation/module_data.php';
|
2010-09-21 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: in function "print_select_groups" and function
"print_select_from_sql" added source code to check $config['text_char_long']
for show small text in this widgets.
* include/functions.php: in function "get_event_types" and "get_priorities"
added source code to check $config['text_char_long'] for show small text in
this widgets. And in function "get_priority_class" cleaned source code.
* operation/agentes/status_monitor.php, operation/events/events.php: cleaned
source code style.
* images/pandora.ico.gif: added image file for to use in the mobile footer.
* mobile/operation/agents/monitor_status.php,
mobile/operation/agents/view_agents.php,
mobile/operation/agents/tactical.php,
mobile/operation/agents/group_view.php, mobile/operation/events/events.php,
mobile/include/style/main.css, mobile/include/functions_web.php,
mobile/index.php, general/footer.php: continued the develop, yep the
Pandora Console Mobile is complete (only rest the bugs).
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3269 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-21 20:02:11 +02:00
|
|
|
$enterpriseHook = enterprise_include('mobile/include/enterprise.class.php');
|
2014-10-15 18:12:51 +02:00
|
|
|
$enterpriseHook = enterprise_include('mobile/operation/home.php');
|
2010-09-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: in function "get_agent_module_info" added
the return "status" and "alert_value".
* include/auth/mysql.php: in function "process_user_login" cleaned the
source code style.
* include/functions_ui.php: in function "print_timestamp" added in the
parameter $option the check of units ('large' and 'tiny' at the moment).
Added the function "print_group_icon2" that it is the same of
"print_group_icon" but it has a new parameter $path for to set the images
path.
* include/functions.php: in function "human_time_comparation" added the
parameter $units to set the type return text for time unit (at the moment
only "large" and "tiny"). And in the function "human_time_description_raw"
added the paramter $units for to set the type of return text for units, at
the moment only "large" and "tiny".
* include/functions_db.php, operation/agentes/ver_agente.php: cleaned source
code.
* mobile/index.php, mobile/operation/agents,
mobile/operation/agents/view_agents.php, mobile/include/db.class.php,
mobile/include/style, mobile/include/style/main.css,
mobile/include/user.class.php, mobile/include/functions_web.php,
mobile/include/system.class.php, mobile/images/bricks.png,
mobile/images/up.png, mobile/images/zoom.png, mobile/images/down.png: added
first version of file for Pandora Mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3246 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-15 17:54:59 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$is_mobile = true;
|
2016-08-12 13:35:22 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (!empty($config['https']) && empty($_SERVER['HTTPS'])) {
|
|
|
|
$query = '';
|
2022-01-19 12:40:52 +01:00
|
|
|
if (count($_REQUEST)) {
|
2019-01-30 16:18:44 +01:00
|
|
|
// Some (old) browsers don't like the ?&key=var
|
|
|
|
$query .= 'mobile/index.php?1=1';
|
|
|
|
}
|
2010-09-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: in function "get_agent_module_info" added
the return "status" and "alert_value".
* include/auth/mysql.php: in function "process_user_login" cleaned the
source code style.
* include/functions_ui.php: in function "print_timestamp" added in the
parameter $option the check of units ('large' and 'tiny' at the moment).
Added the function "print_group_icon2" that it is the same of
"print_group_icon" but it has a new parameter $path for to set the images
path.
* include/functions.php: in function "human_time_comparation" added the
parameter $units to set the type return text for time unit (at the moment
only "large" and "tiny"). And in the function "human_time_description_raw"
added the paramter $units for to set the type of return text for units, at
the moment only "large" and "tiny".
* include/functions_db.php, operation/agentes/ver_agente.php: cleaned source
code.
* mobile/index.php, mobile/operation/agents,
mobile/operation/agents/view_agents.php, mobile/include/db.class.php,
mobile/include/style, mobile/include/style/main.css,
mobile/include/user.class.php, mobile/include/functions_web.php,
mobile/include/system.class.php, mobile/images/bricks.png,
mobile/images/up.png, mobile/images/zoom.png, mobile/images/down.png: added
first version of file for Pandora Mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3246 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-15 17:54:59 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// We don't clean these variables up as they're only being passed along
|
|
|
|
foreach ($_GET as $key => $value) {
|
|
|
|
if ($key == 1) {
|
|
|
|
continue;
|
|
|
|
}
|
2016-09-23 11:57:07 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$query .= '&'.$key.'='.$value;
|
|
|
|
}
|
2016-09-23 11:57:07 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
foreach ($_POST as $key => $value) {
|
|
|
|
$query .= '&'.$key.'='.$value;
|
|
|
|
}
|
|
|
|
|
|
|
|
$url = ui_get_full_url($query);
|
|
|
|
|
|
|
|
// Prevent HTTP response splitting attacks
|
|
|
|
// http://en.wikipedia.org/wiki/HTTP_response_splitting
|
|
|
|
$url = str_replace("\n", '', $url);
|
|
|
|
header('Location: '.$url);
|
|
|
|
exit;
|
|
|
|
// Always exit after sending location headers
|
|
|
|
}
|
|
|
|
|
|
|
|
$system = System::getInstance();
|
|
|
|
|
|
|
|
// ~ In this moment doesn't work the version mobile when have metaconsole version.
|
|
|
|
// ~ In the future versions of pandora maybe is added a mobile version of PandoraFMS Metaconsole version.
|
|
|
|
// ~ if ($system->getConfig('metaconsole'))
|
|
|
|
// ~ header ("Location: " . $system->getConfig('homeurl') . "enterprise/meta");
|
|
|
|
require_once $system->getConfig('homedir').'/include/constants.php';
|
2014-12-15 13:47:33 +01:00
|
|
|
|
2013-03-26 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php, include/functions_groups.php:
changes for to use in the calls in mobile version.
* mobile/index.php, mobile/operation/events.php,
mobile/operation/modules.php, mobile/operation/events,
mobile/operation/events/events.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/alerts.php,
mobile/include/style/main.css, mobile/include/ui.class.php,
mobile/include/user.class.php: changes and improves in the code
of mobile.
* mobile/operation/agents/*, mobile/operation/servers/*: removed
the old files from version pandora mobile 4.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7891 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-26 18:24:10 +01:00
|
|
|
$user = User::getInstance();
|
2014-12-15 13:47:33 +01:00
|
|
|
$user->saveLogin();
|
2012-01-10 05:46:09 +01:00
|
|
|
|
2017-11-17 12:29:52 +01:00
|
|
|
$default_page = 'home';
|
|
|
|
$page = $system->getRequest('page');
|
2013-03-15 15:50:47 +01:00
|
|
|
$action = $system->getRequest('action');
|
2014-12-15 13:47:33 +01:00
|
|
|
|
|
|
|
// The logout action has priority
|
|
|
|
if ($action != 'logout') {
|
2019-01-30 16:18:44 +01:00
|
|
|
if (!$user->isLogged()) {
|
|
|
|
$action = 'login';
|
|
|
|
} else if ($user->isWaitingDoubleAuth()) {
|
|
|
|
$dauth_period = SECONDS_2MINUTES;
|
|
|
|
$now = time();
|
|
|
|
$dauth_time = $user->getLoginTime();
|
|
|
|
|
|
|
|
if (($now - $dauth_period) < $dauth_time) {
|
|
|
|
$action = 'double_auth';
|
|
|
|
}
|
|
|
|
// Expired login
|
|
|
|
else {
|
|
|
|
$action = 'logout';
|
|
|
|
}
|
|
|
|
}
|
2012-01-10 05:46:09 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($action != 'ajax') {
|
|
|
|
$user_language = get_user_language($system->getConfig('id_user'));
|
|
|
|
if (file_exists('../include/languages/'.$user_language.'.mo')) {
|
|
|
|
$l10n = new gettext_reader(new CachedFileReader('../include/languages/'.$user_language.'.mo'));
|
|
|
|
$l10n->load_tables();
|
|
|
|
}
|
2013-05-04 02:29:16 +02:00
|
|
|
}
|
|
|
|
|
2018-08-23 13:57:41 +02:00
|
|
|
if ($user->isLogged()) {
|
2019-01-30 16:18:44 +01:00
|
|
|
if (file_exists('../enterprise/load_enterprise.php')) {
|
|
|
|
include_once '../enterprise/load_enterprise.php';
|
|
|
|
}
|
2018-08-23 13:57:41 +02:00
|
|
|
}
|
|
|
|
|
2013-03-15 15:50:47 +01:00
|
|
|
switch ($action) {
|
2019-01-30 16:18:44 +01:00
|
|
|
case 'ajax':
|
|
|
|
$parameter1 = $system->getRequest('parameter1', false);
|
|
|
|
$parameter2 = $system->getRequest('parameter2', false);
|
|
|
|
|
|
|
|
if (class_exists('Enterprise')) {
|
|
|
|
$enterprise = Enterprise::getInstance();
|
|
|
|
|
|
|
|
$permission = $enterprise->checkEnterpriseACL($parameter1);
|
|
|
|
|
|
|
|
if (!$permission) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($parameter1) {
|
|
|
|
case 'events':
|
|
|
|
$events = new Events();
|
|
|
|
$events->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'agents':
|
|
|
|
$agents = new Agents();
|
|
|
|
$agents->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'agent':
|
|
|
|
$agent = new Agent();
|
|
|
|
$agent->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'modules':
|
|
|
|
$modules = new Modules();
|
|
|
|
$modules->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'module_graph':
|
|
|
|
$module_graph = new ModuleGraph();
|
|
|
|
$module_graph->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'visualmap':
|
|
|
|
$visualmap = new Visualmap();
|
|
|
|
$visualmap->ajax($parameter2);
|
2022-03-08 17:18:44 +01:00
|
|
|
break;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
case 'tactical':
|
|
|
|
$tactical = new Tactical();
|
|
|
|
$tactical->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
2023-04-12 14:48:19 +02:00
|
|
|
case 'server_status':
|
|
|
|
$server_status = new ServerStatus();
|
|
|
|
$server_status->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
2023-04-13 16:27:13 +02:00
|
|
|
case 'services':
|
|
|
|
$services = new Services();
|
|
|
|
$services->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
2023-04-18 17:05:08 +02:00
|
|
|
case 'module_data':
|
|
|
|
$module_data = new ModuleData();
|
|
|
|
$module_data->ajax($parameter2);
|
|
|
|
break;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
default:
|
|
|
|
if (class_exists('Enterprise')) {
|
|
|
|
$enterprise->enterpriseAjax($parameter1, $parameter2);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
case 'login':
|
|
|
|
if ($user->login() && $user->isLogged()) {
|
|
|
|
if (file_exists('../enterprise/load_enterprise.php')) {
|
|
|
|
include_once '../enterprise/load_enterprise.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($user->isWaitingDoubleAuth()) {
|
|
|
|
if ($user->validateDoubleAuthCode()) {
|
2022-07-14 16:50:26 +02:00
|
|
|
$url = ui_get_full_url('');
|
|
|
|
$url = str_replace("\n", '', $url);
|
|
|
|
$url = str_replace('?action=logout', '', $url);
|
|
|
|
|
|
|
|
// Logged. Refresh the page.
|
|
|
|
header('Location: '.$url);
|
2019-01-30 16:18:44 +01:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
$user->showDoubleAuthPage();
|
|
|
|
}
|
|
|
|
} else {
|
2022-07-14 16:50:26 +02:00
|
|
|
$url = ui_get_full_url('');
|
|
|
|
$url = str_replace("\n", '', $url);
|
|
|
|
$url = str_replace('?action=logout', '', $url);
|
|
|
|
|
|
|
|
// Logged. Refresh the page.
|
|
|
|
header('Location: '.$url);
|
2019-01-30 16:18:44 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$user->showLoginPage();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'double_auth':
|
|
|
|
if ($user->isLogged()) {
|
|
|
|
if (file_exists('../enterprise/load_enterprise.php')) {
|
|
|
|
include_once '../enterprise/load_enterprise.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($user->validateDoubleAuthCode()) {
|
|
|
|
$user_language = get_user_language($system->getConfig('id_user'));
|
|
|
|
if (file_exists('../include/languages/'.$user_language.'.mo')) {
|
|
|
|
$l10n = new gettext_reader(new CachedFileReader('../include/languages/'.$user_language.'.mo'));
|
|
|
|
$l10n->load_tables();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_GET['page'] != '') {
|
|
|
|
header('refresh:0; url=http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (class_exists('HomeEnterprise')) {
|
|
|
|
$home = new HomeEnterprise();
|
|
|
|
} else {
|
|
|
|
$home = new Home();
|
|
|
|
}
|
|
|
|
|
|
|
|
$home->show();
|
|
|
|
} else {
|
|
|
|
$user->showDoubleAuthPage();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$user->showLoginPage();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'logout':
|
|
|
|
$user->logout();
|
|
|
|
$user->showLoginPage();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (class_exists('Enterprise')) {
|
|
|
|
$enterprise = Enterprise::getInstance();
|
|
|
|
if (!empty($page) && $page != $default_page) {
|
|
|
|
$permission = $enterprise->checkEnterpriseACL($page);
|
|
|
|
|
|
|
|
if (!$permission) {
|
|
|
|
$error['type'] = 'onStart';
|
|
|
|
$error['title_text'] = __('You don\'t have access to this page');
|
|
|
|
$error['content_text'] = System::getDefaultACLFailText();
|
|
|
|
if (class_exists('HomeEnterprise')) {
|
|
|
|
$home = new HomeEnterprise();
|
|
|
|
} else {
|
|
|
|
$home = new Home();
|
|
|
|
}
|
|
|
|
|
|
|
|
$home->show($error);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($page)) {
|
|
|
|
$user_info = $user->getInfo();
|
|
|
|
$home_page = $system->safeOutput($user_info['section']);
|
|
|
|
$section_data = $user_info['data_section'];
|
|
|
|
|
|
|
|
switch ($home_page) {
|
|
|
|
case 'Event list':
|
|
|
|
$page = 'events';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Alert detail':
|
|
|
|
$page = 'alerts';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Tactical view':
|
|
|
|
$page = 'tactical';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Visual console':
|
|
|
|
$page = 'visualmap';
|
|
|
|
$id_map = (int) db_get_value('id', 'tlayout', 'name', $section_data);
|
|
|
|
$_GET['id'] = $id_map;
|
|
|
|
break;
|
2021-04-07 18:17:08 +02:00
|
|
|
|
2022-05-13 09:51:43 +02:00
|
|
|
case 'External link':
|
|
|
|
$full_url = ui_get_full_url();
|
|
|
|
$section_data = io_safe_output($section_data);
|
|
|
|
|
|
|
|
$host_full = parse_url($full_url, PHP_URL_HOST);
|
|
|
|
$host_section = parse_url($section_data, PHP_URL_HOST);
|
|
|
|
|
|
|
|
if ($host_full !== $host_section) {
|
|
|
|
$has_mobile = strpos($section_data, 'mobile');
|
|
|
|
if ($has_mobile === false) {
|
|
|
|
$pos = strpos($section_data, '/index');
|
|
|
|
if ($pos !== false) {
|
|
|
|
$section_data = substr_replace($section_data, '/mobile', $pos, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<script type="text/javascript">document.location="'.$section_data.'"</script>';
|
|
|
|
} else {
|
|
|
|
if (strpos($full_url, 'event') !== false) {
|
|
|
|
$page = 'events';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strpos($full_url, 'alert') !== false) {
|
|
|
|
$page = 'alerts';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strpos($full_url, 'tactical') !== false) {
|
|
|
|
$page = 'tactical';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strpos($full_url, 'visual_console') !== false) {
|
|
|
|
$page = 'visualmap';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-04-07 18:17:08 +02:00
|
|
|
case 'Group view':
|
|
|
|
default:
|
|
|
|
// No content.
|
|
|
|
break;
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($page) {
|
|
|
|
case 'home':
|
|
|
|
default:
|
|
|
|
if (class_exists('HomeEnterprise')) {
|
|
|
|
$home = new HomeEnterprise();
|
|
|
|
} else {
|
|
|
|
$home = new Home();
|
|
|
|
}
|
|
|
|
|
|
|
|
$home->show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'tactical':
|
|
|
|
$tactical = new Tactical();
|
|
|
|
$tactical->show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'groups':
|
|
|
|
$groups = new Groups();
|
|
|
|
$groups->show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'events':
|
|
|
|
$events = new Events();
|
|
|
|
$events->show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'alerts':
|
|
|
|
$alerts = new Alerts();
|
|
|
|
$alerts->show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'agents':
|
|
|
|
$agents = new Agents();
|
|
|
|
$agents->show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'modules':
|
|
|
|
$modules = new Modules();
|
|
|
|
$modules->show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'module_graph':
|
|
|
|
$module_graph = new ModuleGraph();
|
|
|
|
$module_graph->show();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'agent':
|
|
|
|
$agent = new Agent();
|
|
|
|
$agent->show();
|
|
|
|
break;
|
2020-12-18 13:23:35 +01:00
|
|
|
|
2020-12-18 13:40:00 +01:00
|
|
|
case 'visualmaps':
|
2021-04-07 18:17:08 +02:00
|
|
|
// Show a list of VC.
|
2020-12-18 13:40:00 +01:00
|
|
|
$vc_list = new Visualmaps();
|
|
|
|
$vc_list->show();
|
|
|
|
break;
|
|
|
|
|
2020-12-18 13:23:35 +01:00
|
|
|
case 'visualmap':
|
2020-12-18 13:40:00 +01:00
|
|
|
$vc = new Visualmap();
|
|
|
|
$vc->show();
|
2020-12-18 13:23:35 +01:00
|
|
|
break;
|
2023-04-12 14:48:19 +02:00
|
|
|
|
|
|
|
case 'server_status':
|
|
|
|
$server_status = new ServerStatus();
|
|
|
|
$server_status->show();
|
|
|
|
break;
|
2023-04-13 16:27:13 +02:00
|
|
|
|
|
|
|
case 'services':
|
|
|
|
$services = new Services();
|
|
|
|
$services->show();
|
|
|
|
break;
|
2023-04-18 17:05:08 +02:00
|
|
|
|
|
|
|
case 'module_data':
|
|
|
|
$module_data = new ModuleData();
|
|
|
|
$module_data->show();
|
|
|
|
break;
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
break;
|
2013-03-15 15:50:47 +01:00
|
|
|
}
|