From f6ea5118d9ed3fb15a288341f30ea33537329957 Mon Sep 17 00:00:00 2001 From: shish Date: Thu, 3 May 2007 15:27:10 +0000 Subject: [PATCH] valid rss date git-svn-id: file:///home/shish/svn/shimmie2/trunk@54 7f39781d-f577-437e-ae19-be835c7a54ca --- core/database.class.php | 13 ++++++++++--- core/image.class.php | 1 + ext/rss_images.ext.php | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/database.class.php b/core/database.class.php index aa557c21..60a90311 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -121,7 +121,7 @@ class Database { } if($positive_tag_count + $negative_tag_count == 0) { - $query = new Querylet("SELECT * FROM images "); + $query = new Querylet("SELECT *,UNIX_TIMESTAMP(posted) AS posted_timestamp FROM images "); } else { $s_tag_array = array_map("sql_escape", $tag_search->variables); @@ -139,7 +139,9 @@ class Database { array($positive_tag_count) ) ); - $query = new Querylet("SELECT * FROM ({$subquery->sql}) AS images ", $subquery->variables); + $query = new Querylet(" + SELECT *, UNIX_TIMESTAMP(posted) AS posted_timestamp + FROM ({$subquery->sql}) AS images ", $subquery->variables); } if(strlen($img_search->sql) > 0) { @@ -180,7 +182,12 @@ class Database { if($limit < 1) $limit = 1; if(count($tags) == 0) { - $result = $this->db->Execute("SELECT * FROM images ORDER BY id DESC LIMIT ?,?", array($start, $limit)); + $result = $this->db->Execute(" + SELECT *,UNIX_TIMESTAMP(posted) AS posted_timestamp + FROM images + ORDER BY id DESC + LIMIT ?,? + ", array($start, $limit)); } else { $querylet = $this->build_search_querylet($tags); diff --git a/core/image.class.php b/core/image.class.php index e6438ab3..5ae86cdc 100644 --- a/core/image.class.php +++ b/core/image.class.php @@ -26,6 +26,7 @@ class Image { $this->width = $row['width']; $this->height = $row['height']; $this->posted = $row['posted']; + $this->posted_timestamp = $row['posted_timestamp']; } private function mime_to_ext($mime) { diff --git a/ext/rss_images.ext.php b/ext/rss_images.ext.php index a652a195..61a1f35a 100644 --- a/ext/rss_images.ext.php +++ b/ext/rss_images.ext.php @@ -32,7 +32,7 @@ class RSS_Images extends Extension { $link = make_link("post/view/{$image->id}"); $tags = $image->get_tag_list(); $owner = $image->get_owner(); - $posted = $image->posted; // FIXME: MySQL date != RSS date + $posted = strftime("%a, %d %b %Y %T %Z", $image->posted_timestamp); $content = html_escape( "

" . build_thumb_html($image) . "

" . "

Uploaded by " . $owner->name . "

"