From c7c275b741d457367b26e8dafa5d2913bf2c75fd Mon Sep 17 00:00:00 2001 From: Colin Viebrock Date: Thu, 26 Sep 2002 17:54:54 +0000 Subject: [PATCH] fix phpinfo() output for better browser BC --- ext/standard/css.c | 88 +++++++------------------------------- ext/standard/info.c | 57 ++++++++++++++---------- main/php_ini.c | 6 +-- sapi/aolserver/aolserver.c | 2 +- sapi/apache/php_apache.c | 2 +- 5 files changed, 56 insertions(+), 99 deletions(-) diff --git a/ext/standard/css.c b/ext/standard/css.c index 5324174352..a3303875be 100644 --- a/ext/standard/css.c +++ b/ext/standard/css.c @@ -28,78 +28,22 @@ PHPAPI void php_info_print_css(void) { TSRMLS_FETCH(); - PUTS("body {"); - PUTS("background-color: #ffffff;"); - PUTS("color: #000000;"); - PUTS("font-family: verdana, arial, helvetica, sans-serif;"); - PUTS("}\n"); - PUTS("pre {"); - PUTS("font-family: \"andale mono\", \"monotype.com\", \"courier new\", courier, monospace;"); - PUTS("}\n"); - PUTS("a[href] {"); - PUTS("color: #000099;"); - PUTS("text-decoration: none;"); - PUTS("}\n"); - PUTS("a[href]:hover {"); - PUTS("text-decoration: underline;"); - PUTS("}\n"); - PUTS("table {"); - PUTS("border-collapse: collapse;"); - PUTS("width: 600px;"); - PUTS("font-size: 80%;"); - PUTS("}\n"); - PUTS(".centered {"); - PUTS("text-align: center;"); - PUTS("}\n"); - PUTS(".centered table {"); - PUTS("margin-left: auto;"); - PUTS("margin-right: auto;"); - PUTS("text-align: left;"); - PUTS("}\n"); - PUTS("td, th {"); - PUTS("vertical-align: baseline;"); - PUTS("padding: 3px;"); - PUTS("border: 1px solid #000000;"); - PUTS("}\n"); - PUTS("h1 {"); - PUTS("text-align: center;"); - PUTS("font-size: 160%;"); - PUTS("}\n"); - PUTS(".phpver {"); - PUTS("text-align: left;"); - PUTS("}\n"); - PUTS("h2 {"); - PUTS("text-align: center;"); - PUTS("font-size: 130%;"); - PUTS("}\n"); - PUTS(".entry {"); - PUTS("background-color: #ccccff;"); - PUTS("font-weight: bold;"); - PUTS("}\n"); - PUTS(".header {"); - PUTS("background-color: #9999cc;"); - PUTS("font-weight: bold;"); - PUTS("margin-left: auto;"); - PUTS("margin-right: auto;"); - PUTS("}\n"); - PUTS(".value {"); - PUTS("background-color: #cccccc;"); - PUTS("margin-left: auto;"); - PUTS("margin-right: auto;"); - PUTS("}\n"); - PUTS(".infobox {"); - PUTS("background-color: #cccccc;"); - PUTS("}\n"); - PUTS("img {"); - PUTS("float: right;"); - PUTS("border: 0px;"); - PUTS("}\n"); - PUTS("hr {"); - PUTS("width: 600px;"); - PUTS("background-color: #cccccc;"); - PUTS("border: 0px;"); - PUTS("height: 1px;"); - PUTS("}\n"); + PUTS("body {background-color: #ffffff; color: #000000;}\n"); + PUTS("body, td, th, h1, h2 {font-family: arial, helvetica, sans-serif;}\n"); + PUTS("pre {margin: 0px; font-family: \"andale mono\", \"monotype.com\", \"courier new\", courier, monospace;}\n"); + PUTS("a:link {color: #000099; text-decoration: none;}\n"); + PUTS("a:hover {text-decoration: underline;}\n"); + PUTS("table {border-collapse: collapse;}\n"); + PUTS("td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}\n"); + PUTS("h1 {font-size: 150%;}\n"); + PUTS(".p {text-align: left;}\n"); + PUTS("h2 {font-size: 125%;}\n"); + PUTS(".e {background-color: #ccccff; font-weight: bold;}\n"); + PUTS(".h {background-color: #9999cc; font-weight: bold;}\n"); + PUTS(".v {background-color: #cccccc;}\n"); + PUTS("i {color: #666666;}\n"); + PUTS("img {float: right; border: 0px;}\n"); + PUTS("hr {width: 600px; align: center; background-color: #cccccc; border: 0px; height: 1px;}\n"); } /* }}} */ diff --git a/ext/standard/info.c b/ext/standard/info.c index 227985b859..4f21a76f41 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -51,7 +51,7 @@ ZEND_EXTERN_MODULE_GLOBALS(iconv) #endif #define SECTION(name) if (PG(html_errors)) { \ - PUTS("

" name "

\n"); \ + PUTS("

" name "

\n"); \ } else { \ php_info_print_table_start(); \ php_info_print_table_header(1, name); \ @@ -68,7 +68,7 @@ static int _display_module_info(zend_module_entry *module, void *arg TSRMLS_DC) if (show_info_func && module->info_func) { if (PG(html_errors)) { - php_printf("

%s

\n", module->name, module->name); + php_printf("

%s

\n", module->name, module->name); } else { php_info_print_table_start(); php_info_print_table_header(1, module->name); @@ -105,7 +105,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { if (PG(html_errors)) { PUTS(""); - PUTS(""); + PUTS(""); } @@ -126,7 +126,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } PUTS("\"]"); if (PG(html_errors)) { - PUTS(""); + PUTS(""); } else { PUTS(" => "); } @@ -143,14 +143,22 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) zval_copy_ctor(&tmp2); convert_to_string(&tmp2); if (PG(html_errors)) { - zend_html_puts(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); + if (Z_STRLEN(tmp2) == 0) { + PUTS("no value"); + } else { + zend_html_puts(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); + } } else { PUTS(Z_STRVAL(tmp2)); } zval_dtor(&tmp2); } else { if (PG(html_errors)) { - zend_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + if (Z_STRLEN_PP(tmp) == 0) { + PUTS("no value"); + } else { + zend_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + } } else { PUTS(Z_STRVAL_PP(tmp)); } @@ -294,8 +302,8 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) } if (PG(html_errors)) { - php_printf("phpinfo()", charset); - PUTS(""); + php_printf("phpinfo()\n", charset); + PUTS("
\n"); } else { PUTS(" _ _ __ ____ \n"); PUTS(" _ __ | |__ _ __ (_)_ __ / _| ___ / /\\ \\ \n"); @@ -316,7 +324,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) } if (expose_php && PG(html_errors)) { - PUTS("PHP Version %s\n", PHP_VERSION); + php_printf("

PHP Version %s

\n", PHP_VERSION); } else { php_info_print_table_row(2, "PHP Version", PHP_VERSION); } @@ -406,7 +414,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) /* Zend Engine */ php_info_print_box_start(0); if (expose_php && PG(html_errors)) { - PUTS("
"); - PUTS("PHP 4 Credits"); + PUTS("PHP Credits"); PUTS("\n"); } @@ -451,6 +459,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) SECTION("Additional Modules"); php_info_print_table_start(); + php_info_print_table_header(1, "Module Name"); show_info_func = 0; zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC); php_info_print_table_end(); @@ -537,7 +546,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) } } if (PG(html_errors)) { - PUTS(""); + PUTS("
"); } } /* }}} */ @@ -548,7 +557,7 @@ PHPAPI void php_info_print_table_start() TSRMLS_FETCH(); if (PG(html_errors)) { - php_printf("
\n"); + php_printf("
\n"); } else { php_printf("\n"); } @@ -559,7 +568,7 @@ PHPAPI void php_info_print_table_end() TSRMLS_FETCH(); if (PG(html_errors)) { - php_printf("

\n"); + php_printf("
\n"); } } @@ -571,11 +580,11 @@ PHPAPI void php_info_print_box_start(int flag) php_info_print_table_start(); if (flag) { if (PG(html_errors)) { - php_printf("\n"); + php_printf("\n"); } } else { if (PG(html_errors)) { - php_printf("\n"); + php_printf("\n"); } else { php_printf("\n"); } @@ -610,7 +619,7 @@ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) TSRMLS_FETCH(); if (PG(html_errors)) { - php_printf("%s\n", num_cols, header ); + php_printf("%s\n", num_cols, header ); } else { spaces = (74 - strlen(header)); php_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " "); @@ -629,7 +638,7 @@ PHPAPI void php_info_print_table_header(int num_cols, ...) va_start(row_elements, num_cols); if (PG(html_errors)) { - php_printf(""); + php_printf(""); } for (i=0; i", - (i==0 ? "entry" : "value" ) + (i==0 ? "e" : "v" ) ); } row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { - PUTS( " " ); + if (PG(html_errors)) { + PUTS( "no value" ); + } else { + PUTS( " " ); + } } else { if (PG(html_errors)) { zend_html_puts(row_element, strlen(row_element)); @@ -691,7 +704,7 @@ PHPAPI void php_info_print_table_row(int num_cols, ...) } } if (PG(html_errors)) { - php_printf(""); + php_printf(" "); } } if (PG(html_errors)) { diff --git a/main/php_ini.c b/main/php_ini.c index e74b2c1209..41832500ed 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -101,11 +101,11 @@ static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number TSRMLS } if (PG(html_errors)) { PUTS(""); - PUTS(""); + PUTS(""); PHPWRITE(ini_entry->name, ini_entry->name_length-1); - PUTS(""); + PUTS(""); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE); - PUTS(""); + PUTS(""); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG); PUTS("\n"); } else { diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c index 1a8d1e4b17..1136d1dc1b 100644 --- a/sapi/aolserver/aolserver.c +++ b/sapi/aolserver/aolserver.c @@ -36,7 +36,7 @@ #endif #include "ext/standard/info.h" -#define SECTION(name) PUTS("

" name "

\n") +#define SECTION(name) PUTS("

" name "

\n") #define NS_BUF_SIZE 511 diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index 3bd2563e5b..4cde682d82 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -34,7 +34,7 @@ int php_apache_info_id; php_apache_info_struct php_apache_info; #endif -#define SECTION(name) PUTS("

" name "

\n") +#define SECTION(name) PUTS("

" name "

\n") extern module *top_module; -- 2.50.1