From a5de1fd9f013768d3ea78bc5eea3302206ce798e Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 27 Jan 2012 00:03:26 +0000 Subject: [PATCH 01/15] fixes popular_by_month/year not working due to "number of bound variables does not match number of tokens" error --- contrib/numeric_score/main.php | 36 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/contrib/numeric_score/main.php b/contrib/numeric_score/main.php index 97c81bd8..5c61fa49 100755 --- a/contrib/numeric_score/main.php +++ b/contrib/numeric_score/main.php @@ -112,9 +112,6 @@ class NumericScore implements Extension { //TODO: Somehow make popular_by_#/2012/12/31 > popular_by_#?day=31&month=12&year=2012 (So no problems with date formats) //TODO: Add Popular_by_week. - $sql = "SELECT * FROM images "; - $args = array(); - //year if(int_escape($event->get_arg(0)) == 0){ $year = date("Y"); @@ -135,40 +132,45 @@ class NumericScore implements Extension { } $totaldate = $year."/".$month."/".$day; + $sql = + "SELECT * FROM images + WHERE EXTRACT(YEAR FROM posted) = :year + "; + + $agrs = array("limit" => $t_images, "year" => $year); + if($event->page_matches("popular_by_day")){ $sql .= - "WHERE EXTRACT(YEAR FROM posted) = :year - AND EXTRACT(MONTH FROM posted) = :month + "AND EXTRACT(MONTH FROM posted) = :month AND EXTRACT(DAY FROM posted) = :day AND NOT numeric_score=0 "; + //array_push doesn't seem to like using double arrows + //this requires us to instead create two arrays and merge + $sgra = array("month" => $month, "day" => $day); + $args = array_merge($agrs, $sgra); + $dte = array($totaldate, date("F jS, Y", (strtotime($totaldate))), "Y/m/d", "day"); } if($event->page_matches("popular_by_month")){ $sql .= - "WHERE EXTRACT(YEAR FROM posted) = :year - AND EXTRACT(MONTH FROM posted) = :month + "AND EXTRACT(MONTH FROM posted) = :month AND NOT numeric_score=0 "; + $sgra = array("month" => $month); + $args = array_merge($agrs, $sgra); + $title = date("F Y", (strtotime($totaldate))); $dte = array($totaldate, $title, "Y/m", "month"); } if($event->page_matches("popular_by_year")){ - $sql .= - "WHERE EXTRACT(YEAR FROM posted) = :year - AND NOT numeric_score=0 - "; + $sql .= "AND NOT numeric_score=0"; $dte = array($totaldate, $year, "Y", "year"); + $args = $agrs; } $sql .= " ORDER BY numeric_score DESC LIMIT :limit OFFSET 0"; //filter images by year/score != 0 > limit to max images on one page > order from highest to lowest score - $args = array( - "year" => $year, - "month" => $month, - "day" => $day, - "limit" => $t_images - ); $result = $database->get_all($sql, $args); $images = array(); From c5468bd93888dfc81920dcd7bfde521be14cfb1d Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 27 Jan 2012 03:47:27 +0000 Subject: [PATCH 02/15] centering downtime text --- contrib/downtime/theme.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/downtime/theme.php b/contrib/downtime/theme.php index 0003c2af..e529209e 100644 --- a/contrib/downtime/theme.php +++ b/contrib/downtime/theme.php @@ -6,7 +6,7 @@ class DowntimeTheme extends Themelet { */ public function display_notification(Page $page) { $page->add_block(new Block("Downtime", - "DOWNTIME MODE IS ON!", "left", 0)); + "
DOWNTIME MODE IS ON!
", "left", 0)); } /** @@ -28,7 +28,7 @@ class DowntimeTheme extends Themelet {
-

Down for Maintenance

+

Down for Maintenance

$message
From 56f3ca6c109d2f0d3bfe63f7951281d8ffcd08a4 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 27 Jan 2012 05:19:47 +0000 Subject: [PATCH 03/15] fixes the featured block not keeping the image in the sidebar on certain themes --- contrib/featured/theme.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/contrib/featured/theme.php b/contrib/featured/theme.php index e4a3ab78..74a4134e 100644 --- a/contrib/featured/theme.php +++ b/contrib/featured/theme.php @@ -5,7 +5,7 @@ class FeaturedTheme extends Themelet { * Show $text on the $page */ public function display_featured(Page $page, Image $image) { - $page->add_block(new Block("Featured Image", $this->build_thumb_html($image), "left", 3)); + $page->add_block(new Block("Featured Image", $this->build_featured_html($image), "left", 3)); } public function get_buttons_html($image_id) { @@ -18,5 +18,25 @@ class FeaturedTheme extends Themelet { "; } + + public function build_featured_html(Image $image, $query=null) { + global $config; + $i_id = int_escape($image->id); + $h_view_link = make_link("post/view/$i_id", $query); + $h_thumb_link = $image->get_thumb_link(); + $h_tip = html_escape($image->get_tooltip()); + $tsize = get_thumbnail_size($image->width, $image->height); + + + return " +
+ + + $h_tip + + +
+ "; + } } ?> From 2c1a94c734146aa9a851e5f4d226ca75fe960e86 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 27 Jan 2012 05:42:46 +0000 Subject: [PATCH 04/15] xspf_player now uses filename as song title --- contrib/handle_mp3/theme.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/handle_mp3/theme.php b/contrib/handle_mp3/theme.php index 7844f595..0239b522 100644 --- a/contrib/handle_mp3/theme.php +++ b/contrib/handle_mp3/theme.php @@ -4,13 +4,14 @@ class MP3FileHandlerTheme extends Themelet { public function display_image(Page $page, Image $image) { $data_href = get_base_href(); $ilink = $image->get_image_link(); + $fname = $image->filename; //Most of the time this will be the title/artist of the song. $html = " - From 74478297f287891895502f7fe377669210affe55 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 27 Jan 2012 06:08:37 +0000 Subject: [PATCH 05/15] contact link only shows if set --- contrib/home/theme.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/home/theme.php b/contrib/home/theme.php index eda5e815..da3c80a8 100644 --- a/contrib/home/theme.php +++ b/contrib/home/theme.php @@ -29,6 +29,7 @@ EOD $main_links_html = empty($main_links) ? "" : ""; $message_html = empty($main_text) ? "" : "
$main_text
"; $counter_html = empty($counter_text) ? "" : "
$counter_text
"; + $contact_link = empty($contact_link) ? "" : "
Contact –"; $search_html = "