index.php 8.7 KB

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