diff options
author | Chris Buechler <cmb@pfsense.org> | 2012-03-30 20:56:06 -0700 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2012-03-30 20:56:06 -0700 |
commit | 949a8708959e8777c17e8d21fc20791af2616f94 (patch) | |
tree | dae83b59de43df0202f6d32a09f5aa48f0c5f793 /config | |
parent | 7852acc1ede90c850669e6d94568c53c5fb807d4 (diff) | |
parent | 63f8ba46162fc25d5512fdcfe91d9f622de6e52e (diff) | |
download | pfsense-packages-949a8708959e8777c17e8d21fc20791af2616f94.tar.gz pfsense-packages-949a8708959e8777c17e8d21fc20791af2616f94.tar.bz2 pfsense-packages-949a8708959e8777c17e8d21fc20791af2616f94.zip |
Merge pull request #233 from saxonbeta/master
SquidGuard: Added option to general settings to show a blank gif image for the advertising category
Diffstat (limited to 'config')
-rw-r--r-- | config/squidGuard/squidguard.inc | 10 | ||||
-rw-r--r-- | config/squidGuard/squidguard.xml | 6 | ||||
-rw-r--r-- | config/squidGuard/squidguard_configurator.inc | 12 |
3 files changed, 24 insertions, 4 deletions
diff --git a/config/squidGuard/squidguard.inc b/config/squidGuard/squidguard.inc index c1680adb..856e15b6 100644 --- a/config/squidGuard/squidguard.inc +++ b/config/squidGuard/squidguard.inc @@ -326,7 +326,7 @@ function squidguard_resync() { # apply changes //if ($submit == APPLY_BTN) { # write_config('Update squidGuard options.'); # store, if not 'Save' button -# перенести в validate для детектирования ошибок? + sg_reconfigure(); //} @@ -817,7 +817,7 @@ function squidguard_install_command() { # conf_mount_rw(); $blklist_file = SQUIDGUARD_BLK_FILELISTPATH; - # рассмотреть вариант слияния examples базы и существующей в системе + if (!file_exists($blklist_file)) { # if blacklist not exists, then copy default db from samples # $entries = array("ads", "aggressive", "audio-video", "drugs", "gambling", "hacking", "mail", "porn", "proxy", "violence", "warez"); @@ -934,6 +934,10 @@ function convert_pfxml_to_sgxml() { $sgxml[F_ENABLEGUILOG] = $pfxml['enable_guilog'] == 'on' ? 'on' : 'off'; $sgxml[F_LOGROTATION] = $pfxml['log_rotation'] == 'on' ? 'on' : 'off'; + #Clean adversiting + $sgxml[F_ADV_BLANKIMG] = $pfxml['adv_blankimg'] == 'on' ? 'on' : 'off'; + + # other $lanip = $config['interfaces']['lan']['ipaddr']; $sgxml[F_CURRENT_LAN_IP] = $lanip; @@ -1395,4 +1399,4 @@ function squidguard_blacklist_list() return $res; } -?> +?>
\ No newline at end of file diff --git a/config/squidGuard/squidguard.xml b/config/squidGuard/squidguard.xml index 61bdf146..a23df167 100644 --- a/config/squidGuard/squidguard.xml +++ b/config/squidGuard/squidguard.xml @@ -132,6 +132,12 @@ <type>checkbox</type> </field> <field> + <fielddescr>Clean Advertising</fielddescr> + <fieldname>adv_blankimg</fieldname> + <description>Check this to display a blank gif image instead the default block page. With this option you get a cleaner page.</description> + <type>checkbox</type> + </field> + <field> <name>Blacklist options</name> <type>listtopic</type> </field> diff --git a/config/squidGuard/squidguard_configurator.inc b/config/squidGuard/squidguard_configurator.inc index 3347b48b..c69ef0ee 100644 --- a/config/squidGuard/squidguard_configurator.inc +++ b/config/squidGuard/squidguard_configurator.inc @@ -273,6 +273,9 @@ define('F_ENABLELOG', 'enablelog'); define('F_ENABLEGUILOG', 'enableguilog'); define('F_LOGROTATION', 'logrotation'); +#Clean adversiting +define('F_ADV_BLANKIMG', 'adv_blankimg'); + # transparent mode define('F_SQUID_TRANSPARENT_MODE', 'squid_transparent_mode'); define('F_CURRENT_LAN_IP', 'current_lan_ip'); @@ -910,6 +913,13 @@ function sg_create_config() if ($ent_state[F_DOMAINS]) $sg_tag->items[] = "domainlist $ent/domains"; if ($ent_state[F_EXPRESSIONS]) $sg_tag->items[] = "expressionlist $ent/expressions"; if ($ent_state[F_URLS]) $sg_tag->items[] = "urllist $ent/urls"; + + # Check if $ent contains adv or ads, and F_ADV_BLANKIMG is on then add a custom redirect + $adv_pos = strpos($ent,'_adv'); + $ads_pos = strpos($ent, '_ads'); + if ( ($ads_pos > 0 || $adv_pos > 0) && $squidguard_config[F_ADV_BLANKIMG] == 'on') + $sg_tag->items[] = "redirect " . sg_redirector_base_url($dst[F_REDIRECT], RMOD_INT_BLANKIMG); + if ($squidguard_config[F_ENABLELOG] == 'on' ) { $sg_tag->items[] = "log ". SQUIDGUARD_LOGFILE; } @@ -2450,4 +2460,4 @@ class TSgTag } } -?> +?>
\ No newline at end of file |