From 5f3ff8db86407c79fc12c476ddbddacf1aa7f64a Mon Sep 17 00:00:00 2001 From: Daku Date: Thu, 13 Mar 2014 23:29:47 +0000 Subject: [PATCH 1/4] don't add "tagme" when trying to mass-edit to null fixes #233 --- ext/tag_edit/main.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 30867f84..0251aaca 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -243,8 +243,8 @@ class TagEdit extends Extension { global $database; global $config; - $search_set = Tag::explode(strtolower($search)); - $replace_set = Tag::explode(strtolower($replace)); + $search_set = Tag::explode(strtolower($search), false); + $replace_set = Tag::explode(strtolower($replace), false); log_info("tag_edit", "Mass editing tags: '$search' -> '$replace'"); @@ -266,17 +266,19 @@ class TagEdit extends Extension { // search returns high-ids first, so we want to look // at images with lower IDs than the previous. $search_forward = $search_set; - if($last_id >= 0) $search_forward[] = "id<$last_id"; + if($last_id >= 0){ + $search_forward[] = "id<$last_id"; + $search_forward[] = "order=id_desc"; //Force high > low ID search + } $images = Image::find_images(0, 100, $search_forward); if(count($images) == 0) break; foreach($images as $image) { // remove the search'ed tags - $before = $image->get_tag_array(); + $before = array_map('strtolower', $image->get_tag_array()); $after = array(); foreach($before as $tag) { - $tag = strtolower($tag); if(!in_array($tag, $search_set)) { $after[] = $tag; } From 76526f371cadbdc8fbc7e67f265657ffae0308a9 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 14 Mar 2014 16:54:14 +0000 Subject: [PATCH 2/4] Add option to use transloaded URL as source fixes #234 --- ext/upload/main.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/upload/main.php b/ext/upload/main.php index b92fc479..36ca9137 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -49,6 +49,7 @@ class Upload extends Extension { global $config; $config->set_default_int('upload_count', 3); $config->set_default_int('upload_size', '1MB'); + $config->set_default_bool('upload_tlsource', TRUE); // SHIT: fucking PHP "security" measures -_-;;; $free_num = @disk_free_space(realpath("./images/")); @@ -90,6 +91,7 @@ class Upload extends Extension { $sb->add_shorthand_int_option("upload_size", "
Max size per file: "); $sb->add_label("PHP Limit = ".ini_get('upload_max_filesize').""); $sb->add_choice_option("transload_engine", $tes, "
Transload: "); + $sb->add_bool_option("upload_tlsource", "
Use transloaded URL as source: "); $event->panel->add_block($sb); } @@ -350,7 +352,7 @@ class Upload extends Extension { $metadata['filename'] = $filename; $metadata['extension'] = getExtension($headers['Content-Type']) ?: $pathinfo['extension']; $metadata['tags'] = $tags; - $metadata['source'] = $source; + $metadata['source'] = ($config->get_bool('upload_tlsource') ? $source : ""); /* check for locked > adds to metadata if it has */ if(!empty($locked)){ From 994652c3f7d212c810f9db00e4ce3f9091e42f2e Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 26 Mar 2014 08:05:05 +0000 Subject: [PATCH 3/4] make sure mass_tag_edit reads high > low id if default order is different --- ext/tag_edit/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 0251aaca..8062d55c 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -266,9 +266,9 @@ class TagEdit extends Extension { // search returns high-ids first, so we want to look // at images with lower IDs than the previous. $search_forward = $search_set; + $search_forward[] = "order=id_desc"; //Default order can be changed, so make sure we order high > low ID if($last_id >= 0){ $search_forward[] = "id<$last_id"; - $search_forward[] = "order=id_desc"; //Force high > low ID search } $images = Image::find_images(0, 100, $search_forward); From 78373627114d1e8eedb581fbc9cf9733f575c55c Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 26 Mar 2014 08:26:21 +0000 Subject: [PATCH 4/4] make sure source is still used if provided --- ext/upload/main.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/upload/main.php b/ext/upload/main.php index 36ca9137..3bb5de2c 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -91,7 +91,7 @@ class Upload extends Extension { $sb->add_shorthand_int_option("upload_size", "
Max size per file: "); $sb->add_label("PHP Limit = ".ini_get('upload_max_filesize').""); $sb->add_choice_option("transload_engine", $tes, "
Transload: "); - $sb->add_bool_option("upload_tlsource", "
Use transloaded URL as source: "); + $sb->add_bool_option("upload_tlsource", "
Use transloaded URL as source if none is provided: "); $event->panel->add_block($sb); } @@ -352,7 +352,7 @@ class Upload extends Extension { $metadata['filename'] = $filename; $metadata['extension'] = getExtension($headers['Content-Type']) ?: $pathinfo['extension']; $metadata['tags'] = $tags; - $metadata['source'] = ($config->get_bool('upload_tlsource') ? $source : ""); + $metadata['source'] = (($url == $source) && !$config->get_bool('upload_tlsource') ? "" : $source); /* check for locked > adds to metadata if it has */ if(!empty($locked)){