index.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <?php
  2. include_once 'auth.php';
  3. ?>
  4. <html>
  5. <!DOCTYPE HTML>
  6. <head>
  7. <meta name="viewport" content="width=device-width, initial-scale=0.7, shrink-to-fit=no">
  8. <title>ArOZ Onlineβ</title>
  9. <link rel="stylesheet" href="script/tocas/tocas.css">
  10. <script src="script/tocas/tocas.js"></script>
  11. <script src="script/jquery.min.js"></script>
  12. </head>
  13. <?php
  14. include_once("SystemAOB/functions/personalization/configIO.php");
  15. $indexConfig = getConfig("index",true);
  16. //Folders that exclude in the function arranging process.
  17. $function_exclude = ["Help","img","script","msb"];
  18. ?>
  19. <body>
  20. <style>
  21. .mobilemenulist{
  22. width:100%;
  23. padding-left:0px !important;
  24. padding-right:0px !important;
  25. }
  26. .mobileTsContainer{
  27. padding-left:0px !important;
  28. padding-right:0px !important;
  29. }
  30. .mobileTsClass{
  31. margin-top:10px !important;
  32. margin-bottom:10px !important;
  33. border: 1px solid transparent;
  34. }
  35. .h4mobile{
  36. font-size:12px !important;
  37. text-align: center !important;
  38. text-align-last: center !important;
  39. margin-left: auto !important;
  40. padding-left: auto !important;
  41. }
  42. </style>
  43. <nav id="topbar" class="ts attached inverted borderless large menu">
  44. <div class="ts narrow container">
  45. <a href="index.php" class="item">ArOZ Online β</a>
  46. </div>
  47. </nav>
  48. <!-- Main Banner -->
  49. <div id="mainarea" class="ts center aligned attached very padded segment">
  50. <div class="ts narrow container">
  51. <br>
  52. <div class="ts massive header">
  53. <img class="ts fluid image" src="<?php echo $indexConfig["index-image"][3]; ?>">
  54. <div class="sub header">
  55. <?php echo $indexConfig["index-tag"][3]; ?>
  56. <div class="ts outlined message">
  57. <div id="identity">You are now identify as <i class="loading spinner icon"></i></div>
  58. </div>
  59. </div>
  60. </div>
  61. <br>
  62. <div class="ts buttons">
  63. <button id="fbBtn" class="ts primary button" onClick="toggleFunctionBar();"><i class="tasks icon"></i>Activate Virtual Desktop</button>
  64. <button id="extDt" class="nvdio ts info button" onClick="extFunctionBar();"><i class="tasks icon"></i>Extend Desktop</button>
  65. <button class="ts button" OnClick="window.location.href='logout.php';"><i class="log out icon"></i>Logout</button>
  66. </div>
  67. <br>
  68. <br>
  69. </div>
  70. </div>
  71. <!-- Main Banner -->
  72. <!-- Mobile Banner-->
  73. <div id="mobilebanner" class="ts fluid top attached small buttons" style="display:none;">
  74. <div id="vpdm" class="ts primary button"><i class="mobile icon"></i>Your IP: <?php echo $_SERVER['REMOTE_ADDR'];?></div>
  75. <button class="ts button" OnClick="window.location.href='logout.php';"><i class="log out icon"></i>Logout</button>
  76. </div>
  77. </div>
  78. <!-- Main Area -->
  79. <div class="ts center aligned attached vertically very padded secondary segment">
  80. <div id="menulistcontainer" class="ts container" align="center">
  81. <!-- Conainer for scanning -->
  82. <div id="menulist" class="ts four flatted cards">
  83. <?php
  84. //Template for one scan function unit
  85. $scantemplate = '<div class="ts card">
  86. <div class="image">
  87. <a href="%FUNCTION_PATH%"><img src="%FUNCTION_ICON_PATH%"></a>
  88. </div>
  89. <div class="left aligned content">
  90. <h4>%FOLDERTITLE%</h4>
  91. <div class="description">%DESCRIPTION_TEXT%<br><a href="%FUNCTION_PATH%">Launch</a></div>
  92. </div>
  93. </div>';
  94. $directories = glob("./" . '/*' , GLOB_ONLYDIR);
  95. foreach($directories as $result) {
  96. //echo str_replace(".//","",$result), '<br>';
  97. $foldername = str_replace(".//","",$result);
  98. if (in_array($foldername,$function_exclude) != True){
  99. //If this folder is not excluded in the function list
  100. $thisbox = str_replace("%FUNCTION_PATH%",$foldername . "/",$scantemplate);
  101. if (file_exists($foldername . "/img/function_icon.png") !== False){
  102. $thisbox = str_replace("%FUNCTION_ICON_PATH%",$foldername . "/img/function_icon.png",$thisbox);
  103. }else{
  104. $thisbox = str_replace("%FUNCTION_ICON_PATH%","img/no_icon.png",$thisbox);
  105. }
  106. $thisbox = str_replace("%FOLDERTITLE%",$foldername,$thisbox);
  107. if (file_exists($foldername . "/description.txt")){
  108. $descripton = file_get_contents($foldername .'/description.txt', FILE_USE_INCLUDE_PATH);
  109. $thisbox = str_replace("%DESCRIPTION_TEXT%",$descripton,$thisbox);
  110. }else{
  111. $lazytext = "It seems the developer don't even know what is this for.";
  112. $thisbox = str_replace("%DESCRIPTION_TEXT%",$lazytext,$thisbox);
  113. }
  114. echo $thisbox;
  115. }
  116. }
  117. $DesktopExists = "false";
  118. if (file_exists("Desktop/index.php")){
  119. $DesktopExists = "true";
  120. }
  121. ?>
  122. <div class="ts card">
  123. <div class="image">
  124. <a href="Help/"><img src="Help/img/function_icon.png"></a>
  125. </div>
  126. <div class="left aligned content">
  127. <h4>Help</h4>
  128. <div class="description">Click here if you need help on how to use this system or you just want to know more.<br><a href="Help/">Launch</a></div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <!-- / End of Main Area -->
  135. <!-- Foot -->
  136. <div class="ts bottom attached segment">
  137. <div class="ts narrow container">
  138. <br>
  139. <div class="ts large header">
  140. <?php echo $indexConfig["bottomTag"][3]; ?>
  141. <div class="smaller sub header">
  142. <?php echo $indexConfig["licenseTerm"][3]; ?>
  143. </div>
  144. </div>
  145. <br>
  146. </div>
  147. </div>
  148. <!-- / Foot -->
  149. <br><br>
  150. <script>
  151. var DesktopExists = "<?php echo $DesktopExists;?>";
  152. var DirectDesktopMode = <?php echo $indexConfig["directDesktop"][3]; ?>;
  153. var desktopSettings;
  154. $.get("SystemAOB/functions/personalization/desktopConfig.php",function(data){
  155. if (typeof(data) === "object"){
  156. desktopSettings = data;
  157. //console.log(desktopSettings);
  158. if (desktopSettings.systemExtendedDesktop == "disabled"){
  159. $("#extDt").addClass("disabled");
  160. }
  161. }
  162. });
  163. function extFunctionBar(){
  164. if (desktopSettings != undefined){
  165. //Use the defined external desktop settings
  166. var extDesktopPath = desktopSettings.systemExtendedDesktop + "/" + desktopSettings.systemExtentedPath;
  167. }
  168. }
  169. function toggleFunctionBar(){
  170. if (parent.isFunctionBar == true){
  171. window.top.location = "index.php";
  172. }else{
  173. if (desktopSettings != undefined && desktopSettings.systemDesktopModule != ""){
  174. //Use the informatin get from the config
  175. window.location.href = "function_bar.php#" + desktopSettings.systemDesktopModule + "/" + desktopSettings.systemStartingPath;
  176. }else{
  177. if (DesktopExists){
  178. //Desktop exists and no defined Desktop. Use default instead
  179. window.location.href = "function_bar.php#Desktop";
  180. }else{
  181. //Desktop not exists. Use SystemAOB main page as Desktop environment
  182. window.location.href = "function_bar.php#SystemAOB";
  183. }
  184. }
  185. }
  186. }
  187. /*
  188. //Deprecated background worker function
  189. function bgworker(){
  190. if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
  191. // is mobile..
  192. window.open('index.php', '_blank');
  193. window.open('backgroundWorker.php', '_self');
  194. }else{
  195. //Desktop
  196. window.open ('backgroundWorker.php','_blank',false)
  197. }
  198. }
  199. */
  200. if (localStorage.ArOZusername == null || localStorage.ArOZusername == ""){
  201. //No User Name
  202. $('#identity').html('<i class="user icon"></i>You have not identified yourself.');
  203. }else{
  204. $('#identity').html('<i class="user icon"></i>Welcome back ' + localStorage.ArOZusername + ".");
  205. }
  206. $(document).ready(function(){
  207. //Check if function bar exists or not
  208. if (parent.isFunctionBar == true){
  209. //The current page is viewed in Function Bar Mode
  210. $('#fbBtn').html('<i class="tasks icon"></i>Disable Virtual Desktop');
  211. $(".nvdio").hide();
  212. }else{
  213. //The current page is not viewed in Function Bar Mode
  214. if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
  215. //This is a mobile devices
  216. //Not support function bar system
  217. $('#fbBtn').attr('class','ts disabled button');
  218. $('#fbBtn').html('<i class="tasks icon"></i>Function Bar (Desktop Only)');
  219. //Hide and shrink all non-important information on index
  220. $('.description').each(function(){
  221. $(this).hide();
  222. });
  223. $('h4').each(function(){
  224. $(this).addClass("h4mobile");
  225. });
  226. //Adjusting the App icon width to fit better on the mobile interface
  227. $("#menulist").addClass("mobilemenulist");
  228. $("#menulistcontainer").addClass("mobileTsContainer");
  229. $("#menulistcontainer").parent().addClass("mobileTsContainer");
  230. $("#mainarea").css("padding-left","0px");
  231. $("#mainarea").css("padding-right","0px");
  232. //Make each icon looks better
  233. $(".ts.card").each(function(){
  234. $(this).addClass("mobileTsClass");
  235. });
  236. $(".left.aligned.content").each(function(){
  237. $(this).css("height","40px");
  238. $(this).css("padding-top","5px")
  239. });
  240. $("#mainarea").hide();
  241. $("#topbar").removeClass("large").addClass("mini");
  242. $("#mobilebanner").show();
  243. }else if (DirectDesktopMode){
  244. //This is not mobile, not in fw mode and direct desktop mode is enabled
  245. toggleFunctionBar();
  246. }
  247. }
  248. });
  249. </script>
  250. </body>
  251. </html>