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.2 2001-11-06 20:41:56 dairiki 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);
15 $pagename = gettext("FrontPage");
17 // if there is no FrontPage, create a basic set of Wiki pages
18 if (! IsWikiPage($dbi, $pagename)) {
19 include "lib/setupwiki.php";
24 $enc_name = rawurlencode($pagename);
25 $pagehash = RetrievePage($dbi, $pagename, $WikiPageStore);
27 // we render the page if it exists, else ask the user to write one.
28 if (is_array($pagehash)) {
29 // transform.php returns $html containing all the HTML markup
30 include("lib/transform.php");
32 $html .= sprintf(gettext("Describe %s here."),
33 "$pagename<a href='$ScriptUrl?edit=$enc_name'>?</a>");
36 GeneratePage('BROWSE', $html, $pagename, $pagehash);
39 IncreaseHitCount($dbi, $pagename);