~yoboy-leguesh/ubuntu-fr-doc/maj20150810a

« back to all changes in this revision

Viewing changes to doku.php

  • Committer: YoBoY
  • Date: 2015-11-11 10:05:14 UTC
  • Revision ID: yoboy.leguesh@gmail.com-20151111100514-bw7p06lrhban4g2t
Mise à jour vers Dokuwiki 2015-08-10a avec nos patchs

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 * @global Input $INPUT
9
9
 */
10
10
 
11
 
// update message version
12
 
$updateVersion = 44;
 
11
// update message version - always use a string to avoid localized floats!
 
12
$updateVersion = "47.1";
13
13
 
14
14
//  xdebug_start_profiling();
15
15
 
16
16
if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/');
17
17
 
 
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;
 
21
 
 
22
 
18
23
if(isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
19
24
    $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
20
25
} elseif(!empty($_REQUEST['idx'])) {
29
34
    Header('Location: /maintenance-search.php');
30
35
    exit;
31
36
}
32
 
 
33
37
// load and initialize the core system
34
38
require_once(DOKU_INC.'inc/init.php');
35
39
 
39
43
$ID             = getID();
40
44
 
41
45
$REV   = $INPUT->int('rev');
 
46
$DATE_AT = $INPUT->str('at');
42
47
$IDX   = $INPUT->str('idx');
43
48
$DATE  = $INPUT->int('date');
44
49
$RANGE = $INPUT->str('range');
52
57
$SUF = cleanText($INPUT->post->str('suffix'));
53
58
$SUM = $INPUT->post->str('summary');
54
59
 
55
 
//make info about the selected page available
 
60
 
 
61
//parse DATE_AT
 
62
if($DATE_AT) {
 
63
    $date_parse = strtotime($DATE_AT);
 
64
    if($date_parse) {
 
65
        $DATE_AT = $date_parse;
 
66
    } else { // check for UNIX Timestamp
 
67
        $date_parse = @date('Ymd',$DATE_AT);
 
68
        if(!$date_parse || $date_parse === '19700101') {
 
69
            msg(sprintf($lang['unable_to_parse_date'], $DATE_AT));
 
70
            $DATE_AT = null;
 
71
        }
 
72
    }
 
73
}
 
74
 
 
75
//check for existing $REV related to $DATE_AT
 
76
if($DATE_AT) {
 
77
    $pagelog = new PageChangeLog($ID);
 
78
    $rev_t = $pagelog->getLastRevisionAt($DATE_AT);
 
79
    if($rev_t === '') { //current revision
 
80
        $REV = null;
 
81
        $DATE_AT = null;
 
82
    } else if ($rev_t === false) { //page did not exist
 
83
        $rev_n = $pagelog->getRelativeRevision($DATE_AT,+1);
 
84
        msg(sprintf($lang['page_nonexist_rev'],
 
85
            strftime($conf['dformat'],$DATE_AT),
 
86
            wl($ID, array('rev' => $rev_n)),
 
87
            strftime($conf['dformat'],$rev_n)));
 
88
        $REV = $DATE_AT; //will result in a page not exists message
 
89
    } else {
 
90
        $REV = $rev_t;
 
91
    }
 
92
}
 
93
 
 
94
//make infos about the selected page available
56
95
$INFO = pageinfo();
57
96
 
58
97
//export minimal info to JS, plugins can add more