cvs: phpweb /archive 2009.php /include layout.inc
| From: | Hannes Magnusson | Date: | Sat, 11 Apr 2009 10:09:20 +0000 |
| Subject: | cvs: phpweb /archive 2009.php /include layout.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-4388@lists.php.net to get a copy of this message | ||
bjori Sat Apr 11 10:09:20 2009 UTC
Modified files:
/phpweb/include layout.inc
/phpweb/archive 2009.php
Log:
Fixed bug#47007 (archives, 2009 == end of 2008)
http://cvs.php.net/viewvc.cgi/phpweb/include/layout.inc?r1=1.299&r2=1.300&diff_format=u
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.299 phpweb/include/layout.inc:1.300
--- phpweb/include/layout.inc:1.299 Fri Apr 10 08:57:51 2009
+++ phpweb/include/layout.inc Sat Apr 11 10:09:19 2009
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.299 2009/04/10 08:57:51 bjori Exp $ */
+/* $Id: layout.inc,v 1.300 2009/04/11 10:09:19 bjori Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -655,7 +655,7 @@
}
// Print news
-function print_news($news, $dog, $max = 5) {
+function print_news($news, $dog, $max = 5, $onlyyear = null) {
$count = 0;
foreach($news as $item) {
$vevent = "";
@@ -701,7 +701,12 @@
// PHP4 strtotime() doesn't support RFC3339 timestamps
$published = substr($item["published"], 0, 10);
- $newsdate = date("d-M-Y", strtotime($published));
+ $nixtimestamp = strtotime($published);
+ $newsdate = date("d-M-Y", $nixtimestamp);
+ if ($onlyyear && date("Y", $nixtimestamp) != $onlyyear) {
+ $count--;
+ continue;
+ }
echo <<< EOT
<div class="newsItem hentry{$vevent}">
http://cvs.php.net/viewvc.cgi/phpweb/archive/2009.php?r1=1.2&r2=1.3&diff_format=u
Index: phpweb/archive/2009.php
diff -u phpweb/archive/2009.php:1.2 phpweb/archive/2009.php:1.3
--- phpweb/archive/2009.php:1.2 Thu Jan 1 13:39:21 2009
+++ phpweb/archive/2009.php Sat Apr 11 10:09:20 2009
@@ -1,5 +1,5 @@
<?php
-// $Id: 2009.php,v 1.2 2009/01/01 13:39:21 bjori Exp $
+// $Id: 2009.php,v 1.3 2009/04/11 10:09:20 bjori Exp $
$_SERVER['BASE_PAGE'] = 'archive/2009.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc';
@@ -17,7 +17,7 @@
<?php
-print_news($NEWS_ENTRIES, array("conferences", "cfp", "frontpage"),
50);
+print_news($NEWS_ENTRIES, array("conferences", "cfp", "frontpage"),
50, 2009);
/* %s/<a href="\(.*\)"><img src="\/images\/news\/\(.*\)"
alt="\(.*\)" width.*><\/a>/<?php news_image("\1", "\2",
"\3"); ?>/g */
site_footer();