Changeset 6001
- Timestamp:
- Mar 24, 2008, 2:12:20 PM (14 years ago)
- Location:
- OpenPNE/branches/stable-2.10.x
- Files:
-
- 13 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE/branches/stable-2.10.x/lib/include/Services/Amazon.php
r2 r6001 69 69 * @author Tatsuya Tsuruoka <ttsuruoka@p4life.jp> 70 70 * @access public 71 * @version Release: 0. 6.071 * @version Release: 0.7.1 72 72 * @uses PEAR 73 73 * @uses HTTP_Request … … 119 119 * @see setLocale 120 120 */ 121 function Services_Amazon($token = null, $affid = null, $locale = 'us', $baseurl = 'http:// xml.amazon.com/onca/xml2') {121 function Services_Amazon($token = null, $affid = null, $locale = 'us', $baseurl = 'http://webservices.amazon.com/onca/xml2') { 122 122 if (!is_null($token)) { 123 123 $this->_token = $token; … … 128 128 } 129 129 130 $this->_locale = $locale;131 130 $this->_baseurl = $baseurl; 131 $this->setLocale($locale); 132 132 } 133 133 … … 237 237 238 238 /** 239 * Sets the locale passed when making a query to Amazon. com.240 * 241 * Currently only us, uk, and deare supported by Amazon.239 * Sets the locale passed when making a query to Amazon. 240 * 241 * Currently only us, uk, de, jp, fr and ca are supported by Amazon. 242 242 * 243 243 * @access public … … 247 247 */ 248 248 function setLocale($locale) { 249 $this->_locale = $locale; 249 $urls = array( 250 'us' => 'http://webservices.amazon.com/onca/xml2', 251 'uk' => 'http://webservices.amazon.co.uk/onca/xml2', 252 'de' => 'http://webservices.amazon.de/onca/xml2', 253 'jp' => 'http://webservices.amazon.co.jp/onca/xml2', 254 'fr' => 'http://webservices.amazon.fr/onca/xml2', 255 'ca' => 'http://webservices.amazon.ca/onca/xml2', 256 ); 257 $this->_locale = strtolower($locale); 258 if (empty($urls[$locale])) { 259 return; 260 } 261 $this->setBaseUrl($urls[$locale]); 250 262 } 251 263 … … 725 737 if (is_array($product->Artists->Artist)) { 726 738 foreach ($product->Artists->Artist as $artist) { 727 $item['artists'][] = $a uthor;739 $item['artists'][] = $artist; 728 740 } 729 741 } else { … … 731 743 } 732 744 } 733 $item['release'] = $product->ReleaseDate;734 $item['manufacturer'] = $product->Manufacturer;745 $item['release'] = isset($product->ReleaseDate) ? $product->ReleaseDate : null; 746 $item['manufacturer'] = isset($product->Manufacturer) ? $product->Manufacturer : null; 735 747 $item['imagesmall'] = $product->ImageUrlSmall; 736 748 $item['imagemedium'] = $product->ImageUrlMedium; 737 749 $item['imagelarge'] = $product->ImageUrlLarge; 738 $item['listprice'] = $product->ListPrice;739 $item['ourprice'] = $product->ListPrice;750 $item['listprice'] = isset($product->ListPrice) ? $product->ListPrice : null; 751 $item['ourprice'] = isset($product->ListPrice) ? $product->ListPrice : null; 740 752 741 753 $items[] = $item; -
OpenPNE/branches/stable-2.10.x/lib/include/Services/AmazonECS4.php
r2 r6001 94 94 * @author Tatsuya Tsuruoka <ttsuruoka@p4life.jp> 95 95 * @access public 96 * @version Release: 0. 6.096 * @version Release: 0.7.1 97 97 * @uses PEAR 98 98 * @uses HTTP_Request … … 150 150 151 151 /** 152 * The raw result returned from the request 153 * 154 * @access private 155 * @var string 156 */ 157 var $_raw_result = null; 158 159 /** 152 160 * The cache object 153 161 * … … 166 174 */ 167 175 var $_cache_expire = 3600; 176 177 /** 178 * Proxy server 179 * 180 * @access private 181 * @var string 182 */ 183 var $_proxy_host = null; 184 185 /** 186 * Proxy port 187 * 188 * @access private 189 * @var integer 190 */ 191 var $_proxy_port = null; 192 193 /** 194 * Proxy username 195 * 196 * @access private 197 * @var string 198 */ 199 var $_proxy_user = null; 200 201 /** 202 * Proxy password 203 * 204 * @access private 205 * @var string 206 */ 207 var $_proxy_pass = null; 168 208 169 209 /** … … 201 241 function getApiVersion() 202 242 { 203 return '0. 6.0';243 return '0.7.1'; 204 244 } 205 245 … … 348 388 349 389 /** 390 * Sets a proxy 391 * 392 * @access public 393 * @param string $host Proxy host 394 * @param int $port Proxy port 395 * @param string $user Proxy username 396 * @param string $pass Proxy password 397 */ 398 function setProxy($host, $port = 8080, $user = null, $pass = null) 399 { 400 $this->_proxy_host = $host; 401 $this->_proxy_port = $port; 402 $this->_proxy_user = $user; 403 $this->_proxy_pass = $pass; 404 } 405 406 /** 350 407 * Retrieves all error codes and messages 351 408 * … … 406 463 { 407 464 return $this->_lasturl; 465 } 466 467 /** 468 * Retrieves the raw result 469 * 470 * @access public 471 * @return string The raw result 472 */ 473 function getRawResult() 474 { 475 return $this->_raw_result; 408 476 } 409 477 … … 647 715 $params = $options; 648 716 $params['Operation'] = 'ItemLookup'; 717 if (is_array($item_id)) { 718 $item_id = implode(',', $item_id); 719 } 649 720 $params['ItemId'] = $item_id; 650 721 return $this->_sendRequest($params); … … 800 871 $params = $options; 801 872 $params['Operation'] = 'SimilarityLookup'; 873 if (is_array($item_id)) { 874 $item_id = implode(',', $item_id); 875 } 802 876 $params['ItemId'] = $item_id; 803 877 return $this->_sendRequest($params); … … 957 1031 958 1032 /** 959 * Sends the request to Amazon 960 * 961 * @access private 962 * @param array $params The array of request parameters 963 * @return array The array of information returned by the query 964 */ 965 function _sendRequest($params) 966 { 967 $this->_errors = array(); 968 969 if (is_null($this->_keyid)) { 970 return PEAR::raiseError('Access Key ID have not been set'); 971 } 972 1033 * Builds a URL 1034 * 1035 * @access private 1036 * @param array $params 1037 * @return string URL 1038 */ 1039 function _buildUrl($params) 1040 { 973 1041 $params['AWSAccessKeyId'] = $this->_keyid; 974 1042 $params['AssociateTag'] = $this->_associd; … … 978 1046 $url .= '&' . $k . '=' . urlencode($v); 979 1047 } 980 $this->_lasturl = $url; 981 982 // Return cached data if available 983 $cache_id = false; 984 if (isset($this->_cache) && !$this->_ignoreCache($params['Operation'])) { 985 $cache_id = $this->_generateCacheId($params); 986 $cache = $this->_cache->get($cache_id); 987 if (!is_null($cache)) { 988 $this->_processing_time = 0; 989 return $cache; 990 } 991 } 992 1048 return $url; 1049 } 1050 1051 /** 1052 * Sends a request 1053 * 1054 * @access private 1055 * @param string $url 1056 * @return string The response 1057 */ 1058 function _sendHttpRequest($url) 1059 { 993 1060 $http = &new HTTP_Request($url); 994 1061 $http->setHttpVer('1.0'); 995 1062 $http->addHeader('User-Agent', 'Services_AmazonECS4/' . $this->getApiVersion()); 996 $http->sendRequest(); 1063 if ($this->_proxy_host) { 1064 $http->setProxy($this->_proxy_host, $this->_proxy_port, $this->_proxy_user, $this->_proxy_pass); 1065 } 1066 1067 $result = $http->sendRequest(); 1068 if (PEAR::isError($result)) { 1069 return PEAR::raiseError('HTTP_Request::sendRequest failed: ' . $result->message); 1070 } 997 1071 998 1072 if ($http->getResponseCode() != 200){ 999 1073 return PEAR::raiseError('Amazon returned invalid HTTP response code ' . $http->getResponseCode()); 1000 1074 } 1001 $result = $http->getResponseBody(); 1002 1075 return $http->getResponseBody(); 1076 } 1077 1078 /** 1079 * Parses raw XML result 1080 * 1081 * @access private 1082 * @param string $raw_result 1083 * @return string The contents 1084 */ 1085 function _parseRawResult($raw_result) 1086 { 1003 1087 $xml = &new XML_Unserializer(); 1004 1088 $xml->setOption(XML_UNSERIALIZER_OPTION_ATTRIBUTES_PARSE, true); 1005 1089 $xml->setOption(XML_UNSERIALIZER_OPTION_FORCE_ENUM, 1006 1090 array('Item', 'Review', 'EditorialReview', 1007 'Parameter', 'Author', ' ResponseGroup', 'Error'));1008 $xml->unserialize($r esult, false);1091 'Parameter', 'Author', 'Creator', 'ResponseGroup', 'Error')); 1092 $xml->unserialize($raw_result, false); 1009 1093 $data = $xml->getUnserializedData(); 1010 1094 if (PEAR::isError($data)) { … … 1043 1127 } 1044 1128 } 1045 1046 if ($cache_id) {1047 $this->_cache->save($cache_id, $contents, $this->_cache_expire);1048 }1049 1050 1129 return $contents; 1051 1130 } … … 1057 1136 * @param array $content Values of the content elements 1058 1137 * @return array mixed A PEAR_Error on error, a true on success 1138 * @see _parseRawResult 1059 1139 */ 1060 1140 function _checkContentError($content) … … 1077 1157 return true; 1078 1158 } 1159 1160 /** 1161 * Sends the request to Amazon 1162 * 1163 * @access private 1164 * @param array $params The array of request parameters 1165 * @return array The array of information returned by the query 1166 */ 1167 function _sendRequest($params) 1168 { 1169 $this->_errors = array(); 1170 1171 if (is_null($this->_keyid)) { 1172 return PEAR::raiseError('Access Key ID have not been set'); 1173 } 1174 1175 $url = $this->_buildUrl($params); 1176 $this->_lasturl = $url; 1177 if (PEAR::isError($url)) { 1178 return $url; 1179 } 1180 1181 // Return cached data if available 1182 $cache_id = false; 1183 if (isset($this->_cache) && !$this->_ignoreCache($params['Operation'])) { 1184 $cache_id = $this->_generateCacheId($params); 1185 $cache = $this->_cache->get($cache_id); 1186 if (!is_null($cache)) { 1187 $this->_processing_time = 0; 1188 return $cache; 1189 } 1190 } 1191 1192 $result = $this->_sendHttpRequest($url); 1193 $this->_raw_result = $result; 1194 if (PEAR::isError($result)) { 1195 return $result; 1196 } 1197 1198 $contents = $this->_parseRawResult($result); 1199 if (PEAR::isError($contents)) { 1200 return $contents; 1201 } 1202 1203 if ($cache_id) { 1204 $this->_cache->save($cache_id, $contents, $this->_cache_expire); 1205 } 1206 1207 return $contents; 1208 } 1209 1079 1210 } 1080 1211 ?> -
OpenPNE/branches/stable-2.10.x/lib/include/XML/Parser.php
r2 r6001 19 19 // +----------------------------------------------------------------------+ 20 20 // 21 // $Id: Parser.php,v 1.2 6 2005/09/23 11:51:10schst Exp $21 // $Id: Parser.php,v 1.28 2006/12/01 16:23:22 schst Exp $ 22 22 23 23 /** … … 165 165 var $_handlerObj; 166 166 167 /** 168 * valid encodings 169 * 170 * @var array 171 */ 172 var $_validEncodings = array('ISO-8859-1', 'UTF-8', 'US-ASCII'); 173 167 174 // }}} 168 175 // {{{ constructor … … 222 229 * @access public 223 230 * @param string mode, either 'func' or 'event' 224 * @return boolean|object true on success, PEAR_Error otherwise 231 * @return boolean|object true on success, PEAR_Error otherwise 225 232 */ 226 233 function setMode($mode) … … 333 340 } 334 341 xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, $this->folding); 335 336 342 return true; 343 } 344 if (!in_array(strtoupper($this->srcenc), $this->_validEncodings)) { 345 return $this->raiseError('invalid source encoding', XML_PARSER_ERROR_INVALID_ENCODING); 337 346 } 338 347 return $this->raiseError('Unable to create XML parser resource.', XML_PARSER_ERROR_NO_RESOURCE); … … 382 391 } 383 392 } 384 393 385 394 $fp = @fopen($file, 'rb'); 386 395 if (is_resource($fp)) { … … 393 402 // }}} 394 403 // {{{ setInputString() 395 404 396 405 /** 397 406 * XML_Parser::setInputString() 398 * 407 * 399 408 * Sets the xml input from a string 400 * 409 * 401 410 * @param string $data a string containing the XML document 402 411 * @return null … … 407 416 return null; 408 417 } 409 418 410 419 // }}} 411 420 // {{{ setInput() … … 415 424 * 416 425 * You should use setInputFile() or setInputString() if you 417 * pass a string 426 * pass a string 418 427 * 419 428 * @param mixed $fp Can be either a resource returned from fopen(), … … 466 475 // if $this->fp was fopened previously 467 476 if (is_resource($this->fp)) { 468 477 469 478 while ($data = fread($this->fp, 4096)) { 470 479 if (!$this->_parseString($data, feof($this->fp))) { … … 489 498 /** 490 499 * XML_Parser::_parseString() 491 * 500 * 492 501 * @param string $data 493 502 * @param boolean $eof … … 500 509 return xml_parse($this->parser, $data, $eof); 501 510 } 502 511 503 512 // }}} 504 513 // {{{ parseString() … … 506 515 /** 507 516 * XML_Parser::parseString() 508 * 517 * 509 518 * Parses a string. 510 519 * … … 520 529 $this->reset(); 521 530 } 522 531 523 532 if (!$this->_parseString($data, $eof)) { 524 533 $error = &$this->raiseError(); … … 532 541 return true; 533 542 } 534 543 535 544 /** 536 545 * XML_Parser::free() 537 * 546 * 538 547 * Free the internal resources associated with the parser 539 * 548 * 540 549 * @return null 541 550 **/ … … 552 561 return null; 553 562 } 554 563 555 564 /** 556 565 * XML_Parser::raiseError() 557 * 566 * 558 567 * Throws a XML_Parser_Error 559 * 568 * 560 569 * @param string $msg the error message 561 570 * @param integer $ecode the error message code 562 * @return XML_Parser_Error 571 * @return XML_Parser_Error 563 572 **/ 564 573 function raiseError($msg = null, $ecode = 0) … … 568 577 return parent::raiseError($err); 569 578 } 570 579 571 580 // }}} 572 581 // {{{ funcStartHandler() … … 575 584 { 576 585 $func = 'xmltag_' . $elem; 577 if (strchr($func, '.')) { 578 $func = str_replace('.', '_', $func); 579 } 586 $func = str_replace(array('.', '-', ':'), '_', $func); 580 587 if (method_exists($this->_handlerObj, $func)) { 581 588 call_user_func(array(&$this->_handlerObj, $func), $xp, $elem, $attribs); … … 591 598 { 592 599 $func = 'xmltag_' . $elem . '_'; 593 if (strchr($func, '.')) { 594 $func = str_replace('.', '_', $func); 595 } 600 $func = str_replace(array('.', '-', ':'), '_', $func); 596 601 if (method_exists($this->_handlerObj, $func)) { 597 602 call_user_func(array(&$this->_handlerObj, $func), $xp, $elem); … … 652 657 * 653 658 * @var string 654 */ 659 */ 655 660 var $error_message_prefix = 'XML_Parser: '; 656 661 … … 669 674 * @param integer error handling 670 675 * @param integer error level 671 */ 676 */ 672 677 function XML_Parser_Error($msgorparser = 'unknown error', $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) 673 678 { -
OpenPNE/branches/stable-2.10.x/lib/include/XML/RPC.php
r2 r6001 33 33 * @author Daniel Convissor <danielc@php.net> 34 34 * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group 35 * @version CVS: $Id: RPC.php,v 1. 99 2006/06/16 16:00:54 danielc Exp $35 * @version CVS: $Id: RPC.php,v 1.101 2006/10/28 16:42:34 danielc Exp $ 36 36 * @link http://pear.php.net/package/XML_RPC 37 37 */ … … 580 580 * @author Daniel Convissor <danielc@php.net> 581 581 * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group 582 * @version Release: 1.5. 0582 * @version Release: 1.5.1 583 583 * @link http://pear.php.net/package/XML_RPC 584 584 */ … … 625 625 * @author Daniel Convissor <danielc@php.net> 626 626 * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group 627 * @version Release: 1.5. 0627 * @version Release: 1.5.1 628 628 * @link http://pear.php.net/package/XML_RPC 629 629 */ … … 1067 1067 * @author Daniel Convissor <danielc@php.net> 1068 1068 * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group 1069 * @version Release: 1.5. 01069 * @version Release: 1.5.1 1070 1070 * @link http://pear.php.net/package/XML_RPC 1071 1071 */ … … 1158 1158 * @author Daniel Convissor <danielc@php.net> 1159 1159 * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group 1160 * @version Release: 1.5. 01160 * @version Release: 1.5.1 1161 1161 * @link http://pear.php.net/package/XML_RPC 1162 1162 */ 1163 1163 class XML_RPC_Message extends XML_RPC_Base 1164 1164 { 1165 /** 1166 * Should the payload's content be passed through mb_convert_encoding()? 1167 * 1168 * @see XML_RPC_Message::setConvertPayloadEncoding() 1169 * @since Property available since Release 1.5.1 1170 * @var boolean 1171 */ 1172 var $convert_payload_encoding = false; 1173 1165 1174 /** 1166 1175 * The current debug mode (1 = on, 0 = off) … … 1262 1271 * (CRLF), which is probably required by specifications. 1263 1272 * 1264 * If PHP's mbstring extension is enabled, the mb_convert_encoding() 1265 * function is used to ensure the payload matches the encoding set in the 1273 * If XML_RPC_Message::setConvertPayloadEncoding() was set to true, 1274 * the payload gets passed through mb_convert_encoding() 1275 * to ensure the payload matches the encoding set in the 1266 1276 * XML declaration. The encoding type can be manually set via 1267 1277 * XML_RPC_Message::setSendEncoding(). … … 1270 1280 * 1271 1281 * @uses XML_RPC_Message::xml_header(), XML_RPC_Message::xml_footer() 1272 * @see XML_RPC_Message::setSendEncoding(), $GLOBALS['XML_RPC_defencoding'] 1282 * @see XML_RPC_Message::setSendEncoding(), $GLOBALS['XML_RPC_defencoding'], 1283 * XML_RPC_Message::setConvertPayloadEncoding() 1273 1284 */ 1274 1285 function createPayload() … … 1288 1299 $this->payload = $GLOBALS['XML_RPC_func_ereg_replace']("\r\n|\n|\r|\n\r", "\r\n", $this->payload); 1289 1300 } 1290 if ( function_exists('mb_convert_encoding')) {1301 if ($this->convert_payload_encoding) { 1291 1302 $this->payload = mb_convert_encoding($this->payload, $this->send_encoding); 1292 1303 } … … 1354 1365 1355 1366 /** 1367 * Sets whether the payload's content gets passed through 1368 * mb_convert_encoding() 1369 * 1370 * Returns PEAR_ERROR object if mb_convert_encoding() isn't available. 1371 * 1372 * @param int $in where 1 = on, 0 = off 1373 * 1374 * @return void 1375 * 1376 * @see XML_RPC_Message::setSendEncoding() 1377 * @since Method available since Release 1.5.1 1378 */ 1379 function setConvertPayloadEncoding($in) 1380 { 1381 if ($in && !function_exists('mb_convert_encoding')) { 1382 return $this->raiseError('mb_convert_encoding() is not available', 1383 XML_RPC_ERROR_PROGRAMMING); 1384 } 1385 $this->convert_payload_encoding = $in; 1386 } 1387 1388 /** 1356 1389 * Sets the XML declaration's encoding attribute 1357 1390 * … … 1360 1393 * @return void 1361 1394 * 1362 * @see XML_RPC_Message:: $send_encoding, XML_RPC_Message::xml_header()1395 * @see XML_RPC_Message::setConvertPayloadEncoding(), XML_RPC_Message::xml_header() 1363 1396 * @since Method available since Release 1.2.0 1364 1397 */ … … 1514 1547 } else { 1515 1548 $v = $XML_RPC_xh[$parser]['value']; 1516 $allOK=1;1517 1549 if ($XML_RPC_xh[$parser]['isf']) { 1518 1550 $f = $v->structmem('faultCode'); … … 1539 1571 * @author Daniel Convissor <danielc@php.net> 1540 1572 * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group 1541 * @version Release: 1.5. 01573 * @version Release: 1.5.1 1542 1574 * @link http://pear.php.net/package/XML_RPC 1543 1575 */ … … 1814 1846 1815 1847 /** 1816 * @return mixed 1848 * @return mixed the current element's scalar value. If the value is 1849 * not scalar, FALSE is returned. 1817 1850 */ 1818 1851 function scalarval() 1819 1852 { 1820 1853 reset($this->me); 1821 return current($this->me); 1854 $v = current($this->me); 1855 if (!is_scalar($v)) { 1856 $v = false; 1857 } 1858 return $v; 1822 1859 } 1823 1860 -
OpenPNE/branches/stable-2.10.x/lib/include/XML/RPC/Dump.php
r2 r6001 43 43 * @package XML_RPC 44 44 * @author Christian Weiske <cweiske@php.net> 45 * @version Release: 1.5. 045 * @version Release: 1.5.1 46 46 * @link http://pear.php.net/package/XML_RPC 47 47 */ -
OpenPNE/branches/stable-2.10.x/lib/include/XML/RPC/Server.php
r2 r6001 33 33 * @author Daniel Convissor <danielc@php.net> 34 34 * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group 35 * @version CVS: $Id: Server.php,v 1.3 6 2006/06/21 12:17:27danielc Exp $35 * @version CVS: $Id: Server.php,v 1.37 2006/10/28 16:42:34 danielc Exp $ 36 36 * @link http://pear.php.net/package/XML_RPC 37 37 */ … … 271 271 * @author Daniel Convissor <danielc@php.net> 272 272 * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group 273 * @version Release: 1.5. 0273 * @version Release: 1.5.1 274 274 * @link http://pear.php.net/package/XML_RPC 275 275 */ 276 276 class XML_RPC_Server 277 277 { 278 /** 279 * Should the payload's content be passed through mb_convert_encoding()? 280 * 281 * @see XML_RPC_Server::setConvertPayloadEncoding() 282 * @since Property available since Release 1.5.1 283 * @var boolean 284 */ 285 var $convert_payload_encoding = false; 286 278 287 /** 279 288 * The dispatch map, listing the methods this server provides. … … 374 383 375 384 /** 385 * Sets whether the payload's content gets passed through 386 * mb_convert_encoding() 387 * 388 * Returns PEAR_ERROR object if mb_convert_encoding() isn't available. 389 * 390 * @param int $in where 1 = on, 0 = off 391 * 392 * @return void 393 * 394 * @see XML_RPC_Message::getEncoding() 395 * @since Method available since Release 1.5.1 396 */ 397 function setConvertPayloadEncoding($in) 398 { 399 if ($in && !function_exists('mb_convert_encoding')) { 400 return $this->raiseError('mb_convert_encoding() is not available', 401 XML_RPC_ERROR_PROGRAMMING); 402 } 403 $this->convert_payload_encoding = $in; 404 } 405 406 /** 376 407 * Sends the response 377 408 * … … 415 446 * Generates the payload and puts it in the $server_payload property 416 447 * 448 * If XML_RPC_Server::setConvertPayloadEncoding() was set to true, 449 * the payload gets passed through mb_convert_encoding() 450 * to ensure the payload matches the encoding set in the 451 * XML declaration. The encoding type can be manually set via 452 * XML_RPC_Message::setSendEncoding(). 453 * 417 454 * @return void 418 455 * 419 456 * @uses XML_RPC_Server::parseRequest(), XML_RPC_Server::$encoding, 420 457 * XML_RPC_Response::serialize(), XML_RPC_Server::serializeDebug() 458 * @see XML_RPC_Server::setConvertPayloadEncoding() 421 459 */ 422 460 function createServerPayload() … … 427 465 . $this->serializeDebug() 428 466 . $r->serialize(); 429 if ( function_exists('mb_convert_encoding')) {467 if ($this->convert_payload_encoding) { 430 468 $this->server_payload = mb_convert_encoding($this->server_payload, 431 469 $this->encoding); -
OpenPNE/branches/stable-2.10.x/setup/sql/mysql40/install/install-2.10-insert_data.sql
r4481 r6001 197 197 INSERT INTO `c_rank` VALUES (NULL,'GOLD','r_3_gold.gif',1000); 198 198 INSERT INTO `c_rank` VALUES (NULL,'PLATINUM','r_4_platinum.gif',10000); 199 INSERT INTO `c_review_category` VALUES (NULL,'books-jp','和書',1); 200 INSERT INTO `c_review_category` VALUES (NULL,'books-us','洋書',2); 201 INSERT INTO `c_review_category` VALUES (NULL,'music-jp','CDポピュラー',3); 202 INSERT INTO `c_review_category` VALUES (NULL,'classical-jp','CDクラシック',4); 203 INSERT INTO `c_review_category` VALUES (NULL,'dvd-jp','DVD',5); 204 INSERT INTO `c_review_category` VALUES (NULL,'videogames-jp','ゲーム',6); 205 INSERT INTO `c_review_category` VALUES (NULL,'software-jp','ソフトウェア',7); 206 INSERT INTO `c_review_category` VALUES (NULL,'electronics-jp','エレクトロニクス',8); 207 INSERT INTO `c_review_category` VALUES (NULL,'kitchen-jp','キッチン',9); 208 INSERT INTO `c_review_category` VALUES (NULL,'toys-jp','おもちゃ&ホビー',10); 209 INSERT INTO `c_review_category` VALUES (NULL,'sporting-goods-jp','スポーツ',11); 210 INSERT INTO `c_review_category` VALUES (NULL,'hpc-jp','ヘルス&ビューティー',12); 199 INSERT INTO `c_review_category` VALUES (NULL,'Books','和書',1); 200 INSERT INTO `c_review_category` VALUES (NULL,'ForeignBooks','洋書',2); 201 INSERT INTO `c_review_category` VALUES (NULL,'Music','CDポピュラー',3); 202 INSERT INTO `c_review_category` VALUES (NULL,'Classical','CDクラシック',4); 203 INSERT INTO `c_review_category` VALUES (NULL,'DVD','DVD',5); 204 INSERT INTO `c_review_category` VALUES (NULL,'VideoGames','ゲーム',6); 205 INSERT INTO `c_review_category` VALUES (NULL,'Software','ソフトウェア',7); 206 INSERT INTO `c_review_category` VALUES (NULL,'Electronics','エレクトロニクス',8); 207 INSERT INTO `c_review_category` VALUES (NULL,'Kitchen','キッチン',9); 208 INSERT INTO `c_review_category` VALUES (NULL,'Toys','おもちゃ&ホビー',10); 209 INSERT INTO `c_review_category` VALUES (NULL,'SportingGoods','スポーツ',11); 210 INSERT INTO `c_review_category` VALUES (NULL,'HealthPersonalCare','ヘルス&ビューティー',12); 211 INSERT INTO `c_review_category` VALUES (NULL,'Watches','時計',13); 212 INSERT INTO `c_review_category` VALUES (NULL,'Baby','ベビー&マタニティ',14); 213 INSERT INTO `c_review_category` VALUES (NULL,'Apparel','アパレル&シューズ',15); 211 214 INSERT INTO `c_siteadmin` VALUES (NULL,'inc_page_footer_before','<a href=\"./?m=pc&a=page_o_sns_kiyaku\" target=\"_blank\">利用規約</a> <a href=\"./?m=pc&a=page_o_sns_privacy\" target=\"_blank\">プライバシーポリシー</a> <a href=\"http://www.openpne.jp/about/\" target=\"_blank\">OpenPNEとは</a>',NOW()); 212 215 INSERT INTO `c_siteadmin` VALUES (NULL,'inc_page_footer_after','<a href=\"./?m=pc&a=page_o_sns_kiyaku\" target=\"_blank\">利用規約</a> <a href=\"./?m=pc&a=page_o_sns_privacy\" target=\"_blank\">プライバシーポリシー</a>',NOW()); -
OpenPNE/branches/stable-2.10.x/setup/sql/mysql41/install/install-2.10-insert_data.sql
r4481 r6001 199 199 INSERT INTO `c_rank` VALUES (NULL,'GOLD','r_3_gold.gif',1000); 200 200 INSERT INTO `c_rank` VALUES (NULL,'PLATINUM','r_4_platinum.gif',10000); 201 INSERT INTO `c_review_category` VALUES (NULL,'books-jp','和書',1); 202 INSERT INTO `c_review_category` VALUES (NULL,'books-us','洋書',2); 203 INSERT INTO `c_review_category` VALUES (NULL,'music-jp','CDポピュラー',3); 204 INSERT INTO `c_review_category` VALUES (NULL,'classical-jp','CDクラシック',4); 205 INSERT INTO `c_review_category` VALUES (NULL,'dvd-jp','DVD',5); 206 INSERT INTO `c_review_category` VALUES (NULL,'videogames-jp','ゲーム',6); 207 INSERT INTO `c_review_category` VALUES (NULL,'software-jp','ソフトウェア',7); 208 INSERT INTO `c_review_category` VALUES (NULL,'electronics-jp','エレクトロニクス',8); 209 INSERT INTO `c_review_category` VALUES (NULL,'kitchen-jp','キッチン',9); 210 INSERT INTO `c_review_category` VALUES (NULL,'toys-jp','おもちゃ&ホビー',10); 211 INSERT INTO `c_review_category` VALUES (NULL,'sporting-goods-jp','スポーツ',11); 212 INSERT INTO `c_review_category` VALUES (NULL,'hpc-jp','ヘルス&ビューティー',12); 201 INSERT INTO `c_review_category` VALUES (NULL,'Books','和書',1); 202 INSERT INTO `c_review_category` VALUES (NULL,'ForeignBooks','洋書',2); 203 INSERT INTO `c_review_category` VALUES (NULL,'Music','CDポピュラー',3); 204 INSERT INTO `c_review_category` VALUES (NULL,'Classical','CDクラシック',4); 205 INSERT INTO `c_review_category` VALUES (NULL,'DVD','DVD',5); 206 INSERT INTO `c_review_category` VALUES (NULL,'VideoGames','ゲーム',6); 207 INSERT INTO `c_review_category` VALUES (NULL,'Software','ソフトウェア',7); 208 INSERT INTO `c_review_category` VALUES (NULL,'Electronics','エレクトロニクス',8); 209 INSERT INTO `c_review_category` VALUES (NULL,'Kitchen','キッチン',9); 210 INSERT INTO `c_review_category` VALUES (NULL,'Toys','おもちゃ&ホビー',10); 211 INSERT INTO `c_review_category` VALUES (NULL,'SportingGoods','スポーツ',11); 212 INSERT INTO `c_review_category` VALUES (NULL,'HealthPersonalCare','ヘルス&ビューティー',12); 213 INSERT INTO `c_review_category` VALUES (NULL,'Watches','時計',13); 214 INSERT INTO `c_review_category` VALUES (NULL,'Baby','ベビー&マタニティ',14); 215 INSERT INTO `c_review_category` VALUES (NULL,'Apparel','アパレル&シューズ',15); 213 216 INSERT INTO `c_siteadmin` VALUES (NULL,'inc_page_footer_before','<a href=\"./?m=pc&a=page_o_sns_kiyaku\" target=\"_blank\">利用規約</a> <a href=\"./?m=pc&a=page_o_sns_privacy\" target=\"_blank\">プライバシーポリシー</a> <a href=\"http://www.openpne.jp/about/\" target=\"_blank\">OpenPNEとは</a>',NOW()); 214 217 INSERT INTO `c_siteadmin` VALUES (NULL,'inc_page_footer_after','<a href=\"./?m=pc&a=page_o_sns_kiyaku\" target=\"_blank\">利用規約</a> <a href=\"./?m=pc&a=page_o_sns_privacy\" target=\"_blank\">プライバシーポリシー</a>',NOW()); -
OpenPNE/branches/stable-2.10.x/setup/sql/postgres74/install/install-2.10-insert_data.sql
r4543 r6001 197 197 INSERT INTO c_rank VALUES (nextval('c_rank_c_rank_id_seq'),'GOLD','r_3_gold.gif',1000); 198 198 INSERT INTO c_rank VALUES (nextval('c_rank_c_rank_id_seq'),'PLATINUM','r_4_platinum.gif',10000); 199 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'books-jp','和書',1); 200 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'books-us','洋書',2); 201 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'music-jp','CDポピュラー',3); 202 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'classical-jp','CDクラシック',4); 203 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'dvd-jp','DVD',5); 204 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'videogames-jp','ゲーム',6); 205 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'software-jp','ソフトウェア',7); 206 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'electronics-jp','エレクトロニクス',8); 207 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'kitchen-jp','キッチン',9); 208 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'toys-jp','おもちゃ&ホビー',10); 209 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'sporting-goods-jp','スポーツ',11); 210 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'hpc-jp','ヘルス&ビューティー',12); 199 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Books','和書',1); 200 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'ForeignBooks','洋書',2); 201 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Music','CDポピュラー',3); 202 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Classical','CDクラシック',4); 203 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'DVD','DVD',5); 204 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'VideoGames','ゲーム',6); 205 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Software','ソフトウェア',7); 206 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Electronics','エレクトロニクス',8); 207 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Kitchen','キッチン',9); 208 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Toys','おもちゃ&ホビー',10); 209 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'SportingGoods','スポーツ',11); 210 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'HealthPersonalCare','ヘルス&ビューティー',12); 211 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Watches','時計',13); 212 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Baby','ベビー&マタニティ',14); 213 INSERT INTO c_review_category VALUES (nextval('c_review_category_c_review_category_id_seq'),'Apparel','アパレル&シューズ',15); 211 214 INSERT INTO c_siteadmin VALUES (nextval('c_siteadmin_c_siteadmin_id_seq'),'inc_page_footer_before','<a href=\"./?m=pc&a=page_o_sns_kiyaku\" target=\"_blank\">利用規約</a> <a href=\"./?m=pc&a=page_o_sns_privacy\" target=\"_blank\">プライバシーポリシー</a> <a href=\"http://www.openpne.jp/about/\" target=\"_blank\">OpenPNEとは</a>',NOW()); 212 215 INSERT INTO c_siteadmin VALUES (nextval('c_siteadmin_c_siteadmin_id_seq'),'inc_page_footer_after','<a href=\"./?m=pc&a=page_o_sns_kiyaku\" target=\"_blank\">利用規約</a> <a href=\"./?m=pc&a=page_o_sns_privacy\" target=\"_blank\">プライバシーポリシー</a>',NOW()); -
OpenPNE/branches/stable-2.10.x/webapp/lib/OpenPNE/Config.php
r5008 r6001 197 197 'AMAZON_TOKEN' => '1WZYY1W9YF49AGM0RTG2', 198 198 'AMAZON_LOCALE' => 'jp', 199 'AMAZON_BASEURL' => 'http:// xml-jp.amznxslt.com/onca/xml3',199 'AMAZON_BASEURL' => 'http://webservices.amazon.co.jp/onca/xml?Service=AWSECommerceService', 200 200 'OPENPNE_REGIST_FROM_NONE' => 0, 201 201 'OPENPNE_REGIST_FROM_PC' => 1, -
OpenPNE/branches/stable-2.10.x/webapp/lib/db/review.php
r4272 r6001 95 95 } 96 96 97 include_once 'Services/Amazon.php'; 98 $amazon =& new Services_Amazon(AMAZON_TOKEN, AMAZON_AFFID, AMAZON_LOCALE, AMAZON_BASEURL); 99 $products = $amazon->searchKeyword($keyword, $category, $page); 97 include_once 'Services/AmazonECS4.php'; 98 $amazon =& new Services_AmazonECS4(AMAZON_TOKEN, AMAZON_AFFID); 99 $amazon->setLocale(AMAZON_LOCALE); 100 $amazon->setBaseUrl(AMAZON_BASEURL); 101 102 $options = array( 103 'Keywords' => $keyword, 104 'ItemPage' => $page, 105 'ResponseGroup' => 'Large', 106 ); 107 $products = $amazon->ItemSearch($category, $options); 108 100 109 if (PEAR::isError($products)) { 101 110 return null; 102 111 } 103 if (empty($products[' totalresults'])) {112 if (empty($products['Request']['IsValid']) || $products['Request']['IsValid'] !== 'True') { 104 113 return null; 105 114 } 106 115 107 foreach ($products as $key => $value) { 108 if (is_array($value['authors'])) { 109 $authors = array_unique($value['authors']); 110 $products[$key]['author'] = implode(', ', $authors); 111 } 112 if (is_array($value['artists'])) { 113 $artists = array_unique($value['artists']); 114 $products[$key]['artist'] = implode(', ', $artists); 115 } 116 } 117 118 $product_page = $products['page']; 119 $product_pages = $products['pages']; 120 $total_num = $products['totalresults']; 121 unset($products[0]); 122 unset($products['page']); 123 unset($products['pages']); 124 unset($products['totalresults']); 125 126 return array($products, $product_page, $product_pages, $total_num); 116 foreach ($products['Item'] as $key => $value) { 117 if (is_array($value['ItemAttributes']['Author'])) { 118 $authors = array_unique($value['ItemAttributes']['Author']); 119 $products['Item'][$key]['author'] = implode(', ', $authors); 120 } 121 if (is_array($value['ItemAttributes']['Aritst'])) { 122 $artists = array_unique($value['ItemAttributes']['Artist']); 123 $products['Item'][$key]['artist'] = implode(', ', $artists); 124 } 125 } 126 127 $product_page = $products['Request']['ItemSearchRequest']['ItemPage']; 128 $product_pages = $products['TotalPages']; 129 $total_num = $products['TotalResults']; 130 131 return array($products['Item'], $product_page, $product_pages, $total_num); 127 132 } 128 133 129 134 function db_review_write_product4asin($asin) 130 135 { 131 include_once 'Services/Amazon.php'; 132 $amazon =& new Services_Amazon(AMAZON_TOKEN, AMAZON_AFFID, AMAZON_LOCALE, AMAZON_BASEURL); 136 include_once 'Services/AmazonECS4.php'; 137 $amazon =& new Services_AmazonECS4(AMAZON_TOKEN, AMAZON_AFFID); 138 $amazon->setLocale(AMAZON_LOCALE); 139 $amazon->setBaseUrl(AMAZON_BASEURL); 133 140 $keyword = mb_convert_encoding($keyword, "UTF-8", "auto"); 134 141 135 $result = $amazon->searchAsin($asin); 142 $options = array(); 143 $options['ResponseGroup'] = 'Large'; 144 $result = $amazon->ItemLookup($asin, $options); 136 145 if (PEAR::isError($result)) { 137 146 return false; 138 147 } 139 140 $product =$result[1]; 141 if ($result[1]['authors']) { 142 $product['author'] = implode(',', $result[1]['authors']); 143 } 144 145 if (!is_array($product)) { 146 return false; 147 } 148 foreach ($product as $key => $value) { 149 $product[$key] = mb_convert_encoding($value, 'UTF-8', 'auto'); 148 if (empty($result['Request']['IsValid']) || $result['Request']['IsValid'] !== 'True') { 149 return null; 150 } 151 152 $product = $result['Item'][0]; 153 if (is_array($product['ItemAttributes']['Author'])) { 154 $authors = array_unique($product['ItemAttributes']['Author']); 155 $product['author'] = implode(', ', $authors); 156 } 157 if (is_array($product['ItemAttributes']['Aritst'])) { 158 $artists = array_unique($product['ItemAttributes']['Artist']); 159 $product['artist'] = implode(', ', $artists); 150 160 } 151 161 … … 503 513 { 504 514 $sql = 'SELECT c_review_id FROM c_review WHERE asin = ?'; 505 $params = array($product[' asin']);515 $params = array($product['ASIN']); 506 516 if ($c_review_id = db_get_one($sql, $params)) { 507 517 return $c_review_id; … … 509 519 510 520 $data = array( 511 'title' => $product[' name'],512 'release_date' => $product[' release'],513 'manufacturer' => $product[' manufacturer'],521 'title' => $product['ItemAttributes']['Title'], 522 'release_date' => $product['ItemAttributes']['PublicationDate'], 523 'manufacturer' => $product['ItemAttributes']['Manufacturer'], 514 524 'author' => $product['author'], 515 525 'c_review_category_id' => intval($c_review_category_id), 516 'image_small' => $product[' imagesmall'],517 'image_medium' => $product[' imagemedium'],518 'image_large' => $product[' imagelarge'],519 'url' => $product[' url'],520 'asin' => $product[' asin'],521 'list_price' => $product[' listprice'],522 'retail_price' => $product[' ourprice'],526 'image_small' => $product['MediumImage']['URL'], 527 'image_medium' => $product['MediumImage']['URL'], 528 'image_large' => $product['MediumImage']['URL'], 529 'url' => $product['DetailPageURL'], 530 'asin' => $product['ASIN'], 531 'list_price' => $product['ListPrice']['FormattedPrice'], 532 'retail_price' => $product['OfferSummary']['LowestUsedPrice']['FormattedPrice'], 523 533 'r_datetime' => db_now(), 524 534 ); -
OpenPNE/branches/stable-2.10.x/webapp/modules/pc/templates/h_review_add.tpl
r5358 r6001 180 180 <div class="padding_s"> 181 181 182 <a href="({$product. url})" target="_blank"><img src="({if $product.imagemedium})({$product.imagemedium})({else})({t_img_url_skin filename=no_image w=120 h=120})({/if})"><br>詳細を見る</a>182 <a href="({$product.DetailPageURL})" target="_blank"><img src="({if $product.MediumImage})({$product.MediumImage.URL})({else})./skin/dummy.gif({/if})"><br>詳細を見る</a> 183 183 184 184 </div> … … 208 208 <div class="padding_s"> 209 209 210 <span class="b_b">({$product. name})</span>210 <span class="b_b">({$product.ItemAttributes.Title})</span> 211 211 212 212 </div> … … 240 240 <div class="padding_s"> 241 241 242 ({$product. release})<br>243 ({$product. manufacturer})<br>242 ({$product.ItemAttributes.PublicationDate})<br> 243 ({$product.ItemAttributes.Manufacturer})<br> 244 244 ({$product.artist})({$product.author}) 245 245 … … 262 262 <div class="padding_s"> 263 263 264 <a href="({t_url m=pc a=page_h_review_add_write})&category_id=({$category_id})&asin=({$product. asin})">レビューを書く</a>264 <a href="({t_url m=pc a=page_h_review_add_write})&category_id=({$category_id})&asin=({$product.ASIN})">レビューを書く</a> 265 265 266 266 </div> -
OpenPNE/branches/stable-2.10.x/webapp/modules/pc/templates/h_review_add_write.tpl
r5358 r6001 46 46 <td class="bg_02" style="width:180px;" align="center" rowspan="7"> 47 47 48 <a href="({$product. url})" target="_blank"><img src="({if $product.imagemedium})({$product.imagemedium})({else})({t_img_url_skin filename=no_image w=120 h=120})({/if})"><br>詳細を見る</a>48 <a href="({$product.DetailPageURL})" target="_blank"><img src="({if $product.MediumImage})({$product.MediumImage.URL})({else})./skin/dummy.gif({/if})"><br>詳細を見る</a> 49 49 50 50 </td> … … 64 64 <div class="padding_s"> 65 65 66 ({$product. name})66 ({$product.ItemAttributes.Title}) 67 67 68 68 </div> … … 93 93 <div class="padding_s"> 94 94 95 ({$product. release})<br>96 ({$product. manufacturer})<br>97 ({$product.artist})({$product.author}) <br>95 ({$product.ItemAttributes.PublicationDate})<br> 96 ({$product.ItemAttributes.Manufacturer})<br> 97 ({$product.artist})({$product.author}) 98 98 99 99 </div>
Note: See TracChangeset
for help on using the changeset viewer.