From eedc085142d1ec37ac60b5f80b26c3fdddb5bc4a Mon Sep 17 00:00:00 2001 From: rurban Date: Wed, 2 Jun 2004 18:01:46 +0000 Subject: [PATCH] init global FileFinder to add proper include paths at startup adds PHPWIKI_DIR if started from another dir, lib/pear also fix slashify for Windows fix USER_AUTH_POLICY=old, use only USER_AUTH_ORDER methods (besides HttpAuth) git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3582 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/ErrorManager.php | 11 ++++++++--- lib/FileFinder.php | 18 ++++++++++++++---- lib/IniConfig.php | 15 ++++++++++++++- lib/WikiUserNew.php | 23 +++++++++++++++-------- lib/config.php | 9 ++++++--- lib/main.php | 9 +++++++-- 6 files changed, 64 insertions(+), 21 deletions(-) diff --git a/lib/ErrorManager.php b/lib/ErrorManager.php index 58db3df5c..0e0ab0a3f 100644 --- a/lib/ErrorManager.php +++ b/lib/ErrorManager.php @@ -1,4 +1,4 @@ -getParam and WikiDB->getAuthParam method to get rid of globals diff --git a/lib/FileFinder.php b/lib/FileFinder.php index cdb54e662..712e2e810 100644 --- a/lib/FileFinder.php +++ b/lib/FileFinder.php @@ -1,4 +1,4 @@ -forcePathSlashes($dir,$sep); } return $result; } else { - if ($this->_isOtherPathsep()) { + if (isWindows() or $this->_isOtherPathsep()) { if (isMac()) $from = ":"; elseif (isWindows()) $from = "\\"; else $from = "\\"; @@ -197,7 +197,7 @@ class FileFinder function _search_path ($file) { foreach ($this->_path as $dir) { // ensure we use the same pathsep - if ($this->_pathsep != '/') { + if ($this->_isOtherPathsep()) { $dir = $this->slashifyPath($dir); $file = $this->slashifyPath($file); if (file_exists($dir . $this->_pathsep . $file)) @@ -442,7 +442,8 @@ function FindFile ($file, $missing_okay = false, $slashify = false) $finder->_append_to_include_path($wikidir); $finder->_append_to_include_path(dirname(__FILE__)."/pear"); // Don't override existing INCLUDE_PATH config. - define("INCLUDE_PATH", implode($finder->_get_ini_separator(), $finder->_path)); + if (!defined("INCLUDE_PATH")) + define("INCLUDE_PATH", implode($finder->_get_ini_separator(), $finder->_path)); } $s = $finder->findFile($file, $missing_okay); if ($slashify) @@ -554,6 +555,15 @@ function isCygwin() { } // $Log: not supported by cvs2svn $ +// Revision 1.20 2004/05/27 17:49:05 rurban +// renamed DB_Session to DbSession (in CVS also) +// added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals +// remove leading slash in error message +// added force_unlock parameter to File_Passwd (no return on stale locks) +// fixed adodb session AffectedRows +// added FileFinder helpers to unify local filenames and DATA_PATH names +// editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR +// // // Local Variables: diff --git a/lib/IniConfig.php b/lib/IniConfig.php index 817dab5ac..b83863eba 100644 --- a/lib/IniConfig.php +++ b/lib/IniConfig.php @@ -1,5 +1,5 @@ getParam and WikiDB->getAuthParam method to get rid of globals +// remove leading slash in error message +// added force_unlock parameter to File_Passwd (no return on stale locks) +// fixed adodb session AffectedRows +// added FileFinder helpers to unify local filenames and DATA_PATH names +// editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR +// // Revision 1.24 2004/05/18 13:33:13 rurban // we already have a CGI function // diff --git a/lib/WikiUserNew.php b/lib/WikiUserNew.php index e33cc11d2..ad28de08a 100644 --- a/lib/WikiUserNew.php +++ b/lib/WikiUserNew.php @@ -1,5 +1,5 @@ nextClass(); return new $class($UserName,$this->_prefs); } - // use the default behaviour from the previous versions: + // Use the default behaviour from the previous versions: elseif (USER_AUTH_POLICY === 'old') { - // default: try to be smart + // Default: try to be smart // On php5 we can directly return and upgrade the Object, // before we have to upgrade it manually. - if (!empty($GLOBALS['PHP_AUTH_USER'])) { + if (!empty($GLOBALS['PHP_AUTH_USER']) or !empty($_SERVER['REMOTE_USER'])) { if (check_php_version(5)) return new _HttpAuthPassUser($UserName,$this->_prefs); else { @@ -876,7 +876,8 @@ extends _AnonUser /*PHP5 patch*/$this = $user; return $user; } - } elseif ($dbh->getAuthParam('auth_check') and + } elseif (in_array('Db', $dbh->getAuthParam('USER_AUTH_ORDER')) and + $dbh->getAuthParam('auth_check') and ($dbh->getAuthParam('auth_dsn') or $dbh->getParam('dsn'))) { if (check_php_version(5)) return new _DbPassUser($UserName,$this->_prefs); @@ -886,7 +887,8 @@ extends _AnonUser /*PHP5 patch*/$this = $user; return $user; } - } elseif (defined('LDAP_AUTH_HOST') and defined('LDAP_BASE_DN') and + } elseif (in_array('LDAP', $dbh->getAuthParam('USER_AUTH_ORDER')) and + defined('LDAP_AUTH_HOST') and defined('LDAP_BASE_DN') and function_exists('ldap_open')) { if (check_php_version(5)) return new _LDAPPassUser($UserName,$this->_prefs); @@ -896,7 +898,8 @@ extends _AnonUser /*PHP5 patch*/$this = $user; return $user; } - } elseif (defined('IMAP_AUTH_HOST') and function_exists('imap_open')) { + } elseif (in_array('IMAP', $dbh->getAuthParam('USER_AUTH_ORDER')) and + defined('IMAP_AUTH_HOST') and function_exists('imap_open')) { if (check_php_version(5)) return new _IMAPPassUser($UserName,$this->_prefs); else { @@ -905,7 +908,8 @@ extends _AnonUser /*PHP5 patch*/$this = $user; return $user; } - } elseif (defined('AUTH_USER_FILE') and file_exists(AUTH_USER_FILE)) { + } elseif (in_array('File', $dbh->getAuthParam('USER_AUTH_ORDER')) and + defined('AUTH_USER_FILE') and file_exists(AUTH_USER_FILE)) { if (check_php_version(5)) return new _FilePassUser($UserName, $this->_prefs); else { @@ -2913,6 +2917,9 @@ extends UserPreferences // $Log: not supported by cvs2svn $ +// Revision 1.80 2004/06/02 14:20:27 rurban +// fix adodb DbPassUser login +// // Revision 1.79 2004/06/01 15:27:59 rurban // AdminUser only ADMIN_USER not member of Administrators // some RateIt improvements by dfrankow diff --git a/lib/config.php b/lib/config.php index 5db7f778d..601d8e127 100644 --- a/lib/config.php +++ b/lib/config.php @@ -1,5 +1,5 @@ getParam and WikiDB->getAuthParam method to get rid of globals -- 2.45.2