aboutsummaryrefslogtreecommitdiffstats
path: root/config/sarg
diff options
context:
space:
mode:
Diffstat (limited to 'config/sarg')
-rw-r--r--config/sarg/sarg.inc25
-rw-r--r--config/sarg/sarg.xml2
-rwxr-xr-xconfig/sarg/sarg_frame.php2
-rwxr-xr-xconfig/sarg/sarg_reports.php2
4 files changed, 25 insertions, 6 deletions
diff --git a/config/sarg/sarg.inc b/config/sarg/sarg.inc
index 32cca7ed..59b7eb11 100644
--- a/config/sarg/sarg.inc
+++ b/config/sarg/sarg.inc
@@ -4,7 +4,7 @@
sarg.inc
part of pfSense (http://www.pfSense.com)
Copyright (C) 2007 Joao Henrique F. Freitas
- Copyright (C) 2012 Marcello Coutinho
+ Copyright (C) 2012-2013 Marcello Coutinho
All rights reserved.
*/
/* ========================================================================== */
@@ -33,12 +33,26 @@
/* ========================================================================== */
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
if ($pf_version > 2.0){
+
+ // Function to get squidGuard directory
+ // each squidGuard version has a different directory
+ function getsqGuardDir() {
+ foreach (glob("/usr/pbi/*",GLOB_ONLYDIR) as $dirname) {
+ if (preg_match("/squidguard-/i", $dirname)) {
+ return trim($dirname);
+ break;
+ }
+ }
+ }
+
define('SARG_DIR', '/usr/pbi/sarg-' . php_uname("m"));
+ define('SQGARD_DIR', getsqGuardDir());
define('SQUID_DIR', '/usr/pbi/squid-' . php_uname("m"));
define('DANSG_DIR', '/usr/pbi/dansguardian-' . php_uname("m"));
}
else{
define('SARG_DIR', '/usr/local');
+ define('SQGARD_DIR', '/usr/local');
define('SQUID_DIR', '/usr/local');
define('DANSG_DIR', '/usr/local');
}
@@ -50,7 +64,7 @@ if ($uname['machine']=='amd64')
// STATIC VARS
$sarg_proxy=array( 'squid_rc'=> SQUID_DIR . '/etc/rc.d/squid.sh',
'squid_config'=> '/var/squid/logs/access.log',
- 'squidguard_config'=> SARG_DIR . '/etc/squidGuard/squidGuard.conf',
+ 'squidguard_config'=> SQGARD_DIR . '/etc/squidGuard/squidGuard.conf',
'squidguard_block_log'=>'/var/squidGuard/log/block.log',
'dansguardian_config'=> DANSG_DIR . '/etc/dansguardian/dansguardian.conf',
'dansguardian_log'=>'/var/log/dansguardian/access.log');
@@ -140,7 +154,7 @@ EOF;
}
#create a new file to speedup find search
file_put_contents("/root/sarg_run_{$id}.sh",$gzip_script,LOCK_EX);
- mwexec($cmd. " ".$args);
+ mwexec("export LC_ALL=C && " .$cmd. " ".$args);
#check if there is a script to run after file save
if (is_array($config['installedpackages']['sarg']))
switch ($config['installedpackages']['sarg']['config'][0]['proxy_server']){
@@ -246,7 +260,7 @@ function sync_package_sarg() {
$anonymous_output_files=(preg_match('/anonymous_output_files/',$sarg['report_options'])?"yes":"no");
$resolve_ip=(preg_match('/resolve_ip/',$sarg['report_options'])?"yes":"no");
$user_ip=(preg_match('/user_ip/',$sarg['report_options'])?"yes":"no");
- $sort_order=(preg_match('/user_sort_field_order/',$sarg['report_options'])?"REVERSE":"NORMAL");
+ $sort_order=(preg_match('/user_sort_field_order/',$sarg['report_options'])?"reverse":"normal");
$remove_temp_files=(preg_match('/remove_temp_files/',$sarg['report_options'])?"yes":"no");
$main_index=(preg_match('/main_index/',$sarg['report_options'])?"yes":"no");
$index_tree=(preg_match('/index_tree/',$sarg['report_options'])?"file":"date");
@@ -258,7 +272,7 @@ function sync_package_sarg() {
$bytes_in_sites_users_report=(preg_match('/bytes_in_sites_users_report/',$sarg['report_options'])?"yes":"no");
$date_time_by=(preg_match('/date_time_by_bytes/',$sarg['report_options'])?"bytes":"");
$date_time_by.=(preg_match('/date_time_by_elap/',$sarg['report_options'])?" elap":"");
- $date_format=(empty($sarg['report_date_format'])?"u":$sarg['report_date_format']);
+ $date_format=(preg_match("/\w/",$sarg['report_date_format'])?$sarg['report_date_format']:"u");
$report_type=preg_replace('/,/',' ',$sarg['report_type']);
$report_charset=(empty($sarg['report_charset'])?"UTF-8":$sarg['report_charset']);
$exclude_string=(empty($sarg['exclude_string'])?"":'exclude_string "'.$sarg['exclude_string'].'"');
@@ -289,6 +303,7 @@ function sync_package_sarg() {
file_put_contents( SARG_DIR . '/etc/sarg/usertab.conf', sarg_text_area_decode($sarguser['usertab']),LOCK_EX);
}
if($sarguser['ldap_enable']){
+ $usertab="ldap";
$LDAPHost=(empty($sarguser['ldap_host'])?"":"LDAPHost ".$sarguser['ldap_host']);
$LDAPort=(empty($sarguser['ldap_port'])?"":"LDAPPort ".$sarguser['ldap_port']);
$LDAPBindDN=(empty($sarguser['ldap_bind_dn'])?"":"LDAPBindDN ".$sarguser['ldap_bind_dn']);
diff --git a/config/sarg/sarg.xml b/config/sarg/sarg.xml
index bb345379..cc11cad4 100644
--- a/config/sarg/sarg.xml
+++ b/config/sarg/sarg.xml
@@ -9,7 +9,7 @@
/*
sarg.xml
part of the sarg for pfSense
- Copyright (C) 2012 Marcello Coutinho
+ Copyright (C) 2012-2013 Marcello Coutinho
All rights reserved.
*/
diff --git a/config/sarg/sarg_frame.php b/config/sarg/sarg_frame.php
index 4d3421ab..21638247 100755
--- a/config/sarg/sarg_frame.php
+++ b/config/sarg/sarg_frame.php
@@ -68,9 +68,11 @@ if ($report != "" )
#look for graph files inside reports.
if (preg_match_all('/img src="([a-zA-Z0-9._-]+).png/',$report,$images)){
+ conf_mount_rw();
for ($x=0;$x<count($images[1]);$x++){
copy("{$dir}/{$prefix}/{$images[1][$x]}.png","/usr/local/www/sarg-images/temp/{$images[1][$x]}.{$rand}.png");
}
+ conf_mount_ro();
}
print preg_replace($pattern,$replace,$report);
}
diff --git a/config/sarg/sarg_reports.php b/config/sarg/sarg_reports.php
index b1792312..b156a4d7 100755
--- a/config/sarg/sarg_reports.php
+++ b/config/sarg/sarg_reports.php
@@ -61,7 +61,9 @@ require("guiconfig.inc");
$tab_array[] = array(gettext("XMLRPC Sync"), false, "/pkg_edit.php?xml=sarg_sync.xml&id=0");
$tab_array[] = array(gettext("Help"), false, "/pkg_edit.php?xml=sarg_about.php");
display_top_tabs($tab_array);
+ conf_mount_rw();
exec('rm -f /usr/local/www/sarg-images/temp/*');
+ conf_mount_ro();
?>
</td></tr>
<tr>