- Add a bitwise flag to phpinfo()

- Import a draft of the new PHP license
This commit is contained in:
Andi Gutmans 1999-07-14 16:02:10 +00:00
parent fec59d3b4d
commit 3e6bce59b3
7 changed files with 251 additions and 211 deletions

101
LICENSE
View File

@ -1,64 +1,63 @@
-------------------------------------------------------------------- --------------------------------------------------------------------
Copyright (c) 1998 The PHP Development Team. All rights reserved. The PHP License, version 2.0
-------------------------------------------------------------------- Copyright (c) 1999 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Commercial redistribution of larger works derived from, or Redistribution and use in source and binary forms, with or without
works which bundle PHP, requires written permission from the modification, are permitted provided that the following conditions
PHP Development Team. You may charge a fee for the physical are met:
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.
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. 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 copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided disclaimer in the documentation and/or other materials provided
with the distribution. with the distribution.
4. All advertising materials mentioning features or use of this 3. The name "PHP" must not be used to endorse or promote products
software must display the following acknowledgment: derived from this software without prior permission from the
"This product includes software written by the PHP Development PHP Group. This does not apply to add-on libraries or tools
Team" that work in conjunction with PHP. In such a case the PHP
name may be used to indicate that the product supports PHP.
5. The name "PHP" must not be used to endorse or promote products 4. The PHP Group reserves the right to modify the PHP license at
derived from this software without prior written permission any time and without prior notice, as long as the changes keep
from the PHP Development Team. This does not apply to add-on the free and open source nature of PHP.
libraries or tools that work in conjunction with PHP. In such
a case the PHP name may be used to indicate that the product 5. Redistributions of any form whatsoever must retain the following
supports PHP.
6. Redistributions of any form whatsoever must retain the following
acknowledgment: acknowledgment:
"This product includes software written by the PHP Development "This product includes PHP, freely available from
Team". 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.
-------------------------------------------------------------------- 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.
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
For more information on the PHP Development Team and the PHP ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
project, please see <http://www.php.net>. 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>.

View File

@ -310,7 +310,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
} }
cgi_started=1; cgi_started=1;
php3_TreatHeaders(); php3_TreatHeaders();
_php3_info(); _php3_info(0xFFFFFFFF);
exit(1); exit(1);
break; break;
case 's': case 's':

View File

@ -172,7 +172,57 @@ void php3_info_apache(ZEND_MODULE_INFO_FUNC_ARGS)
SLS_FETCH(); SLS_FETCH();
serv = ((request_rec *) SG(server_context))->server; 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"); PUTS("<table border=5 width=\"600\">\n");
php_info_print_table_header(2, "Entry", "Value"); php_info_print_table_header(2, "Entry", "Value");
#if WIN32|WINNT #if WIN32|WINNT

View File

@ -381,6 +381,7 @@ int php3_minit_basic(INIT_FUNC_ARGS)
test_class_startup(); test_class_startup();
REGISTER_INI_ENTRIES(); REGISTER_INI_ENTRIES();
register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU);
return SUCCESS; return SUCCESS;
} }

View 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 **env,*tmp1,*tmp2;
char *php3_uname; char *php3_uname;
@ -73,93 +73,96 @@ PHPAPI void _php3_info(void)
PLS_FETCH(); PLS_FETCH();
SLS_FETCH(); SLS_FETCH();
if (flag & PHP_INFO_GENERAL) {
#if WIN32|WINNT #if WIN32|WINNT
// Get build numbers for Windows NT or Win95 // Get build numbers for Windows NT or Win95
if (dwVersion < 0x80000000){ if (dwVersion < 0x80000000){
dwBuild = (DWORD)(HIWORD(dwVersion)); dwBuild = (DWORD)(HIWORD(dwVersion));
snprintf(php3_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild); snprintf(php3_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild);
} else { } else {
snprintf(php3_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion); snprintf(php3_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion);
} }
php3_uname = php3_windows_uname; php3_uname = php3_windows_uname;
#else #else
php3_uname=PHP_UNAME; php3_uname=PHP_UNAME;
#endif #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=\""); PUTS("<hr><a href=\"http://www.php.net/\"><img src=\"");
if (SG(request_info).request_uri) { if (SG(request_info).request_uri) {
PUTS(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"); 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("System: %s<br>Build Date: %s\n<br>", php3_uname, __DATE__);
php3_printf("php3.ini path: %s<br>\n", CONFIGURATION_FILE_PATH); 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 #ifdef ZTS
php3_printf("ZTS is defined"); php3_printf("ZTS is defined");
#else #else
php3_printf("ZTS is undefined"); php3_printf("ZTS is undefined");
#endif #endif
/* Zend Engine */ /* Zend Engine */
PUTS("<hr><a href=\"http://www.zend.com/\"><img src=\""); PUTS("<hr><a href=\"http://www.zend.com/\"><img src=\"");
if (SG(request_info).request_uri) { if (SG(request_info).request_uri) {
PUTS(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("<center>");
PUTS("<hr><h1>Credits</h1>\n");
PUTS("<table border=5 width=\"600\">\n"); if (flag & PHP_INFO_CREDITS) {
PUTS("<tr><th colspan=\"2\" bgcolor=\"" PHP_HEADER_COLOR "\">PHP 4.0 Authors</th></tr>\n"); PUTS("<h1>Credits</h1>\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("<table border=5 width=\"600\">\n");
PUTS("<hr><h1>Configuraton</h1>\n"); PUTS("<tr><th colspan=\"2\" bgcolor=\"" PHP_HEADER_COLOR "\">PHP 4.0 Authors</th></tr>\n");
PUTS("<h2>PHP Core</h2>\n"); php_info_print_table_header(2, "Contribution", "Authors");
display_ini_entries(NULL); CREDIT_LINE("Zend Scripting Language Engine", "Andi Gutmans, Zeev Suraski");
_php3_hash_apply(&module_registry,(int (*)(void *)) _display_module_info); CREDIT_LINE("Extension Module API", "Andi Gutmans, Zeev Suraski");
CREDIT_LINE("UNIX Build and Modularization", "Stig Bakken");
#if 0 CREDIT_LINE("Win32 Port", "Shane Caraveo, Zeev Suraski");
/* apache only directives */ CREDIT_LINE("Server API (SAPI) Abstraction Layer", "Andi Gutmans, Shane Caraveo, Zeev Suraski");
PHP3_CONF_LONG("engine", INI_ORIG_INT("engine"), INI_INT("engine")); /* apache only */ CREDIT_LINE("Apache SAPI Module", "Rasmus Lerdorf, Zeev Suraski");
PHP3_CONF_LONG("xbithack", INI_ORIG_INT("xbithack"), INI_INT("xbithack")); /* apache only */ CREDIT_LINE("ISAPI SAPI Module", "Andi Gutmans, Zeev Suraski");
PHP3_CONF_LONG("last_modified", INI_ORIG_INT("last_modified"), INI_INT("last_modified")); /* apache only */ CREDIT_LINE("CGI SAPI Module", "Rasmus Lerdorf, Stig Bakken");
/* end of apache only directives */ PUTS("</table>\n");
#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? */
efree(tmp1);
continue;
}
*tmp2 = 0;
tmp2++;
php_info_print_table_row(2, tmp1, tmp2);
efree(tmp1);
} }
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);
}
PUTS("</table>\n");
}
if (flag & PHP_INFO_VARIABLES) {
pval **data, **tmp; pval **data, **tmp;
char *string_key; char *string_key;
ulong num_key; ulong num_key;
@ -184,7 +187,7 @@ PHPAPI void _php3_info(void)
_php3_hash_internal_pointer_reset((*data)->value.ht); _php3_hash_internal_pointer_reset((*data)->value.ht);
while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) { while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
convert_to_string(*tmp); 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)) { switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
case HASH_KEY_IS_STRING: case HASH_KEY_IS_STRING:
PUTS(string_key); PUTS(string_key);
@ -194,7 +197,7 @@ PHPAPI void _php3_info(void)
php3_printf("%ld",num_key); php3_printf("%ld",num_key);
break; 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((*tmp)->value.str.val); /* This could be "Array" - too ugly to expand that for now */
PUTS("</td></tr>\n"); PUTS("</td></tr>\n");
_php3_hash_move_forward((*data)->value.ht); _php3_hash_move_forward((*data)->value.ht);
@ -204,7 +207,7 @@ PHPAPI void _php3_info(void)
_php3_hash_internal_pointer_reset((*data)->value.ht); _php3_hash_internal_pointer_reset((*data)->value.ht);
while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) { while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
convert_to_string(*tmp); 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)) { switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
case HASH_KEY_IS_STRING: case HASH_KEY_IS_STRING:
PUTS(string_key); PUTS(string_key);
@ -214,7 +217,7 @@ PHPAPI void _php3_info(void)
php3_printf("%ld",num_key); php3_printf("%ld",num_key);
break; break;
} }
PUTS("\"]</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">"); PUTS("\"]</b></td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
PUTS((*tmp)->value.str.val); PUTS((*tmp)->value.str.val);
PUTS("</td></tr>\n"); PUTS("</td></tr>\n");
_php3_hash_move_forward((*data)->value.ht); _php3_hash_move_forward((*data)->value.ht);
@ -224,7 +227,7 @@ PHPAPI void _php3_info(void)
_php3_hash_internal_pointer_reset((*data)->value.ht); _php3_hash_internal_pointer_reset((*data)->value.ht);
while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) { while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
convert_to_string(*tmp); 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)) { switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
case HASH_KEY_IS_STRING: case HASH_KEY_IS_STRING:
PUTS(string_key); PUTS(string_key);
@ -234,7 +237,7 @@ PHPAPI void _php3_info(void)
php3_printf("%ld",num_key); php3_printf("%ld",num_key);
break; break;
} }
PUTS("\"]</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">"); PUTS("\"]</b></td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
PUTS((*tmp)->value.str.val); PUTS((*tmp)->value.str.val);
PUTS("</td></tr>\n"); PUTS("</td></tr>\n");
_php3_hash_move_forward((*data)->value.ht); _php3_hash_move_forward((*data)->value.ht);
@ -243,83 +246,22 @@ PHPAPI void _php3_info(void)
PUTS("</table>\n"); 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>"); PUTS("</center>");
SECTION("PHP License"); if (flag & PHP_INFO_LICENSE) {
PUTS("<PRE>This program is free software; you can redistribute it and/or modify\n"); SECTION("PHP License");
PUTS("it under the terms of:\n"); PUTS("<PRE>This program is free software; you can redistribute it and/or modify\n");
PUTS("\n"); PUTS("it under the terms of the PHP License as published by the PHP Development Team\n");
PUTS("A) the GNU General Public License as published by the Free Software\n"); PUTS("and included in the distribution in the file: LICENSE\n");
PUTS(" Foundation; either version 2 of the License, or (at your option)\n"); PUTS("\n");
PUTS(" any later version.\n"); PUTS("This program is distributed in the hope that it will be useful,\n");
PUTS("\n"); PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
PUTS("B) the PHP License as published by the PHP Development Team and\n"); PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
PUTS(" included in the distribution in the file: LICENSE\n"); PUTS("\n");
PUTS("\n"); PUTS("If you did not receive a copy of the PHP license, or have any questions about\n");
PUTS("This program is distributed in the hope that it will be useful,\n"); PUTS("PHP licensing, please contact license@php.net.</PRE>\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");
} }
@ -360,7 +302,8 @@ PHPAPI void php_info_print_table_row(int num_cols, ...)
if (!row_element || !*row_element) { if (!row_element || !*row_element) {
row_element = "&nbsp;"; 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; color = PHP_CONTENTS_COLOR;
} }
php3_printf("</tr>\n"); 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) /* {{{ proto void phpinfo(void)
Output a page of useful information about PHP and the current request */ Output a page of useful information about PHP and the current request */
PHP_FUNCTION(info) 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; RETURN_TRUE;
} }
/* }}} */ /* }}} */

View File

@ -32,15 +32,27 @@
#ifndef _INFO_H #ifndef _INFO_H
#define _INFO_H #define _INFO_H
#define PHP_ENTRY_NAME_COLOR "#999999" #define PHP_ENTRY_NAME_COLOR "#FFFFFF"
#define PHP_CONTENTS_COLOR "#DDDDDD" #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(version);
PHP_FUNCTION(info); 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_header(int num_cols, ...);
PHPAPI void php_info_print_table_row(int num_cols, ...); PHPAPI void php_info_print_table_row(int num_cols, ...);
void register_phpinfo_constants(INIT_FUNC_ARGS);
#endif /* _INFO_H */ #endif /* _INFO_H */

View File

@ -333,9 +333,9 @@ static int php_ini_displayer(php_ini_entry *ini_entry, int module_number)
return 0; 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); 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); php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ACTIVE);
PUTS("</td><td align=\"center\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); PUTS("</td><td align=\"center\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ORIG); php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ORIG);