home.php 14 KB

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