comparison fr/index.php @ 19:84a412b8122c

try to protect against a range of missing info
author Charlie Root
date Thu, 30 Aug 2018 17:18:12 -0400
parents 077b0a0a3e6d
children a67bf725e87b
comparison
equal deleted inserted replaced
18:c41a5802b26c 19:84a412b8122c
115 } 115 }
116 } 116 }
117 } 117 }
118 else 118 else
119 { 119 {
120 try{ 120 try{
121 $isbn = substr($isbn, 5); 121 $isbn = substr($isbn, 5);
122 $chars = explode("/",$isbn); 122 $chars = explode("/",$isbn);
123 $isbn = $chars[0]; 123 $isbn = $chars[0];
124 $ret = 1; 124 $ret = 1;
125 $countryCode = 4; 125 $countryCode = 4;
138 } 138 }
139 else 139 else
140 { 140 {
141 $bookDetails = getAmazonDet($isbn,1,'fr'); 141 $bookDetails = getAmazonDet($isbn,1,'fr');
142 $bookXML = new SimpleXMLElement($bookDetails); 142 $bookXML = new SimpleXMLElement($bookDetails);
143 $title = $bookXML->Items->Item[0]->ItemAttributes->Title; 143 if ($bookXML->Items && $bookXML->Items->Item[0] &&
144 $author = $bookXML->Items->Item[0]->ItemAttributes->Author; 144 $bookXML->Items->Item[0]->ItemAttributes)
145 { $attrs=$bookXML->Items->Item[0]->ItemAttributes;
146 if ($attrs->Title) {
147 $title = $attrs->Title; }
148 else {
149 $title ="[no Title]";
150 }
151 if ($attrs->Author) {
152 $author = $attrs->Author;
153 }
154 else {
155 $author ="[no Author]";
156 }
157 }
158 else {
159 $title ="[no Title]";
160 $author = "[no Author]";
161 }
145 } 162 }
146 163
147 $linkedBooks = include "../php/read/getLinkedBooks.php"; 164 $linkedBooks = include "../php/read/getLinkedBooks.php";
148 $xml = new SimpleXMLElement($linkedBooks); 165 $xml = new SimpleXMLElement($linkedBooks);
149 166
164 } 181 }
165 else 182 else
166 { 183 {
167 $bookLDetails = getAmazonDet($linkedISBN,1,'fr'); 184 $bookLDetails = getAmazonDet($linkedISBN,1,'fr');
168 $bookLXML = new SimpleXMLElement($bookLDetails); 185 $bookLXML = new SimpleXMLElement($bookLDetails);
169 $titleL = $bookLXML->Items->Item[0]->ItemAttributes->Title; 186 if ($bookLXML->Items &&
170 $authorL = $bookLXML->Items->Item[0]->ItemAttributes->Author; 187 $bookLXML->Items->Item[0] &&
188 $bookLXML->Items->Item[0]->ItemAttributes) {
189 $attrs=$bookLXML->Items->Item[0]->ItemAttributes;
190 if ($attrs->Title) {
191 $titleL = $attrs->Title; }
192 else {
193 $titleL = ""; }
194 if ($attrs->Author) {
195 $authorL = $attrs->Author; }
196 else {
197 $authorL = ""; }
198 }
199 else {
200 $titleL = ""; }
171 } 201 }
172 if($titleL != "") 202 if($titleL != "")
173 { 203 {
174 $recommended .= " $titleL by $authorL,"; 204 $recommended .= " $titleL by $authorL,";
175 $underAuthor = str_replace(" ","_",$authorL); 205 $underAuthor = str_replace(" ","_",$authorL);
243 <p>Thank you for using YourNextRead<p> 273 <p>Thank you for using YourNextRead<p>
244 <img src=\"http://www.yournextread.com/images/topleft.gif\" alt=\"YourNextRead\"/> 274 <img src=\"http://www.yournextread.com/images/topleft.gif\" alt=\"YourNextRead\"/>
245 </noscript>"; 275 </noscript>";
246 if($iPhone && !$iPad) 276 if($iPhone && !$iPad)
247 { 277 {
248 echo "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />"; 278 echo "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />";
249 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksMob/books.nocache.js\"></script>"; 279 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksMob/books.nocache.js\"></script>";
250 } 280 }
251 else 281 else
252 { 282 {
253 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../raphael-min.js\"></script>"; 283 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../raphael-min.js\"></script>";
254 echo $launchScript;//"<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>"; 284 echo $launchScript;//"<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>";
255 } 285 }
256 286
257 echo "</head>"; 287 echo "</head>";
258 288
259 echo "<body>"; 289 echo "<body>";
271 var obj = new Object; 301 var obj = new Object;
272 obj.height=960; 302 obj.height=960;
273 FB.Canvas.setSize(obj); 303 FB.Canvas.setSize(obj);
274 </script>"; 304 </script>";
275 } 305 }
276 } 306 }
277 ?> 307 ?>
278 308
279 <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> 309 <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
280 310
281 <script type="text/javascript"> 311 <script type="text/javascript">