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.8KB

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