From 12a480ed8b612e7f804e5e49890b3b8a0405e257 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Thu, 3 Nov 2011 16:55:04 -0400 Subject: [PATCH 01/10] Fixed small bug with transloading images. (If clean_urls were not enabled) --- ext/upload/theme.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index f26905c0..a86d6f58 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -64,8 +64,15 @@ class UploadTheme extends Themelet { if($tl_enabled) { $link = make_http(make_link("upload")); $title = "Upload to " . $config->get_string('title'); + + if($config->get_bool('nice_urls')){ + $delimiter = '?'; + } else { + $delimiter = '&'; + } + $html .= '

' . + $link . $delimiter . 'url="+location.href+"&tags="+prompt("enter tags")">' . $title . ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } From 7bfe30e0c5bea1ca12e5ae699d848c84336a1de2 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Fri, 4 Nov 2011 01:00:45 -0400 Subject: [PATCH 02/10] Patch for displaying error message when disk full. --- 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 167bce07..75c48583 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -178,7 +178,9 @@ class Upload implements Extension { } else { - if(!$is_full) { + if ($is_full) { + $this->theme->display_full($page); + } else { $this->theme->display_page($page); } } From db59cb14af5e8af56a4a33f0b3a333e32c0e8092 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Sun, 8 Jan 2012 13:23:03 -0500 Subject: [PATCH 03/10] Working on Reverting Changes by specific IP. --- contrib/tag_history/main.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/contrib/tag_history/main.php b/contrib/tag_history/main.php index fc0f43e6..ce2b9249 100644 --- a/contrib/tag_history/main.php +++ b/contrib/tag_history/main.php @@ -126,6 +126,7 @@ class Tag_History implements Extension { // there is no history entry with that id so either the image was deleted // while the user was viewing the history, someone is playing with form // variables or we have messed up in code somewhere. + /* calling die() is probably not a good idea, we should throw an Exception */ die("Error: No tag history with specified id was found."); } @@ -179,6 +180,30 @@ class Tag_History implements Extension { return ($row ? $row : array()); } + /* This doesn't actually get _ALL_ IPs as it limits to 1000. */ + public function get_all_user_ips() + { + global $database; + $row = $database->get_all(" + SELECT DISTINCT user_ip + FROM tag_histories + ORDER BY tag_histories.user_ip DESC + LIMIT 1000"); + return ($row ? $row : array()); + } + + public function process_revert_all_changes_by_ip($ip) + { + global $database; + /* + +SELECT * FROM `tag_histories` WHERE image_id IN +( select image_id from `tag_histories` where user_ip="216.240.14.185" and date_set >= 2011-10-23) +ORDER BY image_id, date_set + + */ + } + /* * this function is called when an image has been deleted */ From f93b86261eac078599d7773ea913f388d80f9d26 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Sun, 8 Jan 2012 13:23:39 -0500 Subject: [PATCH 04/10] Small feature for uploading using a bookmark. --- 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 a86d6f58..0c5b0686 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -63,7 +63,8 @@ class UploadTheme extends Themelet { if($tl_enabled) { $link = make_http(make_link("upload")); - $title = "Upload to " . $config->get_string('title'); + $home = make_http(make_link()); + $title = $config->get_string('title'); if($config->get_bool('nice_urls')){ $delimiter = '?'; @@ -71,9 +72,9 @@ class UploadTheme extends Themelet { $delimiter = '&'; } - $html .= '

' . - $title . ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; + $js='javascript:(function(){if(typeof window=="undefined"||!window.location||window.location.href=="about:blank"){window.location="'. $home .'";}else if(typeof document=="undefined"||!document.body){window.location="'. $home .'?url="+encodeURIComponent(window.location.href);} else if(window.location.href.match("\/\/'. $_SERVER["HTTP_HOST"] .'.*")){alert("You are already at '. $title .'!");} else{var tags=prompt("Please enter tags","tagme");if(tags!=""&&tags!=null){var link="'. $link . $delimiter .'url="+location.href+"&tags="+tags;var w=window.open(link,"_blank");}}})();'; + + $html .= '

Upload to '.$title.' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } $page->set_title("Upload"); From dcf96456f1bbf15a982717baf088f4a6309fb8ab Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Sun, 8 Jan 2012 16:50:35 -0500 Subject: [PATCH 05/10] Fixed issue with Cancelling Transloads. Also added some features to the Bookmarklet. --- ext/upload/theme.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index fae6501f..4d701eea 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -98,17 +98,18 @@ class UploadTheme extends Themelet { "; if($tl_enabled) { - $link = make_http(make_link("upload")); + $link = make_http(make_link("upload")); + $main_page = make_http(make_link()); + $title = $config->get_string('title'); + if($config->get_bool('nice_urls')){ $delimiter = '?'; } else { $delimiter = '&'; } - { - $title = "Upload to " . $config->get_string('title'); - $html .= '

' . - $title . ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; + { + $js='javascript:(function(){if(typeof window=="undefined"||!window.location||window.location.href=="about:blank"){window.location="'. $main_page .'";}else if(typeof document=="undefined"||!document.body){window.location="'. $main_page .'?url="+encodeURIComponent(window.location.href);} else if(window.location.href.match("\/\/'. $_SERVER["HTTP_HOST"] .'.*")){alert("You are already at '. $title .'!");} else{var tags=prompt("Please enter tags","tagme");if(tags!=""&&tags!=null){var link="'. $link . $delimiter .'url="+location.href+"&tags="+tags;var w=window.open(link,"_blank");}}})();'; + $html .= '

Upload to '.$title.' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } { /* Danbooru > Shimmie Bookmarklet. From f7fc253075c999bdd182c9bdc781003b37c20e02 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Sun, 8 Jan 2012 22:18:17 -0500 Subject: [PATCH 06/10] Display message if no comments. --- ext/comment/theme.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/comment/theme.php b/ext/comment/theme.php index 264cd67b..3e2f9138 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -123,6 +123,9 @@ class CommentListTheme extends Themelet { foreach($comments as $comment) { $html .= $this->comment_to_html($comment, true); } + if(empty($html)) { + $html = '

No comments by this user.

'; + } $page->add_block(new Block("Comments", $html, "left", 70)); } From 0b03f91f1c37d87b68049b5d94cf889d6c745ca7 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Mon, 9 Jan 2012 20:45:30 -0500 Subject: [PATCH 07/10] Fixed the new upload form. Changed it over to use jQuery since shimmie has that already. Works with FF, Chrome, and IE 7 now. --- ext/upload/theme.php | 110 +++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 41 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 4d701eea..1b13bf9e 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -15,59 +15,87 @@ class UploadTheme extends Themelet { // Uploader 2.0! $upload_list = ""; - for($i=0; $i<$config->get_int('upload_count'); $i++) { + for($i=0; $i<$config->get_int('upload_count'); $i++) + { $a=$i+1; $s=$i-1; + if(!$i==0){ $upload_list .=""; }else{ $upload_list .= ""; - } - $upload_list .= ""; - - if($i==0){ - $upload_list .= "
" . - "". - "
"; - }else{ - $upload_list .="
- ". - ""; - if($a==$config->get_int('upload_count')){ - $upload_list .=""; - }else{ - $upload_list .= - "". - ""; - } - $upload_list .= "
"; - } + } + + $upload_list .= ""; + if($i==0){ + $js = 'javascript:$(function() { + $("#row'.$a.'").show(); + $("#hide'.$i.'").hide(); + $("#hide'.$a.'").show();});'; + + $upload_list .= "
" . + "". + "
"; + } else { + $js = 'javascript:$(function() { + $("#row'.$i.'").hide(); + $("#hide'.$i.'").hide(); + $("#hide'.$s.'").show(); + $("#data'.$i.'").val(""); + $("#url'.$i.'").val(""); + });'; + + $upload_list .="
+ ". + ""; + + if($a==$config->get_int('upload_count')){ + $upload_list .=""; + }else{ + $js1 = 'javascript:$(function() { + $("#row'.$a.'").show(); + $("#hide'.$i.'").hide(); + $("#hide'.$a.'").show(); });'; + $upload_list .= - "
File
"; - if($tl_enabled) { - $upload_list .= - " URL
+ "". + ""; + } + $upload_list .= "
"; + } - - "; - } - else { - $upload_list .= " - - "; - } + $js2 = 'javascript:$(function() { + $("#url'.$i.'").show(); + $("#url'.$i.'").val(""); + $("#data'.$i.'").show(); });'; + + $upload_list .= + " File
"; + + if($tl_enabled) { + $js = 'javascript:$(function() { + $("#data'.$i.'").hide(); + $("#data'.$i.'").val(""); + $("#url'.$i.'").show(); });'; + + $upload_list .= + " URL + + + + "; + } else { + $upload_list .= " + + "; + } $upload_list .= " "; } + $max_size = $config->get_int('upload_size'); $max_kb = to_shorthand_int($max_size); $html = " @@ -86,7 +114,7 @@ class UploadTheme extends Themelet { }); }); - ".make_form(make_link("upload"), "POST", $multipart=True)." + ".make_form(make_link("upload"), "POST", $multipart=True, 'file_upload')." $upload_list @@ -109,7 +137,7 @@ class UploadTheme extends Themelet { } { $js='javascript:(function(){if(typeof window=="undefined"||!window.location||window.location.href=="about:blank"){window.location="'. $main_page .'";}else if(typeof document=="undefined"||!document.body){window.location="'. $main_page .'?url="+encodeURIComponent(window.location.href);} else if(window.location.href.match("\/\/'. $_SERVER["HTTP_HOST"] .'.*")){alert("You are already at '. $title .'!");} else{var tags=prompt("Please enter tags","tagme");if(tags!=""&&tags!=null){var link="'. $link . $delimiter .'url="+location.href+"&tags="+tags;var w=window.open(link,"_blank");}}})();'; - $html .= '

Upload to '.$title.' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; + $html .= '

Upload to '.$title.' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } { /* Danbooru > Shimmie Bookmarklet. From 342600cb405acf3bb0d01816b87fe008cb0cfc7a Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Sun, 15 Jan 2012 12:02:54 -0500 Subject: [PATCH 08/10] This code is not used in the master branch. Moved into separate branch 'revert_by_ip'. --- contrib/tag_history/main.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/contrib/tag_history/main.php b/contrib/tag_history/main.php index ce2b9249..dfe15c5b 100644 --- a/contrib/tag_history/main.php +++ b/contrib/tag_history/main.php @@ -180,30 +180,6 @@ class Tag_History implements Extension { return ($row ? $row : array()); } - /* This doesn't actually get _ALL_ IPs as it limits to 1000. */ - public function get_all_user_ips() - { - global $database; - $row = $database->get_all(" - SELECT DISTINCT user_ip - FROM tag_histories - ORDER BY tag_histories.user_ip DESC - LIMIT 1000"); - return ($row ? $row : array()); - } - - public function process_revert_all_changes_by_ip($ip) - { - global $database; - /* - -SELECT * FROM `tag_histories` WHERE image_id IN -( select image_id from `tag_histories` where user_ip="216.240.14.185" and date_set >= 2011-10-23) -ORDER BY image_id, date_set - - */ - } - /* * this function is called when an image has been deleted */ From 46960eed48a1551b938298544c0ed90bc8f8ebee Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Mon, 16 Jan 2012 16:06:05 -0500 Subject: [PATCH 09/10] Fix for Notes missing js files. --- contrib/notes/theme.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/notes/theme.php b/contrib/notes/theme.php index 08c4f815..5bbf506e 100644 --- a/contrib/notes/theme.php +++ b/contrib/notes/theme.php @@ -56,7 +56,11 @@ class NotesTheme extends Themelet { } // check action POST on form - public function display_note_system(Page $page, $image_id, $recovered_notes, $adminOptions) { + public function display_note_system(Page $page, $image_id, $recovered_notes, $adminOptions) + { + $page->add_html_header("", 100); + $page->add_html_header("", 101); + $html = "", 100); - $page->add_html_header("", 101); + $data_href = get_base_href(); + $page->add_html_header("", 100); + $page->add_html_header("", 101); $html = "

Tags