index.php 13 KB

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