aboutsummaryrefslogtreecommitdiffstats
path: root/en/index.php
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2018-04-27 20:03:03 +0200
committerfilip <filip.komar@gmail.com>2018-04-27 20:03:03 +0200
commit1e35475cee83c4e19f7c165011064ae77231924b (patch)
treeddc16f0c90d25f72faccc997c92fd435b3cfe13c /en/index.php
parentb379ed46dd9bf2ef5b7e8dd29a4c7b8b8259101b (diff)
downloadwww-1e35475cee83c4e19f7c165011064ae77231924b.tar
www-1e35475cee83c4e19f7c165011064ae77231924b.tar.gz
www-1e35475cee83c4e19f7c165011064ae77231924b.tar.bz2
www-1e35475cee83c4e19f7c165011064ae77231924b.tar.xz
www-1e35475cee83c4e19f7c165011064ae77231924b.zip
show only recent planet&blog post
show localized planet if exists otherwise localized blog if number of localized titles is less then required add English planet and English blog as fallback
Diffstat (limited to 'en/index.php')
-rwxr-xr-xen/index.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/en/index.php b/en/index.php
index 8f4e2f130..3015df71b 100755
--- a/en/index.php
+++ b/en/index.php
@@ -233,10 +233,18 @@ $dictionary = read_translation_file($locale, array('index', 'news', 'common_foot
$prefix = '<span style="font-weight: bold;">';
$prefix .= sprintf(_r('Latest news from our <a href="%s">blog</a>:'), _r('https://blog.mageia.org/en/'));
$prefix .= '</span> ';
- if (_r('https://planet.mageia.org/en/') != 'https://planet.mageia.org/en/') {
- show_feed($locale, null, _r('https://planet.mageia.org/en/'), _r('https://planet.mageia.org/en/') . '?type=rss10', 1, null, true, $prefix);
- } else {
- show_feed($locale, null, _r('https://blog.mageia.org/en/'), _r('https://blog.mageia.org/en/') . '?feed=rss', 1, null, true, $prefix);
+ $loc_planet_url = _r('https://planet.mageia.org/en/');
+ $loc_blog_url = _r('https://blog.mageia.org/en/');
+ $fresh_blog_post_titles = prepare_fresh_blog_post_titles('https://planet.mageia.org/en/', 'https://blog.mageia.org/en/', $loc_planet_url, $loc_blog_url, 1, 1);
+ $fresh_loc_posts = $fresh_blog_post_titles[1];
+ $num_fresh_loc_posts = $fresh_blog_post_titles[2];
+ $fresh_eng_posts = $fresh_blog_post_titles[4];
+ $num_fresh_eng_posts = count($fresh_eng_posts);
+ if(0 != $num_fresh_loc_posts) {
+ show_feed($locale, null, '', '', 0, null, true, $prefix, $fresh_loc_posts);
+ }
+ if(0 != $num_fresh_eng_posts) {
+ show_feed($locale, null, '', '', 0, null, true, $prefix, $fresh_eng_posts);
}
?>
</div>