Account and permission manager and security log viewer. https://netsyms.biz/apps/managepanel
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

app.php 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?php
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. require_once __DIR__ . "/required.php";
  6. if ($_SESSION['loggedin'] != true) {
  7. header('Location: index.php');
  8. die("Session expired. Log in again to continue.");
  9. }
  10. require_once __DIR__ . "/pages.php";
  11. $pageid = "home";
  12. if (!empty($_GET['page'])) {
  13. $pg = strtolower($_GET['page']);
  14. $pg = preg_replace('/[^0-9a-z_]/', "", $pg);
  15. if (array_key_exists($pg, PAGES) && file_exists(__DIR__ . "/pages/" . $pg . ".php")) {
  16. $pageid = $pg;
  17. } else {
  18. $pageid = "404";
  19. }
  20. }
  21. header("Link: <static/fonts/Roboto.css>; rel=preload; as=style", false);
  22. header("Link: <static/css/bootstrap.min.css>; rel=preload; as=style", false);
  23. header("Link: <static/css/material-color/material-color.min.css>; rel=preload; as=style", false);
  24. header("Link: <static/css/app.css>; rel=preload; as=style", false);
  25. header("Link: <static/css/svg-with-js.min.css>; rel=preload; as=style", false);
  26. header("Link: <static/js/fontawesome-all.min.js>; rel=preload; as=script", false);
  27. header("Link: <static/js/jquery-3.3.1.min.js>; rel=preload; as=script", false);
  28. header("Link: <static/js/bootstrap.bundle.min.js>; rel=preload; as=script", false);
  29. ?>
  30. <!DOCTYPE html>
  31. <html>
  32. <head>
  33. <meta charset="UTF-8">
  34. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  35. <meta name="viewport" content="width=device-width, initial-scale=1">
  36. <title><?php echo $SETTINGS['site_title']; ?></title>
  37. <link rel="icon" href="static/img/logo.svg">
  38. <link href="static/css/bootstrap.min.css" rel="stylesheet">
  39. <link href="static/css/material-color/material-color.min.css" rel="stylesheet">
  40. <link href="static/css/app.css" rel="stylesheet">
  41. <link href="static/css/svg-with-js.min.css" rel="stylesheet">
  42. <script nonce="<?php echo $SECURE_NONCE; ?>">
  43. FontAwesomeConfig = {autoAddCss: false}
  44. </script>
  45. <script src="static/js/fontawesome-all.min.js"></script>
  46. <?php
  47. // custom page styles
  48. if (isset(PAGES[$pageid]['styles'])) {
  49. foreach (PAGES[$pageid]['styles'] as $style) {
  50. echo "<link href=\"$style\" rel=\"stylesheet\">\n";
  51. header("Link: <$style>; rel=preload; as=style", false);
  52. }
  53. }
  54. ?>
  55. </head>
  56. <body>
  57. <?php
  58. // Alert messages
  59. if (!empty($_GET['msg'])) {
  60. if (array_key_exists($_GET['msg'], MESSAGES)) {
  61. // optional string generation argument
  62. if (empty($_GET['arg'])) {
  63. $alertmsg = $Strings->get(MESSAGES[$_GET['msg']]['string'], false);
  64. } else {
  65. $alertmsg = $Strings->build(MESSAGES[$_GET['msg']]['string'], ["arg" => strip_tags($_GET['arg'])], false);
  66. }
  67. $alerttype = MESSAGES[$_GET['msg']]['type'];
  68. $alerticon = "square-o";
  69. switch (MESSAGES[$_GET['msg']]['type']) {
  70. case "danger":
  71. $alerticon = "times";
  72. break;
  73. case "warning":
  74. $alerticon = "exclamation-triangle";
  75. break;
  76. case "info":
  77. $alerticon = "info-circle";
  78. break;
  79. case "success":
  80. $alerticon = "check";
  81. break;
  82. }
  83. } else {
  84. // We don't have a message for this, so just assume an error and escape stuff.
  85. $alertmsg = htmlentities($Strings->get($_GET['msg'], false));
  86. $alerticon = "times";
  87. $alerttype = "danger";
  88. }
  89. echo <<<END
  90. <div class="row justify-content-center" id="msg-alert-box">
  91. <div class="col-11 col-sm-6 col-md-5 col-lg-4 col-xl-4">
  92. <div class="alert alert-dismissible alert-$alerttype mt-2 p-0 border-0 shadow">
  93. <div class="p-2 pl-3">
  94. <button type="button" class="close">&times;</button>
  95. <i class="fas fa-$alerticon"></i> $alertmsg
  96. </div>
  97. <div class="progress">
  98. <div class="progress-bar bg-$alerttype w-0" id="msg-alert-timeout-bar"></div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. END;
  104. }
  105. ?>
  106. <?php
  107. // Adjust as needed
  108. $navbar_breakpoint = "xl";
  109. // For mobile app
  110. echo "<script nonce=\"$SECURE_NONCE\">var navbar_breakpoint = \"$navbar_breakpoint\";</script>"
  111. ?>
  112. <nav class="navbar navbar-expand-<?php echo $navbar_breakpoint; ?> navbar-dark bg-brown fixed-top">
  113. <button class="navbar-toggler my-0 py-0" type="button" data-toggle="collapse" data-target="#navbar-collapse" aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
  114. <!--<i class="fas fa-bars"></i>-->
  115. <span class="navbar-toggler-icon"></span>
  116. </button>
  117. <a class="navbar-brand py-0 mr-auto" href="app.php">
  118. <img src="static/img/logo.svg" alt="" class="d-none d-<?php echo $navbar_breakpoint; ?>-inline brand-img py-0" />
  119. <?php echo $SETTINGS['site_title']; ?>
  120. </a>
  121. <div class="collapse navbar-collapse py-0" id="navbar-collapse">
  122. <div class="navbar-nav mr-auto py-0">
  123. <?php
  124. $curpagefound = false;
  125. foreach (PAGES as $id => $pg) {
  126. if (isset($pg['navbar']) && $pg['navbar'] === TRUE) {
  127. if ($pageid == $id) {
  128. $curpagefound = true;
  129. ?>
  130. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0 active">
  131. <?php
  132. } else {
  133. ?>
  134. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0">
  135. <?php
  136. }
  137. ?>
  138. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="app.php?page=<?php echo $id; ?>">
  139. <?php
  140. if (isset($pg['icon'])) {
  141. ?><i class="<?php echo $pg['icon']; ?> fa-fw"></i> <?php
  142. }
  143. $Strings->get($pg['title']);
  144. ?>
  145. </a>
  146. </span>
  147. <?php
  148. }
  149. }
  150. ?>
  151. </div>
  152. <div class="navbar-nav ml-auto py-0" id="navbar-right">
  153. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0">
  154. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="<?php echo $SETTINGS['accounthub']['home']; ?>">
  155. <i class="fas fa-user fa-fw"></i><span>&nbsp;<?php echo $_SESSION['realname'] ?></span>
  156. </a>
  157. </span>
  158. <span class="nav-item mr-auto py-<?php echo $navbar_breakpoint; ?>-0">
  159. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="action.php?action=signout">
  160. <i class="fas fa-sign-out-alt fa-fw"></i><span>&nbsp;<?php $Strings->get("sign out") ?></span>
  161. </a>
  162. </span>
  163. </div>
  164. </div>
  165. </nav>
  166. <div class="container" id="main-content">
  167. <div>
  168. <?php
  169. include_once __DIR__ . '/pages/' . $pageid . ".php";
  170. ?>
  171. </div>
  172. <div class="footer">
  173. <?php echo $SETTINGS['footer_text']; ?><br />
  174. Copyright &copy; <?php echo date('Y'); ?> <?php echo $SETTINGS['copyright']; ?>
  175. </div>
  176. </div>
  177. <script src="static/js/jquery-3.3.1.min.js"></script>
  178. <script src="static/js/bootstrap.bundle.min.js"></script>
  179. <script src="static/js/app.js"></script>
  180. <?php
  181. // custom page scripts
  182. if (isset(PAGES[$pageid]['scripts'])) {
  183. foreach (PAGES[$pageid]['scripts'] as $script) {
  184. echo "<script src=\"$script\"></script>\n";
  185. header("Link: <$script>; rel=preload; as=script", false);
  186. }
  187. }
  188. ?>
  189. </body>
  190. </html>