Redirection loop detected
\nOperation stopped, because we're traped in an infinite redirection loop with page \$id.";
#-- plugin glue
$ewiki_plugins["handler"][] = "ewiki_handler_jump";
$ewiki_config["interwiki"]["jump"] = "";
$ewiki_config["interwiki"]["goto"] = "";
function ewiki_handler_jump(&$id, &$data, &$action) {
global $ewiki_config;
static $redirect_count = 5;
$jump_markup = array("jump", "goto", "redirect", "location");
#-- we only care about "view" action
if ($action != "view") {
return;
}
#-- escape from loop
if (isset($_REQUEST["EWIKI_UP_REDIRECT_COUNT"])) {
$redirect_count = $_REQUEST["EWIKI_UP_REDIRECT_COUNT"];
}
if ($redirect_count-- <= 0) {
return(ewiki_t("REDIRECTION_LOOP", array("id"=>$id)));
}
#-- search for [jump:...]
if ($links = explode("\n", trim($data["refs"])))
foreach ($links as $link) {
if (strlen($link) && strpos($link, ":")
&& in_array(strtolower(strtok($link, ":")), $jump_markup)
&& ($dest = trim(strtok("\n"))) )
{
$url = "";
if (strpos($dest, "://")) {
$url = $dest;
}
else {
$url = ewiki_interwiki($dest);
}
#-- Location:
if (EWIKI_JUMP_HTTP && EWIKI_HTTP_HEADERS && !headers_sent()) {
if (empty($url)) {
$url = ewiki_script("", $dest,
array(EWIKI_UP_REDIRECT_COUNT=>$redirect_count),
0, 0, ewiki_script_url()
);
}
header("Location: $url");
die();
}
#-- show page as usual, what will reveal dest URL
elseif ($url) {
return("");
# the rendering kernel will just show up the [jump:]!
# (without the jump: of course)
}
#-- it's simply about another WikiPage
else {
#-- we'll just restart ewiki
$data = array();
$id = $dest;
return(ewiki_page("view/".$id));
}
}
}#-search
}
?>