comparison ca/bkp_index.php @ 6:077b0a0a3e6d

remaining originals according to dependency walk
author Robert Boland <robert@markup.co.uk>
date Thu, 16 Feb 2017 22:29:02 +0000
parents
children
comparison
equal deleted inserted replaced
5:55445b456ad0 6:077b0a0a3e6d
1 <!DOCTYPE html>
2
3 <html>
4 <?PHP
5
6 function uniqueRand($n, $min = 0, $max = null)
7 {
8 if($max === null)
9 $max = getrandmax();
10 $array = range($min, $max);
11 $return = array();
12 $keys = array_rand($array, $n);
13 foreach($keys as $key)
14 $return[] = $array[$key];
15 return $return;
16 }
17
18 //include "../mdetect.php";
19 //$uagent_obj = new uagent_info();
20 //$iPhone = $uagent_obj->DetectSmartphone();
21 //$iPad = $uagent_obj->DetectIpad();
22
23 echo "<head>";
24 echo "<meta name=\"fragment\" content=\"!\">";
25 echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">";
26 echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"../Books.css\">";
27
28 if(isset($_GET['_escaped_fragment_'])) {
29 $isbn = $_GET['_escaped_fragment_'];
30 if($isbn == ""){
31 echo "<META NAME=\"Description\" CONTENT=\"Discover and share your next book at YourNextRead. YourNextRead makes book discovery and recommendation simple. Great for both bookworms and casual readers!\">";
32
33 echo "<title>YourNextRead: Book Recommendations (Canada)</title>";
34 echo "<div id=\"script\"></div><noscript>
35 <p>You need to have Javascript enabled to use YourNextRead - Sorry!<p>
36 <p>Please see instructions on how to switch this on, depending on which browser you use:<p>
37 <ul>
38 <li><a href=\"http://www.ehow.com/how_2033406_enable-javascript-firefox.html\">Firefox</a></li>
39 <li><a href=\"http://www.chromefans.org/chrome-tutorial/how-to-enable-or-disable-javascript-in-google-chrome.htm\">Chrome</a></li>
40 <li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
41 </ul>
42 <p>Thank you for using YourNextRead<p>
43 <img src=\"http://www.yournextread.com/images/topleft.gif\" alt=\"YourNextRead\"/>
44 </noscript>";
45 //if($iPhone)
46 // echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksMob/books.nocache.js\"></script>";
47 //else
48 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>";
49 echo "</head>";
50 echo "<body>";
51 //we are at the launch page
52 echo "<p>Get started, search for a book you like... or choose from one of the lists below:</p><BR></BR>";
53
54 $ret = 1;
55
56 $bookLists = include "../php/read/getAllSavedBooks.php";
57 $xml = new SimpleXMLElement($bookLists);
58
59 $numOfLists = sizeof($xml->List) - 1; //-1 for zero indexing
60
61 $randomFourLists = uniqueRand(4,0,$numOfLists);
62
63 foreach ($randomFourLists as $id) {
64 $ListName = $xml->List[$id]->SavedListName;
65 echo "<p><b>$ListName</b></p><BR></BR>";
66 for($i=0;$i<sizeof($xml->List[$id]->ListDetails->Book);$i++){
67 $bookTitle = $xml->List[$id]->ListDetails->Book[$i]->BookTitle;
68 $isbn = $xml->List[$id]->ListDetails->Book[$i]->ISBN;
69 echo "<a href=http://www.YourNextRead.com/ca/#!isbn=$isbn>$bookTitle</a> ";
70 }
71 }
72 }
73 else
74 {
75 $isbn = substr($isbn, 5);
76 $ret = 1;
77 $countryCode = 2;
78
79 $linkedBooks = include "../php/read/getLinkedBooks.php";
80
81 $xml = new SimpleXMLElement($linkedBooks);
82
83 include "../xml/getAmazonInfo.php";
84 $bookDetails = getAmazonDet($isbn,1,'ca');
85 $bookXML = new SimpleXMLElement($bookDetails);
86
87 $title = $bookXML->Items->Item[0]->ItemAttributes->Title;
88 $author = $bookXML->Items->Item[0]->ItemAttributes->Author;
89
90 $amazonReview = $bookXML->Items->Item[0]->EditorialReviews[0]->EditorialReview->Content;
91 $amazonRating = $bookXML->Items->Item[0]->CustomerReviews[0]->AverageRating;
92
93 $recommended = "";
94 $linkedRecommended = "";
95 for($i=0;$i<sizeof($xml->isbn);$i++){
96 $linkedISBN = $xml->isbn[$i];
97 $bookLDetails = getAmazonDet($linkedISBN,1,'ca');
98 $bookLXML = new SimpleXMLElement($bookLDetails);
99 $titleL = $bookLXML->Items->Item[0]->ItemAttributes->Title;
100 $authorL = $bookLXML->Items->Item[0]->ItemAttributes->Author;
101 if($titleL != "")
102 {
103 $recommended .= " $titleL by $authorL,";
104 $linkedRecommended .= "<a href=\"http://www.YourNextRead.com/ca/#!isbn=$linkedISBN\">$titleL by $authorL</a>, ";
105 }
106 }
107
108 $vote = "Vote on these recommendations!";
109
110 echo "<META NAME=\"Description\" CONTENT=\"YourNextRead recommended books for $title by $author:$recommended $vote\">";
111
112 echo "<title>YourNextRead (Canada) Recommended Books for $title by $author</title>";
113 echo "<div id=\"script\"></div><noscript>
114 <p>You need to have Javascript enabled to use YourNextRead - Sorry!<p>
115 <p>Please see instructions on how to switch this on, depending on which browser you use:<p>
116 <ul>
117 <li><a href=\"http://www.ehow.com/how_2033406_enable-javascript-firefox.html\">Firefox</a></li>
118 <li><a href=\"http://www.chromefans.org/chrome-tutorial/how-to-enable-or-disable-javascript-in-google-chrome.htm\">Chrome</a></li>
119 <li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
120 </ul>
121 <p>Thank you for using YourNextRead<p>
122 <img src=\"http://www.yournextread.com/images/topleft.gif\" alt=\"YourNextRead\"/>
123 </noscript>";
124 //if($iPhone)
125 // echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksMob/books.nocache.js\"></script>";
126 //else
127 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>";
128
129 echo "</head>";
130
131 echo "<body>";
132 echo "<p>Recommended Books for <b>$title</b> by <b>$author</b>:";
133 echo $linkedRecommended;
134 echo $vote;
135
136 echo "<BR></BR><b>Amazon Review</b>: $amazonReview";
137 echo "<BR></BR><b>Amazon AvgRating</b>: $amazonRating";
138
139 echo "<BR></BR><b>Customer Reviews</b>: ";
140
141 for($i=0;$i<sizeof($bookXML->Items->Item[0]->CustomerReviews[0]->Review);$i++){
142 $customerReview = $bookXML->Items->Item[0]->CustomerReviews[0]->Review[$i]->Content;
143 echo "<BR></BR><b>Customer Review $i</b>:<BR></BR>$customerReview";
144 }
145 echo "</p>";
146
147 echo "Change to <a href=\"http://www.YourNextRead.com/fr/#!isbn=$linkedISBN\">YourNextRead France</a>, ";
148 echo "Change to <a href=\"http://www.YourNextRead.com/de/#!isbn=$linkedISBN\">YourNextRead Germany</a>, ";
149 echo "Change to <a href=\"http://www.YourNextRead.com/uk/#!isbn=$linkedISBN\">YourNextRead UK</a>, ";
150 echo "Change to <a href=\"http://www.YourNextRead.com/us/#!isbn=$linkedISBN\">YourNextRead USA</a>";
151 }
152 }
153 else
154 {
155 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!\">";
156
157 echo "<title>YourNextRead: Book Recommendations (Canada)</title>";
158 //the title will get changed dynamically in the GWT code
159 echo "<div id=\"script\"></div><noscript>
160 <p>You need to have Javascript enabled to use YourNextRead - Sorry!<p>
161 <p>Please see instructions on how to switch this on, depending on which browser you use:<p>
162 <ul>
163 <li><a href=\"http://www.ehow.com/how_2033406_enable-javascript-firefox.html\">Firefox</a></li>
164 <li><a href=\"http://www.chromefans.org/chrome-tutorial/how-to-enable-or-disable-javascript-in-google-chrome.htm\">Chrome</a></li>
165 <li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
166 </ul>
167 <p>Thank you for using YourNextRead<p>
168 <img src=\"http://www.yournextread.com/images/topleft.gif\" alt=\"YourNextRead\"/>
169 </noscript>";
170 //if($iPhone)
171 // echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksMob/books.nocache.js\"></script>";
172 //else
173 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>";
174
175 echo "</head>";
176
177 echo "<body>";
178 }
179 ?>
180
181 <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
182
183 <script type="text/javascript">
184 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
185 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
186 </script>
187 <script type="text/javascript">
188 try {
189 var pageTracker = _gat._getTracker("UA-15026249-1");
190 pageTracker._setDomainName("none");
191 pageTracker._setAllowLinker(true);
192 pageTracker._trackPageview();
193 } catch(err) {}</script>
194 </body>
195 </html>