1<?php
2/**
3 * Display Wiki Page for DokuWiki
4 *
5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author Terence J. Grant<tjgrant@tatewake.com>
7 */
8
9function dwp_display_wiki_page($wikipagename)
10{
11    global $conf, $lang;
12    global $auth;
13    global $ID, $REV;
14
15    //save status
16    $backup['ID']	= $ID;
17    $backup['REV']	= $REV;
18
19    $result = '';
20
21    //Check user permissions...
22    $perm = auth_quickaclcheck(trim(strtolower($wikipagename), ":"));
23
24    if (@file_exists(wikiFN($wikipagename)) && $perm >= AUTH_READ) {
25        if ($perm >= AUTH_READ) {
26            $result = p_wiki_xhtml($wikipagename, '', false);
27
28            if ($perm >= AUTH_EDIT) {
29                $result .='<div class="secedit2"><a href="' . DOKU_BASE . 'doku.php?id=' . $wikipagename . '&amp;do=edit'
30                . '">' . $lang['btn_secedit'] . '</a></div>';
31            }
32        } else {	//show access denied
33            $result = p_locale_xhtml('<b>Access Denied</b>');
34        }
35    } else {
36        if ($perm >= AUTH_CREATE) {
37            $result .='<div class="secedit2"><a href="' . DOKU_BASE . 'doku.php?id=' . $wikipagename . '&amp;do=edit'
38            . '">' . $lang['btn_create'] . '</a></div>';
39        }
40    }
41
42    echo $result;
43
44    $ID = $backup['ID'];
45    $REV = $backup['REV'];
46}
47