/** * Gets the feed items * * @return array */ public function getitems() { global $_zp_CMS; switch ($this->feedtype) { case 'gallery': if ($this->mode == "albums") { $items = getAlbumStatistic($this->itemnumber, $this->sortorder, $this->albumfolder, 0, $this->sortdirection); } else { $items = getImageStatistic($this->itemnumber, $this->sortorder, $this->albumfolder, $this->collection, 0, $this->sortdirection); } break; case 'news': switch ($this->newsoption) { case "category": if ($this->sortorder) { $items = getZenpageStatistic($this->itemnumber, 'categories', $this->sortorder, $this->sortdirection); } else { $items = getLatestNews($this->itemnumber, $this->catlink, false, $this->sortdirection); } break; default: case "news": if ($this->sortorder) { $items = getZenpageStatistic($this->itemnumber, 'news', $this->sortorder, $this->sortdirection); } else { // Needed baceause type variable "news" is used by the feed item method and not set by the class method getArticles! $items = getLatestNews($this->itemnumber, '', false, $this->sortdirection); } break; } break; case "pages": if ($this->sortorder) { $items = getZenpageStatistic($this->itemnumber, 'pages', $this->sortorder, $this->sortdirection); } else { $items = $_zp_CMS->getPages(NULL, false, $this->itemnumber); } break; case 'comments': switch ($type = $this->commentfeedtype) { case 'gallery': $items = getLatestComments($this->itemnumber, 'all'); break; case 'album': $items = getLatestComments($this->itemnumber, 'album', $this->id); break; case 'image': $items = getLatestComments($this->itemnumber, 'image', $this->id); break; case 'zenpage': $type = 'all'; case 'news': case 'page': if (function_exists('getLatestZenpageComments')) { $items = getLatestZenpageComments($this->itemnumber, $type, $this->id); } break; case 'allcomments': $items = getLatestComments($this->itemnumber, 'all'); $items_zenpage = array(); if (function_exists('getLatestZenpageComments')) { $items_zenpage = getLatestZenpageComments($this->itemnumber, 'all', $this->id); $items = array_merge($items, $items_zenpage); $items = sortMultiArray($items, 'date', true); $items = array_slice($items, 0, $this->itemnumber); } break; } break; } if (isset($items)) { return $items; } if (TEST_RELEASE) { zp_error(gettext('Bad ' . $this->feed . ' feed:' . $this->feedtype), E_USER_WARNING); } return NULL; }
?> <h4 class="blockhead"><span><?php echo gettext('Latest Comments'); ?> </span></h4> <?php printLatestDisqus(3, 100); } else { ?> <!-- IF NO DISQUS, PRINTS LATEST GALLERY COMMENTS OR NEWS COMMENTS --> <?php if ($_zp_gallery_page != 'news.php') { ?> <?php if (function_exists('printCommentForm') && getLatestComments(1, 'all')) { ?> <h4 class="blockhead"><span><?php echo gettext('Latest Gallery Comments'); ?> </span></h4> <?php printLatestComments(3, '100'); ?> <?php } ?> <?php } else { ?> <?php
$admin = getAdministrators(); $admin = array_shift($admin); $adminname = $admin['user']; $adminemail = $admin['email']; ?> <managingEditor><?php echo "{$adminemail} ({$adminname})"; ?> </managingEditor> <webMaster><?php echo "{$adminemail} ({$adminname})"; ?> </webMaster> <?php $comments = getLatestComments($items); foreach ($comments as $comment) { if ($comment['anon'] === "0") { $author = " " . gettext("by") . " " . $comment['name']; } else { $author = ""; } $album = $comment['folder']; if ($comment['type'] != "albums" and $comment['type'] != "news" and $comment['type'] != "pages") { // check if not comments on albums or Zenpage items $imagetag = $imagepath . $comment['filename'] . $modrewritesuffix; } else { $imagetag = ""; } $date = $comment['date']; $albumtitle = $comment['albumtitle'];
<ul> <?php $posts = getLatestPosts(); foreach ($posts as $row) { echo '<li><a href="' . HTTP_SERVER . $row['post_link'] . '.html" title="' . $row['post_h1'] . '">' . $row['post_h1'] . '</a></li>'; } ?> </ul> </div> </div> <div class="box"> <h2>Recent comments:</h2> <div class="full"> <ul> <?php $comments = getLatestComments(); foreach ($comments as $row) { echo '<li><a href="' . HTTP_SERVER . $row['post_link'] . '.html#' . $row['comment_id'] . '" title="' . $row['post_h1'] . '">' . stripString($row['comment'], 38) . '</a></li>'; } ?> </ul> </div> </div> <div class="box"> <h2>Flickr Photos: </h2> <div id="flickr_badge_uber_wrapper"> <a href="http://www.flickr.com/photos/swapnilsarwe/" id="flickr_www"> www.<strong>flickr</strong>.com/photos/swapnilsarwe/ </a> <div id="flickr_badge_wrapper"> <script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=9&display=random&size=s&layout=x&source=user&user=85538283%40N00"></script> </div> </div> </div>
/** * Prints out latest comments for images and albums * * @param int $number how many comments you want. * @param string $shorten the number of characters to shorten the comment display * @param string $type "all" for all latest comments of all images and albums * "image" for the lastest comments of one specific image * "album" for the latest comments of one specific album * @param int $itemID the ID of the element to get the comments for if $type != "all" */ function printLatestComments($number, $shorten = '123', $type = "all", $itemID = "") { if (MOD_REWRITE) { $albumpath = "/"; $imagepath = "/"; $modrewritesuffix = getOption('mod_rewrite_image_suffix'); } else { $albumpath = "/index.php?album="; $imagepath = "&image="; $modrewritesuffix = ""; } $comments = getLatestComments($number, $type, $itemID); echo "<ul id=\"showlatestcomments\">\n"; foreach ($comments as $comment) { if ($comment['anon'] === "0") { $author = " " . gettext("by") . " " . $comment['name']; } else { $author = ""; } $album = $comment['folder']; if ($comment['type'] != "albums" and $comment['type'] != "news" and $comment['type'] != "pages") { // check if not comments on albums or Zenpage items $imagetag = $imagepath . $comment['filename'] . $modrewritesuffix; } else { $imagetag = ""; } $date = $comment['date']; $albumtitle = get_language_string($comment['albumtitle']); $title = ''; if ($comment['type'] != 'albums') { if ($comment['title'] == "") { $title = ''; } else { $title = get_language_string($comment['title']); } } $website = $comment['website']; $shortcomment = truncate_string($comment['comment'], $shorten); if (!empty($title)) { $title = ": " . $title; } echo "<li><a href=\"" . WEBPATH . $albumpath . $album . $imagetag . "\" class=\"commentmeta\">" . $albumtitle . $title . $author . "</a><br />\n"; echo "<span class=\"commentbody\">" . $shortcomment . "</span></li>"; } echo "</ul>\n"; }
} $comments = getLatestComments($items, $type, $id); break; case 'zenpage': case 'news': case 'page': if ($type == 'zenpage') { $type = 'all'; } if (function_exists('getLatestZenpageComments')) { $comments = getLatestZenpageComments($items, $type, $id); } break; case 'allcomments': $type = 'all'; $comments = getLatestComments($items, $type, $id); $comments_zenpage = array(); if (function_exists('getLatestZenpageComments')) { $comments_zenpage = getLatestZenpageComments($items, $type, $id); $comments = array_merge($comments, $comments_zenpage); $comments = sortMultiArray($comments, 'id', true); $comments = array_slice($comments, 0, $items); } break; } foreach ($comments as $comment) { if ($comment['anon']) { $author = ""; } else { $author = " " . gettext("by") . " " . $comment['name']; }
/** * Prints latest comments for images, albums, news and pages * * @param see getLatestComments * */ function printLatestComments($number, $shorten = '123', $type = "all", $item = NULL, $ulid = 'showlatestcomments') { $comments = getLatestComments($number, $type, $item); echo '<ul id="' . $ulid . $item . "\">\n"; foreach ($comments as $comment) { if ($comment['anon'] === "0") { $author = " " . gettext("by") . " " . $comment['name']; } else { $author = ""; } $shortcomment = shortenContent($comment['comment'], $shorten, ''); $website = $comment['website']; $date = $comment['date']; switch ($comment['type']) { case 'albums': $album = getItemByID('albums', $comment['ownerid']); if ($album) { echo '<li><a href="' . $album->getLink() . '" class="commentmeta">' . $album->getTitle() . $author . "</a><br />\n"; echo '<span class="commentbody">' . $shortcomment . '</span></li>'; } break; case 'images': $image = getItemByID('images', $comment['ownerid']); if ($image) { echo '<li><a href="' . $image->getLink() . '" class="commentmeta">' . $image->album->gettitle() . ': ' . $image->getTitle() . $author . "</a><br />\n"; echo '<span class="commentbody">' . $shortcomment . '</span></li>'; } break; case 'news': $news = getItemByID('news', $comment['ownerid']); if ($news) { echo '<li><a href="' . $news->getLink() . '" class="commentmeta">' . gettext('Article') . ':' . $news->getTitle() . $author . "</a><br />\n"; echo '<span class="commentbody">' . $shortcomment . '</span></li>'; } break; case 'pages': $page = getItemByID('news', $comment['ownerid']); if ($page) { echo '<li><a href="' . $page->getLink() . '" class="commentmeta">' . gettext('Article') . ':' . $page->getTitle() . $author . "</a><br />\n"; echo '<span class="commentbody">' . $shortcomment . '</span></li>'; } break; } } echo "</ul>\n"; }