1f3f0262cSandi<?php 215fae107Sandi/** 315fae107Sandi * DokuWiki mainscript 415fae107Sandi * 515fae107Sandi * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 7*dbd7dc8eSAndreas Gohr * 8*dbd7dc8eSAndreas Gohr * @global Input $INPUT 915fae107Sandi */ 1015fae107Sandi 11ef362bb8SAnika Henke// update message version 122f85287eSAdrian Lang$updateVersion = 36.1; 13ef362bb8SAnika Henke 1481aafed4Sandi// xdebug_start_profiling(); 1581aafed4Sandi 16d0a27cb0SAndreas Gohrif(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/'); 17ab24fc7fSAdrian Lang 18ab24fc7fSAdrian Langif (isset($_SERVER['HTTP_X_DOKUWIKI_DO'])){ 19ab24fc7fSAdrian Lang $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO'])); 20d059be8cSAndreas Gohr} elseif (!empty($_REQUEST['idx'])) { 21ab24fc7fSAdrian Lang $ACT = 'index'; 22ab24fc7fSAdrian Lang} elseif (isset($_REQUEST['do'])) { 23ab24fc7fSAdrian Lang $ACT = $_REQUEST['do']; 24ab24fc7fSAdrian Lang} else { 25ab24fc7fSAdrian Lang $ACT = 'show'; 26ab24fc7fSAdrian Lang} 27ab24fc7fSAdrian Lang 2816905344SAndreas Gohr// load and initialize the core system 29ed7b5f09Sandirequire_once(DOKU_INC.'inc/init.php'); 30f3f0262cSandi 31f3f0262cSandi//import variables 32*dbd7dc8eSAndreas Gohr$_REQUEST['id'] = str_replace("\xC2\xAD",'',$INPUT->str('id')); //soft-hyphen 33*dbd7dc8eSAndreas Gohr$QUERY = trim($INPUT->str('id')); 346c7843b5Sandi$ID = getID(); 35bced4159SAdrian Lang 36bced4159SAdrian Lang// deprecated 2011-01-14 37d98d4540SBen Coburn$NS = getNS($ID); 38bced4159SAdrian Lang 39*dbd7dc8eSAndreas Gohr$REV = $INPUT->int('rev'); 40*dbd7dc8eSAndreas Gohr$IDX = $INPUT->str('idx'); 41*dbd7dc8eSAndreas Gohr$DATE = $INPUT->int('date'); 42*dbd7dc8eSAndreas Gohr$RANGE = $INPUT->str('range'); 43*dbd7dc8eSAndreas Gohr$HIGH = $INPUT->param('s'); 44f3f0262cSandiif(empty($HIGH)) $HIGH = getGoogleQuery(); 45f3f0262cSandi 46*dbd7dc8eSAndreas Gohrif ($INPUT->post->has('wikitext')) { 47*dbd7dc8eSAndreas Gohr $TEXT = cleanText($INPUT->post->str('wikitext')); 4845a99335SAdrian Lang} 49*dbd7dc8eSAndreas Gohr$PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1)); 50*dbd7dc8eSAndreas Gohr$SUF = cleanText($INPUT->post->str('suffix')); 51*dbd7dc8eSAndreas Gohr$SUM = $INPUT->post->str('summary'); 52258641c6Sandi 53100a97e3SAndreas Gohr//make infos about the selected page available 54100a97e3SAndreas Gohr$INFO = pageinfo(); 55f3f0262cSandi 5672e0dc37SAndreas Gohr//export minimal infos to JS, plugins can add more 5785b9dd81SAndreas Gohr$JSINFO['id'] = $ID; 5885b9dd81SAndreas Gohr$JSINFO['namespace'] = (string) $INFO['namespace']; 5972e0dc37SAndreas Gohr 6072e0dc37SAndreas Gohr 61100a97e3SAndreas Gohr// handle debugging 62f42d1c75SAndreas Gohrif($conf['allowdebug'] && $ACT == 'debug'){ 63f3f0262cSandi html_debug(); 64f3f0262cSandi exit; 65f3f0262cSandi} 66f3f0262cSandi 672cff5827SAndreas Gohr//send 404 for missing pages if configured or ID has special meaning to bots 682cff5827SAndreas Gohrif(!$INFO['exists'] && 692cff5827SAndreas Gohr ($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/',$ID)) && 70e2cf9671SGina Haeussge ($ACT == 'show' || (!is_array($ACT) && substr($ACT,0,7) == 'export_')) ){ 712649b1a4SAndreas Gohr header('HTTP/1.0 404 Not Found'); 722649b1a4SAndreas Gohr} 732649b1a4SAndreas Gohr 748746e727Sandi//prepare breadcrumbs (initialize a static var) 75359fab8bSMichael Hamannif ($conf['breadcrumbs']) breadcrumbs(); 768746e727Sandi 77c29dc6e4SAndreas Gohr// check upstream 78c29dc6e4SAndreas GohrcheckUpdateMessages(); 79c29dc6e4SAndreas Gohr 80c66972f2SAdrian Lang$tmp = array(); // No event data 81c66972f2SAdrian Langtrigger_event('DOKUWIKI_STARTED',$tmp); 82a4b5ae12Schris 838746e727Sandi//close session 848746e727Sandisession_write_close(); 858746e727Sandi 868746e727Sandi//do the work 876b13307fSandiact_dispatch($ACT); 88b3222a5cSandi 89c66972f2SAdrian Lang$tmp = array(); // No event data 90c66972f2SAdrian Langtrigger_event('DOKUWIKI_DONE', $tmp); 91a4b5ae12Schris 922a27e99aSandi// xdebug_dump_function_profile(1); 93