fixes
git-svn-id: file:///home/shish/svn/shimmie2/trunk@342 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
16df65cf35
commit
f75af6a908
@ -110,6 +110,8 @@ class Upload extends Extension {
|
|||||||
|
|
||||||
$ok = false;
|
$ok = false;
|
||||||
|
|
||||||
|
// PHP falls back to system default if /tmp fails, can't we just
|
||||||
|
// use the system default to start with? :-/
|
||||||
$tmp_filename = tempnam("/tmp", "shimmie_transload");
|
$tmp_filename = tempnam("/tmp", "shimmie_transload");
|
||||||
|
|
||||||
if($config->get_string("transload_engine") == "fopen") {
|
if($config->get_string("transload_engine") == "fopen") {
|
||||||
@ -119,11 +121,13 @@ class Upload extends Extension {
|
|||||||
"Error reading from ".html_escape($url));
|
"Error reading from ".html_escape($url));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$data = fread($fp, $config->get_int('upload_size'));
|
$data = "";
|
||||||
|
while(!feof($fp) && $length <= $config->get_int('upload_size')) {
|
||||||
|
$data .= fread($fp, 8192);
|
||||||
|
$length = strlen($data);
|
||||||
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
// PHP falls back to system default if /tmp fails, can't we just
|
|
||||||
// use the system default to start with? :-/
|
|
||||||
$fp = fopen($tmp_filename, "w");
|
$fp = fopen($tmp_filename, "w");
|
||||||
fwrite($fp, $data);
|
fwrite($fp, $data);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@ -141,7 +145,12 @@ class Upload extends Extension {
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!($info = getimagesize($tmp_filename))) {
|
if(filesize($tmp_filename) > $config->get_int('upload_size')) {
|
||||||
|
$this->theme->display_upload_error($page, "Error with ".html_escape($file['name']),
|
||||||
|
"File too large (".filesize($tmp_filename)." > ".
|
||||||
|
($config->get_int('upload_size')).")");
|
||||||
|
}
|
||||||
|
else if(!($info = getimagesize($tmp_filename))) {
|
||||||
$this->theme->display_upload_error($page, "Error with ".html_escape(basename($url)),
|
$this->theme->display_upload_error($page, "Error with ".html_escape(basename($url)),
|
||||||
"PHP doesn't recognise this as an image file");
|
"PHP doesn't recognise this as an image file");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user