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.

app.php 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. require_once __DIR__ . "/required.php";
  3. if ($_SESSION['loggedin'] != true) {
  4. header('Location: index.php');
  5. die("Session expired. Log in again to continue.");
  6. }
  7. require_once __DIR__ . "/pages.php";
  8. $pageid = "home";
  9. if (!is_empty($_GET['page'])) {
  10. $pg = strtolower($_GET['page']);
  11. $pg = preg_replace('/[^0-9a-z_]/', "", $pg);
  12. if (array_key_exists($pg, PAGES) && file_exists(__DIR__ . "/pages/" . $pg . ".php")) {
  13. $pageid = $pg;
  14. } else {
  15. $pageid = "404";
  16. }
  17. }
  18. ?>
  19. <!DOCTYPE html>
  20. <html>
  21. <head>
  22. <meta charset="UTF-8">
  23. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  24. <meta name="viewport" content="width=device-width, initial-scale=1">
  25. <title><?php echo SITE_TITLE; ?></title>
  26. <link href="static/css/bootstrap.min.css" rel="stylesheet">
  27. <link href="static/css/font-awesome.min.css" rel="stylesheet">
  28. <link href="static/css/material-color/material-color.min.css" rel="stylesheet">
  29. <link href="static/css/app.css" rel="stylesheet">
  30. <?php
  31. // custom page styles
  32. if (isset(PAGES[$pageid]['styles'])) {
  33. foreach (PAGES[$pageid]['styles'] as $style) {
  34. echo "<link href=\"$style\" rel=\"stylesheet\">\n";
  35. }
  36. }
  37. ?>
  38. </head>
  39. <body>
  40. <div class="container">
  41. <div class="row">
  42. <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 col-sm-offset-3 col-md-offset-4 col-lg-offset-4">
  43. <?php
  44. if ((SHOW_ICON == "both" || SHOW_ICON == "app") && ICON_POSITION != "menu") {
  45. if (MENU_BAR_STYLE != "fixed") {
  46. ?>
  47. <img class="img-responsive banner-image" src="static/img/logo.png" />
  48. <?php
  49. }
  50. }
  51. ?>
  52. </div>
  53. </div>
  54. <nav class="navbar navbar-inverse navbar-<?php echo MENU_BAR_STYLE; ?>-top">
  55. <div class="container-fluid">
  56. <div class="navbar-header">
  57. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
  58. <span class="sr-only">Toggle navigation</span>
  59. <span class="icon-bar"></span>
  60. <span class="icon-bar"></span>
  61. <span class="icon-bar"></span>
  62. </button>
  63. <?php
  64. if (SHOW_ICON == "both" || SHOW_ICON == "app") {
  65. if (MENU_BAR_STYLE == "fixed" || ICON_POSITION == "menu") {
  66. $src = "static/img/logo.png";
  67. if ($pageid != "home") {
  68. $src = "static/img/up-arrow-white.png";
  69. }
  70. ?>
  71. <a class="navbar-brand" href="app.php">
  72. <img style="height: 35px; padding-bottom: 12px; padding-left: 5px;" src="<?php echo $src; ?>" />
  73. </a>
  74. <?php
  75. }
  76. }
  77. ?>
  78. <a class="navbar-brand" href="app.php">
  79. <?php
  80. echo SITE_TITLE;
  81. ?>
  82. </a>
  83. </div>
  84. <div class="collapse navbar-collapse" id="navbar-collapse">
  85. <ul class="nav navbar-nav">
  86. <?php
  87. foreach (PAGES as $id => $pg) {
  88. if ($pg['navbar'] === TRUE) {
  89. if ($pageid == $id) {
  90. ?>
  91. <li class="active">
  92. <?php
  93. } else {
  94. ?>
  95. <li>
  96. <?php } ?>
  97. <a href="app.php?page=<?php echo $id; ?>">
  98. <?php
  99. if (isset($pg['icon'])) {
  100. ?>
  101. <i class="fa fa-<?php echo $pg['icon']; ?> fa-fw"></i>
  102. <?php } ?>
  103. <?php lang($pg['title']) ?>
  104. </a>
  105. </li>
  106. <?php
  107. }
  108. }
  109. ?>
  110. </ul>
  111. <ul class="nav navbar-nav navbar-right">
  112. <li><a href="<?php echo PORTAL_URL; ?>"><i class="fa fa-user fa-fw"></i> <?php echo $_SESSION['realname'] ?></a></li>
  113. <li><a href="action.php?action=signout"><i class="fa fa-sign-out fa-fw"></i> <?php lang("sign out") ?></a></li>
  114. </ul>
  115. </div>
  116. </div>
  117. </nav>
  118. <?php
  119. if (MENU_BAR_STYLE == "fixed") {
  120. ?>
  121. <div style="height: 75px;"></div>
  122. <?php
  123. }
  124. ?>
  125. <?php
  126. // Alert messages
  127. if (!is_empty($_GET['msg']) && array_key_exists($_GET['msg'], MESSAGES)) {
  128. // optional string generation argument
  129. if (is_empty($_GET['arg'])) {
  130. $alertmsg = lang(MESSAGES[$_GET['msg']]['string'], false);
  131. } else {
  132. $alertmsg = lang2(MESSAGES[$_GET['msg']]['string'], ["arg" => strip_tags($_GET['arg'])], false);
  133. }
  134. $alerttype = MESSAGES[$_GET['msg']]['type'];
  135. $alerticon = "square-o";
  136. switch (MESSAGES[$_GET['msg']]['type']) {
  137. case "danger":
  138. $alerticon = "times";
  139. break;
  140. case "warning":
  141. $alerticon = "exclamation-triangle";
  142. break;
  143. case "info":
  144. $alerticon = "info-circle";
  145. break;
  146. case "success":
  147. $alerticon = "check";
  148. break;
  149. }
  150. echo <<<END
  151. <div class="row">
  152. <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 col-sm-offset-3 col-md-offset-4 col-lg-offset-4">
  153. <div class="alert alert-dismissible alert-$alerttype">
  154. <button type="button" class="close">&times;</button>
  155. <i class="fa fa-$alerticon"></i> $alertmsg
  156. </div>
  157. </div>
  158. </div>
  159. END;
  160. }
  161. ?>
  162. <div>
  163. <?php
  164. include_once __DIR__ . '/pages/' . $pageid . ".php";
  165. ?>
  166. </div>
  167. <div class="footer">
  168. <?php echo LICENSE_TEXT; ?><br />
  169. Copyright &copy; <?php echo date('Y'); ?> <?php echo COPYRIGHT_NAME; ?>
  170. </div>
  171. </div>
  172. <script src="static/js/jquery-3.2.1.min.js"></script>
  173. <script src="static/js/bootstrap.min.js"></script>
  174. <script src="static/js/app.js"></script>
  175. <?php
  176. // custom page scripts
  177. if (isset(PAGES[$pageid]['scripts'])) {
  178. foreach (PAGES[$pageid]['scripts'] as $script) {
  179. echo "<script src=\"$script\"></script>\n";
  180. }
  181. }
  182. ?>
  183. </body>
  184. </html>