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

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