Ejemplo n.º 1
0
 function fisheye_expunge_user($pObject)
 {
     global $gBitDb;
     if (!empty($pObject->mUserId)) {
         $query = "SELECT fg.`content_id` FROM `" . BIT_DB_PREFIX . "fisheye_gallery` fg INNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON(fg.`content_id`=lc.`content_id`) WHERE lc.`user_id`=?";
         if ($galleries = $gBitDb->getCol($query, array($pObject->mUserId))) {
             foreach ($galleries as $contentId) {
                 $delGallery = new FisheyeGallery(NULL, $contentId);
                 if ($delGallery->load()) {
                     $delGallery->expunge(TRUE);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
require_once FISHEYE_PKG_PATH . "FisheyeImage.php";
require_once RSS_PKG_PATH . "rss_inc.php";
$rss->title = $gBitSystem->getConfig('fisheye_rss_title', $gBitSystem->getConfig('site_title') . ' - ' . tra('Image Galleries'));
$rss->description = $gBitSystem->getConfig('fisheye_rss_description', $gBitSystem->getConfig('site_title') . ' - ' . tra('RSS Feed'));
// check permission to view fisheye images
if (!$gBitUser->hasPermission('p_fisheye_view')) {
    require_once RSS_PKG_PATH . "rss_error.php";
} else {
    $listHash = array('max_records' => $gBitSystem->getConfig('fisheye_rss_max_records', 10), 'sort_mode' => 'last_modified_desc', 'gallery_id' => !empty($_REQUEST['gallery_id']) ? $_REQUEST['gallery_id'] : NULL, 'user_id' => !empty($_REQUEST['user_id']) ? $_REQUEST['user_id'] : NULL);
    // check if we want to use the cache file
    $cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . FISHEYE_PKG_NAME . '/' . "g{$listHash['gallery_id']}u{$listHash['user_id']}" . $cacheFileTail;
    $rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time'));
    // if we have a gallery we can work with - load it
    if (@BitBase::verifyId($_REQUEST['gallery_id'])) {
        $gallery = new FisheyeGallery($_REQUEST['gallery_id']);
        $gallery->load();
        $rss->title .= " - {$gallery->getTitle()}";
    }
    $fisheye = new FisheyeImage();
    $feeds = $fisheye->getList($listHash);
    // set the rss link
    $rss->link = 'http://' . $_SERVER['HTTP_HOST'] . FISHEYE_PKG_URL;
    global $gBitSystem;
    // get all the data ready for the feed creator
    foreach ($feeds as $feed) {
        $item = new FeedItem();
        $item->title = $feed['title'];
        $item->link = $feed['display_url'];
        $item->description = '<a href="' . $feed['display_url'] . '"><img src="' . $feed['thumbnail_url'] . '" /></a>';
        $item->description .= '<p>' . $feed['data'] . '</p>';
        $item->date = (int) $feed['last_modified'];
Ejemplo n.º 3
0
function fisheye_process_ftp_directory($pProcessDir)
{
    global $gBitSystem, $gBitUser;
    if (empty($_REQUEST['gallery_additions'])) {
        $_REQUEST['gallery_additions'] = array();
    }
    $errors = array();
    if ($archiveDir = opendir($pProcessDir)) {
        $order = 100;
        while ($fileName = readdir($archiveDir)) {
            $sortedNames[] = $fileName;
        }
        sort($sortedNames);
        $order = 100;
        foreach ($sortedNames as $fileName) {
            if (!preg_match('/^\\./', $fileName) && $fileName != 'Thumbs.db') {
                $scanFile = array('type' => $gBitSystem->lookupMimeType(substr($fileName, strrpos($fileName, '.') + 1)), 'name' => $fileName, 'size' => filesize("{$pProcessDir}/{$fileName}"), 'tmp_name' => "{$pProcessDir}/{$fileName}");
                if (is_dir($pProcessDir . '/' . $fileName)) {
                    // create a new gallery from directory
                    $dirGallery = new FisheyeGallery();
                    $galleryHash = array('title' => str_replace('_', ' ', $fileName));
                    if ($dirGallery->store($galleryHash)) {
                        $dirGallery->addToGalleries($_REQUEST['gallery_additions']);
                        $errors = array_merge($errors, fisheye_process_directory($pProcessDir . '/' . $fileName, $dirGallery));
                    } else {
                        $errors = array_merge($errors, array_values($dirGallery->mErrors));
                    }
                    unset($dirGallery);
                } else {
                    if (preg_match('/(^image|pdf)/i', $scanFile['type'])) {
                        // process image
                        $newImage = new FisheyeImage();
                        $imageHash = array('upload' => $scanFile);
                        if ($newImage->store($imageHash)) {
                            $newImage->addToGalleries($_REQUEST['gallery_additions']);
                            // if we have a gallery to add these images to, load one of them
                            if (!empty($_REQUEST['gallery_additions'][0]) && @(!is_object($imageGallery))) {
                                $imageGallery = new FisheyeGallery();
                                $imageGallery->mGalleryId = $_REQUEST['gallery_additions'][0];
                                $imageGallery->load();
                            }
                            if (@(!is_object($imageGallery))) {
                                global $gBitUser;
                                $galleryHash = array('title' => $gBitUser->getDisplayName() . "'s Gallery");
                                $imageGallery = new FisheyeGallery();
                                if ($imageGallery->store($galleryHash)) {
                                    $imageGallery->load();
                                } else {
                                    $errors = array_merge($errors, array_values($imageGallery->mErrors));
                                }
                            }
                            $imageGallery->addItem($newImage->mContentId);
                        } else {
                            $errors = array_merge($errors, array_values($newImage->mErrors));
                        }
                    } else {
                        // create a new gallery from archive
                        $archiveGallery = new FisheyeGallery();
                        $galleryHash = array('title' => substr($fileName, 0, str_replace('_', ' ', strrpos($fileName, '.'))));
                        if (!$archiveGallery->store($galleryHash)) {
                            $errors = array_merge($errors, array_values($archiveGallery->mErrors));
                        }
                        $errors = fisheye_process_archive($scanFile, $archiveGallery, TRUE);
                        unset($archiveGallery);
                    }
                }
                $order += 10;
            }
        }
    }
    return $errors;
}
Ejemplo n.º 4
0
 case 'security':
     $storageHash['security_id'] = $batchParam;
     $feedback['success'] = tra("Items security assigned");
     break;
 case 'gallerymove':
     if (empty($destGallery)) {
         $destGallery = new FisheyeGallery(NULL, $batchParam);
         $destGallery->load();
     }
     if ($batchParam != $contentId) {
         $gContent->removeItem($contentId);
     }
 case 'gallerycopy':
     if (empty($destGallery)) {
         $destGallery = new FisheyeGallery(NULL, $batchParam);
         $destGallery->load();
     }
     if ($destGallery->addItem($contentId)) {
         $feedback['success'][] = $galleryItem->getTitle() . ' ' . tra("added to") . ' ' . $destGallery->getTitle();
     } else {
         $feedback['error'][] = $galleryItem->getTitle() . ' ' . tra("could not be added to") . ' ' . $destGallery->getTitle();
     }
     break;
 case 'filenametoimagename':
     $renameHash = array();
     if (!empty($galleryItem->mInfo['filename'])) {
         $renameHash['title'] = file_name_to_title($galleryItem->mInfo['filename']);
         $galleryItem->store($renameHash);
         // update to prevent renaming value in text input
         $_REQUEST['image_title'][$contentId] = $renameHash['title'];
     }