2 // display.php: fetch page or get default content
3 // calls transform.php for actual transformation of wiki markup to HTML
4 rcs_id('$Id: display.php,v 1.5.2.5 2005-01-07 14:23:04 rurban Exp $');
6 // if we got GET data, the first item is always a page name
7 // if it wasn't this file would not have been included
9 if (empty($QUERY_STRING) && isset($argv[0]))
10 $QUERY_STRING = $argv[0];
12 if (isset($QUERY_STRING) && preg_match('/^[-_.+%\w]+$/', $QUERY_STRING)) {
13 $pagename = urldecode($QUERY_STRING);
14 } elseif (isset($QUERY_STRING) && preg_match('/^([-_.+%\w]+)&.+$/', $QUERY_STRING, $m)) {
15 $pagename = urldecode($m[1]);
17 $pagename = gettext("FrontPage");
19 // if there is no FrontPage, create a basic set of Wiki pages
20 if (! IsWikiPage($dbi, $pagename)) {
21 include "lib/setupwiki.php";
26 $enc_name = rawurlencode($pagename);
27 $pagehash = RetrievePage($dbi, $pagename, $WikiPageStore);
29 // we render the page if it exists, else ask the user to write one.
30 if (is_array($pagehash)) {
31 // transform.php returns $html containing all the HTML markup
32 include("lib/transform.php");
34 $html .= sprintf(gettext("Describe %s here."),
35 "$pagename<a href=\"$ScriptUrl?edit=$enc_name\">?</a>");
38 GeneratePage('BROWSE', $html, $pagename, $pagehash);
41 IncreaseHitCount($dbi, $pagename);