Solved a problem with autorefresh URL. This fixes problem on refreshing the same URL for a long time (p.e: 4 hours). Problem was the filename was not passed, and this, in someway, makes the whole system to add parameters to the right until it too long and breaks it.

To avoid other problems, I've added a safe check to see if coming URL contains "index.php" before adding it. Tested on several subcomponents and works.
This commit is contained in:
Sancho Lerena 2015-01-08 19:05:43 +01:00
parent f45c09259e
commit 9fb1e879f3

View File

@ -1216,7 +1216,7 @@ function ui_process_page_head ($string, $bitfield) {
$_GET['sec2'] == 'operation/snmpconsole/snmp_view' || $_GET['sec2'] == 'operation/snmpconsole/snmp_view' ||
$_GET['sec2'] == 'enterprise/dashboard/main_dashboard') { $_GET['sec2'] == 'enterprise/dashboard/main_dashboard') {
$query = ui_get_url_refresh (false); $query = ui_get_url_refresh (false, false);
$output .= '<meta http-equiv="refresh" content="' . $output .= '<meta http-equiv="refresh" content="' .
$config_refr . '; URL=' . $query . '" />'; $config_refr . '; URL=' . $query . '" />';
@ -1229,8 +1229,8 @@ function ui_process_page_head ($string, $bitfield) {
<meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="resource-type" content="document" /> <meta name="resource-type" content="document" />
<meta name="distribution" content="global" /> <meta name="distribution" content="global" />
<meta name="author" content="Sancho Lerena" /> <meta name="author" content="Pandora FMS Developer team" />
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and others" /> <meta name="copyright" content="(c) Artica Soluciones Tecnologicas" />
<meta name="keywords" content="pandora, monitoring, system, GPL, software" /> <meta name="keywords" content="pandora, monitoring, system, GPL, software" />
<meta name="robots" content="index, follow" /> <meta name="robots" content="index, follow" />
<link rel="icon" href="images/pandora.ico" type="image/ico" /> <link rel="icon" href="images/pandora.ico" type="image/ico" />
@ -2038,7 +2038,12 @@ function ui_toggle($code, $name, $title = '', $hidden_default = true, $return =
function ui_get_url_refresh ($params = false, $relative = true, $add_post = true) { function ui_get_url_refresh ($params = false, $relative = true, $add_post = true) {
// Agent selection filters and refresh // Agent selection filters and refresh
global $config; global $config;
// slerena, 8/Ene/2015 - Need to put index.php on URL which have it.
if (strpos($_SERVER['REQUEST_URI'], 'index.php') === false)
$url = ''; $url = '';
else
$url = 'index.php';
if (sizeof ($_REQUEST)) { if (sizeof ($_REQUEST)) {
//Some (old) browsers don't like the ?&key=var //Some (old) browsers don't like the ?&key=var
@ -2118,6 +2123,7 @@ function ui_get_url_refresh ($params = false, $relative = true, $add_post = true
} }
$url = htmlspecialchars ($url); $url = htmlspecialchars ($url);
if (! $relative) { if (! $relative) {
return ui_get_full_url ($url); return ui_get_full_url ($url);
} }