2 rcs_id('$Id: main.php,v 1.130 2004-04-18 00:25:53 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 if (in_array('File',$GLOBALS['USER_AUTH_ORDER'])) {
26 include_once 'lib/pear/File_Passwd.php';
28 $this->_dbsession = & new DB_Session($this->getDbh(),
29 $prefix . $GLOBALS['DBParams']['db_session_table']);
31 // Fixme: Does pear reset the error mask to 1? We have to find the culprit
32 $x = error_reporting();
37 $this->setArg('pagename', $this->_deducePagename());
38 $this->setArg('action', $this->_deduceAction());
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')
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')))
55 $this->_user = WikiUser($userid,$this->_user->_prefs);
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 )
64 $this->_user = new _FilePassUser($userid,$this->_user->_prefs,$this->_user->_file->filename);
67 if (!isa($user,WikiUserClassname()) or empty($this->_user->_level)) {
68 $user = UpgradeUser($this->_user,$user);
71 $this->_prefs = & $this->_user->_prefs;
73 $user = WikiUser($userid);
74 $this->_user = & $user;
75 $this->_prefs = & $this->_user->_prefs;
78 $this->_user = new WikiUser($this, $this->_deduceUsername());
79 $this->_prefs = $this->_user->getPreferences();
83 function initializeLang () {
84 if ($user_lang = $this->getPref('lang')) {
85 //trigger_error("DEBUG: initializeLang() ". $user_lang ." calling update_locale()...");
86 update_locale($user_lang);
87 FindLocalizedButtonFile(".",'missing_ok','reinit');
91 function initializeTheme () {
95 if ($user_theme = $this->getPref('theme'))
96 include_once("themes/$user_theme/themeinfo.php");
97 if (empty($Theme) and defined ('THEME'))
98 include_once("themes/" . THEME . "/themeinfo.php");
100 include_once("themes/default/themeinfo.php");
101 assert(!empty($Theme));
104 // This really maybe should be part of the constructor, but since it
105 // may involve HTML/template output, the global $request really needs
106 // to be initialized before we do this stuff.
107 function updateAuthAndPrefs () {
109 if (isset($this->_user) and (!isa($this->_user,WikiUserClassname()))) {
110 $this->_user = false;
112 // Handle authentication request, if any.
113 if ($auth_args = $this->getArg('auth')) {
114 $this->setArg('auth', false);
115 $this->_handleAuthRequest($auth_args); // possible NORETURN
117 elseif ( ! $this->_user or
118 (isa($this->_user,WikiUserClassname()) and ! $this->_user->isSignedIn())) {
119 // If not auth request, try to sign in as saved user.
120 if (($saved_user = $this->getPref('userid')) != false) {
121 $this->_signIn($saved_user);
125 // Save preferences in session and cookie
126 if (isset($this->_user) and
127 (!isset($this->_user->_authhow) or $this->_user->_authhow != 'session')) {
129 $this->_user->setPreferences($this->_prefs, $id_only);
131 $this->setSessionVar('wiki_user', $this->_user);
132 //$this->setSessionVar('wiki_prefs', $this->_prefs);
135 // Ensure user has permissions for action
136 $require_level = $this->requiredAuthority($this->getArg('action'));
137 if (! $this->_user->hasAuthority($require_level))
138 $this->_notAuthorized($require_level); // NORETURN
141 function getUser () {
142 if (isset($this->_user))
145 return $GLOBALS['ForbiddenUser'];
148 function getPrefs () {
149 return $this->_prefs;
152 // Convenience function:
153 function getPref ($key) {
154 if (isset($this->_prefs))
155 return $this->_prefs->get($key);
163 * Get requested page from the page database.
164 * By default it will grab the page requested via the URL
166 * This is a convenience function.
167 * @param string $pagename Name of page to get.
168 * @return WikiDB_Page Object with methods to pull data from
169 * database for the page requested.
171 function getPage ($pagename = false) {
172 if (!isset($this->_dbi))
175 $pagename = $this->getArg('pagename');
176 return $this->_dbi->getPage($pagename);
179 /** Get URL for POST actions.
181 * Officially, we should just use SCRIPT_NAME (or some such),
182 * but that causes problems when we try to issue a redirect, e.g.
183 * after saving a page.
185 * Some browsers (at least NS4 and Mozilla 0.97 won't accept
186 * a redirect from a page to itself.)
188 * So, as a HACK, we include pagename and action as query args in
189 * the URL. (These should be ignored when we receive the POST
192 function getPostURL ($pagename=false) {
193 if ($pagename === false)
194 $pagename = $this->getArg('pagename');
195 $action = $this->getArg('action');
196 if (!empty($_GET['start_debug'])) // zend ide support
197 return WikiURL($pagename, array('action' => $action, 'start_debug' => 1));
199 return WikiURL($pagename, array('action' => $action));
202 function _handleAuthRequest ($auth_args) {
203 if (!is_array($auth_args))
206 // Ignore password unless POST'ed.
207 if (!$this->isPost())
208 unset($auth_args['passwd']);
210 $olduser = $this->_user;
211 $user = $this->_user->AuthCheck($auth_args);
212 if (isa($user,WikiUserClassname())) {
213 // Successful login (or logout.)
214 $this->_setUser($user);
216 elseif (is_string($user)) {
217 // Login attempt failed.
218 $fail_message = $user;
219 $auth_args['pass_required'] = true;
220 // If no password was submitted, it's not really
221 // a failure --- just need to prompt for password...
222 if (!ALLOW_USER_PASSWORDS
224 and !isset($auth_args['passwd']))
226 $fail_message = false;
228 $olduser->PrintLoginForm($this, $auth_args, $fail_message);
229 $this->finish(); //NORETURN
232 // Login request cancelled.
237 * Attempt to sign in (bogo-login).
241 * @param $userid string Userid to attempt to sign in as.
244 function _signIn ($userid) {
245 if (ENABLE_USER_NEW) {
247 $this->_user = new _BogoUser($userid);
249 $this->_user = new _PassUser($userid);
251 $user = $this->_user->AuthCheck(array('userid' => $userid));
252 if (isa($user,WikiUserClassname())) {
253 $this->_setUser($user); // success!
257 // login or logout or restore state
258 function _setUser ($user) {
259 $this->_user = $user;
260 $this->setCookieVar('WIKI_ID', $user->getAuthenticatedId(), 365);
261 $this->setSessionVar('wiki_user', $user);
262 if ($user->isSignedIn())
263 $user->_authhow = 'signin';
265 // Save userid to prefs..
266 if (!($this->_prefs = $this->_user->getPreferences()))
267 $this->_prefs = $this->_user->_prefs;
268 $this->_prefs->set('userid',
269 $user->isSignedIn() ? $user->getId() : '');
270 $this->initializeTheme();
273 /* Permission system */
275 function _notAuthorized ($require_level) {
276 // Display the authority message in the Wiki's default
277 // language, in case it is not english.
279 // Note that normally a user will not see such an error once
280 // logged in, unless the admin has altered the default
281 // disallowed wikiactions. In that case we should probably
282 // check the user's language prefs too at this point; this
283 // would be a situation which is not really handled with the
285 if (empty($GLOBALS['LANG']))
286 update_locale(DEFAULT_LANGUAGE);
288 // User does not have required authority. Prompt for login.
289 $what = $this->getActionDescription($this->getArg('action'));
291 if ($require_level == WIKIAUTH_FORBIDDEN) {
292 $this->finish(fmt("%s is disallowed on this wiki.",
293 $this->getDisallowedActionDescription($this->getArg('action'))));
295 elseif ($require_level == WIKIAUTH_BOGO)
296 $msg = fmt("You must sign in to %s.", $what);
297 elseif ($require_level == WIKIAUTH_USER)
298 $msg = fmt("You must log in to %s.", $what);
300 $msg = fmt("You must be an administrator to %s.", $what);
301 $pass_required = ($require_level >= WIKIAUTH_USER);
303 $this->_user->PrintLoginForm($this, compact('require_level','pass_required'), $msg);
304 $this->finish(); // NORETURN
307 // Fixme: for PagePermissions we'll need other strings,
308 // relevant to the requested page, not just for the action on the whole wiki.
309 function getActionDescription($action) {
310 static $actionDescriptions;
311 if (! $actionDescriptions) {
313 = array('browse' => _("view this page"),
314 'diff' => _("diff this page"),
315 'dumphtml' => _("dump html pages"),
316 'dumpserial' => _("dump serial pages"),
317 'edit' => _("edit this page"),
318 'create' => _("create this page"),
319 'loadfile' => _("load files into this wiki"),
320 'lock' => _("lock this page"),
321 'remove' => _("remove this page"),
322 'unlock' => _("unlock this page"),
323 'upload' => _("upload a zip dump"),
324 'verify' => _("verify the current action"),
325 'viewsource' => _("view the source of this page"),
326 'xmlrpc' => _("access this wiki via XML-RPC"),
327 'zip' => _("download a zip dump from this wiki"),
328 'ziphtml' => _("download an html zip dump from this wiki")
331 if (in_array($action, array_keys($actionDescriptions)))
332 return $actionDescriptions[$action];
336 function getDisallowedActionDescription($action) {
337 static $disallowedActionDescriptions;
338 if (! $disallowedActionDescriptions) {
339 $disallowedActionDescriptions
340 = array('browse' => _("Browsing pages"),
341 'diff' => _("Diffing pages"),
342 'dumphtml' => _("Dumping html pages"),
343 'dumpserial' => _("Dumping serial pages"),
344 'edit' => _("Editing pages"),
345 'create' => _("Creating pages"),
346 'loadfile' => _("Loading files"),
347 'lock' => _("Locking pages"),
348 'remove' => _("Removing pages"),
349 'unlock' => _("Unlocking pages"),
350 'upload' => _("Uploading zip dumps"),
351 'verify' => _("Verify the current action"),
352 'viewsource' => _("Viewing the source of pages"),
353 'xmlrpc' => _("XML-RPC access"),
354 'zip' => _("Downloading zip dumps"),
355 'ziphtml' => _("Downloading html zip dumps")
358 if (in_array($action, array_keys($disallowedActionDescriptions)))
359 return $disallowedActionDescriptions[$action];
364 function requiredAuthority ($action) {
365 $auth = $this->requiredAuthorityForAction($action);
366 if (!ALLOW_ANON_USER) return WIKIAUTH_USER;
369 * This is a hook for plugins to require authority
370 * for posting to them.
372 * IMPORTANT: this is not a secure check, so the plugin
373 * may not assume that any POSTs to it are authorized.
374 * All this does is cause PhpWiki to prompt for login
375 * if the user doesn't have the required authority.
377 if ($this->isPost()) {
378 $post_auth = $this->getArg('require_authority_for_post');
379 if ($post_auth !== false)
380 $auth = max($auth, $post_auth);
385 function requiredAuthorityForAction ($action) {
386 if (class_exists("PagePermission")) {
387 return requiredAuthorityForPage($action);
397 return WIKIAUTH_ANON;
401 if (defined('ZIPDUMP_AUTH') && ZIPDUMP_AUTH)
402 return WIKIAUTH_ADMIN;
403 return WIKIAUTH_ANON;
406 if (defined('REQUIRE_SIGNIN_BEFORE_EDIT') && REQUIRE_SIGNIN_BEFORE_EDIT)
407 return WIKIAUTH_BOGO;
408 return WIKIAUTH_ANON;
409 // return WIKIAUTH_BOGO;
412 $page = $this->getPage();
413 $current = $page->getCurrentRevision();
414 if ($current->hasDefaultContents())
415 return $this->requiredAuthorityForAction('edit');
416 return $this->requiredAuthorityForAction('browse');
426 return WIKIAUTH_ADMIN;
428 global $WikiNameRegexp;
429 if (preg_match("/$WikiNameRegexp\Z/A", $action))
430 return WIKIAUTH_ANON; // ActionPage.
432 return WIKIAUTH_ADMIN;
436 /* End of Permission system */
438 function possiblyDeflowerVirginWiki () {
439 if ($this->getArg('action') != 'browse')
441 if ($this->getArg('pagename') != HOME_PAGE)
444 $page = $this->getPage();
445 $current = $page->getCurrentRevision();
446 if ($current->getVersion() > 0)
447 return; // Homepage exists.
449 include('lib/loadsave.php');
451 $this->finish(); // NORETURN
454 function handleAction () {
455 $action = $this->getArg('action');
456 $method = "action_$action";
457 if (method_exists($this, $method)) {
460 elseif ($page = $this->findActionPage($action)) {
461 $this->actionpage($page);
464 $this->finish(fmt("%s: Bad action", $action));
468 function finish ($errormsg = false) {
472 exit(); // just in case CloseDataBase calls us
475 if (!empty($this->_dbi))
476 $this->_dbi->close();
480 global $ErrorManager;
481 $ErrorManager->flushPostponedErrors();
483 if (!empty($errormsg)) {
486 HTML::h2(_("Fatal PhpWiki Error")),
489 echo "\n</body></html>";
496 function _deducePagename () {
497 if ($this->getArg('pagename'))
498 return $this->getArg('pagename');
501 $pathinfo = $this->get('PATH_INFO');
502 $tail = substr($pathinfo, strlen(PATH_INFO_PREFIX));
504 if ($tail != '' and $pathinfo == PATH_INFO_PREFIX . $tail) {
508 elseif ($this->isPost()) {
510 * In general, for security reasons, HTTP_GET_VARS should be ignored
511 * on POST requests, but we make an exception here (only for pagename).
513 * The justifcation for this hack is the following
514 * asymmetry: When POSTing with USE_PATH_INFO set, the
515 * pagename can (and should) be communicated through the
516 * request URL via PATH_INFO. When POSTing with
517 * USE_PATH_INFO off, this cannot be done --- the only way
518 * to communicate the pagename through the URL is via
519 * QUERY_ARGS (HTTP_GET_VARS).
521 global $HTTP_GET_VARS;
522 if (isset($HTTP_GET_VARS['pagename'])) {
523 return $HTTP_GET_VARS['pagename'];
528 * Support for PhpWiki 1.2 style requests.
530 $query_string = $this->get('QUERY_STRING');
531 if (preg_match('/^[^&=]+$/', $query_string)) {
532 return urldecode($query_string);
538 function _deduceAction () {
539 if (!($action = $this->getArg('action'))) {
540 // Detect XML-RPC requests
542 && $this->get('CONTENT_TYPE') == 'text/xml') {
543 global $HTTP_RAW_POST_DATA;
544 if (strstr($HTTP_RAW_POST_DATA, '<methodCall>')) {
549 return 'browse'; // Default if no action specified.
552 if (method_exists($this, "action_$action"))
555 // Allow for, e.g. action=LikePages
556 if ($this->isActionPage($action))
559 trigger_error("$action: Unknown action", E_USER_NOTICE);
563 function _deduceUsername() {
564 if (!empty($this->args['auth']) and !empty($this->args['auth']['userid']))
565 return $this->args['auth']['userid'];
566 if (!empty($_SERVER['PHP_AUTH_USER']))
567 return $_SERVER['PHP_AUTH_USER'];
568 if (!empty($_ENV['REMOTE_USER']))
569 return $_ENV['REMOTE_USER'];
571 if ($user = $this->getSessionVar('wiki_user')) {
572 $this->_user = $user;
573 $this->_user->_authhow = 'session';
574 return ENABLE_USER_NEW ? $user->UserName() : $this->_user;
576 if ($userid = $this->getCookieVar('WIKI_ID')) {
577 if (!empty($userid) and substr($userid,0,2) != 's:') {
578 $this->_user->authhow = 'cookie';
585 function _isActionPage ($pagename) {
586 $dbi = $this->getDbh();
587 $page = $dbi->getPage($pagename);
588 $rev = $page->getCurrentRevision();
589 // FIXME: more restrictive check for sane plugin?
590 if (strstr($rev->getPackedContent(), '<?plugin'))
592 if (!$rev->hasDefaultContents())
593 trigger_error("$pagename: Does not appear to be an 'action page'", E_USER_NOTICE);
597 function findActionPage ($action) {
600 // check for translated version, as per users preferred language
601 // (or system default in case it is not en)
602 $translation = gettext($action);
604 if (isset($cache) and isset($cache[$translation]))
605 return $cache[$translation];
607 // check for cached translated version
608 if ($this->_isActionPage($translation))
609 return $cache[$action] = $translation;
611 // Allow for, e.g. action=LikePages
612 global $WikiNameRegexp;
613 if (!preg_match("/$WikiNameRegexp\\Z/A", $action))
614 return $cache[$action] = false;
616 // check for translated version (default language)
618 if ($LANG != DEFAULT_LANGUAGE and $LANG != "en") {
620 //trigger_error("DEBUG: findActionPage() ". DEFAULT_LANGUAGE." calling update_locale()...");
621 update_locale(DEFAULT_LANGUAGE);
622 $default = gettext($action);
623 //trigger_error("DEBUG: findActionPage() ". $save_lang." restoring save_lang, calling update_locale()...");
624 update_locale($save_lang);
625 if ($this->_isActionPage($default))
626 return $cache[$action] = $default;
629 $default = $translation;
632 // check for english version
633 if ($action != $translation and $action != $default) {
634 if ($this->_isActionPage($action))
635 return $cache[$action] = $action;
638 trigger_error("$action: Cannot find action page", E_USER_NOTICE);
639 return $cache[$action] = false;
642 function isActionPage ($pagename) {
643 return $this->findActionPage($pagename);
646 function action_browse () {
647 $this->buffer_output();
648 include_once("lib/display.php");
652 function action_verify () {
653 $this->action_browse();
656 function actionpage ($action) {
657 $this->buffer_output();
658 include_once("lib/display.php");
659 actionPage($this, $action);
662 function action_diff () {
663 $this->buffer_output();
664 include_once "lib/diff.php";
668 function action_search () {
669 // This is obsolete: reformulate URL and redirect.
670 // FIXME: this whole section should probably be deleted.
671 if ($this->getArg('searchtype') == 'full') {
672 $search_page = _("FullTextSearch");
675 $search_page = _("TitleSearch");
677 $this->redirect(WikiURL($search_page,
678 array('s' => $this->getArg('searchterm')),
682 function action_edit () {
683 $this->buffer_output();
684 include "lib/editpage.php";
685 $e = new PageEditor ($this);
689 function action_create () {
690 $this->action_edit();
693 function action_viewsource () {
694 $this->buffer_output();
695 include "lib/editpage.php";
696 $e = new PageEditor ($this);
700 function action_lock () {
701 $page = $this->getPage();
702 $page->set('locked', true);
703 $this->action_browse();
706 function action_unlock () {
707 // FIXME: This check is redundant.
708 //$user->requireAuth(WIKIAUTH_ADMIN);
709 $page = $this->getPage();
710 $page->set('locked', false);
711 $this->action_browse();
714 function action_remove () {
715 // FIXME: This check is redundant.
716 //$user->requireAuth(WIKIAUTH_ADMIN);
717 $pagename = $this->getArg('pagename');
718 if (strstr($pagename,_('PhpWikiAdministration'))) {
719 $this->action_browse();
721 include('lib/removepage.php');
726 function action_xmlrpc () {
727 include_once("lib/XmlRpcServer.php");
728 $xmlrpc = new XmlRpcServer($this);
732 function action_zip () {
733 include_once("lib/loadsave.php");
735 // I don't think it hurts to add cruft at the end of the zip file.
736 echo "\n========================================================\n";
737 echo "PhpWiki " . PHPWIKI_VERSION . " source:\n$GLOBALS[RCS_IDS]\n";
740 function action_ziphtml () {
741 include_once("lib/loadsave.php");
742 MakeWikiZipHtml($this);
743 // I don't think it hurts to add cruft at the end of the zip file.
744 echo "\n========================================================\n";
745 echo "PhpWiki " . PHPWIKI_VERSION . " source:\n$GLOBALS[RCS_IDS]\n";
748 function action_dumpserial () {
749 include_once("lib/loadsave.php");
753 function action_dumphtml () {
754 include_once("lib/loadsave.php");
755 DumpHtmlToDir($this);
758 function action_upload () {
759 include_once("lib/loadsave.php");
763 function action_upgrade () {
764 include_once("lib/loadsave.php");
765 include_once("lib/upgrade.php");
769 function action_loadfile () {
770 include_once("lib/loadsave.php");
771 LoadFileOrDir($this);
776 function is_safe_action ($action) {
777 return WikiRequest::requiredAuthorityForAction($action) < WIKIAUTH_ADMIN;
780 function validateSessionPath() {
781 // Try to defer any session.save_path PHP errors before any html
782 // is output, which causes some versions of IE to display a blank
783 // page (due to its strict mode while parsing a page?).
784 if (! is_writeable(ini_get('session.save_path'))) {
787 (sprintf(_("%s is not writable."),
788 _("The session.save_path directory"))
790 . sprintf(_("Please ensure that %s is writable, or redefine %s in index.php."),
791 sprintf(_("the directory '%s'"),
792 ini_get('session.save_path')),
795 . sprintf(_("Attempting to use the directory '%s' instead."),
798 if (! is_writeable($tmpdir)) {
800 (sprintf(_("%s is not writable."), $tmpdir)
802 . _("Users will not be able to sign in.")
806 ini_set('session.save_path', $tmpdir);
812 validateSessionPath();
816 $request = new WikiRequest();
819 * Allow for disabling of markup cache.
820 * (Mostly for debugging ... hopefully.)
822 * See also <?plugin WikiAdminUtils action=purge-cache ?>
824 if (!defined('WIKIDB_NOCACHE_MARKUP') and $request->getArg('nocache'))
825 define('WIKIDB_NOCACHE_MARKUP', $request->getArg('nocache'));
827 // Initialize with system defaults in case user not logged in.
828 // Should this go into constructor?
829 $request->initializeTheme();
831 $request->updateAuthAndPrefs();
832 $request->initializeLang();
834 // Enable the output of most of the warning messages.
835 // The warnings will screw up zip files though.
836 global $ErrorManager;
837 if (substr($request->getArg('action'), 0, 3) != 'zip') {
838 $ErrorManager->setPostponedErrorMask(E_NOTICE|E_USER_NOTICE);
839 //$ErrorManager->setPostponedErrorMask(0);
843 //if ($user->is_authenticated())
844 // $LogEntry->user = $user->getId();
846 $request->possiblyDeflowerVirginWiki();
848 if (defined('WIKI_XMLRPC') and WIKI_XMLRPC) return;
849 if (defined('WIKI_SOAP') and WIKI_SOAP) return;
851 $validators = array('wikiname' => WIKI_NAME,
852 'args' => hash($request->getArgs()),
853 'prefs' => hash($request->getPrefs()));
854 if (CACHE_CONTROL == 'STRICT') {
855 $dbi = $request->getDbh();
856 $timestamp = $dbi->getTimestamp();
857 $validators['mtime'] = $timestamp;
858 $validators['%mtime'] = (int)$timestamp;
860 // FIXME: we should try to generate strong validators when possible,
861 // but for now, our validator is weak, since equal validators do not
862 // indicate byte-level equality of content. (Due to DEBUG timing output, etc...)
864 // (If DEBUG if off, this may be a strong validator, but I'm going
865 // to go the paranoid route here pending further study and testing.)
867 $validators['%weak'] = true;
869 $request->setValidators($validators);
871 $request->handleAction();
873 if (defined('DEBUG') and DEBUG & 4) phpinfo(INFO_VARIABLES);
877 $x = error_reporting(); // why is it 1 here? should be E_ALL
878 error_reporting(E_ALL);
882 // $Log: not supported by cvs2svn $
883 // Revision 1.129 2004/04/07 23:13:19 rurban
884 // fixed pear/File_Passwd for Windows
885 // fixed FilePassUser sessions (filehandle revive) and password update
887 // Revision 1.128 2004/04/02 15:06:55 rurban
888 // fixed a nasty ADODB_mysql session update bug
889 // improved UserPreferences layout (tabled hints)
890 // fixed UserPreferences auth handling
891 // improved auth stability
892 // improved old cookie handling: fixed deletion of old cookies with paths
894 // Revision 1.127 2004/03/25 17:00:31 rurban
895 // more code to convert old-style pref array to new hash
897 // Revision 1.126 2004/03/24 19:39:03 rurban
898 // php5 workaround code (plus some interim debugging code in XmlElement)
899 // php5 doesn't work yet with the current XmlElement class constructors,
900 // WikiUserNew does work better than php4.
901 // rewrote WikiUserNew user upgrading to ease php5 update
902 // fixed pref handling in WikiUserNew
903 // added Email Notification
904 // added simple Email verification
905 // removed emailVerify userpref subclass: just a email property
906 // changed pref binary storage layout: numarray => hash of non default values
907 // print optimize message only if really done.
908 // forced new cookie policy: delete pref cookies, use only WIKI_ID as plain string.
909 // prefs should be stored in db or homepage, besides the current session.
911 // Revision 1.125 2004/03/14 16:30:52 rurban
912 // db-handle session revivification, dba fixes
914 // Revision 1.124 2004/03/12 15:48:07 rurban
915 // fixed explodePageList: wrong sortby argument order in UnfoldSubpages
916 // simplified lib/stdlib.php:explodePageList
918 // Revision 1.123 2004/03/10 15:41:27 rurban
919 // use default pref mysql table
921 // Revision 1.122 2004/03/08 18:17:09 rurban
922 // added more WikiGroup::getMembersOf methods, esp. for special groups
923 // fixed $LDAP_SET_OPTIONS
924 // fixed _AuthInfo group methods
926 // Revision 1.121 2004/03/01 13:48:45 rurban
928 // p[] consistency fix
930 // Revision 1.120 2004/03/01 10:22:41 rurban
931 // initializeTheme optimize
933 // Revision 1.119 2004/02/26 20:45:06 rurban
934 // check for ALLOW_ANON_USER = false
936 // Revision 1.118 2004/02/26 01:32:03 rurban
937 // fixed session login with old WikiUser object. strangely, the errormask gets corruoted to 1, Pear???
939 // Revision 1.117 2004/02/24 17:19:37 rurban
940 // debugging helpers only
942 // Revision 1.116 2004/02/24 15:17:14 rurban
943 // 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
945 // Revision 1.115 2004/02/15 21:34:37 rurban
946 // PageList enhanced and improved.
947 // fixed new WikiAdmin... plugins
948 // editpage, Theme with exp. htmlarea framework
949 // (htmlarea yet committed, this is really questionable)
950 // WikiUser... code with better session handling for prefs
951 // enhanced UserPreferences (again)
952 // RecentChanges for show_deleted: how should pages be deleted then?
954 // Revision 1.114 2004/02/15 17:30:13 rurban
955 // workaround for lost db connnection handle on session restauration (->_auth_dbi)
956 // fixed getPreferences() (esp. from sessions)
957 // fixed setPreferences() (update and set),
958 // fixed AdoDb DB statements,
959 // update prefs only at UserPreferences POST (for testing)
960 // unified db prefs methods (but in external pref classes yet)
962 // Revision 1.113 2004/02/12 13:05:49 rurban
963 // Rename functional for PearDB backend
964 // some other minor changes
965 // SiteMap comes with a not yet functional feature request: includepages (tbd)
967 // Revision 1.112 2004/02/09 03:58:12 rurban
968 // for now default DB_SESSION to false
970 // * not existing perms will now query the parent, and not
971 // return the default perm
972 // * added pagePermissions func which returns the object per page
973 // * added getAccessDescription
975 // * added global ->prepare (not yet used) with smart user/pref/member table prefixing.
976 // * force init of authdbh in the 2 db classes
978 // * fixed session handling (not triple auth request anymore)
979 // * don't store cookie prefs with sessions
980 // stdlib: global obj2hash helper from _AuthInfo, also needed for PagePerm
982 // Revision 1.111 2004/02/07 10:41:25 rurban
983 // fixed auth from session (still double code but works)
985 // fixed DbPassUser upgrade and policy=old
988 // Revision 1.110 2004/02/03 09:45:39 rurban
989 // LDAP cleanup, start of new Pref classes
991 // Revision 1.109 2004/01/30 19:57:58 rurban
992 // fixed DBAuthParams['pref_select']: wrong _auth_dbi object used.
994 // Revision 1.108 2004/01/28 14:34:14 rurban
995 // session table takes the common prefix
996 // + various minor stuff
997 // reallow password changing
999 // Revision 1.107 2004/01/27 23:23:39 rurban
1000 // renamed ->Username => _userid for consistency
1001 // renamed mayCheckPassword => mayCheckPass
1002 // fixed recursion problem in WikiUserNew
1003 // fixed bogo login (but not quite 100% ready yet, password storage)
1005 // Revision 1.106 2004/01/26 09:17:49 rurban
1006 // * changed stored pref representation as before.
1007 // the array of objects is 1) bigger and 2)
1008 // less portable. If we would import packed pref
1009 // objects and the object definition was changed, PHP would fail.
1010 // This doesn't happen with an simple array of non-default values.
1011 // * use $prefs->retrieve and $prefs->store methods, where retrieve
1012 // understands the interim format of array of objects also.
1013 // * simplified $prefs->get() and fixed $prefs->set()
1014 // * added $user->_userid and class '_WikiUser' portability functions
1015 // * fixed $user object ->_level upgrading, mostly using sessions.
1016 // this fixes yesterdays problems with loosing authorization level.
1017 // * fixed WikiUserNew::checkPass to return the _level
1018 // * fixed WikiUserNew::isSignedIn
1019 // * added explodePageList to class PageList, support sortby arg
1020 // * fixed UserPreferences for WikiUserNew
1021 // * fixed WikiPlugin for empty defaults array
1022 // * UnfoldSubpages: added pagename arg, renamed pages arg,
1023 // removed sort arg, support sortby arg
1025 // Revision 1.105 2004/01/25 03:57:15 rurban
1026 // WikiUserNew support (temp. ENABLE_USER_NEW constant)
1028 // Revision 1.104 2003/12/26 06:41:16 carstenklapp
1029 // Bugfix: Try to defer OS errors about session.save_path and ACCESS_LOG,
1030 // so they don't prevent IE from partially (or not at all) rendering the
1031 // page. This should help a little for the IE user who encounters trouble
1032 // when setting up a new PhpWiki for the first time.
1034 // Revision 1.103 2003/12/02 00:10:00 carstenklapp
1035 // Bugfix: Ongoing work to untangle UserPreferences/WikiUser/request code
1036 // mess: UserPreferences should take effect immediately now upon signing
1039 // Revision 1.102 2003/11/25 22:55:32 carstenklapp
1040 // Localization bugfix: For wikis where English is not the default system
1041 // language, make sure that the authority error message (i.e. "You must
1042 // sign in to edit pages in this wiki" etc.) is displayed in the wiki's
1043 // default language. Previously it would always display in English.
1044 // (Added call to update_locale() before displaying any messages prior to
1045 // the login prompt.)
1047 // Revision 1.101 2003/11/25 21:49:44 carstenklapp
1048 // Bugfix: For a non-english wiki or when the user's preference is not
1049 // english, the wiki would always use the english ActionPage first if it
1050 // was present rather than the appropriate localised variant. (PhpWikis
1051 // running only in english or Wikis running ONLY without any english
1052 // ActionPages would not notice this bug, only when both english and
1053 // localised ActionPages were in the DB.) Now we check for the localised
1056 // Revision 1.100 2003/11/18 16:54:18 carstenklapp
1057 // Reformatting only: Tabs to spaces, added rcs log.
1064 // c-basic-offset: 4
1065 // c-hanging-comment-ender-p: nil
1066 // indent-tabs-mode: nil