Skip to content

Removed Logo GUIDs and replaced with Data URIs and div hidden with JS #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 6, 2012
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ PHP X.Y UPGRADE NOTES
========================================

- Drop Windows XP and 2003 support. (Pierre)
- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and
zend_logo_guid() have been removed
- Removal of Logo GUIDs

========================================
2. New Features
Expand Down Expand Up @@ -89,6 +92,8 @@ PHP X.Y UPGRADE NOTES
- IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() are
deprecated. Use IntlDateFormatter::setTimeZone() or datefmt_set_timezone()
instead.
- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and
zend_logo_guid() have been removed

========================================
5. New Functions
Expand Down Expand Up @@ -222,3 +227,5 @@ PHP X.Y UPGRADE NOTES
========================================
11. Other Changes
========================================

- Logo GUIDs will no longer work
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
fopen_wrappers.c alloca.c php_scandir.c \
php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
network.c php_open_temporary_file.c php_logos.c \
network.c php_open_temporary_file.c \
output.c getopt.c)

PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
Expand Down
16 changes: 0 additions & 16 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1550,18 +1550,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phpcredits, 0, 0, 0)
ZEND_ARG_INFO(0, flag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO(arginfo_php_logo_guid, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO(arginfo_php_real_logo_guid, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO(arginfo_php_egg_logo_guid, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO(arginfo_zend_logo_guid, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO(arginfo_php_sapi_name, 0)
ZEND_END_ARG_INFO()

Expand Down Expand Up @@ -2723,10 +2711,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(phpinfo, arginfo_phpinfo)
PHP_FE(phpversion, arginfo_phpversion)
PHP_FE(phpcredits, arginfo_phpcredits)
PHP_FE(php_logo_guid, arginfo_php_logo_guid)
PHP_FE(php_real_logo_guid, arginfo_php_real_logo_guid)
PHP_FE(php_egg_logo_guid, arginfo_php_egg_logo_guid)
PHP_FE(zend_logo_guid, arginfo_zend_logo_guid)
PHP_FE(php_sapi_name, arginfo_php_sapi_name)
PHP_FE(php_uname, arginfo_php_uname)
PHP_FE(php_ini_scanned_files, arginfo_php_ini_scanned_files)
Expand Down
8 changes: 0 additions & 8 deletions ext/standard/credits.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@

PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */
{
if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) {
php_print_info_htmlhead(TSRMLS_C);
}

if (!sapi_module.phpinfo_as_text) {
PUTS("<h1>PHP Credits</h1>\n");
} else {
Expand Down Expand Up @@ -123,10 +119,6 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */
CREDIT_LINE("Windows Infrastructure", "Alex Schoenmaker");
php_info_print_table_end();
}

if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) {
PUTS("</div></body></html>\n");
}
}
/* }}} */

Expand Down
132 changes: 36 additions & 96 deletions ext/standard/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ static int php_info_printf(const char *fmt, ...) /* {{{ */
}
/* }}} */

static void php_info_print_request_uri(TSRMLS_D) /* {{{ */
{
if (SG(request_info).request_uri) {
php_info_print_html_esc(SG(request_info).request_uri, strlen(SG(request_info).request_uri));
}
}
/* }}} */

static int php_info_print(const char *str) /* {{{ */
{
TSRMLS_FETCH();
Expand Down Expand Up @@ -660,7 +652,6 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
{
char **env, *tmp1, *tmp2;
char *php_uname;
int expose_php = INI_INT("expose_php");

if (!sapi_module.phpinfo_as_text) {
php_print_info_htmlhead(TSRMLS_C);
Expand All @@ -671,22 +662,26 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
if (flag & PHP_INFO_GENERAL) {
char *zend_version = get_zend_version();
char temp_api[10];
char *logo_guid;

php_uname = php_get_uname('a');

if (!sapi_module.phpinfo_as_text) {
php_info_print_box_start(1);
}

if (expose_php && !sapi_module.phpinfo_as_text) {
php_info_print("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
php_info_print_request_uri(TSRMLS_C);
php_info_print("?=");
logo_guid = php_logo_guid();
php_info_print(logo_guid);
efree(logo_guid);
php_info_print("\" alt=\"PHP Logo\" /></a>");
if (!sapi_module.phpinfo_as_text) {
time_t the_time;
struct tm *ta, tmbuf;

the_time = time(NULL);
ta = php_localtime_r(&the_time, &tmbuf);

php_info_print("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) {
php_info_print(PHP_EGG_LOGO_DATA_URI "\" alt=\"PHP logo\" /></a>");
} else {
php_info_print(PHP_LOGO_DATA_URI "\" alt=\"PHP logo\" /></a>");
}
}

if (!sapi_module.phpinfo_as_text) {
Expand Down Expand Up @@ -787,10 +782,9 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)

/* Zend Engine */
php_info_print_box_start(0);
if (expose_php && !sapi_module.phpinfo_as_text) {
if (!sapi_module.phpinfo_as_text) {
php_info_print("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");
php_info_print_request_uri(TSRMLS_C);
php_info_print("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n");
php_info_print(ZEND_LOGO_DATA_URI "\" alt=\"Zend logo\" /></a>\n");
}
php_info_print("This program makes use of the Zend Scripting Language Engine:");
php_info_print(!sapi_module.phpinfo_as_text?"<br />":"\n");
Expand All @@ -803,13 +797,30 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
efree(php_uname);
}

if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) {
if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) {
php_info_print_hr();
php_info_print("<h1><a href=\"");
php_info_print_request_uri(TSRMLS_C);
php_info_print("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
php_info_print("<script>(function () {\n");
php_info_print(" 'use strict';\n");
php_info_print(" window.onload = function () {\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this cause strange behavior if somebody is embedding the phpinfo() page in a page already overwriting window.onload? People are embedding phpinfo() in installers or configuration areas for different applications.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They shouldn't be including a full HTML page, that's bound to break
things anyway. They should be using an iframe or a popup. I feel no
sympathy for them if they're doing that, things can break.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.onload should just be onload [edited], since window is a reference to the global object.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, what? If you replace window.onload with window you'd overwrite the global scope with said function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to be more specific (and hence verbose). I always use, e.g.,
window.onload, window.WebSocket, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpinfo and phpcredits aren't the same thing.

Please give me an actual example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TazeTSchnitzel I think your Facebook just went wild ;)

Copy link
Contributor Author

@hikari-no-yume hikari-no-yume Aug 11, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it did. Last time I trust them with my contact list.

This is very irritating, I apologise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under normal circumstances I'd mock you for having a Facebook account in
the first place. But o think you've already seen the error of your ways ;)
On Aug 11, 2012 2:51 PM, "Andrew Faulds" [email protected] wrote:

In ext/standard/info.c:

    php_info_print_hr();
  •   php_info_print("<h1><a href=\"");
    
  •   php_info_print_request_uri(TSRMLS_C);
    
  •   php_info_print("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
    
  •   php_info_print("<script>(function () {\n");
    
  •   php_info_print("    'use strict';\n");
    
  •   php_info_print("    window.onload = function () {\n");
    

Yes it did. Last time I trust them with my contact list. This is very
irritating, I apologise.
-- Sent from Samsung Mobile Andrew Faulds http://ajf.me/ nikic <
[email protected]> hat geschrieben: In ext/standard/info.c:
php_info_print_hr(); - php_info_print("

<a href=""); -
php_info_print_request_uri(TSRMLS_C); -
php_info_print("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000">"); +
php_info_print("<script>(function () {\n"); + php_info_print(" 'use
strict';\n"); + php_info_print(" window.onload = function () {\n");
@TazeTSchnitzel https://github.com/TazeTSchnitzel I think your
Facebook just went wild ;) — Reply to this email directly or view it on
GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//pull/132/files#r1357361.

Copy link
Contributor Author

@hikari-no-yume hikari-no-yume Aug 11, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought rejoining Facebook was a good thing.

I was sadly mistaken ;)

php_info_print(" var credits, reveal;\n");
php_info_print("\n");
php_info_print(" credits = document.getElementById('credits');\n");
php_info_print(" reveal = document.getElementById('revealcredits');\n");
php_info_print("\n");
php_info_print(" credits.style.display = 'none';\n");
php_info_print(" reveal.style.display = 'block';\n");
php_info_print(" reveal.onclick = function () {\n");
php_info_print(" credits.style.display = 'block';\n");
php_info_print(" reveal.style.display = 'none';\n");
php_info_print(" };\n");
php_info_print(" };\n");
php_info_print("}());</script>\n");
php_info_print("<h1><a id=\"revealcredits\" href=\"#credits\" style=\"display: none;\">");
php_info_print("PHP Credits");
php_info_print("</a></h1>\n");
php_info_print("<div id=\"credits\">\n");
php_print_credits(PHP_CREDITS_ALL, TSRMLS_C);
php_info_print("</div>\n");
}

zend_ini_sort_entries(TSRMLS_C);
Expand Down Expand Up @@ -1191,77 +1202,6 @@ PHP_FUNCTION(phpcredits)
}
/* }}} */

/* {{{ php_logo_guid
*/
PHPAPI char *php_logo_guid(void)
{
char *logo_guid;

time_t the_time;
struct tm *ta, tmbuf;

the_time = time(NULL);
ta = php_localtime_r(&the_time, &tmbuf);

if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) {
logo_guid = PHP_EGG_LOGO_GUID;
} else {
logo_guid = PHP_LOGO_GUID;
}

return estrdup(logo_guid);

}
/* }}} */

/* {{{ proto string php_logo_guid(void)
Return the special ID used to request the PHP logo in phpinfo screens*/
PHP_FUNCTION(php_logo_guid)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}

RETURN_STRING(php_logo_guid(), 0);
}
/* }}} */

/* {{{ proto string php_real_logo_guid(void)
Return the special ID used to request the PHP logo in phpinfo screens*/
PHP_FUNCTION(php_real_logo_guid)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}

RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);
}
/* }}} */

/* {{{ proto string php_egg_logo_guid(void)
Return the special ID used to request the PHP logo in phpinfo screens*/
PHP_FUNCTION(php_egg_logo_guid)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}

RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);
}
/* }}} */

/* {{{ proto string zend_logo_guid(void)
Return the special ID used to request the Zend logo in phpinfo screens*/
PHP_FUNCTION(zend_logo_guid)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}

RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);
}
/* }}} */

/* {{{ proto string php_sapi_name(void)
Return the current SAPI module name */
PHP_FUNCTION(php_sapi_name)
Expand Down
Loading