Revision history for RedirectingPages


Revision [19213]

Last edited on 2008-01-28 00:14:43 by PhilippAHartmann [Modified links pointing to docs server]

No Differences

Revision [16992]

Edited on 2007-05-31 23:27:32 by PhilippAHartmann [Reverted]
Additions:
if ($this->method == "show" && $_REQUEST["redirect"] != "no") $this->GetTargetPage();
$this->ReadInterWikiConfig();
?>%%
if we want to call the function gettargetpage() we'd better have one:
function GetTargetPage() {
if ($this->HasAccess("read")) {
if (preg_match("/\A\s*=>\s*(.*)/", $this->page["body"], $matches)) {
// patterns of forced links and wikiwords (without the commas) are german umlauts really enough?
preg_match ("/^(\[\[.*?\]\]|[A-ZÄÖÜ][a-zäöüß]+[A-Z0-9ÄÖÜ][A-Z0-9a-zäöüßÄÖÜ]*)/", $matches[1], $matches1);
$target = $matches1[1];
if ($target_page = $this->LoadPage($target)) {
$this->redirect_page = $this->page["tag"];
$this->LoadAllACLs($target_page["tag"]); // isn't loadallacls better a part of setpage()?
$this->SetPage($target_page);
}
}
} else {
// no idea why a redirector page should have it's own acls. but if user has no read-access he hasn't ;)
// in that case, we simply do nothing and let the page fail as usual
return;
}
}
?>%%
~& Added fix in ##$this->LoadAllACLs(...)## call, changed ##$target_page## to ##$target_page["tag"]##.
~& Otherwise mysql_real_escape_string complains about parameter being an array.
~& Additionally, the error message in case of missing "read" access rights was duplicated. Removed it from here.
~& Everything else works really fine!
~& -- PhilippAHartmann
the showhandler shall provide a link back to the original page. or we'll never have a chance to change the redirector (of course we would, guess how).
handlers/page/show.php
if ($this->redirect_page) {
print ("<div class='revisioninfo'>Redirected from "); // this div may get it's own class
print ("<a href='".$this->href("", $this->redirect_page, "redirect=no")."'>".$this->redirect_page."</a>");
print ("</div>\n");
}
// display page
print($this->Format($this->page["body"]));
?>%%
Test,Page
now any page will be redirected to another when it starts with **=>TargetPage**
----
CategoryDevelopmentHandlers CategoryDevelopmentCore
Deletions:
if ($this->method == "show"


Revision [16791]

Edited on 2007-05-31 10:48:35 by ThwTn9 [Reverted]
Additions:
if ($this->method == "show"
Deletions:
if ($this->method == "show" && $_REQUEST["redirect"] != "no") $this->GetTargetPage();
$this->ReadInterWikiConfig();
?>%%
if we want to call the function gettargetpage() we'd better have one:
function GetTargetPage() {
if ($this->HasAccess("read")) {
if (preg_match("/\A\s*=>\s*(.*)/", $this->page["body"], $matches)) {
// patterns of forced links and wikiwords (without the commas) are german umlauts really enough?
preg_match ("/^(\[\[.*?\]\]|[A-ZÄÖÜ][a-zäöüß]+[A-Z0-9ÄÖÜ][A-Z0-9a-zäöüßÄÖÜ]*)/", $matches[1], $matches1);
$target = $matches1[1];
if ($target_page = $this->LoadPage($target)) {
$this->redirect_page = $this->page["tag"];
$this->LoadAllACLs($target_page["tag"]); // isn't loadallacls better a part of setpage()?
$this->SetPage($target_page);
}
}
} else {
// no idea why a redirector page should have it's own acls. but if user has no read-access he hasn't ;)
// in that case, we simply do nothing and let the page fail as usual
return;
}
}
?>%%
~& Added fix in ##$this->LoadAllACLs(...)## call, changed ##$target_page## to ##$target_page["tag"]##.
~& Otherwise mysql_real_escape_string complains about parameter being an array.
~& Additionally, the error message in case of missing "read" access rights was duplicated. Removed it from here.
~& Everything else works really fine!
~& -- PhilippAHartmann
the showhandler shall provide a link back to the original page. or we'll never have a chance to change the redirector (of course we would, guess how).
handlers/page/show.php
if ($this->redirect_page) {
print ("<div class='revisioninfo'>Redirected from "); // this div may get it's own class
print ("<a href='".$this->href("", $this->redirect_page, "redirect=no")."'>".$this->redirect_page."</a>");
print ("</div>\n");
}
// display page
print($this->Format($this->page["body"]));
?>%%
Test,Page
now any page will be redirected to another when it starts with **=>TargetPage**
----
CategoryDevelopmentHandlers CategoryDevelopmentCore


Revision [11333]

Edited on 2005-10-10 18:40:53 by PhilippAHartmann [put back "else" for clarity]
Additions:
} else {
// no idea why a redirector page should have it's own acls. but if user has no read-access he hasn't ;)
// in that case, we simply do nothing and let the page fail as usual
return;
Deletions:
}
// no idea why a redirector page should have it's own acls. but if user has no read-access he hasn't ;)
// in that case, we simply do nothing and let the page fail as usual
return;


Revision [11332]

Edited on 2005-10-10 18:38:48 by PhilippAHartmann [Fix permission handling]
Additions:
// no idea why a redirector page should have it's own acls. but if user has no read-access he hasn't ;)
// in that case, we simply do nothing and let the page fail as usual
return;
~& Otherwise mysql_real_escape_string complains about parameter being an array.
~& Additionally, the error message in case of missing "read" access rights was duplicated. Removed it from here.
~& Everything else works really fine!
Deletions:
} else {
// no idea why a redirector page should have it's own acls. but if user has no read-access he hasn't ;)
print("<p><em>You aren't allowed to read this page.</em></p></div>");
~& Otherwise mysql_real_escape_string complains about parameter being an array. Everything else works really fine!


Revision [11331]

Edited on 2005-10-10 18:12:51 by PhilippAHartmann [small fix -> $target_page["tag"]]
Additions:
$this->LoadAllACLs($target_page["tag"]); // isn't loadallacls better a part of setpage()?
~& Added fix in ##$this->LoadAllACLs(...)## call, changed ##$target_page## to ##$target_page["tag"]##.
~& Otherwise mysql_real_escape_string complains about parameter being an array. Everything else works really fine!
~& -- PhilippAHartmann
Deletions:
$this->LoadAllACLs($target_page); // isn't loadallacls better a part of setpage()?


Revision [8611]

Edited on 2005-05-28 17:31:55 by JavaWoman [moe to two subcategories]
Additions:
=====Redirecting Pages=====
before we can MovePages we'll need a redirector to keep the links to the old wikiword intact. this facility is useful for other reasons too. it can serve synonyms, acronyms and different transcriptions of foreign names. we'll hook in at the function run() after we've got all information we need (the page itself and it's acls):

run():

%%(php)<?
// ...
if ($this->method == "show" && $_REQUEST["redirect"] != "no") $this->GetTargetPage();
$this->ReadInterWikiConfig();
?>%%

if we want to call the function gettargetpage() we'd better have one:

%%(php)<?
function GetTargetPage() {
if ($this->HasAccess("read")) {
if (preg_match("/\A\s*=>\s*(.*)/", $this->page["body"], $matches)) {
// patterns of forced links and wikiwords (without the commas) are german umlauts really enough?
preg_match ("/^(\[\[.*?\]\]|[A-ZÄÖÜ][a-zäöüß]+[A-Z0-9ÄÖÜ][A-Z0-9a-zäöüßÄÖÜ]*)/", $matches[1], $matches1);
$target = $matches1[1];
if ($target_page = $this->LoadPage($target)) {
$this->redirect_page = $this->page["tag"];
$this->LoadAllACLs($target_page); // isn't loadallacls better a part of setpage()?
$this->SetPage($target_page);
}
}
} else {
// no idea why a redirector page should have it's own acls. but if user has no read-access he hasn't ;)
print("<p><em>You aren't allowed to read this page.</em></p></div>");
}
}
?>%%

the showhandler shall provide a link back to the original page. or we'll never have a chance to change the redirector (of course we would, guess how).

handlers/page/show.php

%%(php)<?
// ...

if ($this->redirect_page) {
print ("<div class='revisioninfo'>Redirected from "); // this div may get it's own class
print ("<a href='".$this->href("", $this->redirect_page, "redirect=no")."'>".$this->redirect_page."</a>");
print ("</div>\n");
}

// display page
print($this->Format($this->page["body"]));
?>%%

Test,Page

now any page will be redirected to another when it starts with **=>TargetPage**

----
CategoryDevelopmentHandlers CategoryDevelopmentCore
Deletions:
=====Redirecting Pages=====
before we can MovePages we'll need a redirector to keep the links to the old wikiword intact. this facility is useful for other reasons too. it can serve synonyms, acronyms and different transcriptions of foreign names. we'll hook in at the function run() after we've got all information we need (the page itself and it's acls):

run():

%%(php)<?
// ...
if ($this->method == "show" && $_REQUEST["redirect"] != "no") $this->GetTargetPage();
$this->ReadInterWikiConfig();
?>%%

if we want to call the function gettargetpage() we'd better have one:

%%(php)<?
function GetTargetPage() {
if ($this->HasAccess("read")) {
if (preg_match("/\A\s*=>\s*(.*)/", $this->page["body"], $matches)) {
// patterns of forced links and wikiwords (without the commas) are german umlauts really enough?
preg_match ("/^(\[\[.*?\]\]|[A-ZÄÖÜ][a-zäöüß]+[A-Z0-9ÄÖÜ][A-Z0-9a-zäöüßÄÖÜ]*)/", $matches[1], $matches1);
$target = $matches1[1];
if ($target_page = $this->LoadPage($target)) {
$this->redirect_page = $this->page["tag"];
$this->LoadAllACLs($target_page); // isn't loadallacls better a part of setpage()?
$this->SetPage($target_page);
}
}
} else {
// no idea why a redirector page should have it's own acls. but if user has no read-access he hasn't ;)
print("<p><em>You aren't allowed to read this page.</em></p></div>");
}
}
?>%%

the showhandler shall provide a link back to the original page. or we'll never have a chance to change the redirector (of course we would, guess how).

handlers/page/show.php

%%(php)<?
// ...

if ($this->redirect_page) {
print ("<div class='revisioninfo'>Redirected from "); // this div may get it's own class
print ("<a href='".$this->href("", $this->redirect_page, "redirect=no")."'>".$this->redirect_page."</a>");
print ("</div>\n");
}

// display page
print($this->Format($this->page["body"]));
?>%%

Test,Page

now any page will be redirected to another when it starts with **=>TargetPage**

----
CategoryDevelopment


Revision [2611]

Edited on 2004-11-29 12:24:25 by NilsLindenberg [header + cat. added]
Additions:
=====Redirecting Pages=====
now any page will be redirected to another when it starts with **=>TargetPage**
----
CategoryDevelopment
Deletions:
now any page will be redirected to another when it starts with **=>TargetPage**


Revision [1027]

The oldest known version of this page was created on 2004-08-18 23:07:35 by DreckFehler [header + cat. added]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki