aboutsummaryrefslogtreecommitdiffstats
path: root/config/sarg/sarg.inc
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-05-24 17:13:31 -0300
committermarcelloc <marcellocoutinho@gmail.com>2012-05-24 17:13:31 -0300
commit3864c8951c23d691101b18911bb5e76d603e4d1b (patch)
tree2a793da9ecb0fdf855a3aea34db31400056e4712 /config/sarg/sarg.inc
parent0413d215d6102b9e75068564c87e368426b012c5 (diff)
downloadpfsense-packages-3864c8951c23d691101b18911bb5e76d603e4d1b.tar.gz
pfsense-packages-3864c8951c23d691101b18911bb5e76d603e4d1b.tar.bz2
pfsense-packages-3864c8951c23d691101b18911bb5e76d603e4d1b.zip
sarg - version 0.5 with reports permission inc file and no direct access to reports
Diffstat (limited to 'config/sarg/sarg.inc')
-rw-r--r--config/sarg/sarg.inc23
1 files changed, 20 insertions, 3 deletions
diff --git a/config/sarg/sarg.inc b/config/sarg/sarg.inc
index 2bcd4115..0927b164 100644
--- a/config/sarg/sarg.inc
+++ b/config/sarg/sarg.inc
@@ -139,6 +139,9 @@ function sync_package_sarg() {
if (!preg_match("/\w+/",$_POST['__csrf_magic']))
return;
}
+ #check pkg.php sent a sync request
+
+
$update_conf=0;
#mount filesystem writeable
conf_mount_rw();
@@ -246,12 +249,26 @@ function sync_package_sarg() {
$LDAPFilterSearch=(empty($sarguser['ldap_filter_search'])?"":"LDAPFilterSearch ".$sarguser['ldap_filter_search']);
}
- #dirs
- $dirs=array("/usr/local/www/sarg-reports");
+
+ #move old reports
+ if (is_dir("/usr/local/www/sarg-reports") && !is_dir("/usr/local/sarg-reports"))
+ rename("/usr/local/www/sarg-reports","/usr/local/sarg-reports");
+
+ #check dirs
+ $dirs=array("/usr/local/sarg-reports","/usr/local/www/sarg-images","/usr/local/www/sarg-images/temp");
foreach ($dirs as $dir)
if (!is_dir($dir))
mkdir ($dir,0755,true);
-
+
+ #images
+ $simages=array("datetime.png","graph.png","sarg-squidguard-block.png","sarg.png");
+ $simgdir1="/usr/local/www/sarg-images";
+ $simgdir2="/usr/local/etc/sarg/images";
+ foreach ($simages as $simage){
+ if (!file_exists("{$simgdir1}/{$simage}"))
+ copy("{$simgdir2}/{$simage}","{$simgdir1}/{$simage}");
+ }
+
//log_error($_POST['__csrf_magic']." sarg log:". $access_log);
#create sarg config files
include("/usr/local/pkg/sarg.template");