Skip to content

Commit

Permalink
WEB: Support for translated news in All News page
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Nov 23, 2015
1 parent c56a00a commit e9749b8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/Models/NewsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ static public function getAllNews($processContent = false) {
if (!($files = scandir(DIR_NEWS))) {
throw new ErrorException(self::NO_FILES);
}
global $lang;
$news = array();
foreach ($files as $filename) {
if (substr($filename, -4) != '.xml') {
continue;
}
if (!($data = @file_get_contents(DIR_NEWS . "/{$filename}"))) {
continue;
if (!is_file(($fname = DIR_NEWS . "/$lang/" . basename($filename)))
|| !is_readable($fname) || !($data = @file_get_contents($fname))) {
if (!($data = @file_get_contents(DIR_NEWS . "/{$filename}"))) {
continue;
}
}
$news[] = new News($data, $filename, $processContent);
}
Expand Down

0 comments on commit e9749b8

Please sign in to comment.