diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c2d7a43084..2014937e1d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,22 @@ +2009-01-08 Evi Vanoost + + * general/footer.php: Made image link relative. It wasn't working for me. + + * include/functions.php, include/functions_exportserver.php, + include/functions_incidents.php, include/functions_visual_map.php, + include/functions_db.php, include/functions_extensions.php, + include/functions_reporting.php, include/functions_events.php, + include/functions_html.php, include/functions_ui.php: + Updated documentation to adhere to PHPDoc and parses without errors + + * include/functions.php: Removed unsafe_string function (magic_quotes) + Made pagination possible to return instead of print + + * include/functions_db.php: Removed give_modulecategory_name + (Module types etc. are now in database). Was unused. + + * reporting/fgraph.php: Removed unsafe_string usage + 2009-01-08 Ramon Novoa * include/functions.php, diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php index 2e8cbcc202..0f657f10a3 100644 --- a/pandora_console/general/footer.php +++ b/pandora_console/general/footer.php @@ -30,5 +30,5 @@ if ((isset($develop_bypass)) AND ($develop_bypass == 1)) { echo ' - Saved '.format_numeric ($sql_cache["saved"]).' Queries'; } echo '
'; -echo ''; +echo ''; ?> diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 00b3e8735f..0df6fd677a 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -22,13 +22,13 @@ require_once ('functions_ui.php'); define ('ENTERPRISE_NOT_HOOK', -1); -/** +/** * Prints a help tip icon. * - * @param id Help id - * @param return Flag to return or output the result + * @param string $help_id Id of the help article + * @param bool $return Whether to return or output the result * - * @return The help tip if return flag was active. + * @return string The help tip */ function pandora_help ($help_id, $return = false) { global $config; @@ -43,9 +43,9 @@ function pandora_help ($help_id, $return = false) { * entities. UTF-8 is necessary for foreign chars like asian * and our databases are (or should be) UTF-8 * - * @param (mixed) String or array of strings to be cleaned. + * @param mixed String or array of strings to be cleaned. * - * @return (mixed) The cleaned string or array. + * @return mixed The cleaned string or array. */ function safe_input ($value) { if (is_numeric ($value)) @@ -60,12 +60,12 @@ function safe_input ($value) { /** * Cleans an object or an array and casts all values as integers * - * @param mixed String or array of strings to be cleaned - * @param min If value is smaller than min it will return false - * @param max if value is larger than max it will return false + * @param mixed $value String or array of strings to be cleaned + * @param int $min If value is smaller than min it will return false + * @param int $max if value is larger than max it will return false * - * @return The cleaned string. If an array was passed, the invalid values would - * be removed + * @return mixed The cleaned string. If an array was passed, the invalid values + * will be removed */ function safe_int ($value, $min = false, $max = false) { if (is_array ($value)) { @@ -89,23 +89,24 @@ function safe_int ($value, $min = false, $max = false) { /** - * Pandora debug functions. - * * It prints a variable value and a message. + * TODO: Expand this to handle mixed variables * - * @param mixed Variable to be displayed + * @param mixed variable to be displayed * @param string Message to be displayed + * + * @return string Variable with message and Pandora DEBUG identifier */ -function pandora_debug ($var, $msg) { +function pandora_debug ($var, $msg = '') { echo "[Pandora DEBUG (".$var."): (".$msg.")
"; } /** - * Clean a string. + * @deprecated Use get_parameter or safe_input functions * * @param string String to be cleaned * - * @return Cleaned given string + * @return string Cleaned string */ function salida_limpia ($string) { $quote_style = ENT_QUOTES; @@ -123,11 +124,12 @@ function salida_limpia ($string) { } /** - * Cleans a string to be shown in a graphic. + * Cleans a string of special characters (|,@,$,%,/,\,=,?,*,&,#) + * Useful for filenames and graphs * * @param string String to be cleaned * - * @return String with special characters cleaned. + * @return string Special characters cleaned. */ function output_clean_strict ($string) { return preg_replace ('/[\|\@\$\%\/\(\)\=\?\*\&\#]/', '', $string); @@ -135,21 +137,22 @@ function output_clean_strict ($string) { /** - * DEPRECATED use safe_input. Keep for compatibility. + * @deprecated use safe_input and get_parameter functions. Keep temporarily for compatibility. */ function entrada_limpia ($string) { return safe_input ($string); } /** - * Performs an extra clean to a string. Makes it usable in an URL + * Performs an extra clean to a string removing all but alphanumerical + * characters _ and / The string is also stripped to 125 characters from after :// + * It's useful on sec and sec2, to avoid the use of malicious parameters. + * + * TODO: Make this multibyte safe (I don't know if there is an attack vector there) * - * It's useful on sec and sec2 index parameters, to avoid the use of - * malicious parameters. The string is also stripped to 125 charactes. + * @param string String to clean * - * @param (string) String to clean - * - * @return (string) Cleaned string + * @return string Cleaned string */ function safe_url_extraclean ($string) { /* Clean "://" from the strings @@ -169,7 +172,12 @@ function safe_url_extraclean ($string) { /** * Add a help link to show help in a popup window. * - * @param help_id Help id to be shown when clicking. + * TODO: Get this merged with the other help function(s) + * + * @param string $help_id Help id to be shown when clicking. + * @param bool $return Whether to print this (false) or return (true) + * + * @return string Link with the popup. */ function popup_help ($help_id, $return = false) { $output = " [H]"; @@ -195,9 +203,11 @@ function no_permission () { } /** - * Prints a generic error message for some unhandled error. + * Prints a generic error message for some unhandled error and exits * - * @param error Aditional error string to be shown. Blank by default + * TODO: Clean this up so it doesn't use table and insert erroneous td + * + * @param string $error Aditional error string to be shown. Blank by default */ function unmanaged_error ($error = "") { require_once ("config.php"); @@ -217,14 +227,14 @@ function unmanaged_error ($error = "") { /** * List files in a directory in the local path. * - * @param directory Local path. - * @param stringSearch String to match the values. - * @param searchHandler Pattern of files to match. - * @param return Flag to print or return the list. + * @param string $directory Local path. + * @param string $stringSearch String to match the values. + * @param string $searchHandler Pattern of files to match. + * @param bool $return Whether to print or return the list. * - * @return The list if $return parameter is true. + * @return string he list of files if $return parameter is true. */ -function list_files ($directory, $stringSearch, $searchHandler, $return) { +function list_files ($directory, $stringSearch, $searchHandler, $return = false) { $errorHandler = false; $result = array (); if (! $directoryHandler = @opendir ($directory)) { @@ -247,26 +257,27 @@ function list_files ($directory, $stringSearch, $searchHandler, $return) { echo ("
\nerror: no filetype \"$fileExtension\" found!\n
\n"); } else { asort ($result); - if ($return == 0) { - return $result; + if ($return === false) { + echo ("
\n");
+			print_r ($result);
+			echo ("
\n"); } - echo ("
\n");
-		print_r ($result);
-		echo ("
\n"); + return $result; } } /** * Prints a pagination menu to browse into a collection of data. * - * @param count Number of elements in the collection. - * @param url URL of the pagination links. It must include all form values as GET form. - * @param offset Current offset for the pagination - * @param pagination Current pagination size. If a user requests a larger pagination than config["block_size"] - * - * @return It returns nothing, it prints the pagination. + * @param int $count Number of elements in the collection. + * @param string $url URL of the pagination links. It must include all form values as GET form. + * @param int $offset Current offset for the pagination + * @param int $pagination Current pagination size. If a user requests a larger pagination than config["block_size"] + * @param bool $return Whether to return or print this + * + * @return string The pagination div or nothing if no pagination needs to be done */ -function pagination ($count, $url, $offset, $pagination = 0) { +function pagination ($count, $url, $offset, $pagination = 0, $return = false) { global $config; if (empty ($pagination)) { @@ -282,7 +293,7 @@ function pagination ($count, $url, $offset, $pagination = 0) { */ $block_limit = 15; // Visualize only $block_limit blocks if ($count <= $pagination) { - return; + return false; } // If exists more registers than I can put in a page, calculate index markers $index_counter = ceil($count/$pagination); // Number of blocks of block_size with data @@ -311,17 +322,17 @@ function pagination ($count, $url, $offset, $pagination = 0) { else $inicio_pag = 0; - echo "
"; + $output = '
'; // Show GOTO FIRST button - echo ' '; + $output .= ' '; // Show PREVIOUS button if ($index_page > 0){ $index_page_prev= ($index_page-(floor($block_limit/2)))*$pagination; if ($index_page_prev < 0) $index_page_prev = 0; - echo ''; + $output .= ''; } - echo " ";echo " "; + $output .= "  "; // Draw blocks markers // $i stores number of page for ($i = $inicio_pag; $i < $index_limit; $i++) { @@ -330,27 +341,27 @@ function pagination ($count, $url, $offset, $pagination = 0) { if ($final_bloque > $count){ // if upper limit is beyond max, this shouldnt be possible ! $final_bloque = ($i-1) * $pagination + $count-(($i-1) * $pagination); } - echo ""; + $output .= ""; $inicio_bloque_fake = $inicio_bloque + 1; // To Calculate last block (doesnt end with round data, // it must be shown if not round to block limit) - echo ''; - if ($inicio_bloque == $offset) - echo "[ $i ]"; - else - echo "[ $i ]"; - echo ' '; - echo ""; + $output .= ''; + if ($inicio_bloque == $offset) { + $output .= "[ $i ]"; + } else { + $output .= "[ $i ]"; + } + $output .= ''; } - echo " ";echo " "; + $output .= "  "; // Show NEXT PAGE (fast forward) // Index_counter stores max of blocks if (($paginacion_maxima == 1) AND (($index_counter - $i) > 0)) { $prox_bloque = ($i + ceil ($block_limit / 2)) * $pagination; if ($prox_bloque > $count) $prox_bloque = ($count -1) - $pagination; - echo ''; + $output .= ''; $i = $index_counter; } // if exists more registers than i can put in a page (defined by $block_size config parameter) @@ -359,10 +370,14 @@ function pagination ($count, $url, $offset, $pagination = 0) { // as painted in last block (last integer block). if (($count - $pagination) > 0){ $myoffset = floor(($count-1) / $pagination) * $pagination; - echo ''; + $output .= ''; } // End div and layout - echo "
"; + $output .= "
"; + if ($return === false) { + echo $output; + } + return $output; } /** @@ -371,10 +386,10 @@ function pagination ($count, $url, $offset, $pagination = 0) { * If the number is zero or it's integer value, no decimals are * shown. Otherwise, the number of decimals are given in the call. * - * @param (float) Number to be rendered - * @param (int) Number of decimals to be shown. Default value: 1 + * @param float $number Number to be rendered + * @param int $decimals numbers after comma to be shown. Default value: 1 * - * @return (string) A formatted number for use in output + * @return string A formatted number for use in output */ function format_numeric ($number, $decimals = 1) { //Translate to float in case there are characters in the string so @@ -396,16 +411,17 @@ function format_numeric ($number, $decimals = 1) { } /** - * Render numeric data for a graph. + * Render numeric data for a graph. It adds magnitude suffix to the number + * (M for millions, K for thousands...) base-10 * - * It adds magnitude suffix to the number (M for millions, K for thousands...) + * TODO: base-2 multiplication * - * @param number Number to be rendered - * @param decimals Number of decimals to display. Default value: 1 + * @param float $number Number to be rendered + * @param int $decimals Numbers after comma. Default value: 1 * @param dec_point Decimal separator character. Default value: . * @param thousands_sep Thousands separator character. Default value: , * - * @return A number rendered to be displayed gently on a graph. + * @return string A string with the number and the multiplier */ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands_sep = ",") { $shorts = array("","K","M","G","T","P"); @@ -421,13 +437,15 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands } /** - * Get a human readable string of the difference between current time - * and given timestamp. + * INTERNAL: Use print_timestamp for output Get a human readable string of + * the difference between current time and given timestamp. * - * @param timestamp Timestamp to compare with current time. + * TODO: Make sense out of all these time functions and stick with 2 or 3 + * + * @param int $timestamp Unixtimestamp to compare with current time. * - * @return A human readable string of the diference between current - * time and given timestamp. + * @return string A human readable string of the diference between current + * time and a given timestamp. */ function human_time_comparation ($timestamp) { global $config; @@ -444,8 +462,8 @@ function human_time_comparation ($timestamp) { /** * This function gets the time from either system or sql based on preference and returns it * - * @return (int) Unix timestamp -**/ + * @return int Unix timestamp + */ function get_system_time () { global $config; @@ -461,12 +479,12 @@ function get_system_time () { } /** - * Transform an amount of time in seconds into a human readable + * INTERNAL (use print_timestamp for output): Transform an amount of time in seconds into a human readable * strings of minutes, hours or days. * - * @param seconds Seconds elapsed time + * @param int $seconds Seconds elapsed time * - * @return A human readable translation of minutes. + * @return string A human readable translation of minutes. */ function human_time_description_raw ($seconds) { if (empty ($seconds)) { @@ -498,24 +516,18 @@ function human_time_description_raw ($seconds) { } /** - * Get a human readable label for a period of time. - * - * It only works with rounded period of times (one hour, two hours, six hours...) - * - * @param period Period of time in seconds - * - * @return A human readable label for a period of time. + * @deprecated Use print_timestamp for output. */ function human_time_description ($period) { return human_time_description_raw ($period); //human_time_description_raw does the same but by calculating instead of a switch } /** - * Get current time minus some seconds. + * @deprecated Get current time minus some seconds. (Do your calculations yourself on unix timestamps) * - * @param seconds Seconds to substract from current time. + * @param int $seconds Seconds to substract from current time. * - * @return The current time minus the seconds given. + * @return int The current time minus the seconds given. */ function human_date_relative ($seconds) { $ahora=date("Y/m/d H:i:s"); @@ -525,7 +537,7 @@ function human_date_relative ($seconds) { } /** - * DEPRECATED: Use print_timestamp instead + * @deprecated Use print_timestamp instead */ function render_time ($lapse) { $myhour = intval (($lapse*30) / 60); @@ -548,10 +560,10 @@ function render_time ($lapse) { * It checks first on post request, if there were nothing defined, it * would return get request * - * @param (string) name of the parameter in the $_POST or $_GET array - * @param (mixed) default value if it wasn't found + * @param string $name key of the parameter in the $_POST or $_GET array + * @param mixed $default default value if the key wasn't found * - * @return (mixed) Whatever was in that parameter, cleaned however + * @return mixed Whatever was in that parameter, cleaned however */ function get_parameter ($name, $default = '') { // POST has precedence @@ -565,12 +577,12 @@ function get_parameter ($name, $default = '') { } /** - * Get a parameter from get request array. + * Get a parameter from a get request. + * + * @param string $name key of the parameter in the $_GET array + * @param mixed $default default value if the key wasn't found * - * @param name Name of the parameter - * @param default Value returned if there were no parameter. - * - * @return Parameter value. + * @return mixed Whatever was in that parameter, cleaned however */ function get_parameter_get ($name, $default = "") { if ((isset ($_GET[$name])) && ($_GET[$name] != "")) @@ -580,12 +592,12 @@ function get_parameter_get ($name, $default = "") { } /** - * Get a parameter from post request array. + * Get a parameter from a post request. + * + * @param string $name key of the parameter in the $_POST array + * @param mixed $default default value if the key wasn't found * - * @param name Name of the parameter - * @param default Value returned if there were no parameter. - * - * @return Parameter value. + * @return mixed Whatever was in that parameter, cleaned however */ function get_parameter_post ($name, $default = "") { if ((isset ($_POST[$name])) && ($_POST[$name] != "")) @@ -597,9 +609,9 @@ function get_parameter_post ($name, $default = "") { /** * Get name of a priority value. * - * @param priority Priority value + * @param int $priority Priority value * - * @return Name of given priority + * @return string Name of given priority */ function get_alert_priority ($priority = 0) { global $config; @@ -626,9 +638,9 @@ function get_alert_priority ($priority = 0) { /** * Gets a translated string of names of days based on the boolean properties of it's input ($row["monday"] = (bool) 1 will output Mon) * - * @param (array) The array of boolean values to check. They should have monday -> sunday in boolean + * @param array $row The array of boolean values to check. They should have monday -> sunday in boolean * - * @return (string) Translated names of days + * @return string Translated names of days */ function get_alert_days ($row) { global $config; @@ -667,9 +679,9 @@ function get_alert_days ($row) { /** * Gets the alert times values and returns them as string * - * @param (array) Array with time_from and time_to in it's keys + * @param array Array with time_from and time_to in it's keys * - * @return (string) A string with the concatenated values + * @return string A string with the concatenated values */ function get_alert_times ($row2) { if ($row2["time_from"]){ @@ -689,14 +701,7 @@ function get_alert_times ($row2) { } /** - * DEPRECATED: This has been replaced with print_table or format_alert_row - * - * @param row2 - * @param tdcolor - * @param id_tipo_modulo - * @param combined - * - * @return (string) HTML code + * @deprecated This should be replaced with print_table and format_alert_row */ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $combined = 0){ global $config; @@ -801,12 +806,12 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c /** * Formats a row from the alert table and returns an array usable in the table function * - * @param (array) $alert A valid (non empty) row from the alert table - * @param (bool) $combined Whether or not this is a combined alert - * @param (bool) $agent Whether to print the agent information with the module information - * @param $section (string) Tab where the function was called from (used for urls) + * @param array $alert A valid (non empty) row from the alert table + * @param bool $combined Whether or not this is a combined alert + * @param bool $agent Whether to print the agent information with the module information + * @param string $section Tab where the function was called from (used for urls) * - * @return (array) A formatted array with proper html for use in $table -> 7 columns + * @return array A formatted array with proper html for use in $table->data (7 columns) */ function format_alert_row ($alert, $combined = 0, $agent = 1, $tab = 'main') { if (empty ($alert)) { @@ -890,7 +895,7 @@ function format_alert_row ($alert, $combined = 0, $agent = 1, $tab = 'main') { /** * Get report types in an array. * - * @return An array with all the possible reports in Pandora where the array index is the report id. + * @return array An array with all the possible reports in Pandora where the array index is the report id. */ function get_report_types () { $types = array (); @@ -914,9 +919,9 @@ function get_report_types () { /** * Get report type name from type id. * - * @param type Type id of the report. + * @param int $type Type id of the report. * - * @return Report type name. + * @return string Report type name. */ function get_report_name ($type) { $types = get_report_types (); @@ -926,11 +931,13 @@ function get_report_name ($type) { } /** - * Get report type name from type id. + * Get report type data source from type id. * - * @param type Type id of the report. + * TODO: Better documentation as to what this function does * - * @return Report type name. + * @param mixed $type Type id or type name of the report. + * + * @return string Report type name. */ function get_report_type_data_source ($type) { switch ($type) { @@ -970,9 +977,9 @@ function get_report_type_data_source ($type) { /** * Checks if a module is of type "data" * - * @param module_name Module name to check. + * @param string $module_name Module name to check. * - * @return true if the module is of type "data" + * @return bool True if the module is of type "data" */ function is_module_data ($module_name) { $result = ereg ("^(.*_data)$", $module_name); @@ -984,9 +991,9 @@ function is_module_data ($module_name) { /** * Checks if a module is of type "proc" * - * @param module_name Module name to check. + * @param string $module_name Module name to check. * - * @return true if the module is of type "proc" + * @return bool true if the module is of type "proc" */ function is_module_proc ($module_name) { $result = ereg ('^(.*_proc)$', $module_name); @@ -998,9 +1005,9 @@ function is_module_proc ($module_name) { /** * Checks if a module is of type "inc" * - * @param module_name Module name to check. + * @param string $module_name Module name to check. * - * @return true if the module is of type "inc" + * @return bool true if the module is of type "inc" */ function is_module_inc ($module_name) { $result = ereg ('^(.*_inc)$', $module_name); @@ -1012,9 +1019,9 @@ function is_module_inc ($module_name) { /** * Checks if a module is of type "string" * - * @param module_name Module name to check. + * @param string $module_name Module name to check. * - * @return true if the module is of type "string" + * @return bool true if the module is of type "string" */ function is_module_data_string ($module_name) { $result = ereg ('^(.*string)$', $module_name); @@ -1024,9 +1031,9 @@ function is_module_data_string ($module_name) { } /** - * Checks if a module is of type "string" + * Get all event types in an array * - * @return module_name Module name to check. + * @return array module_name Module name to check. */ function get_event_types () { $types = array (); @@ -1047,7 +1054,7 @@ function get_event_types () { /** * Get an array with all the priorities. * - * @return An array with all the priorities. + * @return array An array with all the priorities. */ function get_priorities () { $priorities = array (); @@ -1063,9 +1070,9 @@ function get_priorities () { /** * Get priority name from priority value. * - * @param priority value (integer) as stored eg. in database. + * @param int $priority value (integer) as stored eg. in database. * - * @return priority string. + * @return string priority string. */ function get_priority_name ($priority) { switch ($priority) { @@ -1087,9 +1094,9 @@ function get_priority_name ($priority) { /** * Get priority class (CSS class) from priority value. * - * @param priority value (integer) as stored eg. in database. + * @param int priority value (integer) as stored eg. in database. * - * @return priority class. + * @return string CSS priority class. */ function get_priority_class ($priority) { switch ($priority) { @@ -1108,24 +1115,9 @@ function get_priority_class ($priority) { } } - /** - * Avoid magic_quotes protection - * Deprecated by get_parameter functions and safe_input funcitons - * Magic Quotes are deprecated in PHP5 and will be removed in PHP6 - * @param string Text string to be stripped of magic_quotes protection + * TODO: Document enterprise functions */ - -function unsafe_string ($string) { - if (get_magic_quotes_gpc () == 1) - $string = stripslashes ($string); - return $string; -} - -/** - * enterprise functions - */ - function enterprise_hook ($function_name, $parameters = false) { if (function_exists ($function_name)) { if (!is_array ($parameters)) @@ -1135,6 +1127,9 @@ function enterprise_hook ($function_name, $parameters = false) { return ENTERPRISE_NOT_HOOK; } +/** + * TODO: Document enterprise functions + */ function enterprise_include ($filename) { global $config; // Load enterprise extensions @@ -1148,22 +1143,36 @@ function enterprise_include ($filename) { return ENTERPRISE_NOT_HOOK; } + +//These are wrapper functions for PHP. Don't document them if (!function_exists ("mb_strtoupper")) { //Multibyte not loaded - use wrapper functions //You should really load multibyte especially for foreign charsets + /** + * @ignore + */ function mb_strtoupper ($string, $encoding = false) { - return strtoupper ($string); - } - + return strtoupper ($string); + } + + /** + * @ignore + */ function mb_strtolower ($string, $encoding = false) { - return strtoupper ($string); + return strtoupper ($string); } + /** + * @ignore + */ function mb_substr ($string, $start, $length, $encoding = false) { return substr ($string, $start, $length); } + /** + * @ignore + */ function mb_strlen ($string, $encoding = false) { return strlen ($string); } diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 9cf0ff53b1..87b7e1088d 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -22,7 +22,7 @@ * * It will stop the execution if those variables were not set * - * @return 0 on success + * @return bool 0 on success exit() on no success */ function check_login () { @@ -58,12 +58,12 @@ function check_login () { * LM - Alert Management * PM - Pandora Management * - * @param id_user User id - * @param id_group Agents group id - * @param access Access privilege + * @param int $id_user User id + * @param int $id_group Agents group id + * @param string $access Access privilege * - * @return 1 if the user has privileges, 0 if not. -**/ + * @return bool 1 if the user has privileges, 0 if not. + */ function give_acl ($id_user, $id_group, $access) { // IF user is level = 1 then always return 1 @@ -132,10 +132,10 @@ AND tusuario_perfil.id_usuario = '%s' AND (tusuario_perfil.id_grupo = %d OR tusu /** * Adds an audit log entry. * - * @param id User id - * @param ip Client IP - * @param accion Action description - * @param descripcion Long action description + * @param string $id User id + * @param string $ip Client IP + * @param string $accion Action description + * @param string $descripcion Long action description */ function audit_db ($id, $ip, $accion, $descripcion){ $accion = safe_input($accion); @@ -147,8 +147,8 @@ function audit_db ($id, $ip, $accion, $descripcion){ /** * Log in a user into Pandora. * - * @param id_user User id - * @param ip Client user IP address. + * @param string $id_user User id + * @param string $ip Client user IP address. */ function logon_db ($id_user, $ip) { audit_db ($id_user, $ip, "Logon", "Logged in"); @@ -160,8 +160,8 @@ function logon_db ($id_user, $ip) { /** * Log out a user into Pandora. * - * @param id_user User id - * @param ip Client user IP address. + * @param string $id_user User id + * @param string $ip Client user IP address. */ function logoff_db ($id_user, $ip) { audit_db ($id_user, $ip, "Logoff", "Logged out"); @@ -170,9 +170,9 @@ function logoff_db ($id_user, $ip) { /** * Get profile name from id. * - * @param id_profile Id profile in tperfil + * @param int $id_profile Id profile in tperfil * - * @return Profile name of the given id + * @return string Profile name of the given id */ function dame_perfil ($id_profile) { return (string) get_db_value ('name', 'tperfil', 'id_perfil', (int) $id_profile); @@ -181,9 +181,9 @@ function dame_perfil ($id_profile) { /** * Get disabled field of a group * - * @param id_group Group id + * @param int id_group Group id * - * @return Disabled field of given group + * @return bool Disabled field of given group */ function give_disabled_group ($id_group) { return (bool) get_db_value ('disabled', 'tgrupo', 'id_grupo', (int) $id_group); @@ -192,13 +192,13 @@ function give_disabled_group ($id_group) { /** * Get all the agents within a group(s). * - * @param id_group Group id or an array of ID's + * @param mixed $id_group Group id or an array of ID's * - * @param disabled Add disabled agents to agents. Default: False. + * @param bool $disabled Add disabled agents to agents. Default: False. * - * @param case Which case to return the agentname as (lower, upper, none) + * @param string $case Which case to return the agentname as (lower, upper, none) * - * @return An array with all agents in the group or an empty array + * @return array An array with all agents in the group or an empty array */ function get_group_agents ($id_group, $disabled = false, $case = "lower") { $id_group = (array) safe_int ($id_group, 1); @@ -246,10 +246,10 @@ function get_group_agents ($id_group, $disabled = false, $case = "lower") { /** * Get all the modules in an agent. * - * @param $id_agent Agent id - * @param $details Array, comma delimited list or singular value of rows to select. If nothing is specified, nombre will be selected + * @param int $id_agent Agent id + * @param mixed $details Array, comma delimited list or singular value of rows to select. If nothing is specified, nombre will be selected * - * @return An array with all modules in the agent. If multiple rows are selected, they will be in an array + * @return array An array with all modules in the agent. If multiple rows are selected, they will be in an array */ function get_agent_modules ($id_agent, $details = false) { $id_agent = safe_int ($id_agent, 1); @@ -289,11 +289,10 @@ function get_agent_modules ($id_agent, $details = false) { /** * Get all the simple alerts of an agent. * - * @param $id_agent Agent id - * @param $filter Filter on "fired", "notfired" or "disabled" - * @param $limit Limit the return to a certain number - * @param $offset Offset to start the limit from - * @return An array with all simple alerts defined for an agent. + * @param int $id_agent Agent id + * @param string $filter Filter on "fired", "notfired" or "disabled" + * + * @return array An array with all simple alerts defined for an agent. */ function get_agent_alerts_simple ($id_agent, $filter = false) { switch ($filter) { @@ -320,9 +319,9 @@ function get_agent_alerts_simple ($id_agent, $filter = false) { /** * Get all the combined alerts of an agent. * - * @param $id_agent Agent id + * @param int $id_agent Agent id * - * @return An array with all combined alerts defined for an agent. + * @return array An array with all combined alerts defined for an agent. */ function get_agent_alerts_combined ($id_agent, $filter = false) { switch ($filter) { @@ -349,9 +348,9 @@ function get_agent_alerts_combined ($id_agent, $filter = false) { /** * Get all the alerts of an agent, simple and combined. * - * @param $id_agent Agent id + * @param int $id_agent Agent id * - * @return An array with all alerts defined for an agent. + * @return array An array with all alerts defined for an agent. */ function get_agent_alerts ($id_agent, $filter = false) { $simple_alerts = get_agent_alerts_simple ($id_agent, $filter); @@ -368,9 +367,9 @@ function get_agent_alerts ($id_agent, $filter = false) { * - The report is not private and the user has reading privileges on * the group associated to the report * - * @param $id_user User id + * @param string $id_user User id * - * @return An array with all the reports the user can view. + * @return array An array with all the reports the user can view. */ function get_reports ($id_user) { $user_reports = array (); @@ -393,9 +392,9 @@ function get_reports ($id_user) { /** * Get group icon from group. * - * @param id_group Id group to get the icon + * @param int id_group Id group to get the icon * - * @return Icon path of the given group + * @return string Icon path of the given group */ function dame_grupo_icono ($id_group) { return (string) get_db_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group); @@ -404,9 +403,9 @@ function dame_grupo_icono ($id_group) { /** * Get agent id from an agent name. * - * @param agent_name Agent name to get its id. + * @param string $agent_name Agent name to get its id. * - * @return Id from the agent of the given name. + * @return int Id from the agent of the given name. */ function dame_agente_id ($agent_name) { return (int) get_db_value ('id_agente', 'tagente', 'nombre', $agent_name); @@ -415,10 +414,10 @@ function dame_agente_id ($agent_name) { /** * Get name of an agent. * - * @param id_agent Agent id. - * @param case Case (upper, lower, none) + * @param int $id_agent Agent id. + * @param string $case Case (upper, lower, none) * - * @return Name of the given agent. + * @return string Name of the given agent. */ function get_agent_name ($id_agent, $case = "upper") { $agent = (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agent); @@ -435,22 +434,22 @@ function get_agent_name ($id_agent, $case = "upper") { } /** - * Get password of an user. + * Get MD5 encrypted password of a user. * - * @param id_usuario User id. + * @param string id_usuario User id. * - * @return Password of an user. + * @return string Password of a user (should be compared to MD5 string) */ function get_user_password ($id_user) { return (string) get_db_value ('password', 'tusuario', 'id_usuario', $id_user); } /** - * Get type of an alert (e-mail, text, internal, ...) + * Get type name for alerts (e-mail, text, internal, ...) based on type number * - * @param id_alert Alert type id. + * @param int id_alert Alert type id. * - * @return Type name of the alert. + * @return string Type name of the alert. */ function get_alert_type ($id_type) { return (string) get_db_value ('nombre', 'talerta', 'id_alerta', (int) $id_type); @@ -459,9 +458,9 @@ function get_alert_type ($id_type) { /** * Get name of a module group. * - * @param id_module_group Module group id. + * @param int $id_module_group Module group id. * - * @return Name of the given module group. + * @return string Name of the given module group. */ function dame_nombre_grupomodulo ($id_module_group) { return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $id_module_group); @@ -470,9 +469,9 @@ function dame_nombre_grupomodulo ($id_module_group) { /** * Get the name of an exporting server * - * @param id_server Server id + * @param int $id_server Server id * - * @return The name of given server. + * @return string The name of given server. */ function dame_nombre_servidorexportacion ($id_server) { return (string) get_db_value ('name', 'tserver_export', 'id', (int) $id_server); @@ -481,9 +480,9 @@ function dame_nombre_servidorexportacion ($id_server) { /** * Get the name of a plugin * - * @param id_plugin Plugin id. + * @param int id_plugin Plugin id. * - * @return The name of the given plugin + * @return string The name of the given plugin */ function dame_nombre_pluginid ($id_plugin) { return (string) get_db_value ('name', 'tplugin', 'id', (int) $id_plugin); @@ -492,9 +491,9 @@ function dame_nombre_pluginid ($id_plugin) { /** * Get the name of a module type * - * @param id_type Type id + * @param int $id_type Type id * - * @return The name of the given type. + * @return string The name of the given type. */ function giveme_module_type ($id_type) { return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type); @@ -503,9 +502,9 @@ function giveme_module_type ($id_type) { /** * Get agent id of an agent module. * - * @param (int) id_agentmodule Agent module id. + * @param int $id_agentmodule Agent module id. * - * @return (int) The id of the agent of given agent module + * @return int The id of the agent of given agent module */ function get_agentmodule_agent ($id_agentmodule) { return (int) get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); @@ -514,9 +513,9 @@ function get_agentmodule_agent ($id_agentmodule) { /** * Get agent name of an agent module. * - * @param id_agente_modulo Agent module id. + * @param int $id_agente_modulo Agent module id. * - * @return The name of the given agent module. + * @return string The name of the given agent module. */ function get_agentmodule_agent_name ($id_agentmodule) { return (string) get_agent_name (get_agentmodule_agent ($id_agentmodule)); //since this is a helper function we don't need to do casting @@ -525,9 +524,9 @@ function get_agentmodule_agent_name ($id_agentmodule) { /** * Get the module name of an agent module. * - * @param id_agente_modulo Agent module id. + * @param int $id_agente_modulo Agent module id. * - * @return Name of the given agent module. + * @return string Name of the given agent module. */ function get_agentmodule_name ($id_agente_modulo) { return (string) get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); @@ -536,9 +535,9 @@ function get_agentmodule_name ($id_agente_modulo) { /** * Get the module type of an agent module. * - * @param id_agente_modulo Agent module id. + * @param int $id_agentmodule Agent module id. * - * @return Module type of the given agent module. + * @return string Module type of the given agent module. */ function get_agentmodule_type ($id_agentmodule) { return (int) get_db_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); @@ -547,9 +546,9 @@ function get_agentmodule_type ($id_agentmodule) { /** * Get the real name of an user. * - * @param id_user User id + * @param string $id_user User id * - * @return Real name of given user. + * @return string Real name of given user. */ function dame_nombre_real ($id_user) { return (string) get_db_value ('nombre_real', 'tusuario', 'id_usuario', $id_user); @@ -558,11 +557,11 @@ function dame_nombre_real ($id_user) { /** * Get all the times a monitor went down during a period. * - * @param $id_agent_module Agent module of the monitor. - * @param $period Period timed to check from date - * @param $date Date to check (now by default) + * @param int $id_agent_module Agent module of the monitor. + * @param int $period Period timed to check from date + * @param int $date Date to check (now by default) * - * @return The number of times a monitor went down. + * @return int The number of times a monitor went down. */ function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) { if ($date == 0) { @@ -582,11 +581,11 @@ function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) { /** * Get the last time a monitor went down during a period. * - * @param $id_agent_module Agent module of the monitor. - * @param $period Period timed to check from date - * @param $date Date to check (now by default) + * @param int $id_agent_module Agent module of the monitor. + * @param int $period Period timed to check from date + * @param int $date Date to check (now by default) * - * @return The last time a monitor went down. + * @return int The last time a monitor went down. */ function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $date = 0) { if ($date == 0) { @@ -606,9 +605,9 @@ function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $ /** * Get all the monitors defined in an group. * - * @param id_group Group id to get all the monitors. + * @param int $id_group Group id to get all the monitors. * - * @return An array with all the monitors defined in the group (tagente_modulo). + * @return array An array with all the monitors defined in the group (tagente_modulo). */ function get_monitors_in_group ($id_group) { if ($id_group <= 1) { @@ -634,11 +633,11 @@ function get_monitors_in_group ($id_group) { * * The returned events will be in the time interval ($date - $period, $date] * - * @param id_group Group id to get events. - * @param period Period of time in seconds to get events. - * @param date Beginning date to get events. + * @param int $id_group Group id to get events. + * @param int $period Period of time in seconds to get events. + * @param int $date Beginning date to get events. * - * @return An array with all the events happened. + * @return array An array with all the events happened. */ function get_group_events ($id_group, $period, $date) { $datelimit = $date - $period; @@ -662,9 +661,9 @@ function get_group_events ($id_group, $period, $date) { /** * Get all the monitors defined in an agent. * - * @param id_agent Agent id to get all the monitors. + * @param int $id_agent Agent id to get all the monitors. * - * @return An array with all the monitors defined (tagente_modulo). + * @return array An array with all the monitors defined (tagente_modulo). */ function get_monitors_in_agent ($id_agent) { $sql = sprintf ("SELECT `tagente_modulo`.* @@ -679,12 +678,12 @@ function get_monitors_in_agent ($id_agent) { /** * Get all the monitors down during a period of time. * - * @param monitors An array with all the monitors to check. Each + * @param array $monitors An array with all the monitors to check. Each * element of the array must be a dictionary. - * @param period Period of time to check the monitors. - * @param date Beginning date to check the monitors. + * @param int $period Period of time to check the monitors. + * @param int $date Beginning date to check the monitors. * - * @return An array with all the monitors that went down in that + * @return array An array with all the monitors that went down in that * period of time. */ function get_monitors_down ($monitors, $period = 0, $date = 0) { @@ -703,11 +702,11 @@ function get_monitors_down ($monitors, $period = 0, $date = 0) { /** * Get all the times an alerts fired during a period. * - * @param $id_agent_module Agent module of the alert. - * @param $period Period timed to check from date - * @param $date Date to check (now by default) + * @param int $id_agent_module Agent module of the alert. + * @param int $period Period timed to check from date + * @param int $date Date to check (now by default) * - * @return The number of times an alert fired. + * @return int The number of times an alert fired. */ function get_alert_fires_in_period ($id_agent_module, $period, $date = 0) { if (!$date) @@ -727,9 +726,9 @@ function get_alert_fires_in_period ($id_agent_module, $period, $date = 0) { * * It gets all the alerts of all the agents on a given group. * - * @param id_group Group id to check. + * @param int $id_group Group id to check. * - * @return An array with alerts dictionaries defined in a group. + * @return array An array with alerts dictionaries defined in a group. */ function get_group_alerts ($id_group) { $alerts = array (); @@ -746,11 +745,11 @@ function get_group_alerts ($id_group) { /** * Get all the alerts fired during a period, given a list of alerts. * - * @param alerts A list of alerts to check. See get_alerts_in_group() - * @param period Period of time to check fired alerts. - * @param date Beginning date to check fired alerts in UNIX format (current date by default) + * @param array $alerts A list of alerts to check. See get_alerts_in_group() + * @param int $period Period of time to check fired alerts. + * @param int $date Beginning date to check fired alerts in UNIX format (current date by default) * - * @return An array with the alert id as key and the number of times + * @return array An array with the alert id as key and the number of times * the alert was fired (only included if it was fired). */ function get_alerts_fired ($alerts, $period = 0, $date = 0) { @@ -773,11 +772,11 @@ function get_alerts_fired ($alerts, $period = 0, $date = 0) { /** * Get the last time an alert fired during a period. * - * @param $id_agent_module Agent module of the monitor. - * @param $period Period timed to check from date - * @param $date Date to check (now by default) + * @param int $id_agent_module Agent module of the monitor. + * @param int $period Period timed to check from date + * @param int $date Date to check (now by default) * - * @return The last time an alert fired. + * @return int The last time an alert fired. */ function get_alert_last_fire_timestamp_in_period ($id_agent_module, $period, $date = 0) { if ($date == 0) { @@ -796,9 +795,9 @@ function get_alert_last_fire_timestamp_in_period ($id_agent_module, $period, $da /** * Get the server name. * - * @param id_server Server id. + * @param int $id_server Server id. * - * @return Name of the given server + * @return string Name of the given server */ function get_server_name ($id_server) { return (string) get_db_value ('name', 'tserver', 'id_server', (int) $id_server); @@ -807,16 +806,16 @@ function get_server_name ($id_server) { /** * Get the module type name (type = generic_data, remote_snmp, ...) * - * @param id_type Type id + * @param int $id_type Type id * - * @return Name of the given type. + * @return string Name of the given type. */ function get_moduletype_name ($id_type) { return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type); } /** - * DEPRECATED: USE get_agent_group ($id) now (fully compatible) + * @deprecated Use get_agent_group ($id) now (fully compatible) */ function dame_id_grupo ($id_agent) { return get_agent_group ($id_agent); @@ -825,9 +824,9 @@ function dame_id_grupo ($id_agent) { /** * Get the number of pandora data in the database. * - * @param (int) $id_agent Agent id or 0 for all + * @param int $id_agent Agent id or 0 for all * - * @return (int) The number of data in the database + * @return int The number of data in the database */ function dame_numero_datos ($id_agent = 0) { if ($id_agent < 1) { @@ -845,9 +844,9 @@ function dame_numero_datos ($id_agent = 0) { /** * Get the data value of a agent module of string type. * - * @param id Agent module string id + * @param int $id Agent module string id * - * @return Data value of the agent module. + * @return string Data value of the agent module. */ function dame_generic_string_data ($id) { return (string) get_db_value ('datos', 'tagente_datos_string', 'id_tagente_datos_string', $id); @@ -856,9 +855,9 @@ function dame_generic_string_data ($id) { /** * Get the operating system name. * - * @param id_os Operating system id. + * @param int id_os Operating system id. * - * @return Name of the given operating system. + * @return string Name of the given operating system. */ function get_os_name ($id_os) { return (string) get_db_value ('name', 'tconfig_os', 'id_os', (int) $id_os); @@ -867,7 +866,7 @@ function get_os_name ($id_os) { /** * Update user last login timestamp. * - * @param id_user User id + * @param string $id_user User id */ function update_user_contact ($id_user) { global $config; @@ -879,9 +878,9 @@ function update_user_contact ($id_user) { /** * Get the user email * - * @param id_user User id. + * @param string $id_user User id. * - * @return Get the email address of an user + * @return string Get the email address of an user */ function dame_email ($id_user) { return (string) get_db_value ('direccion', 'tusuario', 'id_usuario', $id_user); @@ -890,9 +889,9 @@ function dame_email ($id_user) { /** * Checks if a user is administrator. * - * @param id_user User id. + * @param string $id_user User id. * - * @return True is the user is admin + * @return bool True is the user is admin */ function dame_admin ($id_user) { $level = get_db_value ('nivel', 'tusuario', 'id_usuario', $id_user); @@ -904,18 +903,18 @@ function dame_admin ($id_user) { } /** - * WARNING: This is a deprectad function and must not be used + * @deprecated Use check_login () instead */ -function comprueba_login() { +function comprueba_login () { return check_login (); } /** * Check if an agent has alerts fired. * - * @param id_agent Agent id. + * @param int $id_agent Agent id. * - * @return True if the agent has fired alerts. + * @return bool True if the agent has fired alerts. */ function check_alert_fired ($id_agent) { $sql = "SELECT COUNT(*) FROM talerta_agente_modulo, tagente_modulo @@ -931,9 +930,9 @@ function check_alert_fired ($id_agent) { /** * Check is a user exists in the system * - * @param id_user User id. + * @param string $id_user User id. * - * @return True if the user exists. + * @return bool True if the user exists. */ function existe ($id_user) { $user = get_db_row ('tusuario', 'id_usuario', $id_user); @@ -947,9 +946,9 @@ function existe ($id_user) { * * If the module interval is not set, the agent interval is returned * - * @param (int) $id_agent_module Id agent module to get the interval value. + * @param int $id_agent_module Id agent module to get the interval value. * - * @return (int) Module interval or agent interval if no module interval + * @return int Module interval or agent interval if no module interval */ function get_module_interval ($id_agent_module) { $interval = (int) get_db_value ('module_interval', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module); @@ -963,9 +962,9 @@ function get_module_interval ($id_agent_module) { /** * Get the interval of an agent. * - * @param id_agent Agent id. + * @param int $id_agent Agent id. * - * @return The interval value of a given agent + * @return int The interval value of a given agent */ function get_agent_interval ($id_agent) { return (int) get_db_value ('intervalo', 'tagente', 'id_agente', $id_agent); @@ -974,9 +973,9 @@ function get_agent_interval ($id_agent) { /** * Get the flag value of an agent module. * - * @param id_agent_module Agent module id. + * @param int $id_agent_module Agent module id. * - * @return The flag value of an agent module. + * @return bool The flag value of an agent module. */ function give_agentmodule_flag ($id_agent_module) { return get_db_value ('flag', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); @@ -986,13 +985,13 @@ function give_agentmodule_flag ($id_agent_module) { * Prints a list of HTML tags with the groups the user has * reading privileges. * - * DEPRECATED: Use get_user_groups () in combination with print_select () + * @deprecated Use get_user_groups () in combination with print_select () * instead * - * @param id_user User id - * @param show_all Flag to show all the groups or not. True by default. + * @param string $id_user User id + * @param bool $show_all Flag to show all the groups or not. True by default. * - * @return An array with all the groups + * @return array An array with all the groups */ function list_group ($id_user, $show_all = 1){ $mis_grupos = array (); // Define array mis_grupos to put here all groups with Agent Read permission @@ -1011,13 +1010,13 @@ function list_group ($id_user, $show_all = 1){ } /** - * Get a list of the groups a user has reading privileges. + * Get a list of the groups a user has reading privileges to. * - * DEPRECATED: Use get_user_groups () instead + * @deprecated Use get_user_groups () instead * - * @param id_user User id + * @param int $id_user User id * - * @return A list of the groups the user has reading privileges. + * @return array A list of the groupid => groups the user has reading privileges. */ function list_group2 ($id_user) { $mis_grupos = array (); // Define array mis_grupos to put here all groups with Agent Read permission @@ -1036,9 +1035,9 @@ function list_group2 ($id_user) { /** * Get a list of all users in an array [username] => real name * - * @param order by (id_usuario, nombre_real or fecha_registro) + * @param string $order by (id_usuario, nombre_real or fecha_registro) * - * @return An array of users + * @return array An array of users */ function list_users ($order = "nombre_real") { switch ($order) { @@ -1065,9 +1064,9 @@ function list_users ($order = "nombre_real") { /** * Get all the groups a user has reading privileges. * - * @param id_user User id - * @param privilege The privilege to evaluate - * @return A list of the groups the user has certain privileges. + * @param string $id_user User id + * @param string $privilege The privilege to evaluate + * @return array A list of the groups the user has certain privileges. */ function get_user_groups ($id_user = 0, $privilege = "AR") { if ($id_user == 0) { @@ -1093,12 +1092,12 @@ function get_user_groups ($id_user = 0, $privilege = "AR") { /** * Get module type icon. * - * The path of the icons is 'images/', which must be append by the - * caller (including final slash). + * TODO: Create print_moduletype_icon and print the full tag including hover etc. + * @deprecated Use print_moduletype_icon instead * - * @param id_tipo Module type id + * @param int $id_type Module type id * - * @return Icon filename of the given group + * @return string Icon filename of the given group */ function show_icon_type ($id_type) { return (string) get_db_value ('icon', 'ttipo_modulo', 'id_tipo', $id_type); @@ -1106,8 +1105,12 @@ function show_icon_type ($id_type) { /** * Return a string containing image tag for a given target id (server) + * TODO: Make this print_servertype_icon and move to functions_ui.php. Make XHTML compatible. Make string translatable + * + * @deprecated Use print_servertype_icon instead + * + * @param int $id Server type id * - * @param int Server type id * @return string Fully formatted IMG HTML tag with icon */ function show_server_type ($id){ @@ -1132,37 +1135,12 @@ function show_server_type ($id){ } } -/** - * Get a module category name - * - * @param id_category Id category - * - * @return Name of the given category - */ -function give_modulecategory_name ($id_category) { - switch ($id_category) { - case 0: - return __('Software agent data'); - break; - case 1: - return __('Software agent monitor'); - break; - case 2: - return __('Network agent data'); - break; - case 3: - return __('Network agent monitor'); - break; - } - return __('Unknown'); -} - /** * Get a network component group name * - * @param id_network_component_group Id network component group. + * @param int $id_network_component_group Id network component group. * - * @return Name of the given network component group + * @return string Name of the given network component group */ function give_network_component_group_name ($id_network_component_group) { return (string) get_db_value ('name', 'tnetwork_component_group', 'id_sg', $id_network_component_group); @@ -1171,9 +1149,9 @@ function give_network_component_group_name ($id_network_component_group) { /** * Get a network profile name. * - * @param id_network_profile Id network profile + * @param int $id_network_profile Id network profile * - * @return Name of the given network profile. + * @return string Name of the given network profile. */ function get_networkprofile_name ($id_network_profile) { return (string) get_db_value ('name', 'tnetwork_profile', 'id_np', $id_network_profile); @@ -1182,8 +1160,8 @@ function get_networkprofile_name ($id_network_profile) { /** * Assign an IP address to an agent. * - * @param id_agent Agent id - * @param ip_address IP address to assign + * @param int id_agent Agent id + * @param string ip_address IP address to assign */ function agent_add_address ($id_agent, $ip_address) { // Check if already is attached to agent @@ -1213,8 +1191,8 @@ function agent_add_address ($id_agent, $ip_address) { /** * Unassign an IP address from an agent. * - * @param id_agent Agent id - * @param ip_address IP address to unassign + * @param int $id_agent Agent id + * @param string $ip_address IP address to unassign */ function agent_delete_address ($id_agent, $ip_address) { $sql = sprintf ("SELECT id_ag FROM taddress_agent, taddress @@ -1237,9 +1215,9 @@ function agent_delete_address ($id_agent, $ip_address) { /** * Get address of an agent. * - * @param id_agent Agent id + * @param int $id_agent Agent id * - * @return The address of the given agent + * @return string The address of the given agent */ function get_agent_address ($id_agent) { return (string) get_db_value ('direccion', 'tagente', 'id_agente', (int) $id_agent); @@ -1248,9 +1226,9 @@ function get_agent_address ($id_agent) { /** * Get the agent that matches an IP address * - * @param $ip_address IP address to get the agents. + * @param string $ip_address IP address to get the agents. * - * @return The agent that has the IP address given. False if none were found. + * @return mixed The agent that has the IP address given. False if none were found. */ function get_agent_with_ip ($ip_address) { $sql = sprintf ('SELECT tagente.* @@ -1264,9 +1242,9 @@ function get_agent_with_ip ($ip_address) { /** * Get all IP addresses of an agent * - * @param id_agent Agent id + * @param int $id_agent Agent id * - * @return Array with the IP address of the given agent or an empty array. + * @return array Array with the IP address of the given agent or an empty array. */ function get_agent_addresses ($id_agent) { $sql = sprintf ("SELECT ip FROM taddress_agent, taddress @@ -1290,9 +1268,9 @@ function get_agent_addresses ($id_agent) { /** * Get agent id from an agent module. * - * @param id_agent_module Id of the agent module. + * @param int id_agent_module Id of the agent module. * - * @return The agent if of the given module. + * @return int The agent if of the given module. */ function give_agent_id_from_module_id ($id_agent_module) { return (int) get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); @@ -1303,12 +1281,12 @@ $sql_cache = array ('saved' => 0); /** * Get the first value of the first row of a table in the database. * - * @param field Field name to get - * @param table Table to retrieve the data - * @param field_search Field to filter elements - * @param condition Condition the field must have + * @param string $field Field name to get + * @param string $table Table to retrieve the data + * @param string $field_search Field to filter elements + * @param string $condition Condition the field must have * - * @return Value of first column of the first row. False if there were no row. + * @return mixed Value of first column of the first row. False if there were no row. */ function get_db_value ($field, $table, $field_search = 1, $condition = 1) { if (is_int ($condition)) { @@ -1332,9 +1310,9 @@ function get_db_value ($field, $table, $field_search = 1, $condition = 1) { /** * Get the first row of an SQL database query. * - * @param sql SQL select statement to execute. + * @param string $sql SQL select statement to execute. * - * @return The first row of the result or something empty. + * @return mixed The first row of the result or false */ function get_db_row_sql ($sql) { $sql .= " LIMIT 1"; @@ -1352,11 +1330,11 @@ function get_db_row_sql ($sql) { * The SQL statement executed would be something like: * "SELECT * FROM $table WHERE $field_search = $condition" * - * @param table Table to get the row - * @param field_search Field to filter elementes - * @param condition Condition the field must have. + * @param string $table Table to get the row + * @param string $field_search Field to filter elementes + * @param string $condition Condition the field must have. * - * @return The first row of a database query. + * @return mixed The first row of a database query or false. */ function get_db_row ($table, $field_search, $condition) { @@ -1378,10 +1356,10 @@ function get_db_row ($table, $field_search, $condition) { /** * Get a single field in the databse from a SQL query. * - * @param sql SQL statement to execute - * @param field Field number to get, beggining by 0. Default: 0 + * @param string $sql SQL statement to execute + * @param mixed $field Field number or row to get, beggining by 0. Default: 0 * - * @return The selected field of the first row in a select statement. + * @return mixed The selected field of the first row in a select statement. */ function get_db_sql ($sql, $field = 0) { $result = get_db_all_rows_sql ($sql); @@ -1394,9 +1372,9 @@ function get_db_sql ($sql, $field = 0) { /** * Get all the result rows using an SQL statement. * - * @param $sql SQL statement to execute. + * @param string $sql SQL statement to execute. * - * @return A matrix with all the values returned from the SQL statement or + * @return mixed A matrix with all the values returned from the SQL statement or * false in case of empty result */ function get_db_all_rows_sql ($sql) { @@ -1411,8 +1389,10 @@ function get_db_all_rows_sql ($sql) { /** * Error handler function when an SQL error is triggered. * - * @param $errno Level of the error raised (not used, but required by set_error_handler()). - * @param $errstr Contains the error message. + * @param int $errno Level of the error raised (not used, but required by set_error_handler()). + * @param string $errstr Contains the error message. + * + * @return bool */ function sql_error_handler ($errno, $errstr) { if (error_reporting () <= $errno) @@ -1427,14 +1407,14 @@ function sql_error_handler ($errno, $errstr) { * an empty array in case of SELECT without results * Queries that return data will be cached so queries don't get repeated * - * @param $sql SQL statement to execute + * @param string $sql SQL statement to execute * - * @param $rettype (optional) What type of info to return in case of INSERT/UPDATE. + * @param string $rettype (optional) What type of info to return in case of INSERT/UPDATE. * 'affected_rows' will return mysql_affected_rows (default value) * 'insert_id' will return the ID of an autoincrement value * 'info' will return the full (debug) information of a query * - * @return An array with the rows, columns and values in a multidimensional array + * @return mixed An array with the rows, columns and values in a multidimensional array or false in error */ function process_sql ($sql, $rettype = "affected_rows") { global $config; @@ -1482,10 +1462,10 @@ function process_sql ($sql, $rettype = "affected_rows") { /** * Get all the rows in a table of the database. * - * @param $table Database table name. - * @param $order_field Field to order by. + * @param string $table Database table name. + * @param string $order_field Field to order by. * - * @return A matrix with all the values in the table + * @return mixed A matrix with all the values in the table */ function get_db_all_rows_in_table ($table, $order_field = "") { if ($order_field != "") { @@ -1498,12 +1478,12 @@ function get_db_all_rows_in_table ($table, $order_field = "") { /** * Get all the rows in a table of the databes filtering from a field. * - * @param $table Database table name. - * @param $field Field of the table. - * @param $condition Condition the field must have to be selected. - * @param $order_field Field to order by. + * @param string $table Database table name. + * @param string $field Field of the table. + * @param string $condition Condition the field must have to be selected. + * @param string $order_field Field to order by. * - * @return A matrix with all the values in the table that matches the condition in the field + * @return mixed A matrix with all the values in the table that matches the condition in the field or false */ function get_db_all_rows_field_filter ($table, $field, $condition, $order_field = "") { if (is_int ($condition)) { @@ -1522,10 +1502,10 @@ function get_db_all_rows_field_filter ($table, $field, $condition, $order_field /** * Get all the rows in a table of the databes filtering from a field. * - * @param $table Database table name. - * @param $field Field of the table. + * @param string $table Database table name. + * @param string $field Field of the table. * - * @return A matrix with all the values in the table that matches the condition in the field + * @return mixed A matrix with all the values in the table that matches the condition in the field */ function get_db_all_fields_in_table ($table, $field = '', $condition = '', $order_field = '') { $sql = sprintf ("SELECT * FROM `%s`", $table); @@ -1542,9 +1522,9 @@ function get_db_all_fields_in_table ($table, $field = '', $condition = '', $orde /** * Get the status of an alert assigned to an agent module. * - * @param id_agentmodule Id agent module to check. + * @param int id_agentmodule Id agent module to check. * - * @return True if there were alerts fired. + * @return bool True if there were alerts fired. */ function return_status_agent_module ($id_agentmodule = 0) { $status = get_db_value ('estado', 'tagente_estado', 'id_agente_modulo', $id_agentmodule); @@ -1572,9 +1552,9 @@ function return_status_agent_module ($id_agentmodule = 0) { * layouts), and makes an AND operation to be sure that all the items * are OK. If any of them is down, then result is down (0) * - * @param id_layout Id of the layout + * @param int $id_layout Id of the layout * - * @return The status of the given layout. + * @return bool The status of the given layout. */ function return_status_layout ($id_layout = 0) { $temp_status = 0; @@ -1603,9 +1583,9 @@ function return_status_layout ($id_layout = 0) { /** * Get the current value of an agent module. * - * @param id_agentmodule + * @param int $id_agentmodule * - * @return a numerically formatted value + * @return int a numerically formatted value */ function return_value_agent_module ($id_agentmodule) { return format_numeric (get_db_value ('datos', 'tagente_estado', @@ -1615,20 +1595,20 @@ function return_value_agent_module ($id_agentmodule) { /** * Get the X axis coordinate of a layout item * - * @param id_layoutdata Id of the layout to get. + * @param int $id_layoutdata Id of the layout to get. * - * @return The X axis coordinate value. + * @return int The X axis coordinate value. */ function get_layoutdata_x ($id_layoutdata) { return (float) get_db_value ('pos_x', 'tlayout_data', 'id', $id_layoutdata); } /** - * Get the X axis coordinate of a layout item + * Get the Y axis coordinate of a layout item * - * @param id_layoutdata Id of the layout to get. + * @param int $id_layoutdata Id of the layout to get. * - * @return The X axis coordinate value. + * @return int The Y axis coordinate value. */ function get_layoutdata_y ($id_layoutdata){ return (float) get_db_value ('pos_y', 'tlayout_data', 'id', $id_layoutdata); @@ -1642,10 +1622,10 @@ function get_layoutdata_y ($id_layoutdata){ * before the beginning of the interval. All this calculation is due * to the data compression algorithm. * - * @param $id_agent_module Agent module id - * @param $utimestamp The timestamp to look backwards from and get the data. + * @param int $id_agent_module Agent module id + * @param int $utimestamp The timestamp to look backwards from and get the data. * - * @return The row of tagente_datos of the last period. NULL if there were no data. + * @return mixed The row of tagente_datos of the last period. False if there were no data. */ function get_previous_data ($id_agent_module, $utimestamp) { $interval = get_module_interval ($id_agent_module); @@ -1662,11 +1642,11 @@ function get_previous_data ($id_agent_module, $utimestamp) { /** * Get the average value of an agent module in a period of time. * - * @param id_agent_module Agent module id - * @param period Period of time to check (in seconds) - * @param date Top date to check the values. Default current time. + * @param int $id_agent_module Agent module id + * @param int $period Period of time to check (in seconds) + * @param int $date Top date to check the values. Default current time. * - * @return The average module value in the interval. + * @return int The average module value in the interval. */ function get_agent_module_value_average ($id_agent_module, $period, $date = 0) { if (! $date) @@ -1694,11 +1674,11 @@ function get_agent_module_value_average ($id_agent_module, $period, $date = 0) { /** * Get the maximum value of an agent module in a period of time. * - * @param id_agent_module Agent module id to get the maximum value. - * @param period Period of time to check (in seconds) - * @param date Top date to check the values. Default current time. + * @param int $id_agent_module Agent module id to get the maximum value. + * @param int $period Period of time to check (in seconds) + * @param int $date Top date to check the values. Default current time. * - * @return The maximum module value in the interval. + * @return int The maximum module value in the interval. */ function get_agent_module_value_max ($id_agent_module, $period, $date = 0) { if (! $date) @@ -1722,11 +1702,11 @@ function get_agent_module_value_max ($id_agent_module, $period, $date = 0) { /** * Get the minimum value of an agent module in a period of time. * - * @param id_agent_module Agent module id to get the minimum value. - * @param period Period of time to check (in seconds) - * @param date Top date to check the values. Default current time. + * @param int $id_agent_module Agent module id to get the minimum value. + * @param int $period Period of time to check (in seconds) + * @param int $date Top date to check the values. Default current time. * - * @return The minimum module value of the module + * @return int The minimum module value of the module */ function get_agent_module_value_min ($id_agent_module, $period, $date = 0) { if (! $date) @@ -1749,11 +1729,11 @@ function get_agent_module_value_min ($id_agent_module, $period, $date = 0) { /** * Get the sumatory of values of an agent module in a period of time. * - * @param id_agent_module Agent module id to get the sumatory. - * @param period Period of time to check (in seconds) - * @param date Top date to check the values. Default current time. + * @param int $id_agent_module Agent module id to get the sumatory. + * @param int $period Period of time to check (in seconds) + * @param int $date Top date to check the values. Default current time. * - * @return The sumatory of the module values in the interval. + * @return int The sumatory of the module values in the interval. */ function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0) { if (! $date) @@ -1827,9 +1807,9 @@ function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0) /** * Get a translated string * - * @param string String to translate + * @param string $string String to translate * - * @return The translated string. If not defined, the same string will be returned + * @return string The translated string. If not defined, the same string will be returned */ function __ ($string) { global $l10n; @@ -1845,7 +1825,7 @@ function __ ($string) { * * This check assumes that server_keepalive should be at least 15 minutes. * - * @return The number of servers alive. + * @return int The number of servers alive. */ function check_server_status () { $sql = "SELECT COUNT(id_server) FROM tserver WHERE status = 1 AND keepalive > NOW() - INTERVAL 15 MINUTE"; @@ -1858,11 +1838,11 @@ function check_server_status () { } /** - * DEPRECATED or MOVE: Will show a small HTML table with some compound alert information + * @deprecated Will show a small HTML table with some compound alert information * - * @param (int) id_combined_alert + * @param int $id_combined_alert * - * @return (string) HTML block + * @return string HTML block */ function show_alert_row_mini ($id_combined_alert) { $color=1; @@ -1978,33 +1958,34 @@ function show_alert_row_mini ($id_combined_alert) { } /** - * *DEPRECATED* use get_server_info instead + * @deprecated use get_server_info instead * Get statistical information for a given server * - * @param id_server + * @param int $id_server * - * @return : Serverinfo array -*/ + * @return array Serverinfo array + */ function server_status ($id_server) { $serverinfo = get_server_info ($id_server); return $serverinfo[$id_server]; } -/* +/** * This function will delete the agent from the database in a transaction * You can pass a variable or an array of ID's to be removed (int) * - * @param $id_agents An array or variable with integeres of ID's to be erased + * @param mixed $id_agents An array or variable with integeres of ID's to be erased * - * returns false in case of a problem, true in case of successful - * -*/ - + * @return bool false in case of a problem, true in case of successful + */ function delete_agent ($id_agents) { //Init vars $errors = 0; //Subfunciton for less typing + /** + * @ignore + */ function temp_sql_delete ($table, $row, $value) { global $errors; //Globalize the errors variable $sql = sprintf ("DELETE FROM %s WHERE %s = %s", $table, $row, $value); @@ -2098,11 +2079,10 @@ function delete_agent ($id_agents) { /** * This function will get all the server information in an array or a specific server * - * @param $id_server: An optional integer or array of integers to select specific servers + * @param mixed $id_server An optional integer or array of integers to select specific servers * - * @return false in case the server doesn't exist or an array with info - * -**/ + * @return bool false in case the server doesn't exist or an array with info + */ function get_server_info ($id_server = -1) { if (is_array ($id_server)) { $select_id = " WHERE id_server IN (".implode (",", $id_server).")"; @@ -2180,11 +2160,11 @@ function get_server_info ($id_server = -1) { /** * This function will return the number of all agent modules in the database * - * @param (int) or (array) of integers with agent(s). Leave empty to select everything + * @param mixed $id_agent array of or just integers with agent(s). Leave empty to select everything * - * @return (int) The number of agent modules + * @return int The number of agent modules * - **/ + */ function get_agent_modules_count ($id_agent = 0) { $id_agent = safe_int ($id_agent, 1); //Make sure we're all int's and filter out bad stuff if (empty ($id_agent)) { @@ -2200,10 +2180,10 @@ function get_agent_modules_count ($id_agent = 0) { /** * This function gets the agent group for a given agent module * - * @param (int) $id_module: The agent module id + * @param int $id_module: The agent module id * - * @return (int) The group id -**/ + * @return int The group id + */ function get_agentmodule_group ($id_module) { $agent = (int) get_agentmodule_agent ((int) $id_module); return (int) get_agent_group ($agent); @@ -2212,10 +2192,10 @@ function get_agentmodule_group ($id_module) { /** * This function gets the group for a given agent * - * @param (int) $id_agent: The agent id + * @param int $id_agent: The agent id * - * @return (int) The group id -**/ + * @return int The group id + */ function get_agent_group ($id_agent) { return (int) get_db_value ('id_grupo', 'tagente', 'id_agente', (int) $id_agent); } @@ -2223,10 +2203,10 @@ function get_agent_group ($id_agent) { /** * This function gets the group name for a given group id * - * @param (int) $id_group: The group id + * @param int $id_group: The group id * - * @return (string) The group name -**/ + * @return string The group name + */ function get_group_name ($id_group) { return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group); } @@ -2234,10 +2214,10 @@ function get_group_name ($id_group) { /** * Validates an alert id or an array of alert id's * - * @param $alert_id (array) Array of or a single id + * @param mixed $alert_id Array of or a single id * - * @return (bool) True if it was successful, false if it doesn't - **/ + * @return bool True if it was successful, false if it doesn't + */ function process_alerts_validate ($id_alert) { global $config; require_once ("include/functions_events.php"); @@ -2279,8 +2259,8 @@ function process_alerts_validate ($id_alert) { /** * Gets all module groups. (General, Networking, System). Module groups are merely for sorting frontend * - * @return (array) All module groups -**/ + * @return array All module groups + */ function get_modulegroups () { $result = get_db_all_fields_in_table ("tmodule_group"); $return = array (); @@ -2299,10 +2279,10 @@ function get_modulegroups () { /** * Gets a modulegroup name based on the id * - * @param (int) $modulegroup_id The id of the modulegroup + * @param int $modulegroup_id The id of the modulegroup * - * @return (string) The modulegroup name -**/ + * @return string The modulegroup name + */ function get_modulegroup_name ($modulegroup_id) { return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $modulegroup_id); } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 21de21da9d..c78c10efa2 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -16,6 +16,13 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +/** + * Delete events in a transaction + * + * @param mixed $id_event Event ID or array of events + * + * @return bool Whether or not it was successful + */ function delete_event ($id_event) { global $config; @@ -54,6 +61,13 @@ function delete_event ($id_event) { } } +/** + * Validate events in a transaction + * + * @param mixed $id_event Event ID or array of events + * + * @return bool Whether or not it was successful + */ function process_event_validate ($id_event) { global $config; @@ -95,9 +109,9 @@ function process_event_validate ($id_event) { /** * Get group id of an event. * - * @param id_event Event id + * @param int $id_event Event id * - * @return Group id of the given event. + * @return int Group id of the given event. */ function get_event_group ($id_event) { return (int) get_db_value ('id_grupo', 'tevento', 'id_evento', (int) $id_event); @@ -106,9 +120,9 @@ function get_event_group ($id_event) { /** * Get description of an event. * - * @param id_event Event id. + * @param int $id_event Event id. * - * @return Description of the given event. + * @return string Description of the given event. */ function get_event_description ($id_event) { return (string) get_db_value ('evento', 'tevento', 'id_evento', (int) $id_event); @@ -117,17 +131,17 @@ function get_event_description ($id_event) { /** * Insert a event in the event log system. * - * @param event - * @param id_group - * @param id_agent - * @param status - * @param id_user - * @param event_type - * @param priority - * @param id_agent_module - * @param id_aam + * @param int $event + * @param int $id_group + * @param int $id_agent + * @param int $status + * @param string $id_user + * @param string $event_type + * @param int $priority + * @param int $id_agent_module + * @param int $id_aam * - * @return event_id + * @return int event id */ function create_event ($event, $id_group, $id_agent, $status = 0, $id_user = "", $event_type = "unknown", $priority = 0, $id_agent_module = 0, $id_aam = 0) { $sql = sprintf ('INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, @@ -272,5 +286,4 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return = return $return; } } - ?> \ No newline at end of file diff --git a/pandora_console/include/functions_extensions.php b/pandora_console/include/functions_extensions.php index 094440edd5..1240803741 100644 --- a/pandora_console/include/functions_extensions.php +++ b/pandora_console/include/functions_extensions.php @@ -19,6 +19,12 @@ $extension_file = ''; + +/** + * TODO: Document extensions + * + * @param string $filename + */ function extension_call_main_function ($filename) { global $config; @@ -29,6 +35,11 @@ function extension_call_main_function ($filename) { } } +/** + * TODO: Document extensions + * + * @param string $filename + */ function extension_call_godmode_function ($filename) { global $config; @@ -39,6 +50,9 @@ function extension_call_godmode_function ($filename) { } } +/** + * TODO: Document extensions + */ function extensions_call_login_function () { global $config; @@ -50,6 +64,11 @@ function extensions_call_login_function () { } } +/** + * TODO: Document extensions + * + * @param string $page + */ function is_extension ($page) { global $config; @@ -57,6 +76,11 @@ function is_extension ($page) { return isset ($config['extensions'][$filename]); } +/** + * TODO: Document extensions + * + * @param bool $enterprise + */ function get_extensions ($enterprise = false) { $dir = EXTENSIONS_DIR; if ($enterprise) @@ -97,6 +121,11 @@ function get_extensions ($enterprise = false) { return $extensions; } +/** + * TODO: Document extensions + * + * @param array $extensions + */ function load_extensions ($extensions) { global $config; global $extension_file; @@ -107,6 +136,11 @@ function load_extensions ($extensions) { } } +/** + * TODO: Document extensions + * + * @param string $name + */ function add_operation_menu_option ($name) { global $config; global $extension_file; @@ -120,6 +154,12 @@ function add_operation_menu_option ($name) { $extension['operation_menu'] = $option_menu; } +/** + * TODO: Document extensions + * + * @param string $name + * @param string $acl + */ function add_godmode_menu_option ($name, $acl) { global $config; global $extension_file; @@ -134,7 +174,11 @@ function add_godmode_menu_option ($name, $acl) { $extension['godmode_menu'] = $option_menu; } - +/** + * TODO: Document extensions + * + * @param string $function_name + */ function add_extension_main_function ($function_name) { global $config; global $extension_file; @@ -143,6 +187,11 @@ function add_extension_main_function ($function_name) { $extension['main_function'] = $function_name; } +/** + * TODO: Document extensions + * + * @param string $function_name + */ function add_extension_godmode_function ($function_name) { global $config; global $extension_file; @@ -151,6 +200,11 @@ function add_extension_godmode_function ($function_name) { $extension['godmode_function'] = $function_name; } +/** + * TODO: Document extensions + * + * @param string $function_name + */ function add_extension_login_function ($function_name) { global $config; global $extension_file; @@ -158,5 +212,4 @@ function add_extension_login_function ($function_name) { $extension = &$config['extensions'][$extension_file]; $extension['login_function'] = $function_name; } - ?> diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 5857dbb789..97edf558e3 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -96,16 +96,16 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing = * * The element will have an id like: "password-$value". Based on choose_from_menu() from Moodle. * - * @param string SQL sentence, the first field will be the identifier of the option. + * @param string $sql SQL sentence, the first field will be the identifier of the option. * The second field will be the shown value in the dropdown. - * @param string Select form name - * @param string Current selected value. - * @param string Javascript onChange code. - * @param string Label when nothing is selected. - * @param string Value when nothing is selected - * @param bool Whether to return an output string or echo now (optional, echo by default). - * @param bool Whether to allow multiple selections or not. Single by default - * @param bool Whether to sort the options or not. Sorted by default. + * @param string $name Select form name + * @param string $selected Current selected value. + * @param string $script Javascript onChange code. + * @param string $nothing Label when nothing is selected. + * @param string $nothing_value Value when nothing is selected + * @param bool $return Whether to return an output string or echo now (optional, echo by default). + * @param bool $multiple Whether to allow multiple selections or not. Single by default + * @param bool $sort Whether to sort the options or not. Sorted by default. * * @return string HTML code if return parameter is true. */ @@ -126,16 +126,17 @@ function print_select_from_sql ($sql, $name, $selected = '', $script = '', $noth /** * Render an input text element. Extended version, use print_input_text() to simplify. * - * @param string Input name. - * @param string Input value. - * @param string Input HTML id. - * @param string Alternative HTML string. - * @param int Size of the input. - * @param int Maximum length allowed. - * @param bool Disable the button (optional, button enabled by default). - * @param string Alternative HTML string. - * @param bool Whether to return an output string or echo now (optional, echo by default). - * @param bool Whether it is a password input or not. Not password by default. + * @param string $name Input name. + * @param string $value Input value. + * @param string $id Input HTML id. + * @param string $alt Alternative HTML string. + * @param int $size Size of the input. + * @param int $maxlength Maximum length allowed. + * @param bool $disabled Disable the button (optional, button enabled by default). + * @param string $script JavaScript to attach to this + * @param string $attributes Attributes to add to this tag + * @param bool $return Whether to return an output string or echo now (optional, echo by default). + * @param bool $password Whether it is a password input or not. Not password by default. * * @return string HTML code if return parameter is true. */ @@ -183,12 +184,12 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength, * * The element will have an id like: "password-$name" * - * @param string Input name. - * @param string Input value. - * @param string Alternative HTML string (optional). - * @param int Size of the input (optional). - * @param int Maximum length allowed (optional). - * @param bool Whether to return an output string or echo now (optional, echo by default). + * @param string $name Input name. + * @param string $value Input value. + * @param string $alt Alternative HTML string (optional). + * @param int $size Size of the input (optional). + * @param int $maxlength Maximum length allowed (optional). + * @param bool $return Whether to return an output string or echo now (optional, echo by default). * * @return string HTML code if return parameter is true. */ @@ -205,12 +206,12 @@ function print_input_password ($name, $value, $alt = '', $size = 50, $maxlength * * The element will have an id like: "text-$name" * - * @param string Input name. - * @param string Input value. - * @param string Alternative HTML string (optional). - * @param int Size of the input (optional). - * @param int Maximum length allowed (optional). - * @param bool Whether to return an output string or echo now (optional, echo by default). + * @param string $name Input name. + * @param string $value Input value. + * @param string $alt Alternative HTML string (optional). + * @param int $size Size of the input (optional). + * @param int $maxlength Maximum length allowed (optional). + * @param bool $return Whether to return an output string or echo now (optional, echo by default). * * @return string HTML code if return parameter is true. */ @@ -227,11 +228,11 @@ function print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 0, * * The element will have an id like: "image-$name" * - * @param string Input name. - * @param string Image source. - * @param string Input value. - * @param string HTML style property. - * @param bool Whether to return an output string or echo now (optional, echo by default). + * @param string $name Input name. + * @param string $src Image source. + * @param string $value Input value. + * @param string $style HTML style property. + * @param bool $return Whether to return an output string or echo now (optional, echo by default). * * @return string HTML code if return parameter is true. */ @@ -248,9 +249,9 @@ function print_input_image ($name, $src, $value, $style = '', $return = false) { * * The element will have an id like: "hidden-$name" * - * @param string Input name. - * @param string Input value. - * @param bool Whether to return an output string or echo now (optional, echo by default). + * @param string $name Input name. + * @param string $value Input value. + * @param bool $return Whether to return an output string or echo now (optional, echo by default). * * @return string HTML code if return parameter is true. */ @@ -267,11 +268,11 @@ function print_input_hidden ($name, $value, $return = false) { * * The element will have an id like: "submit-$name" * - * @param string Input label. - * @param string Input name. - * @param bool Whether to disable by default or not. Enabled by default. - * @param string Additional HTML attributes. - * @param bool Whether to return an output string or echo now (optional, echo by default). + * @param string $label Input label. + * @param string $name Input name. + * @param bool $disabled Whether to disable by default or not. Enabled by default. + * @param string $attributes Additional HTML attributes. + * @param bool $return Whether to return an output string or echo now (optional, echo by default). * * @return string HTML code if return parameter is true. */ @@ -293,11 +294,12 @@ function print_submit_button ($label = 'OK', $name = '', $disabled = false, $att * * The element will have an id like: "button-$name" * - * @param string Input label. - * @param string Input name. - * @param bool Whether to disable by default or not. Enabled by default. - * @param string Additional HTML attributes. - * @param bool Whether to return an output string or echo now (optional, echo by default). + * @param string $label Input label. + * @param string $name Input name. + * @param bool $disabled Whether to disable by default or not. Enabled by default. + * @param string $script JavaScript to attach + * @param string $attributes Additional HTML attributes. + * @param bool $return Whether to return an output string or echo now (optional, echo by default). * * @return string HTML code if return parameter is true. */ @@ -319,9 +321,13 @@ function print_button ($label = 'OK', $name = '', $disabled = false, $script = ' * * The element will have an id like: "textarea_$name" * - * @param string Input name. - * @param string Input value. - * @param bool Whether to return an output string or echo now (optional, echo by default). * + * @param string $name Input name. + * @param int $rows How many rows (height) + * @param int $columns How many columns (width) + * @param string $value Text in the textarea + * @param string $attributes Additional attributes + * @param bool $return Whether to return an output string or echo now (optional, echo by default). * + * * @return string HTML code if return parameter is true. */ function print_textarea ($name, $rows, $columns, $value = '', $attributes = '', $return = false) { @@ -359,7 +365,7 @@ function print_textarea ($name, $rows, $columns, $value = '', $attributes = '', * $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table * $table->titlestyle - Title style * $table->titleclass - Title class - * @param bool $return whether to return an output string or echo now + * @param bool $return whether to return an output string or echo now * * @return string HTML code if return parameter is true. */ @@ -654,8 +660,8 @@ function print_checkbox ($name, $value, $checked = false, $return = false) { /** * Prints only a tip button which shows a text when the user puts the mouse over it. * - * @param string $text Complete text to show in the tip - * @param bool $return whether to return an output string or echo now + * @param string $text Complete text to show in the tip + * @param bool $return whether to return an output string or echo now * * @return string HTML code if return parameter is true. */ @@ -671,8 +677,9 @@ function print_help_tip ($text, $return = false) { /** * Prints an image HTML element. * - * @param string Image source filename. - * @param array Array with optional HTML options to set. At this moment, the + * @param string $src Image source filename. + * @param bool $return Whether to return or print + * @param array $options Array with optional HTML options to set. At this moment, the * following options are supported: alt, style, title, width, height, class. * * @return string HTML code if return parameter is true. @@ -709,4 +716,4 @@ function print_image ($src, $return = false, $options = false) { return $output; echo $output; } -?> +?> \ No newline at end of file diff --git a/pandora_console/include/functions_incidents.php b/pandora_console/include/functions_incidents.php index b5b9dcd412..845eadb9ff 100644 --- a/pandora_console/include/functions_incidents.php +++ b/pandora_console/include/functions_incidents.php @@ -18,9 +18,8 @@ /** * Gets all the possible priorities for incidents in an array * - * @return (array) The several priorities with their values + * @return array The several priorities with their values */ - function get_incidents_priorities () { $fields = array(); $fields[0] = __('Informative'); @@ -36,11 +35,10 @@ function get_incidents_priorities () { /** * Prints the image tag for passed status * - * @param (int) $id_status: Which status to return the image to + * @param int $id_status Which status to return the image to * - * @return (string) The string with the image tag + * @return string The string with the image tag */ - function print_incidents_priority_img ($id_priority, $return = false) { switch ($id_priority) { case 0: @@ -73,9 +71,8 @@ function print_incidents_priority_img ($id_priority, $return = false) { /** * Gets all the possible status for incidents in an array * - * @return (array) The several status with their values + * @return array The several status with their values */ - function get_incidents_status () { $fields = array (); $fields[0] = __('Active incidents'); @@ -90,11 +87,10 @@ function get_incidents_status () { /** * Prints the image tag for passed status * - * @param (int) $id_status: Which status to return the image to + * @param int $id_status: Which status to return the image to * - * @return (string) The string with the image tag + * @return string The string with the image tag */ - function print_incidents_status_img ($id_status, $return = false) { switch ($id_status) { case 0: @@ -124,11 +120,10 @@ function print_incidents_status_img ($id_status, $return = false) { * Updates the last user (either by adding an attachment, note or the incident itself) * Named after the UNIX touch utility * - * @param (int) $id_incident: A single incident or an array of incidents + * @param int $id_incident: A single incident or an array of incidents * - * @return (bool) True if it was done, false if it wasn't + * @return bool True if it was done, false if it wasn't */ - function process_incidents_touch ($id_incident) { global $config; @@ -144,11 +139,10 @@ function process_incidents_touch ($id_incident) { /** * Updates the owner (named after the UNIX utility chown) * - * @param (int) $id_incident: A single incident or an array of incidents + * @param int $id_incident: A single incident or an array of incidents * - * @return (bool) True if it was done, false if it wasn't + * @return bool True if it was done, false if it wasn't */ - function process_incidents_chown ($id_incident, $owner = false) { if ($owner === false) { global $config; @@ -168,9 +162,9 @@ function process_incidents_chown ($id_incident, $owner = false) { /** * Get the author of an incident. * - * @param (int) id_incident Incident id. + * @param int $id_incident Incident id. * - * @return (string) The author of an incident + * @return string The author of an incident */ function get_incidents_author ($id_incident) { if ($id_incident < 1) { @@ -182,9 +176,9 @@ function get_incidents_author ($id_incident) { /** * Get the owner of an incident. * - * @param (int) id_incident Incident id. + * @param int $id_incident Incident id. * - * @return (string) The last updater of an incident + * @return string The last updater of an incident */ function get_incidents_owner ($id_incident) { if ($id_incident < 1) { @@ -196,9 +190,9 @@ function get_incidents_owner ($id_incident) { /** * Get the last updater of an incident. * - * @param (int) id_incident Incident id. + * @param int $id_incident Incident id. * - * @return (string) The last updater of an incident + * @return string The last updater of an incident */ function get_incidents_lastupdate ($id_incident) { if ($id_incident < 1) { @@ -211,9 +205,9 @@ function get_incidents_lastupdate ($id_incident) { /** * Get the group id of an incident. * - * @param (int) id_incident Incident id. + * @param int $id_incident Incident id. * - * @return (int) The group id of an incident + * @return int The group id of an incident */ function get_incidents_group ($id_incident) { if ($id_incident < 1) { @@ -225,9 +219,9 @@ function get_incidents_group ($id_incident) { /** * Delete an incident out the database. * - * @param id_inc (array or int) An int or an array of ints to be deleted + * @param mixed $id_inc An int or an array of ints to be deleted * - * @return (bool) True if incident was succesfully deleted, false if not + * @return bool True if incident was succesfully deleted, false if not */ function delete_incidents ($id_incident) { global $config; @@ -277,10 +271,10 @@ function delete_incidents ($id_incident) { /** * Delete notes out the database. * - * @param id_note (array or int) An int or an array of ints to be deleted - * @param transact (bool) true if a transaction should be started, false if not + * @param mixed $id_note An int or an array of ints to be deleted + * @param bool $transact true if a transaction should be started, false if not * - * @return (bool) True if note was succesfully deleted, false if not + * @return bool True if note was succesfully deleted, false if not */ function delete_incidents_note ($id_note, $transact = true) { $id_note = (array) safe_int ($id_note, 1); //cast as array @@ -319,10 +313,10 @@ function delete_incidents_note ($id_note, $transact = true) { /** * Delete attachments out the database and from the machine. * - * @param id_attach (array or int) An int or an array of ints to be deleted - * @param transact (bool) true if a transaction should be started, false if not + * @param mixed $id_attach An int or an array of ints to be deleted + * @param bool $transact true if a transaction should be started, false if not * - * @return (bool) True if attachment was succesfully deleted, false if not + * @return bool True if attachment was succesfully deleted, false if not */ function delete_incidents_attach ($id_attach, $transact = true) { global $config; @@ -365,9 +359,9 @@ function delete_incidents_attach ($id_attach, $transact = true) { /** * Get notes based on the incident id. * - * @param id_inc (int) An int with the incident id + * @param int $id_incident An int with the incident id * - * @return (array) An array of all the notes for that incident + * @return array An array of all the notes for that incident */ function get_incidents_notes ($id_incident) { $return = get_db_all_rows_field_filter ("tnota", "id_incident", (int) $id_incident); @@ -387,9 +381,9 @@ function get_incidents_notes ($id_incident) { /** * Get attachments based on the incident id. * - * @param id_inc (int) An int with the incident id + * @param int $id_incident An int with the incident id * - * @return (array) An array of all the notes for that incident + * @return array An array of all the notes for that incident */ function get_incidents_attach ($id_incident) { $return = get_db_all_rows_field_filter ("tattachment", "id_incidencia", (int) $id_incident); @@ -410,15 +404,17 @@ function get_incidents_attach ($id_incident) { /** * Get user id of a note. * - * @param id_note Note id. + * @param int $id_note Note id. * - * @return User id of the given note. + * @return string User id of the given note. */ function get_incidents_notes_author ($id_note) { return (string) get_db_value ('id_usuario', 'tnota', 'id_nota', (int) $id_note); } -//Upgrade incidents table from 1.3 to 2.1 +/** + * @ignore This function should never be used + */ function upgrade_inc13to21 () { $sql = "ALTER TABLE `tincidencia` CHANGE `id_incidencia` `id_incidencia` BIGINT( 6 ) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT"; process_sql ($sql); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 4eb8d370ed..dd40d74516 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -20,13 +20,13 @@ /** * Get SLA of a module. * - * @param id_agent_module Agent module to calculate SLA - * @param period Period to check the SLA compliance. - * @param min_value Minimum data value the module in the right interval - * @param max_value Maximum data value the module in the right interval - * @param date Beginning date of the report in UNIX time (current date by default). + * @param int $id_agent_module Agent module to calculate SLA + * @param int $period Period to check the SLA compliance. + * @param int $min_value Minimum data value the module in the right interval + * @param int $max_value Maximum data value the module in the right interval + * @param int $date Beginning date of the report in UNIX time (current date by default). * - * @return SLA percentage of the requested module. + * @return int SLA percentage of the requested module. */ function get_agent_module_sla ($id_agent_module, $period, $min_value, $max_value, $date = 0) { if (empty ($date)) @@ -116,9 +116,9 @@ function get_agent_module_sla ($id_agent_module, $period, $min_value, $max_value /** * Get general stats info on a group * - * @param id_group + * @param int $id_group * - * @return + * @return array */ function get_group_stats ($id_group) { $groups = array_keys (get_user_groups ()); @@ -284,12 +284,12 @@ function get_group_stats ($id_group) { * It construct a table object with all the events happened in a group * during a period of time. * - * @param id_group Group id to get the report. - * @param period Period of time to get the report. - * @param date Beginning date of the report - * @param return Flag to return or echo the report table (echo by default). + * @param int $id_group Group id to get the report. + * @param int $period Period of time to get the report. + * @param int $date Beginning date of the report + * @param int $return Flag to return or echo the report table (echo by default). * - * @return A table object if return variable is true. + * @return object A table object */ function event_reporting ($id_group, $period, $date = 0, $return = false) { if (empty ($date)) { @@ -329,9 +329,10 @@ function event_reporting ($id_group, $period, $date = 0, $return = false) { /** * Get a table report from a alerts fired array. * - * @param alerts_fired Alerts fired array. See get_alerts_fired() + * @param array $alerts_fired Alerts fired array. + * @see function get_alerts_fired () * - * @return A table object with a report of the fired alerts. + * @return object A table object with a report of the fired alerts. */ function get_fired_alerts_reporting_table ($alerts_fired) { $agents = array (); @@ -377,10 +378,12 @@ function get_fired_alerts_reporting_table ($alerts_fired) { * It prints the numbers of alerts defined, fired and not fired in a group. * It also prints all the alerts that were fired grouped by agents. * - * @param $id_group Group to get info of the alerts. - * @param $period Period of time of the desired alert report. - * @param $date Beggining date of the report (current date by default). - * @param $return Flag to return or echo the report (echo by default). + * @param int $id_group Group to get info of the alerts. + * @param int $period Period of time of the desired alert report. + * @param int $date Beggining date of the report (current date by default). + * @param bool $return Flag to return or echo the report (echo by default). + * + * @return string */ function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { $output = ''; @@ -423,10 +426,12 @@ function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { * It prints the numbers of monitors defined, showing those which went up and down, in a group. * It also prints all the down monitors in the group. * - * @param $id_group Group to get info of the monitors. - * @param $period Period of time of the desired monitor report. - * @param $date Beginning date of the report in UNIX time (current date by default). - * @param $return Flag to return or echo the report (by default). + * @param int $id_group Group to get info of the monitors. + * @param int $period Period of time of the desired monitor report. + * @param int $date Beginning date of the report in UNIX time (current date by default). + * @param bool $return Flag to return or echo the report (by default). + * + * @return string */ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = false) { if (empty ($date)) //If date is 0, false or empty @@ -459,7 +464,7 @@ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = $output .= print_table ($table, true); //Floating it was ugly, moved it to the bottom - $output .= ''; + $output .= ''; if (!$return) echo $output; @@ -469,10 +474,10 @@ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = /** * Get a report table with all the monitors down. * - * @param monitors_down An array with all the monitors down. See - * get_monitors_down() + * @param array $monitors_down An array with all the monitors down + * @see function get_monitors_down() * - * @return A table object with a monitors down report. + * @return object A table object with a monitors down report. */ function get_monitors_down_reporting_table ($monitors_down) { $table->data = array (); @@ -518,6 +523,8 @@ function get_monitors_down_reporting_table ($monitors_down) { * * @param $id_group Group to get the report * @param $return Flag to return or echo the report (by default). + * + * @return string */ function general_group_reporting ($id_group, $return = false) { $agents = get_group_agents ($id_group, false, "none"); @@ -532,11 +539,11 @@ function general_group_reporting ($id_group, $return = false) { /** * Get a report table of the fired alerts group by agents. * - * @param id_agent Agent id to generate the report. - * @param period Period of time of the report. - * @param date Beginning date of the report in UNIX time (current date by default). + * @param int $id_agent Agent id to generate the report. + * @param int $period Period of time of the report. + * @param int $date Beginning date of the report in UNIX time (current date by default). * - * @return A table object with the alert reporting.. + * @return object A table object with the alert reporting.. */ function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) { $table->data = array (); @@ -573,11 +580,11 @@ function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) { /** * Get a report of monitors in an agent. * - * @param id_agent Agent id to get the report - * @param period Period of time of the report. - * @param date Beginning date of the report in UNIX time (current date by default). + * @param int $id_agent Agent id to get the report + * @param int $period Period of time of the report. + * @param int $date Beginning date of the report in UNIX time (current date by default). * - * @return A table object with the report. + * @return object A table object with the report. */ function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0) { $n_a_string = __('N/A').'(*)'; @@ -610,11 +617,11 @@ function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0) /** * Get a report of all the modules in an agent. * - * @param id_agent Agent id to get the report. - * @param period Period of time of the report - * @param date Beginning date of the report in UNIX time (current date by default). + * @param int $id_agent Agent id to get the report. + * @param int $period Period of time of the report + * @param int $date Beginning date of the report in UNIX time (current date by default). * - * @return + * @return object */ function get_agent_modules_reporting_table ($id_agent, $period = 0, $date = 0) { $table->data = array (); @@ -638,10 +645,12 @@ function get_agent_modules_reporting_table ($id_agent, $period = 0, $date = 0) { /** * Get a detailed report of an agent * - * @param $id_agent Agent to get the report. - * @param $period Period of time of the desired report. - * @param $date Beginning date of the report in UNIX time (current date by default). - * @param $return Flag to return or echo the report (by default). + * @param int $id_agent Agent to get the report. + * @param int $period Period of time of the desired report. + * @param int $date Beginning date of the report in UNIX time (current date by default). + * @param bool $return Flag to return or echo the report (by default). + * + * @return string */ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $return = false) { $output = ''; @@ -689,8 +698,12 @@ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $retur /** * Get a detailed report of agents in a group. * - * @param $id_group Group to get the report - * @param $return Flag to return or echo the report (by default). + * @param int $id_group Group to get the report + * @param int $period Period + * @param int $date Timestamp to start from + * @param bool $return Flag to return or echo the report (by default). + * + * @return string */ function get_agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return = false) { $agents = get_group_agents ($id_group, false, "none"); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 8292e133f7..bfcaf26efb 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -21,17 +21,17 @@ * Evaluates a result using empty() and then prints an error message or a * success message * - * @param mixed $result the results to evaluate. 0, NULL, false, '' or array() - * is bad, the rest is good + * @param mixed $result the results to evaluate. 0, NULL, false, '' or + * array() is bad, the rest is good * @param string $good the string to be displayed if the result was good * @param string $bad the string to be displayed if the result was bad * @param string $attributes any other attributes to be set for the h3 * @param bool $return whether to output the string or return it * @param string $tag what tag to use (you could specify something else than - * h3 like div or h2 + * h3 like div or h2) * - * @return string HTML code if return parameter is true. -*/ + * @return string XHTML code if return parameter is true. + */ function print_error_message ($result, $good = '', $bad = '', $attributes = '', $return = false, $tag = 'h3') { if ($good == '' || $good === false) $good = __('Request successfully processed'); @@ -196,13 +196,13 @@ function print_os_icon ($id_os, $name = true, $return = false) { /** * Prints an agent name with the correct link * - * @param int $agent Agent id + * @param int $id_agent Agent id * @param bool $return Whether to return the string or echo it too - * @param int $cutoff After how much characters to cut off the inside of the link. - * The full agent name will remain in the roll-over + * @param int $cutoff After how much characters to cut off the inside of the + * link. The full agent name will remain in the roll-over * * @return string HTML with agent name and link -**/ + */ function print_agent_name ($id_agent, $return = false, $cutoff = 0) { $agent_name = (string) get_agent_name ($id_agent); $output = ''; @@ -220,5 +220,4 @@ function print_agent_name ($id_agent, $return = false, $cutoff = 0) { echo $output; } - ?> diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 4547a28fb6..8b36643234 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -17,6 +17,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +/** + * Prints visual map + * + * @param int $id_layout Layout id + * @param bool $show_links + * @param bool $draw_lines + */ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = true) { global $config; $layout = get_db_row ('tlayout', 'id', $id_layout); @@ -135,6 +143,9 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = echo ""; } +/** + * @return array Layout data types + */ function get_layout_data_types () { $types = array (0 => __('Static graph'), 1 => __('Module graph')); diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index bf12b0e267..171321b587 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -2036,7 +2036,6 @@ $date = get_parameter ("date"); $graphic_type = (string) get_parameter ('tipo'); $mode = get_parameter ("mode", 1); $url = get_parameter ('url',''); -$url = unsafe_string ($url); if ($graphic_type) { switch ($graphic_type) {