BLOG API 요청값이 없을 경우 500에러 대신 에러메세지 출력

XE BLOG API 주소를 URL을 통해 직접 접속했을 때.
http://localhost/mid/api

기존
HTTP_RAW_POST_DATA값이 NULL이기 때문에 500페이지 출력.
(사용자로 하여금 연산 에러 메세지 출력으로 API 자체 오류로 보일 수 있음)

수정
Invalid Method Call 메세지 출력
(사용자로 하여금 API 페이지임을 알려줌)
This commit is contained in:
upgle 2014-04-19 22:53:47 +05:45
parent 8b2ed49d10
commit 40d92fb6f4

View file

@ -30,6 +30,13 @@ if($_REQUEST['act'] != 'api')
// Read func file
require_once(_XE_PATH_ . 'addons/blogapi/blogapi.func.php');
// If HTTP_RAW_POST_DATA is NULL, Print error message
if(!$GLOBALS['HTTP_RAW_POST_DATA'])
{
$content = getXmlRpcFailure(1, 'Invalid Method Call');
printContent($content);
}
// xmlprc parsing
// Parse the requested xmlrpc
$xml = new SimpleXMLElement($GLOBALS['HTTP_RAW_POST_DATA']);