diff --git a/core/extension.class.php b/core/extension.class.php index 9b514318..4571b1c0 100644 --- a/core/extension.class.php +++ b/core/extension.class.php @@ -177,6 +177,19 @@ abstract class DataHandlerExtension implements Extension { $iae = new ImageAdditionEvent($event->user, $image); send_event($iae); $event->image_id = $iae->image->id; + + // Rating Stuff. + if(!empty($event->metadata['rating'])){ + global $database; + $rating = $event->metadata['rating']; + $database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $event->image_id)); + } + + // Locked Stuff. + if(!empty($event->metadata['locked'])){ + $locked = $event->metadata['locked']; + send_event(new LockSetEvent($image, !empty($locked))); + } } } diff --git a/ext/upload/main.php b/ext/upload/main.php index 167bce07..36e0914c 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -173,6 +173,7 @@ class Upload implements Extension { if(!empty($_GET['tags']) && $_GET['tags'] != "null") { $tags = Tag::explode($_GET['tags']); } + $ok = $this->try_transload($url, $tags, $url); $this->theme->display_upload_status($page, $ok); } @@ -299,10 +300,51 @@ class Upload implements Extension { private function try_transload($url, $tags, $source, $replace='') { global $page; global $config; + global $user; $ok = true; - if(empty($source)) $source = $url; + //Allows external source to be set. + if(!empty($_GET['source'])){ + $source = $_GET['source']; + }else{ + $source = $url; + } + + // Checks if user is admin > check if you want locked. + if($user->is_admin()){ + // There must be a less messy way to do this.. + if($_GET['locked'] == "y" || $_GET['locked'] == "yes" || $_GET['locked'] == "true" || $_GET['locked'] == "on" || $_GET['locked'] == "n" || $_GET['locked'] == "no" || $_GET['locked'] == "false" || $_GET['locked'] == "off"){ + if($_GET['locked'] == "y" || $_GET['locked'] == "yes" || $_GET['locked'] == "true" || $_GET['locked'] == "on"){ + $locked = "on"; + } + } + } + + // Checks if url contains rating, also checks if the rating extension is enabled. + if($config->get_string("transload_engine", "none") != "none" && file_exists("ext/rating") && !empty($_GET['rating'])) { + $rating = strtolower($_GET['rating']); + // There REALLY must be a less messy way to do this.. + if($rating !== "") { + if($rating == "s" || $rating == "safe" || $rating == "q" || $rating == "questionable" || $rating == "e" || $rating == "explicit") { + if($rating == "s" || $rating == "safe" || $rating == "q" || $rating == "questionable") { + if($rating == "s" || $rating == "safe") { + $rating = "s"; + }else{ + $rating = "q"; + } + }else{ + $rating = "e"; + } + }else{ + $rating = "u"; + } + }else{ + $rating = "u"; + } + }else{ + $rating = ""; + } // PHP falls back to system default if /tmp fails, can't we just // use the system default to start with? :-/ @@ -363,6 +405,16 @@ class Upload implements Extension { $metadata['tags'] = $tags; $metadata['source'] = $source; + /* check for locked > adds to metadata if it has */ + if(!empty($locked)){ + $metadata['locked'] = $locked; + } + + /* check for rating > adds to metadata if it has */ + if(!empty($rating)){ + $metadata['rating'] = $rating; + } + /* check if we have been given an image ID to replace */ if (!empty($replace)) { $metadata['replace'] = $replace; diff --git a/ext/upload/minus.png b/ext/upload/minus.png new file mode 100644 index 00000000..57c86dec Binary files /dev/null and b/ext/upload/minus.png differ diff --git a/ext/upload/plus.png b/ext/upload/plus.png new file mode 100644 index 00000000..d7ec0ae3 Binary files /dev/null and b/ext/upload/plus.png differ diff --git a/ext/upload/style.css b/ext/upload/style.css index 1fe3f45d..ef8424c9 100644 --- a/ext/upload/style.css +++ b/ext/upload/style.css @@ -5,5 +5,10 @@ #radio_button { width: auto; } +#wrapper { + opacity : 0.4; + filter: alpha(opacity=40); // msie +} + /* 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 a18adbe5..50895783 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -16,13 +16,44 @@ class UploadTheme extends Themelet { // Uploader 2.0! $upload_list = ""; for($i=0; $i<$config->get_int('upload_count'); $i++) { - $n = $i + 1; - $upload_list .= " - -
File
"; + $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 .= + " File
"; if($tl_enabled) { - $upload_list .=" - URL
+ $upload_list .= + " URL "; @@ -58,8 +89,8 @@ class UploadTheme extends Themelet { ".make_form(make_link("upload"), "POST", $multipart=True)." $upload_list - - + +
Tags
Source
Tags
Source
@@ -80,13 +111,17 @@ class UploadTheme extends Themelet { $title . ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } { + /* Danbooru > Shimmie Bookmarklet. + This "should" work on any site running danbooru, unless for some odd reason they switched around the id's or aren't using post/list. + */ $title = "Danbooru to " . $config->get_string('title'); $html .= '

' . - $title . ' (As above, Click on a Danbooru-run image page. (This also grabs the tags!))'; + $link . $delimiter . 'url=";var tag=document.getElementById("post_old_tags").value;var doc=document.documentElement.innerHTML;var rtg=doc.match("

  • Rating: (.*)<\/li>");var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/.*\/");' . + 'if (confirm("OK = Use Current tags.\nCancel = Use new tags.")==true)' . + '{if(tag.search(/\bflash\b/)==-1){location.href=ste+img+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx;}else{location.href=ste+document.getElementsByName("movie")[0].value' . + '+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx;}}else{var p=prompt("Enter Tags","");if(tag.search(/\bflash\b/)==-1){location.href=ste+img+"&tags="+p+"&rating="+rtg[1]+"&source="+srx;}' . + 'else{location.href=ste+document.getElementsByName("movie")[0].value+"&tags="+p+"&rating="+rtg[1]+"&source="+srx;}}">' . + $title . ' (As above, Click on a Danbooru-run image page. (This also grabs the tags, rating & source!))'; } @@ -106,10 +141,10 @@ class UploadTheme extends Themelet { $upload_list = ''; $upload_list .= " -
    File
    "; + File
    "; if($tl_enabled) { $upload_list .=" - URL
    + URL "; } else { diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index d5b5e479..a9a21f8b 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -59,13 +59,13 @@ class Themelet { $tsize = get_thumbnail_size($image->width, $image->height); } return " -
    +
    $h_tip -
    +
    "; } diff --git a/themes/warm/layout.class.php b/themes/warm/layout.class.php index 3d6c2cb7..c843eb3a 100644 --- a/themes/warm/layout.class.php +++ b/themes/warm/layout.class.php @@ -10,7 +10,9 @@ class Layout { global $config; $theme_name = $config->get_string('theme', 'default'); + $site_name = $config->get_string('title'); $data_href = get_base_href(); + $main_page = $config->get_string('main_page'); $contact_link = $config->get_string('contact_link'); $header_html = ""; @@ -67,7 +69,7 @@ $header_html $head_block_html