diff options
| -rw-r--r-- | ext/standard/config.m4 | 2 | ||||
| -rw-r--r-- | ext/standard/css.c | 114 | ||||
| -rw-r--r-- | ext/standard/css.h | 26 | ||||
| -rw-r--r-- | ext/standard/info.c | 72 | ||||
| -rw-r--r-- | main/php_ini.c | 8 | ||||
| -rw-r--r-- | sapi/aolserver/aolserver.c | 2 | ||||
| -rw-r--r-- | sapi/apache/php_apache.c | 2 |
7 files changed, 182 insertions, 44 deletions
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 8fc91f6bc2..c3bf1d24b0 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -240,7 +240,7 @@ PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32. parsedate.c quot_print.c rand.c reg.c soundex.c string.c scanf.c \ syslog.c type.c uniqid.c url.c url_scanner.c var.c versioning.c assert.c \ strnatcmp.c levenshtein.c incomplete_class.c url_scanner_ex.c \ - ftp_fopen_wrapper.c http_fopen_wrapper.c php_fopen_wrapper.c credits.c \ + ftp_fopen_wrapper.c http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \ var_unserializer.c ftok.c aggregation.c sha1.c ) PHP_ADD_MAKEFILE_FRAGMENT diff --git a/ext/standard/css.c b/ext/standard/css.c new file mode 100644 index 0000000000..5324174352 --- /dev/null +++ b/ext/standard/css.c @@ -0,0 +1,114 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 4 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2002 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.02 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Colin Viebrock <colin@easydns.com> | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "php.h" +#include "info.h" + + +/* {{{ php_info_print_css + */ +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"); + +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/standard/css.h b/ext/standard/css.h new file mode 100644 index 0000000000..33888d1550 --- /dev/null +++ b/ext/standard/css.h @@ -0,0 +1,26 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 4 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2002 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.02 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Colin Viebrock <colin@easydns.com> | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef CSS_H +#define CSS_H + +PHPAPI void php_info_print_css(void); + +#endif diff --git a/ext/standard/info.c b/ext/standard/info.c index 15c0c917e2..227985b859 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -14,6 +14,7 @@ +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf <rasmus@php.net> | | Zeev Suraski <zeev@zend.com> | + | Colin Viebrock <colin@easydns.com> | +----------------------------------------------------------------------+ */ @@ -25,6 +26,7 @@ #include "ext/standard/head.h" #include "info.h" #include "credits.h" +#include "css.h" #include "SAPI.h" #include <time.h> #include "php_main.h" @@ -49,7 +51,7 @@ ZEND_EXTERN_MODULE_GLOBALS(iconv) #endif #define SECTION(name) if (PG(html_errors)) { \ - PUTS("<h2 align=\"center\">" name "</h2>\n"); \ + PUTS("<h2 class=\"section\">" name "</h2>\n"); \ } else { \ php_info_print_table_start(); \ php_info_print_table_header(1, name); \ @@ -66,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("<h2 align=\"center\"><a name=\"module_%s\">%s</a></h2>\n", module->name, module->name); + php_printf("<h2 class=\"section\"><a name=\"module_%s\">%s</a></h2>\n", module->name, module->name); } else { php_info_print_table_start(); php_info_print_table_header(1, module->name); @@ -75,7 +77,7 @@ static int _display_module_info(zend_module_entry *module, void *arg TSRMLS_DC) module->info_func(module TSRMLS_CC); } else if (!show_info_func && !module->info_func) { if (PG(html_errors)) { - php_printf("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); + php_printf("<tr>"); php_printf("<td>"); php_printf("%s", module->name); php_printf("</td></tr>\n"); @@ -102,8 +104,8 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) 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)) { - PUTS("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); - PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>"); + PUTS("<tr>"); + PUTS("<td class=\"entry\">"); } @@ -124,7 +126,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } PUTS("\"]"); if (PG(html_errors)) { - PUTS("</b></td><td>"); + PUTS("</td><td class=\"value\">"); } else { PUTS(" => "); } @@ -154,7 +156,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } } if (PG(html_errors)) { - PUTS(" </td></tr>\n"); + PUTS("</td></tr>\n"); } else { PUTS("\n"); } @@ -169,12 +171,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) void php_info_print_style(void) { php_printf("<style type=\"text/css\"><!--\n"); - php_printf("a { text-decoration: none; }\n"); - php_printf("a:hover { text-decoration: underline; }\n"); - php_printf("h1 { font-family: arial, helvetica, sans-serif; font-size: 18pt; font-weight: bold;}\n"); - php_printf("h2 { font-family: arial, helvetica, sans-serif; font-size: 14pt; font-weight: bold;}\n"); - php_printf("body, td { font-family: arial, helvetica, sans-serif; font-size: 10pt; }\n"); - php_printf("th { font-family: arial, helvetica, sans-serif; font-size: 11pt; font-weight: bold; }\n"); + php_info_print_css(); php_printf("//--></style>\n"); } /* }}} */ @@ -270,7 +267,8 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) the_time = time(NULL); ta = php_localtime_r(&the_time, &tmbuf); if (PG(html_errors)) { - PUTS("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n"); + PUTS("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">"); + PUTS("<html>"); PUTS("<head>"); php_info_print_style(); if (SG(default_charset)) { @@ -296,8 +294,8 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) } if (PG(html_errors)) { - php_printf("<title>phpinfo()</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"></head>", charset); - PUTS("<body text=\"#000000\" bgcolor=\"#ffffff\" link=\"#0000ff\" vlink=\"#ff00ff\" alink=\"#0000ff\">"); + php_printf("<title>phpinfo()</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" /></head>", charset); + PUTS("<body>"); } else { PUTS(" _ _ __ ____ \n"); PUTS(" _ __ | |__ _ __ (_)_ __ / _| ___ / /\\ \\ \n"); @@ -323,14 +321,14 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) PUTS(SG(request_info).request_uri); } if ((ta->tm_mon==3) && (ta->tm_mday==1)) { - PUTS("?="PHP_EGG_LOGO_GUID"\" border=0 align=\"right\" alt=\"Thies!\"></a>"); + PUTS("?="PHP_EGG_LOGO_GUID"\" alt=\"Thies!\" /></a>"); } else { - PUTS("?="PHP_LOGO_GUID"\" border=0 align=\"right\" alt=\"PHP Logo\"></a>"); + PUTS("?="PHP_LOGO_GUID"\" alt=\"PHP Logo\" /></a>"); } } if (PG(html_errors)) { - php_printf("<h1>PHP Version %s</h1>\n", PHP_VERSION); + php_printf("<h1 class=\"phpver\">PHP Version %s</h1>\n", PHP_VERSION); } else { php_info_print_table_row(2, "PHP Version", PHP_VERSION); } @@ -412,7 +410,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if (SG(request_info).request_uri) { PUTS(SG(request_info).request_uri); } - PUTS("?="ZEND_LOGO_GUID"\" border=\"0\" align=\"right\" alt=\"Zend logo\"></a>\n"); + 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"); @@ -423,7 +421,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if ((flag & PHP_INFO_CREDITS) && expose_php && PG(html_errors)) { php_info_print_hr(); - PUTS("<h1 align=\"center\"><a href=\""); + PUTS("<h1><a href=\""); if (SG(request_info).request_uri) { PUTS(SG(request_info).request_uri); } @@ -437,11 +435,11 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if (flag & PHP_INFO_CONFIGURATION) { php_info_print_hr(); if (PG(html_errors)) { - PUTS("<h1 align=\"center\">Configuration</h1>\n"); + PUTS("<h1>Configuration</h1>\n"); } else { SECTION("Configuration"); } - SECTION("PHP Core\n"); + SECTION("PHP Core"); display_ini_entries(NULL); } @@ -550,7 +548,7 @@ PHPAPI void php_info_print_table_start() TSRMLS_FETCH(); if (PG(html_errors)) { - php_printf("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"600\" bgcolor=\"#000000\" align=\"center\">\n"); + php_printf("<div class=\"centered\"><table><tbody>\n"); } else { php_printf("\n"); } @@ -561,7 +559,7 @@ PHPAPI void php_info_print_table_end() TSRMLS_FETCH(); if (PG(html_errors)) { - php_printf("</table><br />\n"); + php_printf("</tbody></table></div><br />\n"); } } @@ -573,11 +571,11 @@ PHPAPI void php_info_print_box_start(int flag) php_info_print_table_start(); if (flag) { if (PG(html_errors)) { - php_printf("<tr valign=\"middle\" bgcolor=\"" PHP_HEADER_COLOR "\"><td align=\"left\">\n"); + php_printf("<tr class=\"header\"><td>\n"); } } else { if (PG(html_errors)) { - php_printf("<tr valign=\"top\" bgcolor=\"" PHP_CONTENTS_COLOR "\"><td align=\"left\">\n"); + php_printf("<tr class=\"infobox\"><td>\n"); } else { php_printf("\n"); } @@ -599,7 +597,7 @@ PHPAPI void php_info_print_hr() TSRMLS_FETCH(); if (PG(html_errors)) { - php_printf("<hr noshade size=\"1\" width=\"600\">\n"); + php_printf("<hr />\n"); } else { php_printf("\n\n _______________________________________________________________________\n\n"); } @@ -612,7 +610,7 @@ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) TSRMLS_FETCH(); if (PG(html_errors)) { - php_printf("<tr bgcolor=\"" PHP_HEADER_COLOR "\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header ); + php_printf("<tr class=\"header\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header ); } else { spaces = (74 - strlen(header)); php_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " "); @@ -631,12 +629,12 @@ PHPAPI void php_info_print_table_header(int num_cols, ...) va_start(row_elements, num_cols); if (PG(html_errors)) { - php_printf("<tr valign=\"middle\" bgcolor=\"" PHP_HEADER_COLOR "\">"); + php_printf("<tr class=\"header\">"); } for (i=0; i<num_cols; i++) { row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { - row_element = PG(html_errors)?" ":" "; + row_element = " "; } if (PG(html_errors)) { php_printf("<th>%s</th>", row_element); @@ -669,17 +667,17 @@ PHPAPI void php_info_print_table_row(int num_cols, ...) va_start(row_elements, num_cols); if (PG(html_errors)) { - php_printf("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); + php_printf("<tr>"); } for (i=0; i<num_cols; i++) { if (PG(html_errors)) { - php_printf("<td %s>%s", - (i==0?"bgcolor=\"" PHP_ENTRY_NAME_COLOR "\" ":"align=\"left\""), - (i==0?"<b>":"")); + php_printf("<td class=\"%s\">", + (i==0 ? "entry" : "value" ) + ); } row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { - PUTS(PG(html_errors)?" ":" "); + PUTS( " " ); } else { if (PG(html_errors)) { zend_html_puts(row_element, strlen(row_element)); @@ -693,7 +691,7 @@ PHPAPI void php_info_print_table_row(int num_cols, ...) } } if (PG(html_errors)) { - php_printf("%s</td>", (i==0?"</b>":"")); + php_printf("</td>"); } } if (PG(html_errors)) { diff --git a/main/php_ini.c b/main/php_ini.c index fcc8373a9b..6349f9d722 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -100,12 +100,12 @@ static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number TSRMLS return 0; } if (PG(html_errors)) { - PUTS("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); - PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>"); + PUTS("<tr>"); + PUTS("<td class=\"entry\">"); PHPWRITE(ini_entry->name, ini_entry->name_length-1); - PUTS("</b><br /></td><td align=\"center\">"); + PUTS("</td><td class=\"value\">"); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE); - PUTS("</td><td align=\"center\">"); + PUTS("</td><td class=\"value\">"); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG); PUTS("</td></tr>\n"); } else { diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c index 3131d69d71..1a8d1e4b17 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("<H2 align=\"center\">" name "</H2>\n") +#define SECTION(name) PUTS("<h2 class=\"section\">" name "</h2>\n") #define NS_BUF_SIZE 511 diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index 99cb694fcc..3bd2563e5b 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("<H2 align=\"center\">" name "</H2>\n") +#define SECTION(name) PUTS("<h2 class=\"section\">" name "</h2>\n") extern module *top_module; |
