2013-07-16 Miguel de Dios <miguel.dedios@artica.es>

* include/functions.php,
	include/javascript/jquery.pandora.controls.js: improved the
	functions to pass the php vars to js, now it supports json.
	
	* include/javascript/d3.v3.js: added this library for to make
	beautiful things.
	
	* include/functions_ui.php, include/graphs/fgraph.php,
	include/javascript/pandora_events.js, include/javascript/pandora.js,
	include/functions_treeview.php,
	include/include_graph_dependencies.php,
	include/functions_categories.php, include/db/postgresql.php,
	include/db/oracle.php, include/db/mysql.php: cleaned source code
	style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-07-16 14:13:23 +00:00
parent 3eed1ff8be
commit 0875fb0af9
14 changed files with 8943 additions and 197 deletions

View File

@ -1,3 +1,20 @@
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/flot/pandora.flot.js,

View File

@ -580,7 +580,7 @@ function mysql_db_get_value_sql($sql, $dbconnection = false) {
$sql .= " LIMIT 1";
$result = mysql_db_get_all_rows_sql ($sql, false, true, $dbconnection);
if($result === false)
if ($result === false)
return false;
foreach ($result[0] as $f)
@ -598,7 +598,7 @@ function mysql_db_get_row_sql ($sql, $search_history_db = false) {
$sql .= " LIMIT 1";
$result = db_get_all_rows_sql ($sql, $search_history_db);
if($result === false)
if ($result === false)
return false;
return $result[0];

View File

@ -65,7 +65,7 @@ function oracle_connect_db($host = null, $db = null, $user = null, $pass = null,
* @return mixed Value of first column of the first row. False if there were no row.
*/
function oracle_db_get_value ($field, $table, $field_search = 1, $condition = 1, $search_history_db = false) {
if (is_int ($condition)) {
$sql = sprintf ("SELECT *
FROM (SELECT %s FROM %s WHERE %s = %d)
@ -861,7 +861,7 @@ function oracle_db_get_value_sql($sql, $dbconnection = false) {
$sql = "SELECT * FROM (" . $sql . ") WHERE rownum < 2";
$result = oracle_db_get_all_rows_sql ($sql, false, true, $dbconnection);
if($result === false)
if ($result === false)
return false;
foreach ($result[0] as $f)
@ -879,7 +879,7 @@ function oracle_db_get_row_sql ($sql, $search_history_db = false) {
$sql = "SELECT * FROM (" . $sql . ") WHERE rownum < 2";
$result = oracle_db_get_all_rows_sql($sql, $search_history_db);
if($result === false)
if ($result === false)
return false;
return $result[0];
@ -1115,7 +1115,7 @@ function oracle_db_format_array_to_update_sql ($values) {
else if (substr($value, 0,1) == '#'){
$sql = sprintf ("%s = %s", $field, substr($value,1));
}
else{
else {
$sql = sprintf ("%s = '%s'", $field, $value);
}
}

View File

@ -37,7 +37,7 @@ function postgresql_connect_db($host = null, $db = null, $user = null, $pass = n
if (! $connect_id) {
return false;
}
return $connect_id;
}
@ -54,18 +54,18 @@ function postgresql_connect_db($host = null, $db = null, $user = null, $pass = n
function postgresql_db_get_value ($field, $table, $field_search = 1, $condition = 1, $search_history_db = false) {
if ($field_search[0] == '`')
$field_search = str_replace ('`', '', $field_search);
if (is_int ($condition)) {
$sql = sprintf ("SELECT %s FROM %s WHERE %s = %d LIMIT 1",
$field, $table, $field_search, $condition);
$field, $table, $field_search, $condition);
}
else if (is_float ($condition) || is_double ($condition)) {
$sql = sprintf ("SELECT %s FROM %s WHERE %s = %f LIMIT 1",
$field, $table, $field_search, $condition);
$field, $table, $field_search, $condition);
}
else {
$sql = sprintf ("SELECT %s FROM %s WHERE %s = '%s' LIMIT 1",
$field, $table, $field_search, $condition);
$field, $table, $field_search, $condition);
}
$result = db_get_all_rows_sql ($sql, $search_history_db);
@ -74,7 +74,7 @@ function postgresql_db_get_value ($field, $table, $field_search = 1, $condition
if ($field[0] == '`')
$field = str_replace ('`', '', $field);
if (!isset($result[0][$field])) {
return reset($result[0]);
}
@ -120,7 +120,7 @@ function postgresql_db_get_row ($table, $field_search, $condition, $fields = fal
$fields, $table, $field_search, $condition);
}
$result = db_get_all_rows_sql ($sql);
if ($result === false)
return false;
@ -131,11 +131,11 @@ function postgresql_db_get_all_rows_sql ($sql, $search_history_db = false, $cach
global $config;
$history = array ();
if ($dbconnection === false) {
$dbconnection = $config['dbconnection'];
}
// To disable globally SQL cache depending on global variable.
// Used in several critical places like Metaconsole trans-server queries
if (isset($config["dbcache"]))
@ -161,16 +161,17 @@ function postgresql_db_get_all_rows_sql ($sql, $search_history_db = false, $cach
if ($return === false) {
$return = array ();
}
// Append result to the history DB data
if (! empty ($return)) {
foreach ($return as $row) {
array_push ($history, $row);
}
}
if (! empty ($history))
return $history;
//Return false, check with === or !==
return false;
}
@ -247,8 +248,8 @@ function postgresql_db_process_sql($sql, $rettype = "affected_rows", $dbconnecti
$result = $rows;
}
db_add_database_debug_trace ($sql, $result, $rows,
array ('time' => $time));
array ('time' => $time));
return $result;
}
else { //The query IS a select.
@ -308,7 +309,7 @@ function postgresql_db_process_sql_insert($table, $values) {
return false;
$values = (array) $values;
$query = sprintf ('INSERT INTO "%s" ', $table);
$fields = array ();
$values_str = '';
@ -357,7 +358,7 @@ function postgresql_db_process_sql_insert($table, $values) {
*/
function postgresql_escape_string_sql($string) {
$str = pg_escape_string($string);
return $str;
}
@ -389,7 +390,7 @@ function postgresql_escape_string_sql($string) {
function postgresql_db_get_value_filter ($field, $table, $filter, $where_join = 'AND') {
if (! is_array ($filter) || empty ($filter))
return false;
/* Avoid limit and offset if given */
unset ($filter['limit']);
unset ($filter['offset']);
@ -413,7 +414,7 @@ function postgresql_db_get_value_filter ($field, $table, $filter, $where_join =
if ($result === false)
return false;
if (!$is_a_function) {
$fieldClean = str_replace('"', '', $field);
$fieldClean = str_replace('`', '', $fieldClean);
@ -536,7 +537,7 @@ function postgresql_db_format_array_where_clause_sql ($values, $join = 'AND', $p
$group = sprintf (' GROUP BY %s', $values['group']);
unset ($values['group']);
}
$i = 1;
$max = count ($values);
foreach ($values as $field => $value) {
@ -550,7 +551,7 @@ function postgresql_db_format_array_where_clause_sql ($values, $join = 'AND', $p
$i++;
continue;
}
if ($field[0] != "\"") {
//If the field is as <table>.<field>, don't scape.
if (strstr($field, '.') === false)
@ -597,7 +598,7 @@ function postgresql_db_format_array_where_clause_sql ($values, $join = 'AND', $p
}
$i++;
}
return (! empty ($query) ? $prefix: '').$query.$group.$order.$limit.$offset;
}
@ -613,7 +614,7 @@ function postgresql_db_get_value_sql($sql, $dbconnection = false) {
$sql .= " LIMIT 1";
$result = postgresql_db_get_all_rows_sql ($sql, false, true, $dbconnection);
if($result === false)
if ($result === false)
return false;
foreach ($result[0] as $f)
@ -631,7 +632,7 @@ function postgresql_db_get_row_sql ($sql, $search_history_db = false) {
$sql .= " LIMIT 1";
$result = postgresql_db_get_all_rows_sql($sql, $search_history_db);
if($result === false)
if ($result === false)
return false;
return $result[0];
@ -671,7 +672,7 @@ function postgresql_db_get_row_filter ($table, $filter, $fields = false, $where_
else if (! is_string ($fields))
return false;
}
if (is_array ($filter))
$filter = db_format_array_where_clause_sql ($filter, $where_join, ' WHERE ');
else if (is_string ($filter))
@ -680,7 +681,7 @@ function postgresql_db_get_row_filter ($table, $filter, $fields = false, $where_
$filter = '';
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
return db_get_row_sql ($sql);
}
@ -719,7 +720,7 @@ function postgresql_db_get_all_rows_filter ($table, $filter = array(), $fields =
elseif (!is_string($fields)) {
return false;
}
//TODO: Validate and clean filter options
if (is_array ($filter)) {
$filter = db_format_array_where_clause_sql ($filter, $where_join, ' WHERE ');
@ -730,7 +731,7 @@ function postgresql_db_get_all_rows_filter ($table, $filter = array(), $fields =
else {
$filter = '';
}
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
if ($returnSQL)
@ -747,7 +748,7 @@ function postgresql_db_get_all_rows_filter ($table, $filter = array(), $fields =
*/
function postgresql_db_get_num_rows ($sql) {
$result = pg_query($sql);
return pg_num_rows($result);
}
@ -771,10 +772,10 @@ function postgresql_db_get_all_rows_field_filter ($table, $field, $condition, $o
else {
$sql = sprintf ("SELECT * FROM \"%s\" WHERE \"%s\" = '%s'", $table, $field, $condition);
}
if ($order_field != "")
$sql .= sprintf (" ORDER BY %s", $order_field);
return db_get_all_rows_sql ($sql);
}
@ -792,10 +793,10 @@ function postgresql_db_get_all_fields_in_table ($table, $field = '', $condition
if ($condition != '') {
$sql .= sprintf (" WHERE \"%s\" = '%s'", $field, $condition);
}
if ($order_field != "")
$sql .= sprintf (" ORDER BY %s", $order_field);
return db_get_all_rows_sql ($sql);
}
@ -824,7 +825,7 @@ function postgresql_db_get_all_fields_in_table ($table, $field = '', $condition
*/
function postgresql_db_format_array_to_update_sql ($values) {
$fields = array ();
foreach ($values as $field => $value) {
if (is_numeric($field)) {
array_push ($fields, $value);
@ -833,7 +834,7 @@ function postgresql_db_format_array_to_update_sql ($values) {
else if ($field[0] == "`") {
$field = str_replace('`', '', $field);
}
if ($value === NULL) {
$sql = sprintf ("\"%s\" = NULL", $field);
}
@ -853,7 +854,7 @@ function postgresql_db_format_array_to_update_sql ($values) {
}
array_push ($fields, $sql);
}
return implode (", ", $fields);
}
@ -885,7 +886,7 @@ function postgresql_db_process_sql_update($table, $values, $where = false, $wher
$query = sprintf ("UPDATE \"%s\" SET %s",
$table,
db_format_array_to_update_sql ($values));
if ($where) {
if (is_string ($where)) {
// No clean, the caller should make sure all input is clean, this is a raw function
@ -895,7 +896,7 @@ function postgresql_db_process_sql_update($table, $values, $where = false, $wher
$query .= db_format_array_where_clause_sql ($where, $where_join, ' WHERE ');
}
}
return db_process_sql ($query);
}
@ -931,9 +932,9 @@ function postgresql_db_process_sql_delete($table, $where, $where_join = 'AND') {
if (empty ($where))
/* Should avoid any mistake that lead to deleting all data */
return false;
$query = sprintf ("DELETE FROM \"%s\" WHERE ", $table);
if ($where) {
if (is_string ($where)) {
/* FIXME: Should we clean the string for sanity?
@ -944,7 +945,7 @@ function postgresql_db_process_sql_delete($table, $where, $where_join = 'AND') {
$query .= db_format_array_where_clause_sql ($where, $where_join);
}
}
return db_process_sql ($query);
}
@ -961,7 +962,7 @@ function postgresql_db_process_sql_delete($table, $where, $where_join = 'AND') {
function postgresql_db_get_all_row_by_steps_sql($new = true, &$result, $sql = null) {
if ($new == true)
$result = pg_query($sql);
return pg_fetch_assoc($result);
}
@ -1056,16 +1057,16 @@ function postgresql_db_get_type_field_table($table, $field) {
*/
function postgresql_db_get_table_count($sql, $search_history_db = false) {
global $config;
$history_count = 0;
$count = postgresql_db_get_value_sql ($sql);
if ($count === false) {
$count = 0;
}
// Search the history DB for matches
if ($search_history_db && $config['history_db_enabled'] == 1) {
// Connect to the history DB
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
$config['history_db_connection'] = postgresql_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], $config['history_db_pass'], $config['history_db_port'], false);
@ -1077,9 +1078,9 @@ function postgresql_db_get_table_count($sql, $search_history_db = false) {
}
}
}
$count += $history_count;
return $count;
}

View File

@ -138,48 +138,6 @@ function safe_url_extraclean ($string, $default_string = '') {
return $string;
}
/**
* DEPRECATED: This function is not used anywhere. Remove it?
* (use general/noaccess.php followed by exit instead)
*/
function no_permission () {
require ("config.php");
ui_print_error_message(__('You don\'t have access'));
echo html_print_image('images/noaccess.png', true, array("alt" => 'No access', "width" => '120')) . "<br /><br />";
echo "<table width=550>";
echo "<tr><td>";
echo __('You don\'t have enough permission to access this resource');
echo "</table>";
echo "<tr><td><td><td><td>";
include "general/footer.php";
exit;
}
/**
* DEPRECATED: This function is not used anywhere. Remove it?
* (use print_error function instead followed by return or exit)
*
* @param string $error Aditional error string to be shown. Blank by default
*/
function unmanaged_error ($error = "") {
require_once ("config.php");
ui_print_error_message(__('Unmanaged error'));
echo html_print_image('images/error.png', true, array("alt" => 'error')) . "<br /><br />";
echo "<table width=550>";
echo "<tr><td>";
echo __('Unmanaged error');
echo "<tr><td>";
echo $error;
echo "</table>";
echo "<tr><td><td><td><td>";
include "general/footer.php";
exit;
}
/**
* List files in a directory in the local path.
*
@ -1775,10 +1733,11 @@ function is_snapshot_data ($data) {
/**
* Create an invisible div with a provided ID and value to
* can retrieve it from javascript with function get_php_value(value)
* can retrieve it from javascript with function get_php_value(name)
*/
function set_js_value($name, $value) {
html_print_div(array('id' => 'php_to_js_value_' . $name, 'content' => $value, 'hidden' => true));
html_print_div(array('id' => 'php_to_js_value_' . $name,
'content' => json_encode($value), 'hidden' => true));
}

View File

@ -31,7 +31,7 @@ function categories_delete_category ($id_category) {
// Change the elements of this category to "without category"
db_process_sql_update('tagente_modulo', array('id_category' => 0), array('id_category' => $id_category));
db_process_sql_update('tnetwork_component', array('id_category' => 0), array('id_category' => $id_category));
if(enterprise_installed()) {
if (enterprise_installed()) {
db_process_sql_update('tlocal_component', array('id_category' => 0), array('id_category' => $id_category));
db_process_sql_update('tpolicy_modules', array('id_category' => 0), array('id_category' => $id_category));
}

View File

@ -17,7 +17,7 @@
function treeview_printModuleTable($id_module, $server_data = false) {
global $config;
if(empty($server_data)) {
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
@ -40,9 +40,9 @@ function treeview_printModuleTable($id_module, $server_data = false) {
enterprise_include_once ('meta/include/functions_metaconsole.php');
$filter["id_agente_modulo"] = $id_module;
$module = db_get_row_filter ("tagente_modulo", $filter);
if ($module === false) {
ui_print_error_message(__('There was a problem loading module'));
return;
@ -50,7 +50,7 @@ function treeview_printModuleTable($id_module, $server_data = false) {
if (! check_acl ($config["id_user"], $module["id_grupo"], "AR")) {
db_pandora_audit("ACL Violation",
"Trying to access Module Information");
"Trying to access Module Information");
require_once ("general/noaccess.php");
return;
}
@ -108,13 +108,13 @@ function treeview_printModuleTable($id_module, $server_data = false) {
// Tags
$tags = tags_get_module_tags($module['id_agente_modulo']);
if(empty($tags)) {
if (empty($tags)) {
$tags = array();
}
foreach($tags as $k => $v) {
foreach ($tags as $k => $v) {
$tag_name = tags_get_name($v);
if(empty($tag_name)) {
if (empty($tag_name)) {
unset($tags[$k]);
}
else {
@ -122,16 +122,16 @@ function treeview_printModuleTable($id_module, $server_data = false) {
}
}
if(empty($tags)) {
if (empty($tags)) {
$tags = '<i>' . __('N/A') . '</i>';
}
else {
$tags = implode(', ' , $tags);
}
echo '<tr><td class="datos"><b>'.__('Tags').'</b></td>';
echo '<td class="datos" colspan="2">' . $tags . '</td></tr>';
// Data
$last_data = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $module['id_agente_modulo'], 'order' => array('field' => 'id_agente_estado', 'order' => 'DESC')));
if (is_numeric($last_data["datos"]))
@ -141,15 +141,15 @@ function treeview_printModuleTable($id_module, $server_data = false) {
echo '<tr><td class="datos"><b>'.__('Last data').'</b></td>';
echo '<td class="datos" colspan="2">';
if (!empty($last_data['utimestamp'])) {
echo $data;
if ($module['unit'] != '') {
echo "&nbsp;";
echo '('.$module['unit'].')';
}
echo "&nbsp;";
html_print_image('images/clock2.png', false, array('title' => $last_data["timestamp"], 'width' => '18px'));
}
@ -189,7 +189,7 @@ function treeview_printModuleTable($id_module, $server_data = false) {
function treeview_printAlertsTable($id_module, $server_data = array()) {
global $config;
if(empty($server_data)) {
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
@ -226,7 +226,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
echo '<td class="datos">'.$template_name.'</td>';
$actions = alerts_get_alert_agent_module_actions($module_alert['id']);
echo '<td class="datos">';
if(empty($actions)) {
if (empty($actions)) {
echo '<i>'.__('N/A').'</i>';
}
else {
@ -242,7 +242,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
}
echo '</table>';
if(can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) {
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) {
// Actions table
echo '<div style="width:90%; text-align: right; min-width: 300px;">';
echo '<form id="agent_detail" method="post" action="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name=' . $module_name . '&id_agente=' . $agent_id . $url_hash . '" target="_blank">';
@ -255,7 +255,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
function treeview_printTable($id_agente, $server_data = array()) {
global $config;
if(empty($server_data)) {
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
@ -283,7 +283,7 @@ function treeview_printTable($id_agente, $server_data = array()) {
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
if($is_extra === ENTERPRISE_NOT_HOOK) {
if ($is_extra === ENTERPRISE_NOT_HOOK) {
$is_extra = false;
}
@ -313,8 +313,8 @@ function treeview_printTable($id_agente, $server_data = array()) {
$addresses = agents_get_addresses ($id_agente);
$address = agents_get_address($id_agente);
foreach($addresses as $k => $add) {
if($add == $address) {
foreach ($addresses as $k => $add) {
if ($add == $address) {
unset($addresses[$k]);
}
}
@ -590,7 +590,7 @@ function treeview_getData ($type) {
$avariableGroups = array_intersect_key($avariableGroups, $fgroups);
$avariableGroupsIds = implode(',',array_keys($avariableGroups));
if($avariableGroupsIds == '') {
if ($avariableGroupsIds == '') {
$avariableGroupsIds == -1;
}
@ -874,7 +874,7 @@ function treeview_getData ($type) {
default:
case 'module':
$avariableGroupsIds = implode(',',array_keys($avariableGroups));
if($avariableGroupsIds == ''){
if ($avariableGroupsIds == ''){
$avariableGroupsIds == -1;
}
@ -926,7 +926,7 @@ function treeview_getData ($type) {
case 'tag':
// Restrict the tags showed to the user tags
$user_tags = tags_get_user_tags();
if(empty($user_tags)) {
if (empty($user_tags)) {
$user_tags_sql = ' AND 1 = 0';
}
else {
@ -953,7 +953,7 @@ function treeview_getData ($type) {
break;
}
if($list == false) {
if ($list == false) {
$list = array();
}
@ -1041,7 +1041,7 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
//TODO CHANGE POLICY ACL FOR TAG ACL
$extra_sql = '';
if($extra_sql != '') {
if ($extra_sql != '') {
$extra_sql .= ' OR';
}
$groups_sql = implode(', ', $avariableGroupsIds);
@ -1184,7 +1184,7 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
return false;
}
if(empty($groups_sql)) {
if (empty($groups_sql)) {
$groups_condition = ' AND 1 = 0';
}
else {

View File

@ -20,7 +20,7 @@
*/
// Check to avoid error when load this library in error screen situations
if(isset($config['homedir'])) {
if (isset($config['homedir'])) {
require_once($config['homedir'] . '/include/functions_agents.php');
require_once($config['homedir'] . '/include/functions_modules.php');
require_once($config['homedir'] . '/include/functions.php');
@ -474,7 +474,7 @@ function ui_print_tags_warning ($return = false) {
$msg .= __("Is possible that this view uses part of information which your user has not access");
$msg .= '</div>';
if($return) {
if ($return) {
return $msg;
}
else {
@ -535,12 +535,12 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
* @return string HTML code if return parameter is true.
*/
function ui_print_group_icon_path ($id_group, $return = false, $path = "images/groups_small", $style='', $link = true) {
if($id_group > 0)
if ($id_group > 0)
$icon = (string) db_get_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group);
else
$icon = "world";
if($style == '')
if ($style == '')
$style = 'width: 16px; height: 16px;';
$output = '';
@ -593,7 +593,7 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin =
$output = html_print_image("images/" . $subfolter . "/" . $icon, true, $options, true, $relative);
}
else {
if(!isset($options['title'])) {
if (!isset($options['title'])) {
$options['title'] = $os_name;
}
$output = html_print_image("images/" . $subfolter . "/" . $icon, true, $options, false, $relative);
@ -627,7 +627,7 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin =
* @return string HTML with agent name and link
*/
function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_medium', $style = '', $cutname = false, $server_url = '', $extra_params = '', $known_agent_name = false) {
if($known_agent_name === false) {
if ($known_agent_name === false) {
$agent_name = (string) agents_get_name ($id_agent);
}
else {
@ -669,7 +669,7 @@ function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_mediu
function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = false) {
global $config;
if(!isset($alert['server_data'])) {
if (!isset($alert['server_data'])) {
$server_name = '';
$server_id = '';
$url_hash = '';
@ -1004,7 +1004,7 @@ function ui_print_help_icon ($help_id, $return = false, $home_url = '', $image =
if (empty($home_url))
$home_url = "";
if(defined('METACONSOLE')) {
if (defined('METACONSOLE')) {
$home_url = "../../" . $home_url;
}
@ -1855,7 +1855,7 @@ function ui_get_status_images_path () {
* @return string HTML code if return parameter is true.
*/
function ui_print_status_image ($type, $title = "", $return = false, $options = false, $path = false) {
if($path === false) {
if ($path === false) {
list ($imagepath) = ui_get_status_images_path ();
}
else {
@ -1864,7 +1864,7 @@ function ui_print_status_image ($type, $title = "", $return = false, $options =
$imagepath .= "/" . $type;
if($options === false) {
if ($options === false) {
$options = array();
}
@ -2184,7 +2184,7 @@ function ui_print_page_header ($title, $icon = "", $return = false, $help = "",
if (is_array($options)) {
$buffer .= '<div id="menu_tab"><ul class="mn">';
foreach ($options as $key => $option) {
if(empty($option)) {
if (empty($option)) {
continue;
}
else if ($key === 'separator') {
@ -3309,7 +3309,7 @@ function ui_get_error ($error_code) {
$message .= db_get_last_error();
$message .= '</span>';
if($error_code == 'error_authconfig') {
if ($error_code == 'error_authconfig') {
$message .= '<br/><br/>';
$message .= __('If you have modified auth system, this problem could be because Pandora cannot override authorization variables from the config database. Remove them from your database by executing:<br><pre>DELETE FROM tconfig WHERE token = "auth";</pre>');
}

View File

@ -13,40 +13,6 @@
$ttl = 1;
$homeurl = '';
/*function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
global $ttl;
global $homeurl;
$ttl = $serialize_ttl;
$homeurl = $home_url;
include_once($homeurl . 'include/functions.php');
include_once($homeurl . 'include/functions_html.php');
include_once($homeurl . 'include/graphs/functions_fsgraph.php');
include_once($homeurl . 'include/graphs/functions_gd.php');
include_once($homeurl . 'include/graphs/functions_utils.php');
}*/
/*
// If is called from index
if(file_exists('include/functions.php')) {
include_once('include/functions.php');
include_once('include/graphs/functions_fsgraph.php');
include_once('include/graphs/functions_utils.php');
} // If is called through url
else if(file_exists('../functions.php')) {
include_once('../functions.php');
include_once('../functions_html.php');
include_once('functions_fsgraph.php');
include_once('functions_gd.php');
include_once('functions_utils.php');
}
include_once('functions_fsgraph.php');
include_once('functions_utils.php');
*/
if (isset($_GET['homeurl'])) {
$homeurl = $_GET['homeurl'];
}
@ -197,7 +163,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if($flash_chart) {
if ($flash_chart) {
return flot_vcolumn_chart ($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, $homedir, $reduce_data_columns, $adapt_key);
}
else {
@ -285,7 +251,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
return '<img src="' . $no_data_image . '" />';
}
if($flash_chart) {
if ($flash_chart) {
return flot_area_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url);
}
else {
@ -321,7 +287,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
}
if($flash_chart) {
if ($flash_chart) {
return flot_line_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url);
}
else {
@ -356,7 +322,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
return '<img src="' . $no_data_image . '" />';
}
if($flash_chart) {
if ($flash_chart) {
return flot_line_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url);
}
else {
@ -407,7 +373,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if($flash_chart) {
if ($flash_chart) {
if ($return){
return flot_hcolumn_chart ($chart_data, $width, $height, $water_mark_url);
}

View File

@ -14,23 +14,23 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/* Function that includes all graph dependencies */
function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
global $config;
global $ttl;
global $homeurl;
$ttl = $serialize_ttl;
$homeurl = $home_url;
include_once($homeurl . 'include/functions_io.php');
include_once($homeurl . 'include/functions.php');
include_once($homeurl . 'include/functions_html.php');
if($config['flash_charts'] && !defined('AJAX') && !get_parameter('static_graph',0)) {
include_once($homeurl . 'include/graphs/functions_flot.php');
}
include_once($homeurl . 'include/graphs/functions_gd.php');
include_once($homeurl . 'include/graphs/functions_utils.php');
}
/* Function that includes all graph dependencies */
function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
global $config;
global $ttl;
global $homeurl;
$ttl = $serialize_ttl;
$homeurl = $home_url;
include_once($homeurl . 'include/functions_io.php');
include_once($homeurl . 'include/functions.php');
include_once($homeurl . 'include/functions_html.php');
if ($config['flash_charts'] && !defined('AJAX') && !get_parameter('static_graph',0)) {
include_once($homeurl . 'include/graphs/functions_flot.php');
}
include_once($homeurl . 'include/graphs/functions_gd.php');
include_once($homeurl . 'include/graphs/functions_utils.php');
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -111,7 +111,7 @@
config.callbackPre ();
// Get the selected item from hidden field
selected = $('#hidden-'+config.moduleSelect.attr('id')+'_selected').val();
if(selected == i) {
if (selected == i) {
option = $("<option></option>")
.attr ("selected", "selected")
.attr ("value", value['id_agente_modulo'])

View File

@ -58,7 +58,7 @@ function js_html_entity_decode (str) {
*/
Array.prototype.in_array = function () {
for (var j in this) {
if(this[j] == arguments[0])
if (this[j] == arguments[0])
return true;
}
@ -794,5 +794,5 @@ function hidded_sidebar(position, menuW, menuH, icon_width, top_dist, autotop, r
// Function that recover a previously stored value from php code
function get_php_value(value) {
return $('#php_to_js_value_' + value).html();
return $.parseJSON($('#php_to_js_value_' + value).html());
}

View File

@ -2,7 +2,7 @@
function show_event_dialog(event_id, group_rep, dialog_page, result) {
var ajax_file = $('#hidden-ajax_file').val();
if(dialog_page == undefined) {
if (dialog_page == undefined) {
dialog_page = 'general';
}
@ -121,7 +121,7 @@ function execute_response(event_id, server_id) {
var response = get_response(response_id);
// If cannot get response abort it
if(response == null) {
if (response == null) {
return;
}
@ -132,7 +132,7 @@ function execute_response(event_id, server_id) {
show_response_dialog(event_id, response_id, response);
break;
case 'url':
if(response['new_window'] == 1) {
if (response['new_window'] == 1) {
window.open(response['target'],'_blank');
}
else {