Skip to content

Commit ff93287

Browse files
committed
Bringing CSS up to this decade's standards.
Here are some tweaks to the phpinfo() styling, since this really hasn't been touched in almost a decade: - color codes are shortened - table width is bigger and handled via CSS - fix so that long INI entries don't make the layout super wide - bgcolor for "Additional Modules" wasn't set - fix my email address Signed-off-by: Colin Viebrock <[email protected]>
1 parent e383d4d commit ff93287

File tree

3 files changed

+51
-52
lines changed

3 files changed

+51
-52
lines changed

ext/standard/css.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
+----------------------------------------------------------------------+
33
| PHP Version 5 |
44
+----------------------------------------------------------------------+
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Colin Viebrock <colin@easydns.com> |
15+
| Authors: Colin Viebrock <colin@viebrock.ca> |
1616
+----------------------------------------------------------------------+
1717
*/
1818

@@ -23,25 +23,24 @@
2323

2424
PHPAPI void php_info_print_css(TSRMLS_D) /* {{{ */
2525
{
26-
PUTS("body {background-color: #ffffff; color: #000000;}\n");
27-
PUTS("body, td, th, h1, h2 {font-family: sans-serif;}\n");
28-
PUTS("pre {margin: 0px; font-family: monospace;}\n");
29-
PUTS("a:link {color: #000099; text-decoration: none; background-color: #ffffff;}\n");
26+
PUTS("body {background-color: #fff; color: #000; font-family: sans-serif;}\n");
27+
PUTS("pre {margin: 0; font-family: monospace;}\n");
28+
PUTS("a:link {color: #009; text-decoration: none; background-color: #fff;}\n");
3029
PUTS("a:hover {text-decoration: underline;}\n");
31-
PUTS("table {border-collapse: collapse;}\n");
30+
PUTS("table {border-collapse: collapse; border: 0; width: 75%; min-width: 600px;}\n");
3231
PUTS(".center {text-align: center;}\n");
33-
PUTS(".center table { margin-left: auto; margin-right: auto; text-align: left;}\n");
34-
PUTS(".center th { text-align: center !important; }\n");
35-
PUTS("td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}\n");
32+
PUTS(".center table {margin: 0 auto; text-align: left;}\n");
33+
PUTS(".center th {text-align: center !important;}\n");
34+
PUTS("td, th {border: 1px solid #000; font-size: 75%; vertical-align: baseline; padding: 3px 5px;}\n");
3635
PUTS("h1 {font-size: 150%;}\n");
3736
PUTS("h2 {font-size: 125%;}\n");
3837
PUTS(".p {text-align: left;}\n");
39-
PUTS(".e {background-color: #ccccff; font-weight: bold; color: #000000;}\n");
40-
PUTS(".h {background-color: #9999cc; font-weight: bold; color: #000000;}\n");
41-
PUTS(".v {background-color: #cccccc; color: #000000;}\n");
42-
PUTS(".vr {background-color: #cccccc; text-align: right; color: #000000;}\n");
43-
PUTS("img {float: right; border: 0px;}\n");
44-
PUTS("hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}\n");
38+
PUTS(".e {background-color: #ccf; font-weight: bold;}\n");
39+
PUTS(".h {background-color: #99c; font-weight: bold;}\n");
40+
PUTS(".v {background-color: #ccc; max-width: 20em; overflow-y: scroll;}\n");
41+
PUTS(".v i {color: #999;}\n");
42+
PUTS("img {float: right; border: 0;}\n");
43+
PUTS("hr {width: 800px; background-color: #ccc; border: 0; height: 1px;}\n");
4544
}
4645
/* }}} */
4746

ext/standard/css.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
+----------------------------------------------------------------------+
33
| PHP Version 5 |
44
+----------------------------------------------------------------------+
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Colin Viebrock <colin@easydns.com> |
15+
| Authors: Colin Viebrock <colin@viebrock.ca> |
1616
+----------------------------------------------------------------------+
1717
*/
1818

ext/standard/info.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
+----------------------------------------------------------------------+
33
| PHP Version 5 |
44
+----------------------------------------------------------------------+
@@ -14,7 +14,7 @@
1414
+----------------------------------------------------------------------+
1515
| Authors: Rasmus Lerdorf <[email protected]> |
1616
| Zeev Suraski <[email protected]> |
17-
| Colin Viebrock <colin@easydns.com> |
17+
| Colin Viebrock <colin@viebrock.ca> |
1818
+----------------------------------------------------------------------+
1919
*/
2020

@@ -67,7 +67,7 @@ static int php_info_print_html_esc(const char *str, int len) /* {{{ */
6767
int written;
6868
char *new_str;
6969
TSRMLS_FETCH();
70-
70+
7171
new_str = php_escape_html_entities((unsigned char *) str, len, &new_len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC);
7272
written = php_output_write(new_str, new_len TSRMLS_CC);
7373
efree(new_str);
@@ -81,11 +81,11 @@ static int php_info_printf(const char *fmt, ...) /* {{{ */
8181
int len, written;
8282
va_list argv;
8383
TSRMLS_FETCH();
84-
84+
8585
va_start(argv, fmt);
8686
len = vspprintf(&buf, 0, fmt, argv);
8787
va_end(argv);
88-
88+
8989
written = php_output_write(buf, len TSRMLS_CC);
9090
efree(buf);
9191
return written;
@@ -103,7 +103,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC
103103
{
104104
char *key;
105105
uint len;
106-
106+
107107
if (ht) {
108108
if (zend_hash_num_elements(ht)) {
109109
HashPosition pos;
@@ -113,7 +113,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC
113113
} else {
114114
php_info_printf("\nRegistered %s => ", name);
115115
}
116-
116+
117117
zend_hash_internal_pointer_reset_ex(ht, &pos);
118118
while (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING)
119119
{
@@ -125,7 +125,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC
125125
break;
126126
}
127127
}
128-
128+
129129
if (!sapi_module.phpinfo_as_text) {
130130
php_info_print("</td></tr>\n");
131131
}
@@ -160,10 +160,10 @@ PHPAPI void php_info_print_module(zend_module_entry *zend_module TSRMLS_DC) /* {
160160
}
161161
} else {
162162
if (!sapi_module.phpinfo_as_text) {
163-
php_info_printf("<tr><td>%s</td></tr>\n", zend_module->name);
163+
php_info_printf("<tr><td class=\"v\">%s</td></tr>\n", zend_module->name);
164164
} else {
165165
php_info_printf("%s\n", zend_module->name);
166-
}
166+
}
167167
}
168168
}
169169
/* }}} */
@@ -208,7 +208,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
208208

209209
php_info_print(name);
210210
php_info_print("[\"");
211-
211+
212212
switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) {
213213
case HASH_KEY_IS_STRING:
214214
if (!sapi_module.phpinfo_as_text) {
@@ -432,7 +432,7 @@ char* php_get_windows_name()
432432
sub = "Web Edition";
433433
else sub = "Standard Edition";
434434
}
435-
}
435+
}
436436
}
437437

438438
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) {
@@ -525,7 +525,7 @@ PHPAPI char *php_get_uname(char mode)
525525
DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
526526
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
527527
char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
528-
528+
529529
GetComputerName(ComputerName, &dwSize);
530530

531531
if (mode == 's') {
@@ -574,7 +574,7 @@ PHPAPI char *php_get_uname(char mode)
574574
if (mode == 's') {
575575
php_uname = buf.sysname;
576576
} else if (mode == 'r') {
577-
snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d",
577+
snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d",
578578
buf.netware_major, buf.netware_minor, buf.netware_revision);
579579
php_uname = tmp_uname;
580580
} else if (mode == 'n') {
@@ -664,7 +664,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
664664
char temp_api[10];
665665

666666
php_uname = php_get_uname('a');
667-
667+
668668
if (!sapi_module.phpinfo_as_text) {
669669
php_info_print_box_start(1);
670670
}
@@ -688,7 +688,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
688688
php_info_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION);
689689
} else {
690690
php_info_print_table_row(2, "PHP Version", PHP_VERSION);
691-
}
691+
}
692692
php_info_print_box_end();
693693
php_info_print_table_start();
694694
php_info_print_table_row(2, "System", php_uname );
@@ -773,7 +773,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
773773
#else
774774
php_info_print_table_row(2, "DTrace Support", "disabled" );
775775
#endif
776-
776+
777777
php_info_print_stream_hash("PHP Streams", php_stream_get_url_stream_wrappers_hash() TSRMLS_CC);
778778
php_info_print_stream_hash("Stream Socket Transports", php_stream_xport_get_hash() TSRMLS_CC);
779779
php_info_print_stream_hash("Stream Filters", php_get_stream_filters_hash() TSRMLS_CC);
@@ -805,7 +805,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
805805
php_info_print("<h1>Configuration</h1>\n");
806806
} else {
807807
SECTION("Configuration");
808-
}
808+
}
809809
if (!(flag & PHP_INFO_MODULES)) {
810810
SECTION("PHP Core");
811811
display_ini_entries(NULL);
@@ -879,7 +879,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
879879
}
880880

881881

882-
if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) {
882+
if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) {
883883
php_info_print_hr();
884884
php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE TSRMLS_CC);
885885
}
@@ -920,17 +920,17 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
920920

921921
if (!sapi_module.phpinfo_as_text) {
922922
php_info_print("</div></body></html>");
923-
}
923+
}
924924
}
925925
/* }}} */
926926

927927
PHPAPI void php_info_print_table_start(void) /* {{{ */
928928
{
929929
if (!sapi_module.phpinfo_as_text) {
930-
php_info_print("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n");
930+
php_info_print("<table>\n");
931931
} else {
932932
php_info_print("\n");
933-
}
933+
}
934934
}
935935
/* }}} */
936936

@@ -955,7 +955,7 @@ PHPAPI void php_info_print_box_start(int flag) /* {{{ */
955955
php_info_print("<tr class=\"v\"><td>\n");
956956
} else {
957957
php_info_print("\n");
958-
}
958+
}
959959
}
960960
}
961961
/* }}} */
@@ -988,7 +988,7 @@ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) /* {
988988
} else {
989989
spaces = (74 - strlen(header));
990990
php_info_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " ");
991-
}
991+
}
992992
}
993993
/* }}} */
994994

@@ -1003,7 +1003,7 @@ PHPAPI void php_info_print_table_header(int num_cols, ...)
10031003
va_start(row_elements, num_cols);
10041004
if (!sapi_module.phpinfo_as_text) {
10051005
php_info_print("<tr class=\"h\">");
1006-
}
1006+
}
10071007
for (i=0; i<num_cols; i++) {
10081008
row_element = va_arg(row_elements, char *);
10091009
if (!row_element || !*row_element) {
@@ -1032,21 +1032,21 @@ PHPAPI void php_info_print_table_header(int num_cols, ...)
10321032

10331033
/* {{{ php_info_print_table_row_internal
10341034
*/
1035-
static void php_info_print_table_row_internal(int num_cols,
1035+
static void php_info_print_table_row_internal(int num_cols,
10361036
const char *value_class, va_list row_elements)
10371037
{
10381038
int i;
10391039
char *row_element;
10401040

10411041
if (!sapi_module.phpinfo_as_text) {
10421042
php_info_print("<tr>");
1043-
}
1043+
}
10441044
for (i=0; i<num_cols; i++) {
10451045
if (!sapi_module.phpinfo_as_text) {
10461046
php_info_printf("<td class=\"%s\">",
10471047
(i==0 ? "e" : value_class )
10481048
);
1049-
}
1049+
}
10501050
row_element = va_arg(row_elements, char *);
10511051
if (!row_element || !*row_element) {
10521052
if (!sapi_module.phpinfo_as_text) {
@@ -1061,7 +1061,7 @@ static void php_info_print_table_row_internal(int num_cols,
10611061
php_info_print(row_element);
10621062
if (i < num_cols-1) {
10631063
php_info_print(" => ");
1064-
}
1064+
}
10651065
}
10661066
}
10671067
if (!sapi_module.phpinfo_as_text) {
@@ -1081,7 +1081,7 @@ static void php_info_print_table_row_internal(int num_cols,
10811081
PHPAPI void php_info_print_table_row(int num_cols, ...)
10821082
{
10831083
va_list row_elements;
1084-
1084+
10851085
va_start(row_elements, num_cols);
10861086
php_info_print_table_row_internal(num_cols, "v", row_elements);
10871087
va_end(row_elements);
@@ -1090,11 +1090,11 @@ PHPAPI void php_info_print_table_row(int num_cols, ...)
10901090

10911091
/* {{{ php_info_print_table_row_ex
10921092
*/
1093-
PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class,
1093+
PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class,
10941094
...)
10951095
{
10961096
va_list row_elements;
1097-
1097+
10981098
va_start(row_elements, value_class);
10991099
php_info_print_table_row_internal(num_cols, value_class, row_elements);
11001100
va_end(row_elements);
@@ -1222,7 +1222,7 @@ PHP_FUNCTION(php_ini_scanned_files)
12221222
if (zend_parse_parameters_none() == FAILURE) {
12231223
return;
12241224
}
1225-
1225+
12261226
if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) {
12271227
RETURN_STRING(php_ini_scanned_files, 1);
12281228
} else {
@@ -1238,7 +1238,7 @@ PHP_FUNCTION(php_ini_loaded_file)
12381238
if (zend_parse_parameters_none() == FAILURE) {
12391239
return;
12401240
}
1241-
1241+
12421242
if (php_ini_opened_path) {
12431243
RETURN_STRING(php_ini_opened_path, 1);
12441244
} else {

0 commit comments

Comments
 (0)