Skip to content

Commit

Permalink
refs #1561 : Added : Author-specific feed generator / URL
Browse files Browse the repository at this point in the history
  • Loading branch information
inureyes committed Feb 25, 2011
1 parent 35e4510 commit e8ec01c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
35 changes: 35 additions & 0 deletions interface/atom/author/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/// Copyright (c) 2004-2011, 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'];
$blogid = getBlogId();

$cache = pageCache::getInstance();
$cache->reset('authorATOM-'.$period);
if(!$cache->load()) {
requireModel("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('authorRSS-'.$period);
$cache->contents = $result;
$cache->update();
}
}
header('Content-Type: application/atom+xml; charset=utf-8');
fireEvent('FeedOBStart');
echo fireEvent('ViewAuthorATOM', $cache->contents);
fireEvent('FeedOBEnd');
?>
1 change: 1 addition & 0 deletions interface/blog/author.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
$author = empty($suri['value']) ? '' : $suri['value'];
$authorId = User::getUserIdByName($author);
if(empty($authorId)) exit;
$listFeedURL = 'author/'.URL::encode($author);

if ($skinSetting['showListOnAuthor'] != 0) {
$cache->name = 'authorList-'.$authorId."-".$suri['page']."-";
Expand Down
35 changes: 35 additions & 0 deletions interface/rss/author/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/// Copyright (c) 2004-2011, 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'];
$blogid = getBlogId();

$cache = pageCache::getInstance();
$cache->reset('authorRSS-'.$period);
if(!$cache->load()) {
requireModel("blog.feed");
list($entries, $paging) = getEntriesWithPagingByAuthor($blogid, $author, 1, 1, 1);
if(empty($entries)) {
header ("Location: ".$context->getProperty('uri.host').$context->getProperty('uri.blog')."/rss");
exit;
}
$result = getFeedWithEntries($blogid,$entries,_textf('%1 의 글 목록',$author),'rss');
if($result !== false) {
$cache->reset('authorRSS-'.$period);
$cache->contents = $result;
$cache->update();
}
}
header('Content-Type: application/rss+xml; charset=utf-8');
fireEvent('FeedOBStart');
echo fireEvent('ViewAuthorRSS', $cache->contents);
fireEvent('FeedOBEnd');
?>

0 comments on commit e8ec01c

Please sign in to comment.