index.php 9.2 KB

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