Merge ../BusinessAppTemplate
This commit is contained in:
commit
ba98534444
52
app.php
52
app.php
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
@ -14,7 +13,7 @@ if ($_SESSION['loggedin'] != true) {
|
|||||||
require_once __DIR__ . "/pages.php";
|
require_once __DIR__ . "/pages.php";
|
||||||
|
|
||||||
$pageid = "home";
|
$pageid = "home";
|
||||||
if (isset($_GET['page']) && !is_empty($_GET['page'])) {
|
if (!empty($_GET['page'])) {
|
||||||
$pg = strtolower($_GET['page']);
|
$pg = strtolower($_GET['page']);
|
||||||
$pg = preg_replace('/[^0-9a-z_]/', "", $pg);
|
$pg = preg_replace('/[^0-9a-z_]/', "", $pg);
|
||||||
if (array_key_exists($pg, PAGES) && file_exists(__DIR__ . "/pages/" . $pg . ".php")) {
|
if (array_key_exists($pg, PAGES) && file_exists(__DIR__ . "/pages/" . $pg . ".php")) {
|
||||||
@ -66,28 +65,35 @@ header("Link: <static/js/bootstrap.bundle.min.js>; rel=preload; as=script", fals
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Alert messages
|
// Alert messages
|
||||||
if (isset($_GET['msg']) && !is_empty($_GET['msg']) && array_key_exists($_GET['msg'], MESSAGES)) {
|
if (!empty($_GET['msg'])) {
|
||||||
// optional string generation argument
|
if (array_key_exists($_GET['msg'], MESSAGES)) {
|
||||||
if (!isset($_GET['arg']) || is_empty($_GET['arg'])) {
|
// optional string generation argument
|
||||||
$alertmsg = $Strings->get(MESSAGES[$_GET['msg']]['string'], false);
|
if (empty($_GET['arg'])) {
|
||||||
|
$alertmsg = $Strings->get(MESSAGES[$_GET['msg']]['string'], false);
|
||||||
|
} else {
|
||||||
|
$alertmsg = $Strings->build(MESSAGES[$_GET['msg']]['string'], ["arg" => strip_tags($_GET['arg'])], false);
|
||||||
|
}
|
||||||
|
$alerttype = MESSAGES[$_GET['msg']]['type'];
|
||||||
|
$alerticon = "square-o";
|
||||||
|
switch (MESSAGES[$_GET['msg']]['type']) {
|
||||||
|
case "danger":
|
||||||
|
$alerticon = "times";
|
||||||
|
break;
|
||||||
|
case "warning":
|
||||||
|
$alerticon = "exclamation-triangle";
|
||||||
|
break;
|
||||||
|
case "info":
|
||||||
|
$alerticon = "info-circle";
|
||||||
|
break;
|
||||||
|
case "success":
|
||||||
|
$alerticon = "check";
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$alertmsg = $Strings->build(MESSAGES[$_GET['msg']]['string'], ["arg" => strip_tags($_GET['arg'])], false);
|
// We don't have a message for this, so just assume an error and escape stuff.
|
||||||
}
|
$alertmsg = htmlentities($Strings->get($_GET['msg'], false));
|
||||||
$alerttype = MESSAGES[$_GET['msg']]['type'];
|
$alerticon = "times";
|
||||||
$alerticon = "square-o";
|
$alerttype = "danger";
|
||||||
switch (MESSAGES[$_GET['msg']]['type']) {
|
|
||||||
case "danger":
|
|
||||||
$alerticon = "times";
|
|
||||||
break;
|
|
||||||
case "warning":
|
|
||||||
$alerticon = "exclamation-triangle";
|
|
||||||
break;
|
|
||||||
case "info":
|
|
||||||
$alerticon = "info-circle";
|
|
||||||
break;
|
|
||||||
case "success":
|
|
||||||
$alerticon = "check";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
echo <<<END
|
echo <<<END
|
||||||
<div class="row justify-content-center" id="msg-alert-box">
|
<div class="row justify-content-center" id="msg-alert-box">
|
||||||
|
@ -47,7 +47,7 @@ if (Login::checkLoginServer()) {
|
|||||||
$username_ok = true;
|
$username_ok = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!is_empty($error)) {
|
if (!empty($error)) {
|
||||||
$alert = $error;
|
$alert = $error;
|
||||||
} else {
|
} else {
|
||||||
$alert = $Strings->get("login error", false);
|
$alert = $Strings->get("login error", false);
|
||||||
|
@ -75,7 +75,7 @@ if (mobile_enabled() !== TRUE) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we have a username and access key
|
// Make sure we have a username and access key
|
||||||
if (is_empty($VARS['username']) || is_empty($VARS['key'])) {
|
if (empty($VARS['username']) || empty($VARS['key'])) {
|
||||||
http_response_code(401);
|
http_response_code(401);
|
||||||
die(json_encode(["status" => "ERROR", "msg" => "Missing username and/or access key."]));
|
die(json_encode(["status" => "ERROR", "msg" => "Missing username and/or access key."]));
|
||||||
}
|
}
|
||||||
|
41
required.php
41
required.php
@ -132,15 +132,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
define("GET", true);
|
define("GET", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a string or whatever is empty.
|
|
||||||
* @param $str The thingy to check
|
|
||||||
* @return boolean True if it's empty or whatever.
|
|
||||||
*/
|
|
||||||
function is_empty($str) {
|
|
||||||
return (is_null($str) || !isset($str) || $str == '');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function dieifnotloggedin() {
|
function dieifnotloggedin() {
|
||||||
if ($_SESSION['loggedin'] != true) {
|
if ($_SESSION['loggedin'] != true) {
|
||||||
@ -165,38 +156,6 @@ function checkDBError($specials = []) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* http://stackoverflow.com/a/20075147
|
|
||||||
*/
|
|
||||||
if (!function_exists('base_url')) {
|
|
||||||
|
|
||||||
function base_url($atRoot = FALSE, $atCore = FALSE, $parse = FALSE) {
|
|
||||||
if (isset($_SERVER['HTTP_HOST'])) {
|
|
||||||
$http = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
|
|
||||||
$hostname = $_SERVER['HTTP_HOST'];
|
|
||||||
$dir = str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
|
|
||||||
|
|
||||||
$core = preg_split('@/@', str_replace($_SERVER['DOCUMENT_ROOT'], '', realpath(dirname(__FILE__))), NULL, PREG_SPLIT_NO_EMPTY);
|
|
||||||
$core = $core[0];
|
|
||||||
|
|
||||||
$tmplt = $atRoot ? ($atCore ? "%s://%s/%s/" : "%s://%s/") : ($atCore ? "%s://%s/%s/" : "%s://%s%s");
|
|
||||||
$end = $atRoot ? ($atCore ? $core : $hostname) : ($atCore ? $core : $dir);
|
|
||||||
$base_url = sprintf($tmplt, $http, $hostname, $end);
|
|
||||||
} else
|
|
||||||
$base_url = 'http://localhost/';
|
|
||||||
|
|
||||||
if ($parse) {
|
|
||||||
$base_url = parse_url($base_url);
|
|
||||||
if (isset($base_url['path']))
|
|
||||||
if ($base_url['path'] == '/')
|
|
||||||
$base_url['path'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $base_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function redirectIfNotLoggedIn() {
|
function redirectIfNotLoggedIn() {
|
||||||
if ($_SESSION['loggedin'] !== TRUE) {
|
if ($_SESSION['loggedin'] !== TRUE) {
|
||||||
header('Location: ' . URL . '/index.php');
|
header('Location: ' . URL . '/index.php');
|
||||||
|
4
static/css/svg-with-js.min.css
vendored
4
static/css/svg-with-js.min.css
vendored
@ -1,5 +1,5 @@
|
|||||||
/*!
|
/*!
|
||||||
* Font Awesome Free 5.3.1 by @fontawesome - https://fontawesome.com
|
* Font Awesome Free 5.6.0 by @fontawesome - https://fontawesome.com
|
||||||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||||
*/
|
*/
|
||||||
.svg-inline--fa,svg:not(:root).svg-inline--fa{overflow:visible}.svg-inline--fa{display:inline-block;font-size:inherit;height:1em;vertical-align:-.125em}.svg-inline--fa.fa-lg{vertical-align:-.225em}.svg-inline--fa.fa-w-1{width:.0625em}.svg-inline--fa.fa-w-2{width:.125em}.svg-inline--fa.fa-w-3{width:.1875em}.svg-inline--fa.fa-w-4{width:.25em}.svg-inline--fa.fa-w-5{width:.3125em}.svg-inline--fa.fa-w-6{width:.375em}.svg-inline--fa.fa-w-7{width:.4375em}.svg-inline--fa.fa-w-8{width:.5em}.svg-inline--fa.fa-w-9{width:.5625em}.svg-inline--fa.fa-w-10{width:.625em}.svg-inline--fa.fa-w-11{width:.6875em}.svg-inline--fa.fa-w-12{width:.75em}.svg-inline--fa.fa-w-13{width:.8125em}.svg-inline--fa.fa-w-14{width:.875em}.svg-inline--fa.fa-w-15{width:.9375em}.svg-inline--fa.fa-w-16{width:1em}.svg-inline--fa.fa-w-17{width:1.0625em}.svg-inline--fa.fa-w-18{width:1.125em}.svg-inline--fa.fa-w-19{width:1.1875em}.svg-inline--fa.fa-w-20{width:1.25em}.svg-inline--fa.fa-pull-left{margin-right:.3em;width:auto}.svg-inline--fa.fa-pull-right{margin-left:.3em;width:auto}.svg-inline--fa.fa-border{height:1.5em}.svg-inline--fa.fa-li{width:2em}.svg-inline--fa.fa-fw{width:1.25em}.fa-layers svg.svg-inline--fa{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.fa-layers{display:inline-block;height:1em;position:relative;text-align:center;vertical-align:-.125em;width:1em}.fa-layers svg.svg-inline--fa{transform-origin:center center}.fa-layers-counter,.fa-layers-text{display:inline-block;position:absolute;text-align:center}.fa-layers-text{left:50%;top:50%;transform:translate(-50%,-50%);transform-origin:center center}.fa-layers-counter{background-color:#ff253a;border-radius:1em;box-sizing:border-box;color:#fff;height:1.5em;line-height:1;max-width:5em;min-width:1.5em;overflow:hidden;padding:.25em;right:0;text-overflow:ellipsis;top:0;transform:scale(.25);transform-origin:top right}.fa-layers-bottom-right{bottom:0;right:0;top:auto;transform:scale(.25);transform-origin:bottom right}.fa-layers-bottom-left{bottom:0;left:0;right:auto;top:auto;transform:scale(.25);transform-origin:bottom left}.fa-layers-top-right{right:0;top:0;transform:scale(.25);transform-origin:top right}.fa-layers-top-left{left:0;right:auto;top:0;transform:scale(.25);transform-origin:top left}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{animation:fa-spin 2s infinite linear}.fa-pulse{animation:fa-spin 1s infinite steps(8)}@keyframes fa-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;position:relative;width:2em}.fa-stack-1x,.fa-stack-2x{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.svg-inline--fa.fa-stack-1x{height:1em;width:1em}.svg-inline--fa.fa-stack-2x{height:2em;width:2em}.fa-inverse{color:#fff}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}
|
.svg-inline--fa,svg:not(:root).svg-inline--fa{overflow:visible}.svg-inline--fa{display:inline-block;font-size:inherit;height:1em;vertical-align:-.125em}.svg-inline--fa.fa-lg{vertical-align:-.225em}.svg-inline--fa.fa-w-1{width:.0625em}.svg-inline--fa.fa-w-2{width:.125em}.svg-inline--fa.fa-w-3{width:.1875em}.svg-inline--fa.fa-w-4{width:.25em}.svg-inline--fa.fa-w-5{width:.3125em}.svg-inline--fa.fa-w-6{width:.375em}.svg-inline--fa.fa-w-7{width:.4375em}.svg-inline--fa.fa-w-8{width:.5em}.svg-inline--fa.fa-w-9{width:.5625em}.svg-inline--fa.fa-w-10{width:.625em}.svg-inline--fa.fa-w-11{width:.6875em}.svg-inline--fa.fa-w-12{width:.75em}.svg-inline--fa.fa-w-13{width:.8125em}.svg-inline--fa.fa-w-14{width:.875em}.svg-inline--fa.fa-w-15{width:.9375em}.svg-inline--fa.fa-w-16{width:1em}.svg-inline--fa.fa-w-17{width:1.0625em}.svg-inline--fa.fa-w-18{width:1.125em}.svg-inline--fa.fa-w-19{width:1.1875em}.svg-inline--fa.fa-w-20{width:1.25em}.svg-inline--fa.fa-pull-left{margin-right:.3em;width:auto}.svg-inline--fa.fa-pull-right{margin-left:.3em;width:auto}.svg-inline--fa.fa-border{height:1.5em}.svg-inline--fa.fa-li{width:2em}.svg-inline--fa.fa-fw{width:1.25em}.fa-layers svg.svg-inline--fa{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.fa-layers{display:inline-block;height:1em;position:relative;text-align:center;vertical-align:-.125em;width:1em}.fa-layers svg.svg-inline--fa{transform-origin:center center}.fa-layers-counter,.fa-layers-text{display:inline-block;position:absolute;text-align:center}.fa-layers-text{left:50%;top:50%;transform:translate(-50%,-50%);transform-origin:center center}.fa-layers-counter{background-color:#ff253a;border-radius:1em;box-sizing:border-box;color:#fff;height:1.5em;line-height:1;max-width:5em;min-width:1.5em;overflow:hidden;padding:.25em;right:0;text-overflow:ellipsis;top:0;transform:scale(.25);transform-origin:top right}.fa-layers-bottom-right{bottom:0;right:0;top:auto;transform:scale(.25);transform-origin:bottom right}.fa-layers-bottom-left{bottom:0;left:0;right:auto;top:auto;transform:scale(.25);transform-origin:bottom left}.fa-layers-top-right{right:0;top:0;transform:scale(.25);transform-origin:top right}.fa-layers-top-left{left:0;right:auto;top:0;transform:scale(.25);transform-origin:top left}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{animation:fa-spin 2s infinite linear}.fa-pulse{animation:fa-spin 1s infinite steps(8)}@keyframes fa-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{display:inline-block;height:2em;position:relative;width:2.5em}.fa-stack-1x,.fa-stack-2x{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.svg-inline--fa.fa-stack-1x{height:1em;width:1.25em}.svg-inline--fa.fa-stack-2x{height:2em;width:2.5em}.fa-inverse{color:#fff}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}
|
4
static/js/fontawesome-all.min.js
vendored
4
static/js/fontawesome-all.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user