From: <var...@us...> - 2009-08-19 19:36:40
|
Revision: 7071 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7071&view=rev Author: vargenau Date: 2009-08-19 19:36:31 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Handle redirect (like in IncludePage) Modified Paths: -------------- trunk/lib/plugin/Template.php Modified: trunk/lib/plugin/Template.php =================================================================== --- trunk/lib/plugin/Template.php 2009-08-19 19:35:29 UTC (rev 7070) +++ trunk/lib/plugin/Template.php 2009-08-19 19:36:31 UTC (rev 7071) @@ -147,6 +147,29 @@ } $initial_content = $r->getPackedContent(); + $content = $r->getContent(); + // follow redirects + if ((preg_match('/<'.'\?plugin\s+RedirectTo\s+page=(\S+)\s*\?'.'>/', + implode("\n", $content), $m)) + or (preg_match('/<<\s*RedirectTo\s+page=(\S+)\s*>>/', + implode("\n", $content), $m))) + { + // Strip quotes (simple or double) from page name if any + if ((string_starts_with($m[1], "'")) + or (string_starts_with($m[1], "\""))) { + $m[1] = substr($m[1], 1, -1); + } + // trap recursive redirects + if (in_array($m[1], $included_pages)) { + return $this->error(sprintf(_("recursive inclusion of page %s ignored"), + $page.' => '.$m[1])); + } + $page = $m[1]; + $p = $dbi->getPage($page); + $r = $p->getCurrentRevision(); + $initial_content = $r->getPackedContent(); + } + if ($args['section']) { $c = explode("\n", $initial_content); $c = extractSection($args['section'], $c, $page, $quiet, $args['sectionhead']); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |