function cmdAddItem($pParamHash) { $response = array(); $uploadFile = !empty($_FILES['g2_userfile']) ? $_FILES['g2_userfile'] : NULL; if (empty($pParamHash['set_albumName'])) { $response = $this->createResponse(CREATE_ALBUM_FAILED, 'No gallery specified'); } elseif (empty($uploadFile) || empty($uploadFile['size'])) { $response = $this->createResponse(FEG2REMOTE_NO_FILENAME, 'No image uploaded'); } else { $storeHash['title'] = !empty($pParamHash['force_filename']) ? $pParamHash['force_filename'] : NULL; $storeHash['summary'] = !empty($pParamHash['extrafield.Summary']) ? $pParamHash['extrafield.Summary'] : NULL; $storeHash['edit'] = !empty($pParamHash['extrafield.Description']) ? $pParamHash['extrafield.Description'] : NULL; require_once FISHEYE_PKG_PATH . 'upload_inc.php'; $parentGallery = new FisheyeGallery(); if ($parentGallery = $parentGallery->lookup(array('content_id' => $pParamHash['set_albumName']))) { $parentGallery->load(); $_REQUEST['gallery_additions'] = array($parentGallery->mGalleryId); } if ($errors = fisheye_store_upload($uploadFile, $storeHash)) { $response = $this->createResponse(FEG2REMOTE_UPLOAD_PHOTO_FAIL, 'Export Failed'); } else { $response = $this->createResponse(FEG2REMOTE_SUCCESS, 'Image added', array('item_name' => $uploadFile['name'])); } } return $response; }
/** * Recursively builds a tree where each directory represents a gallery, and files are assumed to be images. */ function fisheye_process_archive(&$pFileHash, &$pParentGallery, $pRoot = FALSE) { global $gBitSystem, $gBitUser; $errors = array(); if (($destDir = liberty_process_archive($pFileHash)) && (!empty($_REQUEST['process_archive']) || !$gBitUser->hasPermission('p_fisheye_upload_nonimages'))) { if (empty($pParentGallery) && !is_file($pFileHash['tmp_name'])) { $pParentGallery = new FisheyeGallery(); $galleryHash = array('title' => basename($destDir)); if (!$pParentGallery->store($galleryHash)) { $errors = array_merge($errors, array_values($pParentGallery->mErrors)); } global $gContent; $gContent =& $pParentGallery; } fisheye_process_directory($destDir, $pParentGallery, $pRoot); } else { global $gBitUser; if ($gBitUser->hasPermission('p_fisheye_upload_nonimages')) { $errors = array_merge($errors, fisheye_store_upload($pFileHash)); } else { $errors['upload'] = tra('Your upload could not be processed because it was determined to be a non-image and you only have permission to upload images.'); } } return $errors; }