A lot of code cleanup and code sanitation done.

This commit is contained in:
2026-06-20 00:31:32 +02:00
parent be392b8149
commit d781078c0d
100 changed files with 733 additions and 2097 deletions

View File

@@ -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";
}

View File

@@ -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();
@@ -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>

View File

@@ -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();

View File

@@ -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();
@@ -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>

View File

@@ -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">
@@ -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();
}

View File

@@ -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";
}

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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";
}

View File

@@ -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();

View File

@@ -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();
@@ -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>

View File

@@ -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();