Single-sign-on and self-serve account management. https://netsyms.biz/apps/accounthub
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.

home.php 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. if (array_key_exists($_GET['page'], PAGES)) {
  11. $pageid = $_GET['page'];
  12. } else {
  13. $pageid = "404";
  14. }
  15. }
  16. ?>
  17. <!DOCTYPE html>
  18. <html>
  19. <head>
  20. <meta charset="UTF-8">
  21. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  22. <meta name="viewport" contgreent="width=device-width, initial-scale=1">
  23. <title><?php echo SITE_TITLE; ?></title>
  24. <link href="static/css/bootstrap.min.css" rel="stylesheet">
  25. <link href="static/css/font-awesome.min.css" rel="stylesheet">
  26. <link href="static/css/app.css" rel="stylesheet">
  27. </head>
  28. <body>
  29. <div class="container">
  30. <div class="row">
  31. <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">
  32. <img class="img-responsive banner-image" src="static/img/logo.svg" />
  33. </div>
  34. </div>
  35. <nav class="navbar navbar-inverse">
  36. <div class="container-fluid">
  37. <div class="navbar-header">
  38. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
  39. <span class="sr-only">Toggle navigation</span>
  40. <span class="icon-bar"></span>
  41. <span class="icon-bar"></span>
  42. <span class="icon-bar"></span>
  43. </button>
  44. <?php
  45. if (PAGES[$pageid]['title'] == "{DEFAULT}") {
  46. ?>
  47. <span class="navbar-brand">
  48. <?php
  49. lang2("welcome user", ["user" => $_SESSION['realname']]);
  50. ?>
  51. </span>
  52. <?php
  53. } else {
  54. ?>
  55. <a class="navbar-brand" href="home.php?page=home">
  56. <?php
  57. // add breadcrumb thing
  58. lang("home");
  59. echo " <i class=\"fa fa-caret-right\"></i> ";
  60. lang(PAGES[$pageid]['title']);
  61. ?>
  62. </a>
  63. <?php
  64. }
  65. ?>
  66. </div>
  67. <div class="collapse navbar-collapse" id="navbar-collapse">
  68. <ul class="nav navbar-nav">
  69. </ul>
  70. <ul class="nav navbar-nav navbar-right">
  71. <li class="dropdown">
  72. <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>
  73. <ul class="dropdown-menu" role="menu">
  74. <li><a href="home.php?page=security"><i class="fa fa-lock fa-fw"></i> <?php lang("account security") ?></a></li>
  75. <li class="divider"></li>
  76. <li><a href="action.php?action=signout"><i class="fa fa-sign-out fa-fw"></i> <?php lang("sign out") ?></a></li>
  77. </ul>
  78. </li>
  79. </ul>
  80. </div>
  81. </div>
  82. </nav>
  83. <?php
  84. // Alert messages
  85. if (!is_empty($_GET['msg']) && array_key_exists($_GET['msg'], MESSAGES)) {
  86. // optional string generation argument
  87. if (is_empty($_GET['arg'])) {
  88. $alertmsg = lang(MESSAGES[$_GET['msg']]['string'], false);
  89. } else {
  90. $alertmsg = lang2(MESSAGES[$_GET['msg']]['string'], ["arg" => $_GET['arg']], false);
  91. }
  92. $alerttype = MESSAGES[$_GET['msg']]['type'];
  93. $alerticon = "square-o";
  94. switch (MESSAGES[$_GET['msg']]['type']) {
  95. case "danger":
  96. $alerticon = "times";
  97. break;
  98. case "warning":
  99. $alerticon = "exclamation-triangle";
  100. break;
  101. case "info":
  102. $alerticon = "info-circle";
  103. break;
  104. case "success":
  105. $alerticon = "check";
  106. break;
  107. }
  108. echo <<<END
  109. <div class="row">
  110. <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">
  111. <div class="alert alert-dismissible alert-$alerttype">
  112. <button type="button" class="close">&times;</button>
  113. <i class="fa fa-$alerticon"></i> $alertmsg
  114. </div>
  115. </div>
  116. </div>
  117. END;
  118. }
  119. ?>
  120. <div class="row">
  121. <?php
  122. // Center the widgets horizontally on the screen
  123. $appcount = count(APPS[$pageid]);
  124. if ($appcount == 1) {
  125. ?>
  126. <div class="hidden-xs col-sm-3 col-md-4 col-lg-4">
  127. <!-- Empty placeholder column for nice center-align -->
  128. </div>
  129. <?php
  130. } else if ($appcount == 2) {
  131. ?>
  132. <div class="hidden-xs hidden-sm col-md-2 col-lg-2">
  133. <!-- Empty placeholder column for nice center-align -->
  134. </div>
  135. <?php
  136. }
  137. // Load app widgets
  138. foreach (APPS[$pageid] as $app) {
  139. if (file_exists(__DIR__ . "/apps/" . $app . ".php")) {
  140. include_once __DIR__ . "/apps/" . $app . ".php";
  141. $apptitle = $APPS[$app]['title'];
  142. $appicon = (is_empty($APPS[$app]['icon']) ? "" : "fa fa-fw fa-" . $APPS[$app]['icon']);
  143. $apptype = (is_empty($APPS[$app]['type']) ? "default" : $APPS[$app]['type']);
  144. $appcontent = $APPS[$app]['content'];
  145. echo <<<END
  146. <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
  147. <div class="panel panel-$apptype">
  148. <div class="panel-heading">
  149. <h3 class="panel-title"><i class="$appicon"></i> $apptitle </h3>
  150. </div>
  151. <div class="panel-body">
  152. $appcontent
  153. </div>
  154. </div>
  155. </div>
  156. END;
  157. }
  158. }
  159. ?>
  160. </div>
  161. <div class="footer">
  162. <?php echo LICENSE_TEXT; ?><br />
  163. Copyright &copy; <?php echo date('Y'); ?> <?php echo COPYRIGHT_NAME; ?>
  164. </div>
  165. </div>
  166. <script src="static/js/jquery-3.2.1.min.js"></script>
  167. <script src="static/js/bootstrap.min.js"></script>
  168. <script src="static/js/app.js"></script>
  169. </body>
  170. </html>