helly Tue Mar 18 15:52:52 2003 EDT Modified files: /php4/ext/standard info.c /php4/main SAPI.h /php4/sapi/cli php_cli.c Log: make phpinfo() depend on executed sapi
Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.228 php4/ext/standard/info.c:1.229 --- php4/ext/standard/info.c:1.228 Sun Mar 2 08:35:01 2003 +++ php4/ext/standard/info.c Tue Mar 18 15:52:51 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.228 2003/03/02 13:35:01 zeev Exp $ */ +/* $Id: info.c,v 1.229 2003/03/18 20:52:51 helly Exp $ */ #include "php.h" #include "php_ini.h" @@ -48,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(); \ @@ -66,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(); @@ -75,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); @@ -105,7 +105,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\">"); @@ -116,7 +116,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); @@ -129,24 +129,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 TSRMLS_CC); - 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 { @@ -159,7 +159,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 { @@ -171,7 +171,7 @@ PUTS(Z_STRVAL_PP(tmp)); } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</td></tr>\n"); } else { PUTS("\n"); @@ -391,7 +391,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"); @@ -403,11 +403,11 @@ 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); @@ -419,7 +419,7 @@ } } - 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); @@ -505,7 +505,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); @@ -513,13 +513,13 @@ 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(!sapi_module.phpinfo_as_text?"<br />":"\n"); zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC); 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) { @@ -534,7 +534,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"); @@ -613,7 +613,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"); @@ -645,7 +645,7 @@ PUTS("questions about PHP licensing, please contact [EMAIL PROTECTED]"); } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS("</div></body></html>"); } } @@ -654,9 +654,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"); @@ -665,9 +663,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"); } @@ -675,15 +671,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"); @@ -693,9 +687,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(); @@ -703,9 +695,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"); @@ -716,9 +706,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)); @@ -737,7 +725,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++) { @@ -745,7 +733,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>"); @@ -758,7 +746,7 @@ } } } - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf("</tr>\n"); } @@ -781,24 +769,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" ) ); } 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); @@ -809,13 +797,13 @@ } } } - 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"); } Index: php4/main/SAPI.h diff -u php4/main/SAPI.h:1.101 php4/main/SAPI.h:1.102 --- php4/main/SAPI.h:1.101 Tue Mar 18 10:53:33 2003 +++ php4/main/SAPI.h Tue Mar 18 15:52:51 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: SAPI.h,v 1.101 2003/03/18 15:53:33 helly Exp $ */ +/* $Id: SAPI.h,v 1.102 2003/03/18 20:52:51 helly Exp $ */ #ifndef SAPI_H #define SAPI_H @@ -243,6 +243,7 @@ unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len TSRMLS_DC); void (*ini_defaults)(HashTable *configuration_hash); + int phpinfo_as_text; }; Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.72 php4/sapi/cli/php_cli.c:1.73 --- php4/sapi/cli/php_cli.c:1.72 Tue Mar 18 10:56:12 2003 +++ php4/sapi/cli/php_cli.c Tue Mar 18 15:52:52 2003 @@ -549,6 +549,7 @@ #endif cli_sapi_module.ini_defaults = sapi_cli_ini_defaults; + cli_sapi_module.phpinfo_as_text = 1; sapi_startup(&cli_sapi_module); #ifdef PHP_WIN32
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php