- Timestamp:
- 2012/04/11 02:58:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/api/SC_Api_Operation.php
r21722 r21734 98 98 protected function checkReferer() { 99 99 $ret = false; 100 if (!SC_Utils_Ex::isBlank($_SERVER['HTTP_REFERER'])) {100 if (!SC_Utils_Ex::isBlank($_SERVER['HTTP_REFERER'])) { 101 101 $domain = SC_Utils_Ex::sfIsHTTPS() ? HTTPS_URL : HTTP_URL; 102 102 $pattern = sprintf('|^%s.*|', $domain); … … 144 144 // Refer: https://images-na.ssl-images-amazon.com/images/G/09/associates/paapi/dg/index.html?Query_QueryAuth.html 145 145 $check_str = ''; 146 foreach ($arrParam as $key => $val) {146 foreach ($arrParam as $key => $val) { 147 147 switch ($key) { 148 148 case 'Signature': … … 159 159 . $check_str; 160 160 $signature = base64_encode(hash_hmac('sha256', $check_str, $secret_key, true)); 161 if ($signature === $arrParam['Signature']) {161 if ($signature === $arrParam['Signature']) { 162 162 return true; 163 163 } … … 206 206 return false; 207 207 } 208 $arrAuthTypes = explode( "|", $arrApiConfig['auth_types']);208 $arrAuthTypes = explode('|', $arrApiConfig['auth_types']); 209 209 $result = false; 210 210 foreach ($arrAuthTypes as $auth_type) { … … 249 249 break; 250 250 } 251 if ($ret === true) {251 if ($ret === true) { 252 252 $result = true; 253 } else{253 } else { 254 254 $result = false; 255 255 break; // 1つでもfalseがあれば,その時点で終了 … … 277 277 * 278 278 * @param array $arrPost リクエストパラメーター 279 * @return array( string レスポンス名, array レスポンス配列)279 * @return array(string レスポンス名, array レスポンス配列) 280 280 */ 281 281 public function doApiAction($arrPost) { … … 313 313 314 314 // オペレーション結果処理 315 if ($operation_result) {315 if ($operation_result) { 316 316 $arrOperationRequestValid = $objApiOperation->getRequestValidate(); 317 317 $arrResponseBody = $objApiOperation->getResponseArray(); 318 318 $response_group_name = $objApiOperation->getResponseGroupName(); 319 } else{319 } else { 320 320 $arrErr = $objApiOperation->getErrorArray(); 321 321 } 322 } else{322 } else { 323 323 $arrErr['ECCUBE.Operation.NoLoad'] = 'オペレーションをロード出来ませんでした。'; 324 324 } 325 } else{325 } else { 326 326 $arrErr['ECCUBE.Authority.NoAuthority'] = 'オペレーションの実行権限がありません。'; 327 327 } … … 330 330 if (count($arrErr) == 0) { 331 331 // 実行成功 332 $arrResponseValidSection = array( 'Request' => array(332 $arrResponseValidSection = array('Request' => array( 333 333 'IsValid' => 'True', 334 334 $operation_name . 'Request' => $arrOperationRequestValid … … 343 343 $arrResponseErrorSection[] = array('Code' => $error_code, 'Message' => $error_msg); 344 344 } 345 $arrResponseValidSection = array( 'Request' => array(345 $arrResponseValidSection = array('Request' => array( 346 346 'IsValid' => 'False', 347 347 'Errors' => array('Error' => $arrResponseErrorSection) … … 350 350 if (is_object($objApiOperation)) { 351 351 $response_outer = $operation_name . 'Response'; 352 } else{352 } else { 353 353 $response_outer = 'ECCUBEApiCommonResponse'; 354 354 } … … 381 381 'Arguments' => array(), 382 382 ); 383 foreach ($arrParam as $key => $val) {383 foreach ($arrParam as $key => $val) { 384 384 $arrRet['Arguments'][] = array('_attributes' => array('Name' => htmlentities($key, ENT_NOQUOTES, 'UTF-8'), 'Value' => htmlentities($val, ENT_NOQUOTES, 'UTF-8'))); 385 385 } … … 390 390 // TODO: ここらへんは SC_Displayに持って行きたい所だが・・ 391 391 public function sendApiResponse($type, $response_outer_name, &$arrResponse) { 392 switch ($type) {392 switch ($type) { 393 393 case 'xml': 394 394 SC_Api_Utils_Ex::sendResponseXml($response_outer_name, $arrResponse);
Note: See TracChangeset
for help on using the changeset viewer.
