2006-03-27 05:37:27 +02:00
< ? php
2008-01-10 17:40:00 +01:00
// Pandora FMS - the Free Monitoring System
2007-03-02 18:56:07 +01:00
// ========================================
2008-04-01 15:53:11 +02:00
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
2008-01-10 17:40:00 +01:00
// Please see http://pandora.sourceforge.net for full contribution list
2008-04-01 15:53:11 +02:00
// 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.
// 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.
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
require ( 'functions_html.php' );
2008-01-10 17:40:00 +01:00
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
function pandora_help ( $id , $return = false ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
global $config ;
$output = '<img src="' . $config [ 'homeurl' ] . '/images/help.png" onClick="pandora_help(\'' . $id . '\')">' ;
if ( $return )
return $return ;
echo $output ;
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
}
// ---------------------------------------------------------------
// safe_output()
// Write a string to screen, deleting all kind of problematic characters
// This should be safe for XSS.
// ---------------------------------------------------------------
function safe_output ( $string ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return preg_replace ( '/[^\x09\x0A\x0D\x20-\x7F]/e' , '"&#".ord($0).";"' , $string );
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
}
// ---------------------------------------------------------------
// safe_input()
// Get parameter, using UTF8 encoding, and cleaning bad codes
// ---------------------------------------------------------------
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
function safe_input ( $value ) {
if ( is_numeric ( $value ))
return $value ;
return htmlentities ( utf8_decode ( $value ), ENT_QUOTES );
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
}
// ---------------------------------------------------------------
// salida_sql: Parse \' for replace to ' character, prearing
// SQL sentences to execute.
// ---------------------------------------------------------------
function salida_sql ( $string ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return mysql_escape_string ( $string );
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
}
2006-03-27 05:37:27 +02:00
// input: var, string.
// mesg, mesage to show, var content.
// ---------------------------------------------------------------
function midebug ( $var , $mesg ){
echo " [DEBUG ( " . $var . " ]: ( " . $mesg . " ) " ;
echo " <br> " ;
}
// ---------------------------------------------------------------
2007-03-06 14:18:49 +01:00
// array_in
// Search "item" in a given array, return 1 if exists, 0 if not
2006-03-27 05:37:27 +02:00
// ---------------------------------------------------------------
2007-03-06 14:18:49 +01:00
function array_in ( $exampleArray , $item ){
$result = 0 ;
foreach ( $exampleArray as $key => $value ){
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
if ( $value == $item ){
$result = 1 ;
2006-03-27 05:37:27 +02:00
}
2007-03-06 14:18:49 +01:00
}
return $result ;
2006-03-27 05:37:27 +02:00
}
// ---------------------------------------------------------------
// parse and clear string
// ---------------------------------------------------------------
function salida_limpia ( $string ){
$quote_style = ENT_QUOTES ;
static $trans ;
if ( ! isset ( $trans )) {
$trans = get_html_translation_table ( HTML_ENTITIES , $quote_style );
foreach ( $trans as $key => $value )
$trans [ $key ] = '&#' . ord ( $key ) . ';' ;
// dont translate the '&' in case it is part of &xxx;
$trans [ chr ( 38 )] = '&' ;
}
// after the initial translation, _do_ map standalone '&' into '&'
return preg_replace ( " /&(?![A-Za-z] { 0,4} \ w { 2,3};|#[0-9] { 2,3};)/ " , " & " , strtr ( $string , $trans ));
}
2007-04-11 05:12:48 +02:00
function clean_output_breaks ( $string ){
$myoutput = salida_limpia ( $string );
return preg_replace ( '/\n/' , " <br> " , $myoutput );
2006-03-27 05:37:27 +02:00
}
2007-04-21 18:14:11 +02:00
function output_clean_strict ( $string ){
$string = preg_replace ( '/[\|\@\$\%\/\(\)\=\?\*\&\#]/' , '' , $string );
return $string ;
}
2006-03-27 05:37:27 +02:00
// ---------------------------------------------------------------
// This function reads a string and returns it "clean"
// for use in DB, againts string XSS and so on
// ---------------------------------------------------------------
function entrada_limpia ( $texto ){
2007-06-21 20:58:35 +02:00
$filtro0 = utf8_decode ( $texto );
$filtro1 = htmlentities ( $filtro0 , ENT_QUOTES );
return $filtro1 ;
2006-03-27 05:37:27 +02:00
}
// ---------------------------------------------------------------
// Esta funcion lee una cadena y la da "limpia", para su uso con
// parametros pasados a funcion de abrir fichero. Usados en sec y sec2
// ---------------------------------------------------------------
function parametro_limpio ( $texto ){
// Metemos comprobaciones de seguridad para los includes de paginas pasados por parametro
2006-07-11 17:33:55 +02:00
// Gracias Raul (http://seclists.org/lists/incidents/2004/Jul/0034.html)
// Consiste en purgar los http:// de las cadenas
$pos = strpos ( $texto , " :// " ); // quitamos la parte "fea" de http:// o ftp:// o telnet:// :-)))
if ( $pos <> 0 )
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$texto = substr_replace ( $texto , " " , $pos , + 3 );
2006-07-11 17:33:55 +02:00
// limitamos la entrada de datos por parametros a 125 caracteres
$texto = substr_replace ( $texto , " " , 125 );
$safe = preg_replace ( '/[^a-z0-9_\/]/i' , '' , $texto );
return $safe ;
2006-03-27 05:37:27 +02:00
}
// ---------------------------------------------------------------
// Esta funcion se supone que cierra todos los tags HTML abiertos y no cerrados
// ---------------------------------------------------------------
// string closeOpenTags(string string [, string beginChar [, stringEndChar [, string CloseChar]]]);
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
function closeOpenTags ( $str , $open = " < " , $close = " > " , $end = " / " , $tokens = " _abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ " )
2006-03-27 05:37:27 +02:00
{ $chars = array ();
for ( $i = 0 ; $i < strlen ( $tokens ); $i ++ )
{ $chars [] = substr ( $tokens , $i , 1 ); }
$openedTags = array ();
$closedTags = array ();
$tag = FALSE ;
$closeTag = FALSE ;
$tagName = " " ;
for ( $i = 0 ; $i < strlen ( $str ); $i ++ )
{ $char = substr ( $str , $i , 1 );
if ( $char == $open )
{ $tag = TRUE ; continue ; }
if ( $char == $end )
{ $closeTag = TRUE ; continue ; }
if ( $tag && in_array ( $char , $chars ))
{ $tagName .= $char ; }
else
{ if ( $closeTag )
{ if ( isset ( $closedTags [ $tagName ]))
{ $closedTags [ $tagName ] ++ ; }
else
{ $closedTags [ $tagName ] = 1 ; } }
elseif ( $tag )
{ if ( isset ( $openedTags [ $tagName ]))
{ $openedTags [ $tagName ] ++ ; }
else
{ $openedTags [ $tagName ] = 1 ; } }
$tag = FALSE ; $closeTag = FALSE ; $tagName = " " ; }
}
while ( list ( $tag , $count ) = each ( $openedTags ))
{
$closedTags [ $tag ] = isset ( $closedTags [ $tag ]) ? $closedTags [ $tag ] : 0 ;
$count -= $closedTags [ $tag ];
if ( $count < 1 ) continue ;
$str .= str_repeat ( $open . $end . $tag . $close , $count );
}
return $str ;
}
// ---------------------------------------------------------------
// Return string with time-threshold in secs, mins, days or weeks
// ---------------------------------------------------------------
function give_human_time ( $int_seconds ){
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$key_suffix = 's' ;
$periods = array ( 'year' => 31556926 ,
'month' => 2629743 ,
'day' => 86400 ,
'hour' => 3600 ,
'minute' => 60 ,
'second' => 1
);
// used to hide 0's in higher periods
$flag_hide_zero = true ;
// do the loop thang
foreach ( $periods as $key => $length ) {
// calculate
$temp = floor ( $int_seconds / $length );
// determine if temp qualifies to be passed to output
if ( ! $flag_hide_zero || $temp > 0 ) {
// store in an array
$build [] = $temp . ' ' . $key . ( $temp != 1 ? 's' : null );
// set flag to false, to allow 0's in lower periods
2008-06-19 02:24:05 +02:00
$flag_hide_zero = true ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
// get the remainder of seconds
$int_seconds = fmod ( $int_seconds , $length );
}
// return output, if !empty, implode into string, else output $if_reached
return ( ! empty ( $build ) ? implode ( ', ' , $build ) : $if_reached );
2006-03-27 05:37:27 +02:00
}
// ---------------------------------------------------------------
// This function show a popup window using a help_id (unused)
// ---------------------------------------------------------------
function popup_help ( $help_id ){
echo " <a href='javascript:help_popup( " . $help_id . " )'>[H]</a> " ;
}
// ---------------------------------------------------------------
// no_permission () - Display no perm. access
// ---------------------------------------------------------------
function no_permission () {
require ( " config.php " );
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
require ( " include/languages/language_ " . $config [ " language " ] . " .php " );
2006-10-21 18:47:26 +02:00
echo " <h3 class='error'> " . $lang_label [ " no_permission_title " ] . " </h3> " ;
2007-07-01 16:15:47 +02:00
echo " <img src='images/noaccess.png' alt='No access' width='120'><br><br> " ;
2006-03-27 05:37:27 +02:00
echo " <table width=550> " ;
2006-10-21 18:47:26 +02:00
echo " <tr><td> " ;
2006-03-27 05:37:27 +02:00
echo $lang_label [ " no_permission_text " ];
echo " </table> " ;
echo " <tr><td><td><td><td> " ;
include " general/footer.php " ;
exit ;
}
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
// ---------------------------------------------------------------
// unmanaged_error - Display generic error message and stop execution
// ---------------------------------------------------------------
function unmanaged_error ( $error = " " ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
require ( " config.php " );
require ( " include/languages/language_ " . $config [ " language " ] . " .php " );
echo " <h3 class='error'> " . lang_string ( " Unmanaged error " ) . " </h3> " ;
echo " <img src='images/errror.png' alt='error'><br><br> " ;
echo " <table width=550> " ;
echo " <tr><td> " ;
echo lang_string ( " Unmanaged error_text " );
echo " <tr><td> " ;
echo $error ;
echo " </table> " ;
echo " <tr><td><td><td><td> " ;
include " general/footer.php " ;
exit ;
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
}
2006-07-01 03:48:56 +02:00
function list_files ( $directory , $stringSearch , $searchHandler , $outputHandler ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$errorHandler = false ;
$result = array ();
if ( ! $directoryHandler = @ opendir ( $directory )) {
echo ( " <pre> \n error: directory \" $directory\ " doesn ' t exist ! \n </ pre > \n " );
return $errorHandler = true ;
}
if ( $searchHandler == 0 ) {
2006-07-01 03:48:56 +02:00
while ( false !== ( $fileName = @ readdir ( $directoryHandler ))) {
@ array_push ( $result , $fileName );
}
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
if ( $searchHandler == 1 ) {
while ( false !== ( $fileName = @ readdir ( $directoryHandler ))) {
if ( @ substr_count ( $fileName , $stringSearch ) > 0 ) {
@ array_push ( $result , $fileName );
}
}
}
if (( $errorHandler == true ) && ( @ count ( $result ) === 0 )) {
echo ( " <pre> \n error: no filetype \" $fileExtension\ " found ! \n </ pre > \n " );
} else {
sort ( $result );
if ( $outputHandler == 0 ) {
return $result ;
}
if ( $outputHandler == 1 ) {
echo ( " <pre> \n " );
print_r ( $result );
echo ( " </pre> \n " );
}
}
2006-07-01 03:48:56 +02:00
}
2006-03-27 05:37:27 +02:00
function pagination ( $count , $url , $offset ) {
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
global $config ;
require ( " include/languages/language_ " . $config [ " language " ] . " .php " );
2006-03-27 05:37:27 +02:00
/* URL passed render links with some parameter
& offset - Offset records passed to next page
& counter - Number of items to be blocked
Pagination needs $url to build the base URL to render links , its a base url , like
" http://pandora/index.php?sec=godmode&sec2=godmode/admin_access_logs "
*/
2007-02-05 18:45:14 +01:00
$block_limit = 15 ; // Visualize only $block_limit blocks
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
if ( $count > $config [ " block_size " ]){
2006-03-27 05:37:27 +02:00
// If exists more registers than I can put in a page, calculate index markers
2008-04-01 15:53:11 +02:00
$index_counter = ceil ( $count / $config [ " block_size " ]); // Number of blocks of block_size with data
$index_page = ceil ( $offset / $config [ " block_size " ]) - ( ceil ( $block_limit / 2 )); // block to begin to show data;
2007-02-05 18:45:14 +01:00
if ( $index_page < 0 )
$index_page = 0 ;
2006-03-27 05:37:27 +02:00
// This calculate index_limit, block limit for this search.
if (( $index_page + $block_limit ) > $index_counter )
2007-02-06 16:38:29 +01:00
$index_limit = $index_counter ;
2006-03-27 05:37:27 +02:00
else
$index_limit = $index_page + $block_limit ;
// This calculate if there are more blocks than visible (more than $block_limit blocks)
if ( $index_counter > $block_limit )
$paginacion_maxima = 1 ; // If maximum blocks ($block_limit), show only 10 and "...."
else
$paginacion_maxima = 0 ;
// This setup first block of query
if ( $paginacion_maxima == 1 )
if ( $index_page == 0 )
$inicio_pag = 0 ;
else
$inicio_pag = $index_page ;
else
$inicio_pag = 0 ;
2007-02-05 18:45:14 +01:00
echo " <div> " ;
// Show GOTO FIRST button
echo '<a href="' . $url . '&offset=0">' ;
2007-03-02 18:56:07 +01:00
echo " <img src='images/control_start_blue.png' class='bot'> " ;
2007-02-05 18:45:14 +01:00
echo " </a> " ;
echo " " ;
// Show PREVIOUS button
if ( $index_page > 0 ){
2008-04-01 15:53:11 +02:00
$index_page_prev = ( $index_page - ( floor ( $block_limit / 2 ))) * $config [ " block_size " ];
2007-02-05 18:45:14 +01:00
if ( $index_page_prev < 0 )
$index_page_prev = 0 ;
2007-03-02 18:56:07 +01:00
echo '<a href="' . $url . '&offset=' . $index_page_prev . '"><img src="images/control_rewind_blue.png" class="bot"></a>' ;
2006-03-27 05:37:27 +02:00
}
2007-03-02 18:56:07 +01:00
echo " " ; echo " " ;
2006-03-27 05:37:27 +02:00
// Draw blocks markers
2007-02-06 16:38:29 +01:00
// $i stores number of page
2007-02-05 18:45:14 +01:00
for ( $i = $inicio_pag ; $i < $index_limit ; $i ++ ) {
2008-04-01 15:53:11 +02:00
$inicio_bloque = ( $i * $config [ " block_size " ]);
$final_bloque = $inicio_bloque + $config [ " block_size " ];
2006-03-27 05:37:27 +02:00
if ( $final_bloque > $count ){ // if upper limit is beyond max, this shouldnt be possible !
2008-04-01 15:53:11 +02:00
$final_bloque = ( $i - 1 ) * $config [ " block_size " ] + $count - (( $i - 1 ) * $config [ " block_size " ]);
2006-03-27 05:37:27 +02:00
}
2007-02-05 18:45:14 +01:00
echo " <span> " ;
2007-02-06 16:38:29 +01:00
2006-03-27 05:37:27 +02:00
$inicio_bloque_fake = $inicio_bloque + 1 ;
2007-02-06 16:38:29 +01:00
// To Calculate last block (doesnt end with round data,
// it must be shown if not round to block limit)
echo '<a href="' . $url . '&offset=' . $inicio_bloque . '">' ;
if ( $inicio_bloque == $offset )
echo " <b>[ $i ]</b> " ;
else
echo " [ $i ] " ;
echo '</a> ' ;
echo " </span> " ;
}
2007-03-02 18:56:07 +01:00
echo " " ; echo " " ;
2007-02-06 16:38:29 +01:00
// Show NEXT PAGE (fast forward)
// Index_counter stores max of blocks
if (( $paginacion_maxima == 1 ) AND (( $index_counter - $i ) > 0 )) {
2008-04-01 15:53:11 +02:00
$prox_bloque = ( $i + ceil ( $block_limit / 2 )) * $config [ " block_size " ];
2007-02-06 16:38:29 +01:00
if ( $prox_bloque > $count )
2008-04-01 15:53:11 +02:00
$prox_bloque = ( $count - 1 ) - $config [ " block_size " ];
2007-02-06 16:38:29 +01:00
echo '<a href="' . $url . '&offset=' . $prox_bloque . '">' ;
2007-03-02 18:56:07 +01:00
echo " <img class='bot' src='images/control_fastforward_blue.png'></a> " ;
2006-03-27 05:37:27 +02:00
$i = $index_counter ;
}
// if exists more registers than i can put in a page (defined by $block_size config parameter)
// get offset for index calculation
2007-02-06 16:38:29 +01:00
// Draw "last" block link, ajust for last block will be the same
// as painted in last block (last integer block).
2008-04-01 15:53:11 +02:00
if (( $count - $config [ " block_size " ]) > 0 ){
$myoffset = floor (( $count - 1 ) / $config [ " block_size " ]) * $config [ " block_size " ];
2007-03-02 18:56:07 +01:00
echo '<a href="' . $url . '&offset=' . $myoffset . '">' ;
echo " <img class='bot' src='images/control_end_blue.png'> " ;
2007-02-06 16:38:29 +01:00
echo " </a> " ;
}
2007-02-05 18:45:14 +01:00
// End div and layout
echo " </div> " ;
2007-02-19 08:44:07 +01:00
}
2006-03-27 05:37:27 +02:00
}
2006-12-25 19:15:57 +01:00
2007-06-10 15:19:27 +02:00
2007-04-18 11:58:26 +02:00
// ---------------------------------------------------------------
2007-03-12 18:58:52 +01:00
// Render data in a fashion way :-)
2007-04-18 11:58:26 +02:00
// ---------------------------------------------------------------
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
function format_numeric ( $number , $decimals = 2 , $dec_point = " . " , $thousands_sep = " , " ) {
2007-03-12 18:58:52 +01:00
if ( $number == 0 )
return 0 ;
// If has decimals
2007-06-10 15:19:27 +02:00
if ( fmod ( $number , 1 ) > 0 )
2007-05-18 14:56:05 +02:00
return number_format ( $number , $decimals , $dec_point , $thousands_sep );
2007-03-12 18:58:52 +01:00
else
return number_format ( $number , 0 , $dec_point , $thousands_sep );
}
2007-04-18 11:58:26 +02:00
// ---------------------------------------------------------------
// Render numeric data in a easy way to the user
// ---------------------------------------------------------------
2007-05-18 14:56:05 +02:00
function format_for_graph ( $number , $decimals = 2 , $dec_point = " . " , $thousands_sep = " , " ) {
2007-04-18 11:58:26 +02:00
if ( $number > " 1000000 " )
2007-06-10 15:19:27 +02:00
if ( fmod ( $number , 1000000 ) > 0 )
return number_format ( $number / 1000000 , $decimals , $dec_point , $thousands_sep ) . " M " ;
else
return number_format ( $number / 1000000 , 0 , $dec_point , $thousands_sep ) . " M " ;
2007-04-18 11:58:26 +02:00
if ( $number > " 1000 " )
2007-06-10 15:19:27 +02:00
if ( fmod ( $number , 1000 ) > 0 )
return number_format ( $number / 1000 , $decimals , $dec_point , $thousands_sep ) . " K " ;
else
return number_format ( $number / 1000 , 0 , $dec_point , $thousands_sep ) . " K " ;
2007-05-18 14:56:05 +02:00
// If has decimals
2007-06-12 13:57:03 +02:00
if ( fmod ( $number , 1 ) > 0 )
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return number_format ( $number , $decimals , $dec_point , $thousands_sep );
return number_format ( $number , 0 , $dec_point , $thousands_sep );
2007-04-18 11:58:26 +02:00
}
2007-06-07 19:46:38 +02:00
function give_parameter_get ( $name , $default = " " ){
$output = $default ;
if ( isset ( $_GET [ $name ])){
$output = $_GET [ $name ];
}
return $output ;
}
function give_parameter_post ( $name , $default = " " ){
$output = $default ;
if ( isset ( $_POST [ $name ])){
$output = $_POST [ $name ];
}
return $output ;
}
2007-10-08 17:29:38 +02:00
function give_parameter_get_numeric ( $name , $default = " -1 " ){
$output = $default ;
if ( isset ( $_GET [ $name ])){
$output = $_GET [ $name ];
}
if ( is_numeric ( $output ))
return $output ;
else
return - 1 ;
}
function give_parameter_post_numeric ( $name , $default = " " ){
$output = $default ;
if ( isset ( $_POST [ $name ])){
$output = $_POST [ $name ];
}
if ( is_numeric ( $output ))
return $output ;
else
return - 1 ;
}
2007-06-07 19:46:38 +02:00
function human_time_comparation ( $timestamp ){
2007-06-12 13:57:03 +02:00
global $lang_label ;
2007-07-28 20:11:48 +02:00
if ( $timestamp != " " ){
$ahora = date ( " Y/m/d H:i:s " );
$seconds = strtotime ( $ahora ) - strtotime ( $timestamp );
} else
$seconds = 0 ;
2007-06-12 13:57:03 +02:00
if ( $seconds < 3600 )
$render = format_numeric ( $seconds / 60 , 1 ) . " " . $lang_label [ " minutes " ];
elseif (( $seconds >= 3600 ) and ( $seconds < 86400 ))
$render = format_numeric ( $seconds / 3600 , 1 ) . " " . $lang_label [ " hours " ];
elseif (( $seconds >= 86400 ) and ( $seconds < 2592000 ))
$render = format_numeric ( $seconds / 86400 , 1 ) . " " . $lang_label [ " days " ];
elseif (( $seconds >= 2592000 ) and ( $seconds < 15552000 ))
$render = format_numeric ( $seconds / 2592000 , 1 ) . " " . $lang_label [ " months " ];
elseif ( $seconds >= 15552000 )
$render = " +6 " . $lang_label [ " months " ];
return $render ;
}
function human_time_description_raw ( $seconds ){
global $lang_label ;
2007-06-07 19:46:38 +02:00
if ( $seconds < 3600 )
$render = format_numeric ( $seconds / 60 , 2 ) . " " . $lang_label [ " minutes " ];
elseif (( $seconds >= 3600 ) and ( $seconds < 86400 ))
$render = format_numeric ( $seconds / 3600 , 2 ) . " " . $lang_label [ " hours " ];
elseif ( $seconds >= 86400 )
$render = format_numeric ( $seconds / 86400 , 2 ) . " " . $lang_label [ " days " ];
2007-06-12 13:57:03 +02:00
return $render ;
2007-06-07 19:46:38 +02:00
}
function human_time_description ( $period ){
2007-06-12 13:57:03 +02:00
global $lang_label ;
2007-06-07 19:46:38 +02:00
switch ( $period ) {
2007-06-12 13:57:03 +02:00
case 3600 : $period_label = $lang_label [ " hour " ];
break ;
case 7200 : $period_label = $lang_label [ " 2_hours " ];
break ;
case 21600 : $period_label = $lang_label [ " 6_hours " ];
break ;
case 43200 : $period_label = $lang_label [ " 12_hours " ];
break ;
case 86400 : $period_label = $lang_label [ " last_day " ];
break ;
case 172800 : $period_label = $lang_label [ " two_days " ];
break ;
case 432000 : $period_label = $lang_label [ " five_days " ];
break ;
case 604800 : $period_label = $lang_label [ " last_week " ];
break ;
case 1296000 : $period_label = $lang_label [ " 15_days " ];
break ;
case 2592000 : $period_label = $lang_label [ " last_month " ];
break ;
case 5184000 : $period_label = $lang_label [ " two_month " ];
break ;
case 15552000 : $period_label = $lang_label [ " six_months " ];
break ;
default : $period_label = human_time_description_raw ( $period );
2007-06-07 19:46:38 +02:00
}
return $period_label ;
}
2007-04-18 11:58:26 +02:00
2007-06-12 20:10:57 +02:00
// This function returns MYSQL Date from now - seconds passed as parameter
function human_date_relative ( $seconds ) {
$ahora = date ( " Y/m/d H:i:s " );
$ahora_s = date ( " U " );
$ayer = date ( " Y/m/d H:i:s " , $ahora_s - $seconds );
return $ayer ;
}
2007-06-21 17:48:47 +02:00
function render_time ( $lapse ) {
$myhour = intval (( $lapse * 30 ) / 60 );
if ( $myhour == 0 )
$output = " 00 " ;
else
$output = $myhour ;
$output .= " : " ;
$mymin = fmod (( $lapse * 30 ), 60 );
if ( $mymin == 0 )
$output .= " 00 " ;
else
$output .= $mymin ;
return $output ;
}
2007-06-12 20:10:57 +02:00
2008-01-10 17:40:00 +01:00
function get_parameter ( $name , $default = '' ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
// POST has precedence
if ( isset ( $_POST [ $name ]))
return get_parameter_post ( $name , $default );
if ( isset ( $_GET [ $name ]))
return get_parameter_get ( $name , $default );
return $default ;
2008-01-10 17:40:00 +01:00
}
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
function get_parameter_get ( $name , $default = " " ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
if (( isset ( $_GET [ $name ])) && ( $_GET [ $name ] != " " ))
return safe_input ( $_GET [ $name ]);
return $default ;
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
}
function get_parameter_post ( $name , $default = " " ){
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
if (( isset ( $_POST [ $name ])) && ( $_POST [ $name ] != " " ))
return safe_input ( $_POST [ $name ]);
return $default ;
}
function get_alert_priority ( $priority = 0 ) {
global $config ;
2008-06-16 20:09:56 +02:00
switch ( $priority ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
case 0 :
return lang_string ( " Maintenance " );
break ;
case 1 :
return lang_string ( " Informational " );
break ;
case 2 :
return lang_string ( " Normal " );
break ;
case 3 :
return lang_string ( " Warning " );
break ;
case 4 :
return lang_string ( " Critical " );
break ;
}
return '' ;
2008-04-03 17:43:34 +02:00
}
function get_alert_days ( $row ){
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
global $config ;
global $lang_label ;
$days_output = " " ;
$check = $row [ " monday " ] + $row [ " tuesday " ] + $row [ " wednesday " ] + $row [ " thursday " ] + $row [ " friday " ] + $row [ " saturday " ] + $row [ " sunday " ];
if ( $row [ " monday " ] != 0 )
return " Mo " ;
if ( $row [ " tuesday " ] != 0 )
return " Tu " ;
if ( $row [ " wednesday " ] != 0 )
return " We " ;
if ( $row [ " thursday " ] != 0 )
return " Th " ;
if ( $row [ " friday " ] != 0 )
return " Fr " ;
if ( $row [ " saturday " ] != 0 )
return " Sa " ;
if ( $row [ " sunday " ] != 0 )
return " Su " ;
if ( $check == 7 )
return lang_string ( " all " );
return lang_string ( " none " );
2008-04-03 17:43:34 +02:00
}
function get_alert_times ( $row2 ){
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
global $config ;
global $lang_label ;
if ( $row2 [ " time_from " ]){
$time_from_table = $row2 [ " time_from " ];
} else {
$time_from_table = lang_string ( " N/A " );
}
if ( $row2 [ " time_to " ]){
$time_to_table = $row2 [ " time_to " ];
} else {
$time_to_table = lang_string ( " N/A " );
}
$string = " " ;
if ( $time_to_table == $time_from_table )
$string .= $lang_label [ " N/A " ];
else
$string .= substr ( $time_from_table , 0 , 5 ) . " - " . substr ( $time_to_table , 0 , 5 );
return $string ;
2008-04-03 17:43:34 +02:00
}
function show_alert_row_edit ( $row2 , $tdcolor = " datos " , $id_tipo_modulo = 1 , $combined = 0 ){
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
global $config ;
global $lang_label ;
$string = " " ;
if ( $row2 [ " disable " ] == 1 ){
$string .= " <td class=' $tdcolor '><b><i> " . $lang_label [ " disabled " ] . " </b></i> " ;
} elseif ( $id_tipo_modulo != 0 ) {
$string .= " <td class=' $tdcolor '><img src='images/ " . show_icon_type ( $id_tipo_modulo ) . " ' border=0> " ;
} else {
$string .= " <td class=' $tdcolor '>-- " ;
}
if ( isset ( $row2 [ " operation " ])){
$string = $string . " <td class= $tdcolor > " . $row2 [ " operation " ];
} else {
$string = $string . " <td class= $tdcolor > " . get_db_sql ( " SELECT nombre FROM talerta WHERE id_alerta = " . $row2 [ " id_alerta " ]);
}
$string = $string . " <td class=' $tdcolor '> " . human_time_description ( $row2 [ " time_threshold " ]);
if ( $row2 [ " dis_min " ]) {
$mytempdata = fmod ( $row2 [ " dis_min " ], 1 );
if ( $mytempdata == 0 )
$mymin = intval ( $row2 [ " dis_min " ]);
else
$mymin = $row2 [ " dis_min " ];
$mymin = format_for_graph ( $mymin );
} else {
$mymin = 0 ;
}
2008-06-16 20:09:56 +02:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
if ( $row2 [ " dis_max " ] != 0 ){
$mytempdata = fmod ( $row2 [ " dis_max " ], 1 );
if ( $mytempdata == 0 )
$mymax = intval ( $row2 [ " dis_max " ]);
else
$mymax = $row2 [ " dis_max " ];
$mymax = format_for_graph ( $mymax );
} else {
$mymax = 0 ;
}
// We have alert text ?
if ( $row2 [ " alert_text " ] != " " ) {
$string = $string . " <td colspan=2 class=' $tdcolor '> " . $lang_label [ " text " ] . " </td> " ;
} else {
$string = $string . " <td class=' $tdcolor '> " . $mymin . " </td> " ;
$string = $string . " <td class=' $tdcolor '> " . $mymax . " </td> " ;
}
// Alert times
$string = $string . " <td class=' $tdcolor '> " ;
$string .= get_alert_times ( $row2 );
// Description
$string = $string . " </td><td class=' $tdcolor '> " . salida_limpia ( $row2 [ " descripcion " ]);
// Has recovery notify activated ?
if ( $row2 [ " recovery_notify " ] > 0 )
$recovery_notify = lang_string ( " Yes " );
else
$recovery_notify = lang_string ( " No " );
// calculate priority
$priority = get_alert_priority ( $row2 [ " priority " ]);
// calculare firing conditions
if ( $row2 [ " alert_text " ] != " " ) {
$firing_cond = lang_string ( " text " ) . " ( " . substr ( $row2 [ " alert_text " ], 0 , 8 ) . " ) " ;
} else {
$firing_cond = $row2 [ " min_alerts " ] . " / " . $row2 [ " max_alerts " ];
}
// calculate days
$firing_days = get_alert_days ( $row2 );
// More details EYE tooltip
$string = $string . " <td class=' $tdcolor '> " ;
$string .= " <a href=# class=info><img class='top'
src = 'images/eye.png' alt = '' > " ;
// Add float info table
$string .= "
< span >
< table cellspacing = '2' cellpadding = '0'
style = 'margin-left:2px;' >
< tr >< th colspan = '2' width = '91' > " .
lang_string ( " Recovery " ) . " </th></tr>
< tr >< td colspan = '2' class = 'datos' align = 'center' >< b > $recovery_notify </ b ></ td ></ tr >
< tr >< th colspan = '2' width = '91' > " .
lang_string ( " Priority " ) . " </th></tr>
< tr >< td colspan = '2' class = 'datos' align = 'center' >< b > $priority </ b ></ td ></ tr >
< tr >< th colspan = '2' width = '91' > " .
lang_string ( " Alert Ctrl. " ) . " </th></tr>
< tr >< td colspan = '2' class = 'datos' align = 'center' >< b > " . $firing_cond . " </ b ></ td ></ tr >
< tr >< th colspan = '2' width = '91' > " .
lang_string ( " Firing days " ) . " </th></tr>
< tr >< td colspan = '2' class = 'datos' align = 'center' >< b > " . $firing_days . " </ b ></ td ></ tr >
</ table ></ span ></ A > " ;
return $string ;
2008-04-03 17:43:34 +02:00
}
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
function show_alert_show_view ( $data , $tdcolor = " datos " , $combined = 0 ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
global $config ;
global $lang_label ;
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
if ( $combined == 0 ) {
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$module_name = get_db_sql ( " SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = " . $data [ " id_agente_modulo " ]);
$agent_name = get_db_sql ( " SELECT tagente.nombre FROM tagente_modulo, tagente WHERE tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_agente_modulo = " . $data [ " id_agente_modulo " ]);
$id_agente = get_db_sql ( " SELECT id_agente FROM tagente_modulo WHERE id_agente_modulo = " . $data [ " id_agente_modulo " ]);
} else {
$agent_name = get_db_sql ( " SELECT nombre FROM tagente WHERE id_agente = " . $data [ " id_agent " ]);
$id_agente = $data [ " id_agent " ];
}
$alert_name = get_db_sql ( " SELECT nombre FROM talerta WHERE id_alerta = " . $data [ " id_alerta " ]);
echo " <td class=' " . $tdcolor . " '> " . $alert_name . " </td> " ;
if ( $combined == 0 ) {
echo " <td class=' " . $tdcolor . " '> " . substr ( $module_name , 0 , 21 ) . " </td> " ;
} else {
echo " <td class=' " . $tdcolor . " '> " ;
// More details EYE tooltip (combined)
echo " <a href='#' class='info_table'><img class='top' src='images/eye.png' alt=''><span> " ;
echo show_alert_row_mini ( $data [ " id_aam " ]);
echo " </span></a> " ;
echo substr ( $agent_name , 0 , 21 ) . " </td> " ;
}
// Description
echo " <td class=' " . $tdcolor . " '> " . $data [ " descripcion " ] . " </td> " ;
// Extended info
echo " <td class=' " . $tdcolor . " '> " ;
// Has recovery notify activated ?
if ( $data [ " recovery_notify " ] > 0 )
$recovery_notify = lang_string ( " Yes " );
else
$recovery_notify = lang_string ( " No " );
// calculate priority
$priority = get_alert_priority ( $data [ " priority " ]);
// calculare firing conditions
if ( $data [ " alert_text " ] != " " ){
$firing_cond = lang_string ( " text " ) . " ( " . substr ( $data [ " alert_text " ], 0 , 8 ) . " ) " ;
} else {
$firing_cond = $data [ " min_alerts " ] . " / " . $data [ " max_alerts " ];
}
// calculate days
$firing_days = get_alert_days ( $data );
// More details EYE tooltip
echo " <a href='#' class='info'><img class='top'
src = 'images/eye.png' alt = '' > " ;
// Add float info table
echo " <span>
< table cellspacing = '2' cellpadding = '0'
style = 'margin-left:2px;' >
< tr >< th colspan = '2' width = '91' > " .
lang_string ( " Recovery " ) . " </th></tr>
< tr >< td colspan = '2' class = 'datos' align = 'center' >< b > $recovery_notify </ b ></ td ></ tr >
< tr >< th colspan = '2' width = '91' > " .
lang_string ( " Priority " ) . " </th></tr>
< tr >< td colspan = '2' class = 'datos' align = 'center' >< b > $priority </ b ></ td ></ tr >
< tr >< th colspan = '2' width = '91' > " .
lang_string ( " Alert Ctrl. " ) . " </th></tr>
< tr >< td colspan = '2' class = 'datos' align = 'center' >< b > " . $firing_cond . " </ b ></ td ></ tr >
< tr >< th colspan = '2' width = '91' > " .
lang_string ( " Firing days " ) . " </th></tr>
< tr >< td colspan = '2' class = 'datos' align = 'center' >< b > " . $firing_days . " </ b ></ td ></ tr >
</ table ></ span ></ a > " ;
$mytempdata = fmod ( $data [ " dis_min " ], 1 );
if ( $mytempdata == 0 )
$mymin = intval ( $data [ " dis_min " ]);
else
$mymin = $data [ " dis_min " ];
$mymin = format_for_graph ( $mymin );
$mytempdata = fmod ( $data [ " dis_max " ], 1 );
if ( $mytempdata == 0 )
$mymax = intval ( $data [ " dis_max " ]);
else
$mymax = $data [ " dis_max " ];
$mymax = format_for_graph ( $mymax );
// Text alert ?
if ( $data [ " alert_text " ] != " " )
echo " <td class=' " . $tdcolor . " ' colspan=2> " . $lang_label [ " text " ] . " </td> " ;
else {
echo " <td class=' " . $tdcolor . " '> " . $mymin . " </td> " ;
echo " <td class=' " . $tdcolor . " '> " . $mymax . " </td> " ;
}
echo " <td align='center' class=' " . $tdcolor . " '> " . human_time_description ( $data [ " time_threshold " ]);
if ( $data [ " last_fired " ] == " 0000-00-00 00:00:00 " ) {
echo " <td align='center' class=' " . $tdcolor . " f9'> " . $lang_label [ " never " ] . " </td> " ;
} else {
echo " <td align='center' class=' " . $tdcolor . " f9'> " . human_time_comparation ( $data [ " last_fired " ]) . " </td> " ;
}
echo " <td align='center' class=' " . $tdcolor . " '> " . $data [ " times_fired " ] . " </td> " ;
if ( $data [ " times_fired " ] <> 0 ){
echo " <td class=' " . $tdcolor . " ' align='center'><img width='20' height='9' src='images/pixel_red.png' title=' " . $lang_label [ " fired " ] . " '> " ;
echo " </td> " ;
$id_grupo_alerta = get_db_value ( " id_grupo " , " tagente " , " id_agente " , $id_agente );
if ( give_acl ( $config [ " id_user " ], $id_grupo_alerta , " AW " ) == 1 ) {
echo " <td align='center' class=' " . $tdcolor . " '> " ;
echo " <a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&
id_agente = $id_agente & validate_alert = " . $data["id_aam"] . " '><img src=' images / ok . png ' ></ a > " ;
echo " </td> " ;
}
} else {
echo " <td class=' " . $tdcolor . " ' align='center'>
< img width = '20' height = '9' src = 'images/pixel_green.png' title = '".$lang_label["not_fired"]."' ></ td > " ;
}
2008-04-03 17:43:34 +02:00
}
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
2008-04-03 17:43:34 +02:00
function form_render_check ( $name_form , $value_form = 1 ){
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
echo " <input name=' $name_form ' type='checkbox' " ;
if ( $value_form != 0 ) {
echo " checked='1' " ;
}
echo " value=1> " ;
}
/**
* Get report types in an array .
*
* @ return An array with all the possible reports in Pandora where the array index is the report id .
*/
function get_report_types () {
$types = array ();
$types [ 'simple_graph' ] = lang_string ( 'simple_graph' );
$types [ 'custom_graph' ] = lang_string ( 'custom_graph' );
$types [ 'SLA' ] = lang_string ( 'SLA' );
$types [ 'event_report' ] = lang_string ( 'event_report' );
$types [ 'alert_report' ] = lang_string ( 'alert_report' );
$types [ 'monitor_report' ] = lang_string ( 'monitor_report' );
$types [ 'avg_value' ] = lang_string ( 'avg_value' );
$types [ 'max_value' ] = lang_string ( 'max_value' );
$types [ 'min_value' ] = lang_string ( 'min_value' );
$types [ 'sumatory' ] = lang_string ( 'sumatory' );
$types [ 'general_group_report' ] = lang_string ( 'general_group_report' );
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
$types [ 'monitor_health' ] = lang_string ( 'monitor_health' );
$types [ 'agents_detailed' ] = lang_string ( 'agents_detailed' );
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return $types ;
}
/**
* Get report type name from type id .
*
* @ param $type Type id of the report .
*
* @ return Report type name .
*/
function get_report_name ( $type ) {
$types = get_report_types ();
if ( ! isset ( $types [ $type ]))
return lang_string ( 'unknown' );
return $types [ $type ];
}
/**
* Get report type name from type id .
*
* @ param $type Type id of the report .
*
* @ return Report type name .
*/
function get_report_type_data_source ( $type ) {
switch ( $type ) {
case 1 :
case 'simple_graph' :
case 7 :
case 'avg_value' :
case 8 :
case 'max_value' :
case 9 :
case 'min_value' :
case 10 :
case 'sumatory' :
return 'module' ;
case 2 :
case 'custom_graph' :
return 'custom-graph' ;
case 3 :
case 'SLA' :
case 4 :
case 'event_report' :
case 5 :
case 'alert_report' :
case 6 :
case 'monitor_report' :
case 11 :
case 'general_group_report' :
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
case 12 :
case 'monitor_health' :
case 13 :
case 'agents_detailed' :
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
return 'agent-group' ;
}
return 'unknown' ;
}
/**
* Checks if a module is of type " data "
*
* @ param $module_name Module name to check .
*
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
* @ return true if the module is of type " data "
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
function is_module_data ( $module_name ) {
$result = ereg ( " ^(.*_data) $ " , $module_name );
if ( $result === false )
return false ;
return true ;
}
/**
* Checks if a module is of type " proc "
*
* @ param $module_name Module name to check .
*
* @ return true if the module is of type " proc "
*/
function is_module_proc ( $module_name ) {
$result = ereg ( '^(.*_proc)$' , $module_name );
if ( $result === false )
return false ;
return true ;
}
/**
* Checks if a module is of type " inc "
*
* @ param $module_name Module name to check .
*
* @ return true if the module is of type " inc "
*/
function is_module_inc ( $module_name ) {
$result = ereg ( '^(.*_inc)$' , $module_name );
if ( $result === false )
return false ;
return true ;
}
/**
* Checks if a module is of type " string "
*
* @ param $module_name Module name to check .
*
* @ return true if the module is of type " string "
*/
function is_module_data_string ( $module_name ) {
$result = ereg ( '^(.*string)$' , $module_name );
if ( $result === false )
return false ;
return true ;
}
function get_event_types () {
$types = array ();
$types [ 'unknown' ] = lang_string ( 'unknown' );
$types [ 'monitor_up' ] = lang_string ( 'monitor_up' );
$types [ 'monitor_down' ] = lang_string ( 'monitor_down' );
$types [ 'alert_fired' ] = lang_string ( 'alert_fired' );
$types [ 'alert_recovered' ] = lang_string ( 'alert_recovered' );
$types [ 'alert_ceased' ] = lang_string ( 'alert_ceased' );
$types [ 'alert_manual_validation' ] = lang_string ( 'alert_manual_validation' );
$types [ 'recon_host_detected' ] = lang_string ( 'recon_host_detected' );
2008-06-19 02:24:05 +02:00
$types [ 'new_agent' ] = lang_string ( 'new_agent' );
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
$types [ 'system' ] = lang_string ( 'sytem' );
$types [ 'error' ] = lang_string ( 'error' );
return $types ;
}
function form_priority ( $priority = 0 , $form_name = " priority " , $show_all = 0 ) {
global $config ;
echo '<select name="' . $form_name . '">' ;
switch ( $priority ) {
case 0 :
echo " <option value=0> " . lang_string ( " Maintenance " );
echo " <option value=1> " . lang_string ( " Informational " );
echo " <option value=2> " . lang_string ( " Normal " );
echo " <option value=3> " . lang_string ( " Warning " );
echo " <option value=4> " . lang_string ( " Critical " );
break ;
case 1 :
echo " <option value=1> " . lang_string ( " Informational " );
echo " <option value=0> " . lang_string ( " Maintenance " );
echo " <option value=2> " . lang_string ( " Normal " );
echo " <option value=3> " . lang_string ( " Warning " );
echo " <option value=4> " . lang_string ( " Critical " );
break ;
case 2 :
echo " <option value=2> " . lang_string ( " Normal " );
echo " <option value=0> " . lang_string ( " Maintenance " );
echo " <option value=1> " . lang_string ( " Informational " );
echo " <option value=3> " . lang_string ( " Warning " );
echo " <option value=4> " . lang_string ( " Critical " );
break ;
case 3 :
echo " <option value=3> " . lang_string ( " Warning " );
echo " <option value=0> " . lang_string ( " Maintenance " );
echo " <option value=1> " . lang_string ( " Informational " );
echo " <option value=2> " . lang_string ( " Normal " );
echo " <option value=4> " . lang_string ( " Critical " );
break ;
case 4 :
echo " <option value=4> " . lang_string ( " Critical " );
echo " <option value=0> " . lang_string ( " Maintenance " );
echo " <option value=1> " . lang_string ( " Informational " );
echo " <option value=2> " . lang_string ( " Normal " );
echo " <option value=3> " . lang_string ( " Warning " );
break ;
case - 1 :
echo " <option value=-1> " . lang_string ( " All " );
echo " <option value=4> " . lang_string ( " Critical " );
echo " <option value=0> " . lang_string ( " Maintenance " );
echo " <option value=1> " . lang_string ( " Informational " );
echo " <option value=2> " . lang_string ( " Normal " );
echo " <option value=3> " . lang_string ( " Warning " );
break ;
}
if ( $show_all == 1 )
echo " <option value=-1> " . lang_string ( " All " );
echo " </select> " ;
2008-06-13 Sancho Lerena <slerena@gmail.com>
* index.php: Added pure (Fullscreen). HTML code cleanup and user session.
* pandoradb.sql: talert_snmp: Added priority field.
* pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo
and some links.
* header.php: Fixed some user session management.
* logon_ok.php: New design for welcome screen, odometer is over.
* menu.php, godmode/menu.php: Some ACL improvements.
* agent_disk_conf_editor.php: Minor fix in view link.
* configurar_agente.php, agent_manager.php: Added parent combo and better
ACL checks. New remote configuration control for get timestamp info of
config file.
* modify_alert.php: Changes to use new internal Mail alert.
* config.php: Some items moved to config_process. (font, attachment and
default style).
* functions.php: Added form_agent_combo(), form_event_type_combo(),
form_priority() and return_priority() functions.
* functions_db.php: Added smal_event_table() to render a variable table
with latest events (filtered).
* pandora.css. Added pure and priority colors.
* estado_alertas.php: Fixed ACL problems.
* stado_generalagente.php: Graph of modules now represents modules that
has generated events. Old graph is not used anymore. Also display parent.
* estado_grupo.php: Border of boxes is now thicker.
* tactical.php: New screen, almost all code changed. Odometer is not used
anymore, added some new items, like module LAG meter, module sanity, and
other general metrics.
* ver_agente.php: Now renders also event for each agent view. Alert manual
validation generate a new event.
* events.php: New event system. 90% new code. A LOT of new features,
including full screen, coloured (by priority) and filters by six fields.
* snmp_alert.php: Added support for alert priority.
* operation/users/user.php: No longer a user with UM privileges could
see any other user.
* render_view.php: Added fullscreen support for visual maps.
* fgraph.php: Added support for session checking in graphs (at least!).
New graphics for events (some changed it's function like events by group),
and feature added to progress GD implementation.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-13 18:59:54 +02:00
}
function return_priority ( $priority ){
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
global $config ;
switch ( $priority ) {
case 0 :
return lang_string ( " Maintenance " );
case 1 :
return lang_string ( " Informational " );
case 2 :
return lang_string ( " Normal " );
case 3 :
return lang_string ( " Warning " );
case 4 :
return lang_string ( " Critical " );
case - 1 :
return lang_string ( " All " );
}
2008-06-13 Sancho Lerena <slerena@gmail.com>
* index.php: Added pure (Fullscreen). HTML code cleanup and user session.
* pandoradb.sql: talert_snmp: Added priority field.
* pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo
and some links.
* header.php: Fixed some user session management.
* logon_ok.php: New design for welcome screen, odometer is over.
* menu.php, godmode/menu.php: Some ACL improvements.
* agent_disk_conf_editor.php: Minor fix in view link.
* configurar_agente.php, agent_manager.php: Added parent combo and better
ACL checks. New remote configuration control for get timestamp info of
config file.
* modify_alert.php: Changes to use new internal Mail alert.
* config.php: Some items moved to config_process. (font, attachment and
default style).
* functions.php: Added form_agent_combo(), form_event_type_combo(),
form_priority() and return_priority() functions.
* functions_db.php: Added smal_event_table() to render a variable table
with latest events (filtered).
* pandora.css. Added pure and priority colors.
* estado_alertas.php: Fixed ACL problems.
* stado_generalagente.php: Graph of modules now represents modules that
has generated events. Old graph is not used anymore. Also display parent.
* estado_grupo.php: Border of boxes is now thicker.
* tactical.php: New screen, almost all code changed. Odometer is not used
anymore, added some new items, like module LAG meter, module sanity, and
other general metrics.
* ver_agente.php: Now renders also event for each agent view. Alert manual
validation generate a new event.
* events.php: New event system. 90% new code. A LOT of new features,
including full screen, coloured (by priority) and filters by six fields.
* snmp_alert.php: Added support for alert priority.
* operation/users/user.php: No longer a user with UM privileges could
see any other user.
* render_view.php: Added fullscreen support for visual maps.
* fgraph.php: Added support for session checking in graphs (at least!).
New graphics for events (some changed it's function like events by group),
and feature added to progress GD implementation.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-13 18:59:54 +02:00
}
// Show combo with agents
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
function form_agent_combo ( $id_agent = 0 , $form_name = " id_agent " ) {
global $config ;
echo '<select name="' . $form_name . '" style="width:120px">' ;
if ( $id_agent != 0 )
echo " <option value=' " . $id_agent . " '> " . dame_nombre_agente ( $id_agent ) . " </option> " ;
else
echo " <option value='0'> " . lang_string ( " None " ) . " </option> " ;
$sql = 'SELECT * FROM tagente' ;
$result = mysql_query ( $sql );
while ( $row = mysql_fetch_array ( $result )) {
// if (give_acl($config["id_user"], $row["id_grupo"], "AR")==1)
echo " <option value= " . $row [ " id_agente " ] . " > " . $row [ " nombre " ] . " </option> " ;
}
echo " </select> " ;
2008-06-13 Sancho Lerena <slerena@gmail.com>
* index.php: Added pure (Fullscreen). HTML code cleanup and user session.
* pandoradb.sql: talert_snmp: Added priority field.
* pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo
and some links.
* header.php: Fixed some user session management.
* logon_ok.php: New design for welcome screen, odometer is over.
* menu.php, godmode/menu.php: Some ACL improvements.
* agent_disk_conf_editor.php: Minor fix in view link.
* configurar_agente.php, agent_manager.php: Added parent combo and better
ACL checks. New remote configuration control for get timestamp info of
config file.
* modify_alert.php: Changes to use new internal Mail alert.
* config.php: Some items moved to config_process. (font, attachment and
default style).
* functions.php: Added form_agent_combo(), form_event_type_combo(),
form_priority() and return_priority() functions.
* functions_db.php: Added smal_event_table() to render a variable table
with latest events (filtered).
* pandora.css. Added pure and priority colors.
* estado_alertas.php: Fixed ACL problems.
* stado_generalagente.php: Graph of modules now represents modules that
has generated events. Old graph is not used anymore. Also display parent.
* estado_grupo.php: Border of boxes is now thicker.
* tactical.php: New screen, almost all code changed. Odometer is not used
anymore, added some new items, like module LAG meter, module sanity, and
other general metrics.
* ver_agente.php: Now renders also event for each agent view. Alert manual
validation generate a new event.
* events.php: New event system. 90% new code. A LOT of new features,
including full screen, coloured (by priority) and filters by six fields.
* snmp_alert.php: Added support for alert priority.
* operation/users/user.php: No longer a user with UM privileges could
see any other user.
* render_view.php: Added fullscreen support for visual maps.
* fgraph.php: Added support for session checking in graphs (at least!).
New graphics for events (some changed it's function like events by group),
and feature added to progress GD implementation.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-13 18:59:54 +02:00
}
2007-07-28 20:11:48 +02:00
?>