xref: /dokuwiki/doku.php (revision ccf5ab4be633f1da1ed602acaf3f1dc0ae27d388)
1<?php
2/**
3 * DokuWiki mainscript
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Andreas Gohr <andi@splitbrain.org>
7 */
8
9//  xdebug_start_profiling();
10
11  if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');
12  require_once(DOKU_INC.'inc/init.php');
13  require_once(DOKU_INC.'inc/common.php');
14  require_once(DOKU_INC.'inc/pageutils.php');
15  require_once(DOKU_INC.'inc/html.php');
16  require_once(DOKU_INC.'inc/auth.php');
17  require_once(DOKU_INC.'inc/actions.php');
18
19  //import variables
20  $QUERY = trim($_REQUEST['id']);
21  $ID    = getID();
22  $REV   = $_REQUEST['rev'];
23  $ACT   = $_REQUEST['do'];
24  $IDX   = $_REQUEST['idx'];
25  $DATE  = $_REQUEST['date'];
26  $RANGE = $_REQUEST['lines'];
27  $HIGH  = $_REQUEST['s'];
28  if(empty($HIGH)) $HIGH = getGoogleQuery();
29
30  $TEXT  = cleanText($_POST['wikitext']);
31  $PRE   = cleanText($_POST['prefix']);
32  $SUF   = cleanText($_POST['suffix']);
33  $SUM   = $_REQUEST['summary'];
34
35  //sanitize revision
36  $REV = preg_replace('/[^0-9]/','',$REV);
37
38  //we accept the do param as HTTP header, too:
39  if(!empty($_SERVER['HTTP_X_DOKUWIKI_DO'])){
40    $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
41  }
42
43  if(!empty($IDX)) $ACT='index';
44  //set default #FIXME not needed here? done in actions?
45  if(empty($ACT)) $ACT = 'show';
46
47
48  if($conf['allowdebug'] && $ACT == 'debug'){
49    html_debug();
50    exit;
51  }
52
53  //make infos about the selected page available
54  $INFO = pageinfo();
55
56  //send 404 for missing pages if configured
57  if($conf['send404'] && !$INFO['exists']){
58    header('HTTP/1.0 404 Not Found');
59  }
60
61  //prepare breadcrumbs (initialize a static var)
62  breadcrumbs();
63
64  //close session
65  session_write_close();
66
67  //do the work
68  act_dispatch($ACT);
69
70//  xdebug_dump_function_profile(1);
71?>
72