Example #1
0
<?php

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// 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();
$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();
Example #2
0
function getEntriesWithPagingByAuthor($blogid, $author, $page, $count, $countItem = null)
{
    $ctx = Model_Context::getInstance();
    $userid = User::getUserIdByName($author);
    $pool = DBModel::getInstance();
    $pool->init("Entries");
    $pool->setAlias("Entries", "e");
    $pool->setAlias("Categories", "c");
    $pool->join("Categories", "left", array(array("e.blogid", "eq", "c.blogid"), array("e.category", "eq", "c.id")));
    $pool->setQualifier("e.blogid", "eq", $blogid);
    $pool->setQualifier("e.userid", "eq", $userid);
    $pool->setQualifier("e.category", ">=", 0);
    $pool->setQualifier("e.draft", "eq", 0);
    if (!doesHaveOwnership()) {
        $pool->setQualifier("e.visibility", ">", 0);
        $pool->setQualifierSet(array("c.visibility", ">", 1), "OR", array("e.category", "eq", 0));
    }
    if (doesHaveOwnership() && !Acl::check('group.editors')) {
        $pool->setQualifierSet(array("e.userid", "eq", getUserId()), "OR", array("e.visibility", ">", 0));
    }
    $pool->setOrder("e.published", "DESC");
    $pool->setProjection("e.*", "c.label AS categoryLabel");
    return Paging::fetch($pool, $page, $count, $ctx->getProperty('uri.folder') . "/" . $ctx->getProperty('suri.value'), "?page=", $countItem);
}
Example #3
0
function getEntriesWithPagingByAuthor($blogid, $author, $page, $count, $countItem = null)
{
    global $database, $folderURL, $suri;
    $userid = User::getUserIdByName($author);
    $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0 AND (c.visibility > 1 OR e.category = 0)';
    $visibility .= doesHaveOwnership() && !Acl::check('group.editors') ? ' AND (e.userid = ' . getUserId() . ' OR e.visibility > 0)' : '';
    $sql = "SELECT e.*, c.label categoryLabel \n\t\tFROM {$database['prefix']}Entries e \n\t\tLEFT JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id \n\t\tWHERE e.blogid = {$blogid} AND e.userid = {$userid} AND e.draft = 0 {$visibility} AND e.category >= 0 \n\t\tORDER BY e.published DESC";
    return Paging::fetch($sql, $page, $count, "{$folderURL}/{$suri['value']}", "?page=", $countItem);
}
Example #4
0
function getEntriesWithPagingByAuthor($blogid, $author, $page, $count, $countItem = null)
{
    $ctx = Model_Context::getInstance();
    $userid = User::getUserIdByName($author);
    $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0 AND (c.visibility > 1 OR e.category = 0)';
    $visibility .= doesHaveOwnership() && !Acl::check('group.editors') ? ' AND (e.userid = ' . getUserId() . ' OR e.visibility > 0)' : '';
    $sql = "SELECT e.*, c.label categoryLabel \n\t\tFROM " . $ctx->getProperty('database.prefix') . "Entries e \n\t\tLEFT JOIN " . $ctx->getProperty('database.prefix') . "Categories c ON e.blogid = c.blogid AND e.category = c.id \n\t\tWHERE e.blogid = {$blogid} AND e.userid = {$userid} AND e.draft = 0 {$visibility} AND e.category >= 0 \n\t\tORDER BY e.published DESC";
    return Paging::fetch($sql, $page, $count, $ctx->getProperty('uri.folder') . "/" . $ctx->getProperty('suri.value'), "?page=", $countItem);
}