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 .= " -