iliaa           Mon Jan 31 21:33:07 2005 EDT

  Modified files:              
    /php-src/main       rfc1867.c 
  Log:
  Final version of filename upload handling.
  
  
http://cvs.php.net/diff.php/php-src/main/rfc1867.c?r1=1.168&r2=1.169&ty=u
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.168 php-src/main/rfc1867.c:1.169
--- php-src/main/rfc1867.c:1.168        Mon Jan 24 17:35:23 2005
+++ php-src/main/rfc1867.c      Mon Jan 31 21:33:07 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: rfc1867.c,v 1.168 2005/01/24 22:35:23 iliaa Exp $ */
+/* $Id: rfc1867.c,v 1.169 2005/02/01 02:33:07 iliaa Exp $ */
 
 /*
  *  This product includes software developed by the Apache Group
@@ -32,7 +32,6 @@
 #include "php_globals.h"
 #include "php_variables.h"
 #include "rfc1867.h"
-#include "ext/standard/php_string.h"
 
 #define DEBUG_FILE_UPLOAD ZEND_DEBUG
 
@@ -1078,7 +1077,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;
                                }
@@ -1086,9 +1089,25 @@
                                goto filedone;
                        }
 #endif                 
-                       php_basename(filename, strlen(filename), NULL, 0, &s, 
NULL TSRMLS_CC);
-                       efree(filename);
-                       filename = s;
+
+#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
+
 #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