use new html purifier for OKAPI logs, too; update OKAPI italian translation

This commit is contained in:
following
2013-07-26 17:08:21 +02:00
parent 7e73badfae
commit b7a165a1d1
9 changed files with 121 additions and 72 deletions

View File

@ -7,22 +7,29 @@
require_once($opt['rootpath'] . 'lib2/HTMLPurifier/library/HTMLPurifier.auto.php');
// !! THIS CODE IS ALSO USED IN OKAPI !!
// Any changes must be tested with OKAPI services/logs/submit method.
// Avoid to include any other OC.de code here.
class OcHTMLPurifier extends HTMLPurifier
{
// $opt needs to be passed as parameter here because it resides in another
// namespace in OKAPI. All options used here must be included in the
// $opt['html_purifier'] array.
function __construct()
{
global $opt;
// prepare config
$config = HTMLPurifier_Config::createDefault();
// set cache directory
$config->set('Cache.SerializerPath', $opt['html_purifier']['cache_path']);
// create parent object with config
parent::__construct($config);
}
function __construct($opt)
{
// prepare config
$config = HTMLPurifier_Config::createDefault();
// set cache directory
$config->set('Cache.SerializerPath', $opt['html_purifier']['cache_path']);
// create parent object with config
parent::__construct($config);
}
}

View File

@ -123,7 +123,7 @@
// check and prepare log text
if ($descMode != 1)
{
$ocPurifier = new OcHTMLPurifier();
$ocPurifier = new OcHTMLPurifier($opt);
$logText = $ocPurifier->purify($logText);
}
else

View File

@ -96,11 +96,11 @@ function change()
function changetext()
{
global $tpl, $login;
global $tpl, $login, $opt;
if (isset($_REQUEST['save']))
{
$purifier = new OcHTMLPurifier();
$purifier = new OcHTMLPurifier($opt);
$desctext = isset($_REQUEST['desctext']) ? $purifier->purify($_REQUEST['desctext']) : "";
sql("UPDATE `user` SET `description`='&2' WHERE `user_id`='&1'", $login->userid, $desctext);
$tpl->redirect('mydetails.php');

View File

@ -814,7 +814,7 @@ class Okapi
{
public static $data_store;
public static $server;
public static $revision = 880; # This gets replaced in automatically deployed packages
public static $revision = 884; # This gets replaced in automatically deployed packages
private static $okapi_vars = null;
/** Get a variable stored in okapi_vars. If variable not found, return $default. */

View File

@ -2,9 +2,9 @@ msgid ""
msgstr ""
"Project-Id-Version: OKAPI\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-10 01:07+0100\n"
"PO-Revision-Date: 2013-04-10 01:08+0100\n"
"Last-Translator: Stefano Cotterli <stefanocotterli@gmail.com>\n"
"POT-Creation-Date: 2013-07-19 08:41+0100\n"
"PO-Revision-Date: 2013-07-19 08:46+0100\n"
"Last-Translator: faina09 <stefanocotterli@gmail.com>\n"
"Language-Team: following <following@online.de>\n"
"Language: Italian\n"
"MIME-Version: 1.0\n"
@ -14,16 +14,22 @@ msgstr ""
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Generator: Poedit 1.5.5\n"
"X-Generator: Poedit 1.5.7\n"
"X-Poedit-SearchPath-0: c:\\source\\okapi\\following2\n"
"X-Poedit-SearchPath-1: D:\\PRIV\\Projekty\\EclipseWorkspace\\opencaching-api"
"\\okapi\n"
"X-Poedit-SearchPath-2: C:\\Users\\stefano.cotterli\\Desktop\\opencaching-"
"api\n"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/geocaches.php:846
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/geocaches.php:956
msgid "Stage"
msgstr "Passo"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/geocaches.php:1009
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/geocaches.php:1111
msgid "National Park / Landscape"
msgstr "Parco Nazionale / Paesaggio"
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/geocaches.php:1263
#, php-format
msgid ""
"This <a href='%s'>geocache</a> description comes from the <a href='%s'>%s</"
@ -32,7 +38,7 @@ msgstr ""
"La deescrizione di questa <a href='%s'>geocache</a>proviene dal sito <a "
"href='%s'>%s</a>."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/geocaches.php:1021
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/geocaches.php:1275
#, php-format
msgid ""
"&copy; <a href='%s'>%s</a>, <a href='%s'>%s</a>, <a href='http://"
@ -40,7 +46,7 @@ msgid ""
"%s; all log entries &copy; their authors"
msgstr ""
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/geocaches.php:1032
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/geocaches.php:1286
#, php-format
msgid ""
"&copy; <a href='%s'>%s</a>, <a href='%s'>%s</a>, <a href='http://"
@ -48,57 +54,62 @@ msgid ""
"log entries &copy; their authors"
msgstr ""
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:31
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:48
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:31
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:60
msgid "hidden by"
msgstr "nascosta da"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:50
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:62
#, php-format
msgid "%d recommendation"
msgid_plural "%d recommendations"
msgstr[0] "%d raccomandazione"
msgstr[1] "%d raccomandazioni"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:51
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:63
#, php-format
msgid "found %d time"
msgid_plural "found %d times"
msgstr[0] "trovata %d volta"
msgstr[1] "trovata %d volte"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:54
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:66
#, php-format
msgid "%d trackable"
msgid_plural "%d trackables"
msgstr[0] "%d travel bug"
msgstr[1] "%d travel bugs"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:58
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:70
msgid "Personal notes"
msgstr "Note personali"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:62
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:74
msgid "Attributes"
msgstr "Attributi"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:66
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:78
msgid "Trackables"
msgstr "Travel bugs"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:84
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:88
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:104
msgid "Images"
msgstr "Immagini"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:91
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:111
msgid "Spoilers"
msgstr "Spoiler"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/caches/formatters/gpxfile.tpl.php:99
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:120
msgid "Image descriptions"
msgstr "Descrizione immagine"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:70
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/caches/formatters/gpxfile.tpl.php:128
msgid "The cache probably is located in the following protection areas:"
msgstr "La cache probabilmente &egrave; situata nelle seguenti aree protette:"
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:70
msgid ""
"You are trying to publish a log entry with a date in future. Cache log "
"entries are allowed to be published in the past, but NOT in the future."
@ -106,7 +117,7 @@ msgstr ""
"Hai cercato di pubblicare un log con una data nel futuro. E' permsso loggare "
"una cache con una data passata, ma NON futura."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:92
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:92
#, php-format
msgid ""
"However, your cache rating was ignored, because %s does not have a rating "
@ -115,7 +126,16 @@ msgstr ""
"Tuttavia, la tua valutazione della cache sarà ignorata, perché %s non ha un "
"sistema di valutazione."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:113
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:111
#, php-format
msgid ""
"However, your cache recommendation was ignored, because %s does not allow "
"recommending event caches."
msgstr ""
"Tuttavia, la tua valutazione della cache sarà ignorata, perché %s non ha "
"permette la valutazione di cache evento."
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:125
#, php-format
msgid ""
"However, your \"needs maintenance\" flag was ignored, because %s does not "
@ -124,31 +144,39 @@ msgstr ""
"Tuttavia, la tua segnalazione di \"manutenzione necessaria\" sarà ignorata, "
"perché %s non supporta questa opzione."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:131
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:145
msgid ""
"This cache is an Event cache. You cannot \"Find it\"! (But - you may "
"\"Comment\" on it.)"
"This cache is an Event cache. You cannot \"Find\" it (but you can attend it, "
"or comment on it)!"
msgstr ""
"Questa cache è una cache Evento. Non puoi \"Trovarla\"! (Ma puoi inserirci "
"un \"Commento\")."
"Questa cache è una cache Evento. Non puoi \"Trovarla\" (ma puoi partecipare, "
"o commentare l'evento)!"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:133
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:150
msgid ""
"This cache is NOT an Event cache. You cannot \"Attend\" it (but you can find "
"it, or comment on it)!"
msgstr ""
"Questa cache NON è una cache Evento. Non puoi \"Partecipare\" (ma puoi "
"trovarla, o inserirci un commento)!"
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:155
msgid "Your have to supply some text for your comment."
msgstr "Devi inserire del testo per il tuo commento."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:146
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:168
msgid "This cache requires a password. You didn't provide one!"
msgstr "Questa cache richiede una password, ma non ne hai fornita nessuuna."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:148
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:170
msgid "Invalid password!"
msgstr "Password non valida!"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:260
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:282
msgid "You have already submitted a log entry with exactly the same contents."
msgstr "Hai già inserito un log esattamente con lo stesso contenuto."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:279
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:305
msgid ""
"You have already submitted a \"Found it\" log entry once. Now you may submit "
"\"Comments\" only!"
@ -156,45 +184,49 @@ msgstr ""
"Hai già inserito un log \"Trovata\". Adesso puoi inserire solamente "
"\"Commenti\"!"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:281
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:307
msgid "You are the owner of this cache. You may submit \"Comments\" only!"
msgstr "Sei il proprietario della cache. Puoi inserire solamente \"Commenti\"!"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:299
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:325
msgid "You have already rated this cache once. Your rating cannot be changed."
msgstr ""
"Hai giàvalutato questa cache. La tua valutazione non può essere cambiata."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:316
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:342
msgid "You have already recommended this cache once."
msgstr "Hai già raccmandato questa cache."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:323
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:352
msgid "You don't have any recommendations to give. Find more caches first!"
msgstr ""
"Non hai possibilità di dare raccomandazioni. Prima devio trovare altre cache!"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/services/logs/submit.php:491
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:395
msgid "Event caches cannot \"need maintenance\"."
msgstr "Le cache evento non necessitano di manutenzione!"
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/services/logs/submit.php:525
msgid "Your cache log entry was posted successfully."
msgstr "Il tuo log sulla cache è stato correttamente inserito."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorize.tpl.php:5
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorize.tpl.php:5
msgid "Authorization Form"
msgstr "Modulo di autorizzazione"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorize.tpl.php:46
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorize.tpl.php:46
msgid "Expired request"
msgstr "Richiesta scaduta"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorize.tpl.php:47
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorize.tpl.php:47
msgid "Unfortunately, the request has expired. Please try again."
msgstr "Sfortunatamente, la richiesta è scaduta. Per favore riprova."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorize.tpl.php:49
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorize.tpl.php:49
msgid "External application is requesting access..."
msgstr "Una applicazione esterna sta richiedendo l'accesso."
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorize.tpl.php:50
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorize.tpl.php:50
#, php-format
msgid ""
"<b>%s</b> wants to access your <b>%s</b> account. Do you agree to grant "
@ -203,15 +235,15 @@ msgstr ""
"<b>%s</b> vuole accedere al tuo account <b>%s</b>. Sei d'accordo nel "
"concedere l'accesso a questa applicazione?"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorize.tpl.php:53
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorize.tpl.php:53
msgid "I agree"
msgstr "Sono d'accordo"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorize.tpl.php:54
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorize.tpl.php:54
msgid "Decline"
msgstr "No"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorize.tpl.php:56
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorize.tpl.php:56
#, php-format
msgid ""
"\n"
@ -239,15 +271,15 @@ msgstr ""
"\t\t\t\t\tPuoi revocare questo permesso in qualsiasi momento.</p>\n"
"\t\t\t\t"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorized.tpl.php:5
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorized.tpl.php:5
msgid "Authorization Succeeded"
msgstr "Autorizzazione concessa"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorized.tpl.php:28
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorized.tpl.php:28
msgid "Access successfully granted"
msgstr "Accesso correttamente consentito"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/authorized.tpl.php:29
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/authorized.tpl.php:29
#, php-format
msgid ""
"\n"
@ -264,15 +296,15 @@ msgstr ""
"codice PIN:</p>\n"
"\t\t\t"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/index.tpl.php:5
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/index.tpl.php:5
msgid "My Apps"
msgstr "Mie App"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/index.tpl.php:29
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/index.tpl.php:29
msgid "Your external applications"
msgstr "Le tue applicazioni esterne"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/index.tpl.php:31
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/index.tpl.php:31
#, php-format
msgid ""
"\n"
@ -295,11 +327,11 @@ msgstr ""
" \t\t\t\t\tazione per tuo conto.</p>\n"
"\t\t\t\t"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/index.tpl.php:45
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/index.tpl.php:45
msgid "remove"
msgstr "entfernen"
#: D:\PRIV\Projekty\EclipseWorkspace\opencaching-api\okapi/views/apps/index.tpl.php:50
#: C:\Users\stefano.cotterli\Desktop\opencaching-api/okapi/views/apps/index.tpl.php:50
#, php-format
msgid ""
"\n"

View File

@ -207,8 +207,11 @@ class WebService
# NOTICE: We are including EXTERNAL OCDE library here! This
# code does not belong to OKAPI!
require_once $GLOBALS['rootpath'] . '../lib/htmlpurifier-4.2.0/library/HTMLPurifier.auto.php';
$purifier = new \HTMLPurifier();
$opt['rootpath'] = $GLOBALS['rootpath'];
$opt['html_purifier'] = Settings::get('OCDE_HTML_PURIFIER_SETTINGS');
require_once $GLOBALS['rootpath'] . 'lib2/OcHTMLPurifier.class.php';
$purifier = new \OcHTMLPurifier($opt);
$formatted_comment = $purifier->purify($formatted_comment);
$value_for_text_html_field = 1;
}

View File

@ -159,6 +159,11 @@ final class Settings
* Minimum size is 64x64 pixels, maximum size 72x72 pixels.
*/
'SITE_LOGO' => null,
/**
* Settings for the OCDE HTML purifier which is used by services/logs/submit.
*/
'OCDE_HTML_PURIFIER_SETTINGS' => array(),
);
/**

View File

@ -43,5 +43,7 @@ function get_okapi_settings()
'SITE_LOGO' => $opt['page']['absolute_url'] . 'resource2/' . $opt['template']['default']['style'] . '/images/oclogo/oc_logo_alpha3.png',
'OC_NODE_ID' => $opt['logic']['node']['id'],
'OC_COOKIE_NAME' => $opt['session']['cookiename'].'data',
'OCDE_HTML_PURIFIER_SETTINGS'
=> $opt['html_purifier'],
);
}