Subversion Repositories ALCASAR

Rev

Rev 3028 | Rev 3179 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3028 Rev 3173
Line 21... Line 21...
21
function form_filter_ip($form_content, $color)
21
function form_filter_ip($form_content, $color)
22
{
22
{
23
	//# reconstruction des ip
23
	//# reconstruction des ip
24
	$list = explode("\n", form_filter($form_content));
24
	$list = explode("\n", form_filter($form_content));
25
	$new_list = "";
25
	$new_list = "";
26
	foreach($list as &$value)
26
	foreach ($list as &$value)
27
	{
27
	{
28
		if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
28
		if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
29
		{
29
		{
30
			$new_list = $new_list.$value."\n";
30
			$new_list = $new_list.$value."\n";
31
		}
31
		}
Line 328... Line 328...
328
			if (strstr($key,'chk-safesearch')) $bl_safesearch="on";
328
			if (strstr($key,'chk-safesearch')) $bl_safesearch="on";
329
		}
329
		}
330
		exec ("sudo /usr/local/bin/alcasar-url_filter_bl.sh -safesearch_$bl_safesearch -pureip_$bl_pureip");
330
		exec ("sudo /usr/local/bin/alcasar-url_filter_bl.sh -safesearch_$bl_safesearch -pureip_$bl_pureip");
331
		break;
331
		break;
332
	case 'MAJ_ossi_file' :
332
	case 'MAJ_ossi_file' :
333
		foreach($_POST as $fichier => $value)
333
		foreach ($_POST as $fichier => $value)
334
		{
334
		{
335
			if($fichier != "choix" && $fichier != "update_cat")
335
			if($fichier != "choix" && $fichier != "update_cat")
336
			{
336
			{
337
				$action=$_POST[$fichier];
337
				$action=$_POST[$fichier];
338
				if($action == $l_remove) //delete
338
				if($action == $l_remove) //delete
Line 363... Line 363...
363
					        echo "<p>".$l_update_success."</p>";
363
					        echo "<p>".$l_update_success."</p>";
364
				        }
364
				        }
365
				        else
365
				        else
366
				        {
366
				        {
367
					        echo "<p>".$l_update_failed.":</p>";
367
					        echo "<p>".$l_update_failed.":</p>";
368
					        foreach($out as $line)
368
					        foreach ($out as $line)
369
					        {
369
					        {
370
						        echo "<p>".$line."</p>";
370
						        echo "<p>".$line."</p>";
371
					        }
371
					        }
372
				        }
372
				        }
373
                    }
373
                    }
Line 380... Line 380...
380
		$f = fopen($update_file_ossi_cat, 'w');
380
		$f = fopen($update_file_ossi_cat, 'w');
381
		fclose($f);
381
		fclose($f);
382
        $f = fopen($update_file_ossi_cat, 'w');
382
        $f = fopen($update_file_ossi_cat, 'w');
383
		fclose($f);
383
		fclose($f);
384
		
384
		
385
        foreach($_POST as $fichier => $value)
385
        foreach ($_POST as $fichier => $value)
386
		{
386
		{
387
			// General BL
387
			// General BL
388
			if ($fichier == 'update_cat' && $value == 1)
388
			if ($fichier == 'update_cat' && $value == 1)
389
			{
389
			{
390
				if (file_exists($bl_categories_enabled))
390
				if (file_exists($bl_categories_enabled))
Line 472... Line 472...
472
$cols=1;
472
$cols=1;
473
if (file_exists($bl_categories))
473
if (file_exists($bl_categories))
474
{
474
{
475
	$bl_files = file($bl_categories);
475
	$bl_files = file($bl_categories);
476
	$bl_files = preg_grep("/ossi-/", $bl_files, 1); // don't display ossi custom categories
476
	$bl_files = preg_grep("/ossi-/", $bl_files, 1); // don't display ossi custom categories
477
	foreach($bl_files as $fichier => $value)
477
	foreach ($bl_files as $fichier => $value)
478
	{
478
	{
479
		if ($cols == 1) { echo "<tr>";}
479
		if ($cols == 1) { echo "<tr>";}
480
		$categorie=trim(basename($value));
480
		$categorie=trim(basename($value));
481
		echo "<td><a href='bl_categories_help.php?liste=bl&cat=$categorie' target='cat_help' onclick=\"window.open('bl_categories_help.php','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>$categorie</a><br>";
481
		echo "<td><a href='bl_categories_help.php?liste=bl&cat=$categorie' target='cat_help' onclick=\"window.open('bl_categories_help.php','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>$categorie</a><br>";
482
		echo "<input type='checkbox' name='chk-$categorie'";
482
		echo "<input type='checkbox' name='chk-$categorie'";
Line 536... Line 536...
536
echo "<input type='hidden' name='choix' value='MAJ_ossi_file'>";
536
echo "<input type='hidden' name='choix' value='MAJ_ossi_file'>";
537
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_nb_domain_names<th colspan=3>$l_file_action</tr>";
537
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_nb_domain_names<th colspan=3>$l_file_action</tr>";
538
//list OSSI custom categories
538
//list OSSI custom categories
539
$fichiersbl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
539
$fichiersbl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
540
$fichiersbl = preg_grep("/^ossi-bl-/",$fichiersbl);
540
$fichiersbl = preg_grep("/^ossi-bl-/",$fichiersbl);
541
foreach($fichiersbl as $fichier => $value)
541
foreach ($fichiersbl as $fichier => $value)
542
{
542
{
543
	echo "<tr><td><center><a href='bl_categories_help.php?liste=bl&cat=$value&filtre=domain' target='cat_help' onclick=\"window.open('bl_categories_help','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>".substr($value,8)."</a></center></td><td><center>".exec("wc -l $dir_bl_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_bl_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value'";
543
	echo "<tr><td><center><a href='bl_categories_help.php?liste=bl&cat=$value&filtre=domain' target='cat_help' onclick=\"window.open('bl_categories_help','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>".substr($value,8)."</a></center></td><td><center>".exec("wc -l $dir_bl_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_bl_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value'";
544
	if (file_exists ($dir_bl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
544
	if (file_exists ($dir_bl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
545
	echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td>";
545
	echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td>";
546
	if (in_array($value,$updateable_ossi_bls)) echo "<td><center><input type='submit' name='$value' value='$l_update'></center></td>"; else echo "<td><center>$l_no_update_configured</center></td>";
546
	if (in_array($value,$updateable_ossi_bls)) echo "<td><center><input type='submit' name='$value' value='$l_update'></center></td>"; else echo "<td><center>$l_no_update_configured</center></td>";
Line 582... Line 582...
582
echo "<td>".$l_update_cat."</td>";
582
echo "<td>".$l_update_cat."</td>";
583
echo "<td><input type='radio' name='update_cat' value=0 ".$update_select[0]." >".$l_disable;
583
echo "<td><input type='radio' name='update_cat' value=0 ".$update_select[0]." >".$l_disable;
584
echo "<input type='radio' name='update_cat' value=1 ".$update_select[1]." >".$l_enable;
584
echo "<input type='radio' name='update_cat' value=1 ".$update_select[1]." >".$l_enable;
585
echo "</td>";
585
echo "</td>";
586
// Display update checkbox for each updateable ossi-bl
586
// Display update checkbox for each updateable ossi-bl
587
foreach($updateable_ossi_bls as $value)
587
foreach ($updateable_ossi_bls as $value)
588
{
588
{
589
    //check if autoupdate is enabled
589
    //check if autoupdate is enabled
590
    $update_ossi_select = ["", ""];
590
    $update_ossi_select = ["", ""];
591
    if ( strpos(file_get_contents($update_file_ossi_cat),$value) !== false ) $update_ossi_select[1] = "checked";
591
    if ( strpos(file_get_contents($update_file_ossi_cat),$value) !== false ) $update_ossi_select[1] = "checked";
592
    else $update_ossi_select[0] = "checked";
592
    else $update_ossi_select[0] = "checked";