annotate xml/getAmazonInfo.php @ 39:2c0c95bd97a6

pass char for log lines in to doAmazonRequest, move static arrays to aws_s_r
author Charlie Root
date Fri, 04 Jan 2019 18:03:24 -0500
parents 86f79bc1d142
children 3f400072bf14
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
a6b55ae70617 original
robert
parents:
diff changeset
1 <?php
a6b55ae70617 original
robert
parents:
diff changeset
2
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
3 include_once "doAmazonRequest.inc";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
4
4
a6b55ae70617 original
robert
parents:
diff changeset
5 function getAmazonDet($isbn,$go,$localeIn)
a6b55ae70617 original
robert
parents:
diff changeset
6 {
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
7 $Adefault=array(
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
8 'language' =>'en', //what language to render the page in
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
9 'locale' =>$localeIn, //which server's products? available: ca,de,fr,jp,uk,us
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
10 //'mode' =>'books', //what product category?
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
11 'page' =>1, //first page to show (we are counting from 1 not 0)
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
12 //'search' =>'Machiavelli', //what to search for?
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
13 'operation' =>'ItemLookup', //what to do? //ItemSearch
33
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
14 'searchindex' =>'Books', //what product category for search?
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
15 'searchparameter' =>'ItemId', //what kind of search?
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
16 'searchparameterdata'=>$isbn, //what to search for?
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
17 //here some debugging flags you can put at the end of the URL to call this script with, like: '?show_array=true'
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
18 'show_array' =>false, //debug: show complete incoming array? You can use this to see what other information Amazon is sending
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
19 'show_url' =>false, //debug: show XML request url to be send to Amazon?
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
20 'show_xml' =>false, //debug: show incoming XML code from Amazon?
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
21 );
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
22 //change the debug options to true if you want to activate them or call the script with '?show_array=true' to see what actual information you're getting from Amazon and how little my standard script is actually showing of it
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
23 //for all parameters see if the user has overruled it or use the default
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
24 foreach ($Adefault as $i=>$d) {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
25 $$i=isset($_GET[$i])?$_GET[$i]:$d;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
26 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
27 switch($locale){
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
28 case "us":
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
29 $loc = 0;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
30 break;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
31 case "uk":
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
32 $loc = 1;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
33 break;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
34 case "ca":
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
35 $loc = 2;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
36 break;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
37 case "de":
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
38 $loc = 3;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
39 break;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
40 case "fr":
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
41 $loc = 4;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
42 break;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
43 };
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
44
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
45 try {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
46 return getAmazonDetRemote($go,$language,$locale,$loc,
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
47 $page,$operation,$searchparameter,
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
48 $searchparameterdata,
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
49 $show_array,$show_url,$show_xml);
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
50 }
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
51 catch (Exception $e) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
52 return getAmazonDetLocal($go,$language,$loc,
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
53 $page,$operation,$searchparameter,
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
54 $searchparameterdata,
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
55 $show_array,$show_url,$show_xml);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
56 }
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
57 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
58
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
59 function getAmazonDetRemote($go,$language,$locale,$loc,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
60 $page,$operation,$searchparameter,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
61 $searchparameterdata,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
62 $show_array,$show_url,$show_xml)
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
63 {
39
2c0c95bd97a6 pass char for log lines in to doAmazonRequest,
Charlie Root
parents: 35
diff changeset
64 global $output, $Aassociates_id, $Aserver;
4
a6b55ae70617 original
robert
parents:
diff changeset
65
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
66 //if(go != 1)
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
67 //include "aws_signed_request.php";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
68 //this is the data that is used to form the request for AWS
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
69 //this is the part that is search specific
4
a6b55ae70617 original
robert
parents:
diff changeset
70 $parameters=array(
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
71 'Operation' =>$operation ,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
72 //'Keywords' =>urlencode($search) ,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
73 "$searchparameter"=>$searchparameterdata ,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
74 'ItemPage' =>$page , //which page?
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
75 'AssociateTag' =>$Aassociates_id[$locale],
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
76 'ResponseGroup' =>'ItemAttributes,Reviews,EditorialReview,OfferSummary,Offers,Images,AlternateVersions,SalesRank,BrowseNodes' , //Small, Medium, Large or SellerListing,'BrowseNodes',// ,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
77 'ReviewSort' =>'-HelpfulVotes'
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
78 );
4
a6b55ae70617 original
robert
parents:
diff changeset
79
33
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
80 if (isset($searchindex) && $searchindex!='Books') {
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
81 // HST did this
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
82 // Used to be in $parameters init above, but
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
83 // that caused an error:
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
84 // If idType equals ASIN, SearchIndex cannot be present
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
85 //'SearchIndex' =>$searchindex , //Books for example.
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
86 $parameters['SearchIndex']=$searchindex;
c9d9b76ecbf9 minor tidying
Charlie Root
parents: 32
diff changeset
87 }
39
2c0c95bd97a6 pass char for log lines in to doAmazonRequest,
Charlie Root
parents: 35
diff changeset
88 $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3,'i'); // may throw exception
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
89 set_error_handler(function () {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
90 global $output;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
91 file_put_contents('/var/ywww/debug/phpDebug',
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
92 "Caught one?: ".$searchparameterdata,
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
93 FILE_APPEND);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
94 file_put_contents('/var/ywww/debug/phpDebug',
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
95 print_r($output, TRUE)."\n",
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
96 FILE_APPEND);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
97 } );
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
98 $review = $xml->Items->Item->CustomerReviews->IFrameURL;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
99 restore_error_handler();
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
100 //echo $review;
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
101 if ($review != "")
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
102 {
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
103 $review1 = "";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
104 $review2 = "";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
105 $review3 = "";
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
106 $text = @file_get_contents($review . "&truncate=300");
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
107 $removeTop1 = preg_replace('~<div class="crIFrameHeaderLeftColumn">(.*?)<div class="crIFrameHeaderHistogram">~si', '', $text);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
108 $removeTop2 = preg_replace('~<div class="crIFrameHeaderHistogram">(.*?)<div class="crIframeReviewList">~si', '', $text);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
109 if (preg_match('~<body[^>]*>(.*?)</body>~si', $removeTop2, $body)){ $getBody = trim($body[1]); } else { $getBody = $removeTop2;}
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
110 $removeDiv = preg_replace('~<div[^>]*>(.*?)</div>~si', '', $getBody);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
111 $removeCloseDivs = preg_replace('/<\/div>/','', $removeDiv);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
112 $setBoundary = str_replace('<!-- BOUNDARY -->','BOTTOM-TOP', $removeCloseDivs);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
113 //replace <!-- BOUNDARY --> with BOTTOM-TOP
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
114 $remove1 = '~<table cellpadding="0"(.*?)%">~s';
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
115 $setBoundary = preg_replace($remove1,'', $setBoundary);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
116 $remove2 = '~</td><td bg(.*?)</table>~s';
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
117 $setBoundary = preg_replace($remove2,'', $setBoundary);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
118 $remove3 = '~<a name=(.*?)</a>~s';
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
119 $setBoundary = preg_replace($remove3,'', $setBoundary);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
120 $setBoundary2 = str_replace('<br />','', $setBoundary);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
121 //remove all extra crap;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
122 $setBoundary3 = str_replace('</td>','BOTTOM', $setBoundary2);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
123 //replace </td> with BOTTOM
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
124
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
125 if (preg_match_all('~TOP(.*?)BOTTOM~s', $setBoundary3, $reviews))
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
126 {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
127 $reviewContents = $reviews[1];
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
128 //print_r($reviewContents);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
129 $review1 = trim($reviewContents[0]);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
130 $review1 = str_replace("\n", "", $review1);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
131 $review1 = str_replace("\r", "", $review1);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
132 if (isset($reviewContents[1])) {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
133 $review2 = trim($reviewContents[1]);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
134 $review2 = str_replace("\n", "", $review2);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
135 $review2 = str_replace("\r", "", $review2);
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 5
diff changeset
136 }
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 7
diff changeset
137 else {
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
138 $review2 = "";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
139 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
140 if (isset($reviewContents[2])) {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
141 $review3 = trim($reviewContents[2]);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
142 $review3 = str_replace("\n", "", $review3);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
143 $review3 = str_replace("\r", "", $review3);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
144 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
145 else {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
146 $review3 = "";
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 7
diff changeset
147 }
5
55445b456ad0 short-circuit error response handling, add debugging
robert
parents: 4
diff changeset
148 }
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
149 else
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
150 {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
151 $review1 = "";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
152 $review2 = "";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
153 $review3 = "";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
154 //echo "EPIC FAIL";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
155 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
156
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
157 unset($xml->Items->Item->CustomerReviews);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
158 $xdoc = new DomDocument;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
159 $xdoc->loadXML($xml->asXML());
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
160
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
161 $cReviews = $xdoc ->createElement('CustomerReviews');
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
162 $cReviewHolder = $xdoc ->createElement('Review');
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
163 $cReview = $xdoc ->createElement('Content');
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
164 $cReviewHolder2 = $xdoc ->createElement('Review');
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
165 $cReview2 = $xdoc ->createElement('Content');
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
166 $cReviewHolder3 = $xdoc ->createElement('Review');
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
167 $cReview3 = $xdoc ->createElement('Content');
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
168
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
169 $txtNode = $xdoc ->createTextNode ($review1);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
170 $cReview -> appendChild($txtNode);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
171
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
172 $txtNode2 = $xdoc ->createTextNode ($review2);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
173 $cReview2 -> appendChild($txtNode2);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
174
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
175 $txtNode3 = $xdoc ->createTextNode ($review3);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
176 $cReview3 -> appendChild($txtNode3);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
177
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
178 $cReviewHolder -> appendChild($cReview);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
179 $cReviewHolder2 -> appendChild($cReview2);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
180 $cReviewHolder3 -> appendChild($cReview3);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
181
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
182 $cReviews -> appendChild($cReviewHolder);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
183 $cReviews -> appendChild($cReviewHolder2);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
184 $cReviews -> appendChild($cReviewHolder3);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
185
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
186 $xdoc->documentElement->childNodes->item(1)->childNodes->item(1)->appendChild($cReviews);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
187 $newXML = simplexml_import_dom($xdoc);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
188 $output = $newXML->asXml();
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
189 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
190
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
191 if($go == 1) {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
192 $item = $xml->Items->Item[0];
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
193 if ($item && $item->ItemAttributes && $item->ItemAttributes->Title) {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
194 $title = $item->ItemAttributes->Title; }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
195 else { $title = "[no title]"; };
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
196 file_put_contents('/var/ywww/debug/phpDebug',"win: $title\n",
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
197 FILE_APPEND);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
198 return $output;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
199 }
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
200 else {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
201 if ($xml->Items->Item) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
202 $title = $xml->Items->Item[0]->ItemAttributes->Title;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
203 $author = $xml->Items->Item[0]->ItemAttributes->Author;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
204 $binding = $xml->Items->Item[0]->ItemAttributes->Binding;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
205 $dewey = $xml->Items->Item[0]->ItemAttributes->DeweyDecimalNumber;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
206 if($dewey == "")
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
207 $dewey = "null";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
208 $imageURL = $xml->Items->Item[0]->MediumImage->URL;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
209 $salesRank = $xml->Items->Item[0]->SalesRank;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
210 $pubDate = $xml->Items->Item[0]->ItemAttributes->PublicationDate;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
211 if (strlen($pubDate)==4) { $pubDate=$pubDate."-01-01";}
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
212 if (strlen($pubDate)==7) { $pubDate=$pubDate."-01";}
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
213 if (strlen($pubDate)==0) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
214 $pubDate="null";
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
215 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
216 else {
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
217 $pubDate="\"$pubDate\"";
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
218 }
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
219 $publisher = $xml->Items->Item[0]->ItemAttributes->Publisher;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
220 }
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
221 else {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
222 $title = $salesRank = "";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
223 $dewey = "null";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
224 }
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
225
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
226 $genreID = "";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
227 $genre = "";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
228 $genArr = array();
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
229
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
230 if ($xml->Items->Item[0] && $xml->Items->Item[0]->BrowseNodes) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
231 for($i=0;$i<sizeof($xml->Items->Item->BrowseNodes->BrowseNode);$i++){
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
232 //sexy recursive function
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
233 findGenre($xml->Items->Item->BrowseNodes->BrowseNode[$i], $genreID, $genre);
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
234
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
235 if($genre != "")
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
236 $genArr[strval($genreID)] = strval($genre);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
237 //$genArr[$i] = array(strval($genreID) => strval($genre));
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
238
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
239 //echo $genre;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
240 //echo $genreID;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
241
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
242 $genre = "";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
243 $genreID = "";
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
244 }
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
245 }
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
246
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
247 $g1 = "null";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
248 $g2 = "null";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
249 $g3 = "null";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
250 $loop = 1;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
251
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
252 foreach ($genArr as $key => $value) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
253 //echo "$key => $value";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
254 if ($key>2047) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
255 //HST added
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
256 break;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
257 }
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
258 $queryG = "CALL b_addBrowseNode($key,\"$value\")"; //add the name value pair for genre to new table
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
259 //echo $queryG;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
260 include "../../private/db.php";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
261 $resG = mysqli_query($link, $queryG);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
262 mysqli_close($link);
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
263
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
264 switch ($loop) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
265 case 1:
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
266 $g1 = $key;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
267 break;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
268 case 2:
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
269 $g2 = $key;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
270 break;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
271 case 3:
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
272 $g3 = $key;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
273 break;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
274 }
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
275
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
276 $loop++;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
277 }
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
278
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
279 if($salesRank == "")
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
280 $salesRank = "null";
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
281
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
282 if($title != "")
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
283 {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
284 include "../../private/db.php";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
285 if ($publisher->count()==0) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
286 $publisher="null";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
287 }
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
288 else {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
289 $publisher=mysqli_real_escape_string($link,$publisher);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
290 if (strlen($publisher)>30) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
291 $publisher=rtrim(substr($publisher,0,30),"\\");
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
292 }
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
293 $publisher="\"".$publisher."\"";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
294 }
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
295 if ($author->count()==0) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
296 $author="unknown";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
297 }
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
298 else {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
299 $author=mysqli_real_escape_string($link,$author);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
300 if (strlen($author)>30) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
301 $author=rtrim(substr($author,0,30),"\\");
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
302 }
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
303 }
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
304 $author="\"".$author."\"";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
305 $title=mysqli_real_escape_string($link,$title);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
306 if (strlen($title)>100) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
307 $title=rtrim(substr($title,0,100),"\\");
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
308 }
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
309 $title="\"".$title."\"";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
310 $review1 = mysqli_real_escape_string($link,$review1);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
311 if (strlen($review1)>500) { $review1=rtrim(substr($review1,0,500),"\\");}
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
312 $review2 = mysqli_real_escape_string($link,$review2);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
313 if (strlen($review2)>500) { $review2=rtrim(substr($review2,0,500),"\\");}
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
314 $review3 = mysqli_real_escape_string($link,$review3);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
315 if (strlen($review3)>500) { $review3=rtrim(substr($review3,0,500),"\\");}
4
a6b55ae70617 original
robert
parents:
diff changeset
316
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
317 $queryInsert = "CALL b_addNewBook(\"$searchparameterdata\",$title, $author,\"$binding\",\"$imageURL\", $dewey, $salesRank,$pubDate,$publisher,$g1,$g2,$g3,$loc)";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
318 //echo $queryInsert;
25
828895488948 more db column protection
Robert Boland <robert@markup.co.uk>
parents: 23
diff changeset
319
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
320 $res = mysqli_query($link, $queryInsert);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
321 if (!$res) {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
322 $err=mysqli_error( $link );
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
323 mysqli_close($link);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
324 file_put_contents('/var/ywww/debug/phpDebug',
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
325 "anb failed: $queryInsert\n$err\n",
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
326 FILE_APPEND);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
327 exit($err);
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
328 }
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
329 $queryInsertReviews = "CALL b_insertReviews(\"$searchparameterdata\",\"$review1\",\"$review2\",\"$review3\")";
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
330 if($review1 != "") {
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
331 $res = mysqli_query($link, $queryInsertReviews);
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
332 if (!$res) {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
333 $err=mysqli_error( $link );
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
334 mysqli_close($link);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
335 file_put_contents('/var/ywww/debug/phpDebug',
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
336 "anr failed: $queryInsertReviews\n",
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
337 FILE_APPEND);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
338 exit($err);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
339 }
4
a6b55ae70617 original
robert
parents:
diff changeset
340 }
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
341 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
342 }
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
343
35
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
344 echo $output;
86f79bc1d142 refactor to split out shareable fn to actually do an Amazon API request
Charlie Root
parents: 33
diff changeset
345 }
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
346 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
347
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
348 function getAmazonDetLocal($go,$language,$loc,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
349 $page,$operation,$searchparameter,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
350 $searchparameterdata,
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
351 $show_array,$show_url,$show_xml)
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
352 {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
353 global $output;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
354 //look up info from db
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
355 include "../../private/db.php";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
356 $query = "CALL b_getBookInfo('$searchparameterdata', $loc)";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
357 //echo $query;
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
358 $res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
4
a6b55ae70617 original
robert
parents:
diff changeset
359
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
360 $output = "";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
361 $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
362 $output .= "<Details>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
363 if ( mysqli_num_rows( $res ) > 0 )
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
364 {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
365 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
366 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
367 $output .= "<ASIN>" . $searchparameterdata . "</ASIN>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
368 $output .= "<Title>" . htmlspecialchars($rows["Title"]) . "</Title>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
369 $output .= "<Author>" . htmlspecialchars($rows["Author"]) . "</Author>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
370 $output .= "<Binding>" . htmlspecialchars($rows["Binding"]) . "</Binding>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
371 $output .= "<Dewey>" . htmlspecialchars($rows["DeweyDecimal"]) . "</Dewey>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
372 $output .= "<ImageURL>" . htmlspecialchars($rows["ImageURL"]) . "</ImageURL>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
373 $output .= "<SalesRank>" . htmlspecialchars($rows["SalesRank"]) . "</SalesRank>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
374 $output .= "<PublicationDate>" . htmlspecialchars($rows["PublicationDate"]) . "</PublicationDate>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
375 $output .= "<Publisher>" . htmlspecialchars($rows["Publisher"]) . "</Publisher>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
376 $output .= "<Genre1>" . htmlspecialchars($rows["Genre1"]) . "</Genre1>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
377 $output .= "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
378 $output .= "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
379 $output .= "<ProductGroup>Book</ProductGroup>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
380 $output .= "<Error>AccountLimitExceeded</Error>";
4
a6b55ae70617 original
robert
parents:
diff changeset
381
32
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
382 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
383 else {
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
384 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
385 }
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
386 $output .= "</Details>";
8130865e9e82 refactor to try to improve error handling
Charlie Root
parents: 31
diff changeset
387 echo $output;
4
a6b55ae70617 original
robert
parents:
diff changeset
388 }
a6b55ae70617 original
robert
parents:
diff changeset
389
a6b55ae70617 original
robert
parents:
diff changeset
390 function findGenre($browseNode, &$ID, &$gen)
a6b55ae70617 original
robert
parents:
diff changeset
391 {
a6b55ae70617 original
robert
parents:
diff changeset
392 if($browseNode->Name == "Subjects")
a6b55ae70617 original
robert
parents:
diff changeset
393 {
a6b55ae70617 original
robert
parents:
diff changeset
394 return true;
a6b55ae70617 original
robert
parents:
diff changeset
395 }
a6b55ae70617 original
robert
parents:
diff changeset
396 else
a6b55ae70617 original
robert
parents:
diff changeset
397 {
a6b55ae70617 original
robert
parents:
diff changeset
398 if($browseNode->Ancestors->BrowseNode)
a6b55ae70617 original
robert
parents:
diff changeset
399 {
a6b55ae70617 original
robert
parents:
diff changeset
400 if(findGenre($browseNode->Ancestors->BrowseNode, $ID, $gen) == true)
a6b55ae70617 original
robert
parents:
diff changeset
401 {
a6b55ae70617 original
robert
parents:
diff changeset
402 $gen = $browseNode->Name;
a6b55ae70617 original
robert
parents:
diff changeset
403 $ID = $browseNode->BrowseNodeId;
a6b55ae70617 original
robert
parents:
diff changeset
404 }
a6b55ae70617 original
robert
parents:
diff changeset
405 }
a6b55ae70617 original
robert
parents:
diff changeset
406 return false;
a6b55ae70617 original
robert
parents:
diff changeset
407 }
a6b55ae70617 original
robert
parents:
diff changeset
408 }
a6b55ae70617 original
robert
parents:
diff changeset
409
a6b55ae70617 original
robert
parents:
diff changeset
410 if(!isset($ret))
a6b55ae70617 original
robert
parents:
diff changeset
411 {
39
2c0c95bd97a6 pass char for log lines in to doAmazonRequest,
Charlie Root
parents: 35
diff changeset
412 include "aws_signed_request.php";
2c0c95bd97a6 pass char for log lines in to doAmazonRequest,
Charlie Root
parents: 35
diff changeset
413 getAmazonDet('default',0,'us'); //will get overwritten from URI params
2c0c95bd97a6 pass char for log lines in to doAmazonRequest,
Charlie Root
parents: 35
diff changeset
414 // by the foreach ($Adefault as ... loop above
4
a6b55ae70617 original
robert
parents:
diff changeset
415 }
a6b55ae70617 original
robert
parents:
diff changeset
416 /*Caught oneSimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
417 (
a6b55ae70617 original
robert
parents:
diff changeset
418 [OperationRequest] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
419 (
a6b55ae70617 original
robert
parents:
diff changeset
420 [RequestId] => d2eaacba-2411-44e7-b268-f23a20167330
a6b55ae70617 original
robert
parents:
diff changeset
421 [Arguments] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
422 (
a6b55ae70617 original
robert
parents:
diff changeset
423 [Argument] => Array
a6b55ae70617 original
robert
parents:
diff changeset
424 (
a6b55ae70617 original
robert
parents:
diff changeset
425 [0] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
426 (
a6b55ae70617 original
robert
parents:
diff changeset
427 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
428 (
a6b55ae70617 original
robert
parents:
diff changeset
429 [Name] => AWSAccessKeyId
17
ae1459564f66 Replace old associate keys with new IAMs user keys
Robert Boland <robert@markup.co.uk>
parents: 11
diff changeset
430 [Value] => AKIAIHTNWC7L6LOUY4LQ
4
a6b55ae70617 original
robert
parents:
diff changeset
431 )
a6b55ae70617 original
robert
parents:
diff changeset
432
a6b55ae70617 original
robert
parents:
diff changeset
433 )
a6b55ae70617 original
robert
parents:
diff changeset
434
a6b55ae70617 original
robert
parents:
diff changeset
435 [1] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
436 (
a6b55ae70617 original
robert
parents:
diff changeset
437 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
438 (
a6b55ae70617 original
robert
parents:
diff changeset
439 [Name] => AssociateTag
a6b55ae70617 original
robert
parents:
diff changeset
440 [Value] => bookwhack-21
a6b55ae70617 original
robert
parents:
diff changeset
441 )
a6b55ae70617 original
robert
parents:
diff changeset
442
a6b55ae70617 original
robert
parents:
diff changeset
443 )
a6b55ae70617 original
robert
parents:
diff changeset
444
a6b55ae70617 original
robert
parents:
diff changeset
445 [2] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
446 (
a6b55ae70617 original
robert
parents:
diff changeset
447 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
448 (
a6b55ae70617 original
robert
parents:
diff changeset
449 [Name] => ItemId
a6b55ae70617 original
robert
parents:
diff changeset
450 [Value] => B004Q3Q3Y4
a6b55ae70617 original
robert
parents:
diff changeset
451 )
a6b55ae70617 original
robert
parents:
diff changeset
452
a6b55ae70617 original
robert
parents:
diff changeset
453 )
a6b55ae70617 original
robert
parents:
diff changeset
454
a6b55ae70617 original
robert
parents:
diff changeset
455 [3] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
456 (
a6b55ae70617 original
robert
parents:
diff changeset
457 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
458 (
a6b55ae70617 original
robert
parents:
diff changeset
459 [Name] => ItemPage
a6b55ae70617 original
robert
parents:
diff changeset
460 [Value] => 1
a6b55ae70617 original
robert
parents:
diff changeset
461 )
a6b55ae70617 original
robert
parents:
diff changeset
462
a6b55ae70617 original
robert
parents:
diff changeset
463 )
a6b55ae70617 original
robert
parents:
diff changeset
464
a6b55ae70617 original
robert
parents:
diff changeset
465 [4] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
466 (
a6b55ae70617 original
robert
parents:
diff changeset
467 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
468 (
a6b55ae70617 original
robert
parents:
diff changeset
469 [Name] => Operation
a6b55ae70617 original
robert
parents:
diff changeset
470 [Value] => ItemLookup
a6b55ae70617 original
robert
parents:
diff changeset
471 )
a6b55ae70617 original
robert
parents:
diff changeset
472
a6b55ae70617 original
robert
parents:
diff changeset
473 )
a6b55ae70617 original
robert
parents:
diff changeset
474
a6b55ae70617 original
robert
parents:
diff changeset
475 [5] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
476 (
a6b55ae70617 original
robert
parents:
diff changeset
477 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
478 (
a6b55ae70617 original
robert
parents:
diff changeset
479 [Name] => ResponseGroup
a6b55ae70617 original
robert
parents:
diff changeset
480 [Value] => ItemAttributes,Reviews,EditorialReview,OfferSummary,Offers,Images,AlternateVersions,SalesRank,BrowseNodes
a6b55ae70617 original
robert
parents:
diff changeset
481 )
a6b55ae70617 original
robert
parents:
diff changeset
482
a6b55ae70617 original
robert
parents:
diff changeset
483 )
a6b55ae70617 original
robert
parents:
diff changeset
484
a6b55ae70617 original
robert
parents:
diff changeset
485 [6] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
486 (
a6b55ae70617 original
robert
parents:
diff changeset
487 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
488 (
a6b55ae70617 original
robert
parents:
diff changeset
489 [Name] => ReviewSort
a6b55ae70617 original
robert
parents:
diff changeset
490 [Value] => -HelpfulVotes
a6b55ae70617 original
robert
parents:
diff changeset
491 )
a6b55ae70617 original
robert
parents:
diff changeset
492
a6b55ae70617 original
robert
parents:
diff changeset
493 )
a6b55ae70617 original
robert
parents:
diff changeset
494
a6b55ae70617 original
robert
parents:
diff changeset
495 [7] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
496 (
a6b55ae70617 original
robert
parents:
diff changeset
497 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
498 (
a6b55ae70617 original
robert
parents:
diff changeset
499 [Name] => Service
a6b55ae70617 original
robert
parents:
diff changeset
500 [Value] => AWSECommerceService
a6b55ae70617 original
robert
parents:
diff changeset
501 )
a6b55ae70617 original
robert
parents:
diff changeset
502
a6b55ae70617 original
robert
parents:
diff changeset
503 )
a6b55ae70617 original
robert
parents:
diff changeset
504
a6b55ae70617 original
robert
parents:
diff changeset
505 [8] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
506 (
a6b55ae70617 original
robert
parents:
diff changeset
507 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
508 (
a6b55ae70617 original
robert
parents:
diff changeset
509 [Name] => Timestamp
a6b55ae70617 original
robert
parents:
diff changeset
510 [Value] => 2016-12-15T23:12:34Z
a6b55ae70617 original
robert
parents:
diff changeset
511 )
a6b55ae70617 original
robert
parents:
diff changeset
512
a6b55ae70617 original
robert
parents:
diff changeset
513 )
a6b55ae70617 original
robert
parents:
diff changeset
514
a6b55ae70617 original
robert
parents:
diff changeset
515 [9] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
516 (
a6b55ae70617 original
robert
parents:
diff changeset
517 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
518 (
a6b55ae70617 original
robert
parents:
diff changeset
519 [Name] => Version
a6b55ae70617 original
robert
parents:
diff changeset
520 [Value] => 2011-08-01
a6b55ae70617 original
robert
parents:
diff changeset
521 )
a6b55ae70617 original
robert
parents:
diff changeset
522
a6b55ae70617 original
robert
parents:
diff changeset
523 )
a6b55ae70617 original
robert
parents:
diff changeset
524
a6b55ae70617 original
robert
parents:
diff changeset
525 [10] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
526 (
a6b55ae70617 original
robert
parents:
diff changeset
527 [@attributes] => Array
a6b55ae70617 original
robert
parents:
diff changeset
528 (
a6b55ae70617 original
robert
parents:
diff changeset
529 [Name] => Signature
a6b55ae70617 original
robert
parents:
diff changeset
530 [Value] => SUXfFZHQ74Joc+WDLx87uzemTdtHijNohykqafJXYKQ=
a6b55ae70617 original
robert
parents:
diff changeset
531 )
a6b55ae70617 original
robert
parents:
diff changeset
532
a6b55ae70617 original
robert
parents:
diff changeset
533 )
a6b55ae70617 original
robert
parents:
diff changeset
534
a6b55ae70617 original
robert
parents:
diff changeset
535 )
a6b55ae70617 original
robert
parents:
diff changeset
536
a6b55ae70617 original
robert
parents:
diff changeset
537 )
a6b55ae70617 original
robert
parents:
diff changeset
538
a6b55ae70617 original
robert
parents:
diff changeset
539 [RequestProcessingTime] => 0.3518217620000000
a6b55ae70617 original
robert
parents:
diff changeset
540 )
a6b55ae70617 original
robert
parents:
diff changeset
541
a6b55ae70617 original
robert
parents:
diff changeset
542 [Items] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
543 (
a6b55ae70617 original
robert
parents:
diff changeset
544 [Request] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
545 (
a6b55ae70617 original
robert
parents:
diff changeset
546 [IsValid] => True
a6b55ae70617 original
robert
parents:
diff changeset
547 [ItemLookupRequest] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
548 (
a6b55ae70617 original
robert
parents:
diff changeset
549 [IdType] => ASIN
a6b55ae70617 original
robert
parents:
diff changeset
550 [ItemId] => B004Q3Q3Y4
a6b55ae70617 original
robert
parents:
diff changeset
551 [ResponseGroup] => Array
a6b55ae70617 original
robert
parents:
diff changeset
552 (
a6b55ae70617 original
robert
parents:
diff changeset
553 [0] => ItemAttributes
a6b55ae70617 original
robert
parents:
diff changeset
554 [1] => Reviews
a6b55ae70617 original
robert
parents:
diff changeset
555 [2] => EditorialReview
a6b55ae70617 original
robert
parents:
diff changeset
556 [3] => OfferSummary
a6b55ae70617 original
robert
parents:
diff changeset
557 [4] => Offers
a6b55ae70617 original
robert
parents:
diff changeset
558 [5] => Images
a6b55ae70617 original
robert
parents:
diff changeset
559 [6] => AlternateVersions
a6b55ae70617 original
robert
parents:
diff changeset
560 [7] => SalesRank
a6b55ae70617 original
robert
parents:
diff changeset
561 [8] => BrowseNodes
a6b55ae70617 original
robert
parents:
diff changeset
562 )
a6b55ae70617 original
robert
parents:
diff changeset
563
a6b55ae70617 original
robert
parents:
diff changeset
564 [VariationPage] => All
a6b55ae70617 original
robert
parents:
diff changeset
565 )
a6b55ae70617 original
robert
parents:
diff changeset
566
a6b55ae70617 original
robert
parents:
diff changeset
567 [Errors] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
568 (
a6b55ae70617 original
robert
parents:
diff changeset
569 [Error] => SimpleXMLElement Object
a6b55ae70617 original
robert
parents:
diff changeset
570 (
a6b55ae70617 original
robert
parents:
diff changeset
571 [Code] => AWS.InvalidParameterValue
a6b55ae70617 original
robert
parents:
diff changeset
572 [Message] => B004Q3Q3Y4 is not a valid value for ItemId. Please change this value and retry your request.
a6b55ae70617 original
robert
parents:
diff changeset
573 )
a6b55ae70617 original
robert
parents:
diff changeset
574
a6b55ae70617 original
robert
parents:
diff changeset
575 )
a6b55ae70617 original
robert
parents:
diff changeset
576
a6b55ae70617 original
robert
parents:
diff changeset
577 )
a6b55ae70617 original
robert
parents:
diff changeset
578
a6b55ae70617 original
robert
parents:
diff changeset
579 )
a6b55ae70617 original
robert
parents:
diff changeset
580
a6b55ae70617 original
robert
parents:
diff changeset
581 )
a6b55ae70617 original
robert
parents:
diff changeset
582 */
21
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 19
diff changeset
583 /*$xml = new SimpleXMLElement("<?xml version=\"1.0\"?><ItemLookupErrorResponse xmlns=\"http://ecs.amazonaws.com/doc/2009-03-31/\"><Error><Code>AccountLimitExceeded</Code><Message>Account limit of 2056 requests per hour exceeded.</Message></Error><RequestID>290ed059-730c-4789-93b4-6d21e11053d3</RequestID></ItemLookupErrorResponse>");*/
4
a6b55ae70617 original
robert
parents:
diff changeset
584 ?>