Ejemplo n.º 1
0
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
define('NO_SESSION', true);
define('__TEXTCUBE_CUSTOM_HEADER__', true);
define('__TEXTCUBE_LOGIN__', true);
require ROOT . '/library/preprocessor.php';
requireStrictBlogURL();
$context = Model_Context::getInstance();
$period = $suri['id'];
$blogid = getBlogId();
$cache = pageCache::getInstance();
$cache->reset('archiveAtom-' . $period);
if (!$cache->load()) {
    requireModel("blog.feed");
    list($entries, $paging) = getEntriesWithPagingByPeriod($blogid, $period, 1, 1, 1);
    //var_dump($entries);
    if (empty($entries)) {
        header("Location: " . $context->getProperty('uri.host') . $context->getProperty('uri.blog') . "/atom");
        exit;
    }
    $result = getFeedWithEntries($blogid, $entries, _textf('%1 기간의 글 목록', $period), 'atom');
    if ($result !== false) {
        $cache->reset('archiveAtom-' . $period);
        $cache->contents = $result;
        $cache->update();
    }
}
header('Content-Type: application/rss+xml; charset=utf-8');
fireEvent('FeedOBStart');
echo fireEvent('ViewArchiveRSS', $cache->contents);
fireEvent('FeedOBEnd');
Ejemplo n.º 2
0
function getCategoryFeedByCategoryId($blogid, $categoryIds, $mode = 'rss', $categoryTitle = null)
{
    $context = Model_Context::getInstance();
    $channel = array();
    $channel = initializeRSSchannel($blogid);
    $pool = DBModel::getInstance();
    $pool->reset("Entries");
    $pool->setAlias("Entries", "e");
    $pool->setAlias("Categories", "c");
    $pool->setAlias("Users", "u");
    $pool->extend("Categories", "left", array(array("e.blogid", "eq", "c.blogid"), array("e.category", "eq", "c.id")));
    $pool->extend("Users", "left", array(array("e.userid", "eq", "u.userid")));
    $pool->setQualifier("e.blogid", "eq", $blogid);
    $pool->setQualifier("e.draft", "eq", 0);
    $pool->setQualifier("e.visibility", ">=", $context->getProperty('blog.publishEolinSyncOnRSS') ? 2 : 3);
    $pool->setQualifier("e.category", "hasoneof", $categoryIds);
    $pool->setOrder("e.published", "desc");
    $pool->setLimit($context->getProperty('blog.entriesOnRSS'));
    $entries = $pool->getAll("e.*, c.name AS categoryName, u.name as author, u.loginid AS email");
    return getFeedWithEntries($blogid, $entries, _textf('%1 카테고리 글 목록', $categoryTitle), $mode);
}
Ejemplo n.º 3
0
define('__TEXTCUBE_CUSTOM_HEADER__', true);
define('__TEXTCUBE_LOGIN__', true);
require ROOT . '/library/preprocessor.php';
requireStrictBlogURL();
$context = Model_Context::getInstance();
$author = $suri['value'];
$authorId = User::getUserIdByName($author);
if (empty($authorId)) {
    exit;
}
$blogid = getBlogId();
$cache = pageCache::getInstance();
$cache->reset('authorATOM-' . $authorId);
if (!$cache->load()) {
    importlib("model.blog.feed");
    list($entries, $paging) = getEntriesWithPagingByAuthor($blogid, $author, 1, 1, 1);
    if (empty($entries)) {
        header("Location: " . $context->getProperty('uri.host') . $context->getProperty('uri.blog') . "/atom");
        exit;
    }
    $result = getFeedWithEntries($blogid, $entries, _textf('%1 의 글 목록', $author), 'atom');
    if ($result !== false) {
        $cache->reset('authorATOM-' . $authorId);
        $cache->contents = $result;
        $cache->update();
    }
}
header('Content-Type: application/atom+xml; charset=utf-8');
fireEvent('FeedOBStart');
echo fireEvent('ViewAuthorATOM', $cache->contents);
fireEvent('FeedOBEnd');
Ejemplo n.º 4
0
function getCategoryFeedByCategoryId($blogid, $categoryIds, $mode = 'rss', $categoryTitle = null)
{
    $ctx = Model_Context::getInstance();
    $channel = array();
    $channel = initializeRSSchannel($blogid);
    $entries = POD::queryAll("SELECT \n\t\t\te.*, \n\t\t\tc.name AS categoryName, \n\t\t\tu.name AS author,\n\t\t\tu.loginid AS email\n\t\tFROM " . $ctx->getProperty('database.prefix') . "Entries e \n\t\tLEFT JOIN " . $ctx->getProperty('database.prefix') . "Categories c\n\t\t\tON e.blogid = c.blogid AND e.category = c.id\n\t\tLEFT JOIN " . $ctx->getProperty('database.prefix') . "Users u\n\t\t\tON e.userid = u.userid\n\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 AND e.visibility >= " . ($ctx->getProperty('blog.publishEolinSyncOnRSS') ? '2' : '3') . " AND e.category IN (" . implode(',', $categoryIds) . ")\n\t\tORDER BY e.published \n\t\tDESC LIMIT " . $ctx->getProperty('blog.entriesOnRSS'));
    return getFeedWithEntries($blogid, $entries, _textf('%1 카테고리 글 목록', $categoryTitle), $mode);
}