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