aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-04-09 20:40:01 -0300
committermarcelloc <marcellocoutinho@gmail.com>2012-04-09 20:40:01 -0300
commit210f73a354126d93d4e5cc7c6cdadaeafe9c4949 (patch)
tree12a38caceacd47430d7e981f6d887cc473665f34
parente9dd1cda71cc70f9c36041385fc6a6d93f1e1335 (diff)
downloadpfsense-packages-210f73a354126d93d4e5cc7c6cdadaeafe9c4949.tar.gz
pfsense-packages-210f73a354126d93d4e5cc7c6cdadaeafe9c4949.tar.bz2
pfsense-packages-210f73a354126d93d4e5cc7c6cdadaeafe9c4949.zip
sarg - include more config options and fix usertab check
-rw-r--r--config/sarg/sarg.inc26
-rw-r--r--config/sarg/sarg.template6
-rw-r--r--config/sarg/sarg.xml30
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
5 files changed, 52 insertions, 14 deletions
diff --git a/config/sarg/sarg.inc b/config/sarg/sarg.inc
index eb17245b..a8749ef4 100644
--- a/config/sarg/sarg.inc
+++ b/config/sarg/sarg.inc
@@ -129,10 +129,11 @@ function sync_package_sarg() {
#mount filesystem writeable
conf_mount_rw();
if (!is_array($config['installedpackages']['sarg']['config']))
- $config['installedpackages']['sarg']['config'][0]=array('report_options'=>'use_graphs,remove_temp_files,main_index,use_comma',
+ $config['installedpackages']['sarg']['config'][0]=array('report_options'=>'use_graphs,remove_temp_files,main_index,use_comma,date_time_by_bytes',
'user_sort_field'=>'BYTES',
'report_type'=>'topusers,topsites,sites_users,users_sites,date_time,denied,auth_failures,site_user_time_date,downloads',
- 'report_type'=>'u');
+ 'report_type'=>'u',
+ 'report_charset'=>'UTF-8');
$sarg=$config['installedpackages']['sarg']['config'][0];
switch ($sarg['proxy_server']){
case 'dansguardian':
@@ -170,18 +171,18 @@ function sync_package_sarg() {
$use_comma=(preg_match('/use_comma/',$sarg['report_options'])?"yes":"no");
$long_url=(preg_match('/long_url/',$sarg['report_options'])?"yes":"no");
$privacy=(preg_match('/privacy/',$sarg['report_options'])?"yes":"no");
+ $displayed_values=(preg_match('/displayed_values/',$sarg['report_options'])?"abbreviation":"bytes");
+ $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']);
$report_type=preg_replace('/,/',' ',$sarg['report_type']);
+ $report_charset=(empty($sarg['report_charset'])?"UTF-8":$sarg['report_charset']);
if(!empty($sarg['include_userlist']))
$include_users="$include_users ".$sarg['include_userlist'];
- include("/usr/local/pkg/sarg.template");
- file_put_contents("/usr/local/etc/sarg/sarg.conf", $sg, LOCK_EX);
- file_put_contents('/usr/local/etc/sarg/exclude_users.conf', sarg_text_area_decode($sarg['exclude_userlist']),LOCK_EX);
- file_put_contents('/usr/local/etc/sarg/exclude_hosts.conf', sarg_text_area_decode($sarg['exclude_hostlist']),LOCK_EX);
- file_put_contents('/usr/local/etc/sarg/exclude_codes.conf', sarg_text_area_decode($sarg['exclude_codelist']),LOCK_EX);
$exclude_string=(empty($sarg['exclude_string'])?"":'exclude_string"'.$sarg['exclude_string']."'");
- if(empty($sarg['include_userlist'])){
+ if(empty($sarg['usertab'])){
$usertab="none";
}
else{
@@ -192,7 +193,14 @@ function sync_package_sarg() {
foreach ($dirs as $dir)
if (!is_dir($dir))
mkdir ($dir,0755,true);
-
+
+ #create sarg config files
+ include("/usr/local/pkg/sarg.template");
+ file_put_contents("/usr/local/etc/sarg/sarg.conf", $sg, LOCK_EX);
+ file_put_contents('/usr/local/etc/sarg/exclude_users.conf', sarg_text_area_decode($sarg['exclude_userlist']),LOCK_EX);
+ file_put_contents('/usr/local/etc/sarg/exclude_hosts.conf', sarg_text_area_decode($sarg['exclude_hostlist']),LOCK_EX);
+ file_put_contents('/usr/local/etc/sarg/exclude_codes.conf', sarg_text_area_decode($sarg['exclude_codelist']),LOCK_EX);
+
#check cron_tab
$new_cron=array();
$cron_found=0;
diff --git a/config/sarg/sarg.template b/config/sarg/sarg.template
index e8d92a73..8f4a83f0 100644
--- a/config/sarg/sarg.template
+++ b/config/sarg/sarg.template
@@ -414,6 +414,7 @@ long_url {$long_url}
# Date/Time reports show the downloaded volume or the elapsed time or both.
#
#date_time_by bytes
+date_time_by {$date_time_by}
# TAG: charset name
# ISO 8859 is a full series of 10 standardized multilingual single-byte coded (8bit)
@@ -435,7 +436,8 @@ long_url {$long_url}
# UTF-8
#
#charset Latin1
-charset UTF-8
+charset {$report_charset}
+
# TAG: user_invalid_char "&/"
# Records that contain invalid characters in userid will be ignored by Sarg.
#
@@ -487,6 +489,7 @@ privacy {$privacy}
# Bytes field must be in Site & Users Report ?
#
#bytes_in_sites_users_report no
+bytes_in_sites_users_report {$bytes_in_sites_users_report}
# TAG: topuser_num n
# How many users in topsites report. 0 = no limit
@@ -610,6 +613,7 @@ show_sarg_logo no
# abbreviation - 210K
#
#displayed_values bytes
+displayed_values {$displayed_values}
# Report limits
# TAG: authfail_report_limit n
diff --git a/config/sarg/sarg.xml b/config/sarg/sarg.xml
index 5e54398b..c1cf3fa2 100644
--- a/config/sarg/sarg.xml
+++ b/config/sarg/sarg.xml
@@ -165,14 +165,18 @@
<option><name>Sort Fields in Reverse order (no)</name><value>user_sort_field_order</value></option>
<option><name>Remove temporary files from root report directory (yes)</name><value>remove_temp_files</value></option>
<option><name>Generate the main index.html (yes)</name><value>main_index</value></option>
- <option><name>Generate the index tree by file (on)</name><value>index_tree</value></option>
+ <option><name>Generate the index tree by file (yes)</name><value>index_tree</value></option>
<option><name>Overwrite report (no)</name><value>overwrite_report</value></option>
<option><name>Use comma instead point in reports (yes)</name><value>use_comma</value></option>
<option><name>Show full url in report (no)</name><value>long_url</value></option>
<option><name>Privacy (no)</name><value>privacy</value></option>
+ <option><name>Show Bytes in sites users reports(no)</name><value>bytes_in_sites_users_report</value></option>
+ <option><name>Show values in reports using abbreviation (no)</name><value>displayed_values</value></option>
+ <option><name>Show the downloaded volume on Date/Time reports (yes)</name><value>date_time_by_bytes</value></option>
+ <option><name>Show the downloaded elapsed time on Date/Time reports (no)</name><value>date_time_by_elap</value></option>
</options>
<multiple/>
- <size>13</size>
+ <size>17</size>
</field>
<field>
<fielddescr>Report to generate</fielddescr>
@@ -205,6 +209,28 @@
<option><name>Weekly yy.ww</name><value>w</value></option>
</options>
</field>
+ <field>
+ <fielddescr>Report charset</fielddescr>
+ <fieldname>report_charset</fieldname>
+ <description><![CDATA[ISO 8859 is a full series of 10 standardized multilingual single-byte coded (8bit) graphic character sets for writing in alphabetic languages]]></description>
+ <type>select</type>
+ <options>
+ <option><name>UTF-8 (Default)</name><value>UTF-8</value></option>
+ <option><name>Latin1 - West European</name><value>Latin1</value></option>
+ <option><name>Latin2 - East European</name><value>Latin2</value></option>
+ <option><name>Latin3 - South European</name><value>Latin3</value></option>
+ <option><name>Latin4 - North European</name><value>Latin4</value></option>
+ <option><name>Latin5 - Turkish</name><value>Latin5</value></option>
+ <option><name>Latin6</name><value>Latin6</value></option>
+ <option><name>Cyrillic</name><value>Cyrillic</value></option>
+ <option><name>Arabic</name><value>Arabic</value></option>
+ <option><name>Greek</name><value>Greek</value></option>
+ <option><name>Hebrew</name><value>Hebrew</value></option>
+ <option><name>Windows-1251</name><value>Windows-1251</value></option>
+ <option><name>Japan</name><value>Japan</value></option>
+ <option><name>Koi8-r</name><value>Koi8-r</value></option>
+ </options>
+ </field>
<field>
<name>User Settings</name>
<type>listtopic</type>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 7e23d5d5..31cd1fd9 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -552,7 +552,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,47765.0.html</pkginfolink>
<depends_on_package_base_url>http://e-sac.siteseguro.ws/packages/8/All/</depends_on_package_base_url>
<depends_on_package>sarg-2.3.2.tbz</depends_on_package>
- <version>2.3.2 pkg v.0.3</version>
+ <version>2.3.2 pkg v.0.3.1</version>
<status>beta</status>
<required_version>2.0</required_version>
<configurationfile>sarg.xml</configurationfile>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 323189b5..3ce61c02 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -642,7 +642,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,47765.0.html</pkginfolink>
<depends_on_package_base_url>http://e-sac.siteseguro.ws/packages/amd64/8/All/</depends_on_package_base_url>
<depends_on_package>sarg-2.3.2.tbz</depends_on_package>
- <version>2.3.2 pkg v.0.3</version>
+ <version>2.3.2 pkg v.0.3.1</version>
<status>beta</status>
<required_version>2.0</required_version>
<configurationfile>sarg.xml</configurationfile>