| 38 | | if((misc::isMetaBlog() == true) && doesHaveOwnership()) { |
| 39 | | $visibility = 'AND e.visibility > 0 AND (c.visibility > 1 OR e.category = 0)'; |
| 40 | | } else { |
| 41 | | $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0 AND (c.visibility > 1 OR e.category = 0)'; |
| 42 | | } |
| 43 | | $multiple = ($data['metaMode']==2) ? '' : 'e.blogid = ' . getBlogId() . ' AND'; |
| 44 | | $entries = DBQuery::queryAll("SELECT e.blogid, e.id, e.userid, e.title, e.content, e.slogan, e.category, e.published, c.label |
| 45 | | FROM {$database['prefix']}Entries e |
| 46 | | LEFT JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id |
| 47 | | WHERE $multiple e.draft = 0 $visibility AND e.category >= 0 |
| 48 | | ORDER BY published DESC LIMIT $entryLength"); |
| 49 | | |
| 50 | | $html = ''; |
| 51 | | foreach ($entries as $entry){ |
| 52 | | $tagLabelView = ""; |
| 53 | | $blogid = ($data['metaMode']==2) ? $entry['blogid'] : getBlogId(); |
| 54 | | $entryTags = getTags($blogid, $entry['id']); |
| 55 | | $defaultURL = getDefaultURL($blogid); |
| 56 | | if (sizeof($entryTags) > 0) { |
| 57 | | $tags = array(); |
| 58 | | foreach ($entryTags as $entryTag) { |
| 59 | | $tags[$entryTag['name']] = "<a href=\"{$defaultURL}/tag/" . encodeURL($entryTag['name']) . '"' . ((count($entries) == 1 && getBlogSetting('useRelTag', true)) ? ' rel="tag"' : '') . '>' . htmlspecialchars($entryTag['name']) . '</a>'; |
| 60 | | } |
| 61 | | $tagLabelView = "<div class=\"post_tags\"><span>TAG : </span>".implode(",\r\n", array_values($tags))."</div>"; |
| 62 | | } |
| 63 | | $categoryName = htmlspecialchars(empty($entry['category']) ? _text('분류없음') : $entry['label']); |
| 64 | | $categoryLink = "{$defaultURL}/" . (empty($entry['category']) ? "category/" : "category/".encodeURL($categoryName)); |
| 65 | | $permalink = "{$defaultURL}/" . ($blog['useSlogan'] ? "entry/" . encodeURL($entry['slogan']) : $entry['id']); |
| 66 | | |
| 67 | | $html .= '<div class="metapost">'.CRLF; |
| 68 | | if($imageName = MT_Meta_getAttachmentExtract($entry['content'])){ |
| 69 | | if($tempImageSrc = MT_Meta_getImageResizer($blogid, $imageName)){ |
| 70 | | $html .= '<div class="img_preview" style="background:url('.$tempImageSrc.') top center no-repeat #ffffff;"><img src="'.$serviceURL.'/image/spacer.gif" alt="" onclick="window.location.href=\''.$permalink.'\'; return false;" /></div>'.CRLF; |
| 71 | | } |
| 72 | | } |
| 73 | | $html .= ' <h2><a href="'.$permalink.'">'.htmlspecialchars($entry['title']).'</a></h2>'.CRLF; |
| 74 | | $html .= ' <div class="post_info">'.CRLF; |
| 75 | | $html .= ' <span class="category"><a href="'.$categoryLink.'">'.$categoryName.'</a></span>'.CRLF; |
| 76 | | $html .= ' <span class="date">'.Timestamp::format5($entry['published']).'</span>'.CRLF; |
| 77 | | $html .= ' <span class="author">by '.User::getName($entry['userid']).'</span>'.CRLF; |
| 78 | | $html .= ' </div>'.CRLF; |
| 79 | | $html .= ' <div class="post_content">'.htmlspecialchars(UTF8::lessenAsEm(removeAllTags(stripHTML($entry['content'])),250)).'</div>'.CRLF; |
| 80 | | $html .= $tagLabelView; |
| 81 | | $html .= ' <div class="clear"></div>'.CRLF; |
| 82 | | $html .= '</div>'.CRLF; |
| 83 | | } |
| 84 | | $target = $html; |
| 85 | | $cache->contents = $target; |
| 86 | | $cache->update(); |
| 87 | | unset($cache); |
| 88 | | return $target; |
| 89 | | } |
| | 45 | $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0 AND (c.visibility > 1 OR e.category = 0)'; |
| | 46 | } |
| | 47 | $multiple = ($data['metaMode']==2) ? '' : 'e.blogid = ' . getBlogId() . ' AND'; |
| | 48 | $entries = DBQuery::queryAll("SELECT e.blogid, e.id, e.userid, e.title, e.content, e.slogan, e.category, e.published, c.label |
| | 49 | FROM {$database['prefix']}Entries e |
| | 50 | LEFT JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id |
| | 51 | WHERE $multiple e.draft = 0 $visibility AND e.category >= 0 |
| | 52 | ORDER BY published DESC LIMIT $entryLength"); |
| | 53 | |
| | 54 | $html = ''; |
| | 55 | foreach ($entries as $entry){ |
| | 56 | $tagLabelView = ""; |
| | 57 | $blogid = ($data['metaMode']==2) ? $entry['blogid'] : getBlogId(); |
| | 58 | $entryTags = getTags($blogid, $entry['id']); |
| | 59 | $defaultURL = getDefaultURL($blogid); |
| | 60 | if (sizeof($entryTags) > 0) { |
| | 61 | $tags = array(); |
| | 62 | foreach ($entryTags as $entryTag) { |
| | 63 | $tags[$entryTag['name']] = "<a href=\"{$defaultURL}/tag/" . encodeURL($entryTag['name']) . '"' . ((count($entries) == 1 && getBlogSetting('useRelTag', true)) ? ' rel="tag"' : '') . '>' . htmlspecialchars($entryTag['name']) . '</a>'; |
| | 64 | } |
| | 65 | $tagLabelView = "<div class=\"post_tags\"><span>TAG : </span>".implode(",\r\n", array_values($tags))."</div>"; |
| | 66 | } |
| | 67 | $categoryName = htmlspecialchars(empty($entry['category']) ? _text('분류없음') : $entry['label']); |
| | 68 | $categoryLink = "{$defaultURL}/" . (empty($entry['category']) ? "category/" : "category/".encodeURL($categoryName)); |
| | 69 | $permalink = "{$defaultURL}/" . ($blog['useSlogan'] ? "entry/" . encodeURL($entry['slogan']) : $entry['id']); |
| | 70 | |
| | 71 | $html .= '<div class="metapost">'.CRLF; |
| | 72 | if($imageName = MT_Meta_getAttachmentExtract($entry['content'])){ |
| | 73 | if($tempImageSrc = MT_Meta_getImageResizer($blogid, $imageName)){ |
| | 74 | $html .= '<div class="img_preview" style="background:url('.$tempImageSrc.') top center no-repeat #ffffff;"><img src="'.$serviceURL.'/image/spacer.gif" alt="" onclick="window.location.href=\''.$permalink.'\'; return false;" /></div>'.CRLF; |
| | 75 | } |
| | 76 | } |
| | 77 | $html .= ' <h2><a href="'.$permalink.'">'.htmlspecialchars($entry['title']).'</a></h2>'.CRLF; |
| | 78 | $html .= ' <div class="post_info">'.CRLF; |
| | 79 | $html .= ' <span class="category"><a href="'.$categoryLink.'">'.$categoryName.'</a></span>'.CRLF; |
| | 80 | $html .= ' <span class="date">'.Timestamp::format5($entry['published']).'</span>'.CRLF; |
| | 81 | $html .= ' <span class="author">by '.User::getName($entry['userid']).'</span>'.CRLF; |
| | 82 | $html .= ' </div>'.CRLF; |
| | 83 | $html .= ' <div class="post_content">'.htmlspecialchars(UTF8::lessenAsEm(removeAllTags(stripHTML($entry['content'])),250)).'</div>'.CRLF; |
| | 84 | $html .= $tagLabelView; |
| | 85 | $html .= ' <div class="clear"></div>'.CRLF; |
| | 86 | $html .= '</div>'.CRLF; |
| | 87 | } |
| | 88 | $target = $html; |
| | 89 | $cache->contents = $target; |
| | 90 | $cache->dbContents = Timestamp::getUNIXtime(); |
| | 91 | $cache->update(); |
| | 92 | unset($cache); |
| | 93 | return $target; |