فهرست منبع

[svn r20557] FS#306 - Preparing for testing the social tool about encoding issues. First, rewriting the function api_is_xml_http_request() in a safe way. See http://www.electrictoolbox.com/how-to-tell-ajax-request-php/ .

Ivan Tcholakov 16 سال پیش
والد
کامیت
f5a5bdb159
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      main/inc/lib/main_api.lib.php

+ 3 - 0
main/inc/lib/main_api.lib.php

@@ -3344,11 +3344,14 @@ if ( !function_exists('sys_get_temp_dir') )
  * This function allow know when request sent is XMLHttpRequest
  */
 function api_is_xml_http_request() {
+	/*
 	if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') {
 		return true;
 	} else {
 		return false;
 	}
+	*/
+	return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') ? true : false;
 }
 /**
  * This function gets the hash in md5 or sha1 (it depends in the platform config) of a given password