<?php if (!defined('PmWiki')) exit(); /* This file is RedirectSilent.php. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation http://www.fsf.org either version 2 of the License, or (at your option) any later version. Copyright 2007 John Bittner (jbit@bitlink.com) http://www.pmwiki.org/wiki/Profiles/JB Please donate to the author at url: http://gnuzoo.org/ $RecipeInfo['RedirectSilent']['Version'] = '1.3'; */ ############################################## # remove redirect message PMWiki displays in a page $PageRedirectFmt = ''; #return ; #return ; ############################################### # remove "?from=PAGENAME" from url // override the built-in (:redirect:) pattern Markup('redirect', '<include', '/\\(:redirect\\s+(\\S.*?):\\)/i', #"RedirectMarkup2(\$pagename, PSS('$1'))"); "RedirectMarkup2"); // override the built-in redirect function function RedirectMarkup2($m) { list($pmwiki_element, $pagename, $opt) = $m ; #echo "pmwiki_element='$pmwiki_element' name='$name' args='".print_r($args, true)."' pagename='$pagename' opt='$opt' to='$to'" ; exit ; $k = Keep("(:redirect $opt:)"); global $MarkupFrame; if (!@$MarkupFrame[0]['redirect']) return $k; $opt = ParseArgs($opt); #$to = @$opt['to']; if (!$to) $to = @$opt[''][0]; $to = @$opt['to']; if (!$to) $to = @$pagename ; #echo "to='$to'" ; exit ; if (!$to) return $k; if (preg_match('/^([^#]+)(#[A-Za-z][-\\w]*)$/', $to, $match)) { $to = $match[1]; $anchor = $match[2]; } $to = MakePageName($pagename, $to); if (!PageExists($to)) return $k; #if ($to == $pagename) return ''; if (@$opt['from'] && !MatchPageNames($pagename, FixGlob($opt['from'], '$1*.$2'))) return ''; if (preg_match('/^30[1237]$/', @$opt['status'])) header("HTTP/1.1 {$opt['status']}"); Redirect($to, "{\$PageUrl}"); exit(); }