2009-01-08 Evi Vanoost <vanooste@rcbi.rochester.edu>
* 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 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1323 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
530e5dd8f6
commit
75dbad42a7
|
@ -1,3 +1,22 @@
|
|||
2009-01-08 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* 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 <rnovoa@artica.es>
|
||||
|
||||
* include/functions.php,
|
||||
|
|
|
@ -30,5 +30,5 @@ if ((isset($develop_bypass)) AND ($develop_bypass == 1)) {
|
|||
echo ' - Saved '.format_numeric ($sql_cache["saved"]).' Queries';
|
||||
}
|
||||
echo '</a><br />';
|
||||
echo '<a href="http://www.mozilla-europe.org/en/firefox/"><img src="'.$config["homeurl"].'images/firefox.png" align="middle" title="'.__('Pandora FMS console is best viewed with Firefox web browser').'" /></a>';
|
||||
echo '<a href="http://www.mozilla-europe.org/en/firefox/"><img src="images/firefox.png" align="middle" title="'.__('Pandora FMS console is best viewed with Firefox web browser').'" /></a>';
|
||||
?>
|
||||
|
|
|
@ -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.")<br />";
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = " <a href='javascript:help_popup(".$help_id.")'>[H]</a>";
|
||||
|
@ -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 ("<pre>\nerror: no filetype \"$fileExtension\" found!\n</pre>\n");
|
||||
} else {
|
||||
asort ($result);
|
||||
if ($return == 0) {
|
||||
return $result;
|
||||
if ($return === false) {
|
||||
echo ("<pre>\n");
|
||||
print_r ($result);
|
||||
echo ("</pre>\n");
|
||||
}
|
||||
echo ("<pre>\n");
|
||||
print_r ($result);
|
||||
echo ("</pre>\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 "<div>";
|
||||
$output = '<div>';
|
||||
// Show GOTO FIRST button
|
||||
echo '<a href="'.$url.'&offset=0"><img src="images/control_start_blue.png" class="bot" /></a> ';
|
||||
$output .= '<a href="'.$url.'&offset=0"><img src="images/control_start_blue.png" class="bot" /></a> ';
|
||||
// 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 '<a href="'.$url.'&offset='.$index_page_prev.'"><img src="images/control_rewind_blue.png" class="bot" /></a>';
|
||||
$output .= '<a href="'.$url.'&offset='.$index_page_prev.'"><img src="images/control_rewind_blue.png" class="bot" /></a>';
|
||||
}
|
||||
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 "<span>";
|
||||
$output .= "<span>";
|
||||
|
||||
$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 '<a href="'.$url.'&offset='.$inicio_bloque.'">';
|
||||
if ($inicio_bloque == $offset)
|
||||
echo "<b>[ $i ]</b>";
|
||||
else
|
||||
echo "[ $i ]";
|
||||
echo '</a> ';
|
||||
echo "</span>";
|
||||
$output .= '<a href="'.$url.'&offset='.$inicio_bloque.'">';
|
||||
if ($inicio_bloque == $offset) {
|
||||
$output .= "<b>[ $i ]</b>";
|
||||
} else {
|
||||
$output .= "[ $i ]";
|
||||
}
|
||||
$output .= '</a></span>';
|
||||
}
|
||||
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 '<a href="'.$url.'&offset='.$prox_bloque.'"><img class="bot" src="images/control_fastforward_blue.png" /></a>';
|
||||
$output .= '<a href="'.$url.'&offset='.$prox_bloque.'"><img class="bot" src="images/control_fastforward_blue.png" /></a>';
|
||||
$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 '<a href="'.$url.'&offset='.$myoffset.'"><img class="bot" src="images/control_end_blue.png" /></a>';
|
||||
$output .= '<a href="'.$url.'&offset='.$myoffset.'"><img class="bot" src="images/control_end_blue.png" /></a>';
|
||||
}
|
||||
// End div and layout
|
||||
echo "</div>";
|
||||
$output .= "</div>";
|
||||
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);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
?>
|
||||
?>
|
|
@ -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);
|
||||
|
|
|
@ -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 .= '<img src="reporting/fgraph.php?tipo=monitors_health_pipe&height=150&width=280&down='.$down_percentage.'&not_down='.$not_down_percentage.'" style="border: 1px solid black">';
|
||||
$output .= '<img src="reporting/fgraph.php?tipo=monitors_health_pipe&height=150&width=280&down='.$down_percentage.'&not_down='.$not_down_percentage.'" style="border: 1px solid black" />';
|
||||
|
||||
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");
|
||||
|
|
|
@ -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 = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'" title="'.$agent_name.'"><b>';
|
||||
|
@ -220,5 +220,4 @@ function print_agent_name ($id_agent, $return = false, $cutoff = 0) {
|
|||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -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 "</div>";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array Layout data types
|
||||
*/
|
||||
function get_layout_data_types () {
|
||||
$types = array (0 => __('Static graph'),
|
||||
1 => __('Module graph'));
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue