index.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <?php
  2. try {
  3. $config = parse_ini_file('settings.ini.php', true);
  4. } catch(Exception $e) {
  5. die('<b>Unable to read config.ini.php. Did you rename it from config.ini.php-example?</b><br><br>Error message: ' .$e->getMessage());
  6. }
  7. foreach ($config as $keyname => $section) {
  8. if(!empty($section["useicons"]) && ($section["useicons"]=="true")){
  9. $icons = "active";
  10. $guesticons = "<span><i class=\"fa fa-toggle-on\"></i></span>";
  11. $adminicons = "<span><i class=\"fa fa-toggle-on\"></i></span>";
  12. $refreshicons = "<span><i class=\"fa fa-refresh\"></i></span>";
  13. }
  14. if(!empty($section["usemargins"]) && ($section["usemargins"]=="true")){
  15. $margins = "active";
  16. }
  17. if($icons == "active"){
  18. $px = "62px";//80
  19. $pxmobile = "-30px";
  20. }else{
  21. $px = "34px";//50
  22. $pxmobile = "0px";
  23. }
  24. if($margins == "active"){
  25. $marginpx = "10px";
  26. $marginborderpx = "1px";
  27. }else{
  28. $marginpx = "0px";
  29. $marginborderpx = "0px";
  30. }
  31. //Guest
  32. if($_COOKIE["logged"] !== $cookiepass && !empty($section["enabled"]) && ($section["enabled"]=="true") && !empty($section["guest"]) && ($section["guest"]=="true") ) {
  33. if($icons == "active"){ $listicons = "<span><i class=\"fa ". $section["icon"] ."\"></i></span>"; }
  34. $loadedlist .= "<li id=\"". $section["url"] ."x\"><a>" . $keyname . " " . $listicons ."</a></li>\n";
  35. $loadedurls .= "<div class=\"z-nopadding\" data-content-url=\"". $section["url"] ."\" data-content-type=\"iframe\"></div>\n";
  36. }
  37. //Full Access
  38. if($_COOKIE["logged"] == $cookiepass && !empty($section["enabled"]) && ($section["enabled"]=="true")) {
  39. if($icons == "active"){ $listicons = "<span><i class=\"fa ". $section["icon"] ."\"></i></span>"; }
  40. $loadedlist .= "<li id=\"". $section["url"] ."x\"><a>" . $keyname . " " . $listicons ."</a></li>\n";
  41. $loadedurls .= "<div class=\"z-nopadding\" data-content-url=\"". $section["url"] ."\" data-content-type=\"iframe\"></div>\n";
  42. }
  43. //General
  44. if (empty($title)) $title = 'Manage My HTPC';
  45. if(($keyname == "general")) { $title = $section["title"]; $tabcoloractive = $section["tabcoloractive"]; $fontcoloractive = $section["fontcoloractive"]; $tabcolor = $section["tabcolor"]; $fontcolor = $section["fontcolor"]; $tabshadowactive = $section["tabshadowactive"]; $tabshadow = $section["tabshadow"]; $cookiepass = $section["password"];}
  46. }
  47. if($_COOKIE["logged"] !== $cookiepass){
  48. $lasttablist .= "<li><a>Login" . $guesticons . "</a></li>\n";
  49. $lasttaburl .= "<div class=\"z-nopadding\" data-content-url=\"setup.php\" data-content-type=\"iframe\"></div>\n";
  50. }
  51. if($_COOKIE["logged"] == $cookiepass){
  52. $lasttablist .= "<li><a>Settings" . $adminicons . "</a></li>\n";
  53. $lasttaburl .= "<div class=\"z-nopadding\" data-content-url=\"setup.php\" data-content-type=\"iframe\"></div>\n";
  54. }
  55. if(!file_exists('settings.ini.php')){
  56. $lasttablist = "<li><a>Setup<span><i class=\"fa fa-spinner\"></i></span></a></li>\n";
  57. $lasttaburl = "<div class=\"z-nopadding\" data-content-url=\"setup.php\" data-content-type=\"iframe\"></div>\n";
  58. }
  59. ?>
  60. <!doctype html>
  61. <html class="z-white z-width1200">
  62. <head>
  63. <title><?=$title;?></title>
  64. <meta charset="utf-8">
  65. <meta name="viewport" content="width = device-width, initial-scale = 1.0" />
  66. <link href="css/min.css" rel="stylesheet" />
  67. <link href="css/tabs.min.css" rel="stylesheet" />
  68. <script src="js/jquery.min.js"></script>
  69. <script src="js/tabs.min.js"></script>
  70. <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'>
  71. <style>
  72. .z-tabs.white.z-bordered > ul > li.z-active > a {color: <?=$fontcoloractive;?>; background-color: <?=$tabcoloractive;?>; text-shadow: 0 1px <?=$tabshadowactive;?>;}
  73. </style>
  74. <style>
  75. .z-tabs.horizontal.responsive > ul > li > a, .z-tabs.horizontal.top-compact > ul > li > a, .z-tabs.horizontal.bottom-compact > ul > li > a, .z-tabs.horizontal.top-center > ul > li > a, .z-tabs.horizontal.bottom-center > ul > li > a {
  76. color: <?=$fontcolor;?>; background-color: <?=$tabcolor;?>; text-shadow: 0 1px <?=$tabshadow;?>;
  77. }
  78. </style>
  79. <style>.z-tabs.mobile {
  80. position: absolute;
  81. top: 0;
  82. bottom: 0;
  83. left: 0;
  84. right: 0;
  85. overflow: overlay;
  86. }</style>
  87. <script>
  88. $(document).ready(function(){
  89. $("li").dblclick(function(){
  90. var frame = this.id.slice(0, -1);
  91. var f = document.getElementById(frame);
  92. f.src = f.src;
  93. });
  94. });
  95. </script>
  96. </head>
  97. <body style="position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: white;
  98. -webkit-background-size: cover;
  99. -moz-background-size: cover;
  100. -o-background-size: cover;
  101. background-size: cover;">
  102. <span>&nbsp;</span>
  103. <div id="page" style="margin: <?=$marginpx;?>; position: absolute;">
  104. <!--Tabs Start-->
  105. <div id="tabbed-nav">
  106. <ul>
  107. <?=$loadedlist;?>
  108. <?=$lasttablist;?>
  109. </ul>
  110. <!-- Content container -->
  111. <style> .z-container { position: fixed; top: 50px; right: 0px; bottom: 0px; left: 0px; margin: <?=$marginpx;?>; } </style>
  112. <style> .z-tabs .z-container{ margin: <?=$marginpx;?>; border-width: <?=$marginborderpx;?>; } </style>
  113. <style> .z-tabs.mobile.top > .z-container {margin-top: <?=$pxmobile;?>;} </style>
  114. <style> .z-video{position: absolute; height: 100%; width: 100%;-webkit-overflow-scrolling: touch; overflow: auto;}</style>
  115. <!--<style> .z-content-inner{overflow: overlay;}</style>
  116. <style> .z-nopadding.z-content{overflow-x: hidden;overflow-y: auto;}</style>-->
  117. <div style="top: <?=$px;?>;overflow: auto;">
  118. <?=$loadedurls;?>
  119. <?=$lasttaburl;?>
  120. </div>
  121. </div>
  122. <!--Tabs End-->
  123. </div>
  124. <script>
  125. jQuery(document).ready(function ($) {
  126. /* jQuery activation and setting options for the tabs*/
  127. $("#tabbed-nav").zozoTabs({
  128. defaultTab: "tab1",
  129. multiline: true,
  130. theme: "white",
  131. position: "top-compact",
  132. size: "mini",
  133. animation: {
  134. easing: "easeInOutExpo",
  135. duration: 450,
  136. effects: "slideRight"
  137. }
  138. });
  139. });
  140. </script>
  141. <script>
  142. jQuery('iframe','#container').attr('src',url);
  143. </script>
  144. </body>
  145. </html>