Exemplo n.º 1
0
    $objTemplate->setText('PAGETITLE', "New Pictures");
    $objMiniMenu->add('Mark all as seen', "index.php?action=albums&subaction=seen");
    $objBreadcrumbs->add("New pictures", "index.php?action=albums&subaction=newpictures&" . $objMember->getIDPair());
    clsPicture::displayPictures(clsPicture::getNewPictures($objUser));
}
if ($strSubAction == 'save') {
    $blnGood = true;
    if (!$objUser) {
        throw new Exception('exception_notloggedin');
    }
    if (!$objAlbum->canEdit($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    /* Get the user's submitted changes. */
    $objAlbum = new clsAlbum();
    $objAlbum->getFromRequest(array('id', 'album_id', 'group_id', 'name', 'caption', 'date', 'export_tag', 'max_height', 'max_width', 'mime', 'simple_permissions'));
    if ($objAlbum->get('max_width') > MAX_X || $objAlbum->get('max_width') <= 0 || !is_numeric($objAlbum->get('max_width'))) {
        $blnGood = false;
        $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()) {
Exemplo n.º 2
0
						Add <input type='text' size='3' id='numtoadd2' value='5'> files...  <input type='button' onClick='javascript:addRows("files", $("numtoadd2").value);' value='Go!'>
					</td>
				</tr>
				<tr>
					<td align='right' width='100%'>
						<span id='notification' class='message'></span><br>
						<input type='submit' value='Save' onClick="$('notification').innerHTML = 'Image(s) uploading, please be patient...';"><br>
					</td>
				</tr>
			</table>
		</form>
<?php 
}
if ($strSubAction == 'save') {
    $objAlbum = new clsAlbum();
    $objAlbum->getFromRequest(array('id'));
    $objAlbum->load();
    if (!$objAlbum->canPostPicture($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    foreach ($_FILES as $strName => $arrFile) {
        $tmp_name = $arrFile['tmp_name'];
        $name = $arrFile['name'];
        $type = $arrFile['type'];
        $size = $arrFile['size'];
        $error = $arrFile['error'];
        if ($error) {
            switch ($error) {
                case UPLOAD_ERR_INI_SIZE:
                    print "<span class='error'>The uploaded file is bigger than the allowed size. Please choose a smaller file or ask the server admin to change upload_max_filesize.</span><br>";
                    break;