index.php 8.6 KB

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