1 | <?php
|
---|
2 | /**
|
---|
3 | * DokuWiki mainscript
|
---|
4 | *
|
---|
5 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
---|
6 | * @author Andreas Gohr <[email protected]>
|
---|
7 | */
|
---|
8 |
|
---|
9 | // update message version
|
---|
10 | $updateVersion = 34;
|
---|
11 |
|
---|
12 | // xdebug_start_profiling();
|
---|
13 |
|
---|
14 | if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
|
---|
15 |
|
---|
16 | if (isset($_SERVER['HTTP_X_DOKUWIKI_DO'])){
|
---|
17 | $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
|
---|
18 | } elseif (!empty($_REQUEST['idx'])) {
|
---|
19 | $ACT = 'index';
|
---|
20 | } elseif (isset($_REQUEST['do'])) {
|
---|
21 | $ACT = $_REQUEST['do'];
|
---|
22 | } else {
|
---|
23 | $ACT = 'show';
|
---|
24 | }
|
---|
25 |
|
---|
26 | // load and initialize the core system
|
---|
27 | require_once(DOKU_INC.'inc/init.php');
|
---|
28 |
|
---|
29 | //import variables
|
---|
30 | $_REQUEST['id'] = str_replace("\xC2\xAD",'',$_REQUEST['id']); //soft-hyphen
|
---|
31 | $QUERY = trim($_REQUEST['id']);
|
---|
32 | $ID = getID();
|
---|
33 |
|
---|
34 | // deprecated 2011-01-14
|
---|
35 | $NS = getNS($ID);
|
---|
36 |
|
---|
37 | $REV = $_REQUEST['rev'];
|
---|
38 | $IDX = $_REQUEST['idx'];
|
---|
39 | $DATE = $_REQUEST['date'];
|
---|
40 | $RANGE = $_REQUEST['range'];
|
---|
41 | $HIGH = $_REQUEST['s'];
|
---|
42 | if(empty($HIGH)) $HIGH = getGoogleQuery();
|
---|
43 |
|
---|
44 | if (isset($_POST['wikitext'])) {
|
---|
45 | $TEXT = cleanText($_POST['wikitext']);
|
---|
46 | }
|
---|
47 | $PRE = cleanText(substr($_POST['prefix'], 0, -1));
|
---|
48 | $SUF = cleanText($_POST['suffix']);
|
---|
49 | $SUM = $_REQUEST['summary'];
|
---|
50 |
|
---|
51 | //sanitize revision
|
---|
52 | $REV = preg_replace('/[^0-9]/','',$REV);
|
---|
53 |
|
---|
54 | //make infos about the selected page available
|
---|
55 | $INFO = pageinfo();
|
---|
56 |
|
---|
57 | //export minimal infos to JS, plugins can add more
|
---|
58 | $JSINFO['id'] = $ID;
|
---|
59 | $JSINFO['namespace'] = (string) $INFO['namespace'];
|
---|
60 |
|
---|
61 |
|
---|
62 | // handle debugging
|
---|
63 | if($conf['allowdebug'] && $ACT == 'debug'){
|
---|
64 | html_debug();
|
---|
65 | exit;
|
---|
66 | }
|
---|
67 |
|
---|
68 | //send 404 for missing pages if configured or ID has special meaning to bots
|
---|
69 | if(!$INFO['exists'] &&
|
---|
70 | ($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/',$ID)) &&
|
---|
71 | ($ACT == 'show' || (!is_array($ACT) && substr($ACT,0,7) == 'export_')) ){
|
---|
72 | header('HTTP/1.0 404 Not Found');
|
---|
73 | }
|
---|
74 |
|
---|
75 | //prepare breadcrumbs (initialize a static var)
|
---|
76 | if ($conf['breadcrumbs']) breadcrumbs();
|
---|
77 |
|
---|
78 | // check upstream
|
---|
79 | checkUpdateMessages();
|
---|
80 |
|
---|
81 | $tmp = array(); // No event data
|
---|
82 | trigger_event('DOKUWIKI_STARTED',$tmp);
|
---|
83 |
|
---|
84 | //close session
|
---|
85 | session_write_close();
|
---|
86 |
|
---|
87 | //do the work
|
---|
88 | act_dispatch($ACT);
|
---|
89 |
|
---|
90 | $tmp = array(); // No event data
|
---|
91 | trigger_event('DOKUWIKI_DONE', $tmp);
|
---|
92 |
|
---|
93 | // xdebug_dump_function_profile(1);
|
---|