index.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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. .extraRightPadding{
  43. margin-right:10px !important;
  44. }
  45. .selectable{
  46. cursor:pointer;
  47. }
  48. </style>
  49. <nav id="topbar" class="ts attached inverted borderless large menu">
  50. <div class="ts narrow container">
  51. <a href="index.php" class="item localtext" localtext="index/menu/title">ArOZ Online β</a>
  52. </div>
  53. <div id="langbtn" style="position:absolute;top:12px;right:22px;color:white;cursor:pointer;"><i class="globe icon"></i> Language</div>
  54. </nav>
  55. <!-- Main Banner -->
  56. <div id="mainarea" class="ts center aligned attached very padded segment">
  57. <div class="ts narrow container">
  58. <br>
  59. <div class="ts massive header">
  60. <img class="ts fluid image" src="<?php echo $indexConfig["index-image"][3]; ?>">
  61. <div class="sub header">
  62. <?php echo $indexConfig["index-tag"][3]; ?>
  63. <div class="ts outlined message">
  64. <div id="identity"><span class="localtext" localtext="index/banner/identify">You are now identify as</span> <i class="loading spinner icon"></i></div>
  65. </div>
  66. </div>
  67. </div>
  68. <br>
  69. <div class="ts buttons">
  70. <button id="fbBtn" class="ts primary button" onClick="toggleFunctionBar();"><i class="tasks icon"></i><span class="localtext" localtext="index/button/desktop">Activate Virtual Desktop</span></button>
  71. <button id="extDt" class="nvdio ts info button" onClick="extFunctionBar();"><i class="tasks icon"></i><span class="localtext" localtext="index/button/extdesktop">Extend Desktop</span></button>
  72. <button class="ts button" OnClick="window.location.href='logout.php';"><i class="log out icon"></i><span class="localtext" localtext="index/button/logout">Logout</span></button>
  73. </div>
  74. <br>
  75. <br>
  76. </div>
  77. </div>
  78. <!-- Main Banner -->
  79. <!-- Mobile Banner-->
  80. <div id="mobilebanner" class="ts fluid top attached small buttons" style="display:none;">
  81. <div id="vpdm" class="ts primary button"><i class="mobile icon"></i><span class="localtext" localtext="index/mobile/yourip">Your IP: </span><?php echo $_SERVER['REMOTE_ADDR'];?></div>
  82. <button class="ts button" OnClick="window.location.href='logout.php';"><i class="log out icon"></i><span class="localtext" localtext="index/mobile/logout">Logout</span></button>
  83. </div>
  84. </div>
  85. <!-- Main Area -->
  86. <div class="ts center aligned attached vertically very padded secondary segment">
  87. <div id="menulistcontainer" class="ts container" align="center">
  88. <!-- Conainer for scanning -->
  89. <div id="menulist" class="ts four flatted cards">
  90. <?php
  91. //Template for one scan function unit
  92. $scantemplate = '<div class="ts card">
  93. <div class="image">
  94. <a href="%FUNCTION_PATH%"><img src="%FUNCTION_ICON_PATH%"></a>
  95. </div>
  96. <div class="left aligned content">
  97. <h4>%FOLDERTITLE%</h4>
  98. <div class="description">%DESCRIPTION_TEXT%<br><a href="%FUNCTION_PATH%" class="localtext" localtext="index/launcher/launch">Launch</a></div>
  99. </div>
  100. </div>';
  101. $directories = glob("./" . '/*' , GLOB_ONLYDIR);
  102. foreach($directories as $result) {
  103. //echo str_replace(".//","",$result), '<br>';
  104. $foldername = str_replace(".//","",$result);
  105. if (in_array($foldername,$function_exclude) != True){
  106. //If this folder is not excluded in the function list
  107. $thisbox = str_replace("%FUNCTION_PATH%",$foldername . "/",$scantemplate);
  108. if (file_exists($foldername . "/img/function_icon.png") !== False){
  109. $thisbox = str_replace("%FUNCTION_ICON_PATH%",$foldername . "/img/function_icon.png",$thisbox);
  110. }else{
  111. $thisbox = str_replace("%FUNCTION_ICON_PATH%","img/no_icon.png",$thisbox);
  112. }
  113. $thisbox = str_replace("%FOLDERTITLE%",$foldername,$thisbox);
  114. if (file_exists($foldername . "/description.txt")){
  115. $descripton = file_get_contents($foldername .'/description.txt', FILE_USE_INCLUDE_PATH);
  116. $thisbox = str_replace("%DESCRIPTION_TEXT%",$descripton,$thisbox);
  117. }else{
  118. $lazytext = "It seems the developer don't even know what is this for.";
  119. $thisbox = str_replace("%DESCRIPTION_TEXT%",$lazytext,$thisbox);
  120. }
  121. echo $thisbox;
  122. }
  123. }
  124. $DesktopExists = "false";
  125. if (file_exists("Desktop/index.php")){
  126. $DesktopExists = "true";
  127. }
  128. ?>
  129. <div class="ts card">
  130. <div class="image">
  131. <a href="Help/"><img src="Help/img/function_icon.png"></a>
  132. </div>
  133. <div class="left aligned content">
  134. <h4>Help</h4>
  135. <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>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <!-- / End of Main Area -->
  142. <!-- Lanuage Selection Menu -->
  143. <div id="langSelection" style="position:absolute;top:45.7px;right:0px;display:none;background-color:#f7f7f7;">
  144. <div class="ts segmented items">
  145. <div class="selectable language item" lang="">
  146. <img class="ts mini middle aligned image extraRightPadding" src="SystemAOB/system/lang/flags/disable.png"> Disable Translation
  147. </div>
  148. <?php
  149. $langs = glob("SystemAOB/system/lang/*.json");
  150. foreach ($langs as $lang){
  151. $flags = 'SystemAOB/system/lang/flags/' . basename($lang,".json") . ".png";
  152. if (!file_exists($flags)){
  153. $flags = 'SystemAOB/system/lang/flags/unknown.png';
  154. }
  155. echo '<div class="selectable language item" lang="' . basename($lang,".json") . '">
  156. <img class="ts mini middle aligned image extraRightPadding" src="' . $flags . '">' . basename($lang,".json") . '
  157. </div>';
  158. }
  159. ?>
  160. </div>
  161. </div>
  162. <!-- Foot -->
  163. <div class="ts bottom attached segment">
  164. <div class="ts narrow container">
  165. <br>
  166. <div class="ts large header">
  167. <?php echo $indexConfig["bottomTag"][3]; ?>
  168. <div class="smaller sub header">
  169. <?php echo $indexConfig["licenseTerm"][3]; ?>
  170. </div>
  171. </div>
  172. <br>
  173. </div>
  174. </div>
  175. <!-- / Foot -->
  176. <br><br>
  177. <script>
  178. var DesktopExists = "<?php echo $DesktopExists;?>";
  179. var DirectDesktopMode = <?php echo $indexConfig["directDesktop"][3]; ?>;
  180. var desktopSettings;
  181. var lang = localStorage.getItem("aosystem.localize");
  182. var translationkeys;
  183. //Handle localization translation and its settings
  184. if (lang === undefined || lang == "" || lang === null){
  185. if (localStorage.ArOZusername == null || localStorage.ArOZusername == ""){
  186. //No User Name
  187. var message = localize("index/identify/notfound") || "You have not identified yourself.";
  188. $('#identity').html('<i class="user icon"></i>' + message);
  189. }else{
  190. var message = localize("index/identify/welcomeback") || "Welcome back";
  191. $('#identity').html('<i class="user icon"></i>' + message + ' ' + localStorage.ArOZusername + ".");
  192. }
  193. }
  194. $(".selectable").hover(
  195. function(){ $(this).addClass('active') },
  196. function(){ $(this).removeClass('active') }
  197. )
  198. $("#langbtn").on("click",function(e){
  199. $("#langSelection").slideToggle('fast');
  200. });
  201. $(".language").on("click",function(){
  202. $("#langSelection").slideUp('fast');
  203. var targetlang = $(this).attr("lang");
  204. localStorage.setItem("aosystem.localize",targetlang);
  205. if (targetlang != ""){
  206. alert("Language changed to " + targetlang);
  207. }else{
  208. alert("Translation Disabled.");
  209. }
  210. window.location.reload();
  211. });
  212. $.get("SystemAOB/system/lang/" + lang + ".json",function(data){
  213. translationkeys = data;
  214. console.log("Localization loaded. Lang: " + lang);
  215. //Update the on-screen objects with localized translationkeys
  216. $(".localtext").each(function(){
  217. if (this.hasAttribute("localtext")){
  218. var thisKey = $(this).attr("localtext");
  219. var localtext = translationkeys.keys[thisKey];
  220. $(this).text(localtext);
  221. }
  222. });
  223. if (localStorage.ArOZusername == null || localStorage.ArOZusername == ""){
  224. //No User Name
  225. var message = localize("index/identify/notfound") || "You have not identified yourself.";
  226. $('#identity').html('<i class="user icon"></i>' + message);
  227. }else{
  228. var message = localize("index/identify/welcomeback") || "Welcome back";
  229. $('#identity').html('<i class="user icon"></i>' + message + ' ' + localStorage.ArOZusername + ".");
  230. }
  231. });
  232. function localize(key){
  233. if (translationkeys === undefined){
  234. return null;
  235. }
  236. return translationkeys.keys[key];
  237. }
  238. $.get("SystemAOB/functions/personalization/desktopConfig.php",function(data){
  239. if (typeof(data) === "object"){
  240. desktopSettings = data;
  241. //console.log(desktopSettings);
  242. if (desktopSettings.systemExtendedDesktop == "disabled"){
  243. $("#extDt").addClass("disabled");
  244. }
  245. }
  246. });
  247. function extFunctionBar(){
  248. if (desktopSettings != undefined){
  249. //Use the defined external desktop settings
  250. var extDesktopPath = desktopSettings.systemExtendedDesktop + "/" + desktopSettings.systemExtentedPath;
  251. }
  252. }
  253. function toggleFunctionBar(){
  254. if (parent.isFunctionBar == true){
  255. window.top.location = "index.php";
  256. }else{
  257. if (desktopSettings != undefined && desktopSettings.systemDesktopModule != ""){
  258. //Use the informatin get from the config
  259. window.location.href = "function_bar.php#" + desktopSettings.systemDesktopModule + "/" + desktopSettings.systemStartingPath;
  260. }else{
  261. if (DesktopExists){
  262. //Desktop exists and no defined Desktop. Use default instead
  263. window.location.href = "function_bar.php#Desktop/";
  264. }else{
  265. //Desktop not exists. Use SystemAOB main page as Desktop environment
  266. window.location.href = "function_bar.php#SystemAOB/";
  267. }
  268. }
  269. }
  270. }
  271. /*
  272. //Deprecated background worker function
  273. function bgworker(){
  274. if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
  275. // is mobile..
  276. window.open('index.php', '_blank');
  277. window.open('backgroundWorker.php', '_self');
  278. }else{
  279. //Desktop
  280. window.open ('backgroundWorker.php','_blank',false)
  281. }
  282. }
  283. */
  284. $(document).ready(function(){
  285. //Check if function bar exists or not
  286. if (parent.isFunctionBar == true){
  287. //The current page is viewed in Function Bar Mode
  288. $('#fbBtn').html('<i class="tasks icon"></i>Disable Virtual Desktop');
  289. $(".nvdio").hide();
  290. }else{
  291. //The current page is not viewed in Function Bar Mode
  292. if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
  293. //This is a mobile devices
  294. //Not support function bar system
  295. $('#fbBtn').attr('class','ts disabled button');
  296. $('#fbBtn').html('<i class="tasks icon"></i>Function Bar (Desktop Only)');
  297. //Hide and shrink all non-important information on index
  298. $('.description').each(function(){
  299. $(this).hide();
  300. });
  301. $('h4').each(function(){
  302. $(this).addClass("h4mobile");
  303. });
  304. //Adjusting the App icon width to fit better on the mobile interface
  305. $("#menulist").addClass("mobilemenulist");
  306. $("#menulistcontainer").addClass("mobileTsContainer");
  307. $("#menulistcontainer").parent().addClass("mobileTsContainer");
  308. $("#mainarea").css("padding-left","0px");
  309. $("#mainarea").css("padding-right","0px");
  310. //Make each icon looks better
  311. $(".ts.card").each(function(){
  312. $(this).addClass("mobileTsClass");
  313. });
  314. $(".left.aligned.content").each(function(){
  315. $(this).css("height","40px");
  316. $(this).css("padding-top","5px")
  317. });
  318. $("#mainarea").hide();
  319. $("#topbar").removeClass("large").addClass("mini");
  320. $("#mobilebanner").show();
  321. $("#langbtn").css("top","5px");
  322. $("#langSelection").css("top",$("#topbar").height());
  323. }else if (DirectDesktopMode){
  324. //This is not mobile, not in fw mode and direct desktop mode is enabled
  325. toggleFunctionBar();
  326. }
  327. }
  328. });
  329. </script>
  330. </body>
  331. </html>