From 637e9673daa9e9eb7e4a11bd2b4ca5085184e0e6 Mon Sep 17 00:00:00 2001 From: raulmateos Date: Sat, 24 Jan 2009 20:11:07 +0000 Subject: [PATCH] 2009-01-24 Raul Mateos * install.php: Added code to show current console URL in step 3. Updated header. Spaces changed to tabs. * include/functions_reporting.php: Give default value to several vars that caused two notice errors. Updated header. * include/functions_db.php: Solved notice error in search page that caused not to show the user. It uses get_users() function from mysql.php. ldap.php and dev.php define the same function, and uses different value, so they could give an error in the search page, NOT TESTED. Updated header. * /extensions/update_manager/sql/update_manager.sql: Changed default text value for description column, it was giving a SQL error. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1396 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 16 +++++++++++++++ .../update_manager/sql/update_manager.sql | 2 +- pandora_console/include/functions_db.php | 16 +++++++-------- .../include/functions_reporting.php | 9 +++++---- pandora_console/install.php | 20 +++++++++---------- 5 files changed, 40 insertions(+), 23 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index eaed4f9cb3..350a968cc3 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2009-01-24 Raul Mateos + + * install.php: Added code to show current console URL in step 3. + Updated header. Spaces changed to tabs. + + * include/functions_reporting.php: Give default value to several vars that + caused two notice errors. Updated header. + + * include/functions_db.php: Solved notice error in search page that caused + not to show the user. It uses get_users() function from mysql.php. + ldap.php and dev.php define the same function, and uses different value, so + they could give an error in the search page, NOT TESTED. Updated header. + + * /extensions/update_manager/sql/update_manager.sql: Changed default text + value for description column, it was giving a SQL error. + 2009-01-23 Esteban Sanchez * godmode/reporting/map_builder.php: Fixed an error when getting diff --git a/pandora_console/extensions/update_manager/sql/update_manager.sql b/pandora_console/extensions/update_manager/sql/update_manager.sql index ab9279ed82..f2ed9f73c9 100644 --- a/pandora_console/extensions/update_manager/sql/update_manager.sql +++ b/pandora_console/extensions/update_manager/sql/update_manager.sql @@ -1,5 +1,5 @@ CREATE TABLE `tupdate_settings` ( `key` varchar(255) default '', `value` varchar(255) default '', PRIMARY KEY (`key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `tupdate_settings` VALUES ('current_update', '0'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora/util/keygen'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); -CREATE TABLE `tupdate_package` ( id int(11) unsigned NOT NULL auto_increment, timestamp datetime NOT NULL, description mediumtext NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `tupdate_package` ( id int(11) unsigned NOT NULL auto_increment, timestamp datetime NOT NULL, description varchar(255) default '', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `tupdate` ( id int(11) unsigned NOT NULL auto_increment, type enum('code', 'db_data', 'db_schema', 'binary'), id_update_package int(11) unsigned NOT NULL default 0, filename varchar(250) default '', checksum varchar(250) default '', previous_checksum varchar(250) default '', svn_version int(4) unsigned NOT NULL default 0, data LONGTEXT default '', data_rollback LONGTEXT default '', description TEXT default '', db_table_name varchar(140) default '', db_field_name varchar(140) default '', db_field_value varchar(1024) default '', PRIMARY KEY (`id`), FOREIGN KEY (`id_update_package`) REFERENCES tupdate_package(`id`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `tupdate_journal` ( id int(11) unsigned NOT NULL auto_increment, id_update int(11) unsigned NOT NULL default 0, PRIMARY KEY (`id`), FOREIGN KEY (`id_update`) REFERENCES tupdate(`id`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 3ee2f23ab9..e7d93b38e9 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -2,7 +2,7 @@ // Pandora FMS - the Flexible Monitoring System // ============================================ -// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es +// Copyright (c) 2009 Artica Soluciones Tecnologicas, http://www.artica.es // Please see http://pandora.sourceforge.net for full contribution list // This program is free software; you can redistribute it and/or @@ -11,11 +11,11 @@ // // 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 +// 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 this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /** * Check if login session variables are set. @@ -600,7 +600,7 @@ function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $ */ function get_monitors_in_group ($id_group) { if ($id_group <= 1) { - //We select all groups the user has access to if it's 0, -1 or 1 + //We select all groups the user has access to if it's 0, -1 or 1 global $config; $id_group = array_keys (get_user_groups ($config['id_user'])); } @@ -1022,7 +1022,7 @@ function list_group ($id_user, $show_all = 1){ return $mis_grupos; foreach ($result as $row) { if (($row["id_grupo"] != 1 || $show_all == 1) && $row["id_grupo"] != 0 && give_acl($id_user,$row["id_grupo"], "AR") == 1) { - //Put in an array all the groups the user belongs to + //Put in an array all the groups the user belongs to array_push ($mis_grupos, $row["id_grupo"]); echo ''; } @@ -1061,7 +1061,7 @@ function list_group2 ($id_user) { * * @return array An array of users */ -function get_users_info ($order = "nombre_real", $info = "nombre_real") { +function get_users_info ($order = "fullname", $info = "fullname") { $users = get_users ($order); $ret = array (); foreach ($users as $user_id => $user_info) { @@ -1121,7 +1121,7 @@ function show_icon_type ($id_type) { * * @param int Server type id * - * @return string Fully formatted IMG HTML tag with icon + * @return string Fully formatted IMG HTML tag with icon */ function show_server_type ($id) { global $config; @@ -1322,7 +1322,7 @@ $sql_cache = array ('saved' => 0); * @param string Condition the field must have * * @return mixed Value of first column of the first row. False if there were no row. - */ + */ function get_db_value ($field, $table, $field_search = 1, $condition = 1) { if (is_int ($condition)) { $sql = sprintf ("SELECT %s FROM %s WHERE %s = %d LIMIT 1", diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 610649ed63..7ef598e312 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2,7 +2,7 @@ // Pandora FMS - the Flexible Monitoring System // ============================================ -// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es +// Copyright (c) 2009 Artica Soluciones Tecnologicas, http://www.artica.es // Please see http://pandora.sourceforge.net for full contribution list // This program is free software; you can redistribute it and/or @@ -11,11 +11,11 @@ // // 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 +// 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 this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require_once ("include/functions_agents.php"); @@ -129,7 +129,8 @@ function get_group_stats ($id_group) { $data["monitor_alerts"] = 0; $data["monitor_alerts_fired"] = 0; $data["monitor_alerts_fire_count"] = 0; - + $data["total_checks"] = 0; + $data["total_alerts"] = 0; $data["total_agents"] = 0; $data["monitor_health"] = 100; $data["alert_level"] = 100; diff --git a/pandora_console/install.php b/pandora_console/install.php index 6ed3c9aee4..06af76861a 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -1,7 +1,8 @@ @@ -116,7 +117,6 @@ function check_writable ( $fullpath, $label ){ } - function check_variable ( $var, $value, $label, $mode ){ echo ""; echo " $label "; @@ -141,15 +141,15 @@ function check_variable ( $var, $value, $label, $mode ){ function parse_mysql_dump($url){ if (file_exists($url)){ - $file_content = file($url); - $query = ""; - foreach($file_content as $sql_line){ + $file_content = file($url); + $query = ""; + foreach($file_content as $sql_line){ if(trim($sql_line) != "" && strpos($sql_line, "--") === false){ $query .= $sql_line; if(preg_match("/;[\040]*\$/", $sql_line)){ - //echo "DEBUG $query
"; //Uncomment for debug + // echo "DEBUG $query
"; //Uncomment for debug if (!$result = mysql_query($query)) { - // echo mysql_errno() . ": " . mysql_error(); //Uncomment for debug + // echo mysql_errno() . ": " . mysql_error(); //Uncomment for debug return 0; } $query = ""; @@ -324,7 +324,7 @@ function install_step3() { For example '/pandora_console' + value='".dirname ($_SERVER["SCRIPT_NAME"])."'>