A lot of code cleanup and code sanitation done.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user