132,6 → 132,11 |
$l_nbDomainNames="Noms de domaine :"; |
$l_nbUrl="Url :"; |
$l_nbIp="Ip :"; |
$l_update_cat="Mise a jour des catégories automatiquement?"; |
$l_no_update_cat = "désactiver"; |
$l_1_update_cat = "toutes les 12 heures"; |
$l_2_update_cat = "toutes les semaines"; |
$l_3_update_cat = "tous les mois"; |
} |
else { |
$l_bl="BlackList"; |
178,6 → 183,11 |
$l_nbDomainNames="Domain names :"; |
$l_nbUrl="Url :"; |
$l_nbIp="Ip :"; |
$l_update_cat="Mise a jour des catégories automatiquement?"; |
$l_no_update_cat = "Disable"; |
$l_1_update_cat = "every 12 hours"; |
$l_2_update_cat = "every weeks"; |
$l_3_update_cat = "every month"; |
} |
$dir_etc="/usr/local/etc/"; |
$dir_dg="/etc/dansguardian/lists/"; |
192,6 → 202,34 |
$upload_dir_ip = "/usr/local/share/iptables-bl-enabled/"; |
$upload_dir_domain_names = "/usr/local/share/dnsmasq-bl-enabled/"; |
$cron_apache = "/etc/cron.d/alcasar-update-cat"; |
$update_file_cat="/usr/local/etc/update_cat.conf"; |
if(isset($_POST['update_cat'])) |
{ |
|
$fichier=fopen($cron_apache,"w+"); |
$update_mode = $_POST['update_cat']; |
switch($update_mode){ |
case 0: |
fputs($fichier, "#0 update with rsync categories is disabled\n"); |
break; |
case 1: |
fputs($fichier, "#1 update with rsync every 12 hours\n"); |
fputs($fichier, "0 0-23/12 * * * /usr/local/bin/alcasar-bl.sh --update_cat \n"); |
break; |
case 2: |
fputs($fichier, "#2 update with rsync every week (Sunday) at 00:00\n"); |
fputs($fichier, "0 0 * * 0 /usr/local/bin/alcasar-bl.sh --update_cat \n"); |
break; |
case 3: |
fputs($fichier, "#3 update with rsync every month (1st) at 00:00\n"); |
fputs($fichier, "0 0 1 * * /usr/local/bin/alcasar-bl.sh --update_cat \n"); |
break; |
} |
|
|
fclose($fichier); |
} |
|
# default values |
if (is_file ($conf_file)) |
{ |
227,7 → 265,6 |
case 'MAJ_cat_bl' : |
if (file_exists($bl_categories_enabled)) |
{ |
$cron_malware = 0; |
$pointeur=fopen($bl_categories_enabled, "w+"); |
foreach ($_POST as $key => $value) |
{ |
235,20 → 272,13 |
{ |
$line=str_replace('chk-','',$key)."\n"; |
fwrite($pointeur,$line); |
if(trim($line) == 'malware') |
if(trim($line) == 'malware' && $update_mode > 0) |
{ |
$cron_malware = 1; |
$fichier=fopen($cron_apache,"w+"); |
fputs($fichier, "# update malware categories every 12 hours\n"); |
fputs($fichier, "* 0-23/12 * * * /usr/local/bin/alcasar-bl.sh --update-cat malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n"); |
$fichier=fopen($update_file_cat,"w+"); |
fputs($fichier, "malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n"); |
} |
} |
} |
if(!$cron_malware) |
{ |
$fichier=fopen($cron_apache,"w+"); |
fputs($fichier, "# malware updates disabled\n"); |
} |
|
fclose($pointeur); |
} |
409,9 → 439,40 |
} |
else { |
echo "$l_error_open_file $bl_categories"; |
} |
} |
|
#update categories via rsync |
$update_select = array(); |
$update_select[0] = ""; |
$update_select[1] = ""; |
$update_select[2] = ""; |
$update_select[3] = ""; |
|
$pointeur=fopen($cron_apache,'r'); |
while (!feof ($pointeur)) |
{ |
$line=fgets($pointeur,1024); |
if(explode(' ',$line)[0] === "#0") |
$update_select[0]="checked"; |
if(explode(' ',$line)[0] === "#1") |
$update_select[1]="checked"; |
if(explode(' ',$line)[0] === "#2") |
$update_select[2]="checked"; |
if(explode(' ',$line)[0] === "#3") |
$update_select[3]="checked"; |
} |
fclose($pointeur); |
|
echo "</td></tr>"; |
echo "<tr><td valign='middle' align='left' colspan=10>"; |
echo "<center>$l_update_cat |
<input type='radio' name='update_cat' value=0 $update_select[0]> $l_no_update_cat |
<input type='radio' name='update_cat' value=1 $update_select[1]> $l_1_update_cat |
<input type='radio' name='update_cat' value=2 $update_select[2]> $l_2_update_cat |
<input type='radio' name='update_cat' value=3 $update_select[3]> $l_3_update_cat |
<input type='submit' value='$l_record'></center>"; |
echo "</td></tr>"; |
echo "<tr><td valign='middle' align='left' colspan=10>"; |
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>"; |
echo "<tr><td width=50% colspan=5 align=center>"; |
echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain<BR>$l_one_dns<BR>"; |
538,3 → 599,4 |
</BODY> |
</HTML> |
|
|