diff options
author | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-04-03 11:30:45 -0300 |
---|---|---|
committer | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-04-03 11:30:45 -0300 |
commit | 696e201450f9ca8de457df305b30c4766bf13712 (patch) | |
tree | accc4c07c29813356da50db4804d913d5bf9d225 /config/sarg/sarg_frame.php | |
parent | 0737b58f4d8a8d676342bd6cc9757d167f6dcbb9 (diff) | |
download | pfsense-packages-696e201450f9ca8de457df305b30c4766bf13712.tar.gz pfsense-packages-696e201450f9ca8de457df305b30c4766bf13712.tar.bz2 pfsense-packages-696e201450f9ca8de457df305b30c4766bf13712.zip |
sarg - fix images on report and improve file tests
Diffstat (limited to 'config/sarg/sarg_frame.php')
-rwxr-xr-x | config/sarg/sarg_frame.php | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/config/sarg/sarg_frame.php b/config/sarg/sarg_frame.php index 96b8c92f..5838e36b 100755 --- a/config/sarg/sarg_frame.php +++ b/config/sarg/sarg_frame.php @@ -38,22 +38,19 @@ else{ $prefix=""; } $url=($_REQUEST['file'] == ""?"index.html":$_REQUEST['file']); -$report=file_get_contents("/usr/local/www/sarg-reports/".$url); -/*$pattern[0]="/header_\w/"; -$replace[0]="listtopic"; -$pattern[1]="/class=.data./"; -$replace[1]='class="listlr"'; -$pattern[2]="/cellpadding=.\d./"; -$replace[2]='cellpadding="0"'; -$pattern[3]="/cellspacing=.\d./"; -$replace[3]='cellspacing="0"'; -$pattern[4]="/sarg/"; -$replace[4]='cellspacing="0"'; -*/ -$pattern[0]="/href=\W(\S+html)\W/"; -$replace[0]="href=/sarg_frame.php?file=$prefix/$1"; -$pattern[1]='/img src="(\w+\.\w+)/'; -$replace[1]='img src="/sarg-reports'.$prefix.'/$1'; - -print preg_replace($pattern,$replace,$report); +if (file_exists("/usr/local/www/sarg-reports/".$url)) + { + $report=file_get_contents("/usr/local/www/sarg-reports/".$url); + $pattern[0]="/href=\W(\S+html)\W/"; + $replace[0]="href=/sarg_frame.php?file=$prefix/$1"; + $pattern[1]='/img src="(\w+\.\w+)/'; + $replace[1]='img src="/sarg-reports'.$prefix.'/$1'; + $pattern[2]='@img src="([.a-z/]+)/(\w+\.\w+)@'; + $replace[2]='img src="/sarg-reports'.$prefix.'/$1/$2'; + print preg_replace($pattern,$replace,$report); + } +else{ + print "<pre>Error: Could not find report index file.<br>Check sarg settings and try to force sarg schedule."; + } + ?>
\ No newline at end of file |