Ejemplo n.º 1
0
/**
 * fisheye_handle_upload
 */
function fisheye_handle_upload(&$pFiles)
{
    global $gBitUser, $gContent, $gBitSystem, $fisheyeErrors, $fisheyeWarnings, $fisheyeSuccess, $gFisheyeUploads;
    // first of all set the execution time for this process to unlimited
    set_time_limit(0);
    $upImages = array();
    $upArchives = array();
    $upErrors = array();
    $upData = array();
    $i = 0;
    usort($pFiles, 'fisheye_sort_uploads');
    foreach (array_keys($pFiles) as $key) {
        $pFiles[$key]['type'] = $gBitSystem->verifyMimeType($pFiles[$key]['tmp_name']);
        if (preg_match('/(^image|pdf|vnd)/i', $pFiles[$key]['type'])) {
            $upImages[$key] = $pFiles[$key];
            // clone the request data so edit service values are passed into store process
            $upData[$key] = $_REQUEST;
            // add the form data for each upload
            if (!empty($_REQUEST['imagedata'][$i])) {
                array_merge($upData[$key], $_REQUEST['imagedata'][$i]);
            }
        } elseif (!empty($pFiles[$key]['tmp_name']) && !empty($pFiles[$key]['name'])) {
            $upArchives[$key] = $pFiles[$key];
        }
        $i++;
    }
    $gallery_additions = array();
    // No gallery was specified, let's try to find one or create one.
    if (empty($_REQUEST['gallery_additions'])) {
        if ($gBitUser->hasPermission('p_fisheye_create')) {
            $_REQUEST['gallery_additions'] = array(fisheye_get_default_gallery_id($gBitUser->mUserId, $gBitUser->getDisplayName() . "'s Gallery"));
        } else {
            $gBitSystem->fatalError(tra("You don't have permissions to create a new gallery. Please select an existing one to insert your images to."));
        }
    }
    foreach (array_keys($upArchives) as $key) {
        $upErrors = fisheye_process_archive($upArchives[$key], $gContent, TRUE);
    }
    foreach (array_keys($upImages) as $key) {
        // resize original if we the user requests it
        if (!empty($_REQUEST['resize'])) {
            $upImages[$key]['resize'] = $_REQUEST['resize'];
        }
        $upErrors = array_merge($upErrors, fisheye_store_upload($upImages[$key], $upData[$key], !empty($_REQUEST['rotate_image'])));
    }
    if (!is_object($gContent) || !$gContent->isValid()) {
        $gContent = new FisheyeGallery($_REQUEST['gallery_additions'][0]);
        $gContent->load();
    }
    if (!empty($gFisheyeUploads)) {
        $_REQUEST['uploaded_objects'] =& $gFisheyeUploads;
        $gContent->invokeServices("content_post_upload_function", $_REQUEST);
    }
    return $upErrors;
}
Ejemplo n.º 2
0
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
require_once FISHEYE_PKG_PATH . 'FisheyeGallery.php';
global $gBitSystem, $gBitSmarty, $gFisheyeGallery;
//$gBitSystem->verifyPermission( 'p_fisheye_list_galleries' );
$gFisheyeGallery = new FisheyeGallery();
/* Get a list of galleries which matches the input parameters (default is to list every gallery in the system) */
$_REQUEST['root_only'] = TRUE;
/* Process the input parameters this page accepts */
if (!empty($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id'])) {
    if ($_REQUEST['user_id'] == $gBitUser->mUserId) {
        $_REQUEST['show_empty'] = TRUE;
    }
    $gBitSmarty->assignByRef('gQueryUserId', $_REQUEST['user_id']);
    $template = 'user_galleries.tpl';
} else {
    $template = 'list_galleries.tpl';
}
$_REQUEST['thumbnail_size'] = $gBitSystem->getConfig('fisheye_list_thumbnail_size', 'small');
$galleryList = $gFisheyeGallery->getList($_REQUEST);
$gFisheyeGallery->invokeServices('content_list_function', $_REQUEST);
// Pagination Data
$gBitSmarty->assignByRef('listInfo', $_REQUEST['listInfo']);
$gBitSmarty->assign('galleryList', $galleryList);
// Display the template
$gDefaultCenter = "bitpackage:fisheye/{$template}";
$gBitSmarty->assignByRef('gDefaultCenter', $gDefaultCenter);
$gBitSystem->display('bitpackage:kernel/dynamic.tpl', 'List Galleries', array('display_mode' => 'list'));