} } else { ?> <li class="empty">글이 없습니다.</li> <?php } ?> </ul> </div> <?php echo drawAdminBoxEnd();?> </div> <!-- new version --> <div id="new_version_sidebar" class="sidebar_item"> <?php list($feedItems, $totalFeedItems) = FeedItem::getFeedItems('blogURL','itcanus.net/bloglounge_download',Feed::blogURL2Id('http://itcanus.net/bloglounge_download'),1,10); if($totalFeedItems==0) { // 자동등록된 공지사항 피드를 삭제하였을경우 .. 동적으로 읽어 온다. list($status, $feed, $xml) = Feed::getRemoteFeed('http://itcanus.net/bloglounge_download/rss'); if($status == 0) { $feedItems = Feed::getFeedItems($xml); if(count($feedItems) > 10) $feedItems = array_slice($feedItems, 0,10); $totalFeedItems = count($feedItems); } } ?> <?php echo drawAdminBoxBegin('new_version');?> <div class="title"> <a href="http://itcanus.net/bloglounge_download" target="_blank"><?php echo _t('다운로드');?></a> <span class="subtitle"><?php echo _t('현재버전');?> v<?php echo BLOGLOUNGE_VERSION;?></span> </div> <div class="line"></div> <div class="data">
<?php define('ROOT', '..'); include ROOT . '/lib/include.php'; // 글 목록 $searchType = $accessInfo['action']; $searchKeyword = func::decode($accessInfo['value']); if ($searchType=='tag') { } else if ($searchType=='blogURL') { // 블로그주소 if(!empty($searchKeyword)) { $searchFeedId = Feed::blogURL2Id('http://'.str_replace('http://', '', $searchKeyword)); $searchExtraValue = $searchFeedId; } } else if($searchType=='archive') { // 날짜.. $targetDate = (!Validator::is_digit($searchKeyword) || strlen($searchKeyword) != 8) ? date("Ymd") : $searchKeyword; $tDate = substr($targetDate, 0, 4).'-'.substr($targetDate, 4, 2).'-'.substr($targetDate, 6, 2); $tStart = strtotime("$tDate 00:00:00"); if(isset($accessInfo['pass'][0]) && Validator::is_digit($accessInfo['pass'][0]) && strlen($accessInfo['pass'][0]) == 8) { $targetDate = $accessInfo['pass'][0]; $tDate = substr($targetDate, 0, 4).'-'.substr($targetDate, 4, 2).'-'.substr($targetDate, 6, 2); $tEnd = strtotime("$tDate 00:00:00"); $searchExtraValue = array('start'=>$tStart,'end'=>$tEnd); } else { $searchExtraValue = $tStart; } }
<?php define('ROOT', '..'); include ROOT . '/lib/include.php'; $searchFeedId = $accessInfo['action']; $searchType = 'blogURL'; if(is_numeric($searchFeedId)) { $searchKeyword = 'http://'.str_replace('http://', '', Feed::get($searchFeedId, 'blogURL')); $searchExtraValue = $searchFeedId; } else { $searchKeyword = 'http://'.str_replace('http://', '', $accessInfo['address']); $searchExtraValue = Feed::blogURL2Id('http://'.str_replace('http://', '', $searchKeyword)); } include ROOT . '/lib/begin.php'; $pageCount = $skinConfig->postList; // ÆäÀÌÁö°¹¼ö list($posts, $totalFeedItems) = FeedItem::getFeedItems($searchType, $searchKeyword, $searchExtraValue, $page, $pageCount); $paging = Func::makePaging($page, $pageCount, $totalFeedItems); include ROOT . '/lib/piece/message.php'; include ROOT . '/lib/piece/postlist.php'; include ROOT . '/lib/end.php'; ?>
function getFeedItemsQuery($searchType, $searchKeyword, $searchExtraValue,$viewDelete = false,$owner = 0) { global $db, $database, $config; $sQuery = ''; if (($searchType=='tag' || $searchType=='tag+group_category') && !Validator::is_empty($searchKeyword)) { $tagIds = array(); $tags = explode(',',$searchKeyword); if($tagResult = $db->queryAll('SELECT id FROM '.$database['prefix'].'Tags WHERE name IN ('.Func::implode_string(',',$tags).')')) { foreach($tagResult as $tagItem) array_push($tagIds, $tagItem['id']); } if (empty($tagIds)) { return array(null,0); } else { if($searchType == 'tag') { $sQuery = ' LEFT JOIN '.$database['prefix'].'TagRelations r ON (r.item = i.id AND (r.type = "feed")) WHERE r.tag IN ('.implode(',',$tagIds).')'; } else if($searchType == 'tag+group_category') { $sQuery = ' LEFT JOIN '.$database['prefix'].'TagRelations r ON (r.item = i.id AND (r.type = "feed" || r.type = "group_category")) WHERE r.tag IN ('.implode(',',$tagIds).')'; } } } else if ($searchType=='blogURL' && !Validator::is_empty($searchKeyword)){ $searchKeyword = UTF8::bring($searchKeyword); $searchFeedId = $searchExtraValue; if(empty($searchFeedId)) { $searchFeedId = Feed::blogURL2Id('http://'.str_replace('http://', '', $searchKeyword)); } if(!empty($searchFeedId)) { $sQuery = ' WHERE i.feed = '.$searchFeedId; } else { $sQuery = ' WHERE 1=0 '; } } else if ($searchType=='user' && !Validator::is_empty($searchKeyword)){ $searchKeyword = UTF8::bring($searchKeyword); $searchFeedId = $searchExtraValue; if(empty($searchFeedId)) { if(is_numeric($searchKeyword)) { $user = User::getById($searchKeyword); } else { $user = User::getByloginId($searchKeyword); } $searchFeedId = Feed::getIdListByOwner($user['id']); } if(!empty($searchFeedId)) { $sQuery = ' WHERE i.feed IN ('.implode(",",$searchFeedId).')'; } else { $sQuery = ' WHERE 1=0 '; } } else if ($searchType=='author' && !Validator::is_empty($searchKeyword)){ $searchKeyword = UTF8::bring($searchKeyword); if(!empty($searchKeyword)) { $sQuery = ' WHERE i.author = "' . $searchKeyword . '"'; } else { $sQuery = ' WHERE 1=0 '; } } else if ($searchType=='title+description' && !Validator::is_empty($searchKeyword)){ $searchKeyword = UTF8::bring($searchKeyword); $keyword = $db->escape($searchKeyword); $sQuery = ' WHERE i.description LIKE "%'.$keyword.'%"'; } else if ($searchType=='title' && !Validator::is_empty($searchKeyword)){ $searchKeyword = UTF8::bring($searchKeyword); $keyword = $db->escape($searchKeyword); $sQuery = ' WHERE i.title LIKE "%'.$keyword.'%"'; } else if ($searchType=='description' && !Validator::is_empty($searchKeyword)){ $searchKeyword = UTF8::bring($searchKeyword); $keyword = $db->escape($searchKeyword); $sQuery = ' WHERE i.description LIKE "%'.$keyword.'%"'; } else if ($searchType=='focus'){ $sQuery = ' WHERE i.focus = "'.$searchKeyword.'"'; } else if ($searchType=='group') { requireComponent('Bloglounge.Data.Groups'); if(!empty($searchExtraValue)) { $tagId = $db->pick('SELECT id FROM '.$database['prefix'].'Tags WHERE name="'.$db->escape(urldecode($searchExtraValue)).'"'); if($tagId) { $tagId = $tagId[0]; $sQuery = ' LEFT JOIN '.$database['prefix'].'TagRelations r ON (r.item = i.id AND r.type = "group_category") '; } } if(!is_numeric($searchKeyword)) { $group = Group::getByName($searchKeyword); $searchKeyword = $group['id']; } if($searchKeyword) { $feedIds = Group::getFeedIdList($searchKeyword); $sQuery .= ' WHERE i.feed IN (' . implode(',',$feedIds) .')'; if($tagId) { $sQuery .= ' AND r.tag="'.$tagId.'"'; } } } else if ($searchType=='category') { requireComponent('Bloglounge.Data.Category'); if(is_numeric($searchKeyword)) { $category = Category::getById($searchKeyword); } else { $category = Category::getByName($searchKeyword); } if($category) { $sQuery = ' WHERE c.category = ' . $category['id']; } } else if ($searchType == 'archive' && !Validator::is_empty($searchKeyword)) { if(is_array($searchExtraValue) && array_key_exists('start',$searchExtraValue) && array_key_exists('end',$searchExtraValue)) { $tStart = $searchExtraValue['start']; $tEnd = $searchExtraValue['end'] + 86400; } else { $tStart = $searchExtraValue; $tEnd = $tStart + 86400; } $tQuery = ' WHERE i.written > '.$tStart.' AND i.written < '.$tEnd.' '; if (strpos($sQuery, 'WHERE') !== false) { $sQuery = str_replace('WHERE ', $tQuery.' AND (', $sQuery); $sQuery .= ')'; } else { $sQuery .= $tQuery; } } else { if (!Validator::is_empty($searchKeyword)) { $searchKeyword = UTF8::bring($searchKeyword); $keyword = $db->escape($searchKeyword); if(empty($searchExtraValue)) { // all : title, description, tags, permlink $sQuery = ' WHERE i.author LIKE "%'.$keyword.'%" OR i.title LIKE "%'.$keyword.'%" OR i.description LIKE "%'.$keyword.'%" OR i.tags LIKE "%'.$keyword.'%" OR i.permalink LIKE "%'.$keyword.'%"'; } else { // custom $sQuery = ' WHERE ' . $searchExtraValue; } } } // boomDownReactor, boomDownReactorLimit : 리액터가 숨기기일때 쿼리에서 제외 파트 추가 ( 특정수만큼 붐다운(비추천)한글은 제외하거나 특정기능.. if(isset($config)) { if (($config->boomDownReactor == 'hide') && ($config->boomDownReactLimit > 0)) { $bQuery = ' WHERE (i.boomDown <= '.$config->boomDownReactLimit.') '; if (strpos($sQuery, 'WHERE') !== false) { $sQuery = str_replace('WHERE ', $bQuery.' AND (', $sQuery); $sQuery .= ')'; } else { $sQuery .= $bQuery; } } } if(empty($owner)) { if($viewDelete) { // 공개된 블로그만 뽑기 + 삭제된 글 보이기 if(!isAdmin()) { $bQuery = ' WHERE (i.visibility = "d") AND (i.feedVisibility = "y") '; } else { $bQuery = ' WHERE (i.visibility = "d") '; } } else { // 공개된 블로그만 뽑기 if(!isAdmin()) { $bQuery = ' WHERE (i.visibility = "y") AND (i.feedVisibility = "y") '; } else { $bQuery = ' WHERE (i.visibility != "d") '; } } } else { if($viewDelete) { // 공개된 블로그만 뽑기 // if(!isAdmin()) { // $bQuery = ' WHERE (i.visibility = "d") AND (i.feedVisibility = "y") AND (f.owner = ' . $owner . ')'; // } else { $bQuery = ' WHERE (i.visibility = "d") AND (f.owner = ' . $owner . ')'; // } } else { // 공개된 블로그만 뽑기 // if(!isAdmin()) { // $bQuery = ' WHERE (i.visibility = "y") AND (i.feedVisibility = "y") AND (f.owner = ' . $owner . ')'; // } else { $bQuery = ' WHERE (i.visibility != "d") AND (f.owner = ' . $owner . ')'; // } } } if($viewDelete) { if(strpos($sQuery, 'Feeds f') === false ) { $bQuery = ' LEFT JOIN '.$database['prefix'].'Feeds f ON (f.id = i.feed) ' . $bQuery; } } if (strpos($sQuery, 'WHERE') !== false) { $sQuery = str_replace('WHERE ', $bQuery.' AND (', $sQuery); $sQuery .= ')'; } else { $sQuery .= $bQuery; } return $sQuery; }