[PHP4BETA] CVS update: php4/ext/standard
| From: | zeev | Date: | Sun, 09 May 1999 08:48:01 +0000 |
| Subject: | [PHP4BETA] CVS update: php4/ext/standard | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-719@lists.php.net to get a copy of this message | ||
Date: Sunday May 9, 1999 @ 4:48
Author: zeev
Update of /repository/php4/ext/standard
In directory php:/tmp/cvs-serv25538/ext/standard
Modified Files:
dl.c dl.h head.c info.c info.h mail.c php3_mail.h post.c
Log Message:
* Finalizing the PHP version of SAPI. Support POST and cookies among other things.
* Fully implement ISAPI support - POST and cookies among other things.
* Almost completely rewrote phpinfo(). Allow modules to easily display their
information in phpinfo() without modifying phpinfo() itself (prototype for
the module info function was changed, thus the large amount of updated module
files).
* Initial extended SAPI support for Apache, completely untested.
* CGI now uses SAPI fully as well.
Index: php4/ext/standard/dl.c
diff -u php4/ext/standard/dl.c:1.3 php4/ext/standard/dl.c:1.4
--- php4/ext/standard/dl.c:1.3 Fri Apr 23 20:11:56 1999
+++ php4/ext/standard/dl.c Sun May 9 04:48:01 1999
@@ -160,7 +160,7 @@
}
-void php3_info_dl(void)
+void php3_info_dl(ZEND_MODULE_INFO_FUNC_ARGS)
{
PUTS("Dynamic Library support enabled.\n");
}
Index: php4/ext/standard/dl.h
diff -u php4/ext/standard/dl.h:1.1 php4/ext/standard/dl.h:1.2
--- php4/ext/standard/dl.h:1.1 Wed Apr 21 20:25:56 1999
+++ php4/ext/standard/dl.h Sun May 9 04:48:01 1999
@@ -30,7 +30,7 @@
*/
-/* $Id: dl.h,v 1.1 1999/04/22 00:25:56 ssb Exp $ */
+/* $Id: dl.h,v 1.2 1999/05/09 08:48:01 zeev Exp $ */
#ifndef _DL_H
#define _DL_H
@@ -48,7 +48,7 @@
extern int php3_minit_dl(INIT_FUNC_ARGS);
extern int php3_mshutdown_dl(SHUTDOWN_FUNC_ARGS);
extern int php3_rshutdown_dl(SHUTDOWN_FUNC_ARGS);
-extern void php3_info_dl(void);
+extern void php3_info_dl(ZEND_MODULE_INFO_FUNC_ARGS);
#else
Index: php4/ext/standard/head.c
diff -u php4/ext/standard/head.c:1.10 php4/ext/standard/head.c:1.11
--- php4/ext/standard/head.c:1.10 Wed May 5 17:29:26 1999
+++ php4/ext/standard/head.c Sun May 9 04:48:01 1999
@@ -26,7 +26,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: head.c,v 1.10 1999/05/05 21:29:26 zeev Exp $ */
+/* $Id: head.c,v 1.11 1999/05/09 08:48:01 zeev Exp $ */
#include <stdio.h>
#include "php.h"
@@ -76,7 +76,7 @@
}
-#ifdef APACHE
+#if 0
/* Adds header information */
void php4i_add_header_information(char *header_information, uint header_length)
{
@@ -229,7 +229,7 @@
-#ifdef APACHE
+#if 0
/*
* php3_header() flushes the header info built up using calls to
* the Header() function. If type is 1, a redirect to str is done.
@@ -438,15 +438,10 @@
/* php3_SetCookie(name,value,expires,path,domain,secure) */
void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS)
{
-#if !APACHE
- char *tempstr;
-#if FHTTPD
- char *tempstr1;
-#endif
- int len=0;
+ char *cookie;
+ int len=sizeof("Set-Cookie: ");
time_t t;
char *r, *dt;
-#endif
char *name = NULL, *value = NULL, *path = NULL, *domain = NULL;
time_t expires = 0;
int secure = 0;
@@ -465,100 +460,107 @@
case 6:
convert_to_boolean(arg[5]);
secure = arg[5]->value.lval;
+ /* break missing intentionally */
case 5:
convert_to_string(arg[4]);
domain = estrndup(arg[4]->value.str.val,arg[4]->value.str.len);
+ /* break missing intentionally */
case 4:
convert_to_string(arg[3]);
path = estrndup(arg[3]->value.str.val,arg[3]->value.str.len);
+ /* break missing intentionally */
case 3:
convert_to_long(arg[2]);
expires = arg[2]->value.lval;
+ /* break missing intentionally */
case 2:
convert_to_string(arg[1]);
value = estrndup(arg[1]->value.str.val,arg[1]->value.str.len);
+ /* break missing intentionally */
case 1:
convert_to_string(arg[0]);
name = estrndup(arg[0]->value.str.val,arg[0]->value.str.len);
+ break;
}
-#if APACHE
+#if 0
php3_PushCookieList(name, value, expires, path, domain, secure);
#else
- if (name) len += strlen(name);
- if (value) len += strlen(value);
- if (path) len += strlen(path);
- if (domain) len += strlen(domain);
- tempstr = emalloc(len + 100);
+ if (name) {
+ len += strlen(name);
+ }
+ if (value) {
+ len += strlen(value);
+ }
+ if (path) {
+ len += strlen(path);
+ }
+ if (domain) {
+ len += strlen(domain);
+ }
+ cookie = emalloc(len + 100);
if (!value || (value && !*value)) {
/*
* MSIE doesn't delete a cookie when you set it to a null value
* so in order to force cookies to be deleted, even on MSIE, we
* pick an expiry date 1 year and 1 second in the past
*/
- sprintf(tempstr, "%s=deleted", name);
- strcat(tempstr, "; expires=");
+ sprintf(cookie, "Set-Cookie: %s=deleted", name);
+ strcat(cookie, "; expires=");
t = time(NULL) - 31536001;
dt = php3_std_date(t);
- strcat(tempstr, dt);
+ strcat(cookie, dt);
efree(dt);
} else {
/* FIXME: XXX: this is not binary data safe */
r = _php3_urlencode(value, strlen (value));
- sprintf(tempstr, "%s=%s", name, value ? r : "");
+ sprintf(cookie, "Set-Cookie: %s=%s", name, value ? r : "");
if (r) efree(r);
if (value) efree(value);
value=NULL;
if (name) efree(name);
name=NULL;
if (expires > 0) {
- strcat(tempstr, "; expires=");
+ strcat(cookie, "; expires=");
dt = php3_std_date(expires);
- strcat(tempstr, dt);
+ strcat(cookie, dt);
efree(dt);
}
}
if (path && strlen(path)) {
- strcat(tempstr, "; path=");
- strcat(tempstr, path);
+ strcat(cookie, "; path=");
+ strcat(cookie, path);
efree(path);
path=NULL;
}
if (domain && strlen(domain)) {
- strcat(tempstr, "; domain=");
- strcat(tempstr, domain);
+ strcat(cookie, "; domain=");
+ strcat(cookie, domain);
efree(domain);
domain=NULL;
}
if (secure) {
- strcat(tempstr, "; secure");
+ strcat(cookie, "; secure");
}
-#if USE_SAPI
- {
- char *tempstr2=emalloc(strlen(tempstr)+14);
- sprintf(tempstr2,"Set-Cookie: %s\015\012",tempstr);
- sapi_rqst->header(sapi_rqst->scid,tempstr2);
- efree(tempstr2);
+
+
+ if (sapi_add_header(cookie, strlen(cookie))==SUCCESS) {
+ RETVAL_TRUE;
+ } else {
+ RETVAL_FALSE;
}
-#elif FHTTPD
- tempstr1 = emalloc(strlen(tempstr)
- + sizeof("Set-Cookie: ") + 2);
- if(tempstr1) {
- strcpy(tempstr1, "Set-Cookie: ");
- strcpy(tempstr1 + sizeof("Set-Cookie: ") - 1, tempstr);
- strcat(tempstr1, "\r\n");
- php3_fhttpd_puts_header(tempstr1);
- efree(tempstr1);
- }
-#else
- PUTS_H("Set-Cookie: ");
- PUTS_H(tempstr);
- PUTS_H("\015\012");
-#endif
- if (domain) efree(domain);
- if (path) efree(path);
- if (name) efree(name);
- if (value) efree(value);
- efree(tempstr);
+
+ if (domain) {
+ efree(domain);
+ }
+ if (path) {
+ efree(path);
+ }
+ if (name) {
+ efree(name);
+ }
+ if (value) {
+ efree(value);
+ }
#endif
}
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.10 php4/ext/standard/info.c:1.11
--- php4/ext/standard/info.c:1.10 Thu May 6 14:09:50 1999
+++ php4/ext/standard/info.c Sun May 9 04:48:01 1999
@@ -40,17 +40,6 @@
#include "zend_globals.h" /* needs ELS */
-#define PHP3_CONF_STR(directive,value1,value2) \
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">"); \
- PUTS(directive); \
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR
"\"> "); \
- if (value1) PUTS(value1); \
- else PUTS("<i>none</i>"); \
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR
"\"> "); \
- if (value2) PUTS(value2); \
- else PUTS("<i>none</i>"); \
- PUTS("</td></tr>\n");
-
#define PHP3_CONF_LONG(directive,value1,value2) \
php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR
"\">%s</td><td bgcolor=\"" CONTENTS_COLOR
"\">%ld</td><td bgcolor=\"" CONTENTS_COLOR
"\">%ld</td></tr>\n",directive,value1,value2);
@@ -60,17 +49,15 @@
#define CONTENTS_COLOR "#DDDDDD"
#define HEADER_COLOR "#00DDDD"
+#define CREDIT_LINE(module, authors) php_info_print_table_row(2, module, authors)
+
+
static int _display_module_info(php3_module_entry *module)
{
- PUTS("<tr><th align=left bgcolor=\"" ENTRY_NAME_COLOR
"\">");
- PUTS(module->name);
- PUTS("</th><td bgcolor=\"" CONTENTS_COLOR "\">");
if (module->info_func) {
- module->info_func();
- } else {
- PUTS("No additional information.");
+ php3_printf("<hr><h2>%s</h2>\n", module->name);
+ module->info_func(module);
}
- PUTS("</td></tr>\n");
return 0;
}
@@ -103,106 +90,60 @@
php3_uname=PHP_UNAME;
#endif
+
+ php3_printf("<center><h1>PHP Version %s</h1></center>\n",
PHP_VERSION);
- PUTS("<img src=\"");
+ PUTS("<hr><a href=\"http://www.php.net/\"><img src=\"");
if (SG(request_info).request_uri) {
PUTS(SG(request_info).request_uri);
}
- PUTS("?=PHPE9568F34-D428-11d2-A769-00AA001ACF42\" border=\"0\"
width=\"100\" height=\"56\" align=\"right\">\n");
- php3_printf("<center><h1>PHP Version %s</h1></center>\n",
PHP_VERSION);
- PUTS("<p>by <a href=\"mailto:rasmus@lerdorf.on.ca\">Rasmus
Lerdorf</a>,\n");
- PUTS("<a href=\"mailto:andi@zend.com\">Andi
Gutmans</a>,\n");
- PUTS("<a href=\"mailto:zeev@zend.com\">Zeev
Suraski</a>,\n");
- PUTS("<a href=\"mailto:ssb@guardian.no\">Stig
Bakken</a>,\n");
- PUTS("<a href=\"mailto:shane@caraveo.com\">Shane
Caraveo</a>,\n");
- PUTS("<a href=\"mailto:jimw@php.net\">Jim Winstead</a>, and
countless others.</P>\n");
-
- PUTS("<P><a href=\"http://www.zend.com/\">Zend</a>:</a>
");
- PUTS("<a href=\"mailto:andi@zend.com\">Andi Gutmans</a> and
\n");
- PUTS("<a href=\"mailto:zeev@zend.com\">Zeev
Suraski</a></p>\n");
-
- PUTS("<hr>");
- php3_printf("<center>System: %s<br>Build Date: %s</center>\n",
php3_uname, __DATE__);
- PUTS("<center>\n");
-
- SECTION("Extensions");
- PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR
"\">Extensions</th><th bgcolor=\"" HEADER_COLOR
"\">Additional Information</th></tr>\n");
+ PUTS("?=PHPE9568F34-D428-11d2-A769-00AA001ACF42\" border=\"0\"
width=\"100\" height=\"56\" align=\"right\"></a>\n");
+ php3_printf("System: %s<br>Build Date: %s\n<br>", php3_uname, __DATE__);
+ php3_printf("php3.ini path: %s<br>\n", CONFIGURATION_FILE_PATH);
+
+ /* Zend Engine */
+ PUTS("<hr><a href=\"http://www.zend.com/\"><img src=\"");
+ if (SG(request_info).request_uri) {
+ PUTS(SG(request_info).request_uri);
+ }
+ PUTS("?=PHPE9568F35-D428-11d2-A769-00AA001ACF42\" border=\"0\"
width=\"100\" height=\"89\" align=\"right\"></a>\n");
+ php3_printf("This program makes use of the Zend scripting language
engine:<br><pre>%s</pre>", get_zend_version());
+
+
+ PUTS("<center>");
-#ifndef MSVC5
- PUTS("<tr><th align=left bgcolor=\"" ENTRY_NAME_COLOR "\">PHP
core</th>\n");
- PUTS("<td bgcolor=\"" CONTENTS_COLOR "\"><tt>CFLAGS="
PHP_CFLAGS "<br>\n");
- PUTS("HSREGEX=" PHP_HSREGEX "</td></tr>\n");
-#endif
+ PUTS("<hr><h1>Credits</h1>\n");
- _php3_hash_apply(&module_registry,(int (*)(void *))_display_module_info);
+ PUTS("<table border=5 width=\"600\">\n");
+ PUTS("<tr><th colspan=\"2\" bgcolor=\"" HEADER_COLOR
"\">PHP 4.0 Authors</th></tr>\n");
+ php_info_print_table_header(2, "Module", "Authors");
+ CREDIT_LINE("Scripting Language Engine", "Andi Gutmans, Zeev Suraski");
+ CREDIT_LINE("Extension Module API", "Andi Gutmans, Zeev Suraski");
+ CREDIT_LINE("UNIX Build and Modularization", "Stig Bakken");
+ CREDIT_LINE("Win32 Port", "Shane Caraveo, Zeev Suraski");
+ CREDIT_LINE("Server API (SAPI) Abstraction Layer", "Andi Gutmans, Shane Caraveo,
Zeev Suraski");
+ CREDIT_LINE("Apache SAPI Module", "Rasmus Lerdorf, Zeev Suraski");
+ CREDIT_LINE("ISAPI SAPI Module", "Andi Gutmans, Zeev Suraski");
+ CREDIT_LINE("CGI SAPI Module", "Rasmus Lerdorf, Stig Bakken");
PUTS("</table>\n");
- SECTION("Configuration");
- PUTS("php3.ini file path is set to: ");
- PUTS(CONFIGURATION_FILE_PATH);
- PUTS("<br>\n");
- PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR
"\">Directive</th><th bgcolor=\"" HEADER_COLOR
"\">Master Value</th><th bgcolor=\"" HEADER_COLOR
"\">Local Value</th></tr>\n");
- PHP3_CONF_STR("arg_separator", INI_ORIG_STR("arg_separator"),
PG(arg_separator));
- PHP3_CONF_LONG("asp_tags", INI_ORIG_INT("asp_tags"), PG(asp_tags));
- PHP3_CONF_STR("auto_prepend_file", INI_ORIG_STR("auto_prepend_file"),
PG(auto_prepend_file));
- PHP3_CONF_STR("auto_append_file", INI_ORIG_STR("auto_append_file"),
PG(auto_append_file));
- PHP3_CONF_STR("browscap", INI_ORIG_STR("browscap"),
INI_STR("browscap"));
- PHP3_CONF_LONG("define_syslog_variables",
INI_ORIG_STR("define_syslog_variables"), INI_STR("define_syslog_variables"));
- PHP3_CONF_LONG("display_errors", INI_ORIG_INT("display_errors"),
PG(display_errors));
- PHP3_CONF_STR("doc_root", INI_ORIG_STR("doc_root"), PG(doc_root));
- PHP3_CONF_LONG("enable_dl", INI_ORIG_INT("enable_dl"), PG(enable_dl));
- PHP3_CONF_STR("error_log", INI_ORIG_STR("error_log"), PG(error_log));
- PHP3_CONF_STR("error_prepend_string", INI_ORIG_STR("error_prepend_string"),
INI_STR("error_prepend_string"));
- PHP3_CONF_STR("error_append_string", INI_ORIG_STR("error_append_string"),
INI_STR("error_append_string"));
- PHP3_CONF_LONG("error_reporting", INI_ORIG_INT("error_reporting"),
EG(error_reporting));
- PHP3_CONF_STR("extension_dir", INI_ORIG_STR("extension_dir"),
PG(extension_dir));
- PHP3_CONF_STR("gpc_order", INI_ORIG_STR("gpc_order"), PG(gpc_order));
- PHP3_CONF_STR("include_path", INI_ORIG_STR("include_path"), PG(include_path));
- PHP3_CONF_LONG("log_errors", INI_ORIG_INT("log_errors"), PG(log_errors));
- PHP3_CONF_LONG("max_execution_time", INI_ORIG_INT("max_execution_time"),
PG(max_execution_time));
- PHP3_CONF_LONG("magic_quotes_gpc", INI_ORIG_INT("magic_quotes_gpc"),
PG(magic_quotes_gpc));
- PHP3_CONF_LONG("magic_quotes_runtime", INI_ORIG_INT("magic_quotes_runtime"),
PG(magic_quotes_runtime));
- PHP3_CONF_LONG("magic_quotes_sybase", INI_ORIG_INT("magic_quotes_sybase"),
PG(magic_quotes_sybase));
- PHP3_CONF_LONG("memory limit", INI_ORIG_INT("memory_limit"),
PG(memory_limit));
- PHP3_CONF_STR("open_basedir", INI_ORIG_STR("open_basedir"), PG(open_basedir));
- PHP3_CONF_LONG("precision", INI_ORIG_INT("precision"), EG(precision));
- PHP3_CONF_LONG("safe_mode", INI_ORIG_INT("safe_mode"), PG(safe_mode));
- PHP3_CONF_STR("safe_mode_exec_dir", INI_ORIG_STR("safe_mode_exec_dir"),
PG(safe_mode_exec_dir));
- PHP3_CONF_STR("sendmail_from", INI_ORIG_STR("sendmail_from"),
INI_STR("sendmail_from"));
- PHP3_CONF_STR("sendmail_path", INI_ORIG_STR("sendmail_path"),
INI_STR("sendmail_path"));
- PHP3_CONF_LONG("short_open_tag", INI_ORIG_INT("short_open_tag"),
PG(short_tags));
- PHP3_CONF_STR("SMTP", INI_ORIG_STR("SMTP"), INI_STR("SMTP"));
- PHP3_CONF_LONG("sql_safe_mode", INI_ORIG_INT("sql.safe_mode"),
PG(sql_safe_mode));
- PHP3_CONF_LONG("track_errors", INI_ORIG_INT("track_errors"),
PG(track_errors));
- PHP3_CONF_LONG("track_vars", INI_ORIG_INT("track_vars"), PG(track_vars));
- PHP3_CONF_LONG("upload_max_filesize", INI_ORIG_INT("upload_max_filesize"),
PG(upload_max_filesize));
- PHP3_CONF_STR("upload_tmp_dir", INI_ORIG_STR("upload_tmp_dir"),
PG(upload_tmp_dir));
- PHP3_CONF_STR("user_dir", INI_ORIG_STR("user_dir"), PG(user_dir));
- PHP3_CONF_LONG("y2k_compliance", INI_ORIG_INT("y2k_compliance"),
PG(y2k_compliance));
+
+ PUTS("<hr><h1>Configuraton</h1>\n");
+ PUTS("<h2>PHP Core</h2>\n");
+ display_ini_entries(NULL);
+ _php3_hash_apply(&module_registry,(int (*)(void *)) _display_module_info);
+
+#if 0
/* apache only directives */
PHP3_CONF_LONG("engine", INI_ORIG_INT("engine"), INI_INT("engine"));
/* apache only */
PHP3_CONF_LONG("xbithack", INI_ORIG_INT("xbithack"),
INI_INT("xbithack")); /* apache only */
PHP3_CONF_LONG("last_modified", INI_ORIG_INT("last_modified"),
INI_INT("last_modified")); /* apache only */
/* end of apache only directives */
-
- /* And now for the highlight colours */
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR
"\">highlight_comment</td><td bgcolor=\"" CONTENTS_COLOR
"\"><font color=%s> %s</font></td><td
bgcolor=\"" CONTENTS_COLOR "\"><font
color=%s> %s</font></td></tr>\n",INI_ORIG_STR("highlight.comment"),
INI_ORIG_STR("highlight.comment"), INI_STR("highlight.comment"),
INI_STR("highlight.comment"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR
"\">highlight_default</td><td bgcolor=\"" CONTENTS_COLOR
"\"><font color=%s> %s</font></td><td
bgcolor=\"" CONTENTS_COLOR "\"><font
color=%s> %s</font></td></tr>\n",INI_ORIG_STR("highlight.default"),
INI_ORIG_STR("highlight.default"), INI_STR("highlight.default"),
INI_STR("highlight.default"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR
"\">highlight_html</td><td bgcolor=\"" CONTENTS_COLOR
"\"><font color=%s> %s</font></td><td
bgcolor=\"" CONTENTS_COLOR "\"><font
color=%s> %s</font></td></tr>\n",INI_ORIG_STR("highlight.html"),
INI_ORIG_STR("highlight.html"), INI_STR("highlight.html"),
INI_STR("highlight.html"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR
"\">highlight_string</td><td bgcolor=\"" CONTENTS_COLOR
"\"><font color=%s> %s</font></td><td
bgcolor=\"" CONTENTS_COLOR "\"><font
color=%s> %s</font></td></tr>\n",INI_ORIG_STR("highlight.string"),
INI_ORIG_STR("highlight.string"), INI_STR("highlight.string"),
INI_STR("highlight.string"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR
"\">highlight_bg</td><td bgcolor=\"" CONTENTS_COLOR
"\"><font color=%s> %s</font></td><td
bgcolor=\"" CONTENTS_COLOR "\"><font
color=%s> %s</font></td></tr>\n",INI_ORIG_STR("highlight.bg"),
INI_ORIG_STR("highlight.bg"), INI_STR("highlight.bg"),
INI_STR("highlight.bg"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR
"\">highlight_keyword</td><td bgcolor=\"" CONTENTS_COLOR
"\"><font color=%s> %s</font></td><td
bgcolor=\"" CONTENTS_COLOR "\"><font
color=%s> %s</font></td></tr>\n",INI_ORIG_STR("highlight.keyword"),
INI_ORIG_STR("highlight.keyword"), INI_STR("highlight.keyword"),
INI_STR("highlight.keyword"));
- PUTS("</table>");
-
-#if USE_SAPI /* call a server module specific info function */
- sapi_rqst->info(sapi_rqst);
#endif
SECTION("Environment");
PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR
"\">Variable</th><th bgcolor=\"" HEADER_COLOR
"\">Value</th></tr>\n");
+ php_info_print_table_header(2, "Variable", "Value");
for (env=environ; env!=NULL && *env !=NULL; env++) {
tmp1 = estrdup(*env);
if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
@@ -211,15 +152,7 @@
}
*tmp2 = 0;
tmp2++;
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(tmp1);
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- if (tmp2 && *tmp2) {
- PUTS(tmp2);
- } else {
- PUTS(" ");
- }
- PUTS("</td></tr>\n");
+ php_info_print_table_row(2, tmp1, tmp2);
efree(tmp1);
}
PUTS("</table>\n");
@@ -232,34 +165,18 @@
SECTION("PHP Variables");
PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR
"\">Variable</th><th bgcolor=\"" HEADER_COLOR
"\">Value</th></tr>\n");
+ php_info_print_table_header(2, "Variable", "Value");
if (_php3_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"),
(void **) &data) != FAILURE) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS("PHP_SELF");
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*data)->value.str.val);
- PUTS("</td></tr>\n");
+ php_info_print_table_row(2, "PHP_SELF", (*data)->value.str.val);
}
if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE",
sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS("PHP_AUTH_TYPE");
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*data)->value.str.val);
- PUTS("</td></tr>\n");
+ php_info_print_table_row(2, "PHP_AUTH_TYPE", (*data)->value.str.val);
}
if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_USER",
sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS("PHP_AUTH_USER");
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*data)->value.str.val);
- PUTS("</td></tr>\n");
+ php_info_print_table_row(2, "PHP_AUTH_USER", (*data)->value.str.val);
}
if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_PW",
sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS("PHP_AUTH_PW");
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*data)->value.str.val);
- PUTS("</td></tr>\n");
+ php_info_print_table_row(2, "PHP_AUTH_PW", (*data)->value.str.val);
}
if (_php3_hash_find(&EG(symbol_table), "HTTP_GET_VARS",
sizeof("HTTP_GET_VARS"), (void **) &data) != FAILURE) {
_php3_hash_internal_pointer_reset((*data)->value.ht);
@@ -338,13 +255,9 @@
SECTION("Apache Environment");
PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR
"\">Variable</th><th bgcolor=\"" HEADER_COLOR
"\">Value</th></tr>\n");
+ php_info_print_table_header(2, "Variable", "Value");
for (i=0; i < arr->nelts; i++) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(elts[i].key);
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(elts[i].val);
- PUTS(" </td></tr>\n");
+ php_info_print_table_row(2, elts[i].key, elts[i].val);
}
PUTS("</table>\n");
}
@@ -362,18 +275,12 @@
SECTION("HTTP Headers Information");
PUTS("<table border=5 width=\"600\">\n");
PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP
Request Headers</th></tr>\n");
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">HTTP
Request</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(r->the_request);
- PUTS(" </td></tr>\n");
+ php_info_print_table_row(2, "HTTP Request", r->the_request);
env_arr = table_elts(r->headers_in);
env = (table_entry *)env_arr->elts;
for (i = 0; i < env_arr->nelts; ++i) {
if (env[i].key) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(env[i].key);
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(env[i].val);
- PUTS(" </td></tr>\n");
+ php_info_print_table_row(2, env[i].key, env[i].val);
}
}
PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP
Response Headers</th></tr>\n");
@@ -381,11 +288,7 @@
env = (table_entry *)env_arr->elts;
for(i = 0; i < env_arr->nelts; ++i) {
if (env[i].key) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(env[i].key);
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(env[i].val);
- PUTS(" </td></tr>\n");
+ php_info_print_table_row(2, env[i].key, env[i].val);
}
}
PUTS("</table>\n\n");
@@ -394,15 +297,6 @@
PUTS("</center>");
- PUTS("<hr>\n");
- PUTS("<table width=\"100%%\"><tr>\n");
- php3_printf("<td><h2>Zend</h2>This program makes use of the Zend scripting
language engine:<br><pre>%s</pre></td>", get_zend_version());
- PUTS("<td width=\"100\"><a href=\"http://www.zend.com/\"><img src=\"");
- if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
- }
- PUTS("?=PHPE9568F35-D428-11d2-A769-00AA001ACF42\" border=\"0\"
width=\"100\" height=\"89\"></a></td>\n");
- PUTS("</tr></table>\n");
SECTION("PHP License");
PUTS("<PRE>This program is free software; you can redistribute it and/or
modify\n");
@@ -425,6 +319,53 @@
PUTS("contact core@php.net.</PRE>\n");
}
+
+
+PHPAPI void php_info_print_table_header(int num_cols, ...)
+{
+ int i;
+ va_list row_elements;
+ char *row_element;
+
+ va_start(row_elements, num_cols);
+
+ php3_printf("<tr>");
+ for (i=0; i<num_cols; i++) {
+ row_element = va_arg(row_elements, char *);
+ if (!row_element || !*row_element) {
+ row_element = " ";
+ }
+ php3_printf("<th bgcolor=\"" HEADER_COLOR "\"
valign=\"top\">%s</th>", row_element);
+ }
+ php3_printf("</tr>\n");
+
+ va_end(row_elements);
+}
+
+
+PHPAPI void php_info_print_table_row(int num_cols, ...)
+{
+ int i;
+ va_list row_elements;
+ char *color = ENTRY_NAME_COLOR;
+ char *row_element;
+
+ va_start(row_elements, num_cols);
+
+ php3_printf("<tr>");
+ for (i=0; i<num_cols; i++) {
+ row_element = va_arg(row_elements, char *);
+ if (!row_element || !*row_element) {
+ row_element = " ";
+ }
+ php3_printf("<td bgcolor=\"%s\"
valign=\"top\">%s</td>", color, row_element);
+ color = CONTENTS_COLOR;
+ }
+ php3_printf("</tr>\n");
+
+ va_end(row_elements);
+}
+
/* {{{ proto void phpinfo(void)
Output a page of useful information about PHP and the current request */
Index: php4/ext/standard/info.h
diff -u php4/ext/standard/info.h:1.2 php4/ext/standard/info.h:1.3
--- php4/ext/standard/info.h:1.2 Mon Apr 26 10:00:49 1999
+++ php4/ext/standard/info.h Sun May 9 04:48:01 1999
@@ -27,14 +27,16 @@
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: info.h,v 1.2 1999/04/26 14:00:49 zeev Exp $ */
+/* $Id: info.h,v 1.3 1999/05/09 08:48:01 zeev Exp $ */
#ifndef _INFO_H
#define _INFO_H
-extern void php3_version(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_info(INTERNAL_FUNCTION_PARAMETERS);
-
+void php3_version(INTERNAL_FUNCTION_PARAMETERS);
+void php3_info(INTERNAL_FUNCTION_PARAMETERS);
PHPAPI void _php3_info(void);
+
+PHPAPI void php_info_print_table_header(int num_cols, ...);
+PHPAPI void php_info_print_table_row(int num_cols, ...);
#endif /* _INFO_H */
Index: php4/ext/standard/mail.c
diff -u php4/ext/standard/mail.c:1.3 php4/ext/standard/mail.c:1.4
--- php4/ext/standard/mail.c:1.3 Fri Apr 23 20:11:56 1999
+++ php4/ext/standard/mail.c Sun May 9 04:48:01 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mail.c,v 1.3 1999/04/24 00:11:56 zeev Exp $ */
+/* $Id: mail.c,v 1.4 1999/05/09 08:48:01 zeev Exp $ */
#include <stdlib.h>
#include <ctype.h>
@@ -160,7 +160,7 @@
return 1;
}
-void php3_info_mail(void)
+void php3_info_mail(ZEND_MODULE_INFO_FUNC_ARGS)
{
#if MSVC5
PUTS("Internal Sendmail support for Windows 4");
@@ -172,7 +172,7 @@
#else
void php3_mail(INTERNAL_FUNCTION_PARAMETERS) {}
-void php3_info_mail() {}
+void php3_info_mail(ZEND_MODULE_INFO_FUNC_ARGS) {}
#endif
Index: php4/ext/standard/php3_mail.h
diff -u php4/ext/standard/php3_mail.h:1.1 php4/ext/standard/php3_mail.h:1.2
--- php4/ext/standard/php3_mail.h:1.1 Fri Apr 16 20:37:07 1999
+++ php4/ext/standard/php3_mail.h Sun May 9 04:48:01 1999
@@ -28,7 +28,7 @@
*/
-/* $Id: php3_mail.h,v 1.1 1999/04/17 00:37:07 ssb Exp $ */
+/* $Id: php3_mail.h,v 1.2 1999/05/09 08:48:01 zeev Exp $ */
#ifndef _MAIL_H
#define _MAIL_H
@@ -37,7 +37,7 @@
#define mail_module_ptr &mail_module_entry
extern void php3_mail(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_info_mail(void);
+extern void php3_info_mail(ZEND_MODULE_INFO_FUNC_ARGS);
extern int _php3_mail(char *to, char *subject, char *message, char *headers);
#else
Index: php4/ext/standard/post.c
diff -u php4/ext/standard/post.c:1.7 php4/ext/standard/post.c:1.8
--- php4/ext/standard/post.c:1.7 Thu May 6 14:09:50 1999
+++ php4/ext/standard/post.c Sun May 9 04:48:01 1999
@@ -42,6 +42,7 @@
* This reads the post form data into a string.
* Remember to free this pointer when done with it.
*/
+#if APACHE
static char *php3_getpost(pval *http_post_vars PLS_DC)
{
char *buf = NULL;
@@ -149,6 +150,14 @@
#endif
return (buf);
}
+#else
+static char *php3_getpost(pval *http_post_vars PLS_DC)
+{
+ SLS_FETCH();
+
+ return SG(request_info).post_data;
+}
+#endif
/*
@@ -352,7 +361,7 @@
res = (char *) estrdup(var);
}
} else if (arg == PARSE_COOKIE) { /* Cookie data */
- var = (char *)request_info.cookies;
+ var = SG(request_info).cookie_data;
if (var && *var) {
res = (char *) estrdup(var);
}
--
PHP 4 Beta