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
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
|
|
// 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.
|
|
|
|
|
2010-09-30 14:43:31 +02:00
|
|
|
if (!isset($config)) {
|
|
|
|
require_once('../include/config.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
|
|
|
|
2013-03-15 15:50:47 +01:00
|
|
|
//Singleton
|
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
|
|
|
class System {
|
2013-03-15 15:50:47 +01:00
|
|
|
private static $instance;
|
|
|
|
|
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
|
|
|
private $session;
|
|
|
|
private $config;
|
|
|
|
|
|
|
|
function __construct() {
|
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* include/constants.php: added more constants into the constants
block of time conversion to seconds.
* godmode/alerts/alert_commands.php, godmode/setup/performance.php,
include/help/en/help_date_format.php, include/functions_netflow.php,
include/functions_tags.php, include/graphs/functions_pchart.php,
include/functions_modules.php, extensions/agents_modules.php,
extensions/update_manager.php, extensions/resource_exportation.php,
extensions/module_groups.php,
extensions/update_manager/lib/libupdate_manager_client.php,
extensions/system_info.php, operation/events/events_rss.php,
operation/events/export_csv.php, mobile/operation/events/events.php,
mobile/include/system.class.php: used the new constants time instead
the magic numbers, and cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6762 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 15:31:34 +02:00
|
|
|
$this->loadConfig();
|
2013-03-15 15:50:47 +01:00
|
|
|
|
|
|
|
DB::getInstance($this->getConfig('db_engine', 'mysql'));
|
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
|
|
|
|
|
|
|
session_start();
|
|
|
|
$this->session = $_SESSION;
|
|
|
|
session_write_close();
|
|
|
|
}
|
|
|
|
|
2013-03-15 15:50:47 +01:00
|
|
|
public static function getInstance() {
|
|
|
|
if (!(self::$instance instanceof self)) {
|
|
|
|
self::$instance = new self;
|
|
|
|
}
|
|
|
|
|
|
|
|
return self::$instance;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
private function loadConfig() {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$this->config = &$config;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequest($name, $default = null) {
|
|
|
|
$return = $default;
|
|
|
|
|
|
|
|
if (isset($_POST[$name])) {
|
|
|
|
$return = $_POST[$name];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (isset($_GET[$name])) {
|
|
|
|
$return = $_GET[$name];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $return;
|
2014-01-20 13:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function safeOutput($value) {
|
|
|
|
require_once($this->getConfig('homedir') . '/include/functions_io.php');
|
|
|
|
|
|
|
|
return io_safe_output($value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function safeInput($value) {
|
|
|
|
require_once($this->getConfig('homedir') . '/include/functions_io.php');
|
|
|
|
|
|
|
|
return io_safe_input($value);
|
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
|
|
|
}
|
|
|
|
|
2010-09-17 Miguel de Dios <miguel.dedios@artica.es>
* include/fgraph.php: added function "grafico_modulo_sparse_mobile" for
to paint a mobile graph.
* include/functions_db.php: erased deprecate function "dame_grupo_icono".
* include/functions_module.php: moved the functions "format_delete",
"format_time", "format_data", "format_verbatim", "format_timestamp",
"format_delete", "format_delete_string", "format_delete_log4x" from the
file "operation/agentes/datos_agente.php" for to use in other source code
places.
* operation/agentes/datos_agente.php: extracted the functions
"format_delete", "format_time", "format_data", "format_verbatim",
"format_timestamp", "format_delete", "format_delete_string",
"format_delete_log4x" to "include/functions_module.php" for to use in other
source code.
* operation/agentes/tactical.php: cleaned source code style.
* operation/agentes/group_view.php: cleaned source code style.
* mobile/operation/agents/view_agents.php: added class "viewGraph" to show
graph and data of any module.
* mobile/operation/agents/tactical.php: added first version of page to show
tactical mobile page.
* mobile/operation/agents/view_alerts.php: added first version of page to
show alerts mobile page.
* mobile/operation/agents/group_view.php: added first version of page to
show group view mobile page.
* mobile/operation/servers/view_servers.php: added first version of page to
show servers mobile page.
* mobile/include/style/main.css: added many new styles.
* mobile/include/functions_web.php: added links into menu for new pages.
* mobile/include/system.class.php: fixed scope of method "getConfig".
* mobile/index.php: added hooks for new pages.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3250 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-17 12:56:17 +02:00
|
|
|
public function getConfig($name, $default = null) {
|
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
|
|
|
if (!isset($this->config[$name])) {
|
|
|
|
return $default;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return $this->config[$name];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-21 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: fixed the width by default in the function
"print_table", now there isn't a default width (before it was 80%).
* include/pchart_graph.php: fixed in the function "add_events" when tryed
to add a event out the data.
* include/fgraph.php: check the user with the mobile methods.
* include/functions_db.php: in function "check_login" check the user with
the mobile methods.
* images/status_sets/default/severity_warning_pixel.png,
images/status_sets/default/severity_normal_pixel.png,
images/status_sets/default/severity_informational_pixel.png,
images/status_sets/default/severity_maintenance_pixel.png,
images/status_sets/default/severity_critical_pixel.png: added the image
files for to show in the event mobile's page.
* mobile/operation/agents/view_agents.php,
mobile/operation/agents/tactical.php,
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
mobile/operation/servers/view_servers.php, mobile/include/user.class.php,
mobile/include/system.class.php: changed the style the some pages to show
more clearly the pages in old m$-mobiles.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3265 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-21 10:59:01 +02:00
|
|
|
public function setSessionBase($name, $value) {
|
|
|
|
session_start();
|
|
|
|
$_SESSION[$name] = $value;
|
|
|
|
session_write_close();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
public function setSession($name, $value) {
|
|
|
|
$this->session[$name] = $value;
|
|
|
|
|
|
|
|
session_start();
|
|
|
|
$_SESSION = $this->session;
|
|
|
|
session_write_close();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSession($name, $default = null) {
|
|
|
|
if (!isset($this->session[$name])) {
|
|
|
|
return $default;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return $this->session[$name];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sessionDestroy() {
|
|
|
|
session_start();
|
|
|
|
session_destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPageSize() {
|
|
|
|
return 10;
|
|
|
|
}
|
2013-03-15 15:50:47 +01:00
|
|
|
|
|
|
|
public function checkACL($access = "AR", $group_id = 0) {
|
|
|
|
if (check_acl($this->getConfig('id_user'), $group_id, $access)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
db_pandora_audit("ACL Violation",
|
|
|
|
"Trying to access to Mobile Page");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
?>
|