Module: website Branch: master Commit: 4cebcb6bb5cf53bf7a3ed6fd080cc9def4e61c18 URL: https://source.winehq.org/git/website.git/?a=commit;h=4cebcb6bb5cf53bf7a3ed6...
Author: Jeremy Newman jnewman@codeweavers.com Date: Tue Jun 7 11:23:50 2022 -0500
set last modified
---
include/wwn.php | 95 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 40 deletions(-)
diff --git a/include/wwn.php b/include/wwn.php index 6aeb7d35..da29b781 100644 --- a/include/wwn.php +++ b/include/wwn.php @@ -27,28 +27,28 @@ class wwn $this->summary = array(); $this->person = array(); $this->map_array = array( - "a" => "a", - "b" => "b", - "blockquote" => "blockquote", - "center" => "center", - "code" => "code", - "div" => "div", - "font" => "font", - "i" => "i", - "img" => "img", - "li" => "li", - "table" => "table", - "tr" => "tr", - "td" => "td", - "th" => "th", - "dt" => "dt", - "dd" => "dd", - "tt" => "tt", - "pre" => "pre", - "u" => "u", - "ul" => "ul", - "ol" => "ol", - ); + "a" => "a", + "b" => "b", + "blockquote" => "blockquote", + "center" => "center", + "code" => "code", + "div" => "div", + "font" => "font", + "i" => "i", + "img" => "img", + "li" => "li", + "table" => "table", + "tr" => "tr", + "td" => "td", + "th" => "th", + "dt" => "dt", + "dd" => "dd", + "tt" => "tt", + "pre" => "pre", + "u" => "u", + "ul" => "ul", + "ol" => "ol", + ); }
// read dir and get issues @@ -64,6 +64,7 @@ class wwn default: $dir = opendir($config->wwn_xml_path."/".$config->lang); } + $old = 0; while($file = readdir($dir)) { if ($file == "." or $file == ".." or $file == "CVS" or $file == "interviews") @@ -205,6 +206,10 @@ class wwn { global $html;
+ $fdate = DateTime::createFromFormat('m/d/Y', $date); + if (!empty($fdate)) + $html->set_last_modified($fdate->format("Y-m-d H:i:s"), true); + switch ($this->mode) { case "interviews": @@ -266,11 +271,15 @@ class wwn 'body' => $this->body, );
+ $date = DateTime::createFromFormat('m/d/Y', $this->issue); + if (!empty($date)) + $html->set_last_modified($date->format("Y-m-d H:i:s"), true); + return $html->template("base", "wwn_content", $wwn_vars);; }
// display a single wwn issue - public function view_interview($interview) + public function view_interview ($interview) { global $config, $html;
@@ -292,11 +301,15 @@ class wwn
// load issue into template $wwn_vars = array( - 'who' => $this->who, - 'date' => $this->issue, - 'author' => $html->ahref($this->author, 'mailto:'.$this->email), - 'body' => $this->body, - ); + 'who' => $this->who, + 'date' => $this->issue, + 'author' => $html->ahref($this->author, 'mailto:'.$this->email), + 'body' => $this->body, + ); + + $date = DateTime::createFromFormat('m/d/Y', $this->issue); + if (!empty($date)) + $html->set_last_modified($date->format("Y-m-d H:i:s"), true);
return $html->template("base", "wwn_interview", $wwn_vars); } @@ -382,11 +395,11 @@ class wwn break; case "ISSUE": $this->issue = $attrs{'DATE'}; - $this->who = $attrs{'WHO'}; + $this->who = (!empty($attrs{'WHO'}) ? $attrs{'WHO'} : ''); break; case "AUTHOR": - $this->email = $attrs{'EMAIL'}; - $this->contact = $attrs{'CONTACT'}; + $this->email = (!empty($attrs{'EMAIL'}) ? $attrs{'EMAIL'} : ''); + $this->contact = (!empty($attrs{'CONTACT'}) ? $attrs{'CONTACT'} : ''); break; case "INTRO": $this->body .= "<a name="Intro"></a>\n"; @@ -398,8 +411,10 @@ class wwn $this->body .= "<table>\n"; $this->body .= "<tr>\n"; $this->body .= "<th width="100%">".$attrs{'TITLE'}."</th>\n"; - $this->body .= "<th>".$attrs{'STARTDATE'}."</td>\n"; - $this->body .= "<th><a href="".$attrs{'ARCHIVE'}."">Archive</a></th>\n"; + if (!empty($attrs{'STARTDATE'})) + $this->body .= "<th>".$attrs{'STARTDATE'}."</td>\n"; + if (!empty($attrs{'ARCHIVE'})) + $this->body .= "<th><a href="".$attrs{'ARCHIVE'}."">Archive</a></th>\n"; $this->body .= "</tr>\n"; $this->body .= "<tr><td colspan="3">\n"; break; @@ -410,18 +425,18 @@ class wwn $this->body .= "<table>\n"; $this->body .= "<tr><td colspan="3">\n"; $this->body .= "<p> This week, ".$attrs{'POSTS'}." posts consumed ".$attrs{'SIZE'}." K. ". - "There were ".$attrs{'CONTRIB'}." different contributors. ". - $attrs{'MULTIPLES'}." (".$pctMTO."%) posted more than once. ". - $attrs{'LASTWEEK'}." (".$pctLWK."%) posted last week too.</p>\n". - "<p>The top 5 posters of the week were:</p>\n"; + "There were ".$attrs{'CONTRIB'}." different contributors. ". + $attrs{'MULTIPLES'}." (".$pctMTO."%) posted more than once. ". + $attrs{'LASTWEEK'}." (".$pctLWK."%) posted last week too.</p>\n". + "<p>The top 5 posters of the week were:</p>\n"; break; case "PERSON": array_push( $this->person, array( - "WHO" => $attrs{'WHO'}, - "POSTS" => $attrs{'POSTS'}, - "SIZE" => $attrs{'SIZE'} + "WHO" => (!empty($attrs{'WHO'}) ? $attrs{'WHO'} : ''), + "POSTS" => (!empty($attrs{'POSTS'}) ? $attrs{'POSTS'} : ''), + "SIZE" => (!empty($attrs{'SIZE'}) ? $attrs{'SIZE'} : '') ) ); break;