QwikClock is an employee time tracking app.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 (isset($_GET['page']) && !is_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/fa-svg-with-js.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.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 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/fa-svg-with-js.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 (isset($_GET['msg']) && !is_empty($_GET['msg']) && array_key_exists($_GET['msg'], MESSAGES)) {
  60. // optional string generation argument
  61. if (!isset($_GET['arg']) || is_empty($_GET['arg'])) {
  62. $alertmsg = lang(MESSAGES[$_GET['msg']]['string'], false);
  63. } else {
  64. $alertmsg = lang2(MESSAGES[$_GET['msg']]['string'], ["arg" => strip_tags($_GET['arg'])], false);
  65. }
  66. $alerttype = MESSAGES[$_GET['msg']]['type'];
  67. $alerticon = "square-o";
  68. switch (MESSAGES[$_GET['msg']]['type']) {
  69. case "danger":
  70. $alerticon = "times";
  71. break;
  72. case "warning":
  73. $alerticon = "exclamation-triangle";
  74. break;
  75. case "info":
  76. $alerticon = "info-circle";
  77. break;
  78. case "success":
  79. $alerticon = "check";
  80. break;
  81. }
  82. echo <<<END
  83. <div class="row justify-content-center" id="msg-alert-box">
  84. <div class="col-11 col-sm-6 col-md-5 col-lg-4 col-xl-4">
  85. <div class="alert alert-dismissible alert-$alerttype">
  86. <button type="button" class="close">&times;</button>
  87. <i class="fas fa-$alerticon"></i> $alertmsg
  88. </div>
  89. </div>
  90. </div>
  91. END;
  92. }
  93. ?>
  94. <?php
  95. // Adjust as needed
  96. $navbar_breakpoint = "md";
  97. // For mobile app
  98. echo "<script nonce=\"$SECURE_NONCE\">var navbar_breakpoint = \"$navbar_breakpoint\";</script>"
  99. ?>
  100. <nav class="navbar navbar-expand-<?php echo $navbar_breakpoint; ?> navbar-dark bg-blue fixed-top">
  101. <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">
  102. <!--<i class="fas fa-bars"></i>-->
  103. <span class="navbar-toggler-icon"></span>
  104. </button>
  105. <a class="navbar-brand py-0 mr-auto" href="app.php">
  106. <img src="static/img/logo.svg" alt="" class="d-none d-<?php echo $navbar_breakpoint; ?>-inline brand-img py-0" />
  107. <?php echo SITE_TITLE; ?>
  108. </a>
  109. <div class="collapse navbar-collapse py-0" id="navbar-collapse">
  110. <div class="navbar-nav mr-auto py-0">
  111. <?php
  112. $curpagefound = false;
  113. foreach (PAGES as $id => $pg) {
  114. if (isset($pg['navbar']) && $pg['navbar'] === TRUE) {
  115. if ($pageid == $id) {
  116. $curpagefound = true;
  117. ?>
  118. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0 active">
  119. <?php
  120. } else {
  121. ?>
  122. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0">
  123. <?php
  124. }
  125. ?>
  126. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="app.php?page=<?php echo $id; ?>">
  127. <?php
  128. if (isset($pg['icon'])) {
  129. ?><i class="<?php echo $pg['icon']; ?> fa-fw"></i> <?php
  130. }
  131. lang($pg['title']);
  132. ?>
  133. </a>
  134. </span>
  135. <?php
  136. }
  137. }
  138. ?>
  139. </div>
  140. <div class="navbar-nav ml-auto py-0" id="navbar-right">
  141. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0">
  142. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="<?php echo PORTAL_URL; ?>">
  143. <i class="fas fa-user fa-fw"></i><span>&nbsp;<?php echo $_SESSION['realname'] ?></span>
  144. </a>
  145. </span>
  146. <span class="nav-item mr-auto py-<?php echo $navbar_breakpoint; ?>-0">
  147. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="action.php?action=signout">
  148. <i class="fas fa-sign-out-alt fa-fw"></i><span>&nbsp;<?php lang("sign out") ?></span>
  149. </a>
  150. </span>
  151. </div>
  152. </div>
  153. </nav>
  154. <div class="container" id="main-content">
  155. <div>
  156. <?php
  157. include_once __DIR__ . '/pages/' . $pageid . ".php";
  158. ?>
  159. </div>
  160. <div class="footer">
  161. <?php echo FOOTER_TEXT; ?><br />
  162. Copyright &copy; <?php echo date('Y'); ?> <?php echo COPYRIGHT_NAME; ?>
  163. </div>
  164. </div>
  165. <script src="static/js/jquery-3.3.1.min.js"></script>
  166. <script src="static/js/bootstrap.min.js"></script>
  167. <script src="static/js/app.js"></script>
  168. <?php
  169. // custom page scripts
  170. if (isset(PAGES[$pageid]['scripts'])) {
  171. foreach (PAGES[$pageid]['scripts'] as $script) {
  172. echo "<script src=\"$script\"></script>\n";
  173. header("Link: <$script>; rel=preload; as=script", false);
  174. }
  175. }
  176. ?>
  177. </body>
  178. </html>