45 |
- |
1 |
<?php
|
65 |
- |
2 |
include_once ('php/clsLibGTIN.php');
|
|
|
3 |
include_once ('php/constants.php');
|
45 |
- |
4 |
|
|
|
5 |
error_reporting(E_ALL);
|
|
|
6 |
|
65 |
- |
7 |
// add new entry to wishlist
|
52 |
- |
8 |
function addWishlist($uid, $wlArr) {
|
50 |
- |
9 |
$nul = 'NULL';
|
45 |
- |
10 |
$conn = MySessionHandler::getDBSessionId();
|
|
|
11 |
|
|
|
12 |
$created = mysqli_real_escape_string($conn, time());
|
|
|
13 |
$modified = $created;
|
|
|
14 |
|
52 |
- |
15 |
$uid = mysqli_real_escape_string($conn, $uid);
|
|
|
16 |
$mid = isset($wlArr->{'mid'}) ? mysqli_real_escape_string($conn, $wlArr->{'mid'}) : "";
|
|
|
17 |
$rid = isset($wlArr->{'rid'}) ? mysqli_real_escape_string($conn, $wlArr->{'rid'}) : "";
|
81 |
- |
18 |
$asin = isset($wlArr->{'asin'}) ? "'" . mysqli_real_escape_string($conn, $wlArr->{'asin'}) . "'" : "NULL";
|
50 |
- |
19 |
$barcode = (empty($wlArr->{'barcode'}) ? "NULL" : "'" . mysqli_real_escape_string($conn, $wlArr->{'barcode'}) . "'");
|
|
|
20 |
$title = isset($wlArr->{'title'}) ? "'" . mysqli_real_escape_string($conn, $wlArr->{'title'}) . "'" : "NULL";
|
|
|
21 |
$artist = isset($wlArr->{'artist'}) ? "'" . mysqli_real_escape_string($conn, $wlArr->{'artist'}) . "'" : "NULL";
|
73 |
- |
22 |
$cond = 'Any';
|
45 |
- |
23 |
$format = 'Any';
|
46 |
- |
24 |
$currency = 'USD'; //bugbug
|
45 |
- |
25 |
$price = 'NULL';
|
50 |
- |
26 |
$url = isset($wlArr->{'url'}) ? "'" . mysqli_real_escape_string($conn, $wlArr->{'url'}) . "'" : "NULL";
|
|
|
27 |
$thumbnail = isset($wlArr->{'thumbnail'}) ? "'" . mysqli_real_escape_string($conn, $wlArr->{'thumbnail'}) . "'" : "NULL";
|
96 |
- |
28 |
$ip = inet_pton($_SERVER['REMOTE_ADDR']);
|
45 |
- |
29 |
|
|
|
30 |
$sql = "INSERT
|
|
|
31 |
INTO wishlist
|
96 |
- |
32 |
(id, created, ip, modified, uid, mid, rid, asin, barcode, title, artist, cond, format, currency, price, url, thumbnail)
|
|
|
33 |
VALUES (NULL, '$created', '$ip', '$modified', '$uid', '$mid', '$rid', " . $asin . ", " . $barcode . ", " . $title . ", " . $artist . ", '$cond', '$format', '$currency', '$price', " . $url . ", " . $thumbnail . ")";
|
45 |
- |
34 |
|
|
|
35 |
if ($result = mysqli_query($conn, $sql)) {
|
52 |
- |
36 |
return 0;
|
65 |
- |
37 |
}
|
|
|
38 |
else {
|
45 |
- |
39 |
$error = mysqli_errno($conn);
|
|
|
40 |
if ($error == 1062) {
|
52 |
- |
41 |
return 1;
|
65 |
- |
42 |
}
|
|
|
43 |
else {
|
45 |
- |
44 |
error_log("MySQL Read Wishlist SQL: " . $sql);
|
52 |
- |
45 |
error_log("MySQL Read Wishlist Error: " . mysqli_error($conn) . " (" . $error . ")");
|
|
|
46 |
return -1;
|
45 |
- |
47 |
}
|
|
|
48 |
}
|
|
|
49 |
|
52 |
- |
50 |
return -1;
|
45 |
- |
51 |
}
|
|
|
52 |
|
46 |
- |
53 |
function checkWishlist($type, $id) {
|
45 |
- |
54 |
$conn = MySessionHandler::getDBSessionId();
|
81 |
- |
55 |
if ($type == "master") {
|
|
|
56 |
$colName = "mid";
|
|
|
57 |
} else if ($type == "release") {
|
|
|
58 |
$colName = "rid";
|
|
|
59 |
} else if ($type == "asin") {
|
|
|
60 |
$colName = "asin";
|
|
|
61 |
}
|
45 |
- |
62 |
|
52 |
- |
63 |
$uid = mysqli_real_escape_string($conn, $_SESSION['sessData']['userID']);
|
45 |
- |
64 |
|
|
|
65 |
$sql = "SELECT id
|
|
|
66 |
FROM wishlist
|
81 |
- |
67 |
WHERE uid = '$uid' and $colName = '$id'";
|
45 |
- |
68 |
|
|
|
69 |
if ($result = mysqli_query($conn, $sql)) {
|
|
|
70 |
if (mysqli_num_rows($result) > 0) {
|
|
|
71 |
return true;
|
|
|
72 |
}
|
|
|
73 |
}
|
65 |
- |
74 |
else if (mysqli_errno($conn)) {
|
|
|
75 |
error_log("MySQL Check Wishlist SQL: " . $sql);
|
|
|
76 |
error_log("MySQL Check Wishlist Error: " . mysqli_error($conn) . " (" . mysqli_errno($conn) . ")");
|
|
|
77 |
return true;
|
|
|
78 |
}
|
45 |
- |
79 |
|
|
|
80 |
return false;
|
46 |
- |
81 |
}
|
|
|
82 |
|
|
|
83 |
function getWishlist() {
|
127 |
- |
84 |
$xh = new Html;
|
|
|
85 |
$xh->init($_SESSION["htmlIndent"]);
|
|
|
86 |
|
107 |
- |
87 |
if (!isLoggedIn()) {
|
127 |
- |
88 |
$xh->add_attribute("class", "container bg-warning text-center py-3");
|
|
|
89 |
$xh->tag('div');
|
|
|
90 |
$xh->add_attribute("class", "display-6");
|
|
|
91 |
$xh->tag('p');
|
|
|
92 |
$xh->add_attribute("class", "material-icons");
|
|
|
93 |
$xh->tag('i', "error_outline");
|
|
|
94 |
$xh->tag('span', " Please login to your Find Cheap Music account in order to maintain the wishlist.");
|
|
|
95 |
$xh->close(); // p
|
|
|
96 |
$xh->close(); // div
|
|
|
97 |
|
|
|
98 |
$html = $xh->flush();
|
|
|
99 |
//error_log(print_r($html, 1));
|
|
|
100 |
|
|
|
101 |
return $html;
|
107 |
- |
102 |
}
|
|
|
103 |
|
46 |
- |
104 |
$conn = MySessionHandler::getDBSessionId();
|
|
|
105 |
|
|
|
106 |
$uid = $_SESSION['sessData']['userID'];
|
|
|
107 |
|
|
|
108 |
$sql = "SELECT *
|
|
|
109 |
FROM wishlist
|
|
|
110 |
WHERE uid = '$uid'";
|
|
|
111 |
|
|
|
112 |
if ($result = mysqli_query($conn, $sql)) {
|
|
|
113 |
if (mysqli_num_rows($result) > 0) {
|
127 |
- |
114 |
$xh->add_attribute("class", "container");
|
|
|
115 |
$xh->tag('div');
|
|
|
116 |
$xh->add_attribute("class", "input-group mt-3");
|
|
|
117 |
$xh->tag('div');
|
|
|
118 |
$xh->add_attribute("class", "input-group-prepend");
|
|
|
119 |
$xh->tag('div');
|
|
|
120 |
$xh->add_attribute("class", "input-group-text");
|
|
|
121 |
$xh->tag('span');
|
|
|
122 |
$xh->add_attribute("class", "material-icons");
|
|
|
123 |
$xh->tag('i', "search");
|
|
|
124 |
$xh->close(); // span
|
|
|
125 |
$xh->close(); // div
|
|
|
126 |
$xh->add_attribute("type", "text");
|
|
|
127 |
$xh->add_attribute("class", "form-control");
|
|
|
128 |
$xh->add_attribute("id", "tableFilter");
|
|
|
129 |
$xh->add_attribute("placeholder", "Search for..");
|
|
|
130 |
$xh->add_attribute("aria-label", "Search for entry");
|
|
|
131 |
$xh->single_tag('input');
|
|
|
132 |
$xh->add_attribute("id", "tableFilterButton");
|
|
|
133 |
$xh->add_attribute("class", "input-group-append");
|
|
|
134 |
$xh->tag('div');
|
|
|
135 |
$xh->add_attribute("id", "tableFilterReset");
|
|
|
136 |
$xh->add_attribute("type", "button");
|
|
|
137 |
$xh->add_attribute("class", "btn rounded");
|
|
|
138 |
$xh->tag('button');
|
|
|
139 |
$xh->add_attribute("class", "material-icons");
|
|
|
140 |
$xh->tag('i', "cancel_presentation");
|
|
|
141 |
$xh->close(); // button
|
|
|
142 |
$xh->close(); // div
|
|
|
143 |
$xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
|
|
|
144 |
$xh->tag('script');
|
137 |
- |
145 |
$str = my_trim('document.addEventListener("DOMContentLoaded", function() {');
|
|
|
146 |
$str .= my_trim(' document.getElementById("tableFilter").addEventListener("keyup", function() {');
|
|
|
147 |
$str .= my_trim(' filterWishlist();');
|
|
|
148 |
$str .= my_trim(' });');
|
|
|
149 |
$str .= my_trim(' document.getElementById("tableFilterReset").addEventListener("click", function() {');
|
|
|
150 |
$str .= my_trim(' document.getElementById("tableFilter").value = "";');
|
|
|
151 |
$str .= my_trim(' filterWishlist();');
|
|
|
152 |
$str .= my_trim(' });');
|
|
|
153 |
$str .= my_trim('});');
|
127 |
- |
154 |
$xh->insert_code($str);
|
|
|
155 |
$xh->close(); // script
|
|
|
156 |
$xh->close(); // div
|
52 |
- |
157 |
|
127 |
- |
158 |
$xh->add_attribute("method", "post");
|
|
|
159 |
$xh->add_attribute("action", "/index.php");
|
|
|
160 |
$xh->tag('form');
|
|
|
161 |
$xh->insert_code(inputSessionTab());
|
|
|
162 |
$xh->add_attribute("id", "discogsTitle");
|
|
|
163 |
$xh->add_attribute("type", "hidden");
|
|
|
164 |
$xh->add_attribute("name", "discogsTitle");
|
|
|
165 |
$xh->add_attribute("value", "");
|
|
|
166 |
$xh->single_tag('input');
|
|
|
167 |
$xh->add_attribute("id", "discogsArtist");
|
|
|
168 |
$xh->add_attribute("type", "hidden");
|
|
|
169 |
$xh->add_attribute("name", "discogsArtist");
|
|
|
170 |
$xh->add_attribute("value", "");
|
|
|
171 |
$xh->single_tag('input');
|
|
|
172 |
$xh->add_attribute("id", "discogsBarcode");
|
|
|
173 |
$xh->add_attribute("type", "hidden");
|
|
|
174 |
$xh->add_attribute("name", "discogsBarcode");
|
|
|
175 |
$xh->add_attribute("value", "");
|
|
|
176 |
$xh->single_tag('input');
|
|
|
177 |
$xh->insert_code(inputNonce());
|
|
|
178 |
$xh->add_attribute("class", "table");
|
|
|
179 |
$xh->tag('div');
|
|
|
180 |
$xh->add_attribute("id", "wishlistTable");
|
|
|
181 |
$xh->add_attribute("class", "table table-striped table-condensed table-hover small");
|
|
|
182 |
$xh->tag('table');
|
|
|
183 |
$xh->add_attribute("class", "head-dark table-header-sticky");
|
|
|
184 |
$xh->tag('thead');
|
|
|
185 |
$xh->tag('tr');
|
|
|
186 |
$xh->add_attribute("class", "hide-medium");
|
|
|
187 |
$xh->tag('th', "");
|
|
|
188 |
$xh->add_attribute("id", "sortColumn1");
|
|
|
189 |
$xh->add_attribute("class", "text-left cursor-pointer");
|
|
|
190 |
$xh->tag('th');
|
|
|
191 |
$xh->add_attribute("class", "nowrap");
|
|
|
192 |
$xh->tag('span');
|
|
|
193 |
$xh->tag('span', "Artist");
|
|
|
194 |
$xh->add_attribute("class", "d-block d-md-none");
|
|
|
195 |
$xh->tag('span', "<br>");
|
|
|
196 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nrm");
|
|
|
197 |
$xh->tag('i', "arrow_drop_up");
|
|
|
198 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nlm");
|
|
|
199 |
$xh->tag('i', "arrow_drop_down");
|
|
|
200 |
$xh->close(); // span
|
|
|
201 |
$xh->close(); // th
|
46 |
- |
202 |
|
127 |
- |
203 |
$xh->add_attribute("id", "sortColumn2");
|
|
|
204 |
$xh->add_attribute("class", "text-left cursor-pointer");
|
|
|
205 |
$xh->tag('th');
|
|
|
206 |
$xh->add_attribute("class", "nowrap");
|
|
|
207 |
$xh->tag('span');
|
|
|
208 |
$xh->tag('span', "Title");
|
|
|
209 |
$xh->add_attribute("class", "d-block d-md-none");
|
|
|
210 |
$xh->tag('span', "<br>");
|
|
|
211 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nrm");
|
|
|
212 |
$xh->tag('i', "arrow_drop_up");
|
|
|
213 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nlm");
|
|
|
214 |
$xh->tag('i', "arrow_drop_down");
|
|
|
215 |
$xh->close(); // span
|
|
|
216 |
$xh->close(); // th
|
|
|
217 |
|
|
|
218 |
$xh->add_attribute("id", "sortColumn3");
|
|
|
219 |
$xh->add_attribute("class", "d-none");
|
|
|
220 |
$xh->tag('th', "");
|
|
|
221 |
|
|
|
222 |
$xh->add_attribute("id", "sortColumn4");
|
|
|
223 |
$xh->add_attribute("class", "cursor-pointer hide-medium hide-small");
|
|
|
224 |
$xh->tag('th');
|
|
|
225 |
$xh->add_attribute("class", "nowrap");
|
|
|
226 |
$xh->tag('span');
|
|
|
227 |
$xh->tag('span', "Barcode");
|
|
|
228 |
$xh->add_attribute("class", "d-block d-md-none");
|
|
|
229 |
$xh->tag('span', "<br>");
|
|
|
230 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nrm");
|
|
|
231 |
$xh->tag('i', "arrow_drop_up");
|
|
|
232 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nlm");
|
|
|
233 |
$xh->tag('i', "arrow_drop_down");
|
|
|
234 |
$xh->close(); // span
|
|
|
235 |
$xh->close(); // th
|
|
|
236 |
|
|
|
237 |
$xh->add_attribute("id", "sortColumn5");
|
|
|
238 |
$xh->add_attribute("class", "cursor-pointer hide-small");
|
|
|
239 |
$xh->tag('th');
|
|
|
240 |
$xh->add_attribute("class", "nowrap");
|
|
|
241 |
$xh->tag('span');
|
|
|
242 |
$xh->tag('span', "Condition");
|
|
|
243 |
$xh->add_attribute("class", "d-block d-md-none");
|
|
|
244 |
$xh->tag('span', "<br>");
|
|
|
245 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nrm");
|
|
|
246 |
$xh->tag('i', "arrow_drop_up");
|
|
|
247 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nlm");
|
|
|
248 |
$xh->tag('i', "arrow_drop_down");
|
|
|
249 |
$xh->close(); // span
|
|
|
250 |
$xh->close(); // th
|
|
|
251 |
|
|
|
252 |
$xh->add_attribute("id", "sortColumn6");
|
|
|
253 |
$xh->add_attribute("class", "cursor-pointer hide-small");
|
|
|
254 |
$xh->tag('th');
|
|
|
255 |
$xh->add_attribute("class", "nowrap");
|
|
|
256 |
$xh->tag('span');
|
|
|
257 |
$xh->tag('span', "Format");
|
|
|
258 |
$xh->add_attribute("class", "d-block d-md-none");
|
|
|
259 |
$xh->tag('span', "<br>");
|
|
|
260 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nrm");
|
|
|
261 |
$xh->tag('i', "arrow_drop_up");
|
|
|
262 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nlm");
|
|
|
263 |
$xh->tag('i', "arrow_drop_down");
|
|
|
264 |
$xh->close(); // span
|
|
|
265 |
$xh->close(); // th
|
|
|
266 |
|
|
|
267 |
$xh->add_attribute("class", "d-none");
|
|
|
268 |
$xh->tag('th', "Ceiling Price Plain Number");
|
|
|
269 |
|
|
|
270 |
$xh->add_attribute("id", "sortColumn7");
|
|
|
271 |
$xh->add_attribute("class", "cursor-pointer");
|
|
|
272 |
$xh->tag('th');
|
|
|
273 |
$xh->add_attribute("class", "nowrap");
|
|
|
274 |
$xh->tag('span');
|
|
|
275 |
$xh->tag('span', "Price");
|
|
|
276 |
$xh->add_attribute("class", "d-block d-md-none");
|
|
|
277 |
$xh->tag('span', "<br>");
|
|
|
278 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nrm");
|
|
|
279 |
$xh->tag('i', "arrow_drop_up");
|
|
|
280 |
$xh->add_attribute("class", "material-icons hide-material-icons material-text material-nlm");
|
|
|
281 |
$xh->tag('i', "arrow_drop_down");
|
|
|
282 |
$xh->close(); // span
|
|
|
283 |
$xh->close(); // th
|
|
|
284 |
|
|
|
285 |
$xh->tag('th', "");
|
|
|
286 |
$xh->add_attribute("class", "d-none");
|
|
|
287 |
$xh->tag('th', "");
|
|
|
288 |
$xh->close(); // tr
|
|
|
289 |
$xh->close(); // thead
|
|
|
290 |
|
|
|
291 |
$xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
|
|
|
292 |
$xh->tag('script');
|
137 |
- |
293 |
$str = my_trim('document.addEventListener("DOMContentLoaded", function() {');
|
|
|
294 |
$str .= my_trim(' document.getElementById("sortColumn1").addEventListener("click", function() {');
|
|
|
295 |
$str .= my_trim(' sortTable("wishlistTable", 1, "text");');
|
|
|
296 |
$str .= my_trim(' });');
|
|
|
297 |
$str .= my_trim(' document.getElementById("sortColumn2").addEventListener("click", function() {');
|
|
|
298 |
$str .= my_trim(' sortTable("wishlistTable", 2, "text");');
|
|
|
299 |
$str .= my_trim(' });');
|
|
|
300 |
$str .= my_trim(' document.getElementById("sortColumn4").addEventListener("click", function() {');
|
|
|
301 |
$str .= my_trim(' sortTable("wishlistTable", 4, "text");');
|
|
|
302 |
$str .= my_trim(' });');
|
|
|
303 |
$str .= my_trim(' document.getElementById("sortColumn5").addEventListener("click", function() {');
|
|
|
304 |
$str .= my_trim(' sortTable("wishlistTable", 5, "text");');
|
|
|
305 |
$str .= my_trim(' });');
|
|
|
306 |
$str .= my_trim(' document.getElementById("sortColumn6").addEventListener("click", function() {');
|
|
|
307 |
$str .= my_trim(' sortTable("wishlistTable", 6, "text");');
|
|
|
308 |
$str .= my_trim(' });');
|
|
|
309 |
$str .= my_trim(' document.getElementById("sortColumn7").addEventListener("click", function() {');
|
|
|
310 |
$str .= my_trim(' sortTable("wishlistTable", 7, "numeric");');
|
|
|
311 |
$str .= my_trim(' });');
|
|
|
312 |
$str .= my_trim('});');
|
127 |
- |
313 |
$xh->insert_code($str);
|
|
|
314 |
$xh->close(); // script
|
|
|
315 |
$xh->tag('tbody');
|
|
|
316 |
|
65 |
- |
317 |
while ($row = mysqli_fetch_assoc($result)) {
|
141 |
- |
318 |
$artist = (empty($row["artist"]) ? "" : htmlentities($row["artist"]));
|
125 |
- |
319 |
$altText = "Image for " . htmlentities($row['title']) . " by " . $artist;
|
46 |
- |
320 |
$price = print_monetary($row['price'], $row['currency']);
|
141 |
- |
321 |
$searchTitle = 'Searching for:<br><br><strong>';
|
|
|
322 |
if (!empty($row['title'])) { $searchTitle .= htmlentities($row['title']); }
|
|
|
323 |
if (!empty($row['title']) && !empty($artist)) { $searchTitle .= " by "; }
|
|
|
324 |
if (!empty($artist)) { $searchTitle .= $artist; }
|
50 |
- |
325 |
if ($row['barcode'] !== null) {
|
|
|
326 |
$searchTitle .= " (" . displayBarcode($row['barcode']) . ")";
|
|
|
327 |
}
|
52 |
- |
328 |
$searchTitle .= "</strong>";
|
47 |
- |
329 |
|
127 |
- |
330 |
$xh->add_attribute("class", "border");
|
130 |
- |
331 |
$xh->add_attribute("data-id", $row['id']);
|
|
|
332 |
$xh->add_attribute("data-title", htmlentities($row['title']));
|
|
|
333 |
$xh->add_attribute("data-artist", $artist);
|
|
|
334 |
$xh->add_attribute("data-barcode", htmlentities($row['barcode']));
|
|
|
335 |
$xh->add_attribute("data-search-title", $searchTitle);
|
127 |
- |
336 |
$xh->tag('tr');
|
|
|
337 |
$xh->add_attribute("class", "hide-medium wl-img");
|
|
|
338 |
$xh->tag('td');
|
|
|
339 |
$xh->add_attribute("class", "img-fluid lazyload");
|
|
|
340 |
$xh->add_attribute("src",PIXEL);
|
|
|
341 |
$xh->add_attribute("data-src", $row["thumbnail"]);
|
|
|
342 |
$xh->add_attribute("alt", $altText);
|
|
|
343 |
$xh->single_tag('img');
|
|
|
344 |
$xh->close(); // td
|
52 |
- |
345 |
|
127 |
- |
346 |
$xh->tag('td', $artist);
|
|
|
347 |
$xh->tag('td', htmlentities($row['title']));
|
|
|
348 |
$xh->add_attribute("class", "d-none");
|
|
|
349 |
$xh->tag('td', htmlentities($row['barcode']));
|
|
|
350 |
$xh->add_attribute("class", "hide-medium hide-small");
|
|
|
351 |
$xh->tag('td', displayBarcode($row['barcode']));
|
|
|
352 |
$xh->add_attribute("class", "hide-small");
|
|
|
353 |
$xh->tag('td', $row['cond']);
|
|
|
354 |
$xh->add_attribute("class", "hide-small");
|
|
|
355 |
$xh->tag('td', $row['format']);
|
|
|
356 |
$xh->add_attribute("class", "d-none");
|
|
|
357 |
$xh->tag('td', $row['price']);
|
|
|
358 |
$xh->tag('td', $price);
|
|
|
359 |
$xh->add_attribute("class", "text-nowrap");
|
|
|
360 |
$xh->tag('td');
|
|
|
361 |
$xh->add_attribute("id", "wlEditBtn" . $row['id']);
|
|
|
362 |
$xh->add_attribute("class", "btn btn-sm btn-warning rounded px-1");
|
|
|
363 |
$xh->add_attribute("type", "button");
|
|
|
364 |
$xh->add_attribute("data-toggle", "tooltip");
|
|
|
365 |
$xh->add_attribute("title", "Edit");
|
|
|
366 |
$xh->add_attribute("aria-label", "Edit Entry");
|
|
|
367 |
$xh->tag('button');
|
|
|
368 |
$xh->add_attribute("class", "material-icons");
|
|
|
369 |
$xh->tag('i', "edit");
|
|
|
370 |
$xh->close(); // button
|
|
|
371 |
$xh->tag('span' , " ");
|
|
|
372 |
$xh->add_attribute("id", "wlDeleteBtn" . $row['id']);
|
|
|
373 |
$xh->add_attribute("class", "btn btn-sm btn-danger rounded px-1");
|
|
|
374 |
$xh->add_attribute("type", "button");
|
|
|
375 |
$xh->add_attribute("data-toggle", "tooltip");
|
|
|
376 |
$xh->add_attribute("title", "Delete");
|
|
|
377 |
$xh->add_attribute("aria-label", "Delete Entry");
|
|
|
378 |
$xh->tag('button');
|
|
|
379 |
$xh->add_attribute("class", "material-icons");
|
|
|
380 |
$xh->tag('i', "cancel_presentation");
|
|
|
381 |
$xh->close(); // button
|
|
|
382 |
$xh->tag('span' , " ");
|
130 |
- |
383 |
$xh->add_attribute("id", "wlInfoBtn" . $row['id']);
|
127 |
- |
384 |
$xh->add_attribute("class", "btn btn-sm btn-info rounded px-1 hide-small");
|
|
|
385 |
$xh->add_attribute("role", "button");
|
|
|
386 |
$xh->add_attribute("data-toggle", "tooltip");
|
|
|
387 |
$xh->add_attribute("title", "Information");
|
|
|
388 |
$xh->add_attribute("aria-label", "Information for Entry");
|
|
|
389 |
$xh->add_attribute("href", htmlentities($row['url']));
|
|
|
390 |
$xh->add_attribute("target", "_blank", "rel", "noreferrer noopener");
|
|
|
391 |
$xh->tag('a');
|
|
|
392 |
$xh->add_attribute("class", "material-icons");
|
|
|
393 |
$xh->tag('i', "info_outline");
|
|
|
394 |
$xh->close(); // a
|
|
|
395 |
$xh->tag('span' , " ");
|
|
|
396 |
$xh->add_attribute("id", "wlSearchBtn" . $row['id']);
|
|
|
397 |
$xh->add_attribute("type", "submit");
|
134 |
- |
398 |
$xh->add_attribute("name", "submitBtn");
|
127 |
- |
399 |
$xh->add_attribute("value", "discogsSearch");
|
|
|
400 |
$xh->add_attribute("class", "btn btn-sm btn-success rounded px-1");
|
|
|
401 |
$xh->tag('button');
|
|
|
402 |
$xh->add_attribute("class", "material-icons");
|
|
|
403 |
$xh->add_attribute("title", "Search for Store Offers");
|
|
|
404 |
$xh->add_attribute("aria-label", "Search Store Offers for Entry");
|
|
|
405 |
$xh->add_attribute("data-toggle", "tooltip");
|
|
|
406 |
$xh->tag('i', "search");
|
|
|
407 |
$xh->close(); // button
|
|
|
408 |
$xh->close(); // td
|
|
|
409 |
$xh->add_attribute("id", "wlIdRow" . $row['id']);
|
|
|
410 |
$xh->add_attribute("class", "d-none");
|
|
|
411 |
$xh->tag('td', "");
|
|
|
412 |
$xh->close(); // tr
|
46 |
- |
413 |
}
|
52 |
- |
414 |
|
127 |
- |
415 |
$xh->close(); // tbody
|
|
|
416 |
$xh->close(); // table
|
130 |
- |
417 |
$xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
|
|
|
418 |
$xh->tag('script');
|
137 |
- |
419 |
$str = my_trim('document.addEventListener("DOMContentLoaded", function() {');
|
|
|
420 |
$str .= my_trim(' document.getElementById("wishlistTable").addEventListener("click", function(event) {');
|
|
|
421 |
$str .= my_trim(' e = event.target.closest("button") || event.target.closest("a");');
|
|
|
422 |
$str .= my_trim(' tr = event.target.closest("tr");');
|
|
|
423 |
$str .= my_trim(' if (e && tr && e.id.startsWith("wlEditBtn")) {');
|
|
|
424 |
$str .= my_trim(' var id = tr.getAttribute("data-id");');
|
|
|
425 |
$str .= my_trim(' window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Wishlist", "eventAction" : "Edit", "eventLabel" : ""});');
|
|
|
426 |
$str .= my_trim(' editWishlist(id, e);');
|
|
|
427 |
$str .= my_trim(' } else if (e && tr && e.id.startsWith("wlDeleteBtn")) {');
|
|
|
428 |
$str .= my_trim(' var id = tr.getAttribute("data-id");');
|
|
|
429 |
$str .= my_trim(' var title = tr.getAttribute("data-title");');
|
|
|
430 |
$str .= my_trim(' var artist = tr.getAttribute("data-artist");');
|
|
|
431 |
$str .= my_trim(' window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Wishlist", "eventAction" : "Delete", "eventLabel" : ""});');
|
|
|
432 |
$str .= my_trim(' deleteWishlist(id, e, title, artist);');
|
|
|
433 |
$str .= my_trim(' } else if (e && tr && e.id.startsWith("wlInfoBtn")) {');
|
|
|
434 |
$str .= my_trim(' window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Album Info", "eventAction" : "Click", "eventLabel" : ""});');
|
|
|
435 |
$str .= my_trim(' } else if (e && tr && e.id.startsWith("wlSearchBtn")) {');
|
|
|
436 |
$str .= my_trim(' var title = tr.getAttribute("data-title");');
|
|
|
437 |
$str .= my_trim(' var artist = tr.getAttribute("data-artist");');
|
|
|
438 |
$str .= my_trim(' var barcode = tr.getAttribute("data-barcode");');
|
|
|
439 |
$str .= my_trim(' var searchTitle = tr.getAttribute("data-search-title");');
|
|
|
440 |
$str .= my_trim(' document.getElementById("discogsTitle").value = title;');
|
|
|
441 |
$str .= my_trim(' document.getElementById("discogsArtist").value = artist;');
|
|
|
442 |
$str .= my_trim(' document.getElementById("discogsBarcode").value = barcode;');
|
|
|
443 |
$str .= my_trim(' progressBar(searchTitle);');
|
|
|
444 |
$str .= my_trim(' if (window.google_tag_manager && window.ga && ga.create) {');
|
|
|
445 |
$str .= my_trim(' event.preventDefault();');
|
141 |
- |
446 |
$str .= my_trim(' var st = "";');
|
137 |
- |
447 |
$str .= my_trim(' var form = event.target.closest("form");');
|
|
|
448 |
$str .= my_trim(' var input = document.createElement("input");');
|
|
|
449 |
$str .= my_trim(' input.setAttribute("type", "hidden");');
|
|
|
450 |
$str .= my_trim(' input.setAttribute("name", "submitBtn");');
|
|
|
451 |
$str .= my_trim(' input.setAttribute("value", "discogsSearch");');
|
|
|
452 |
$str .= my_trim(' form.appendChild(input);');
|
141 |
- |
453 |
$str .= my_trim(' if (title.length > 0) st += title;');
|
|
|
454 |
$str .= my_trim(' if (title.length > 0 && artist.length > 0) st += " by ";');
|
|
|
455 |
$str .= my_trim(' if (artist.length > 0) st += artist;');
|
|
|
456 |
$str .= my_trim(' window.dataLayer.push({ "event" : "search", "search_term" : st, "eventCallback": function () {form.submit();}});');
|
137 |
- |
457 |
$str .= my_trim(' }');
|
|
|
458 |
$str .= my_trim(' }');
|
|
|
459 |
$str .= my_trim(' });');
|
|
|
460 |
$str .= my_trim('});');
|
130 |
- |
461 |
$xh->insert_code($str);
|
|
|
462 |
$xh->close(); // script
|
|
|
463 |
|
127 |
- |
464 |
$xh->close(); // div
|
|
|
465 |
$xh->close(); // form
|
|
|
466 |
|
|
|
467 |
$xh->add_attribute("class", "modal fade");
|
|
|
468 |
$xh->add_attribute("id", "editWishlistModal");
|
|
|
469 |
$xh->tag('div');
|
|
|
470 |
$xh->add_attribute("class", "modal-dialog");
|
|
|
471 |
$xh->tag('div');
|
|
|
472 |
$xh->add_attribute("class", "modal-content");
|
|
|
473 |
$xh->tag('div');
|
|
|
474 |
$xh->add_attribute("class", "modal-header bg-secondary");
|
|
|
475 |
$xh->tag('div');
|
|
|
476 |
$xh->add_attribute("class", "modal-title display-6");
|
|
|
477 |
$xh->tag('p', "Edit Wishlist Entry");
|
|
|
478 |
$xh->close(); // div>
|
|
|
479 |
$xh->add_attribute("class", "mt-0");
|
|
|
480 |
$xh->add_attribute("id", "wlMsg");
|
|
|
481 |
$xh->tag('span', "");
|
|
|
482 |
$xh->insert_code(inputSessionTab());
|
|
|
483 |
$xh->add_attribute("type", "hidden");
|
|
|
484 |
$xh->add_attribute("name", "wlId");
|
|
|
485 |
$xh->add_attribute("id", "wlId");
|
|
|
486 |
$xh->single_tag('input');
|
|
|
487 |
$xh->add_attribute("class", "modal-body");
|
|
|
488 |
$xh->tag('div');
|
|
|
489 |
$xh->add_attribute("class", "form-group");
|
|
|
490 |
$xh->tag('div');
|
|
|
491 |
$xh->add_attribute("for", "wlArtist");
|
|
|
492 |
$xh->tag('label', "Artist:");
|
|
|
493 |
$xh->add_attribute("type", "text");
|
|
|
494 |
$xh->add_attribute("class", "form-control");
|
|
|
495 |
$xh->add_attribute("id", "wlArtist");
|
|
|
496 |
$xh->single_tag('input');
|
|
|
497 |
$xh->close(); // div
|
|
|
498 |
$xh->add_attribute("class", "form-group");
|
|
|
499 |
$xh->tag('div');
|
|
|
500 |
$xh->add_attribute("for", "wlTitle");
|
|
|
501 |
$xh->tag('label', "Title:");
|
|
|
502 |
$xh->add_attribute("type", "text");
|
|
|
503 |
$xh->add_attribute("class", "form-control");
|
|
|
504 |
$xh->add_attribute("id", "wlTitle");
|
|
|
505 |
$xh->single_tag('input');
|
|
|
506 |
$xh->close(); // div
|
|
|
507 |
$xh->add_attribute("class", "form-group");
|
|
|
508 |
$xh->tag('div');
|
|
|
509 |
$xh->add_attribute("for", "wlBarcode");
|
|
|
510 |
$xh->tag('label', "Barcode:");
|
|
|
511 |
$xh->add_attribute("type", "text");
|
|
|
512 |
$xh->add_attribute("class", "form-control");
|
|
|
513 |
$xh->add_attribute("id", "wlBarcode");
|
|
|
514 |
$xh->single_tag('input');
|
|
|
515 |
$xh->close(); // div
|
|
|
516 |
$xh->add_attribute("class", "form-group");
|
|
|
517 |
$xh->tag('div');
|
|
|
518 |
$xh->add_attribute("for", "wlCond");
|
|
|
519 |
$xh->tag('label', "Condition:");
|
|
|
520 |
$xh->add_attribute("class", "form-control");
|
|
|
521 |
$xh->add_attribute("id", "wlCond");
|
|
|
522 |
$xh->tag('select');
|
|
|
523 |
$xh->tag('option', "Any");
|
|
|
524 |
$xh->tag('option', "New");
|
|
|
525 |
$xh->tag('option', "Used");
|
|
|
526 |
$xh->close(); // select
|
|
|
527 |
$xh->close(); // div
|
|
|
528 |
$xh->add_attribute("class", "form-group");
|
|
|
529 |
$xh->tag('div');
|
|
|
530 |
$xh->add_attribute("for", "wlFormat");
|
|
|
531 |
$xh->tag('label', "Format:");
|
|
|
532 |
$xh->add_attribute("class", "form-control");
|
|
|
533 |
$xh->add_attribute("id", "wlFormat");
|
|
|
534 |
$xh->tag('select');
|
|
|
535 |
$xh->tag('option', "Any");
|
|
|
536 |
$xh->tag('option', "CD");
|
|
|
537 |
$xh->tag('option', "Record");
|
|
|
538 |
$xh->tag('option', "Digital");
|
|
|
539 |
$xh->tag('option', "Book");
|
|
|
540 |
$xh->close(); // select
|
|
|
541 |
$xh->close(); // div
|
|
|
542 |
$xh->add_attribute("class", "form-group");
|
|
|
543 |
$xh->tag('div');
|
|
|
544 |
$xh->add_attribute("for", "wlPrice");
|
|
|
545 |
$xh->tag('label', "Ceiling Price:");
|
|
|
546 |
$xh->add_attribute("type", "text");
|
|
|
547 |
$xh->add_attribute("class", "form-control");
|
|
|
548 |
$xh->add_attribute("id", "wlPrice");
|
|
|
549 |
$xh->single_tag('input');
|
|
|
550 |
$xh->close(); // div
|
|
|
551 |
$xh->close(); // div
|
|
|
552 |
$xh->add_attribute("class", "modal-footer bg-secondary");
|
|
|
553 |
$xh->tag('div');
|
|
|
554 |
$xh->add_attribute("id", "saveEditedWl");
|
|
|
555 |
$xh->add_attribute("type", "button");
|
|
|
556 |
$xh->add_attribute("class", "btn btn-success");
|
134 |
- |
557 |
$xh->add_attribute("name", "submitBtn");
|
127 |
- |
558 |
$xh->add_attribute("value", "Save");
|
|
|
559 |
$xh->tag('button', "Save");
|
|
|
560 |
$xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
|
|
|
561 |
$xh->tag('script');
|
137 |
- |
562 |
$str = my_trim('document.addEventListener("DOMContentLoaded", function() {');
|
|
|
563 |
$str .= my_trim(' document.getElementById("saveEditedWl").addEventListener("click", function() {');
|
|
|
564 |
$str .= my_trim(' saveEditedWishlist();');
|
|
|
565 |
$str .= my_trim(' });');
|
|
|
566 |
$str .= my_trim('});');
|
127 |
- |
567 |
$xh->insert_code($str);
|
|
|
568 |
$xh->close(); // script
|
|
|
569 |
$xh->add_attribute("type", "button");
|
|
|
570 |
$xh->add_attribute("class", "btn btn-danger");
|
|
|
571 |
$xh->add_attribute("data-dismiss", "modal");
|
|
|
572 |
$xh->tag('button', "Cancel");
|
|
|
573 |
$xh->close(); // div
|
|
|
574 |
$xh->close(); // div
|
|
|
575 |
$xh->close(); // div
|
|
|
576 |
$xh->close(); // div
|
|
|
577 |
$xh->close(); // div
|
65 |
- |
578 |
}
|
|
|
579 |
else {
|
127 |
- |
580 |
$xh->add_attribute("class", "container bg-warning text-center py-3");
|
|
|
581 |
$xh->tag('div');
|
|
|
582 |
$xh->add_attribute("class", "display-6");
|
|
|
583 |
$xh->tag('p');
|
|
|
584 |
$xh->add_attribute("class", "material-icons");
|
|
|
585 |
$xh->tag('i', "bookmark");
|
|
|
586 |
$xh->tag('span', " Your wishlist is currently empty. Add matching albums from the search results.");
|
|
|
587 |
$xh->close(); // p
|
|
|
588 |
$xh->close(); // div
|
46 |
- |
589 |
}
|
|
|
590 |
}
|
65 |
- |
591 |
else if (mysqli_errno($conn)) {
|
|
|
592 |
error_log("MySQL Read Wishlist SQL: " . $sql);
|
|
|
593 |
error_log("MySQL Read Wishlist Error: " . mysqli_error($conn) . " (" . mysqli_errno($conn) . ")");
|
|
|
594 |
}
|
46 |
- |
595 |
|
127 |
- |
596 |
$html = $xh->flush();
|
|
|
597 |
//error_log(print_r($html, 1));
|
|
|
598 |
|
|
|
599 |
return $html;
|
52 |
- |
600 |
}
|
|
|
601 |
|
|
|
602 |
function deleteWishlist($uid, $id) {
|
|
|
603 |
$conn = MySessionHandler::getDBSessionId();
|
|
|
604 |
|
|
|
605 |
$id = mysqli_real_escape_string($conn, $id);
|
|
|
606 |
$uid = mysqli_real_escape_string($conn, $uid);
|
|
|
607 |
|
|
|
608 |
$sql = "DELETE FROM wishlist WHERE id = $id AND uid = $uid;";
|
|
|
609 |
|
|
|
610 |
if (!($result = mysqli_query($conn, $sql))) {
|
65 |
- |
611 |
error_log("MySQL Delete Wishlist SQL: " . $sql);
|
|
|
612 |
error_log("MySQL Delete Wishlist Error: " . mysqli_error($conn) . " (" . mysqli_errno($conn) . ")");
|
|
|
613 |
return -1;
|
52 |
- |
614 |
}
|
|
|
615 |
|
|
|
616 |
return 0;
|
|
|
617 |
}
|
|
|
618 |
|
|
|
619 |
function updateWishlist($uid, $wlArr) {
|
|
|
620 |
$nul = 'NULL';
|
|
|
621 |
$conn = MySessionHandler::getDBSessionId();
|
|
|
622 |
|
|
|
623 |
$modified = mysqli_real_escape_string($conn, time());
|
|
|
624 |
|
|
|
625 |
$id = (empty($wlArr['id']) ? "NULL" : "'" . mysqli_real_escape_string($conn, $wlArr['id']) . "'");
|
|
|
626 |
$uid = mysqli_real_escape_string($conn, $uid);
|
|
|
627 |
$barcode = (empty($wlArr['barcode']) ? "NULL" : "'" . mysqli_real_escape_string($conn, $wlArr['barcode']) . "'");
|
|
|
628 |
$title = isset($wlArr['title']) ? "'" . mysqli_real_escape_string($conn, $wlArr['title']) . "'" : "NULL";
|
|
|
629 |
$artist = isset($wlArr['artist']) ? "'" . mysqli_real_escape_string($conn, $wlArr['artist']) . "'" : "NULL";
|
73 |
- |
630 |
$cond = isset($wlArr['cond']) ? mysqli_real_escape_string($conn, $wlArr['cond']) : "Any";
|
52 |
- |
631 |
$format = isset($wlArr['format']) ? mysqli_real_escape_string($conn, $wlArr['format']) : "Any";
|
|
|
632 |
$currency = 'USD'; //bugbug
|
|
|
633 |
$price = isset($wlArr['price']) ? "'" . mysqli_real_escape_string($conn, $wlArr['price']) . "'" : "NULL";
|
|
|
634 |
|
|
|
635 |
$sql = "UPDATE wishlist
|
73 |
- |
636 |
SET modified='$modified', barcode=" . $barcode . ", title=" . $title . ", artist=" . $artist . ", cond='$cond', format='$format', price=" . $price . "
|
52 |
- |
637 |
WHERE id=$id and uid=$uid";
|
|
|
638 |
|
|
|
639 |
if ($result = mysqli_query($conn, $sql)) {
|
|
|
640 |
return 0;
|
65 |
- |
641 |
}
|
|
|
642 |
else {
|
52 |
- |
643 |
error_log("MySQL Update Wishlist SQL: " . $sql);
|
|
|
644 |
error_log("MySQL Update Wishlist Error: " . mysqli_error($conn) . " (" . $error . ")");
|
|
|
645 |
return -1;
|
|
|
646 |
}
|
|
|
647 |
|
|
|
648 |
return -1;
|
|
|
649 |
}
|
73 |
- |
650 |
|
|
|
651 |
function unsubscribeWishlist($arr) {
|
116 |
- |
652 |
if (empty($arr['id']) || empty($arr['email'])) {
|
|
|
653 |
return "";
|
|
|
654 |
}
|
73 |
- |
655 |
$conn = MySessionHandler::getDBSessionId();
|
|
|
656 |
|
|
|
657 |
$modified = mysqli_real_escape_string($conn, time());
|
|
|
658 |
|
|
|
659 |
$id = mysqli_real_escape_string($conn, $arr['id']);
|
|
|
660 |
$email = mysqli_real_escape_string($conn, $arr['email']);
|
|
|
661 |
|
|
|
662 |
$sql = "UPDATE users
|
|
|
663 |
SET wlEmailFlag = '0'
|
|
|
664 |
WHERE id=$id and email='$email'";
|
|
|
665 |
|
|
|
666 |
if (!($result = mysqli_query($conn, $sql))) {
|
|
|
667 |
error_log("MySQL Update Wishlist SQL: " . $sql);
|
|
|
668 |
error_log("MySQL Update Wishlist Error: " . mysqli_error($conn) . " (" . $error . ")");
|
|
|
669 |
}
|
|
|
670 |
|
127 |
- |
671 |
$xh = new Html;
|
|
|
672 |
$xh->init($_SESSION["htmlIndent"]);
|
73 |
- |
673 |
|
127 |
- |
674 |
$xh->add_attribute("class", "container text-center bg-warning p-3 rounded");
|
|
|
675 |
$xh->tag('div');
|
|
|
676 |
$xh->add_attribute("class", "display-6 font-weight-bold");
|
|
|
677 |
$xh->tag('p', "The wishlist price check emails for " . $email . " have been turned off.");
|
|
|
678 |
$xh->tag('p', "You can reinstate the emails at any time by setting the option 'Email Price Checks' for your account back to 'Yes'.");
|
|
|
679 |
$xh->close(); // div>";
|
|
|
680 |
|
|
|
681 |
$html = $xh->flush();
|
|
|
682 |
//error_log(print_r($html, 1));
|
|
|
683 |
|
|
|
684 |
return $html;
|
73 |
- |
685 |
}
|
78 |
- |
686 |
|
|
|
687 |
function checkPriceMonitor() {
|
|
|
688 |
if (empty($_SESSION['sessData']['userID'])) {
|
|
|
689 |
unset($_SESSION['priceMonitor']);
|
|
|
690 |
return -1;
|
|
|
691 |
}
|
|
|
692 |
|
|
|
693 |
$conn = MySessionHandler::getDBSessionId();
|
|
|
694 |
|
|
|
695 |
$uid = $_SESSION['sessData']['userID'];
|
|
|
696 |
|
|
|
697 |
$sql = "SELECT created, access
|
|
|
698 |
FROM pricemonitor
|
|
|
699 |
WHERE userId = '$uid'";
|
|
|
700 |
|
|
|
701 |
if ($result = mysqli_query($conn, $sql)) {
|
|
|
702 |
if (mysqli_num_rows($result) > 0) {
|
|
|
703 |
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
704 |
$_SESSION['priceMonitor']['created'] = $row['created'];
|
|
|
705 |
$_SESSION['priceMonitor']['access'] = $row['access'];
|
110 |
- |
706 |
if ($_SESSION['priceMonitor']['created'] > $_SESSION['priceMonitor']['access']) {
|
79 |
- |
707 |
$_SESSION['priceMonitor']['newFlag'] = true;
|
|
|
708 |
} else {
|
|
|
709 |
$_SESSION['priceMonitor']['newFlag'] = false;
|
|
|
710 |
}
|
78 |
- |
711 |
|
|
|
712 |
return 0;
|
|
|
713 |
}
|
|
|
714 |
}
|
|
|
715 |
}
|
|
|
716 |
else if (mysqli_errno($conn)) {
|
|
|
717 |
error_log("MySQL Read Price Monitor SQL: " . $sql);
|
|
|
718 |
error_log("MySQL Read Price Monitor Error: " . mysqli_error($conn) . " (" . mysqli_errno($conn) . ")");
|
|
|
719 |
}
|
|
|
720 |
|
|
|
721 |
return -1;
|
|
|
722 |
}
|
|
|
723 |
|
|
|
724 |
|
|
|
725 |
function getPriceMonitor() {
|
127 |
- |
726 |
$xh = new Html;
|
|
|
727 |
$xh->init($_SESSION["htmlIndent"]);
|
|
|
728 |
|
107 |
- |
729 |
if (!isLoggedIn()) {
|
127 |
- |
730 |
$xh->add_attribute("class", "container bg-warning text-center py-3");
|
|
|
731 |
$xh->tag('div');
|
|
|
732 |
$xh->add_attribute("class", "display-6");
|
|
|
733 |
$xh->tag('p');
|
|
|
734 |
$xh->add_attribute("class", "material-icons");
|
|
|
735 |
$xh->tag('i', "error_outline");
|
|
|
736 |
$xh->tag('span', " Please login to your Find Cheap Music account in order to see the price monitor results.");
|
|
|
737 |
$xh->close(); // p
|
|
|
738 |
$xh->close(); // div
|
|
|
739 |
|
|
|
740 |
$html = $xh->flush();
|
|
|
741 |
//error_log(print_r($html, 1));
|
|
|
742 |
|
|
|
743 |
return $html;
|
107 |
- |
744 |
}
|
|
|
745 |
|
78 |
- |
746 |
$conn = MySessionHandler::getDBSessionId();
|
|
|
747 |
|
|
|
748 |
$uid = $_SESSION['sessData']['userID'];
|
|
|
749 |
|
|
|
750 |
$sql = "SELECT data
|
|
|
751 |
FROM pricemonitor
|
|
|
752 |
WHERE userId = '$uid'";
|
|
|
753 |
|
|
|
754 |
if ($result = mysqli_query($conn, $sql)) {
|
|
|
755 |
if (mysqli_num_rows($result) > 0) {
|
|
|
756 |
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
757 |
$access = mysqli_real_escape_string($conn, time());
|
|
|
758 |
$sql = "UPDATE pricemonitor
|
|
|
759 |
SET access = $access
|
|
|
760 |
WHERE userId = '$uid'";
|
|
|
761 |
if (!($result = mysqli_query($conn, $sql))) {
|
|
|
762 |
error_log("MySQL Update Price Monitor SQL: " . $sql);
|
|
|
763 |
error_log("MySQL Update Price Monitor Error: " . mysqli_error($conn) . " (" . $error . ")");
|
|
|
764 |
}
|
|
|
765 |
|
121 |
- |
766 |
$html = gzdecode(base64_decode($row['data']));
|
|
|
767 |
$html = str_replace(base64_encode("xxxNONCExxx"), base64_encode($_SESSION["nonce"]), $html);
|
|
|
768 |
return ($html);
|
78 |
- |
769 |
}
|
|
|
770 |
}
|
|
|
771 |
}
|
|
|
772 |
else if (mysqli_errno($conn)) {
|
|
|
773 |
error_log("MySQL Read Price Monitor SQL: " . $sql);
|
|
|
774 |
error_log("MySQL Read Price Monitor Error: " . mysqli_error($conn) . " (" . mysqli_errno($conn) . ")");
|
|
|
775 |
}
|
|
|
776 |
|
127 |
- |
777 |
$xh->add_attribute("class", "container bg-warning text-center py-3");
|
|
|
778 |
$xh->tag('div');
|
|
|
779 |
$xh->add_attribute("class", "display-6");
|
|
|
780 |
$xh->tag('p');
|
|
|
781 |
$xh->add_attribute("class", "material-icons");
|
|
|
782 |
$xh->tag('i', "bookmark");
|
|
|
783 |
$xh->tag('span', " Your price monitor list is currently empty.");
|
|
|
784 |
$xh->close(); // p
|
|
|
785 |
$xh->close(); // div
|
|
|
786 |
|
|
|
787 |
$html = $xh->flush();
|
|
|
788 |
//error_log(print_r($html, 1));
|
|
|
789 |
|
|
|
790 |
return $html;
|
78 |
- |
791 |
}
|