]>
Commit | Line | Data |
---|---|---|
9c3c186d AM |
1 | diff -urN php-4.2.3.org/ext/standard/mail.c php-4.2.3/ext/standard/mail.c |
2 | --- php-4.2.3.org/ext/standard/mail.c Tue Oct 29 21:35:04 2002 | |
3 | +++ php-4.2.3/ext/standard/mail.c Tue Oct 29 21:33:03 2002 | |
392b90a4 AF |
4 | @@ -21,6 +21,8 @@ |
5 | #include <stdlib.h> | |
6 | #include <ctype.h> | |
7 | #include <stdio.h> | |
8 | +#include <syslog.h> | |
9 | +#include <string.h> | |
10 | #include "php.h" | |
9c3c186d | 11 | #include "ext/standard/info.h" |
392b90a4 | 12 | #if !defined(PHP_WIN32) |
9c3c186d AM |
13 | @@ -37,6 +39,10 @@ |
14 | #include "safe_mode.h" | |
15 | #include "exec.h" | |
16 | ||
17 | +#include "zend_operators.h" | |
18 | + | |
19 | +#include "zend_globals.h" | |
20 | + | |
21 | #if HAVE_SENDMAIL | |
22 | #ifdef PHP_WIN32 | |
23 | #include "win32/sendmail.h" | |
24 | @@ -166,8 +172,42 @@ | |
25 | efree (sendmail_cmd); | |
392b90a4 AF |
26 | |
27 | if (sendmail) { | |
28 | - fprintf(sendmail, "To: %s\n", to); | |
29 | - fprintf(sendmail, "Subject: %s\n", subject); | |
7a3dec77 | 30 | + TSRMLS_FETCH(); |
31 | + | |
392b90a4 AF |
32 | + if ((to != NULL) && (strlen(to)!=0)) { |
33 | + fprintf(sendmail, "To: %s\n", to); | |
34 | + } | |
35 | + if ((subject != NULL) && (strlen(subject)!=0)) { | |
36 | + fprintf(sendmail, "Subject: %s\n", subject); | |
37 | + } | |
9c3c186d | 38 | + |
9c3c186d AM |
39 | + if (PG(http_globals)[TRACK_VARS_SERVER]) { |
40 | + zval **remote_addr, **server_name, **server_port, | |
41 | + **request_uri, **http_user_agent; | |
42 | + | |
43 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &remote_addr)==SUCCESS) { | |
44 | + convert_to_string_ex(remote_addr); | |
45 | + fprintf(sendmail, "HTTP-Posting-Client: %s\n", Z_STRVAL_PP(remote_addr)); | |
46 | + } | |
47 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_NAME", sizeof("SERVER_NAME"), (void **) &server_name)==SUCCESS) { | |
48 | + convert_to_string_ex(server_name); | |
49 | + fprintf(sendmail, "HTTP-Posting-URI: %s", Z_STRVAL_PP(server_name)); | |
50 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_PORT", sizeof("SERVER_PORT"), (void **) &server_port)==SUCCESS) { | |
51 | + convert_to_string_ex(server_port); | |
52 | + fprintf(sendmail, ":%s", Z_STRVAL_PP(server_port)); | |
53 | + } | |
54 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &request_uri)==SUCCESS) { | |
55 | + convert_to_string_ex(request_uri); | |
56 | + fprintf(sendmail, "%s", Z_STRVAL_PP(request_uri)); | |
57 | + } | |
58 | + fprintf(sendmail, "\n"); | |
59 | + } | |
60 | + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &http_user_agent)==SUCCESS) { | |
61 | + convert_to_string_ex(http_user_agent); | |
62 | + fprintf(sendmail, "HTTP-Posting-User-Agent: %s\n", Z_STRVAL_PP(http_user_agent)); | |
63 | + } | |
64 | + } | |
65 | + | |
392b90a4 AF |
66 | if (headers != NULL) { |
67 | fprintf(sendmail, "%s\n", headers); | |
68 | } |