]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/display.php
Going back to version 1.5, this time with the signature Jan Hidder
[SourceForge/phpwiki.git] / lib / display.php
1 <?php
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 2000-12-30 21:09:13 ahollosi Exp $');
5  
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
8
9    if (!empty($argv[0])) {
10       $pagename = rawurldecode($argv[0]);
11    } else { 
12       $pagename = gettext("FrontPage");
13
14       // if there is no FrontPage, create a basic set of Wiki pages
15       if (! IsWikiPage($dbi, $pagename)) {
16          include "lib/setupwiki.php";
17       }
18    }
19
20    $html = "";
21    $enc_name = rawurlencode($pagename);
22    $pagehash = RetrievePage($dbi, $pagename, $WikiPageStore);
23
24    // we render the page if it exists, else ask the user to write one.
25    if (is_array($pagehash)) {
26       // transform.php returns $html containing all the HTML markup
27       include("lib/transform.php");
28    } else {
29       $html .= sprintf(gettext("Describe %s here."),
30                        "$pagename<a href='$ScriptUrl?edit=$enc_name'>?</a>");
31    }
32
33    GeneratePage('BROWSE', $html, $pagename, $pagehash);
34    flush();
35
36    IncreaseHitCount($dbi, $pagename);
37 ?>