/* +----------------------------------------------------------------------+ | PHP HTML Embedded Scripting Language Version 3.0 | +----------------------------------------------------------------------+ | Copyright (c) 1997,1998 PHP Development Team (See Credits file) | +----------------------------------------------------------------------+ | This program is free software; you can redistribute it and/or modify | | it under the terms of one of the following licenses: | | | | A) the GNU General Public License as published by the Free Software | | Foundation; either version 2 of the License, or (at your option) | | any later version. | | | | B) the PHP License as published by the PHP Development Team and | | included in the distribution in the file: LICENSE | | | | This program is distributed in the hope that it will be useful, | | but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | GNU General Public License for more details. | | | | You should have received a copy of both licenses referred to here. | | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf | | Zeev Suraski | +----------------------------------------------------------------------+ */ #ifdef THREAD_SAFE #include "tls.h" #endif #include "php.h" #include "php_ini.h" #include "php_globals.h" #include "head.h" #include "info.h" #ifndef MSVC5 #include "build-defs.h" #endif #include "zend_globals.h" /* needs ELS */ #define PHP3_CONF_STR(directive,value1,value2) \ PUTS(""); \ PUTS(directive); \ PUTS(" "); \ if (value1) PUTS(value1); \ else PUTS("none"); \ PUTS(" "); \ if (value2) PUTS(value2); \ else PUTS("none"); \ PUTS("\n"); #define PHP3_CONF_LONG(directive,value1,value2) \ php3_printf("%s%ld%ld\n",directive,value1,value2); extern char **environ; #define SECTION(name) PUTS("

" name "

\n") #define ENTRY_NAME_COLOR "#999999" #define CONTENTS_COLOR "#DDDDDD" #define HEADER_COLOR "#00DDDD" static int _display_module_info(php3_module_entry *module) { PUTS(""); PUTS(module->name); PUTS(""); if (module->info_func) { module->info_func(); } else { PUTS("No additional information."); } PUTS("\n"); return 0; } void _php3_info(void) { char **env,*tmp1,*tmp2; char *php3_uname; #if WIN32|WINNT char php3_windows_uname[256]; DWORD dwBuild=0; DWORD dwVersion = GetVersion(); DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); #endif ELS_FETCH(); PLS_FETCH(); #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; #else php3_uname=PHP_UNAME; #endif PUTS("\n"); php3_printf("

PHP Version %s

\n", PHP_VERSION); PUTS("

by Rasmus Lerdorf,\n"); PUTS("Andi Gutmans,\n"); PUTS("Zeev Suraski,\n"); PUTS("Stig Bakken,\n"); PUTS("Shane Caraveo,\n"); PUTS("Jim Winstead, and countless others.

\n"); PUTS("

Zend: "); PUTS("Andi Gutmans and \n"); PUTS("Zeev Suraski

\n"); PUTS("
"); php3_printf("
System: %s
Build Date: %s
\n", php3_uname, __DATE__); PUTS("
\n"); SECTION("Extensions"); PUTS("\n"); PUTS("\n"); #ifndef MSVC5 PUTS("\n"); PUTS("\n"); #endif _php3_hash_apply(&GLOBAL(module_registry),(int (*)(void *))_display_module_info); PUTS("
ExtensionsAdditional Information
PHP coreCFLAGS=" PHP_CFLAGS "
\n"); PUTS("HSREGEX=" PHP_HSREGEX "
\n"); SECTION("Configuration"); PUTS("php3.ini file path is set to: "); PUTS(CONFIGURATION_FILE_PATH); PUTS("
\n"); PUTS("\n"); PUTS("\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)); /* 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("\n",INI_ORIG_STR("highlight.comment"), INI_ORIG_STR("highlight.comment"), INI_STR("highlight.comment"), INI_STR("highlight.comment")); php3_printf("\n",INI_ORIG_STR("highlight.default"), INI_ORIG_STR("highlight.default"), INI_STR("highlight.default"), INI_STR("highlight.default")); php3_printf("\n",INI_ORIG_STR("highlight.html"), INI_ORIG_STR("highlight.html"), INI_STR("highlight.html"), INI_STR("highlight.html")); php3_printf("\n",INI_ORIG_STR("highlight.string"), INI_ORIG_STR("highlight.string"), INI_STR("highlight.string"), INI_STR("highlight.string")); php3_printf("\n",INI_ORIG_STR("highlight.bg"), INI_ORIG_STR("highlight.bg"), INI_STR("highlight.bg"), INI_STR("highlight.bg")); php3_printf("\n",INI_ORIG_STR("highlight.keyword"), INI_ORIG_STR("highlight.keyword"), INI_STR("highlight.keyword"), INI_STR("highlight.keyword")); PUTS("
DirectiveMaster ValueLocal Value
highlight_comment %s %s
highlight_default %s %s
highlight_html %s %s
highlight_string %s %s
highlight_bg %s %s
highlight_keyword %s %s
"); #if USE_SAPI /* call a server module specific info function */ GLOBAL(sapi_rqst)->info(GLOBAL(sapi_rqst)); #endif SECTION("Environment"); PUTS("\n"); PUTS("\n"); for (env=environ; env!=NULL && *env !=NULL; env++) { tmp1 = estrdup(*env); if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */ efree(tmp1); continue; } *tmp2 = 0; tmp2++; PUTS("\n"); efree(tmp1); } PUTS("
VariableValue
"); PUTS(tmp1); PUTS(""); if (tmp2 && *tmp2) { PUTS(tmp2); } else { PUTS(" "); } PUTS("
\n"); { pval **data, **tmp; char *string_key; ulong num_key; SECTION("PHP Variables"); PUTS("\n"); PUTS("\n"); if (_php3_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) { PUTS("\n"); } if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) { PUTS("\n"); } if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) { PUTS("\n"); } if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) { PUTS("\n"); } 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); while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) { convert_to_string(*tmp); PUTS("\n"); _php3_hash_move_forward((*data)->value.ht); } } if (_php3_hash_find(&EG(symbol_table), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), (void **) &data) != FAILURE) { _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("\n"); _php3_hash_move_forward((*data)->value.ht); } } if (_php3_hash_find(&EG(symbol_table), "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS"), (void **) &data) != FAILURE) { _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("\n"); _php3_hash_move_forward((*data)->value.ht); } } PUTS("
VariableValue
"); PUTS("PHP_SELF"); PUTS(""); PUTS((*data)->value.str.val); PUTS("
"); PUTS("PHP_AUTH_TYPE"); PUTS(""); PUTS((*data)->value.str.val); PUTS("
"); PUTS("PHP_AUTH_USER"); PUTS(""); PUTS((*data)->value.str.val); PUTS("
"); PUTS("PHP_AUTH_PW"); PUTS(""); PUTS((*data)->value.str.val); PUTS("
HTTP_GET_VARS[\""); switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) { case HASH_KEY_IS_STRING: PUTS(string_key); break; case HASH_KEY_IS_LONG: php3_printf("%ld",num_key); break; } PUTS("\"]"); PUTS((*tmp)->value.str.val); /* This could be "Array" - too ugly to expand that for now */ PUTS("
HTTP_POST_VARS[\""); switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) { case HASH_KEY_IS_STRING: PUTS(string_key); break; case HASH_KEY_IS_LONG: php3_printf("%ld",num_key); break; } PUTS("\"]"); PUTS((*tmp)->value.str.val); PUTS("
HTTP_COOKIE_VARS[\""); switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) { case HASH_KEY_IS_STRING: PUTS(string_key); break; case HASH_KEY_IS_LONG: php3_printf("%ld",num_key); break; } PUTS("\"]"); PUTS((*tmp)->value.str.val); PUTS("
\n"); } #if APACHE { register int i; array_header *arr = table_elts(GLOBAL(php3_rqst)->subprocess_env); table_entry *elts = (table_entry *)arr->elts; SECTION("Apache Environment"); PUTS("\n"); PUTS("\n"); for (i=0; i < arr->nelts; i++) { PUTS("\n"); } PUTS("
VariableValue
"); PUTS(elts[i].key); PUTS(""); PUTS(elts[i].val); PUTS(" 
\n"); } #endif #if APACHE { array_header *env_arr; table_entry *env; int i; SECTION("HTTP Headers Information"); PUTS("\n"); PUTS(" \n"); PUTS("\n"); env_arr = table_elts(GLOBAL(php3_rqst)->headers_in); env = (table_entry *)env_arr->elts; for (i = 0; i < env_arr->nelts; ++i) { if (env[i].key) { PUTS("\n"); } } PUTS(" \n"); env_arr = table_elts(GLOBAL(php3_rqst)->headers_out); env = (table_entry *)env_arr->elts; for(i = 0; i < env_arr->nelts; ++i) { if (env[i].key) { PUTS("\n"); } } PUTS("
HTTP Request Headers
HTTP Request"); PUTS(GLOBAL(php3_rqst)->the_request); PUTS(" 
"); PUTS(env[i].key); PUTS(""); PUTS(env[i].val); PUTS(" 
HTTP Response Headers
"); PUTS(env[i].key); PUTS(""); PUTS(env[i].val); PUTS(" 
\n\n"); } #endif PUTS("
"); PUTS("
\n"); PUTS("\n"); php3_printf("", get_zend_version()); PUTS("\n"); PUTS("

Zend

This program makes use of the Zend scripting language engine:
%s
\n"); SECTION("PHP License"); PUTS("
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.
\n"); } /* {{{ proto void phpinfo(void) Output a page of useful information about PHP and the current request */ void php3_info(INTERNAL_FUNCTION_PARAMETERS) { TLS_VARS; _php3_info(); RETURN_TRUE; } /* }}} */ /* {{{ proto string phpversion(void) Return the current PHP version */ void php3_version(INTERNAL_FUNCTION_PARAMETERS) { TLS_VARS; RETURN_STRING(PHP_VERSION,1); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: */