]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
May fix some errors in sarg-php
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Mon, 14 Apr 2014 11:06:00 +0000 (13:06 +0200)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Mon, 14 Apr 2014 11:06:00 +0000 (13:06 +0200)
Sarg-php was in a sorry state but as Jose Vicente Mondejar kindly provided
a translation, I felt obliged to try to improve things a bit.

I can't test it on my computer. I hope I didn't broke it more than it was.

16 files changed:
sarg-php/INSTALL
sarg-php/LANGUAGES
sarg-php/config.php.inc [new file with mode: 0644]
sarg-php/language.php [deleted file]
sarg-php/locale/en_EN/LC_MESSAGES/messages.po
sarg-php/locale/es/LC_MESSAGES/messages.mo [new file with mode: 0644]
sarg-php/locale/es/LC_MESSAGES/messages.po [new file with mode: 0644]
sarg-php/locale/fr/LC_MESSAGES/messages.po
sarg-php/locale/pt_BR/LC_MESSAGES/messages.po
sarg-php/locale/ru/LC_MESSAGES/messages.po
sarg-php/sarg-block-it.php
sarg-php/sarg-squidguard-block.php
sarg-php/sarg-squidguard-block2.php
sarg-php/translate.this
sarg-php/update-mo.sh [new file with mode: 0644]
sarg-php/update-po.sh [new file with mode: 0644]

index e3e887b87f992f8ba90694eca14c737e9f27cae5..2e7f45b08e0e979d1226149d6f7f6d69c696b214 100644 (file)
@@ -1,9 +1,7 @@
 *
 To use sarg-squidGuard you need to change:
 
-1. These two variables on sarg-squidguard-block.php file:
-$SargConf = "/usr/local/sarg/sarg.conf";
-$squidGuardConf = "/usr/local/squidGuard/squidGuard.conf";
+1. These the variables in config.php.inc file:
 
 2.change the squidGuard db file to the same httpd process owner:
 chown apache /var/www/html/sarg-php
index 303792363e21435bcbae6969a393e8caf3942557..6008097b8083bd9b24faca801803227686090725 100644 (file)
@@ -1,9 +1,10 @@
 This PHP modules is under i18n. 
 Available languages:
 
-       English                 Pedro Orso <pedro.orso@gmail.com>
+       English                                 Pedro Orso <pedro.orso@gmail.com>
        Brazilian_Portuguese    Pedro Orso <pedro.orso@gmail.com>
-       French                  Jacques GRILLOT <Jacques.Grillot@grouperdi.com>
+       French                                  Jacques GRILLOT <Jacques.Grillot@grouperdi.com>
+       Spanish                                 Jose Vicente Mondejar <jomonbre@gmail.com>
        Russian                 Michael Stepanenko <mistic@ecolines.ru>
 
 Thank you, my friends.
diff --git a/sarg-php/config.php.inc b/sarg-php/config.php.inc
new file mode 100644 (file)
index 0000000..cc03867
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+// Change to squidGuard and sarg config file paths
+$SargConf = "/usr/local/sarg/sarg.conf";
+$squidGuardConf = "/usr/local/squidGuard/squidGuard.conf";
+
+// File where URL to block will be appended
+$DefaultSquidBlock = "/usr/local/squid/etc/block.txt";
+
+// Choose the locale you want to use to display messages (it must exist on your system)
+$language = "fr_BE.utf-8";
+
+?>
diff --git a/sarg-php/language.php b/sarg-php/language.php
deleted file mode 100755 (executable)
index 51d469a..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-/*
- * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
- *                                                            1998, 2010
- *
- * SARG donations:
- *      please look at http://sarg.sourceforge.net/donations.php
- * Support:
- *     http://sourceforge.net/projects/sarg/forums/forum/363374
- * ---------------------------------------------------------------------
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
- */
-
-global $language;
-global $SargConf;
-
-function sarg_config($line,$clave) {
-   if ( 0 == strncmp("#", $line, 1))
-      return;
-   if (preg_match("/language/i", $line)) {
-      global $language;
-      $l = explode(' ', $line);
-      list(, $lang) = $l;
-      $lang=preg_replace('/\s+/','',$lang);
-      if ( 0 == strcmp("English", $lang))
-         $language = "en-EN";
-      else if ( 0 == strcmp("Portuguese", $lang))
-         $language = "pt_BR";
-      else if ( 0 == strcmp("French", $lang))
-         $language = "fr";
-      else if ( 0 == strcmp("Russian", $lang))
-         $language = "ru";
-      return;
-   }
-}
-
-
-$lines=file($SargConf);
-array_walk($lines,'sarg_config');
-
-putenv("LANG=$language");
-setlocale(LC_ALL, $language);
-$domain = 'messages';
-bindtextdomain($domain, "./locale");
-textdomain($domain);
-return;
-
-?>
index 1f23a042bf23422e077c1787cb2006b6630fb777..6f5ff42dd2039ec44cf1e5598989f213c38e457c 100755 (executable)
@@ -8,42 +8,64 @@ msgid ""
 msgstr ""
 "Project-Id-Version: sarg-squidGuard 1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-08-12 11:14-0300\n"
+"POT-Creation-Date: 2014-04-14 12:46+0200\n"
 "PO-Revision-Date: 2004-08-12 11:14-0400\n"
 "Last-Translator: Pedro Lineu Orso <orso@brturbo.com>\n"
 "Language-Team: English\n"
+"Language: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: sarg-squidguard-block2.php:10
-msgid "Could not open the file"
+#: sarg-block-it.php:32
+msgid "No URL passed as argument"
 msgstr ""
 
-#: sarg-squidguard-block2.php:19
+#: sarg-block-it.php:40 sarg-squidguard-block2.php:62
+#, php-format
+msgid "Could not open file: %s"
+msgstr ""
+
+#: sarg-block-it.php:47 sarg-squidguard-block2.php:69
 msgid "Write error"
 msgstr ""
 
-#: sarg-squidguard-block2.php:23
+#: sarg-block-it.php:50 sarg-squidguard-block2.php:72
 msgid "Done!"
 msgstr ""
 
-#: sarg-squidguard-block2.php:27
-msgid "Return"
+#: sarg-block-it.php:52 sarg-squidguard-block2.php:74
+#, php-format
+msgid "<a href=\"%s\">Return</a> to Sarg."
 msgstr ""
 
-#: sarg-squidguard-block2.php:30
-msgid " to Sarg."
+#: sarg-squidguard-block2.php:32
+msgid "No file passed as argument"
 msgstr ""
 
-#: sarg-squidguard-block.php:29
-msgid "Sarg-SquidGuard - URL Blocking"
+#: sarg-squidguard-block2.php:38
+msgid "No url passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:52
+#, php-format
+msgid "Invalid locale %s"
 msgstr ""
 
-#: sarg-squidguard-block.php:33
-msgid "Choose the rule set where"
+#: sarg-squidguard-block.php:37
+#, php-format
+msgid "Invalid locale: %s"
+msgstr ""
+
+#: sarg-squidguard-block.php:48
+msgid "No URL to block"
+msgstr ""
+
+#: sarg-squidguard-block.php:66
+msgid "Sarg-SquidGuard - URL Blocking"
 msgstr ""
 
-#: sarg-squidguard-block.php:36
-msgid "will by added"
+#: sarg-squidguard-block.php:69
+#, php-format
+msgid "Choose the rule set where %s will be added"
 msgstr ""
diff --git a/sarg-php/locale/es/LC_MESSAGES/messages.mo b/sarg-php/locale/es/LC_MESSAGES/messages.mo
new file mode 100644 (file)
index 0000000..1618b3a
Binary files /dev/null and b/sarg-php/locale/es/LC_MESSAGES/messages.mo differ
diff --git a/sarg-php/locale/es/LC_MESSAGES/messages.po b/sarg-php/locale/es/LC_MESSAGES/messages.po
new file mode 100644 (file)
index 0000000..a9a7624
--- /dev/null
@@ -0,0 +1,74 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: sarg-squidGuard 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-04-14 12:46+0200\n"
+"PO-Revision-Date: 2014-04-14 11:19+0200\n"
+"Last-Translator: José Vicente Mondéjar <jomonbre@gmail.com>\n"
+"Language-Team: Spanish\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sarg-block-it.php:32
+msgid "No URL passed as argument"
+msgstr ""
+
+#: sarg-block-it.php:40 sarg-squidguard-block2.php:62
+#, fuzzy, php-format
+msgid "Could not open file: %s"
+msgstr "No se pudo abrir el fichero"
+
+#: sarg-block-it.php:47 sarg-squidguard-block2.php:69
+msgid "Write error"
+msgstr "Error de escritura"
+
+#: sarg-block-it.php:50 sarg-squidguard-block2.php:72
+msgid "Done!"
+msgstr "Hecho!"
+
+#: sarg-block-it.php:52 sarg-squidguard-block2.php:74
+#, php-format
+msgid "<a href=\"%s\">Return</a> to Sarg."
+msgstr ""
+
+#: sarg-squidguard-block2.php:32
+msgid "No file passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:38
+msgid "No url passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:52
+#, php-format
+msgid "Invalid locale %s"
+msgstr ""
+
+#: sarg-squidguard-block.php:37
+#, php-format
+msgid "Invalid locale: %s"
+msgstr ""
+
+#: sarg-squidguard-block.php:48
+msgid "No URL to block"
+msgstr ""
+
+#: sarg-squidguard-block.php:66
+msgid "Sarg-SquidGuard - URL Blocking"
+msgstr "Sarg-SquidGuard - Bloqueo de URLs"
+
+#: sarg-squidguard-block.php:69
+#, fuzzy, php-format
+msgid "Choose the rule set where %s will be added"
+msgstr "Elegir el conjunto de reglas donde"
+
+#~ msgid "Return"
+#~ msgstr "Volver"
+
+#~ msgid " to Sarg."
+#~ msgstr " a Sarg."
+
+#~ msgid "will by added"
+#~ msgstr "será añadido"
index 0cf54051395c9028be72af9d21ecea118a79fca5..5a59d78f0e317e334c37dcf0ac8639fc32435a06 100755 (executable)
@@ -2,42 +2,73 @@ msgid ""
 msgstr ""
 "Project-Id-Version: sarg-squidGuard 1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-02-10 09:30-0300\n"
+"POT-Creation-Date: 2014-04-14 12:46+0200\n"
 "PO-Revision-Date: 2005-02-10 09:30-0300\n"
 "Last-Translator: Jacques Grillot <Jacques.Grillot@grouperdi.com>\n"
 "Language-Team: French\n"
+"Language: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: sarg-squidguard-block2.php:10
-msgid "Could not open the file"
+#: sarg-block-it.php:32
+msgid "No URL passed as argument"
+msgstr ""
+
+#: sarg-block-it.php:40 sarg-squidguard-block2.php:62
+#, fuzzy, php-format
+msgid "Could not open file: %s"
 msgstr "Ne peut pas ouvrir le fichier"
 
-#: sarg-squidguard-block2.php:19
+#: sarg-block-it.php:47 sarg-squidguard-block2.php:69
 msgid "Write error"
 msgstr "Erreur d'ecriture"
 
-#: sarg-squidguard-block2.php:23
+#: sarg-block-it.php:50 sarg-squidguard-block2.php:72
 msgid "Done!"
 msgstr "Fait!"
 
-#: sarg-squidguard-block2.php:27
-msgid "Return"
-msgstr "revenir"
+#: sarg-block-it.php:52 sarg-squidguard-block2.php:74
+#, php-format
+msgid "<a href=\"%s\">Return</a> to Sarg."
+msgstr ""
+
+#: sarg-squidguard-block2.php:32
+msgid "No file passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:38
+msgid "No url passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:52
+#, php-format
+msgid "Invalid locale %s"
+msgstr ""
 
-#: sarg-squidguard-block2.php:30
-msgid " to Sarg."
-msgstr " a Sarg"
+#: sarg-squidguard-block.php:37
+#, php-format
+msgid "Invalid locale: %s"
+msgstr ""
 
-#: sarg-squidguard-block.php:29
+#: sarg-squidguard-block.php:48
+msgid "No URL to block"
+msgstr ""
+
+#: sarg-squidguard-block.php:66
 msgid "Sarg-SquidGuard - URL Blocking"
 msgstr "Sarg-SquidGuard - Blocage d'URL"
 
-#: sarg-squidguard-block.php:33
-msgid "Choose the rule set where"
+#: sarg-squidguard-block.php:69
+#, fuzzy, php-format
+msgid "Choose the rule set where %s will be added"
 msgstr "Choisissez la regle qui"
 
-#: sarg-squidguard-block.php:36
-msgid "will by added"
-msgstr "sera ajoutee"
+#~ msgid "Return"
+#~ msgstr "revenir"
+
+#~ msgid " to Sarg."
+#~ msgstr " a Sarg"
+
+#~ msgid "will by added"
+#~ msgstr "sera ajoutee"
index aa9bda0652c79009f40db09f764f3c9c5bc67a89..923d47d427107dcba11a46d15ca2a52436fe6261 100755 (executable)
@@ -8,42 +8,73 @@ msgid ""
 msgstr ""
 "Project-Id-Version: sarg-squidGuard 1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-08-12 11:14-0300\n"
+"POT-Creation-Date: 2014-04-14 12:46+0200\n"
 "PO-Revision-Date: 2004-08-12 11:14-0300\n"
 "Last-Translator: Pedro Lineu Orso <pedro.orso@gmail.com>\n"
 "Language-Team: Brazilian_Portuguese\n"
+"Language: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: sarg-squidguard-block2.php:10
-msgid "Could not open the file"
+#: sarg-block-it.php:32
+msgid "No URL passed as argument"
+msgstr ""
+
+#: sarg-block-it.php:40 sarg-squidguard-block2.php:62
+#, fuzzy, php-format
+msgid "Could not open file: %s"
 msgstr "N&atilde;o pode abrir o arquivo"
 
-#: sarg-squidguard-block2.php:19
+#: sarg-block-it.php:47 sarg-squidguard-block2.php:69
 msgid "Write error"
 msgstr "Erro na escrita do arquivo"
 
-#: sarg-squidguard-block2.php:23
+#: sarg-block-it.php:50 sarg-squidguard-block2.php:72
 msgid "Done!"
 msgstr "Feito!"
 
-#: sarg-squidguard-block2.php:27
-msgid "Return"
-msgstr "Retorna"
+#: sarg-block-it.php:52 sarg-squidguard-block2.php:74
+#, php-format
+msgid "<a href=\"%s\">Return</a> to Sarg."
+msgstr ""
+
+#: sarg-squidguard-block2.php:32
+msgid "No file passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:38
+msgid "No url passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:52
+#, php-format
+msgid "Invalid locale %s"
+msgstr ""
 
-#: sarg-squidguard-block2.php:30
-msgid " to Sarg."
-msgstr "ao Sarg"
+#: sarg-squidguard-block.php:37
+#, php-format
+msgid "Invalid locale: %s"
+msgstr ""
 
-#: sarg-squidguard-block.php:29
+#: sarg-squidguard-block.php:48
+msgid "No URL to block"
+msgstr ""
+
+#: sarg-squidguard-block.php:66
 msgid "Sarg-SquidGuard - URL Blocking"
 msgstr "Sarg-SquidGuard - Bloqueio de URL"
 
-#: sarg-squidguard-block.php:33
-msgid "Choose the rule set where"
+#: sarg-squidguard-block.php:69
+#, fuzzy, php-format
+msgid "Choose the rule set where %s will be added"
 msgstr "Escolha uma regra onde a URL"
 
-#: sarg-squidguard-block.php:36
-msgid "will by added"
-msgstr "ser&aacute; incluida"
+#~ msgid "Return"
+#~ msgstr "Retorna"
+
+#~ msgid " to Sarg."
+#~ msgstr "ao Sarg"
+
+#~ msgid "will by added"
+#~ msgstr "ser&aacute; incluida"
index 9580353334d9d57d36194a6be9bb8de9e258a1dc..8118d321e0df19143826ddd5b7f5251e669a8772 100755 (executable)
@@ -8,42 +8,73 @@ msgid ""
 msgstr ""
 "Project-Id-Version: sarg-squidGuard 1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-08-12 11:14-0300\n"
+"POT-Creation-Date: 2014-04-14 12:46+0200\n"
 "PO-Revision-Date: 2004-11-18 17:31+0300\n"
 "Last-Translator: Michael Stepanenko <mistic@yandex.ru>\n"
 "Language-Team: Russian\n"
+"Language: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=koi8-r\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: sarg-squidguard-block2.php:10
-msgid "Could not open the file"
+#: sarg-block-it.php:32
+msgid "No URL passed as argument"
+msgstr ""
+
+#: sarg-block-it.php:40 sarg-squidguard-block2.php:62
+#, fuzzy, php-format
+msgid "Could not open file: %s"
 msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ"
 
-#: sarg-squidguard-block2.php:19
+#: sarg-block-it.php:47 sarg-squidguard-block2.php:69
 msgid "Write error"
 msgstr "ïÛÉÂËÁ ÚÁÐÉÓÉ"
 
-#: sarg-squidguard-block2.php:23
+#: sarg-block-it.php:50 sarg-squidguard-block2.php:72
 msgid "Done!"
 msgstr "çÏÔÏ×Ï!"
 
-#: sarg-squidguard-block2.php:27
-msgid "Return"
-msgstr "÷ÅÒÎÕÔØÓÑ"
+#: sarg-block-it.php:52 sarg-squidguard-block2.php:74
+#, php-format
+msgid "<a href=\"%s\">Return</a> to Sarg."
+msgstr ""
+
+#: sarg-squidguard-block2.php:32
+msgid "No file passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:38
+msgid "No url passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:52
+#, php-format
+msgid "Invalid locale %s"
+msgstr ""
 
-#: sarg-squidguard-block2.php:30
-msgid " to Sarg."
-msgstr " × Sarg"
+#: sarg-squidguard-block.php:37
+#, php-format
+msgid "Invalid locale: %s"
+msgstr ""
 
-#: sarg-squidguard-block.php:29
+#: sarg-squidguard-block.php:48
+msgid "No URL to block"
+msgstr ""
+
+#: sarg-squidguard-block.php:66
 msgid "Sarg-SquidGuard - URL Blocking"
 msgstr "Sarg-SquidGuard - ÂÌÏËÉÒÏ×ËÁ URL"
 
-#: sarg-squidguard-block.php:33
-msgid "Choose the rule set where"
+#: sarg-squidguard-block.php:69
+#, fuzzy, php-format
+msgid "Choose the rule set where %s will be added"
 msgstr "÷ÙÂÅÒÅÔÅ ÎÁÂÏÒ ÐÒÁ×ÉÌ ËÕÄÁ URL"
 
-#: sarg-squidguard-block.php:36
-msgid "will by added"
-msgstr "ÂÕÄÅÔ ÄÏÂÁ×ÌÅÎ"
+#~ msgid "Return"
+#~ msgstr "÷ÅÒÎÕÔØÓÑ"
+
+#~ msgid " to Sarg."
+#~ msgstr " × Sarg"
+
+#~ msgid "will by added"
+#~ msgstr "ÂÕÄÅÔ ÄÏÂÁ×ÌÅÎ"
index 20efb9adcaf9d8e1df7c8a1351e64bdb2a8a702f..4c5844a9e2477daf5aa111e8dc2391aa4b71f018 100755 (executable)
  *
  */
 
-$filename = "/usr/local/squid/etc/block.txt";
+require_once "config.php.inc";
 
+if (!isset($_GET['url']))
+{
+       echo "<p>",gettext("No URL passed as argument"),"</p>\n";
+       exit;
+}
 $url = $_GET['url'];
 $url = $url."\n";
 
-$ha = fopen($filename, 'a');
-if ($filename == false) {
-   print (gettext ("Could not open the filename"));
-   echo '&nbsp;'.$filename;
+$ha = fopen($DefaultSquidBlock, 'a');
+if ($ha == false) {
+   printf(gettext("Could not open file: %s"),$DefaultSquidBlock);
    exit;
 }
 else {
@@ -45,8 +49,5 @@ else {
    }
    print (gettext ("Done!"));
    echo "<br><br>\n";
-   echo "<a href=\"javascript:history.go(-1)\">";
-   print (gettext("Return"));
-   echo "</a>&nbsp;";
-   print (gettext (" to Sarg."));
+   printf(gettext("<a href=\"%s\">Return</a> to Sarg."),"javascript:history.go(-1)");
 }
index c403a0d324a931cb2528f68040929e3d88461bf2..e28deca67b20538eaf59aba75be2090abe2722ae 100755 (executable)
  *
  */
 
-// Change to squidGuard and sarg config file paths
-$SargConf = "/usr/local/sarg/sarg.conf";
-$squidGuardConf = "/usr/local/squidGuard/squidGuard.conf";
+require_once "config.php.inc";
 
 global $SargConf;
 global $dbhome;
-global $language;
 
-include_once("language.php");
+putenv("LANG=$language");
+if (!setlocale(LC_ALL, $language))
+{
+       echo "<p>";
+       printf(gettext("Invalid locale: %s"),$language);
+       echo "</p>\n";
+       exit;
+}
+$domain = 'messages';
+bindtextdomain($domain, "./locale");
+textdomain($domain);
 include_once("style.php");
 
+if (!isset($_GET['url']))
+{
+       echo "<p>",gettext("No URL to block"),"</p>\n";
+       exit;
+}
+
 $url = $_GET['url'];
-$squidGuard_conf = '/usr/local/squidGuard/squidGuard.conf';
 
 function parse_config($line,$clave) {
    if (preg_match("/dbhome/i", $line)) {
@@ -54,9 +66,7 @@ echo "<tr><td class=\"title\">";
 print(gettext ("Sarg-SquidGuard - URL Blocking"));
 echo "</td></tr>\n";
 echo "<tr><td class=\"header2\">";
-print(gettext ("Choose the rule set where"));
-echo "<a href=\"http://$url\">&nbsp;$url</a> ";
-print(gettext ("will by added"));
+printf(gettext("Choose the rule set where %s will be added"),"<a href=\"http://$url\">$url</a> ");
 echo "</td></tr>\n";
 echo "</table>\n";
 echo "<table>\n";
index dac7e1fe9fd720fecdc606b7b840ea902287773f..e717e038b040a3e92af4a67c9fccc90711b2a14c 100755 (executable)
  *
  */
 
+require_once "config.php.inc";
+
+if (!isset($_GET['file']))
+{
+       echo "<p>",gettext("No file passed as argument"),"</p>\n";
+       exit;
+}
 $file = $_GET['file'];
+if (!isset($_GET['url']))
+{
+       echo "<p>",gettext("No url passed as argument"),"</p>\n";
+       exit;
+}
 $url = $_GET['url'];
-$language = $_GET['lang'];
 $url = $url."\n";
+if (isset($_GET['lang']))
+{
+       $language = $_GET['lang'];
+}
 
 putenv("LANG=$language");
-setlocale(LC_ALL, $language);
+if (!setlocale(LC_ALL, $language))
+{
+       echo "<p>";
+       printf(gettext("Invalid locale %s"),$language);
+       echo "</p>\n";
+       exit;
+}
 $domain = 'messages';
 bindtextdomain($domain, "./locale");
 textdomain($domain);
 
 $ha = fopen($file, 'a');
-if ($file == false) {
-   print (gettext ("Could not open the file"));
-   echo '&nbsp;'.$file;
+if ($ha == false) {
+   printf(gettext("Could not open file: %s"),$file);
    exit;
 }
 else {
@@ -51,8 +71,5 @@ else {
    }
    print (gettext ("Done!"));
    echo "<br><br>\n";
-   echo "<a href=\"javascript:history.go(-2)\">";
-   print (gettext("Return"));
-   echo "</a>&nbsp;";
-   print (gettext (" to Sarg."));
+   printf(gettext("<a href=\"%s\">Return</a> to Sarg."),"javascript:history.go(-2)");
 }
index 9d699d7a2a77f50e799607b85058b64f369f6a91..4cd495adeba228b83b2c059ecbf6a25543607885 100644 (file)
@@ -1,69 +1,71 @@
-/*
- * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
- *                                                            1998, 2010
- *
- * SARG donations:
- *      please look at http://sarg.sourceforge.net/donations.php
- * Support:
- *     http://sourceforge.net/projects/sarg/forums/forum/363374
- * ---------------------------------------------------------------------
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
- */
-
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: sarg-squidGuard 1.0\n"
+"Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-08-12 11:14-0300\n"
+"POT-Creation-Date: 2014-04-14 12:57+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
 "MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=charset=ISO-8859-1\n"
+"Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: sarg-squidguard-block2.php:10
-msgid "Could not open the file"
+#: sarg-block-it.php:32
+msgid "No URL passed as argument"
+msgstr ""
+
+#: sarg-block-it.php:40 sarg-squidguard-block2.php:62
+#, php-format
+msgid "Could not open file: %s"
 msgstr ""
 
-#: sarg-squidguard-block2.php:19
+#: sarg-block-it.php:47 sarg-squidguard-block2.php:69
 msgid "Write error"
 msgstr ""
 
-#: sarg-squidguard-block2.php:23
+#: sarg-block-it.php:50 sarg-squidguard-block2.php:72
 msgid "Done!"
 msgstr ""
 
-#: sarg-squidguard-block2.php:27
-msgid "Return"
+#: sarg-block-it.php:52 sarg-squidguard-block2.php:74
+#, php-format
+msgid "<a href=\"%s\">Return</a> to Sarg."
 msgstr ""
 
-#: sarg-squidguard-block2.php:30
-msgid " to Sarg."
+#: sarg-squidguard-block2.php:32
+msgid "No file passed as argument"
 msgstr ""
 
-#: sarg-squidguard-block.php:29
-msgid "Sarg-SquidGuard - URL Blocking"
+#: sarg-squidguard-block2.php:38
+msgid "No url passed as argument"
+msgstr ""
+
+#: sarg-squidguard-block2.php:52
+#, php-format
+msgid "Invalid locale %s"
 msgstr ""
 
-#: sarg-squidguard-block.php:33
-msgid "Choose the rule set where"
+#: sarg-squidguard-block.php:37
+#, php-format
+msgid "Invalid locale: %s"
+msgstr ""
+
+#: sarg-squidguard-block.php:48
+msgid "No URL to block"
+msgstr ""
+
+#: sarg-squidguard-block.php:66
+msgid "Sarg-SquidGuard - URL Blocking"
 msgstr ""
 
-#: sarg-squidguard-block.php:36
-msgid "will by added"
+#: sarg-squidguard-block.php:69
+#, php-format
+msgid "Choose the rule set where %s will be added"
 msgstr ""
diff --git a/sarg-php/update-mo.sh b/sarg-php/update-mo.sh
new file mode 100644 (file)
index 0000000..3650833
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# quick and non portable hack to update the mo files from bash
+for f in locale/*/LC_MESSAGES/messages.po
+do
+       echo "Updating $f"
+       msgfmt --check --statistics -o "${f%.po}.mo" "$f" 
+done
diff --git a/sarg-php/update-po.sh b/sarg-php/update-po.sh
new file mode 100644 (file)
index 0000000..81fb42a
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# quick and non portable hack to update the po files from bash
+xgettext -o translate.this *.php
+for f in locale/*/LC_MESSAGES/messages.po
+do
+       echo "Updating $f"
+       msgmerge --update "$f" translate.this 
+done