]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/main.php
Restrict valid usernames to prevent from attacks against external auth or compromise
[SourceForge/phpwiki.git] / lib / main.php
1 <?php //-*-php-*-
2 rcs_id('$Id: main.php,v 1.157 2004-06-04 12:40:21 rurban Exp $');
3
4 define ('USE_PREFS_IN_PAGE', true);
5
6 //include "lib/config.php";
7 require_once(dirname(__FILE__)."/stdlib.php");
8 require_once('lib/Request.php');
9 require_once('lib/WikiDB.php');
10 if (ENABLE_USER_NEW)
11     require_once("lib/WikiUserNew.php");
12 else
13     require_once("lib/WikiUser.php");
14 require_once("lib/WikiGroup.php");
15 require_once("lib/PagePerm.php");
16
17 class WikiRequest extends Request {
18     // var $_dbi;
19
20     function WikiRequest () {
21         $this->_dbi = WikiDB::open($GLOBALS['DBParams']);
22         if (in_array('File', $this->_dbi->getAuthParam('USER_AUTH_ORDER'))) {
23             // force our local copy, until the pear version is fixed.
24             include_once(dirname(__FILE__)."/pear/File_Passwd.php");
25         }
26         if (USE_DB_SESSION) {
27             include_once('lib/DbSession.php');
28             $dbi =& $this->_dbi;
29             $this->_dbsession = & new DbSession($dbi, $dbi->getParam('prefix') . $dbi->getParam('db_session_table'));
30         }
31 // Fixme: Does pear reset the error mask to 1? We have to find the culprit
32 $x = error_reporting();
33 $this->version = phpwiki_version();
34         $this->Request();
35
36         // Normalize args...
37         $this->setArg('pagename', $this->_deducePagename());
38         $this->setArg('action', $this->_deduceAction());
39
40         // Restore auth state. This doesn't check for proper authorization!
41         if (ENABLE_USER_NEW) {
42             $userid = $this->_deduceUsername(); 
43             if (isset($this->_user) and 
44                 !empty($this->_user->_authhow) and 
45                 $this->_user->_authhow == 'session')
46             {
47                 // users might switch in a session between the two objects.
48                 // restore old auth level here or in updateAuthAndPrefs?
49                 //$user = $this->getSessionVar('wiki_user');
50                 // revive db handle, because these don't survive sessions
51                 if (isset($this->_user) and 
52                      ( ! isa($this->_user,WikiUserClassname())
53                        or (strtolower(get_class($this->_user)) == '_passuser')))
54                 {
55                     $this->_user = WikiUser($userid,$this->_user->_prefs);
56                 }
57                 unset($this->_user->_HomePagehandle);
58                 $this->_user->hasHomePage();
59                 // update the lockfile filehandle
60                 if (  isa($this->_user,'_FilePassUser') and 
61                       $this->_user->_file->lockfile and 
62                       !$this->_user->_file->fplock  )
63                 {
64                     $this->_user = new _FilePassUser($userid, $this->_user->_prefs, $this->_user->_file->filename);
65                 }
66                 /*
67                 if (!isa($user,WikiUserClassname()) or empty($this->_user->_level)) {
68                     $user = UpgradeUser($this->_user,$user);
69                 }
70                 */
71                 $this->_prefs = & $this->_user->_prefs;
72             } else {
73                 $user = WikiUser($userid);
74                 $this->_user = & $user;
75                 $this->_prefs = & $this->_user->_prefs;
76             }
77         } else {
78             $this->_user = new WikiUser($this, $this->_deduceUsername());
79             $this->_prefs = $this->_user->getPreferences();
80         }
81     }
82
83     function initializeLang () {
84         $user_lang = $this->getPref('lang');
85         $_lang = @$this->_prefs->_prefs['lang'];
86         //check changed LANG and THEME inside a session. 
87         // (e.g. by using another baseurl)
88         if (isset($this->_user->_authhow) and 
89             $this->_user->_authhow == 'session' and 
90             !isset($_lang->lang) and 
91             $user_lang != $GLOBALS['LANG'])
92         {
93             $user_lang = $GLOBALS['LANG'];
94         }
95         if (isset($user_lang)) {
96             //trigger_error("DEBUG: initializeLang() ". $user_lang ." calling update_locale()...");
97             update_locale($user_lang);
98             FindLocalizedButtonFile(".",'missing_ok','reinit');
99         }
100     }
101
102     function initializeTheme () {
103         global $Theme;
104
105         // Load theme
106         $user_theme = $this->getPref('theme');
107         $_theme = @$this->_prefs->_prefs['theme'];
108         //check changed LANG and THEME inside a session. 
109         // (e.g. by using another baseurl)
110         if (isset($this->_user->_authhow) and 
111             $this->_user->_authhow == 'session' and 
112             !isset($_theme->theme) and
113             defined('THEME') and 
114             $user_theme != THEME)
115         {
116             include_once("themes/" . THEME . "/themeinfo.php");
117         }
118         if (empty($Theme) and isset($user_theme))
119             include_once("themes/$user_theme/themeinfo.php");
120         if (empty($Theme) and defined('THEME'))
121             include_once("themes/" . THEME . "/themeinfo.php");
122         if (empty($Theme))
123             include_once("themes/default/themeinfo.php");
124         assert(!empty($Theme));
125     }
126
127     // This really maybe should be part of the constructor, but since it
128     // may involve HTML/template output, the global $request really needs
129     // to be initialized before we do this stuff.
130     function updateAuthAndPrefs () {
131
132         if (isset($this->_user) and (!isa($this->_user,WikiUserClassname()))) {
133             $this->_user = false;       
134         }
135         // Handle authentication request, if any.
136         if ($auth_args = $this->getArg('auth')) {
137             $this->setArg('auth', false);
138             $this->_handleAuthRequest($auth_args); // possible NORETURN
139         }
140         elseif ( ! $this->_user or 
141                  (isa($this->_user,WikiUserClassname()) and ! $this->_user->isSignedIn())) {
142             // If not auth request, try to sign in as saved user.
143             if (($saved_user = $this->getPref('userid')) != false) {
144                 $this->_signIn($saved_user);
145             }
146         }
147
148         // Save preferences in session and cookie
149         if (isset($this->_user) and 
150             (!isset($this->_user->_authhow) or $this->_user->_authhow != 'session')) {
151             $id_only = true; 
152             $this->_user->setPreferences($this->_prefs, $id_only);
153         } else {
154             $this->setSessionVar('wiki_user', $this->_user);
155             //$this->setSessionVar('wiki_prefs', $this->_prefs);
156         }
157
158         // Ensure user has permissions for action
159         $require_level = $this->requiredAuthority($this->getArg('action'));
160         if (! $this->_user->hasAuthority($require_level))
161             $this->_notAuthorized($require_level); // NORETURN
162     }
163
164     function getUser () {
165         if (isset($this->_user))
166             return $this->_user;
167         else
168             return $GLOBALS['ForbiddenUser'];
169     }
170
171     function getPrefs () {
172         return $this->_prefs;
173     }
174
175     // Convenience function:
176     function getPref ($key) {
177         if (isset($this->_prefs))
178             return $this->_prefs->get($key);
179     }
180
181     function getDbh () {
182         return $this->_dbi;
183     }
184
185     /**
186      * Get requested page from the page database.
187      * By default it will grab the page requested via the URL
188      *
189      * This is a convenience function.
190      * @param string $pagename Name of page to get.
191      * @return WikiDB_Page Object with methods to pull data from
192      * database for the page requested.
193      */
194     function getPage ($pagename = false) {
195         if (!isset($this->_dbi))
196             $this->getDbh();
197         if (!$pagename) 
198             $pagename = $this->getArg('pagename');
199         return $this->_dbi->getPage($pagename);
200     }
201
202     /** Get URL for POST actions.
203      *
204      * Officially, we should just use SCRIPT_NAME (or some such),
205      * but that causes problems when we try to issue a redirect, e.g.
206      * after saving a page.
207      *
208      * Some browsers (at least NS4 and Mozilla 0.97 won't accept
209      * a redirect from a page to itself.)
210      *
211      * So, as a HACK, we include pagename and action as query args in
212      * the URL.  (These should be ignored when we receive the POST
213      * request.)
214      */
215     function getPostURL ($pagename=false) {
216         global $HTTP_GET_VARS;
217
218         if ($pagename === false)
219             $pagename = $this->getArg('pagename');
220         $action = $this->getArg('action');
221         if (!empty($HTTP_GET_VARS['start_debug'])) // zend ide support
222             return WikiURL($pagename, array('action' => $action, 'start_debug' => 1));
223         else
224             return WikiURL($pagename, array('action' => $action));
225     }
226     
227     function _handleAuthRequest ($auth_args) {
228         if (!is_array($auth_args))
229             return;
230
231         // Ignore password unless POST'ed.
232         if (!$this->isPost())
233             unset($auth_args['passwd']);
234
235         $olduser = $this->_user;
236         $user = $this->_user->AuthCheck($auth_args);
237         if (isa($user,WikiUserClassname())) {
238             // Successful login (or logout.)
239             $this->_setUser($user);
240         }
241         elseif (is_string($user)) {
242             // Login attempt failed.
243             $fail_message = $user;
244             $auth_args['pass_required'] = true;
245             // If no password was submitted, it's not really
246             // a failure --- just need to prompt for password...
247             if (!ALLOW_USER_PASSWORDS 
248                 and ALLOW_BOGO_LOGIN 
249                 and !isset($auth_args['passwd'])) 
250             {
251                 $fail_message = false;
252             }
253             $olduser->PrintLoginForm($this, $auth_args, $fail_message, 'newpage');
254             $this->finish();    //NORETURN
255         }
256         else {
257             // Login request cancelled.
258         }
259     }
260
261     /**
262      * Attempt to sign in (bogo-login).
263      *
264      * Fails silently.
265      *
266      * @param $userid string Userid to attempt to sign in as.
267      * @access private
268      */
269     function _signIn ($userid) {
270         if (ENABLE_USER_NEW) {
271             if (! $this->_user )
272                 $this->_user = new _BogoUser($userid);
273             if (! $this->_user )
274                 $this->_user = new _PassUser($userid);
275         }
276         $user = $this->_user->AuthCheck(array('userid' => $userid));
277         if (isa($user,WikiUserClassname())) {
278             $this->_setUser($user); // success!
279         }
280     }
281
282     // login or logout or restore state
283     function _setUser ($user) {
284         $this->_user = $user;
285         define('MAIN_setUser',true);
286         $this->setCookieVar('WIKI_ID', $user->getAuthenticatedId(),
287                             COOKIE_EXPIRATION_DAYS, COOKIE_DOMAIN);
288         $this->setSessionVar('wiki_user', $user);
289         if ($user->isSignedIn())
290             $user->_authhow = 'signin';
291
292         // Save userid to prefs..
293         if ( empty($this->_user->_prefs)) {
294             $this->_user->_prefs = $this->_user->getPreferences();
295             $this->_prefs =& $this->_user->_prefs;
296         }
297         $this->_prefs->set('userid',
298                            $user->isSignedIn() ? $user->getId() : '');
299         $this->initializeTheme();
300     }
301
302     /* Permission system */
303     function getLevelDescription($level) {
304         static $levels = false;
305         if (!$levels) 
306             $levels = array('-1'  => _("FORBIDDEN"),
307                              '0'  => _("ANON"),
308                              '1'  => _("BOGO"),
309                              '2'  => _("USER"),
310                              '10' => _("ADMIN"),
311                              '100'=> _("UNOBTAINABLE"));
312         return $levels[$level];
313     }
314     
315     function _notAuthorized ($require_level) {
316         // Display the authority message in the Wiki's default
317         // language, in case it is not english.
318         //
319         // Note that normally a user will not see such an error once
320         // logged in, unless the admin has altered the default
321         // disallowed wikiactions. In that case we should probably
322         // check the user's language prefs too at this point; this
323         // would be a situation which is not really handled with the
324         // current code.
325         if (empty($GLOBALS['LANG']))
326             update_locale(DEFAULT_LANGUAGE);
327
328         // User does not have required authority.  Prompt for login.
329         $what = $this->getActionDescription($this->getArg('action'));
330         $pass_required = ($require_level >= WIKIAUTH_USER);
331         if ($require_level == WIKIAUTH_UNOBTAINABLE) {
332             if (class_exists('PagePermission')) {
333                 $user =& $this->_user;
334                 $status = $user->isAuthenticated() ? _("authenticated") : _("not authenticated");
335                 $msg = fmt("%s is disallowed on this wiki for %s user '%s' (level: %s).",
336                            $this->getDisallowedActionDescription($this->getArg('action')),
337                            $status, $user->getId(),$this->getLevelDescription($user->_level));
338                 $user->PrintLoginForm($this, compact('require_level','pass_required'), $msg);
339                 $this->finish();
340             } else {
341                 $msg = fmt("%s is disallowed on this wiki.",
342                            $this->getDisallowedActionDescription($this->getArg('action')));
343                 $this->_user->PrintLoginForm($this, compact('require_level','pass_required'), $msg);
344                 $this->finish();
345             }
346         }
347         elseif ($require_level == WIKIAUTH_BOGO)
348             $msg = fmt("You must sign in to %s.", $what);
349         elseif ($require_level == WIKIAUTH_USER)
350             $msg = fmt("You must log in to %s.", $what);
351         else
352             $msg = fmt("You must be an administrator to %s.", $what);
353
354         $this->_user->PrintLoginForm($this, compact('require_level','pass_required'), $msg);
355         $this->finish();    // NORETURN
356     }
357
358     // Fixme: for PagePermissions we'll need other strings, 
359     // relevant to the requested page, not just for the action on the whole wiki.
360     function getActionDescription($action) {
361         static $actionDescriptions;
362         if (! $actionDescriptions) {
363             $actionDescriptions
364             = array('browse'     => _("view this page"),
365                     'diff'       => _("diff this page"),
366                     'dumphtml'   => _("dump html pages"),
367                     'dumpserial' => _("dump serial pages"),
368                     'edit'       => _("edit this page"),
369                     'create'     => _("create this page"),
370                     'loadfile'   => _("load files into this wiki"),
371                     'lock'       => _("lock this page"),
372                     'remove'     => _("remove this page"),
373                     'unlock'     => _("unlock this page"),
374                     'upload'     => _("upload a zip dump"),
375                     'verify'     => _("verify the current action"),
376                     'viewsource' => _("view the source of this page"),
377                     'xmlrpc'     => _("access this wiki via XML-RPC"),
378                     'soap'       => _("access this wiki via SOAP"),
379                     'zip'        => _("download a zip dump from this wiki"),
380                     'ziphtml'    => _("download an html zip dump from this wiki")
381                     );
382         }
383         if (in_array($action, array_keys($actionDescriptions)))
384             return $actionDescriptions[$action];
385         else
386             return $action;
387     }
388     function getDisallowedActionDescription($action) {
389         static $disallowedActionDescriptions;
390         if (! $disallowedActionDescriptions) {
391             $disallowedActionDescriptions
392             = array('browse'     => _("Browsing pages"),
393                     'diff'       => _("Diffing pages"),
394                     'dumphtml'   => _("Dumping html pages"),
395                     'dumpserial' => _("Dumping serial pages"),
396                     'edit'       => _("Editing pages"),
397                     'create'     => _("Creating pages"),
398                     'loadfile'   => _("Loading files"),
399                     'lock'       => _("Locking pages"),
400                     'remove'     => _("Removing pages"),
401                     'unlock'     => _("Unlocking pages"),
402                     'upload'     => _("Uploading zip dumps"),
403                     'verify'     => _("Verify the current action"),
404                     'viewsource' => _("Viewing the source of pages"),
405                     'xmlrpc'     => _("XML-RPC access"),
406                     'soap'       => _("SOAP access"),
407                     'zip'        => _("Downloading zip dumps"),
408                     'ziphtml'    => _("Downloading html zip dumps")
409                     );
410         }
411         if (in_array($action, array_keys($disallowedActionDescriptions)))
412             return $disallowedActionDescriptions[$action];
413         else
414             return $action;
415     }
416
417     function requiredAuthority ($action) {
418         $auth = $this->requiredAuthorityForAction($action);
419         if (!ALLOW_ANON_USER) return WIKIAUTH_USER;
420         
421         /*
422          * This is a hook for plugins to require authority
423          * for posting to them.
424          *
425          * IMPORTANT: this is not a secure check, so the plugin
426          * may not assume that any POSTs to it are authorized.
427          * All this does is cause PhpWiki to prompt for login
428          * if the user doesn't have the required authority.
429          */
430         if ($this->isPost()) {
431             $post_auth = $this->getArg('require_authority_for_post');
432             if ($post_auth !== false)
433                 $auth = max($auth, $post_auth);
434         }
435         return $auth;
436     }
437         
438     function requiredAuthorityForAction ($action) {
439         if (ENABLE_PAGEPERM and class_exists("PagePermission")) {
440             return requiredAuthorityForPage($action);
441         } else {
442           // FIXME: clean up. 
443           switch ($action) {
444             case 'browse':
445             case 'viewsource':
446             case 'diff':
447             case 'select':
448             case 'xmlrpc':
449             case 'search':
450             case 'pdf':
451                 return WIKIAUTH_ANON;
452
453             case 'zip':
454             case 'ziphtml':
455                 if (defined('ZIPDUMP_AUTH') && ZIPDUMP_AUTH)
456                     return WIKIAUTH_ADMIN;
457                 return WIKIAUTH_ANON;
458
459             case 'edit':
460             case 'soap':
461                 if (defined('REQUIRE_SIGNIN_BEFORE_EDIT') && REQUIRE_SIGNIN_BEFORE_EDIT)
462                     return WIKIAUTH_BOGO;
463                 return WIKIAUTH_ANON;
464                 // return WIKIAUTH_BOGO;
465
466             case 'create':
467                 $page = $this->getPage();
468                 $current = $page->getCurrentRevision();
469                 if ($current->hasDefaultContents())
470                     return $this->requiredAuthorityForAction('edit');
471                 return $this->requiredAuthorityForAction('browse');
472
473             case 'upload':
474             case 'dumpserial':
475             case 'dumphtml':
476             case 'loadfile':
477             case 'remove':
478             case 'lock':
479             case 'unlock':
480             case 'upgrade':
481                 return WIKIAUTH_ADMIN;
482
483             /* authcheck occurs only in the plugin.
484                required actionpage RateIt */
485             /*
486             case 'rate':
487             case 'delete_rating':
488                 // Perhaps this should be WIKIAUTH_USER
489                 return WIKIAUTH_BOGO;
490             */
491
492             default:
493                 global $WikiNameRegexp;
494                 if (preg_match("/$WikiNameRegexp\Z/A", $action))
495                     return WIKIAUTH_ANON; // ActionPage.
496                 else
497                     return WIKIAUTH_ADMIN;
498           }
499         }
500     }
501     /* End of Permission system */
502
503     function possiblyDeflowerVirginWiki () {
504         if ($this->getArg('action') != 'browse')
505             return;
506         if ($this->getArg('pagename') != HOME_PAGE)
507             return;
508
509         $page = $this->getPage();
510         $current = $page->getCurrentRevision();
511         if ($current->getVersion() > 0)
512             return;             // Homepage exists.
513
514         include('lib/loadsave.php');
515         SetupWiki($this);
516         $this->finish();        // NORETURN
517     }
518
519     function handleAction () {
520         $action = $this->getArg('action');
521         $method = "action_$action";
522         if (method_exists($this, $method)) {
523             $this->{$method}();
524         }
525         elseif ($page = $this->findActionPage($action)) {
526             $this->actionpage($page);
527         }
528         else {
529             $this->finish(fmt("%s: Bad action", $action));
530         }
531     }
532     
533     function finish ($errormsg = false) {
534         static $in_exit = 0;
535
536         if ($in_exit)
537             exit();        // just in case CloseDataBase calls us
538         $in_exit = true;
539
540         global $ErrorManager;
541         $ErrorManager->flushPostponedErrors();
542
543         if (!empty($errormsg)) {
544             PrintXML(HTML::br(),
545                      HTML::hr(),
546                      HTML::h2(_("Fatal PhpWiki Error")),
547                      $errormsg);
548             // HACK:
549             echo "\n</body></html>";
550         }
551         if (is_object($this->_user)) {
552             $this->_user->page   = $this->getArg('pagename');
553             $this->_user->action = $this->getArg('action');
554             unset($this->_user->_HomePagehandle);
555             unset($this->_user->_auth_dbi);
556         }
557         if (!empty($this->_dbi)) {
558             session_write_close();
559             $this->_dbi->close();
560             unset($this->_dbi);
561         }
562         Request::finish();
563         exit;
564     }
565
566     /**
567      * Generally pagename is rawurlencoded for older browsers or mozilla.
568      * Typing a pagename into the IE bar will utf-8 encode it, so we have to 
569      * fix that with fixTitleEncoding().
570      * If USE_PATH_INFO = true, the pagename is stripped from the "/DATA_PATH/PageName&arg=value" line.
571      * If false, we support either "/index.php?pagename=PageName&arg=value",
572      * or the first arg (1.2.x style): "/index.php?PageName&arg=value"
573      */
574     function _deducePagename () {
575         if (trim(rawurldecode($this->getArg('pagename'))))
576             return fixTitleEncoding(rawurldecode($this->getArg('pagename')));
577
578         if (USE_PATH_INFO) {
579             $pathinfo = $this->get('PATH_INFO');
580             if (empty($pathinfo)) { // fix for CGI
581                 $path = $this->get('REQUEST_URI');
582                 $script = $this->get('SCRIPT_NAME');
583                 $pathinfo = substr($path,strlen($script));
584                 $pathinfo = preg_replace('/\?.+$/','',$pathinfo);
585             }
586             $tail = substr($pathinfo, strlen(PATH_INFO_PREFIX));
587
588             if (trim($tail) != '' and $pathinfo == PATH_INFO_PREFIX . $tail) {
589                 return fixTitleEncoding($tail);
590             }
591         }
592         elseif ($this->isPost()) {
593             /*
594              * In general, for security reasons, HTTP_GET_VARS should be ignored
595              * on POST requests, but we make an exception here (only for pagename).
596              *
597              * The justification for this hack is the following
598              * asymmetry: When POSTing with USE_PATH_INFO set, the
599              * pagename can (and should) be communicated through the
600              * request URL via PATH_INFO.  When POSTing with
601              * USE_PATH_INFO off, this cannot be done --- the only way
602              * to communicate the pagename through the URL is via
603              * QUERY_ARGS (HTTP_GET_VARS).
604              */
605             global $HTTP_GET_VARS;
606             if (isset($HTTP_GET_VARS['pagename']) and trim($HTTP_GET_VARS['pagename'])) { 
607                 return fixTitleEncoding(rawurldecode($HTTP_GET_VARS['pagename']));
608             }
609         }
610
611         /*
612          * Support for PhpWiki 1.2 style requests.
613          * Strip off "&" args (?PageName&action=...&start_debug,...)
614          */
615         $query_string = $this->get('QUERY_STRING');
616         if (trim(rawurldecode($query_string)) and preg_match('/^([^&=]+)(&.+)?$/', $query_string, $m)) {
617             return fixTitleEncoding(rawurldecode($m[1]));
618         }
619
620         return fixTitleEncoding(HOME_PAGE);
621     }
622
623     function _deduceAction () {
624         if (!($action = $this->getArg('action'))) {
625             // Detect XML-RPC requests
626             if ($this->isPost()
627                 && $this->get('CONTENT_TYPE') == 'text/xml') {
628                 global $HTTP_RAW_POST_DATA;
629                 if (strstr($HTTP_RAW_POST_DATA, '<methodCall>')) {
630                     return 'xmlrpc';
631                 }
632             }
633             return 'browse';    // Default if no action specified.
634         }
635
636         if (method_exists($this, "action_$action"))
637             return $action;
638
639         // Allow for, e.g. action=LikePages
640         if ($this->isActionPage($action))
641             return $action;
642
643         // Handle untranslated actionpages in non-english
644         // (people playing with switching languages)
645         if (0 and $GLOBALS['LANG'] != 'en') {
646             require_once("lib/plugin/_WikiTranslation.php");
647             $trans = new WikiPlugin__WikiTranslation();
648             $en_action = $trans->translate($action,'en',$GLOBALS['LANG']);
649             if ($this->isActionPage($en_action))
650                 return $en_action;
651         }
652
653         trigger_error("$action: Unknown action", E_USER_NOTICE);
654         return 'browse';
655     }
656
657     function _deduceUsername() {
658         global $HTTP_SERVER_VARS, $HTTP_ENV_VARS;
659
660         if (!empty($this->args['auth']) and !empty($this->args['auth']['userid']))
661             return $this->args['auth']['userid'];
662
663         if (!empty($HTTP_SERVER_VARS['PHP_AUTH_USER']))
664             return $HTTP_SERVER_VARS['PHP_AUTH_USER'];
665         if (!empty($HTTP_ENV_VARS['REMOTE_USER']))
666             return $HTTP_ENV_VARS['REMOTE_USER'];
667             
668         if ($user = $this->getSessionVar('wiki_user')) {
669             $this->_user = $user;
670             $this->_user->_authhow = 'session';
671             return ENABLE_USER_NEW ? $user->UserName() : $this->_user;
672         }
673         if ($userid = $this->getCookieVar('WIKI_ID')) {
674             if (!empty($userid) and substr($userid,0,2) != 's:') {
675                 $this->_user->authhow = 'cookie';
676                 return $userid;
677             }
678         }
679         return false;
680     }
681     
682     function _isActionPage ($pagename) {
683         $dbi = $this->getDbh();
684         $page = $dbi->getPage($pagename);
685         $rev = $page->getCurrentRevision();
686         // FIXME: more restrictive check for sane plugin?
687         if (strstr($rev->getPackedContent(), '<?plugin'))
688             return true;
689         if (!$rev->hasDefaultContents())
690             trigger_error("$pagename: Does not appear to be an 'action page'", E_USER_NOTICE);
691         return false;
692     }
693
694     function findActionPage ($action) {
695         static $cache;
696
697         // check for translated version, as per users preferred language
698         // (or system default in case it is not en)
699         $translation = gettext($action);
700
701         if (isset($cache) and isset($cache[$translation]))
702             return $cache[$translation];
703
704         // check for cached translated version
705         if ($this->_isActionPage($translation))
706             return $cache[$action] = $translation;
707
708         // Allow for, e.g. action=LikePages
709         global $WikiNameRegexp;
710         if (!preg_match("/$WikiNameRegexp\\Z/A", $action))
711             return $cache[$action] = false;
712
713         // check for translated version (default language)
714         global $LANG;
715         if ($LANG != DEFAULT_LANGUAGE and $LANG != "en") {
716             $save_lang = $LANG;
717             //trigger_error("DEBUG: findActionPage() ". DEFAULT_LANGUAGE." calling update_locale()...");
718             update_locale(DEFAULT_LANGUAGE);
719             $default = gettext($action);
720             //trigger_error("DEBUG: findActionPage() ". $save_lang." restoring save_lang, calling update_locale()...");
721             update_locale($save_lang);
722             if ($this->_isActionPage($default))
723                 return $cache[$action] = $default;
724         }
725         else {
726             $default = $translation;
727         }
728         
729         // check for english version
730         if ($action != $translation and $action != $default) {
731             if ($this->_isActionPage($action))
732                 return $cache[$action] = $action;
733         }
734
735         trigger_error("$action: Cannot find action page", E_USER_NOTICE);
736         return $cache[$action] = false;
737     }
738     
739     function isActionPage ($pagename) {
740         return $this->findActionPage($pagename);
741     }
742
743     function action_browse () {
744         $this->buffer_output();
745         include_once("lib/display.php");
746         displayPage($this);
747     }
748
749     function action_verify () {
750         $this->action_browse();
751     }
752
753     function actionpage ($action) {
754         $this->buffer_output();
755         include_once("lib/display.php");
756         actionPage($this, $action);
757     }
758
759     function action_diff () {
760         $this->buffer_output();
761         include_once "lib/diff.php";
762         showDiff($this);
763     }
764
765     function action_search () {
766         // This is obsolete: reformulate URL and redirect.
767         // FIXME: this whole section should probably be deleted.
768         if ($this->getArg('searchtype') == 'full') {
769             $search_page = _("FullTextSearch");
770         }
771         else {
772             $search_page = _("TitleSearch");
773         }
774         $this->redirect(WikiURL($search_page,
775                                 array('s' => $this->getArg('searchterm')),
776                                 'absolute_url'));
777     }
778
779     function action_edit () {
780         $this->buffer_output();
781         include "lib/editpage.php";
782         $e = new PageEditor ($this);
783         $e->editPage();
784     }
785
786     function action_create () {
787         $this->action_edit();
788     }
789     
790     function action_viewsource () {
791         $this->buffer_output();
792         include "lib/editpage.php";
793         $e = new PageEditor ($this);
794         $e->viewSource();
795     }
796
797     function action_lock () {
798         $page = $this->getPage();
799         $page->set('locked', true);
800         $this->_dbi->touch();
801         $this->action_browse();
802     }
803
804     function action_unlock () {
805         // FIXME: This check is redundant.
806         //$user->requireAuth(WIKIAUTH_ADMIN);
807         $page = $this->getPage();
808         $page->set('locked', false);
809         $this->_dbi->touch();
810         $this->action_browse();
811     }
812
813     function action_remove () {
814         // FIXME: This check is redundant.
815         //$user->requireAuth(WIKIAUTH_ADMIN);
816         $pagename = $this->getArg('pagename');
817         if (strstr($pagename,_('PhpWikiAdministration'))) {
818             $this->action_browse();
819         } else {
820             include('lib/removepage.php');
821             RemovePage($this);
822         }
823     }
824
825     function action_xmlrpc () {
826         include_once("lib/XmlRpcServer.php");
827         $xmlrpc = new XmlRpcServer($this);
828         $xmlrpc->service();
829     }
830     
831     function action_zip () {
832         include_once("lib/loadsave.php");
833         MakeWikiZip($this);
834         // I don't think it hurts to add cruft at the end of the zip file.
835         //echo "\n========================================================\n";
836         //echo "PhpWiki " . PHPWIKI_VERSION . " source:\n$GLOBALS[RCS_IDS]\n";
837     }
838
839     function action_ziphtml () {
840         include_once("lib/loadsave.php");
841         MakeWikiZipHtml($this);
842         // I don't think it hurts to add cruft at the end of the zip file.
843         echo "\n========================================================\n";
844         echo "PhpWiki " . PHPWIKI_VERSION . " source:\n$GLOBALS[RCS_IDS]\n";
845     }
846
847     function action_dumpserial () {
848         include_once("lib/loadsave.php");
849         DumpToDir($this);
850     }
851
852     function action_dumphtml () {
853         include_once("lib/loadsave.php");
854         DumpHtmlToDir($this);
855     }
856
857     function action_upload () {
858         include_once("lib/loadsave.php");
859         LoadPostFile($this);
860     }
861
862     function action_upgrade () {
863         include_once("lib/loadsave.php");
864         include_once("lib/upgrade.php");
865         DoUpgrade($this);
866     }
867
868     function action_loadfile () {
869         include_once("lib/loadsave.php");
870         LoadFileOrDir($this);
871     }
872
873     function action_pdf () {
874         include_once("lib/pdf.php");
875         ConvertAndDisplayPdf($this);
876     }
877     
878 }
879
880 //FIXME: deprecated
881 function is_safe_action ($action) {
882     return WikiRequest::requiredAuthorityForAction($action) < WIKIAUTH_ADMIN;
883 }
884
885 function validateSessionPath() {
886     // Try to defer any session.save_path PHP errors before any html
887     // is output, which causes some versions of IE to display a blank
888     // page (due to its strict mode while parsing a page?).
889     if (! is_writeable(ini_get('session.save_path'))) {
890         $tmpdir = '/tmp';
891         trigger_error
892             (sprintf(_("%s is not writable."),
893                      _("The session.save_path directory"))
894              . "\n"
895              . sprintf(_("Please ensure that %s is writable, or redefine %s in index.php."),
896                        sprintf(_("the directory '%s'"),
897                                ini_get('session.save_path')),
898                        'session.save_path')
899              . "\n"
900              . sprintf(_("Attempting to use the directory '%s' instead."),
901                        $tmpdir)
902              , E_USER_NOTICE);
903         if (! is_writeable($tmpdir)) {
904             trigger_error
905                 (sprintf(_("%s is not writable."), $tmpdir)
906                  . "\n"
907                  . _("Users will not be able to sign in.")
908                  , E_USER_NOTICE);
909         }
910         else
911             ini_set('session.save_path', $tmpdir);
912     }
913 }
914
915 function main () {
916     if (!USE_DB_SESSION)
917         validateSessionPath();
918
919     global $request;
920
921     if ((DEBUG & 4) and extension_loaded("apd"))
922         apd_set_session_trace(9);
923
924     // Postpone warnings
925     global $ErrorManager;
926     $ErrorManager->setPostponedErrorMask(E_NOTICE|E_USER_NOTICE|E_USER_WARNING);
927     $request = new WikiRequest();
928
929     $action = $request->getArg('action');
930     if (substr($action, 0, 3) != 'zip') {
931         if ($action == 'pdf')
932             $ErrorManager->setPostponedErrorMask(-1);
933         else // reject postponing of warnings
934             $ErrorManager->setPostponedErrorMask(E_NOTICE|E_USER_NOTICE);
935     }
936
937     /*
938      * Allow for disabling of markup cache.
939      * (Mostly for debugging ... hopefully.)
940      *
941      * See also <?plugin WikiAdminUtils action=purge-cache ?>
942      */
943     if (!defined('WIKIDB_NOCACHE_MARKUP') and $request->getArg('nocache'))
944         define('WIKIDB_NOCACHE_MARKUP', $request->getArg('nocache'));
945     
946     // Initialize with system defaults in case user not logged in.
947     // Should this go into constructor?
948     $request->initializeTheme();
949
950     $request->updateAuthAndPrefs();
951     $request->initializeLang();
952     
953     //FIXME:
954     //if ($user->is_authenticated())
955     //  $LogEntry->user = $user->getId();
956
957     $request->possiblyDeflowerVirginWiki();
958     
959 if (defined('WIKI_XMLRPC') and WIKI_XMLRPC) return;
960 if (defined('WIKI_SOAP')   and WIKI_SOAP)   return;
961
962     $validators = array('wikiname' => WIKI_NAME,
963                         'args'     => hash($request->getArgs()),
964                         'prefs'    => hash($request->getPrefs()));
965     if (CACHE_CONTROL == 'STRICT') {
966         $dbi = $request->getDbh();
967         $timestamp = $dbi->getTimestamp();
968         $validators['mtime'] = $timestamp;
969         $validators['%mtime'] = (int)$timestamp;
970     }
971     // FIXME: we should try to generate strong validators when possible,
972     // but for now, our validator is weak, since equal validators do not
973     // indicate byte-level equality of content.  (Due to DEBUG timing output, etc...)
974     //
975     // (If DEBUG if off, this may be a strong validator, but I'm going
976     // to go the paranoid route here pending further study and testing.)
977     //
978     $validators['%weak'] = true;
979     $request->setValidators($validators);
980    
981     $request->handleAction();
982
983 if (defined('DEBUG') and DEBUG & 4) phpinfo(INFO_VARIABLES);
984     $request->finish();
985 }
986
987 $x = error_reporting(); // why is it 1 here? should be E_ALL
988 error_reporting(E_ALL);
989 main();
990
991
992 // $Log: not supported by cvs2svn $
993 // Revision 1.156  2004/06/03 17:58:16  rurban
994 // support immediate LANG and THEME switch inside a session
995 //
996 // Revision 1.155  2004/06/03 10:18:19  rurban
997 // fix FileUser locking issues, new config ENABLE_PAGEPERM
998 //
999 // Revision 1.154  2004/06/02 18:01:46  rurban
1000 // init global FileFinder to add proper include paths at startup
1001 //   adds PHPWIKI_DIR if started from another dir, lib/pear also
1002 // fix slashify for Windows
1003 // fix USER_AUTH_POLICY=old, use only USER_AUTH_ORDER methods (besides HttpAuth)
1004 //
1005 // Revision 1.153  2004/06/01 15:28:00  rurban
1006 // AdminUser only ADMIN_USER not member of Administrators
1007 // some RateIt improvements by dfrankow
1008 // edit_toolbar buttons
1009 //
1010 // Revision 1.152  2004/05/27 17:49:06  rurban
1011 // renamed DB_Session to DbSession (in CVS also)
1012 // added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals
1013 // remove leading slash in error message
1014 // added force_unlock parameter to File_Passwd (no return on stale locks)
1015 // fixed adodb session AffectedRows
1016 // added FileFinder helpers to unify local filenames and DATA_PATH names
1017 // editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR
1018 //
1019 // Revision 1.151  2004/05/25 12:40:48  rurban
1020 // trim the pagename
1021 //
1022 // Revision 1.150  2004/05/25 10:18:44  rurban
1023 // Check for UTF-8 URLs; Internet Explorer produces these if you
1024 // type non-ASCII chars in the URL bar or follow unescaped links.
1025 // Fixes sf.net bug #953949
1026 // src: languages/Language.php:checkTitleEncoding() from mediawiki
1027 //
1028 // Revision 1.149  2004/05/18 13:31:19  rurban
1029 // hold warnings until headers are sent. new Error-style with collapsed output of repeated messages
1030 //
1031 // Revision 1.148  2004/05/17 17:43:29  rurban
1032 // CGI: no PATH_INFO fix
1033 //
1034 // Revision 1.147  2004/05/15 19:48:33  rurban
1035 // fix some too loose PagePerms for signed, but not authenticated users
1036 //  (admin, owner, creator)
1037 // no double login page header, better login msg.
1038 // moved action_pdf to lib/pdf.php
1039 //
1040 // Revision 1.146  2004/05/15 18:31:01  rurban
1041 // some action=pdf Request fixes: With MSIE it works now. Now the work with the page formatting begins.
1042 //
1043 // Revision 1.145  2004/05/12 10:49:55  rurban
1044 // require_once fix for those libs which are loaded before FileFinder and
1045 //   its automatic include_path fix, and where require_once doesn't grok
1046 //   dirname(__FILE__) != './lib'
1047 // upgrade fix with PearDB
1048 // navbar.tmpl: remove spaces for IE &nbsp; button alignment
1049 //
1050 // Revision 1.144  2004/05/06 19:26:16  rurban
1051 // improve stability, trying to find the InlineParser endless loop on sf.net
1052 //
1053 // remove end-of-zip comments to fix sf.net bug #777278 and probably #859628
1054 //
1055 // Revision 1.143  2004/05/06 17:30:38  rurban
1056 // CategoryGroup: oops, dos2unix eol
1057 // improved phpwiki_version:
1058 //   pre -= .0001 (1.3.10pre: 1030.099)
1059 //   -p1 += .001 (1.3.9-p1: 1030.091)
1060 // improved InstallTable for mysql and generic SQL versions and all newer tables so far.
1061 // abstracted more ADODB/PearDB methods for action=upgrade stuff:
1062 //   backend->backendType(), backend->database(),
1063 //   backend->listOfFields(),
1064 //   backend->listOfTables(),
1065 //
1066 // Revision 1.142  2004/05/04 22:34:25  rurban
1067 // more pdf support
1068 //
1069 // Revision 1.141  2004/05/03 13:16:47  rurban
1070 // fixed UserPreferences update, esp for boolean and int
1071 //
1072 // Revision 1.140  2004/05/02 21:26:38  rurban
1073 // limit user session data (HomePageHandle and auth_dbi have to invalidated anyway)
1074 //   because they will not survive db sessions, if too large.
1075 // extended action=upgrade
1076 // some WikiTranslation button work
1077 // revert WIKIAUTH_UNOBTAINABLE (need it for main.php)
1078 // some temp. session debug statements
1079 //
1080 // Revision 1.139  2004/05/02 15:10:07  rurban
1081 // new finally reliable way to detect if /index.php is called directly
1082 //   and if to include lib/main.php
1083 // new global AllActionPages
1084 // SetupWiki now loads all mandatory pages: HOME_PAGE, action pages, and warns if not.
1085 // WikiTranslation what=buttons for Carsten to create the missing MacOSX buttons
1086 // PageGroupTestOne => subpages
1087 // renamed PhpWikiRss to PhpWikiRecentChanges
1088 // more docs, default configs, ...
1089 //
1090 // Revision 1.138  2004/05/01 15:59:29  rurban
1091 // more php-4.0.6 compatibility: superglobals
1092 //
1093 // Revision 1.137  2004/04/29 19:39:44  rurban
1094 // special support for formatted plugins (one-liners)
1095 //   like <small><plugin BlaBla ></small>
1096 // iter->asArray() helper for PopularNearby
1097 // db_session for older php's (no &func() allowed)
1098 //
1099 // Revision 1.136  2004/04/29 17:18:19  zorloc
1100 // Fixes permission failure issues.  With PagePermissions and Disabled Actions when user did not have permission WIKIAUTH_FORBIDDEN was returned.  In WikiUser this was ok because WIKIAUTH_FORBIDDEN had a value of 11 -- thus no user could perform that action.  But WikiUserNew has a WIKIAUTH_FORBIDDEN value of -1 -- thus a user without sufficent permission to do anything.  The solution is a new high value permission level (WIKIAUTH_UNOBTAINABLE) to be the default level for access failure.
1101 //
1102 // Revision 1.135  2004/04/26 12:15:01  rurban
1103 // check default config values
1104 //
1105 // Revision 1.134  2004/04/23 06:46:37  zorloc
1106 // Leave DB connection open when USE_DB_SESSION is true so that session info can be written to the DB.
1107 //
1108 // Revision 1.133  2004/04/20 18:10:31  rurban
1109 // config refactoring:
1110 //   FileFinder is needed for WikiFarm scripts calling index.php
1111 //   config run-time calls moved to lib/IniConfig.php:fix_configs()
1112 //   added PHPWIKI_DIR smart-detection code (Theme finder)
1113 //   moved FileFind to lib/FileFinder.php
1114 //   cleaned lib/config.php
1115 //
1116 // Revision 1.132  2004/04/19 21:51:41  rurban
1117 // php5 compatibility: it works!
1118 //
1119 // Revision 1.131  2004/04/19 18:27:45  rurban
1120 // Prevent from some PHP5 warnings (ref args, no :: object init)
1121 //   php5 runs now through, just one wrong XmlElement object init missing
1122 // Removed unneccesary UpgradeUser lines
1123 // Changed WikiLink to omit version if current (RecentChanges)
1124 //
1125 // Revision 1.130  2004/04/18 00:25:53  rurban
1126 // allow "0" pagename
1127 //
1128 // Revision 1.129  2004/04/07 23:13:19  rurban
1129 // fixed pear/File_Passwd for Windows
1130 // fixed FilePassUser sessions (filehandle revive) and password update
1131 //
1132 // Revision 1.128  2004/04/02 15:06:55  rurban
1133 // fixed a nasty ADODB_mysql session update bug
1134 // improved UserPreferences layout (tabled hints)
1135 // fixed UserPreferences auth handling
1136 // improved auth stability
1137 // improved old cookie handling: fixed deletion of old cookies with paths
1138 //
1139 // Revision 1.127  2004/03/25 17:00:31  rurban
1140 // more code to convert old-style pref array to new hash
1141 //
1142 // Revision 1.126  2004/03/24 19:39:03  rurban
1143 // php5 workaround code (plus some interim debugging code in XmlElement)
1144 //   php5 doesn't work yet with the current XmlElement class constructors,
1145 //   WikiUserNew does work better than php4.
1146 // rewrote WikiUserNew user upgrading to ease php5 update
1147 // fixed pref handling in WikiUserNew
1148 // added Email Notification
1149 // added simple Email verification
1150 // removed emailVerify userpref subclass: just a email property
1151 // changed pref binary storage layout: numarray => hash of non default values
1152 // print optimize message only if really done.
1153 // forced new cookie policy: delete pref cookies, use only WIKI_ID as plain string.
1154 //   prefs should be stored in db or homepage, besides the current session.
1155 //
1156 // Revision 1.125  2004/03/14 16:30:52  rurban
1157 // db-handle session revivification, dba fixes
1158 //
1159 // Revision 1.124  2004/03/12 15:48:07  rurban
1160 // fixed explodePageList: wrong sortby argument order in UnfoldSubpages
1161 // simplified lib/stdlib.php:explodePageList
1162 //
1163 // Revision 1.123  2004/03/10 15:41:27  rurban
1164 // use default pref mysql table
1165 //
1166 // Revision 1.122  2004/03/08 18:17:09  rurban
1167 // added more WikiGroup::getMembersOf methods, esp. for special groups
1168 // fixed $LDAP_SET_OPTIONS
1169 // fixed _AuthInfo group methods
1170 //
1171 // Revision 1.121  2004/03/01 13:48:45  rurban
1172 // rename fix
1173 // p[] consistency fix
1174 //
1175 // Revision 1.120  2004/03/01 10:22:41  rurban
1176 // initializeTheme optimize
1177 //
1178 // Revision 1.119  2004/02/26 20:45:06  rurban
1179 // check for ALLOW_ANON_USER = false
1180 //
1181 // Revision 1.118  2004/02/26 01:32:03  rurban
1182 // fixed session login with old WikiUser object. strangely, the errormask gets corruoted to 1, Pear???
1183 //
1184 // Revision 1.117  2004/02/24 17:19:37  rurban
1185 // debugging helpers only
1186 //
1187 // Revision 1.116  2004/02/24 15:17:14  rurban
1188 // improved auth errors with individual pages. the fact that you may not browse a certain admin page does not conclude that you may not browse the whole wiki. renamed browse => view
1189 //
1190 // Revision 1.115  2004/02/15 21:34:37  rurban
1191 // PageList enhanced and improved.
1192 // fixed new WikiAdmin... plugins
1193 // editpage, Theme with exp. htmlarea framework
1194 //   (htmlarea yet committed, this is really questionable)
1195 // WikiUser... code with better session handling for prefs
1196 // enhanced UserPreferences (again)
1197 // RecentChanges for show_deleted: how should pages be deleted then?
1198 //
1199 // Revision 1.114  2004/02/15 17:30:13  rurban
1200 // workaround for lost db connnection handle on session restauration (->_auth_dbi)
1201 // fixed getPreferences() (esp. from sessions)
1202 // fixed setPreferences() (update and set),
1203 // fixed AdoDb DB statements,
1204 // update prefs only at UserPreferences POST (for testing)
1205 // unified db prefs methods (but in external pref classes yet)
1206 //
1207 // Revision 1.113  2004/02/12 13:05:49  rurban
1208 // Rename functional for PearDB backend
1209 // some other minor changes
1210 // SiteMap comes with a not yet functional feature request: includepages (tbd)
1211 //
1212 // Revision 1.112  2004/02/09 03:58:12  rurban
1213 // for now default DB_SESSION to false
1214 // PagePerm:
1215 //   * not existing perms will now query the parent, and not
1216 //     return the default perm
1217 //   * added pagePermissions func which returns the object per page
1218 //   * added getAccessDescription
1219 // WikiUserNew:
1220 //   * added global ->prepare (not yet used) with smart user/pref/member table prefixing.
1221 //   * force init of authdbh in the 2 db classes
1222 // main:
1223 //   * fixed session handling (not triple auth request anymore)
1224 //   * don't store cookie prefs with sessions
1225 // stdlib: global obj2hash helper from _AuthInfo, also needed for PagePerm
1226 //
1227 // Revision 1.111  2004/02/07 10:41:25  rurban
1228 // fixed auth from session (still double code but works)
1229 // fixed GroupDB
1230 // fixed DbPassUser upgrade and policy=old
1231 // added GroupLdap
1232 //
1233 // Revision 1.110  2004/02/03 09:45:39  rurban
1234 // LDAP cleanup, start of new Pref classes
1235 //
1236 // Revision 1.109  2004/01/30 19:57:58  rurban
1237 // fixed DBAuthParams['pref_select']: wrong _auth_dbi object used.
1238 //
1239 // Revision 1.108  2004/01/28 14:34:14  rurban
1240 // session table takes the common prefix
1241 // + various minor stuff
1242 // reallow password changing
1243 //
1244 // Revision 1.107  2004/01/27 23:23:39  rurban
1245 // renamed ->Username => _userid for consistency
1246 // renamed mayCheckPassword => mayCheckPass
1247 // fixed recursion problem in WikiUserNew
1248 // fixed bogo login (but not quite 100% ready yet, password storage)
1249 //
1250 // Revision 1.106  2004/01/26 09:17:49  rurban
1251 // * changed stored pref representation as before.
1252 //   the array of objects is 1) bigger and 2)
1253 //   less portable. If we would import packed pref
1254 //   objects and the object definition was changed, PHP would fail.
1255 //   This doesn't happen with an simple array of non-default values.
1256 // * use $prefs->retrieve and $prefs->store methods, where retrieve
1257 //   understands the interim format of array of objects also.
1258 // * simplified $prefs->get() and fixed $prefs->set()
1259 // * added $user->_userid and class '_WikiUser' portability functions
1260 // * fixed $user object ->_level upgrading, mostly using sessions.
1261 //   this fixes yesterdays problems with loosing authorization level.
1262 // * fixed WikiUserNew::checkPass to return the _level
1263 // * fixed WikiUserNew::isSignedIn
1264 // * added explodePageList to class PageList, support sortby arg
1265 // * fixed UserPreferences for WikiUserNew
1266 // * fixed WikiPlugin for empty defaults array
1267 // * UnfoldSubpages: added pagename arg, renamed pages arg,
1268 //   removed sort arg, support sortby arg
1269 //
1270 // Revision 1.105  2004/01/25 03:57:15  rurban
1271 // WikiUserNew support (temp. ENABLE_USER_NEW constant)
1272 //
1273 // Revision 1.104  2003/12/26 06:41:16  carstenklapp
1274 // Bugfix: Try to defer OS errors about session.save_path and ACCESS_LOG,
1275 // so they don't prevent IE from partially (or not at all) rendering the
1276 // page. This should help a little for the IE user who encounters trouble
1277 // when setting up a new PhpWiki for the first time.
1278 //
1279 // Revision 1.103  2003/12/02 00:10:00  carstenklapp
1280 // Bugfix: Ongoing work to untangle UserPreferences/WikiUser/request code
1281 // mess: UserPreferences should take effect immediately now upon signing
1282 // in.
1283 //
1284 // Revision 1.102  2003/11/25 22:55:32  carstenklapp
1285 // Localization bugfix: For wikis where English is not the default system
1286 // language, make sure that the authority error message (i.e. "You must
1287 // sign in to edit pages in this wiki" etc.) is displayed in the wiki's
1288 // default language. Previously it would always display in English.
1289 // (Added call to update_locale() before displaying any messages prior to
1290 // the login prompt.)
1291 //
1292 // Revision 1.101  2003/11/25 21:49:44  carstenklapp
1293 // Bugfix: For a non-english wiki or when the user's preference is not
1294 // english, the wiki would always use the english ActionPage first if it
1295 // was present rather than the appropriate localised variant. (PhpWikis
1296 // running only in english or Wikis running ONLY without any english
1297 // ActionPages would not notice this bug, only when both english and
1298 // localised ActionPages were in the DB.) Now we check for the localised
1299 // variant first.
1300 //
1301 // Revision 1.100  2003/11/18 16:54:18  carstenklapp
1302 // Reformatting only: Tabs to spaces, added rcs log.
1303 //
1304
1305
1306 // Local Variables:
1307 // mode: php
1308 // tab-width: 8
1309 // c-basic-offset: 4
1310 // c-hanging-comment-ender-p: nil
1311 // indent-tabs-mode: nil
1312 // End:
1313 ?>