]>
Commit | Line | Data |
---|---|---|
8135bbee JB |
1 | --- php-4.3.0/ext/standard/mail.c.orig Fri Nov 29 12:15:43 2002 |
2 | +++ php-4.3.0/ext/standard/mail.c Thu Jan 2 12:37:54 2003 | |
5316c927 AF |
3 | @@ -21,6 +21,8 @@ |
4 | #include <stdlib.h> | |
5 | #include <ctype.h> | |
6 | #include <stdio.h> | |
7 | +#include <syslog.h> | |
8 | +#include <string.h> | |
9 | #include "php.h" | |
804cfcec | 10 | #include "ext/standard/info.h" |
8135bbee JB |
11 | |
12 | @@ -36,6 +38,9 @@ | |
804cfcec AM |
13 | #include "safe_mode.h" |
14 | #include "exec.h" | |
15 | ||
16 | +#include "zend_operators.h" | |
804cfcec AM |
17 | +#include "zend_globals.h" |
18 | + | |
19 | #if HAVE_SENDMAIL | |
20 | #ifdef PHP_WIN32 | |
21 | #include "win32/sendmail.h" | |
8135bbee JB |
22 | @@ -196,8 +201,42 @@ |
23 | return 0; | |
24 | } | |
25 | #endif | |
5316c927 AF |
26 | - fprintf(sendmail, "To: %s\n", to); |
27 | - fprintf(sendmail, "Subject: %s\n", subject); | |
edf77de8 | 28 | + TSRMLS_FETCH(); |
29 | + | |
5316c927 AF |
30 | + if ((to != NULL) && (strlen(to)!=0)) { |
31 | + fprintf(sendmail, "To: %s\n", to); | |
32 | + } | |
33 | + if ((subject != NULL) && (strlen(subject)!=0)) { | |
34 | + fprintf(sendmail, "Subject: %s\n", subject); | |
35 | + } | |
804cfcec | 36 | + |
804cfcec AM |
37 | + if (PG(http_globals)[TRACK_VARS_SERVER]) { |
38 | + zval **remote_addr, **server_name, **server_port, | |
bfb8a2ed | 39 | + **script_name, **http_user_agent; |
804cfcec AM |
40 | + |
41 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &remote_addr)==SUCCESS) { | |
42 | + convert_to_string_ex(remote_addr); | |
43 | + fprintf(sendmail, "HTTP-Posting-Client: %s\n", Z_STRVAL_PP(remote_addr)); | |
44 | + } | |
45 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_NAME", sizeof("SERVER_NAME"), (void **) &server_name)==SUCCESS) { | |
46 | + convert_to_string_ex(server_name); | |
b4e19d31 | 47 | + fprintf(sendmail, "HTTP-Posting-URI: %s", Z_STRVAL_PP(server_name)); |
804cfcec AM |
48 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_PORT", sizeof("SERVER_PORT"), (void **) &server_port)==SUCCESS) { |
49 | + convert_to_string_ex(server_port); | |
50 | + fprintf(sendmail, ":%s", Z_STRVAL_PP(server_port)); | |
51 | + } | |
18e705dd | 52 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &script_name)==SUCCESS) { |
bfb8a2ed AM |
53 | + convert_to_string_ex(script_name); |
54 | + fprintf(sendmail, "%s", Z_STRVAL_PP(script_name)); | |
804cfcec AM |
55 | + } |
56 | + fprintf(sendmail, "\n"); | |
57 | + } | |
58 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &http_user_agent)==SUCCESS) { | |
59 | + convert_to_string_ex(http_user_agent); | |
60 | + fprintf(sendmail, "HTTP-Posting-User-Agent: %s\n", Z_STRVAL_PP(http_user_agent)); | |
61 | + } | |
62 | + } | |
63 | + | |
5316c927 AF |
64 | if (headers != NULL) { |
65 | fprintf(sendmail, "%s\n", headers); | |
66 | } |