2012-02-24 Miguel de Dios <miguel.dedios@artica.es>
* pandora_console/include/functions_ui.php: changed the source code into the function "ui_get_full_url" for accept false for to return url with the home url or with any string (as query) return url with the php file. * pandora_console/include/functions_graph.php, pandora_console/include/functions_html.php, pandora_console/include/functions_events.php, pandora_console/include/functions_reporting.php, pandora_console/include/functions_api.php, pandora_console/include/functions.php, pandora_console/index.php, pandora_console/extensions/system_info.php, pandora_console/operation/agentes/stat_win.php, pandora_console/operation/menu.php, pandora_console/operation/events/events_rss.php, pandora_console/operation/events/events_marquee.php, pandora_console/operation/events/events.php: change in more part of source code to use "ui_get_full_url" instead the hard write method of $_SERVER vars, now Pandora Console run fine (in all actions I hope) with web servers in other ports instead the typical 80. Merged from branch pandora_4.0 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5646 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
29350a4a0a
commit
edf3b1cf9a
|
@ -1,3 +1,27 @@
|
|||
2012-02-24 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* pandora_console/include/functions_ui.php: changed the source code into the
|
||||
function "ui_get_full_url" for accept false for to return url with the home
|
||||
url or with any string (as query) return url with the php file.
|
||||
|
||||
* pandora_console/include/functions_graph.php,
|
||||
pandora_console/include/functions_html.php,
|
||||
pandora_console/include/functions_events.php,
|
||||
pandora_console/include/functions_reporting.php,
|
||||
pandora_console/include/functions_api.php,
|
||||
pandora_console/include/functions.php, pandora_console/index.php,
|
||||
pandora_console/extensions/system_info.php,
|
||||
pandora_console/operation/agentes/stat_win.php,
|
||||
pandora_console/operation/menu.php,
|
||||
pandora_console/operation/events/events_rss.php,
|
||||
pandora_console/operation/events/events_marquee.php,
|
||||
pandora_console/operation/events/events.php: change in more part of source
|
||||
code to use "ui_get_full_url" instead the hard write method of $_SERVER
|
||||
vars, now Pandora Console run fine (in all actions I hope) with web servers
|
||||
in other ports instead the typical 80.
|
||||
|
||||
Merged from branch pandora_4.0
|
||||
|
||||
2012-02-24 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions.php: clean source style.
|
||||
|
|
|
@ -323,14 +323,9 @@ function mainSystemInfo() {
|
|||
$zipArchive = $config['attachment_store'] . '/last_info.zip';
|
||||
@unlink($zipArchive);
|
||||
|
||||
if ($config['https']) {
|
||||
$http = 'https://';
|
||||
}
|
||||
else {
|
||||
$http = "http://";
|
||||
}
|
||||
$url_zip = ui_get_full_url(false);
|
||||
|
||||
$url = '<a href="' .$http.$_SERVER['HTTP_HOST'].$config["homeurl"].'/attachment/last_info.zip">' . __('System info file zipped') . '</a>';
|
||||
$url = '<a href="' .$url_zip . 'attachment/last_info.zip">' . __('System info file zipped') . '</a>';
|
||||
echo '<b>' . __('File:') . '</b> ' . $url . '<br />';
|
||||
echo '<b>' . __('Location:') . '</b> ' . $zipArchive;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ require_once('functions_agents.php');
|
|||
require_once('functions_modules.php');
|
||||
include_once($config['homedir'] . "/include/functions_profile.php");
|
||||
include_once($config['homedir'] . "/include/functions.php");
|
||||
include_once($config['homedir'] . "/include/functions_ui.php");
|
||||
include_once($config['homedir'] . "/include/functions_events.php");
|
||||
include_once($config['homedir'] . "/include/functions_groups.php");
|
||||
include_once($config['homedir'] . "/include/functions_network_components.php");
|
||||
|
@ -4576,14 +4577,8 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
|
|||
$row['description_event'] = events_print_type_description($row["event_type"], true);
|
||||
$row['img_description'] = events_print_type_img ($row["event_type"], true, true);
|
||||
$row['criticity_name'] = get_priority_name ($row["criticity"]);
|
||||
if ($config['https']) {
|
||||
$urlImage = 'https://';
|
||||
}
|
||||
else {
|
||||
$urlImage = "http://";
|
||||
}
|
||||
|
||||
$urlImage = $urlImage.$_SERVER['HTTP_HOST'].$config["homeurl"];
|
||||
$urlImage = ui_get_full_url(false);
|
||||
switch ($row["criticity"]) {
|
||||
default:
|
||||
case 0:
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
include_once("include/functions_ui.php");
|
||||
|
||||
/**
|
||||
* @package Include
|
||||
* @subpackage Events
|
||||
|
@ -468,14 +470,7 @@ function events_print_type_img ($type, $return = false, $only_url = false) {
|
|||
|
||||
$output = '';
|
||||
|
||||
if ($config['https']) {
|
||||
$urlImage = 'https://';
|
||||
}
|
||||
else {
|
||||
$urlImage = "http://";
|
||||
}
|
||||
|
||||
$urlImage = $urlImage.$_SERVER['HTTP_HOST'].$config["homeurl"];
|
||||
$urlImage = ui_get_full_url(false);
|
||||
|
||||
switch ($type) {
|
||||
case "alert_recovered":
|
||||
|
|
|
@ -33,6 +33,8 @@ if (!isset($config)) {
|
|||
|
||||
require_once ($config['homedir'].'/include/functions_users.php');
|
||||
require_once ($config['homedir'].'/include/functions_groups.php');
|
||||
require_once ($config['homedir'].'/include/functions_ui.php');
|
||||
|
||||
|
||||
/**
|
||||
* Prints the print_r with < pre > tags
|
||||
|
@ -1139,10 +1141,14 @@ function html_print_image ($src, $return = false, $options = false, $return_src
|
|||
if ($skin_path)
|
||||
$src = $skin_path;
|
||||
}
|
||||
|
||||
// path to image (relative or absolute)
|
||||
$src = ($relative? '' : $config["homeurl"] . '/') . $src;
|
||||
|
||||
|
||||
if (!$relative) {
|
||||
$urlImage = ui_get_full_url(false);
|
||||
|
||||
// path to image
|
||||
$src = $urlImage . $src;
|
||||
}
|
||||
|
||||
// Only return src field of image
|
||||
if ($return_src) {
|
||||
if (!$return) {
|
||||
|
|
|
@ -33,6 +33,7 @@ include_once($config['homedir'] . "/include/functions_alerts.php");
|
|||
include_once($config['homedir'] . '/include/functions_users.php');
|
||||
enterprise_include_once ('include/functions_metaconsole.php');
|
||||
include_once($config['homedir'] . "/include/functions_forecast.php");
|
||||
include_once($config['homedir'] . "/include/functions_ui.php");
|
||||
|
||||
/**
|
||||
* Get the average value of an agent module in a period of time.
|
||||
|
@ -2355,11 +2356,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$table->colspan[1][0] = 3;
|
||||
$data = array ();
|
||||
|
||||
$urlImage = 'http://';
|
||||
if ($config['https']) {
|
||||
$urlImage = 'https://';
|
||||
}
|
||||
$urlImage .= $_SERVER['SERVER_NAME'] . $config['homeurl'] . '/';
|
||||
$urlImage = ui_get_full_url(false);
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
$data[0] = graphic_combined_module(
|
||||
|
|
|
@ -1676,31 +1676,27 @@ function ui_get_url_refresh ($params = false, $relative = true, $add_post = true
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a full URL in Pandora.
|
||||
* Returns a full URL in Pandora. (with the port and https in some systems)
|
||||
*
|
||||
* An example of full URL is http:/localhost/pandora_console/index.php?sec=gsetup&sec2=godmode/setup/setup
|
||||
*
|
||||
* @param string If provided, it will be added after the index.php
|
||||
* @param mixed $url If provided, it will be added after the index.php, but it is false boolean value, put the homeurl in the url.
|
||||
*
|
||||
* @return string A full URL in Pandora.
|
||||
*/
|
||||
function ui_get_full_url ($url = false) {
|
||||
function ui_get_full_url ($url = '') {
|
||||
global $config;
|
||||
|
||||
$was_empty = false;
|
||||
if (empty ($url)) {
|
||||
$was_empty = true;
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
|
||||
if ($config['https']) {
|
||||
//When $config["https"] is set, always force https
|
||||
$protocol = 'https';
|
||||
$ssl = true;
|
||||
} elseif (isset ($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === true || $_SERVER['HTTPS'] == 'on')) {
|
||||
}
|
||||
elseif (isset ($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === true || $_SERVER['HTTPS'] == 'on')) {
|
||||
$protocol = 'https';
|
||||
$ssl = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$protocol = 'http';
|
||||
$ssl = false;
|
||||
}
|
||||
|
@ -1711,14 +1707,20 @@ function ui_get_full_url ($url = false) {
|
|||
$fullurl .= ":".$_SERVER['SERVER_PORT'];
|
||||
}
|
||||
|
||||
if (! $was_empty) {
|
||||
if ($url === '') {
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
elseif ($url === false) {
|
||||
//Only add the home url
|
||||
$url = $config['homeurl'] . '/';
|
||||
}
|
||||
else {
|
||||
$fullurl .= $_SERVER['SCRIPT_NAME'];
|
||||
}
|
||||
|
||||
return $fullurl.$url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a standard page header (Pandora FMS 3.1 version)
|
||||
*
|
||||
|
|
|
@ -69,7 +69,7 @@ if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) {
|
|||
|
||||
|
||||
if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
|
||||
$query = 'https://' . $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
|
||||
$query = '';
|
||||
if (sizeof ($_REQUEST))
|
||||
//Some (old) browsers don't like the ?&key=var
|
||||
$query .= '?1=1';
|
||||
|
@ -83,11 +83,12 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
|
|||
foreach ($_POST as $key => $value) {
|
||||
$query .= '&'.$key.'='.$value;
|
||||
}
|
||||
$url = ui_get_full_url($query);
|
||||
|
||||
// Prevent HTTP response splitting attacks
|
||||
// http://en.wikipedia.org/wiki/HTTP_response_splitting
|
||||
$query = str_replace ("\n", "", $query);
|
||||
|
||||
$url = str_replace ("\n", "", $url);
|
||||
|
||||
header ('Location: '.$query);
|
||||
exit; //Always exit after sending location headers
|
||||
}
|
||||
|
@ -96,7 +97,8 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
|
|||
$config["pure"] = (bool) get_parameter ("pure");
|
||||
|
||||
// Auto Refresh page (can now be disabled anywhere in the script)
|
||||
$config["refr"] = (int) get_parameter ("refr", $config["refr"]);
|
||||
$config["refr"] = (int) get_parameter ("refr");
|
||||
|
||||
|
||||
ob_start ();
|
||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
|
||||
|
|
|
@ -21,6 +21,7 @@ require_once ("include/functions_alerts.php"); //Alerts processing functions
|
|||
require_once ($config['homedir'].'/include/functions_agents.php'); //Agents functions
|
||||
require_once ($config['homedir'].'/include/functions_users.php'); //Users functions
|
||||
require_once ($config['homedir'].'/include/functions_graph.php');
|
||||
require_once ($config['homedir'].'/include/functions_ui.php');
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -267,7 +268,10 @@ if ($config["pure"] == 0) {
|
|||
?>
|
||||
<script type="text/javascript">
|
||||
function openSoundEventWindow() {
|
||||
url = '<?php $protocol = $config['https'] ? 'https' : 'http'; echo $protocol . '://' . $_SERVER['SERVER_NAME'] . $config['homeurl'] . '/operation/events/sound_events.php'; ?>';
|
||||
<?php
|
||||
$url = ui_get_full_url(false);
|
||||
?>
|
||||
url = '<?php echo $url . 'operation/events/sound_events.php'; ?>';
|
||||
|
||||
window.open(url, '<?php __('Sound Alerts'); ?>','width=300, height=300, toolbar=no, location=no, directories=no, status=no, menubar=no');
|
||||
}
|
||||
|
|
|
@ -91,10 +91,7 @@ echo "<html>";
|
|||
echo "<head>";
|
||||
echo "<title>Pandora FMS - Latest events </title>";
|
||||
|
||||
$query = 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '') . '://' . $_SERVER['SERVER_NAME'];
|
||||
if ($_SERVER['SERVER_PORT'] != 80)
|
||||
$query .= ":" . $_SERVER['SERVER_PORT'];
|
||||
$query .= $_SERVER['SCRIPT_NAME'];
|
||||
$query = ui_get_full_url();
|
||||
echo '<meta http-equiv="refresh" content="' . $MARQUEE_INTERVAL . '; URL=' . $query . '">';
|
||||
echo '<link rel="icon" href="../../images/pandora.ico" type="image/ico">';
|
||||
echo "</head>";
|
||||
|
|
|
@ -45,18 +45,17 @@ header("Content-Type: application/xml; charset=UTF-8"); //Send header before sta
|
|||
|
||||
function rss_error_handler ($errno, $errstr, $errfile, $errline) {
|
||||
global $config;
|
||||
|
||||
$base = 'http'.(isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '').'://'.$_SERVER['HTTP_HOST'];
|
||||
$url = $base.$config["homeurl"];
|
||||
$selfurl = $base.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
|
||||
|
||||
|
||||
$url = ui_get_full_url(false);
|
||||
$selfurl = ui_get_full_url('?' . $_SERVER['QUERY_STRING']);
|
||||
|
||||
$rss_feed = '<?xml version="1.0" encoding="utf-8" ?>'; //' Fixes certain highlighters freaking out on the PHP closing tag
|
||||
$rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
|
||||
$rss_feed .= '<channel><title>Pandora RSS Feed</title><description>Latest events on Pandora</description>';
|
||||
$rss_feed .= '<lastBuildDate>'.date (DATE_RFC822, 0).'</lastBuildDate>';
|
||||
$rss_feed .= '<link>'.$url.'</link>'; //Link back to the main Pandora page
|
||||
$rss_feed .= '<atom:link href="'.io_safe_input ($selfurl).'" rel="self" type="application/rss+xml" />'; //Alternative for Atom feeds. It's the same.
|
||||
|
||||
|
||||
$rss_feed .= '<item><guid>'.$url.'/index.php?sec=eventos&sec2=operation/events/events</guid><title>Error creating feed</title>';
|
||||
$rss_feed .= '<description>There was an error creating the feed: '.$errno.' - '.$errstr.' in '.$errfile.' on line '.$errline.'</description>';
|
||||
$rss_feed .= '<link>'.$url.'/index.php?sec=eventos&sec2=operation/events/events</link></item>';
|
||||
|
@ -202,9 +201,8 @@ switch ($config["dbtype"]) {
|
|||
|
||||
$result= db_get_all_rows_sql ($sql);
|
||||
|
||||
$base = 'http'.(isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '').'://'.$_SERVER['HTTP_HOST'];
|
||||
$url = $base.$config["homeurl"];
|
||||
$selfurl = $base.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
|
||||
$url = ui_get_full_url(false);
|
||||
$selfurl = ui_get_full_url('?' . $_SERVER['QUERY_STRING']);
|
||||
|
||||
if (empty ($result)) {
|
||||
$lastbuild = 0; //Last build in 1970
|
||||
|
|
|
@ -242,7 +242,10 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
?>
|
||||
<script type="text/javascript">
|
||||
function openSoundEventWindow() {
|
||||
url = '<?php echo 'http://' . $_SERVER['SERVER_NAME'] . $config['homeurl'] . '/operation/events/sound_events.php'; ?>';
|
||||
<?php
|
||||
$url = ui_get_full_url(false);
|
||||
?>
|
||||
url = '<?php echo $url . 'operation/events/sound_events.php'; ?>';
|
||||
|
||||
window.open(url, '<?php __('Sound Alerts'); ?>','width=475, height=275, toolbar=no, location=no, directories=no, status=no, menubar=no');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue