index.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. if($icons == "active"){ $px = "80px"; }else{ $px = "50px";}
  11. $guesticons = "<span><i class=\"fa fa-toggle-on\"></i></span>";
  12. $adminicons = "<span><i class=\"fa fa-toggle-on\"></i></span>";
  13. $refreshicons = "<span><i class=\"fa fa-refresh\"></i></span>";
  14. }
  15. //Guest
  16. if($_COOKIE["logged"] !== $cookiepass && !empty($section["enabled"]) && ($section["enabled"]=="true") && !empty($section["guest"]) && ($section["guest"]=="true") ) {
  17. if($icons == "active"){ $listicons = "<span><i class=\"fa ". $section["icon"] ."\"></i></span>"; }
  18. $loadedlist .= "<li id=\"". $section["url"] ."x\"><a>" . $keyname . " " . $listicons ."</a></li>\n";
  19. $loadedurls .= "<div class=\"z-nopadding\" data-content-url=\"". $section["url"] ."\" data-content-type=\"iframe\"></div>\n";
  20. }
  21. //Full Access
  22. if($_COOKIE["logged"] == $cookiepass && !empty($section["enabled"]) && ($section["enabled"]=="true")) {
  23. if($icons == "active"){ $listicons = "<span><i class=\"fa ". $section["icon"] ."\"></i></span>"; }
  24. $loadedlist .= "<li id=\"". $section["url"] ."x\"><a>" . $keyname . " " . $listicons ."</a></li>\n";
  25. $loadedurls .= "<div class=\"z-nopadding\" data-content-url=\"". $section["url"] ."\" data-content-type=\"iframe\"></div>\n";
  26. }
  27. //General
  28. if (empty($title)) $title = 'Manage My HTPC';
  29. 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"];}
  30. }
  31. if($_COOKIE["logged"] !== $cookiepass){
  32. $lasttablist .= "<li><a>Login" . $guesticons . "</a></li>\n";
  33. $lasttaburl .= "<div class=\"z-nopadding\" data-content-url=\"setup.php\" data-content-type=\"iframe\"></div>\n";
  34. }
  35. if($_COOKIE["logged"] == $cookiepass){
  36. $lasttablist .= "<li><a>Settings" . $adminicons . "</a></li>\n";
  37. $lasttaburl .= "<div class=\"z-nopadding\" data-content-url=\"setup.php\" data-content-type=\"iframe\"></div>\n";
  38. }
  39. if(!file_exists('settings.ini.php')){
  40. $lasttablist = "<li><a>Setup<span><i class=\"fa fa-spinner\"></i></span></a></li>\n";
  41. $lasttaburl = "<div class=\"z-nopadding\" data-content-url=\"setup.php\" data-content-type=\"iframe\"></div>\n";
  42. }
  43. ?>
  44. <!doctype html>
  45. <html class="z-white z-width1200">
  46. <head>
  47. <title><?=$title;?></title>
  48. <meta charset="utf-8">
  49. <meta name="viewport" content="width = device-width, initial-scale = 1.0" />
  50. <link href="css/min.css" rel="stylesheet" />
  51. <link href="css/tabs.min.css" rel="stylesheet" />
  52. <script src="js/jquery.min.js"></script>
  53. <script src="js/tabs.min.js"></script>
  54. <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'>
  55. <style>
  56. .z-tabs.white.z-bordered > ul > li.z-active > a {color: <?=$fontcoloractive;?>; background-color: <?=$tabcoloractive;?>; text-shadow: 0 1px <?=$tabshadowactive;?>;}
  57. </style>
  58. <style>
  59. .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 {
  60. color: <?=$fontcolor;?>; background-color: <?=$tabcolor;?>; text-shadow: 0 1px <?=$tabshadow;?>;
  61. }
  62. </style>
  63. <script>
  64. $(document).ready(function(){
  65. $("li").dblclick(function(){
  66. var frame = this.id.slice(0, -1);
  67. var f = document.getElementById(frame);
  68. f.src = f.src;
  69. });
  70. });
  71. </script>
  72. </head>
  73. <body style="position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: white;
  74. -webkit-background-size: cover;
  75. -moz-background-size: cover;
  76. -o-background-size: cover;
  77. background-size: cover;">
  78. <span>&nbsp;</span>
  79. <div id="page">
  80. <!--Tabs Start-->
  81. <div id="tabbed-nav">
  82. <ul>
  83. <?=$loadedlist;?>
  84. <?=$lasttablist;?>
  85. </ul>
  86. <!-- Content container -->
  87. <style> .z-container { position: fixed; top: 50px; right: 0px; bottom: 0px; left: 0px; margin: 10px; } </style>
  88. <div style="top: <?=$px;?>">
  89. <?=$loadedurls;?>
  90. <?=$lasttaburl;?>
  91. </div>
  92. </div>
  93. <!--Tabs End-->
  94. </div>
  95. <script>
  96. jQuery(document).ready(function ($) {
  97. /* jQuery activation and setting options for the tabs*/
  98. $("#tabbed-nav").zozoTabs({
  99. defaultTab: "tab1",
  100. multiline: true,
  101. theme: "white",
  102. position: "top-compact",
  103. size: "medium",
  104. animation: {
  105. easing: "easeInOutExpo",
  106. duration: 450,
  107. effects: "fade"
  108. }
  109. });
  110. });
  111. </script>
  112. <script>
  113. jQuery('iframe','#container').attr('src',url);
  114. </script>
  115. </body>
  116. </html>