Miscellaneous tweaks for readability and correctness.
darkmorford -
8280669ab025
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -26,7 +26,7 function Excerpt($excerpt)
26 return $excerpt;
26 return $excerpt;
27 }
27 }
28
28
29 function datesort($a , $b)
29 function datesort($a, $b)
30 {
30 {
31 if ($a->udate == $b->udate)
31 if ($a->udate == $b->udate)
32 {
32 {
@@ -38,7 +38,7 function datesort($a , $b)
38
38
39 function utfentities($string)
39 function utfentities($string)
40 {
40 {
41 return htmlentities($string, ENT_COMPAT, 'UTF-8');
41 return htmlentities($string, ENT_COMPAT | ENT_XML1);
42 }
42 }
43
43
44 function _query($s, $byid = false)
44 function _query($s, $byid = false)
@@ -110,10 +110,10 if ($type == 'strips' or $type == '')
110 foreach($s as $k => $v)
110 foreach($s as $k => $v)
111 {
111 {
112 $s[$k]->link = SITE_HOST . SITE_PATH . "/strip/$v->id";
112 $s[$k]->link = SITE_HOST . SITE_PATH . "/strip/$v->id";
113 $s[$k]->title = "Comic [$v->id] \"" . numeric_entities(utfentities($v->title)) . '"';
113 $s[$k]->title = "Comic [$v->id] \"" . utfentities($v->title) . '"';
114 $s[$k]->desc = "<![CDATA[$v->chapdesc comic $v->id
114 $s[$k]->desc = "<![CDATA[$v->chapdesc comic $v->id
115 <br/>[<a href=\"http://www.megatokyo.com/\">read...</a>]
115 <br />[<a href=\"http://www.megatokyo.com/\">read...</a>]
116 <br/>[<a href=\"" . $s[$k]->link . "\">permalink</a>]
116 <br />[<a href=\"" . $s[$k]->link . "\">permalink</a>]
117 ]]>";
117 ]]>";
118 $s[$k]->date = date(DATE_RSS, $v->udate);
118 $s[$k]->date = date(DATE_RSS, $v->udate);
119 $s[$k]->guid = $s[$k]->link;
119 $s[$k]->guid = $s[$k]->link;
@@ -130,7 +130,7 if ($type == 'rants' or $type == '')
130 $rant_query = 'SELECT r.id, r.body, UNIX_TIMESTAMP(r.published) as udate, c.name, r.title
130 $rant_query = 'SELECT r.id, r.body, UNIX_TIMESTAMP(r.published) as udate, c.name, r.title
131 FROM rant r JOIN contributor c ON r.author = c.id
131 FROM rant r JOIN contributor c ON r.author = c.id
132 WHERE r.published <= NOW() AND r.status = "published"
132 WHERE r.published <= NOW() AND r.status = "published"
133 ORDER BY udate DESC LIMIT 5';
133 ORDER BY r.published DESC LIMIT 5';
134
134
135 $s = _query($rant_query) or die(mysqli_error($link));
135 $s = _query($rant_query) or die(mysqli_error($link));
136
136
@@ -173,7 +173,7 usort($f_items, 'datesort');
173
173
174 $f_date = $f_items[0]->date;
174 $f_date = $f_items[0]->date;
175
175
176 $rfc1123_date = gmdate('D, d M Y H:i:s', $f_items[0]->udate) . ' GMT';
176 $rfc1123_date = gmdate(DATE_RFC1123, $f_items[0]->udate);
177 $etag = md5($rfc1123_date);
177 $etag = md5($rfc1123_date);
178
178
179 /* Conditional Get */
179 /* Conditional Get */
@@ -202,7 +202,7 echo '<?xml version="1.0" encoding="utf-8"?>', "\n";
202 <title><?php echo $f_title; ?></title>
202 <title><?php echo $f_title; ?></title>
203 <link>https://megatokyo.com</link>
203 <link>https://megatokyo.com</link>
204 <description><?php echo $f_desc; ?></description>
204 <description><?php echo $f_desc; ?></description>
205 <language>en-us</language>
205 <language>en-US</language>
206 <copyright>Fred Gallagher</copyright>
206 <copyright>Fred Gallagher</copyright>
207 <managingEditor>piro@megatokyo.com (Fred Gallagher)</managingEditor>
207 <managingEditor>piro@megatokyo.com (Fred Gallagher)</managingEditor>
208 <docs>http://cyber.harvard.edu/rss/rss.html</docs>
208 <docs>http://cyber.harvard.edu/rss/rss.html</docs>
@@ -210,7 +210,7 echo '<?xml version="1.0" encoding="utf-8"?>', "\n";
210 <lastBuildDate><?php echo $f_date; ?></lastBuildDate>
210 <lastBuildDate><?php echo $f_date; ?></lastBuildDate>
211 <ttl>15</ttl>
211 <ttl>15</ttl>
212
212
213 <?php if (count($f_items) > 0) foreach ($f_items as $v) { ?>
213 <?php foreach ($f_items as $v) { ?>
214 <item>
214 <item>
215 <title><?php echo $v->title; ?></title>
215 <title><?php echo $v->title; ?></title>
216 <link><?php echo $v->link; ?></link>
216 <link><?php echo $v->link; ?></link>
Comments 0
You need to be logged in to leave comments. Login now