From 431e494ae43257bea251a59ed6b2a4bb20eb7fd4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 6 Apr 2006 17:15:45 +0000 Subject: To all people having their bug status set to fixed: SF pserver CVS access is currently down, therefore the snapshots are still out of date. - fix a bunch of bugs - is no longer allowed in template (.html) files - changed layout of private message screens (folders are menu items) - removed unread mode for private messages - added new feature to template engine - "jump out of loop" or "loop another loop within my loop" :D (will be documented within the coding guidelines) - added autologin field to sessions - check session length checks - added add_log statement to sessions to track session valid to invalid changes if ip/browser change depending on config settings (only debug) - added multibyte support for various variables (exception at the moment is usernames which needs some discussion) - hopefully not broke something. :/ git-svn-id: file:///svn/phpbb/trunk@5765 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_upload.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/functions_upload.php') diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index ca2ef1517f..a9e08ec1e9 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -524,7 +524,7 @@ class fileupload $url = parse_url($upload_url); $host = $url['host']; - $path = dirname($url['path']); + $path = $url['path']; $port = (!empty($url['port'])) ? (int) $url['port'] : 80; $upload_ary['type'] = 'application/octet-stream'; @@ -543,7 +543,7 @@ class fileupload return $file; } - fputs($fsock, 'GET /' . $filename . " HTTP/1.1\r\n"); + fputs($fsock, 'GET /' . $path . " HTTP/1.1\r\n"); fputs($fsock, "HOST: " . $host . "\r\n"); fputs($fsock, "Connection: close\r\n\r\n"); @@ -569,6 +569,11 @@ class fileupload { $upload_ary['type'] = rtrim(str_replace('Content-Type: ', '', $line)); } + else if (strpos($line, 'HTTP/1.1 404 Not Found') !== false) + { + $file = new fileerror($user->lang[$this->error_prefix . 'URL_NOT_FOUND']); + return $file; + } } } } @@ -609,10 +614,15 @@ class fileupload { case 1: $error = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize')); - break; + break; + case 2: - $error = sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $this->max_filesize); - break; + $size_lang = ($this->max_filesize >= 1048576) ? $user->lang['MB'] : (($this->max_filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] ); + $max_filesize = ($this->max_filesize >= 1048576) ? round($this->max_filesize / 1048576 * 100) / 100 : (($this->max_filesize >= 1024) ? round($this->max_filesize / 1024 * 100) / 100 : $this->max_filesize); + + $error = sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang); + break; + case 3: $error = 'The uploaded file was only partially uploaded'; break; @@ -637,7 +647,10 @@ class fileupload // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form if ($this->max_filesize && ($file->get('filesize') > $this->max_filesize || $file->get('filesize') == 0)) { - $file->error[] = sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $this->max_filesize); + $size_lang = ($this->max_filesize >= 1048576) ? $user->lang['MB'] : (($this->max_filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] ); + $max_filesize = ($this->max_filesize >= 1048576) ? round($this->max_filesize / 1048576 * 100) / 100 : (($this->max_filesize >= 1024) ? round($this->max_filesize / 1024 * 100) / 100 : $this->max_filesize); + + $file->error[] = sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang); } // check Filename -- cgit v1.2.1