diff options
| -rw-r--r-- | suhosin.c | 30 |
1 files changed, 6 insertions, 24 deletions
| @@ -32,7 +32,9 @@ | |||
| 32 | #include "zend_llist.h" | 32 | #include "zend_llist.h" |
| 33 | #include "zend_operators.h" | 33 | #include "zend_operators.h" |
| 34 | #include "SAPI.h" | 34 | #include "SAPI.h" |
| 35 | #if PHP_VERSION_ID < 50500 | ||
| 35 | #include "php_logos.h" | 36 | #include "php_logos.h" |
| 37 | #endif | ||
| 36 | #include "suhosin_logo.h" | 38 | #include "suhosin_logo.h" |
| 37 | #include "ext/standard/php_string.h" | 39 | #include "ext/standard/php_string.h" |
| 38 | #include "ext/standard/url.h" | 40 | #include "ext/standard/url.h" |
| @@ -1115,8 +1117,10 @@ PHP_MINIT_FUNCTION(suhosin) | |||
| 1115 | suhosin_hook_sha256(); | 1117 | suhosin_hook_sha256(); |
| 1116 | suhosin_hook_ex_imp(); | 1118 | suhosin_hook_ex_imp(); |
| 1117 | 1119 | ||
| 1120 | #if PHP_VERSION_ID < 50500 | ||
| 1118 | /* register the logo for phpinfo */ | 1121 | /* register the logo for phpinfo */ |
| 1119 | php_register_info_logo(SUHOSIN_LOGO_GUID, "image/jpeg", suhosin_logo, sizeof(suhosin_logo)); | 1122 | php_register_info_logo(SUHOSIN_LOGO_GUID, "image/jpeg", suhosin_logo, sizeof(suhosin_logo)); |
| 1123 | #endif | ||
| 1120 | 1124 | ||
| 1121 | #if PHP_MAJOR_VERSION < 5 | 1125 | #if PHP_MAJOR_VERSION < 5 |
| 1122 | php_error_docref(NULL TSRMLS_CC, E_ERROR, "Suhosin Extension is not designed to run with PHP 4 and below. Erroring Out."); | 1126 | php_error_docref(NULL TSRMLS_CC, E_ERROR, "Suhosin Extension is not designed to run with PHP 4 and below. Erroring Out."); |
| @@ -1211,32 +1215,10 @@ PHP_MINFO_FUNCTION(suhosin) | |||
| 1211 | { | 1215 | { |
| 1212 | php_info_print_box_start(0); | 1216 | php_info_print_box_start(0); |
| 1213 | if (!sapi_module.phpinfo_as_text) { | 1217 | if (!sapi_module.phpinfo_as_text) { |
| 1214 | if (PG(expose_php)) { | 1218 | do { |
| 1215 | PUTS("<a href=\"http://www.suhosin.org/\"><img border=\"0\" src=\""); | ||
| 1216 | if (SG(request_info).request_uri) { | ||
| 1217 | char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC); | ||
| 1218 | PUTS(elem_esc); | ||
| 1219 | efree(elem_esc); | ||
| 1220 | } | ||
| 1221 | PUTS("?="SUHOSIN_LOGO_GUID"\" alt=\"Suhosin logo\" /></a>\n"); | ||
| 1222 | } else do { | ||
| 1223 | char *enc_logo; | 1219 | char *enc_logo; |
| 1224 | int ret; | 1220 | int ret; |
| 1225 | zval **agent_name; | 1221 | |
| 1226 | |||
| 1227 | #ifdef ZEND_ENGINE_2 | ||
| 1228 | zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC); | ||
| 1229 | #endif | ||
| 1230 | if (!PG(http_globals)[TRACK_VARS_SERVER] || | ||
| 1231 | zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &agent_name)==FAILURE) { | ||
| 1232 | break; | ||
| 1233 | } | ||
| 1234 | if (Z_TYPE_PP(agent_name) != IS_STRING) { | ||
| 1235 | break; | ||
| 1236 | } | ||
| 1237 | if (strstr(Z_STRVAL_PP(agent_name), "Gecko") == NULL && strstr(Z_STRVAL_PP(agent_name), "Opera") == NULL) { | ||
| 1238 | break; | ||
| 1239 | } | ||
| 1240 | PUTS("<a href=\"http://www.suhosin.org/\"><img border=\"0\" src=\"data:image/jpeg;base64,"); | 1222 | PUTS("<a href=\"http://www.suhosin.org/\"><img border=\"0\" src=\"data:image/jpeg;base64,"); |
| 1241 | enc_logo=(char *)php_base64_encode(suhosin_logo, sizeof(suhosin_logo), &ret); | 1223 | enc_logo=(char *)php_base64_encode(suhosin_logo, sizeof(suhosin_logo), &ret); |
| 1242 | if (enc_logo) { | 1224 | if (enc_logo) { |
