cvs: php4(PHP_4) /ext/standard info.c info.h
| From: | Sascha Schumann | Date: | Sat, 19 Apr 2003 17:47:49 +0000 |
| Subject: | cvs: php4(PHP_4) /ext/standard info.c info.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20396@lists.php.net to get a copy of this message | ||
sas Sat Apr 19 13:47:49 2003 EDT
Modified files: (Branch: PHP_4)
/php4/ext/standard info.c info.h
Log:
Merge changes from PHP_4_3
Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.218.2.2.2.1 php4/ext/standard/info.c:1.218.2.2.2.2 --- php4/ext/standard/info.c:1.218.2.2.2.1 Tue Apr 1 06:05:50 2003 +++ php4/ext/standard/info.c Sat Apr 19 13:47:49 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.218.2.2.2.1 2003/04/01 11:05:50 thies Exp $ */ +/* $Id: info.c,v 1.218.2.2.2.2 2003/04/19 17:47:49 sas Exp $ */ #include "php.h" #include "php_ini.h" @@ -33,6 +33,7 @@ #include "php_main.h" #include "zend_globals.h" /* needs ELS */ #include "zend_extensions.h" +#include "zend_highlight.h" #ifdef HAVE_SYS_UTSNAME_H #include <sys/utsname.h> #endif @@ -47,7 +48,7 @@ ZEND_EXTERN_MODULE_GLOBALS(iconv) #endif -#define SECTION(name) if (PG(html_errors)) { \ +#define SECTION(name) if (!sapi_module.phpinfo_as_text) { \ PUTS("<h2>" name "</h2>\n"); \ } else { \ php_info_print_table_start(); \ @@ -65,7 +66,7 @@ int show_info_func = *((int *) arg); if (show_info_func && module->info_func) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", module->name, module->name); } else { php_info_print_table_start(); @@ -74,7 +75,7 @@ } module->info_func(module TSRMLS_CC); } else if (!show_info_func && !module->info_func) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr>"); php_printf("<td>"); php_printf("%s", module->name); @@ -102,7 +103,7 @@ && (Z_TYPE_PP(data)==IS_ARRAY)) { zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("<tr>"); PUTS("<td class=\"e\">"); @@ -113,7 +114,7 @@ switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) { case HASH_KEY_IS_STRING: - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { elem_esc = php_info_html_esc(string_key TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); @@ -126,24 +127,24 @@ break; } PUTS("\"]"); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</td><td class=\"v\">"); } else { PUTS(" => "); } if (Z_TYPE_PP(tmp) == IS_ARRAY) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("<pre>"); } zend_print_zval_r(*tmp, 0); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</pre>"); } } else if (Z_TYPE_PP(tmp) != IS_STRING) { tmp2 = **tmp; zval_copy_ctor(&tmp2); convert_to_string(&tmp2); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { if (Z_STRLEN(tmp2) == 0) { PUTS("<i>no value</i>"); } else { @@ -156,7 +157,7 @@ } zval_dtor(&tmp2); } else { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { if (Z_STRLEN_PP(tmp) == 0) { PUTS("<i>no value</i>"); } else { @@ -168,7 +169,7 @@ PUTS(Z_STRVAL_PP(tmp)); } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</td></tr>\n"); } else { PUTS("\n"); @@ -181,7 +182,7 @@ /* {{{ php_info_print_style */ -void php_info_print_style(void) +void php_info_print_style() { php_printf("<style type=\"text/css\"><!--\n"); php_info_print_css(); @@ -211,6 +212,12 @@ DWORD dwVersion = GetVersion(); DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); + DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; + char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + SYSTEM_INFO SysInfo; + + GetComputerName(ComputerName, &dwSize); + GetSystemInfo(&SysInfo); if (mode == 's') { if (dwVersion < 0x80000000) { @@ -222,25 +229,57 @@ snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion); php_uname = tmp_uname; } else if (mode == 'n') { - /* XXX HOW TO GET THIS ON WINDOWS? */ - php_uname = "localhost"; + php_uname = ComputerName; } else if (mode == 'v') { dwBuild = (DWORD)(HIWORD(dwVersion)); snprintf(tmp_uname, sizeof(tmp_uname), "build %d", dwBuild); php_uname = tmp_uname; } else if (mode == 'm') { - /* XXX HOW TO GET THIS ON WINDOWS? */ - php_uname = "i386"; + switch (SysInfo.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_INTEL : + snprintf(tmp_uname, sizeof(tmp_uname), "i%d", SysInfo.dwProcessorType); + php_uname = tmp_uname; + break; + case PROCESSOR_ARCHITECTURE_MIPS : + php_uname = "MIPS R4000"; + php_uname = tmp_uname; + break; + case PROCESSOR_ARCHITECTURE_ALPHA : + snprintf(tmp_uname, sizeof(tmp_uname), "Alpha %d", SysInfo.wProcessorLevel); + php_uname = tmp_uname; + break; + case PROCESSOR_ARCHITECTURE_PPC : + snprintf(tmp_uname, sizeof(tmp_uname), "PPC 6%02d", SysInfo.wProcessorLevel); + php_uname = tmp_uname; + break; + case PROCESSOR_ARCHITECTURE_IA64 : + php_uname = "IA64"; + break; +#if defined(PROCESSOR_ARCHITECTURE_IA32_ON_WIN64) + case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 : + php_uname = "IA32"; + break; +#endif +#if defined(PROCESSOR_ARCHITECTURE_AMD64) + case PROCESSOR_ARCHITECTURE_AMD64 : + php_uname = "AMD64"; + break; +#endif + case PROCESSOR_ARCHITECTURE_UNKNOWN : + default : + php_uname = "Unknown"; + break; + } } else { /* assume mode == 'a' */ /* Get build numbers for Windows NT or Win95 */ if (dwVersion < 0x80000000){ dwBuild = (DWORD)(HIWORD(dwVersion)); snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d", - "Windows NT", "localhost", + "Windows NT", ComputerName, dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild); } else { snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d", - "Windows 9x", "localhost", + "Windows 9x", ComputerName, dwWindowsMajorVersion, dwWindowsMinorVersion); } php_uname = tmp_uname; @@ -350,7 +389,7 @@ the_time = time(NULL); ta = php_localtime_r(&the_time, &tmbuf); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_print_info_htmlhead(TSRMLS_C); } else { PUTS("phpinfo()\n"); @@ -362,23 +401,23 @@ php_uname = php_get_uname('a'); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_info_print_box_start(1); } - if (expose_php && PG(html_errors)) { + if (expose_php && !sapi_module.phpinfo_as_text) { PUTS("<a href=\"http://www.php.net/\"><img border=\"0\" src=\""); if (SG(request_info).request_uri) { PUTS(SG(request_info).request_uri); } if ((ta->tm_mon==3) && (ta->tm_mday==1)) { - PUTS("?="PHP_EGG_LOGO_GUID"\" alt=\"Dog!\" /></a>"); + PUTS("?="PHP_EGG_LOGO_GUID"\" alt=\"Thies!\" /></a>"); } else { PUTS("?="PHP_LOGO_GUID"\" alt=\"PHP Logo\" /></a>"); } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION); } else { php_info_print_table_row(2, "PHP Version", PHP_VERSION); @@ -467,7 +506,7 @@ /* Zend Engine */ php_info_print_box_start(0); - if (expose_php && PG(html_errors)) { + if (expose_php && !sapi_module.phpinfo_as_text) { PUTS("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\""); if (SG(request_info).request_uri) { PUTS(SG(request_info).request_uri); @@ -475,13 +514,17 @@ PUTS("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n"); } PUTS("This program makes use of the Zend Scripting Language Engine:"); - PUTS(PG(html_errors)?"<br />":"\n"); - PUTS(zend_version); + PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n"); + if (PG(html_errors)) { + zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC); + } else { + PUTS(zend_version); + } php_info_print_box_end(); efree(php_uname); } - if ((flag & PHP_INFO_CREDITS) && expose_php && PG(html_errors)) { + if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) { php_info_print_hr(); PUTS("<h1><a href=\""); if (SG(request_info).request_uri) { @@ -496,7 +539,7 @@ if (flag & PHP_INFO_CONFIGURATION) { php_info_print_hr(); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("<h1>Configuration</h1>\n"); } else { SECTION("Configuration"); @@ -564,7 +607,7 @@ if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) { php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data)); } - php_print_gpcse_array("_FORM", sizeof("_FORM")-1 TSRMLS_CC); + php_print_gpcse_array("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC); php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC); php_print_gpcse_array("_POST", sizeof("_POST")-1 TSRMLS_CC); php_print_gpcse_array("_FILES", sizeof("_FILES")-1 TSRMLS_CC); @@ -575,7 +618,7 @@ } if (flag & PHP_INFO_LICENSE) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { SECTION("PHP License"); php_info_print_box_start(0); PUTS("<p>\n"); @@ -607,7 +650,7 @@ PUTS("questions about PHP licensing, please contact license@php.net.\n"); } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</div></body></html>"); } } @@ -616,9 +659,7 @@ PHPAPI void php_info_print_table_start() { - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n"); } else { php_printf("\n"); @@ -627,9 +668,7 @@ PHPAPI void php_info_print_table_end() { - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</table><br />\n"); } @@ -637,15 +676,13 @@ PHPAPI void php_info_print_box_start(int flag) { - TSRMLS_FETCH(); - php_info_print_table_start(); if (flag) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\"><td>\n"); } } else { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"v\"><td>\n"); } else { php_printf("\n"); @@ -655,9 +692,7 @@ PHPAPI void php_info_print_box_end() { - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</td></tr>\n"); } php_info_print_table_end(); @@ -665,9 +700,7 @@ PHPAPI void php_info_print_hr() { - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<hr />\n"); } else { php_printf("\n\n _______________________________________________________________________\n\n"); @@ -678,9 +711,7 @@ { int spaces; - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header ); } else { spaces = (74 - strlen(header)); @@ -699,7 +730,7 @@ TSRMLS_FETCH(); va_start(row_elements, num_cols); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\">"); } for (i=0; i<num_cols; i++) { @@ -707,7 +738,7 @@ if (!row_element || !*row_element) { row_element = " "; } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("<th>"); PUTS(row_element); PUTS("</th>"); @@ -720,7 +751,7 @@ } } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</tr>\n"); } @@ -728,12 +759,12 @@ } /* }}} */ -/* {{{ php_info_print_table_row +/* {{{ php_info_print_table_row_internal */ -PHPAPI void php_info_print_table_row(int num_cols, ...) +static void php_info_print_table_row_internal(int num_cols, + const char *value_class, va_list row_elements) { int i; - va_list row_elements; char *row_element; char *elem_esc = NULL; /* @@ -742,25 +773,24 @@ TSRMLS_FETCH(); - va_start(row_elements, num_cols); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr>"); } for (i=0; i<num_cols; i++) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<td class=\"%s\">", - (i==0 ? "e" : "v" ) + (i==0 ? "e" : value_class ) ); } row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS( "<i>no value</i>" ); } else { PUTS( " " ); } } else { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { elem_esc = php_info_html_esc(row_element TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); @@ -768,19 +798,42 @@ PUTS(row_element); if (i < num_cols-1) { PUTS(" => "); - } else { - PUTS("\n"); } } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf(" </td>"); - } + } else if (i == (num_cols - 1)) { + PUTS("\n"); + } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</tr>\n"); } +} +/* }}} */ + +/* {{{ php_info_print_table_row + */ +PHPAPI void php_info_print_table_row(int num_cols, ...) +{ + va_list row_elements; + + va_start(row_elements, num_cols); + php_info_print_table_row_internal(num_cols, "v", row_elements); + va_end(row_elements); +} +/* }}} */ + +/* {{{ php_info_print_table_row_ex + */ +PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, + ...) +{ + va_list row_elements; + va_start(row_elements, value_class); + php_info_print_table_row_internal(num_cols, value_class, row_elements); va_end(row_elements); } /* }}} */ @@ -960,3 +1013,4 @@ * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 */ + Index: php4/ext/standard/info.h diff -u php4/ext/standard/info.h:1.29.2.1 php4/ext/standard/info.h:1.29.2.1.2.1 --- php4/ext/standard/info.h:1.29.2.1 Tue Dec 31 11:35:31 2002 +++ php4/ext/standard/info.h Sat Apr 19 13:47:49 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.h,v 1.29.2.1 2002/12/31 16:35:31 sebastian Exp $ */ +/* $Id: info.h,v 1.29.2.1.2.1 2003/04/19 17:47:49 sas Exp $ */ #ifndef INFO_H #define INFO_H @@ -72,6 +72,7 @@ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header); 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_ex(int num_cols, const char *, ...); PHPAPI void php_info_print_table_start(void); PHPAPI void php_info_print_table_end(void); PHPAPI void php_info_print_box_start(int bg);
Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.218.2.2.2.1 php4/ext/standard/info.c:1.218.2.2.2.2 --- php4/ext/standard/info.c:1.218.2.2.2.1 Tue Apr 1 06:05:50 2003 +++ php4/ext/standard/info.c Sat Apr 19 13:47:49 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.218.2.2.2.1 2003/04/01 11:05:50 thies Exp $ */ +/* $Id: info.c,v 1.218.2.2.2.2 2003/04/19 17:47:49 sas Exp $ */ #include "php.h" #include "php_ini.h" @@ -33,6 +33,7 @@ #include "php_main.h" #include "zend_globals.h" /* needs ELS */ #include "zend_extensions.h" +#include "zend_highlight.h" #ifdef HAVE_SYS_UTSNAME_H #include <sys/utsname.h> #endif @@ -47,7 +48,7 @@ ZEND_EXTERN_MODULE_GLOBALS(iconv) #endif -#define SECTION(name) if (PG(html_errors)) { \ +#define SECTION(name) if (!sapi_module.phpinfo_as_text) { \ PUTS("<h2>" name "</h2>\n"); \ } else { \ php_info_print_table_start(); \ @@ -65,7 +66,7 @@ int show_info_func = *((int *) arg); if (show_info_func && module->info_func) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", module->name, module->name); } else { php_info_print_table_start(); @@ -74,7 +75,7 @@ } module->info_func(module TSRMLS_CC); } else if (!show_info_func && !module->info_func) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr>"); php_printf("<td>"); php_printf("%s", module->name); @@ -102,7 +103,7 @@ && (Z_TYPE_PP(data)==IS_ARRAY)) { zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("<tr>"); PUTS("<td class=\"e\">"); @@ -113,7 +114,7 @@ switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) { case HASH_KEY_IS_STRING: - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { elem_esc = php_info_html_esc(string_key TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); @@ -126,24 +127,24 @@ break; } PUTS("\"]"); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</td><td class=\"v\">"); } else { PUTS(" => "); } if (Z_TYPE_PP(tmp) == IS_ARRAY) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("<pre>"); } zend_print_zval_r(*tmp, 0); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</pre>"); } } else if (Z_TYPE_PP(tmp) != IS_STRING) { tmp2 = **tmp; zval_copy_ctor(&tmp2); convert_to_string(&tmp2); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { if (Z_STRLEN(tmp2) == 0) { PUTS("<i>no value</i>"); } else { @@ -156,7 +157,7 @@ } zval_dtor(&tmp2); } else { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { if (Z_STRLEN_PP(tmp) == 0) { PUTS("<i>no value</i>"); } else { @@ -168,7 +169,7 @@ PUTS(Z_STRVAL_PP(tmp)); } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</td></tr>\n"); } else { PUTS("\n"); @@ -181,7 +182,7 @@ /* {{{ php_info_print_style */ -void php_info_print_style(void) +void php_info_print_style() { php_printf("<style type=\"text/css\"><!--\n"); php_info_print_css(); @@ -211,6 +212,12 @@ DWORD dwVersion = GetVersion(); DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); + DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; + char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + SYSTEM_INFO SysInfo; + + GetComputerName(ComputerName, &dwSize); + GetSystemInfo(&SysInfo); if (mode == 's') { if (dwVersion < 0x80000000) { @@ -222,25 +229,57 @@ snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion); php_uname = tmp_uname; } else if (mode == 'n') { - /* XXX HOW TO GET THIS ON WINDOWS? */ - php_uname = "localhost"; + php_uname = ComputerName; } else if (mode == 'v') { dwBuild = (DWORD)(HIWORD(dwVersion)); snprintf(tmp_uname, sizeof(tmp_uname), "build %d", dwBuild); php_uname = tmp_uname; } else if (mode == 'm') { - /* XXX HOW TO GET THIS ON WINDOWS? */ - php_uname = "i386"; + switch (SysInfo.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_INTEL : + snprintf(tmp_uname, sizeof(tmp_uname), "i%d", SysInfo.dwProcessorType); + php_uname = tmp_uname; + break; + case PROCESSOR_ARCHITECTURE_MIPS : + php_uname = "MIPS R4000"; + php_uname = tmp_uname; + break; + case PROCESSOR_ARCHITECTURE_ALPHA : + snprintf(tmp_uname, sizeof(tmp_uname), "Alpha %d", SysInfo.wProcessorLevel); + php_uname = tmp_uname; + break; + case PROCESSOR_ARCHITECTURE_PPC : + snprintf(tmp_uname, sizeof(tmp_uname), "PPC 6%02d", SysInfo.wProcessorLevel); + php_uname = tmp_uname; + break; + case PROCESSOR_ARCHITECTURE_IA64 : + php_uname = "IA64"; + break; +#if defined(PROCESSOR_ARCHITECTURE_IA32_ON_WIN64) + case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 : + php_uname = "IA32"; + break; +#endif +#if defined(PROCESSOR_ARCHITECTURE_AMD64) + case PROCESSOR_ARCHITECTURE_AMD64 : + php_uname = "AMD64"; + break; +#endif + case PROCESSOR_ARCHITECTURE_UNKNOWN : + default : + php_uname = "Unknown"; + break; + } } else { /* assume mode == 'a' */ /* Get build numbers for Windows NT or Win95 */ if (dwVersion < 0x80000000){ dwBuild = (DWORD)(HIWORD(dwVersion)); snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d", - "Windows NT", "localhost", + "Windows NT", ComputerName, dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild); } else { snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d", - "Windows 9x", "localhost", + "Windows 9x", ComputerName, dwWindowsMajorVersion, dwWindowsMinorVersion); } php_uname = tmp_uname; @@ -350,7 +389,7 @@ the_time = time(NULL); ta = php_localtime_r(&the_time, &tmbuf); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_print_info_htmlhead(TSRMLS_C); } else { PUTS("phpinfo()\n"); @@ -362,23 +401,23 @@ php_uname = php_get_uname('a'); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_info_print_box_start(1); } - if (expose_php && PG(html_errors)) { + if (expose_php && !sapi_module.phpinfo_as_text) { PUTS("<a href=\"http://www.php.net/\"><img border=\"0\" src=\""); if (SG(request_info).request_uri) { PUTS(SG(request_info).request_uri); } if ((ta->tm_mon==3) && (ta->tm_mday==1)) { - PUTS("?="PHP_EGG_LOGO_GUID"\" alt=\"Dog!\" /></a>"); + PUTS("?="PHP_EGG_LOGO_GUID"\" alt=\"Thies!\" /></a>"); } else { PUTS("?="PHP_LOGO_GUID"\" alt=\"PHP Logo\" /></a>"); } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION); } else { php_info_print_table_row(2, "PHP Version", PHP_VERSION); @@ -467,7 +506,7 @@ /* Zend Engine */ php_info_print_box_start(0); - if (expose_php && PG(html_errors)) { + if (expose_php && !sapi_module.phpinfo_as_text) { PUTS("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\""); if (SG(request_info).request_uri) { PUTS(SG(request_info).request_uri); @@ -475,13 +514,17 @@ PUTS("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n"); } PUTS("This program makes use of the Zend Scripting Language Engine:"); - PUTS(PG(html_errors)?"<br />":"\n"); - PUTS(zend_version); + PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n"); + if (PG(html_errors)) { + zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC); + } else { + PUTS(zend_version); + } php_info_print_box_end(); efree(php_uname); } - if ((flag & PHP_INFO_CREDITS) && expose_php && PG(html_errors)) { + if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) { php_info_print_hr(); PUTS("<h1><a href=\""); if (SG(request_info).request_uri) { @@ -496,7 +539,7 @@ if (flag & PHP_INFO_CONFIGURATION) { php_info_print_hr(); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("<h1>Configuration</h1>\n"); } else { SECTION("Configuration"); @@ -564,7 +607,7 @@ if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) { php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data)); } - php_print_gpcse_array("_FORM", sizeof("_FORM")-1 TSRMLS_CC); + php_print_gpcse_array("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC); php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC); php_print_gpcse_array("_POST", sizeof("_POST")-1 TSRMLS_CC); php_print_gpcse_array("_FILES", sizeof("_FILES")-1 TSRMLS_CC); @@ -575,7 +618,7 @@ } if (flag & PHP_INFO_LICENSE) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { SECTION("PHP License"); php_info_print_box_start(0); PUTS("<p>\n"); @@ -607,7 +650,7 @@ PUTS("questions about PHP licensing, please contact license@php.net.\n"); } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</div></body></html>"); } } @@ -616,9 +659,7 @@ PHPAPI void php_info_print_table_start() { - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n"); } else { php_printf("\n"); @@ -627,9 +668,7 @@ PHPAPI void php_info_print_table_end() { - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</table><br />\n"); } @@ -637,15 +676,13 @@ PHPAPI void php_info_print_box_start(int flag) { - TSRMLS_FETCH(); - php_info_print_table_start(); if (flag) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\"><td>\n"); } } else { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"v\"><td>\n"); } else { php_printf("\n"); @@ -655,9 +692,7 @@ PHPAPI void php_info_print_box_end() { - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</td></tr>\n"); } php_info_print_table_end(); @@ -665,9 +700,7 @@ PHPAPI void php_info_print_hr() { - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<hr />\n"); } else { php_printf("\n\n _______________________________________________________________________\n\n"); @@ -678,9 +711,7 @@ { int spaces; - TSRMLS_FETCH(); - - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header ); } else { spaces = (74 - strlen(header)); @@ -699,7 +730,7 @@ TSRMLS_FETCH(); va_start(row_elements, num_cols); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr class=\"h\">"); } for (i=0; i<num_cols; i++) { @@ -707,7 +738,7 @@ if (!row_element || !*row_element) { row_element = " "; } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("<th>"); PUTS(row_element); PUTS("</th>"); @@ -720,7 +751,7 @@ } } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</tr>\n"); } @@ -728,12 +759,12 @@ } /* }}} */ -/* {{{ php_info_print_table_row +/* {{{ php_info_print_table_row_internal */ -PHPAPI void php_info_print_table_row(int num_cols, ...) +static void php_info_print_table_row_internal(int num_cols, + const char *value_class, va_list row_elements) { int i; - va_list row_elements; char *row_element; char *elem_esc = NULL; /* @@ -742,25 +773,24 @@ TSRMLS_FETCH(); - va_start(row_elements, num_cols); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<tr>"); } for (i=0; i<num_cols; i++) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("<td class=\"%s\">", - (i==0 ? "e" : "v" ) + (i==0 ? "e" : value_class ) ); } row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS( "<i>no value</i>" ); } else { PUTS( " " ); } } else { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { elem_esc = php_info_html_esc(row_element TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); @@ -768,19 +798,42 @@ PUTS(row_element); if (i < num_cols-1) { PUTS(" => "); - } else { - PUTS("\n"); } } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf(" </td>"); - } + } else if (i == (num_cols - 1)) { + PUTS("\n"); + } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</tr>\n"); } +} +/* }}} */ + +/* {{{ php_info_print_table_row + */ +PHPAPI void php_info_print_table_row(int num_cols, ...) +{ + va_list row_elements; + + va_start(row_elements, num_cols); + php_info_print_table_row_internal(num_cols, "v", row_elements); + va_end(row_elements); +} +/* }}} */ + +/* {{{ php_info_print_table_row_ex + */ +PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, + ...) +{ + va_list row_elements; + va_start(row_elements, value_class); + php_info_print_table_row_internal(num_cols, value_class, row_elements); va_end(row_elements); } /* }}} */ @@ -960,3 +1013,4 @@ * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 */ + Index: php4/ext/standard/info.h diff -u php4/ext/standard/info.h:1.29.2.1 php4/ext/standard/info.h:1.29.2.1.2.1 --- php4/ext/standard/info.h:1.29.2.1 Tue Dec 31 11:35:31 2002 +++ php4/ext/standard/info.h Sat Apr 19 13:47:49 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.h,v 1.29.2.1 2002/12/31 16:35:31 sebastian Exp $ */ +/* $Id: info.h,v 1.29.2.1.2.1 2003/04/19 17:47:49 sas Exp $ */ #ifndef INFO_H #define INFO_H @@ -72,6 +72,7 @@ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header); 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_ex(int num_cols, const char *, ...); PHPAPI void php_info_print_table_start(void); PHPAPI void php_info_print_table_end(void); PHPAPI void php_info_print_box_start(int bg);