[Scummvm-git-logs] scummvm-web master -> 094efe3fc8104a6726f8618c47844148b5ac409f

criezy criezy at scummvm.org
Fri Mar 31 22:19:42 CEST 2017


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
08ccbe725d WEB: Fix date for news on the archive and news by date pages
094efe3fc8 WEB: Fix sorting of recent news when we have several news for the same date


Commit: 08ccbe725dcfcc7cb806cef641c5e8a95c4a2ae5
    https://github.com/scummvm/scummvm-web/commit/08ccbe725dcfcc7cb806cef641c5e8a95c4a2ae5
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-03-31T21:15:25+01:00

Commit Message:
WEB: Fix date for news on the archive and news by date pages

The news page that limits news to the last few news was properly handling file names with a character after the date (used when we
have several news for the same day).  However the pages for the
news archive or for the news for a date were not removing that
additional character and the link for the header of the news had
this incorrect date with the additional character.

Changed paths:
    templates/news.tpl


diff --git a/templates/news.tpl b/templates/news.tpl
index 3e3cf68..d2cbfba 100644
--- a/templates/news.tpl
+++ b/templates/news.tpl
@@ -2,7 +2,11 @@
 {assign var='news_date' value=$news->getDate()|date_format:"%Y%m%d"}
 {assign var='news_filename' value=$news->getFilename()|substr:'0':'-4'}
 {if !empty($date) && ($date == 'archive' || strlen($date) == 8)}
-	{assign var='news_date' value=$news_filename}
+	{if strlen($news_filename) == 9}
+		{assign var='news_date' value=$news_filename|substr:'0':'-1'}
+	{else}
+		{assign var='news_date' value=$news_filename}
+	{/if}
 {/if}
 
 <div class="box">


Commit: 094efe3fc8104a6726f8618c47844148b5ac409f
    https://github.com/scummvm/scummvm-web/commit/094efe3fc8104a6726f8618c47844148b5ac409f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-03-31T21:18:42+01:00

Commit Message:
WEB: Fix sorting of recent news when we have several news for the same date

The news archive page and news for a date page where using natural sorting for
the dates, which properly handles dates with an additional alphabetic character
at the end (used when we have several news for the same day). However the
recent news code was using a numeric sort, which resulted in those dates not
being properly handled and the order being the reverse of what we want.

Changed paths:
    include/Models/NewsModel.php


diff --git a/include/Models/NewsModel.php b/include/Models/NewsModel.php
index 7747329..bbda182 100644
--- a/include/Models/NewsModel.php
+++ b/include/Models/NewsModel.php
@@ -21,7 +21,7 @@ abstract class NewsModel extends BasicModel {
 			}
 			$dates[] = substr($file, 0, -4);
 		}
-		sort($dates, SORT_NUMERIC);
+		sort($dates, SORT_STRING);
 		return $dates;
 	}
 
@@ -55,7 +55,7 @@ abstract class NewsModel extends BasicModel {
 			if (!($newslist = NewsModel::getListOfNewsDates())) {
 				throw new ErrorException(self::NO_FILES);
 			}
-			rsort($newslist, SORT_NUMERIC);
+			rsort($newslist, SORT_STRING);
 			$newslist = array_slice($newslist, 0, $num);
 			$news = array();
 			foreach ($newslist as $date) {





More information about the Scummvm-git-logs mailing list