fix(search): remove overlook from parameter
[dokuwiki.git] / doku.php
blobeb7b7d472e105c7eb30a054e34bf280c05a83648
1 <?php
2 /**
3 * DokuWiki mainscript
5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author Andreas Gohr <andi@splitbrain.org>
8 * @global Input $INPUT
9 */
11 // update message version - always use a string to avoid localized floats!
12 $updateVersion = "50";
14 // xdebug_start_profiling();
16 if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/');
18 // define all DokuWiki globals here (needed within test requests but also helps to keep track)
19 global $ACT, $INPUT, $QUERY, $ID, $REV, $DATE_AT, $IDX,
20 $DATE, $RANGE, $HIGH, $TEXT, $PRE, $SUF, $SUM, $INFO, $JSINFO;
23 if(isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
24 $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
25 } elseif(!empty($_REQUEST['idx'])) {
26 $ACT = 'index';
27 } elseif(isset($_REQUEST['do'])) {
28 $ACT = $_REQUEST['do'];
29 } else {
30 $ACT = 'show';
33 // load and initialize the core system
34 require_once(DOKU_INC.'inc/init.php');
36 //import variables
37 $INPUT->set('id', str_replace("\xC2\xAD", '', $INPUT->str('id'))); //soft-hyphen
38 $QUERY = trim($INPUT->str('q'));
39 $ID = getID();
41 $REV = $INPUT->int('rev');
42 $DATE_AT = $INPUT->str('at');
43 $IDX = $INPUT->str('idx');
44 $DATE = $INPUT->int('date');
45 $RANGE = $INPUT->str('range');
46 $HIGH = $INPUT->param('s');
47 if(empty($HIGH)) $HIGH = getGoogleQuery();
49 if($INPUT->post->has('wikitext')) {
50 $TEXT = cleanText($INPUT->post->str('wikitext'));
52 $PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1));
53 $SUF = cleanText($INPUT->post->str('suffix'));
54 $SUM = $INPUT->post->str('summary');
57 //parse DATE_AT
58 if($DATE_AT) {
59 $date_parse = strtotime($DATE_AT);
60 if($date_parse) {
61 $DATE_AT = $date_parse;
62 } else { // check for UNIX Timestamp
63 $date_parse = @date('Ymd',$DATE_AT);
64 if(!$date_parse || $date_parse === '19700101') {
65 msg(sprintf($lang['unable_to_parse_date'], hsc($DATE_AT)));
66 $DATE_AT = null;
71 //check for existing $REV related to $DATE_AT
72 if($DATE_AT) {
73 $pagelog = new PageChangeLog($ID);
74 $rev_t = $pagelog->getLastRevisionAt($DATE_AT);
75 if($rev_t === '') { //current revision
76 $REV = null;
77 $DATE_AT = null;
78 } else if ($rev_t === false) { //page did not exist
79 $rev_n = $pagelog->getRelativeRevision($DATE_AT,+1);
80 msg(sprintf($lang['page_nonexist_rev'],
81 strftime($conf['dformat'],$DATE_AT),
82 wl($ID, array('rev' => $rev_n)),
83 strftime($conf['dformat'],$rev_n)));
84 $REV = $DATE_AT; //will result in a page not exists message
85 } else {
86 $REV = $rev_t;
90 //make infos about the selected page available
91 $INFO = pageinfo();
93 //export minimal info to JS, plugins can add more
94 $JSINFO['id'] = $ID;
95 $JSINFO['namespace'] = (string) $INFO['namespace'];
97 // handle debugging
98 if($conf['allowdebug'] && $ACT == 'debug') {
99 html_debug();
100 exit;
103 //send 404 for missing pages if configured or ID has special meaning to bots
104 if(!$INFO['exists'] &&
105 ($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/', $ID)) &&
106 ($ACT == 'show' || (!is_array($ACT) && substr($ACT, 0, 7) == 'export_'))
108 header('HTTP/1.0 404 Not Found');
111 //prepare breadcrumbs (initialize a static var)
112 if($conf['breadcrumbs']) breadcrumbs();
114 // check upstream
115 checkUpdateMessages();
117 $tmp = array(); // No event data
118 trigger_event('DOKUWIKI_STARTED', $tmp);
120 //close session
121 session_write_close();
123 //do the work (picks up what to do from global env)
124 act_dispatch();
126 $tmp = array(); // No event data
127 trigger_event('DOKUWIKI_DONE', $tmp);
129 // xdebug_dump_function_profile(1);