]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/main.php
New action=create. Essentially the same as action=edit, except that if the
[SourceForge/phpwiki.git] / lib / main.php
1 <?php
2 rcs_id('$Id: main.php,v 1.97 2003-02-26 03:40:22 dairiki Exp $');
3
4 define ('USE_PREFS_IN_PAGE', true);
5
6 include "lib/config.php";
7 include "lib/stdlib.php";
8 require_once('lib/Request.php');
9 require_once("lib/WikiUser.php");
10 require_once('lib/WikiDB.php');
11
12 if (USE_DB_SESSION) {
13     include_once('lib/DB_Session.php');
14 }
15
16 class WikiRequest extends Request {
17     // var $_dbi;
18
19     function WikiRequest () {
20         if (USE_DB_SESSION) {
21             $this->_dbi = $this->getDbh();
22             new DB_Session($this->_dbi->_backend->_dbh,
23                            $GLOBALS['DBParams']['db_session_table']);
24         }
25         
26         $this->Request();
27
28         // Normalize args...
29         $this->setArg('pagename', $this->_deducePagename());
30         $this->setArg('action', $this->_deduceAction());
31
32         // Restore auth state
33         $this->_user = new WikiUser($this, $this->_deduceUsername());
34         // $this->_user = new WikiDB_User($this->_user->getId(), $this->getAuthDbh());
35         $this->_prefs = $this->_user->getPreferences();
36     }
37
38     function initializeLang () {
39         if ($user_lang = $this->getPref('lang')) {
40             //trigger_error("DEBUG: initializeLang() ". $user_lang ." calling update_locale()...");
41             update_locale($user_lang);
42         }
43     }
44
45     function initializeTheme () {
46         global $Theme;
47
48         // Load theme
49         if ($user_theme = $this->getPref('theme'))
50             include_once("themes/$user_theme/themeinfo.php");
51         if (empty($Theme) and defined ('THEME'))
52             include_once("themes/" . THEME . "/themeinfo.php");
53         if (empty($Theme))
54             include_once("themes/default/themeinfo.php");
55         assert(!empty($Theme));
56     }
57
58
59     // This really maybe should be part of the constructor, but since it
60     // may involve HTML/template output, the global $request really needs
61     // to be initialized before we do this stuff.
62     function updateAuthAndPrefs () {
63         
64         // Handle preference updates, an authentication requests, if any.
65         if ($new_prefs = $this->getArg('pref')) {
66             $this->setArg('pref', false);
67             if ($this->isPost() and !empty($new_prefs['passwd']) and 
68                 ($new_prefs['passwd2'] != $new_prefs['passwd'])) {
69                 // FIXME: enh?
70                 $this->_prefs->set('passwd','');
71                 // $this->_prefs->set('passwd2',''); // This is not stored anyway
72                 return false;
73             }
74             foreach ($new_prefs as $key => $val) {
75                 if ($key == 'passwd') {
76                     // FIXME: enh?
77                     $val = crypt('passwd');
78                 }
79                 $this->_prefs->set($key, $val);
80             }
81         }
82
83         // FIXME: need to move authentication request processing
84         // up to be before pref request processing, I think,
85         // since logging in may change which preferences
86         // we're talking about...
87
88         // Handle authentication request, if any.
89         if ($auth_args = $this->getArg('auth')) {
90             $this->setArg('auth', false);
91             $this->_handleAuthRequest($auth_args); // possible NORETURN
92         }
93         elseif ( ! $this->_user->isSignedIn() ) {
94             // If not auth request, try to sign in as saved user.
95             if (($saved_user = $this->getPref('userid')) != false) {
96                 $this->_signIn($saved_user);
97             }
98         }
99
100         // Save preferences in session and cookie
101         // FIXME: hey! what about anonymous users?   Can't they have
102         // preferences too?
103
104         $id_only = true; 
105         $this->_user->setPreferences($this->_prefs, $id_only);
106
107         // Ensure user has permissions for action
108         $require_level = $this->requiredAuthority($this->getArg('action'));
109         if (! $this->_user->hasAuthority($require_level))
110             $this->_notAuthorized($require_level); // NORETURN
111     }
112
113     function getUser () {
114         return $this->_user;
115     }
116
117     function getPrefs () {
118         return $this->_prefs;
119     }
120
121     // Convenience function:
122     function getPref ($key) {
123         return $this->_prefs->get($key);
124     }
125
126     function getDbh () {
127         if (!isset($this->_dbi)) {
128             // needs PHP 4.1. better use $this->_user->...
129             $this->_dbi = WikiDB::open($GLOBALS['DBParams']);
130         }
131         return $this->_dbi;
132     }
133
134     function getAuthDbh () {
135         global $DBParams, $DBAuthParams;
136         if (!isset($this->_auth_dbi)) {
137             if ($DBParams['dbtype'] == 'dba' or empty($DBAuthParams['auth_dsn']))
138                 $this->_auth_dbi = $this->getDbh(); // use phpwiki database 
139             elseif ($DBAuthParams['auth_dsn'] == $DBParams['dsn'])
140                 $this->_auth_dbi = $this->getDbh(); // same phpwiki database 
141             else // use external database 
142                 // needs PHP 4.1. better use $this->_user->...
143                 $this->_auth_dbi = WikiDB_User::open($DBAuthParams);
144         }
145         return $this->_auth_dbi;
146     }
147
148     /**
149      * Get requested page from the page database.
150      * By default it will grab the page requested via the URL
151      *
152      * This is a convenience function.
153      * @param string $pagename Name of page to get.
154      * @return WikiDB_Page Object with methods to pull data from
155      * database for the page requested.
156      */
157     function getPage ($pagename = false) {
158         if (!isset($this->_dbi))
159             $this->getDbh();
160                 if (!$pagename) 
161                         $pagename = $this->getArg('pagename');
162         return $this->_dbi->getPage($pagename);
163     }
164
165     /** Get URL for POST actions.
166      *
167      * Officially, we should just use SCRIPT_NAME (or some such),
168      * but that causes problems when we try to issue a redirect, e.g.
169      * after saving a page.
170      *
171      * Some browsers (at least NS4 and Mozilla 0.97 won't accept
172      * a redirect from a page to itself.)
173      *
174      * So, as a HACK, we include pagename and action as query args in
175      * the URL.  (These should be ignored when we receive the POST
176      * request.)
177      */
178     function getPostURL ($pagename=false) {
179         if ($pagename === false)
180             $pagename = $this->getArg('pagename');
181         $action = $this->getArg('action');
182         return WikiURL($pagename, array('action' => $action));
183     }
184     
185     function _handleAuthRequest ($auth_args) {
186         if (!is_array($auth_args))
187             return;
188
189         // Ignore password unless POST'ed.
190         if (!$this->isPost())
191             unset($auth_args['passwd']);
192
193         $user = $this->_user->AuthCheck($auth_args);
194
195         if (isa($user, 'WikiUser')) {
196             // Successful login (or logout.)
197             $this->_setUser($user);
198         }
199         elseif ($user) {
200             // Login attempt failed.
201             $fail_message = $user;
202             $auth_args['pass_required'] = true;
203             // If no password was submitted, it's not really
204             // a failure --- just need to prompt for password...
205             if (!isset($auth_args['passwd'])) {
206                  //$auth_args['pass_required'] = false;
207                  $fail_message = false;
208             }
209             $this->_user->PrintLoginForm($this, $auth_args, $fail_message);
210             $this->finish();    //NORETURN
211         }
212         else {
213             // Login request cancelled.
214         }
215     }
216
217     /**
218      * Attempt to sign in (bogo-login).
219      *
220      * Fails silently.
221      *
222      * @param $userid string Userid to attempt to sign in as.
223      * @access private
224      */
225     function _signIn ($userid) {
226         $user = $this->_user->AuthCheck(array('userid' => $userid));
227         if (isa($user, 'WikiUser')) {
228             $this->_setUser($user); // success!
229         }
230     }
231
232     function _setUser ($user) {
233         $this->_user = $user;
234         $this->setCookieVar('WIKI_ID', $user->_userid, 365);
235         $this->setSessionVar('wiki_user', $user);
236         if ($user->isSignedIn())
237             $user->_authhow = 'signin';
238
239         // Save userid to prefs..
240         $this->_prefs->set('userid',
241                            $user->isSignedIn() ? $user->getId() : '');
242     }
243
244     function _notAuthorized ($require_level) {
245         // User does not have required authority.  Prompt for login.
246         $what = $this->getActionDescription($this->getArg('action'));
247
248         if ($require_level >= WIKIAUTH_FORBIDDEN) {
249             $this->finish(fmt("%s is disallowed on this wiki.",
250                               $this->getDisallowedActionDescription($this->getArg('action'))));
251         }
252         elseif ($require_level == WIKIAUTH_BOGO)
253             $msg = fmt("You must sign in to %s.", $what);
254         elseif ($require_level == WIKIAUTH_USER)
255             $msg = fmt("You must log in to %s.", $what);
256         else
257             $msg = fmt("You must be an administrator to %s.", $what);
258         $pass_required = ($require_level >= WIKIAUTH_USER);
259
260         $this->_user->PrintLoginForm($this, compact('require_level','pass_required'), $msg);
261         $this->finish();    // NORETURN
262     }
263
264     function getActionDescription($action) {
265         static $actionDescriptions;
266         if (! $actionDescriptions) {
267             $actionDescriptions
268             = array('browse'     => _("browse pages in this wiki"),
269                     'diff'       => _("diff pages in this wiki"),
270                     'dumphtml'   => _("dump html pages from this wiki"),
271                     'dumpserial' => _("dump serial pages from this wiki"),
272                     'edit'       => _("edit pages in this wiki"),
273                     'create'     => _("create pages in this wiki"),
274                     'loadfile'   => _("load files into this wiki"),
275                     'lock'       => _("lock pages in this wiki"),
276                     'remove'     => _("remove pages from this wiki"),
277                     'unlock'     => _("unlock pages in this wiki"),
278                     'upload'     => _("upload a zip dump to this wiki"),
279                     'verify'     => _("verify the current action"),
280                     'viewsource' => _("view the source of pages in this wiki"),
281                     'xmlrpc'     => _("access this wiki via XML-RPC"),
282                     'zip'        => _("download a zip dump from this wiki"),
283                     'ziphtml'    => _("download an html zip dump from this wiki")
284                     );
285         }
286         if (in_array($action, array_keys($actionDescriptions)))
287             return $actionDescriptions[$action];
288         else
289             return $action;
290     }
291     function getDisallowedActionDescription($action) {
292         static $disallowedActionDescriptions;
293         if (! $disallowedActionDescriptions) {
294             $disallowedActionDescriptions
295             = array('browse'     => _("Browsing pages"),
296                     'diff'       => _("Diffing pages"),
297                     'dumphtml'   => _("Dumping html pages"),
298                     'dumpserial' => _("Dumping serial pages"),
299                     'edit'       => _("Editing pages"),
300                     'create'     => _("Creating pages"),
301                     'loadfile'   => _("Loading files"),
302                     'lock'       => _("Locking pages"),
303                     'remove'     => _("Removing pages"),
304                     'unlock'     => _("Unlocking pages"),
305                     'upload'     => _("Uploading zip dumps"),
306                     'verify'     => _("Verify the current action"),
307                     'viewsource' => _("Viewing the source of pages"),
308                     'xmlrpc'     => _("XML-RPC access"),
309                     'zip'        => _("Downloading zip dumps"),
310                     'ziphtml'    => _("Downloading html zip dumps")
311                     );
312         }
313         if (in_array($action, array_keys($disallowedActionDescriptions)))
314             return $disallowedActionDescriptions[$action];
315         else
316             return $action;
317     }
318
319     function requiredAuthority ($action) {
320         $auth = $this->requiredAuthorityForAction($action);
321         
322         /*
323          * This is a hook for plugins to require authority
324          * for posting to them.
325          *
326          * IMPORTANT: this is not a secure check, so the plugin
327          * may not assume that any POSTs to it are authorized.
328          * All this does is cause PhpWiki to prompt for login
329          * if the user doesn't have the required authority.
330          */
331         if ($this->isPost()) {
332             $post_auth = $this->getArg('require_authority_for_post');
333             if ($post_auth !== false)
334                 $auth = max($auth, $post_auth);
335         }
336         return $auth;
337     }
338         
339     function requiredAuthorityForAction ($action) {
340         // FIXME: clean up. 
341         // Todo: Check individual page permissions instead.
342         switch ($action) {
343             case 'browse':
344             case 'viewsource':
345             case 'diff':
346             case 'select':
347             case 'xmlrpc':    
348                 return WIKIAUTH_ANON;
349
350             case 'zip':
351                 if (defined('ZIPDUMP_AUTH') && ZIPDUMP_AUTH)
352                     return WIKIAUTH_ADMIN;
353                 return WIKIAUTH_ANON;
354
355             case 'ziphtml':
356                 if (defined('ZIPDUMP_AUTH') && ZIPDUMP_AUTH)
357                     return WIKIAUTH_ADMIN;
358                 return WIKIAUTH_ANON;
359
360             case 'edit':
361                 if (defined('REQUIRE_SIGNIN_BEFORE_EDIT') && REQUIRE_SIGNIN_BEFORE_EDIT)
362                     return WIKIAUTH_BOGO;
363                 return WIKIAUTH_ANON;
364                 // return WIKIAUTH_BOGO;
365
366             case 'create':
367                 $page = $this->getPage();
368                 $current = $page->getCurrentRevision();
369                 if ($current->hasDefaultContents())
370                     return $this->requiredAuthorityForAction('edit');
371                 return $this->requiredAuthorityForAction('browse');
372
373             case 'upload':
374             case 'dumpserial':
375             case 'dumphtml':
376             case 'loadfile':
377             case 'remove':
378             case 'lock':
379             case 'unlock':
380                 return WIKIAUTH_ADMIN;
381             default:
382                 global $WikiNameRegexp;
383                 if (preg_match("/$WikiNameRegexp\Z/A", $action))
384                     return WIKIAUTH_ANON; // ActionPage.
385                 else
386                     return WIKIAUTH_ADMIN;
387         }
388     }
389
390     function possiblyDeflowerVirginWiki () {
391         if ($this->getArg('action') != 'browse')
392             return;
393         if ($this->getArg('pagename') != HOME_PAGE)
394             return;
395
396         $page = $this->getPage();
397         $current = $page->getCurrentRevision();
398         if ($current->getVersion() > 0)
399             return;             // Homepage exists.
400
401         include('lib/loadsave.php');
402         SetupWiki($this);
403         $this->finish();        // NORETURN
404     }
405
406     function handleAction () {
407         $action = $this->getArg('action');
408         $method = "action_$action";
409         if (method_exists($this, $method)) {
410             $this->{$method}();
411         }
412         elseif ($page = $this->findActionPage($action)) {
413             $this->actionpage($page);
414         }
415         else {
416             $this->finish(fmt("%s: Bad action", $action));
417         }
418     }
419     
420     function finish ($errormsg = false) {
421         static $in_exit = 0;
422
423         if ($in_exit)
424             exit();        // just in case CloseDataBase calls us
425         $in_exit = true;
426
427         if (!empty($this->_dbi))
428             $this->_dbi->close();
429         unset($this->_dbi);
430
431
432         global $ErrorManager;
433         $ErrorManager->flushPostponedErrors();
434
435         if (!empty($errormsg)) {
436             PrintXML(HTML::br(),
437                      HTML::hr(),
438                      HTML::h2(_("Fatal PhpWiki Error")),
439                      $errormsg);
440             // HACK:
441             echo "\n</body></html>";
442         }
443
444         Request::finish();
445         exit;
446     }
447
448     function _deducePagename () {
449         if ($this->getArg('pagename'))
450             return $this->getArg('pagename');
451
452         if (USE_PATH_INFO) {
453             $pathinfo = $this->get('PATH_INFO');
454             $tail = substr($pathinfo, strlen(PATH_INFO_PREFIX));
455
456             if ($tail && $pathinfo == PATH_INFO_PREFIX . $tail) {
457                 return $tail;
458             }
459         }
460         elseif ($this->isPost()) {
461             /*
462              * In general, for security reasons, HTTP_GET_VARS should be ignored
463              * on POST requests, but we make an exception here (only for pagename).
464              *
465              * The justifcation for this hack is the following
466              * asymmetry: When POSTing with USE_PATH_INFO set, the
467              * pagename can (and should) be communicated through the
468              * request URL via PATH_INFO.  When POSTing with
469              * USE_PATH_INFO off, this cannot be done --- the only way
470              * to communicate the pagename through the URL is via
471              * QUERY_ARGS (HTTP_GET_VARS).
472              */
473             global $HTTP_GET_VARS;
474             if (isset($HTTP_GET_VARS['pagename'])) { 
475                 return $HTTP_GET_VARS['pagename'];
476             }
477         }
478
479         /*
480          * Support for PhpWiki 1.2 style requests.
481          */
482         $query_string = $this->get('QUERY_STRING');
483         if (preg_match('/^[^&=]+$/', $query_string)) {
484             return urldecode($query_string);
485         }
486
487         return HOME_PAGE;
488     }
489
490     function _deduceAction () {
491         if (!($action = $this->getArg('action'))) {
492             // Detect XML-RPC requests
493             if ($this->isPost()
494                 && $this->get('CONTENT_TYPE') == 'text/xml') {
495                 global $HTTP_RAW_POST_DATA;
496                 if (strstr($HTTP_RAW_POST_DATA, '<methodCall>')) {
497                     return 'xmlrpc';
498                 }
499             }
500
501             return 'browse';    // Default if no action specified.
502         }
503
504         if (method_exists($this, "action_$action"))
505             return $action;
506
507         // Allow for, e.g. action=LikePages
508         if ($this->isActionPage($action))
509             return $action;
510
511         trigger_error("$action: Unknown action", E_USER_NOTICE);
512         return 'browse';
513     }
514
515     function _deduceUsername () {
516         if ($userid = $this->getSessionVar('wiki_user')) {
517             if (!empty($this->_user))
518                 $this->_user->_authhow = 'session';
519             return $userid;
520         }
521         if ($userid = $this->getCookieVar('WIKI_ID')) {
522             if (!empty($this->_user))
523                 $this->_user->authhow = 'cookie';
524             return $userid;
525         }
526         return false;
527     }
528     
529     function _isActionPage ($pagename) {
530         $dbi = $this->getDbh();
531         $page = $dbi->getPage($pagename);
532         $rev = $page->getCurrentRevision();
533         // FIXME: more restrictive check for sane plugin?
534         if (strstr($rev->getPackedContent(), '<?plugin'))
535             return true;
536         if (!$rev->hasDefaultContents())
537             trigger_error("$pagename: Does not appear to be an 'action page'", E_USER_NOTICE);
538         return false;
539     }
540
541     function findActionPage ($action) {
542         static $cache;
543
544         if (isset($cache) and isset($cache[$action]))
545             return $cache[$action];
546         
547         // Allow for, e.g. action=LikePages
548         global $WikiNameRegexp;
549         if (!preg_match("/$WikiNameRegexp\\Z/A", $action))
550             return $cache[$action] = false;
551
552         // check for translated version (users preferred language)
553         $translation = gettext($action);
554         if ($this->_isActionPage($translation))
555             return $cache[$action] = $translation;
556
557         // check for translated version (default language)
558         global $LANG;
559         if ($LANG != DEFAULT_LANGUAGE and $LANG != "en") {
560             $save_lang = $LANG;
561             //trigger_error("DEBUG: findActionPage() ". DEFAULT_LANGUAGE." calling update_locale()...");
562             update_locale(DEFAULT_LANGUAGE);
563             $default = gettext($action);
564             //trigger_error("DEBUG: findActionPage() ". $save_lang." restoring save_lang, calling update_locale()...");
565             update_locale($save_lang);
566             if ($this->_isActionPage($default))
567                 return $cache[$action] = $default;
568         }
569         else {
570             $default = $translation;
571         }
572         
573         // check for english version
574         if ($action != $translation and $action != $default) {
575             if ($this->_isActionPage($action))
576                 return $cache[$action] = $action;
577         }
578
579         trigger_error("$action: Cannot find action page", E_USER_NOTICE);
580         return $cache[$action] = false;
581     }
582     
583     function isActionPage ($pagename) {
584         return $this->findActionPage($pagename);
585     }
586
587     function action_browse () {
588         $this->buffer_output();
589         include_once("lib/display.php");
590         displayPage($this);
591     }
592
593     function action_verify () {
594         $this->action_browse();
595     }
596
597     function actionpage ($action) {
598         $this->buffer_output();
599         include_once("lib/display.php");
600         actionPage($this, $action);
601     }
602
603     function action_diff () {
604         $this->buffer_output();
605         include_once "lib/diff.php";
606         showDiff($this);
607     }
608
609     function action_search () {
610         // This is obsolete: reformulate URL and redirect.
611         // FIXME: this whole section should probably be deleted.
612         if ($this->getArg('searchtype') == 'full') {
613             $search_page = _("FullTextSearch");
614         }
615         else {
616             $search_page = _("TitleSearch");
617         }
618         $this->redirect(WikiURL($search_page,
619                                 array('s' => $this->getArg('searchterm')),
620                                 'absolute_url'));
621     }
622
623     function action_edit () {
624         $this->buffer_output();
625         include "lib/editpage.php";
626         $e = new PageEditor ($this);
627         $e->editPage();
628     }
629
630     function action_create () {
631         $this->action_edit();
632     }
633     
634     function action_viewsource () {
635         $this->buffer_output();
636         include "lib/editpage.php";
637         $e = new PageEditor ($this);
638         $e->viewSource();
639     }
640
641     function action_lock () {
642         $page = $this->getPage();
643         $page->set('locked', true);
644         $this->action_browse();
645     }
646
647     function action_unlock () {
648         // FIXME: This check is redundant.
649         //$user->requireAuth(WIKIAUTH_ADMIN);
650         $page = $this->getPage();
651         $page->set('locked', false);
652         $this->action_browse();
653     }
654
655     function action_remove () {
656         // FIXME: This check is redundant.
657         //$user->requireAuth(WIKIAUTH_ADMIN);
658         $pagename = $this->getArg('pagename');
659         if (strstr($pagename,_('PhpWikiAdministration'))) {
660             $this->action_browse();
661         } else {
662             include('lib/removepage.php');
663             RemovePage($this);
664         }
665     }
666
667
668     function action_upload () {
669         include_once("lib/loadsave.php");
670         LoadPostFile($this);
671     }
672
673     function action_xmlrpc () {
674         include_once("lib/XmlRpcServer.php");
675         $xmlrpc = new XmlRpcServer($this);
676         $xmlrpc->service();
677     }
678     
679     function action_zip () {
680         include_once("lib/loadsave.php");
681         MakeWikiZip($this);
682         // I don't think it hurts to add cruft at the end of the zip file.
683         echo "\n========================================================\n";
684         echo "PhpWiki " . PHPWIKI_VERSION . " source:\n$GLOBALS[RCS_IDS]\n";
685     }
686
687     function action_ziphtml () {
688         include_once("lib/loadsave.php");
689         MakeWikiZipHtml($this);
690         // I don't think it hurts to add cruft at the end of the zip file.
691         echo "\n========================================================\n";
692         echo "PhpWiki " . PHPWIKI_VERSION . " source:\n$GLOBALS[RCS_IDS]\n";
693     }
694
695     function action_dumpserial () {
696         include_once("lib/loadsave.php");
697         DumpToDir($this);
698     }
699
700     function action_dumphtml () {
701         include_once("lib/loadsave.php");
702         DumpHtmlToDir($this);
703     }
704
705     function action_loadfile () {
706         include_once("lib/loadsave.php");
707         LoadFileOrDir($this);
708     }
709 }
710
711 //FIXME: deprecated
712 function is_safe_action ($action) {
713     return WikiRequest::requiredAuthorityForAction($action) < WIKIAUTH_ADMIN;
714 }
715
716
717 function main () {
718     global $request;
719
720     $request = new WikiRequest();
721
722     /*
723      * Allow for disabling of markup cache.
724      * (Mostly for debugging ... hopefully.)
725      *
726      * See also <?plugin WikiAdminUtils action=purge-cache ?>
727      */
728     if (!defined('WIKIDB_NOCACHE_MARKUP') and $request->getArg('nocache'))
729         define('WIKIDB_NOCACHE_MARKUP', $request->getArg('nocache'));
730     
731     // Initialize with system defaults in case user not logged in.
732     // Should this go into constructor?
733     $request->initializeTheme();
734
735     $request->updateAuthAndPrefs();
736     // initialize again with user's prefs
737     $request->initializeTheme();
738     $request->initializeLang();
739     
740     // Enable the output of most of the warning messages.
741     // The warnings will screw up zip files though.
742     global $ErrorManager;
743     if (substr($request->getArg('action'), 0, 3) != 'zip') {
744         $ErrorManager->setPostponedErrorMask(E_NOTICE|E_USER_NOTICE);
745         //$ErrorManager->setPostponedErrorMask(0);
746     }
747
748     //FIXME:
749     //if ($user->is_authenticated())
750     //  $LogEntry->user = $user->getId();
751
752     $request->possiblyDeflowerVirginWiki();
753     
754 if(defined('WIKI_XMLRPC')) return;
755
756     $validators = array('wikiname' => WIKI_NAME,
757                         'args'  => hash($request->getArgs()),
758                         'prefs' => hash($request->getPrefs()));
759     if (CACHE_CONTROL == 'STRICT') {
760         $dbi = $request->getDbh();
761         $timestamp = $dbi->getTimestamp();
762         $validators['mtime'] = $timestamp;
763         $validators['%mtime'] = (int)$timestamp;
764     }
765     
766     $request->setValidators($validators);
767    
768     $request->handleAction();
769
770 if (defined('DEBUG') and DEBUG>1) phpinfo(INFO_VARIABLES);
771     $request->finish();
772 }
773
774
775 main();
776
777
778 // Local Variables:
779 // mode: php
780 // tab-width: 8
781 // c-basic-offset: 4
782 // c-hanging-comment-ender-p: nil
783 // indent-tabs-mode: nil
784 // End:
785 ?>