2 rcs_id('$Id: main.php,v 1.126 2004-03-24 19:39:03 rurban Exp $');
4 define ('USE_PREFS_IN_PAGE', true);
6 include "lib/config.php";
7 require_once("lib/stdlib.php");
8 require_once('lib/Request.php');
9 require_once('lib/WikiDB.php');
11 require_once("lib/WikiUserNew.php");
13 require_once("lib/WikiUser.php");
14 require_once("lib/WikiGroup.php");
15 require_once("lib/PagePerm.php");
17 class WikiRequest extends Request {
20 function WikiRequest () {
21 $this->_dbi = WikiDB::open($GLOBALS['DBParams']);
23 include_once('lib/DB_Session.php');
24 $prefix = isset($GLOBALS['DBParams']['prefix']) ? $GLOBALS['DBParams']['prefix'] : '';
25 $this->_dbsession = & new DB_Session($this->getDbh(),
26 $prefix . $GLOBALS['DBParams']['db_session_table']);
28 // Fixme: Does pear reset the error mask to 1? We have to find the culprit
29 $x = error_reporting();
34 $this->setArg('pagename', $this->_deducePagename());
35 $this->setArg('action', $this->_deduceAction());
37 // Restore auth state. This doesn't check for proper authorization!
38 if (ENABLE_USER_NEW) {
39 $userid = $this->_deduceUsername();
40 if (isset($this->_user) and $this->_user->_authhow == 'session') {
41 // users might switch in a session between the two objects.
42 // restore old auth level here or in updateAuthAndPrefs?
43 //$user = $this->getSessionVar('wiki_user');
44 // revive db handle, because these don't survive sessions
45 unset($this->_user->_HomePagehandle);
46 $this->_user->hasHomePage();
48 if (!isa($user,WikiUserClassname()) or empty($this->_user->_level)) {
49 $user = UpgradeUser($this->_user,$user);
52 $this->_prefs = & $this->_user->_prefs;
54 $user = WikiUser($userid);
55 //Todo: upgrade later at updateAuthAndPrefs()
56 if (isset($this->_user))
57 $user = UpgradeUser($this->_user,$user);
59 $this->_prefs = & $this->_user->_prefs;
62 $this->_user = new WikiUser($this, $this->_deduceUsername());
63 $this->_prefs = $this->_user->getPreferences();
67 function initializeLang () {
68 if ($user_lang = $this->getPref('lang')) {
69 //trigger_error("DEBUG: initializeLang() ". $user_lang ." calling update_locale()...");
70 update_locale($user_lang);
71 FindLocalizedButtonFile(".",'missing_ok','reinit');
75 function initializeTheme () {
79 if ($user_theme = $this->getPref('theme'))
80 include_once("themes/$user_theme/themeinfo.php");
81 if (empty($Theme) and defined ('THEME'))
82 include_once("themes/" . THEME . "/themeinfo.php");
84 include_once("themes/default/themeinfo.php");
85 assert(!empty($Theme));
88 // This really maybe should be part of the constructor, but since it
89 // may involve HTML/template output, the global $request really needs
90 // to be initialized before we do this stuff.
91 function updateAuthAndPrefs () {
93 // Handle authentication request, if any.
94 if ($auth_args = $this->getArg('auth')) {
95 $this->setArg('auth', false);
96 $this->_handleAuthRequest($auth_args); // possible NORETURN
98 elseif ( ! $this->_user or ! $this->_user->isSignedIn() ) {
99 // If not auth request, try to sign in as saved user.
100 if (($saved_user = $this->getPref('userid')) != false) {
101 $this->_signIn($saved_user);
105 // Save preferences in session and cookie
106 if (isset($this->_user) and
107 (!isset($this->_user->_authhow) or $this->_user->_authhow != 'session')) {
109 $this->_user->setPreferences($this->_prefs, $id_only);
111 $this->setSessionVar('wiki_user', $this->_user);
112 //$this->setSessionVar('wiki_prefs', $this->_prefs);
115 // Ensure user has permissions for action
116 $require_level = $this->requiredAuthority($this->getArg('action'));
117 if (! $this->_user->hasAuthority($require_level))
118 $this->_notAuthorized($require_level); // NORETURN
121 function getUser () {
125 function getPrefs () {
126 return $this->_prefs;
129 // Convenience function:
130 function getPref ($key) {
131 if (isset($this->_prefs))
132 return $this->_prefs->get($key);
140 * Get requested page from the page database.
141 * By default it will grab the page requested via the URL
143 * This is a convenience function.
144 * @param string $pagename Name of page to get.
145 * @return WikiDB_Page Object with methods to pull data from
146 * database for the page requested.
148 function getPage ($pagename = false) {
149 if (!isset($this->_dbi))
152 $pagename = $this->getArg('pagename');
153 return $this->_dbi->getPage($pagename);
156 /** Get URL for POST actions.
158 * Officially, we should just use SCRIPT_NAME (or some such),
159 * but that causes problems when we try to issue a redirect, e.g.
160 * after saving a page.
162 * Some browsers (at least NS4 and Mozilla 0.97 won't accept
163 * a redirect from a page to itself.)
165 * So, as a HACK, we include pagename and action as query args in
166 * the URL. (These should be ignored when we receive the POST
169 function getPostURL ($pagename=false) {
170 if ($pagename === false)
171 $pagename = $this->getArg('pagename');
172 $action = $this->getArg('action');
173 if (!empty($_GET['start_debug'])) // zend ide support
174 return WikiURL($pagename, array('action' => $action, 'start_debug' => 1));
176 return WikiURL($pagename, array('action' => $action));
179 function _handleAuthRequest ($auth_args) {
180 if (!is_array($auth_args))
183 // Ignore password unless POST'ed.
184 if (!$this->isPost())
185 unset($auth_args['passwd']);
187 $olduser = $this->_user;
188 $user = $this->_user->AuthCheck($auth_args);
189 if (isa($user,WikiUserClassname())) {
190 // Successful login (or logout.)
191 $this->_setUser($user);
193 elseif (is_string($user)) {
194 // Login attempt failed.
195 $fail_message = $user;
196 $auth_args['pass_required'] = true;
197 // If no password was submitted, it's not really
198 // a failure --- just need to prompt for password...
199 if (!isset($auth_args['passwd'])) {
200 //$auth_args['pass_required'] = false;
201 $fail_message = false;
203 $olduser->PrintLoginForm($this, $auth_args, $fail_message);
204 $this->finish(); //NORETURN
207 // Login request cancelled.
212 * Attempt to sign in (bogo-login).
216 * @param $userid string Userid to attempt to sign in as.
219 function _signIn ($userid) {
220 if (ENABLE_USER_NEW) {
222 $this->_user = new _BogoUser($userid);
224 $this->_user = new _PassUser($userid);
226 $user = $this->_user->AuthCheck(array('userid' => $userid));
227 if (isa($user,WikiUserClassname())) {
228 $this->_setUser($user); // success!
232 // login or logout or restore state
233 function _setUser ($user) {
234 $this->_user = $user;
235 $this->setCookieVar('WIKI_ID', $user->getAuthenticatedId(), 365);
236 $this->setSessionVar('wiki_user', $user);
237 if ($user->isSignedIn())
238 $user->_authhow = 'signin';
240 // Save userid to prefs..
241 if (!($this->_prefs = $this->_user->getPreferences()))
242 $this->_prefs = $this->_user->_prefs;
243 $this->_prefs->set('userid',
244 $user->isSignedIn() ? $user->getId() : '');
245 $this->initializeTheme();
248 /* Permission system */
250 function _notAuthorized ($require_level) {
251 // Display the authority message in the Wiki's default
252 // language, in case it is not english.
254 // Note that normally a user will not see such an error once
255 // logged in, unless the admin has altered the default
256 // disallowed wikiactions. In that case we should probably
257 // check the user's language prefs too at this point; this
258 // would be a situation which is not really handled with the
260 if (empty($GLOBALS['LANG']))
261 update_locale(DEFAULT_LANGUAGE);
263 // User does not have required authority. Prompt for login.
264 $what = $this->getActionDescription($this->getArg('action'));
266 if ($require_level == WIKIAUTH_FORBIDDEN) {
267 $this->finish(fmt("%s is disallowed on this wiki.",
268 $this->getDisallowedActionDescription($this->getArg('action'))));
270 elseif ($require_level == WIKIAUTH_BOGO)
271 $msg = fmt("You must sign in to %s.", $what);
272 elseif ($require_level == WIKIAUTH_USER)
273 $msg = fmt("You must log in to %s.", $what);
275 $msg = fmt("You must be an administrator to %s.", $what);
276 $pass_required = ($require_level >= WIKIAUTH_USER);
278 $this->_user->PrintLoginForm($this, compact('require_level','pass_required'), $msg);
279 $this->finish(); // NORETURN
282 // Fixme: for PagePermissions we'll need other strings,
283 // relevant to the requested page, not just for the action on the whole wiki.
284 function getActionDescription($action) {
285 static $actionDescriptions;
286 if (! $actionDescriptions) {
288 = array('browse' => _("view this page"),
289 'diff' => _("diff this page"),
290 'dumphtml' => _("dump html pages"),
291 'dumpserial' => _("dump serial pages"),
292 'edit' => _("edit this page"),
293 'create' => _("create this page"),
294 'loadfile' => _("load files into this wiki"),
295 'lock' => _("lock this page"),
296 'remove' => _("remove this page"),
297 'unlock' => _("unlock this page"),
298 'upload' => _("upload a zip dump"),
299 'verify' => _("verify the current action"),
300 'viewsource' => _("view the source of this page"),
301 'xmlrpc' => _("access this wiki via XML-RPC"),
302 'zip' => _("download a zip dump from this wiki"),
303 'ziphtml' => _("download an html zip dump from this wiki")
306 if (in_array($action, array_keys($actionDescriptions)))
307 return $actionDescriptions[$action];
311 function getDisallowedActionDescription($action) {
312 static $disallowedActionDescriptions;
313 if (! $disallowedActionDescriptions) {
314 $disallowedActionDescriptions
315 = array('browse' => _("Browsing pages"),
316 'diff' => _("Diffing pages"),
317 'dumphtml' => _("Dumping html pages"),
318 'dumpserial' => _("Dumping serial pages"),
319 'edit' => _("Editing pages"),
320 'create' => _("Creating pages"),
321 'loadfile' => _("Loading files"),
322 'lock' => _("Locking pages"),
323 'remove' => _("Removing pages"),
324 'unlock' => _("Unlocking pages"),
325 'upload' => _("Uploading zip dumps"),
326 'verify' => _("Verify the current action"),
327 'viewsource' => _("Viewing the source of pages"),
328 'xmlrpc' => _("XML-RPC access"),
329 'zip' => _("Downloading zip dumps"),
330 'ziphtml' => _("Downloading html zip dumps")
333 if (in_array($action, array_keys($disallowedActionDescriptions)))
334 return $disallowedActionDescriptions[$action];
339 function requiredAuthority ($action) {
340 $auth = $this->requiredAuthorityForAction($action);
341 if (!ALLOW_ANON_USER) return WIKIAUTH_USER;
344 * This is a hook for plugins to require authority
345 * for posting to them.
347 * IMPORTANT: this is not a secure check, so the plugin
348 * may not assume that any POSTs to it are authorized.
349 * All this does is cause PhpWiki to prompt for login
350 * if the user doesn't have the required authority.
352 if ($this->isPost()) {
353 $post_auth = $this->getArg('require_authority_for_post');
354 if ($post_auth !== false)
355 $auth = max($auth, $post_auth);
360 function requiredAuthorityForAction ($action) {
361 if (class_exists("PagePermission")) {
362 return requiredAuthorityForPage($action);
372 return WIKIAUTH_ANON;
376 if (defined('ZIPDUMP_AUTH') && ZIPDUMP_AUTH)
377 return WIKIAUTH_ADMIN;
378 return WIKIAUTH_ANON;
381 if (defined('REQUIRE_SIGNIN_BEFORE_EDIT') && REQUIRE_SIGNIN_BEFORE_EDIT)
382 return WIKIAUTH_BOGO;
383 return WIKIAUTH_ANON;
384 // return WIKIAUTH_BOGO;
387 $page = $this->getPage();
388 $current = $page->getCurrentRevision();
389 if ($current->hasDefaultContents())
390 return $this->requiredAuthorityForAction('edit');
391 return $this->requiredAuthorityForAction('browse');
401 return WIKIAUTH_ADMIN;
403 global $WikiNameRegexp;
404 if (preg_match("/$WikiNameRegexp\Z/A", $action))
405 return WIKIAUTH_ANON; // ActionPage.
407 return WIKIAUTH_ADMIN;
411 /* End of Permission system */
413 function possiblyDeflowerVirginWiki () {
414 if ($this->getArg('action') != 'browse')
416 if ($this->getArg('pagename') != HOME_PAGE)
419 $page = $this->getPage();
420 $current = $page->getCurrentRevision();
421 if ($current->getVersion() > 0)
422 return; // Homepage exists.
424 include('lib/loadsave.php');
426 $this->finish(); // NORETURN
429 function handleAction () {
430 $action = $this->getArg('action');
431 $method = "action_$action";
432 if (method_exists($this, $method)) {
435 elseif ($page = $this->findActionPage($action)) {
436 $this->actionpage($page);
439 $this->finish(fmt("%s: Bad action", $action));
443 function finish ($errormsg = false) {
447 exit(); // just in case CloseDataBase calls us
450 if (!empty($this->_dbi))
451 $this->_dbi->close();
455 global $ErrorManager;
456 $ErrorManager->flushPostponedErrors();
458 if (!empty($errormsg)) {
461 HTML::h2(_("Fatal PhpWiki Error")),
464 echo "\n</body></html>";
471 function _deducePagename () {
472 if ($this->getArg('pagename'))
473 return $this->getArg('pagename');
476 $pathinfo = $this->get('PATH_INFO');
477 $tail = substr($pathinfo, strlen(PATH_INFO_PREFIX));
479 if ($tail && $pathinfo == PATH_INFO_PREFIX . $tail) {
483 elseif ($this->isPost()) {
485 * In general, for security reasons, HTTP_GET_VARS should be ignored
486 * on POST requests, but we make an exception here (only for pagename).
488 * The justifcation for this hack is the following
489 * asymmetry: When POSTing with USE_PATH_INFO set, the
490 * pagename can (and should) be communicated through the
491 * request URL via PATH_INFO. When POSTing with
492 * USE_PATH_INFO off, this cannot be done --- the only way
493 * to communicate the pagename through the URL is via
494 * QUERY_ARGS (HTTP_GET_VARS).
496 global $HTTP_GET_VARS;
497 if (isset($HTTP_GET_VARS['pagename'])) {
498 return $HTTP_GET_VARS['pagename'];
503 * Support for PhpWiki 1.2 style requests.
505 $query_string = $this->get('QUERY_STRING');
506 if (preg_match('/^[^&=]+$/', $query_string)) {
507 return urldecode($query_string);
513 function _deduceAction () {
514 if (!($action = $this->getArg('action'))) {
515 // Detect XML-RPC requests
517 && $this->get('CONTENT_TYPE') == 'text/xml') {
518 global $HTTP_RAW_POST_DATA;
519 if (strstr($HTTP_RAW_POST_DATA, '<methodCall>')) {
524 return 'browse'; // Default if no action specified.
527 if (method_exists($this, "action_$action"))
530 // Allow for, e.g. action=LikePages
531 if ($this->isActionPage($action))
534 trigger_error("$action: Unknown action", E_USER_NOTICE);
538 function _deduceUsername() {
539 if (!empty($this->args['auth']) and !empty($this->args['auth']['userid']))
540 return $this->args['auth']['userid'];
541 if (!empty($_SERVER['PHP_AUTH_USER']))
542 return $_SERVER['PHP_AUTH_USER'];
543 if (!empty($_ENV['REMOTE_USER']))
544 return $_ENV['REMOTE_USER'];
546 if ($user = $this->getSessionVar('wiki_user')) {
547 $this->_user = $user;
548 $this->_user->_authhow = 'session';
549 return ENABLE_USER_NEW ? $user->UserName() : $this->_user;
551 if ($userid = $this->getCookieVar('WIKI_ID')) {
552 if (!empty($this->_user))
553 $this->_user->authhow = 'cookie';
559 function _isActionPage ($pagename) {
560 $dbi = $this->getDbh();
561 $page = $dbi->getPage($pagename);
562 $rev = $page->getCurrentRevision();
563 // FIXME: more restrictive check for sane plugin?
564 if (strstr($rev->getPackedContent(), '<?plugin'))
566 if (!$rev->hasDefaultContents())
567 trigger_error("$pagename: Does not appear to be an 'action page'", E_USER_NOTICE);
571 function findActionPage ($action) {
574 // check for translated version, as per users preferred language
575 // (or system default in case it is not en)
576 $translation = gettext($action);
578 if (isset($cache) and isset($cache[$translation]))
579 return $cache[$translation];
581 // check for cached translated version
582 if ($this->_isActionPage($translation))
583 return $cache[$action] = $translation;
585 // Allow for, e.g. action=LikePages
586 global $WikiNameRegexp;
587 if (!preg_match("/$WikiNameRegexp\\Z/A", $action))
588 return $cache[$action] = false;
590 // check for translated version (default language)
592 if ($LANG != DEFAULT_LANGUAGE and $LANG != "en") {
594 //trigger_error("DEBUG: findActionPage() ". DEFAULT_LANGUAGE." calling update_locale()...");
595 update_locale(DEFAULT_LANGUAGE);
596 $default = gettext($action);
597 //trigger_error("DEBUG: findActionPage() ". $save_lang." restoring save_lang, calling update_locale()...");
598 update_locale($save_lang);
599 if ($this->_isActionPage($default))
600 return $cache[$action] = $default;
603 $default = $translation;
606 // check for english version
607 if ($action != $translation and $action != $default) {
608 if ($this->_isActionPage($action))
609 return $cache[$action] = $action;
612 trigger_error("$action: Cannot find action page", E_USER_NOTICE);
613 return $cache[$action] = false;
616 function isActionPage ($pagename) {
617 return $this->findActionPage($pagename);
620 function action_browse () {
621 $this->buffer_output();
622 include_once("lib/display.php");
626 function action_verify () {
627 $this->action_browse();
630 function actionpage ($action) {
631 $this->buffer_output();
632 include_once("lib/display.php");
633 actionPage($this, $action);
636 function action_diff () {
637 $this->buffer_output();
638 include_once "lib/diff.php";
642 function action_search () {
643 // This is obsolete: reformulate URL and redirect.
644 // FIXME: this whole section should probably be deleted.
645 if ($this->getArg('searchtype') == 'full') {
646 $search_page = _("FullTextSearch");
649 $search_page = _("TitleSearch");
651 $this->redirect(WikiURL($search_page,
652 array('s' => $this->getArg('searchterm')),
656 function action_edit () {
657 $this->buffer_output();
658 include "lib/editpage.php";
659 $e = new PageEditor ($this);
663 function action_create () {
664 $this->action_edit();
667 function action_viewsource () {
668 $this->buffer_output();
669 include "lib/editpage.php";
670 $e = new PageEditor ($this);
674 function action_lock () {
675 $page = $this->getPage();
676 $page->set('locked', true);
677 $this->action_browse();
680 function action_unlock () {
681 // FIXME: This check is redundant.
682 //$user->requireAuth(WIKIAUTH_ADMIN);
683 $page = $this->getPage();
684 $page->set('locked', false);
685 $this->action_browse();
688 function action_remove () {
689 // FIXME: This check is redundant.
690 //$user->requireAuth(WIKIAUTH_ADMIN);
691 $pagename = $this->getArg('pagename');
692 if (strstr($pagename,_('PhpWikiAdministration'))) {
693 $this->action_browse();
695 include('lib/removepage.php');
700 function action_xmlrpc () {
701 include_once("lib/XmlRpcServer.php");
702 $xmlrpc = new XmlRpcServer($this);
706 function action_zip () {
707 include_once("lib/loadsave.php");
709 // I don't think it hurts to add cruft at the end of the zip file.
710 echo "\n========================================================\n";
711 echo "PhpWiki " . PHPWIKI_VERSION . " source:\n$GLOBALS[RCS_IDS]\n";
714 function action_ziphtml () {
715 include_once("lib/loadsave.php");
716 MakeWikiZipHtml($this);
717 // I don't think it hurts to add cruft at the end of the zip file.
718 echo "\n========================================================\n";
719 echo "PhpWiki " . PHPWIKI_VERSION . " source:\n$GLOBALS[RCS_IDS]\n";
722 function action_dumpserial () {
723 include_once("lib/loadsave.php");
727 function action_dumphtml () {
728 include_once("lib/loadsave.php");
729 DumpHtmlToDir($this);
732 function action_upload () {
733 include_once("lib/loadsave.php");
737 function action_upgrade () {
738 include_once("lib/loadsave.php");
739 include_once("lib/upgrade.php");
743 function action_loadfile () {
744 include_once("lib/loadsave.php");
745 LoadFileOrDir($this);
750 function is_safe_action ($action) {
751 return WikiRequest::requiredAuthorityForAction($action) < WIKIAUTH_ADMIN;
754 function validateSessionPath() {
755 // Try to defer any session.save_path PHP errors before any html
756 // is output, which causes some versions of IE to display a blank
757 // page (due to its strict mode while parsing a page?).
758 if (! is_writeable(ini_get('session.save_path'))) {
761 (sprintf(_("%s is not writable."),
762 _("The session.save_path directory"))
764 . sprintf(_("Please ensure that %s is writable, or redefine %s in index.php."),
765 sprintf(_("the directory '%s'"),
766 ini_get('session.save_path')),
769 . sprintf(_("Attempting to use the directory '%s' instead."),
772 if (! is_writeable($tmpdir)) {
774 (sprintf(_("%s is not writable."), $tmpdir)
776 . _("Users will not be able to sign in.")
780 ini_set('session.save_path', $tmpdir);
786 validateSessionPath();
790 $request = new WikiRequest();
793 * Allow for disabling of markup cache.
794 * (Mostly for debugging ... hopefully.)
796 * See also <?plugin WikiAdminUtils action=purge-cache ?>
798 if (!defined('WIKIDB_NOCACHE_MARKUP') and $request->getArg('nocache'))
799 define('WIKIDB_NOCACHE_MARKUP', $request->getArg('nocache'));
801 // Initialize with system defaults in case user not logged in.
802 // Should this go into constructor?
803 $request->initializeTheme();
805 $request->updateAuthAndPrefs();
806 $request->initializeLang();
808 // Enable the output of most of the warning messages.
809 // The warnings will screw up zip files though.
810 global $ErrorManager;
811 if (substr($request->getArg('action'), 0, 3) != 'zip') {
812 $ErrorManager->setPostponedErrorMask(E_NOTICE|E_USER_NOTICE);
813 //$ErrorManager->setPostponedErrorMask(0);
817 //if ($user->is_authenticated())
818 // $LogEntry->user = $user->getId();
820 $request->possiblyDeflowerVirginWiki();
822 if (defined('WIKI_XMLRPC') and WIKI_XMLRPC) return;
823 if (defined('WIKI_SOAP') and WIKI_SOAP) return;
825 $validators = array('wikiname' => WIKI_NAME,
826 'args' => hash($request->getArgs()),
827 'prefs' => hash($request->getPrefs()));
828 if (CACHE_CONTROL == 'STRICT') {
829 $dbi = $request->getDbh();
830 $timestamp = $dbi->getTimestamp();
831 $validators['mtime'] = $timestamp;
832 $validators['%mtime'] = (int)$timestamp;
834 // FIXME: we should try to generate strong validators when possible,
835 // but for now, our validator is weak, since equal validators do not
836 // indicate byte-level equality of content. (Due to DEBUG timing output, etc...)
838 // (If DEBUG if off, this may be a strong validator, but I'm going
839 // to go the paranoid route here pending further study and testing.)
841 $validators['%weak'] = true;
843 $request->setValidators($validators);
845 $request->handleAction();
847 if (defined('DEBUG') and DEBUG & 4) phpinfo(INFO_VARIABLES);
851 $x = error_reporting(); // why is it 1 here? should be E_ALL
852 error_reporting(E_ALL);
856 // $Log: not supported by cvs2svn $
857 // Revision 1.125 2004/03/14 16:30:52 rurban
858 // db-handle session revivification, dba fixes
860 // Revision 1.124 2004/03/12 15:48:07 rurban
861 // fixed explodePageList: wrong sortby argument order in UnfoldSubpages
862 // simplified lib/stdlib.php:explodePageList
864 // Revision 1.123 2004/03/10 15:41:27 rurban
865 // use default pref mysql table
867 // Revision 1.122 2004/03/08 18:17:09 rurban
868 // added more WikiGroup::getMembersOf methods, esp. for special groups
869 // fixed $LDAP_SET_OPTIONS
870 // fixed _AuthInfo group methods
872 // Revision 1.121 2004/03/01 13:48:45 rurban
874 // p[] consistency fix
876 // Revision 1.120 2004/03/01 10:22:41 rurban
877 // initializeTheme optimize
879 // Revision 1.119 2004/02/26 20:45:06 rurban
880 // check for ALLOW_ANON_USER = false
882 // Revision 1.118 2004/02/26 01:32:03 rurban
883 // fixed session login with old WikiUser object. strangely, the errormask gets corruoted to 1, Pear???
885 // Revision 1.117 2004/02/24 17:19:37 rurban
886 // debugging helpers only
888 // Revision 1.116 2004/02/24 15:17:14 rurban
889 // 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
891 // Revision 1.115 2004/02/15 21:34:37 rurban
892 // PageList enhanced and improved.
893 // fixed new WikiAdmin... plugins
894 // editpage, Theme with exp. htmlarea framework
895 // (htmlarea yet committed, this is really questionable)
896 // WikiUser... code with better session handling for prefs
897 // enhanced UserPreferences (again)
898 // RecentChanges for show_deleted: how should pages be deleted then?
900 // Revision 1.114 2004/02/15 17:30:13 rurban
901 // workaround for lost db connnection handle on session restauration (->_auth_dbi)
902 // fixed getPreferences() (esp. from sessions)
903 // fixed setPreferences() (update and set),
904 // fixed AdoDb DB statements,
905 // update prefs only at UserPreferences POST (for testing)
906 // unified db prefs methods (but in external pref classes yet)
908 // Revision 1.113 2004/02/12 13:05:49 rurban
909 // Rename functional for PearDB backend
910 // some other minor changes
911 // SiteMap comes with a not yet functional feature request: includepages (tbd)
913 // Revision 1.112 2004/02/09 03:58:12 rurban
914 // for now default DB_SESSION to false
916 // * not existing perms will now query the parent, and not
917 // return the default perm
918 // * added pagePermissions func which returns the object per page
919 // * added getAccessDescription
921 // * added global ->prepare (not yet used) with smart user/pref/member table prefixing.
922 // * force init of authdbh in the 2 db classes
924 // * fixed session handling (not triple auth request anymore)
925 // * don't store cookie prefs with sessions
926 // stdlib: global obj2hash helper from _AuthInfo, also needed for PagePerm
928 // Revision 1.111 2004/02/07 10:41:25 rurban
929 // fixed auth from session (still double code but works)
931 // fixed DbPassUser upgrade and policy=old
934 // Revision 1.110 2004/02/03 09:45:39 rurban
935 // LDAP cleanup, start of new Pref classes
937 // Revision 1.109 2004/01/30 19:57:58 rurban
938 // fixed DBAuthParams['pref_select']: wrong _auth_dbi object used.
940 // Revision 1.108 2004/01/28 14:34:14 rurban
941 // session table takes the common prefix
942 // + various minor stuff
943 // reallow password changing
945 // Revision 1.107 2004/01/27 23:23:39 rurban
946 // renamed ->Username => _userid for consistency
947 // renamed mayCheckPassword => mayCheckPass
948 // fixed recursion problem in WikiUserNew
949 // fixed bogo login (but not quite 100% ready yet, password storage)
951 // Revision 1.106 2004/01/26 09:17:49 rurban
952 // * changed stored pref representation as before.
953 // the array of objects is 1) bigger and 2)
954 // less portable. If we would import packed pref
955 // objects and the object definition was changed, PHP would fail.
956 // This doesn't happen with an simple array of non-default values.
957 // * use $prefs->retrieve and $prefs->store methods, where retrieve
958 // understands the interim format of array of objects also.
959 // * simplified $prefs->get() and fixed $prefs->set()
960 // * added $user->_userid and class '_WikiUser' portability functions
961 // * fixed $user object ->_level upgrading, mostly using sessions.
962 // this fixes yesterdays problems with loosing authorization level.
963 // * fixed WikiUserNew::checkPass to return the _level
964 // * fixed WikiUserNew::isSignedIn
965 // * added explodePageList to class PageList, support sortby arg
966 // * fixed UserPreferences for WikiUserNew
967 // * fixed WikiPlugin for empty defaults array
968 // * UnfoldSubpages: added pagename arg, renamed pages arg,
969 // removed sort arg, support sortby arg
971 // Revision 1.105 2004/01/25 03:57:15 rurban
972 // WikiUserNew support (temp. ENABLE_USER_NEW constant)
974 // Revision 1.104 2003/12/26 06:41:16 carstenklapp
975 // Bugfix: Try to defer OS errors about session.save_path and ACCESS_LOG,
976 // so they don't prevent IE from partially (or not at all) rendering the
977 // page. This should help a little for the IE user who encounters trouble
978 // when setting up a new PhpWiki for the first time.
980 // Revision 1.103 2003/12/02 00:10:00 carstenklapp
981 // Bugfix: Ongoing work to untangle UserPreferences/WikiUser/request code
982 // mess: UserPreferences should take effect immediately now upon signing
985 // Revision 1.102 2003/11/25 22:55:32 carstenklapp
986 // Localization bugfix: For wikis where English is not the default system
987 // language, make sure that the authority error message (i.e. "You must
988 // sign in to edit pages in this wiki" etc.) is displayed in the wiki's
989 // default language. Previously it would always display in English.
990 // (Added call to update_locale() before displaying any messages prior to
991 // the login prompt.)
993 // Revision 1.101 2003/11/25 21:49:44 carstenklapp
994 // Bugfix: For a non-english wiki or when the user's preference is not
995 // english, the wiki would always use the english ActionPage first if it
996 // was present rather than the appropriate localised variant. (PhpWikis
997 // running only in english or Wikis running ONLY without any english
998 // ActionPages would not notice this bug, only when both english and
999 // localised ActionPages were in the DB.) Now we check for the localised
1002 // Revision 1.100 2003/11/18 16:54:18 carstenklapp
1003 // Reformatting only: Tabs to spaces, added rcs log.
1010 // c-basic-offset: 4
1011 // c-hanging-comment-ender-p: nil
1012 // indent-tabs-mode: nil