cvs: /php4 rfc1867.c /php4/ext/imap php_imap.c
| From: | Zeev Suraski | Date: | Sun, 02 Apr 2000 21:28:03 +0000 |
| Subject: | cvs: /php4 rfc1867.c /php4/ext/imap php_imap.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-13018@lists.php.net to get a copy of this message | ||
zeev Sun Apr 2 14:28:03 2000 EDT
Modified files:
/php4 rfc1867.c
/php4/ext/imap php_imap.c
Log:
@- 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
Index: php4/rfc1867.c
diff -u php4/rfc1867.c:1.31 php4/rfc1867.c:1.32
--- php4/rfc1867.c:1.31 Thu Mar 30 14:41:13 2000
+++ php4/rfc1867.c Sun Apr 2 14:27:32 2000
@@ -15,7 +15,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.31 2000/03/30 22:41:13 andi Exp $ */
+/* $Id: rfc1867.c,v 1.32 2000/04/02 21:27:32 zeev Exp $ */
#include <stdio.h>
#include "php.h"
@@ -30,7 +30,10 @@
#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)
{
int register_globals = PG(register_globals);
@@ -126,7 +129,7 @@
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 @@
}
}
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;
Index: php4/ext/imap/php_imap.c
diff -u php4/ext/imap/php_imap.c:1.1 php4/ext/imap/php_imap.c:1.2
--- php4/ext/imap/php_imap.c:1.1 Sat Apr 1 08:49:39 2000
+++ php4/ext/imap/php_imap.c Sun Apr 2 14:27:32 2000
@@ -22,7 +22,7 @@
| PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.1 2000/04/01 16:49:39 zeev Exp $ */
+/* $Id: php_imap.c,v 1.2 2000/04/02 21:27:32 zeev Exp $ */
#define IMAP41
@@ -41,7 +41,7 @@
#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 @@
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 @@
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 @@
}
/* }}} */
-#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