* Blocked page edit action from dokuwiki.php
[sudaraka-org:dokuwiki-mods.git] / doku.php
1 <?php
2 /**
3  * DokuWiki mainscript
4  *
5  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6  * @author     Andreas Gohr <andi@splitbrain.org>
7  */
8
9 // update message version
10 $updateVersion = 36.2;
11
12 //  xdebug_start_profiling();
13
14 if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
15
16 if (isset($_SERVER['HTTP_X_DOKUWIKI_DO'])){
17     $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
18 } elseif (!empty($_REQUEST['idx'])) {
19     $ACT = 'index';
20 } elseif (isset($_REQUEST['do'])) {
21     $ACT = $_REQUEST['do'];
22 } else {
23     $ACT = 'show';
24 }
25
26 //Disable over HTTP edits
27 if(!in_array($ACT, array('show', 'sitemap', 'export_code'))) $ACT = 'show';
28
29 // load and initialize the core system
30 require_once(DOKU_INC.'inc/init.php');
31
32 //import variables
33 $_REQUEST['id'] = str_replace("\xC2\xAD",'',$_REQUEST['id']); //soft-hyphen
34 $QUERY = trim($_REQUEST['id']);
35 $ID    = getID();
36
37 // deprecated 2011-01-14
38 $NS    = getNS($ID);
39
40 $REV   = $_REQUEST['rev'];
41 $IDX   = $_REQUEST['idx'];
42 $DATE  = $_REQUEST['date'];
43 $RANGE = $_REQUEST['range'];
44 $HIGH  = $_REQUEST['s'];
45 if(empty($HIGH)) $HIGH = getGoogleQuery();
46
47 if (isset($_POST['wikitext'])) {
48     $TEXT  = cleanText($_POST['wikitext']);
49 }
50 $PRE   = cleanText(substr($_POST['prefix'], 0, -1));
51 $SUF   = cleanText($_POST['suffix']);
52 $SUM   = $_REQUEST['summary'];
53
54 //sanitize revision
55 $REV = preg_replace('/[^0-9]/','',$REV);
56
57 //make infos about the selected page available
58 $INFO = pageinfo();
59
60 //export minimal infos to JS, plugins can add more
61 $JSINFO['id']        = $ID;
62 $JSINFO['namespace'] = (string) $INFO['namespace'];
63
64
65 // handle debugging
66 if($conf['allowdebug'] && $ACT == 'debug'){
67     html_debug();
68     exit;
69 }
70
71 //send 404 for missing pages if configured or ID has special meaning to bots
72 if(!$INFO['exists'] &&
73   ($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/',$ID)) &&
74   ($ACT == 'show' || (!is_array($ACT) && substr($ACT,0,7) == 'export_')) ){
75     header('HTTP/1.0 404 Not Found');
76 }
77
78 //prepare breadcrumbs (initialize a static var)
79 if ($conf['breadcrumbs']) breadcrumbs();
80
81 // check upstream
82 checkUpdateMessages();
83
84 $tmp = array(); // No event data
85 trigger_event('DOKUWIKI_STARTED',$tmp);
86
87 //close session
88 session_write_close();
89
90 //do the work
91 act_dispatch($ACT);
92
93 $tmp = array(); // No event data
94 trigger_event('DOKUWIKI_DONE', $tmp);
95
96 //  xdebug_dump_function_profile(1);