cmv Thu Sep 19 17:57:26 2002 EDT
Added files:
/php4/ext/standard css.c css.h
Modified files:
/php4/ext/standard config.m4 info.c
/php4/main php_ini.c
/php4/sapi/aolserver aolserver.c
/php4/sapi/apache php_apache.c
Log:
Change phpinfo() to use CSS styling instead of HTML code.
It doesn't render as nicely as it used to on older browsers, but it
does result in smaller files, and opens the door to using your own CSS
to style it differently.
There is a patch to Zend/zend_ini.c, but I don't have enough Karma, so
Derick has the patch.
Index: php4/ext/standard/config.m4
diff -u php4/ext/standard/config.m4:1.39 php4/ext/standard/config.m4:1.40
--- php4/ext/standard/config.m4:1.39 Fri Aug 2 06:08:53 2002
+++ php4/ext/standard/config.m4 Thu Sep 19 17:57:24 2002
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.39 2002/08/02 10:08:53 hholzgra Exp $ -*- sh -*-
+dnl $Id: config.m4,v 1.40 2002/09/19 21:57:24 cmv Exp $ -*- sh -*-
divert(3)dnl
@@ -240,7 +240,7 @@
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
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.203 php4/ext/standard/info.c:1.204
--- php4/ext/standard/info.c:1.203 Wed Sep 18 17:56:00 2002
+++ php4/ext/standard/info.c Thu Sep 19 17:57:24 2002
@@ -14,10 +14,11 @@
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <[EMAIL PROTECTED]> |
| Zeev Suraski <[EMAIL PROTECTED]> |
+ | Colin Viebrock <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.203 2002/09/18 21:56:00 imajes Exp $ */
+/* $Id: info.c,v 1.204 2002/09/19 21:57:24 cmv Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -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 @@
#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 @@
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 @@
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 @@
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 @@
}
PUTS("\"]");
if (PG(html_errors)) {
- PUTS("</b></td><td>");
+ PUTS("</td><td class=\"value\">");
} else {
PUTS(" => ");
}
@@ -154,7 +156,7 @@
}
}
if (PG(html_errors)) {
- PUTS(" </td></tr>\n");
+ PUTS("</td></tr>\n");
} else {
PUTS("\n");
}
@@ -169,12 +171,7 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
TSRMLS_FETCH();
if (PG(html_errors)) {
- php_printf("</table><br />\n");
+ php_printf("</tbody></table></div><br />\n");
}
}
@@ -573,11 +571,11 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
}
if (PG(html_errors)) {
- php_printf("%s</td>", (i==0?"</b>":""));
+ php_printf("</td>");
}
}
if (PG(html_errors)) {
Index: php4/main/php_ini.c
diff -u php4/main/php_ini.c:1.100 php4/main/php_ini.c:1.101
--- php4/main/php_ini.c:1.100 Mon Sep 9 07:43:50 2002
+++ php4/main/php_ini.c Thu Sep 19 17:57:24 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ini.c,v 1.100 2002/09/09 11:43:50 hyanantha Exp $ */
+/* $Id: php_ini.c,v 1.101 2002/09/19 21:57:24 cmv Exp $ */
/* Check CWD for php.ini */
#define INI_CHECK_CWD
@@ -100,12 +100,12 @@
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 {
Index: php4/sapi/aolserver/aolserver.c
diff -u php4/sapi/aolserver/aolserver.c:1.70 php4/sapi/aolserver/aolserver.c:1.71
--- php4/sapi/aolserver/aolserver.c:1.70 Wed Sep 18 17:57:30 2002
+++ php4/sapi/aolserver/aolserver.c Thu Sep 19 17:57:24 2002
@@ -22,7 +22,7 @@
* - CGI/1.1 conformance
*/
-/* $Id: aolserver.c,v 1.70 2002/09/18 21:57:30 zeev Exp $ */
+/* $Id: aolserver.c,v 1.71 2002/09/19 21:57:24 cmv Exp $ */
/* conflict between PHP and AOLserver headers */
#define Debug php_Debug
@@ -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
@@ -205,7 +205,7 @@
int i;
php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.70
2002/09/18 21:57:30 zeev Exp $");
+ php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.71
+2002/09/19 21:57:24 cmv Exp $");
php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
Index: php4/sapi/apache/php_apache.c
diff -u php4/sapi/apache/php_apache.c:1.66 php4/sapi/apache/php_apache.c:1.67
--- php4/sapi/apache/php_apache.c:1.66 Tue Aug 13 00:03:20 2002
+++ php4/sapi/apache/php_apache.c Thu Sep 19 17:57:25 2002
@@ -17,7 +17,7 @@
| David Sklar <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_apache.c,v 1.66 2002/08/13 04:03:20 rasmus Exp $ */
+/* $Id: php_apache.c,v 1.67 2002/09/19 21:57:25 cmv Exp $ */
#include "php_apache_http.h"
@@ -34,7 +34,7 @@
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;
Index: php4/ext/standard/css.c
+++ php4/ext/standard/css.c
/*
+----------------------------------------------------------------------+
| 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 |
| [EMAIL PROTECTED] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Colin Viebrock <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
/* $Id: css.c,v 1.1 2002/09/19 21:57:24 cmv Exp $ */
#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
*/
Index: php4/ext/standard/css.h
+++ php4/ext/standard/css.h
/*
+----------------------------------------------------------------------+
| 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 |
| [EMAIL PROTECTED] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Colin Viebrock <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
/* $Id: css.h,v 1.1 2002/09/19 21:57:24 cmv Exp $ */
#ifndef CSS_H
#define CSS_H
PHPAPI void php_info_print_css(void);
#endif
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php