From: <pdo...@us...> - 2014-12-16 19:36:25
|
Revision: 14475 http://sourceforge.net/p/squirrelmail/code/14475 Author: pdontthink Date: 2014-12-16 19:36:20 +0000 (Tue, 16 Dec 2014) Log Message: ----------- Make sure logout errors aren't accidentally ignored by advanced reloader Modified Paths: -------------- branches/SM-1_4-STABLE/squirrelmail/functions/display_messages.php branches/SM-1_4-STABLE/squirrelmail/scripts/reload_page.js branches/SM-1_4-STABLE/squirrelmail/scripts/remote_request.js Modified: branches/SM-1_4-STABLE/squirrelmail/functions/display_messages.php =================================================================== --- branches/SM-1_4-STABLE/squirrelmail/functions/display_messages.php 2014-08-01 02:28:12 UTC (rev 14474) +++ branches/SM-1_4-STABLE/squirrelmail/functions/display_messages.php 2014-12-16 19:36:20 UTC (rev 14475) @@ -110,7 +110,9 @@ '<font color="'.$color[2].'"><b>'. '<a href="'.$logout_link.'" target="'.$frame_top.'">'. _("Go to the login page") . '</a></b></font></td></tr>'. - '</table></td></tr></table></center></body></html>'; + '</table></td></tr></table></center>'. + '<!-- logout_error -->'. + '</body></html>'; } function error_box($string, $color) { @@ -154,7 +156,8 @@ '</td></tr><tr><td>'. '<table cellpadding="1" cellspacing="5" align="center" border="0">'. '<tr>' . html_tag( 'td', $string."\n", 'left') . '</tr></table>'. - '</td></tr></table></td></tr></table>'; + '</td></tr></table></td></tr></table>'. + '<!-- error_box -->'; } /** Modified: branches/SM-1_4-STABLE/squirrelmail/scripts/reload_page.js =================================================================== --- branches/SM-1_4-STABLE/squirrelmail/scripts/reload_page.js 2014-08-01 02:28:12 UTC (rev 14474) +++ branches/SM-1_4-STABLE/squirrelmail/scripts/reload_page.js 2014-12-16 19:36:20 UTC (rev 14475) @@ -76,11 +76,13 @@ { if (use_advanced_page_reload) sm_send_request("GET", window.location.href, "", "replace_document", false, - reload_request_timeout, 1000, "server_or_connect_error", false, "", false); + reload_request_timeout, 1000, "<!-- logout_error -->", + "server_or_connect_error", false, "", false); else // images/spacer.png is exactly 68 bytes in size sm_send_request("GET", base_uri + "images/spacer.png", "", "reload_now", false, - reload_request_timeout, 68, "server_or_connect_error", false, "", true); + reload_request_timeout, 68, "", "server_or_connect_error", + false, "", true); } Modified: branches/SM-1_4-STABLE/squirrelmail/scripts/remote_request.js =================================================================== --- branches/SM-1_4-STABLE/squirrelmail/scripts/remote_request.js 2014-08-01 02:28:12 UTC (rev 14474) +++ branches/SM-1_4-STABLE/squirrelmail/scripts/remote_request.js 2014-12-16 19:36:20 UTC (rev 14475) @@ -139,6 +139,9 @@ * @param int minimum_response_size When set to anything greater than zero, the * response size must be equal to or greater than this, * otherwise an error will be triggered (code 599) + * (set to a negative number to skip response size test) + * @param int good_string When not empty, if the response includes this string, + * the response is always considered to be valid. * @param string error_function The name of the function that will be called if any * error occurs (beside timeout). It will be called with * two parameters: the error code and error message (note @@ -156,7 +159,7 @@ * */ function sm_send_request(method, uri, content, result_function, result_in_xml, - max_wait, minimum_response_size, error_function, + max_wait, minimum_response_size, good_string, error_function, show_server_side_error_alert, timeout_message, make_query_unique) { @@ -250,6 +253,12 @@ // case 200: + request_is_known_ok = false; + if (good_string != '' && response_string.indexOf(good_string) > -1) + { + request_is_known_ok = true; + } + // FIXME: do we want to do something else here for application-generated errors or skip that and deal with it when the caller evaluates the returned contents? (yeah, for now, that's fine) // // alert custom error or debug messages // // @@ -266,7 +275,7 @@ // // // no errors occurred; call the target result function // else - if (minimum_response_size > 0 && response_string.length < minimum_response_size) + if (!request_is_known_ok && minimum_response_size > 0 && response_string.length < minimum_response_size) { if (debug >= 3) debug_print("Calling error handler: " + error_function); eval(error_function + "(599, 'Response size too small');"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |