Jeremy Newman : set last modified from news dates
Jeremy Newman
jnewman at winehq.org
Tue Jun 7 11:24:04 CDT 2022
Module: website
Branch: master
Commit: 83aad1182ff9a5c2a749434ed811d7b4cea18ec1
URL: https://source.winehq.org/git/website.git/?a=commit;h=83aad1182ff9a5c2a749434ed811d7b4cea18ec1
Author: Jeremy Newman <jnewman at codeweavers.com>
Date: Tue Jun 7 10:40:29 2022 -0500
set last modified from news dates
---
include/plugins/news.php | 44 ++++++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/include/plugins/news.php b/include/plugins/news.php
index 94f18e30..e05dfeb6 100644
--- a/include/plugins/news.php
+++ b/include/plugins/news.php
@@ -58,6 +58,9 @@ switch ($flag)
// The single flag guarantees vars already has the news path
+ // set last modified
+ $html->set_last_modified($vars['date'], true);
+
// set open graph tags
$html->meta_og['title'] = trim($vars['title']);
$ogmode = preg_replace('/^(.*)({\$root}\/)(wwn|announce)(\/)(.*)$/ms', '$3', $vars['body']);
@@ -101,11 +104,6 @@ switch ($flag)
$news = array_reverse ($news);
// clear cache and output the rss file
- header('Pragma: public');
- header('Expires: 0');
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Content-Type: application/xml');
- header('Content-Disposition: inline; filename="winehq_news.xml";');
$rss_rows = "";
$c = 0;
foreach ($news as $key => $item)
@@ -135,24 +133,27 @@ switch ($flag)
// display row
$rss_row = array(
- 'item_title' => strip_tags($vars['title']),
- 'item_desc' => $vars['body'],
- 'item_link' => $vars['link'],
- 'item_guid' => $config->base_url.'?news='.$item,
- 'item_date' => date("r", strtotime($vars['date']))
- );
+ 'item_title' => strip_tags($vars['title']),
+ 'item_desc' => $vars['body'],
+ 'item_link' => $vars['link'],
+ 'item_guid' => $config->base_url.'?news='.$item,
+ 'item_date' => date("r", strtotime($vars['date']))
+ );
$rss_rows .= $html->template('global', 'xml/rss_row', $rss_row, 1);
+ $html->set_last_modified($vars['date'], true);
}
unset($c);
$rss = array(
- 'rss_date' => date("r", $top_date),
- 'rss_title' => "{$config->site_name} News",
- 'rss_link' => "{$config->base_url}news/rss/",
- 'rss_img' => "https://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-announcement.png",
- 'rss_desc' => 'News and information about Wine',
- 'rss_crt' => '(C) '.$config->site_name.' '.date("Y", time()),
- 'rss_rows' => $rss_rows
- );
+ 'rss_date' => date("r", $top_date),
+ 'rss_title' => "{$config->site_name} News",
+ 'rss_link' => "{$config->base_url}news/rss/",
+ 'rss_img' => "https://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-announcement.png",
+ 'rss_desc' => 'News and information about Wine',
+ 'rss_crt' => '(C) '.$config->site_name.' '.date("Y", time()),
+ 'rss_rows' => $rss_rows
+ );
+ $html->http_header("application/xml");
+ header('Content-Disposition: inline; filename="winehq_news.xml";');
echo $html->template('global', 'xml/rss', $rss);
exit();
break;
@@ -210,7 +211,10 @@ switch ($flag)
// add to news body
echo $html->template('base', 'news_row', $vars);
-
+
+ // set last modified
+ $html->set_last_modified($vars['date'], true);
+
// show only $max
if ($c - $x == $amax)
break;
More information about the wine-cvs
mailing list