mdtrooper 9411b1bd79 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 13:31:34 +00:00

102 lines
2.1 KiB
PHP

<?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.
if (!isset($config)) {
require_once('../include/config.php');
}
require_once('db.class.php');
class System {
private $session;
private $config;
private $db;
function __construct() {
$this->loadConfig();
$this->db = new DB($this, $this->getConfig('db_engine', 'mysql'));
session_start();
$this->session = $_SESSION;
session_write_close();
}
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;
}
public function getConfig($name, $default = null) {
if (!isset($this->config[$name])) {
return $default;
}
else {
return $this->config[$name];
}
}
public function setSessionBase($name, $value) {
session_start();
$_SESSION[$name] = $value;
session_write_close();
}
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 debug($var) {
echo "<pre>";
var_dump($var);
echo "</pre>";
}
public function sessionDestroy() {
session_start();
session_destroy();
}
public function getPageSize() {
return 10;
}
}
?>