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 $updateVersion = "50";
14 // xdebug_start_profiling();
16 if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__
).'/');
18 // define all DokuWiki globals here (needed within test requests but also helps to keep track)
19 global $ACT, $INPUT, $QUERY, $ID, $REV, $DATE_AT, $IDX,
20 $DATE, $RANGE, $HIGH, $TEXT, $PRE, $SUF, $SUM, $INFO, $JSINFO;
23 if(isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
24 $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
25 } elseif(!empty($_REQUEST['idx'])) {
27 } elseif(isset($_REQUEST['do'])) {
28 $ACT = $_REQUEST['do'];
33 // load and initialize the core system
34 require_once(DOKU_INC
.'inc/init.php');
37 $INPUT->set('id', str_replace("\xC2\xAD", '', $INPUT->str('id'))); //soft-hyphen
38 $QUERY = trim($INPUT->str('q'));
41 $REV = $INPUT->int('rev');
42 $DATE_AT = $INPUT->str('at');
43 $IDX = $INPUT->str('idx');
44 $DATE = $INPUT->int('date');
45 $RANGE = $INPUT->str('range');
46 $HIGH = $INPUT->param('s');
47 if(empty($HIGH)) $HIGH = getGoogleQuery();
49 if($INPUT->post
->has('wikitext')) {
50 $TEXT = cleanText($INPUT->post
->str('wikitext'));
52 $PRE = cleanText(substr($INPUT->post
->str('prefix'), 0, -1));
53 $SUF = cleanText($INPUT->post
->str('suffix'));
54 $SUM = $INPUT->post
->str('summary');
59 $date_parse = strtotime($DATE_AT);
61 $DATE_AT = $date_parse;
62 } else { // check for UNIX Timestamp
63 $date_parse = @date
('Ymd',$DATE_AT);
64 if(!$date_parse ||
$date_parse === '19700101') {
65 msg(sprintf($lang['unable_to_parse_date'], hsc($DATE_AT)));
71 //check for existing $REV related to $DATE_AT
73 $pagelog = new PageChangeLog($ID);
74 $rev_t = $pagelog->getLastRevisionAt($DATE_AT);
75 if($rev_t === '') { //current revision
78 } else if ($rev_t === false) { //page did not exist
79 $rev_n = $pagelog->getRelativeRevision($DATE_AT,+
1);
80 msg(sprintf($lang['page_nonexist_rev'],
81 strftime($conf['dformat'],$DATE_AT),
82 wl($ID, array('rev' => $rev_n)),
83 strftime($conf['dformat'],$rev_n)));
84 $REV = $DATE_AT; //will result in a page not exists message
90 //make infos about the selected page available
94 if($conf['allowdebug'] && $ACT == 'debug') {
99 //send 404 for missing pages if configured or ID has special meaning to bots
100 if(!$INFO['exists'] &&
101 ($conf['send404'] ||
preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/', $ID)) &&
102 ($ACT == 'show' ||
(!is_array($ACT) && substr($ACT, 0, 7) == 'export_'))
104 header('HTTP/1.0 404 Not Found');
107 //prepare breadcrumbs (initialize a static var)
108 if($conf['breadcrumbs']) breadcrumbs();
111 checkUpdateMessages();
113 $tmp = array(); // No event data
114 trigger_event('DOKUWIKI_STARTED', $tmp);
117 session_write_close();
119 //do the work (picks up what to do from global env)
122 $tmp = array(); // No event data
123 trigger_event('DOKUWIKI_DONE', $tmp);
125 // xdebug_dump_function_profile(1);