Compare commits
25 Commits
9dfb60fb9a
...
1.3
| Author | SHA1 | Date | |
|---|---|---|---|
| 97e743407f | |||
| fa3515625b | |||
| f94bafb25d | |||
| b31185c2e9 | |||
| 94f349597d | |||
| 68c9e00afb | |||
| b4f3553f1e | |||
| dec038fc0d | |||
| 97963b34aa | |||
| 30269316b2 | |||
| e1ef2456ea | |||
| 50d6166067 | |||
| ebf44f5152 | |||
| 6682b974a3 | |||
| 433ed86f7e | |||
| 55cc1be52f | |||
| 229d2b4a15 | |||
| e96d6b9a70 | |||
| d781078c0d | |||
| be392b8149 | |||
| 8b742d997c | |||
| 0b76255cfa | |||
| 89ea170798 | |||
| 16be5448be | |||
| 7429cd367d |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
pub/.well-known/security.txt.sig
|
||||
pub/data/devices/*/documents/*
|
||||
pub/data/devices/*/firmware/*
|
||||
.idea/*
|
||||
|
||||
52
pub/.well-known/openpgp.asc
Normal file
52
pub/.well-known/openpgp.asc
Normal file
@@ -0,0 +1,52 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBGoxoXgBEADBpSGILyhWLl5vranPqbVtcReBxeleHArepBBfsbS8GGLXaSjS
|
||||
1kVITSjeg90D4hog7XE+ryyXgYpLugXzUc/FF2Oh0XKN0s64bXd6K8EOrzB9HCz6
|
||||
n8nCk3SctG6TbQPT6i8OS3mNCWslQ2iLU7o9P0UCbB0NO0/m9qp+K3UplWCoMbUd
|
||||
f7qtnP4As+TTHQqiXoqADbLFf4fyJdnJXAa6fD75yWDejz3KIPNvhV/3+VBVcSjo
|
||||
bMhYeriW43fZNRHVrJkQBWhtkwGylOIk8v3Zrlgd2YolmOJQNQKiAI3+r6qy8TXM
|
||||
oqU4ymdXazFm1E9ivxPz17G4k76pfnhw4cZBdPRXVVYXFuqBDbCRB4lnqZjkYHoo
|
||||
N/iYHlCfSZe06dplZ5jW+1hADO663OJHjXRKBKHusBHIYgFHYeoS6866upoymFMz
|
||||
Mq+kdaMZwDQEeAyrDUZ535Qvish6TqGuJVtCveNksL0pKNnWuwKsMKtxQJTXYLth
|
||||
jD8lRfw+4fhnbtvFd7oDCIWY1BRsCR2gZuUul1nuaBEImKdOjyuCA/SOua3Yym9x
|
||||
H1cfJ54tlcQtWprpTG2eNXpMeQkw3CCGeg8JxbrghSgPEIWU2Pz5iVlrDZcyj8rU
|
||||
Zqtt8JXRTb7BlRSBiiNY7R9AeJ6Zu0g9LSiwzvMbZAqBRf9S9eSaNTSjowARAQAB
|
||||
tB1NYXJjbyBNb29paiA8c2VudHJpQG1vb2lqLm1lPokCVwQTAQgAQRYhBJYGP73G
|
||||
HZjbernuF+V8Pv4rstmMBQJqMaF4AhsDBQkDwmcABQsJCAcCAiICBhUKCQgLAgQW
|
||||
AgMBAh4HAheAAAoJEOV8Pv4rstmMfloQALthZY4nWV3OFUnqWvUgjjbvBcbOe6Rp
|
||||
HNGOCFie72OrFbAiU8arH5benwblXOvUtMZHXL73KyVFLd9dnqbUyGaAtN+2wL+1
|
||||
et76RW/dUvT0ILSSjHI595SrWv2XJN7Z6ruEHwzcrzvjhp6sLMu+QX78cHAnbz9S
|
||||
0QGr5jBjsfUE7ty0bJFu4Ex7HMlO1ShJShRxnfV3iwCHlBWzr2wlhkVOayKJxXmO
|
||||
iICpKFsWAQNDNhxu/G/U+CA6S0B1h2g99fiJ5t1bjvwjR1om4aPSljETzaJff0Dr
|
||||
9Jp3ZxzcxA16MFHAOJPB5lRYIMHAbW3YGpIbOVyMFUc/rhL8sCP7nHOfKx448WPQ
|
||||
zuc8/KU77WbRRZgNa8P6nWdLf9gmNKxt1y38OlsYWpH+qfdWsKRh/i1hiJmDwSHR
|
||||
4BsgDBRsZ/ugYaEO9WGxoZdCb/muPO7jjqkieIZq7Lyadu61jW5tzzCrFOtQnzT+
|
||||
DgddhuhwvW/neRnUowRseuheoSCEtz61y72jjbXAw/SQWWG3JX5kBYMLLclOnZ0O
|
||||
huo85pWJKuxzvYuxrbQ0zFIWVQRLaTq7peP//9DubsUihtbl9bxBMAvt7JxyAE8V
|
||||
VHxL+ZDP24Ju7UiZJmcDvgK+P4EiNLd+MN/xHP2WFEIzNiaySyXObI+X7Qr3+/d/
|
||||
O5qcWL/GyS02uQINBGoxoXgBEADGjxwhIsOWcIJCZM+3sDyeO+soH2T0/a8FXKk6
|
||||
4qvJ1KfPhTovkPhDdaKe+iYgP1oP2rRk6Yp4+fjOwVEbCcuKYHD3v8iNwUj8OFiS
|
||||
armVWCg/AYFiPPv5OtJ/U6laMkBCQ2Li6EpTV7BbI+HUhk00yHk7Of1GnYPDWJwB
|
||||
UUdVCd13hGuTBhIlftUUe11MeCzrQBiWEauHiU+/0mToJ+ePEalGaWud7BCg6K9b
|
||||
lAh+I+9KqtfYejBCOGpwxUNXkPp26SM726Nag6hsAWJXFOusEyAOh6NvKcfDkFlP
|
||||
nndRWjfHGfIzBLxBK69DgEMRFA2WmEnCZ/QTDtnFPFg5QUbfxtf2MwHtRswK7Ze5
|
||||
uvqH5Eh7Mik2W8jtwtpgkHz/04uGjth0Ur7SIPyg6pqeP0YPDujIPl70h4PDFLfu
|
||||
fms994Y4FUcdPIIVaSHUxPBqLTsIHdDs9ymucYsWBEKPUg/yqQkXitMLQ+eTYi12
|
||||
ZqnY/XrBHmQI62zljQSbZ6Sga+IHdm0zjEtg0G/3bKbc1n7GDfRZqe3QxkBACXtn
|
||||
HMwy6ea+rWEHng9GjzGXhesfSrUqK7QUJuE5BpkAhSPZIkeu3lM4WnwkCVaKvhDa
|
||||
p/MN9TXG/sJ918NHIiXvwXPndbmx9FHa36QoL/407EKzMAdGU8R593XSJfotVVFH
|
||||
SNqcHQARAQABiQI8BBgBCAAmFiEElgY/vcYdmNt6ue4X5Xw+/iuy2YwFAmoxoXgC
|
||||
GwwFCQPCZwAACgkQ5Xw+/iuy2YxirhAAtikJT72KwXfeBxE4fpkfI+raS0EsVkHo
|
||||
Z7JEDOaPJSS5RzgaV3BmiINctnC6KpteMk2q7HoRzfEmd22lVr5IIpn0ugNCKdQq
|
||||
363SfqzLzNF2Nxyykdy4IB94upN2K/UqXnkk6f/xj7TaXRWw+IIrrg/Il9Ba3xck
|
||||
LPG30i43OgZdoS3Rfl9UzKmnHpOIyCr41XxP3/UXCghE/UE7rFv/ZE6kGhwMccRO
|
||||
L5/EUSGo4I7TpTtJRagCxglk/r54ypBpXZm4WopKKNnA71jfKDnRSmL6v3XR7IS4
|
||||
BGK81MlkpAbG3WQMA9G656YHjcNshge4p81C5je1i4CLZHtbDd4mTROHMm9OeWtN
|
||||
5r4EsC1ZL0RKplXfV8kvvNUa33QOBx8dAO2qJkeaRiDkJhzK7nOa28RQ/FoMtKMw
|
||||
6dmDPzfM7oqizDZHtQ7O2Ik8oNai03VLP9rKcZb63WEmTRVSunqL/KFbWDFMsZCN
|
||||
0av9zhUTu6uC1c4Wh9goOEIdV5qbzBM2Wj46yCnfLz0+YUsXe2BplKuP3AvCeTKG
|
||||
ShXH02LR570z4b/Tddps2r0uAuLB3d1hzaeGOFO2VVBIbkW44Ag+j0rteSOfDHGf
|
||||
Jwvh55GwStzQBZCkPkGYVKaPuljZpe0KeCIsINpMUAniPOriXENGyOHqurTUNJ55
|
||||
Zcn2v7WN+iY=
|
||||
=pjNF
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
8
pub/.well-known/security.txt
Normal file
8
pub/.well-known/security.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Contact: mailto:sentri@mooij.me
|
||||
Expires: 2027-06-14T00:00:00Z
|
||||
|
||||
Encryption: https://sentri.mooij.me/.well-known/openpgp.asc
|
||||
|
||||
Canonical: https://sentri.mooij.me/.well-known/security.txt
|
||||
|
||||
Preferred-Languages: en, nl
|
||||
@@ -1,15 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace api\classes;
|
||||
|
||||
use DateTime;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
class API
|
||||
{
|
||||
public $conn;
|
||||
public $pdo;
|
||||
public mixed $conn;
|
||||
public mixed $pdo;
|
||||
|
||||
# The user uuid that requested the API
|
||||
protected $user_uuid;
|
||||
|
||||
# $user_type is either an API call (api) or an call from the frontend (frontend)
|
||||
# $user_type is either an API call (api) or a call from the frontend (frontend)
|
||||
protected $user_type;
|
||||
|
||||
# Either GET POST PUT or DELETE
|
||||
@@ -18,7 +22,7 @@ class API
|
||||
protected $content_type;
|
||||
|
||||
# The original posted data to the API, this data is NOT sanitized and validated, never use this data for queries!
|
||||
public $postedData;
|
||||
public mixed $postedData;
|
||||
|
||||
# The validated and sanitized data can be uses for the API actions
|
||||
public $data;
|
||||
@@ -29,22 +33,13 @@ class API
|
||||
# The return url that the frontend request will forward to after the api call is done. if set to false it will only output
|
||||
# the json response with an http code. API calls always respond with json. $return_url can be set to supply the form with an input
|
||||
# with the name _return and value of the url to return to.
|
||||
public $return_url;
|
||||
|
||||
# Required fields & optional fields set by the API actions. This is an array like:
|
||||
# Example:
|
||||
# 'user_uuid' => ['type' => 'string', 'min' => 5, 'max' => 36],
|
||||
# 'user_enabled' => ['type' => 'int', 'min' => 0, 'max' => 99],
|
||||
# 'user_active' => ['type' => 'enum', 'values' => ['active', 'inactive', 'banned']],
|
||||
# 'user_email' => ['type' => 'string', 'format' => 'email'],
|
||||
private $requiredFields = [];
|
||||
private $optionalFields = [];
|
||||
public mixed $return_url;
|
||||
|
||||
# Used for the query builder base
|
||||
public $baseQuery = false;
|
||||
|
||||
# Used for the general get function, this prevents SQL injecting by only allowing these columns instead of
|
||||
# Whatever the user inputs straigt into the query.
|
||||
# Whatever the user inputs straight into the query.
|
||||
public $allowedGetColumns = false;
|
||||
|
||||
# Cache the columns of the tables for some small performance improvements.
|
||||
@@ -52,8 +47,8 @@ class API
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/db_connect.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/Functions/globalFunctions.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/db_connect.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Functions/globalFunctions.php";
|
||||
|
||||
# Setup Database connection
|
||||
$this->conn = $GLOBALS['conn'];
|
||||
@@ -97,7 +92,7 @@ class API
|
||||
// When building a frontend page, you can still programmatically construct a builder array
|
||||
// and set it via $_GET like so after the API class creation:
|
||||
// $_GET['builder'] = [1 => ['where' => [0 => 'permission_uuid', 1 => $permission_uuid]]];
|
||||
if ($this->request_method !== 'GET' || $this->user_type === 'frontend') {
|
||||
if ($this->request_method !== 'GET') {
|
||||
$this->disableBuilder();
|
||||
}
|
||||
|
||||
@@ -106,7 +101,7 @@ class API
|
||||
|
||||
}
|
||||
|
||||
private function InitUserTypeFrontend()
|
||||
private function InitUserTypeFrontend(): void
|
||||
{
|
||||
$this->user_uuid = $_SESSION['user']['user_uuid'];
|
||||
$this->user_type = 'frontend';
|
||||
@@ -196,11 +191,9 @@ class API
|
||||
{
|
||||
$inputData = $this->postedData;
|
||||
|
||||
$this->requiredFields = $requiredFields;
|
||||
$this->optionalFields = $optionalFields;
|
||||
$sanitizedData = [];
|
||||
|
||||
foreach ($this->requiredFields as $field => $rules) {
|
||||
foreach ($requiredFields as $field => $rules) {
|
||||
|
||||
if (!array_key_exists($field, $inputData)) {
|
||||
$this->apiOutput(400, ['error' => "Missing required field: $field"]);
|
||||
@@ -217,7 +210,7 @@ class API
|
||||
|
||||
|
||||
// Check optional fields
|
||||
foreach ($this->optionalFields as $field => $rules) {
|
||||
foreach ($optionalFields as $field => $rules) {
|
||||
if (isset($inputData[$field])) {
|
||||
$value = $inputData[$field];
|
||||
|
||||
@@ -273,8 +266,11 @@ class API
|
||||
{
|
||||
switch ($rules['type']) {
|
||||
case 'string':
|
||||
case 'password':
|
||||
case 'html':
|
||||
if (!is_string($value)) return false;
|
||||
return $this->isValidLength($value, $rules);
|
||||
|
||||
case 'slugify':
|
||||
if (!is_string($value) || !preg_match('/^[a-z0-9]+(-[a-z0-9]+)*$/', $value)) return false;
|
||||
return $this->isValidLength($value, $rules);
|
||||
@@ -298,14 +294,6 @@ class API
|
||||
if (!filter_var($value, FILTER_VALIDATE_EMAIL)) return false;
|
||||
return $this->isValidLength($value, $rules);
|
||||
|
||||
case 'password':
|
||||
if (!is_string($value)) return false;
|
||||
return $this->isValidLength($value, $rules);
|
||||
|
||||
case 'html':
|
||||
if (!is_string($value)) return false;
|
||||
return $this->isValidLength($value, $rules);
|
||||
|
||||
case 'int':
|
||||
if (!is_int($value) && !ctype_digit($value)) return false;
|
||||
$value = (int)$value;
|
||||
@@ -340,19 +328,22 @@ class API
|
||||
if (!is_string($value)) return false;
|
||||
return base64_encode(base64_decode($value, true)) === $value;
|
||||
|
||||
case 'uuid':
|
||||
if (!is_string($value)) return false;
|
||||
return preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i', $value);
|
||||
|
||||
case 'json':
|
||||
if (!is_string($value)) return false;
|
||||
json_decode($value);
|
||||
return json_last_error() === JSON_ERROR_NONE;
|
||||
return json_validate($value);
|
||||
|
||||
case 'array':
|
||||
if (!is_array($value)) return false;
|
||||
return $value;
|
||||
|
||||
case 'date':
|
||||
if (!is_string($value)) return false;
|
||||
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) {
|
||||
return false;
|
||||
}
|
||||
[$year, $month, $day] = explode('-', $value);
|
||||
return checkdate((int)$month, (int)$day, (int)$year);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -390,7 +381,7 @@ class API
|
||||
case 'boolean':
|
||||
if (is_string($value)) {
|
||||
$value = strtolower(trim($value));
|
||||
return in_array($value, ['true', '1'], true) ? true : false;
|
||||
return in_array($value, ['true', '1'], true);
|
||||
}
|
||||
|
||||
return (bool)$value;
|
||||
@@ -450,6 +441,8 @@ class API
|
||||
if ($returnBoolean) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function setReturnUrl()
|
||||
@@ -514,8 +507,7 @@ class API
|
||||
return false;
|
||||
}
|
||||
|
||||
json_decode($rawInput, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
if (!json_validate($rawInput)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -573,7 +565,7 @@ class API
|
||||
# api will need to post with an application/json type Content type.
|
||||
# frontend will post with application/x-www-form-urlencoded content type but also is capable of application/json
|
||||
# frontend can also post multipart/form-data
|
||||
# GET requests dont have an content type
|
||||
# GET requests don't have a content type
|
||||
|
||||
$contentType = $_SERVER['CONTENT_TYPE'] ?? '';
|
||||
|
||||
@@ -587,17 +579,17 @@ class API
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strpos($contentType, 'application/json') !== false) {
|
||||
if (str_contains($contentType, 'application/json')) {
|
||||
$this->content_type = 'application/json';
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strpos($contentType, 'application/x-www-form-urlencoded') !== false) {
|
||||
if (str_contains($contentType, 'application/x-www-form-urlencoded')) {
|
||||
$this->content_type = 'application/x-www-form-urlencoded';
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strpos($contentType, 'multipart/form-data') !== false) {
|
||||
if (str_contains($contentType, 'multipart/form-data')) {
|
||||
$this->content_type = 'multipart/form-data';
|
||||
return true;
|
||||
}
|
||||
@@ -610,17 +602,13 @@ class API
|
||||
return $this->user_uuid;
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function apiOutput($code = 200, $data = [], $frontendMessage = false)
|
||||
{
|
||||
if ($this->user_type === 'api') {
|
||||
http_response_code($code);
|
||||
header('Content-Type: application/json');
|
||||
if ($code === 200) {
|
||||
echo json_encode(reset($data));
|
||||
} else {
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -629,10 +617,10 @@ class API
|
||||
if (in_array($this->request_method, ['POST', 'PUT', 'DELETE'])) {
|
||||
http_response_code($code);
|
||||
|
||||
if ($this->return_url) { # sometimes the PUT doesnt need an return or response set (Think of js actions to api from frontend)
|
||||
if ($this->return_url) { # sometimes the PUT doesn't need a return or response set (Think of js actions to api from frontend)
|
||||
$_SESSION['response'] = json_encode($data);
|
||||
|
||||
# When a request is successfull the api will recieve the data, the frontend needs a friendly message
|
||||
# When a request is successfully the api will receive the data, the frontend needs a friendly message
|
||||
if ($frontendMessage) {
|
||||
$_SESSION['response'] = json_encode([key($data) => __($frontendMessage)]);
|
||||
}
|
||||
@@ -658,10 +646,9 @@ class API
|
||||
try {
|
||||
$stmt = $this->conn->prepare($query);
|
||||
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
} catch (\mysqli_sql_exception $e) {
|
||||
// If an error occurs during prepare, catch it and return a proper response
|
||||
$this->apiOutput(500, ['error' => 'Database error: ' . $e->getMessage()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
return $stmt;
|
||||
@@ -675,13 +662,12 @@ class API
|
||||
try {
|
||||
$stmt->execute();
|
||||
return true;
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
} catch (\mysqli_sql_exception $e) {
|
||||
if ($e->getCode() === 1451) {
|
||||
$this->apiOutput(409, ['error' => 'Cannot delete record: dependent data exists.']);
|
||||
} else {
|
||||
$this->apiOutput(500, ['error' => 'Database error: ' . $e->getMessage()]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,6 +686,12 @@ class API
|
||||
}
|
||||
}
|
||||
|
||||
protected function isValidDate(string $date): bool
|
||||
{
|
||||
$dt = DateTime::createFromFormat('Y-m-d', $date);
|
||||
return $dt && $dt->format('Y-m-d') === $date;
|
||||
}
|
||||
|
||||
protected function buildDynamicQuery(string $tableName): array
|
||||
{
|
||||
$this->allowedGetColumns = $this->loadTableColumns($tableName);
|
||||
@@ -717,7 +709,9 @@ class API
|
||||
}
|
||||
|
||||
foreach ($_GET['builder'] as $builder) {
|
||||
if (!isset($builder['where']) || !is_array($builder['where']) || count($builder['where']) !== 2) {
|
||||
if (isset($builder['where']) && is_array($builder['where'])) {
|
||||
|
||||
if (count($builder['where']) !== 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -725,7 +719,7 @@ class API
|
||||
$value = $builder['where'][1];
|
||||
|
||||
if (!in_array($column, $this->allowedGetColumns, true)) {
|
||||
$this->apiOutput(400, ['error' => 'The column ' . $column . ' is not allowed.']);
|
||||
$this->apiOutput(400, ['error' => "The column $column is not allowed."]);
|
||||
}
|
||||
|
||||
$whereClauses[] = "$column = ?";
|
||||
@@ -733,6 +727,32 @@ class API
|
||||
$values[] = $value;
|
||||
}
|
||||
|
||||
// BETWEEN (for DATE / range fields)
|
||||
if (isset($builder['between']) && is_array($builder['between'])) {
|
||||
|
||||
if (count($builder['between']) !== 3) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$column = $builder['between'][0];
|
||||
$from = $builder['between'][1];
|
||||
$to = $builder['between'][2];
|
||||
|
||||
if (!in_array($column, $this->allowedGetColumns, true)) {
|
||||
$this->apiOutput(400, ['error' => "The column $column is not allowed."]);
|
||||
}
|
||||
|
||||
if (!$this->isValidDate($from) || !$this->isValidDate($to)) {
|
||||
$this->apiOutput(400, ['error' => "Invalid date format for BETWEEN."]);
|
||||
}
|
||||
|
||||
$whereClauses[] = "$column BETWEEN ? AND ?";
|
||||
$types .= 'ss';
|
||||
$values[] = $from;
|
||||
$values[] = $to;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($whereClauses)) {
|
||||
$this->baseQuery .= " WHERE " . implode(" AND ", $whereClauses);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use api\classes\API_users;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
@@ -37,7 +38,7 @@ class API_apitoken extends API
|
||||
|
||||
public function checkTokenPermissions()
|
||||
{
|
||||
# First we need to find to what user the api_token belongs to if its not given.
|
||||
# First we need to find to what user the api_token belongs to if it's not given.
|
||||
# If the user_uuid is unknown, get the user_uuid based on the api_token_being.
|
||||
if (!$this->data['user_uuid']) {
|
||||
$_GET['builder'] = [1 => ['where' => [0 => 'api_token_uuid', 1 => $this->data['api_token_uuid']]]];
|
||||
@@ -66,6 +67,7 @@ class API_apitoken extends API
|
||||
}
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function createNewToken()
|
||||
{
|
||||
|
||||
@@ -144,7 +146,7 @@ class API_apitoken extends API
|
||||
$stmt->bind_param('is', $api_token_revoked, $this->data['api_token_uuid']);
|
||||
|
||||
if ($this->executeStatement($stmt)) {
|
||||
$this->apiOutput(200, ['success' => 'API token ' . ($api_token_revoked ? 're' : 'en') . 'voked successfully.']);
|
||||
$this->apiOutput(200, ['success' => 'API token ' . ($api_token_revoked ? 'revoked' : 'envoked') . ' successfully.']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ require_once 'API.php';
|
||||
|
||||
class API_companies extends API
|
||||
{
|
||||
public function updateCompanyState()
|
||||
public function updateCompanyState(): void
|
||||
{
|
||||
$query = "UPDATE companies SET company_state = ? WHERE company_uuid = ?";
|
||||
$stmt = $this->prepareStatement($query);
|
||||
@@ -17,4 +17,13 @@ class API_companies extends API
|
||||
$this->apiOutput(200, ['success' => 'company state successfully updated']);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCompanies(): array
|
||||
{
|
||||
list($query, $types, $params) = $this->buildDynamicQuery('companies');
|
||||
|
||||
$items = $this->generalGetFunction($query, $types, $params, false, 'Companies');
|
||||
|
||||
return ($items);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use api\classes\imageProcessor;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
@@ -36,13 +37,14 @@ class API_devices extends API
|
||||
$imageProcessor->imageRestrictions = $imageRestrictions;
|
||||
$imageProcessor->validateAndProcess();
|
||||
$ImageData = $imageProcessor->returnBase64image();
|
||||
} catch (Exception $e) {
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->apiOutput(401, ['error' => 'Error: ' . $e->getMessage()]);
|
||||
}
|
||||
|
||||
return $ImageData;
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function createDevice()
|
||||
{
|
||||
|
||||
@@ -108,6 +110,7 @@ class API_devices extends API
|
||||
}
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function deleteDevice()
|
||||
{
|
||||
# check if the device exists
|
||||
|
||||
@@ -3,19 +3,20 @@
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
class API_inserve extends API
|
||||
{
|
||||
|
||||
private $inserve_url;
|
||||
private string $inserve_url;
|
||||
|
||||
private $inserve_token;
|
||||
private string $inserve_token;
|
||||
|
||||
public $inserve_source_uuid;
|
||||
public string $inserve_source_uuid;
|
||||
|
||||
public $inserve_custom_data;
|
||||
public array $inserve_custom_data;
|
||||
|
||||
private $ch;
|
||||
|
||||
@@ -23,7 +24,7 @@ class API_inserve extends API
|
||||
|
||||
public $response = false;
|
||||
|
||||
private $cloudDistrubutor = false;
|
||||
private $cloudDistributor = false;
|
||||
|
||||
public function setupConnection()
|
||||
{
|
||||
@@ -44,11 +45,6 @@ class API_inserve extends API
|
||||
curl_close($this->ch);
|
||||
}
|
||||
|
||||
public function returnResponse()
|
||||
{
|
||||
$this->apiOutput($this->httpCode, json_decode($this->response, true));
|
||||
}
|
||||
|
||||
public function authMe()
|
||||
{
|
||||
$this->ch = curl_init($this->inserve_url . 'auth/me');
|
||||
@@ -60,18 +56,19 @@ class API_inserve extends API
|
||||
]
|
||||
]);
|
||||
$this->execCurl();
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getLinkedCompanies()
|
||||
{
|
||||
# init the clouddistrubutor name
|
||||
if (!isset($this->inserve_custom_data['clouddistrubutor']) || $this->inserve_custom_data['clouddistrubutor'] === '') {
|
||||
$this->apiOutput(400, ['error' => 'missing clouddistrubutor in custom source data']);
|
||||
# init the cloudDistributor name
|
||||
if (!isset($this->inserve_custom_data['cloudDistributor']) || $this->inserve_custom_data['cloudDistributor'] === '') {
|
||||
$this->apiOutput(400, ['error' => 'missing cloudDistributor in custom source data']);
|
||||
} else {
|
||||
$this->cloudDistrubutor = $this->inserve_custom_data['clouddistrubutor'];
|
||||
$this->cloudDistributor = $this->inserve_custom_data['cloudDistributor'];
|
||||
}
|
||||
|
||||
$this->ch = curl_init($this->inserve_url . 'cloud-distributors/' . $this->cloudDistrubutor . '/companies');
|
||||
$this->ch = curl_init($this->inserve_url . 'cloud-distributors/' . $this->cloudDistributor . '/companies');
|
||||
curl_setopt_array($this->ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => [
|
||||
@@ -128,11 +125,12 @@ class API_inserve extends API
|
||||
|
||||
public function syncCompaniesFromSentri()
|
||||
{
|
||||
# init the clouddistrubutor name
|
||||
if (!isset($this->inserve_custom_data['clouddistrubutor']) || $this->inserve_custom_data['clouddistrubutor'] === '') {
|
||||
$this->apiOutput(400, ['error' => 'missing clouddistrubutor in custom source data']);
|
||||
# init the cloudDistributor name
|
||||
|
||||
if (!isset($this->inserve_custom_data['cloudDistributor']) || $this->inserve_custom_data['cloudDistributor'] === '') {
|
||||
$this->apiOutput(400, ['error' => 'missing cloudDistributor in custom source data']);
|
||||
} else {
|
||||
$this->cloudDistrubutor = $this->inserve_custom_data['clouddistrubutor'];
|
||||
$this->cloudDistributor = $this->inserve_custom_data['cloudDistributor'];
|
||||
}
|
||||
|
||||
# First retrieve all the active companies to sync to the Inserve cloud distributor
|
||||
@@ -148,7 +146,7 @@ class API_inserve extends API
|
||||
];
|
||||
}
|
||||
|
||||
$url = $this->inserve_url . 'cloud-distributors/' . $this->cloudDistrubutor . '/companies';
|
||||
$url = $this->inserve_url . 'cloud-distributors/' . $this->cloudDistributor . '/companies';
|
||||
|
||||
$this->ch = curl_init($url);
|
||||
|
||||
@@ -246,7 +244,7 @@ class API_inserve extends API
|
||||
];
|
||||
|
||||
if (!in_array($type, $allowedColumns, true)) {
|
||||
throw new Exception('Invalid column name');
|
||||
throw new \RuntimeException('Invalid column name');
|
||||
}
|
||||
|
||||
$query = "SELECT `$type` FROM servers";
|
||||
@@ -256,7 +254,7 @@ class API_inserve extends API
|
||||
|
||||
$servers = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
array_push($servers, $row);
|
||||
$servers[] = $row;
|
||||
}
|
||||
|
||||
$allTypes = [];
|
||||
@@ -430,7 +428,7 @@ class API_inserve extends API
|
||||
$item['subscriptionInserveCompanyId'] = $inserveLookup[$item['md5']]['cloud_distribution_company_id'];
|
||||
$item['subscriptionInserveName'] = $inserveLookup[$item['md5']]['name'];
|
||||
//$item['subscriptionInserveStatus'] = $inserveLookup[$item['md5']]['status'];
|
||||
} else { # Subscription does not exists in Inserve
|
||||
} else { # Subscription does not exist in Inserve
|
||||
$item['sentriCompanyId'] = (int)$allCompaniesIds[$row['company_source_id']] ?? 0;
|
||||
$item['subscriptionInserveExists'] = false;
|
||||
$item['subscriptionInserveId'] = false;
|
||||
@@ -451,15 +449,15 @@ class API_inserve extends API
|
||||
$namePart = substr($key, 7, -6);
|
||||
$namePart = ucfirst($namePart);
|
||||
} // Handle keys with "."
|
||||
elseif (strpos($key, '.') !== false) {
|
||||
elseif (str_contains($key, '.')) {
|
||||
[$first, $second] = explode('.', $key, 2);
|
||||
if ($first === $second || strtolower($second) === 'yes') {
|
||||
$namePart = ucfirst($first);
|
||||
} else {
|
||||
$namePart = ucfirst($first) . ' - ' . $second;
|
||||
}
|
||||
} //Handle keys without . but with a space (expmale directadmin.Standard Discounted)
|
||||
elseif (strpos($key, ' ') !== false) {
|
||||
} //Handle keys without . but with a space (example directadmin.Standard Discounted)
|
||||
elseif (str_contains($key, ' ')) {
|
||||
// explode on first .
|
||||
$parts = explode('.', $key, 2);
|
||||
if (count($parts) === 2) {
|
||||
@@ -477,7 +475,6 @@ class API_inserve extends API
|
||||
}
|
||||
unset($item);
|
||||
|
||||
|
||||
foreach ($subscriptionCounts as $key => $item) {
|
||||
// if subscriptionInserveExists but the countInserve is null skip creation
|
||||
if ($item['subscriptionInserveExists'] === false && (int)$item['countSentri'] === 0) {
|
||||
@@ -487,13 +484,14 @@ class API_inserve extends API
|
||||
// if subscriptionInserveExists is false create a new subscription
|
||||
if ($item['subscriptionInserveExists'] === false) {
|
||||
$payload = [
|
||||
"cloud_distribution_id" => $item['md5'], #md5 hash based on the server_uuid from sentri and the subscription name (eg. server_cpu_count)
|
||||
"cloud_distribution_id" => $item['md5'], #md5 hash based on the server_uuid from sentri and the subscription name (e.g. server_cpu_count)
|
||||
"cloud_subscription_id" => "sentri-servers", # Mark all the sentri-servers subscriptions so we can filter the subscriptions better
|
||||
"name" => $item['subscriptionSentriName'],
|
||||
"quantity" => ($row['server_state'] === 'deleted') ? 0 : $item['countSentri'],
|
||||
"cloud_distributor" => $this->cloudDistributor,
|
||||
"cloud_distribution_company_id" => $item['sentriCompanyId'], # this is generated by inserve
|
||||
"status" => $item['SentriStatus'],
|
||||
"period_type" => 0, # 0 = monthly, 1 = anual, 2 = one time cost
|
||||
"period_type" => 0, # 0 = monthly, 1 = annual, 2 = one time cost
|
||||
"start_date" => date('Y-m-d')
|
||||
];
|
||||
|
||||
@@ -502,8 +500,8 @@ class API_inserve extends API
|
||||
continue;
|
||||
}
|
||||
|
||||
// update the subscription if the countInserve and countSentri dont match
|
||||
// Or when sentriCompanyId and subscriptionInserveCompanyId dont match
|
||||
// update the subscription if the countInserve and countSentri don't match
|
||||
// Or when sentriCompanyId and subscriptionInserveCompanyId don't match
|
||||
if ((
|
||||
(int)$item['countInserve'] !== (int)$item['countSentri'] ||
|
||||
(int)$item['sentriCompanyId'] !== (int)$item['subscriptionInserveCompanyId'] ||
|
||||
@@ -513,16 +511,15 @@ class API_inserve extends API
|
||||
&& $item['subscriptionInserveExists'] !== false
|
||||
) {
|
||||
$payload = [
|
||||
"quantity" => (int)$item['countSentri'],
|
||||
"quantity" => ($row['server_state'] === 'deleted') ? 0 : $item['countSentri'],
|
||||
"cloud_distributor" => $this->cloudDistributor,
|
||||
"cloud_distribution_company_id" => (int)$item['sentriCompanyId'],
|
||||
"name" => $item['subscriptionSentriName'],
|
||||
"status" => $item['SentriStatus'],
|
||||
"quantity" => ($row['server_state'] === 'deleted') ? 0 : $item['countSentri']
|
||||
"status" => $item['SentriStatus']
|
||||
];
|
||||
|
||||
$this->updateCloudSubscription($item['subscriptionInserveId'], $payload);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -670,7 +667,6 @@ class API_inserve extends API
|
||||
$subscriptionId = $subscriptionFound;
|
||||
$existingLines = [];
|
||||
$missingLines = [];
|
||||
$subscriptionLines = [];
|
||||
|
||||
# Get the subscription lines from the specific subscriptionId
|
||||
$this->getSubscriptionsLines($subscriptionId);
|
||||
@@ -680,7 +676,7 @@ class API_inserve extends API
|
||||
$existingLines[$item['product_code']] = $item;
|
||||
}
|
||||
|
||||
# Check if there are products that dont exists yet or have different descriptions
|
||||
# Check if there are products that don't exist yet or have different descriptions
|
||||
foreach ($subscriptionLines['lines'] as $subscriptionLine) {
|
||||
$product_code = $subscriptionLine['product_code'];
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
class API_mfa extends API
|
||||
{
|
||||
#[NoReturn]
|
||||
public function disableMFA()
|
||||
{
|
||||
# Users cannot, by default disable MFA of other users
|
||||
@@ -23,6 +25,7 @@ class API_mfa extends API
|
||||
$this->apiOutput(200, ['success' => 'mfa is disabled']);
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function enableMFA()
|
||||
{
|
||||
# Users cannot, create MFA of other users
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
class API_office_stompjes extends API
|
||||
{
|
||||
#[NoReturn]
|
||||
public function addStomp()
|
||||
{
|
||||
$query = "INSERT INTO office_stompjes (stomp_uuid, user_uuid, stomp_timestamp) VALUES (UUID(), ?, ?)";
|
||||
@@ -19,6 +21,7 @@ class API_office_stompjes extends API
|
||||
$this->apiOutput(200, ['success' => 'Stomp added.']);
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function deleteStomp()
|
||||
{
|
||||
$query = "DELETE FROM office_stompjes WHERE stomp_uuid = ?";
|
||||
@@ -30,12 +33,41 @@ class API_office_stompjes extends API
|
||||
$this->apiOutput(200, ['success' => 'Stomp removed.']);
|
||||
}
|
||||
|
||||
public function getStomp()
|
||||
public function getStomp($frontend = false)
|
||||
{
|
||||
if (!$frontend) {
|
||||
list($query, $types, $params) = $this->buildDynamicQuery('office_stompjes');
|
||||
|
||||
$items = $this->generalGetFunction($query, $types, $params, false, 'Stompjes');
|
||||
|
||||
return ($items);
|
||||
|
||||
} else {
|
||||
if (!isset($_GET['fd'])) {
|
||||
$SelectFromDate = strtotime(date('Y-m-01'));
|
||||
} else {
|
||||
$date = str_replace('/', '-', htmlspecialchars($_GET['fd'], ENT_QUOTES, 'UTF-8'));
|
||||
$SelectFromDate = strtotime($date . ' 00:00:00');
|
||||
}
|
||||
|
||||
if (!isset($_GET['td'])) {
|
||||
$SelectTillDate = time();
|
||||
} else {
|
||||
$date = str_replace('/', '-', htmlspecialchars($_GET['td'], ENT_QUOTES, 'UTF-8'));
|
||||
$SelectTillDate = strtotime($date . ' 23:59:59');
|
||||
}
|
||||
$stompjes = [];
|
||||
$stmt = $this->conn->query("SELECT stomp_uuid, office_stompjes.user_uuid, user_full_name, user_first_name, stomp_timestamp
|
||||
FROM office_stompjes
|
||||
INNER JOIN system_users ON office_stompjes.user_uuid = system_users.user_uuid
|
||||
WHERE stomp_timestamp BETWEEN '$SelectFromDate' AND '$SelectTillDate'
|
||||
AND user_stompable = '1'
|
||||
ORDER BY stomp_timestamp DESC");
|
||||
while ($row = $stmt->fetch_assoc()) {
|
||||
$stompjes[] = $row;
|
||||
}
|
||||
|
||||
return $stompjes;
|
||||
}
|
||||
}
|
||||
}
|
||||
154
pub/api/classes/API_office_travel_reimburse.php
Normal file
154
pub/api/classes/API_office_travel_reimburse.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
use PDO;
|
||||
use api\classes\API_companies;
|
||||
|
||||
require_once 'API.php';
|
||||
require_once 'API_companies.php';
|
||||
|
||||
class API_office_travel_reimburse extends API
|
||||
{
|
||||
#[NoReturn]
|
||||
public function createTravelReimburse(): void
|
||||
{
|
||||
$query = " INSERT INTO office_travelreimburse (
|
||||
reimburse_uuid,
|
||||
user_uuid,
|
||||
departure_postcode,
|
||||
destination_postcode,
|
||||
travel_distance,
|
||||
travel_description,
|
||||
travel_date,
|
||||
office_travelreimburse_company_uuid,
|
||||
office_travelreimburse_company_name,
|
||||
homework
|
||||
)
|
||||
VALUES (UUID(),
|
||||
:user_uuid,
|
||||
:departure_postcode,
|
||||
:destination_postcode,
|
||||
:travel_distance,
|
||||
:travel_description,
|
||||
:travel_date,
|
||||
:office_travelreimburse_company_uuid,
|
||||
:office_travelreimburse_company_name,
|
||||
:homework
|
||||
)";
|
||||
|
||||
$stmt = $this->pdo->prepare($query);
|
||||
|
||||
$stmt->bindValue(':user_uuid', $this->data['user_uuid']);
|
||||
$stmt->bindValue(':departure_postcode', $this->data['departure_postcode']);
|
||||
$stmt->bindValue(':destination_postcode', $this->data['destination_postcode']);
|
||||
$stmt->bindValue(':travel_distance', $this->data['travel_distance']);
|
||||
$stmt->bindValue(':travel_date', $this->data['travel_date']);
|
||||
$stmt->bindValue(':office_travelreimburse_company_uuid', $this->data['office_travelreimburse_company_uuid']);
|
||||
$stmt->bindValue(':office_travelreimburse_company_name', $this->data['office_travelreimburse_company_name']);
|
||||
$stmt->bindValue(':homework', $this->data['homework']);
|
||||
|
||||
// Optional fields
|
||||
$stmt->bindValue(':travel_description', $this->data['travel_description'] ?? null, $this->data['travel_description'] ?? null ? PDO::PARAM_STR : PDO::PARAM_NULL);
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
$this->apiOutput(200, ['success' => 'Travel reimburse added.']);
|
||||
}
|
||||
|
||||
public function getTravelReimburse(): array
|
||||
{
|
||||
list($query, $types, $params) = $this->buildDynamicQuery('office_travelreimburse');
|
||||
|
||||
$items = $this->generalGetFunction($query, $types, $params, false, 'TravelReimburse');
|
||||
|
||||
return ($items);
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function updateTravelReimburse(): void
|
||||
{
|
||||
$query = "UPDATE office_travelreimburse SET
|
||||
user_uuid = :user_uuid,
|
||||
departure_postcode = :departure_postcode,
|
||||
destination_postcode = :destination_postcode,
|
||||
travel_date = :travel_date,
|
||||
travel_distance = :travel_distance,
|
||||
travel_description = :travel_description,
|
||||
office_travelreimburse_company_uuid = :office_travelreimburse_company_uuid,
|
||||
office_travelreimburse_company_name = :office_travelreimburse_company_name,
|
||||
homework = :homework
|
||||
WHERE reimburse_uuid = :reimburse_uuid";
|
||||
|
||||
$stmt = $this->pdo->prepare($query);
|
||||
|
||||
$stmt->bindValue(':reimburse_uuid', $this->data['reimburse_uuid'], PDO::PARAM_STR);
|
||||
$stmt->bindValue(':user_uuid', $this->data['user_uuid'], PDO::PARAM_STR);
|
||||
$stmt->bindValue(':departure_postcode', $this->data['departure_postcode'], PDO::PARAM_STR);
|
||||
$stmt->bindValue(':destination_postcode', $this->data['destination_postcode'], PDO::PARAM_STR);
|
||||
$stmt->bindValue(':travel_date', $this->data['travel_date'], PDO::PARAM_STR);
|
||||
$stmt->bindValue(':travel_distance', $this->data['travel_distance'], PDO::PARAM_INT);
|
||||
$stmt->bindValue(':office_travelreimburse_company_uuid', $this->data['office_travelreimburse_company_uuid'], PDO::PARAM_STR);
|
||||
$stmt->bindValue(':office_travelreimburse_company_name', $this->data['office_travelreimburse_company_name'], PDO::PARAM_STR);
|
||||
$stmt->bindValue(':homework', $this->data['homework'], PDO::PARAM_BOOL);
|
||||
|
||||
// Optional fields
|
||||
$stmt->bindValue(':travel_description', $this->data['travel_description'] ?? null, isset($this->data['travel_description']) && $this->data['travel_description'] !== null ? PDO::PARAM_STR : PDO::PARAM_NULL);
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() === 0) {
|
||||
$check = $this->pdo->prepare(
|
||||
"SELECT 1 FROM office_travelreimburse WHERE reimburse_uuid = :uuid"
|
||||
);
|
||||
$check->execute([
|
||||
':uuid' => $this->data['reimburse_uuid']
|
||||
]);
|
||||
|
||||
if (!$check->fetchColumn()) {
|
||||
$this->apiOutput(404, ['error' => 'Travel reimbursement not found.']);
|
||||
}
|
||||
}
|
||||
|
||||
$this->apiOutput(200, ['success' => 'Travel reimbursement updated.']);
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function deleteTravelReimburse(): void
|
||||
{
|
||||
$query = "DELETE FROM office_travelreimburse WHERE reimburse_uuid = ? AND user_uuid = ?";
|
||||
$stmt = $this->prepareStatement($query);
|
||||
$stmt->bind_param('ss', $this->data['reimburse_uuid'], $_SESSION['user']['user_uuid']);
|
||||
$this->executeStatement($stmt);
|
||||
|
||||
if ($stmt->affected_rows === 0) {
|
||||
$stmt->close();
|
||||
$this->apiOutput(403, ['error' => 'Travel reimbursement not found or you do not have permission to delete it.']);
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
|
||||
$this->apiOutput(200, ['success' => 'Travel reimburse removed.']);
|
||||
}
|
||||
|
||||
public function setTravelReimburseCompany(): void
|
||||
{
|
||||
$API_companies = new API_companies();
|
||||
if (!empty($GLOBALS['modules_enabled']['customers'])) {
|
||||
|
||||
$companies = $API_companies->getCompanies();
|
||||
|
||||
$companyUuid = $this->postedData['office_travelreimburse_company_uuid'] ?? null;
|
||||
if ($companyUuid) {
|
||||
foreach ($companies as $company) {
|
||||
if ($company['company_uuid'] === $companyUuid) {
|
||||
$this->postedData['office_travelreimburse_company_name'] = $company['company_name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
@@ -27,6 +28,7 @@ class API_permissions extends API
|
||||
}
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function createPermission()
|
||||
{
|
||||
# Check if permission slugify already exists
|
||||
@@ -53,7 +55,7 @@ class API_permissions extends API
|
||||
$sql = "SELECT * FROM system_user_groups";
|
||||
$stmt = $this->conn->query($sql);
|
||||
while ($user_group = $stmt->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$user_groups[] = $user_group;
|
||||
}
|
||||
|
||||
# Update all the groups with the newly added permission
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
@@ -18,6 +19,7 @@ class API_platforms extends API
|
||||
}
|
||||
|
||||
|
||||
#[NoReturn]
|
||||
public function createPlatforms()
|
||||
{
|
||||
if (isset($this->data['platform_image'])) {
|
||||
|
||||
@@ -28,4 +28,28 @@ class API_portalsettings extends API
|
||||
|
||||
return ($items);
|
||||
}
|
||||
|
||||
public function updatePortalSettingsOfficeTravelReimburse()
|
||||
{
|
||||
$setParts = [
|
||||
'office_travelreimburse_cents_homework_incl = :homework_incl',
|
||||
'office_travelreimburse_cents_homework_excl = :homework_excl',
|
||||
'office_travelreimburse_cents_business_incl = :business_incl',
|
||||
'office_travelreimburse_cents_business_excl = :business_excl',
|
||||
];
|
||||
|
||||
$params = [
|
||||
':homework_incl' => $this->data['office_travelreimburse_cents_homework_incl'],
|
||||
':homework_excl' => $this->data['office_travelreimburse_cents_homework_excl'],
|
||||
':business_incl' => $this->data['office_travelreimburse_cents_business_incl'],
|
||||
':business_excl' => $this->data['office_travelreimburse_cents_business_excl'],
|
||||
':portal_uuid' => $this->data['portal_uuid'],
|
||||
];
|
||||
|
||||
$query = "UPDATE system_settings SET " . implode(", ", $setParts) . "
|
||||
WHERE portal_uuid = :portal_uuid";
|
||||
|
||||
$stmt = $this->pdo->prepare($query);
|
||||
$stmt->execute($params);
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class API_servers extends API
|
||||
VALUES (" . implode(',', $insertValues) . ")
|
||||
ON DUPLICATE KEY UPDATE ";
|
||||
|
||||
# Build the ON DUPLICATE KEY UPDATE, only foor fields that exist
|
||||
# Build the ON DUPLICATE KEY UPDATE, only for fields that exist
|
||||
$updateParts = [];
|
||||
foreach ($insertFields as $field) {
|
||||
if (!in_array($field, ['server_create_timestamp', 'server_uuid'])) {
|
||||
@@ -241,7 +241,7 @@ class API_servers extends API
|
||||
|
||||
public function processServerData($server, $requiredFields, $optionalFields)
|
||||
{
|
||||
// since the disk data is sent as an array we need to check it seperatly from the other data validations
|
||||
// since the disk data is sent as an array we need to check it separately from the other data validations
|
||||
|
||||
if (!empty($server['server_disks']) && is_array($server['server_disks'])) {
|
||||
$server['server_disks'] = $this->validateDiskData($server['server_disks']);
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
class API_system_sources extends API
|
||||
{
|
||||
#[NoReturn]
|
||||
public function inserveUpdate()
|
||||
{
|
||||
$query = "INSERT INTO system_sources (
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
@@ -17,6 +18,7 @@ class API_usergroups extends API
|
||||
return $items;
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function createUsergroups()
|
||||
{
|
||||
# check if the user_group already exists
|
||||
@@ -25,7 +27,7 @@ class API_usergroups extends API
|
||||
if ($this->getUsergroup(true)) {
|
||||
$this->apiOutput(409, ['error' => 'Usergroup already exists.']);
|
||||
}
|
||||
$this->baseQuery = ''; # reset the base query set $_GET['builder]
|
||||
$this->baseQuery = ''; # reset the base query set $_GET['builder']
|
||||
|
||||
$this->data['user_group_weight'] = $this->get_next_available_user_group_weight($this->data['user_group_weight']);
|
||||
|
||||
@@ -70,6 +72,7 @@ class API_usergroups extends API
|
||||
}
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function deleteUsergroup()
|
||||
{
|
||||
# check if the user group exists
|
||||
@@ -77,7 +80,7 @@ class API_usergroups extends API
|
||||
$user_group = $this->getUsergroup();
|
||||
|
||||
# superuser cannot be deleted
|
||||
if ($user_group[0]['user_group_slufigy'] === 'superuser') {
|
||||
if ($user_group[0]['user_group_slugify'] === 'superuser') {
|
||||
$this->apiOutput(400, ['error' => 'superuser cannot be deleted.']);
|
||||
}
|
||||
|
||||
@@ -113,6 +116,7 @@ class API_usergroups extends API
|
||||
return $weight;
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function updateUserGroup()
|
||||
{
|
||||
# check if the user group exists
|
||||
@@ -120,7 +124,7 @@ class API_usergroups extends API
|
||||
$user_group = $this->getUsergroup();
|
||||
|
||||
# superuser cannot be modified
|
||||
if ($user_group[0]['user_group_slufigy'] === 'superuser') {
|
||||
if ($user_group[0]['user_group_slugify'] === 'superuser') {
|
||||
$this->apiOutput(500, ['error' => 'superuser cannot be modified']);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@ namespace api\classes;
|
||||
use api\classes\API;
|
||||
use api\classes\API_usergroups;
|
||||
use bin\php\Classes\mailBuilder;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/mailBuilder.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/mailBuilder.php";
|
||||
|
||||
class API_users extends API
|
||||
{
|
||||
@@ -20,6 +21,7 @@ class API_users extends API
|
||||
return $items;
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function createUser()
|
||||
{
|
||||
# check if the user already exists
|
||||
@@ -102,6 +104,7 @@ The Sentri gnomes';
|
||||
return $API_usergroups->getUserGroup()[0]['user_group_weight'];
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function updateUser()
|
||||
{
|
||||
# check if the user exists
|
||||
@@ -133,18 +136,19 @@ The Sentri gnomes';
|
||||
$this->apiOutput(200, ['success' => 'User successfully updated.']);
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function deleteUser()
|
||||
{
|
||||
# delete an user
|
||||
|
||||
# chect if the user exists
|
||||
# check if the user exists
|
||||
$_GET['builder'] = [1 => ['where' => [0 => 'user_uuid', 1 => $this->data['user_uuid']]]];
|
||||
$user_data = $this->getUser()[0];
|
||||
|
||||
|
||||
$this->data['user_group_uuid'] = $user_data['user_group_uuid'];
|
||||
|
||||
# check group weigth
|
||||
# check group weight
|
||||
if ($this->getUserGroupWeight() < $_SESSION['user']['user_group_weight']) {
|
||||
$this->apiOutput(400, ['error' => 'You cannot delete a user with an lower weight then yourself!']);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class API_usersavatar extends API
|
||||
$imageProcessor->imageRestrictions = $imageRestrictions;
|
||||
$imageProcessor->validateAndProcess();
|
||||
$ImageData = $imageProcessor->returnBase64image();
|
||||
} catch (Exception $e) {
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->apiOutput(401, ['error' => 'Error: ' . $e->getMessage()]);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class API_usersavatar extends API
|
||||
user_profile_picture_thumbnail = ?
|
||||
WHERE user_uuid = ?";
|
||||
|
||||
$stmt = $stmt = $this->prepareStatement($query);
|
||||
$stmt = $this->prepareStatement($query);
|
||||
$stmt->bind_param("sss",
|
||||
$this->data['user_profile_picture'],
|
||||
$this->data['user_profile_picture_thumbnail'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
@@ -17,6 +18,7 @@ class API_vendors extends API
|
||||
return $items;
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
public function createVendor()
|
||||
{
|
||||
if (isset($this->data['vendor_image'])) {
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
|
||||
namespace api\classes;
|
||||
|
||||
use http\Exception\RuntimeException;
|
||||
|
||||
class imageProcessor
|
||||
{
|
||||
public $postedFile = null;
|
||||
@@ -34,18 +37,18 @@ class imageProcessor
|
||||
$mimeType = $matches[1];
|
||||
$base64 = substr($base64, strpos($base64, ',') + 1);
|
||||
} else {
|
||||
throw new Exception('Invalid image data.');
|
||||
throw new \RuntimeException('Invalid image data.');
|
||||
}
|
||||
|
||||
$imageData = base64_decode($base64);
|
||||
if ($imageData === false) {
|
||||
throw new Exception('Invalid base64 image data.');
|
||||
throw new \RuntimeException('Invalid base64 image data.');
|
||||
}
|
||||
|
||||
# Create image directly from string (no file)
|
||||
$srcImage = imagecreatefromstring($imageData);
|
||||
if (!$srcImage) {
|
||||
throw new Exception('Failed to create image from string.');
|
||||
throw new \RuntimeException('Failed to create image from string.');
|
||||
}
|
||||
|
||||
# Now you can get dimensions directly
|
||||
@@ -53,7 +56,6 @@ class imageProcessor
|
||||
$height = imagesy($srcImage);
|
||||
|
||||
# Store $srcImage in a class property, continue processing in-memory
|
||||
$this->imageResource = $srcImage;
|
||||
$this->imageInfo = [
|
||||
'mime' => $mimeType,
|
||||
'width' => $width,
|
||||
@@ -74,11 +76,11 @@ class imageProcessor
|
||||
$fileSizeKB = filesize($this->imageTmpPath) / 1024;
|
||||
|
||||
if (!in_array($mime, $this->imageRestrictions['allowed_types'])) {
|
||||
throw new Exception("Invalid image type: $mime");
|
||||
throw new \RuntimeException("Invalid image type: $mime");
|
||||
}
|
||||
|
||||
if ($fileSizeKB > $this->imageRestrictions['max_size_kb']) {
|
||||
throw new Exception("Image exceeds max file size.");
|
||||
throw new \RuntimeException("Image exceeds max file size.");
|
||||
}
|
||||
|
||||
# Resize to fit within min/max bounds
|
||||
@@ -113,7 +115,7 @@ class imageProcessor
|
||||
return in_array($mime, ['image/png', 'image/webp']);
|
||||
}
|
||||
|
||||
private function setTransparentCanvas($image, $width, $height)
|
||||
private function setTransparentCanvas($image, $width, $height): void
|
||||
{
|
||||
// Enable alpha blending and preserve alpha channel
|
||||
imagealphablending($image, false);
|
||||
@@ -123,7 +125,6 @@ class imageProcessor
|
||||
$transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
|
||||
imagefilledrectangle($image, 0, 0, $width, $height, $transparent);
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
private function resizeToFitRestrictions($mime, $width, $height)
|
||||
@@ -137,7 +138,7 @@ class imageProcessor
|
||||
'image/jpeg' => imagecreatefromjpeg($this->imageTmpPath),
|
||||
'image/png' => imagecreatefrompng($this->imageTmpPath),
|
||||
'image/webp' => imagecreatefromwebp($this->imageTmpPath),
|
||||
default => throw new Exception("Unsupported image type.")
|
||||
default => throw new \RuntimeException("Unsupported image type.")
|
||||
};
|
||||
|
||||
# Determine new size
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use api\classes\API_devices;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_devices.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_devices.php";
|
||||
|
||||
$API_devices = new API_devices();
|
||||
|
||||
@@ -11,7 +11,7 @@ if ($API_devices->request_method === 'POST') {
|
||||
|
||||
$API_devices->checkPermissions('admin-devices-files', 'RW');
|
||||
|
||||
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
|
||||
# when called from the frontend will not be forwarding to a url since when it's called from the frontend it doesn't need a redirection
|
||||
$API_devices->return_url = false;
|
||||
|
||||
$device_slugify = isset($_POST['device_slugify']) ? preg_replace('/[^a-zA-Z0-9_-]/', '_', $_POST['device_slugify']) : '';
|
||||
@@ -27,7 +27,7 @@ if ($API_devices->request_method === 'POST') {
|
||||
}
|
||||
|
||||
$filename = basename($_FILES['file']['name']);
|
||||
$filename = preg_replace('/[^a-zA-Z0-9_\.\-]/', '_', $filename);
|
||||
$filename = preg_replace('/[^a-zA-Z0-9_.-]/', '_', $filename);
|
||||
$file_extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
|
||||
$expectedExtension = $allowedFiletypes[$filetype];
|
||||
@@ -61,7 +61,7 @@ if ($API_devices->request_method === 'POST') {
|
||||
|
||||
if (move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
|
||||
chmod($destination, 0644); // Set safe permissions
|
||||
$API_devices->apiOutput(200, ['success' => 'File uploaded succcessfully']);
|
||||
$API_devices->apiOutput(200, ['success' => 'File uploaded successfully']);
|
||||
} else {
|
||||
$API_devices->apiOutput(500, ['error' => 'Failed to move uploaded file']);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ if ($API_devices->request_method === 'POST') {
|
||||
|
||||
$API_devices->checkPermissions('admin-devices-files', 'RW');
|
||||
|
||||
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
|
||||
# when called from the frontend will not be forwarding to a url since when it's called from the frontend it doesn't need a redirection
|
||||
$API_devices->return_url = false;
|
||||
|
||||
$relativePath = $_POST['file_name'] ?? '';
|
||||
@@ -94,7 +94,7 @@ if ($API_devices->request_method === 'POST') {
|
||||
$requestedPath = realpath($_SERVER['DOCUMENT_ROOT'] . $relativePath);
|
||||
|
||||
// Validate resolved path
|
||||
if (!$requestedPath || strpos($requestedPath, $root) !== 0) {
|
||||
if (!$requestedPath || !str_starts_with($requestedPath, $root)) {
|
||||
http_response_code(403);
|
||||
echo json_encode(['status' => 'error', 'message' => 'Access denied']);
|
||||
exit;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
use api\classes\API_devices;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_devices.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/imageProcessor.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_devices.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/imageProcessor.php";
|
||||
|
||||
$API_devices = new API_devices();
|
||||
|
||||
@@ -16,7 +16,7 @@ if ($API_devices->request_method === 'GET') {
|
||||
|
||||
} elseif ($API_devices->request_method === 'POST') {
|
||||
|
||||
# create an new device
|
||||
# create a new device
|
||||
|
||||
$API_devices->checkPermissions('admin-devices', 'RW');
|
||||
|
||||
@@ -106,7 +106,7 @@ if ($API_devices->request_method === 'GET') {
|
||||
|
||||
$API_devices->checkPermissions('admin-devices', 'RW');
|
||||
|
||||
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
|
||||
# when called from the frontend will not be forwarding to a url since when it's called from the frontend it doesn't need a redirection
|
||||
$API_devices->return_url = false;
|
||||
|
||||
$requiredFields = ['device_uuid' => ['type' => 'uuid']];
|
||||
|
||||
@@ -4,8 +4,8 @@ use api\classes\API_platforms;
|
||||
use api\classes\imageProcessor;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_platforms.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/imageProcessor.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_platforms.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/imageProcessor.php";
|
||||
|
||||
$API_platforms = new API_platforms();
|
||||
|
||||
|
||||
4
pub/api/v1/autop/vendors/index.php
vendored
4
pub/api/v1/autop/vendors/index.php
vendored
@@ -4,8 +4,8 @@ use api\classes\API_vendors;
|
||||
use api\classes\imageProcessor;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_vendors.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/imageProcessor.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_vendors.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/imageProcessor.php";
|
||||
|
||||
$API_vendors = new API_vendors();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_companies;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_companies.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";
|
||||
|
||||
# Check permissions
|
||||
$API_companies = new API_companies();
|
||||
@@ -17,7 +17,7 @@ if (!$GLOBALS['modules_enabled']['customers']) {
|
||||
if ($API_companies->request_method === 'PUT') {
|
||||
$API_companies->checkPermissions('customer-companies', 'RW');
|
||||
|
||||
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
|
||||
# when called from the frontend will not be forwarding to a url since when it's called from the frontend it doesn't need a redirection
|
||||
$API_companies->return_url = false;
|
||||
|
||||
$requiredFields = [
|
||||
|
||||
24
pub/api/v1/customers/companies/index.php
Normal file
24
pub/api/v1/customers/companies/index.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API_companies;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";
|
||||
|
||||
|
||||
$API_companies = new API_companies();
|
||||
|
||||
if (!$GLOBALS['modules_enabled']['customers']) {
|
||||
echo '405 Not Allowed';
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($API_companies->request_method === 'GET') {
|
||||
$API_companies->checkPermissions('customer-companies', 'RO');
|
||||
|
||||
$companies = $API_companies->getCompanies();
|
||||
|
||||
$API_companies->apiOutput($code = 200, $data = $companies);
|
||||
|
||||
}
|
||||
24
pub/api/v1/frontend/breadcrumbs/index.php
Normal file
24
pub/api/v1/frontend/breadcrumbs/index.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API;
|
||||
|
||||
session_start();
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
$API = new API();
|
||||
|
||||
if ($API->request_method === 'GET') {
|
||||
$breadcrumbJson = '[]';
|
||||
|
||||
if (isset($_SESSION['breadCrumbArray'])) {
|
||||
try {
|
||||
$breadcrumbJson = json_encode($_SESSION['breadCrumbArray'] ?? [], JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
error_log($e->getMessage());
|
||||
$breadcrumbJson = '[]';
|
||||
}
|
||||
$_SESSION['breadCrumbArray'] = [];
|
||||
}
|
||||
|
||||
echo $breadcrumbJson;
|
||||
}
|
||||
21
pub/api/v1/frontend/locale/index.php
Normal file
21
pub/api/v1/frontend/locale/index.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API;
|
||||
|
||||
session_start();
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
$API = new API();
|
||||
|
||||
if ($API->request_method === 'GET') {
|
||||
# this is used by js scripts to get the locale of the user
|
||||
$locale = getPreferredLocale();
|
||||
|
||||
$translations = require $_SERVER['DOCUMENT_ROOT'] . "/bin/locales/{$locale}.php";
|
||||
|
||||
header("Cache-Control: public, max-age=3600");
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
echo json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
|
||||
}
|
||||
17
pub/api/v1/frontend/response/index.php
Normal file
17
pub/api/v1/frontend/response/index.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API;
|
||||
|
||||
session_start();
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
$API = new API();
|
||||
|
||||
if ($API->request_method === 'GET') {
|
||||
if (isset($_SESSION['response'])) {
|
||||
echo $_SESSION['response'];
|
||||
unset($_SESSION['response']);
|
||||
} else {
|
||||
echo '[]';
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_office_stompjes;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_office_stompjes.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_office_stompjes.php";
|
||||
|
||||
$API_office_stompjes = new API_office_stompjes();
|
||||
|
||||
@@ -15,7 +15,12 @@ if (!$GLOBALS['modules_enabled']['office']) {
|
||||
if ($API_office_stompjes->request_method === 'GET') {
|
||||
$API_office_stompjes->checkPermissions('office-stompjes', 'RO');
|
||||
|
||||
if (isset($_GET['frontend'])) {
|
||||
# This one is used by the frontend and is filtered by date.
|
||||
$stompjes = $API_office_stompjes->getStomp(true);
|
||||
} else {
|
||||
$stompjes = $API_office_stompjes->getStomp();
|
||||
}
|
||||
|
||||
$API_office_stompjes->apiOutput($code = 200, ['success' => $stompjes]);
|
||||
|
||||
@@ -30,15 +35,14 @@ if ($API_office_stompjes->request_method === 'GET') {
|
||||
|
||||
$API_office_stompjes->validateData($requiredFields);
|
||||
|
||||
$modules = $API_office_stompjes->addStomp();
|
||||
$API_office_stompjes->addStomp();
|
||||
|
||||
$API_office_stompjes->apiOutput($code = 200, ['success' => 'stomp added successfully.']);
|
||||
} elseif ($API_office_stompjes->request_method === 'DELETE') {
|
||||
|
||||
# Only superuser can delete permission due to fact that the backend needs programming when setting a permission
|
||||
$API_office_stompjes->checkPermissions('office-stompjes', 'RW');
|
||||
|
||||
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
|
||||
# when called from the frontend will not be forwarding to a url since when it's called from the frontend it doesn't need a redirection
|
||||
$API_office_stompjes->return_url = false;
|
||||
|
||||
$requiredFields = ['stomp_uuid' => ['type' => 'uuid']];
|
||||
|
||||
51
pub/api/v1/office/travel-reimburse/configure/index.php
Normal file
51
pub/api/v1/office/travel-reimburse/configure/index.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API_portalsettings;
|
||||
use api\classes\API_office_travel_reimburse;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_portalsettings.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_office_travel_reimburse.php";
|
||||
|
||||
|
||||
$API_portalsettings = new API_portalsettings();
|
||||
|
||||
if (!$GLOBALS['modules_enabled']['office']) {
|
||||
echo '405 Not Allowed';
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($API_portalsettings->request_method === 'GET') {
|
||||
$API_portalsettings->checkPermissions('office-travel-reimburse', 'RO');
|
||||
|
||||
$travel_reimbursements = $API_portalsettings->getTravelReimburseSettings();
|
||||
|
||||
$API_portalsettings->apiOutput($code = 200, $travel_reimbursements);
|
||||
|
||||
} elseif ($API_portalsettings->request_method === 'PUT') {
|
||||
|
||||
$API_portalsettings->checkPermissions('admin-portalsettings', 'RW');
|
||||
|
||||
$API_office_travel_reimburse = new API_office_travel_reimburse();
|
||||
|
||||
# Edit the portal settings of the platform
|
||||
$requiredFields = [
|
||||
'office_travelreimburse_cents_homework_incl' => ['type' => 'int'],
|
||||
'office_travelreimburse_cents_homework_excl' => ['type' => 'int'],
|
||||
'office_travelreimburse_cents_business_incl' => ['type' => 'int'],
|
||||
'office_travelreimburse_cents_business_excl' => ['type' => 'int'],
|
||||
'portal_uuid' => ['type' => 'uuid'],
|
||||
];
|
||||
|
||||
if (count($API_portalsettings->getPortalSettings()) !== 1) {
|
||||
$API_portalsettings->apiOutput(400, ['error' => 'Invalid portal_uuid']);
|
||||
}
|
||||
|
||||
$API_portalsettings->validateData($requiredFields);
|
||||
|
||||
# Update the permission
|
||||
$API_portalsettings->updatePortalSettingsOfficeTravelReimburse();
|
||||
|
||||
$API_portalsettings->apiOutput(200, ['success' => 'portal settings updated successfully.']);
|
||||
}
|
||||
89
pub/api/v1/office/travel-reimburse/index.php
Normal file
89
pub/api/v1/office/travel-reimburse/index.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API_office_travel_reimburse;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_office_travel_reimburse.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";
|
||||
|
||||
$API_office_travel_reimburse = new API_office_travel_reimburse();
|
||||
|
||||
if (!$GLOBALS['modules_enabled']['office']) {
|
||||
echo '405 Not Allowed';
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($API_office_travel_reimburse->request_method === 'GET') {
|
||||
$API_office_travel_reimburse->checkPermissions('office-travel-reimburse', 'RO');
|
||||
|
||||
$_GET['builder'] = [1 => ['where' => [0 => 'user_uuid', 1 => $_SESSION['user']['user_uuid']]]];
|
||||
|
||||
$travel_reimbursements = $API_office_travel_reimburse->getTravelReimburse();
|
||||
$API_office_travel_reimburse->apiOutput($code = 200, $travel_reimbursements);
|
||||
|
||||
} elseif ($API_office_travel_reimburse->request_method === 'POST') {
|
||||
|
||||
$API_office_travel_reimburse->checkPermissions('office-travel-reimburse', 'RW');
|
||||
$API_office_travel_reimburse->return_url = false;
|
||||
$API_office_travel_reimburse->setTravelReimburseCompany();
|
||||
$API_office_travel_reimburse->postedData['user_uuid'] = $_SESSION['user']['user_uuid'];
|
||||
|
||||
$requiredFields = [
|
||||
'user_uuid' => ['type' => 'uuid'],
|
||||
'departure_postcode' => ['type' => 'string'],
|
||||
'destination_postcode' => ['type' => 'string'],
|
||||
'travel_date' => ['type' => 'date'],
|
||||
'travel_distance' => ['type' => 'int'],
|
||||
'office_travelreimburse_company_uuid' => ['type' => 'uuid'],
|
||||
'office_travelreimburse_company_name' => ['type' => 'string'],
|
||||
'homework' => ['type' => 'int']
|
||||
];
|
||||
|
||||
$optionalFields = [
|
||||
'travel_description' => ['type' => 'string']
|
||||
];
|
||||
|
||||
$API_office_travel_reimburse->validateData($requiredFields, $optionalFields);
|
||||
$API_office_travel_reimburse->createTravelReimburse();
|
||||
|
||||
} elseif ($API_office_travel_reimburse->request_method === 'PUT') {
|
||||
# Only superuser can delete permission due to fact that the backend needs programming when setting a permission
|
||||
|
||||
$API_office_travel_reimburse->checkPermissions('office-travel-reimburse', 'RW');
|
||||
$API_office_travel_reimburse->return_url = false;
|
||||
$API_office_travel_reimburse->setTravelReimburseCompany();
|
||||
$API_office_travel_reimburse->postedData['user_uuid'] = $_SESSION['user']['user_uuid'];
|
||||
|
||||
$requiredFields = [
|
||||
'reimburse_uuid' => ['type' => 'uuid'],
|
||||
'user_uuid' => ['type' => 'uuid'],
|
||||
'departure_postcode' => ['type' => 'string'],
|
||||
'destination_postcode' => ['type' => 'string'],
|
||||
'travel_date' => ['type' => 'date'],
|
||||
'travel_distance' => ['type' => 'int'],
|
||||
'office_travelreimburse_company_uuid' => ['type' => 'uuid'],
|
||||
'office_travelreimburse_company_name' => ['type' => 'string'],
|
||||
'homework' => ['type' => 'boolean']
|
||||
];
|
||||
|
||||
$optionalFields = [
|
||||
'travel_description' => ['type' => 'string'],
|
||||
];
|
||||
|
||||
$API_office_travel_reimburse->validateData($requiredFields, $optionalFields);
|
||||
$API_office_travel_reimburse->updateTravelReimburse();
|
||||
|
||||
} elseif ($API_office_travel_reimburse->request_method === 'DELETE') {
|
||||
# Only superuser can delete permission due to fact that the backend needs programming when setting a permission
|
||||
$API_office_travel_reimburse->checkPermissions('office-travel-reimburse', 'RW');
|
||||
$API_office_travel_reimburse->return_url = false;
|
||||
|
||||
$requiredFields = [
|
||||
'reimburse_uuid' => ['type' => 'uuid']
|
||||
];
|
||||
|
||||
$API_office_travel_reimburse->validateData($requiredFields);
|
||||
$API_office_travel_reimburse->deleteTravelReimburse();
|
||||
|
||||
}
|
||||
212
pub/api/v1/office/travel-reimburse/send/index.php
Normal file
212
pub/api/v1/office/travel-reimburse/send/index.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API_office_travel_reimburse;
|
||||
use bin\php\Classes\mailBuilder;
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/../vendor/autoload.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_office_travel_reimburse.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/mailBuilder.php";
|
||||
|
||||
$API_office_travel_reimburse = new API_office_travel_reimburse();
|
||||
|
||||
if (!$GLOBALS['modules_enabled']['office']) {
|
||||
echo '405 Not Allowed';
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($API_office_travel_reimburse->request_method === 'POST') {
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
$API_office_travel_reimburse->checkPermissions('office-travel-reimburse', 'RO');
|
||||
$portal_settings = $GLOBALS['conn']->query("SELECT * FROM system_settings")->fetch_assoc();
|
||||
$month = $_POST['calender_month'];
|
||||
$firstDay = $month . '-01';
|
||||
$lastDay = date('Y-m-t', strtotime($firstDay));
|
||||
|
||||
$_GET['builder'] = [
|
||||
1 => [
|
||||
'where' => [
|
||||
0 => 'user_uuid',
|
||||
1 => $_SESSION['user']['user_uuid']
|
||||
],
|
||||
'between' => [
|
||||
0 => 'travel_date',
|
||||
1 => $firstDay,
|
||||
2 => $lastDay
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$travel_reimbursements = $API_office_travel_reimburse->getTravelReimburse();
|
||||
|
||||
// format is this: 2026-07
|
||||
$month = $_POST['calender_month'];
|
||||
|
||||
$lastDay = date('Y-m-t', strtotime($month . '-01'));
|
||||
$invoiceNumber = 'D-' . date('nY', strtotime($month . '-01'));
|
||||
|
||||
$totalBusinessKm = 0;
|
||||
$totalHomeworkKm = 0;
|
||||
|
||||
foreach ($travel_reimbursements as $trip) {
|
||||
if ($trip['homework']) {
|
||||
$totalHomeworkKm += $trip['travel_distance'];
|
||||
} else {
|
||||
$totalBusinessKm += $trip['travel_distance'];
|
||||
}
|
||||
}
|
||||
|
||||
$totalKm = $totalBusinessKm + $totalHomeworkKm;
|
||||
|
||||
$amountExcl =
|
||||
($totalBusinessKm * $portal_settings['office_travelreimburse_cents_business_excl']) +
|
||||
($totalHomeworkKm * $portal_settings['office_travelreimburse_cents_homework_excl']);
|
||||
|
||||
$amountIncl =
|
||||
($totalBusinessKm * $portal_settings['office_travelreimburse_cents_business_incl']) +
|
||||
($totalHomeworkKm * $portal_settings['office_travelreimburse_cents_homework_incl']);
|
||||
|
||||
// cents -> euros
|
||||
$amountExcl /= 100;
|
||||
$amountIncl /= 100;
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<h2><?= __('travelReimburse') ?></h2>
|
||||
|
||||
<table border="0" cellpadding="4">
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= __('date') ?>:</strong>
|
||||
</td>
|
||||
<td><?= date('d/m/Y', strtotime($lastDay)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= __('full_name') ?>:</strong>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($_SESSION['user']['user_full_name']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= __('invoice_number') ?>:</strong>
|
||||
</td>
|
||||
<td><?= $invoiceNumber; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= __('total_travel_excl') ?>:</strong>
|
||||
</td>
|
||||
<td>€ <?= number_format($amountExcl, 2, ',', '.'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= __('total_travel_incl') ?>:</strong>
|
||||
</td>
|
||||
<td>€ <?= number_format($amountIncl, 2, ',', '.'); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table border="1" cellpadding="5" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= __('date') ?></th>
|
||||
<th><?= __('from') ?></th>
|
||||
<th><?= __('to') ?></th>
|
||||
<th><?= __('company') ?></th>
|
||||
<th>KM <?= __('homework') ?></th>
|
||||
<th>KM <?= __('business') ?></th>
|
||||
<th><?= __('description') ?></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($travel_reimbursements as $trip) { ?>
|
||||
|
||||
<tr>
|
||||
<td><?= date('d-m-Y', strtotime($trip['travel_date'])); ?></td>
|
||||
<td><?= htmlspecialchars($trip['departure_postcode']); ?></td>
|
||||
<td><?= htmlspecialchars($trip['destination_postcode']); ?></td>
|
||||
<td><?= htmlspecialchars($trip['office_travelreimburse_company_name']); ?></td>
|
||||
<td><?= ($trip['homework'] ? $trip['travel_distance'] : '') ?></td>
|
||||
<td><?= ($trip['homework'] ? '' : $trip['travel_distance']) ?></td>
|
||||
<td><?= $trip['travel_description']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td colspan="5" align="right">
|
||||
<strong><?= __('total') . ' ' . __('business') ?> km</strong>
|
||||
</td>
|
||||
<td>
|
||||
<strong><?= $totalBusinessKm; ?></strong>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" align="right">
|
||||
<strong><?= __('total') . ' ' . __('homework') ?> km</strong>
|
||||
</td>
|
||||
<td>
|
||||
<strong><?= $totalHomeworkKm; ?></strong>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" align="right">
|
||||
<strong><?= __('total') ?></strong>
|
||||
</td>
|
||||
<td>
|
||||
<strong><?= $totalKm; ?></strong>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
$html = ob_get_clean();
|
||||
|
||||
$options = new Options();
|
||||
$options->set('isHtml5ParserEnabled', true);
|
||||
$options->set('isRemoteEnabled', true);
|
||||
|
||||
$dompdf = new Dompdf($options);
|
||||
$dompdf->loadHtml($html);
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
$dompdf->render();
|
||||
$pdfFile = sys_get_temp_dir() . '/travel_reimburse.pdf';
|
||||
|
||||
file_put_contents(
|
||||
$pdfFile,
|
||||
$dompdf->output()
|
||||
);
|
||||
|
||||
$mail = new mailBuilder();
|
||||
|
||||
$mail->addAddress($_SESSION['user']['user_email'], $_SESSION['user']['user_full_name']);
|
||||
$mail->subject = 'Travel reimbursement ' . $_SESSION['user']['user_full_name'] . ' - ' . $invoiceNumber;
|
||||
$mail->mailText = 'Your travel reimbursement is attached.';
|
||||
|
||||
try {
|
||||
$mail->addAttachment($pdfFile, 'travel_reimbursement.pdf');
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$mail->sendMail();
|
||||
|
||||
unlink($pdfFile);
|
||||
|
||||
$API_office_travel_reimburse->apiOutput(200, ['success' => 'Message send.']);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
use api\classes\API_portalsettings;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_portalsettings.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_portalsettings.php";
|
||||
|
||||
$API_portalsettings = new API_portalsettings();
|
||||
|
||||
@@ -29,6 +29,10 @@ if ($API_portalsettings->request_method === 'GET') {
|
||||
'admin_auth_methods' => ['type' => 'string']
|
||||
];
|
||||
|
||||
if (count($API_portalsettings->getPortalSettings()) !== 1) {
|
||||
$API_portalsettings->apiOutput(400, ['error' => 'Invalid portal_uuid']);
|
||||
}
|
||||
|
||||
$API_portalsettings->validateData($requiredFields);
|
||||
|
||||
# Update the permission
|
||||
|
||||
@@ -4,8 +4,8 @@ use api\classes\API_permissions;
|
||||
use api\classes\API_usergroups;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_permissions.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_usergroups.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_permissions.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_usergroups.php";
|
||||
|
||||
$API_permissions = new API_permissions();
|
||||
$API_usergroups = new API_usergroups();
|
||||
@@ -18,7 +18,7 @@ if ($API_permissions->request_method === 'GET') {
|
||||
$API_permissions->apiOutput($code = 200, ['success' => $permissions]);
|
||||
|
||||
} elseif ($API_permissions->request_method === 'PUT') {
|
||||
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
|
||||
# when called from the frontend will not be forwarding to a url since when it's called from the frontend it doesn't need a redirection
|
||||
$API_permissions->return_url = false;
|
||||
|
||||
$API_permissions->checkPermissions('admin-access-control-permissions', 'RW');
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API_mailsettings;
|
||||
use api\classes\API_portalsettings;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_mailsettings.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_mailsettings.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_portalsettings.php";
|
||||
|
||||
$API_mailsettings = new API_mailsettings();
|
||||
|
||||
@@ -24,7 +26,7 @@ if ($API_mailsettings->request_method === 'PUT') {
|
||||
'mail_smtp_pass' => ['type' => 'string']
|
||||
];
|
||||
# check if the password is changed
|
||||
$updatePassword = str_contains($API_mailsettings->postedData['mail_smtp_pass'], '******') ? false : true;
|
||||
$updatePassword = !str_contains($API_mailsettings->postedData['mail_smtp_pass'], '******');
|
||||
if ($updatePassword) {
|
||||
if (strlen($API_mailsettings->postedData['mail_smtp_pass']) < 12) {
|
||||
$API_mailsettings->apiOutput(400, ['error' => 'Password too short']);
|
||||
@@ -35,6 +37,11 @@ if ($API_mailsettings->request_method === 'PUT') {
|
||||
}
|
||||
}
|
||||
|
||||
$API_portalsettings = new API_portalsettings();
|
||||
if (count($API_portalsettings->getPortalSettings()) !== 1) {
|
||||
$API_mailsettings->apiOutput(400, ['error' => 'Invalid portal_uuid']);
|
||||
}
|
||||
|
||||
$API_mailsettings->validateData($requiredFields);
|
||||
|
||||
# Update the permission
|
||||
|
||||
@@ -4,8 +4,8 @@ use api\classes\API_mailsettings;
|
||||
use bin\php\Classes\mailBuilder;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_mailsettings.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/mailBuilder.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_mailsettings.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/mailBuilder.php";
|
||||
|
||||
$API_mailsettings = new API_mailsettings();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use api\classes\API_system_modules;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_system_modules.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_system_modules.php";
|
||||
|
||||
$API_system_modules = new API_system_modules();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_permissions;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_permissions.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_permissions.php";
|
||||
|
||||
$API_permissions = new API_permissions();
|
||||
|
||||
@@ -61,7 +61,7 @@ if ($API_permissions->request_method === 'GET') {
|
||||
$API_permissions->apiOutput(401, ['error' => 'You are not authorized to access this resource.']);
|
||||
}
|
||||
|
||||
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
|
||||
# when called from the frontend will not be forwarding to a url since when it's called from the frontend it doesn't need a redirection
|
||||
$API_permissions->return_url = false;
|
||||
|
||||
$requiredFields = ['permission_uuid' => ['type' => 'uuid']];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use api\classes\API_system_sources;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_system_sources.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_system_sources.php";
|
||||
|
||||
$API_system_sources = new API_system_sources();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use api\classes\API_usergroups;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_usergroups.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_usergroups.php";
|
||||
|
||||
|
||||
$API_usergroups = new API_usergroups();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use api\classes\API_users;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_users.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_users.php";
|
||||
|
||||
$API_users = new API_users();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_servers;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_servers.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_servers.php";
|
||||
|
||||
$API_servers = new API_servers();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_inserve;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_inserve.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_inserve.php";
|
||||
|
||||
$API_inserve = new API_inserve();
|
||||
$API_inserve->setupConnection();
|
||||
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_inserve;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_inserve.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_inserve.php";
|
||||
|
||||
|
||||
$API_inserve = new API_inserve();
|
||||
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_inserve;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_inserve.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_inserve.php";
|
||||
|
||||
$API_inserve = new API_inserve();
|
||||
$API_inserve->setupConnection();
|
||||
@@ -20,7 +20,7 @@ if ($API_inserve->request_method === 'POST' || $API_inserve->request_method ===
|
||||
do {
|
||||
$result = $API_inserve->companies($page);
|
||||
|
||||
if (!isset($result['data']) || empty($result['data'])) {
|
||||
if (empty($result['data'])) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_inserve;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_inserve.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_inserve.php";
|
||||
|
||||
|
||||
$API_inserve = new API_inserve();
|
||||
|
||||
@@ -4,7 +4,7 @@ use api\classes\API_inserve;
|
||||
|
||||
session_start();
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_inserve.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_inserve.php";
|
||||
|
||||
|
||||
$API_inserve = new API_inserve();
|
||||
|
||||
@@ -5,7 +5,7 @@ use api\classes\API_users;
|
||||
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_apitoken.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_apitoken.php";
|
||||
|
||||
$API_apitoken = new API_apitoken();
|
||||
|
||||
@@ -65,7 +65,7 @@ if ($API_apitoken->request_method === 'GET') {
|
||||
|
||||
} elseif ($API_apitoken->request_method === 'DELETE') {
|
||||
|
||||
# Deletes an API token, requies DELETE with 'api_token_uuid' first retrieve the uuid of the user with getToken then check
|
||||
# Deletes an API token, requires DELETE with 'api_token_uuid' first retrieve the uuid of the user with getToken then check
|
||||
# if the user is another user or itself
|
||||
|
||||
# This api call, when called from the frontend will not be forwarding to a url.
|
||||
|
||||
@@ -4,15 +4,13 @@
|
||||
use api\classes\API_usersavatar;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_usersavatar.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/imageProcessor.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_usersavatar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/imageProcessor.php";
|
||||
|
||||
$API_usersavatar = new API_usersavatar();
|
||||
|
||||
if ($API_usersavatar->request_method === 'GET') {
|
||||
|
||||
} elseif ($API_usersavatar->request_method === 'POST') {
|
||||
# Reset a users password and send a email to the user to set a new password
|
||||
if ($API_usersavatar->request_method === 'POST') {
|
||||
# Reset a users password and send an email the user to set a new password
|
||||
|
||||
$API_usersavatar->postedData['user_profile_picture'] = $API_usersavatar->createUserImage(['min_width' => 500, 'max_width' => 1000, 'min_height' => 500, 'max_height' => 1000, 'square' => true, 'allowed_types' => ['image/png'], 'max_size_kb' => 1024, 'transparent' => true]);
|
||||
$API_usersavatar->postedData['user_profile_picture_thumbnail'] = $API_usersavatar->createUserImage(['min_width' => 64, 'max_width' => 64, 'min_height' => 64, 'max_height' => 64, 'square' => true, 'allowed_types' => ['image/png'], 'max_size_kb' => 1024, 'transparent' => true]);
|
||||
@@ -34,8 +32,4 @@ if ($API_usersavatar->request_method === 'GET') {
|
||||
|
||||
$API_usersavatar->apiOutput(200, ['success' => 'Avatar was successfully changed.']);
|
||||
|
||||
} elseif ($API_usersavatar->request_method === 'PUT') {
|
||||
|
||||
} elseif ($API_usersavatar->request_method === 'DELETE') {
|
||||
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_mfa.php';
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/../vendor/autoload.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'] . '/login/php/authFunctions.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_mfa.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/../vendor/autoload.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/login/php/authFunctions.php";
|
||||
|
||||
|
||||
use api\classes\API_mfa;
|
||||
use RobThree\Auth\TwoFactorAuth;
|
||||
use RobThree\Auth\Providers\Qr\EndroidQrCodeWithLogoProvider;
|
||||
use RobThree\Auth\Providers\Qr\EndroidQrCodeProvider;
|
||||
|
||||
$API_mfa = new API_mfa();
|
||||
|
||||
if ($API_mfa->request_method === 'GET') {
|
||||
|
||||
} elseif ($API_mfa->request_method === 'POST') {
|
||||
# Setup a new MFA secret its posted from mfaSetup.php where it generated a secret
|
||||
if ($API_mfa->request_method === 'POST') {
|
||||
# Set up a new MFA secret its posted from mfaSetup.php where it generated a secret
|
||||
|
||||
if (checkLoginAttempts() > 10) {
|
||||
echo 'too many attempts, please try again later.';
|
||||
@@ -26,11 +24,11 @@ if ($API_mfa->request_method === 'GET') {
|
||||
$this->apiOutput(400, ['error' => 'secret not found.']);
|
||||
}
|
||||
|
||||
$tfa = new TwoFactorAuth(new EndroidQrCodeWithLogoProvider());
|
||||
$tfa = new TwoFactorAuth(new EndroidQrCodeProvider());
|
||||
|
||||
$API_mfa->postedData['user_uuid'] = $_SESSION['user']['user_uuid'];
|
||||
$API_mfa->postedData['user_two_factor_secret'] = $_SESSION['mfasetup']['secret'];
|
||||
$API_mfa->postedData['verificationCode'] = linkVerificationPosts(); # The code is entered in six loose posts this wil link it togheter
|
||||
$API_mfa->postedData['verificationCode'] = linkVerificationPosts(); # The code is entered in six loose posts this wil link it together
|
||||
|
||||
$requiredFields = [
|
||||
'user_uuid' => ['type' => 'uuid'],
|
||||
@@ -49,8 +47,6 @@ if ($API_mfa->request_method === 'GET') {
|
||||
|
||||
$API_mfa->enableMFA();
|
||||
|
||||
} elseif ($API_mfa->request_method === 'PUT') {
|
||||
|
||||
} elseif ($API_mfa->request_method === 'DELETE') {
|
||||
|
||||
# Delete a mfa code for a user
|
||||
|
||||
@@ -5,26 +5,24 @@ use api\classes\API_users;
|
||||
use bin\php\Classes\mailBuilder;
|
||||
|
||||
session_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_resetpassword.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/mailBuilder.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_users.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_resetpassword.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/mailBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_users.php";
|
||||
|
||||
|
||||
$API_resetpassword = new API_resetpassword();
|
||||
|
||||
if ($API_resetpassword->request_method === 'GET') {
|
||||
|
||||
} elseif ($API_resetpassword->request_method === 'POST') {
|
||||
# Reset a users password and send a email to the user to set a new password
|
||||
if ($API_resetpassword->request_method === 'POST') {
|
||||
# Reset a users password and send a mail to the user to set a new password
|
||||
|
||||
$API_resetpassword->checkPermissions('admin-access-admins-resetpassword', 'RW');
|
||||
|
||||
# The user will need to verify their email, the password field cannot be NULL so set an random password for now till the user resets it on when verifing there email
|
||||
# The user will need to verify their email, the password field cannot be NULL so set a random password for now till the user resets it on when verifying there email
|
||||
$random_string = substr(str_shuffle(str_repeat('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01', 64)), 0, rand(50, 64));
|
||||
$user_password = password_hash($random_string, PASSWORD_BCRYPT, ["cost" => 12]);
|
||||
$API_resetpassword->postedData['user_password'] = $user_password;
|
||||
|
||||
# Password reset token that will be send to the user
|
||||
# Password reset token that will be sent to the user
|
||||
$API_resetpassword->postedData['user_password_reset_token'] = bin2hex(random_bytes(32));
|
||||
$API_resetpassword->postedData['user_password_reset_expires'] = time() + 86400;
|
||||
|
||||
@@ -71,8 +69,4 @@ The Sentri gnomes
|
||||
$mail->sendMail();
|
||||
$API_resetpassword->apiOutput(200, ['success' => 'Password reset link sent successfully.']);
|
||||
|
||||
} elseif ($API_resetpassword->request_method === 'PUT') {
|
||||
|
||||
} elseif ($API_resetpassword->request_method === 'DELETE') {
|
||||
|
||||
}
|
||||
@@ -39,6 +39,7 @@ return [
|
||||
'access_control' => 'Access Control',
|
||||
'monitoring' => 'Monitoring',
|
||||
'systemconfig' => 'Settings',
|
||||
'configure' => 'Configure',
|
||||
'portal-management' => 'Portal Management',
|
||||
'dashboard_text_admin_management' => 'Manage access for administrators',
|
||||
'dashboard_text_access_control' => 'Edit permission and groups',
|
||||
@@ -73,6 +74,7 @@ return [
|
||||
'last_modified_date' => 'Last modified date',
|
||||
'last_update' => 'Last update',
|
||||
'never' => 'Never',
|
||||
'invalid_data' => 'Invalid date',
|
||||
'save' => 'Save',
|
||||
'add_vendor' => 'Add vendor',
|
||||
'edit_vendor' => 'Edit vendor',
|
||||
@@ -230,7 +232,7 @@ return [
|
||||
'autoproviosioning' => 'Autoprovisioning',
|
||||
'dashboard_text_stompjes' => 'Can you kick it?',
|
||||
'office' => 'Office',
|
||||
'stompjeslist' => 'Stompjeslist',
|
||||
'stompjeslist' => 'Stompjes',
|
||||
'stompable' => 'Stompable',
|
||||
'stompjes' => 'Stomps',
|
||||
'stomped' => 'Stomped',
|
||||
@@ -307,4 +309,25 @@ return [
|
||||
'source_inserve_sync_subscriptions' => 'Sync server subscriptions',
|
||||
'source_inserve_sync_subscriptions_desc' => 'This API call first executes the <b>Sync cloud distributor</b> companies action and then creates a subscription if it does not exist, or updates the subscription description if it does. It also creates subscription lines with the correct product_code entered in the <b>custom source data</b> JSON field.',
|
||||
'not_allowed_to_change_due_to_group_weight' => 'You are not permitted to modify these settings because has a lower group weight, which is used to enforce hierarchy and prevent privilege escalation.',
|
||||
'travelReimburse' => 'Travel Reimbursement',
|
||||
'office_travelreimburse_homework_company_name' => 'Default company for home-work',
|
||||
'office_travelreimburse_cents_homework_incl' => 'Cents per/km home-work incl. VAT',
|
||||
'office_travelreimburse_cents_homework_excl' => 'Cents per/km home-work excl. VAT',
|
||||
'office_travelreimburse_cents_business_incl' => 'Cents per/km business incl. VAT',
|
||||
'office_travelreimburse_cents_business_excl' => 'Cents per/km business excl. VAT',
|
||||
'total_travel_distance_homework' => 'Home-work',
|
||||
'total_travel_distance_business' => 'Business',
|
||||
'total_travel_incl' => 'Total incl. VAT',
|
||||
'total_travel_excl' => 'Total excl. VAT',
|
||||
'total' => 'Total',
|
||||
'departure_postcode' => 'Departure Postcode',
|
||||
'destination_postcode' => 'Destination Postcode',
|
||||
'kilometers' => 'Kilometers',
|
||||
'save_default' => 'Save defaults',
|
||||
'default_saved' => 'Defaults saved',
|
||||
'homework' => 'Home-work',
|
||||
'business' => 'Business',
|
||||
'default_have_been_saved' => 'Your default travel values have been saved.',
|
||||
'mail_travelreimburse' => 'Mail travel reimbursement',
|
||||
'invoice_number' => 'Invoice number',
|
||||
];
|
||||
@@ -39,6 +39,7 @@ return [
|
||||
'access_control' => 'Toegangs beheer',
|
||||
'monitoring' => 'Monitoring',
|
||||
'systemconfig' => 'Instellingen',
|
||||
'configure' => 'Configureer',
|
||||
'portal-management' => 'Portaal beheer',
|
||||
'dashboard_text_admin_management' => 'Toegang beheer voor administrators',
|
||||
'dashboard_text_access_control' => 'Beheer permissies en groepen',
|
||||
@@ -73,6 +74,7 @@ return [
|
||||
'last_modified_date' => 'Laatst gewijzigd datum',
|
||||
'last_update' => 'Laatste update',
|
||||
'never' => 'Nooit',
|
||||
'invalid_data' => 'Ongeldige datum',
|
||||
'save' => 'Opslaan',
|
||||
'add_vendor' => 'Vendor toevoegen',
|
||||
'edit_vendor' => 'Vendor bewerken',
|
||||
@@ -230,7 +232,7 @@ return [
|
||||
'autoproviosioning' => 'Autoprovisioning',
|
||||
'dashboard_text_stompjes' => 'Kan je stompen?',
|
||||
'office' => 'Kantoor',
|
||||
'stompjeslist' => 'Stompjeslijst',
|
||||
'stompjeslist' => 'Stompjes',
|
||||
'stompable' => 'Stompabel',
|
||||
'stompjes' => 'Stompjes',
|
||||
'stomped' => 'Gestompt',
|
||||
@@ -306,5 +308,27 @@ return [
|
||||
'source_inserve_sync_licenses_desc' => 'Deze API-call voert eerst de <b>Synchroniseer cloud-distributeurbedrijven</b> actie uit en synchroniseert daarna alle servers in een actieve, verwijderde of trial status met Inserve-licenties. Het maakt serverlicenties in Inserve aan of werkt ze bij als ze niet bestaan of als de licentieaantallen afwijken van die in Sentri.',
|
||||
'source_inserve_sync_subscriptions' => 'Synchroniseer serverabonnementen',
|
||||
'source_inserve_sync_subscriptions_desc' => 'Deze API-call voert eerst de actie <b>Sync cloud distributor companies</b> uit en maakt vervolgens een abonnement aan als dit nog niet bestaat, of werkt de beschrijving van het abonnement bij als het wel bestaat. Daarnaast worden abonnementsregels aangemaakt met de juiste product_code die is ingevuld in het <b>custom source data</b> JSON-veld.',
|
||||
'not_allowed_to_change_due_to_group_weight' => 'U mag deze instellingen niet wijzigen omdat deze een lagere groepsgewichtwaarde hebben, wat wordt gebruikt om de hiërarchie af te dwingen en privilege-escalatie te voorkomen.'
|
||||
'not_allowed_to_change_due_to_group_weight' => 'U mag deze instellingen niet wijzigen omdat deze een lagere groepsgewichtwaarde hebben, wat wordt gebruikt om de hiërarchie af te dwingen en privilege-escalatie te voorkomen.',
|
||||
'travelReimburse' => 'Reiskosten',
|
||||
'travelReimburse_overview' => 'Reiskostenoverzicht',
|
||||
'office_travelreimburse_homework_company_name' => 'Standaard woonwerk bedrijf',
|
||||
'office_travelreimburse_cents_homework_incl' => 'Cent per/km woon-werk incl. BTW',
|
||||
'office_travelreimburse_cents_homework_excl' => 'Cent per/km woon-werk excl. BTW',
|
||||
'office_travelreimburse_cents_business_incl' => 'Cent per/km zakelijk incl. BTW',
|
||||
'office_travelreimburse_cents_business_excl' => 'Cent per/km zakelijk excl. BTW',
|
||||
'total_travel_distance_homework' => 'Woonwerk',
|
||||
'total_travel_distance_business' => 'Zakelijk',
|
||||
'total_travel_incl' => 'Totaal incl. BTW',
|
||||
'total_travel_excl' => 'Totaal excl. BTW',
|
||||
'total' => 'Totaal',
|
||||
'departure_postcode' => 'Vertrek postcode',
|
||||
'destination' => 'Bestemming postcode',
|
||||
'kilometers' => 'Kilometers',
|
||||
'save_default' => 'Standaard opslaan',
|
||||
'default_saved' => 'Standaard opgeslagen',
|
||||
'homework' => 'Woon/werk',
|
||||
'business' => 'Zakelijk',
|
||||
'default_have_been_saved' => 'De standaard instellingen zijn opgeslagen.',
|
||||
'mail_travelreimburse' => 'Reiskosten mailen',
|
||||
'invoice_number' => 'Factuurnummer',
|
||||
];
|
||||
@@ -3,11 +3,11 @@ if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
if (isset($_GET['add'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pageDevices_add.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pageDevices_add.php";
|
||||
} elseif (isset($_GET['edit'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pageDevices_edit.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pageDevices_edit.php";
|
||||
} elseif (isset($_GET['view'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pageDevices_view.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pageDevices_view.php";
|
||||
} else {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pageDevices_list.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pageDevices_list.php";
|
||||
}
|
||||
@@ -10,10 +10,10 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_devices.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_devices.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -26,11 +26,11 @@ if (!$API->checkPermissions('admin-devices', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['slugify'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/slugify.js'] = true;
|
||||
$jsScriptLoadData['datepicker'] = true;
|
||||
$jsScriptLoadData['multiple_select'] = true;
|
||||
$jsScriptLoadData['validateJson'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/multiple_select.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/validateJson.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -58,7 +58,7 @@ if ($_GET['add'] == 'phone' || $_GET['add'] == 'base') {
|
||||
$formInputs[] = 'device_extra';
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('add_device'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('add_device'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -145,7 +145,7 @@ $formBuilder->startForm();
|
||||
<label for="device_image" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('device_image') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<div class="input-file input-file-image">
|
||||
<img class="img-upload-preview" width="200" src="/src/images/placeholder500x500.png" alt="preview">
|
||||
<img class="img-upload-preview" width="200" src="/src/images/placeholder200x200.png" alt="preview">
|
||||
<input type="file" class="form-control form-control-file" id="device_image" name="device_image" accept="image/png">
|
||||
<label for="device_image" class="label-input-file btn btn-black btn-round">
|
||||
<span class="btn-label"><i class="fa fa-file-image"></i></span>
|
||||
|
||||
@@ -10,10 +10,10 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_devices.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_devices.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -27,9 +27,9 @@ if (!$API->checkPermissions('admin-devices', 'RW', true)) {
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'][] = true;
|
||||
$jsScriptLoadData['datepicker'] = true;
|
||||
$jsScriptLoadData['multiple_select'] = true;
|
||||
$jsScriptLoadData['validateJson'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/multiple_select.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/validateJson.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -56,8 +56,7 @@ $stmt->bind_param("s", $_GET['edit']);
|
||||
$stmt->execute();
|
||||
$device_data_result = $stmt->get_result();
|
||||
$device_data = $device_data_result->fetch_assoc();
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => $device_data['vendor_name'] . ' ' . $device_data['device_name'], 'href' => '?view=' . $device_data['device_uuid']));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('edit'), 'href' => '?view=' . $device_data['device_uuid']));
|
||||
|
||||
if ($device_data_result->num_rows > 0) {
|
||||
$device_found = true;
|
||||
}
|
||||
@@ -70,7 +69,9 @@ if ($device_data['device_type'] == 'phone' || $device_data['device_type'] == 'ba
|
||||
$formInputs[] = 'device_extra';
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('devices'), 'href' => '/devices/'));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => $device_data['vendor_name'] . ' ' . $device_data['device_name'], 'href' => '?view=' . $device_data['device_uuid']];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('edit'), 'href' => '?view=' . $device_data['device_uuid']];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('devices'), 'href' => '/devices/'];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
|
||||
@@ -9,9 +9,9 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_devices.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_devices.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -23,10 +23,10 @@ if (!$API->checkPermissions('admin-devices', 'RO', true)) {
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['multiFilterSelect'] = true;
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['datatables'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/multiFilterSelect.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/plugin/datatables/datatables.min.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(false, '<i class="fas fa-fax"></i> ' . __('devices'));
|
||||
@@ -48,7 +48,7 @@ if ($API->checkPermissions('admin-devices', 'RW', true)) {
|
||||
$data = $GLOBALS['conn']->query("SELECT * FROM autop_devices INNER JOIN autop_vendors ON autop_devices.device_vendor_uuid = autop_vendors.vendor_uuid");
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('devices'), 'href' => '/devices/'));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('devices'), 'href' => '/devices/'];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -79,7 +79,7 @@ $pageNavbar->outPutNavbar();
|
||||
<tbody>
|
||||
<?php while ($row = $data->fetch_assoc()) { ?>
|
||||
<tr data-item-id="<?php echo $row['device_uuid']; ?>">
|
||||
<td style="padding-top: 0px!important;padding-bottom: 0px!important;">
|
||||
<td style="padding-top: 0!important;padding-bottom: 0!important;">
|
||||
<img class="img-upload-preview" src="data:image/png;base64, <?php echo $row['device_image_thumbnail'] ?>" alt="">
|
||||
</td>
|
||||
<td><?php echo ucfirst($row['device_type']) ?></td>
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API;
|
||||
use bin\php\Classes\pageNavbar;
|
||||
|
||||
if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_devices.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_devices.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -18,7 +23,7 @@ if (!$API->checkPermissions('admin-devices', 'RO', true)) {
|
||||
}
|
||||
|
||||
# Page functions
|
||||
function showExtension($devicesLinked, $filter = false)
|
||||
function showExtension($devicesLinked, $filter = false): void
|
||||
{
|
||||
if (count($devicesLinked) > 0) {
|
||||
foreach ($devicesLinked as $extension) {
|
||||
@@ -34,7 +39,7 @@ function showExtension($devicesLinked, $filter = false)
|
||||
<?php }
|
||||
}
|
||||
|
||||
function makeFileTables($API, $dataFolder, $device_slugify)
|
||||
function makeFileTables($API, $dataFolder, $device_slugify): void
|
||||
{
|
||||
$device_data_dir = $_SERVER['DOCUMENT_ROOT'] . '/data/devices/' . $device_slugify . '/' . $dataFolder . '/';
|
||||
$documents = array_diff(scandir($device_data_dir), array('..', '.'));
|
||||
@@ -70,7 +75,7 @@ function makeFileTables($API, $dataFolder, $device_slugify)
|
||||
<?php }
|
||||
}
|
||||
|
||||
function render_template_controls($template_uuid, $device_uuid, $default_template, $platform_uuid)
|
||||
function render_template_controls($template_uuid, $device_uuid, $default_template, $platform_uuid): void
|
||||
{
|
||||
?>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
@@ -97,10 +102,10 @@ function render_template_controls($template_uuid, $device_uuid, $default_templat
|
||||
}
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['delete_confirmation'][] = true;
|
||||
$jsScriptLoadData['load_dropzone'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/load_dropzone.js'] = true;
|
||||
$jsScriptLoadData['form'][] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -135,8 +140,8 @@ if ($device_data_result->num_rows == 0) {
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('devices'), 'href' => '/devices/'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => $device_data['vendor_name'] . ' ' . $device_data['device_name'], 'href' => '?view=' . $device_data['device_uuid']));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('devices'), 'href' => '/devices/'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => $device_data['vendor_name'] . ' ' . $device_data['device_name'], 'href' => '?view=' . $device_data['device_uuid']];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -198,6 +203,7 @@ $pageNavbar->outPutNavbar();
|
||||
<tr>
|
||||
<td class="align-top">device_extra:</td>
|
||||
<td class="w-100">
|
||||
<label for="device_extra"></label>
|
||||
<textarea class="form-control" id="device_extra" name="device_extra" rows="5" disabled><?php echo json_encode(json_decode($device_data['device_extra']), JSON_PRETTY_PRINT) ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -213,7 +219,7 @@ $pageNavbar->outPutNavbar();
|
||||
<h4>Uses</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
To be made. Its going to be visible where the device is used (organisation/site).
|
||||
To be made. It's going to be visible where the device is used (organisation/site).
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -235,7 +241,7 @@ $pageNavbar->outPutNavbar();
|
||||
|
||||
$device_extensions = array();
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
array_push($device_extensions, $row['device_uuid']);
|
||||
$device_extensions[] = $row['device_uuid'];
|
||||
}
|
||||
$stmt->close();
|
||||
}
|
||||
@@ -252,7 +258,7 @@ $pageNavbar->outPutNavbar();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
array_push($devicesLinked, $row);
|
||||
$devicesLinked[] = $row;
|
||||
}
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
if (isset($_GET['add'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pagePlatforms_add.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pagePlatforms_add.php";
|
||||
} elseif (isset($_GET['edit'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pagePlatforms_edit.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pagePlatforms_edit.php";
|
||||
} else {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pagePlatforms_list.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pagePlatforms_list.php";
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API;
|
||||
use bin\php\Classes\pageNavbar;
|
||||
use bin\php\Classes\formBuilder;
|
||||
|
||||
if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -21,8 +25,8 @@ if (!$API->checkPermissions('admin-access-control-permissions', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['slugify'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/slugify.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -34,8 +38,8 @@ $formBuilder->submitButtonIcon = '<i class="fas fa-save"></i>';
|
||||
# Retrieve Information for the page
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('platforms'), 'href' => '/platforms/'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('add_platform'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('platforms'), 'href' => '/platforms/'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('add_platform'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
|
||||
@@ -11,10 +11,10 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_platforms.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_platforms.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -27,7 +27,7 @@ if (!$API->checkPermissions('admin-platforms', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -47,8 +47,8 @@ $API_platforms->validateData($requiredFields);
|
||||
$platform_data = $API_platforms->getPlatforms()[0];
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('platforms'), 'href' => '/platforms/'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('edit_platform'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('platforms'), 'href' => '/platforms/'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('edit_platform'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
if ($platform_data) {
|
||||
|
||||
@@ -9,8 +9,8 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
|
||||
@@ -3,9 +3,9 @@ if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
if (isset($_GET['add'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pageVendors_add.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pageVendors_add.php";
|
||||
} elseif (isset($_GET['edit'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pageVendors_edit.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pageVendors_edit.php";
|
||||
} else {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/autop/pageVendors_list.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/autop/pageVendors_list.php";
|
||||
}
|
||||
@@ -10,10 +10,10 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_vendors.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_vendors.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -24,8 +24,8 @@ if (!$API->checkPermissions('admin-vendors', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['slugify'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/slugify.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -34,7 +34,7 @@ $pageNavbar->AddHTMLButton('<a href="?add="><button class="btn btn-primary"><i c
|
||||
$formBuilder = new formBuilder('add_vendor', '<i class="fas fa-plus"></i>', '/vendors/');
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('add_vendor'), 'href' => '/vendors/'));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('add_vendor'), 'href' => '/vendors/'];
|
||||
|
||||
# Retrieve Information for the page
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_vendors.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_vendors.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -27,7 +27,7 @@ if (!$API->checkPermissions('admin-vendors', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -47,7 +47,7 @@ $API_vendors->validateData($requiredFields);
|
||||
$vendor_data = $API_vendors->getVendors()[0];
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('edit_vendor'), 'href' => '/vendors/'));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('edit_vendor'), 'href' => '/vendors/'];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -58,14 +58,14 @@ if ($vendor_data) { ?>
|
||||
<input type="hidden" name="X-HTTP-Method-Override" value="PUT">
|
||||
<div class="card-body">
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="vendor_name" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('vendor_name') ?></label>
|
||||
<label for="vendor_name_edit" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('vendor_name') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="text" class="form-control" id="vendor_name_edit" name="vendor_name" placeholder="" value="<?php echo $vendor_data['vendor_name'] ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="vendor_slugify" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('vendor_slugify') ?></label>
|
||||
<label for="vendor_slugify_edit" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('vendor_slugify') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="text" class="form-control" id="vendor_slugify_edit" name="vendor_slugify" placeholder="" value="<?php echo $vendor_data['vendor_slugify'] ?>" required disabled>
|
||||
</div>
|
||||
|
||||
@@ -11,9 +11,9 @@ if (!defined('APP_INIT')) {
|
||||
// N/A
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_vendors.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_vendors.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!$GLOBALS['modules_enabled']['customers']) {
|
||||
}
|
||||
|
||||
if (isset($_GET['view'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/customers/pageCompanies_company_view.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/customers/pageCompanies_company_view.php";
|
||||
} else {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/customers/pageCompanies_view.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/customers/pageCompanies_view.php";
|
||||
}
|
||||
@@ -15,9 +15,9 @@ if (!$GLOBALS['modules_enabled']['customers']) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/serverOverviewBuilder.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_servers.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/serverOverviewBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_servers.php";
|
||||
|
||||
# Check permissions
|
||||
$API_servers = new API_servers();
|
||||
@@ -30,10 +30,10 @@ if (!$API_servers->checkPermissions('customer-companies', 'RO', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['datepicker'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['datatables'] = true;
|
||||
$jsScriptLoadData['multiFilterSelectServers'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/plugin/datatables/datatables.min.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/multiFilterSelectServers.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -49,8 +49,8 @@ $result = $stmt->get_result();
|
||||
$company_data = $result->fetch_assoc();
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('companies'), 'href' => '/companies/'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => $company_data['company_name'], 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('companies'), 'href' => '/companies/'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => $company_data['company_name'], 'href' => ''];
|
||||
|
||||
# Retrieve Information for the page
|
||||
$company_uuid = htmlspecialchars($_GET['view'], ENT_QUOTES, 'UTF-8');
|
||||
|
||||
@@ -12,8 +12,8 @@ if (!$GLOBALS['modules_enabled']['customers']) {
|
||||
# Includes Section
|
||||
use api\classes\API;
|
||||
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_permissions.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_permissions.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -25,11 +25,11 @@ if (!$API->checkPermissions('customer-companies', 'RO', true)) {
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['datatables'] = true;
|
||||
$jsScriptLoadData['multiFilterSelect'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/plugin/datatables/datatables.min.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/multiFilterSelect.js'] = true;
|
||||
$jsScriptLoadData['datepicker'] = true;
|
||||
$jsScriptLoadData['activateCompany'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/activateCompany.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API;
|
||||
use api\classes\API_office_stompjes;
|
||||
|
||||
if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
@@ -14,11 +14,10 @@ if (!$GLOBALS['modules_enabled']['office']) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_permissions.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_office_stompjes.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
$API = new API_office_stompjes();
|
||||
if (!$API->checkPermissions('office-stompjes', 'RO', true)) {
|
||||
echo 'error 401 unauthorized';
|
||||
exit;
|
||||
@@ -27,15 +26,15 @@ if (!$API->checkPermissions('office-stompjes', 'RO', true)) {
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['stompjes'] = true;
|
||||
$jsScriptLoadData['datatables'] = true;
|
||||
$jsScriptLoadData['multiFilterSelect'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/plugin/chart.js/chart.min.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/stompjes.js'] = true;
|
||||
$jsScriptLoadData['/src/js/plugin/datatables/datatables.min.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/multiFilterSelect.js'] = true;
|
||||
$jsScriptLoadData['datepicker'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
|
||||
|
||||
# Retrieve Information for the page
|
||||
$stmt = $GLOBALS['conn']->query("SELECT user_uuid, user_full_name, user_first_name, user_profile_picture_thumbnail, user_stompable, user_email FROM system_users WHERE user_stompable = '1'");
|
||||
$administrators = [];
|
||||
@@ -50,6 +49,7 @@ if (!isset($_GET['fd'])) {
|
||||
$date = str_replace('/', '-', htmlspecialchars($_GET['fd'], ENT_QUOTES, 'UTF-8'));
|
||||
$SelectFromDate = strtotime($date . ' 00:00:00');
|
||||
}
|
||||
|
||||
if (!isset($_GET['td'])) {
|
||||
$SelectTillDate = time();
|
||||
} else {
|
||||
@@ -57,23 +57,14 @@ if (!isset($_GET['td'])) {
|
||||
$SelectTillDate = strtotime($date . ' 23:59:59');
|
||||
}
|
||||
|
||||
$stompjes = array();
|
||||
$stmt = $GLOBALS['conn']->query("SELECT stomp_uuid, office_stompjes.user_uuid, user_full_name, user_first_name, stomp_timestamp FROM office_stompjes
|
||||
INNER JOIN system_users ON office_stompjes.user_uuid = system_users.user_uuid
|
||||
WHERE stomp_timestamp BETWEEN '$SelectFromDate' AND '$SelectTillDate'
|
||||
AND user_stompable = '1'
|
||||
ORDER BY stomp_timestamp DESC");
|
||||
while ($row = $stmt->fetch_assoc()) {
|
||||
array_push($stompjes, $row);
|
||||
$administrators[$row['user_uuid']]['amount']++;
|
||||
$stompjes = $API->getStomp(true);
|
||||
|
||||
foreach ($stompjes as $stompje) {
|
||||
$administrators[$stompje['user_uuid']]['amount']++;
|
||||
}
|
||||
|
||||
# Start page output
|
||||
?>
|
||||
<script>
|
||||
const stompData = <?php echo json_encode($stompjes); ?>;
|
||||
</script>
|
||||
|
||||
<div class="form-group form-show-validation row mb-3">
|
||||
<div class="col-5">
|
||||
<h2>
|
||||
@@ -81,24 +72,22 @@ while ($row = $stmt->fetch_assoc()) {
|
||||
</h2>
|
||||
</div>
|
||||
<div class="col d-flex justify-content-end px-1">
|
||||
<div class="col-lg-auto col-md-auto col-sm-auto mt-sm-1 px-1">
|
||||
<label>
|
||||
<div class="d-flex align-items-center gap-2 justify-content-end">
|
||||
<h5><?php echo __('from') ?>: </h5>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-lg-auto col-md-auto col-sm-auto">
|
||||
<div class="input-group">
|
||||
<label for="fd"></label>
|
||||
<input type="text" id="fd" class="form-control" data-datepicker="true" value="<?php echo date('d/m/Y', $SelectFromDate) ?>"/>
|
||||
<span class="input-group-text"><i class="fa fa-calendar-check"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-auto col-md-auto col-sm-auto mt-sm-1 px-2">
|
||||
<label>
|
||||
<h5><?php echo __('to') ?>: </h5>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-lg-auto col-md-auto col-sm-auto px-2">
|
||||
<div class="input-group">
|
||||
<label for="td"></label>
|
||||
<input type="text" id="td" class="form-control" data-datepicker="true" value="<?php echo date('d/m/Y', $SelectTillDate) ?>"/>
|
||||
<span class="input-group-text"><i class="fa fa-calendar-check"></i></span>
|
||||
</div>
|
||||
|
||||
263
pub/bin/pages/office/pageTravelReimbursement.php
Normal file
263
pub/bin/pages/office/pageTravelReimbursement.php
Normal file
@@ -0,0 +1,263 @@
|
||||
<?php
|
||||
|
||||
|
||||
use api\classes\API_office_travel_reimburse;
|
||||
use api\classes\API_companies;
|
||||
|
||||
if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$GLOBALS['modules_enabled']['office']) {
|
||||
echo '405 Not Allowed';
|
||||
exit;
|
||||
}
|
||||
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_office_travel_reimburse.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API_office_travel_reimburse();
|
||||
if (!$API->checkPermissions('office-travel-reimburse', 'RO', true)) {
|
||||
echo 'error 401 unauthorized';
|
||||
exit;
|
||||
}
|
||||
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['/src/js/plugin/fullcalendar/fullcalendar.global.js'] = true;
|
||||
$jsScriptLoadData['/src/css/fullcalendar/theme/global.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/travelReimburse.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/companiesMap.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
|
||||
# Retrieve Information for the page
|
||||
$API_companies = new API_companies();
|
||||
$_GET['builder'] = [1 => ['where' => [0 => 'company_state', 1 => 'active']]];
|
||||
|
||||
# Retrieve Information for the page
|
||||
$portal_settings = $GLOBALS['conn']->query("SELECT * FROM system_settings")->fetch_assoc();
|
||||
|
||||
$companies = $API_companies->getCompanies();
|
||||
|
||||
# Start page output
|
||||
?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body pt-2">
|
||||
<form id="defaultForNew" enctype="multipart/form-data" method="post" action="/api/v1/portal-management/users/">
|
||||
<div class="row align-items-end mt-0">
|
||||
<div class="col mt-0">
|
||||
<label for="new_departure_postcode" class="form-label"><?php echo __('departure_postcode') ?></label>
|
||||
<input type="text" id="new_departure_postcode" class="form-control" value="" placeholder="Departure Postcode" required>
|
||||
</div>
|
||||
|
||||
<div class="col mt-0">
|
||||
<label for="new_destination_postcode" class="form-label"><?php echo __('destination_postcode') ?></label>
|
||||
<input type="text" id="new_destination_postcode" class="form-control" value="" placeholder="Destination Postcode" required>
|
||||
</div>
|
||||
|
||||
<div class="col mt-0">
|
||||
<label for="new_travel_distance" class="form-label"><?php echo __('kilometers') ?></label>
|
||||
<input type="number" id="new_travel_distance" class="form-control" value="" placeholder="0" required>
|
||||
</div>
|
||||
|
||||
<div class="col mt-0">
|
||||
<label for="new_office_travelreimburse_company_uuid" class="form-label"><?php echo __('company') ?></label>
|
||||
<select id="new_office_travelreimburse_company_uuid" class="form-select" required>
|
||||
<option value=""></option>
|
||||
<?php foreach ($companies as $company) { ?>
|
||||
<option value="<?php echo $company['company_uuid'] ?>">
|
||||
<?php echo $company['company_name'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-check-label" for="new_homework"><?php echo __('homework') ?></label>
|
||||
<div class="form-check form-switch pb-3 mb-4">
|
||||
<input class="form-check-input" type="checkbox" id="new_homework">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<button type="submit" class="btn btn-success">
|
||||
<?php echo __('save_default') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid h-100 d-flex flex-column p-0">
|
||||
<div id="calendar" class="flex-grow-1"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="travelModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h5><?php echo __('edit') . ' ' . __('travelReimburse') ?></h5>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<input type="hidden" id="reimburse_uuid">
|
||||
<input type="hidden" id="travel_date">
|
||||
|
||||
<div class="mb-3">
|
||||
<label><?php echo __('departure_postcode') ?></label>
|
||||
<label for="departure_postcode"></label><input class="form-control" id="departure_postcode" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label><?php echo __('destination_postcode') ?></label>
|
||||
<label for="destination_postcode"></label><input class="form-control" id="destination_postcode" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label><?php echo __('kilometers') ?></label>
|
||||
<label for="travel_distance"></label><input type="number" class="form-control" id="travel_distance" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label><?php echo __('company') ?></label>
|
||||
<select id="office_travelreimburse_company_uuid" aria-label="office_travelreimburse_company_uuid" aria-describedby="office_travelreimburse_company_uuid" class="form-control" required>
|
||||
<option value=""></option>
|
||||
<?php foreach ($companies as $company) { ?>
|
||||
<option value="<?php echo $company['company_uuid'] ?>"><?php echo $company['company_name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label><?php echo __('description') ?></label>
|
||||
<label for="travel_description"></label><textarea class="form-control" id="travel_description"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-switch pb-3 mb-3">
|
||||
<label class="form-check-label" for="homework"><?php echo __('total_travel_distance_homework') ?></label>
|
||||
<input class="form-check-input" type="checkbox" id="homework">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-danger" id="deleteTravelBtn"><?php echo __('delete') ?></button>
|
||||
<button class="btn btn-primary" id="saveTravelBtn"><?php echo __('save') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<table class="table table-sm table-responsive">
|
||||
<tr>
|
||||
<td><?php echo __('office_travelreimburse_cents_homework_incl') ?>:</td>
|
||||
<td>
|
||||
<span id="office_travelreimburse_cents_homework_incl">
|
||||
€ <?php echo number_format($portal_settings['office_travelreimburse_cents_homework_incl'] / 100, 2, ',', '.') ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="total_travel_distance_homework_incl"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="office_travelreimburse_cents_homework_incl_total">
|
||||
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('office_travelreimburse_cents_homework_excl') ?>:</td>
|
||||
<td>
|
||||
<span id="office_travelreimburse_cents_homework_excl">
|
||||
€ <?php echo number_format($portal_settings['office_travelreimburse_cents_homework_excl'] / 100, 2, ',', '.') ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="total_travel_distance_homework_excl"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="office_travelreimburse_cents_homework_excl_total">
|
||||
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('office_travelreimburse_cents_business_incl') ?>:</td>
|
||||
<td>
|
||||
<span id="office_travelreimburse_cents_business_incl">
|
||||
€ <?php echo number_format($portal_settings['office_travelreimburse_cents_business_incl'] / 100, 2, ',', '.') ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="total_travel_distance_business_incl"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="office_travelreimburse_cents_business_incl_total">
|
||||
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('office_travelreimburse_cents_business_excl') ?>:</td>
|
||||
<td>
|
||||
<span id="office_travelreimburse_cents_business_excl">
|
||||
€ <?php echo number_format($portal_settings['office_travelreimburse_cents_business_excl'] / 100, 2, ',', '.') ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="total_travel_distance_business_excl"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="office_travelreimburse_cents_business_excl_total">
|
||||
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('total_travel_incl') ?>:</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<span id="total_travel_incl">
|
||||
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('total_travel_excl') ?>:</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<span id="total_travel_excl">
|
||||
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<form method="POST" action="/api/v1/office/travel-reimburse/send/">
|
||||
<input type="hidden" name="calender_month" id="calender_month" value="">
|
||||
<button class="btn btn-success" type="submit">
|
||||
<i class="fa-regular fa-envelope"></i> <?php echo __('mail_travelreimburse') ?>
|
||||
<br> (<?php echo $_SESSION['user']['user_email'] ?>)
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="card-body py-0 border">
|
||||
<h5>
|
||||
Sentri<br> Made by:
|
||||
<a class="text-decoration-none" href="https://marcomooij.net" target="_blank">Marco Mooij</a><br> Version 1.2.3
|
||||
<a class="text-decoration-none" href="https://marcomooij.net" target="_blank">Marco Mooij</a><br> Version 1.3.0
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,10 +8,10 @@ if (!defined('APP_INIT')) {
|
||||
# Includes Section
|
||||
use api\classes\API;
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
$API = new API();
|
||||
|
||||
function showCard($module_name, $page_name, $width = 3)
|
||||
function showCard($module_name, $page_name): void
|
||||
{
|
||||
$page = $GLOBALS['pages'][$module_name][$page_name];
|
||||
?>
|
||||
@@ -40,15 +40,16 @@ function showCard($module_name, $page_name, $width = 3)
|
||||
<div class="row row-cols-1 row-cols-md-3 row-cols-sm-2 g-3">
|
||||
<?php
|
||||
if ($GLOBALS['modules_enabled']['customers'] && $API->checkPermissions('customer-companies', 'RO', true)) {
|
||||
showCard('customers', 'companies', '6');
|
||||
showCard('customers', 'companies');
|
||||
}
|
||||
|
||||
if ($GLOBALS['modules_enabled']['servers'] && $API->checkPermissions('servers', 'RO', true)) {
|
||||
showCard('servers', 'server_overview', '6');
|
||||
showCard('servers', 'server_overview');
|
||||
}
|
||||
|
||||
if ($GLOBALS['modules_enabled']['office'] && $API->checkPermissions('office-stompjes', 'RO', true)) {
|
||||
showCard('office', 'stompjeslist');
|
||||
showCard('office', 'travelReimburse');
|
||||
}
|
||||
|
||||
if ($GLOBALS['modules_enabled']['autop']) {
|
||||
@@ -62,7 +63,7 @@ function showCard($module_name, $page_name, $width = 3)
|
||||
|
||||
if ($GLOBALS['modules_enabled']['portal-management']) {
|
||||
showCard('portal-management', 'access_control');
|
||||
showCard('portal-management', 'systemconfig');
|
||||
showCard('portal-management', 'portal-management');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
if (isset($_GET['edit'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/pageUserProfile_edit.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/pageUserProfile_edit.php";
|
||||
} else {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/pageUserProfile_view.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/pageUserProfile_view.php";
|
||||
}
|
||||
|
||||
@@ -9,16 +9,16 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['Generatepassword'] = true;
|
||||
$jsScriptLoadData['passwordShowHide'] = true;
|
||||
$jsScriptLoadData['passwordRegen'] = true;
|
||||
$jsScriptLoadData['enableButtonOnImageUpload'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/Generatepassword.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/passwordShowHide.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/passwordRegen.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/enableButtonOnImageUpload.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -29,7 +29,7 @@ $user_groups_data = $GLOBALS['conn']->query("SELECT * FROM system_user_groups WH
|
||||
$user_groups = array();
|
||||
$user_data = false;
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$user_groups[] = $user_group;
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ if ($result->num_rows == 1) {
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('user_profile'), 'href' => '/userprofile/'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('edit'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('user_profile'), 'href' => '/userprofile/'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('edit'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -60,7 +60,7 @@ if ($user_data) {
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_email" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_email') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="email" class="form-control" id="user_email" name="user_email" value="<?php echo $user_data['user_email'] ?>" placeholder="user@example.xxx" required autofill="off" autocomplete="off"/>
|
||||
<input type="email" class="form-control" id="user_email" name="user_email" value="<?php echo $user_data['user_email'] ?>" placeholder="user@example.xxx" required autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_apitoken.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_apitoken.php";
|
||||
|
||||
# Check permissions
|
||||
|
||||
@@ -18,10 +18,10 @@ include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_apitoken.php');
|
||||
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['enableButtonOnImageUpload'] = true;
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['CopyTargetData'] = true;
|
||||
$jsScriptLoadData['updateToggle'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/enableButtonOnImageUpload.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/CopyTargetData.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/updateToggle.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(false, '<i class="fa-solid fa-address-card"></i> ' . $_SESSION['user']['user_full_name'] . ' ' . strtolower(__('user_profile')));
|
||||
@@ -31,7 +31,7 @@ $user_groups_data = $GLOBALS['conn']->query("SELECT * FROM system_user_groups WH
|
||||
$user_groups = array();
|
||||
$admin_data = false;
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$user_groups[] = $user_group;
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ if (isset($_SESSION['tmp_api_token'])) {
|
||||
|
||||
if ($API_token->checkPermissions('admin-access-admins', 'RW', true)) {
|
||||
$pageNavbar->AddHTMLButton('<a class="btn btn-primary mx-3" type="button" href="?edit=' . $_SESSION['user']['user_uuid'] . '"><i class="fas fa-edit"></i> ' . __('edit') . '</a>');
|
||||
};
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
|
||||
@@ -207,18 +207,18 @@ if ($user_data) { ?>
|
||||
<h4><?php echo __('user_management') ?></h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="mfa-enabled-row" class="row" style="display: <?php echo(($_SESSION['user']['user_two_factor_enabled'] == 1) ? '' : 'none') ?>">
|
||||
<div id="mfa-enabled-row" class="row <?= ($_SESSION['user']['user_two_factor_enabled'] ? '' : 'd-none') ?>">
|
||||
<div class="col-auto">
|
||||
<a href="#" class="btn btn-danger delete-btn" data-item-uuid="<?php echo $user_uuid ?>" data-api-url="/api/v1/user/mfa/" data-delete-action='{"mfa-enabled-row":"hide", "mfa-disabled-row":"show"}' data-item-name='user_uuid'>
|
||||
<i class="fa-solid fa-lock"></i> <?php echo __('reset_mfa') ?>
|
||||
<a href="#" class="btn btn-danger delete-btn" data-item-uuid="<?= $user_uuid ?>" data-api-url="/api/v1/user/mfa/" data-item-name="user_uuid" data-delete-action='{"mfa-enabled-row":"hide", "mfa-disabled-row":"show"}'>
|
||||
<i class="fa-solid fa-lock"></i> <?= __('reset_mfa') ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="mfa-disabled-row" class="row" style="display: <?php echo(($_SESSION['user']['user_two_factor_enabled'] == 1) ? 'none' : '') ?>">
|
||||
<div id="mfa-disabled-row" class="row <?= ($_SESSION['user']['user_two_factor_enabled'] ? 'd-none' : '') ?>">
|
||||
<div class="col-auto">
|
||||
<a class="btn btn-primary" href="/login/mfaSetup.php">
|
||||
<i class="fa-solid fa-lock"></i> <?php echo __('set_mfa') ?>
|
||||
<a href="/login/mfaSetup.php" class="btn btn-success">
|
||||
<i class="fa-solid fa-lock"></i> <?= __('set_mfa') ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -242,7 +242,7 @@ if ($user_data) { ?>
|
||||
<h4 class="mb-0">User history</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
To be made. Its going show the history of the user.
|
||||
To be made. It's going show the history of the user.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -299,9 +299,9 @@ if ($user_data) { ?>
|
||||
<tbody>
|
||||
<?php foreach ($apitokens as $token_data) { ?>
|
||||
<tr>
|
||||
<td class="text-nowrap" style="max-width: 100%;">
|
||||
<div class="d-flex align-items-center gap-2" style="max-width: 100%;">
|
||||
<div class="text-truncate" style="max-width: 200px;" id="<?php echo $token_data['api_token_uuid'] ?>" data-copy-data="<?php echo $token_data['api_token_uuid']; ?>">
|
||||
<td class="text-nowrap w-100">
|
||||
<div class="d-flex align-items-center gap-2 w-100">
|
||||
<div class="text-truncate" id="<?php echo $token_data['api_token_uuid'] ?>" data-copy-data="<?php echo $token_data['api_token_uuid']; ?>">
|
||||
<?php echo $token_data['api_token_uuid']; ?>
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" data-copy-target="<?php echo $token_data['api_token_uuid'] ?>" title="Copy ID">
|
||||
@@ -316,7 +316,7 @@ if ($user_data) { ?>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="checkbox" data-api-data='<?php echo json_encode(['api_token_uuid' => $token_data['api_token_uuid'], 'api_token_revoked' => $token_data['api_token_revoked'] ? 1 : 0]) ?>' data-api-changevalue="api_token_revoked" data-api-url="/api/v1/user/apitoken/" <?php echo((($token_data['api_token_revoked'])) ? 'checked' : '') ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
<?php if ($API_token->checkPermissions('user-apitoken-self', 'RW', true)) { ?>
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API;
|
||||
|
||||
if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
# IDE Section
|
||||
|
||||
|
||||
# Includes Section
|
||||
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_companies.php";
|
||||
# Check permissions
|
||||
$API = new \api\classes\API_companies();
|
||||
|
||||
# Page functions
|
||||
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['/src/js/sentri/activeTabOnRefresh.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/copyInputValue.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/updateToggle.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
|
||||
# Retrieve Information for the page
|
||||
$portal_settings = $GLOBALS['conn']->query("SELECT * FROM system_settings")->fetch_assoc();
|
||||
|
||||
$companies = [];
|
||||
if ($GLOBALS['modules_enabled']['customers']) {
|
||||
$_GET['builder'] = [1 => ['where' => [0 => 'company_state', 1 => 'active']]];
|
||||
$companies = $API->getCompanies();
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
|
||||
# Start page output
|
||||
|
||||
?><?php if ($API->checkPermissions('admin-portalsettings', 'RO', true)) { ?>
|
||||
<div class="card-body activeTabOnRefresh">
|
||||
<div class="row">
|
||||
<div class="col-md-1 col-lg-2">
|
||||
<div class="nav flex-column nav-pills nav-secondary nav-pills-no-bd nav-pills-icons" id="v-pills-tab-with-icon" role="tablist" aria-orientation="vertical">
|
||||
<a class="nav-link" id="travel-reimbursement-settings-tab" data-bs-toggle="pill" href="#travel-reimburse-settings" role="tab" aria-controls="mail-settings" aria-selected="true">
|
||||
<i class="<?php echo $GLOBALS['pages']['office']['travelReimburse']['page_icon'] ?>"></i><?php echo __('travelReimburse'); ?>
|
||||
</a>
|
||||
|
||||
<a class="nav-link" id="global-settings-tab" data-bs-toggle="pill" href="#stompjes-settings" role="tab" aria-controls="global-settings">
|
||||
<i class="<?php echo $GLOBALS['pages']['office']['stompjeslist']['page_icon'] ?>"></i><?php echo __('stompjeslist'); ?>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-11 col-lg-10">
|
||||
<div class="tab-content" id="v-pills-with-icon-tabContent">
|
||||
<div class="tab-pane fade show active" id="travel-reimburse-settings" role="tabpanel" aria-labelledby="travel-reimbursement-settings-tab">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<h2>
|
||||
<i class="fas fa-globe-americas"></i> <?php echo __('travelReimburse') . " " . __('settings'); ?>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<form id="FormValidation" method="post" action="/api/v1/office/travel-reimburse/configure/">
|
||||
<input type="hidden" name="X-HTTP-Method-Override" value="PUT">
|
||||
<input type="hidden" name="_return" value="/portal-management/modules/office/#travel-reimburse-settings">
|
||||
<input type="hidden" name="portal_uuid" value="<?php echo $portal_settings['portal_uuid']; ?>">
|
||||
<div class="card-body">
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="office_travelreimburse_cents_homework_incl" class="col-lg-4 col-md-4 col-sm-4 mt-sm-2"><?php echo __('office_travelreimburse_cents_homework_incl') ?></label>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<input type="number" class="form-control" id="office_travelreimburse_cents_homework_incl" name="office_travelreimburse_cents_homework_incl" value="<?php echo $portal_settings['office_travelreimburse_cents_homework_incl'] ?>" placeholder="" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="office_travelreimburse_cents_homework_excl" class="col-lg-4 col-md-4 col-sm-4 mt-sm-2"><?php echo __('office_travelreimburse_cents_homework_excl') ?></label>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<input type="number" class="form-control" id="office_travelreimburse_cents_homework_excl" name="office_travelreimburse_cents_homework_excl" value="<?php echo $portal_settings['office_travelreimburse_cents_homework_excl'] ?>" placeholder="" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="office_travelreimburse_cents_business_incl" class="col-lg-4 col-md-4 col-sm-4 mt-sm-2"><?php echo __('office_travelreimburse_cents_business_incl') ?></label>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<input type="number" class="form-control" id="office_travelreimburse_cents_business_incl" name="office_travelreimburse_cents_business_incl" value="<?php echo $portal_settings['office_travelreimburse_cents_business_incl'] ?>" placeholder="" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="office_travelreimburse_cents_business_excl" class="col-lg-4 col-md-4 col-sm-4 mt-sm-2"><?php echo __('office_travelreimburse_cents_business_excl') ?></label>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<input type="number" class="form-control" id="office_travelreimburse_cents_business_excl" name="office_travelreimburse_cents_business_excl" value="<?php echo $portal_settings['office_travelreimburse_cents_business_excl'] ?>" placeholder="" required/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-4">
|
||||
<div class="row">
|
||||
<div class="col d-flex justify-content-end">
|
||||
<?php if ($API->checkPermissions('admin-portalsettings', 'RW', true)) { ?>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-edit"></i> <?php echo __('edit') ?>
|
||||
</button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade show active" id="stompjes-settings" role="tabpanel" aria-labelledby="stompjes-settings-tab">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<h2>
|
||||
<i class="fa-solid fa-envelope"></i> <?php echo __('stompjes') . ' ' . __('settings') ?>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
No settings for stompjes yet.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
@@ -9,11 +9,10 @@ if (!defined('APP_INIT')) {
|
||||
}
|
||||
# IDE Section
|
||||
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -25,11 +24,11 @@ if (!$API->checkPermissions('admin-access-admins', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['Generatepassword'] = true;
|
||||
$jsScriptLoadData['passwordGenOnLoad'] = true;
|
||||
$jsScriptLoadData['passwordShowHide'] = true;
|
||||
$jsScriptLoadData['passwordRegen'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/Generatepassword.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/passwordGenOnLoad.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/passwordShowHide.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/passwordRegen.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -41,13 +40,13 @@ $formBuilder = new formBuilder('add_admin', '<i class="fas fa-plus"></i>', '/acc
|
||||
$user_groups_data = $GLOBALS['conn']->query("SELECT * FROM system_user_groups WHERE user_group_type = 'admin' ORDER BY user_group_weight DESC");
|
||||
$user_groups = array();
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$user_groups[] = $user_group;
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('administrators'), 'href' => '/accesscontrol/#administrators'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('add_admin'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('administrators'), 'href' => '/accesscontrol/#administrators'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('add_admin'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -78,7 +77,7 @@ $formBuilder->startForm();
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_email" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_email') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="email" class="form-control" id="user_email" name="user_email" placeholder="user@example.xxx" required autofill="off" autofocus autocomplete="off"/>
|
||||
<input type="email" class="form-control" id="user_email" name="user_email" placeholder="user@example.xxx" required autofocus autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -25,7 +25,7 @@ if (!$API->checkPermissions('admin-access-admins', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -38,7 +38,7 @@ $user_groups_data = $GLOBALS['conn']->query("SELECT * FROM system_user_groups WH
|
||||
$user_groups = array();
|
||||
$admin_data = false;
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$user_groups[] = $user_group;
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ if ($result->num_rows == 1) {
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('administrators'), 'href' => '/accesscontrol/#administrators'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('edit_admin'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('administrators'), 'href' => '/accesscontrol/#administrators'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('edit_admin'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -82,7 +82,7 @@ if ($admin_data) {
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_email" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_email') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="email" class="form-control" id="user_email" name="user_email" value="<?php echo $admin_data['user_email'] ?>" placeholder="user@example.xxx" required autofill="off" autocomplete="off"/>
|
||||
<input type="email" class="form-control" id="user_email" name="user_email" value="<?php echo $admin_data['user_email'] ?>" placeholder="user@example.xxx" required autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_apitoken.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_apitoken.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -23,13 +23,13 @@ if (!$API->checkPermissions('admin-access-admins', 'RO', true)) {
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['Generatepassword'] = true;
|
||||
$jsScriptLoadData['passwordShowHide'] = true;
|
||||
$jsScriptLoadData['passwordRegen'] = true;
|
||||
$jsScriptLoadData['enableButtonOnImageUpload'] = true;
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['updateToggle'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/Generatepassword.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/passwordShowHide.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/passwordRegen.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/enableButtonOnImageUpload.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/updateToggle.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -45,7 +45,7 @@ $user_groups_data = $GLOBALS['conn']->query("SELECT * FROM system_user_groups WH
|
||||
$user_groups = array();
|
||||
$admin_data = false;
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$user_groups[] = $user_group;
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ $_GET['user_uuid'] = $user_uuid;
|
||||
$userHashigherGroupWeight = false;
|
||||
if ($admin_data['user_group_weight'] > $_SESSION['user']['user_group_weight']) {
|
||||
$userHashigherGroupWeight = true;
|
||||
};
|
||||
}
|
||||
|
||||
$API_token = new API_apitoken();
|
||||
$requiredFields = ['user_uuid' => ['type' => 'uuid']];
|
||||
@@ -71,9 +71,8 @@ $API_token->validateData($requiredFields);
|
||||
$apitokens = $API_token->getTokens();
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('administrators'), 'href' => '/accesscontrol/#administrators'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('view'), 'href' => ''));
|
||||
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('administrators'), 'href' => '/accesscontrol/#administrators'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('view'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -223,30 +222,31 @@ if ($admin_data) { ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if ($API->checkPermissions('admin-access-admins-mfa', 'RW', true)) { ?>
|
||||
<div id="mfa-enabled-row" class="row" style="display: <?php echo(($admin_data['user_two_factor_enabled']) ? '' : 'none') ?>">
|
||||
<div id="mfa-enabled-row" class="row <?= ($admin_data['user_two_factor_enabled'] ? '' : 'd-none') ?>">
|
||||
<div class="col-auto">
|
||||
<a href="#" class="btn btn-danger delete-btn" data-item-uuid="<?php echo $admin_data['user_uuid'] ?>" data-api-url="/api/v1/user/mfa/" data-item-name='user_uuid' data-delete-action='{"mfa-enabled-row":"hide", "mfa-disabled-row":"show"}'>
|
||||
<i class="fa-solid fa-lock"></i> <?php echo __('reset_mfa') ?>
|
||||
<a href="#" class="btn btn-danger delete-btn" data-item-uuid="<?= $admin_data['user_uuid'] ?>" data-api-url="/api/v1/user/mfa/" data-item-name="user_uuid" data-delete-action='{"mfa-enabled-row":"hide", "mfa-disabled-row":"show"}'>
|
||||
<i class="fa-solid fa-lock"></i> <?= __('reset_mfa') ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="mfa-disabled-row" class="row" style="display: <?php echo(($admin_data['user_two_factor_enabled'] == 1) ? 'none' : '') ?>">
|
||||
<div id="mfa-disabled-row" class="row <?= ($admin_data['user_two_factor_enabled'] ? 'd-none' : '') ?>">
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-danger delete-btn" href="#" disabled>
|
||||
<i class="fa-solid fa-lock"></i> <?php echo __('reset_mfa') ?>
|
||||
<button class="btn btn-danger delete-btn" disabled>
|
||||
<i class="fa-solid fa-lock"></i> <?= __('reset_mfa') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ($API->checkPermissions('admin-access-admins-resetpassword', 'RW', true)) { ?>
|
||||
<?php }
|
||||
if ($API->checkPermissions('admin-access-admins-resetpassword', 'RW', true)) { ?>
|
||||
<form method="post" action="/api/v1/user/resetpassword/">
|
||||
<input type="hidden" name="user_uuid" value="<?php echo $user_uuid ?>">
|
||||
<input type="hidden" name="user_uuid" value="<?= $user_uuid ?>">
|
||||
<button class="btn btn-primary mt-2">
|
||||
<i class="fa-solid fa-lock"></i> <?php echo __('send_password_reset') ?>
|
||||
<i class="fa-solid fa-lock"></i> <?= __('send_password_reset') ?>
|
||||
</button>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
reset the verified email (to be made)<br>
|
||||
</div>
|
||||
</div>
|
||||
@@ -288,9 +288,9 @@ if ($admin_data) { ?>
|
||||
<tbody>
|
||||
<?php foreach ($apitokens as $token_data) { ?>
|
||||
<tr>
|
||||
<td class="text-nowrap" style="max-width: 100%;">
|
||||
<div class="d-flex align-items-center gap-2" style="max-width: 100%;">
|
||||
<div class="text-truncate" style="max-width: 200px;" id="<?php echo $token_data['api_token_uuid'] ?>" data-copy-data="<?php echo $token_data['api_token_uuid']; ?>">
|
||||
<td class="text-nowrap">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<div class="text-truncate" id="<?php echo $token_data['api_token_uuid'] ?>" data-copy-data="<?php echo $token_data['api_token_uuid']; ?>">
|
||||
<?php echo $token_data['api_token_uuid']; ?>
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" data-copy-target="<?php echo $token_data['api_token_uuid'] ?>" title="Copy ID">
|
||||
@@ -305,7 +305,7 @@ if ($admin_data) { ?>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="checkbox" data-api-data='<?php echo json_encode(['api_token_uuid' => $token_data['api_token_uuid'], 'api_token_revoked' => $token_data['api_token_revoked'] ? 1 : 0]) ?>' data-api-changevalue="api_token_revoked" data-api-url="/api/v1/user/apitoken/" <?php echo((($token_data['api_token_revoked'])) ? 'checked' : '') ?> <?php echo($userHashigherGroupWeight ? '' : 'disabled') ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
<?php if ($API_token->checkPermissions('user-apitoken-others', 'RW', true)) { ?>
|
||||
@@ -330,7 +330,7 @@ if ($admin_data) { ?>
|
||||
<h4>User history</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
To be made. Its going show the history of the administrator.
|
||||
To be made. It's going show the history of the administrator.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,9 +10,9 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -25,8 +25,8 @@ if (!$API->isSuperuser()) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'][] = true;
|
||||
$jsScriptLoadData['slugify'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/slugify.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -36,13 +36,13 @@ $formBuilder = new formBuilder('add_permission', '<i class="fas fa-plus"></i>',
|
||||
$system_modules_data = $GLOBALS['conn']->query("SELECT * FROM system_modules WHERE module_enabled = 1");
|
||||
$system_modules = array();
|
||||
while ($module = $system_modules_data->fetch_assoc()) {
|
||||
array_push($system_modules, $module);
|
||||
$system_modules[] = $module;
|
||||
}
|
||||
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('permission'), 'href' => '/accesscontrol/#permissions'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('add_permission'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('permission'), 'href' => '/accesscontrol/#permissions'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('add_permission'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
|
||||
@@ -11,10 +11,10 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_permissions.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_permissions.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -28,7 +28,7 @@ if (!$API->isSuperuser()) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'][] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -47,12 +47,12 @@ $permission_data = $API_permissions->getPermission()[0];
|
||||
$system_modules_data = $GLOBALS['conn']->query("SELECT * FROM system_modules WHERE module_enabled = 1");
|
||||
$system_modules = array();
|
||||
while ($module = $system_modules_data->fetch_assoc()) {
|
||||
array_push($system_modules, $module);
|
||||
$system_modules[] = $module;
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('permission'), 'href' => '/accesscontrol/#permissions'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('edit_permission'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('permission'), 'href' => '/accesscontrol/#permissions'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('edit_permission'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
|
||||
@@ -10,9 +10,9 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_permissions.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_permissions.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -24,10 +24,10 @@ if (!$API->checkPermissions('admin-access-control-permissions', 'RO', true)) {
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['datatables'] = true;
|
||||
$jsScriptLoadData['updatePermissions'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/plugin/datatables/datatables.min.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/updatePermissions.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -52,8 +52,8 @@ $API_permissions->validateData($requiredFields);
|
||||
$permission_data = $API_permissions->getPermissionRights();
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('permission'), 'href' => '/accesscontrol/#permissions'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('view'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('permission'), 'href' => '/accesscontrol/#permissions'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('view'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -125,21 +125,21 @@ if ($permission_data) { ?>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="checkbox" data-permission-uuid="<?= $permission_data_group['permission_uuid'] ?>" data-user-group-uuid="<?= $permission_data_group['user_group_uuid'] ?>" data-value="NA" data-api-url="/api/v1/portal-management/group-permissions/" <?php echo(($permission_data_group['permission_value'] == 'NA') ? 'checked' : '') ?>
|
||||
<?php echo ($API->checkPermissions('admin-access-control-permissions', 'RW', true)) ? '' : 'disabled' ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="checkbox" data-permission-uuid="<?= $permission_data_group['permission_uuid'] ?>" data-user-group-uuid="<?= $permission_data_group['user_group_uuid'] ?>" data-value="RO" data-api-url="/api/v1/portal-management/group-permissions/" <?php echo(($permission_data_group['permission_value'] == 'RO') ? 'checked' : '') ?>
|
||||
<?php echo ($API->checkPermissions('admin-access-control-permissions', 'RW', true)) ? '' : 'disabled' ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="checkbox" data-permission-uuid="<?= $permission_data_group['permission_uuid'] ?>" data-user-group-uuid="<?= $permission_data_group['user_group_uuid'] ?>" data-value="RW" data-api-url="/api/v1/portal-management/group-permissions/" <?php echo(($permission_data_group['permission_value'] == 'RW') ? 'checked' : '') ?>
|
||||
<?php echo ($API->checkPermissions('admin-access-control-permissions', 'RW', true)) ? '' : 'disabled' ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -10,9 +10,9 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -25,8 +25,8 @@ if (!$API->checkPermissions('admin-access-control-user-groups', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'][] = true;
|
||||
$jsScriptLoadData['slugify'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/slugify.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -36,13 +36,13 @@ $formBuilder = new formBuilder('add_user_groups', '<i class="fas fa-plus"></i>',
|
||||
$user_groups_data = $GLOBALS['conn']->query("SELECT * FROM system_user_groups ORDER BY user_group_weight ASC");
|
||||
$user_groups = array();
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$user_groups[] = $user_group;
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('user_groups'), 'href' => '/accesscontrol/#user-groups'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('add_user_groups'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('user_groups'), 'href' => '/accesscontrol/#user-groups'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('add_user_groups'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -80,7 +80,9 @@ $formBuilder->startForm();
|
||||
<label for="user_group_slugify" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('weight') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<div class="mb-3">
|
||||
<label>
|
||||
<input type="number" class="form-control" name="user_group_weight" min="1" max="900" step="1" value="<?php echo $last_weight + 10 ?>">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,10 +11,10 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_usergroups.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/formBuilder.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_usergroups.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -27,8 +27,8 @@ if (!$API->checkPermissions('admin-access-control-user-groups', 'RW', true)) {
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['slugify'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/slugify.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -44,9 +44,9 @@ $API_usergroups->validateData($requiredFields);
|
||||
$user_group = $API_usergroups->getUsergroup()[0];
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('user_groups'), 'href' => '/accesscontrol/#user-groups'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => $user_group['user_group_name'], 'href' => '/accesscontrol/#user-groups'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('edit'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('user_groups'), 'href' => '/accesscontrol/#user-groups'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => $user_group['user_group_name'], 'href' => '/accesscontrol/#user-groups'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('edit'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -87,7 +87,9 @@ $formBuilder->startForm();
|
||||
<label for="user_group_slugify" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('weight') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<div class="mb-3">
|
||||
<label>
|
||||
<input type="number" class="form-control" name="user_group_weight" min="1" max="900" step="1" value="<?php echo $user_group['user_group_weight'] ?>">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,8 +9,8 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_usergroups.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_usergroups.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API_usergroups();
|
||||
@@ -22,8 +22,8 @@ if (!$API->checkPermissions('admin-access-control-user-groups', 'RO', true)) {
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['updatePermissions'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/updatePermissions.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -56,8 +56,8 @@ if (!$API->checkPermissions('admin-access-control-permissions', 'RW', true)) {
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('user_groups'), 'href' => '/accesscontrol/#user-groups'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => $user_group['user_group_name'], 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('user_groups'), 'href' => '/accesscontrol/#user-groups'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => $user_group['user_group_name'], 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -145,26 +145,27 @@ $pageNavbar->outPutNavbar();
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="checkbox" data-permission-uuid="<?= $group_permissions_data['permission_uuid'] ?>" data-user-group-uuid="<?= $group_permissions_data['user_group_uuid'] ?>" data-value="NA" data-api-url="/api/v1/portal-management/group-permissions/" <?php echo(($group_permissions_data['permission_value'] == 'NA') ? 'checked' : '') ?>
|
||||
<?php echo ($toggleDisabled) ? 'disabled' : '' ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="checkbox" data-permission-uuid="<?= $group_permissions_data['permission_uuid'] ?>" data-user-group-uuid="<?= $group_permissions_data['user_group_uuid'] ?>" data-value="RO" data-api-url="/api/v1/portal-management/group-permissions/" <?php echo(($group_permissions_data['permission_value'] == 'RO') ? 'checked' : '') ?>
|
||||
<?php echo ($toggleDisabled) ? 'disabled' : '' ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="checkbox" data-permission-uuid="<?= $group_permissions_data['permission_uuid'] ?>" data-user-group-uuid="<?= $group_permissions_data['user_group_uuid'] ?>" data-value="RW" data-api-url="/api/v1/portal-management/group-permissions/" <?php echo(($group_permissions_data['permission_value'] == 'RW') ? 'checked' : '') ?>
|
||||
<?php echo ($toggleDisabled) ? 'disabled' : '' ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" class="btn btn-info btn-sm btn-rounded" data-bs-toggle="modal" data-bs-target="#infoModal<?php echo $group_permissions_data['permission_uuid'] ?>"><i class="fa-solid fa-circle-info"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<div class="modal fade" id="infoModal<?php echo $group_permissions_data['permission_uuid'] ?>" tabindex="-1" aria-labelledby="infoModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div class="modal-content bg-black2">
|
||||
@@ -180,7 +181,6 @@ $pageNavbar->outPutNavbar();
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -8,8 +8,8 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_permissions.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_permissions.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -17,10 +17,10 @@ $API = new API();
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['activeTabOnRefresh'] = true;;
|
||||
$jsScriptLoadData['multiFilterSelect'] = true;
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['datatables'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/activeTabOnRefresh.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/multiFilterSelect.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/plugin/datatables/datatables.min.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
|
||||
@@ -28,7 +28,7 @@ $jsScriptLoadData['datatables'] = true;
|
||||
$user_groups_data = $GLOBALS['conn']->query("SELECT * FROM system_user_groups ORDER BY user_group_weight ASC");
|
||||
$user_groups = array();
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$user_groups[] = $user_group;
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
@@ -36,21 +36,21 @@ while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
$stmt = $GLOBALS['conn']->query("SELECT * FROM system_users INNER JOIN system_user_groups ON system_users.user_group_uuid = system_user_groups.user_group_uuid WHERE user_group_type = 'admin'");
|
||||
$administrators = array();
|
||||
while ($row = $stmt->fetch_assoc()) {
|
||||
array_push($administrators, $row);
|
||||
$administrators[] = $row;
|
||||
}
|
||||
|
||||
|
||||
$stmt = $GLOBALS['conn']->query("SELECT * FROM system_permissions INNER JOIN system_modules ON system_permissions.module_uuid = system_modules.module_uuid WHERE system_modules.module_enabled = 1");
|
||||
$permissions = array();
|
||||
while ($row = $stmt->fetch_assoc()) {
|
||||
array_push($permissions, $row);
|
||||
$permissions[] = $row;
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
|
||||
# Start page output
|
||||
?>
|
||||
<div class="card-body activeTabOnRefresh" style="opacity: 0; transition: opacity 10ms;">
|
||||
<div class="card-body activeTabOnRefresh">
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
<div class="nav flex-column nav-pills nav-secondary nav-pills-no-bd nav-pills-icons" id="v-pills-tab-with-icon" role="tablist" aria-orientation="vertical">
|
||||
|
||||
@@ -3,16 +3,16 @@ if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$jsScriptLoadData['activeTabOnRefresh'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/activeTabOnRefresh.js'] = true;
|
||||
|
||||
?>
|
||||
<div class="card-body activeTabOnRefresh" style="opacity: 0; transition: opacity 10ms;">
|
||||
<div class="card-body activeTabOnRefresh">
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
<div class="nav flex-column nav-pills nav-secondary nav-pills-no-bd nav-pills-icons" id="v-pills-tab-with-icon" role="tablist" aria-orientation="vertical">
|
||||
|
||||
<a class="nav-link active" id="overview-tab" data-bs-toggle="pill" href="#overview" role="tab" aria-controls="overview" aria-selected="true">
|
||||
<i class="fa-solid fa-ear-listen"></i></i><?php echo __('overview'); ?>
|
||||
<i class="fa-solid fa-ear-listen"></i><?php echo __('overview'); ?>
|
||||
</a>
|
||||
<a class="nav-link" id="monitoring-tab" data-bs-toggle="pill" href="#monitoring" role="tab" aria-controls="monitoring">
|
||||
<i class="fa-solid fa-magnifying-glass"></i><?php echo __('monitoring'); ?>
|
||||
@@ -25,7 +25,7 @@ $jsScriptLoadData['activeTabOnRefresh'] = true;
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">
|
||||
<h2>
|
||||
<i class="fa-solid fa-ear-listen"></i></i> <?php echo __('overview') ?>
|
||||
<i class="fa-solid fa-ear-listen"></i> <?php echo __('overview') ?>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!defined('APP_INIT')) {
|
||||
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -18,9 +18,9 @@ $API = new API();
|
||||
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['activeTabOnRefresh'] = true;
|
||||
$jsScriptLoadData['copyInputValue'] = true;
|
||||
$jsScriptLoadData['updateToggle'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/activeTabOnRefresh.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/copyInputValue.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/updateToggle.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
|
||||
@@ -30,7 +30,7 @@ $portal_settings = $GLOBALS['conn']->query("SELECT * FROM system_settings")->fet
|
||||
$system_modules_data = $GLOBALS['conn']->query("SELECT * FROM system_modules");
|
||||
$system_modules = array();
|
||||
while ($module = $system_modules_data->fetch_assoc()) {
|
||||
array_push($system_modules, $module);
|
||||
$system_modules[] = $module;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ while ($module = $system_modules_data->fetch_assoc()) {
|
||||
# Start page output
|
||||
|
||||
?>
|
||||
<div class="card-body activeTabOnRefresh" style="opacity: 0; transition: opacity 10ms;">
|
||||
<div class="card-body activeTabOnRefresh">
|
||||
<div class="row">
|
||||
<div class="col-md-1 col-lg-1">
|
||||
<div class="nav flex-column nav-pills nav-secondary nav-pills-no-bd nav-pills-icons" id="v-pills-tab-with-icon" role="tablist" aria-orientation="vertical">
|
||||
@@ -128,7 +128,7 @@ while ($module = $system_modules_data->fetch_assoc()) {
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="cacert_url" name="cacert_url" value="<?php echo $portal_settings['cacert_url'] ?>" placeholder="" disabled/>
|
||||
<button class="btn btn-outline-secondary" type="button" onclick="copyToClipboard('cacert_url')">
|
||||
<button class="btn btn-outline-secondary" type="button" data-copy-target="cacert_url">
|
||||
<i class="fas fa-copy"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -141,7 +141,7 @@ while ($module = $system_modules_data->fetch_assoc()) {
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="autop_url" name="autop_url" value="<?php echo $portal_settings['autop_url'] ?>" placeholder="" disabled/>
|
||||
<button class="btn btn-outline-secondary" type="button" onclick="copyToClipboard('autop_url')">
|
||||
<button class="btn btn-outline-secondary" type="button" data-copy-target="autop_url">
|
||||
<i class="fas fa-copy"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -187,13 +187,17 @@ while ($module = $system_modules_data->fetch_assoc()) {
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="mail_from_address" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('mail_from_address') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<label>
|
||||
<input type="email" class="form-control" name="mail_from_address" value="<?php echo $portal_settings['mail_from_address'] ?>" placeholder="" required/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="mail_smtp_host" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('mail_smtp_host') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<label>
|
||||
<input type="text" class="form-control" name="mail_smtp_host" value="<?php echo $portal_settings['mail_smtp_host'] ?>" placeholder="" required/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -315,12 +319,14 @@ while ($module = $system_modules_data->fetch_assoc()) {
|
||||
<tr>
|
||||
<th><?php echo __('module_name') ?></th>
|
||||
<th><?php echo __('enabled') ?></th>
|
||||
<th><?php echo __('configure') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th><?php echo __('module_name') ?></th>
|
||||
<th><?php echo __('enabled') ?></th>
|
||||
<th><?php echo __('configure') ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
@@ -335,9 +341,14 @@ while ($module = $system_modules_data->fetch_assoc()) {
|
||||
<?php echo(($module['module_enabled']) ? 'checked' : '') ?>
|
||||
<?php echo ($API->checkPermissions('admin-modules', 'RW', true)) ? '' : 'disabled' ?>
|
||||
<?php echo(($module['module_slugify'] == 'system') ? 'disabled' : '') ?>>
|
||||
<div class="slider"></div>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<?php if ($module['module_slugify'] === 'office') { ?>
|
||||
<a href="/portal-management/modules/office/" class="btn btn-primary btn-sm btn-rounded"><i class="fa-solid fa-gear"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
@@ -9,8 +9,8 @@ if (!defined('APP_INIT')) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -20,12 +20,12 @@ $API->checkPermissions('admin-sources', 'RO');
|
||||
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['activeTabOnRefresh'] = true;
|
||||
$jsScriptLoadData['copyInputValue'] = true;
|
||||
$jsScriptLoadData['updateToggle'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['inserve_source'] = true;
|
||||
$jsScriptLoadData['validateJson'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/activeTabOnRefresh.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/copyInputValue.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/updateToggle.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/inserve_source.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/validateJson.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -35,10 +35,9 @@ $inserve_settings = $GLOBALS['conn']->query("SELECT * FROM system_sources WHERE
|
||||
$inserve_custom_data = ($inserve_settings['source_custom_data'] ? json_encode(json_decode($inserve_settings['source_custom_data']), JSON_PRETTY_PRINT) : "{}");
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('portal_management'), 'href' => '/systemconfig'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('sources'), 'href' => '/systemconfig#sources'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => 'Inserve', 'href' => ''));
|
||||
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('portal_management'), 'href' => '/portal-management'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('sources'), 'href' => '/portal-management#sources'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => 'Inserve', 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!$GLOBALS['modules_enabled']['servers']) {
|
||||
}
|
||||
|
||||
if (isset($_GET['view'])) {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/servers/pageServerOverview_server_view.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/servers/pageServerOverview_server_view.php";
|
||||
} else {
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/pages/servers/pageServerOverview_view.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/pages/servers/pageServerOverview_view.php";
|
||||
}
|
||||
@@ -14,8 +14,8 @@ if (!$GLOBALS['modules_enabled']['servers']) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/pageNavbar.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
@@ -27,9 +27,10 @@ if (!$API->checkPermissions('servers', 'RO', true)) {
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/breadCrumbs.js'] = true;
|
||||
$jsScriptLoadData['codeblocks'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/serverView.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
@@ -46,7 +47,7 @@ if ($GLOBALS['modules_enabled']['customers']) {
|
||||
$companies_data = $GLOBALS['conn']->query("SELECT company_uuid, company_name FROM companies WHERE company_state = 'active'");
|
||||
$companies = array();
|
||||
while ($company_data = $companies_data->fetch_assoc()) {
|
||||
array_push($companies, $company_data);
|
||||
$companies[] = $company_data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,11 +127,11 @@ if ($API->checkPermissions('servers', 'RW', true)) {
|
||||
) .
|
||||
'</form>'
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('server_overview'), 'href' => '/servers/'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => $server_data['server_vm_host_name'], 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('server_overview'), 'href' => '/servers/'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => $server_data['server_vm_host_name'], 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
@@ -149,12 +150,12 @@ $pageNavbar->outPutNavbar();
|
||||
<div class="row pb-5">
|
||||
<div class="col-md-3 col-lg-3">
|
||||
<h2><?php echo $server_data['server_os'] ?></h2>
|
||||
<img class="img-fluid os-logo" src="/src/images/os/<?php echo $logo ?>.svg">
|
||||
<img alt="os-logo" class="img-fluid os-logo" src="/src/images/os/<?php echo $logo ?>.svg">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-auto col-md-auto">
|
||||
<table class="table table-borderless">
|
||||
<form id="FormValidation" enctype="multipart/form-data" method="post" action="/api/v1/servers/">
|
||||
<table class="table table-borderless">
|
||||
<input type="hidden" name="X-HTTP-Method-Override" value="POST">
|
||||
<input type="hidden" name="_return" value="/servers?view=<?php echo $server_data['server_uuid'] ?>">
|
||||
<input type="hidden" name="server_vm_id" value="<?php echo $server_data['server_vm_id'] ?>"/>
|
||||
@@ -213,6 +214,7 @@ $pageNavbar->outPutNavbar();
|
||||
|
||||
|
||||
<div class="input-group">
|
||||
<label for="company_uuid"></label>
|
||||
<select id="company_uuid" name="company_uuid" class="form-control">
|
||||
<option></option>
|
||||
<?php foreach ($companies as $company) { ?>
|
||||
@@ -242,14 +244,14 @@ $pageNavbar->outPutNavbar();
|
||||
<?php if ($API->checkPermissions('servers', 'RW', true)) {
|
||||
if ($server_data['server_state'] != 'deleted') { ?>
|
||||
<div class="input-group">
|
||||
<select id="server_state" class="form-control" onchange="this.name = this.value ? 'server_state' : '';">
|
||||
<label for="server_state"></label>
|
||||
<select id="server_state" class="form-control">
|
||||
<option></option>
|
||||
<option <?php echo ($server_data['server_state'] == 'active') ? 'selected' : '' ?> value="active">Active</option>
|
||||
<option <?php echo ($server_data['server_state'] == 'trial') ? 'selected' : '' ?> value="trial">Trial</option>
|
||||
<option <?php echo ($server_data['server_state'] == 'disabled') ? 'selected' : '' ?> value="disabled">Disabled</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<h4>
|
||||
<?php echo ucfirst($server_data['server_state']) ?>
|
||||
@@ -285,8 +287,8 @@ $pageNavbar->outPutNavbar();
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</form>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ if (!$GLOBALS['modules_enabled']['servers']) {
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_servers.php';
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/serverOverviewBuilder.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_servers.php";
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/bin/php/Classes/serverOverviewBuilder.php";
|
||||
|
||||
# Check permissions
|
||||
$API_servers = new API_servers();
|
||||
@@ -27,9 +27,9 @@ if (!$API_servers->checkPermissions('servers', 'RO', true)) {
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['delete_confirmation'] = true;
|
||||
$jsScriptLoadData['datatables'] = true;
|
||||
$jsScriptLoadData['multiFilterSelectServers'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/delete_confirmation.js'] = true;
|
||||
$jsScriptLoadData['/src/js/plugin/datatables/datatables.min.js'] = true;
|
||||
$jsScriptLoadData['/src/js/sentri/multiFilterSelectServers.js'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$serverOverview = new serverOverviewBuilder();
|
||||
@@ -59,10 +59,8 @@ if (!$GLOBALS['modules_enabled']['customers']) {
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('permission'), 'href' => '/accesscontrol/#permissions'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('view'), 'href' => ''));
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('permission'), 'href' => '/accesscontrol/#permissions'];
|
||||
$_SESSION['breadCrumbArray'][] = ['display' => __('view'), 'href' => ''];
|
||||
|
||||
# Start page output
|
||||
$serverOverview->serverOverviewOutPut();
|
||||
?>
|
||||
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
namespace bin\php\Classes;
|
||||
class formBuilder
|
||||
{
|
||||
public $title;
|
||||
public $icon;
|
||||
public $submitButton;
|
||||
public $closeButton;
|
||||
public $closeButtonLocation;
|
||||
public string $title;
|
||||
public string $icon;
|
||||
public mixed $submitButton;
|
||||
public mixed $closeButton;
|
||||
public string $closeButtonLocation;
|
||||
|
||||
public $submitButtonColor;
|
||||
public string $submitButtonColor;
|
||||
|
||||
public $submitButtonText;
|
||||
public mixed $submitButtonText;
|
||||
|
||||
public $submitButtonIcon;
|
||||
public string $submitButtonIcon;
|
||||
|
||||
private $extraButtonsArray = array();
|
||||
private array $extraButtonsArray = array();
|
||||
|
||||
public function __construct($title, $icon, $closeButtonLocation, $submitButton = true, $closeButton = true)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class formBuilder
|
||||
$this->submitButtonIcon = $icon;
|
||||
}
|
||||
|
||||
public function startForm()
|
||||
public function startForm(): void
|
||||
{ ?>
|
||||
<div class="row"><div class="col-md-8 ms-auto me-auto"><div class="card">
|
||||
<div class="card-header">
|
||||
@@ -52,12 +52,12 @@ class formBuilder
|
||||
# 'buttonColor' => 'success'
|
||||
# ) > next array
|
||||
|
||||
public function addExtraButtons($extraButtonsArray)
|
||||
public function addExtraButtons($extraButtonsArray): bool
|
||||
{
|
||||
foreach ($extraButtonsArray as $numb => $extraButtonArray) {
|
||||
foreach ($extraButtonsArray as $extraButtonArray) {
|
||||
if (is_array($extraButtonArray)) {
|
||||
if (array_key_exists('buttonIcon', $extraButtonArray) && array_key_exists('buttonText', $extraButtonArray) && array_key_exists('buttonHref', $extraButtonArray) && array_key_exists('buttonColor', $extraButtonArray)) {
|
||||
array_push($this->extraButtonsArray, $extraButtonArray);
|
||||
$this->extraButtonsArray[] = $extraButtonArray;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class formBuilder
|
||||
return false;
|
||||
}
|
||||
|
||||
public function formFooter()
|
||||
public function formFooter(): void
|
||||
{ ?>
|
||||
<div class="card-footer pt-3">
|
||||
<div class="row">
|
||||
@@ -74,7 +74,7 @@ class formBuilder
|
||||
<button type="submit" class="btn btn-<?php echo $this->submitButtonColor ?>"><?php echo $this->submitButtonIcon ?> <?php echo $this->submitButtonText ?></button>
|
||||
<?php }
|
||||
|
||||
foreach ($this->extraButtonsArray as $numb => $extraButtonArray) { ?>
|
||||
foreach ($this->extraButtonsArray as $extraButtonArray) { ?>
|
||||
<a href="<?php echo $extraButtonArray['buttonHref'] ?>" class="btn btn-<?php echo $extraButtonArray['buttonColor'] ?>"><?php echo $extraButtonArray['buttonIcon'] ?> <?php echo $extraButtonArray['buttonText'] ?></a>
|
||||
<?php }
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace bin\php\Classes;
|
||||
if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class healthCheck
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
include_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/db_connect.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/globalFunctions.php';
|
||||
}
|
||||
|
||||
public function healthCheck()
|
||||
{
|
||||
echo 'Checking and creating device data folders...';
|
||||
if ($this->checkDeviceDataFolders()) {
|
||||
echo 'Success creating device data folders';
|
||||
} else {
|
||||
echo 'something went wrong creating device data folders!';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkDeviceDataFolders()
|
||||
{
|
||||
try {
|
||||
$sql = "SELECT device_slugify FROM autop_devices";
|
||||
|
||||
$stmt = $GLOBALS['conn']->prepare($sql);
|
||||
|
||||
if ($stmt === false) {
|
||||
throw new Exception("Failed to prepare the SQL statement: " . $GLOBALS['conn']->error);
|
||||
}
|
||||
|
||||
if (!$stmt->execute()) {
|
||||
throw new Exception("Failed to execute the SQL statement: " . $stmt->error);
|
||||
}
|
||||
|
||||
$result = $stmt->get_result();
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$device_slugify = $row['device_slugify'];
|
||||
$dirsToCreate = array(
|
||||
$_SERVER['DOCUMENT_ROOT'] . "/data/devices/" . $device_slugify,
|
||||
$_SERVER['DOCUMENT_ROOT'] . "/data/devices/" . $device_slugify . "/firmware",
|
||||
$_SERVER['DOCUMENT_ROOT'] . "/data/devices/" . $device_slugify . "/documents"
|
||||
);
|
||||
|
||||
foreach ($dirsToCreate as $dir) {
|
||||
if (!file_exists($dir)) {
|
||||
if (!mkdir($dir)) {
|
||||
throw new Exception("Failed to create the directory: " . $dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,14 @@ namespace bin\php\Classes;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/../vendor/autoload.php';
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/../vendor/autoload.php";
|
||||
|
||||
class mailBuilder
|
||||
{
|
||||
public $mail;
|
||||
public $subject;
|
||||
public $mailText;
|
||||
public PHPMailer $mail;
|
||||
|
||||
private $portal_uuid;
|
||||
public string $subject;
|
||||
public string $mailText;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
@@ -44,38 +43,52 @@ class mailBuilder
|
||||
$this->mail->CharSet = 'UTF-8';
|
||||
$this->mail->Encoding = 'base64';
|
||||
|
||||
$this->mail->setFrom($mail_settings['mail_from_address'], $mail_settings['mail_from_name']);
|
||||
try {
|
||||
$this->mail->setFrom($mail_settings['mail_from_address'], $mail_settings['mail_from_name']
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function addAddress($address, $name)
|
||||
{
|
||||
$this->mail->addAddress($address, $name);
|
||||
}
|
||||
|
||||
function sendMail()
|
||||
function addAddress($address, $name): void
|
||||
{
|
||||
try {
|
||||
$this->mail->isHTML(true);
|
||||
$this->mail->addAddress($address, $name);
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
function addAttachment($path, $name): void
|
||||
{
|
||||
$this->mail->addAttachment($path, $name);
|
||||
}
|
||||
|
||||
function sendMail(): bool
|
||||
{
|
||||
try {
|
||||
$this->mail->isHTML();
|
||||
$this->mail->Subject = $this->subject;
|
||||
$this->mail->Body = $this->mailHtmlBody();
|
||||
|
||||
$this->mail->send();
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function mailHtmlBody()
|
||||
function mailHtmlBody(): array|false|string
|
||||
{
|
||||
$body = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/src/html/mailBody.html');
|
||||
|
||||
$bodyText = $this->mailText;
|
||||
|
||||
$body = str_replace('{{bodyText}}', $bodyText, $body);
|
||||
|
||||
|
||||
return $body;
|
||||
return str_replace('{{bodyText}}', $bodyText, $body);
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,12 @@ if (!defined('APP_INIT')) {
|
||||
|
||||
use api\classes\API;
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API.php";
|
||||
|
||||
class pageBuilder extends API
|
||||
class pageBuilder
|
||||
{
|
||||
|
||||
private $jsScriptLoadData;
|
||||
private array $jsScriptLoadData;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -38,16 +38,16 @@ class pageBuilder extends API
|
||||
$this->figureOutContent();
|
||||
}
|
||||
|
||||
private function figureOutContent()
|
||||
private function figureOutContent(): void
|
||||
{
|
||||
$requestUri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
|
||||
// Remove trailing slash, but only if it’s not the root "/"
|
||||
if ($requestUri !== '/' && substr($requestUri, -1) === '/') {
|
||||
if ($requestUri !== '/' && str_ends_with($requestUri, '/')) {
|
||||
$requestUri = rtrim($requestUri, '/');
|
||||
}
|
||||
|
||||
$GLOBALS['breadCrumbArray'] = array(array('display' => '<i class="fas fa-home"></i>', 'href' => '/'));
|
||||
$_SESSION['breadCrumbArray'] = array(array('display' => '<i class="fas fa-home"></i>', 'href' => '/'));
|
||||
|
||||
$GLOBALS['pageContentToShow']['pageName'] = '404';
|
||||
$GLOBALS['pageContentToShow']['pageFile'] = 'pageNotFound.php';
|
||||
@@ -66,7 +66,7 @@ class pageBuilder extends API
|
||||
}
|
||||
}
|
||||
|
||||
public function buildPage()
|
||||
public function buildPage(): void
|
||||
{ ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -94,8 +94,7 @@ class pageBuilder extends API
|
||||
</html>
|
||||
<?php }
|
||||
|
||||
private
|
||||
function pageHeadContent()
|
||||
private function pageHeadContent(): void
|
||||
{ ?>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
@@ -109,50 +108,15 @@ class pageBuilder extends API
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Public+Sans:300,400,500,600,700|Quicksand:300,400,500,600,700&display=swap" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
.dataTables_filter label {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.dataTables_filter input {
|
||||
height: 40px;
|
||||
width: 100% !important; /* Make the input field full width */
|
||||
box-sizing: border-box; /* Ensure padding doesn't exceed the width */
|
||||
}
|
||||
|
||||
.dataTables_filter .fa-search {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
left: auto;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.dataTables_length label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.dataTables_length label::before {
|
||||
display: inline-block;
|
||||
height: 40px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.dataTables_length select {
|
||||
flex: 1;
|
||||
max-width: 100%;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- CSS Files -->
|
||||
<link rel="stylesheet" href="/src/css/bootstrap.gruvbox.min.css"/> <!-- Basic bootstrap and theming -->
|
||||
<link rel="stylesheet" href="/src/css/sentri.min.css"/> <!-- Special css tricks for Sentri -->
|
||||
<link rel="stylesheet" href="/src/css/plugins.min.css"/> <!-- need this for scroll bars and other small things -->
|
||||
|
||||
<link rel="stylesheet" href="/src/js/plugin/sweetalert2/sweetalert2.min.css"/> <!-- need this for scroll bars and other small things -->
|
||||
<link rel="stylesheet" href="/src/js/plugin/toastify-js/toastify.css"/> <!-- This is used for the toasts -->
|
||||
<link rel="stylesheet" href="/src/css/fullcalendar/skeleton.css"/> <!-- Used for fullcalander.js -->
|
||||
<link rel="stylesheet" href="/src/css/fullcalendar/theme/theme.css"/> <!-- Used for fullcalander.js -->
|
||||
<link rel="stylesheet" href="/src/css/fullcalendar/theme/palettes/purple.css"/> <!-- Used for fullcalander.js -->
|
||||
|
||||
<!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.2.3/css/flag-icons.min.css"/> -->
|
||||
|
||||
@@ -162,31 +126,14 @@ class pageBuilder extends API
|
||||
<link rel="shortcut icon" href="/src/images/favicon/favicon.ico"/>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/src/images/favicon/apple-touch-icon.png"/>
|
||||
<link rel="manifest" href="/src/images/favicon/site.webmanifest"/>
|
||||
|
||||
<style>
|
||||
.fade-in {
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease, transform 0.3s ease;
|
||||
}
|
||||
|
||||
.fade-in.show {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
.transition-opacity {
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<?php }
|
||||
|
||||
private function pageSidebarContent()
|
||||
private function pageSidebarContent(): void
|
||||
{
|
||||
|
||||
|
||||
$API = new API();
|
||||
function showSpan($module_name)
|
||||
function showSpan($module_name): void
|
||||
{
|
||||
?>
|
||||
<li class="nav-section">
|
||||
@@ -199,7 +146,7 @@ class pageBuilder extends API
|
||||
</li>
|
||||
<?php }
|
||||
|
||||
function showPage($module_name, $page_name)
|
||||
function showPage($module_name, $page_name): void
|
||||
{
|
||||
$page = $GLOBALS['pages'][$module_name][$page_name];
|
||||
?>
|
||||
@@ -215,7 +162,7 @@ class pageBuilder extends API
|
||||
<div class="sidebar-logo">
|
||||
<div class="logo-header">
|
||||
<a href="/" class="logo">
|
||||
<img src="/src/images/logo-sidebar-dark.webp" alt="navbar brand" class="navbar-brand" height="50"/>
|
||||
<img src="/src/images/logo-sidebar-dark.webp" alt="navbar brand" class="navbar-brand" height="60"/>
|
||||
</a>
|
||||
<div class="nav-toggle">
|
||||
<button class="btn btn-toggle toggle-sidebar">
|
||||
@@ -240,6 +187,7 @@ class pageBuilder extends API
|
||||
if ($GLOBALS['modules_enabled']['office'] && $API->checkPermissions('office-stompjes', 'RO', true)) {
|
||||
showSpan('office');
|
||||
showPage('office', 'stompjeslist');
|
||||
showPage('office', 'travelReimburse');
|
||||
}
|
||||
|
||||
if ($GLOBALS['modules_enabled']['servers'] && $API->checkPermissions('servers', 'RO', true)) {
|
||||
@@ -264,7 +212,7 @@ class pageBuilder extends API
|
||||
|
||||
showSpan(__('portal-management'));
|
||||
showPage('portal-management', 'access_control');
|
||||
showPage('portal-management', 'systemconfig');
|
||||
showPage('portal-management', 'portal-management');
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -273,8 +221,7 @@ class pageBuilder extends API
|
||||
<?php
|
||||
}
|
||||
|
||||
private
|
||||
function pageNavbarContent()
|
||||
private function pageNavbarContent(): void
|
||||
{
|
||||
?>
|
||||
<div class="main-header">
|
||||
@@ -282,7 +229,7 @@ class pageBuilder extends API
|
||||
<!-- Logo Header -->
|
||||
<div class="logo-header">
|
||||
<a href="/" class="logo">
|
||||
<img src="/src/images/logo-sidebar-dark.webp" alt="navbar brand" class="navbar-brand" height="50"/>
|
||||
<img src="/src/images/logo-sidebar-dark.webp" alt="navbar brand" class="navbar-brand" height="60"/>
|
||||
</a>
|
||||
<div class="nav-toggle">
|
||||
<button class="btn btn-toggle toggle-sidebar">
|
||||
@@ -312,9 +259,7 @@ class pageBuilder extends API
|
||||
<span class="op-7"> <?php echo __('hi') ?>, </span>
|
||||
<span class="fw-bold"><?php echo $_SESSION['user']['user_first_name'] ?></span>
|
||||
</a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-user animated fadeIn">
|
||||
<div class="dropdown-user-scroll scrollbar-outer">
|
||||
<li>
|
||||
<div class="user-box">
|
||||
<div class="avatar-lg">
|
||||
@@ -337,12 +282,11 @@ class pageBuilder extends API
|
||||
<?php } ?>
|
||||
<form id="logoutform" class="form-inline logoutform" action="/login/logout.php" method="POST">
|
||||
<input type="hidden" name="logout">
|
||||
<a class="dropdown-item" href="#" onclick="document.getElementById('logoutform').submit()">
|
||||
<i class="fas fa-sign-out-alt"></i> <?php echo __('logout') ?>
|
||||
</a>
|
||||
<button type="submit" form="logoutform" class="dropdown-item">
|
||||
<i class="fas fa-sign-out-alt"></i> Logout
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -352,8 +296,7 @@ class pageBuilder extends API
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
private
|
||||
function pageFooterContent()
|
||||
private function pageFooterContent(): void
|
||||
{ ?>
|
||||
<footer class="footer py-2">
|
||||
<div class="container-fluid d-flex justify-content-between">
|
||||
@@ -366,7 +309,7 @@ class pageBuilder extends API
|
||||
</nav>
|
||||
<div class="copyright">
|
||||
<?php echo __('version') ?>
|
||||
<a class="text-primary" href="/changelog/">1.2.3</a>
|
||||
<a class="text-primary" href="/changelog/">1.3.0</a>
|
||||
</div>
|
||||
<div>
|
||||
<span class="navbar-text">Sentri</span>
|
||||
@@ -375,16 +318,18 @@ class pageBuilder extends API
|
||||
</footer>
|
||||
<?php }
|
||||
|
||||
private
|
||||
function pageScriptContents()
|
||||
private function pageScriptContents(): void
|
||||
{ ?>
|
||||
<!-- always load these -->
|
||||
<script src="/src/js/core/jquery-3.7.1.min.js"></script>
|
||||
<script src="/src/js/core/popper.min.js"></script>
|
||||
<script src="/src/js/core/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap Notify -->
|
||||
<script src="/src/js/plugin/bootstrap-notify/bootstrap-notify.min.js"></script>
|
||||
<!-- Load the locales in js -->
|
||||
<script src="/src/js/i18n-loader.js"></script>
|
||||
|
||||
<!-- Toastify js for toasts after actions are peformed -->
|
||||
<script src="/src/js/plugin/toastify-js/toastify.js"></script>
|
||||
|
||||
<!-- Sweet Alert -->
|
||||
<script src="/src/js/plugin/sweetalert2/sweetalert2.min.js"></script>
|
||||
@@ -395,60 +340,39 @@ class pageBuilder extends API
|
||||
<!-- jQuery Scrollbar -->
|
||||
<script src="/src/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>
|
||||
|
||||
<script src="/src/js/sentri/response.js"></script>
|
||||
|
||||
<!-- Chart JS
|
||||
<script src="/src/js/plugin/chart.js/chart.min.js"></script>
|
||||
-->
|
||||
|
||||
<!-- jQuery Sparkline
|
||||
<script src="/src/js/plugin/jquery.sparkline/jquery.sparkline.min.js"></script>
|
||||
-->
|
||||
|
||||
<!-- Chart Circle
|
||||
<script src="/src/js/plugin/chart-circle/circles.min.js"></script>
|
||||
-->
|
||||
|
||||
<!-- jQuery Vector Maps
|
||||
<script src="/src/js/plugin/jsvectormap/jsvectormap.min.js"></script>
|
||||
<script src="/src/js/plugin/jsvectormap/world.js"></script>
|
||||
-->
|
||||
|
||||
<!-- Load Other Js scripts -->
|
||||
<?php
|
||||
if (isset($this->jsScriptLoadData)) {
|
||||
foreach ($this->jsScriptLoadData as $key => $script) {
|
||||
if ($key === 'form') { ?>
|
||||
<script src="/src/js/plugin/select2/select2.full.min.js"></script><!-- Bootstrap Tagsinput -->
|
||||
<script src="/src/js/plugin/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script><!-- jQuery Moment.JS -->
|
||||
<script src="/src/js/plugin/moment/moment.min.js"></script><!-- Bootstrap datetimepicker -->
|
||||
<script src="/src/js/plugin/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script><!-- validate forms -->
|
||||
<script src="/src/js/plugin/jquery.validate/jquery.validate.min.js"></script><!-- dropzone -->
|
||||
<script src="/src/js/plugin/dropzone/dropzone.min.js"></script>
|
||||
<script src="/src/js/sentri/form.js"></script>
|
||||
|
||||
<?php } elseif ($key === 'codeblocks') { ?>
|
||||
<link rel="stylesheet" href="/src/css/prism.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs/prism.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs/components/prism-json.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs/plugins/toolbar/prism-toolbar.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs/plugins/toolbar/prism-toolbar.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"></script>
|
||||
<?php } elseif ($key === 'datepicker') { ?>
|
||||
<script src="/src/js/plugin/moment/moment.min.js"></script>
|
||||
<script src="/src/js/plugin/datepicker/bootstrap-datetimepicker.min.js"></script>
|
||||
|
||||
<script src="/src/js/sentri/datepicker.js"></script>
|
||||
<?php } else { ?>
|
||||
<script src="<?php echo $key ?>"></script>
|
||||
<?php } ?><?php }
|
||||
}
|
||||
# keeps refreshing the timeZoneCookie
|
||||
setTimeZoneCookie();
|
||||
|
||||
if (isset($this->jsScriptLoadData)) {
|
||||
include_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/jsScripts.php';
|
||||
}
|
||||
# process response from actions
|
||||
if (isset($_SESSION['response'])) {
|
||||
$ar = json_decode($_SESSION['response']);
|
||||
$type = key($ar);
|
||||
$text = reset($ar);
|
||||
$title = $type;
|
||||
if ($type == 'error') {
|
||||
$type = 'danger';
|
||||
}
|
||||
unset($_SESSION['response']) ?>
|
||||
<script>
|
||||
var content = {};
|
||||
content.message = '<?php echo __($text) ?>';
|
||||
content.title = '<?php echo ucfirst($title) ?>';
|
||||
content.icon = "fa fa-bell";
|
||||
|
||||
$.notify(content, {
|
||||
type: '<?php echo $type ?>',
|
||||
placement: {
|
||||
from: 'top',
|
||||
align: 'right',
|
||||
},
|
||||
time: 10,
|
||||
delay: 3,
|
||||
});
|
||||
$('#multiple').select2({
|
||||
theme: "bootstrap"
|
||||
});
|
||||
</script>
|
||||
<?php }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@ if (!defined('APP_INIT')) {
|
||||
|
||||
class pageNavbar
|
||||
{
|
||||
public $breadCrumb;
|
||||
private $buttons = array();
|
||||
public bool $breadCrumb;
|
||||
private array $buttons = array();
|
||||
private string $title;
|
||||
|
||||
public function __construct($showBreadCrumb, $title = false)
|
||||
{
|
||||
@@ -16,18 +17,18 @@ class pageNavbar
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function AddHTMLButton($html)
|
||||
public function AddHTMLButton($html): void
|
||||
{
|
||||
array_push($this->buttons, $html);
|
||||
$this->buttons[] = $html;
|
||||
}
|
||||
|
||||
public function outPutNavbar()
|
||||
public function outPutNavbar(): void
|
||||
{
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col d-flex justify-content-start">
|
||||
<?php if ($this->breadCrumb) { ?>
|
||||
<div class="pb-2" id="breadCrumb"></div>
|
||||
<div class="pb-2" id="breadCrumb"> </div>
|
||||
<?php } elseif ($this->title) { ?>
|
||||
<h2 class="px-4 mb-0"><?php echo $this->title ?></h2>
|
||||
<?php } else { ?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user