From a652177a65cc17c8dddaa739d30ce40dc20d68a9 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sat, 8 Oct 2011 11:29:11 +0200 Subject: include trailing slash in config weburl variable When running CGP in the root, the header didn't link to the overview page because the href was empty. Reported-by: Nikoli --- conf/common.inc.php | 4 +--- detail.php | 6 +++--- inc/collectd.inc.php | 2 +- inc/html.inc.php | 10 +++++----- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/conf/common.inc.php b/conf/common.inc.php index c4884d6..165c73f 100644 --- a/conf/common.inc.php +++ b/conf/common.inc.php @@ -3,6 +3,4 @@ require_once 'config.php'; $CONFIG['webdir'] = preg_replace('/\/[a-z\.]+$/', '', $_SERVER['SCRIPT_FILENAME']); -$CONFIG['weburl'] = preg_replace('/\/[a-z\.]+$/', '', $_SERVER['SCRIPT_NAME']); - -?> +$CONFIG['weburl'] = preg_replace('/(?<=\/)[a-z\.]+$/', '', $_SERVER['SCRIPT_NAME']); diff --git a/detail.php b/detail.php index e9e80a0..a7b2cd4 100644 --- a/detail.php +++ b/detail.php @@ -23,7 +23,7 @@ $seconds = GET('s'); html_start(); printf('

%s

'."\n", - $CONFIG['weburl'].'/host.php?h='.htmlentities($host), $host + $CONFIG['weburl'].'host.php?h='.htmlentities($host), $host ); $term = array( @@ -40,7 +40,7 @@ $args = $_GET; print "\n"; @@ -53,7 +53,7 @@ if(!$plugins) { } # show graph -printf(''."\n", $CONFIG['weburl'], build_url('graph.php', $_GET)); +printf(''."\n", $CONFIG['weburl'], build_url('graph.php', $_GET)); html_end(); diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php index 11dc91f..439d507 100644 --- a/inc/collectd.inc.php +++ b/inc/collectd.inc.php @@ -133,7 +133,7 @@ function graphs_from_plugin($host, $plugin) { ? $CONFIG['time_range'][$plugin] : $CONFIG['time_range']['default']; - printf(''."\n", + printf(''."\n", $CONFIG['weburl'], build_url('detail.php', $items, $time), $CONFIG['weburl'], diff --git a/inc/html.inc.php b/inc/html.inc.php index d4a31f2..2e71488 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -18,8 +18,8 @@ function html_start() { CGP{$path} - - + + @@ -51,7 +51,7 @@ function html_end() { echo << @@ -71,7 +71,7 @@ function plugin_header($host, $plugin, $status) { $a = '-'; } - return printf("

\"[%s]\" %s

\n", $f, $host, $plugin, $CONFIG['weburl'], $i, $a, $plugin); + return printf("

\"[%s]\" %s

\n", $f, $host, $plugin, $CONFIG['weburl'], $i, $a, $plugin); } function host_summary($hosts) { @@ -88,7 +88,7 @@ function host_summary($hosts) { $host_counter++; printf('', $row_style[$host_counter % 2]); - printf('%s', + printf('%s', $CONFIG['weburl'],$host, $host); if ($CONFIG['showload']) { -- cgit v1.1