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