/** * Initialization */ require_once "../kernel/setup_inc.php"; require_once RSS_PKG_PATH . "rss_inc.php"; require_once LIBERTY_PKG_PATH . "LibertyContent.php"; $gBitSystem->verifyPackage('rss'); $gBitSystem->verifyFeature('liberty_rss'); $rss->title = $gBitSystem->getConfig('liberty_rss_title', $gBitSystem->getConfig('site_title') . ' - ' . tra('Liberty')); $rss->description = $gBitSystem->getConfig('liberty_rss_description', $gBitSystem->getConfig('site_title') . ' - ' . tra('RSS Feed')); // check if we want to use the cache file $cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . LIBERTY_PKG_NAME . '/' . $cacheFileTail; $rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time')); $liberty = new LibertyContent(); $listHash = array('max_records' => $gBitSystem->getConfig('liberty_rss_max_records', 10), 'sort_mode' => 'last_modified_desc', 'include_data' => TRUE); $feeds = $liberty->getContentList($listHash); // set the rss link $rss->link = 'http://' . $_SERVER['HTTP_HOST'] . LIBERTY_PKG_DIR . '/list_content.php'; // get all the data ready for the feed creator foreach ($feeds as $feed) { $item = new FeedItem(); $item->title = $feed['title']; $item->link = BIT_BASE_URI . $liberty->getDisplayUrl($feed['title'], $feed); // create a page header that we know what type of data we're looking at $description = tra('Package') . ': ' . ucfirst($gLibertySystem->mContentTypes[$feed['content_type_guid']]['handler_package']) . '<br />' . tra('Content Type') . ': ' . $gLibertySystem->getContentTypeName($feed['content_type_guid']) . '<br />'; // add the parsed data, if there is any if (!empty($feed['data'])) { $description .= '<br /><hr /><br />' . tra('Content') . ':<br />' . $liberty->parseData($feed) . '<br /><hr />'; } $item->description = $description; $item->date = (int) $feed['last_modified'];
/** * Get a list of content ranked by certain criteria set in $pListHash['sort_mode'] * * @param array hash of parameters ( content_type_guid will limit list to a single content type * @return - data **/ function getContentRanking($pListHash) { $pListHash['sort_mode'] = !empty($pListHash['sort_mode']) ? $pListHash['sort_mode'] : 'hits_desc'; if ($pListHash['sort_mode'] == 'top_authors') { global $gBitUser; $ret['data'] = $gBitUser->getAuthorList($pListHash); } else { include_once LIBERTY_PKG_PATH . 'LibertyContent.php'; $libertyContent = new LibertyContent(); $ret['data'] = $libertyContent->getContentList($pListHash); } $ret['title'] = !empty($pListHash['title']) ? $pListHash['title'] : tra("Content Ranking"); $ret['attribute'] = !empty($pListHash['attribute']) ? $pListHash['attribute'] : tra("Hits"); return $ret; }
} // get_content_list_inc doesn't use $_REQUEST parameters as it might not be the only list in the page that needs sorting and limiting if (empty($contentListHash)) { $contentListHash = array('content_type_guid' => $contentSelect = empty($_REQUEST['content_type_guid']) ? NULL : $contentTypeGuids, 'offset' => !empty($offset_content) ? $offset_content : NULL, 'max_records' => !empty($max_content) ? $max_content : (!empty($_REQUEST['max_records']) ? $_REQUEST['max_records'] : 100), 'sort_mode' => !empty($content_sort_mode) ? $content_sort_mode : 'title_asc', 'find' => !empty($_REQUEST["find"]) ? $_REQUEST["find"] : NULL, 'page' => !empty($_REQUEST["list_page"]) ? $_REQUEST["list_page"] : NULL, 'user_id' => @BitBase::verifyId($_REQUEST['user_id']) ? $_REQUEST['user_id'] : NULL, 'from_date' => !empty($_REQUEST["from_date"]) ? $_REQUEST["from_date"] : NULL, 'until_date' => !empty($_REQUEST["until_date"]) ? $_REQUEST["until_date"] : NULL, 'thumbnail_size' => !empty($_REQUEST["thumbnail_size"]) ? $_REQUEST["thumbnail_size"] : NULL); if (!empty($_REQUEST['output']) && ($_REQUEST['output'] == 'json' || $_REQUEST['output'] == 'ajax')) { foreach ($_REQUEST as $key => $value) { if (!is_array($value)) { if (strstr($value, ',')) { $_REQUEST[$key] = explode(",", $value); } } } } $contentListHash = array_merge($_REQUEST, $contentListHash); } // Finally we're ready to get some content $contentList = $gContent->getContentList($contentListHash); if (empty($contentTypes)) { $contentTypes = array('' => tra('All Content')); foreach ($gLibertySystem->mContentTypes as $cType) { $contentTypes[$cType['content_type_guid']] = $gLibertySystem->getContentTypeName($cType['content_type_guid'], TRUE); } asort($contentTypes); } global $gBitSystem, $gBitUser; if ($gBitSystem->isFeatureActive('liberty_display_status') && $gBitUser->hasPermission('p_liberty_view_all_status')) { $contentStatuses = $gContent->getAvailableContentStatuses(); $contentStatuses[''] = 'All Statuses'; $contentStatuses['not_available'] = 'All but Available'; $gBitSmarty->assign('content_statuses', $contentStatuses); }