Ejemplo n.º 1
0
     $objTemplate->setText('ERROR', "Width must be a number between 1 and " . MAX_X . ".<br>");
 }
 if ($objAlbum->get('max_height') > MAX_X || $objAlbum->get('max_height') <= 0 || !is_numeric($objAlbum->get('max_height'))) {
     $blnGood = false;
     $objTemplate->setText('ERROR', "Height must be a number between 1 and " . MAX_X . ".<br>");
 }
 if (array_search($objAlbum->get('mime'), array('image/jpeg', 'image/png', 'image/gif')) === false) {
     $blnGood = false;
     $objTemplate->setText('ERROR', "Mime choices are image/jpeg, image/png, and image/gif.<br>");
 }
 /* Validate fields. */
 if ($blnGood) {
     if ($objAlbum->isNew()) {
         $objAlbum->set('user_id', $objUser->get('id'));
     }
     if (!$objAlbum->exists('simple_permissions')) {
         $objAlbumGuest = clsAlbum::getPolicyFromRequest('albumpolicy_guest', $objUser);
         $objAlbumGuest->save();
         $objAlbum->set('albumpolicy_guest_id', $objAlbumGuest->get('id'));
         $objAlbumMember = clsAlbum::getPolicyFromRequest('albumpolicy_member', $objUser);
         $objAlbumMember->save();
         $objAlbum->set('albumpolicy_member_id', $objAlbumMember->get('id'));
         $objAlbumGroup = clsAlbum::getPolicyFromRequest('albumpolicy_group', $objUser);
         $objAlbumGroup->save();
         $objAlbum->set('albumpolicy_group_id', $objAlbumGroup->get('id'));
     } else {
         $objAlbumGuest = clsAlbum::getPolicyFromRequest('albumpolicy_guest', $objUser);
         $objAlbumMember = clsAlbum::getPolicyFromRequest('albumpolicy_member', $objUser);
         $objAlbumGroup = clsAlbum::getPolicyFromRequest('albumpolicy_group', $objUser);
         switch ($objAlbum->get('simple_permissions')) {
             /* -1=>"Don't change" */