]> granicus.if.org Git - php/commitdiff
* Finalizing the PHP version of SAPI. Support POST and cookies among other things.
authorZeev Suraski <zeev@php.net>
Sun, 9 May 1999 08:48:05 +0000 (08:48 +0000)
committerZeev Suraski <zeev@php.net>
Sun, 9 May 1999 08:48:05 +0000 (08:48 +0000)
* 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.

56 files changed:
cgi_main.c
ext/apache/apache.c
ext/dav/dav.c
ext/db/db.c
ext/db/php3_db.h
ext/fdf/fdf.c
ext/fdf/php3_fdf.h
ext/gd/gd.c
ext/gettext/gettext.c
ext/gettext/php3_gettext.h
ext/hyperwave/hw.c
ext/hyperwave/hw.h
ext/informix/php3_ifx.h
ext/interbase/interbase.c
ext/interbase/php3_interbase.h
ext/ldap/ldap.c
ext/ldap/php3_ldap.h
ext/msql/msql.c
ext/msql/php3_msql.h
ext/mysql/mysql.c
ext/mysql/php3_mysql.h
ext/odbc/odbc.c
ext/odbc/php3_odbc.h
ext/odbc/php3_velocis.h
ext/odbc/velocis.c
ext/oracle/oci8.c
ext/oracle/oracle.c
ext/oracle/oracle.h
ext/pdf/pdf.c
ext/pdf/php3_pdf.h
ext/rpc/com/COM.c
ext/snmp/php3_snmp.h
ext/snmp/snmp.c
ext/standard/dl.c
ext/standard/dl.h
ext/standard/head.c
ext/standard/info.c
ext/standard/info.h
ext/standard/mail.c
ext/standard/php3_mail.h
ext/standard/post.c
ext/sybase/php3_sybase-ct.h
ext/sybase/php3_sybase.h
ext/sybase/sybase-ct.c
ext/sybase/sybase.c
ext/xml/xml.c
ext/zlib/php3_zlib.h
ext/zlib/zlib.c
main/SAPI.c
main/SAPI.h
main/main.c
main/php_ini.c
main/php_ini.h
mod_php3.c
request_info.c
request_info.h

index fa438d6eac0c838e0222feb502a3df5efdcaed78..e34d0e7e37851f404f4bd71138c0ca0bad7ffd2e 100644 (file)
@@ -85,6 +85,29 @@ static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_c
 }
 
 
+static char *sapi_cgi_read_post(SLS_D)
+{
+       uint read_bytes=0, tmp_read_bytes;
+       char *result = (char *) emalloc(SG(request_info).content_length+1);
+
+       while (read_bytes < SG(request_info).content_length) {
+               tmp_read_bytes = read(0, result+read_bytes, SG(request_info).content_length-read_bytes);
+               if (tmp_read_bytes<=0) {
+                       break;
+               }
+               read_bytes += tmp_read_bytes;
+       }
+       result[read_bytes]=0;
+       return result;
+}
+
+
+static char *sapi_cgi_read_cookies(SLS_D)
+{
+       return getenv("HTTP_COOKIE");
+}
+
+
 static sapi_module_struct sapi_module = {
        "PHP Language",                                 /* name */
                                                                        
@@ -98,6 +121,9 @@ static sapi_module_struct sapi_module = {
        NULL,                                                   /* header handler */
        NULL,                                                   /* send headers handler */
        sapi_cgi_send_header,                   /* send header handler */
+
+       sapi_cgi_read_post,                             /* read POST data */
+       sapi_cgi_read_cookies                   /* read Cookies */
 };
 
 
@@ -132,15 +158,19 @@ static void php_cgi_usage(char *argv0)
 
 static void init_request_info(SLS_D)
 {
-       char *request_method = getenv("REQUEST_METHOD");
+       char *content_length = getenv("CONTENT_LENGTH");
 
+       SG(request_info).request_method = getenv("REQUEST_METHOD");
        SG(request_info).query_string = getenv("QUERY_STRING");
        SG(request_info).request_uri = getenv("PATH_INFO");
-       if (request_method && !strcmp(request_method, "HEAD")) {
+       SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */
+       if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
                SG(request_info).headers_only = 1;
        } else {
                SG(request_info).headers_only = 0;
        }
+       SG(request_info).content_type = getenv("CONTENT_TYPE");
+       SG(request_info).content_length = (content_length?atoi(content_length):0);
 }
 
 
@@ -229,6 +259,8 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
        sapi_globals = ts_resource(sapi_globals_id);
 #endif
 
+       init_request_info(SLS_C);
+       SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
        CG(extended_info) = 0;
 
        if (!cgi) {                                     /* never execute the arguments if you are a CGI */
@@ -322,7 +354,6 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
 
        php3_TreatHeaders();
 
-       init_request_info(SLS_C);
 
        if (!cgi) {
                if (!SG(request_info).query_string) {
index c5085f749ea3b28e38742747ba6d81e8ac9befb3..d3a390eba653201c5f6bf6e932ec6da70b2cedf9 100644 (file)
@@ -54,7 +54,7 @@ extern module *top_module;
 void php3_virtual(INTERNAL_FUNCTION_PARAMETERS);
 void php3_getallheaders(INTERNAL_FUNCTION_PARAMETERS);
 void php3_apachelog(INTERNAL_FUNCTION_PARAMETERS);
-void php3_info_apache(void);
+void php3_info_apache(ZEND_MODULE_INFO_FUNC_ARGS);
 void php3_apache_note(INTERNAL_FUNCTION_PARAMETERS);
 void php3_apache_lookup_uri(INTERNAL_FUNCTION_PARAMETERS);
 
@@ -154,7 +154,7 @@ void php3_apache_note(INTERNAL_FUNCTION_PARAMETERS)
 }
 /* }}} */
 
-void php3_info_apache(void) {
+void php3_info_apache(ZEND_MODULE_INFO_FUNC_ARGS) {
        module *modp = NULL;
 #if !defined(WIN32) && !defined(WINNT)
        char name[64];
index 967b1a6757a620938f400c7435dce9b547607e8d..6f00f0b1d4d4a0cfe6f1c9abcdbc125378962a28 100644 (file)
@@ -91,7 +91,7 @@ int php3_minit_phpdav(INIT_FUNC_ARGS);
 int php3_rinit_phpdav(INIT_FUNC_ARGS);
 int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS);
 int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS);
-void php3_info_phpdav(void);
+void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS);
 
 /* }}} */
 /* {{{ extension definition structures */
@@ -186,7 +186,7 @@ int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS)
 /* }}} */
     /* {{{ php3_info_phpdav() */
 
-void php3_info_phpdav()
+void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS)
 {
 }
 
index 70ba058b032e024dfc98b0f28f468c11d5c02fc4..ef1502a7f288a811721ed9c39c6b597ad3ba9aeb 100644 (file)
@@ -251,7 +251,7 @@ static char *php3_get_info_db(void)
 }
 
 
-void php3_info_db(void)
+void php3_info_db(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        php3_printf(php3_get_info_db());
 }
index ded7774ffd134d675be8351ef396afb9262f5605..08039d5640c0812d256cc86f008587d498b5bd2c 100644 (file)
@@ -76,7 +76,7 @@ char *_php3_dbmnextkey(dbm_info *info, char *key);
 /* db file functions */
 extern int php3_minit_db(INIT_FUNC_ARGS);
 extern int php3_rinit_db(INIT_FUNC_ARGS);
-extern void php3_info_db(void);
+extern void php3_info_db(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_dblist(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_dbmopen(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_dbmclose(INTERNAL_FUNCTION_PARAMETERS);
index e16b6bcb826fb208300f6f237475d2edc486af09..e0a0a55a00519a0cfd9215cf0c921f84e60e2bdf 100644 (file)
@@ -109,7 +109,7 @@ int php3_minit_fdf(INIT_FUNC_ARGS)
        return SUCCESS;
 }
 
-void php3_info_fdf(void) {
+void php3_info_fdf(ZEND_MODULE_INFO_FUNC_ARGS) {
        /* need to use a PHPAPI function here because it is external module in windows */
        php3_printf("FdfTk Version %s", FDFGetVersion());
 }
index 08f7bee50912eb83576fb85125765ce0987c9b96..4a83c62468a20df422203144eeb39365fca3f074 100644 (file)
@@ -44,7 +44,7 @@ extern php3_module_entry fdf_module_entry;
 
 extern int php3_minit_fdf(INIT_FUNC_ARGS);
 extern int php3_mend_fdf(void);
-extern void php3_info_fdf(void);
+extern void php3_info_fdf(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_fdf_open(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_fdf_close(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_fdf_create(INTERNAL_FUNCTION_PARAMETERS);
index eafea097508b92a8e04fd29f0001c00f1fd8c4d2..f71b129a1782b1aa54424f003f3772abcfe93975 100644 (file)
@@ -178,7 +178,7 @@ int php3_minit_gd(INIT_FUNC_ARGS)
        return SUCCESS;
 }
 
-void php3_info_gd(void) {
+void php3_info_gd(ZEND_MODULE_INFO_FUNC_ARGS) {
        /* need to use a PHPAPI function here because it is external module in windows */
 #if HAVE_LIBGD13
        php3_printf("Version 1.3");
index 69166d18df6f52d215c205f7c0b0f4f2449aec2d..1c9a9fefd13ba0f056594bb4166c2e73dff79a53 100644 (file)
@@ -52,7 +52,7 @@ php3_module_entry php3_gettext_module_entry = {
        "gettext", php3_gettext_functions, NULL, NULL, NULL, NULL, php3_info_gettext, STANDARD_MODULE_PROPERTIES
 };
 
-void php3_info_gettext(void)
+void php3_info_gettext(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        php3_printf("GNU gettext support active.");
 }
index eb7b851b4afdc4393e4ac7c54f748fcd745d893c..b3ae0131d5606b0de1ca098787f8210c5cd6702c 100644 (file)
@@ -40,7 +40,7 @@
 extern php3_module_entry php3_gettext_module_entry;
 #define php3_gettext_module_ptr &php3_gettext_module_entry
 
-extern void php3_info_gettext(void);
+extern void php3_info_gettext(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_textdomain(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_gettext(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_dgettext(INTERNAL_FUNCTION_PARAMETERS);
index f2380dde058b01d891ed6ea83c12fa3c4b9d6322..dcee8874d5d48b9af7db3dced83b9f471fa7ae47 100644 (file)
@@ -1531,7 +1531,7 @@ void php3_hw_getcgi(INTERNAL_FUNCTION_PARAMETERS) {
                             getenv("QUERY_STRING"));
 #else
        sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
-                            request_info.request_method,
+                            SG(request_info).request_method,
                             SG(request_info).request_uri,
                             SG(request_info).query_string);
 #endif
@@ -1783,7 +1783,7 @@ void php3_hw_pipecgi(INTERNAL_FUNCTION_PARAMETERS) {
                             getenv("QUERY_STRING"));
 #else
        sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
-                            request_info.request_method,
+                            SG(request_info).request_method,
                             SG(request_info).request_uri,
                             SG(request_info).query_string);
 #endif
@@ -2959,7 +2959,7 @@ void php3_hw_getrellink(INTERNAL_FUNCTION_PARAMETERS) {
 /* }}} */
        
 
-void php3_info_hw()
+void php3_info_hw(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        php3_printf("HG-CSP Version: 7.17");
 }
index 21c2e6ad0774dba7ba3ea91e971e275742fc2db2..4f4fd112199c2c345ac64db3bfd90c27247c5605 100644 (file)
@@ -109,7 +109,7 @@ extern void php3_hw_document_content(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_hw_objrec2array(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_hw_array2objrec(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_hw_connection_info(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_info_hw(void);
+extern void php3_info_hw(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_hw_getsrcbydestobj(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_hw_getrellink(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_hw_dummy(INTERNAL_FUNCTION_PARAMETERS);
index d06cf1660036482724bd7b2ab7a7f3ce9b8dae16..d64bb2c403ed09f03644531c27157f48fb2005c6 100644 (file)
@@ -56,7 +56,7 @@ extern php3_module_entry ifx_module_entry;
 extern int php3_minit_ifx(INIT_FUNC_ARGS);
 extern int php3_rinit_ifx(INIT_FUNC_ARGS);
 extern int php3_mshutdown_ifx(SHUTDOWN_FUNC_ARGS);
-extern void php3_info_ifx(void);
+extern void php3_info_ifx(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_ifx_connect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_ifx_pconnect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_ifx_close(INTERNAL_FUNCTION_PARAMETERS);
index c239cb610cd6d3d9310c928763c2b65660e7e795..1cc8aa530b46ac7a94ccd2e6e502ffe57c8f4e3d 100644 (file)
@@ -214,7 +214,7 @@ int php3_rfinish_ibase(void)
 }
 */
 
-void php3_info_ibase(void)
+void php3_info_ibase(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        /* TODO */
 }
index 47da79d5749e3ca405fbc1e0bab03c31854f7692..ec2fe6ef8042f624019eedc2a3a764dc9ce93032 100644 (file)
@@ -47,7 +47,7 @@ extern php3_module_entry ibase_module_entry;
 extern int php3_minit_ibase(INIT_FUNC_ARGS);
 extern int php3_rinit_ibase(INIT_FUNC_ARGS);
 extern int php3_mfinish_ibase(void);
-extern void php3_info_ibase(void);
+extern void php3_info_ibase(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_ibase_pconnect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_ibase_close(INTERNAL_FUNCTION_PARAMETERS);
index f85b0dcf7cdf38f84311e3e92b17e61edb3dad44..93c19d43ce8dfeecbf3535de17f039478e0cdfba 100644 (file)
@@ -260,7 +260,7 @@ int php3_mshutdown_ldap(SHUTDOWN_FUNC_ARGS) {
        return SUCCESS;
 }
 
-void php3_info_ldap(void)
+void php3_info_ldap(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        char maxl[16];
 #if HAVE_NSLDAP
index 1440df17f534dff31b531f1e41b87c524b2b30bd..ac6781527bea158060e7f166f84bfc31673a8789 100644 (file)
@@ -50,7 +50,7 @@ extern php3_module_entry ldap_module_entry;
 extern int php3_minit_ldap(INIT_FUNC_ARGS);
 extern int php3_mshutdown_ldap(SHUTDOWN_FUNC_ARGS);
 
-extern void php3_info_ldap(void);
+extern void php3_info_ldap(ZEND_MODULE_INFO_FUNC_ARGS);
 
 extern void php3_ldap_connect(INTERNAL_FUNCTION_PARAMETERS);
 
index acf687174bb5ba5ed98d8a6dc211d427b74fc7d8..074c7d0da3bd36c8b2ecf9dc65ddcd166ad6fb8c 100644 (file)
@@ -275,7 +275,7 @@ DLEXPORT int php3_rinit_msql(INIT_FUNC_ARGS)
        return SUCCESS;
 }
 
-DLEXPORT void php3_info_msql(void)
+DLEXPORT void php3_info_msql(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        char maxp[16],maxl[16];
        MSQL_TLS_VARS;
index 6c1e8e3fbf3f218b853ade5403fd810819c62914..738f0c08564a8706f7ec3ef7d46ca739bb9c3966 100644 (file)
@@ -48,7 +48,7 @@ extern php3_module_entry msql_module_entry;
 extern DLEXPORT int php3_minit_msql(INIT_FUNC_ARGS);
 extern DLEXPORT int php3_rinit_msql(INIT_FUNC_ARGS);
 extern DLEXPORT int php3_mshutdown_msql(SHUTDOWN_FUNC_ARGS);
-extern DLEXPORT void php3_info_msql(void);
+extern DLEXPORT void php3_info_msql(ZEND_MODULE_INFO_FUNC_ARGS);
 extern DLEXPORT void php3_msql_connect(INTERNAL_FUNCTION_PARAMETERS);
 extern DLEXPORT void php3_msql_pconnect(INTERNAL_FUNCTION_PARAMETERS);
 extern DLEXPORT void php3_msql_close(INTERNAL_FUNCTION_PARAMETERS);
index b19215d2833700d52d04ddbbd0c3d26cebfc5d03..afe05d3b7e7249051201971b4e6690d3b5b2f9b5 100644 (file)
@@ -309,7 +309,7 @@ int php3_rinit_mysql(INIT_FUNC_ARGS)
 }
 
 
-void php3_info_mysql(void)
+void php3_info_mysql(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        char maxp[16],maxl[16];
        MySLS_FETCH();
index 748ad70a67569df570ccf203cabec1c65fa84878..0988631d1ecbbbea9e058db450a1c2454ba8c702 100644 (file)
@@ -49,7 +49,7 @@ extern php3_module_entry mysql_module_entry;
 extern int php3_minit_mysql(INIT_FUNC_ARGS);
 extern int php3_rinit_mysql(INIT_FUNC_ARGS);
 extern int php3_mshutdown_mysql(SHUTDOWN_FUNC_ARGS);
-extern void php3_info_mysql(void);
+extern void php3_info_mysql(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_mysql_connect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_mysql_pconnect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_mysql_close(INTERNAL_FUNCTION_PARAMETERS);
index 768af908026c65c89c6189a891971ac96166c83d..3af8798c5586d0af6f9ce76bb1f6a09da987c141 100644 (file)
@@ -287,7 +287,7 @@ int php3_mshutdown_odbc(SHUTDOWN_FUNC_ARGS)
 }
 
 
-void php3_info_odbc(void)
+void php3_info_odbc(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        ODBC_TLS_VARS;
 
index 2e5abe9d22ce42dd0730a31b0e8a403e131a6bd4..295f6b4fb88d5e60e0822fe0f47854c1887f7d80 100644 (file)
@@ -120,7 +120,7 @@ extern php3_module_entry odbc_module_entry;
 extern int php3_minit_odbc(INIT_FUNC_ARGS);
 extern int php3_mshutdown_odbc(SHUTDOWN_FUNC_ARGS);
 extern int php3_rinit_odbc(INIT_FUNC_ARGS);
-extern void php3_info_odbc(void);
+extern void php3_info_odbc(ZEND_MODULE_INFO_FUNC_ARGS);
 extern PHP_FUNCTION(odbc_setoption);
 extern PHP_FUNCTION(odbc_autocommit);
 extern PHP_FUNCTION(odbc_close);
index 19d9f4070ab9825af46f167fe53d53ebfc158cdc..dd114ceec6102d64962d239e05cc86ad4520fd97 100644 (file)
@@ -76,8 +76,8 @@ extern php3_module_entry velocis_module_entry;
 /* velocis.c functions */
 extern int php3_minit_velocis(INIT_FUNC_ARGS);
 extern int php3_rinit_velocis(INIT_FUNC_ARGS);
-extern void php3_info_velocis(void);
-extern int php3_shutdown_velocis(void);
+extern void php3_info_velocis(ZEND_MODULE_INFO_FUNC_ARGS);
+extern int php3_shutdown_velocis(SHUTDOWN_FUNC_ARGS);
 extern void php3_velocis_connect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_velocis_close(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_velocis_exec(INTERNAL_FUNCTION_PARAMETERS);
index 0c5b03eab0c233f1eab638875f4e61d10c4e77ad..9e0de4dc90724a38a0b7bacde6906f3cec037bd8 100644 (file)
@@ -111,7 +111,7 @@ int php3_rinit_velocis(INIT_FUNC_ARGS)
 }
 
 
-void php3_info_velocis(void)
+void php3_info_velocis(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        php3_printf("RAIMA Velocis Support Active");
 }
index 47639809dd001d5f156da6452db7fe00a27a3854..39ffec33e85b6581dfddb3bdb73991060199bb81 100644 (file)
@@ -162,7 +162,7 @@ int php3_minit_oci8(INIT_FUNC_ARGS);
 int php3_rinit_oci8(INIT_FUNC_ARGS);
 int php3_mshutdown_oci8(SHUTDOWN_FUNC_ARGS);
 int php3_rshutdown_oci8(SHUTDOWN_FUNC_ARGS);
-void php3_info_oci8(void);
+void php3_info_oci8(ZEND_MODULE_INFO_FUNC_ARGS);
 
 static ub4 oci8_error(OCIError *err_p, char *what, sword status);
 /* static int oci8_ping(oci8_connection *conn); XXX NYI */
@@ -536,7 +536,7 @@ int php3_rshutdown_oci8(SHUTDOWN_FUNC_ARGS)
 }
 
 
-void php3_info_oci8()
+void php3_info_oci8(ZEND_MODULE_INFO_FUNC_ARGS)
 {
 #if !(WIN32|WINNT)
        php3_printf("Oracle version: %s<br>\n"
index af6a8f84d5786f505f8c7e4a49322f6cb7ce55cc..51997baf22315307982f4892149bd533106717d8 100644 (file)
@@ -1564,7 +1564,7 @@ void php3_Ora_ErrorCode(INTERNAL_FUNCTION_PARAMETERS)
 }
 /* }}} */
 
-void php3_info_oracle()
+void php3_info_oracle(ZEND_MODULE_INFO_FUNC_ARGS)
 {
 #if !(WIN32|WINNT)
        php3_printf("Oracle version: %s<br>\n"
index 3b5f6bea610a130c280a70b838d35ad1d0b62bbb..75faf27a0dc163ac321e115072cfbe8cb2332115 100644 (file)
@@ -136,7 +136,7 @@ extern void php3_Ora_Rollback(INTERNAL_FUNCTION_PARAMETERS);
 extern int php3_minit_oracle(INIT_FUNC_ARGS);
 extern int php3_mshutdown_oracle(SHUTDOWN_FUNC_ARGS);
 extern int php3_rshutdown_oracle(SHUTDOWN_FUNC_ARGS);
-extern void php3_info_oracle(void);
+extern void php3_info_oracle(ZEND_MODULE_INFO_FUNC_ARGS);
 extern int php3_rinit_oracle(INIT_FUNC_ARGS);
 
 #else
index 2e90f5aa2ea21076fae0185fc6008453a16f5ca8..ce34ca7b2a8f693b30ddaf23699b7c148d2e6797 100644 (file)
@@ -161,7 +161,7 @@ int php3_minit_pdf(INIT_FUNC_ARGS)
        return SUCCESS;
 }
 
-void php3_info_pdf(void) {
+void php3_info_pdf(ZEND_MODULE_INFO_FUNC_ARGS) {
        /* need to use a PHPAPI function here because it is external module in windows */
        php3_printf("%s. AFM files in %s", PDFLIB_VERSION, PDF_DEFAULT_FONT_PATH);
 }
index 2f97e602435068103cd9e685a12dcc546aa64406..00437519b0585dd4832d802a3e7a92c3762ed1fe 100644 (file)
@@ -40,7 +40,7 @@ extern int le_fp;
 extern php3_module_entry pdf_module_entry;
 #define pdf_module_ptr &pdf_module_entry
 
-extern void php3_info_pdf(void);
+extern void php3_info_pdf(ZEND_MODULE_INFO_FUNC_ARGS);
 extern int php3_minit_pdf(INIT_FUNC_ARGS);
 extern int php3_mend_pdf(void);
 extern void php3_pdf_get_info(INTERNAL_FUNCTION_PARAMETERS);
index 919e8ec21ce631d72aba30da2dfe2e81250d0369..5f618264b0f5ed2f8cd6d5be19b5e8ac50b5063f 100644 (file)
@@ -74,8 +74,15 @@ function_entry COM_functions[] = {
        {NULL, NULL, NULL}
 };
 
+
+static void php_info_COM(ZEND_MODULE_INFO_FUNC_ARGS)
+{
+       DISPLAY_INI_ENTRIES();
+}
+
+
 php3_module_entry COM_module_entry = {
-       "Win32 COM", COM_functions, php3_minit_COM, php3_mshutdown_COM, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
+       "Win32 COM", COM_functions, php3_minit_COM, php3_mshutdown_COM, NULL, NULL, php_info_COM, STANDARD_MODULE_PROPERTIES
 };
 
 void php_register_COM_class();
@@ -213,7 +220,7 @@ static PHP_INI_MH(OnTypelibFileChange)
 
 
 PHP_INI_BEGIN()
-       PHP_INI_ENTRY1("allow_dcom",                    "0",            PHP_INI_SYSTEM,         NULL,                                   NULL)
+       PHP_INI_ENTRY1_EX("allow_dcom",         "0",            PHP_INI_SYSTEM,         NULL,                                   NULL,   php_ini_boolean_displayer_cb)
        PHP_INI_ENTRY1("typelib_file",          NULL,           PHP_INI_SYSTEM,         OnTypelibFileChange,    NULL)
 PHP_INI_END()
 
index c35962cf8f1e29abb5047363b2a86c0666db65d2..520e9ee2fa228efd45a83bcbde85ac3c4527ddfe 100644 (file)
@@ -46,7 +46,7 @@ extern int php3i_snmp_init(INIT_FUNC_ARGS);
 extern PHP_FUNCTION(snmpget);
 extern PHP_FUNCTION(snmpwalk);
 extern PHP_FUNCTION(snmprealwalk);
-extern void php3_info_snmp(void);
+extern void php3_info_snmp(ZEND_MODULE_INFO_FUNC_ARGS);
 #else
 
 #define snmp_module_ptr NULL
index 05c35f3b549c5ddde59957ea11dc8d5e30938993..5943decc83f852dd0cc56f96b8aaa737e89aa09b 100644 (file)
@@ -104,7 +104,7 @@ int php3i_snmp_init(INIT_FUNC_ARGS) {
        return SUCCESS;
 }
 
-void php3_info_snmp(void) {
+void php3_info_snmp(ZEND_MODULE_INFO_FUNC_ARGS) {
        php3_printf("ucd-snmp");
 }
 
index 7471634ab571a28564f38c33baaf9a5004ba6580..c95fa431c65c6099c6099e719223092a3da3f785 100644 (file)
@@ -160,7 +160,7 @@ void php3_dl(pval *file,int type,pval *return_value)
 }
 
 
-void php3_info_dl(void)
+void php3_info_dl(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        PUTS("Dynamic Library support enabled.\n");
 }
index 900bca429419181b811adbdb01f177c36d113b43..87a684e5837e19c2a873039e8bd237e42cf3f2bb 100644 (file)
@@ -48,7 +48,7 @@ extern void dl(INTERNAL_FUNCTION_PARAMETERS);
 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 636f1438039d5de7c4551b495558fb2b63f3ffc2..86e3a7d835da4d68addcf343beae0d3dd24f6c1c 100644 (file)
@@ -76,7 +76,7 @@ PHPAPI void php3_noheader(void)
 }
 
 
-#ifdef APACHE
+#if 0
 /* Adds header information */
 void php4i_add_header_information(char *header_information, uint header_length)
 {
@@ -229,7 +229,7 @@ void php3_Header(INTERNAL_FUNCTION_PARAMETERS)
 
 
 
-#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 @@ CookieList *php3_PopCookieList(void)
 /* 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 @@ void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS)
                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);
+
+       if (domain) {
+               efree(domain);
+       }
+       if (path) {
+               efree(path);
+       }
+       if (name) {
+               efree(name);
+       }
+       if (value) {
+               efree(value);
        }
-#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);
 #endif
 }
 
index 5f841a076021f5665604ab8253dedf7fc1fb60ff..70b3a05457137a8f90d1025f7a08eee9bf9a6590 100644 (file)
 #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 "\">&nbsp;"); \
-       if (value1) PUTS(value1); \
-       else PUTS("<i>none</i>"); \
-       PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">&nbsp;"); \
-       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);
 
 #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;
 }
 
@@ -104,105 +91,59 @@ PHPAPI void _php3_info(void)
 #endif
 
 
-       PUTS("<img src=\"");
+       php3_printf("<center><h1>PHP Version %s</h1></center>\n", PHP_VERSION);
+
+       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>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%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>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%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>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%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>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%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>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%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>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%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 @@ PHPAPI void _php3_info(void)
                }
                *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("&nbsp;");
-               }
-               PUTS("</td></tr>\n");
+               php_info_print_table_row(2, tmp1, tmp2);
                efree(tmp1);
        }
        PUTS("</table>\n");
@@ -232,34 +165,18 @@ PHPAPI void _php3_info(void)
                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 @@ PHPAPI void _php3_info(void)
                
                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("&nbsp;</td></tr>\n");
+                       php_info_print_table_row(2, elts[i].key, elts[i].val);
                }
                PUTS("</table>\n");
        }
@@ -362,18 +275,12 @@ PHPAPI void _php3_info(void)
                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("&nbsp;</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("&nbsp;</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 @@ PHPAPI void _php3_info(void)
                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("&nbsp;</td></tr>\n");
+                               php_info_print_table_row(2, env[i].key, env[i].val);
                        }
                }
                PUTS("</table>\n\n");
@@ -394,15 +297,6 @@ PHPAPI void _php3_info(void)
 
        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");
@@ -426,6 +320,53 @@ PHPAPI void _php3_info(void)
        
 }
 
+
+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 = "&nbsp;";
+               }
+               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 = "&nbsp;";
+               }
+               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 */
 void php3_info(INTERNAL_FUNCTION_PARAMETERS)
index 49adc456f653483e305eaeb876e6e71e8a5e0577..73db45810886c6aef7792fa8eef19857b4929711 100644 (file)
 #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 da06d4007d99040d812e4608c235ddffc380fc90..a6e97161ed6c5e678e3718eacf35bc032a3c2c05 100644 (file)
@@ -160,7 +160,7 @@ int _php3_mail(char *to, char *subject, char *message, char *headers)
        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 @@ void php3_info_mail(void)
 #else
 
 void php3_mail(INTERNAL_FUNCTION_PARAMETERS) {}
-void php3_info_mail() {}
+void php3_info_mail(ZEND_MODULE_INFO_FUNC_ARGS) {}
 
 #endif
 
index 3fb763ecb0cfd80f7d0d75f6291d4927654af6dd..71ac97fe8f1a6c52701f66da6b9056510381edc0 100644 (file)
@@ -37,7 +37,7 @@ extern php3_module_entry mail_module_entry;
 #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 f961602e77b2991897c639bbdbc36e61242edc7c..7be502ff69e9ad2d6a4f7ddab54c0b1396912bd7 100644 (file)
@@ -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 @@ static char *php3_getpost(pval *http_post_vars PLS_DC)
 #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 @@ void php3_treat_data(int arg, char *str)
                        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);
                }
index 1ce0a30f0c1d3e38d25351558e79704a4c035a3f..c8e89a6213dc8c09abf70119cdfdec6350c829e8 100644 (file)
@@ -49,7 +49,7 @@ extern int php3_minit_sybct(INIT_FUNC_ARGS);
 extern int php3_rinit_sybct(INIT_FUNC_ARGS);
 extern int php3_mshutdown_sybct(SHUTDOWN_FUNC_ARGS);
 extern int php3_rshutdown_sybct(SHUTDOWN_FUNC_ARGS);
-extern void php3_info_sybct(void);
+extern void php3_info_sybct(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_sybct_connect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_sybct_pconnect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_sybct_close(INTERNAL_FUNCTION_PARAMETERS);
index dbfcdd767ac2ef402fc436cc6f94a790fc1549f2..3b1a5e18a18f28d186461a1f143f38eb5ffb8d96 100644 (file)
@@ -47,7 +47,7 @@ extern int php3_minit_sybase(INIT_FUNC_ARGS);
 extern int php3_rinit_sybase(INIT_FUNC_ARGS);
 extern int php3_mshutdown_sybase(SHUTDOWN_FUNC_ARGS);
 extern int php3_rshutdown_sybase(SHUTDOWN_FUNC_ARGS);
-extern void php3_info_sybase(void);
+extern void php3_info_sybase(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_sybase_connect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_sybase_pconnect(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_sybase_close(INTERNAL_FUNCTION_PARAMETERS);
index 7f45658d6b3731aa9b2b11cc39926e4449c5ced6..58ba286bad177df690bad8ba92e8004eacea89be 100644 (file)
@@ -1596,7 +1596,7 @@ void php3_sybct_affected_rows(INTERNAL_FUNCTION_PARAMETERS)
 }
 
 
-void php3_info_sybct(void)
+void php3_info_sybct(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        char maxp[16],maxl[16];
        
index df17867142bfc1f7b51bdedc9f8d06ecf2487071..94a8c9ccd11fcc712ae4527cad41c13cfe1ffbf2 100644 (file)
@@ -1186,7 +1186,7 @@ void php3_sybase_result(INTERNAL_FUNCTION_PARAMETERS)
 }
 
 
-void php3_info_sybase(void)
+void php3_info_sybase(ZEND_MODULE_INFO_FUNC_ARGS)
 {
        char maxp[16],maxl[16];
        
index eed6a3f6e02bf948acad4156957b9f9a0eb73ba5..299be2cfc381ff76d7634a1f6f04b62f578f55ac 100644 (file)
@@ -102,7 +102,7 @@ int php3_minit_xml(INIT_FUNC_ARGS);
 int php3_rinit_xml(INIT_FUNC_ARGS);
 int php3_mshutdown_xml(SHUTDOWN_FUNC_ARGS);
 int php3_rshutdown_xml(SHUTDOWN_FUNC_ARGS);
-void php3_info_xml(void);
+void php3_info_xml(ZEND_MODULE_INFO_FUNC_ARGS);
 
 static xml_parser *xml_get_parser(int, const char *, HashTable *);
 static void xml_destroy_parser(xml_parser *);
@@ -273,7 +273,7 @@ int php3_rshutdown_xml(SHUTDOWN_FUNC_ARGS)
 /* }}} */
     /* {{{ php3_info_xml() */
 
-void php3_info_xml()
+void php3_info_xml(ZEND_MODULE_INFO_FUNC_ARGS)
 {
                PUTS("XML support active");
 }
index 22052fbab43eeadba67fb9b618e8b2b0ae3197b5..710c694cba5a152e2ccaaef967c481b3e49a71d8 100644 (file)
@@ -40,7 +40,7 @@ extern php3_module_entry php3_zlib_module_entry;
 
 extern int php3_minit_zlib(INIT_FUNC_ARGS);
 extern int php3_mshutdown_zlib(SHUTDOWN_FUNC_ARGS);
-extern void php3_info_zlib(void);
+extern void php3_info_zlib(ZEND_MODULE_INFO_FUNC_ARGS);
 extern void php3_gzopen(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_gzclose(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_gzeof(INTERNAL_FUNCTION_PARAMETERS);
index 46ff513c562e4e9ce5c4d93fbf75914104ce9980..c72c07c26d6ede392daf88ea1ef5e969ee9a4df0 100644 (file)
@@ -179,7 +179,7 @@ int php3_mshutdown_zlib(SHUTDOWN_FUNC_ARGS){
        return SUCCESS;
 }
 
-void php3_info_zlib(void)
+void php3_info_zlib(ZEND_MODULE_INFO_FUNC_ARGS)
 {
                PUTS("Zlib support active (compiled with ");
                PUTS(ZLIB_VERSION);
index 1df5fe4fea85e04411cd9ee0db503ae5fb6caaee..a5b9b21b9d144dff4e27048a718f172a9a7bcfdf 100644 (file)
@@ -2,10 +2,12 @@
    +----------------------------------------------------------------------+
    | Server API Abstraction Layer                                         |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1999 SAPI Development Team                             |
+   | Copyright (c) 1998, 1999 SAPI Development Team                       |
    +----------------------------------------------------------------------+
-   | This source file is subject to the GNU public license, that is       |
-   | bundled with this package in the file LICENSE.                       |
+   | This source file is subject to the Zend license, that is bundled     |
+   | with this package in the file LICENSE.  If you did not receive a     |
+   | copy of the Zend license, please mail us at zend@zend.com so we can  |
+   | send you a copy immediately.                                         |
    +----------------------------------------------------------------------+
    | Design:  Shane Caraveo <shane@caraveo.com>                           |
    | Authors: Andi Gutmans <andi@zend.com>                                |
@@ -59,17 +61,21 @@ static void sapi_free_header(sapi_header_struct *sapi_header)
 SAPI_API void sapi_activate(SLS_D)
 {
        zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0);
-       SG(sapi_headers).content_type.header = NULL;
+       SG(sapi_headers).send_default_content_type = 1;
        SG(sapi_headers).http_response_code = 200;
        SG(headers_sent) = 0;
+       if (SG(server_context)) {
+               SG(request_info).post_data = sapi_module.read_post(SLS_C);
+               SG(request_info).cookie_data = sapi_module.read_cookies(SLS_C);
+       }
 }
 
 
 SAPI_API void sapi_deactivate(SLS_D)
 {
        zend_llist_destroy(&SG(sapi_headers).headers);
-       if (SG(sapi_headers).content_type.header) {
-               efree(SG(sapi_headers).content_type.header);
+       if (SG(server_context) && SG(request_info).post_data) {
+               efree(SG(request_info).post_data);
        }
 }
 
@@ -93,7 +99,7 @@ SAPI_API int sapi_add_header(char *header_line, uint header_line_len)
        sapi_header.header_len = header_line_len;
 
        if (sapi_module.header_handler) {
-               retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers));
+               retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) SLS_CC);
        } else {
                retval = SAPI_HEADER_ADD;
        }
@@ -107,13 +113,7 @@ SAPI_API int sapi_add_header(char *header_line, uint header_line_len)
                if (colon_offset) {
                        *colon_offset = 0;
                        if (!STRCASECMP(header_line, "Content-Type")) {
-                               if (SG(sapi_headers).content_type.header) {
-                                       efree(SG(sapi_headers).content_type.header);
-                               }
-                               *colon_offset = ':';
-                               SG(sapi_headers).content_type.header = (char *) header_line;
-                               SG(sapi_headers).content_type.header_len = header_line_len;
-                               return SUCCESS;
+                               SG(sapi_headers).send_default_content_type = 0;
                        }
                        *colon_offset = ':';
                }
@@ -145,9 +145,7 @@ SAPI_API int sapi_send_headers()
                        return SUCCESS;
                        break;
                case SAPI_HEADER_DO_SEND:
-                       if (SG(sapi_headers).content_type.header) {
-                               sapi_module.send_header(&SG(sapi_headers).content_type, SG(server_context));
-                       } else {
+                       if (SG(sapi_headers).send_default_content_type) {
                                sapi_module.send_header(&default_header, SG(server_context));
                        }
                        zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) sapi_module.send_header, SG(server_context));
index 58925b630e3027d07895bd453544bb4aaa19618f..03bc4f7868633475bf69bed1cf4e88ec698fd795 100644 (file)
@@ -24,8 +24,8 @@ typedef struct {
 
 typedef struct {
        zend_llist headers;
-       sapi_header_struct content_type;
        int http_response_code;
+       unsigned char send_default_content_type;
 } sapi_headers_struct;
 
 
@@ -36,11 +36,17 @@ extern sapi_module_struct sapi_module;  /* true global */
 
 
 typedef struct {
+       char *request_method;
        char *query_string;
+       char *post_data;
+       char *cookie_data;
+       uint content_length;
 
        char *path_translated;
        char *request_uri;
 
+       char *content_type;
+
        unsigned char headers_only;
 } sapi_request_info;
 
@@ -89,9 +95,12 @@ struct _sapi_module_struct {
 
        void (*sapi_error)(int type, const char *error_msg, ...);
 
-       int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers);
+       int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC);
        int (*send_headers)(sapi_headers_struct *sapi_headers SLS_DC);
        void (*send_header)(sapi_header_struct *sapi_header, void *server_context);
+
+       char *(*read_post)(SLS_D);
+       char *(*read_cookies)(SLS_D);
 };
 
 
index 52a1f07b85d639696a421afcdfe2ab9cb9792062..a14dbbabcf419d9570e2ed49070945d5bbba8876 100644 (file)
@@ -186,41 +186,41 @@ static PHP_INI_MH(OnUpdateErrorReporting)
 #      define DEFAULT_SENDMAIL_PATH NULL
 #endif
 PHP_INI_BEGIN()
-       STD_PHP_INI_ENTRY("short_open_tag",             "1",            PHP_INI_ALL,            OnUpdateInt,            short_tags,             php_core_globals,       core_globals)
-       STD_PHP_INI_ENTRY("asp_tags",                   "0",            PHP_INI_ALL,            OnUpdateInt,            asp_tags,               php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("short_open_tag",   "1",            PHP_INI_ALL,            OnUpdateInt,            short_tags,             php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("asp_tags",                 "0",            PHP_INI_ALL,            OnUpdateInt,            asp_tags,               php_core_globals,       core_globals)
        PHP_INI_ENTRY("precision",                      "14",           PHP_INI_ALL,            OnSetPrecision)
 
-       PHP_INI_ENTRY("highlight.comment",      HL_COMMENT_COLOR,       PHP_INI_ALL,            NULL)
-       PHP_INI_ENTRY("highlight.default",      HL_DEFAULT_COLOR,       PHP_INI_ALL,            NULL)
-       PHP_INI_ENTRY("highlight.html",         HL_HTML_COLOR,          PHP_INI_ALL,            NULL)
-       PHP_INI_ENTRY("highlight.string",       HL_STRING_COLOR,        PHP_INI_ALL,            NULL)
-       PHP_INI_ENTRY("highlight.bg",           HL_BG_COLOR,            PHP_INI_ALL,            NULL)
-       PHP_INI_ENTRY("highlight.keyword",      HL_KEYWORD_COLOR,       PHP_INI_ALL,            NULL)
+       PHP_INI_ENTRY_EX("highlight.comment",   HL_COMMENT_COLOR,       PHP_INI_ALL,            NULL,           php_ini_color_displayer_cb)
+       PHP_INI_ENTRY_EX("highlight.default",   HL_DEFAULT_COLOR,       PHP_INI_ALL,            NULL,           php_ini_color_displayer_cb)
+       PHP_INI_ENTRY_EX("highlight.html",              HL_HTML_COLOR,          PHP_INI_ALL,            NULL,           php_ini_color_displayer_cb)
+       PHP_INI_ENTRY_EX("highlight.string",    HL_STRING_COLOR,        PHP_INI_ALL,            NULL,           php_ini_color_displayer_cb)
+       PHP_INI_ENTRY_EX("highlight.bg",                HL_BG_COLOR,            PHP_INI_ALL,            NULL,           php_ini_color_displayer_cb)
+       PHP_INI_ENTRY_EX("highlight.keyword",   HL_KEYWORD_COLOR,       PHP_INI_ALL,            NULL,           php_ini_color_displayer_cb)
 
-       STD_PHP_INI_ENTRY("magic_quotes_gpc",           "1",    PHP_INI_ALL,            OnUpdateInt,            magic_quotes_gpc,               php_core_globals,       core_globals)
-       STD_PHP_INI_ENTRY("magic_quotes_runtime",       "0",    PHP_INI_ALL,            OnUpdateInt,            magic_quotes_runtime,   php_core_globals,       core_globals)
-       STD_PHP_INI_ENTRY("magic_quotes_sybase",        "0",    PHP_INI_ALL,            OnUpdateInt,            magic_quotes_sybase,    php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("magic_quotes_gpc",         "1",    PHP_INI_ALL,            OnUpdateInt,            magic_quotes_gpc,               php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("magic_quotes_runtime",     "0",    PHP_INI_ALL,            OnUpdateInt,            magic_quotes_runtime,   php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("magic_quotes_sybase",      "0",    PHP_INI_ALL,            OnUpdateInt,            magic_quotes_sybase,    php_core_globals,       core_globals)
 
-       STD_PHP_INI_ENTRY("safe_mode",          "0",            PHP_INI_SYSTEM,                 OnUpdateInt,            safe_mode,                              php_core_globals,       core_globals)
-       STD_PHP_INI_ENTRY("sql.safe_mode",      "0",            PHP_INI_SYSTEM,                 OnUpdateInt,            sql_safe_mode,                  php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("safe_mode",                "0",            PHP_INI_SYSTEM,                 OnUpdateInt,            safe_mode,                              php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("sql.safe_mode",    "0",            PHP_INI_SYSTEM,                 OnUpdateInt,            sql_safe_mode,                  php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("safe_mode_exec_dir", "1",    PHP_INI_SYSTEM,                 OnUpdateString, safe_mode_exec_dir,             php_core_globals,       core_globals)
-       STD_PHP_INI_ENTRY("enable_dl",          "1",            PHP_INI_SYSTEM,                 OnUpdateInt,            enable_dl,                              php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("enable_dl",                "1",            PHP_INI_SYSTEM,                 OnUpdateInt,            enable_dl,                              php_core_globals,       core_globals)
 
        PHP_INI_ENTRY("SMTP",                   "localhost",                    PHP_INI_ALL,            NULL)
        PHP_INI_ENTRY("sendmail_path",  DEFAULT_SENDMAIL_PATH,  PHP_INI_SYSTEM,         NULL)
        PHP_INI_ENTRY("sendmail_from",  NULL,                                   PHP_INI_ALL,            NULL)
 
        PHP_INI_ENTRY("error_reporting",        NULL,                           PHP_INI_ALL,            OnUpdateErrorReporting)
-       STD_PHP_INI_ENTRY("display_errors",             "1",                    PHP_INI_ALL,            OnUpdateInt,            display_errors,         php_core_globals,       core_globals)
-       STD_PHP_INI_ENTRY("track_errors",               "0",                    PHP_INI_ALL,            OnUpdateInt,            track_errors,           php_core_globals,       core_globals)
-       STD_PHP_INI_ENTRY("log_errors",                 "0",                    PHP_INI_ALL,            OnUpdateInt,            log_errors,                     php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("display_errors",           "1",                    PHP_INI_ALL,            OnUpdateInt,            display_errors,         php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("track_errors",             "0",                    PHP_INI_ALL,            OnUpdateInt,            track_errors,           php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("log_errors",                       "0",                    PHP_INI_ALL,            OnUpdateInt,            log_errors,                     php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("error_log",                  NULL,                   PHP_INI_ALL,            OnUpdateString, error_log,                      php_core_globals,       core_globals)
 
 
        STD_PHP_INI_ENTRY("auto_prepend_file",  NULL,                   PHP_INI_ALL,            OnUpdateString, auto_prepend_file,      php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("auto_append_file",   NULL,                   PHP_INI_ALL,            OnUpdateString, auto_append_file,       php_core_globals,       core_globals)
 
-       STD_PHP_INI_ENTRY("y2k_compliance",             "0",                    PHP_INI_ALL,            OnUpdateInt,            y2k_compliance,         php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("y2k_compliance",           "0",                    PHP_INI_ALL,            OnUpdateInt,            y2k_compliance,         php_core_globals,       core_globals)
 
        STD_PHP_INI_ENTRY("doc_root",                   NULL,                   PHP_INI_SYSTEM,         OnUpdateStringUnempty,  doc_root,               php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("user_dir",                   NULL,                   PHP_INI_SYSTEM,         OnUpdateStringUnempty,  user_dir,               php_core_globals,       core_globals)
@@ -233,12 +233,12 @@ PHP_INI_BEGIN()
 
        PHP_INI_ENTRY("browscap",                       NULL,                           PHP_INI_SYSTEM,         NULL)
 
-       PHP_INI_ENTRY("define_syslog_variables",        "0",            PHP_INI_ALL,            NULL)
+       PHP_INI_ENTRY_EX("define_syslog_variables",     "0",            PHP_INI_ALL,            NULL,   php_ini_boolean_displayer_cb)
 
        PHP_INI_ENTRY("max_execution_time",             "30",                   PHP_INI_ALL,            OnChangeMaxExecutionTime)
        PHP_INI_ENTRY("memory_limit",                   "8388608",              PHP_INI_ALL,            OnChangeMemoryLimit)
 
-       STD_PHP_INI_ENTRY("track_vars",                         "0",                    PHP_INI_ALL,            OnUpdateInt,                            track_vars,             php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("track_vars",                               "0",                    PHP_INI_ALL,            OnUpdateInt,                            track_vars,             php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("gpc_order",                          "GPC",                  PHP_INI_ALL,            OnUpdateStringUnempty,  gpc_order,              php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("arg_separator",                      "&",                    PHP_INI_ALL,            OnUpdateStringUnempty,  arg_separator,  php_core_globals,       core_globals)
 PHP_INI_END()
@@ -771,6 +771,7 @@ int php_module_startup(sapi_module_struct *sf)
        int module_number=0;    /* for REGISTER_INI_ENTRIES() */
 #ifdef ZTS
        php_core_globals *core_globals;
+       sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id);
 #endif
 #if (WIN32|WINNT) && !(USE_SAPI)
        WORD wVersionRequested;
@@ -779,6 +780,8 @@ int php_module_startup(sapi_module_struct *sf)
        wVersionRequested = MAKEWORD(2, 0);
 #endif
 
+       SG(server_context) = NULL;
+       sapi_activate(SLS_C);
 
        if (module_initialized) {
                return SUCCESS;
@@ -805,6 +808,7 @@ int php_module_startup(sapi_module_struct *sf)
 #endif
 
        PG(header_is_being_sent) = 0;
+       SG(request_info).headers_only = 0;
 
 #if HAVE_SETLOCALE
        setlocale(LC_CTYPE, "");
@@ -838,6 +842,7 @@ int php_module_startup(sapi_module_struct *sf)
                return FAILURE;
        }
        module_initialized = 1;
+       sapi_deactivate(SLS_C);
        return SUCCESS;
 }
 
@@ -903,7 +908,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                switch(*p++) {
                        case 'p':
                        case 'P':
-                               if (!_gpc_flags[0] && php3_headers_unsent() && request_info.request_method && !strcasecmp(request_info.request_method, "post")) {
+                               if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) {
                                        php3_treat_data(PARSE_POST, NULL);      /* POST Data */
                                        _gpc_flags[0]=1;
                                }
index 815b582cbddaad337b8f70cd093c37b6024cab02..fbe1ad0dab909404abffb8667fedda311ca6a950 100644 (file)
 #include "php_ini.h"
 #include "zend_alloc.h"
 #include "php_globals.h"
+#include "ext/standard/info.h"
+
+#define ENTRY_NAME_COLOR "#999999"
+#define CONTENTS_COLOR "#DDDDDD"
 
 static HashTable known_directives;
 
@@ -93,7 +97,7 @@ int php_ini_rshutdown()
  * Registration / unregistration
  */
 
-int php_register_ini_entries(php_ini_entry *ini_entry, int module_number)
+PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number)
 {
        php_ini_entry *p = ini_entry;
        php_ini_entry *hashed_ini_entry;
@@ -126,13 +130,13 @@ int php_register_ini_entries(php_ini_entry *ini_entry, int module_number)
 }
 
 
-void php_unregister_ini_entries(int module_number)
+PHPAPI void php_unregister_ini_entries(int module_number)
 {
        _php3_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number);
 }
 
 
-int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type)
+PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type)
 {
        php_ini_entry *ini_entry;
        char *duplicate;
@@ -166,7 +170,7 @@ int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_
 }
 
 
-int php_restore_ini_entry(char *name, uint name_length)
+PHPAPI int php_restore_ini_entry(char *name, uint name_length)
 {
        php_ini_entry *ini_entry;
 
@@ -182,11 +186,25 @@ int php_restore_ini_entry(char *name, uint name_length)
 }
 
 
+PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type))
+{
+       php_ini_entry *ini_entry;
+
+       if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
+               return FAILURE;
+       }
+
+       ini_entry->displayer = displayer;
+       return SUCCESS;
+}
+
+
+
 /*
  * Data retrieval
  */
 
-long php_ini_long(char *name, uint name_length, int orig)
+PHPAPI long php_ini_long(char *name, uint name_length, int orig)
 {
        php_ini_entry *ini_entry;
 
@@ -202,7 +220,7 @@ long php_ini_long(char *name, uint name_length, int orig)
 }
 
 
-double php_ini_double(char *name, uint name_length, int orig)
+PHPAPI double php_ini_double(char *name, uint name_length, int orig)
 {
        php_ini_entry *ini_entry;
 
@@ -218,7 +236,7 @@ double php_ini_double(char *name, uint name_length, int orig)
 }
 
 
-char *php_ini_string(char *name, uint name_length, int orig)
+PHPAPI char *php_ini_string(char *name, uint name_length, int orig)
 {
        php_ini_entry *ini_entry;
 
@@ -235,7 +253,101 @@ char *php_ini_string(char *name, uint name_length, int orig)
 
 
 
-/* Standard message handlers for core_globals */
+static void php_ini_displayer_cb(php_ini_entry *ini_entry, int type)
+{
+       if (ini_entry->displayer) {
+               ini_entry->displayer(ini_entry, type);
+       } else {
+               char *display_string;
+               uint display_string_length;
+
+               if (type==PHP_INI_DISPLAY_ORIG && ini_entry->orig_value) {
+                       display_string = ini_entry->orig_value;
+                       display_string_length = ini_entry->orig_value_length;
+               } else if (ini_entry->value && ini_entry->value[0]) {
+                       display_string = ini_entry->value;
+                       display_string_length = ini_entry->value_length;
+               } else {
+                       display_string = "<i>no value</i>";
+                       display_string_length = sizeof("<i>no value</i>")-1;
+               }
+               PHPWRITE(display_string, display_string_length);
+       }
+}
+
+
+PHP_INI_DISP(php_ini_boolean_displayer_cb)
+{
+       int value;
+
+       if (type==PHP_INI_DISPLAY_ORIG && ini_entry->orig_value) {
+               value = atoi(ini_entry->orig_value);
+       } else if (ini_entry->value) {
+               value = atoi(ini_entry->value);
+       } else {
+               value = 0;
+       }
+       if (value) {
+               PUTS("On");
+       } else {
+               PUTS("Off");
+       }
+}
+
+
+PHP_INI_DISP(php_ini_color_displayer_cb)
+{
+       char *value;
+
+       if (type==PHP_INI_DISPLAY_ORIG && ini_entry->orig_value) {
+               value = ini_entry->orig_value;
+       } else if (ini_entry->value) {
+               value = ini_entry->value;
+       } else {
+               value = NULL;
+       }
+       if (value) {
+               php3_printf("<font color=\"%s\">%s</font>", value, value);
+       } else {
+               PUTS("<i>no value</i>;");
+       }
+}
+
+
+static int php_ini_displayer(php_ini_entry *ini_entry, int module_number)
+{
+       if (ini_entry->module_number != module_number) {
+               return 0;
+       }
+
+       PUTS("<tr><td align=\"center\" bgcolor=\"" ENTRY_NAME_COLOR "\">");
+       PHPWRITE(ini_entry->name, ini_entry->name_length-1);
+       PUTS("<td align=\"center\" bgcolor=\"" CONTENTS_COLOR "\">");
+       php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ACTIVE);
+       PUTS("</td><td align=\"center\" bgcolor=\"" CONTENTS_COLOR "\">");
+       php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ORIG);
+       PUTS("</td></tr>\n");
+       return 0;
+}
+
+
+PHPAPI void display_ini_entries(zend_module_entry *module)
+{
+       int module_number;
+
+       if (module) {
+               module_number = module->module_number;
+       } else {
+               module_number = 0;
+       }
+       PUTS("<table border=5 width=\"600\">\n");
+       php_info_print_table_header(3, "Directive", "Master Value", "Local Value");
+       zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_displayer, (void *) module_number);
+       PUTS("</table>\n");
+}
+
+
+/* Standard message handlers */
 
 PHP_INI_MH(OnUpdateInt)
 {
index f76dd83cbb1ed017e7b8e55e8fd9e873b7d6af64..de9a994858a3be4e93bebbbd9a470200355bcb38 100644 (file)
@@ -10,6 +10,7 @@
 typedef struct _php_ini_entry php_ini_entry;
 
 #define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3)
+#define PHP_INI_DISP(name) void name(php_ini_entry *ini_entry, int type)
 
 struct _php_ini_entry {
        int module_number;
@@ -27,6 +28,8 @@ struct _php_ini_entry {
        char *orig_value;
        uint orig_value_length;
        int modified;
+
+       void (*displayer)(php_ini_entry *ini_entry, int type);
 };
 
 
@@ -34,36 +37,57 @@ int php_ini_mstartup();
 int php_ini_mshutdown();
 int php_ini_rshutdown();
 
-int php_register_ini_entries(php_ini_entry *ini_entry, int module_number);
-void php_unregister_ini_entries(int module_number);
-int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type);
-int php_restore_ini_entry(char *name, uint name_length);
+PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number);
+PHPAPI void php_unregister_ini_entries(int module_number);
+PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type);
+PHPAPI int php_restore_ini_entry(char *name, uint name_length);
+PHPAPI void display_ini_entries(zend_module_entry *module);
+
+PHPAPI long php_ini_long(char *name, uint name_length, int orig);
+PHPAPI double php_ini_double(char *name, uint name_length, int orig);
+PHPAPI char *php_ini_string(char *name, uint name_length, int orig);
 
-long php_ini_long(char *name, uint name_length, int orig);
-double php_ini_double(char *name, uint name_length, int orig);
-char *php_ini_string(char *name, uint name_length, int orig);
+PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type));
+PHPAPI PHP_INI_DISP(php_ini_boolean_displayer_cb);
+PHPAPI PHP_INI_DISP(php_ini_color_displayer_cb);
 
 #define PHP_INI_BEGIN()                static php_ini_entry ini_entries[] = {
-#define PHP_INI_END()          { 0, 0, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, 0 } };
+#define PHP_INI_END()          { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };
+
+#define PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \
+       { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer },
 
 #define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \
-       { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0 },
+       PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL)
+
+#define PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \
+       PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer)
 
 #define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \
-       PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
+       PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
+
+#define PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \
+       PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer)
 
 #define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \
-       PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, NULL, NULL)
+       PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL)
        
+#define PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \
+       PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer)
+
 #define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \
-       PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, NULL, NULL, NULL)
+       PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL)
 
 #ifdef ZTS
 #define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
        PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
+#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
+       PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, php_ini_boolean_displayer_cb)
 #else
 #define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
        PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
+#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
+       PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, php_ini_boolean_displayer_cb)
 #endif
 
 #define INI_INT(name) php_ini_long((name), sizeof(name), 0)
@@ -78,6 +102,10 @@ char *php_ini_string(char *name, uint name_length, int orig);
 
 #define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number)
 #define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number)
+#define DISPLAY_INI_ENTRIES() display_ini_entries(module)
+
+#define REGISTER_INI_DISPLAYER(name, displayer) php_ini_register_displayer((name), sizeof(name), displayer)
+#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, php_ini_boolean_displayer_cb)
 
 pval *cfg_get_entry(char *name, uint name_length);
 
@@ -88,4 +116,8 @@ PHP_INI_MH(OnUpdateReal);
 PHP_INI_MH(OnUpdateString);
 PHP_INI_MH(OnUpdateStringUnempty);
 
+
+#define PHP_INI_DISPLAY_ORIG   1
+#define PHP_INI_DISPLAY_ACTIVE 2
+
 #endif /* _PHP_INI_H */
index a102fe8f5f50fa5a57f87149bfaa22a42cf243bd..01bdd8d73da3eb18dd2b3aa30f7fea67ceae17d0 100644 (file)
@@ -64,6 +64,8 @@ void php_module_shutdown();
 void php_module_shutdown_for_exec();
 int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
 
+int php3_error(int type, const char *format, ...);
+
 #include "util_script.h"
 
 #include "php_version.h"
@@ -118,6 +120,56 @@ static int zend_apache_ub_write(const char *str, uint str_length)
 }
 
 
+char *sapi_apache_read_post(SLS_D)
+{
+       return NULL;
+}
+
+
+char *sapi_apache_read_cookies(SLS_D)
+{
+       return table_get(r->subprocess_env, "HTTP_COOKIE");
+}
+
+
+int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
+{
+       char *header_name, *header_content, *p;
+       request_rec *r = (request_rec *) SG(server_context);
+
+       header_name = sapi_header->header;
+
+       header_content = p = strchr(header_name, ':');
+       if (!p) {
+               return 0;
+       }
+
+       *p = 0;
+       do {
+               header_content++
+       } while (*header_content==' ');
+
+       if (!strcasecmp(header_name, "Content-Type")) {
+               r->content_type = pstrdup(header_content);
+       } else if (!strcasecmp(header_name, "Location")) {
+               r->status = REDIRECT;
+       } else {
+               table_set(r->headers_out, header_name, header_content);
+       }
+
+       *p = ':';  /* a well behaved header handler shouldn't change its original arguments */
+
+       return 0;  /* don't use the default SAPI mechanism, Apache duplicates this functionality */
+}
+
+
+void sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
+{
+       send_http_header((request_rec *) SG(server_context));
+       return SAPI_HEADER_SENT_SUCCESSFULLY;
+}
+
+
 sapi_module_struct sapi_module = {
        "PHP Language",                                 /* name */
                                                                        
@@ -125,6 +177,15 @@ sapi_module_struct sapi_module = {
        php_module_shutdown_wrapper,    /* shutdown */
 
        zend_apache_ub_write,                   /* unbuffered write */
+
+       php3_error,                                             /* error handler */
+
+       sapi_apache_header_handler,             /* header handler */
+       sapi_apache_send_headers,               /* send headers handler */
+       NULL,                                                   /* send header handler */
+
+       sapi_apache_read_post,                  /* read POST data */
+       sapi_apache_read_cookies                /* read Cookies */
 };
 
 
index ef8482772a72635a10265bf18d62ccd480c94050..86a56f7c3086f246caa6f3495b27387ba13dc4a1 100644 (file)
@@ -37,17 +37,11 @@ PHPAPI php3_request_info request_info;
 #if CGI_BINARY
 int php3_init_request_info(void *conf)
 {
-       char *buf;      /* temporary buffers */
        SLS_FETCH();
 
        request_info.current_user = NULL;
        request_info.current_user_length = 0;
-       request_info.request_method = getenv("REQUEST_METHOD");
        request_info.script_name = getenv("SCRIPT_NAME");
-       buf = getenv("CONTENT_LENGTH");
-       request_info.content_length = (buf ? atoi(buf) : 0);
-       request_info.content_type = getenv("CONTENT_TYPE");
-       request_info.cookies = getenv("HTTP_COOKIE");
        request_info.script_filename = getenv("SCRIPT_FILENAME");
        /* Hack for annoying servers that do not set SCRIPT_FILENAME for us */
        if (!request_info.script_filename) {
@@ -110,13 +104,11 @@ int php3_init_request_info(void *conf)
        request_info.current_user_length = 0;
 
        request_info.filename = r->filename;
-       request_info.request_method = r->method;
+       SG(request_info).request_method = r->method;
        request_info.content_type = table_get(r->subprocess_env, "CONTENT_TYPE");
 
        buf = table_get(r->subprocess_env, "CONTENT_LENGTH");
-       request_info.content_length = (buf ? atoi(buf) : 0);
-
-       request_info.cookies = table_get(r->subprocess_env, "HTTP_COOKIE");
+       SG(request_info).content_length = (buf ? atoi(buf) : 0);
 
        return SUCCESS;
 }
index 2bcbfa7d777d6267d20e79a29fd2c79f8969ad00..51ff6606d253195f7ddf56c35e9626bbc5471c1e 100644 (file)
 
 typedef struct {
        char *filename;
-       char *path_info;
-       const char *request_method;
        char *script_name;
        char *current_user;
        int current_user_length;
-       unsigned int content_length;
-       const char *content_type;
-       const char *cookies;
        const char *script_filename;
        char *php_argv0;
 } php3_request_info;