annotate us/index.php @ 45:8bc395c87c6f

less built-in use of full site address
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Sun, 06 Jan 2019 08:09:47 -0500
parents 38d209611508
children b7376319d25a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
1 <?PHP
44
38d209611508 change includes to assume (contra previos ASSUMES) that we have .user.ini which adds /var/test to include_path
Charlie Root
parents: 43
diff changeset
2 include_once "ywww/dlog.php";
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
3 session_start();
43
dbc006408d2b ASSUMES we have SetEnv PHP_VALUE "include_path =.:/var/test/private:/var/test/ywww:/usr/share/php" in apache2/.../test.conf
Charlie Root
parents: 28
diff changeset
4
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
5 function uniqueRand($n, $min = 0, $max = null)
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
6 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
7 if($max === null)
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
8 $max = getrandmax();
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
9 $array = range($min, $max);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
10 $return = array();
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
11 $keys = array_rand($array, $n);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
12 foreach($keys as $key)
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
13 $return[] = $array[$key];
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
14 return $return;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
15 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
16
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
17 include "../mdetect.php";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
18 $uagent_obj = new uagent_info();
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
19 $iPhone = $uagent_obj->DetectSmartphone();
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
20 $iPad = $uagent_obj->DetectIpad();
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
21
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
22 $proceed = true;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
23 $launchScript = "<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
24
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
25 //print_r($_SERVER);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
26 if (isset($_SERVER['HTTP_REFERER']) || isset($_GET['facebook']))
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
27 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
28 $pos = strpos($_SERVER['HTTP_REFERER'], "apps.facebook.com");
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
29 if($pos !== false || isset($_GET['facebook']))
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
30 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
31 //we are in facebook canvas so react appropriately
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
32 include_once '../facebook.php';
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
33
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
34 $facebook = new Facebook(array(
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
35 'appId' => '128245333876633',
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
36 'secret' => 'f51afc7e04289db62448edd8b70d83bf',
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
37 'cookie' => true,
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
38 'domain' => 'yournextpresent.com'
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
39 ));
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
40
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
41 $session = $facebook->getSession();
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
42
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
43 if (!$session) {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
44 $proceed = false;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
45 $url = $facebook->getLoginUrl(array(
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
46 'canvas' => 1,
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
47 'fbconnect' => 0,
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
48 'req_perms' => 'email,user_birthday,publish_stream'
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
49 ));
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
50
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
51 echo "<script type='text/javascript'>top.location.href = '$url';</script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
52 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
53 else
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
54 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
55 $launchScript = "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksFB/books.nocache.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
56 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
57 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
58 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
59 echo "<!DOCTYPE html><html>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
60 if($proceed)
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
61 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
62 echo "<head>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
63 echo "<meta name=\"fragment\" content=\"!\">";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
64 echo "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
65 echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
66 echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"../Books.css\">";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
67
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
68 if(isset($_GET['_escaped_fragment_'])) {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
69 $isbn = $_GET['_escaped_fragment_'];
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
70 if($isbn == ""){
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
71 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!\">";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
72
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
73 echo "<title>YourNextRead: Book Recommendations (USA)</title>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
74 echo "<div id=\"script\"></div><noscript>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
75 <p>You need to have Javascript enabled to use YourNextRead - Sorry!<p>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
76 <p>Please see instructions on how to switch this on, depending on which browser you use:<p>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
77 <ul>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
78 <li><a href=\"http://www.ehow.com/how_2033406_enable-javascript-firefox.html\">Firefox</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
79 <li><a href=\"http://www.chromefans.org/chrome-tutorial/how-to-enable-or-disable-javascript-in-google-chrome.htm\">Chrome</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
80 <li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
81 </ul>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
82 <p>Thank you for using YourNextRead<p>
45
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
83 <img src=\"../images/topleft.gif\" alt=\"YourNextRead\"/>
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
84 </noscript>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
85 if($iPhone && !$iPad)
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
86 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
87 echo "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
88 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksMob/books.nocache.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
89 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
90 else
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
91 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
92 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../raphael-min.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
93 echo $launchScript;//"<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
94 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
95 echo "</head>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
96 echo "<body>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
97 //we are at the launch page
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
98 echo "<p>Get started, search for a book you like... or choose from one of the lists below:</p><BR></BR>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
99
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
100 $ret = 1;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
101
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
102 $bookLists = include "../php/read/getAllSavedBooks.php";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
103 $xml = new SimpleXMLElement($bookLists);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
104
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
105 $numOfLists = sizeof($xml->List) - 1; //-1 for zero indexing
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
106
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
107 $randomFourLists = uniqueRand(4,0,$numOfLists);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
108
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
109 foreach ($randomFourLists as $id) {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
110 $ListName = $xml->List[$id]->SavedListName;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
111 echo "<p><b>$ListName</b></p><BR></BR>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
112 for($i=0;$i<sizeof($xml->List[$id]->ListDetails->Book);$i++){
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
113 $bookTitle = $xml->List[$id]->ListDetails->Book[$i]->BookTitle;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
114 $isbn = $xml->List[$id]->ListDetails->Book[$i]->ISBN;
45
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
115 echo "<a href=\"../us/#!isbn=$isbn\">$bookTitle</a> ";
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
116 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
117 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
118 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
119 else
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
120 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
121 try{
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
122 $isbn = substr($isbn, 5);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
123 $chars = explode("/",$isbn);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
124 $isbn = $chars[0];
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
125 $ret = 1;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
126 $countryCode = 0;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
127
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
128 include "../../private/db.php";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
129 $query = "CALL b_getBookInfo('$isbn', $countryCode)";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
130 //echo $query;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
131 $res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
132 include "../xml/aws_signed_request.php";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
133 include "../xml/getAmazonInfo.php";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
134 if ( mysqli_num_rows( $res ) > 0 )
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
135 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
136 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
23
d606320ec331 post-5.7-upgrade efforts to reduce dropped connections, db insertion fails
Charlie Root
parents: 19
diff changeset
137 mysqli_close($link);
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
138 $title = $rows["Title"];
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
139 $author = $rows["Author"];
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
140 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
141 else
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
142 {
23
d606320ec331 post-5.7-upgrade efforts to reduce dropped connections, db insertion fails
Charlie Root
parents: 19
diff changeset
143 mysqli_close($link);
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
144 $bookDetails = getAmazonDet($isbn,1,'us');
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
145 $bookXML = new SimpleXMLElement($bookDetails);
8
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
146 // HST added this
28
b058736bc9ad fix old :-( preg bug
Robert Boland <robert@markup.co.uk>
parents: 23
diff changeset
147 if (preg_match("/<Error>/",$bookDetails)) {
8
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
148 $resName=$bookXML->getName();
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
149 $code=$bookXML->Error->Code;
43
dbc006408d2b ASSUMES we have SetEnv PHP_VALUE "include_path =.:/var/test/private:/var/test/ywww:/usr/share/php" in apache2/.../test.conf
Charlie Root
parents: 28
diff changeset
150 dl("Losing 3: $resName, $code\n");
8
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
151 if ($code=='RequestThrottled') {
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
152 usleep(200000); // Try to reduce throttling until we get a
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
153 // principled solution in place
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
154 }
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
155 $title = "";
19
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
156 $author = "";
8
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
157 }
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
158 else {
19
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
159 if ($bookXML->Items && $bookXML->Items->Item[0] &&
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
160 $bookXML->Items->Item[0]->ItemAttributes)
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
161 { $attrs=$bookXML->Items->Item[0]->ItemAttributes;
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
162 if ($attrs->Title) {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
163 $title = $attrs->Title; }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
164 else {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
165 $title ="[no Title]";
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
166 }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
167 if ($attrs->Author) {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
168 $author = $attrs->Author;
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
169 }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
170 else {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
171 $author ="[no Author]";
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
172 }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
173 }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
174 else {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
175 $title ="[no Title]";
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
176 $author = "[no Author]";
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
177 }
8
226f00d9f6f5 another error check
Henry Thompson <ht@markup.co.uk>
parents: 7
diff changeset
178 }
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
179 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
180
19
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
181 $linkedBooks = include "../php/read/getLinkedBooks.php";
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
182 try {
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
183 $xml = new SimpleXMLElement($linkedBooks);
19
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
184 }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
185 catch (Exception $e) {
43
dbc006408d2b ASSUMES we have SetEnv PHP_VALUE "include_path =.:/var/test/private:/var/test/ywww:/usr/share/php" in apache2/.../test.conf
Charlie Root
parents: 28
diff changeset
186 dl("Bad XML?: ".$linkedBooks."\n");
19
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
187 throw $e;
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
188 }
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
189 $recommended = "";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
190 $linkedRecommended = "";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
191 for($i=0;$i<sizeof($xml->isbn);$i++){
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
192 $linkedISBN = $xml->isbn[$i];
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
193 include "../../private/db.php";
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
194 $query = "CALL b_getBookInfo('$linkedISBN', $countryCode)";
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
195 //echo $query;
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
196 $res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
197 set_error_handler(function () {
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
198 global $bookLDetails, $linkedISBN;
43
dbc006408d2b ASSUMES we have SetEnv PHP_VALUE "include_path =.:/var/test/private:/var/test/ywww:/usr/share/php" in apache2/.../test.conf
Charlie Root
parents: 28
diff changeset
199 dl("Caught other one?: $linkedISBN\n");
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
200 } );
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
201 if ( mysqli_num_rows( $res ) > 0 )
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
202 {
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
203 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
23
d606320ec331 post-5.7-upgrade efforts to reduce dropped connections, db insertion fails
Charlie Root
parents: 19
diff changeset
204 mysqli_close($link);
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
205 $titleL = $rows["Title"];
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
206 $authorL = $rows["Author"];
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
207 }
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
208 else
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
209 {
23
d606320ec331 post-5.7-upgrade efforts to reduce dropped connections, db insertion fails
Charlie Root
parents: 19
diff changeset
210 mysqli_close($link);
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
211 $bookLDetails = getAmazonDet($linkedISBN,1,'us');
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
212 $bookLXML = new SimpleXMLElement($bookLDetails);
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
213 // HST added this
28
b058736bc9ad fix old :-( preg bug
Robert Boland <robert@markup.co.uk>
parents: 23
diff changeset
214 if (preg_match("/<Error>/",$bookLDetails)) {
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
215 $resName=$bookLXML->getName();
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
216 $code=$bookLXML->Error->Code;
43
dbc006408d2b ASSUMES we have SetEnv PHP_VALUE "include_path =.:/var/test/private:/var/test/ywww:/usr/share/php" in apache2/.../test.conf
Charlie Root
parents: 28
diff changeset
217 dl("Losing 2: $resName, $code\n");
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
218 if ($code=='RequestThrottled') {
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
219 usleep(200000); // Try to reduce throttling until we get a
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
220 // principled solution in place
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
221 }
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
222 $titleL = "";
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
223 }
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
224 else {
19
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
225 if ($bookLXML->Items &&
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
226 $bookLXML->Items->Item[0] &&
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
227 $bookLXML->Items->Item[0]->ItemAttributes) {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
228 $attrs=$bookLXML->Items->Item[0]->ItemAttributes;
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
229 if ($attrs->Title) {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
230 $titleL = $attrs->Title; }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
231 else {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
232 $titleL = ""; }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
233 if ($attrs->Author) {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
234 $authorL = $attrs->Author; }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
235 else {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
236 $authorL = ""; }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
237 }
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
238 else {
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
239 $titleL = ""; }
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
240 }
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
241 }
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
242 restore_error_handler();
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
243 if($titleL != "")
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
244 {
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
245 $recommended .= " $titleL by $authorL,";
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
246 $underAuthor = str_replace(" ","_",$authorL);
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
247 $underTitle = str_replace(" ","_",$titleL);
45
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
248 $linkedRecommended .= "<a href=\"../us/#!isbn=$linkedISBN/$underTitle" . "_by_$authorL\">$titleL by $authorL</a>, ";
7
1dfe64e365a0 a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents: 6
diff changeset
249 }
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
250 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
251
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
252 $vote = "Vote on these recommendations!";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
253
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
254 echo "<META NAME=\"Description\" CONTENT=\"YourNextRead recommended books for $title by $author:$recommended $vote\">";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
255
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
256 echo "<title>YourNextRead (USA) Recommended Books for $title by $author</title>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
257 echo "<div id=\"script\"></div><noscript>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
258 <p>You need to have Javascript enabled to use YourNextRead - Sorry!<p>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
259 <p>Please see instructions on how to switch this on, depending on which browser you use:<p>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
260 <ul>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
261 <li><a href=\"http://www.ehow.com/how_2033406_enable-javascript-firefox.html\">Firefox</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
262 <li><a href=\"http://www.chromefans.org/chrome-tutorial/how-to-enable-or-disable-javascript-in-google-chrome.htm\">Chrome</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
263 <li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
264 </ul>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
265 <p>Thank you for using YourNextRead<p>
45
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
266 <img src=\"../images/topleft.gif\" alt=\"YourNextRead\"/>
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
267 </noscript>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
268 if($iPhone && !$iPad)
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
269 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
270 echo "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
271 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksMob/books.nocache.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
272 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
273 else
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
274 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
275 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../raphael-min.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
276 echo $launchScript;//"<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
277 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
278
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
279 echo "</head>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
280
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
281 echo "<body>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
282 echo "<p>Recommended Books for <b>$title</b> by <b>$author</b>:";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
283 echo $linkedRecommended . "</p>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
284 echo "<p>" . $vote . "</p>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
285
45
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
286 echo "Change to <a href=\"../de/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead Germany</a>, ";
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
287 echo "Change to <a href=\"../ca/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead Canada</a>, ";
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
288 echo "Change to <a href=\"../fr/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead France</a>, ";
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
289 echo "Change to <a href=\"../us/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead USA</a>";
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
290 echo ", See this on <a href=\"http://www.YourNextPresent.com/us/#!isbn=$isbn\">YourNextPresent</a>, ";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
291 echo "Switch to <a href=\"http://www.YourNextFilm.com/us/\">YourNextFilm</a>, ";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
292 echo "Switch to <a href=\"http://www.YourNextGame.com/us/\">YourNextGame</a>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
293 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
294 catch(Exception $e)
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
295 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
296 echo 'Message: ' .$e->getMessage();
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
297 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
298 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
299 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
300 else
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
301 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
302 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!\">";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
303
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
304 echo "<title>YourNextRead: Book Recommendations (USA)</title>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
305 //the title will get changed dynamically in the GWT code
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
306 echo "<div id=\"script\"></div><noscript>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
307 <p>You need to have Javascript enabled to use YourNextRead - Sorry!<p>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
308 <p>Please see instructions on how to switch this on, depending on which browser you use:<p>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
309 <ul>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
310 <li><a href=\"http://www.ehow.com/how_2033406_enable-javascript-firefox.html\">Firefox</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
311 <li><a href=\"http://www.chromefans.org/chrome-tutorial/how-to-enable-or-disable-javascript-in-google-chrome.htm\">Chrome</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
312 <li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
313 </ul>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
314 <p>Thank you for using YourNextRead<p>
45
8bc395c87c6f less built-in use of full site address
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 44
diff changeset
315 <img src=\"../images/topleft.gif\" alt=\"YourNextRead\"/>
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
316 </noscript>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
317 if($iPhone && !$iPad)
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
318 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
319 echo "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
320 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../booksMob/books.nocache.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
321 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
322 else
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
323 {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
324 echo "<script type=\"text/javascript\" language=\"javascript\" src=\"../raphael-min.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
325 echo $launchScript;//"<script type=\"text/javascript\" language=\"javascript\" src=\"../books/books.nocache.js\"></script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
326 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
327
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
328 echo "</head>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
329
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
330 echo "<body>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
331 echo "<div id=\"fb-root\"></div>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
332 <script type=\"text/javascript\" src=\"http://connect.facebook.net/en_US/all.js\"></script>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
333 <script type=\"text/javascript\">
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
334 FB.init({
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
335 appId : '128245333876633',
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
336 status : true, // check login status
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
337 cookie : true, // enable cookies to allow the server to access the session
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
338 xfbml : true // parse XFBML
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
339 });
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
340 </script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
341 echo "<script type=\"text/javascript\">
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
342 var obj = new Object;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
343 obj.height=960;
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
344 FB.Canvas.setSize(obj);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
345 </script>";
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
346 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
347 }
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
348 ?>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
349
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
350 <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
351
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
352 <script type="text/javascript">
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
353 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
354 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
355 </script>
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
356 <script type="text/javascript">
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
357 try {
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
358 var pageTracker = _gat._getTracker("UA-15026249-1");
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
359 pageTracker._setDomainName("none");
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
360 pageTracker._setAllowLinker(true);
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
361 pageTracker._trackPageview();
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
362 } catch(err) {}</script>
19
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
363 <script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=322bafc0-69fa-4664-8e1c-0b9159259748"></script>
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 8
diff changeset
364 </body>
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents:
diff changeset
365 </html>