aboutsummaryrefslogtreecommitdiffstats
path: root/config/squidGuard
diff options
context:
space:
mode:
Diffstat (limited to 'config/squidGuard')
-rw-r--r--config/squidGuard/squidguard.inc50
-rw-r--r--config/squidGuard/squidguard.xml6
-rw-r--r--config/squidGuard/squidguard_acl.xml4
-rw-r--r--config/squidGuard/squidguard_configurator.inc110
-rw-r--r--config/squidGuard/squidguard_default.xml4
-rw-r--r--config/squidGuard/squidguard_dest.xml4
-rw-r--r--config/squidGuard/squidguard_log.php8
-rw-r--r--config/squidGuard/squidguard_rewr.xml2
-rw-r--r--config/squidGuard/squidguard_time.xml2
9 files changed, 95 insertions, 95 deletions
diff --git a/config/squidGuard/squidguard.inc b/config/squidGuard/squidguard.inc
index d58dfb79..0fd450b7 100644
--- a/config/squidGuard/squidguard.inc
+++ b/config/squidGuard/squidguard.inc
@@ -101,26 +101,26 @@ sg_init(convert_pfxml_to_sgxml());
# ==============================================================================
# Validations
# ==============================================================================
-function squidguard_validate($post, $input_errors)
+function squidguard_validate(&$post, &$input_errors)
{
$submit = isset($_GET['submit']) ? $_GET['submit'] : $_POST['submit'];
# check config if 'Apply'
- if ($submit === APPLY_BTN) sg_check_config_data(&$input_errors);
+ if ($submit === APPLY_BTN) sg_check_config_data($input_errors);
}
# ------------------------------------------------------------------------------
# validate default
# ------------------------------------------------------------------------------
-function squidguard_validate_default($post, $input_errors)
+function squidguard_validate_default(&$post, &$input_errors)
{
- squidguard_validate_acl($post, &$input_errors);
+ squidguard_validate_acl($post, $input_errors);
}
# ------------------------------------------------------------------------------
# validate acl
# ------------------------------------------------------------------------------
-function squidguard_validate_acl($post, $input_errors)
+function squidguard_validate_acl(&$post, &$input_errors)
{
$pass_up = array();
$deny_up = array();
@@ -134,7 +134,7 @@ function squidguard_validate_acl($post, $input_errors)
$name = trim($post[F_NAME]);
if(!empty($name)) {
# validate name format
- check_name_format($name, &$input_errors);
+ check_name_format($name, $input_errors);
# check unique name
if (!sg_check_unique_name(F_ACLS, $name))
@@ -148,7 +148,7 @@ function squidguard_validate_acl($post, $input_errors)
$sgx = array();
$sgx[F_NAME] = $post[F_NAME];
$sgx[F_SOURCE] = $post[F_SOURCE];
- sg_check_src($sgx, &$input_errors);
+ sg_check_src($sgx, $input_errors);
}
# store destinations to 'dest' value
@@ -192,7 +192,7 @@ function squidguard_validate_acl($post, $input_errors)
# check redirect
$errmsg = '';
- if (!sg_check_redirect($post[F_RMOD], $post[F_REDIRECT], &$errmsg)) {
+ if (!sg_check_redirect($post[F_RMOD], $post[F_REDIRECT], $errmsg)) {
$input_errors[] = "Redirect info error. $errmsg";
}
}
@@ -203,14 +203,14 @@ function squidguard_validate_acl($post, $input_errors)
# date: <date(or range)><time (or range)> -- days not parsed (reset to *)
# weekly: <day or *><time or range> -- dates not parsed (reset to '')
# ------------------------------------------------------------------------------
-function squidguard_validate_times($post, $input_errors)
+function squidguard_validate_times(&$post, &$input_errors)
{
$id = get_item_id();
# check name
$name = trim($post[F_NAME]);
if(!empty($name)) {
- check_name_format($name, &$input_errors);
+ check_name_format($name, $input_errors);
# check unique name
if (!sg_check_unique_name(F_TIMES, $name))
@@ -246,18 +246,18 @@ function squidguard_validate_times($post, $input_errors)
$sgx[F_ITEM][] = $sgx_row;
}
#
- sg_check_time($sgx, &$input_errors);
+ sg_check_time($sgx, $input_errors);
}
# ------------------------------------------------------------------------------
# validate destinations
# ------------------------------------------------------------------------------
-function squidguard_validate_destination($post, $input_errors) {
+function squidguard_validate_destination($post, &$input_errors) {
# check name
$name = trim($post[F_NAME]);
if(!empty($name)) {
- check_name_format($name, &$input_errors);
+ check_name_format($name, $input_errors);
# check unique name
if (!sg_check_unique_name(F_DESTINATIONS, $name))
@@ -277,18 +277,18 @@ function squidguard_validate_destination($post, $input_errors) {
$sgx[F_RMOD] = $post[F_RMOD];
$sgx[F_REDIRECT] = $post[F_REDIRECT];
#
- sg_check_dest($sgx, &$input_errors);
+ sg_check_dest($sgx, $input_errors);
}
# ------------------------------------------------------------------------------
# validate rewrites
# ------------------------------------------------------------------------------
-function squidguard_validate_rewrite($post, $input_errors) {
+function squidguard_validate_rewrite($post, &$input_errors) {
# check name
$name = trim($post[F_NAME]);
if(!empty($name)) {
# check name format <char><symbols without space> - Ab123
- check_name_format($name, &$input_errors);
+ check_name_format($name, $input_errors);
# check unique name
if (!sg_check_unique_name(F_REWRITES, $name))
@@ -447,7 +447,7 @@ function get_sgconf_items_list($data_group, $fieldname) {
# ==============================================================================
# squidguard_before_form
# ------------------------------------------------------------------------------
-function squidguard_before_form($pkg) {
+function squidguard_before_form(&$pkg) {
$i=0;
foreach($pkg['fields']['field'] as $field) {
@@ -470,7 +470,7 @@ function squidguard_before_form($pkg) {
# -----------------------------------------------------------------------------
# squidguard_before_form_acl
# -----------------------------------------------------------------------------
-function squidguard_before_form_acl($pkg, $is_acl=true) {
+function squidguard_before_form_acl(&$pkg, $is_acl=true) {
global $g;
global $squidguard_config;
@@ -638,7 +638,7 @@ function squidguard_before_form_acl($pkg, $is_acl=true) {
# -----------------------------------------------------------------------------
# squidguard_before_form_dest
# -----------------------------------------------------------------------------
-function squidguard_before_form_dest($pkg) {
+function squidguard_before_form_dest(&$pkg) {
global $g, $squidguard_config;
$destination_items = get_sgconf_items_list(F_DESTINATIONS, 'name');
//var_dump($squidguard_config);
@@ -1301,12 +1301,12 @@ function squidguard_adt_rewrite_safesrch()
$res[F_NAME] = SAFESEARCH;
$res[F_DESCRIPTION] = "Google, Yandex safesearch";
$res[F_LOG] = 'on';
- squidguard_adt_safesrch_add(&$res[F_ITEM]);
+ squidguard_adt_safesrch_add($res[F_ITEM]);
return $res;
}
-function squidguard_adt_safesrch_add($rewrite_item)
+function squidguard_adt_safesrch_add(&$rewrite_item)
{
if (!is_array($rewrite_item)) $rewrite_item = array();
@@ -1331,7 +1331,7 @@ function squidguard_adt_safesrch_add($rewrite_item)
}
# log dump
-function squidguard_logdump($filename, $lnoffset, $lncount, $reverse)
+function squidguard_logdump($filename, &$lnoffset, $lncount, $reverse)
{
define('LOGSHOW_BUFSIZE', '262144');
$cnt = '';
@@ -1374,7 +1374,7 @@ function squidguard_logdump($filename, $lnoffset, $lncount, $reverse)
function squidguard_filterdump($lnoffset, $lncount, $reverse)
{
$res = array();
- $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . '/squidGuard.log', &$lnoffset, $lncount, $reverse);
+ $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . '/squidGuard.log', $lnoffset, $lncount, $reverse);
foreach($cont as $cn) {
$cn = explode(" ", trim($cn), 4);
@@ -1388,7 +1388,7 @@ function squidguard_filterdump($lnoffset, $lncount, $reverse)
function squidguard_guidump($lnoffset, $lncount, $reverse)
{
$res = array();
- $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . SQUIDGUARD_CONFLOGFILE, &$lnoffset, $lncount, $reverse);
+ $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . SQUIDGUARD_CONFLOGFILE, $lnoffset, $lncount, $reverse);
foreach($cont as $cn) {
$cn = explode(" ", trim($cn), 4);
@@ -1402,7 +1402,7 @@ function squidguard_guidump($lnoffset, $lncount, $reverse)
function squidguard_blockdump($lnoffset, $lncount, $reverse)
{
$res = array();
- $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . '/' . SQUIDGUARD_LOGFILE, &$lnoffset, $lncount, $reverse);
+ $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . '/' . SQUIDGUARD_LOGFILE, $lnoffset, $lncount, $reverse);
foreach($cont as $cn) {
$cn = explode(" ", trim($cn), 9);
diff --git a/config/squidGuard/squidguard.xml b/config/squidGuard/squidguard.xml
index ee7302f4..3a77edf3 100644
--- a/config/squidGuard/squidguard.xml
+++ b/config/squidGuard/squidguard.xml
@@ -6,7 +6,7 @@
<requirements>Describe your package requirements here</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>squidguardgeneral</name>
- <version>1.4_4 pkg v.1.9.3</version>
+ <version>1.4_4 pkg v.1.9.8</version>
<title>Proxy filter SquidGuard: General settings</title>
<include_file>/usr/local/pkg/squidguard.inc</include_file>
<!-- Installation -->
@@ -239,10 +239,10 @@
</fields>
<custom_add_php_command/>
<custom_php_validation_command>
- squidguard_validate(&amp;$_POST, &amp;$input_errors);
+ squidguard_validate($_POST, $input_errors);
</custom_php_validation_command>
<custom_php_command_before_form>
- squidguard_before_form(&amp;$pkg);
+ squidguard_before_form($pkg);
</custom_php_command_before_form>
<custom_php_after_form_command>
squidGuard_print_javascript();
diff --git a/config/squidGuard/squidguard_acl.xml b/config/squidGuard/squidguard_acl.xml
index 243576e8..8ddd6c35 100644
--- a/config/squidGuard/squidguard_acl.xml
+++ b/config/squidGuard/squidguard_acl.xml
@@ -224,10 +224,10 @@
</field>
</fields>
<custom_php_validation_command>
- squidguard_validate_acl(&amp;$_POST, &amp;$input_errors);
+ squidguard_validate_acl($_POST, $input_errors);
</custom_php_validation_command>
<custom_php_command_before_form>
- squidguard_before_form_acl(&amp;$pkg);
+ squidguard_before_form_acl($pkg);
</custom_php_command_before_form>
<custom_php_after_form_command>
squidGuard_print_javascript();
diff --git a/config/squidGuard/squidguard_configurator.inc b/config/squidGuard/squidguard_configurator.inc
index 5dbfcc43..d3448c5d 100644
--- a/config/squidGuard/squidguard_configurator.inc
+++ b/config/squidGuard/squidguard_configurator.inc
@@ -846,7 +846,7 @@ function sg_create_config()
}
# check configuration data
- if (!sg_check_config_data(&$error_res)) {
+ if (!sg_check_config_data($error_res)) {
sg_addlog("sg_create_config", "Bad config data. It's all error_res: $error_res", SQUIDGUARD_ERROR);
sg_addlog("sg_create_config", "Terminated.", SQUIDGUARD_ERROR);
return sg_create_simple_config('', '', "Error! Check squidGuard configuration data." . " (sg_create_config: [2]).");
@@ -1071,8 +1071,8 @@ function sg_create_config()
# delete blacklist entries from 'pass' if blacklist disabled
if ($squidguard_config[F_BLACKLISTENABLED] !== 'on') {
- acl_remove_blacklist_items(&$acl[F_DESTINATIONNAME]);
- acl_remove_blacklist_items(&$acl[F_OVERDESTINATIONNAME]);
+ acl_remove_blacklist_items($acl[F_DESTINATIONNAME]);
+ acl_remove_blacklist_items($acl[F_OVERDESTINATIONNAME]);
}
# not allowing IP in URL
@@ -1128,7 +1128,7 @@ function sg_create_config()
# delete blacklist entries from 'pass' if blacklist disabled
if ($squidguard_config[F_BLACKLISTENABLED] !== 'on')
- acl_remove_blacklist_items(&$def[F_DESTINATIONNAME]);
+ acl_remove_blacklist_items($def[F_DESTINATIONNAME]);
# not allowing IP in URL
if ($def[F_NOTALLOWINGIP])
@@ -1254,7 +1254,7 @@ function sg_redirector_base_url($rdr_info, $redirect_mode)
# check redirect
$errmsg = '';
- if (!sg_check_redirect($redirect_mode, $rdr_info, &$errmsg)) {
+ if (!sg_check_redirect($redirect_mode, $rdr_info, $errmsg)) {
$redirect_mode = RMOD_INT_ERRORPAGE;
$rdr_info = "Bad redirect settings. $errmsg Check you configuration.";
sg_addlog("sg_redirector_base_url", "$errmsg", SQUIDGUARD_ERROR);
@@ -1310,7 +1310,7 @@ function sg_aclpass_reorder($pass)
# ------------------------------------------------------------
# sg_check_config_data
# ------------------------------------------------------------
-function sg_check_config_data ($input_errors)
+function sg_check_config_data (&$input_errors)
{
global $squidguard_config;
$elog = array();
@@ -1327,14 +1327,14 @@ function sg_check_config_data ($input_errors)
# check name as unique and name format
$tm_name = $tm[F_NAME];
$err_s = '';
- if (!check_name_format($tm_name, &$err_s))
+ if (!check_name_format($tm_name, $err_s))
$elog[] = "(T1) TIME '$tm_name' error: >>> $err_s";
if ($key_tm[$tm_name] > 1)
$elog[] = "(T2) TIME '$tm_name' error: duplicate time name '$tm_name'";
# check time items format
- sg_check_time($tm, &$elog);
+ sg_check_time($tm, $elog);
}
}
@@ -1345,7 +1345,7 @@ function sg_check_config_data ($input_errors)
# check name as unique and name format
$src_name = $src[F_NAME];
$err_s = '';
- if (!check_name_format($src_name, &$err_s))
+ if (!check_name_format($src_name, $err_s))
$elog[] = "(A1) ACL '$src_name'error: $err_s";
if ($key_src[$src_name] > 1)
@@ -1362,13 +1362,13 @@ function sg_check_config_data ($input_errors)
# check name as unique and name format
$dst_name = $dst[F_NAME];
$err_s = '';
- if (!check_name_format($dst_name, &$err_s))
+ if (!check_name_format($dst_name, $err_s))
$elog[] = "(D1) DEST '$dst_name' error: $err_s";
if ($key_dst[$dst_name] > 1)
$elog[] = "(D2) DEST '$dst_name' error: duplicate destination name '$dst_name'";
#
- sg_check_dest($dst, &$elog);
+ sg_check_dest($dst, $elog);
}
}
@@ -1396,7 +1396,7 @@ function sg_check_config_data ($input_errors)
# check check name as unique and name format
$rw_name = $rw[F_NAME];
$err_s = '';
- if (!check_name_format($rw_name, &$err_s))
+ if (!check_name_format($rw_name, $err_s))
$elog[] = "(R1) REWRITE '$rw_name' error: $err_s";
if ($key_rw[$rw_name] > 1)
@@ -1674,7 +1674,7 @@ function is_username($username)
# ------------------------------------------------------------------------------
# check name
# ------------------------------------------------------------------------------
-function check_name_format ($name, $input_errors)
+function check_name_format ($name, &$input_errors)
{
$elog = array();
$val = trim($name);
@@ -1698,7 +1698,7 @@ function check_name_format ($name, $input_errors)
# ******************************************************************************
# check redirect
# ------------------------------------------------------------------------------
-function sg_check_redirect($rdr_mode, $rdr_info, $err_msg)
+function sg_check_redirect($rdr_mode, $rdr_info, &$err_msg)
{
$res = true;
switch($rdr_mode) {
@@ -1720,7 +1720,7 @@ function sg_check_redirect($rdr_mode, $rdr_info, $err_msg)
# ------------------------------------------------------------------------------
# sg_check_time
# ------------------------------------------------------------------------------
-function sg_check_time($sgtime, $input_errors)
+function sg_check_time($sgtime, &$input_errors)
{
$err = '';
$days = array("*", "mon", "tue", "wed", "thu", "fri", "sat", "sun");
@@ -1746,14 +1746,14 @@ function sg_check_time($sgtime, $input_errors)
# ------------------------------------------------------------------------------
# sg_check_dest
# ------------------------------------------------------------------------------
-function sg_check_dest($sgx, $input_errors)
+function sg_check_dest($sgx, &$input_errors)
{
$elog = array();
$dm = explode(" ", $sgx[F_DOMAINS]);
# $ex = explode(" ", $sgx[F_EXPRESSIONS]);
$ur = explode(" ", $sgx[F_URLS]);
- array_packitems(&$dm);
- array_packitems(&$ur);
+ array_packitems($dm);
+ array_packitems($ur);
# domain or ip
foreach ($dm as $d_it) {
@@ -1765,7 +1765,7 @@ function sg_check_dest($sgx, $input_errors)
if ($u_it && !is_dest_url($u_it)) $elog[] = "Item '$u_it' is not a url.";
# check redirect
- sg_check_redirect($sgx[F_RMOD], $sgx[F_REDIRECT], &$elog);
+ sg_check_redirect($sgx[F_RMOD], $sgx[F_REDIRECT], $elog);
# update log
if (!empty($elog)) {
@@ -1780,7 +1780,7 @@ function sg_check_dest($sgx, $input_errors)
# ------------------------------------------------------------------------------
# sg_check_src
# ------------------------------------------------------------------------------
-function sg_check_src($sgx, $input_errors)
+function sg_check_src($sgx, &$input_errors)
{
$elog = array();
@@ -1822,7 +1822,7 @@ function str_packspaces($str)
while(strpos($str, ' ')) $str = str_replace(' ', ' ', $str);
}
-function array_packitems($arval)
+function array_packitems(&$arval)
{
if (is_array($arval)) {
$arval = array_map("trim", $arval); # trim all items
@@ -1894,7 +1894,7 @@ function check_time($time)
# -----------------------------------------------------------------------------
# acl_remove_blacklist_items
# -----------------------------------------------------------------------------
-function acl_remove_blacklist_items($items)
+function acl_remove_blacklist_items(&$items)
{
# add !items and ^items
$db_entries = sg_entries_blacklist();
@@ -2081,8 +2081,8 @@ function squidguard_blacklist_update_start($url_filename)
function squidguard_blacklist_update_cancel()
{
# kill script and SG update process
- mwexec("kill `ps auxwwww | grep '" . SCR_NAME_BLKUPDATE . "' | grep -v 'grep' | awk '{print $2}'`");
- mwexec("kill `ps auxwwww | grep 'squidGuard -c .* -C all' | grep -v 'grep' | awk '{print $2}'`");
+ mwexec("/bin/kill `ps auxwwww | /usr/bin/grep '" . SCR_NAME_BLKUPDATE . "' | /usr/bin/grep -v 'grep' | /usr/bin/awk '{print $2}'`");
+ mwexec("/bin/kill `ps auxwwww | /usr/bin/grep 'squidGuard -c .* -C all' | /usr/bin/grep -v 'grep' | /usr/bin/awk '{print $2}'`");
squidguard_ramdisk(false);
squidguard_update_log("Blacklist update terminated by user.", "");
@@ -2102,7 +2102,7 @@ function squidguard_blacklist_update_clearlog()
# -----------------------------------------------------------------------------
function squidguard_blacklist_update_IsStarted()
{
- return exec("ps auxwwww | grep '" . SCR_NAME_BLKUPDATE . "' | grep -v 'grep' | awk '{print $2}' | wc -l | awk '{ print $1 }'");
+ return exec("/bin/ps auxwwww | /usr/bin/grep '" . SCR_NAME_BLKUPDATE . "' | /usr/bin/grep -v 'grep' | /usr/bin/awk '{print $2}' | /usr/bin/wc -l | /usr/bin/awk '{ print $1 }'");
}
# -----------------------------------------------------------------------------
@@ -2126,27 +2126,27 @@ function sg_reconfigure_blacklist($source_filename, $opt = '')
# 2. download
if ($sf[0] === "/") { # local file - example '/tmp/blacklists.tar'
- sg_addlog("sg_reconfigure_blacklist", "Update from file '$sf'.", SQUIDGUARD_INFO);
- squidguard_update_log("Copy archive from file '$sf'");
+ sg_addlog("sg_reconfigure_blacklist", "Update from file '{$sf}'.", SQUIDGUARD_INFO);
+ squidguard_update_log("Copy archive from file '{$sf}'");
if (file_exists($sf)) {
$sf_contents = file_get_contents($sf);
} else {
- sg_addlog("sg_reconfigure_blacklist", "File '$sf' not found.", SQUIDGUARD_ERROR);
- squidguard_update_log("File '$sf' not found.");
+ sg_addlog("sg_reconfigure_blacklist", "File '{$sf}' not found.", SQUIDGUARD_ERROR);
+ squidguard_update_log("File '{$sf}' not found.");
return;
}
}
# from url
else {
- sg_addlog("sg_reconfigure_blacklist", "Download from url '$sf'.", SQUIDGUARD_INFO);
+ sg_addlog("sg_reconfigure_blacklist", "Download from url '{$sf}'.", SQUIDGUARD_INFO);
squidguard_update_log("Start download.");
$sf_contents = sg_uploadfile_from_url($sf, $opt);
}
# 3. update
if (empty($sf_contents)) {
- sg_addlog("sg_reconfigure_blacklist", "Bad content from '$sf'. Terminate.", SQUIDGUARD_ERROR);
- squidguard_update_log("Bad content from '$sf'. Terminate.");
+ sg_addlog("sg_reconfigure_blacklist", "Bad content from '{$sf}'. Terminate.", SQUIDGUARD_ERROR);
+ squidguard_update_log("Bad content from '{$sf}'. Terminate.");
return;
}
@@ -2177,7 +2177,7 @@ function sg_update_blacklist($from_file)
$conf_path = SQUIDGUARD_VAR . DB_REBUILD_BLK_CONF;
$blklist_file = SQUIDGUARD_BLK_FILELISTPATH;
- sg_addlog("sg_update_blacklist", "Begin with '$from_file'.", SQUIDGUARD_INFO);
+ sg_addlog("sg_update_blacklist", "Begin with '{$from_file}'.", SQUIDGUARD_INFO);
if (file_exists($from_file)) {
# check work and DB dir's
@@ -2185,20 +2185,20 @@ function sg_update_blacklist($from_file)
if (file_exists($squidguard_config[F_WORKDIR])) $workdir = $squidguard_config[F_WORKDIR];
# delete old tmp dir's
- if (file_exists($tmp_unpack_dir)) mwexec("rm -R $tmp_unpack_dir");
- if (file_exists($arc_db_dir)) mwexec("rm -R $arc_db_dir");
+ if (file_exists($tmp_unpack_dir)) mwexec("/bin/rm -R {$tmp_unpack_dir}");
+ if (file_exists($arc_db_dir)) mwexec("/bin/rm -R {$arc_db_dir}");
squidguard_ramdisk(false);
# create new tmp/arc dir's, use ramdisk for quick operations
squidguard_ramdisk(true);
- mwexec("mkdir -p -m 0755 $tmp_unpack_dir");
- mwexec("mkdir -p -m 0755 $arc_db_dir");
+ mwexec("/bin/mkdir -p -m 0755 {$tmp_unpack_dir}");
+ mwexec("/bin/mkdir -p -m 0755 {$arc_db_dir}");
# 1. unpack archive
squidguard_update_log("Unpack archive");
- mwexec("tar zxvf $from_file -C $tmp_unpack_dir");
+ mwexec("/usr/bin/tar zxvf $from_file -C {$tmp_unpack_dir}");
set_file_access($tmp_unpack_dir, OWNER_NAME, 0755);
- sg_addlog("sg_update_blacklist", "Unpack uploaded file '$from_file' -> '$tmp_unpack_dir'.", SQUIDGUARD_INFO);
+ sg_addlog("sg_update_blacklist", "Unpack uploaded file '{$from_file}' -> '{$tmp_unpack_dir}'.", SQUIDGUARD_INFO);
# 2. copy blacklist to TempDB base & create entries list
squidguard_update_log("Scan blacklist categories.");
@@ -2207,11 +2207,11 @@ function sg_update_blacklist($from_file)
$blk_list = array();
# scan blacklist items
- scan_blacklist_cat($tmp_unpack_dir, "blk", & $blk_items);
+ scan_blacklist_cat($tmp_unpack_dir, "blk", $blk_items);
# move blacklist catalog structure to 'one level' (from tmp_DB to arch_DB)
foreach ($blk_items as $key => $val) {
- $current_dbpath = "$arc_db_dir/$key";
+ $current_dbpath = "{$arc_db_dir}/{$key}";
if (count($val)) {
# make blk_list for config file
$blk_list[$key] = $key;
@@ -2220,9 +2220,9 @@ function sg_update_blacklist($from_file)
# need moving $val['path'] to $current_dbpath
# if $current_dbpath exists, then $val['path'] will created as subdir - !it's worng!
if (file_exists($current_dbpath))
- mwexec("rm -R $current_dbpath");
- mwexec("mv -f {$val['path']}/ $current_dbpath");
- sg_addlog("sg_update_blacklist", "Move {$val['path']}/ -> $current_dbpath.", SQUIDGUARD_INFO);
+ mwexec("/bin/rm -R {$current_dbpath}");
+ mwexec("/bin/mv -f {$val['path']}/ {$current_dbpath}");
+ sg_addlog("sg_update_blacklist", "Move {$val['path']}/ -> {$current_dbpath}.", SQUIDGUARD_INFO);
}
}
set_file_access($arc_db_dir, OWNER_NAME, 0755);
@@ -2242,7 +2242,7 @@ function sg_update_blacklist($from_file)
file_put_contents($blklist_file, $cont);
set_file_access ($blklist_file, OWNER_NAME, 0755);
- sg_addlog("sg_update_blacklist", "Create DB entries list '$blklist_file'.", SQUIDGUARD_INFO);
+ sg_addlog("sg_update_blacklist", "Create DB entries list '{$blklist_file}'.", SQUIDGUARD_INFO);
squidguard_update_log("Found " . count($blk_items) . " items.");
}
@@ -2252,8 +2252,8 @@ function sg_update_blacklist($from_file)
squidguard_update_log("Copy DB to workdir.");
$blklist_file = $arc_db_dir . SQUIDGUARD_BLK_FILELIST;
- mwexec("cp -R -p $arc_db_dir/ $dbhome");
- mwexec("cp -f -p $blklist_file " . SQUIDGUARD_WORKDIR);
+ mwexec("/bin/cp -R -p {$arc_db_dir}/ {$dbhome}");
+ mwexec("/bin/cp -f -p {$blklist_file} " . SQUIDGUARD_WORKDIR);
set_file_access($dbhome, OWNER_NAME, 0755);
squidguard_update_log("Reconfigure Squid proxy.");
@@ -2266,7 +2266,7 @@ function sg_update_blacklist($from_file)
# free ramdisk
squidguard_ramdisk(false);
}
- else sg_addlog("sg_update_blacklist", "File $from_file not found.", SQUIDGUARD_ERROR);
+ else sg_addlog("sg_update_blacklist", "File {$from_file} not found.", SQUIDGUARD_ERROR);
}
# -----------------------------------------------------------------------------
@@ -2382,13 +2382,13 @@ function squidguard_blacklist_restore_arcdb()
if (file_exists($arc_db_dir)) {
conf_mount_rw();
# copy arc blacklist to work DB with permissions
- mwexec("cp -R -p $arc_db_dir/ $dbhome");
+ mwexec("/bin/cp -R -p {$arc_db_dir}/ {$dbhome}");
set_file_access($dbhome, OWNER_NAME, 0755);
- sg_addlog("squidguard_blacklist_restore_arcdb", "Restore blacklist archive from '$arc_db_dir'.", SQUIDGUARD_INFO);
+ sg_addlog("squidguard_blacklist_restore_arcdb", "Restore blacklist archive from '{$arc_db_dir}'.", SQUIDGUARD_INFO);
# generate blacklist files list
$blklist = "";
- $files = scan_dir("$arc_db_dir/");
+ $files = scan_dir("{$arc_db_dir}/");
if ($files) $blklist = implode("\n", $files);
file_put_contents($blklist_file, $blklist);
set_file_access($blklist_file, OWNER_NAME, 0755);
@@ -2401,8 +2401,8 @@ function squidguard_blacklist_restore_arcdb()
conf_mount_ro();
squidguard_update_log("Restore success.");
} else {
- sg_addlog("squidguard_blacklist_restore_arcdb", "File '$arc_db_dir' or '$blklist_file' not found.", SQUIDGUARD_ERROR);
- squidguard_update_log("Restore error: File '$arc_db_dir' or '$blklist_file' not found.");
+ sg_addlog("squidguard_blacklist_restore_arcdb", "File '{$arc_db_dir}' or '{$blklist_file}' not found.", SQUIDGUARD_ERROR);
+ squidguard_update_log("Restore error: File '{$arc_db_dir}' or '{$blklist_file}' not found.");
}
}
@@ -2416,7 +2416,7 @@ function squidguard_blacklist_restore_arcdb()
# ["urls"] urls file path
# ["expressions"] expressions file path
# ------------------------------------------------------------------------------
-function scan_blacklist_cat($curdir, $key_name, $cat_array)
+function scan_blacklist_cat($curdir, $key_name, &$cat_array)
{
if (file_exists($curdir) and is_dir($curdir)) {
@@ -2449,7 +2449,7 @@ function scan_blacklist_cat($curdir, $key_name, $cat_array)
$fls_key = $key_name . "_" . $fls;
# recursive call
- scan_blacklist_cat($fls_file, $fls_key, & $cat_array);
+ scan_blacklist_cat($fls_file, $fls_key, $cat_array);
}
}
}
diff --git a/config/squidGuard/squidguard_default.xml b/config/squidGuard/squidguard_default.xml
index 01380ea5..4a03c2b6 100644
--- a/config/squidGuard/squidguard_default.xml
+++ b/config/squidGuard/squidguard_default.xml
@@ -134,10 +134,10 @@
</field>
</fields>
<custom_php_validation_command>
- squidguard_validate_acl(&amp;$_POST, &amp;$input_errors);
+ squidguard_validate_acl($_POST, $input_errors);
</custom_php_validation_command>
<custom_php_command_before_form>
- squidguard_before_form_acl(&amp;$pkg, false);
+ squidguard_before_form_acl($pkg, false);
</custom_php_command_before_form>
<custom_php_after_form_command>
squidGuard_print_javascript();
diff --git a/config/squidGuard/squidguard_dest.xml b/config/squidGuard/squidguard_dest.xml
index 3525098e..5f128a49 100644
--- a/config/squidGuard/squidguard_dest.xml
+++ b/config/squidGuard/squidguard_dest.xml
@@ -172,10 +172,10 @@
</field>
</fields>
<custom_php_command_before_form>
- squidguard_before_form_dest(&amp;$pkg);
+ squidguard_before_form_dest($pkg);
</custom_php_command_before_form>
<custom_php_validation_command>
- squidguard_validate_destination($_POST, &amp;$input_errors);
+ squidguard_validate_destination($_POST, $input_errors);
</custom_php_validation_command>
<custom_php_resync_config_command>
squidguard_resync_dest();
diff --git a/config/squidGuard/squidguard_log.php b/config/squidGuard/squidguard_log.php
index 8eba2311..fae61a8c 100644
--- a/config/squidGuard/squidguard_log.php
+++ b/config/squidGuard/squidguard_log.php
@@ -77,14 +77,14 @@ function squidguard_log_AJAX_response( $request )
$res = squidguard_prep_textareacont($cont);
break;
case 'guilog':
- $res = squidguard_logrep(squidguard_guidump( &$offset, 50, true));
+ $res = squidguard_logrep(squidguard_guidump( $offset, 50, true));
break;
case 'filterlog':
- $res = squidguard_logrep(squidguard_filterdump( &$offset, 50, true));
+ $res = squidguard_logrep(squidguard_filterdump( $offset, 50, true));
break;
case "blocked":
default:
- $res = squidguard_logrep(squidguard_blockdump( &$offset, 50, true));
+ $res = squidguard_logrep(squidguard_blockdump( $offset, 50, true));
break;
}
@@ -93,7 +93,7 @@ function squidguard_log_AJAX_response( $request )
return $res;
}
-function squidguard_logrep( $dump )
+function squidguard_logrep( &$dump )
{
$res = '';
diff --git a/config/squidGuard/squidguard_rewr.xml b/config/squidGuard/squidguard_rewr.xml
index c21cb1c0..4b55292d 100644
--- a/config/squidGuard/squidguard_rewr.xml
+++ b/config/squidGuard/squidguard_rewr.xml
@@ -136,7 +136,7 @@
squidGuard_print_javascript();
</custom_php_after_form_command>
<custom_php_validation_command>
- squidguard_validate_rewrite($_POST, &amp;$input_errors);
+ squidguard_validate_rewrite($_POST, $input_errors);
</custom_php_validation_command>
<custom_php_resync_config_command>
// squidguard_resync_rewrite();
diff --git a/config/squidGuard/squidguard_time.xml b/config/squidGuard/squidguard_time.xml
index dfd589aa..7f682174 100644
--- a/config/squidGuard/squidguard_time.xml
+++ b/config/squidGuard/squidguard_time.xml
@@ -136,7 +136,7 @@
squidGuard_print_javascript();
</custom_php_after_form_command>
<custom_php_validation_command>
- squidguard_validate_times(&amp;$_POST, &amp;$input_errors);
+ squidguard_validate_times($_POST, $input_errors);
</custom_php_validation_command>
<custom_php_resync_config_command>
// squidguard_resync_time();