iliaa           Mon Jan 31 21:33:25 2005 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/main       rfc1867.c 
  Log:
  MFH: Final version of filename upload handling.
  
  
http://cvs.php.net/diff.php/php-src/main/rfc1867.c?r1=1.122.2.31&r2=1.122.2.32&ty=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.122.2.31 php-src/main/rfc1867.c:1.122.2.32
--- php-src/main/rfc1867.c:1.122.2.31   Mon Jan 24 18:52:27 2005
+++ php-src/main/rfc1867.c      Mon Jan 31 21:33:25 2005
@@ -16,7 +16,7 @@
    |          Jani Taskinen <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
  */
-/* $Id: rfc1867.c,v 1.122.2.31 2005/01/24 23:52:27 iliaa Exp $ */
+/* $Id: rfc1867.c,v 1.122.2.32 2005/02/01 02:33:25 iliaa Exp $ */
 
 /*
  *  This product includes software developed by the Apache Group
@@ -31,7 +31,6 @@
 #include "php_globals.h"
 #include "php_variables.h"
 #include "rfc1867.h"
-#include "ext/standard/php_string.h"
 
 #undef DEBUG_FILE_UPLOAD
 
@@ -1065,7 +1064,11 @@
                                        str_len = strlen(filename);
                                        
php_mb_gpc_encoding_converter(&filename, &str_len, 1, NULL, NULL TSRMLS_CC);
                                }
+#ifdef PHP_WIN32
                                s = php_mb_strrchr(filename, '\\' TSRMLS_CC);
+#else
+                               s = filename;
+#endif
                                if ((tmp = php_mb_strrchr(filename, '/' 
TSRMLS_CC)) > s) {
                                        s = tmp;
                                }
@@ -1073,11 +1076,24 @@
                                goto filedone;
                        }
 #endif
+#ifdef PHP_WIN32
+                       s = strrchr(filename, '\\');
+#else
+                       s = filename;
+#endif
+                       if ((tmp = strrchr(filename, '/')) > s) {
+                               s = tmp;
+                       }
+#ifdef PHP_WIN32
+                       if (PG(magic_quotes_gpc)) {
+                               s = s ? s : filename;
+                               tmp = strrchr(s, '\'');
+                               s = tmp > s ? tmp : s;
+                               tmp = strrchr(s, '"');
+                               s = tmp > s ? tmp : s;
+                       }
+#endif
 
-                       /* ensure that the uploaded file name only contains the 
path */
-                       s = php_basename(filename, strlen(filename), NULL, 0);
-                       efree(filename);
-                       filename = s;
 #if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
 filedone:
 #endif

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to