From c4bc890f553c80b9b922405ad6837269e7d80957 Mon Sep 17 00:00:00 2001 From: inureyes Date: Thu, 30 Dec 2010 04:43:42 +0000 Subject: [PATCH] =?UTF-8?q?=20refs=20#1443=20=20=20*=20notice/page?= =?UTF-8?q?=EC=97=90=20=ED=95=B4=EB=8B=B9=20=EB=B6=80=EB=B6=84=EC=9D=84=20?= =?UTF-8?q?=EB=AA=85=EA=B8=B0=ED=95=98=EB=8A=94=20define=EB=AC=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(=ED=98=84=EC=9E=AC=20=EC=93=B0=EC=A7=80?= =?UTF-8?q?=20=EC=95=8A=EC=9D=8C)=20=20=20*=20page=20=EC=B6=9C=EB=A0=A5?= =?UTF-8?q?=EC=8B=9C=20=EC=B9=B4=EC=9A=B4=ED=8A=B8=20=EC=A7=80=EC=9B=90=20?= =?UTF-8?q?=20=20*=20TODO=20=20=20=20*=20page=20list=20=EC=82=AC=EC=9D=B4?= =?UTF-8?q?=EB=93=9C=EB=B0=94=20=EB=AA=A8=EB=93=88=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(=EA=B8=B0=EB=B3=B8=20=EB=AA=A8=EB=93=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interface/blog/notice.php | 1 + interface/blog/page.php | 1 + library/model/blog.entry.php | 20 ++++++++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/interface/blog/notice.php b/interface/blog/notice.php index 02d552727..5d895178e 100644 --- a/interface/blog/notice.php +++ b/interface/blog/notice.php @@ -4,6 +4,7 @@ /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; +define('__TEXTCUBE_NOTICE__',true); if (isset($suri['id']) || (isset($suri['value']) && strlen($suri['value']) > 0)) { if (!isset($suri['id']) || (Setting::getBlogSettingGlobal('useSloganOnPost',1) == 1)) { list($entries, $paging) = getEntryWithPagingBySlogan($blogid, $suri['value'], true); diff --git a/interface/blog/page.php b/interface/blog/page.php index d745789f4..0f4245926 100644 --- a/interface/blog/page.php +++ b/interface/blog/page.php @@ -4,6 +4,7 @@ /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; +define('__TEXTCUBE_PAGE__',true); if (isset($suri['id']) || (isset($suri['value']) && strlen($suri['value']) > 0)) { if (!isset($suri['id']) || (Setting::getBlogSettingGlobal('useSloganOnPost',1) == 1)) { list($entries, $paging) = getEntryWithPagingBySlogan($blogid, $suri['value'], true); diff --git a/library/model/blog.entry.php b/library/model/blog.entry.php index 813a4549d..567724b05 100644 --- a/library/model/blog.entry.php +++ b/library/model/blog.entry.php @@ -26,6 +26,14 @@ function getEntriesTotalCount($blogid) { } function getNoticesTotalCount($blogid) { + return getSpecialEntriesTotalCount($blogid, -2); +} + +function getPagesTotalCount($blogid) { + return getSpecialEntriesTotalCount($blogid, -3); +} + +function getSpecialEntriesTotalCount($blogid, $categoryId) { $pool = DBModel::getInstance(); $pool->reset('Entries'); if (doesHaveOwnership()) $pool->setQualifier('visibility','b',0); @@ -34,7 +42,7 @@ function getNoticesTotalCount($blogid) { } $pool->setQualifier('blogid','eq',$blogid); $pool->setQualifier('draft','eq',0); - $pool->setQualifier('category','eq',-2); + $pool->setQualifier('category','eq',$categoryId); return $pool->getCount('*'); } @@ -395,7 +403,7 @@ function getEntryWithPaging($blogid, $id, $isSpecialEntry = false, $categoryId = $entries = array(); $paging = Paging::init($folderURL, '/'); $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0'; - $visibility .= ($isNotice || doesHaveOwnership()) ? '' : ' AND (c.visibility > 1 OR e.category = 0)'; + $visibility .= ($isSpecialEntry || doesHaveOwnership()) ? '' : ' AND (c.visibility > 1 OR e.category = 0)'; $visibility .= (doesHaveOwnership() && !Acl::check('group.editors')) ? ' AND (e.userid = '.getUserId().' OR e.visibility > 0)' : ''; $category = $isSpecialEntry ? ( $isSpecialEntry == 'page' ? 'e.category = -3' : 'e.category = -2' ) : 'e.category >= 0'; if($categoryId !== false) { @@ -426,7 +434,7 @@ function getEntryWithPaging($blogid, $id, $isSpecialEntry = false, $categoryId = $paging['pages'] = $categoryId == 0 ? getEntriesTotalCount($blogid):getEntriesCountByCategory($blogid, $categoryId); $paging['postfix'] = '?category='.$categoryId; } else { - $paging['pages'] = ($isNotice) ? getNoticesTotalCount($blogid) : getEntriesTotalCount($blogid); + $paging['pages'] = $isSpecialEntry ? ($isSpecialEntry == 'page' ? getPagesTotalCount($blogid) : getNoticesTotalCount($blogid)) : getEntriesTotalCount($blogid); } for ($i = 1; $entry = POD::fetch($result); $i++) { @@ -462,9 +470,9 @@ function getEntryWithPagingBySlogan($blogid, $slogan, $isSpecialEntry = false, $ requireModel('blog.category'); $entries = array(); $ctx = Model_Context::getInstance(); - $paging = $isNotice ? Paging::init($ctx->getProperty('uri.blog')."/notice", '/') : Paging::init($ctx->getProperty('uri.blog')."/entry", '/'); + $paging = $isSpecialEntry ? ( $isSpecialEntry == 'page' ? Paging::init($ctx->getProperty('uri.blog')."/page", '/'): Paging::init($ctx->getProperty('uri.blog')."/notice", '/')) : Paging::init($ctx->getProperty('uri.blog')."/entry", '/'); $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0'; - $visibility .= ($isNotice || doesHaveOwnership()) ? '' : getPrivateCategoryExclusionQuery($blogid); + $visibility .= ($isSpecialEntry || doesHaveOwnership()) ? '' : getPrivateCategoryExclusionQuery($blogid); $visibility .= (doesHaveOwnership() && !Acl::check('group.editors')) ? ' AND (e.userid = '.getUserId().' OR e.visibility > 0)' : ''; $category = $isSpecialEntry ? ( $isSpecialEntry == 'page' ? 'e.category = -3' : 'e.category = -2' ) : 'e.category >= 0'; if($categoryId !== false) { @@ -497,7 +505,7 @@ function getEntryWithPagingBySlogan($blogid, $slogan, $isSpecialEntry = false, $ $paging['pages'] = $categoryId == 0 ? getEntriesTotalCount($blogid):getEntriesCountByCategory($blogid, $categoryId); $paging['postfix'] = '?category='.$categoryId; } else { - $paging['pages'] = ($isNotice) ? getNoticesTotalCount($blogid) : getEntriesTotalCount($blogid); + $paging['pages'] = $isSpecialEntry ? ($isSpecialEntry == 'page' ? getPagesTotalCount($blogid) : getNoticesTotalCount($blogid)) : getEntriesTotalCount($blogid); } for ($i = 1; $entry = POD::fetch($result); $i++) {