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// update message version 10$updateVersion = 26; 11 12// xdebug_start_profiling(); 13 14if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/'); 15 16if (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 27require_once(DOKU_INC.'inc/init.php'); 28 29//import variables 30$QUERY = trim($_REQUEST['id']); 31$ID = getID(); 32$NS = getNS($ID); 33$REV = $_REQUEST['rev']; 34$IDX = $_REQUEST['idx']; 35$DATE = $_REQUEST['date']; 36$RANGE = $_REQUEST['range']; 37$HIGH = $_REQUEST['s']; 38if(empty($HIGH)) $HIGH = getGoogleQuery(); 39 40if (isset($_POST['wikitext'])) { 41 $TEXT = cleanText($_POST['wikitext']); 42} 43$PRE = cleanText($_POST['prefix']); 44$SUF = cleanText($_POST['suffix']); 45$SUM = $_REQUEST['summary']; 46 47//sanitize revision 48$REV = preg_replace('/[^0-9]/','',$REV); 49 50//make infos about the selected page available 51$INFO = pageinfo(); 52 53//export minimal infos to JS, plugins can add more 54$JSINFO['id'] = $ID; 55$JSINFO['namespace'] = (string) $INFO['namespace']; 56 57 58// handle debugging 59if($conf['allowdebug'] && $ACT == 'debug'){ 60 html_debug(); 61 exit; 62} 63 64//send 404 for missing pages if configured or ID has special meaning to bots 65if(!$INFO['exists'] && 66 ($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/',$ID)) && 67 ($ACT == 'show' || (!is_array($ACT) && substr($ACT,0,7) == 'export_')) ){ 68 header('HTTP/1.0 404 Not Found'); 69} 70 71//prepare breadcrumbs (initialize a static var) 72if ($conf['breadcrumbs']) breadcrumbs(); 73 74// check upstream 75checkUpdateMessages(); 76 77$tmp = array(); // No event data 78trigger_event('DOKUWIKI_STARTED',$tmp); 79 80//close session 81session_write_close(); 82 83//do the work 84act_dispatch($ACT); 85 86$tmp = array(); // No event data 87trigger_event('DOKUWIKI_DONE', $tmp); 88 89// xdebug_dump_function_profile(1); 90