Permalink
Switch branches/tags
upstream/0.0.20091252c upstream/0.0.20090214b release_2007-06-26 release_2006-11-06 release_2006-03-09 release_2006-03-05 release_stable_2018-04-22 release_stable_2018-04-22a release_stable_2017-02-19 release_stable_2017-02-19e release_stable_2017-02-19d release_stable_2017-02-19c release_stable_2017-02-19b release_stable_2017-02-19a release_stable_2016-06-26 release_stable_2016-06-26e release_stable_2016-06-26d release_stable_2016-06-26c release_stable_2016-06-26b release_stable_2016-06-26a release_stable_2015-08-10 release_stable_2015-08-10a release_stable_2014_09_29d release_stable_2014_09_29c release_stable_2014_09_29b release_stable_2014_05_05e release_stable_2014_05_05d release_stable_2014_05_05c release_stable_2014-09-29 release_stable_2014-09-29a release_stable_2014-05-05 release_stable_2014-05-05b release_stable_2014-05-05a release_stable_2013-12-08 release_stable_2013-12-08a release_stable_2013-05-10 release_stable_2013-05-10a release_stable_2012-10-13 release_stable_2012-01-25 release_stable_2012-01-25b release_stable_2011_05_25 release_stable_2011_05_25a release_stable_2010-11-07 release_stable_2010-11-07b release_stable_2010-11-07a release_stable_2009-12-25 release_stable_2009-02-14 release_stable_2008-05-05 release_stable_2008-05-04 release_candidate_2013_03_06 release_candidate_2013-11-18 release_candidate_2013-10-28 release_candidate_2012_09_10 release_candidate_2011-11-10 release_candidate_2010-10-27 release_candidate_2010-10-07 release_candidate_2009-12-02 release_candidate_2009-02-06 release_candidate_2009-01-30 release_candidate_2009-01-26 release_candidate_2008-04-11 release_candidate_2008-03-31 release_candidate_2007-05-24 release_candidate_2006-10-19 release_candidate_2006-10-08 release_candidate_2006-09-28 rel_2005-09-22 rel_2005-09-19 rel_2005-07-13 rel_2005-07-01 develsnap_2009-12-01 develsnap_2009-11-15 develsnap_2009-11-01 develsnap_2009-10-01 develsnap_2009-09-01 develsnap_2009-08-01 develsnap_2009-07-01 develsnap_2009-06-01 develsnap_2009-05-01 develsnap_2009-04-01 develsnap_2009-03-01 develsnap_2009-02-01 develsnap_2009-01-01 develsnap_2008-12-01 develsnap_2008-11-01 develsnap_2008-10-13 develsnap_2008-10-01 develsnap_2008-09-01 develsnap_2008-08-01 develsnap_2008-07-01 develsnap_2008-06-01 develsnap_2008-05-01 develsnap_2008-04-01 develsnap_2008-03-01 develsnap_2008-02-01 develsnap_2008-01-01 develsnap_2007-12-01 develsnap_2007-11-01 develsnap_2007-10-01 develsnap_2007-09-01
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
126 lines (102 sloc) 3.46 KB
<?php
/**
* DokuWiki mainscript
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@splitbrain.org>
*
* @global Input $INPUT
*/
// update message version - always use a string to avoid localized floats!
$updateVersion = "51";
// xdebug_start_profiling();
if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/');
// define all DokuWiki globals here (needed within test requests but also helps to keep track)
global $ACT, $INPUT, $QUERY, $ID, $REV, $DATE_AT, $IDX,
$DATE, $RANGE, $HIGH, $TEXT, $PRE, $SUF, $SUM, $INFO, $JSINFO;
if(isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
$ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
} elseif(!empty($_REQUEST['idx'])) {
$ACT = 'index';
} 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
$QUERY = trim($INPUT->str('q'));
$ID = getID();
$REV = $INPUT->int('rev');
$DATE_AT = $INPUT->str('at');
$IDX = $INPUT->str('idx');
$DATE = $INPUT->int('date');
$RANGE = $INPUT->str('range');
$HIGH = $INPUT->param('s');
if(empty($HIGH)) $HIGH = getGoogleQuery();
if($INPUT->post->has('wikitext')) {
$TEXT = cleanText($INPUT->post->str('wikitext'));
}
$PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1));
$SUF = cleanText($INPUT->post->str('suffix'));
$SUM = $INPUT->post->str('summary');
//parse DATE_AT
if($DATE_AT) {
$date_parse = strtotime($DATE_AT);
if($date_parse) {
$DATE_AT = $date_parse;
} else { // check for UNIX Timestamp
$date_parse = @date('Ymd',$DATE_AT);
if(!$date_parse || $date_parse === '19700101') {
msg(sprintf($lang['unable_to_parse_date'], hsc($DATE_AT)));
$DATE_AT = null;
}
}
}
//check for existing $REV related to $DATE_AT
if($DATE_AT) {
$pagelog = new PageChangeLog($ID);
$rev_t = $pagelog->getLastRevisionAt($DATE_AT);
if($rev_t === '') { //current revision
$REV = null;
$DATE_AT = null;
} else if ($rev_t === false) { //page did not exist
$rev_n = $pagelog->getRelativeRevision($DATE_AT,+1);
msg(sprintf($lang['page_nonexist_rev'],
strftime($conf['dformat'],$DATE_AT),
wl($ID, array('rev' => $rev_n)),
strftime($conf['dformat'],$rev_n)));
$REV = $DATE_AT; //will result in a page not exists message
} else {
$REV = $rev_t;
}
}
//make infos about the selected page available
$INFO = pageinfo();
// handle debugging
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'] &&
($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)
if($conf['breadcrumbs']) breadcrumbs();
// check upstream
checkUpdateMessages();
$tmp = array(); // No event data
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);