2013-05-21 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php, include/functions.php: improved the source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8180 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ac4d5799d8
commit
3ed70944e4
|
@ -1,3 +1,8 @@
|
|||
2013-05-21 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_reporting.php, include/functions.php: improved
|
||||
the source code style.
|
||||
|
||||
2013-05-21 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_modules.php: fixed false error when update the
|
||||
|
|
|
@ -326,7 +326,7 @@ function human_time_comparation ($timestamp, $units = 'large') {
|
|||
// $seconds could be negative, because get_system_time() could return cached value
|
||||
// (that might be the time a session begins at).
|
||||
// So negative values are to be rounded off to 'NOW'.
|
||||
if( $seconds < 0 ) {
|
||||
if ( $seconds < 0 ) {
|
||||
$seconds = 0;
|
||||
}
|
||||
|
||||
|
@ -369,11 +369,11 @@ function get_user_language ($id_user = null) {
|
|||
if ($quick_language) {
|
||||
$language = get_parameter('language', 0);
|
||||
|
||||
if($language === 'default') {
|
||||
if ($language === 'default') {
|
||||
return $config['language'];
|
||||
}
|
||||
|
||||
if($language !== 0) {
|
||||
if ($language !== 0) {
|
||||
return $language;
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ function get_user_language ($id_user = null) {
|
|||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
||||
if($id_user !== null) {
|
||||
if ($id_user !== null) {
|
||||
$userinfo = get_user_info ($id_user);
|
||||
if ($userinfo['language'] != 'default'){
|
||||
return $userinfo['language'];
|
||||
|
@ -494,34 +494,37 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
|||
if ($mins != 0) {
|
||||
$seconds = $seconds - ($mins * 60);
|
||||
|
||||
if($hours == 0) {
|
||||
if ($hours == 0) {
|
||||
$returnTime .= "$mins $minutesString ";
|
||||
}
|
||||
else {
|
||||
$returnTime = sprintf("%02d",$hours).':'.sprintf("%02d",$mins);
|
||||
$returnTime = sprintf("%02d",$hours) . ':' .
|
||||
sprintf("%02d",$mins);
|
||||
}
|
||||
}
|
||||
|
||||
if ($seconds != 0) {
|
||||
if($hours == 0) {
|
||||
if ($hours == 0) {
|
||||
$returnTime .= "$seconds $secondsString ";
|
||||
}
|
||||
else {
|
||||
$returnTime = sprintf("%02d",$hours).':'.sprintf("%02d",$mins).':'.sprintf("%02d",$seconds);
|
||||
$returnTime = sprintf("%02d",$hours) . ':' .
|
||||
sprintf("%02d",$mins) . ':' .
|
||||
sprintf("%02d",$seconds);
|
||||
}
|
||||
}
|
||||
|
||||
$return = ' ';
|
||||
|
||||
if($returnDate != '') {
|
||||
if ($returnDate != '') {
|
||||
$return = $returnDate;
|
||||
}
|
||||
|
||||
if($returnTime != '') {
|
||||
if ($returnTime != '') {
|
||||
$return .= $returnTime;
|
||||
}
|
||||
|
||||
if($return == ' ') {
|
||||
if ($return == ' ') {
|
||||
return $nowString;
|
||||
}
|
||||
else {
|
||||
|
@ -634,7 +637,7 @@ function get_parameter_checkbox ($name, $default = '') {
|
|||
$sent = get_parameter($name.'_sent', 0);
|
||||
|
||||
// If is not sent, return the default
|
||||
if(!$sent) {
|
||||
if (!$sent) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
|
@ -1156,7 +1159,7 @@ function is_ajax () {
|
|||
* @return bool true if a result code is an error or false otherwise
|
||||
*/
|
||||
function is_error($code) {
|
||||
if($code !== true AND ($code <= ERR_GENERIC || $code === false)) {
|
||||
if ($code !== true AND ($code <= ERR_GENERIC || $code === false)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -1530,7 +1533,7 @@ function check_acl($id_user, $id_group, $access, $id_agent = 0) {
|
|||
$acl_column = get_acl_column($access);
|
||||
foreach ($rowdup as $row) {
|
||||
// For each profile for this pair of group and user do...
|
||||
if(isset($row[$acl_column])) {
|
||||
if (isset($row[$acl_column])) {
|
||||
$result += $row[$acl_column];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1437,9 +1437,9 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
|
|||
//Show empty groups only if they have children with agents
|
||||
//$group_array = array();
|
||||
|
||||
foreach($children as $sub) {
|
||||
foreach ($children as $sub) {
|
||||
// If the group is quering previously, we ingore it
|
||||
if(!in_array($sub['id_grupo'],$covered_groups)){
|
||||
if (!in_array($sub['id_grupo'],$covered_groups)){
|
||||
array_push($covered_groups, $sub['id_grupo']);
|
||||
array_push($group_array, $sub['id_grupo']);
|
||||
}
|
||||
|
@ -1468,8 +1468,8 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
|
|||
$tags_restricted_groups = array_keys($group_restricted_data);
|
||||
|
||||
$no_tags_restricted_groups = $group_array;
|
||||
foreach($no_tags_restricted_groups as $k => $v) {
|
||||
if(in_array($v, $tags_restricted_groups)) {
|
||||
foreach ($no_tags_restricted_groups as $k => $v) {
|
||||
if (in_array($v, $tags_restricted_groups)) {
|
||||
unset($no_tags_restricted_groups[$k]);
|
||||
}
|
||||
}
|
||||
|
@ -2771,7 +2771,7 @@ function reporting_get_agent_module_info ($id_agent, $filter = false) {
|
|||
return $return;
|
||||
}
|
||||
|
||||
if($filter != ''){
|
||||
if ($filter != '') {
|
||||
$filter = 'AND ';
|
||||
}
|
||||
|
||||
|
@ -2915,9 +2915,9 @@ function reporting_header_content($mini, $content, $report, &$table, $title = fa
|
|||
if ($period !== false && $content['period'] > 0) {
|
||||
$data[] = $sizh . $period . $sizhfin;
|
||||
}
|
||||
else if($content['period'] == 0) {
|
||||
else if ($content['period'] == 0) {
|
||||
$es = json_decode($content['external_source'], true);
|
||||
if($es['date'] == 0) {
|
||||
if ($es['date'] == 0) {
|
||||
$date = __('Last data');
|
||||
}
|
||||
else {
|
||||
|
@ -3845,7 +3845,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
// Do a security check on SQL coming from the user
|
||||
$sql = check_sql ($sql);
|
||||
|
||||
if($sql != '') {
|
||||
if ($sql != '') {
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
if ($result === false) {
|
||||
$result = array();
|
||||
|
@ -4323,7 +4323,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
// Get events of the last 8 hours
|
||||
$events = events_get_group_events ($content['id_group'], 28800, $report['datetime']);
|
||||
|
||||
if($events === false) {
|
||||
if ($events === false) {
|
||||
$events = array();
|
||||
}
|
||||
|
||||
|
@ -5605,7 +5605,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$filter_groups = array ('offset' => (int) $offset,
|
||||
'limit' => (int) $config['block_size']);
|
||||
|
||||
if($id_group > 0) {
|
||||
if ($id_group > 0) {
|
||||
$filter_groups['id_grupo'] = $id_group;
|
||||
}
|
||||
|
||||
|
@ -5626,10 +5626,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$nmodules = 0;
|
||||
foreach ($modules_by_name as $module) {
|
||||
$nmodules++;
|
||||
// Don't use pagination
|
||||
/*if($nmodules > $block) { //Will show only the (block) first modules
|
||||
continue;
|
||||
}*/
|
||||
|
||||
$file_name = string2image(ui_print_truncate_text($module['name'], 'module_small', false, true, false, '...'), false, false, 6, 270, '#90B165', 'FFF', 4, 0);
|
||||
$table_data .= '<th width="22px">' . html_print_image($file_name, true, array('title' => $module['name']))."</th>";
|
||||
|
@ -5721,7 +5717,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
}
|
||||
}
|
||||
|
||||
if(!$match) {
|
||||
if (!$match) {
|
||||
$table_data .= "<td style='background-color: #DDD;'></td>";
|
||||
}
|
||||
}
|
||||
|
@ -5811,7 +5807,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
|
||||
$table->colspan[1][0] = 2;
|
||||
|
||||
if($description != '') {
|
||||
if ($description != '') {
|
||||
$data[0] = $description;
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
@ -5936,9 +5932,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
modules_get_status($id_agent_module, $module_status['estado'], $module_status['datos'], $status, $title);
|
||||
$data[9] = ui_print_status_image($status, $title, true);
|
||||
|
||||
$sql_tag = "SELECT name FROM ttag WHERE id_tag IN (
|
||||
SELECT id_tag FROM ttag_module
|
||||
WHERE id_agente_modulo=$id_agent_module)";
|
||||
$sql_tag = "SELECT name
|
||||
FROM ttag
|
||||
WHERE id_tag IN (
|
||||
SELECT id_tag
|
||||
FROM ttag_module
|
||||
WHERE id_agente_modulo = $id_agent_module)";
|
||||
$tags = db_get_all_rows_sql($sql_tag);
|
||||
if ($tags === false)
|
||||
$tags = '';
|
||||
|
@ -6088,9 +6087,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
modules_get_status($id_agent_module, $module_status['estado'], $module_status['datos'], $status, $title);
|
||||
$data[9] = ui_print_status_image($status, $title, true);
|
||||
|
||||
$sql_tag = "SELECT name FROM ttag WHERE id_tag IN (
|
||||
SELECT id_tag FROM ttag_module
|
||||
WHERE id_agente_modulo=$id_agent_module)";
|
||||
$sql_tag = "SELECT name
|
||||
FROM ttag
|
||||
WHERE id_tag IN (
|
||||
SELECT id_tag
|
||||
FROM ttag_module
|
||||
WHERE id_agente_modulo = $id_agent_module)";
|
||||
$tags = db_get_all_rows_sql($sql_tag);
|
||||
if ($tags === false)
|
||||
$tags = '';
|
||||
|
@ -6126,7 +6128,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$start_date = $end_date - $period;
|
||||
|
||||
// Get item filters
|
||||
$filter = db_get_row_sql("SELECT * FROM tnetflow_filter WHERE id_sg = '" . (int)$content['text'] . "'", false, true);
|
||||
$filter = db_get_row_sql("SELECT *
|
||||
FROM tnetflow_filter
|
||||
WHERE id_sg = '" . (int)$content['text'] . "'", false, true);
|
||||
if ($description == '') {
|
||||
$description = $filter['id_name'];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue