home.php 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of MacSwap.
  6. *
  7. * MacSwap is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * MacSwap is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with MacSwap. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * MacSwap home page.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2021, 2024, 5 Mode
  26. */
  27. $curLocale = APP_LOCALE;
  28. $password = filter_input(INPUT_POST, "Password");
  29. if ($password==PHP_STR) {
  30. $password = filter_input(INPUT_POST, "Password2");
  31. }
  32. if ($password !== PHP_STR) {
  33. $hash = hash("sha256", $password . APP_SALT, false);
  34. if ($hash !== APP_HASH) {
  35. $password=PHP_STR;
  36. }
  37. }
  38. ?>
  39. <script>
  40. <?PHP if ($password != PHP_STR): ?>
  41. password = 1;
  42. <?PHP else: ?>
  43. password = 0;
  44. <?PHP endif ?>
  45. businessType = "<?PHP echo(BUSINESS_TYPE)?>";
  46. </script>
  47. <!DOCTYPE html>
  48. <head>
  49. <meta charset="UTF-8"/>
  50. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  51. <!--
  52. Copyright 2021, 2024 5 Mode
  53. This file is part of MAcSwap.
  54. MacSwap is free software: you can redistribute it and/or modify
  55. it under the terms of the GNU General Public License as published by
  56. the Free Software Foundation, either version 3 of the License, or
  57. (at your option) any later version.
  58. MacSwap is distributed in the hope that it will be useful,
  59. but WITHOUT ANY WARRANTY; without even the implied warranty of
  60. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  61. GNU General Public License for more details.
  62. You should have received a copy of the GNU General Public License
  63. along with MacSwap. If not, see <https://www.gnu.org/licenses/>.
  64. -->
  65. <title>MacSwap: Swapping everything but burgers..</title>
  66. <link rel="shortcut icon" href="/favicon.ico?v=<?php echo(time()); ?>" />
  67. <meta name="description" content="Welcome to <?php echo(APP_NAME); ?>"/>
  68. <meta name="author" content="5 Mode"/>
  69. <meta name="robots" content="index,follow"/>
  70. <script src="/js/jquery-3.6.0.min.js" type="text/javascript"></script>
  71. <script src="/js/common.js" type="text/javascript"></script>
  72. <script src="/js/bootstrap.min.js" type="text/javascript"></script>
  73. <script src="/js/sha.js" type="text/javascript"></script>
  74. <script src="/js/serialize-javascript.js" type="text/javascript"></script>
  75. <script src="/js/cube-code.js" type="text/javascript"></script>
  76. <script src="/js/dragndrop-code.js" type="text/javascript"></script>
  77. <script src="/js/home.js?v=<?php echo(time()); ?>" type="text/javascript" defer></script>
  78. <link href="/css/bootstrap.min.css" type="text/css" rel="stylesheet">
  79. <link href="/css/style.css?v=<?php echo(time()); ?>" type="text/css" rel="stylesheet">
  80. <script>
  81. /*
  82. * Interaction code
  83. */
  84. timeoutId=0;
  85. var oldtthis; // Old cube
  86. var lineOldVal = ""; // Old value for a detail line
  87. var lineNewVal = ""; // New value for a detail line
  88. var dataChanged = false;
  89. /*
  90. * Select the given cube
  91. *
  92. * @param <interfaceEl> selected cube
  93. * @returns void
  94. */
  95. function selCube(tthis) {
  96. <?PHP //if ($password != PHP_STR): ?>
  97. _selCube(tthis);
  98. // Clean the old selected..
  99. $(oldtthis).css("color","#d4b0dc");
  100. $(oldtthis).css("text-decoration","none");
  101. oldtthis = tthis;
  102. // Decore the selected one..
  103. $(tthis).css("color","#bd006e");
  104. $(tthis).css("text-decoration","underline");
  105. $("#cubezvname").html(curcube.getname());
  106. // Reset the detail view
  107. $("#detailtitle").html("");
  108. $("#detaildata").html("");
  109. $("#datadetail").hide();
  110. // Update ZOOMED VIEW interface..
  111. //$("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  112. //$("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  113. //$("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  114. //$("#face1").attr("target", curcube.getFace('h0'));
  115. //$("#face2").attr("target", curcube.getFace('v1'));
  116. //$("#face3").attr("target", curcube.getFace('h1'));
  117. clearTimeout(timeoutId);
  118. // Update body background..
  119. //$(document.body).css("background","url('../res/bg.jpg')");
  120. //$(document.body).css("background-size","cover");
  121. // Display ZOOMED VIEW interface and controls
  122. $("#cubeList").css("width", "80%");
  123. //$("#cubectrls").show();
  124. //$("#zoomedview").show();
  125. //$("#cubelinks").show();
  126. <?PHP //endif; ?>
  127. }
  128. /*
  129. * Select the given offer cube
  130. *
  131. * @param <interfaceEl> selected cube
  132. * @returns void
  133. */
  134. function selOfferCube(tthis) {
  135. <?PHP //if ($password != PHP_STR): ?>
  136. _selOfferCube(tthis);
  137. // Clean the old selected..
  138. $(oldtthis).css("color","#d4b0dc");
  139. $(oldtthis).css("text-decoration","none");
  140. oldtthis = tthis;
  141. // Decore the selected one..
  142. $(tthis).css("color","#bd006e");
  143. $(tthis).css("text-decoration","underline");
  144. $("#cubezvname").html(curcube.getname());
  145. // Reset the detail view
  146. $("#detailtitle").html("");
  147. $("#detaildata").html("");
  148. $("#datadetail").hide();
  149. // Update ZOOMED VIEW interface..
  150. //$("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  151. //$("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  152. //$("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  153. //$("#face1").attr("target", curcube.getFace('h0'));
  154. //$("#face2").attr("target", curcube.getFace('v1'));
  155. //$("#face3").attr("target", curcube.getFace('h1'));
  156. clearTimeout(timeoutId);
  157. // Update body background..
  158. //$(document.body).css("background","url('../res/bg.jpg')");
  159. //$(document.body).css("background-size","cover");
  160. // Display ZOOMED VIEW interface and controls
  161. $("#cubeList").css("width", "80%");
  162. //$("#cubectrls").show();
  163. //$("#zoomedview").show();
  164. //$("#cubelinks").show();
  165. <?PHP //endif; ?>
  166. }
  167. /*
  168. * Display the debug info
  169. *
  170. * @returns void
  171. */
  172. function visInfo() {
  173. $("#hcube").val(curcube.gethcube());
  174. $("#vcube").val(curcube.getvcube());
  175. $("#hcur").val(curcube.gethcur());
  176. $("#vcur").val(curcube.getvcur());
  177. $("#curcube").val(curcube.getname());
  178. }
  179. /*
  180. function eachNode(rootNode, callback) {
  181. if (!callback) {
  182. const nodes = []
  183. eachNode(rootNode, function(node) {
  184. nodes.push(node.nodeName)
  185. //nodes.push(node)
  186. })
  187. return nodes
  188. }
  189. if (false === callback(rootNode)) {
  190. return false
  191. }
  192. if (rootNode.hasChildNodes()) {
  193. const nodes = rootNode.childNodes
  194. for (let i = 0, l = nodes.length; i < l; ++i) {
  195. if (false === eachNode(nodes[i], callback)) {
  196. return
  197. }
  198. }
  199. }
  200. }
  201. */
  202. /*
  203. * Get the data for the given detail / face
  204. *
  205. * @param string xmlStr, the current cube xml data
  206. * @param string detail, the requested detail
  207. * @returns string, the detail data
  208. */
  209. function getDetailData(xmlStr, detail, isOffer) {
  210. var ret = "";
  211. var re;
  212. detail = detail.toLowerCase();
  213. xmlStr = xmlStr.replace('<?xml version="1.0" encoding="UTF-8"?>',"");
  214. xmlStr = xmlStr.replace('<details>',"");
  215. xmlStr = xmlStr.replace('</details>',"");
  216. xmlStr = xmlStr.replaceAll('\n',"");
  217. xmlStr = xmlStr.replaceAll(String.fromCharCode(9), "");
  218. xmlStr = xmlStr.replaceAll(String.fromCharCode(10), "");
  219. xmlStr = xmlStr.replaceAll(String.fromCharCode(13), "");
  220. xmlStr = xmlStr.replaceAll(" ", "");
  221. xmlStr = xmlStr.replaceAll(" ", "");
  222. xmlStr = escape(xmlStr);
  223. xmlStr = xmlStr.replaceAll("%0A", "");
  224. xmlStr = xmlStr.replaceAll("%20%20%20%20%20", "");
  225. xmlStr = xmlStr.replaceAll("%20%20%20%20%", "");
  226. xmlStr = xmlStr.replaceAll("%20%20%", "");
  227. //xmlStr = unescape(xmlStr);
  228. //alert(xmlStr);
  229. switch (detail) {
  230. case "swap":
  231. re = new RegExp("detail%20face%3D%22swap%22.+/country", "igsu");
  232. break;
  233. case "contacts":
  234. re = new RegExp("detail%20face%3D%22contacts%22.+/email", "igsu");
  235. break;
  236. case "other info":
  237. re = new RegExp("detail%20face%3D%22other%20info%22.+/guid", "igsu");
  238. break;
  239. case "password":
  240. re = new RegExp("detail%20face%3D%22password%22.+/password", "igsu");
  241. break;
  242. }
  243. s = re.exec(xmlStr);
  244. if (!s || s.length===0) {
  245. ret = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error! #1";
  246. return ret;
  247. }
  248. xmlStr = s[0];
  249. xmlStr = "<"+xmlStr+"></detail>";
  250. xmlStr = unescape(xmlStr);
  251. //alert(xmlStr);
  252. const parser = new DOMParser();
  253. const doc = parser.parseFromString(xmlStr, "text/xml");
  254. x = doc.getElementsByTagName("detail");
  255. if (x.length===0) {
  256. ret = "Error! #2";
  257. return ret;
  258. }
  259. ret += "<div style='padding:10px;'>";
  260. for (i = 0; i < x[0].childNodes.length; i++) {
  261. if (x[0].childNodes[i].nodeType === 1) {
  262. if (x[0].childNodes[i].getAttributeNode("type")) {
  263. mytype = x[0].childNodes[i].getAttributeNode("type");
  264. if (mytype.value==="pic") {
  265. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' placeholder='https://' onkeyup='storePicData(this)'></div>";
  266. } else {
  267. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' onkeyup='storeData(this)'></div>";
  268. }
  269. } else {
  270. <?PHP if ($password != PHP_STR): ?>
  271. saveOnKeyUp = "onkeyup='storeData(this)'";
  272. <?PHP else: ?>
  273. if (isOffer) {
  274. saveOnKeyUp = "onkeyup='storeData(this)'";
  275. } else {
  276. saveOnKeyUp = "";
  277. }
  278. <?PHP endif; ?>
  279. if (x[0].childNodes[i].nodeName === "business-type") {
  280. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + " style='color:green' readonly></div>";
  281. } else if (x[0].childNodes[i].nodeName === "guid") {
  282. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + " style='color:green' readonly></div>";
  283. } else if (x[0].childNodes[i].nodeName === "password") {
  284. <?PHP if ($password != PHP_STR): ?>
  285. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + " style='color:green' readonly></div>";
  286. <?PHP endif; ?>
  287. } else if (x[0].childNodes[i].nodeName === "city") {
  288. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + "></div>";
  289. } else if (x[0].childNodes[i].nodeName === "country") {
  290. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + "></div>";
  291. } else {
  292. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + "></div>";
  293. }
  294. }
  295. }
  296. }
  297. //if ((detail==="pictures") || (detail==="menu")) {
  298. // ret += "<div style='padding-left:80px;clear:both;'><br>you can use eg. Goolge Drive or Microsoft OneDrive to host your pictures.</div>"
  299. //}
  300. ret += "</div>";
  301. return ret;
  302. }
  303. /*
  304. * Store the old data of the text control
  305. *
  306. * @param {InterfaceEl} tthis, the text control under editing
  307. * @returns void
  308. */
  309. /*function storeOldData(tthis) {
  310. //alert("keypress");
  311. lineOldVal = $(tthis).val();
  312. }*/
  313. /*
  314. * Store in the cube object the new data of the text control
  315. *
  316. * @param {InterfaceEl} tthis, the text control under editing
  317. * @returns void
  318. */
  319. function storeData(tthis) {
  320. lineNewVal = $(tthis).val();
  321. //alert(lineNewVal);
  322. nodeName = tthis.id;
  323. nodeName = nodeName.replace("cube-detail-","");
  324. //alert(nodeName);
  325. xmlStr = curcube.getxml();
  326. //$("#log").html($("#log").html() + "old=" + "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs" + "\n");
  327. //$("#log").html($("#log").html() + "new=" + lineNewVal + "\n");
  328. //alert("<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
  329. //re = "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs";
  330. switch (nodeName) {
  331. case "name":
  332. re = /(\<name>).*(\<\/name>)/gs;
  333. break;
  334. case "description":
  335. re = /(\<description>).*(\<\/description>)/gs;
  336. break;
  337. case "value":
  338. re = /(\<value>).*(\<\/value>)/gs;
  339. break;
  340. case "city":
  341. re = /(\<city>).*(\<\/city>)/gs;
  342. break;
  343. case "country":
  344. re = /(\<country>).*(\<\/country>)/gs;
  345. break;
  346. case "contact":
  347. re = /(\<contact>).*(\<\/contact>)/gs;
  348. break;
  349. case "tel":
  350. re = /(\<tel>).*(\<\/tel>)/gs;
  351. break;
  352. case "cell":
  353. re = /(\<cell>).*(\<\/cell>)/gs;
  354. break;
  355. case "email":
  356. re = /(\<email>).*(\<\/email>)/gs;
  357. break;
  358. }
  359. xmlStr = xmlStr.replace(re, "$1" + lineNewVal + "$2");
  360. //xmlStr = xmlStr.replace("<" + nodeName + ">" + lineOldVal + "</" + nodeName + ">", "<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
  361. //alert(xmlStr);
  362. curcube.xml = xmlStr;
  363. dataChanged = true;
  364. }
  365. /*
  366. * Store in the cube object the new pic data
  367. *
  368. * @param {InterfaceEl} tthis, the text control under editing
  369. * @returns void
  370. */
  371. function storePicData(tthis) {
  372. }
  373. function _saveData() {
  374. if (dataChanged) {
  375. curcube.savedata();
  376. //saveData();
  377. dataChanged = false;
  378. }
  379. }
  380. setInterval("_saveData()", 1500);
  381. /*
  382. * Display the given data detail
  383. *
  384. * @param <interfaceEl> selected cube
  385. * @returns void
  386. */
  387. function openDetail(tthis) {
  388. //myhtml = getDetailData(curcube.getxml(), $(tthis).attr("target"));
  389. //$("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + $(tthis).attr("target") + ":");
  390. <?PHP if ($password!=""): ?>
  391. myhtml = getDetailData(curcube.getxml(), "swap") + getDetailData(curcube.getxml(), "contacts") + getDetailData(curcube.getxml(), "other info") + getDetailData(curcube.getxml(), "password");
  392. <?PHP else: ?>
  393. myhtml = getDetailData(curcube.getxml(), "swap");
  394. <?PHP endif; ?>
  395. $("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Detail:");
  396. $("#detaildata").html(myhtml);
  397. $("#datadetail").show();
  398. //alert(curcube.getxml());
  399. }
  400. /*
  401. * Display the given data detail
  402. *
  403. * @param <interfaceEl> selected cube
  404. * @returns void
  405. */
  406. function openOfferDetail(tthis) {
  407. //myhtml = getDetailData(curcube.getxml(), $(tthis).attr("target"));
  408. //$("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + $(tthis).attr("target") + ":");
  409. myhtml = getDetailData(curcube.getxml(), "swap") + getDetailData(curcube.getxml(), "contacts") + getDetailData(curcube.getxml(), "other info") + getDetailData(curcube.getxml(), "password");
  410. $("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Detail:");
  411. $("#detaildata").html(myhtml);
  412. $("#datadetail").show();
  413. //alert(curcube.getxml());
  414. }
  415. </script>
  416. <script>
  417. /*
  418. * Boot up code
  419. */
  420. //var fetchDataIntervalId;
  421. /*
  422. * App starting proc
  423. *
  424. * @returns void
  425. */
  426. function startApp() {
  427. window.name = encryptSha2(rnd(0,99999999)+"");
  428. <?php
  429. if ($password!=PHP_STR) {
  430. $cubedisplay="inline";
  431. } else {
  432. $cubedisplay="none";
  433. }
  434. chdir(APP_DATA_PATH);
  435. foreach (glob("*-s.xml") as $filename) {
  436. $s = substr(substr($filename, 0, strlen($filename)-6),6);
  437. $offerNum = count(glob("burger".$s."-o-*.xml"));
  438. ?>
  439. i = parseInt("<?php echo($s);?>");
  440. if (i<10) {
  441. newFormalName = "burger" + "00" + i;
  442. } else if (i<100) {
  443. newFormalName = "burger" + "0" + i;
  444. } else {
  445. newFormalName = "burger" + i;
  446. }
  447. s = "";
  448. s = s + "<div id='cubelc" + i + "' style='width:99%;overflow-x: scroll;'><div id='cubel" + i + "' order='" + i + "' size='" + <?PHP echo($offerNum); ?> + "' guid='" + window.name + "' style='width:3800px;height:300px;border: 0px solid green;' ondragover='onDragOver(event);' ondrop='onDrop(this, event);'>";
  449. <?PHP if ($password!=""): ?>
  450. s = s + "<div id='cube" + i + "' class='cube' style='background:url(/res/1burger_" + parseInt(rnd(1,3)) + ".png);background-size:cover;border: 3px dashed white;' order='" + i + "' onclick='selCube(this);openDetail(this);' draggable='true' ondragstart='onDragStart(this, event);' onmouseover='onMouseOver();'><div id='cube" + i + "name' class='cubename'>" + businessType + "#" + i + "</div></div>";
  451. <?PHP else: ?>
  452. s = s + "<div id='cube" + i + "' class='cube' style='background:url(/res/1burger_" + parseInt(rnd(1,3)) + ".png);background-size:cover;border: 3px dashed white;' order='" + i + "' onclick='selCube(this);openDetail(this);'><div id='cube" + i + "name' class='cubename'>" + businessType + "#" + i + "</div></div>";
  453. <?PHP endif; ?>
  454. offers[i-1] = [];
  455. myoffer = [];
  456. <?PHP
  457. $y = 1;
  458. foreach (glob("burger".$s."-o-*.xml") as $filename2) {
  459. $basename = substr($filename2, 0, strlen($filename2)-4);
  460. $ss = substr(substr($filename2, 0, strlen($filename2)-4),12);
  461. ?>
  462. y = <?PHP echo($y);?>;
  463. /*
  464. if (y<10) {
  465. newOfferFormalName = "burger" + "00" + y;
  466. } else if (y<100) {
  467. newOfferFormalName = "burger" + "0" + y;
  468. } else {
  469. newOfferFormalName = "burger" + y;
  470. }
  471. */
  472. newOfferFormalName = "<?PHP echo($basename); ?>";
  473. s = s + "<div id='<?PHP echo($basename);?>' class='cube' style='display:<?PHP echo($cubedisplay); ?>;background:url(/res/1burgerg_" + parseInt(rnd(1,3)) + ".png);background-size:cover;border: 0px solid red;' cubeorder='" + i + "' order='" + y + "' onclick='selOfferCube(this);openOfferDetail(this);' draggable='true' ondragstart='onDropOff(event);' onmouseover='onMouseOver();'><div id='cube" + i + "offer" + y + "name' class='cubename'>offer#" + y + "</div></div>";
  474. myoffer[y-1] = new myCube("Offer#" + y, newOfferFormalName, "<?php echo(APP_HOST)?>");
  475. myoffer[y-1].start();
  476. <?PHP
  477. $y++;
  478. }
  479. ?>
  480. offers[i-1] = myoffer;
  481. s = s + "</div></div>";
  482. $("#cubeList").html($("#cubeList").html() + s);
  483. //$("#cube" + i + "name").html(businessType + "#" + i);
  484. cubes[i-1] = new myCube(businessType + "#" + i, newFormalName, "<?php echo(APP_HOST)?>");
  485. cubes[i-1].start();
  486. totcubes = i;
  487. <?php
  488. }
  489. ?>
  490. $("#cubeList").show();
  491. $("#vplayer").get(0).pause();
  492. $("#HCsplash").css("display","none");
  493. $(".header").show();
  494. //fetchDataIntervalId = setInterval("_fetchData()", 2000);
  495. }
  496. /*
  497. * call to startApp
  498. *
  499. * @returns void
  500. */
  501. function _startApp() {
  502. setTimeout("startApp()", 1000);
  503. }
  504. /*
  505. * Set the elements position
  506. */
  507. function setContentPos() {
  508. $("#cubeList").css("height", parseInt(window.innerHeight-20) + "px");
  509. mytop = parseInt(window.innerHeight - ($("#passworddisplay").height() + 60));
  510. $("#passworddisplay").css("top", mytop+"px");
  511. }
  512. function setFooterPos() {
  513. if (document.getElementById("footerCont")) {
  514. //if ($("#Password").val() === "") {
  515. // tollerance = 48;
  516. // } else {
  517. // tollerance = 15;
  518. //}
  519. tollerance = 22;
  520. $("#footerCont").css("top", parseInt( window.innerHeight - $("#footerCont").height() - tollerance ) + "px");
  521. $("#footer").css("top", parseInt( window.innerHeight - $("#footer").height() - tollerance + 6) + "px");
  522. }
  523. }
  524. window.addEventListener("load", function() {
  525. setContentPos();
  526. if ($("#cubeList").css("display")==="none") {
  527. setTimeout("setFooterPos()", 9000);
  528. } else {
  529. setTimeout("setFooterPos()", 2000);
  530. }
  531. //Resetting secrets..
  532. //$("#_read_xml_cube1").val("");
  533. //$("#_read_xml_cube2").val("");
  534. //$("#_read_xml_cube3").val("");
  535. //$("#_read_xml_cube4").val("");
  536. //$("#_read_xml_cube5").val("");
  537. //Debug
  538. $("#hcube").val("");
  539. $("#vcube").val("");
  540. $("#hcur").val("");
  541. $("#vcur").val("");
  542. $("#curcube").val("");
  543. //Splash
  544. $("#HCsplash").show();
  545. $("#vplayer").get(0).play();
  546. }, true);
  547. window.addEventListener("load", function() {
  548. // Fisnished the Intro load the app..
  549. //document.getElementById("vplayer").onended=_startApp;
  550. setTimeout("_startApp()", 6000);
  551. // A bit of preload..
  552. });
  553. window.addEventListener("resize", function() {
  554. setTimeout("setContentPos()", 2000);
  555. if ($("#cubeList").css("display")==="none") {
  556. setTimeout("setFooterPos()", 9000);
  557. } else {
  558. setTimeout("setFooterPos()", 2000);
  559. }
  560. });
  561. // -- End Boot up code
  562. </script>
  563. </head>
  564. <body>
  565. <div id="HCsplash" style="padding-top: 40px; text-align:center;color:#d4b0dc;font-family:'Rampart One';display:none;">
  566. <div id="myh1" style="position:relative; top:80px;"><H1>MacSwap</H1></div><br><br>
  567. <video id="vplayer" loop="1">
  568. <source src="../res/macswap.mp4" type="video/mp4">
  569. </video>
  570. <div style="margin-bottom:80px;"><H3>&nbsp;</H3></div><br><br>
  571. </div>
  572. <form id="frmHC" method="POST" action="/" target="_self" enctype="multipart/form-data">
  573. <div class="header" style="margin-top:18px; display:none;">
  574. &nbsp;&nbsp;<a href="http://macswap.5mode.com" target="_self" style="color:#d4b0dc; text-decoration: none;"><img src="/res/1burger_1.png" style="width:25px;">&nbsp;MacSwap</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/MacSwap" style="color:#d4b0dc;"><span style="color:#d4b0dc;">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:my25mb@aol.com" style="color:#d4b0dc;"><span style="color:#d4b0dc;">for</span> feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="tel:+39-331-4029415" style="font-size:13px;background-color:#15c60b;border:2px solid #15c60b;color:#000000;height:27px;text-decoration:none;">&nbsp;&nbsp;get support&nbsp;&nbsp;</a>
  575. </div>
  576. <div id="debugdisplay" style="float:left;position:absolute;top:680px;left:450px;width:255px;display:none;">
  577. <input id="hcube" type="text"><br>
  578. <input id="vcube" type="text"><br>
  579. <input id="hcur" type="text"><br>
  580. <input id="vcur" type="text">
  581. <input id="curcube" type="text">
  582. </div>
  583. <div id="passworddisplay" style="float:left;position:fixed;top:680px;left:50px;width:255px;height:120px;background:black;text-align:left;white-space:nowrap; font-family:'Bungee Hairline'; color:#d4b0dc; font-weight:900;z-index:99999;">
  584. <br>
  585. &nbsp;&nbsp;<input type="password" id="Password" name="Password" placeholder="password" style="font-size:18px; background:transparent; width: 60%; border-radius:3px; font-weight:900;" value="<?php echo($password);?>" autocomplete="off">&nbsp;<input type="submit" value="<?php echo(getResource("Go", $curLocale));?>" style="text-align:left;width:25%;"><br>
  586. &nbsp;&nbsp;<input type="text" id="Salt" placeholder="salt" style="position:relative; top:+5px; font-size:18px; background:transparent; width: 90%; border-radius:3px; font-weight:900;" autocomplete="off"><br>
  587. <div style="text-align:center;">
  588. <a href="#" onclick="showEncodedPassword();" style="position:relative; left:-2px; top:+5px; font-size:18px; font-weight:900; color:#d4b0dc;"><?php echo(getResource("Hash Me", $curLocale));?>!</a>
  589. </div>
  590. <!--<textarea id="log"></textarea>-->
  591. </div>
  592. <div id="cubeList" style="position:absolute; width:100%; min-height: 500px; display:none; color:#d4b0dc; border: 0px solid red;">
  593. &nbsp;
  594. </div>
  595. <map name="ctrls-map">
  596. <area target="" alt="" title="" href="#" onclick="turnLeft();" onmouseover="zoomviewOver()" coords="408,122,120,3" shape="rect">
  597. <area target="" alt="" title="" href="#" onclick="turnUp();" onmouseover="zoomviewOver()" coords="411,272,525,3" shape="rect">
  598. <area target="" alt="" title="" href="#" onclick="turnRight();" onmouseover="zoomviewOver()" coords="407,497,115,383,407,495" shape="rect">
  599. <area target="" alt="" title="" href="#" onclick="turnDown();" onmouseover="zoomviewOver()" coords="176,347,66,411,2,295,0,144,62,142,106,238,105,243,63,144,109,237" shape="poly">
  600. </map>
  601. <div id="cubectrls" style="position:absolute;width:527px;height:497px;display:none;border:0px solid green; z-index:99998; transform: rotate(-63deg);" onmouseover="zoomviewOver()" onmouseout="zoomviewOut()">
  602. <img src="../res/ctrlbg.png" style="width:527px;height:497px;" usemap="#ctrls-map">
  603. </div>
  604. <div id="zoomedview" style="position:absolute;width:396px;height:477px;display:none;border:0px solid red; z-index:99997">
  605. <div id="cubezvname" style="position:relative; top:+30px;font-size:54px;color:#bd006e;width:400px;margin:auto;text-align:center;font-family:'Bungee Hairline';font-weight:900;"></div>
  606. <div id="cubezv" style="float:left;background:url(../res/1cube.png);background-size:cover;width:396px;height:477px;margin:50px;vertical-align:middle;text-align:center;">
  607. </div>
  608. </div>
  609. <div id="cubelinks" style="position:absolute;width:496px;height:7px;display:none;border:0px solid red; z-index:99999">
  610. <span id="face2" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:160px;left:10px;background:transparent;border:0px;font-size:24px;color:#44ff00;width:450px;height:120px;margin:auto;text-align:center;font-family:'Bungee Hairline';font-weight:900;white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  611. <span id="face1" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:+280px;left:-270px;background:transparent;border:0px solid red;font-size:24px;color:#44ff00;width:450px;height:120px;margin:auto;text-align:left;font-family:'Bungee Hairline';font-weight:900;white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  612. <span id="face3" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:+160px;left:+240px;background:transparent;border:0px;font-size:24px;color:#44ff00;width:450px;height:80px;margin:auto;text-align:left;font-family:'Bungee Hairline';font-weight:900;transform: rotate(0deg); white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  613. </div>
  614. <div id="datadetail" style="float:right;background:#0d0d0d;border-left:1px solid white;width:380px;height:900px;display:none;color:#44ff00;" onmouseover="zoomviewOver()">
  615. <span id="detailtitle" style="color:#bd006e;font-size:20px;font-weight:900;"></span><br><br>
  616. <span id="detaildata"></span>
  617. </div>
  618. <!--
  619. <input type="hidden" id="_read_xml_cube1">
  620. <input type="hidden" id="_read_xml_cube2">
  621. <input type="hidden" id="_read_xml_cube3">
  622. <input type="hidden" id="_read_xml_cube4">
  623. <input type="hidden" id="_read_xml_cube5">
  624. -->
  625. </form>
  626. <div class="footer">
  627. <div id="footerCont">&nbsp;</div>
  628. <div id="footer"><span style="background:#0d0d0d;color:#d4b0dc;opacity:1.0;margin-right:10px;">&nbsp;&nbsp;A <a href="http://5mode.com" style="color:#d4b0dc; text-decoration:underline;">5 Mode</a> project and <a href="http://demo.5mode.com" style="color:#d4b0dc; text-decoration:underline;">WYSIWYG</a> system. Some rights reserved.</span></div>
  629. </div>
  630. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html")): ?>
  631. <?php include(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html"); ?>
  632. <?php endif; ?>
  633. </body>
  634. </html>