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 | $NS = getNS($ID); | |
24 | $REV = $_REQUEST['rev']; | |
25 | $ACT = $_REQUEST['do']; | |
26 | $IDX = $_REQUEST['idx']; | |
27 | $DATE = $_REQUEST['date']; | |
28 | $RANGE = $_REQUEST['lines']; | |
29 | $HIGH = $_REQUEST['s']; | |
30 | if(empty($HIGH)) $HIGH = getGoogleQuery(); | |
31 | ||
32 | $TEXT = cleanText($_POST['wikitext']); | |
33 | $PRE = cleanText($_POST['prefix']); | |
34 | $SUF = cleanText($_POST['suffix']); | |
35 | $SUM = $_REQUEST['summary']; | |
36 | ||
37 | //sanitize revision | |
38 | $REV = preg_replace('/[^0-9]/','',$REV); | |
39 | ||
40 | //we accept the do param as HTTP header, too: | |
41 | if(!empty($_SERVER['HTTP_X_DOKUWIKI_DO'])){ | |
42 | $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO'])); | |
43 | } | |
44 | ||
45 | if(!empty($IDX)) $ACT='index'; | |
46 | //set default #FIXME not needed here? done in actions? | |
47 | if(empty($ACT)) $ACT = 'show'; | |
48 | ||
49 | //make infos about the selected page available | |
50 | $INFO = pageinfo(); | |
51 | ||
52 | // handle debugging | |
53 | if($conf['allowdebug'] && $ACT == 'debug'){ | |
54 | html_debug(); | |
55 | exit; | |
56 | } | |
57 | ||
58 | //send 404 for missing pages if configured | |
59 | if($conf['send404'] && | |
60 | ($ACT == 'show' || substr($ACT,0,7) == 'export_') && | |
61 | !$INFO['exists']){ | |
62 | header('HTTP/1.0 404 Not Found'); | |
63 | } | |
64 | ||
65 | //prepare breadcrumbs (initialize a static var) | |
66 | breadcrumbs(); | |
67 | ||
68 | // check upstream | |
69 | checkUpdateMessages(); | |
70 | ||
71 | trigger_event('DOKUWIKI_STARTED',$tmp=array()); | |
72 | ||
73 | //close session | |
74 | session_write_close(); | |
75 | ||
76 | //do the work | |
77 | act_dispatch($ACT); | |
78 | ||
79 | trigger_event('DOKUWIKI_DONE', $tmp=array()); | |
80 | ||
81 | // xdebug_dump_function_profile(1); | |
82 | ?> |