dokuwiki/doku.php

90 lines
2.3 KiB
PHP
Raw Normal View History

<?php
/**
* DokuWiki mainscript
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@splitbrain.org>
2012-06-24 14:42:45 +02:00
*
* @global Input $INPUT
*/
// update message version
2013-11-18 15:28:28 +01:00
$updateVersion = 42;
// xdebug_start_profiling();
2012-06-24 14:43:51 +02:00
if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/');
2012-06-24 14:43:51 +02:00
if(isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
$ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
2012-06-24 14:43:51 +02:00
} elseif(!empty($_REQUEST['idx'])) {
$ACT = 'index';
2012-06-24 14:43:51 +02:00
} elseif(isset($_REQUEST['do'])) {
$ACT = $_REQUEST['do'];
} else {
$ACT = 'show';
}
// load and initialize the core system
require_once(DOKU_INC.'inc/init.php');
//import variables
$INPUT->set('id', str_replace("\xC2\xAD", '', $INPUT->str('id'))); //soft-hyphen
2012-06-24 14:43:51 +02:00
$QUERY = trim($INPUT->str('id'));
$ID = getID();
2012-06-24 14:42:45 +02:00
$REV = $INPUT->int('rev');
$IDX = $INPUT->str('idx');
$DATE = $INPUT->int('date');
$RANGE = $INPUT->str('range');
$HIGH = $INPUT->param('s');
if(empty($HIGH)) $HIGH = getGoogleQuery();
2012-06-24 14:43:51 +02:00
if($INPUT->post->has('wikitext')) {
$TEXT = cleanText($INPUT->post->str('wikitext'));
}
2012-06-24 14:43:51 +02:00
$PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1));
$SUF = cleanText($INPUT->post->str('suffix'));
$SUM = $INPUT->post->str('summary');
//make info about the selected page available
$INFO = pageinfo();
//export minimal info to JS, plugins can add more
$JSINFO['id'] = $ID;
$JSINFO['namespace'] = (string) $INFO['namespace'];
// handle debugging
2012-06-24 14:43:51 +02:00
if($conf['allowdebug'] && $ACT == 'debug') {
html_debug();
exit;
}
//send 404 for missing pages if configured or ID has special meaning to bots
if(!$INFO['exists'] &&
2012-06-24 14:43:51 +02:00
($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/', $ID)) &&
($ACT == 'show' || (!is_array($ACT) && substr($ACT, 0, 7) == 'export_'))
) {
header('HTTP/1.0 404 Not Found');
}
//prepare breadcrumbs (initialize a static var)
2012-06-24 14:43:51 +02:00
if($conf['breadcrumbs']) breadcrumbs();
// check upstream
checkUpdateMessages();
$tmp = array(); // No event data
2012-06-24 14:43:51 +02:00
trigger_event('DOKUWIKI_STARTED', $tmp);
//close session
session_write_close();
//do the work (picks up what to do from global env)
act_dispatch();
$tmp = array(); // No event data
trigger_event('DOKUWIKI_DONE', $tmp);
// xdebug_dump_function_profile(1);