1<?php
2$text = plugin_load("renderer", "text");
3// Try to render with text plugin first
4if (!@$_REQUEST["do"] && $text != null) {
5	$id = $_SERVER["QUERY_STRING"];
6	$id = str_replace("/", ":", $id);
7	$id = str_replace("id=", "", $id);
8	$file = wikiFN($id);
9	$str = p_cached_output($file,'text');
10	$contentType = "text/plain";
11	if (isset($GLOBALS["contentType"])) {
12		$contentType = $GLOBALS["contentType"];
13	}
14	if (!headers_sent()) header("Content-Type: $contentType");
15	echo $str;
16} else
17if (!@$_REQUEST["do"]) {
18	ob_start();
19	tpl_content(false);
20	$str = ob_get_contents();
21	ob_end_clean();
22	$str = trim(strip_tags($str));
23	$contentType = "text/plain";
24	if (isset($GLOBALS["contentType"])) {
25		$contentType = $GLOBALS["contentType"];
26	}
27	if (!headers_sent()) header("Content-Type: $contentType");
28	echo $str;
29} else {
30	include(__DIR__ . "/editor.php");
31}
32?>