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.
|
|
|
|
|
|
|
|
require_once("system.class.php");
|
|
|
|
|
|
|
|
class User {
|
|
|
|
private $user;
|
|
|
|
private $logged;
|
|
|
|
private $system;
|
|
|
|
|
|
|
|
public function __construct($user = null, $password = null) {
|
|
|
|
global $system;
|
|
|
|
|
|
|
|
$this->user = $user;
|
|
|
|
$this->system = &$system;
|
|
|
|
|
|
|
|
//$this->system->debug($this->system);
|
|
|
|
|
|
|
|
if (process_user_login($this->user, $password)) {
|
|
|
|
$this->logged = true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->logged = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hackinjectConfig() {
|
|
|
|
if ($this->logged) {
|
|
|
|
//hack to compatibility with pandora
|
|
|
|
global $config;
|
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
|
|
|
$config['id_user'] = $this->user;
|
|
|
|
$this->system->setSessionBase('id_usuario', $this->user);
|
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 isLogged() {
|
|
|
|
return $this->logged;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function checkLogin($user = null, $password = null) {
|
|
|
|
if (($user == null) && ($password == null)) {
|
|
|
|
$user = $this->system->getRequest('user', null);
|
|
|
|
$password = $this->system->getRequest('password', null);
|
|
|
|
}
|
|
|
|
|
2010-09-22 18:52:29 +02:00
|
|
|
if (process_user_login($user, $password) !== 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
|
|
|
$this->logged = true;
|
|
|
|
$this->user = $user;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->logged = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function logout() {
|
|
|
|
$this->user = null;
|
|
|
|
$this->logged = false;
|
|
|
|
}
|
|
|
|
|
2010-09-22 18:52:29 +02:00
|
|
|
public function showLogin($text = '') {
|
|
|
|
global $pandora_version;
|
|
|
|
|
|
|
|
echo "<form action='index.php' method='post'>";
|
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
|
|
|
print_input_hidden('action', 'login');
|
2010-09-22 18:52:29 +02:00
|
|
|
?>
|
|
|
|
<div id="center_div">
|
|
|
|
<div id="table_version_negative_position_div">
|
|
|
|
<table cellspacing="0" style="margin: 10px;" id="table_version">
|
|
|
|
<tr>
|
|
|
|
<td style="height: 120px; width: 200px; background: #fff; width: 200px; height: 120px;" colspan="2" rowspan="2">
|
|
|
|
<table id="form_table" cellspacing="0" style="border: 2px solid #6DC62D; width: 100%; height: 100%; background: url('../images/pandora_logo.png') bottom left no-repeat #fff;">
|
|
|
|
<tr>
|
|
|
|
<td style="color: #036A3A; height: 20px;" colspan="2" valign="top" align="left"><?php echo $pandora_version;?> <?php echo $text;?></td>
|
|
|
|
<td style="width: 80px; height: 80px;" valign="bottom" align="left" rowspan="4">
|
|
|
|
<?php
|
|
|
|
print_submit_button(__(''), 'login', false, 'class="login_button" alt="' . __('Login') . '" title="' . __('Login') . '"');
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style="width: 20px; height: 25px;"> </td>
|
|
|
|
<td valign="top" align="left"><?php print_input_text('user', $this->user, __('User'), 10, 20);?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style="width: 20px; height: 15px;"> </td>
|
|
|
|
<td valign="top" align="left"><?php print_input_password('password', '', __('Password'), 10, 20);?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style="height: 20px;"> </td>
|
|
|
|
<td style="height: 20px;"> </td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td> </td>
|
|
|
|
<td> </td>
|
|
|
|
<td> </td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
<td style="height: 15px; width: 15px; background: #fff;"> </td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style="width: 15px; height: 90px; background: #036A3A;"> </td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style="height: 15px; width: 15px; background: #fff;"> </td>
|
|
|
|
<td style="width: 200px; height: 15px; background: #036A3A; color: #fff; font-size: 9px; text-align: right;" colspan="2">
|
|
|
|
<?php echo '<b style="font-size: 9px;">' . __('Your IP').':</b>' . $this->system->getConfig("remote_addr") . ' ';?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style="background: white; height: 0px;"> </td>
|
|
|
|
<td style="background: white; height: 0px;"> </td>
|
|
|
|
<td style="background: white; height: 0px;"> </td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
/*
|
|
|
|
?>
|
|
|
|
<div id="center_div">
|
|
|
|
<div id="negative_position_div">
|
|
|
|
<div id="style_div">
|
|
|
|
<div id="shadow">
|
|
|
|
<p>
|
|
|
|
<?php
|
|
|
|
echo '<b>' . __('Your IP').':</b>' . $this->system->getConfig("remote_addr");
|
|
|
|
?>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
echo "<form id='login_box' method='post' style=''>";
|
|
|
|
echo "<div id='version'>" . $pandora_version . "</div>";
|
|
|
|
print_input_hidden('action', 'login');
|
|
|
|
print_input_text('user', $this->user, __('User'), 10, 20);
|
|
|
|
print_input_password('password', '', __('Password'), 10, 20);
|
|
|
|
print_submit_button(__(''), 'login', false, 'onclick="javascript: click();" class="login_button" alt="' . __('Login') . '" title="' . __('Login') . '"');
|
|
|
|
echo "</form>";
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?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
|
|
|
}
|
|
|
|
|
|
|
|
public function getIdUser() {
|
|
|
|
return $this->user;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|