comparison php/read/map/getMapISBNCirclePaths.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 385ddd7c4b55 a67bf725e87b
comparison
equal deleted inserted replaced
5:55445b456ad0 6:077b0a0a3e6d
1 <?PHP
2 if(!isset($ret))
3 {
4 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
5 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
6 header("Cache-Control: no-store, no-cache, must-revalidate");
7 header("Cache-Control: post-check=0, pre-check=0", false);
8 header("Pragma: no-cache");
9 }
10 $linkedBooks = 0;
11 //$isbn = $_GET['isbn'];
12
13 $UserID = $_GET['user'];
14
15 if(isset($_GET['loc'])){
16 $loc = $_GET['loc'];
17 }
18 else{
19 $loc = 0; //default location is 1
20 }
21
22 if(isset($_GET['listname'])){
23 $listName = $_GET['listname'];
24 }
25 else{
26 $listName = "MyMap"; //default location is 1
27 }
28
29 include "../../../../private/db.php";
30 $query = "CALL b_getMapUserList('$UserID',$loc, \"$listName\")"; // this generates fixed points -
31 //echo $query;
32 $results = mysqli_query($link, $query) or exit( mysqli_error( $link ));
33
34 $output = "<?xml version=\"1.0\"?>";
35 $output .= "<results>";
36 //$output .= "<BookList>";
37
38 $LastNode = "START";
39 $ChangeNode = 0;
40
41 while($line = mysqli_fetch_assoc($results)) {
42 $ISBN =trim($line["ISBN"]);
43 $Title = htmlspecialchars($line["BookTitle"]);
44 $ImageURL = htmlspecialchars($line["PictureURL"]);
45 $SuperNode = htmlspecialchars($line["SuperNode"]);
46
47 IF ($LastNode != $SuperNode && $ChangeNode == 1) {
48 $output .= "</BOOKS>";
49 $output .= "</SNode>";
50 $ChangeNode = 0;
51 }
52
53 IF ($LastNode != $SuperNode ) {
54 $ChangeNode = 1;
55 $output .= "<SNode>";
56 $output .= "<SuperNode>" . $SuperNode . "</SuperNode>";
57 $output .= "<BOOKS>";
58 }
59
60 $output .= "<Book>";
61 $output .= "<ISBN>" . $ISBN . "</ISBN>";
62 $output .= "<Title>" . $Title . "</Title>";
63 $output .= "<ImageURL>" . $ImageURL . "</ImageURL>";
64 $output .= "</Book>";
65
66 $LastNode = $SuperNode;
67 }
68 $output .= "</BOOKS>";
69 $output .= "</SNode>";
70
71 //$output .= "</BookList>";
72
73 mysqli_close($link);
74 include "../../../../private/db.php";
75
76 $query = "CALL b_getMap_isbnPaths('$UserID', $loc, \"$listName\")"; // this generates fixed points -
77 //echo $query;
78 $results = mysqli_query($link, $query) or exit( mysqli_error( $link ));
79
80
81 $LastISBN = "START";
82 $ChangePaths = 0;
83
84 while($line = mysqli_fetch_assoc($results)) {
85
86 //$SuperNodeID = $line["SuperNodeID"]; HST commented out as was often
87 // missing, so throwing error, and not actually used...
88 $ISBN =trim($line["ISBN"]);
89 //$Title = htmlspecialchars($line["BookTitle"]);
90 //$ImageURL = htmlspecialchars($line["PictureURL"]);
91 $ISBN2 =trim($line["ISBN2"]);
92 $LinkID =trim($line["LinkID"]);
93
94 IF ($LastISBN != $ISBN && $ChangePaths == 1) {
95 $output .= "</PATHS>";
96 $output .= "</Node>";
97 $ChangePaths = 0;
98 }
99
100 IF ($LastISBN != $ISBN ) {
101 $ChangePaths = 1;
102 $output .= "<Node>";
103 $output .= "<ISBN>" . $ISBN . "</ISBN>";
104 $output .= "<PATHS>";
105 }
106 $output .= "<LittleNode>";
107 $output .= "<ISBN2>" . $ISBN2 . "</ISBN2>";
108 $output .= "<LinkID>" . $LinkID . "</LinkID>";
109 $output .= "</LittleNode>";
110
111 $LastISBN = $ISBN;
112 }
113
114 $output .= "</PATHS>";
115 $output .= "</Node>";
116
117 $output .= "</results>";
118
119 echo $output;
120
121 mysqli_close($link);
122
123 ?>