Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 94 lines (71 sloc) 2.288 kB
f3f0262 @splitbrain Initial revision.
authored
1 <?php
15fae10 @splitbrain phpdoc comments
authored
2 /**
3 * DokuWiki mainscript
4 *
5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author Andreas Gohr <andi@splitbrain.org>
7 */
ed7b5f0 @splitbrain added init.php - may have broken something! (related to #153)
authored
8
ef362bb @selfthinker moved update message from its own file (conf/msg) into doku.php (FS#1…
selfthinker authored
9 // update message version
c991623 @adrianheine Release preparations
adrianheine authored
10 $updateVersion = 31;
ef362bb @selfthinker moved update message from its own file (conf/msg) into doku.php (FS#1…
selfthinker authored
11
2a27e99 @splitbrain more cleanup
authored
12 // xdebug_start_profiling();
81aafed @splitbrain backbutton fix
authored
13
db959ae @splitbrain Coding Standard Cleanup
authored
14 if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
ab24fc7 @adrianheine Remove (unset) action param from AUTH_LOGIN_CHECK data, init $ACL bef…
adrianheine authored
15
16 if (isset($_SERVER['HTTP_X_DOKUWIKI_DO'])){
17 $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
d059be8 @splitbrain fix index without JavaScript FS#1953
authored
18 } elseif (!empty($_REQUEST['idx'])) {
ab24fc7 @adrianheine Remove (unset) action param from AUTH_LOGIN_CHECK data, init $ACL bef…
adrianheine authored
19 $ACT = 'index';
20 } elseif (isset($_REQUEST['do'])) {
21 $ACT = $_REQUEST['do'];
22 } else {
23 $ACT = 'show';
24 }
25
1690534 @splitbrain first attempt to centralize all include loading
authored
26 // load and initialize the core system
db959ae @splitbrain Coding Standard Cleanup
authored
27 require_once(DOKU_INC.'inc/init.php');
28
29 //import variables
4f0030d @splitbrain ignore soft-hyphens for search FS#2049
authored
30 $_REQUEST['id'] = str_replace("\xC2\xAD",'',$_REQUEST['id']); //soft-hyphen
db959ae @splitbrain Coding Standard Cleanup
authored
31 $QUERY = trim($_REQUEST['id']);
32 $ID = getID();
bced415 @adrianheine Deprecate $NS in doku.php
adrianheine authored
33
34 // deprecated 2011-01-14
db959ae @splitbrain Coding Standard Cleanup
authored
35 $NS = getNS($ID);
bced415 @adrianheine Deprecate $NS in doku.php
adrianheine authored
36
db959ae @splitbrain Coding Standard Cleanup
authored
37 $REV = $_REQUEST['rev'];
38 $IDX = $_REQUEST['idx'];
39 $DATE = $_REQUEST['date'];
40868f2 @adrianheine Hide secedit buttons without title
adrianheine authored
40 $RANGE = $_REQUEST['range'];
db959ae @splitbrain Coding Standard Cleanup
authored
41 $HIGH = $_REQUEST['s'];
42 if(empty($HIGH)) $HIGH = getGoogleQuery();
43
45a9933 @adrianheine Move data preprocessing out of html_edit
adrianheine authored
44 if (isset($_POST['wikitext'])) {
45 $TEXT = cleanText($_POST['wikitext']);
46 }
42de51b @adrianheine Work around WebKit bug: newlines at the end of input values are removed.
adrianheine authored
47 $PRE = cleanText(substr($_POST['prefix'], 0, -1));
db959ae @splitbrain Coding Standard Cleanup
authored
48 $SUF = cleanText($_POST['suffix']);
49 $SUM = $_REQUEST['summary'];
50
51 //sanitize revision
52 $REV = preg_replace('/[^0-9]/','',$REV);
53
54 //make infos about the selected page available
55 $INFO = pageinfo();
f3f0262 @splitbrain Initial revision.
authored
56
72e0dc3 @splitbrain Replaced $INFO export with minimal $JSINFO
authored
57 //export minimal infos to JS, plugins can add more
85b9dd8 @splitbrain made $JSINFO keys additional
authored
58 $JSINFO['id'] = $ID;
59 $JSINFO['namespace'] = (string) $INFO['namespace'];
72e0dc3 @splitbrain Replaced $INFO export with minimal $JSINFO
authored
60
61
db959ae @splitbrain Coding Standard Cleanup
authored
62 // handle debugging
63 if($conf['allowdebug'] && $ACT == 'debug'){
f3f0262 @splitbrain Initial revision.
authored
64 html_debug();
65 exit;
db959ae @splitbrain Coding Standard Cleanup
authored
66 }
98c8685 @splitbrain file cleanups
authored
67
db959ae @splitbrain Coding Standard Cleanup
authored
68 //send 404 for missing pages if configured or ID has special meaning to bots
69 if(!$INFO['exists'] &&
70 ($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/',$ID)) &&
e2cf967 @foosel FS#1960: Don't use substr on $ACT array.
foosel authored
71 ($ACT == 'show' || (!is_array($ACT) && substr($ACT,0,7) == 'export_')) ){
2649b1a @splitbrain option to send 404 header for missing pages
authored
72 header('HTTP/1.0 404 Not Found');
db959ae @splitbrain Coding Standard Cleanup
authored
73 }
2649b1a @splitbrain option to send 404 header for missing pages
authored
74
db959ae @splitbrain Coding Standard Cleanup
authored
75 //prepare breadcrumbs (initialize a static var)
359fab8 @michitux Revert "Fix for $conf['breadcrumbs'] < 0, FS#2107", new fix
michitux authored
76 if ($conf['breadcrumbs']) breadcrumbs();
8746e72 @splitbrain session_write_close added #364
authored
77
db959ae @splitbrain Coding Standard Cleanup
authored
78 // check upstream
79 checkUpdateMessages();
c29dc6e @splitbrain updatecheck feature
authored
80
c66972f @adrianheine Emit less E_NOTICEs and E_STRICTs
adrianheine authored
81 $tmp = array(); // No event data
82 trigger_event('DOKUWIKI_STARTED',$tmp);
a4b5ae1 @Chris--S add events, DOKUWIKI_START & DOKUWIKI_END
Chris--S authored
83
db959ae @splitbrain Coding Standard Cleanup
authored
84 //close session
85 session_write_close();
8746e72 @splitbrain session_write_close added #364
authored
86
db959ae @splitbrain Coding Standard Cleanup
authored
87 //do the work
88 act_dispatch($ACT);
b3222a5 @splitbrain workaround for php umask bug (fixes #97)
authored
89
c66972f @adrianheine Emit less E_NOTICEs and E_STRICTs
adrianheine authored
90 $tmp = array(); // No event data
91 trigger_event('DOKUWIKI_DONE', $tmp);
a4b5ae1 @Chris--S add events, DOKUWIKI_START & DOKUWIKI_END
Chris--S authored
92
2a27e99 @splitbrain more cleanup
authored
93 // xdebug_dump_function_profile(1);
Something went wrong with that request. Please try again.