Пример #1
0
 public static function getNewPictures($objUser)
 {
     $arrPictures = clsDB::selectQueryObjects('picture', "\n\t\t\tSELECT `<<tbl><picture>>`.*\n\t\t\tFROM `<<tbl><picture>>` \n\t\t\t\t\tJOIN `<<tbl><album>>` ON `<<foreign><picture><album>>`=`<<album><id>>`\n\t\t\t\tWHERE `<<isdel><picture>>`='0'\n\t\t\t\t\tAND `<<picture><confirmed>>`='1'\n\t\t\t\t\tAND `<<isdel><album>>`='0'\n\t\t\t\t\tAND `<<picture><id>>` NOT IN \n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT `<<foreign><userpictureview><picture>>`\n\t\t\t\t\t\t\tFROM `<<tbl><userpictureview>>`\n\t\t\t\t\t\t\tWHERE `<<foreign><userpictureview><user>>`='" . $objUser->get('id') . "'\n\t\t\t\t\t\t\t\tAND `<<isdel><userpictureview>>`='0'\n\t\t\t\t\t)\n\t\t\t\tORDER BY `<<picture><date>>` DESC\n\t\t\t\t\t");
     $arrRet = array();
     foreach ($arrPictures as $objPicture) {
         $objAlbum = new clsAlbum($objPicture->get('album_id'));
         /* TODO: Speed this up? */
         if ($objAlbum->canView($objUser)) {
             $arrRet[] = new clsPicture($objPicture->get('id'));
         }
     }
     return $arrRet;
 }
Пример #2
0
 public static function getPicturesByGroup($objUser, $objGroup)
 {
     $arrPictures = clsDB::selectQueryObjects('picture', "SELECT `<<tbl><picture>>`.*\n                                        FROM `<<tbl><album>>`\n                                            LEFT JOIN `<<tbl><picture>>` ON `<<foreign><picture><album>>`=`<<album><id>>`\n                                        WHERE `<<foreign><album><group>>`='" . $objGroup->get('id') . "' \n                                            AND `<<isdel><album>>`='0'\n                                            AND `<<isdel><picture>>`='0'\n                                            AND `<<picture><confirmed>>`='1'\n                                        ORDER BY `<<picture><date>>` DESC\n                                        ");
     $arrRet = array();
     /* TODO: Might be able to make this more efficient. Make sure that canView() isn't running a query every time. */
     foreach ($arrPictures as $objPicture) {
         $objAlbum = new clsAlbum($objPicture->get('album_id'));
         if ($objAlbum->canView($objUser)) {
             $arrRet[] = new clsPicture($objPicture->get('id'));
         }
     }
     return $arrRet;
 }
Пример #3
0
require_once 'cls/clsParameters.php';
require_once 'cls/clsPicture.php';
require_once 'cls/clsTemplate.php';
require_once 'cls/clsThumbnail.php';
$objAlbum = new clsAlbum();
$objAlbum->getFromRequest();
$objAlbum->load();
$objMember = new clsUser();
$objMember->getFromRequest();
$objMember->load();
$objGroup = new clsGroup();
$objGroup->getFromRequest();
$objGroup->load();
$arrSimplePermissions = array(-1 => "Don't change", 0 => "Use same permission as parent", 1 => "Public (anybody can see the album and post comments)", 2 => "Public with rating (same as Public, but users can rate pictures)", 3 => "Public with group posting (same as Public, except group members can post pictures)", 4 => "Private (only group members can see)", 5 => "Private with rating (same as Private, but users can rate pictures)", 6 => "Private with group posting (same as Private, except group members can post pictures)");
if ($strSubAction == '' && $objMember->isNew()) {
    if (!$objAlbum->canView($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    /* Do they have access? */
    if (!$objAlbum->canView($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    /* Are they filtering? */
    if ($objUser && $objUser->get('remember_filter') && $objUser->get('filter_user')) {
        header("Location: index.php?action=albums&subaction=useralbums&user_id=" . $objUser->get('filter_user'));
    }
    $objBreadcrumbs->add('Albums', 'index.php?action=albums');
    $objAlbum->addBreadcrumbs($objBreadcrumbs, false);
    /* Editing the album. */
    if (!$objAlbum->isNew() && $objAlbum->canEdit($objUser)) {
        $objMiniMenu->add('Edit', 'index.php?action=albums&subaction=edit&' . $objAlbum->getIDPair());
Пример #4
0
 /** Get recently updated albums for a particular user. */
 public static function getRecentAlbums($objUser, $num)
 {
     if (!is_numeric($num)) {
         throw new exception('exception_internalerror');
     }
     $arrAlbums = clsDB::selectQueryObjects('album', "\n\t\t\t\t\t\t\t\t\t\tSELECT `<<tbl><album>>`.*, `<<picture><confirmed>>`, MAX(`<<picture><date>>`) AS `<<album><last_updated>>`\n\t\t\t\t\t\t\t\t\t\tFROM `<<tbl><album>>`\n\t\t\t\t\t\t\t\t\t\t\tJOIN `<<tbl><picture>>` ON `<<foreign><picture><album>>`=`<<album><id>>`\n\t\t\t\t\t\t\t\t\t\t\tWHERE `<<isdel><album>>`='0'\n\t\t\t\t\t\t\t\t\t\t\t\tAND `<<isdel><picture>>`='0'\n\t\t\t\t\t\t\t\t\t\t\t\tAND `<<picture><confirmed>>`='1'\n\t\t\t\t\t\t\t\t\t\tGROUP BY `<<album><id>>`\n\t\t\t\t\t\t\t\t\t\tORDER BY `<<album><last_updated>>` DESC\n\t\t");
     $arrRet = array();
     foreach ($arrAlbums as $objAlbum) {
         if (sizeof($arrRet) == $num) {
             return $arrRet;
         }
         $objAlbum = new clsAlbum($objAlbum->get('id'));
         if ($objAlbum->canView($objUser)) {
             $arrRet[] = $objAlbum;
         }
     }
     return $arrRet;
 }