From: <var...@us...> - 2008-09-07 14:45:50
|
Revision: 6245 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6245&view=rev Author: vargenau Date: 2008-09-07 14:45:58 +0000 (Sun, 07 Sep 2008) Log Message: ----------- Removed history Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2008-09-07 11:17:06 UTC (rev 6244) +++ trunk/lib/WikiGroup.php 2008-09-07 14:45:58 UTC (rev 6245) @@ -1101,232 +1101,6 @@ } } -// $Log: not supported by cvs2svn $ -// Revision 1.53 2005/10/29 14:17:21 rurban -// simplify message for translators -// -// Revision 1.52 2004/11/28 15:59:17 rurban -// patch by Charles Corrigan so that WikiGroup->isSpecialMember knows about CREATOR and OWNER -// -// Revision 1.51 2004/11/27 14:39:04 rurban -// simpified regex search architecture: -// no db specific node methods anymore, -// new sql() method for each node -// parallel to regexp() (which returns pcre) -// regex types bitmasked (op's not yet) -// new regex=sql -// clarified WikiDB::quote() backend methods: -// ->quote() adds surrounsing quotes -// ->qstr() (new method) assumes strings and adds no quotes! (in contrast to ADODB) -// pear and adodb have now unified quote methods for all generic queries. -// -// Revision 1.50 2004/11/24 18:58:41 rurban -// bug #1063463 -// -// Revision 1.49 2004/11/23 13:06:30 rurban -// several fixes and suggestions by Charles Corrigan: -// * fix GROUP_BOGO_USER check -// * allow group pages to have the link to the user page in [ ] brackets -// * fix up the implementation of GroupWikiPage::getMembersOf and allow the -// user page to be linked in [ ] brackets -// * added _OWNER and _CREATOR to special wikigroups -// * check against those two for group membership also, not only the user. -// -// Revision 1.48 2004/11/19 19:22:03 rurban -// ModeratePage part1: change status -// -// Revision 1.47 2004/11/19 13:23:47 rurban -// -// Another catch by Charles Corrigan: check against the dbi backend, not the WikiDB class. -// -// Revision 1.46 2004/11/18 09:52:23 rurban -// more safety, requested by Charles Corrigan -// -// Revision 1.45 2004/11/17 20:06:30 rurban -// possible group fix -// -// Revision 1.44 2004/11/11 10:31:26 rurban -// Disable default options in config-dist.ini -// Add new CATEGORY_GROUP_PAGE root page: Default: Translation of "CategoryGroup" -// Clarify more options. -// -// Revision 1.43 2004/11/10 15:29:21 rurban -// * requires newer Pear_DB (as the internal one): quote() uses now escapeSimple for strings -// * ACCESS_LOG_SQL: fix cause request not yet initialized -// * WikiDB: moved SQL specific methods upwards -// * new Pear_DB quoting: same as ADODB and as newer Pear_DB. -// fixes all around: WikiGroup, WikiUserNew SQL methods, SQL logging -// -// Revision 1.42 2004/11/01 10:43:56 rurban -// seperate PassUser methods into seperate dir (memory usage) -// fix WikiUser (old) overlarge data session -// remove wikidb arg from various page class methods, use global ->_dbi instead -// ... -// -// Revision 1.41 2004/09/17 14:21:28 rurban -// fix LDAP ou= issue, wrong strstr arg order -// -// Revision 1.40 2004/06/29 06:48:02 rurban -// Improve LDAP auth and GROUP_LDAP membership: -// no error message on false password, -// added two new config vars: LDAP_OU_USERS and LDAP_OU_GROUP with GROUP_METHOD=LDAP -// fixed two group queries (this -> user) -// stdlib: ConvertOldMarkup still flawed -// -// Revision 1.39 2004/06/28 15:39:28 rurban -// fixed endless recursion in WikiGroup: isAdmin() -// -// Revision 1.38 2004/06/27 10:24:19 rurban -// suggestion by Paul Henry -// -// Revision 1.37 2004/06/25 14:29:18 rurban -// WikiGroup refactoring: -// global group attached to user, code for not_current user. -// improved helpers for special groups (avoid double invocations) -// new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write()) -// fixed a XHTML validation error on userprefs.tmpl -// -// Revision 1.36 2004/06/16 13:21:05 rurban -// stabilize on failing ldap queries or bind -// -// Revision 1.35 2004/06/16 12:08:25 rurban -// better desc -// -// Revision 1.34 2004/06/16 11:51:35 rurban -// catch dl error on Windows -// -// Revision 1.33 2004/06/15 10:40:35 rurban -// minor WikiGroup cleanup: no request param, start of current user independency -// -// Revision 1.32 2004/06/15 09:15:52 rurban -// IMPORTANT: fixed passwd handling for passwords stored in prefs: -// fix encrypted usage, actually store and retrieve them from db -// fix bogologin with passwd set. -// fix php crashes with call-time pass-by-reference (references wrongly used -// in declaration AND call). This affected mainly Apache2 and IIS. -// (Thanks to John Cole to detect this!) -// -// Revision 1.31 2004/06/03 18:06:29 rurban -// fix file locking issues (only needed on write) -// fixed immediate LANG and THEME in-session updates if not stored in prefs -// advanced editpage toolbars (search & replace broken) -// -// Revision 1.30 2004/06/03 09:39:51 rurban -// fix LDAP injection (wildcard in username) detected by Steve Christey, MITRE -// -// Revision 1.29 2004/05/16 22:07:35 rurban -// check more config-default and predefined constants -// various PagePerm fixes: -// fix default PagePerms, esp. edit and view for Bogo and Password users -// implemented Creator and Owner -// BOGOUSERS renamed to BOGOUSER -// fixed syntax errors in signin.tmpl -// -// Revision 1.28 2004/05/15 22:54:49 rurban -// fixed important WikiDB bug with DEBUG > 0: wrong assertion -// improved SetAcl (works) and PagePerms, some WikiGroup helpers. -// -// Revision 1.27 2004/05/06 13:56:40 rurban -// Enable the Administrators group, and add the WIKIPAGE group default root page. -// -// Revision 1.26 2004/04/07 23:13:18 rurban -// fixed pear/File_Passwd for Windows -// fixed FilePassUser sessions (filehandle revive) and password update -// -// Revision 1.25 2004/03/29 10:40:36 rurban -// GroupDb_PearDB fetchmode fix -// -// Revision 1.24 2004/03/14 16:26:22 rurban -// copyright line -// -// Revision 1.23 2004/03/12 23:20:58 rurban -// pref fixes (base64) -// -// Revision 1.22 2004/03/12 15:48:07 rurban -// fixed explodePageList: wrong sortby argument order in UnfoldSubpages -// simplified lib/stdlib.php:explodePageList -// -// Revision 1.21 2004/03/12 11:18:24 rurban -// fixed ->membership chache -// -// Revision 1.20 2004/03/12 10:47:30 rurban -// fixed GroupDB for ADODB -// -// Revision 1.19 2004/03/11 16:27:30 rurban -// fixed GroupFile::getMembersOf for special groups -// added authenticated bind for GroupLdap (Windows AD) as in WikiUserNew -// -// Revision 1.18 2004/03/11 13:30:47 rurban -// fixed File Auth for user and group -// missing only getMembersOf(Authenticated Users),getMembersOf(Every),getMembersOf(Signed Users) -// -// Revision 1.17 2004/03/10 15:38:48 rurban -// store current user->page and ->action in session for WhoIsOnline -// better WhoIsOnline icon -// fixed WhoIsOnline warnings -// -// Revision 1.15 2004/03/09 12:11:57 rurban -// prevent from undefined DBAuthParams warning -// -// Revision 1.14 2004/03/08 19:30:01 rurban -// fixed Theme->getButtonURL -// AllUsers uses now WikiGroup (also DB User and DB Pref users) -// PageList fix for empty pagenames -// -// Revision 1.13 2004/03/08 18:17:09 rurban -// added more WikiGroup::getMembersOf methods, esp. for special groups -// fixed $LDAP_SET_OPTIONS -// fixed _AuthInfo group methods -// -// Revision 1.12 2004/02/23 21:30:25 rurban -// more PagePerm stuff: (working against 1.4.0) -// ACL editing and simplification of ACL's to simple rwx------ string -// not yet working. -// -// Revision 1.11 2004/02/07 10:41:25 rurban -// fixed auth from session (still double code but works) -// fixed GroupDB -// fixed DbPassUser upgrade and policy=old -// added GroupLdap -// -// Revision 1.10 2004/02/03 09:45:39 rurban -// LDAP cleanup, start of new Pref classes -// -// Revision 1.9 2004/02/01 09:14:11 rurban -// Started with Group_Ldap (not yet ready) -// added new _AuthInfo plugin to help in auth problems (warning: may display passwords) -// fixed some configurator vars -// renamed LDAP_AUTH_SEARCH to LDAP_BASE_DN -// changed PHPWIKI_VERSION from 1.3.8a to 1.3.8pre -// USE_DB_SESSION defaults to true on SQL -// changed GROUP_METHOD definition to string, not constants -// changed sample user DBAuthParams from UPDATE to REPLACE to be able to -// create users. (Not to be used with external databases generally, but -// with the default internal user table) -// -// fixed the IndexAsConfigProblem logic. this was flawed: -// scripts which are the same virtual path defined their own lib/main call -// (hmm, have to test this better, phpwiki.sf.net/demo works again) -// -// Revision 1.8 2004/01/27 23:23:39 rurban -// renamed ->Username => _userid for consistency -// renamed mayCheckPassword => mayCheckPass -// fixed recursion problem in WikiUserNew -// fixed bogo login (but not quite 100% ready yet, password storage) -// -// Revision 1.7 2004/01/26 16:52:40 rurban -// added GroupDB and GroupFile classes -// -// Revision 1.6 2003/12/07 19:29:11 carstenklapp -// Code Housecleaning: fixed syntax errors. (php -l *.php) -// -// Revision 1.5 2003/02/22 20:49:55 dairiki -// Fixes for "Call-time pass by reference has been deprecated" errors. -// -// Revision 1.4 2003/01/21 04:02:39 zorloc -// Added Log entry and page footer. -// - // Local Variables: // mode: php // tab-width: 8 @@ -1334,4 +1108,4 @@ // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-08-09 16:40:23
|
Revision: 7635 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7635&view=rev Author: vargenau Date: 2010-08-09 16:40:16 +0000 (Mon, 09 Aug 2010) Log Message: ----------- GROUP_HASHOMEPAGE is not used Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2010-08-09 15:30:20 UTC (rev 7634) +++ trunk/lib/WikiGroup.php 2010-08-09 16:40:16 UTC (rev 7635) @@ -1,7 +1,8 @@ <?php -// rcs_id('$Id$'); +// $Id$' /* * Copyright (C) 2003, 2004 $ThePhpWikiProgrammingTeam + * Copyright (C) 2010 Marc-Etienne Vargenau, Alcatel-Lucent * * This file is part of PhpWiki. * @@ -20,16 +21,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -if (!defined('GROUP_METHOD') or +if (!defined('GROUP_METHOD') or !in_array(GROUP_METHOD, array('NONE','WIKIPAGE','DB','FILE','LDAP'))) trigger_error(_("No or unsupported GROUP_METHOD defined"), E_USER_WARNING); - -/* Special group names for ACL */ + +/* Special group names for ACL */ define('GROUP_EVERY', _("Every")); define('GROUP_ANONYMOUS', _("Anonymous Users")); define('GROUP_BOGOUSER', _("Bogo Users")); -define('GROUP_HASHOMEPAGE', _("HasHomePage")); define('GROUP_SIGNED', _("Signed Users")); define('GROUP_AUTHENTICATED', _("Authenticated Users")); define('GROUP_ADMIN', _("Administrators")); @@ -40,9 +40,9 @@ * WikiGroup is an abstract class to provide the base functions for determining * group membership for a specific user. Some functions are user independent. * - * Limitation: For the current user only. This must be fixed to be able to query + * Limitation: For the current user only. This must be fixed to be able to query * for membership of any user. - * + * * WikiGroup is an abstract class with three functions: * <ol><li />Provide the static method getGroup with will return the proper * subclass. @@ -54,7 +54,7 @@ * * @author Joby Walker <zo...@im...> * @author Reini Urban - */ + */ class WikiGroup{ /** User name */ var $username = ''; @@ -66,12 +66,12 @@ var $membership; /** boolean if not the current user */ var $not_current = false; - + /** * Initializes a WikiGroup object which should never happen. Use: * $group = &WikiGroup::getGroup(); * @param object $request The global WikiRequest object -- ignored. - */ + */ function WikiGroup($not_current = false) { $this->not_current = $not_current; //$this->request =& $GLOBALS['request']; @@ -82,7 +82,7 @@ * and erases $this->membership if is different than * the stored $this->username * @return string Current username. - */ + */ function _getUserName(){ global $request; $user = (!empty($this->user)) ? $this->user : $request->getUser(); @@ -95,16 +95,16 @@ $this->user = $user; return $username; } - + /** * Static method to return the WikiGroup subclass used in this wiki. Controlled * by the constant GROUP_METHOD. * @param object $request The global WikiRequest object. * @return object Subclass of WikiGroup selected via GROUP_METHOD. - */ + */ function getGroup($not_current = false){ switch (GROUP_METHOD){ - case "NONE": + case "NONE": return new GroupNone($not_current); break; case "WIKIPAGE": @@ -116,15 +116,15 @@ } elseif ($GLOBALS['DBParams']['dbtype'] == 'SQL') { return new GroupDb_PearDB($not_current); } else { - trigger_error("GROUP_METHOD = DB: Unsupported dbtype " + trigger_error("GROUP_METHOD = DB: Unsupported dbtype " . $GLOBALS['DBParams']['dbtype'], E_USER_ERROR); } break; - case "FILE": + case "FILE": return new GroupFile($not_current); break; - case "LDAP": + case "LDAP": return new GroupLDAP($not_current); break; default: @@ -134,7 +134,7 @@ } /** ACL PagePermissions will need those special groups based on the User status only. - * translated + * translated */ function specialGroup($group){ return in_array($group,$this->specialGroups()); @@ -170,12 +170,12 @@ /** * Determines if the current user is a member of a group. - * + * * This method is an abstraction. The group is ignored, an error is sent, and * false (not a member of the group) is returned. * @param string $group Name of the group to check for membership (ignored). * @return boolean True if user is a member, else false (always false). - */ + */ function isMember($group){ if (isset($this->membership[$group])) return $this->membership[$group]; @@ -201,14 +201,14 @@ case GROUP_ANONYMOUS: return $this->membership[$group] = ! $user->isSignedIn(); case GROUP_BOGOUSER: - return $this->membership[$group] = (isa($user,'_BogoUser') + return $this->membership[$group] = (isa($user,'_BogoUser') and $user->_level >= WIKIAUTH_BOGO); case GROUP_SIGNED: return $this->membership[$group] = $user->isSignedIn(); case GROUP_AUTHENTICATED: return $this->membership[$group] = $user->isAuthenticated(); case GROUP_ADMIN: - return $this->membership[$group] = (isset($user->_level) + return $this->membership[$group] = (isset($user->_level) and $user->_level == WIKIAUTH_ADMIN); case GROUP_OWNER: case GROUP_CREATOR: @@ -220,14 +220,14 @@ } return false; } - + /** * Determines all of the groups of which the current user is a member. - * - * This method is an abstraction. An error is sent and an empty + * + * This method is an abstraction. An error is sent and an empty * array is returned. * @return array Array of groups to which the user belongs (always empty). - */ + */ function getAllGroupsIn(){ trigger_error(__sprintf("Method '%s' not implemented in this GROUP_METHOD %s", 'getAllGroupsIn', GROUP_METHOD), @@ -253,7 +253,7 @@ /* WikiDB users from prefs (not from users): */ if (ENABLE_USER_NEW) $dbi = _PassUser::getAuthDbh(); - else + else $dbi = false; if ($dbi and $dbh->getAuthParam('pref_select')) { @@ -301,12 +301,12 @@ /** * Determines all of the members of a particular group. - * - * This method is an abstraction. The group is ignored, an error is sent, + * + * This method is an abstraction. The group is ignored, an error is sent, * and an empty array is returned * @param string $group Name of the group to get the full membership list of. * @return array Array of usernames that have joined the group (always empty). - */ + */ function getMembersOf($group){ if ($this->specialGroup($group)) { return $this->getSpecialMembersOf($group); @@ -316,7 +316,7 @@ E_USER_WARNING); return array(); } - + function getSpecialMembersOf($group) { //$request = &$this->request; $all = $this->_allUsers(); @@ -324,14 +324,14 @@ switch ($group) { case GROUP_EVERY: return $all; - case GROUP_ANONYMOUS: + case GROUP_ANONYMOUS: return $users; case GROUP_BOGOUSER: foreach ($all as $u) { if (isWikiWord($u)) $users[] = $u; } return $users; - case GROUP_SIGNED: + case GROUP_SIGNED: foreach ($all as $u) { $user = WikiUser($u); if ($user->isSignedIn()) $users[] = $u; @@ -343,10 +343,10 @@ if ($user->isAuthenticated()) $users[] = $u; } return $users; - case GROUP_ADMIN: + case GROUP_ADMIN: foreach ($all as $u) { $user = WikiUser($u); - if (isset($user->_level) and $user->_level == WIKIAUTH_ADMIN) + if (isset($user->_level) and $user->_level == WIKIAUTH_ADMIN) $users[] = $u; } return $users; @@ -362,29 +362,29 @@ /** * Add the current or specified user to a group. - * - * This method is an abstraction. The group and user are ignored, an error + * + * This method is an abstraction. The group and user are ignored, an error * is sent, and false (not added) is always returned. * @param string $group User added to this group. * @param string $user Username to add to the group (default = current user). * @return bool On true user was added, false if not. - */ + */ function setMemberOf($group, $user = false){ trigger_error(__sprintf("Method '%s' not implemented in this GROUP_METHOD %s", 'setMemberOf', GROUP_METHOD), E_USER_WARNING); return false; } - + /** * Remove the current or specified user to a group. - * + * * This method is an abstraction. The group and user are ignored, and error * is sent, and false (not removed) is always returned. * @param string $group User removed from this group. * @param string $user Username to remove from the group (default = current user). * @return bool On true user was removed, false if not. - */ + */ function removeMemberOf($group, $user = false){ trigger_error(__sprintf("Method '%s' not implemented in this GROUP_METHOD %s", 'removeMemberOf', GROUP_METHOD), @@ -395,31 +395,31 @@ /** * GroupNone disables all Group funtionality - * - * All of the GroupNone functions return false or empty values to indicate failure or + * + * All of the GroupNone functions return false or empty values to indicate failure or * no results. Use GroupNone if group controls are not desired. * @author Joby Walker <zo...@im...> - */ + */ class GroupNone extends WikiGroup{ /** * Constructor - * + * * Ignores the parameter provided. * @param object $request The global WikiRequest object - ignored. - */ + */ function GroupNone() { //$this->request = &$GLOBALS['request']; return; - } + } /** * Determines if the current user is a member of a group. - * + * * The group is ignored and false (not a member of the group) is returned. * @param string $group Name of the group to check for membership (ignored). * @return boolean True if user is a member, else false (always false). - */ + */ function isMember($group){ if ($this->specialGroup($group)) { return $this->isSpecialMember($group); @@ -427,25 +427,25 @@ return false; } } - + /** * Determines all of the groups of which the current user is a member. - * + * * The group is ignored and an empty array (a member of no groups) is returned. * @param string $group Name of the group to check for membership (ignored). * @return array Array of groups to which the user belongs (always empty). - */ + */ function getAllGroupsIn(){ return array(); } /** * Determines all of the members of a particular group. - * + * * The group is ignored and an empty array (a member of no groups) is returned. * @param string $group Name of the group to check for membership (ignored). * @return array Array of groups user belongs to (always empty). - */ + */ function getMembersOf($group){ return array(); } @@ -454,20 +454,20 @@ /** * GroupWikiPage provides group functionality via pages within the Wiki. - * - * GroupWikiPage is the Wiki way of managing a group. Every group will have - * a page. To modify the membership of the group, one only needs to edit the + * + * GroupWikiPage is the Wiki way of managing a group. Every group will have + * a page. To modify the membership of the group, one only needs to edit the * membership list on the page. * @author Joby Walker <zo...@im...> - */ + */ class GroupWikiPage extends WikiGroup{ - + /** * Constructor - * + * * Initializes the three superclass instance variables * @param object $request The global WikiRequest object. - */ + */ function GroupWikiPage() { //$this->request = &$GLOBALS['request']; $this->username = $this->_getUserName(); @@ -477,14 +477,14 @@ /** * Determines if the current user is a member of a group. - * - * To determine membership in a particular group, this method checks the - * superclass instance variable $membership to see if membership has - * already been determined. If not, then the group page is parsed to + * + * To determine membership in a particular group, this method checks the + * superclass instance variable $membership to see if membership has + * already been determined. If not, then the group page is parsed to * determine membership. * @param string $group Name of the group to check for membership. * @return boolean True if user is a member, else false. - */ + */ function isMember($group){ if (isset($this->membership[$group])) { return $this->membership[$group]; @@ -502,7 +502,7 @@ } return false; } - + /** * Private method to take a WikiDB_Page and parse to determine if the * current_user is a member of the group. @@ -514,7 +514,7 @@ $group_revision = $group_page->getCurrentRevision(); if ($group_revision->hasDefaultContents()) { $group = $group_page->getName(); - if ($strict) trigger_error(sprintf(_("Group page '%s' does not exist"), $group), + if ($strict) trigger_error(sprintf(_("Group page '%s' does not exist"), $group), E_USER_WARNING); return false; } @@ -527,15 +527,15 @@ } return false; } - + /** * Determines all of the groups of which the current user is a member. - * - * Checks the root Group page ('CategoryGroup') for the list of all groups, + * + * Checks the root Group page ('CategoryGroup') for the list of all groups, * then checks each group to see if the current user is a member. * @param string $group Name of the group to check for membership. * @return array Array of groups to which the user belongs. - */ + */ function getAllGroupsIn(){ $membership = array(); @@ -560,12 +560,12 @@ /** * Determines all of the members of a particular group. - * + * * Checks a group's page to return all the current members. Currently this * method is disabled and triggers an error and returns an empty array. * @param string $group Name of the group to get the full membership list of. * @return array Array of usernames that have joined the group (always empty). - */ + */ function getMembersOf($group){ if ($this->specialGroup($group)) return $this->getSpecialMembersOf($group); @@ -591,29 +591,29 @@ /** * GroupDb is configured by $DbAuthParams[] statements - * + * * Fixme: adodb * @author ReiniUrban - */ + */ class GroupDb extends WikiGroup { - + var $_is_member, $_group_members, $_user_groups; /** * Constructor - * + * * @param object $request The global WikiRequest object. ignored - */ + */ function GroupDb() { global $DBAuthParams, $DBParams; //$this->request = &$GLOBALS['request']; $this->username = $this->_getUserName(); $this->membership = array(); - if (empty($DBAuthParams['group_members']) or + if (empty($DBAuthParams['group_members']) or empty($DBAuthParams['user_groups']) or empty($DBAuthParams['is_member'])) { - trigger_error(_("No or not enough GROUP_DB SQL statements defined"), + trigger_error(_("No or not enough GROUP_DB SQL statements defined"), E_USER_WARNING); return new GroupNone(); } @@ -641,17 +641,17 @@ /** * PearDB methods - * + * * @author ReiniUrban - */ + */ class GroupDb_PearDB extends GroupDb { - + /** * Determines if the current user is a member of a database group. - * + * * @param string $group Name of the group to check for membership. * @return boolean True if user is a member, else false. - */ + */ function isMember($group) { if (isset($this->membership[$group])) { return $this->membership[$group]; @@ -670,14 +670,14 @@ return $this->isSpecialMember($group); return false; } - + /** * Determines all of the groups of which the current user is a member. - * + * * then checks each group to see if the current user is a member. * @param string $group Name of the group to check for membership. * @return array Array of groups to which the user belongs. - */ + */ function getAllGroupsIn(){ $membership = array(); @@ -701,12 +701,12 @@ /** * Determines all of the members of a particular group. - * + * * Checks a group's page to return all the current members. Currently this * method is disabled and triggers an error and returns an empty array. * @param string $group Name of the group to get the full membership list of. * @return array Array of usernames that have joined the group. - */ + */ function getMembersOf($group){ $members = array(); @@ -726,17 +726,17 @@ /** * ADODB methods - * + * * @author ReiniUrban - */ + */ class GroupDb_ADODB extends GroupDb { /** * Determines if the current user is a member of a database group. - * + * * @param string $group Name of the group to check for membership. * @return boolean True if user is a member, else false. - */ + */ function isMember($group) { if (isset($this->membership[$group])) { return $this->membership[$group]; @@ -759,14 +759,14 @@ return false; } - + /** * Determines all of the groups of which the current user is a member. * then checks each group to see if the current user is a member. * * @param string $group Name of the group to check for membership. * @return array Array of groups to which the user belongs. - */ + */ function getAllGroupsIn(){ $membership = array(); @@ -793,10 +793,10 @@ /** * Determines all of the members of a particular group. - * + * * @param string $group Name of the group to get the full membership list of. * @return array Array of usernames that have joined the group. - */ + */ function getMembersOf($group){ $members = array(); $dbh = & $this->dbh; @@ -818,16 +818,16 @@ /** * GroupFile is configured by AUTH_GROUP_FILE * groupname: user1 user2 ... - * + * * @author ReiniUrban - */ + */ class GroupFile extends WikiGroup { - + /** * Constructor - * + * * @param object $request The global WikiRequest object. - */ + */ function GroupFile(){ //$this->request = &$GLOBALS['request']; $this->username = $this->_getUserName(); @@ -840,7 +840,7 @@ return false; } if (!file_exists(AUTH_GROUP_FILE)) { - trigger_error(sprintf(_("Cannot open AUTH_GROUP_FILE %s"), AUTH_GROUP_FILE), + trigger_error(sprintf(_("Cannot open AUTH_GROUP_FILE %s"), AUTH_GROUP_FILE), E_USER_WARNING); return false; } @@ -850,14 +850,14 @@ /** * Determines if the current user is a member of a group. - * - * To determine membership in a particular group, this method checks the - * superclass instance variable $membership to see if membership has - * already been determined. If not, then the group file is parsed to + * + * To determine membership in a particular group, this method checks the + * superclass instance variable $membership to see if membership has + * already been determined. If not, then the group file is parsed to * determine membership. * @param string $group Name of the group to check for membership. * @return boolean True if user is a member, else false. - */ + */ function isMember($group) { //$request = $this->request; //$username = $this->username; @@ -879,14 +879,14 @@ return $this->isSpecialMember($group); return false; } - + /** * Determines all of the groups of which the current user is a member. - * + * * then checks each group to see if the current user is a member. * @param string $group Name of the group to check for membership. * @return array Array of groups to which the user belongs. - */ + */ function getAllGroupsIn(){ //$username = $this->_getUserName(); $membership = array(); @@ -913,11 +913,11 @@ /** * Determines all of the members of a particular group. - * + * * Return all the current members. * @param string $group Name of the group to get the full membership list of. * @return array Array of usernames that have joined the group. - */ + */ function getMembersOf($group){ $members = array(); if (!empty($this->_file->users[$group])) { @@ -932,16 +932,16 @@ /** * Ldap is configured in index.php - * + * * @author ReiniUrban - */ + */ class GroupLdap extends WikiGroup { - + /** * Constructor - * + * * @param object $request The global WikiRequest object. - */ + */ function GroupLdap(){ //$this->request = &$GLOBALS['request']; $this->username = $this->_getUserName(); @@ -956,7 +956,7 @@ // CGI does work. if (! function_exists('ldap_connect') and (!isWindows() or isCGI())) { // on MacOSX >= 4.3 you'll need PHP_SHLIB_SUFFIX instead. - dl("ldap".defined('PHP_SHLIB_SUFFIX') ? PHP_SHLIB_SUFFIX : DLL_EXT); + dl("ldap".defined('PHP_SHLIB_SUFFIX') ? PHP_SHLIB_SUFFIX : DLL_EXT); if (! function_exists('ldap_connect')) { trigger_error(_("No LDAP in this PHP version"), E_USER_WARNING); return false; @@ -974,17 +974,17 @@ if (!isset($this->user) or !isa($this->user, '_LDAPPassUser')) $this->_user = new _LDAPPassUser('LdapGroupTest'); // to have a valid username - else + else $this->_user =& $this->user; } /** * Determines if the current user is a member of a group. * Not ready yet! - * + * * @param string $group Name of the group to check for membership. * @return boolean True if user is a member, else false. - */ + */ function isMember($group) { if (isset($this->membership[$group])) { return $this->membership[$group]; @@ -997,13 +997,13 @@ if ($this->specialGroup($group)) return $this->isSpecialMember($group); } - + /** * Determines all of the groups of which the current user is a member. * * @param string $group Name of the group to check for membership. * @return array Array of groups to which the user belongs. - */ + */ function getAllGroupsIn(){ //$request = &$this->request; //$username = $this->_getUserName(); @@ -1016,13 +1016,13 @@ $membership[] = $group; } } - + // must be a valid LDAP server, and username must not contain a wildcard if ($ldap = $this->_user->_init()) { $st_search = LDAP_SEARCH_FIELD ? LDAP_SEARCH_FIELD."=".$this->username : "uid=".$this->username; $sr = ldap_search($ldap, (LDAP_OU_USERS ? LDAP_OU_USERS : "ou=Users") - .($this->base_dn ? ",".$this->base_dn : ''), + .($this->base_dn ? ",".$this->base_dn : ''), $st_search); if (!$sr) { $this->_user->_free(); @@ -1047,7 +1047,7 @@ } } } else { - trigger_error(fmt("Unable to connect to LDAP server %s", LDAP_AUTH_HOST), + trigger_error(fmt("Unable to connect to LDAP server %s", LDAP_AUTH_HOST), E_USER_WARNING); } $this->_user->_free(); @@ -1058,11 +1058,11 @@ /** * Determines all of the members of a particular group. - * + * * Return all the members of the given group. LDAP just returns the gid of each user * @param string $group Name of the group to get the full membership list of. * @return array Array of usernames that have joined the group. - */ + */ function getMembersOf($group){ $members = array(); if ($ldap = $this->_user->_init()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-11-17 15:59:04
|
Revision: 9323 http://sourceforge.net/p/phpwiki/code/9323 Author: vargenau Date: 2014-11-17 15:59:00 +0000 (Mon, 17 Nov 2014) Log Message: ----------- Add return Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2014-11-17 15:34:21 UTC (rev 9322) +++ trunk/lib/WikiGroup.php 2014-11-17 15:59:00 UTC (rev 9323) @@ -136,6 +136,7 @@ trigger_error(_("No or unsupported GROUP_METHOD defined"), E_USER_WARNING); return new WikiGroup($not_current); } + return null; } /** ACL PagePermissions will need those special groups based on the User status only. @@ -370,8 +371,8 @@ // this could get complex so just return an empty array return false; default: - trigger_error(__sprintf("Unknown special group “%s”", $group), - E_USER_WARNING); + trigger_error(__sprintf("Unknown special group “%s”", $group), E_USER_WARNING); + return false; } } @@ -558,7 +559,6 @@ } global $request; - $dbh = &$request->_dbi; $master_page = $request->getPage(CATEGORY_GROUP_PAGE); $master_list = $master_page->getLinks(true); while ($group_page = $master_list->next()) { @@ -611,13 +611,13 @@ */ class GroupDb extends WikiGroup { - public $_is_member, $_group_members, $_user_groups; function __construct() { - global $DBAuthParams, $DBParams; - //$this->request = &$GLOBALS['request']; + global $DBAuthParams; + global $request; + $this->username = $this->_getUserName(); $this->membership = array(); @@ -627,7 +627,7 @@ ) { trigger_error(_("No or not enough GROUP_DB SQL statements defined"), E_USER_WARNING); - return new GroupNone(); + return; } if (empty($this->user)) { // use _PassUser::prepare instead @@ -848,14 +848,12 @@ $this->membership = array(); if (!defined('AUTH_GROUP_FILE')) { - trigger_error(sprintf(_("%s: not defined"), "AUTH_GROUP_FILE"), - E_USER_WARNING); - return false; + trigger_error(sprintf(_("%s: not defined"), "AUTH_GROUP_FILE"), E_USER_WARNING); + return; } if (!file_exists(AUTH_GROUP_FILE)) { - trigger_error(sprintf(_("Cannot open AUTH_GROUP_FILE %s"), AUTH_GROUP_FILE), - E_USER_WARNING); - return false; + trigger_error(sprintf(_("Cannot open AUTH_GROUP_FILE %s"), AUTH_GROUP_FILE), E_USER_WARNING); + return; } require_once 'lib/pear/File_Passwd.php'; $this->_file = new File_Passwd(AUTH_GROUP_FILE, false, AUTH_GROUP_FILE . ".lock"); @@ -998,6 +996,7 @@ return true; if ($this->specialGroup($group)) return $this->isSpecialMember($group); + return false; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-11-23 20:00:59
|
Revision: 9366 http://sourceforge.net/p/phpwiki/code/9366 Author: vargenau Date: 2014-11-23 20:00:55 +0000 (Sun, 23 Nov 2014) Log Message: ----------- function getGroup is static Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2014-11-23 19:58:23 UTC (rev 9365) +++ trunk/lib/WikiGroup.php 2014-11-23 20:00:55 UTC (rev 9366) @@ -106,7 +106,7 @@ * @param bool $not_current The global WikiRequest object. * @return object Subclass of WikiGroup selected via GROUP_METHOD. */ - function getGroup($not_current = false) + static function getGroup($not_current = false) { switch (GROUP_METHOD) { case "NONE": @@ -139,21 +139,22 @@ return null; } - /** ACL PagePermissions will need those special groups based on the User status only. - * translated + /* + * ACL PagePermissions will need those special groups based on the User status only. + * translated */ function specialGroup($group) { return in_array($group, $this->specialGroups()); } - /** untranslated */ + /* untranslated */ function _specialGroup($group) { return in_array($group, $this->_specialGroups()); } - /** translated */ + /* translated */ function specialGroups() { return array( @@ -167,7 +168,7 @@ GROUP_CREATOR); } - /** untranslated */ + /* untranslated */ function _specialGroups() { return array( @@ -334,7 +335,6 @@ function getSpecialMembersOf($group) { - //$request = &$this->request; $all = $this->_allUsers(); $users = array(); switch ($group) { @@ -369,10 +369,11 @@ case GROUP_OWNER: case GROUP_CREATOR: // this could get complex so just return an empty array - return false; + return array(); default: trigger_error(__sprintf("Unknown special group “%s”", $group), E_USER_WARNING); return false; + return array(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-11-23 20:18:25
|
Revision: 9368 http://sourceforge.net/p/phpwiki/code/9368 Author: vargenau Date: 2014-11-23 20:18:22 +0000 (Sun, 23 Nov 2014) Log Message: ----------- Fix double return Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2014-11-23 20:06:27 UTC (rev 9367) +++ trunk/lib/WikiGroup.php 2014-11-23 20:18:22 UTC (rev 9368) @@ -373,7 +373,6 @@ default: trigger_error(__sprintf("Unknown special group “%s”", $group), E_USER_WARNING); return false; - return array(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-01-07 09:46:35
|
Revision: 9759 http://sourceforge.net/p/phpwiki/code/9759 Author: vargenau Date: 2016-01-07 09:46:33 +0000 (Thu, 07 Jan 2016) Log Message: ----------- Use __construct Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2016-01-07 09:38:20 UTC (rev 9758) +++ trunk/lib/WikiGroup.php 2016-01-07 09:46:33 UTC (rev 9759) @@ -62,8 +62,6 @@ public $username = ''; /** User object if different from current user */ public $user; - /** The global WikiRequest object */ - //public $request; /** Array of groups $username is confirmed to belong to */ public $membership; /** boolean if not the current user */ @@ -74,7 +72,7 @@ * $group = &WikiGroup::getGroup(); * @param bool $not_current */ - function WikiGroup($not_current = false) + function __construct($not_current = false) { $this->not_current = $not_current; } @@ -871,8 +869,6 @@ */ function isMember($group) { - //$request = $this->request; - //$username = $this->username; if (isset($this->membership[$group])) { return $this->membership[$group]; } @@ -988,8 +984,6 @@ if (isset($this->membership[$group])) { return $this->membership[$group]; } - //$request = $this->request; - //$username = $this->_getUserName(); $this->membership[$group] = in_array($this->username, $this->getMembersOf($group)); if ($this->membership[$group]) return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-24 12:48:16
|
Revision: 10323 http://sourceforge.net/p/phpwiki/code/10323 Author: vargenau Date: 2021-06-24 12:48:16 +0000 (Thu, 24 Jun 2021) Log Message: ----------- Non-static method _PassUser::getAuthDbh() should not be called statically Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2021-06-24 10:30:58 UTC (rev 10322) +++ trunk/lib/WikiGroup.php 2021-06-24 12:48:16 UTC (rev 10323) @@ -268,7 +268,8 @@ } /* WikiDB users from prefs (not from users): */ - $dbi = _PassUser::getAuthDbh(); + $user = new _PassUser(); + $dbi = $user->getAuthDbh(); if ($dbi and $dbh->getAuthParam('pref_select')) { //get prefs table This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-06 07:59:02
|
Revision: 10444 http://sourceforge.net/p/phpwiki/code/10444 Author: vargenau Date: 2021-08-06 07:59:01 +0000 (Fri, 06 Aug 2021) Log Message: ----------- lib/WikiGroup.php: remove unused functions setMemberOf and removeMemberOf Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2021-08-06 07:55:40 UTC (rev 10443) +++ trunk/lib/WikiGroup.php 2021-08-06 07:59:01 UTC (rev 10444) @@ -23,6 +23,8 @@ * */ +require_once 'lib/pear/File_Passwd.php'; + if (!defined('GROUP_METHOD') or !in_array(GROUP_METHOD, array('NONE', 'WIKIPAGE', 'DB', 'FILE', 'LDAP')) @@ -237,7 +239,7 @@ } /** - * Determines all of the groups of which the current user is a member. + * Determines all groups of which the current user is a member. * * This method is an abstraction. An error is sent and an empty * array is returned. @@ -376,39 +378,6 @@ } } - /** - * Add the current or specified user to a group. - * - * This method is an abstraction. The group and user are ignored, an error - * is sent, and false (not added) is always returned. - * @param string $group User added to this group. - * @param string $user Username to add to the group (default = current user). - * @return bool On true user was added, false if not. - */ - function setMemberOf($group, $user = '') - { - trigger_error(__sprintf("Method “%s” not implemented in this GROUP_METHOD %s", - 'setMemberOf', GROUP_METHOD), - E_USER_WARNING); - return false; - } - - /** - * Remove the current or specified user to a group. - * - * This method is an abstraction. The group and user are ignored, and error - * is sent, and false (not removed) is always returned. - * @param string $group User removed from this group. - * @param string $user Username to remove from the group (default = current user). - * @return bool On true user was removed, false if not. - */ - function removeMemberOf($group, $user = '') - { - trigger_error(__sprintf("Method “%s” not implemented in this GROUP_METHOD %s", - 'removeMemberOf', GROUP_METHOD), - E_USER_WARNING); - return false; - } } /** @@ -422,7 +391,6 @@ { function __construct() { - return; } /** @@ -856,7 +824,6 @@ trigger_error(sprintf(_("Cannot open AUTH_GROUP_FILE %s"), AUTH_GROUP_FILE), E_USER_WARNING); return; } - require_once 'lib/pear/File_Passwd.php'; $this->_file = new File_Passwd(AUTH_GROUP_FILE, false, AUTH_GROUP_FILE . ".lock"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-09-20 12:26:40
|
Revision: 10591 http://sourceforge.net/p/phpwiki/code/10591 Author: vargenau Date: 2021-09-20 12:26:39 +0000 (Mon, 20 Sep 2021) Log Message: ----------- Constructors have no parameter Modified Paths: -------------- trunk/lib/WikiGroup.php Modified: trunk/lib/WikiGroup.php =================================================================== --- trunk/lib/WikiGroup.php 2021-09-20 11:42:40 UTC (rev 10590) +++ trunk/lib/WikiGroup.php 2021-09-20 12:26:39 UTC (rev 10591) @@ -111,12 +111,12 @@ { switch (GROUP_METHOD) { case "NONE": - return new GroupNone($not_current); + return new GroupNone(); case "WIKIPAGE": - return new GroupWikiPage($not_current); + return new GroupWikiPage(); case "DB": if ($GLOBALS['DBParams']['dbtype'] == 'SQL') { - return new GroupDb_PearDB($not_current); + return new GroupDb_PearDB(); } else { trigger_error("GROUP_METHOD = DB: Unsupported dbtype " . $GLOBALS['DBParams']['dbtype'], @@ -124,9 +124,9 @@ } break; case "FILE": - return new GroupFile($not_current); + return new GroupFile(); case "LDAP": - return new GroupLDAP($not_current); + return new GroupLDAP(); default: trigger_error(_("No or unsupported GROUP_METHOD defined"), E_USER_WARNING); return new WikiGroup($not_current); @@ -520,7 +520,7 @@ global $request; $master_page = $request->getPage(CATEGORY_GROUP_PAGE); - $master_list = $master_page->getLinks(true); + $master_list = $master_page->getLinks(); while ($group_page = $master_list->next()) { $group = $group_page->getName(); $this->membership[$group] = $this->_inGroupPage($group_page); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |