@- Add $HTTP_POST_FILES[filename][tmp_name] - it was previously impossible to

@  retrieve the temporary name of an uploaded file using $HTTP_POST_FILES[] (Zeev)
- Changed IMAP Win32 definitions
This commit is contained in:
Zeev Suraski 2000-04-02 21:27:32 +00:00
parent de0d354736
commit 18e0850ba1
2 changed files with 14 additions and 7 deletions

View File

@ -41,7 +41,7 @@ ZEND_DECLARE_MODULE_GLOBALS(imap)
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#if (WIN32|WINNT)
#ifdef PHP_WIN32
#include "winsock.h"
MAILSTREAM DEFAULTPROTO;
#endif
@ -130,7 +130,7 @@ function_entry imap_functions[] = {
PHP_FE(imap_alerts, NULL)
PHP_FE(imap_errors, NULL)
PHP_FE(imap_last_error, NULL)
#if !(WIN32|WINNT)
#ifndef PHP_WIN32
PHP_FE(imap_mail, NULL)
#endif
PHP_FE(imap_search, NULL)
@ -380,20 +380,20 @@ PHP_MINIT_FUNCTION(imap)
ZEND_INIT_MODULE_GLOBALS(imap, php_imap_init_globals, NULL)
#if !(WIN32|WINNT)
#ifndef PHP_WIN32
mail_link(&unixdriver); /* link in the unix driver */
#endif
mail_link(&imapdriver); /* link in the imap driver */
mail_link(&nntpdriver); /* link in the nntp driver */
mail_link(&pop3driver); /* link in the pop3 driver */
#if !(WIN32|WINNT)
#ifndef PHP_WIN32
mail_link(&mhdriver); /* link in the mh driver */
mail_link(&mxdriver); /* link in the mx driver */
#endif
mail_link(&mbxdriver); /* link in the mbx driver */
mail_link(&tenexdriver); /* link in the tenex driver */
mail_link(&mtxdriver); /* link in the mtx driver */
#if !(WIN32|WINNT)
#ifndef PHP_WIN32
mail_link(&mmdfdriver); /* link in the mmdf driver */
mail_link(&newsdriver); /* link in the news driver */
mail_link(&philedriver); /* link in the phile driver */
@ -3130,7 +3130,7 @@ PHP_FUNCTION(imap_mail_compose)
}
/* }}} */
#if !(WIN32|WINNT)
#ifndef PHP_WIN32
int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath)
{
#ifdef PHP_WIN32

View File

@ -30,6 +30,9 @@
#define NEW_BOUNDARY_CHECK 1
#define SAFE_RETURN { if (namebuf) efree(namebuf); if (filenamebuf) efree(filenamebuf); if (lbuf) efree(lbuf); return; }
/* The longest property name we use in an uploaded file array */
#define MAX_SIZE_OF_INDEX sizeof("[tmpname]")
static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files ELS_DC PLS_DC)
{
@ -126,7 +129,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr)
if (lbuf) {
efree(lbuf);
}
lbuf = emalloc(s-name + MAX(MAX(sizeof("[name]"),sizeof("[size]")),sizeof("[type]")));
lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX);
state = 2;
loc2 = memchr(loc + 1, '\n', rem);
rem -= (loc2 - ptr) + 1;
@ -267,6 +270,10 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr)
}
}
php_register_variable(namebuf, fn, NULL ELS_CC PLS_CC);
/* Add $foo[tmp_name] */
sprintf(lbuf, "%s[tmp_name]", namebuf);
register_http_post_files_variable(lbuf, fn, http_post_files ELS_CC PLS_CC);
{
zval file_size;