From 8cb95ceb98b8dc1ed18b1217793d12659cdee26b Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 25 Oct 2011 16:17:44 +0100 Subject: [PATCH 01/60] also allow https sources --- ext/view/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/view/theme.php b/ext/view/theme.php index b9cb5cf8..59f6b730 100644 --- a/ext/view/theme.php +++ b/ext/view/theme.php @@ -94,7 +94,7 @@ class ViewImageTheme extends Themelet { $html .= " ($h_ip)"; } if(!is_null($image->source)) { - if(substr($image->source, 0, 7) == "http://") { + if(substr($image->source, 0, 7) == "http://" || substr($image->source, 0, 8) == "https://") { $html .= " (source)"; } else { From a89c5943d84d1a2d481f03d17c55696ca1b1847c Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 8 Nov 2011 11:02:04 +0000 Subject: [PATCH 02/60] error details when the file copy fails --- core/imageboard.pack.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 249b1b2f..0b2c89b8 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -972,7 +972,8 @@ function move_upload_to_archive($event) { $target = warehouse_path("images", $event->hash); if(!file_exists(dirname($target))) mkdir(dirname($target), 0755, true); if(!@copy($event->tmpname, $target)) { - throw new UploadException("Failed to copy file from uploads ({$event->tmpname}) to archive ($target)"); + $errors = error_get_last(); // note: requires php 5.2 + throw new UploadException("Failed to copy file from uploads ({$event->tmpname}) to archive ($target): {$errors['type']} / {$errors['message']}"); return false; } return true; From c6682b906982128ea776a3a612d88448ed85df85 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 8 Nov 2011 11:23:38 +0000 Subject: [PATCH 03/60] make_link for numeric score votes, and put in theme.php, fixes issue #50 --- contrib/numeric_score/main.php | 3 --- contrib/numeric_score/theme.php | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/contrib/numeric_score/main.php b/contrib/numeric_score/main.php index 3b786e20..0ab462c6 100644 --- a/contrib/numeric_score/main.php +++ b/contrib/numeric_score/main.php @@ -35,9 +35,6 @@ class NumericScore implements Extension { if($event instanceof DisplayingImageEvent) { if(!$user->is_anonymous()) { $html = $this->theme->get_voter_html($event->image); - if($user->is_admin()) { - $html .= "

See All Votes"; - } $page->add_block(new Block("Image Score", $html, "left", 20)); } } diff --git a/contrib/numeric_score/theme.php b/contrib/numeric_score/theme.php index 0d2a1953..eab5b338 100644 --- a/contrib/numeric_score/theme.php +++ b/contrib/numeric_score/theme.php @@ -37,6 +37,8 @@ class NumericScoreTheme extends Themelet { + +

See All Votes "; } return $html; From ac9e1c73cf5b4dc858c2d4660f04ab350127dc6b Mon Sep 17 00:00:00 2001 From: Daku Date: Sun, 11 Dec 2011 06:13:00 +0000 Subject: [PATCH 04/60] Adding a simple Danbooru>Shimmie bookmarklet. --- ext/upload/theme.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index f26905c0..adecaaa1 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -68,6 +68,14 @@ class UploadTheme extends Themelet { $link . '?url="+location.href+"&tags="+prompt("enter tags")">' . $title . ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } + if($tl_enabled) { + $link = make_http(make_link("upload")); + $title = "Danbooru to " . $config->get_string('title'); + $html .= '

' . + $title . ' (As above, Click on a Danbooru-run image page. (This also grabs the tags!))'; + } $page->set_title("Upload"); $page->set_heading("Upload"); From 0e4f93a42fbbc1ef70f2c32f52d65d697e774a11 Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 14 Dec 2011 06:45:35 +0000 Subject: [PATCH 05/60] Added a separate option for popular tags length. --- ext/tag_list/main.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 3be78be5..71767773 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -15,6 +15,7 @@ class TagList implements Extension { if($event instanceof InitExtEvent) { $config->set_default_int("tag_list_length", 15); + $config->set_default_int("popular_tag_list_length", 15); $config->set_default_int("tags_min", 3); $config->set_default_string("info_link", 'http://en.wikipedia.org/wiki/$tag'); $config->set_default_string("tag_list_image_type", 'related'); @@ -85,7 +86,8 @@ class TagList implements Extension { $event->panel->add_block($sb); $sb = new SetupBlock("Popular / Related Tag List"); - $sb->add_int_option("tag_list_length", "Show top "); $sb->add_label(" tags"); + $sb->add_int_option("tag_list_length", "Show top "); $sb->add_label(" related tags"); + $sb->add_int_option("popular_tag_list_length", "
Show top "); $sb->add_label(" popular tags"); $sb->add_text_option("info_link", "
Tag info link: "); $sb->add_choice_option("tag_list_image_type", array( "Image's tags only" => "tags", @@ -301,9 +303,9 @@ class TagList implements Extension { FROM tags WHERE count > 0 ORDER BY count DESC - LIMIT :tag_list_length + LIMIT :popular_tag_list_length "; - $args = array("tag_list_length"=>$config->get_int('tag_list_length')); + $args = array("popular_tag_list_length"=>$config->get_int('popular_tag_list_length')); $tags = $database->get_all($query, $args); $database->cache->set("popular_tags", $tags, 600); From 2b717063eb2ebb6d42b6ee23ae2538b56444379a Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 14 Dec 2011 07:36:01 +0000 Subject: [PATCH 06/60] Updated the bookmarklet to give you an option to use either the your own or the current tags. --- ext/upload/theme.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index adecaaa1..863296c2 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -71,12 +71,13 @@ class UploadTheme extends Themelet { if($tl_enabled) { $link = make_http(make_link("upload")); $title = "Danbooru to " . $config->get_string('title'); - $html .= '

' . + $html .= '

' . $title . ' (As above, Click on a Danbooru-run image page. (This also grabs the tags!))'; } - $page->set_title("Upload"); $page->set_heading("Upload"); $page->add_block(new NavBlock()); From 583de3fe6a758e4500682add14ec67d235790ff2 Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 14 Dec 2011 07:53:48 +0000 Subject: [PATCH 07/60] Small update to include the code by green-ponies in issue #51. --- ext/upload/theme.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 863296c2..9d42098e 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -62,22 +62,31 @@ class UploadTheme extends Themelet { "; if($tl_enabled) { - $link = make_http(make_link("upload")); + $link = make_http(make_link("upload")); + if($config->get_bool('nice_urls')){ + $delimiter = '?'; + } else { + $delimiter = '&'; + } + { $title = "Upload to " . $config->get_string('title'); $html .= '

' . + $link . $delimiter . 'url="+location.href+"&tags="+prompt("enter tags")">' . $title . ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; - } - if($tl_enabled) { - $link = make_http(make_link("upload")); + } + { $title = "Danbooru to " . $config->get_string('title'); $html .= '

' . $title . ' (As above, Click on a Danbooru-run image page. (This also grabs the tags!))'; + + } + } + $page->set_title("Upload"); $page->set_heading("Upload"); $page->add_block(new NavBlock()); @@ -188,4 +197,4 @@ class UploadTheme extends Themelet { "; } } -?> +?> \ No newline at end of file From a38327b6d3784b1ee3be41ae1606a4b1e42c4c91 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 16 Dec 2011 16:34:23 +0000 Subject: [PATCH 08/60] Made flash thumbnails have a default 192x192 resolution. --- themes/danbooru/themelet.class.php | 5 ++++- themes/default/themelet.class.php | 5 ++++- themes/flat/themelet.class.php | 5 ++++- themes/futaba/themelet.class.php | 5 ++++- themes/lite/themelet.class.php | 5 ++++- themes/old_default/themelet.class.php | 5 ++++- themes/warm/themelet.class.php | 5 ++++- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index 2fa978a5..7cd8631c 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -20,7 +20,10 @@ class Themelet { $h_view_link = make_link("post/view/{$image->id}", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - $tsize = get_thumbnail_size($image->width, $image->height); + if($image->ext == 'swf'){ + $tsize = get_thumbnail_size(192, 192); } + else{ + $tsize = get_thumbnail_size($image->width, $image->height); } return "$h_tip"; } diff --git a/themes/default/themelet.class.php b/themes/default/themelet.class.php index 159f8881..4fd5e56d 100644 --- a/themes/default/themelet.class.php +++ b/themes/default/themelet.class.php @@ -33,7 +33,10 @@ class Themelet { $h_view_link = make_link("post/view/$i_id", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - $tsize = get_thumbnail_size($image->width, $image->height); + if($image->ext == 'swf'){ + $tsize = get_thumbnail_size(192, 192); } + else{ + $tsize = get_thumbnail_size($image->width, $image->height); } return "

diff --git a/themes/flat/themelet.class.php b/themes/flat/themelet.class.php index b79ccc73..5376e6fc 100644 --- a/themes/flat/themelet.class.php +++ b/themes/flat/themelet.class.php @@ -33,7 +33,10 @@ class Themelet { $h_view_link = make_link("post/view/$i_id", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - $tsize = get_thumbnail_size($image->width, $image->height); + if($image->ext == 'swf'){ + $tsize = get_thumbnail_size(192, 192); } + else{ + $tsize = get_thumbnail_size($image->width, $image->height); } return "
diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php index 706f3f1b..c5a902cf 100644 --- a/themes/futaba/themelet.class.php +++ b/themes/futaba/themelet.class.php @@ -21,7 +21,10 @@ class Themelet { $h_view_link = make_link("post/view/{$image->id}", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - $tsize = get_thumbnail_size($image->width, $image->height); + if($image->ext == 'swf'){ + $tsize = get_thumbnail_size(192, 192); } + else{ + $tsize = get_thumbnail_size($image->width, $image->height); } return "$h_tip"; } diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index 8d57b147..2714233f 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -33,7 +33,10 @@ class Themelet { $h_view_link = make_link("post/view/$i_id", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - $tsize = get_thumbnail_size($image->width, $image->height); + if($image->ext == 'swf'){ + $tsize = get_thumbnail_size(192, 192); } + else{ + $tsize = get_thumbnail_size($image->width, $image->height); } return "
diff --git a/themes/old_default/themelet.class.php b/themes/old_default/themelet.class.php index 41c5cf5e..5b25a843 100644 --- a/themes/old_default/themelet.class.php +++ b/themes/old_default/themelet.class.php @@ -31,7 +31,10 @@ class Themelet { $h_view_link = make_link("post/view/$i_id", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - $tsize = get_thumbnail_size($image->width, $image->height); + if($image->ext == 'swf'){ + $tsize = get_thumbnail_size(192, 192); } + else{ + $tsize = get_thumbnail_size($image->width, $image->height); } return "$h_tip"; } diff --git a/themes/warm/themelet.class.php b/themes/warm/themelet.class.php index 89f4dcf8..7f90ba8a 100644 --- a/themes/warm/themelet.class.php +++ b/themes/warm/themelet.class.php @@ -34,7 +34,10 @@ class Themelet { $h_tip = html_escape($image->get_tooltip()); $h_image_link = $image->get_image_link(); $h_thumb_link = $image->get_thumb_link(); - $tsize = get_thumbnail_size($image->width, $image->height); + if($image->ext == 'swf'){ + $tsize = get_thumbnail_size(192, 192); } + else{ + $tsize = get_thumbnail_size($image->width, $image->height); } return "
From 56931b0eaa80dc07d097b1b9629a3b4b68918942 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 16 Dec 2011 18:36:08 +0000 Subject: [PATCH 09/60] Changed the 192x192 default to use the max thumbnail size. Made this work with SVG aswell. --- themes/danbooru/themelet.class.php | 4 ++-- themes/default/themelet.class.php | 4 ++-- themes/flat/themelet.class.php | 4 ++-- themes/futaba/themelet.class.php | 4 ++-- themes/lite/themelet.class.php | 4 ++-- themes/old_default/themelet.class.php | 4 ++-- themes/warm/themelet.class.php | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index 7cd8631c..a848352b 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -20,8 +20,8 @@ class Themelet { $h_view_link = make_link("post/view/{$image->id}", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf'){ - $tsize = get_thumbnail_size(192, 192); } + if($image->ext == 'swf' || 'svg'){ + $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } return "$h_tipget_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf'){ - $tsize = get_thumbnail_size(192, 192); } + if($image->ext == 'swf' || 'svg'){ + $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } return " diff --git a/themes/flat/themelet.class.php b/themes/flat/themelet.class.php index 5376e6fc..1724f329 100644 --- a/themes/flat/themelet.class.php +++ b/themes/flat/themelet.class.php @@ -33,8 +33,8 @@ class Themelet { $h_view_link = make_link("post/view/$i_id", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf'){ - $tsize = get_thumbnail_size(192, 192); } + if($image->ext == 'swf' || 'svg'){ + $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } return " diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php index c5a902cf..5985f2e2 100644 --- a/themes/futaba/themelet.class.php +++ b/themes/futaba/themelet.class.php @@ -21,8 +21,8 @@ class Themelet { $h_view_link = make_link("post/view/{$image->id}", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf'){ - $tsize = get_thumbnail_size(192, 192); } + if($image->ext == 'swf' || 'svg'){ + $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } return "$h_tipget_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf'){ - $tsize = get_thumbnail_size(192, 192); } + if($image->ext == 'swf' || 'svg'){ + $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } return " diff --git a/themes/old_default/themelet.class.php b/themes/old_default/themelet.class.php index 5b25a843..e7ed8967 100644 --- a/themes/old_default/themelet.class.php +++ b/themes/old_default/themelet.class.php @@ -31,8 +31,8 @@ class Themelet { $h_view_link = make_link("post/view/$i_id", $query); $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf'){ - $tsize = get_thumbnail_size(192, 192); } + if($image->ext == 'swf' || 'svg'){ + $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } return "$h_tipget_tooltip()); $h_image_link = $image->get_image_link(); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf'){ - $tsize = get_thumbnail_size(192, 192); } + if($image->ext == 'swf' || 'svg'){ + $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } return " From c7852423d42b2536511f03aed1cd437df47e99e7 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 16 Dec 2011 21:29:46 +0000 Subject: [PATCH 10/60] Added a feature which removes the size tag from mp3 tooltips. --- themes/danbooru/themelet.class.php | 25 +++++++++++++++++++++++-- themes/default/themelet.class.php | 25 +++++++++++++++++++++++-- themes/flat/themelet.class.php | 25 +++++++++++++++++++++++-- themes/futaba/themelet.class.php | 25 +++++++++++++++++++++++-- themes/lite/themelet.class.php | 25 +++++++++++++++++++++++-- themes/old_default/themelet.class.php | 25 +++++++++++++++++++++++-- themes/warm/themelet.class.php | 25 +++++++++++++++++++++++-- 7 files changed, 161 insertions(+), 14 deletions(-) diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index a848352b..9b634942 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -18,12 +18,33 @@ class Themelet { public function build_thumb_html(Image $image, $query=null) { global $config; $h_view_link = make_link("post/view/{$image->id}", $query); - $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf' || 'svg'){ + + + // Removes the size tag if the file is an mp3 + if($image->ext == 'mp3'){ + $iitip = $image->get_tooltip(); + $mp3tip = array("0x0"); + $h_tip = str_replace($mp3tip, " ", $iitip); + + // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size) + $justincase = array(" //", "// ", " //", "// ", " "); + if(strstr($h_tip, " ")){ + $h_tip = html_escape(str_replace($justincase, "", $h_tip)); + }else{ + $h_tip = html_escape($h_tip); + } + }else{ + $h_tip = html_escape($image->get_tooltip()); + } + + + // If file is flash or svg then sets thumbnail to max size. + if($image->ext == 'swf' || $image->ext == 'svg'){ $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } + return "$h_tip"; } diff --git a/themes/default/themelet.class.php b/themes/default/themelet.class.php index d45610b2..e0ee012e 100644 --- a/themes/default/themelet.class.php +++ b/themes/default/themelet.class.php @@ -31,12 +31,33 @@ class Themelet { global $config; $i_id = int_escape($image->id); $h_view_link = make_link("post/view/$i_id", $query); - $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf' || 'svg'){ + + + // Removes the size tag if the file is an mp3 + if($image->ext == 'mp3'){ + $iitip = $image->get_tooltip(); + $mp3tip = array("0x0"); + $h_tip = str_replace($mp3tip, " ", $iitip); + + // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size) + $justincase = array(" //", "// ", " //", "// ", " "); + if(strstr($h_tip, " ")){ + $h_tip = html_escape(str_replace($justincase, "", $h_tip)); + }else{ + $h_tip = html_escape($h_tip); + } + }else{ + $h_tip = html_escape($image->get_tooltip()); + } + + + // If file is flash or svg then sets thumbnail to max size. + if($image->ext == 'swf' || $image->ext == 'svg'){ $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } + return "
diff --git a/themes/flat/themelet.class.php b/themes/flat/themelet.class.php index 1724f329..13e1424b 100644 --- a/themes/flat/themelet.class.php +++ b/themes/flat/themelet.class.php @@ -31,12 +31,33 @@ class Themelet { global $config; $i_id = int_escape($image->id); $h_view_link = make_link("post/view/$i_id", $query); - $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf' || 'svg'){ + + + // Removes the size tag if the file is an mp3 + if($image->ext == 'mp3'){ + $iitip = $image->get_tooltip(); + $mp3tip = array("0x0"); + $h_tip = str_replace($mp3tip, " ", $iitip); + + // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size) + $justincase = array(" //", "// ", " //", "// ", " "); + if(strstr($h_tip, " ")){ + $h_tip = html_escape(str_replace($justincase, "", $h_tip)); + }else{ + $h_tip = html_escape($h_tip); + } + }else{ + $h_tip = html_escape($image->get_tooltip()); + } + + + // If file is flash or svg then sets thumbnail to max size. + if($image->ext == 'swf' || $image->ext == 'svg'){ $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } + return "
diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php index 5985f2e2..b88fdec6 100644 --- a/themes/futaba/themelet.class.php +++ b/themes/futaba/themelet.class.php @@ -19,12 +19,33 @@ class Themelet { public function build_thumb_html(Image $image, $query=null) { global $config; $h_view_link = make_link("post/view/{$image->id}", $query); - $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf' || 'svg'){ + + + // Removes the size tag if the file is an mp3 + if($image->ext == 'mp3'){ + $iitip = $image->get_tooltip(); + $mp3tip = array("0x0"); + $h_tip = str_replace($mp3tip, " ", $iitip); + + // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size) + $justincase = array(" //", "// ", " //", "// ", " "); + if(strstr($h_tip, " ")){ + $h_tip = html_escape(str_replace($justincase, "", $h_tip)); + }else{ + $h_tip = html_escape($h_tip); + } + }else{ + $h_tip = html_escape($image->get_tooltip()); + } + + + // If file is flash or svg then sets thumbnail to max size. + if($image->ext == 'swf' || $image->ext == 'svg'){ $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } + return "$h_tip"; } diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index d5539d23..ea0297e0 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -31,12 +31,33 @@ class Themelet { global $config; $i_id = int_escape($image->id); $h_view_link = make_link("post/view/$i_id", $query); - $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf' || 'svg'){ + + + // Removes the size tag if the file is an mp3 + if($image->ext == 'mp3'){ + $iitip = $image->get_tooltip(); + $mp3tip = array("0x0"); + $h_tip = str_replace($mp3tip, " ", $iitip); + + // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size) + $justincase = array(" //", "// ", " //", "// ", " "); + if(strstr($h_tip, " ")){ + $h_tip = html_escape(str_replace($justincase, "", $h_tip)); + }else{ + $h_tip = html_escape($h_tip); + } + }else{ + $h_tip = html_escape($image->get_tooltip()); + } + + + // If file is flash or svg then sets thumbnail to max size. + if($image->ext == 'swf' || $image->ext == 'svg'){ $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } + return "
diff --git a/themes/old_default/themelet.class.php b/themes/old_default/themelet.class.php index e7ed8967..35c7dc53 100644 --- a/themes/old_default/themelet.class.php +++ b/themes/old_default/themelet.class.php @@ -29,12 +29,33 @@ class Themelet { global $config; $i_id = int_escape($image->id); $h_view_link = make_link("post/view/$i_id", $query); - $h_tip = html_escape($image->get_tooltip()); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf' || 'svg'){ + + + // Removes the size tag if the file is an mp3 + if($image->ext == 'mp3'){ + $iitip = $image->get_tooltip(); + $mp3tip = array("0x0"); + $h_tip = str_replace($mp3tip, " ", $iitip); + + // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size) + $justincase = array(" //", "// ", " //", "// ", " "); + if(strstr($h_tip, " ")){ + $h_tip = html_escape(str_replace($justincase, "", $h_tip)); + }else{ + $h_tip = html_escape($h_tip); + } + }else{ + $h_tip = html_escape($image->get_tooltip()); + } + + + // If file is flash or svg then sets thumbnail to max size. + if($image->ext == 'swf' || $image->ext == 'svg'){ $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } + return "$h_tip"; } diff --git a/themes/warm/themelet.class.php b/themes/warm/themelet.class.php index 8a3df34a..041274e1 100644 --- a/themes/warm/themelet.class.php +++ b/themes/warm/themelet.class.php @@ -31,13 +31,34 @@ class Themelet { global $config; $i_id = int_escape($image->id); $h_view_link = make_link("post/view/$i_id", $query); - $h_tip = html_escape($image->get_tooltip()); $h_image_link = $image->get_image_link(); $h_thumb_link = $image->get_thumb_link(); - if($image->ext == 'swf' || 'svg'){ + + + // Removes the size tag if the file is an mp3 + if($image->ext == 'mp3'){ + $iitip = $image->get_tooltip(); + $mp3tip = array("0x0"); + $h_tip = str_replace($mp3tip, " ", $iitip); + + // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size) + $justincase = array(" //", "// ", " //", "// ", " "); + if(strstr($h_tip, " ")){ + $h_tip = html_escape(str_replace($justincase, "", $h_tip)); + }else{ + $h_tip = html_escape($h_tip); + } + }else{ + $h_tip = html_escape($image->get_tooltip()); + } + + + // If file is flash or svg then sets thumbnail to max size. + if($image->ext == 'swf' || $image->ext == 'svg'){ $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } + return "
From fbe0df29ed0689174fcc5f70dc1d694c305f901e Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 16 Dec 2011 21:35:30 +0000 Subject: [PATCH 11/60] Fixed scaling with the theme patch. --- contrib/handle_flash/main.php | 1 - contrib/handle_mp3/main.php | 1 - contrib/handle_svg/main.php | 1 - 3 files changed, 3 deletions(-) diff --git a/contrib/handle_flash/main.php b/contrib/handle_flash/main.php index f63f988d..8ee32fc0 100644 --- a/contrib/handle_flash/main.php +++ b/contrib/handle_flash/main.php @@ -7,7 +7,6 @@ class FlashFileHandler extends DataHandlerExtension { protected function create_thumb($hash) { - // FIXME: scale image, as not all boards use 192x192 copy("ext/handle_flash/thumb.jpg", warehouse_path("thumbs", $hash)); } diff --git a/contrib/handle_mp3/main.php b/contrib/handle_mp3/main.php index ba02b3c5..76187638 100644 --- a/contrib/handle_mp3/main.php +++ b/contrib/handle_mp3/main.php @@ -7,7 +7,6 @@ class MP3FileHandler extends DataHandlerExtension { protected function create_thumb($hash) { - // FIXME: scale image, as not all boards use 192x192 copy("ext/handle_mp3/thumb.jpg", warehouse_path("thumbs", $hash)); } diff --git a/contrib/handle_svg/main.php b/contrib/handle_svg/main.php index e9e94c25..f028e178 100644 --- a/contrib/handle_svg/main.php +++ b/contrib/handle_svg/main.php @@ -40,7 +40,6 @@ class SVGFileHandler implements Extension { // exec("convert images/{$ha}/{$hash}[0] -geometry {$w}x{$h} -quality {$q} jpg:thumbs/{$ha}/{$hash}"); // } // else { - // FIXME: scale image, as not all boards use 192x192 copy("ext/handle_svg/thumb.jpg", warehouse_path("thumbs", $hash)); // } } From c125c4ba927c7ba12921219cc15f89efce48b6de Mon Sep 17 00:00:00 2001 From: Daku Date: Mon, 19 Dec 2011 01:43:46 +0000 Subject: [PATCH 12/60] Making the upload form look a bit nicer. --- ext/upload/style.css | 9 +++++++-- ext/upload/theme.php | 30 ++++++++++++++++++------------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ext/upload/style.css b/ext/upload/style.css index c4b1e63e..1fe3f45d 100644 --- a/ext/upload/style.css +++ b/ext/upload/style.css @@ -1,4 +1,9 @@ - -#large_upload_form INPUT { +/* Only need to change the file/url inputs */ +#large_upload_form INPUT.wid { width: 100%; } +#radio_button { + width: auto; +} +/* This is needed since the theme style.css forcibly sets vertical align to "top". */ +TABLE.vert TD, TABLE.vert TH {vertical-align: middle;} diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 9d42098e..3575d569 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -12,22 +12,28 @@ class UploadTheme extends Themelet { public function display_page(Page $page) { global $config; $tl_enabled = ($config->get_string("transload_engine", "none") != "none"); - + + // Uploader 2.0! $upload_list = ""; for($i=0; $i<$config->get_int('upload_count'); $i++) { $n = $i + 1; $width = $tl_enabled ? "35%" : "80%"; $upload_list .= " - File $n - - "; - if($tl_enabled) { - $upload_list .= " - URL $n - - "; - } +
File
"; + if($tl_enabled) { + $upload_list .=" + URL
+ + + "; + } + else { + $upload_list .= " + + "; + } + $upload_list .= " "; @@ -51,7 +57,7 @@ class UploadTheme extends Themelet { }); ".make_form(make_link("upload"), "POST", $multipart=True)." - +
$upload_list @@ -60,7 +66,7 @@ class UploadTheme extends Themelet { (Max file size is $max_kb) "; - + if($tl_enabled) { $link = make_http(make_link("upload")); if($config->get_bool('nice_urls')){ From dab67ea1bbdcf6fc5c6e5b074547153021d9181c Mon Sep 17 00:00:00 2001 From: Daku Date: Tue, 20 Dec 2011 21:56:07 +0000 Subject: [PATCH 13/60] Updated recaptcha. --- lib/recaptchalib.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/recaptchalib.php b/lib/recaptchalib.php index 897c5098..32c4f4d7 100644 --- a/lib/recaptchalib.php +++ b/lib/recaptchalib.php @@ -4,7 +4,7 @@ * - Documentation and latest version * http://recaptcha.net/plugins/php/ * - Get a reCAPTCHA API Key - * http://recaptcha.net/api/getkey + * https://www.google.com/recaptcha/admin/create * - Discussion group * http://groups.google.com/group/recaptcha * @@ -35,9 +35,9 @@ /** * The reCAPTCHA server URL's */ -define("RECAPTCHA_API_SERVER", "http://api.recaptcha.net"); -define("RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net"); -define("RECAPTCHA_VERIFY_SERVER", "api-verify.recaptcha.net"); +define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api"); +define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api"); +define("RECAPTCHA_VERIFY_SERVER", "www.google.com"); /** * Encodes the given data into a query string format @@ -106,7 +106,7 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) { function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) { if ($pubkey == null || $pubkey == '') { - die ("To use reCAPTCHA you must get an API key from http://recaptcha.net/api/getkey"); + die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); } if ($use_ssl) { @@ -152,7 +152,7 @@ class ReCaptchaResponse { function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) { if ($privkey == null || $privkey == '') { - die ("To use reCAPTCHA you must get an API key from http://recaptcha.net/api/getkey"); + die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); } if ($remoteip == null || $remoteip == '') { @@ -169,7 +169,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex return $recaptcha_response; } - $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/verify", + $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", array ( 'privatekey' => $privkey, 'remoteip' => $remoteip, @@ -200,7 +200,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex * @param string $appname The name of your application */ function recaptcha_get_signup_url ($domain = null, $appname = null) { - return "http://recaptcha.net/api/getkey?" . _recaptcha_qsencode (array ('domain' => $domain, 'app' => $appname)); + return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); } function _recaptcha_aes_pad($val) { @@ -230,14 +230,14 @@ function _recaptcha_mailhide_urlbase64 ($x) { function recaptcha_mailhide_url($pubkey, $privkey, $email) { if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . - "you can do so at http://mailhide.recaptcha.net/apikey"); + "you can do so at http://www.google.com/recaptcha/mailhide/apikey"); } $ky = pack('H*', $privkey); $cryptmail = _recaptcha_aes_encrypt ($email, $ky); - return "http://mailhide.recaptcha.net/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); + return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); } /** @@ -262,7 +262,7 @@ function _recaptcha_mailhide_email_parts ($email) { * Gets html to display an email address given a public an private key. * to get a key, go to: * - * http://mailhide.recaptcha.net/apikey + * http://www.google.com/recaptcha/mailhide/apikey */ function recaptcha_mailhide_html($pubkey, $privkey, $email) { $emailparts = _recaptcha_mailhide_email_parts ($email); From c37569f3d453d43cb88b289e9d9b27203a1c1a6d Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 21 Dec 2011 02:28:39 +0000 Subject: [PATCH 14/60] Fixed reCaptcha. --- core/util.inc.php | 8 ++++---- ext/setup/main.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index d6ce5354..c1333151 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -253,8 +253,8 @@ function captcha_get_html() { if(DEBUG && ip_in_range($_SERVER['REMOTE_ADDR'], "127.0.0.0/8")) return ""; $captcha = ""; - if($user->is_anonymous() && $config->get_bool("use_captchas")) { - $rpk = $config->get_string("api_recaptcha_pubkey"); + if($user->is_anonymous() && $config->get_bool("comment_captcha")) { + $rpk = $config->get_string("api_recaptcha_privkey"); if(!empty($rpk)) { $captcha = recaptcha_get_html($rpk); } @@ -274,8 +274,8 @@ function captcha_check() { if(DEBUG && ip_in_range($_SERVER['REMOTE_ADDR'], "127.0.0.0/8")) return true; - if($user->is_anonymous() && $config->get_bool("use_captchas")) { - $rpk = $config->get_string('api_recaptcha_privkey'); + if($user->is_anonymous() && $config->get_bool("comment_captcha")) { + $rpk = $config->get_string('api_recaptcha_pubkey'); if(!empty($rpk)) { $resp = recaptcha_check_answer( $rpk, diff --git a/ext/setup/main.php b/ext/setup/main.php index e53061b1..f1885568 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -171,7 +171,7 @@ class Setup extends SimpleExtension { $config->set_default_string("theme", "default"); $config->set_default_bool("use_autodate", true); $config->set_default_bool("word_wrap", true); - $config->set_default_bool("use_captchas", false); + $config->set_default_bool("comment_captcha", false); $config->set_default_string("autodate_format", "F j, Y"); // Automatic caching is disabled by default $config->set_default_string("autocache_location", "data/cache"); From 9a2d694b6a6939ab5245d137de73b77b7f48c404 Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 21 Dec 2011 02:40:30 +0000 Subject: [PATCH 15/60] Made the replace form look similar to the new upload form. --- ext/upload/theme.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 3575d569..a18adbe5 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -17,7 +17,6 @@ class UploadTheme extends Themelet { $upload_list = ""; for($i=0; $i<$config->get_int('upload_count'); $i++) { $n = $i + 1; - $width = $tl_enabled ? "35%" : "80%"; $upload_list .= " - - - - "; - if($tl_enabled) { - $upload_list .= " - - - - - "; - } + + + + "; + } else { + $upload_list .= " + "; + } $max_size = $config->get_int('upload_size'); $max_kb = to_shorthand_int($max_size); @@ -133,7 +129,7 @@ class UploadTheme extends Themelet { .$thumbnail."
" .make_form(make_link("upload/replace/".$image_id), "POST", $multipart=True)." -
Tags
Source
File
"; @@ -105,21 +104,18 @@ class UploadTheme extends Themelet { $tl_enabled = ($config->get_string("transload_engine", "none") != "none"); $upload_list = ''; - $width = $tl_enabled ? "35%" : "80%"; $upload_list .= " -
File
URL
File
"; + if($tl_enabled) { + $upload_list .=" + URL
+
$upload_list From 660f9ca4b06a03e34406b3fcc21fb8626dde89ba Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 21 Dec 2011 20:52:06 +0000 Subject: [PATCH 16/60] Changed "'thumb_width', 'thumb_height'" > "$config->get_int('thumb_width'), $config->get_int('thumb_height')" --- themes/danbooru/themelet.class.php | 2 +- themes/default/themelet.class.php | 2 +- themes/flat/themelet.class.php | 2 +- themes/futaba/themelet.class.php | 2 +- themes/lite/themelet.class.php | 2 +- themes/old_default/themelet.class.php | 2 +- themes/warm/themelet.class.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index 9b634942..ed738f7e 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -41,7 +41,7 @@ class Themelet { // If file is flash or svg then sets thumbnail to max size. if($image->ext == 'swf' || $image->ext == 'svg'){ - $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } + $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } diff --git a/themes/default/themelet.class.php b/themes/default/themelet.class.php index e0ee012e..08b4b694 100644 --- a/themes/default/themelet.class.php +++ b/themes/default/themelet.class.php @@ -54,7 +54,7 @@ class Themelet { // If file is flash or svg then sets thumbnail to max size. if($image->ext == 'swf' || $image->ext == 'svg'){ - $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } + $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } diff --git a/themes/flat/themelet.class.php b/themes/flat/themelet.class.php index 13e1424b..0aaa32b0 100644 --- a/themes/flat/themelet.class.php +++ b/themes/flat/themelet.class.php @@ -54,7 +54,7 @@ class Themelet { // If file is flash or svg then sets thumbnail to max size. if($image->ext == 'swf' || $image->ext == 'svg'){ - $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } + $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php index b88fdec6..20e7e2fb 100644 --- a/themes/futaba/themelet.class.php +++ b/themes/futaba/themelet.class.php @@ -42,7 +42,7 @@ class Themelet { // If file is flash or svg then sets thumbnail to max size. if($image->ext == 'swf' || $image->ext == 'svg'){ - $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } + $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index ea0297e0..d5b5e479 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -54,7 +54,7 @@ class Themelet { // If file is flash or svg then sets thumbnail to max size. if($image->ext == 'swf' || $image->ext == 'svg'){ - $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } + $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } diff --git a/themes/old_default/themelet.class.php b/themes/old_default/themelet.class.php index 35c7dc53..ff48817b 100644 --- a/themes/old_default/themelet.class.php +++ b/themes/old_default/themelet.class.php @@ -52,7 +52,7 @@ class Themelet { // If file is flash or svg then sets thumbnail to max size. if($image->ext == 'swf' || $image->ext == 'svg'){ - $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } + $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } diff --git a/themes/warm/themelet.class.php b/themes/warm/themelet.class.php index 041274e1..38170d2e 100644 --- a/themes/warm/themelet.class.php +++ b/themes/warm/themelet.class.php @@ -55,7 +55,7 @@ class Themelet { // If file is flash or svg then sets thumbnail to max size. if($image->ext == 'swf' || $image->ext == 'svg'){ - $tsize = get_thumbnail_size('thumb_width', 'thumb_height'); } + $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height')); } else{ $tsize = get_thumbnail_size($image->width, $image->height); } From 11881c99932513a38a0be88e601789c2b3adbce1 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 23 Dec 2011 14:22:32 +0000 Subject: [PATCH 17/60] specify content-type for home page --- contrib/home/theme.php | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/home/theme.php b/contrib/home/theme.php index 5d6bff31..1fe601ff 100644 --- a/contrib/home/theme.php +++ b/contrib/home/theme.php @@ -7,6 +7,7 @@ class HomeTheme extends Themelet { $sitename +
Source