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