index.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. // loads the config
  3. $config = include(__DIR__ . '/../../config.php');
  4. // go set your id here otehrwise ur site wont load the stuff it needs
  5. $siteId = 4;
  6. // website go search what stuffs it need to load
  7. $websiteConfig = array_filter($config, function($site) use ($siteId) {
  8. return isset($site['id']) && $site['id'] === $siteId;
  9. });
  10. $websiteConfig = reset($websiteConfig);
  11. // include the components so the site actually gets rendered
  12. foreach ($websiteConfig['components'] as $component) {
  13. include($component);
  14. }
  15. ?>
  16. <!DOCTYPE html>
  17. <html lang="en">
  18. <head>
  19. <meta charset="UTF-8">
  20. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  21. <title>Dialon - <?php echo ucfirst($page); ?></title>
  22. <meta name="description" content="<?php echo $metaDescription; ?>">
  23. <link rel="stylesheet" href="assets/css/dialon.css">
  24. <?php if (!$navbarTableExists || $navbarHasEntries): ?>
  25. <link rel="stylesheet" href="assets/css/navbar.css">
  26. <?php endif; ?>
  27. <?php if (!$navbarTableExists || !$navbarHasEntries): ?>
  28. <link rel="stylesheet" href="assets/css/hamburger.css">
  29. <?php endif; ?>
  30. <link rel="stylesheet" href="assets/css/extras.css">
  31. <style>
  32. <?php if ($navbarTableExists && $navbarHasEntries): ?>
  33. .chat-toggle-btn {
  34. bottom: 20px;
  35. }
  36. <?php endif; ?>
  37. </style>
  38. </head>
  39. <body>
  40. <header>
  41. <div class="header-content" <?php if ($navbarTableExists && $navbarHasEntries) echo 'style="display:none;"'; ?>>
  42. <img src="assets/img/dialon.png" alt="Teleco Logo" class="logo">
  43. <h1>dialon.ch</h1>
  44. </div>
  45. </header>
  46. <?php if ($navbarTableExists && $navbarHasEntries): ?>
  47. <?php render_navbar_js($db); ?>
  48. <?php endif; ?>
  49. <?php if (!$navbarTableExists || !$navbarHasEntries): ?>
  50. <!-- burger king chnopf -->
  51. <button class="hamburger-menu" onclick="toggleMenu()">
  52. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" width="24" height="24" aria-hidden="true">
  53. <path d="M0 88C0 74.7 10.7 64 24 64H424c13.3 0 24 10.7 24 24s-10.7 24-24 24H24C10.7 112 0 101.3 0 88zM0 248C0 234.7 10.7 224 24 224H424c13.3 0 24 10.7 24 24s-10.7 24-24 24H24C10.7 272 0 261.3 0 248zM424 448H24c-13.3 0-24-10.7-24-24s10.7-24 24-24H424c13.3 0 24 10.7 24 24s-10.7 24-24 24z"/>
  54. </svg>
  55. </button>
  56. <!-- burger king -->
  57. <div class="menu-overlay">
  58. <div class="menu-content">
  59. <h2>Navigation</h2>
  60. <?php get_sidebar($db, 'left', $page, $sub); ?>
  61. <?php get_sidebar($db, 'right', $page, $sub); ?>
  62. </div>
  63. </div>
  64. <?php endif; ?>
  65. <div class="container" style="<?php echo $leftSidebarHasItems || $rightSidebarHasItems ? '' : 'margin-left: 0px; margin-right: 0px; flex-wrap: nowrap; margin-top: 0px; margin-bottom: 0px; max-width: 100%; box-sizing: border-box; padding: 10px;'; ?>">
  66. <!-- dis da left sidebar -->
  67. <?php if ($leftSidebarHasItems): ?>
  68. <div class="sidebar">
  69. <?php get_sidebar($db, 'left', $page, $sub); ?>
  70. </div>
  71. <?php endif; ?>
  72. <!-- dis da main content row down the middle -->
  73. <div class="content" id="content" style="<?php echo $leftSidebarHasItems || $rightSidebarHasItems ? '' : 'width: calc(100%);'; ?>">
  74. <!-- my terrible way of doing breadcrumbs -->
  75. <div class="breadcrumbs">
  76. <?php
  77. foreach ($breadcrumbs as $index => $crumb) {
  78. if ($index > 0) echo ' > ';
  79. echo '<a href="?page=' . htmlspecialchars($crumb['page']) . '">';
  80. echo htmlspecialchars($crumb['title']);
  81. echo '</a>';
  82. }
  83. ?>
  84. </div>
  85. <?php if ($hasContent): ?>
  86. <?php
  87. $result = $query->execute();
  88. $lastPostId = 0;
  89. while ($row = $result->fetchArray()):
  90. $lastPostId++;
  91. ?>
  92. <div class="box" id="post-<?php echo $lastPostId; ?>">
  93. <h3><?php echo htmlspecialchars($row['title']); ?></h3>
  94. <p><?php echo $row['content']; ?></p> <!-- used to have a function to disable and enable rendering html in post, got very annoyed with its db not doing what its supposed to do so now it loads html eitherway and html_custom is nolonger a thing im das datenbank -->
  95. <hr>
  96. <p>Date: <?php echo $row['date']; ?></p>
  97. </div>
  98. <?php endwhile; ?>
  99. <?php else: ?>
  100. <div class="box">
  101. <h3>404 - Page Not Found</h3>
  102. <p>Sorry, the page you are looking for does not exist.</p>
  103. </div>
  104. <?php endif; ?>
  105. <div id="load-container">
  106. <?php if ($hasContent && $offset + $limit < $totalPosts): ?>
  107. <form method="get" action="index.php#post-<?php echo $lastPostId; ?>">
  108. <input type="hidden" name="page" value="<?php echo htmlspecialchars($page); ?>">
  109. <?php if ($sub): ?>
  110. <input type="hidden" name="sub" value="<?php echo htmlspecialchars($sub); ?>">
  111. <?php endif; ?>
  112. <input type="hidden" name="offset" value="<?php echo $offset + $limit; ?>">
  113. <button class="load-more-button" type="submit">Load More (<?php echo min($offset + $limit, $totalPosts) . " out of " . $totalPosts; ?>)</button>
  114. </form>
  115. <?php endif; ?>
  116. </div>
  117. </div>
  118. <!-- dis da right seitenleisteh! -->
  119. <?php if ($rightSidebarHasItems): ?>
  120. <div class="sidebar-right">
  121. <?php get_sidebar($db, 'right', $page, $sub); ?>
  122. </div>
  123. <?php endif; ?>
  124. </div>
  125. <!-- cat support meow meow meow meow -->
  126. <button class="chat-toggle-btn" onclick="toggleChat()">
  127. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="24" height="24" aria-hidden="true">
  128. <path d="M192 208c0-17.7-14.3-32-32-32h-16c-35.4 0-64 28.7-64 64v48c0 35.4 28.7 64 64 64h16c17.7 0 32-14.3 32-32V208zm176 144c35.4 0 64-28.7 64-64v-48c0-35.4-28.7-64-64-64h-16c-17.7 0-32 14.3-32 32v112c0 17.7 14.3 32 32 32h16zM256 0C113.2 0 4.6 118.8 0 256v16c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16v-16c0-114.7 93.3-208 208-208s208 93.3 208 208h-.1c.1 2.4 .1 165.7 .1 165.7 0 23.4-18.9 42.3-42.3 42.3H320c0-26.5-21.5-48-48-48h-32c-26.5 0-48 21.5-48 48s21.5 48 48 48h181.7c49.9 0 90.3-40.4 90.3-90.3V256C507.4 118.8 398.8 0 256 0z"/>
  129. </svg>
  130. </button>
  131. <!-- mau mau support dumpster -->
  132. <div class="chat-container" id="chat-container">
  133. <div class="chat-header">
  134. Virtual Assistant Chat
  135. <button class="chat-close-btn" onclick="toggleChat()">✖</button> <!-- mau mau tschau -->
  136. </div>
  137. <div class="chat-log" id="chat-log"></div>
  138. <div class="chat-input-container">
  139. <input type="text" id="user-input" class="chat-input" style="background-color: var(--secondary-color);" placeholder="Type your message here...">
  140. <button class="send-btn" onclick="sendMessage()">Send</button>
  141. </div>
  142. </div>
  143. <!-- js sache sind hier und so -->
  144. <script src="assets/js/chat.js"></script>
  145. <script src="assets/js/menu.js"></script>
  146. <script>
  147. document.addEventListener('DOMContentLoaded', function() {
  148. const mobileMenu = document.querySelector('.mobile-navbar-menu');
  149. const toggleButton = document.querySelector('.navbar-toggle');
  150. window.toggleNavbar = function() {
  151. if (!mobileMenu) return;
  152. if (mobileMenu.classList.contains('open')) {
  153. mobileMenu.style.maxHeight = "0px";
  154. mobileMenu.classList.remove('open');
  155. } else {
  156. mobileMenu.style.maxHeight = mobileMenu.scrollHeight + "px";
  157. mobileMenu.classList.add('open');
  158. }
  159. };
  160. window.addEventListener('resize', function() {
  161. if (window.innerWidth > 768 && mobileMenu.classList.contains('open')) {
  162. mobileMenu.classList.remove('open');
  163. mobileMenu.style.maxHeight = "0px";
  164. }
  165. });
  166. });
  167. </script>
  168. </body>
  169. </html>