home.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of 5 Cube.
  6. *
  7. * 5 Cube 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. * 5 Cube 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 5 Cube. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * 5 Cube 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 5 Cube.
  54. 5 Cube 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. 5 Cube 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 5 Cube. If not, see <https://www.gnu.org/licenses/>.
  64. -->
  65. <title>5 Cube: Every person its prospects.</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.1.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/interaction-code.js" type="text/javascript"></script>
  77. <script src="/js/dragndrop-code.js" type="text/javascript"></script>
  78. <script src="/js/home.js?v=<?php echo(time()); ?>" type="text/javascript" defer></script>
  79. <link href="/css/bootstrap.min.css" type="text/css" rel="stylesheet">
  80. <link href="/css/style.css?v=<?php echo(time()); ?>" type="text/css" rel="stylesheet">
  81. <script>
  82. /*
  83. * Boot up code
  84. */
  85. //var fetchDataIntervalId;
  86. /*
  87. * App starting proc
  88. *
  89. * @returns void
  90. */
  91. function startApp() {
  92. <?php
  93. if ($password!=PHP_STR) {
  94. $cubedisplay="inline";
  95. } else {
  96. $cubedisplay="none";
  97. }
  98. chdir(APP_DATA_PATH);
  99. foreach (glob("*.xml") as $filename) { ?>
  100. i = parseInt("<?php echo(substr(substr($filename, 0, strlen($filename)-4),4));?>");
  101. $("#cubeList").html($("#cubeList").html()+"<div id='cube" + i + "' class='cube' style='display:<?PHP echo($cubedisplay); ?>' order='" + i + "' onclick='selCube(this)' draggable='true' ondragstart='onDragStart(this, event);' onmouseover='onMouseOver();'><div id='cube" + i + "name' class='cubename'>cube#" + i + "</div></div>");
  102. $("#cube" + i + "name").html(businessType + "#" + i);
  103. if (i<10) {
  104. newFormalName = "cube" + "00" + i;
  105. } else if (i<100) {
  106. newFormalName = "cube" + "0" + i;
  107. } else {
  108. newFormalName = "cube" + i;
  109. }
  110. cubes[i-1] = new myCube(businessType + "#" + i, newFormalName, "<?php echo(APP_HOST)?>");
  111. cubes[i-1].start();
  112. totcubes = i;
  113. <?php
  114. }
  115. ?>
  116. $("#cubeList").show();
  117. if (password===1) {
  118. ///$("#cubeList").show();
  119. //$("#datadetail").show();
  120. //$("#debugdisplay").show();
  121. //alert(cubes.length);
  122. //$("#passworddisplay").hide();
  123. }
  124. $("#vplayer").get(0).pause();
  125. $("#HCsplash").css("display","none");
  126. $(".header").show();
  127. //fetchDataIntervalId = setInterval("_fetchData()", 2000);
  128. }
  129. /*
  130. * call to startApp
  131. *
  132. * @returns void
  133. */
  134. function _startApp() {
  135. setTimeout("startApp()", 1000);
  136. }
  137. /*
  138. * Set the elements position
  139. */
  140. function setContentPos() {
  141. $("#cubeList").css("height", parseInt(window.innerHeight-20) + "px");
  142. mytop = parseInt((window.innerHeight - $("#cubectrls").height()) / 2);
  143. mytop = mytop + parseInt($("#cubectrls").height() / 4);
  144. myleft = parseInt((window.innerWidth - $("#cubectrls").width()) / 2);
  145. myleft = myleft + parseInt($("#cubectrls").width() / 5);
  146. $("#cubectrls").css("top", mytop+"px");
  147. $("#cubectrls").css("left", (myleft+40)+"px");
  148. mytop = parseInt((window.innerHeight - $("#zoomedview").height()) / 2);
  149. myleft = parseInt((window.innerWidth - $("#zoomedview").width()) / 2);
  150. $("#zoomedview").css("top", mytop+"px");
  151. $("#zoomedview").css("left", (myleft+40)+"px");
  152. mytop = parseInt((window.innerHeight - $("#cubelinks").height()) / 2);
  153. myleft = parseInt((window.innerWidth - $("#cubelinks").width()) / 2);
  154. $("#cubelinks").css("top", (mytop-170)+"px");
  155. $("#cubelinks").css("left", (myleft+240)+"px");
  156. mytop = parseInt(window.innerHeight - ($("#passworddisplay").height() + 60));
  157. $("#passworddisplay").css("top", mytop+"px");
  158. }
  159. function setFooterPos() {
  160. if (document.getElementById("footerCont")) {
  161. //if ($("#Password").val() === "") {
  162. // tollerance = 48;
  163. // } else {
  164. // tollerance = 15;
  165. //}
  166. tollerance = 22;
  167. $("#footerCont").css("top", parseInt( window.innerHeight - $("#footerCont").height() - tollerance ) + "px");
  168. $("#footer").css("top", parseInt( window.innerHeight - $("#footer").height() - tollerance + 6) + "px");
  169. }
  170. }
  171. window.addEventListener("load", function() {
  172. setContentPos();
  173. if ($("#cubeList").css("display")==="none") {
  174. setTimeout("setFooterPos()", 9000);
  175. } else {
  176. setTimeout("setFooterPos()", 2000);
  177. }
  178. //Resetting secrets..
  179. //$("#_read_xml_cube1").val("");
  180. //$("#_read_xml_cube2").val("");
  181. //$("#_read_xml_cube3").val("");
  182. //$("#_read_xml_cube4").val("");
  183. //$("#_read_xml_cube5").val("");
  184. //Debug
  185. $("#hcube").val("");
  186. $("#vcube").val("");
  187. $("#hcur").val("");
  188. $("#vcur").val("");
  189. $("#curcube").val("");
  190. //Splash
  191. $("#HCsplash").show();
  192. $("#vplayer").get(0).play();
  193. }, true);
  194. window.addEventListener("load", function() {
  195. // Fisnished the Intro load the app..
  196. document.getElementById("vplayer").onended=_startApp;
  197. // A bit of preload..
  198. bgimg = new Image();
  199. bgimg.src = "../res/bg.jpg";
  200. });
  201. window.addEventListener("resize", function() {
  202. setTimeout("setContentPos()", 2000);
  203. if ($("#cubeList").css("display")==="none") {
  204. setTimeout("setFooterPos()", 9000);
  205. } else {
  206. setTimeout("setFooterPos()", 2000);
  207. }
  208. });
  209. // -- End Boot up code
  210. </script>
  211. </head>
  212. <body>
  213. <div id="HCsplash" style="padding-top: 40px; text-align:center;color:#d4b0dc;font-family:'Rampart One';display:none;">
  214. <div id="myh1" style="position:relative; top:80px;"><H1>5 CUBE</H1></div><br><br>
  215. <video id="vplayer">
  216. <source src="../res/cube.mp4" type="video/mp4">
  217. </video>
  218. </div>
  219. <form id="frmHC" method="POST" action="/" target="_self" enctype="multipart/form-data">
  220. <div class="header" style="margin-top:18px; display:none;">
  221. &nbsp;&nbsp;<a href="http://5cube.org" target="_self" style="color:#d4b0dc; text-decoration: none;"><img src="/res/1cube.png" style="width:25px;">&nbsp;5 Cube</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/5cube" style="color:#d4b0dc;"><span style="color:#d4b0dc;">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:info@5cube.org" 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>
  222. </div>
  223. <div id="debugdisplay" style="float:left;position:absolute;top:680px;left:50px;width:255px;display:none;">
  224. <input id="hcube" type="text"><br>
  225. <input id="vcube" type="text"><br>
  226. <input id="hcur" type="text"><br>
  227. <input id="vcur" type="text">
  228. <input id="curcube" type="text">
  229. </div>
  230. <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;">
  231. <br>
  232. &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>
  233. &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>
  234. <div style="text-align:center;">
  235. <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>
  236. </div>
  237. <!--<textarea id="log"></textarea>-->
  238. </div>
  239. <div id="cubeList" style="position:absolute; width:100%; min-height: 500px; display:none; color:#d4b0dc; border: 0px solid red;" ondragover="onDragOver(event);" ondrop="onDrop(event);">
  240. &nbsp;
  241. </div>
  242. <map name="ctrls-map">
  243. <area target="" alt="" title="" href="#" onclick="turnLeft();" onmouseover="zoomviewOver()" coords="408,122,120,3" shape="rect">
  244. <area target="" alt="" title="" href="#" onclick="turnUp();" onmouseover="zoomviewOver()" coords="411,272,525,3" shape="rect">
  245. <area target="" alt="" title="" href="#" onclick="turnRight();" onmouseover="zoomviewOver()" coords="407,497,115,383,407,495" shape="rect">
  246. <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">
  247. </map>
  248. <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()">
  249. <img src="../res/ctrlbg.png" style="width:527px;height:497px;" usemap="#ctrls-map">
  250. </div>
  251. <div id="zoomedview" style="position:absolute;width:396px;height:477px;display:none;border:0px solid red; z-index:99997">
  252. <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>
  253. <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;">
  254. </div>
  255. </div>
  256. <div id="cubelinks" style="position:absolute;width:496px;height:7px;display:none;border:0px solid red; z-index:99999">
  257. <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>
  258. <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>
  259. <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>
  260. </div>
  261. <div id="datadetail" style="float:right;background:#0d0d0d;border-left:1px solid white;width:380px;height:900px;display:none;color:#44ff00;" onmouseover="zoomviewOver()">
  262. <span id="detailtitle" style="color:#bd006e;font-size:20px;font-weight:900;"></span><br><br>
  263. <span id="detaildata"></span>
  264. </div>
  265. <!--
  266. <input type="hidden" id="_read_xml_cube1">
  267. <input type="hidden" id="_read_xml_cube2">
  268. <input type="hidden" id="_read_xml_cube3">
  269. <input type="hidden" id="_read_xml_cube4">
  270. <input type="hidden" id="_read_xml_cube5">
  271. -->
  272. </form>
  273. <div class="footer">
  274. <div id="footerCont">&nbsp;</div>
  275. <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>
  276. </div>
  277. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html")): ?>
  278. <?php include(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html"); ?>
  279. <?php endif; ?>
  280. </body>
  281. </html>