$objTemplate->setText('PAGETITLE', "Groups"); if ($objUser) { $objMiniMenu->add('Create', 'index.php?action=groups&subaction=edit'); } $arrGroups = clsGroup::getGroupList($objUser); print "<table class='groups'>"; print "<tr>"; print "<th width='300' align='left'>Name</td>"; print "<th width='150' align='left'>Founder</td>"; print "<th width='75'>Members</td>"; print "<th width='75'>Albums</td>"; print "<th width='75'>Pictures</td>"; print "</tr>"; foreach ($arrGroups as $objGroup) { $objFounder = $objGroup->getForeignObject('user'); $isMember = $objGroup->isMember($objUser); $isPotential = $objGroup->isRequestedMember($objUser) || $objGroup->isInvitedMember($objUser); print "<tr>"; print "\t<td>"; if ($isMember) { print "<strong>"; } if ($isPotential) { print "<em>"; } print "\t\t<a href='index.php?action=groups&subaction=view&" . $objGroup->getIDPair() . "' class='nounderline'>" . $objGroup->get('name') . "</a></td>"; if ($isPotential) { print "</em>"; } if ($isMember) { print "</strong>";
public function getPolicy($objUser, $strPolicy) { /* Admins are always allowed. */ if ($objUser && $objUser->get('is_admin')) { return true; } /* Owners are also always allowed. */ if ($objUser && $this->get('user_id') == $objUser->get('id')) { return true; } $objAlbum = $this; /* For recursive checking. */ $arrParents = $this->getParents(); do { $objGroup = new clsGroup($objAlbum->get('group_id')); if ($objUser == null || $objUser->isNew()) { $objPolicy = $objAlbum->getForeignObject('albumpolicy', 'guest'); } elseif ($objGroup->isMember($objUser)) { $objPolicy = $objAlbum->getForeignObject('albumpolicy', 'group'); } else { $objPolicy = $objAlbum->getForeignObject('albumpolicy', 'member'); } if ($objPolicy->get($strPolicy) != INHERIT) { return $objPolicy->get($strPolicy); } $objAlbum = array_shift($arrParents); } while ($objAlbum); return NO; /* Default to no if no policy is found (shouldn't happen). */ }