Mercurial > hg > ywww
comparison ca/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 |
---|---|
58 echo "<!DOCTYPE html><html>"; | 58 echo "<!DOCTYPE html><html>"; |
59 if($proceed) | 59 if($proceed) |
60 { | 60 { |
61 echo "<head>"; | 61 echo "<head>"; |
62 echo "<meta name=\"fragment\" content=\"!\">"; | 62 echo "<meta name=\"fragment\" content=\"!\">"; |
63 | 63 echo "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />"; |
64 echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">"; | 64 echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">"; |
65 echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"../Books.css\">"; | 65 echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"../Books.css\">"; |
66 | 66 |
67 if(isset($_GET['_escaped_fragment_'])) { | 67 if(isset($_GET['_escaped_fragment_'])) { |
68 $isbn = $_GET['_escaped_fragment_']; | 68 $isbn = $_GET['_escaped_fragment_']; |
138 } | 138 } |
139 else | 139 else |
140 { | 140 { |
141 $bookDetails = getAmazonDet($isbn,1,'ca'); | 141 $bookDetails = getAmazonDet($isbn,1,'ca'); |
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,'ca'); | 184 $bookLDetails = getAmazonDet($linkedISBN,1,'ca'); |
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); |
202 else | 232 else |
203 { | 233 { |
204 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../raphael-min.js\"></script>"; | 234 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../raphael-min.js\"></script>"; |
205 echo $launchScript;//"<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>"; | 235 echo $launchScript;//"<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>"; |
206 } | 236 } |
237 | |
207 echo "</head>"; | 238 echo "</head>"; |
208 | 239 |
209 echo "<body>"; | 240 echo "<body>"; |
210 echo "<p>Recommended Books for <b>$title</b> by <b>$author</b>:"; | 241 echo "<p>Recommended Books for <b>$title</b> by <b>$author</b>:"; |
211 echo $linkedRecommended . "</p>"; | 242 echo $linkedRecommended . "</p>"; |
220 echo "Switch to <a href=\"http://www.YourNextGame.com/ca/\">YourNextGame</a>"; | 251 echo "Switch to <a href=\"http://www.YourNextGame.com/ca/\">YourNextGame</a>"; |
221 } | 252 } |
222 catch(Exception $e) | 253 catch(Exception $e) |
223 { | 254 { |
224 echo 'Message: ' .$e->getMessage(); | 255 echo 'Message: ' .$e->getMessage(); |
225 } | 256 } |
226 } | 257 } |
227 } | 258 } |
228 else | 259 else |
229 { | 260 { |
230 echo "<META NAME=\"Description\" CONTENT=\"YourNextRead recommends your next book. YourNextRead provides a book recommendation system showing aggregated book reviews, updated by real peoples opinions, in a simple visual map, helping you to decide 'What Should I Read Next?'. Perfect for both bookworms and casual readers!\">"; | 261 echo "<META NAME=\"Description\" CONTENT=\"YourNextRead recommends your next book. YourNextRead provides a book recommendation system showing aggregated book reviews, updated by real peoples opinions, in a simple visual map, helping you to decide 'What Should I Read Next?'. Perfect for both bookworms and casual readers!\">"; |
250 else | 281 else |
251 { | 282 { |
252 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>"; |
253 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>"; |
254 } | 285 } |
286 | |
255 echo "</head>"; | 287 echo "</head>"; |
256 | 288 |
257 echo "<body>"; | 289 echo "<body>"; |
258 echo "<div id=\"fb-root\"></div> | 290 echo "<div id=\"fb-root\"></div> |
259 <script type=\"text/javascript\" src=\"http://connect.facebook.net/en_US/all.js\"></script> | 291 <script type=\"text/javascript\" src=\"http://connect.facebook.net/en_US/all.js\"></script> |
269 var obj = new Object; | 301 var obj = new Object; |
270 obj.height=960; | 302 obj.height=960; |
271 FB.Canvas.setSize(obj); | 303 FB.Canvas.setSize(obj); |
272 </script>"; | 304 </script>"; |
273 } | 305 } |
274 } | 306 } |
275 ?> | 307 ?> |
276 | 308 |
277 <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> |
278 | 310 |
279 <script type="text/javascript"> | 311 <script type="text/javascript"> |