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 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. <img class="img-responsive banner-image" src="static/img/banner.png" />
  35. </div>
  36. </div>
  37. <nav class="navbar navbar-inverse">
  38. <div class="container-fluid">
  39. <div class="navbar-header">
  40. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
  41. <span class="sr-only">Toggle navigation</span>
  42. <span class="icon-bar"></span>
  43. <span class="icon-bar"></span>
  44. <span class="icon-bar"></span>
  45. </button>
  46. <a class="navbar-brand" href="app.php?page=home">
  47. <?php
  48. // add breadcrumb-y thing
  49. //lang("home");
  50. //echo " <i class=\"fa fa-caret-right\"></i> ";
  51. lang(PAGES[$pageid]['title']);
  52. ?>
  53. </a>
  54. </div>
  55. <div class="collapse navbar-collapse" id="navbar-collapse">
  56. <ul class="nav navbar-nav">
  57. </ul>
  58. <ul class="nav navbar-nav navbar-right">
  59. <li class="dropdown">
  60. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-gears fa-fw"></i> <?php lang("options") ?> <span class="caret"></span></a>
  61. <ul class="dropdown-menu" role="menu">
  62. <li><a href="app.php?page=security"><i class="fa fa-lock fa-fw"></i> <?php lang("account security") ?></a></li>
  63. <li class="divider"></li>
  64. <li><a href="action.php?action=signout"><i class="fa fa-sign-out fa-fw"></i> <?php lang("sign out") ?></a></li>
  65. </ul>
  66. </li>
  67. </ul>
  68. </div>
  69. </div>
  70. </nav>
  71. <?php
  72. // Alert messages
  73. if (!is_empty($_GET['msg']) && array_key_exists($_GET['msg'], MESSAGES)) {
  74. // optional string generation argument
  75. if (is_empty($_GET['arg'])) {
  76. $alertmsg = lang(MESSAGES[$_GET['msg']]['string'], false);
  77. } else {
  78. $alertmsg = lang2(MESSAGES[$_GET['msg']]['string'], ["arg" => $_GET['arg']], false);
  79. }
  80. $alerttype = MESSAGES[$_GET['msg']]['type'];
  81. $alerticon = "square-o";
  82. switch (MESSAGES[$_GET['msg']]['type']) {
  83. case "danger":
  84. $alerticon = "times";
  85. break;
  86. case "warning":
  87. $alerticon = "exclamation-triangle";
  88. break;
  89. case "info":
  90. $alerticon = "info-circle";
  91. break;
  92. case "success":
  93. $alerticon = "check";
  94. break;
  95. }
  96. echo <<<END
  97. <div class="row">
  98. <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">
  99. <div class="alert alert-dismissible alert-$alerttype">
  100. <button type="button" class="close">&times;</button>
  101. <i class="fa fa-$alerticon"></i> $alertmsg
  102. </div>
  103. </div>
  104. </div>
  105. END;
  106. }
  107. ?>
  108. <div>
  109. <?php
  110. include_once __DIR__ . '/pages/' . $pageid . ".php";
  111. ?>
  112. </div>
  113. <div class="footer">
  114. <?php echo LICENSE_TEXT; ?><br />
  115. Copyright &copy; <?php echo date('Y'); ?> <?php echo COPYRIGHT_NAME; ?>
  116. </div>
  117. </div>
  118. <script src="static/js/jquery-3.2.1.min.js"></script>
  119. <script src="static/js/bootstrap.min.js"></script>
  120. <script src="static/js/app.js"></script>
  121. </body>
  122. </html>