Ejemplo n.º 1
0
     $objAlbum->set('mime', DEFAULT_MIME);
 }
 /* The template that looks after the edit page. */
 $objEditTemplate = new clsTemplate('editalbum');
 $objEditTemplate->setText('HIDDEN', $objAlbum->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumGuest->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumMember->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumGroup->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbum->getHiddenField('album_id'));
 $objEditTemplate->setText('HIDDEN', "<input type='hidden' name='action' value='albums'>");
 $objEditTemplate->setText('HIDDEN', "<input type='hidden' name='subaction' value='save'>");
 $objEditTemplate->setText('MAXWIDTH', MAX_X);
 $objEditTemplate->setText('MAXHEIGHT', MAX_Y);
 $objEditTemplate->setText('NAME', $objAlbum->getTextField('name', new clsParameters('SIZE', 40)));
 $objEditTemplate->setText('PARENT', $objParent->isNew() ? "n/a" : $objParent->get('name'));
 $objEditTemplate->setText('GROUP', $objAlbum->getCombo('group_id', clsDB::getOptionsFromList(clsGroup::getGroups($objUser), 'name', 'id', "No group.")));
 $objEditTemplate->setText('CAPTION', $objAlbum->getTextArea('caption', 4, 45));
 $objEditTemplate->setText('EXPORTKEY', $objAlbum->getTextField('export_tag', new clsParameters('SIZE', 4)));
 $objEditTemplate->setText('WIDTH', $objAlbum->getTextField('max_width', new clsParameters('SIZE', 3)));
 $objEditTemplate->setText('HEIGHT', $objAlbum->getTextField('max_height', new clsParameters('SIZE', 3)));
 $objEditTemplate->setText('MIME', $objAlbum->getTextField('mime'));
 $strGroup = '';
 $strGroup .= "View pictures? " . $objAlbumGroup->getCombo('allow_view', $arrOptions) . "<br>";
 $strGroup .= "Rate pictures? " . $objAlbumGroup->getCombo('allow_rate', $arrOptions) . "<br>";
 $strGroup .= "Post pictures? " . $objAlbumGroup->getCombo('allow_post_picture', $arrOptions) . "<br>";
 $strGroup .= "Post comments? " . $objAlbumGroup->getCombo('allow_post_comment', $arrOptions) . "<br>";
 $strGroup .= "Delete pictures? " . $objAlbumGroup->getCombo('allow_delete_picture', $arrOptions) . "<br>";
 $strGroup .= "Create sub-albums?" . $objAlbumGroup->getCombo('allow_create_subalbum', $arrOptions) . "<br>";
 $objEditTemplate->setText('GROUPPERMISSIONS', $strGroup);
 $strMember = '';
 $strMember .= "View pictures? " . $objAlbumMember->getCombo('allow_view', $arrOptions) . "<br>";
Ejemplo n.º 2
0
 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). */
 }
Ejemplo n.º 3
0
    if (!$objGroup->isMember($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    $strResult = $objGroup->approveMember($objMember, $objUser);
    header("Location: index.php?action=groups&subaction=view&message={$strResult}&" . $objGroup->getIDPair());
}
if ($strSubAction == 'accept') {
    $strResult = $objGroup->acceptInvite($objUser);
    header("Location: index.php?action=groups&subaction=view&message={$strResult}&" . $objGroup->getIDPair());
}
if ($strSubAction == 'decline') {
    $strResult = $objGroup->declineInvite($objUser);
    header("Location: index.php?action=groups&subaction=view&message={$strResult}&" . $objGroup->getIDPair());
}
if ($strSubAction == 'invitations') {
    $objTemplate->setText('PAGETITLE', "Invitations");
    $objBreadcrumbs->add('Invitations', 'index.php?action=groups&subaction=invite&' . $objGroup->getIDPair());
    $arrGroups = clsGroup::getInvitations($objUser);
    print "<table>";
    print "<th align='left' width='250'>Group</th>";
    print "<th align='left' width='100'>Accept</th>";
    print "<th align='left' width='100'>Decline</th>";
    foreach ($arrGroups as $objGroup) {
        print "<tr>";
        print "<td><a href='index.php?action=groups&subaction=view&" . $objGroup->getIDPair() . "'>" . $objGroup->get('name') . "</a></td>";
        print "<td><a href='index.php?action=groups&subaction=accept&" . $objGroup->getIDPair() . "'>Accept</a></td>";
        print "<td><a href='index.php?action=groups&subaction=decline&" . $objGroup->getIDPair() . "'>Decline</a></td>";
        print "</tr>";
    }
    print "</table>";
}
Ejemplo n.º 4
0
<?php

require_once 'cls/clsComment.php';
require_once 'cls/clsGroup.php';
require_once 'cls/clsPicture.php';
if ($objUser) {
    print "Welcome back, <a href='index.php?action=members&subaction=view&" . $objUser->getIDPair() . "'>" . $objUser->get('username') . "</a>! <br>";
    print "You have <a href='index.php?action=comment&subaction=viewnew'><strong>" . sizeof(clsComment::getNewComments($objUser)) . "</strong> unread comments</a> on your pictures.<br>";
    print "There are <a href='index.php?action=albums&subaction=newpictures'><strong>" . sizeof(clsPicture::getNewPictures($objUser)) . "</strong> new pictures</a>.<br>";
    if ($objUser) {
        $intNum = sizeof(clsGroup::getInvitations($objUser));
        if ($intNum > 0) {
            print "You have invitations to <a href='index.php?action=groups&subaction=invitations'><strong>{$intNum} groups</strong></a>.<br>";
        }
    }
} else {
    print "Welcome, guest! You can <a href='index.php?action=login'>log in</a> or <a href='index.php?action=members&subaction=view'>register</a>.<br><br>";
}