<?php /** * @version $Header$ * * @author xing <*****@*****.**> * @package treasury * @copyright 2003-2006 bitweaver * @license LGPL {@link http://www.gnu.org/licenses/lgpl.html} **/ /** * Setup */ global $gContent; if (@BitBase::verifyId($_REQUEST['structure_id'])) { $gContent = new TreasuryGallery($_REQUEST['structure_id']); $gContent->load(TRUE); } elseif (@BitBase::verifyId($_REQUEST['content_id'])) { $gContent = new TreasuryGallery(NULL, $_REQUEST['content_id']); $gContent->load(TRUE); } else { $gContent = new TreasuryGallery(); } $gBitSmarty->assigByRef('gContent', $gContent);
require_once RSS_PKG_PATH . "rss_inc.php"; $rss->title = $gBitSystem->getConfig('treasury_rss_title', $gBitSystem->getConfig('site_title') . ' - ' . tra('File Galleries')); $rss->description = $gBitSystem->getConfig('treasury_rss_description', $gBitSystem->getConfig('site_title') . ' - ' . tra('RSS Feed')); // check permission to view treasury item if (!$gBitUser->hasPermission('p_treasury_view_item')) { require_once RSS_PKG_PATH . "rss_error.php"; } else { $listHash = array('max_records' => $gBitSystem->getConfig('treasury_rss_max_records', 10), 'sort_mode' => 'last_modified_desc', 'gallery_content_id' => !empty($_REQUEST['gallery_content_id']) ? $_REQUEST['gallery_content_id'] : NULL, 'user_id' => !empty($_REQUEST['user_id']) ? $_REQUEST['user_id'] : NULL); // check if we want to use the cache file // we'll use groups to cache rss feeds with different permissions $cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . TREASURY_PKG_NAME . '/' . "g{$listHash['gallery_content_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_content_id'])) { $gallery = new TreasuryGallery(NULL, $_REQUEST['gallery_content_id']); $gallery->load(); $rss->title .= " - {$gallery->getTitle()}"; } $treasury = new TreasuryItem(); $feeds = $treasury->getList($listHash); // set the rss link $rss->link = TREASURY_PKG_URI; $gBitSmarty->loadPlugin('smarty_modifier_display_bytes'); // get all the data ready for the feed creator foreach ($feeds as $feed) { $item = new FeedItem(); $item->title = $feed->getTitle(); $item->link = $feed->getField('display_url'); $item->date = (int) $feed->getField('last_modified'); $item->source = BIT_ROOT_URI; if (!empty($feed->mInfo['thumbnail_url']['medium'])) {
$verifyStructurePermission = 'p_treasury_update_gallery'; include_once LIBERTY_PKG_PATH . 'edit_structure_inc.php'; // get all the nodes in this structure foreach ($rootTree as $node) { $galleryStructure[$node['structure_id']] = str_repeat('-', $node['level']) . ' ' . $node['title']; } $gBitSmarty->assign('galleryStructure', $galleryStructure); } if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'edit') { $gBitSmarty->assignByRef('galInfo', $gContent->mInfo); } if (!empty($_REQUEST['treasury_store'])) { // $rootStructure is created in edit_structure_inc.php $_REQUEST['root_structure_id'] = !empty($rootStructure->mStructureId) ? $rootStructure->mStructureId : NULL; $galleryStore = new TreasuryGallery(NULL, !empty($_REQUEST['gallery_content_id']) ? $_REQUEST['gallery_content_id'] : NULL); $galleryStore->load(); // pass thumbnail upload on to storage hash if (!empty($_FILES['icon']['tmp_name'])) { $_REQUEST['thumb'] = $_FILES['icon']; } if ($galleryStore->store($_REQUEST)) { bit_redirect($galleryStore->getDisplayUrl() . "&refresh=1"); } else { $feedback['error'] = $galleryStore->mErrors; } } if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'remove_gallery' || !empty($_REQUEST['confirm'])) { if (@BitBase::verifyId($_REQUEST['content_id'])) { if ($_REQUEST['action'] == 'remove_gallery' && !empty($_REQUEST['confirm'])) { if ($gContent->expunge(!empty($_REQUEST['force_item_delete']))) { bit_redirect(TREASURY_PKG_URL);
$gBitSystem->setHttpStatus(404); $gBitSystem->fatalError(tra("The requested file could not be found")); } // check view permission as set for the gallery $gContent->verifyViewPermission(); $gContent->verifyGalleryPermissions('p_treasury_view_item'); // load the parent gallery as well if (@BitBase::verifyId($_REQUEST['structure_id'])) { $gGallery = new TreasuryGallery($_REQUEST['structure_id']); $gGallery->load(); } else { // if we don't have a structure id to go by, we just get a gallery we can work with $galleryContentIds = $gContent->getParentGalleries(); if (@BitBase::verifyId($galleryContentIds[0])) { $gGallery = new TreasuryGallery(NULL, $galleryContentIds[0]); $gGallery->load(); } } // invoke services $displayHash = array('perm_name' => $gContent->mViewContentPerm); $gContent->invokeServices('content_display_function', $displayHash); $galleryDisplayPath = $gContent->getDisplayPath($gContent->getGalleryPath($gGallery->mStructureId)); $gBitSmarty->assign('galleryDisplayPath', $galleryDisplayPath); $gBitSmarty->assignByRef('gGallery', $gGallery); if (is_object($gGallery) && $gContent->isCommentable()) { $commentsParentId = $gContent->mContentId; $comments_vars = array(TREASURYITEM_CONTENT_TYPE_GUID); $comments_prefix_var = TREASURYITEM_CONTENT_TYPE_GUID . ':'; $comments_object_var = TREASURYITEM_CONTENT_TYPE_GUID; $comments_return_url = $gContent->getDisplayUrl(); $gBitSmarty->assign('item_display_comments', TRUE);