From ecaa076bd3f09df7f479253b1e7f48672a87c0f6 Mon Sep 17 00:00:00 2001
From: Frederic Marchal ";
+ printf(gettext("The path %s (which is supposed to be the squidGuard DB home) is not a directory"),$dbhome);
+ echo " ";
+ printf(gettext("No squidGuard rule found in %s"),$dbhome);
+ echo " ";
+ printf(gettext("Cannot read squidGuard DB home directory %s"),$dbhome);
+ echo "\n";
-echo "
\n";
-echo " \n";
-echo "";
-print(gettext ("Sarg-SquidGuard - URL Blocking"));
-echo " \n";
-echo "";
-printf(gettext("Choose the rule set where %s will be added"),"$url ");
-echo " \n";
-
$lines=file($squidGuardConf);
array_walk($lines,'parse_config');
-if (is_dir($dbhome)) {
- if ($ha1 = opendir($dbhome)) {
- while (false !== ($file = readdir($ha1))) {
- if ($file == '.' || $file == '..') continue;
- echo "
\n";
- $dir2 = $dbhome.'/'.$file;
- if (is_dir($dir2)) {
- if ($ha2 = opendir($dir2)) {
- while (false !== ($file2 = readdir($ha2))) {
- if ($file2 == '.' || $file2 == '..') continue;
- echo "$file \n";
- }
- }
- closedir($ha2);
- }
- }
- closedir($ha1);
- }
-}
+?>
+
+
+
+
+$file2
+
+\n";
-echo "\n";
+if (!is_dir($dbhome))
+{
+ echo "
+
+
+$url")?> \n";
+ $table=true;
+ }
+ if ($first)
+ {
+ echo "
\n";
+ }
+ else
+ {
+ echo " \n";
+ $first=false;
+ }
+ echo "$file \n";
+ }
+ }
+ closedir($ha2);
+ }
+ }
+ closedir($ha1);
+ if ($table)
+ {
+ echo "$file2
"; + echo gettext("Write error"); + echo "
\n"; + exit; } + +echo "",gettext("Done!"),"
\n"; +printf(gettext("Return to Sarg."),"javascript:history.go(-2)"); +echo "
\n"; +?> +diff --git a/sarg-php/sarg-squidguard-block2.php b/sarg-php/sarg-squidguard-block2.php index e717e03..529845b 100755 --- a/sarg-php/sarg-squidguard-block2.php +++ b/sarg-php/sarg-squidguard-block2.php @@ -40,10 +40,6 @@ if (!isset($_GET['url'])) } $url = $_GET['url']; $url = $url."\n"; -if (isset($_GET['lang'])) -{ - $language = $_GET['lang']; -} putenv("LANG=$language"); if (!setlocale(LC_ALL, $language)) @@ -57,19 +53,51 @@ $domain = 'messages'; bindtextdomain($domain, "./locale"); textdomain($domain); +function parse_config($line,$clave) { + if (preg_match("/dbhome/i", $line)) { + global $dbhome; + $l = explode(' ', $line); + list(, $dbhome) = $l; + $dbhome=preg_replace('/\s+/','',$dbhome); + } +} + +global $dbhome; +$lines=file($squidGuardConf); +array_walk($lines,'parse_config'); +$file=$dbhome.'/'.$file; + +?> + + +
+ +
+ +
-- 2.47.2