5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author Andreas Gohr <andi@splitbrain.org>
11 // update message version - always use a string to avoid localized floats!
12 use dokuwiki\Extension\Event
;
14 $updateVersion = "53";
16 // xdebug_start_profiling();
18 if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__
).'/');
20 // define all DokuWiki globals here (needed within test requests but also helps to keep track)
21 global $ACT, $INPUT, $QUERY, $ID, $REV, $DATE_AT, $IDX,
22 $DATE, $RANGE, $HIGH, $TEXT, $PRE, $SUF, $SUM, $INFO, $JSINFO;
25 if(isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
26 $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
27 } elseif(!empty($_REQUEST['idx'])) {
29 } elseif(isset($_REQUEST['do'])) {
30 $ACT = $_REQUEST['do'];
35 // load and initialize the core system
36 require_once(DOKU_INC
.'inc/init.php');
39 $INPUT->set('id', str_replace("\xC2\xAD", '', $INPUT->str('id'))); //soft-hyphen
40 $QUERY = trim($INPUT->str('q'));
43 $REV = $INPUT->int('rev');
44 $DATE_AT = $INPUT->str('at');
45 $IDX = $INPUT->str('idx');
46 $DATE = $INPUT->int('date');
47 $RANGE = $INPUT->str('range');
48 $HIGH = $INPUT->param('s');
49 if(empty($HIGH)) $HIGH = getGoogleQuery();
51 if($INPUT->post
->has('wikitext')) {
52 $TEXT = cleanText($INPUT->post
->str('wikitext'));
54 $PRE = cleanText(substr($INPUT->post
->str('prefix'), 0, -1));
55 $SUF = cleanText($INPUT->post
->str('suffix'));
56 $SUM = $INPUT->post
->str('summary');
61 $date_parse = strtotime($DATE_AT);
63 $DATE_AT = $date_parse;
64 } else { // check for UNIX Timestamp
65 $date_parse = @date
('Ymd',$DATE_AT);
66 if(!$date_parse ||
$date_parse === '19700101') {
67 msg(sprintf($lang['unable_to_parse_date'], hsc($DATE_AT)));
73 //check for existing $REV related to $DATE_AT
75 $pagelog = new \dokuwiki\ChangeLog\
PageChangeLog($ID);
76 $rev_t = $pagelog->getLastRevisionAt($DATE_AT);
77 if($rev_t === '') { //current revision
80 } else if ($rev_t === false) { //page did not exist
81 $rev_n = $pagelog->getRelativeRevision($DATE_AT,+
1);
84 $lang['page_nonexist_rev'],
86 wl($ID, array('rev' => $rev_n)),
90 $REV = $DATE_AT; //will result in a page not exists message
96 //make infos about the selected page available
100 if($conf['allowdebug'] && $ACT == 'debug') {
105 //send 404 for missing pages if configured or ID has special meaning to bots
106 if(!$INFO['exists'] &&
107 ($conf['send404'] ||
preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/', $ID)) &&
108 ($ACT == 'show' ||
(!is_array($ACT) && substr($ACT, 0, 7) == 'export_'))
110 header('HTTP/1.0 404 Not Found');
113 //prepare breadcrumbs (initialize a static var)
114 if($conf['breadcrumbs']) breadcrumbs();
117 checkUpdateMessages();
119 $tmp = array(); // No event data
120 Event
::createAndTrigger('DOKUWIKI_STARTED', $tmp);
123 session_write_close();
125 //do the work (picks up what to do from global env)
128 $tmp = array(); // No event data
129 Event
::createAndTrigger('DOKUWIKI_DONE', $tmp);
131 // xdebug_dump_function_profile(1);