diff --git a/ext/image/theme.php b/ext/image/theme.php index 10bfcfe4..ddd00719 100644 --- a/ext/image/theme.php +++ b/ext/image/theme.php @@ -27,6 +27,9 @@ class ImageIOTheme { "; } + + $html .= "Replace Image"; + return $html; } } diff --git a/ext/upload/main.php b/ext/upload/main.php index b31de495..511f9271 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -84,18 +84,19 @@ class Upload implements Extension { if(count($_FILES) + count($_POST) > 0) { - if (count($_FILES) + count($_POST) > 1) { + if (count($_FILES) > 1) { throw new UploadException("Can not upload more than one image for replacing."); } if($this->can_upload($user)) { - /* This could be changed so that it doesn't use foreach loops.. */ - foreach($_FILES as $file) { - $ok = $ok & $this->try_upload($_FILES, $tags, $source, $image_id); - } - foreach($_POST as $name => $value) { - if(substr($name, 0, 3) == "url" && strlen($value) > 0) { - $ok = $ok & $this->try_transload($value, $tags, $source, $image_id); + if (count($_FILES)) { + $ok = $this->try_upload($_FILES, $tags, $source, $image_id); + } else { + foreach($_POST as $name => $value) { + if(substr($name, 0, 3) == "url" && strlen($value) > 0) { + $ok = $this->try_transload($value, $tags, $source, $image_id); + break; // leave the foreach loop. + } } } /* Could replace with a page saying the image replace was successful? */