Working on Replace Image feature.
Added link to page, fixed foreach loop.
This commit is contained in:
parent
f3b6fde7a5
commit
62cc7e0e5e
@ -27,6 +27,9 @@ class ImageIOTheme {
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$html .= "<a href='".make_link("upload/replace/".$i_image_id)."'>Replace Image</a>";
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,18 +84,19 @@ class Upload implements Extension {
|
|||||||
|
|
||||||
if(count($_FILES) + count($_POST) > 0)
|
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.");
|
throw new UploadException("Can not upload more than one image for replacing.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->can_upload($user)) {
|
if($this->can_upload($user)) {
|
||||||
/* This could be changed so that it doesn't use foreach loops.. */
|
if (count($_FILES)) {
|
||||||
foreach($_FILES as $file) {
|
$ok = $this->try_upload($_FILES, $tags, $source, $image_id);
|
||||||
$ok = $ok & $this->try_upload($_FILES, $tags, $source, $image_id);
|
} else {
|
||||||
}
|
foreach($_POST as $name => $value) {
|
||||||
foreach($_POST as $name => $value) {
|
if(substr($name, 0, 3) == "url" && strlen($value) > 0) {
|
||||||
if(substr($name, 0, 3) == "url" && strlen($value) > 0) {
|
$ok = $this->try_transload($value, $tags, $source, $image_id);
|
||||||
$ok = $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? */
|
/* Could replace with a page saying the image replace was successful? */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user