예제 #1
0
파일: upload.php 프로젝트: shifter/ospap2
        } else {
            $objTemplate->setText('ERROR', "You are not allowed to post pictures in that category.");
        }
        $strSubAction = 'preview';
    }
}
if ($strSubAction == 'delete') {
    $user_id = $objUser ? $objUser->get('id') : 0;
    $objPicture = new clsPicture();
    $objPicture->getFromRequest();
    $objPicture->load();
    if ($objPicture->get('user_id') != $user_id) {
        throw new Exception('exception_accessdenied');
    }
    /* Make sure that users can only edit their own pictures. */
    $objPicture->delete();
    $objPicture->save();
    header("Location: index.php?action=upload&subaction=preview");
}
if ($strSubAction == 'preview') {
    $objTemplate->setText('PAGETITLE', "Pending Pictures");
    $objBreadcrumbs->add('Upload', 'index.php?action=upload');
    $objBreadcrumbs->add('Pending', 'index.php?action=upload&subaction=preview');
    $arrPictures = clsPicture::getPending($objUser);
    print "You have <strong>" . sizeof($arrPictures) . "</strong> pictures waiting for attention" . ($objUser ? "" : " (note: unsaved images from all guests will appear here)") . ":<br><br>";
    foreach ($arrPictures as $objPicture) {
        $objPicture = new clsPicture($objPicture->get('id'));
        $objAlbum = new clsAlbum($objPicture->get('album_id'));
        $objTemplate = new clsTemplate('preview');
        $objTemplate->setText('HIDDEN', $objPicture->getHiddenField('id'));
        $objTemplate->setText('ALBUM', $objPicture->getCombo('album_id', clsDB::getOptionsFromList($objAlbum->getPostableAlbums($objUser), 'name', 'id', "Select an album")));