From 5959a32f9746aa600fd852f6b11f635ad2020253 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 8 Dec 2007 19:39:32 -0500 Subject: [PATCH] real redir cycle detection --- IkiWiki/Plugin/meta.pm | 19 ++++++++++++++----- po/bg.po | 13 +++++++------ po/cs.po | 13 +++++++------ po/da.po | 13 +++++++------ po/es.po | 13 +++++++------ po/fr.po | 13 +++++++------ po/gu.po | 13 +++++++------ po/ikiwiki.pot | 10 +++++----- po/pl.po | 13 +++++++------ po/sv.po | 13 +++++++------ po/vi.po | 13 +++++++------ 11 files changed, 82 insertions(+), 64 deletions(-) diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 968e6ccee..4aa545a93 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -71,6 +71,7 @@ sub preprocess (@) { #{{{ } } elsif ($key eq 'redir') { + return "" if $destpage ne $page; my $safe=0; if ($value !~ /^\w+:\/\//) { add_depends($page, $value); @@ -78,13 +79,21 @@ sub preprocess (@) { #{{{ if (! length $link) { return "[[meta ".gettext("redir page not found")."]]"; } + + $value=urlto($link, $page); + $safe=1; + + # redir cycle detection $pagestate{$page}{meta}{redir}=$link; - if ($pagestate{$link}{meta}{redir}) { - # TODO: real cycle detection - return "[[meta ".gettext("redir not allowed to point to a page that contains a redir")."]]"; + my $at=$page; + my %seen; + while (exists $pagestate{$at}{meta}{redir}) { + if ($seen{$at}) { + return "[[meta ".gettext("redir cycle is not allowed")."]]"; + } + $seen{$at}=1; + $at=$pagestate{$at}{meta}{redir}; } - $value=urlto($link, $destpage); - $safe=1; } else { $value=encode_entities($value); diff --git a/po/bg.po b/po/bg.po index 8281dd8cb..37f882fc4 100644 --- a/po/bg.po +++ b/po/bg.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki-bg\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-01-12 01:19+0200\n" "Last-Translator: Damyan Ivanov \n" "Language-Team: Bulgarian \n" @@ -228,16 +228,17 @@ msgstr "" "грешка при зареждането на perl-модула „Markdown.pm” (%s) или „/usr/bin/" "markdown” (%s)" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "шаблонът „%s” не е намерен" -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "шаблонът „%s” не е намерен" -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 #, fuzzy msgid "stylesheet not found" msgstr "шаблонът „%s” не е намерен" diff --git a/po/cs.po b/po/cs.po index 59c2719b2..beeffa128 100644 --- a/po/cs.po +++ b/po/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-05-09 21:21+0200\n" "Last-Translator: Miroslav Kure \n" "Language-Team: Czech \n" @@ -218,16 +218,17 @@ msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)" msgstr "" "selhalo nahrání perlového modulu Markdown.pm (%s) nebo /usr/bin/markdown (%s)" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "zdroj nebyl nalezen" -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "zdroj nebyl nalezen" -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 msgid "stylesheet not found" msgstr "styl nebyl nalezen" diff --git a/po/da.po b/po/da.po index c6b24768a..88c97d861 100644 --- a/po/da.po +++ b/po/da.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-10-16 23:07+0100\n" "Last-Translator: Jonas Smedegaard \n" "Language-Team: Danish \n" @@ -222,16 +222,17 @@ msgstr "" "Indlæsning af perl-modulet Markdown.pm (%s) eller /usr/bin/markdown (%s) " "mislykkedes" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "fødning ikke fundet" -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "fødning ikke fundet" -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 msgid "stylesheet not found" msgstr "stilsnit (stylesheet) ikke fundet" diff --git a/po/es.po b/po/es.po index 163a047ad..b61b69d0e 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: es\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-04-28 22:01+0200\n" "Last-Translator: Víctor Moral \n" "Language-Team: Spanish \n" @@ -223,16 +223,17 @@ msgstr "" "no he podido cargar el módulo Perl Markdown.pm (%s) ó no he podido ejecutar " "el programa /usr/bin/markdown (%s)" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "fuente de datos no encontrada" -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "fuente de datos no encontrada" -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 msgid "stylesheet not found" msgstr "hoja de estilo no encontrada " diff --git a/po/fr.po b/po/fr.po index 036cc47e5..7dc4350af 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-08-28 21:05+0200\n" "Last-Translator: Cyril Brulebois \n" "Language-Team: French \n" @@ -224,16 +224,17 @@ msgstr "" "Échec du chargement du module Perl Markdown.pm (%s) ou de /usr/bin/markdown " "(%s)" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "Flux introuvable " -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "Flux introuvable " -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 msgid "stylesheet not found" msgstr "Feuille de style introuvable " diff --git a/po/gu.po b/po/gu.po index b99c6c88d..addf152ec 100644 --- a/po/gu.po +++ b/po/gu.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki-gu\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-01-11 16:05+0530\n" "Last-Translator: Kartik Mistry \n" "Language-Team: Gujarati \n" @@ -218,16 +218,17 @@ msgstr "%s એ %s દ્વારા તાળું મરાયેલ છે msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)" msgstr "Markdown.pm પર્લ મોડ્યુલ (%s) અથવા /usr/bin/markdown (%s) લાવવામાં નિષ્ફળ" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "ફીડ મળ્યું નહી" -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "ફીડ મળ્યું નહી" -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 msgid "stylesheet not found" msgstr "સ્ટાઇલશીટ મળ્યું નહી" diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index d928d1414..c8ff704ed 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 18:30-0500\n" +"POT-Creation-Date: 2007-12-08 19:38-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -218,15 +218,15 @@ msgstr "" msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)" msgstr "" -#: ../IkiWiki/Plugin/meta.pm:79 +#: ../IkiWiki/Plugin/meta.pm:80 msgid "redir page not found" msgstr "" -#: ../IkiWiki/Plugin/meta.pm:84 -msgid "redir not allowed to point to a page that contains a redir" +#: ../IkiWiki/Plugin/meta.pm:92 +msgid "redir cycle is not allowed" msgstr "" -#: ../IkiWiki/Plugin/meta.pm:120 +#: ../IkiWiki/Plugin/meta.pm:129 msgid "stylesheet not found" msgstr "" diff --git a/po/pl.po b/po/pl.po index 36f36c3cf..769cee15e 100644 --- a/po/pl.po +++ b/po/pl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki 1.51\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-04-27 22:05+0200\n" "Last-Translator: Pawel Tecza \n" "Language-Team: Debian L10n Polish \n" @@ -231,16 +231,17 @@ msgstr "" "Awaria w trakcie ładowania perlowego modułu Markdown.pm (%s) lub " "uruchamiania programu /usr/bin/markdown (%s)" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "nieznaleziony kanał RSS" -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "nieznaleziony kanał RSS" -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 #, fuzzy msgid "stylesheet not found" msgstr "nieznaleziony szablon ze stylami CSS" diff --git a/po/sv.po b/po/sv.po index 1bfadd088..4baaff9ec 100644 --- a/po/sv.po +++ b/po/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-01-10 23:47+0100\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" @@ -224,16 +224,17 @@ msgstr "" "misslyckades med att läsa in Perl-modulen Markdown.pm (%s) eller /usr/bin/" "markdown (%s)" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "mallen %s hittades inte" -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "mallen %s hittades inte" -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 #, fuzzy msgid "stylesheet not found" msgstr "mallen %s hittades inte" diff --git a/po/vi.po b/po/vi.po index 066d9c341..ce727ca16 100644 --- a/po/vi.po +++ b/po/vi.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-08 17:15-0500\n" +"POT-Creation-Date: 2007-12-08 19:18-0500\n" "PO-Revision-Date: 2007-01-13 15:31+1030\n" "Last-Translator: Clytie Siddall \n" "Language-Team: Vietnamese \n" @@ -225,16 +225,17 @@ msgstr "%s bị %s khoá nên không thể sửa được" msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)" msgstr "lỗi nạp mô-đun perl Markdown.pm (%s) hay « /usr/bin/markdown » (%s)" -#: ../IkiWiki/Plugin/meta.pm:77 +#: ../IkiWiki/Plugin/meta.pm:80 #, fuzzy msgid "redir page not found" msgstr "không tìm thấy mẫu %s" -#: ../IkiWiki/Plugin/meta.pm:82 -msgid "redir not allowed to point to a page that contains a redir" -msgstr "" +#: ../IkiWiki/Plugin/meta.pm:92 +#, fuzzy +msgid "redir cycle is not allowed" +msgstr "không tìm thấy mẫu %s" -#: ../IkiWiki/Plugin/meta.pm:118 +#: ../IkiWiki/Plugin/meta.pm:129 #, fuzzy msgid "stylesheet not found" msgstr "không tìm thấy mẫu %s" -- 2.26.2