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