- Add a bitwise flag to phpinfo()
authorAndi Gutmans <andi@php.net>
Wed, 14 Jul 1999 16:02:10 +0000 (16:02 +0000)
committerAndi Gutmans <andi@php.net>
Wed, 14 Jul 1999 16:02:10 +0000 (16:02 +0000)
- Import a draft of the new PHP license

LICENSE
cgi_main.c
ext/apache/apache.c
ext/standard/basic_functions.c
ext/standard/info.c
ext/standard/info.h
main/php_ini.c

diff --git a/LICENSE b/LICENSE
index a59e164971e23ee55240aa1821be8dacf274278e..0de4763abe31b430cf7aede0be1b7f3392b9b492 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,64 +1,63 @@
-  -------------------------------------------------------------------- 
-   Copyright (c) 1998 The PHP Development Team.  All rights reserved.
-  -------------------------------------------------------------------- 
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
+-------------------------------------------------------------------- 
+                    The PHP License, version 2.0
+Copyright (c) 1999 The PHP Group. All rights reserved.
+-------------------------------------------------------------------- 
 
-  1. Commercial redistribution of larger works derived from, or 
-     works which bundle PHP, requires written permission from the
-     PHP Development Team.  You may charge a fee for the physical
-     act of transferring a copy, and must make it clear that the
-     fee being charged is for the distribution, and not for the
-     software itself.  You may, at your option, offer warranty
-     protection in exchange for a fee.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
 
-  2. Redistributions of source code must retain the above copyright
+  1. Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer. 
  
-  3. Redistributions in binary form must reproduce the above 
+  2. Redistributions in binary form must reproduce the above 
      copyright notice, this list of conditions and the following 
      disclaimer in the documentation and/or other materials provided
      with the distribution.
  
-  4. All advertising materials mentioning features or use of this
-     software must display the following acknowledgment:
-     "This product includes software written by the PHP Development
-      Team"
-  5. The name "PHP" must not be used to endorse or promote products 
-     derived from this software without prior written permission
-     from the PHP Development Team.  This does not apply to add-on
-     libraries or tools that work in conjunction with PHP.  In such
-     a case the PHP name may be used to indicate that the product
-     supports PHP.
+  3. The name "PHP" must not be used to endorse or promote products 
+     derived from this software without prior permission from the 
+        PHP Group.  This does not apply to add-on libraries or tools
+        that work in conjunction with PHP.  In such a case the PHP
+        name may be used to indicate that the product supports PHP.
  
-  6. Redistributions of any form whatsoever must retain the following
+  4. The PHP Group reserves the right to modify the PHP license at
+     any time and without prior notice, as long as the changes keep
+        the free and open source nature of PHP.
+
+  5. Redistributions of any form whatsoever must retain the following
      acknowledgment:
-     "This product includes software written by the PHP Development
-      Team". 
-  THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND 
-  ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
-  PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PHP
-  DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
-  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
-  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
-  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-  OF THE POSSIBILITY OF SUCH DAMAGE.
+     "This product includes PHP, freely available from
+        http://www.php.net/".
 
-  -------------------------------------------------------------------- 
+  6. Permission to freely distribute and use Zend as an integrated
+     part of PHP is granted, under the conditions of version 0.90
+        of the Zend License.
+        The license is bundled with the Zend engine, and is available
+        at http://www.zend.com/license/0_90.txt, or by contacting
+        license@zend.com.
 
-  This software consists of voluntary contributions made by many
-  individuals on behalf of the PHP Development Team.
 
-  The PHP Development Team can be contacted via Email at core@php.net.
-  
-  For more information on the PHP Development Team and the PHP 
-  project, please see <http://www.php.net>.
+
+THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND 
+ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
+PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PHP
+DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------- 
+
+This software consists of voluntary contributions made by many
+individuals on behalf of the PHP Group.
+
+The PHP Group can be contacted via Email at php-group@php.net.
+
+For more information on the PHP Development Group and the PHP 
+project, please see <http://www.php.net>.
index 8434ae720972c0fa6ca6920620847fc6ee8088b3..7c720c258a3754d1eca9d69f52a015e9f9146234 100644 (file)
@@ -310,7 +310,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
                                        }
                                        cgi_started=1;
                                        php3_TreatHeaders();
-                                       _php3_info();
+                                       _php3_info(0xFFFFFFFF);
                                        exit(1);
                                        break;
                                case 's':
index 8f72fbfbb2b5d5e71265cbfa0fad26befcf02c0c..75e971cace95796dd1867d662158c4283a859792 100644 (file)
@@ -172,7 +172,57 @@ void php3_info_apache(ZEND_MODULE_INFO_FUNC_ARGS)
        SLS_FETCH();
 
        serv = ((request_rec *) SG(server_context))->server;
-       
+
+       {
+               register int i;
+               array_header *arr;
+               table_entry *elts;
+               request_rec *r;
+               SLS_FETCH();
+
+               r = ((request_rec *) SG(server_context));
+               arr = table_elts(r->subprocess_env);
+               elts = (table_entry *)arr->elts;
+               
+               SECTION("Apache Environment");  
+               PUTS("<table border=5 width=\"600\">\n");
+               php_info_print_table_header(2, "Variable", "Value");
+               for (i=0; i < arr->nelts; i++) {
+                       php_info_print_table_row(2, elts[i].key, elts[i].val);
+               }
+               PUTS("</table>\n");
+       }
+
+       {
+               array_header *env_arr;
+               table_entry *env;
+               int i;
+               request_rec *r;
+               SLS_FETCH();
+               
+               r = ((request_rec *) SG(server_context));
+               SECTION("HTTP Headers Information");
+               PUTS("<table border=5 width=\"600\">\n");
+               PUTS(" <tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Headers</th></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) {
+                               php_info_print_table_row(2, env[i].key, env[i].val);
+                       }
+               }
+               PUTS(" <tr><th colspan=2  bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Response Headers</th></tr>\n");
+               env_arr = table_elts(r->headers_out);
+               env = (table_entry *)env_arr->elts;
+               for(i = 0; i < env_arr->nelts; ++i) {
+                       if (env[i].key) {
+                               php_info_print_table_row(2, env[i].key, env[i].val);
+                       }
+               }
+               PUTS("</table>\n\n");
+       }
+
     PUTS("<table border=5 width=\"600\">\n");
     php_info_print_table_header(2, "Entry", "Value");
 #if WIN32|WINNT
index fd210e8568aa8be29bb949b264d90aa46e08e85d..f75fc1cc9e0500486eeb4d41cb28c02d0c638bf9 100644 (file)
@@ -381,6 +381,7 @@ int php3_minit_basic(INIT_FUNC_ARGS)
        test_class_startup();
        REGISTER_INI_ENTRIES();
 
+       register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU);
        return SUCCESS;
 }
 
index 110efc49ec4955209f3d65f5920359771a81007c..19bf3f3fe09f157eae205ea56078b535db39d807 100644 (file)
@@ -58,7 +58,7 @@ static int _display_module_info(php3_module_entry *module)
 }
 
 
-PHPAPI void _php3_info(void)
+PHPAPI void _php3_info(int flag)
 {
        char **env,*tmp1,*tmp2;
        char *php3_uname;
@@ -73,93 +73,96 @@ PHPAPI void _php3_info(void)
        PLS_FETCH();
        SLS_FETCH();
        
+       if (flag & PHP_INFO_GENERAL) {
 #if WIN32|WINNT
-       // Get build numbers for Windows NT or Win95
-       if (dwVersion < 0x80000000){
-               dwBuild = (DWORD)(HIWORD(dwVersion));
-               snprintf(php3_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild);
-       } else {
-               snprintf(php3_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion);
-       }
-       php3_uname = php3_windows_uname;
+               // Get build numbers for Windows NT or Win95
+               if (dwVersion < 0x80000000){
+                       dwBuild = (DWORD)(HIWORD(dwVersion));
+                       snprintf(php3_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild);
+               } else {
+                       snprintf(php3_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion);
+               }
+               php3_uname = php3_windows_uname;
 #else
-       php3_uname=PHP_UNAME;
+               php3_uname=PHP_UNAME;
 #endif
 
 
-       php3_printf("<center><h1>PHP Version %s</h1></center>\n", PHP_VERSION);
+               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\"></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);
+               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\"></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);
 
-       php3_printf("ZEND_DEBUG=%d<br>\n", ZEND_DEBUG);
+               php3_printf("ZEND_DEBUG=%d<br>\n", ZEND_DEBUG);
 #ifdef ZTS
-       php3_printf("ZTS is defined");
+               php3_printf("ZTS is defined");
 #else
-       php3_printf("ZTS is undefined");
+               php3_printf("ZTS is undefined");
 #endif
-       /* Zend Engine */
-       PUTS("<hr><a href=\"http://www.zend.com/\"><img src=\"");
-       if (SG(request_info).request_uri) {
-               PUTS(SG(request_info).request_uri);
+               /* 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("<hr>");
        }
-       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>");
-       
-       PUTS("<hr><h1>Credits</h1>\n");
-
-       PUTS("<table border=5 width=\"600\">\n");
-       PUTS("<tr><th colspan=\"2\" bgcolor=\"" PHP_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");
-
-
-       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 */
-#endif
 
-       SECTION("Environment");
-       PUTS("<table border=5 width=\"600\">\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? */
+       if (flag & PHP_INFO_CREDITS) {  
+               PUTS("<h1>Credits</h1>\n");
+
+               PUTS("<table border=5 width=\"600\">\n");
+               PUTS("<tr><th colspan=\"2\" bgcolor=\"" PHP_HEADER_COLOR "\">PHP 4.0 Authors</th></tr>\n");
+               php_info_print_table_header(2, "Contribution", "Authors");
+               CREDIT_LINE("Zend 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");
+       }
+
+
+       if (flag & PHP_INFO_CONFIGURATION) {
+               PUTS("<hr><h1>Configuration</h1>\n");
+               PUTS("<h2>PHP Core</h2>\n");
+               display_ini_entries(NULL);
+       }
+
+       if (flag & PHP_INFO_MODULES) {
+               _php3_hash_apply(&module_registry,(int (*)(void *)) _display_module_info);
+       }
+
+       if (flag & PHP_INFO_ENVIRONMENT) {
+               SECTION("Environment");
+               PUTS("<table border=5 width=\"600\">\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? */
+                               efree(tmp1);
+                               continue;
+                       }
+                       *tmp2 = 0;
+                       tmp2++;
+                       php_info_print_table_row(2, tmp1, tmp2);
                        efree(tmp1);
-                       continue;
                }
-               *tmp2 = 0;
-               tmp2++;
-               php_info_print_table_row(2, tmp1, tmp2);
-               efree(tmp1);
+               PUTS("</table>\n");
        }
-       PUTS("</table>\n");
 
-       {
+       if (flag & PHP_INFO_VARIABLES) {
                pval **data, **tmp;
                char *string_key;
                ulong num_key;
@@ -184,7 +187,7 @@ PHPAPI void _php3_info(void)
                        _php3_hash_internal_pointer_reset((*data)->value.ht);
                        while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
                                convert_to_string(*tmp);
-                               PUTS("<tr><td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\">HTTP_GET_VARS[\"");
+                               PUTS("<tr><td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>HTTP_GET_VARS[\"");
                                switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
                                        case HASH_KEY_IS_STRING:
                                                PUTS(string_key);
@@ -194,7 +197,7 @@ PHPAPI void _php3_info(void)
                                                php3_printf("%ld",num_key);
                                                break;
                                }
-                               PUTS("\"]</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
+                               PUTS("\"]</b></td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
                                PUTS((*tmp)->value.str.val); /* This could be "Array" - too ugly to expand that for now */
                                PUTS("</td></tr>\n");
                                _php3_hash_move_forward((*data)->value.ht);
@@ -204,7 +207,7 @@ PHPAPI void _php3_info(void)
                        _php3_hash_internal_pointer_reset((*data)->value.ht);
                        while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
                                convert_to_string(*tmp);
-                               PUTS("<tr><td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\">HTTP_POST_VARS[\"");
+                               PUTS("<tr><td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>HTTP_POST_VARS[\"");
                                switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
                                        case HASH_KEY_IS_STRING:
                                                PUTS(string_key);
@@ -214,7 +217,7 @@ PHPAPI void _php3_info(void)
                                                php3_printf("%ld",num_key);
                                                break;
                                }
-                               PUTS("\"]</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
+                               PUTS("\"]</b></td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
                                PUTS((*tmp)->value.str.val);
                                PUTS("</td></tr>\n");
                                _php3_hash_move_forward((*data)->value.ht);
@@ -224,7 +227,7 @@ PHPAPI void _php3_info(void)
                        _php3_hash_internal_pointer_reset((*data)->value.ht);
                        while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
                                convert_to_string(*tmp);
-                               PUTS("<tr><td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\">HTTP_COOKIE_VARS[\"");
+                               PUTS("<tr><td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>HTTP_COOKIE_VARS[\"");
                                switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
                                        case HASH_KEY_IS_STRING:
                                                PUTS(string_key);
@@ -234,7 +237,7 @@ PHPAPI void _php3_info(void)
                                                php3_printf("%ld",num_key);
                                                break;
                                }
-                               PUTS("\"]</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
+                               PUTS("\"]</b></td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
                                PUTS((*tmp)->value.str.val);
                                PUTS("</td></tr>\n");
                                _php3_hash_move_forward((*data)->value.ht);
@@ -243,83 +246,22 @@ PHPAPI void _php3_info(void)
                PUTS("</table>\n");
        }
 
-#if APACHE
-       {
-               register int i;
-               array_header *arr;
-               table_entry *elts;
-               request_rec *r;
-               SLS_FETCH();
-
-               r = ((request_rec *) SG(server_context));
-               arr = table_elts(r->subprocess_env);
-               elts = (table_entry *)arr->elts;
-               
-               SECTION("Apache Environment");  
-               PUTS("<table border=5 width=\"600\">\n");
-               php_info_print_table_header(2, "Variable", "Value");
-               for (i=0; i < arr->nelts; i++) {
-                       php_info_print_table_row(2, elts[i].key, elts[i].val);
-               }
-               PUTS("</table>\n");
-       }
-#endif         
-
-#if APACHE
-       {
-               array_header *env_arr;
-               table_entry *env;
-               int i;
-               request_rec *r;
-               SLS_FETCH();
-               
-               r = ((request_rec *) SG(server_context));
-               SECTION("HTTP Headers Information");
-               PUTS("<table border=5 width=\"600\">\n");
-               PUTS(" <tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Headers</th></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) {
-                               php_info_print_table_row(2, env[i].key, env[i].val);
-                       }
-               }
-               PUTS(" <tr><th colspan=2  bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Response Headers</th></tr>\n");
-               env_arr = table_elts(r->headers_out);
-               env = (table_entry *)env_arr->elts;
-               for(i = 0; i < env_arr->nelts; ++i) {
-                       if (env[i].key) {
-                               php_info_print_table_row(2, env[i].key, env[i].val);
-                       }
-               }
-               PUTS("</table>\n\n");
-       }
-#endif
-
        PUTS("</center>");
 
 
-       SECTION("PHP License");
-       PUTS("<PRE>This program is free software; you can redistribute it and/or modify\n");
-       PUTS("it under the terms of:\n");
-       PUTS("\n");
-       PUTS("A) the GNU General Public License as published by the Free Software\n");
-    PUTS("   Foundation; either version 2 of the License, or (at your option)\n");
-    PUTS("   any later version.\n");
-       PUTS("\n");
-       PUTS("B) the PHP License as published by the PHP Development Team and\n");
-    PUTS("   included in the distribution in the file: LICENSE\n");
-       PUTS("\n");
-       PUTS("This program is distributed in the hope that it will be useful,\n");
-       PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
-       PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n");
-       PUTS("GNU General Public License for more details.\n");
-       PUTS("\n");
-       PUTS("You should have received a copy of both licenses referred to here.\n");
-       PUTS("If you did not, or have any questions about PHP licensing, please\n");
-       PUTS("contact core@php.net.</PRE>\n");
-       
+       if (flag & PHP_INFO_LICENSE) {
+               SECTION("PHP License");
+               PUTS("<PRE>This program is free software; you can redistribute it and/or modify\n");
+               PUTS("it under the terms of the PHP License as published by the PHP Development Team\n");
+               PUTS("and included in the distribution in the file:  LICENSE\n");
+               PUTS("\n");
+               PUTS("This program is distributed in the hope that it will be useful,\n");
+               PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
+               PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
+               PUTS("\n");
+               PUTS("If you did not receive a copy of the PHP license, or have any questions about\n");
+               PUTS("PHP licensing, please contact license@php.net.</PRE>\n");
+       }
 }
 
 
@@ -360,7 +302,8 @@ PHPAPI void php_info_print_table_row(int num_cols, ...)
                if (!row_element || !*row_element) {
                        row_element = "&nbsp;";
                }
-               php3_printf("<td bgcolor=\"%s\" valign=\"top\">%s</td>", color, row_element);
+               php3_printf("<td bgcolor=\"%s\" valign=\"top\">%s%s%s</td>", 
+                       color, (i==0?"<b>":""), row_element, (i==0?"</b>":""));
                color = PHP_CONTENTS_COLOR;
        }
        php3_printf("</tr>\n");
@@ -369,11 +312,46 @@ PHPAPI void php_info_print_table_row(int num_cols, ...)
 }
 
 
+
+void register_phpinfo_constants(INIT_FUNC_ARGS)
+{
+       ELS_FETCH();
+
+       REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS);
+}
+
+
 /* {{{ proto void phpinfo(void)
    Output a page of useful information about PHP and the current request */
 PHP_FUNCTION(info)
 {
-       _php3_info();
+       int flag;
+       zval *flag_arg;
+
+
+       switch (ARG_COUNT(ht)) {
+               case 0:
+                       flag = 0xFFFFFFFF;
+                       break;
+               case 1:
+                       if (getParameters(ht, 1, &flag_arg)==FAILURE) {
+                               RETURN_FALSE;
+                       }
+                       convert_to_long(flag_arg);
+                       flag = flag_arg->value.lval;
+                       break;
+               default:
+                       WRONG_PARAM_COUNT;
+                       break;
+       }
+       _php3_info(flag);
        RETURN_TRUE;
 }
 /* }}} */
index 957015ba378e23d7994e381ea7d9f625e2cacccd..db8abb45feeab0135249af0ec9b6c38104b44c73 100644 (file)
 #ifndef _INFO_H
 #define _INFO_H
 
-#define PHP_ENTRY_NAME_COLOR "#999999"
+#define PHP_ENTRY_NAME_COLOR "#FFFFFF"
 #define PHP_CONTENTS_COLOR "#DDDDDD"
-#define PHP_HEADER_COLOR "#00DDDD"
+#define PHP_HEADER_COLOR "#FFFF99"
+
+#define PHP_INFO_GENERAL                       (1<<0)
+#define PHP_INFO_CREDITS                       (1<<1)
+#define PHP_INFO_CONFIGURATION         (1<<2)
+#define PHP_INFO_MODULES                       (1<<3)
+#define PHP_INFO_ENVIRONMENT           (1<<4)
+#define PHP_INFO_VARIABLES                     (1<<5)
+#define PHP_INFO_LICENSE                       (1<<6)
+
+#define PHP_INFO_ALL           0xFFFFFFFF
 
 PHP_FUNCTION(version);
 PHP_FUNCTION(info);
-PHPAPI void _php3_info(void);
+PHPAPI void _php3_info(int flag);
 
 PHPAPI void php_info_print_table_header(int num_cols, ...);
 PHPAPI void php_info_print_table_row(int num_cols, ...);
 
+void register_phpinfo_constants(INIT_FUNC_ARGS);
+
 #endif /* _INFO_H */
index 67da69d24e874585552dc64cc4e6ff5e2b02de62..19829b2763726044231246db9da248cc5ae72482 100644 (file)
@@ -333,9 +333,9 @@ static int php_ini_displayer(php_ini_entry *ini_entry, int module_number)
                return 0;
        }
 
-       PUTS("<tr><td align=\"center\" bgcolor=\"" PHP_ENTRY_NAME_COLOR "\">");
+       PUTS("<tr><td align=\"center\" bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>");
        PHPWRITE(ini_entry->name, ini_entry->name_length-1);
-       PUTS("<td align=\"center\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
+       PUTS("</b></td><td align=\"center\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
        php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ACTIVE);
        PUTS("</td><td align=\"center\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
        php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ORIG);