diff --git a/Makefile b/Makefile index afdffcb..e147140 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ SRCFILES=admin/common.inc.php,admin/directories.php,admin/getgroups.php,admin/in apidoc: if [ -d apidoc ]; then rm -r apidoc; fi - phpdoc -f $(SRCFILES) -t apidoc -s + phpdoc -f $(SRCFILES) -t apidoc --undocumentedelements on -s clean: find -name '*~' -type f -exec rm {} \; diff --git a/admin/users.php b/admin/users.php index c5056f3..6e2bc28 100644 --- a/admin/users.php +++ b/admin/users.php @@ -30,7 +30,14 @@ /** Include common code. */ include_once('common.inc.php'); -function getGroups($username) { +/** + * Gets the names of the given users's groups from the group file. + * + * @param string $username user name + * @return array of group names + * @access private + */ +function _getGroupNames($username) { $groupdata = file($GLOBALS['davconfig']['group.file']); $retval = array(); foreach ($groupdata as $line) { @@ -58,7 +65,7 @@ function getUserData($uid) { } $row = $GLOBALS['namemap'][$uid]; - $groups = getGroups($row['username']); + $groups = _getGroupNames($row['username']); $retval = sprintf('%d%s%s%s%s0', $uid, $row['username'], $row['firstname'], $row['lastname'], implode(", ", $groups)); @@ -121,7 +128,7 @@ function validateUserData(&$userdata, $forinsert) { } /** - * Creates an entry for a digest authentication file. + * Create an entry for a digest authentication file. * * @param string $username user name * @param string $realm realm name @@ -133,12 +140,20 @@ function createDigest($username, $realm, $password) { md5(sprintf("%s:%s:%s", $username, $realm, $password))); } +/** + * Update the user to name mapping file. + */ function updateNameMap() { $fh = fopen($GLOBALS['davconfig']['namemap.file'], 'w'); fwrite($fh, json_encode($GLOBALS['namemap'])); fclose($fh); } +/** + * Update the digest file with the user information. + * + * @param &array reference to an associative array of user data + */ function updateDigest(&$userdata) { if ($userdata['password']) { $digests = file($GLOBALS['davconfig']['digest.file']); @@ -165,6 +180,11 @@ function updateDigest(&$userdata) { } } +/** + * Update the group file with the group assignments of the user. + * + * @param &array reference to an associative array of user data + */ function updateGroups(&$userdata) { if ($userdata['groups']) { $written = array(); @@ -255,6 +275,11 @@ function insertUser(&$userdata) { return $uid; } +/** + * Remove the digest entries of the given user from the digest file. + * + * @param string $username + */ function removeDigest($username) { $digests = file($GLOBALS['davconfig']['digest.file']); $fh = fopen($GLOBALS['davconfig']['digest.file'], 'w'); @@ -268,6 +293,11 @@ function removeDigest($username) { fclose($fh); } +/** + * Remove the given user from all groups in the group file. + * + * @param string $username + */ function removeFromGroups($username) { $groupdata = file($GLOBALS['davconfig']['group.file']); $fh = fopen($GLOBALS['davconfig']['group.file'], 'w');