PHP_FE(parse_ini_file, NULL)
+ PHP_FE(is_upload_file, NULL)
+
/* functions from reg.c */
PHP_FE(ereg, third_argument_force_ref)
PHP_FE(ereg_replace, NULL)
}
+PHP_FUNCTION(is_upload_file)
+{
+ zval **path;
+ SLS_FETCH();
+
+ if (!SG(rfc1867_uploaded_files)) {
+ RETURN_FALSE;
+ }
+
+ if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &path)!=SUCCESS) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+ convert_to_string_ex(path);
+
+ if (zend_hash_exists(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1)) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
+}
+
/*
* Local variables:
* tab-width: 4
sapi_module.activate(SLS_C);
}
}
+ SG(rfc1867_uploaded_files) = NULL;
}
if (sapi_module.deactivate) {
sapi_module.deactivate(SLS_C);
}
+ if (SG(rfc1867_uploaded_files)) {
+ zend_hash_destroy(SG(rfc1867_uploaded_files));
+ FREE_HASHTABLE(SG(rfc1867_uploaded_files));
+ }
}
/*
* Split raw mime stream up into appropriate components
*/
-static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr)
+static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr SLS_DC)
{
char *ptr, *loc, *loc2, *loc3, *s, *name, *filename, *u, *fn;
int len, state = 0, Done = 0, rem, urem;
zend_hash_init(&PG(rfc1867_protected_variables), 5, NULL, NULL, 0);
+ ALLOC_HASHTABLE(SG(rfc1867_uploaded_files));
+ zend_hash_init(SG(rfc1867_uploaded_files), 5, NULL, NULL, 0);
+
ALLOC_ZVAL(http_post_files);
array_init(http_post_files);
INIT_PZVAL(http_post_files);
}
add_protected_variable(namebuf PLS_CC);
safe_php_register_variable(namebuf, fn, NULL, 1 ELS_CC PLS_CC);
+ {
+ int dummy=1;
+
+ zend_hash_add(SG(rfc1867_uploaded_files), namebuf, strlen(namebuf)+1, &dummy, sizeof(int), NULL);
+ }
/* Add $foo[tmp_name] */
if(is_arr_upload) {
boundary_len = strlen(boundary);
if (SG(request_info).post_data) {
- php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary, array_ptr);
+ php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary, array_ptr SLS_CC);
}
}