An easy point of sale system with automatic inventory tracking. https://netsyms.biz/apps/nickelbox/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

app.php 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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/svg-with-js.min.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.bundle.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/svg-with-js.min.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 = $Strings->get(MESSAGES[$_GET['msg']]['string'], false);
  63. } else {
  64. $alertmsg = $Strings->build(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 mt-2 p-0 border-0 shadow">
  86. <div class="p-2 pl-3">
  87. <button type="button" class="close">&times;</button>
  88. <i class="fas fa-$alerticon"></i> $alertmsg
  89. </div>
  90. <div class="progress">
  91. <div class="progress-bar bg-$alerttype w-0" id="msg-alert-timeout-bar"></div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. END;
  97. }
  98. ?>
  99. <?php
  100. // Adjust as needed
  101. $navbar_breakpoint = "md";
  102. // For mobile app
  103. echo "<script nonce=\"$SECURE_NONCE\">var navbar_breakpoint = \"$navbar_breakpoint\";</script>"
  104. ?>
  105. <nav class="navbar navbar-expand-<?php echo $navbar_breakpoint; ?> navbar-light bg-light-green fixed-top">
  106. <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">
  107. <!--<i class="fas fa-bars"></i>-->
  108. <span class="navbar-toggler-icon"></span>
  109. </button>
  110. <a class="navbar-brand py-0 mr-auto" href="app.php">
  111. <img src="static/img/logo.svg" alt="" class="d-none d-<?php echo $navbar_breakpoint; ?>-inline brand-img py-0" />
  112. <?php echo SITE_TITLE; ?>
  113. </a>
  114. <div class="collapse navbar-collapse py-0" id="navbar-collapse">
  115. <div class="navbar-nav mr-auto py-0">
  116. <?php
  117. $curpagefound = false;
  118. foreach (PAGES as $id => $pg) {
  119. if (isset($pg['navbar']) && $pg['navbar'] === TRUE) {
  120. if ($pageid == $id) {
  121. $curpagefound = true;
  122. ?>
  123. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0 active">
  124. <?php
  125. } else {
  126. ?>
  127. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0">
  128. <?php
  129. }
  130. ?>
  131. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="app.php?page=<?php echo $id; ?>">
  132. <?php
  133. if (isset($pg['icon'])) {
  134. ?><i class="<?php echo $pg['icon']; ?> fa-fw"></i> <?php
  135. }
  136. $Strings->get($pg['title']);
  137. ?>
  138. </a>
  139. </span>
  140. <?php
  141. }
  142. }
  143. ?>
  144. </div>
  145. <div class="navbar-nav ml-auto py-0" id="navbar-right">
  146. <span class="nav-item py-<?php echo $navbar_breakpoint; ?>-0">
  147. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="<?php echo PORTAL_URL; ?>">
  148. <i class="fas fa-user fa-fw"></i><span>&nbsp;<?php echo $_SESSION['realname'] ?></span>
  149. </a>
  150. </span>
  151. <span class="nav-item mr-auto py-<?php echo $navbar_breakpoint; ?>-0">
  152. <a class="nav-link py-<?php echo $navbar_breakpoint; ?>-0" href="action.php?action=signout">
  153. <i class="fas fa-sign-out-alt fa-fw"></i><span>&nbsp;<?php $Strings->get("sign out") ?></span>
  154. </a>
  155. </span>
  156. </div>
  157. </div>
  158. </nav>
  159. <div class="container" id="main-content">
  160. <div>
  161. <?php
  162. include_once __DIR__ . '/pages/' . $pageid . ".php";
  163. ?>
  164. </div>
  165. <div class="footer">
  166. <?php echo FOOTER_TEXT; ?><br />
  167. Copyright &copy; <?php echo date('Y'); ?> <?php echo COPYRIGHT_NAME; ?>
  168. </div>
  169. </div>
  170. <script src="static/js/jquery-3.3.1.min.js"></script>
  171. <script src="static/js/bootstrap.bundle.min.js"></script>
  172. <script src="static/js/app.js"></script>
  173. <?php
  174. // custom page scripts
  175. if (isset(PAGES[$pageid]['scripts'])) {
  176. foreach (PAGES[$pageid]['scripts'] as $script) {
  177. echo "<script src=\"$script\"></script>\n";
  178. header("Link: <$script>; rel=preload; as=script", false);
  179. }
  180. }
  181. ?>
  182. </body>
  183. </html>