/** * Prints the latest news either only news articles or with the latest images or albums as a unordered html list * * NOTE: Latest images and albums require the image_album_statistic plugin * * @param int $number The number of news items to get * @param string $category Optional news articles by category (only "none" option" * @param bool $showdate If the date should be shown * @param bool $showcontent If the content should be shown * @param int $contentlength The lengths of the content * @param bool $showcat If the categories should be shown * @param string $readmore Text for the read more link, if empty the option value for "zenpage_readmore" is used * @param bool $sticky place sticky articles at the front of the list * @return string */ function printLatestNews($number = 5, $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true, $readmore = NULL, $sticky = true) { global $_zp_gallery, $_zp_current_zenpage_news; //check if things are deprecated $args = func_get_args(); $deprecated = array("none", "with_latest_images", "with_latest_images_date", "with_latest_images_mtime", "with_latest_images_publishdate", "with_latest_albums", "with_latest_albums_date", "with_latest_albums_mtime", "with_latest_albums_publishdate", "with_latestupdated_albums"); if (in_array($category, $deprecated)) { // there must be the old options parameter! Zenpage_internal_deprecations::printLatestNews(); list($number, $option, $category, $showdate, $showcontent, $contentlength, $showcat, $readmore, $sticky) = array_merge($args, array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)); } $latest = getLatestNews($number, $category, $sticky); echo "\n<ul id=\"latestnews\">\n"; $count = ""; foreach ($latest as $item) { $count++; $category = ""; $categories = ""; $obj = new ZenpageNews($item['titlelink']); $title = html_encode($obj->getTitle()); $link = html_encode(getNewsURL($item['titlelink'])); $count2 = 0; $category = $obj->getCategories(); foreach ($category as $cat) { $catobj = new ZenpageCategory($cat['titlelink']); $count2++; if ($count2 != 1) { $categories = $categories . ", "; } $categories = $categories . $catobj->getTitle(); } $thumb = ""; $content = $obj->getContent(); if ($obj->getTruncation()) { $shorten = true; } $date = zpFormattedDate(DATE_FORMAT, strtotime($item['date'])); echo "<li>"; echo "<h3><a href=\"" . $link . "\" title=\"" . getBare(html_encode($title)) . "\">" . $title . "</a></h3>\n"; if ($showdate) { echo "<span class=\"latestnews-date\">" . $date . "</span>\n"; } if ($showcontent) { echo "<span class=\"latestnews-desc\">" . getContentShorten($content, $contentlength, '', $readmore, $link) . "</span>\n"; } if ($showcat && !empty($categories)) { echo "<span class=\"latestnews-cats\">(" . html_encode($categories) . ")</span>\n"; } echo "</li>\n"; if ($count == $number) { break; } } echo "</ul>\n"; }
<?php } ?> <!-- PRINTS GALLERY DESCRIPTION --> <h4 class="blockhead"><span><?php echo gettext('About'); ?> </span></h4> <?php printGalleryDesc(); ?> <!-- PRINTS ZENPAGE LATEST NEWS, IF APPLICABLE --> <?php if ($zenpage && getLatestNews() && $_zp_gallery_page != 'news.php' && $zpfocus_news) { if ($zpfocus_spotlight == 'latest' && $_zp_gallery_page == 'index.php') { ?> <div id="spotlight2"> <h4 class="blockhead"><span><?php echo gettext('More News'); ?> </span></h4> <?php printLatestNews(4, '', true, true, 150, true, null); ?> <?php } else { ?> <div id="spotlight1"> <h4 class="blockhead"><span><?php
/** * 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; }
<?php } else { ?> <h2 id="logo"><a href="<?php echo getGalleryIndexURL(); ?> "><?php echo getBareGalleryTitle(); ?> </a></h2> <?php } ?> <?php if ($zenpage && $zpfocus_spotlight == 'latest' && getLatestNews()) { ?> <a id="latest-news-link" href="<?php echo getNewsIndexURL(); ?> "><?php echo gettext('Latest News'); ?> </a> <?php printLatestNewsCustom(1, '', true, true, 500, true); ?> <?php } ?> <?php
?> <div class="row"> <div class="col-md-3"><div class="row"> <div class="col-md-12"><h3>Latest Articles:</h3><?php getLatestNewsSidebar(); ?> </div> <div class="col-md-12"><h3>Categories:</h3><?php getCategories(); ?> </div></div> </div> <div class="col-md-9"> <div class="row"> <div class="col-md-12"><?php getLatestNews($limit, $offset); ?> </div> </div> <div class="row"> <div class="col-md-12"> <?php getPrevBtn($limit, $offset); ?> <?php getNextBtn($limit, $offset); ?> </div> </div> <div class="col-md-12 text-center"><p class="meta"><?php countPosts($limit, $offset);
} } // custom menu check end ?> <?php if (extensionEnabled('zenpage')) { ?> <div class="menu"> <h3><?php echo gettext("Latest notes"); ?> </h3> <ul> <?php $latest = getLatestNews(3); foreach ($latest as $item) { $title = htmlspecialchars(get_language_string($item['title'])); $link = getNewsURL($item['titlelink']); echo "<li><a href=\"" . $link . "\" title=\"" . strip_tags(htmlspecialchars($title, ENT_QUOTES)) . "\">" . htmlspecialchars($title) . "</a></li>"; } ?> </ul> </div> <?php } ?> <div class="menu"> <h3><?php echo gettext("Toolbox");
/** * Prints the latest news either only news articles or with the latest images or albums as a unordered html list * * NOTE: Latest images and albums require the image_album_statistic plugin * * @param int $number The number of news items to get * @param string $option "none" for only news articles * "with_latest_images" for news articles with the latest images by id * "with_latest_images_date" for news articles with the latest images by date * "with_latest_images_mtime" for news articles with the latest images by mtime (upload date) * "with_latest_albums" for news articles with the latest albums by id * "with_latestupdated_albums" for news articles with the latest updated albums * @param string $category Optional news articles by category (only "none" option" * @param bool $showdate If the date should be shown * @param bool $showcontent If the content should be shown * @param int $contentlength The lengths of the content * @param bool $showcat If the categories should be shown * @param string $readmore Text for the read more link, if empty the option value for "zenpage_readmore" is used * @return string */ function printLatestNews($number = 5, $option = 'with_latest_images', $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true, $readmore = NULL) { global $_zp_gallery, $_zp_current_zenpage_news; //trigger_error(gettext('printLatestNews is deprecated. Use printLatestCombiNews().'), E_USER_NOTICE); $latest = getLatestNews($number, $option, $category); echo "\n<ul id=\"latestnews\">\n"; $count = ""; foreach ($latest as $item) { $count++; $category = ""; $categories = ""; switch ($item['type']) { case 'news': $obj = new ZenpageNews($item['titlelink']); $title = html_encode($obj->getTitle()); $link = html_encode(getNewsURL($item['titlelink'])); $count2 = 0; $category = $obj->getCategories(); foreach ($category as $cat) { $catobj = new ZenpageCategory($cat['titlelink']); $count2++; if ($count2 != 1) { $categories = $categories . ", "; } $categories = $categories . $catobj->getTitle(); } $thumb = ""; $content = $obj->getContent(); $date = zpFormattedDate(DATE_FORMAT, strtotime($item['date'])); $type = 'news'; break; case 'images': $obj = newImage(new Album($_zp_gallery, $item['albumname']), $item['titlelink']); $categories = $item['albumname']; $title = $obj->getTitle(); $link = html_encode($obj->getImageLink()); $content = $obj->getDesc(); if ($option == "with_latest_image_date") { $date = zpFormattedDate(DATE_FORMAT, $item['date']); } else { $date = zpFormattedDate(DATE_FORMAT, strtotime($item['date'])); } $thumb = "<a href=\"" . $link . "\" title=\"" . html_encode(strip_tags($title)) . "\"><img src=\"" . html_encode($obj->getThumb()) . "\" alt=\"" . html_encode(strip_tags($title)) . "\" /></a>\n"; $type = "image"; break; case 'albums': $obj = new Album($_zp_gallery, $item['albumname']); $title = $obj->getTitle(); $categories = ""; $link = html_encode($obj->getAlbumLink()); $thumb = "<a href=\"" . $link . "\" title=\"" . $title . "\"><img src=\"" . html_encode($obj->getAlbumThumb()) . "\" alt=\"" . strip_tags($title) . "\" /></a>\n"; $content = $obj->getDesc(); $date = zpFormattedDate(DATE_FORMAT, strtotime($item['date'])); $type = "album"; break; } echo "<li>"; if (!empty($thumb)) { echo $thumb; } echo "<h3><a href=\"" . $link . "\" title=\"" . strip_tags(html_encode($title)) . "\">" . $title . "</a></h3>\n"; if ($showdate) { echo "<span class=\"latestnews-date\">" . $date . "</span>\n"; } if ($showcontent) { echo "<span class=\"latestnews-desc\">" . getContentShorten($content, $contentlength, '', $readmore, $link) . "</span>\n"; } if ($showcat and $type != "album" && !empty($categories)) { echo "<span class=\"latestnews-cats\">(" . html_encode($categories) . ")</span>\n"; } echo "</li>\n"; if ($count == $number) { break; } } echo "</ul>\n"; }
for ($u = 0; $u < count($images); $u++) { $img = $images[$u]; $thumb = $img->getCustomImage(NULL, 75, 75, 75, 75, NULL, NULL, false); $link = $img->getLink(); echo "<span class='thumb" . ($u == count($images) - 1 ? " last" : "") . "'>" . "<img class='pin' src='{$_zp_themeroot}/resources/images/pin.png'/><br/>" . "<a href='{$link}'><img src='{$thumb}' width='75' height='75'/></a>" . "</span>"; } ?> <div class="browse"><a href="<?php echo getGalleryIndexURL(); ?> " class="gallery">Browse gallery</a></div> </div> <div id="latest-news"> <?php $news = getLatestNews(1); foreach ($news as $n) { $link = getNewsURL($n['titlelink']); ?> <div class="news"> <div class="news-header"> <div class="news-date-placeholder"> <span class="left">Latest note: <a href="<?php echo $link; ?> "><?php echo $n['title']; ?> </a></span> <div class="opa40 right"><b>: </b><?php
$images = AlbumUtil::getLatestImages(getOption('simplicity2_home_images_number')); foreach ($images as $img) { $thumb = $img->getCustomImage(NULL, 105, 105, 105, 105, NULL, NULL, false); $link = $img->getLink(); echo "<div class='thumb'><a href='{$link}'><img src='{$thumb}' width='105' height='105'/></a></div>"; } ?> </div> <div id="latest-news" class="left"> <?php $n = getOption('simplicity2_home_news_number'); if (!isset($n) || !is_numeric($n)) { $n = 2; } $news = getLatestNews($n); foreach ($news as $n) { $link = getNewsURL($n['titlelink']); ?> <div class="news home"> <div class="news-header home"> <!-- <div id="news-categories-placeholder" class="right">In: <?php NewsUtil::printNewsCategories(); ?> </div> --> <div class="news-date-placeholder"> <span class="left"><a href="<?php echo $link;
/** * Prints the latest news either only news articles or with the latest images or albums as a unordered html list * * NOTE: Latest images and albums require the image_album_statistic plugin * * @param int $number The number of news items to get * @param string $category Optional news articles by category (only "none" option" * @param bool $showdate If the date should be shown * @param bool $showcontent If the content should be shown * @param int $contentlength The lengths of the content * @param bool $showcat If the categories should be shown * @param string $readmore Text for the read more link, if empty the option value for "zenpage_readmore" is used * @param bool $sticky place sticky articles at the front of the list * @return string */ function printLatestNews($number = 5, $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true, $readmore = NULL, $sticky = true) { global $_zp_gallery; $latest = getLatestNews($number, $category, $sticky); echo "\n<ul id=\"latestnews\">\n"; $count = ""; foreach ($latest as $item) { $count++; $category = ""; $categories = ""; $obj = newArticle($item['titlelink']); $title = html_encode($obj->getTitle()); $link = html_encode(getNewsURL($item['titlelink'])); $count2 = 0; $category = $obj->getCategories(); foreach ($category as $cat) { $catobj = newCategory($cat['titlelink']); $count2++; if ($count2 != 1) { $categories = $categories . ", "; } $categories = $categories . $catobj->getTitle(); } $thumb = ""; $content = $obj->getContent(); if ($obj->getTruncation()) { $shorten = true; } $date = zpFormattedDate(DATE_FORMAT, strtotime($item['date'])); echo "<li>"; echo "<h3><a href=\"" . $link . "\" title=\"" . getBare(html_encode($title)) . "\">" . $title . "</a></h3>\n"; if ($showdate) { echo "<span class=\"latestnews-date\">" . $date . "</span>\n"; } if ($showcontent) { echo "<span class=\"latestnews-desc\">" . getContentShorten($content, $contentlength, '', $readmore, $link) . "</span>\n"; } if ($showcat && !empty($categories)) { echo "<span class=\"latestnews-cats\">(" . html_encode($categories) . ")</span>\n"; } echo "</li>\n"; if ($count == $number) { break; } } echo "</ul>\n"; }
function printLatestNewsCustom($number = 5, $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true) { global $_zp_gallery, $_zp_current_article; $latest = getLatestNews($number, $category); echo "\n<div id=\"latestnews-spotlight\">\n"; $count = ""; foreach ($latest as $item) { $count++; $category = ""; $categories = ""; $obj = newArticle($item['titlelink']); $title = htmlspecialchars($obj->getTitle()); $link = getNewsURL($item['titlelink']); $count2 = 0; $category = $obj->getCategories(); foreach ($category as $cat) { $catobj = new Category($cat['titlelink']); $count2++; if ($count2 != 1) { $categories = $categories . "; "; } $categories = $categories . $catobj->getTitle(); } $content = strip_tags($obj->getContent()); $date = zpFormattedDate(getOption('date_format'), strtotime($item['date'])); $type = 'news'; echo "<div>"; echo "<h3><a href=\"" . $link . "\" title=\"" . strip_tags(htmlspecialchars($title, ENT_QUOTES)) . "\">" . htmlspecialchars($title) . "</a></h3>\n"; echo "<div class=\"newsarticlecredit\">\n"; echo "<span class=\"latestnews-date\">" . $date . "</span>\n"; echo "<span class=\"latestnews-cats\">| Posted in " . $categories . "</span>\n"; echo "</div>\n"; echo "<p class=\"latestnews-desc\">" . html_encode(getContentShorten($content, $contentlength, '(...)', null, null)) . "</p>\n"; echo "</div>\n"; if ($count == $number) { break; } } echo "</div>\n"; }
echo $date; ?> </h3> </div> </div> <?php } ?> <?php $_zp_current_album = NULL; ?> </div> <br style="clear:both;" /><br /> <h3 class="searchheader" >Latest words</h3> <?php $ln = getLatestNews(3); foreach ($ln as $n) { $_zp_current_zenpage_news = new ZenpageNews($n['titlelink']); ?> <div class="newsarticlewrapper"><div class="newsarticle" style="border-width: 0;"> <h3><?php printNewsURL(); ?> </h3> <div class="newsarticlecredit"><span class="newsarticlecredit-left"><?php printNewsDate(); ?> | <?php echo gettext("Comments:");
<?php require_once "common/functions.php"; require_once "db/db.php"; echo getLatestNews($db);
<lastBuildDate><?php echo date("r", time()); ?> </lastBuildDate> <docs>http://blogs.law.harvard.edu/tech/rss</docs> <generator>Zenpage - A CMS plugin for ZenPhoto</generator> <?php switch ($option) { case "category": $latest = getLatestNews($items, "none", $catlink); break; case "news": $latest = getLatestNews($items, "none"); break; case "withimages": $latest = getLatestNews($items, "with_latest_images_date"); break; } $count = ""; foreach ($latest as $item) { $count++; $category = ""; $categories = ""; //get the type of the news item switch ($item['type']) { case 'news': $obj = new ZenpageNews($item['titlelink']); $title = get_language_string($obj->get('title'), $locale); $link = getNewsURL($obj->getTitlelink()); $count2 = 0; $category = $obj->getCategories();
<?php function getLatestNews($connection) { $query = "SELECT title, text, author, public_time, link_forum FROM news ORDER BY public_time DESC LIMIT 10"; $result = mysqli_query($connection, $query) or die("Error: " . mysqli_error($connection)); while ($row = mysqli_fetch_array($result)) { echo "<div class='latest-news'>"; echo "<p class='title'> " . $row["title"] . "</p>"; $news_text = $row["text"]; if (strlen($news_text) > 100) { $print_news = substr($news_text, 0, 100); echo "<p class='news-body'> " . $print_news . '.' . '.' . '.' . "</p>"; } echo "<a href=" . $row['link_forum'] . ">Read more</a>"; echo "<p class='author-time'>" . $row["author"] . " / " . $row["public_time"] . "</p>"; echo "</div>"; } } ?> <div class="news-main"> <div class="latest-news-inner-block"> <?php getLatestNews($conn); ?> </div> </div>