mirror of
https://github.com/itflow-org/itflow
synced 2026-08-17 13:05:12 +00:00
Update the rest of the PHP functions to use camelCase
This commit is contained in:
@@ -128,7 +128,7 @@ That is the whole job. `LATEST_DATABASE_VERSION` is derived from the highest-num
|
|||||||
A single update run applies every pending migration in order, stopping at the first failure with the version left at the last file that completed, so a re-run resumes at the one that broke.
|
A single update run applies every pending migration in order, stopping at the first failure with the version left at the last file that completed, so a re-run resumes at the one that broke.
|
||||||
**After acting, log and notify.** State changes call `logAudit($type, $action, $description, $client_id, $entity_id)` for the audit trail. User-facing events may also call `appNotify()`. Fire `triggerCustomAction()` where a site might reasonably want a hook. Then call `flashAlert($message, $type)` and `redirect()` (defaults to the referer) rather than setting session keys or `header()` manually.
|
**After acting, log and notify.** State changes call `logAudit($type, $action, $description, $client_id, $entity_id)` for the audit trail. User-facing events may also call `appNotify()`. Fire `triggerCustomAction()` where a site might reasonably want a hook. Then call `flashAlert($message, $type)` and `redirect()` (defaults to the referer) rather than setting session keys or `header()` manually.
|
||||||
|
|
||||||
**Function names (post-rename).** Helpers were renamed for clarity in 2026; the old names **no longer exist** — code calling them fatals. If you're rebasing an old PR or following an old tutorial, translate: `sanitizeInput` → `escapeSql`, `nullable_htmlentities` → `escapeHtml`, `logAction` → `logAudit`, `flash_alert` → `flashAlert`, `customAction` → `triggerCustomAction`, `encryptLoginEntry`/`decryptLoginEntry` → `encryptCredentialEntry`/`decryptCredentialEntry`, `strtoAZaz09` → `toAlphanumeric`, `fetchUpdates` → `checkForUpdates`.
|
**Function names (post-rename).** Helpers were renamed for clarity in 2026; the old names **no longer exist** — code calling them fatals. If you're rebasing an old PR or following an old tutorial, translate: `sanitizeInput` → `escapeSql`, `nullable_htmlentities` → `escapeHtml`, `logAction` → `logAudit`, `flash_alert` → `flashAlert`, `customAction` → `triggerCustomAction`, `encryptLoginEntry`/`decryptLoginEntry` → `encryptCredentialEntry`/`decryptCredentialEntry`, `strtoAZaz09` → `toAlphanumeric`, `fetchUpdates` → `checkForUpdates`, `sanitize_url` → `escapeUrl`.
|
||||||
|
|
||||||
**Bulk vs. single actions.** If you change the behavior of a single action (e.g. resolving a ticket), check whether a `bulk_*` counterpart exists and update it too. They are currently parallel implementations and drift between them is a known bug source.
|
**Bulk vs. single actions.** If you change the behavior of a single action (e.g. resolving a ticket), check whether a `bulk_*` counterpart exists and update it too. They are currently parallel implementations and drift between them is a known bug source.
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ $phpConfig[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Check upload_max_filesize and post_max_size >= 500M
|
// Check upload_max_filesize and post_max_size >= 500M
|
||||||
function return_bytes($val) {
|
function toBytes($val) {
|
||||||
$val = trim($val);
|
$val = trim($val);
|
||||||
$unit = strtolower(substr($val, -1));
|
$unit = strtolower(substr($val, -1));
|
||||||
$num = (float)$val;
|
$num = (float)$val;
|
||||||
@@ -99,8 +99,8 @@ $required_bytes = 500 * 1024 * 1024; // 500M in bytes
|
|||||||
$upload_max_filesize = ini_get('upload_max_filesize');
|
$upload_max_filesize = ini_get('upload_max_filesize');
|
||||||
$post_max_size = ini_get('post_max_size');
|
$post_max_size = ini_get('post_max_size');
|
||||||
|
|
||||||
$upload_passed = return_bytes($upload_max_filesize) >= $required_bytes;
|
$upload_passed = toBytes($upload_max_filesize) >= $required_bytes;
|
||||||
$post_passed = return_bytes($post_max_size) >= $required_bytes;
|
$post_passed = toBytes($post_max_size) >= $required_bytes;
|
||||||
|
|
||||||
$phpConfig[] = [
|
$phpConfig[] = [
|
||||||
'name' => 'upload_max_filesize >= 500M',
|
'name' => 'upload_max_filesize >= 500M',
|
||||||
@@ -116,7 +116,7 @@ $phpConfig[] = [
|
|||||||
|
|
||||||
// PHP Memory Limit >= 128M
|
// PHP Memory Limit >= 128M
|
||||||
$memoryLimit = ini_get('memory_limit');
|
$memoryLimit = ini_get('memory_limit');
|
||||||
$memoryLimitBytes = return_bytes($memoryLimit);
|
$memoryLimitBytes = toBytes($memoryLimit);
|
||||||
$memoryLimitPassed = $memoryLimitBytes >= (128 * 1024 * 1024);
|
$memoryLimitPassed = $memoryLimitBytes >= (128 * 1024 * 1024);
|
||||||
$phpConfig[] = [
|
$phpConfig[] = [
|
||||||
'name' => 'PHP Memory Limit >= 128M',
|
'name' => 'PHP Memory Limit >= 128M',
|
||||||
|
|||||||
@@ -301,7 +301,7 @@
|
|||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
||||||
$custom_link_name = escapeHtml($row['custom_link_name']);
|
$custom_link_name = escapeHtml($row['custom_link_name']);
|
||||||
$custom_link_uri = sanitize_url($row['custom_link_uri']);
|
$custom_link_uri = escapeUrl($row['custom_link_uri']);
|
||||||
$custom_link_icon = escapeHtml($row['custom_link_icon']);
|
$custom_link_icon = escapeHtml($row['custom_link_icon']);
|
||||||
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
||||||
if ($custom_link_new_tab == 1) {
|
if ($custom_link_new_tab == 1) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ if (function_exists('ini_set')) {
|
|||||||
/**
|
/**
|
||||||
* Write a line to a file handle with newline.
|
* Write a line to a file handle with newline.
|
||||||
*/
|
*/
|
||||||
function fwrite_ln($fh, string $s): void {
|
function writeLine($fh, string $s): void {
|
||||||
fwrite($fh, $s);
|
fwrite($fh, $s);
|
||||||
fwrite($fh, PHP_EOL);
|
fwrite($fh, PHP_EOL);
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ function fwrite_ln($fh, string $s): void {
|
|||||||
*
|
*
|
||||||
* NOTE: Routines/events are not dumped here. Add if needed.
|
* NOTE: Routines/events are not dumped here. Add if needed.
|
||||||
*/
|
*/
|
||||||
function dump_database_streaming(mysqli $mysqli, string $sqlFile): void {
|
function dumpDatabase(mysqli $mysqli, string $sqlFile): void {
|
||||||
$fh = fopen($sqlFile, 'wb');
|
$fh = fopen($sqlFile, 'wb');
|
||||||
if (!$fh) {
|
if (!$fh) {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
@@ -39,12 +39,12 @@ function dump_database_streaming(mysqli $mysqli, string $sqlFile): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Preamble
|
// Preamble
|
||||||
fwrite_ln($fh, "-- UTF-8 + Foreign Key Safe Dump");
|
writeLine($fh, "-- UTF-8 + Foreign Key Safe Dump");
|
||||||
fwrite_ln($fh, "SET NAMES 'utf8mb4';");
|
writeLine($fh, "SET NAMES 'utf8mb4';");
|
||||||
fwrite_ln($fh, "SET FOREIGN_KEY_CHECKS = 0;");
|
writeLine($fh, "SET FOREIGN_KEY_CHECKS = 0;");
|
||||||
fwrite_ln($fh, "SET UNIQUE_CHECKS = 0;");
|
writeLine($fh, "SET UNIQUE_CHECKS = 0;");
|
||||||
fwrite_ln($fh, "SET AUTOCOMMIT = 0;");
|
writeLine($fh, "SET AUTOCOMMIT = 0;");
|
||||||
fwrite_ln($fh, "");
|
writeLine($fh, "");
|
||||||
|
|
||||||
// Gather tables and views
|
// Gather tables and views
|
||||||
$tables = [];
|
$tables = [];
|
||||||
@@ -80,12 +80,12 @@ function dump_database_streaming(mysqli $mysqli, string $sqlFile): void {
|
|||||||
$createSQL = array_values($createRow)[1] ?? '';
|
$createSQL = array_values($createRow)[1] ?? '';
|
||||||
$createRes->close();
|
$createRes->close();
|
||||||
|
|
||||||
fwrite_ln($fh, "-- ----------------------------");
|
writeLine($fh, "-- ----------------------------");
|
||||||
fwrite_ln($fh, "-- Table structure for `{$table}`");
|
writeLine($fh, "-- Table structure for `{$table}`");
|
||||||
fwrite_ln($fh, "-- ----------------------------");
|
writeLine($fh, "-- ----------------------------");
|
||||||
fwrite_ln($fh, "DROP TABLE IF EXISTS `{$table}`;");
|
writeLine($fh, "DROP TABLE IF EXISTS `{$table}`;");
|
||||||
fwrite_ln($fh, $createSQL . ";");
|
writeLine($fh, $createSQL . ";");
|
||||||
fwrite_ln($fh, "");
|
writeLine($fh, "");
|
||||||
|
|
||||||
// Dump data in a streaming fashion
|
// Dump data in a streaming fashion
|
||||||
$dataRes = $mysqli->query("SELECT * FROM `{$mysqli->real_escape_string($table)}`", MYSQLI_USE_RESULT);
|
$dataRes = $mysqli->query("SELECT * FROM `{$mysqli->real_escape_string($table)}`", MYSQLI_USE_RESULT);
|
||||||
@@ -93,7 +93,7 @@ function dump_database_streaming(mysqli $mysqli, string $sqlFile): void {
|
|||||||
$wroteHeader = false;
|
$wroteHeader = false;
|
||||||
while ($row = $dataRes->fetch_assoc()) {
|
while ($row = $dataRes->fetch_assoc()) {
|
||||||
if (!$wroteHeader) {
|
if (!$wroteHeader) {
|
||||||
fwrite_ln($fh, "-- Dumping data for table `{$table}`");
|
writeLine($fh, "-- Dumping data for table `{$table}`");
|
||||||
$wroteHeader = true;
|
$wroteHeader = true;
|
||||||
}
|
}
|
||||||
$cols = array_map(fn($c) => '`' . $mysqli->real_escape_string($c) . '`', array_keys($row));
|
$cols = array_map(fn($c) => '`' . $mysqli->real_escape_string($c) . '`', array_keys($row));
|
||||||
@@ -103,10 +103,10 @@ function dump_database_streaming(mysqli $mysqli, string $sqlFile): void {
|
|||||||
},
|
},
|
||||||
array_values($row)
|
array_values($row)
|
||||||
);
|
);
|
||||||
fwrite_ln($fh, "INSERT INTO `{$table}` (" . implode(", ", $cols) . ") VALUES (" . implode(", ", $vals) . ");");
|
writeLine($fh, "INSERT INTO `{$table}` (" . implode(", ", $cols) . ") VALUES (" . implode(", ", $vals) . ");");
|
||||||
}
|
}
|
||||||
$dataRes->close();
|
$dataRes->close();
|
||||||
if ($wroteHeader) fwrite_ln($fh, "");
|
if ($wroteHeader) writeLine($fh, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,14 +119,14 @@ function dump_database_streaming(mysqli $mysqli, string $sqlFile): void {
|
|||||||
$createView = $row['Create View'] ?? '';
|
$createView = $row['Create View'] ?? '';
|
||||||
$cRes->close();
|
$cRes->close();
|
||||||
|
|
||||||
fwrite_ln($fh, "-- ----------------------------");
|
writeLine($fh, "-- ----------------------------");
|
||||||
fwrite_ln($fh, "-- View structure for `{$view}`");
|
writeLine($fh, "-- View structure for `{$view}`");
|
||||||
fwrite_ln($fh, "-- ----------------------------");
|
writeLine($fh, "-- ----------------------------");
|
||||||
fwrite_ln($fh, "DROP VIEW IF EXISTS `{$view}`;");
|
writeLine($fh, "DROP VIEW IF EXISTS `{$view}`;");
|
||||||
// Ensure statement ends with semicolon
|
// Ensure statement ends with semicolon
|
||||||
if (!str_ends_with($createView, ';')) $createView .= ';';
|
if (!str_ends_with($createView, ';')) $createView .= ';';
|
||||||
fwrite_ln($fh, $createView);
|
writeLine($fh, $createView);
|
||||||
fwrite_ln($fh, "");
|
writeLine($fh, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,22 +142,22 @@ function dump_database_streaming(mysqli $mysqli, string $sqlFile): void {
|
|||||||
$createTrig = $row['SQL Original Statement'] ?? ($row['Create Trigger'] ?? '');
|
$createTrig = $row['SQL Original Statement'] ?? ($row['Create Trigger'] ?? '');
|
||||||
$crt->close();
|
$crt->close();
|
||||||
|
|
||||||
fwrite_ln($fh, "-- ----------------------------");
|
writeLine($fh, "-- ----------------------------");
|
||||||
fwrite_ln($fh, "-- Trigger for `{$triggerName}`");
|
writeLine($fh, "-- Trigger for `{$triggerName}`");
|
||||||
fwrite_ln($fh, "-- ----------------------------");
|
writeLine($fh, "-- ----------------------------");
|
||||||
fwrite_ln($fh, "DROP TRIGGER IF EXISTS `{$triggerName}`;");
|
writeLine($fh, "DROP TRIGGER IF EXISTS `{$triggerName}`;");
|
||||||
if (!str_ends_with($createTrig, ';')) $createTrig .= ';';
|
if (!str_ends_with($createTrig, ';')) $createTrig .= ';';
|
||||||
fwrite_ln($fh, $createTrig);
|
writeLine($fh, $createTrig);
|
||||||
fwrite_ln($fh, "");
|
writeLine($fh, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tRes->close();
|
$tRes->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Postamble
|
// Postamble
|
||||||
fwrite_ln($fh, "SET FOREIGN_KEY_CHECKS = 1;");
|
writeLine($fh, "SET FOREIGN_KEY_CHECKS = 1;");
|
||||||
fwrite_ln($fh, "SET UNIQUE_CHECKS = 1;");
|
writeLine($fh, "SET UNIQUE_CHECKS = 1;");
|
||||||
fwrite_ln($fh, "COMMIT;");
|
writeLine($fh, "COMMIT;");
|
||||||
|
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ if (isset($_GET['download_backup'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// === Generate SQL Dump (streaming) ===
|
// === Generate SQL Dump (streaming) ===
|
||||||
dump_database_streaming($mysqli, $sqlFile);
|
dumpDatabase($mysqli, $sqlFile);
|
||||||
|
|
||||||
// === Zip the uploads folder (strict) ===
|
// === Zip the uploads folder (strict) ===
|
||||||
zipFolderStrict("../uploads", $uploadsZip);
|
zipFolderStrict("../uploads", $uploadsZip);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
require_once "includes/inc_all_admin.php";
|
require_once "includes/inc_all_admin.php";
|
||||||
|
|
||||||
// ---- Tiny status dot for tab labels ----------------------------------------
|
// ---- Tiny status dot for tab labels ----------------------------------------
|
||||||
function mail_status_dot($on) {
|
function renderMailStatusDot($on) {
|
||||||
return $on
|
return $on
|
||||||
? '<i class="fas fa-circle text-success ml-2" style="font-size:.5rem;vertical-align:middle;" title="Configured"></i>'
|
? '<i class="fas fa-circle text-success ml-2" style="font-size:.5rem;vertical-align:middle;" title="Configured"></i>'
|
||||||
: '<i class="far fa-circle text-muted ml-2" style="font-size:.5rem;vertical-align:middle;" title="Not configured"></i>';
|
: '<i class="far fa-circle text-muted ml-2" style="font-size:.5rem;vertical-align:middle;" title="Not configured"></i>';
|
||||||
@@ -64,12 +64,12 @@ $imap_ready = $imap_standard_ready || $imap_oauth_ready;
|
|||||||
<ul class="nav nav-tabs" id="mailTabs" role="tablist">
|
<ul class="nav nav-tabs" id="mailTabs" role="tablist">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" href="#tab-smtp" data-target="#tab-smtp">
|
<a class="nav-link active" href="#tab-smtp" data-target="#tab-smtp">
|
||||||
<i class="fas fa-fw fa-paper-plane mr-1"></i>Sending<?php echo mail_status_dot($smtp_on); ?>
|
<i class="fas fa-fw fa-paper-plane mr-1"></i>Sending<?php echo renderMailStatusDot($smtp_on); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#tab-imap" data-target="#tab-imap">
|
<a class="nav-link" href="#tab-imap" data-target="#tab-imap">
|
||||||
<i class="fas fa-fw fa-inbox mr-1"></i>Receiving<?php echo mail_status_dot($imap_on); ?>
|
<i class="fas fa-fw fa-inbox mr-1"></i>Receiving<?php echo renderMailStatusDot($imap_on); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" id="tabitem-oauth" style="<?php echo $oauth_needed ? '' : 'display:none;'; ?>">
|
<li class="nav-item" id="tabitem-oauth" style="<?php echo $oauth_needed ? '' : 'display:none;'; ?>">
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ if (isset($_GET['asset_id'])) {
|
|||||||
$asset_model = escapeHtml($row['asset_model']);
|
$asset_model = escapeHtml($row['asset_model']);
|
||||||
$asset_serial = escapeHtml($row['asset_serial']);
|
$asset_serial = escapeHtml($row['asset_serial']);
|
||||||
$asset_os = escapeHtml($row['asset_os']);
|
$asset_os = escapeHtml($row['asset_os']);
|
||||||
$asset_uri = sanitize_url($row['asset_uri']);
|
$asset_uri = escapeUrl($row['asset_uri']);
|
||||||
$asset_uri_2 = sanitize_url($row['asset_uri_2']);
|
$asset_uri_2 = escapeUrl($row['asset_uri_2']);
|
||||||
$asset_uri_client = sanitize_url($row['asset_uri_client']);
|
$asset_uri_client = escapeUrl($row['asset_uri_client']);
|
||||||
$asset_status = escapeHtml($row['asset_status']);
|
$asset_status = escapeHtml($row['asset_status']);
|
||||||
$asset_purchase_reference = escapeHtml($row['asset_purchase_reference']);
|
$asset_purchase_reference = escapeHtml($row['asset_purchase_reference']);
|
||||||
$asset_purchase_date = escapeHtml($row['asset_purchase_date']);
|
$asset_purchase_date = escapeHtml($row['asset_purchase_date']);
|
||||||
|
|||||||
@@ -569,9 +569,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$asset_ipv6 = escapeHtml($row['interface_ipv6']);
|
$asset_ipv6 = escapeHtml($row['interface_ipv6']);
|
||||||
$asset_nat_ip = escapeHtml($row['interface_nat_ip']);
|
$asset_nat_ip = escapeHtml($row['interface_nat_ip']);
|
||||||
$asset_mac = escapeHtml($row['interface_mac']) ?: '-';
|
$asset_mac = escapeHtml($row['interface_mac']) ?: '-';
|
||||||
$asset_uri = sanitize_url($row['asset_uri']);
|
$asset_uri = escapeUrl($row['asset_uri']);
|
||||||
$asset_uri_2 = sanitize_url($row['asset_uri_2']);
|
$asset_uri_2 = escapeUrl($row['asset_uri_2']);
|
||||||
$asset_uri_client = sanitize_url($row['asset_uri_client']);
|
$asset_uri_client = escapeUrl($row['asset_uri_client']);
|
||||||
$asset_status = escapeHtml($row['asset_status']);
|
$asset_status = escapeHtml($row['asset_status']);
|
||||||
$asset_purchase_reference = escapeHtml($row['asset_purchase_reference']);
|
$asset_purchase_reference = escapeHtml($row['asset_purchase_reference']);
|
||||||
$asset_purchase_date = escapeHtml($row['asset_purchase_date']);
|
$asset_purchase_date = escapeHtml($row['asset_purchase_date']);
|
||||||
|
|||||||
@@ -365,13 +365,13 @@ $sql_asset_retired = mysqli_query(
|
|||||||
$credential_id = intval($row['credential_id']);
|
$credential_id = intval($row['credential_id']);
|
||||||
$credential_name = escapeHtml($row['credential_name']);
|
$credential_name = escapeHtml($row['credential_name']);
|
||||||
$credential_description = escapeHtml($row['credential_description']);
|
$credential_description = escapeHtml($row['credential_description']);
|
||||||
$credential_uri = sanitize_url($row['credential_uri']);
|
$credential_uri = escapeUrl($row['credential_uri']);
|
||||||
if (empty($credential_uri)) {
|
if (empty($credential_uri)) {
|
||||||
$credential_uri_display = "-";
|
$credential_uri_display = "-";
|
||||||
} else {
|
} else {
|
||||||
$credential_uri_display = "<a href='$credential_uri'>" . truncate($credential_uri,40) . "</a><button class='btn btn-sm clipboardjs' type='button' title='$credential_uri' data-clipboard-text='$credential_uri'><i class='far fa-copy text-secondary'></i></button>";
|
$credential_uri_display = "<a href='$credential_uri'>" . truncate($credential_uri,40) . "</a><button class='btn btn-sm clipboardjs' type='button' title='$credential_uri' data-clipboard-text='$credential_uri'><i class='far fa-copy text-secondary'></i></button>";
|
||||||
}
|
}
|
||||||
$credential_uri_2 = sanitize_url($row['credential_uri_2']);
|
$credential_uri_2 = escapeUrl($row['credential_uri_2']);
|
||||||
$credential_username = escapeHtml(decryptCredentialEntry($row['credential_username']));
|
$credential_username = escapeHtml(decryptCredentialEntry($row['credential_username']));
|
||||||
if (empty($credential_username)) {
|
if (empty($credential_username)) {
|
||||||
$credential_username_display = "-";
|
$credential_username_display = "-";
|
||||||
|
|||||||
@@ -318,13 +318,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$credential_id = intval($row['c_credential_id']);
|
$credential_id = intval($row['c_credential_id']);
|
||||||
$credential_name = escapeHtml($row['credential_name']);
|
$credential_name = escapeHtml($row['credential_name']);
|
||||||
$credential_description = escapeHtml($row['credential_description']);
|
$credential_description = escapeHtml($row['credential_description']);
|
||||||
$credential_uri = sanitize_url($row['credential_uri']);
|
$credential_uri = escapeUrl($row['credential_uri']);
|
||||||
if (empty($credential_uri)) {
|
if (empty($credential_uri)) {
|
||||||
$credential_uri_display = "-";
|
$credential_uri_display = "-";
|
||||||
} else {
|
} else {
|
||||||
$credential_uri_display = "<a href='$credential_uri'>" . truncate($credential_uri,40) . "</a><button class='btn btn-sm clipboardjs' type='button' title='$credential_uri' data-clipboard-text='$credential_uri'><i class='far fa-copy text-secondary'></i></button>";
|
$credential_uri_display = "<a href='$credential_uri'>" . truncate($credential_uri,40) . "</a><button class='btn btn-sm clipboardjs' type='button' title='$credential_uri' data-clipboard-text='$credential_uri'><i class='far fa-copy text-secondary'></i></button>";
|
||||||
}
|
}
|
||||||
$credential_uri_2 = sanitize_url($row['credential_uri_2']);
|
$credential_uri_2 = escapeUrl($row['credential_uri_2']);
|
||||||
$credential_username = escapeHtml(decryptCredentialEntry($row['credential_username']));
|
$credential_username = escapeHtml(decryptCredentialEntry($row['credential_username']));
|
||||||
if (empty($credential_username)) {
|
if (empty($credential_username)) {
|
||||||
$credential_username_display = "-";
|
$credential_username_display = "-";
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ while ($breadcrumb_folder_id > 0) {
|
|||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
// Helper: unified folder tree (no folder_location)
|
// Helper: unified folder tree (no folder_location)
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
function isAncestorFolder($folder_id, $current_folder_id, $client_id) {
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
|
|
||||||
if ($current_folder_id == 0) {
|
if ($current_folder_id == 0) {
|
||||||
@@ -73,13 +73,13 @@ function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
|||||||
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
||||||
if ($row = mysqli_fetch_assoc($result)) {
|
if ($row = mysqli_fetch_assoc($result)) {
|
||||||
$parent_folder_id = intval($row['parent_folder']);
|
$parent_folder_id = intval($row['parent_folder']);
|
||||||
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
|
return isAncestorFolder($folder_id, $parent_folder_id, $client_id);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_folders($parent_folder_id, $client_id, $indent = 0, $render_root = false) {
|
function displayFolders($parent_folder_id, $client_id, $indent = 0, $render_root = false) {
|
||||||
global $mysqli, $get_folder_id, $session_user_role, $archive_query, $archived, $num_root_items, $folders_expanded;
|
global $mysqli, $get_folder_id, $session_user_role, $archive_query, $archived, $num_root_items, $folders_expanded;
|
||||||
|
|
||||||
// Always render root (only once)
|
// Always render root (only once)
|
||||||
@@ -141,7 +141,7 @@ function display_folders($parent_folder_id, $client_id, $indent = 0, $render_roo
|
|||||||
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
||||||
|
|
||||||
// Active or ancestor of active folder = on active path
|
// Active or ancestor of active folder = on active path
|
||||||
$on_active_path = ($get_folder_id == $folder_id) || is_ancestor_folder($folder_id, $get_folder_id, $client_id);
|
$on_active_path = ($get_folder_id == $folder_id) || isAncestorFolder($folder_id, $get_folder_id, $client_id);
|
||||||
|
|
||||||
// Option C: indent with padding (no AdminLTE sidebar CSS required)
|
// Option C: indent with padding (no AdminLTE sidebar CSS required)
|
||||||
// Tune these numbers if you want tighter/looser indent
|
// Tune these numbers if you want tighter/looser indent
|
||||||
@@ -202,7 +202,7 @@ function display_folders($parent_folder_id, $client_id, $indent = 0, $render_roo
|
|||||||
// Collapsed by default: ONLY render children if folder is on active path
|
// Collapsed by default: ONLY render children if folder is on active path
|
||||||
if ($subfolder_count > 0 && ($folders_expanded || $on_active_path)) {
|
if ($subfolder_count > 0 && ($folders_expanded || $on_active_path)) {
|
||||||
echo '<ul class="nav nav-pills flex-column bg-light">';
|
echo '<ul class="nav nav-pills flex-column bg-light">';
|
||||||
display_folders($folder_id, $client_id, $indent + 1);
|
displayFolders($folder_id, $client_id, $indent + 1);
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ $num_root_items = intval($row_root_files['num']) + intval($row_root_docs['num'])
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Start folder tree from root
|
// Start folder tree from root
|
||||||
display_folders(0, $client_id);
|
displayFolders(0, $client_id);
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -212,7 +212,7 @@
|
|||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
||||||
$custom_link_name = escapeHtml($row['custom_link_name']);
|
$custom_link_name = escapeHtml($row['custom_link_name']);
|
||||||
$custom_link_uri = sanitize_url($row['custom_link_uri']);
|
$custom_link_uri = escapeUrl($row['custom_link_uri']);
|
||||||
$custom_link_icon = escapeHtml($row['custom_link_icon']);
|
$custom_link_icon = escapeHtml($row['custom_link_icon']);
|
||||||
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
||||||
if ($custom_link_new_tab == 1) {
|
if ($custom_link_new_tab == 1) {
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ $asset_make = escapeHtml($row['asset_make']);
|
|||||||
$asset_model = escapeHtml($row['asset_model']);
|
$asset_model = escapeHtml($row['asset_model']);
|
||||||
$asset_serial = escapeHtml($row['asset_serial']);
|
$asset_serial = escapeHtml($row['asset_serial']);
|
||||||
$asset_os = escapeHtml($row['asset_os']);
|
$asset_os = escapeHtml($row['asset_os']);
|
||||||
$asset_uri = sanitize_url($row['asset_uri']);
|
$asset_uri = escapeUrl($row['asset_uri']);
|
||||||
$asset_uri_2 = sanitize_url($row['asset_uri_2']);
|
$asset_uri_2 = escapeUrl($row['asset_uri_2']);
|
||||||
$asset_uri_client = sanitize_url($row['asset_uri_client']);
|
$asset_uri_client = escapeUrl($row['asset_uri_client']);
|
||||||
$asset_status = escapeHtml($row['asset_status']);
|
$asset_status = escapeHtml($row['asset_status']);
|
||||||
$asset_purchase_reference = escapeHtml($row['asset_purchase_reference']);
|
$asset_purchase_reference = escapeHtml($row['asset_purchase_reference']);
|
||||||
$asset_purchase_date = escapeHtml($row['asset_purchase_date']);
|
$asset_purchase_date = escapeHtml($row['asset_purchase_date']);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="name" id="client_name" placeholder="Name or Company" maxlength="200" onfocusout="client_duplicate_check()" required autofocus>
|
<input type="text" class="form-control" name="name" id="client_name" placeholder="Name or Company" maxlength="200" onfocusout="checkClientDuplicate()" required autofocus>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<div class="input-group-text">
|
<div class="input-group-text">
|
||||||
<input type="checkbox" name="lead" value="1" <?php if($leads_filter == 1){ echo "checked"; } ?>>
|
<input type="checkbox" name="lead" value="1" <?php if($leads_filter == 1){ echo "checked"; } ?>>
|
||||||
@@ -393,7 +393,7 @@ ob_start();
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Checks for duplicate clients
|
// Checks for duplicate clients
|
||||||
function client_duplicate_check() {
|
function checkClientDuplicate() {
|
||||||
var name = document.getElementById("client_name").value;
|
var name = document.getElementById("client_name").value;
|
||||||
//Send a GET request to ajax.php as ajax.php?client_duplicate_check=true&name=NAME
|
//Send a GET request to ajax.php as ajax.php?client_duplicate_check=true&name=NAME
|
||||||
jQuery.get(
|
jQuery.get(
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="email" class="form-control" name="email" id="contact_email" placeholder="Email Address" maxlength="200" onfocusout="contact_email_check()">
|
<input type="email" class="form-control" name="email" id="contact_email" placeholder="Email Address" maxlength="200" onfocusout="checkContactEmail()">
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<span class="text-info" id="contact_check_info"></span>
|
<span class="text-info" id="contact_check_info"></span>
|
||||||
@@ -346,7 +346,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Checks contact emails
|
// Checks contact emails
|
||||||
function contact_email_check() {
|
function checkContactEmail() {
|
||||||
var email = document.getElementById("contact_email").value;
|
var email = document.getElementById("contact_email").value;
|
||||||
//Send a GET request to ajax.php as ajax.php?contact_email_check=true&email=email
|
//Send a GET request to ajax.php as ajax.php?contact_email_check=true&email=email
|
||||||
jQuery.get(
|
jQuery.get(
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ $credential_name = escapeHtml($row['credential_name']);
|
|||||||
$credential_description = escapeHtml($row['credential_description']);
|
$credential_description = escapeHtml($row['credential_description']);
|
||||||
$credential_uri = escapeHtml($row['credential_uri']);
|
$credential_uri = escapeHtml($row['credential_uri']);
|
||||||
$credential_uri_2 = escapeHtml($row['credential_uri_2']);
|
$credential_uri_2 = escapeHtml($row['credential_uri_2']);
|
||||||
$credential_uri_link = sanitize_url($row['credential_uri']);
|
$credential_uri_link = escapeUrl($row['credential_uri']);
|
||||||
$credential_uri_2_link = sanitize_url($row['credential_uri_2']);
|
$credential_uri_2_link = escapeUrl($row['credential_uri_2']);
|
||||||
$credential_username = escapeHtml(decryptCredentialEntry($row['credential_username']));
|
$credential_username = escapeHtml(decryptCredentialEntry($row['credential_username']));
|
||||||
$credential_password = escapeHtml(decryptCredentialEntry($row['credential_password']));
|
$credential_password = escapeHtml(decryptCredentialEntry($row['credential_password']));
|
||||||
$credential_otp_secret = escapeHtml($row['credential_otp_secret']);
|
$credential_otp_secret = escapeHtml($row['credential_otp_secret']);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="name" id="domain_name" placeholder="example.com" maxlength="200" required autofocus onfocusout="domain_check()">
|
<input type="text" class="form-control" name="name" id="domain_name" placeholder="example.com" maxlength="200" required autofocus onfocusout="checkApexDomain()">
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<span class="text-info" id="domain_check_info"></span>
|
<span class="text-info" id="domain_check_info"></span>
|
||||||
@@ -200,7 +200,7 @@ ob_start();
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Checks domains aren't sub-domains (99%)
|
// Checks domains aren't sub-domains (99%)
|
||||||
function domain_check() {
|
function checkApexDomain() {
|
||||||
var domain = document.getElementById("domain_name").value;
|
var domain = document.getElementById("domain_name").value;
|
||||||
//Send a GET request to ajax.php as ajax.php?apex_domain_check=true&domain=domain
|
//Send a GET request to ajax.php as ajax.php?apex_domain_check=true&domain=domain
|
||||||
jQuery.get(
|
jQuery.get(
|
||||||
|
|||||||
@@ -273,13 +273,13 @@ ob_start();
|
|||||||
mysqli_data_seek($sql_credentials, 0);
|
mysqli_data_seek($sql_credentials, 0);
|
||||||
while ($row = mysqli_fetch_assoc($sql_credentials)) {
|
while ($row = mysqli_fetch_assoc($sql_credentials)) {
|
||||||
if (!empty($row['credential_uri'])) {
|
if (!empty($row['credential_uri'])) {
|
||||||
$urls[] = sanitize_url($row['credential_uri']);
|
$urls[] = escapeUrl($row['credential_uri']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mysqli_data_seek($sql_assets, 0);
|
mysqli_data_seek($sql_assets, 0);
|
||||||
while ($row = mysqli_fetch_assoc($sql_assets)) {
|
while ($row = mysqli_fetch_assoc($sql_assets)) {
|
||||||
if (!empty($row['asset_uri'])) {
|
if (!empty($row['asset_uri'])) {
|
||||||
$urls[] = sanitize_url($row['asset_uri']);
|
$urls[] = escapeUrl($row['asset_uri']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$urls = array_unique($urls);
|
$urls = array_unique($urls);
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
||||||
$custom_link_name = escapeHtml($row['custom_link_name']);
|
$custom_link_name = escapeHtml($row['custom_link_name']);
|
||||||
$custom_link_uri = sanitize_url($row['custom_link_uri']);
|
$custom_link_uri = escapeUrl($row['custom_link_uri']);
|
||||||
$custom_link_icon = escapeHtml($row['custom_link_icon']);
|
$custom_link_icon = escapeHtml($row['custom_link_icon']);
|
||||||
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
||||||
if ($custom_link_new_tab == 1) {
|
if ($custom_link_new_tab == 1) {
|
||||||
|
|||||||
@@ -4,46 +4,6 @@ require_once "includes/inc_all_reports.php";
|
|||||||
|
|
||||||
enforceUserPermission('module_support');
|
enforceUserPermission('module_support');
|
||||||
|
|
||||||
function secondsToTime($inputSeconds) {
|
|
||||||
$inputSeconds = floor($inputSeconds);
|
|
||||||
|
|
||||||
$secondsInAMinute = 60;
|
|
||||||
$secondsInAnHour = 60 * $secondsInAMinute;
|
|
||||||
$secondsInADay = 24 * $secondsInAnHour;
|
|
||||||
|
|
||||||
// Extract days
|
|
||||||
$days = floor($inputSeconds / $secondsInADay);
|
|
||||||
|
|
||||||
// Extract hours
|
|
||||||
$hourSeconds = $inputSeconds % $secondsInADay;
|
|
||||||
$hours = floor($hourSeconds / $secondsInAnHour);
|
|
||||||
|
|
||||||
// Extract minutes
|
|
||||||
$minuteSeconds = $hourSeconds % $secondsInAnHour;
|
|
||||||
$minutes = floor($minuteSeconds / $secondsInAMinute);
|
|
||||||
|
|
||||||
// Extract the remaining seconds
|
|
||||||
$remainingSeconds = $minuteSeconds % $secondsInAMinute;
|
|
||||||
$seconds = ceil($remainingSeconds);
|
|
||||||
|
|
||||||
// Format and return
|
|
||||||
$timeParts = [];
|
|
||||||
$sections = [
|
|
||||||
'day' => (int)$days,
|
|
||||||
'hour' => (int)$hours,
|
|
||||||
'minute' => (int)$minutes,
|
|
||||||
'second' => (int)$seconds,
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($sections as $name => $value){
|
|
||||||
if ($value > 0) {
|
|
||||||
$timeParts[] = $value. ' '.$name.($value == 1 ? '' : 's');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return implode(', ', $timeParts);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET['year'])) {
|
if (isset($_GET['year'])) {
|
||||||
$year = intval($_GET['year']);
|
$year = intval($_GET['year']);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,44 +4,6 @@ require_once "includes/inc_all_reports.php";
|
|||||||
|
|
||||||
enforceUserPermission('module_sales', 1);
|
enforceUserPermission('module_sales', 1);
|
||||||
|
|
||||||
function secondsToTime($inputSeconds) {
|
|
||||||
$secondsInAMinute = 60;
|
|
||||||
$secondsInAnHour = 60 * $secondsInAMinute;
|
|
||||||
$secondsInADay = 24 * $secondsInAnHour;
|
|
||||||
|
|
||||||
// Extract days
|
|
||||||
$days = floor($inputSeconds / $secondsInADay);
|
|
||||||
|
|
||||||
// Extract hours
|
|
||||||
$hourSeconds = $inputSeconds % $secondsInADay;
|
|
||||||
$hours = floor($hourSeconds / $secondsInAnHour);
|
|
||||||
|
|
||||||
// Extract minutes
|
|
||||||
$minuteSeconds = $hourSeconds % $secondsInAnHour;
|
|
||||||
$minutes = floor($minuteSeconds / $secondsInAMinute);
|
|
||||||
|
|
||||||
// Extract the remaining seconds
|
|
||||||
$remainingSeconds = $minuteSeconds % $secondsInAMinute;
|
|
||||||
$seconds = ceil($remainingSeconds);
|
|
||||||
|
|
||||||
// Format and return
|
|
||||||
$timeParts = [];
|
|
||||||
$sections = [
|
|
||||||
'day' => (int)$days,
|
|
||||||
'hour' => (int)$hours,
|
|
||||||
'minute' => (int)$minutes,
|
|
||||||
'second' => (int)$seconds,
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($sections as $name => $value){
|
|
||||||
if ($value > 0){
|
|
||||||
$timeParts[] = $value. ' '.$name.($value == 1 ? '' : 's');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return implode(', ', $timeParts);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET['year'])) {
|
if (isset($_GET['year'])) {
|
||||||
$year = intval($_GET['year']);
|
$year = intval($_GET['year']);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,46 +4,6 @@ require_once "includes/inc_all_reports.php";
|
|||||||
|
|
||||||
enforceUserPermission('module_support');
|
enforceUserPermission('module_support');
|
||||||
|
|
||||||
function secondsToTime($inputSeconds) {
|
|
||||||
$inputSeconds = floor($inputSeconds);
|
|
||||||
|
|
||||||
$secondsInAMinute = 60;
|
|
||||||
$secondsInAnHour = 60 * $secondsInAMinute;
|
|
||||||
$secondsInADay = 24 * $secondsInAnHour;
|
|
||||||
|
|
||||||
// Extract days
|
|
||||||
$days = floor($inputSeconds / $secondsInADay);
|
|
||||||
|
|
||||||
// Extract hours
|
|
||||||
$hourSeconds = $inputSeconds % $secondsInADay;
|
|
||||||
$hours = floor($hourSeconds / $secondsInAnHour);
|
|
||||||
|
|
||||||
// Extract minutes
|
|
||||||
$minuteSeconds = $hourSeconds % $secondsInAnHour;
|
|
||||||
$minutes = floor($minuteSeconds / $secondsInAMinute);
|
|
||||||
|
|
||||||
// Extract the remaining seconds
|
|
||||||
$remainingSeconds = $minuteSeconds % $secondsInAMinute;
|
|
||||||
$seconds = ceil($remainingSeconds);
|
|
||||||
|
|
||||||
// Format and return
|
|
||||||
$timeParts = [];
|
|
||||||
$sections = [
|
|
||||||
'day' => (int)$days,
|
|
||||||
'hour' => (int)$hours,
|
|
||||||
'minute' => (int)$minutes,
|
|
||||||
'second' => (int)$seconds,
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($sections as $name => $value){
|
|
||||||
if ($value > 0){
|
|
||||||
$timeParts[] = $value. ' '.$name.($value == 1 ? '' : 's');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return implode(', ', $timeParts);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET['year'])) {
|
if (isset($_GET['year'])) {
|
||||||
$year = intval($_GET['year']);
|
$year = intval($_GET['year']);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ $assets_sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON
|
|||||||
$asset_warranty_expire = escapeHtml($row['asset_warranty_expire'] ?? "-");
|
$asset_warranty_expire = escapeHtml($row['asset_warranty_expire'] ?? "-");
|
||||||
$assigned_to = escapeHtml($row['contact_name'] ?? "-");
|
$assigned_to = escapeHtml($row['contact_name'] ?? "-");
|
||||||
$asset_status = escapeHtml($row['asset_status']);
|
$asset_status = escapeHtml($row['asset_status']);
|
||||||
$asset_uri_client = sanitize_url($row['asset_uri_client']);
|
$asset_uri_client = escapeUrl($row['asset_uri_client']);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ if ($session_contact_primary == 1 || $session_contact_is_technical_contact) {
|
|||||||
while ($row = mysqli_fetch_assoc($sql_assigned_assets)) {
|
while ($row = mysqli_fetch_assoc($sql_assigned_assets)) {
|
||||||
$asset_name = escapeHtml($row['asset_name']);
|
$asset_name = escapeHtml($row['asset_name']);
|
||||||
$asset_type = escapeHtml($row['asset_type']);
|
$asset_type = escapeHtml($row['asset_type']);
|
||||||
$asset_uri_client = sanitize_url($row['asset_uri_client']);
|
$asset_uri_client = escapeUrl($row['asset_uri_client']);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -341,3 +341,44 @@ function formatBytes($bytes, $precision = 2) {
|
|||||||
|
|
||||||
return round($bytes, $precision) . ' ' . $units[$i];
|
return round($bytes, $precision) . ' ' . $units[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function secondsToTime($inputSeconds) {
|
||||||
|
$inputSeconds = floor($inputSeconds);
|
||||||
|
|
||||||
|
$secondsInAMinute = 60;
|
||||||
|
$secondsInAnHour = 60 * $secondsInAMinute;
|
||||||
|
$secondsInADay = 24 * $secondsInAnHour;
|
||||||
|
|
||||||
|
// Extract days
|
||||||
|
$days = floor($inputSeconds / $secondsInADay);
|
||||||
|
|
||||||
|
// Extract hours
|
||||||
|
$hourSeconds = $inputSeconds % $secondsInADay;
|
||||||
|
$hours = floor($hourSeconds / $secondsInAnHour);
|
||||||
|
|
||||||
|
// Extract minutes
|
||||||
|
$minuteSeconds = $hourSeconds % $secondsInAnHour;
|
||||||
|
$minutes = floor($minuteSeconds / $secondsInAMinute);
|
||||||
|
|
||||||
|
// Extract the remaining seconds
|
||||||
|
$remainingSeconds = $minuteSeconds % $secondsInAMinute;
|
||||||
|
$seconds = ceil($remainingSeconds);
|
||||||
|
|
||||||
|
// Format and return
|
||||||
|
$timeParts = [];
|
||||||
|
$sections = [
|
||||||
|
'day' => (int)$days,
|
||||||
|
'hour' => (int)$hours,
|
||||||
|
'minute' => (int)$minutes,
|
||||||
|
'second' => (int)$seconds,
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($sections as $name => $value) {
|
||||||
|
if ($value > 0) {
|
||||||
|
$timeParts[] = $value. ' '.$name.($value == 1 ? '' : 's');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(', ', $timeParts);
|
||||||
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function toAlphanumeric($string)
|
|||||||
return preg_replace('/[^A-Za-z0-9_-]/', '', $string);
|
return preg_replace('/[^A-Za-z0-9_-]/', '', $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitize_url($url) {
|
function escapeUrl($url) {
|
||||||
$allowed = ['http', 'https', 'file', 'ftp', 'ftps', 'sftp', 'dav', 'webdav', 'caldav', 'carddav', 'ssh', 'telnet', 'smb', 'rdp', 'vnc', 'rustdesk', 'anydesk', 'connectwise', 'splashtop', 'sip', 'sips', 'ldap', 'ldaps'];
|
$allowed = ['http', 'https', 'file', 'ftp', 'ftps', 'sftp', 'dav', 'webdav', 'caldav', 'carddav', 'ssh', 'telnet', 'smb', 'rdp', 'vnc', 'rustdesk', 'anydesk', 'connectwise', 'splashtop', 'sip', 'sips', 'ldap', 'ldaps'];
|
||||||
$parts = parse_url($url ?? '');
|
$parts = parse_url($url ?? '');
|
||||||
if (isset($parts['scheme']) && !in_array(strtolower($parts['scheme']), $allowed)) {
|
if (isset($parts['scheme']) && !in_array(strtolower($parts['scheme']), $allowed)) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
||||||
$custom_link_name = escapeHtml($row['custom_link_name']);
|
$custom_link_name = escapeHtml($row['custom_link_name']);
|
||||||
$custom_link_uri = sanitize_url($row['custom_link_uri']);
|
$custom_link_uri = escapeUrl($row['custom_link_uri']);
|
||||||
$custom_link_icon = escapeHtml($row['custom_link_icon']);
|
$custom_link_icon = escapeHtml($row['custom_link_icon']);
|
||||||
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
||||||
if ($custom_link_new_tab == 1) {
|
if ($custom_link_new_tab == 1) {
|
||||||
|
|||||||
@@ -890,7 +890,7 @@ if (isset($_POST['add_telemetry'])) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Check upload_max_filesize and post_max_size >= 500M
|
// Check upload_max_filesize and post_max_size >= 500M
|
||||||
function return_bytes($val) {
|
function toBytes($val) {
|
||||||
$val = trim($val);
|
$val = trim($val);
|
||||||
$unit = strtolower(substr($val, -1));
|
$unit = strtolower(substr($val, -1));
|
||||||
$num = (float)$val;
|
$num = (float)$val;
|
||||||
@@ -910,8 +910,8 @@ if (isset($_POST['add_telemetry'])) {
|
|||||||
$upload_max_filesize = ini_get('upload_max_filesize');
|
$upload_max_filesize = ini_get('upload_max_filesize');
|
||||||
$post_max_size = ini_get('post_max_size');
|
$post_max_size = ini_get('post_max_size');
|
||||||
|
|
||||||
$upload_passed = return_bytes($upload_max_filesize) >= $required_bytes;
|
$upload_passed = toBytes($upload_max_filesize) >= $required_bytes;
|
||||||
$post_passed = return_bytes($post_max_size) >= $required_bytes;
|
$post_passed = toBytes($post_max_size) >= $required_bytes;
|
||||||
|
|
||||||
$phpConfig[] = [
|
$phpConfig[] = [
|
||||||
'name' => 'upload_max_filesize >= 500M',
|
'name' => 'upload_max_filesize >= 500M',
|
||||||
|
|||||||
Reference in New Issue
Block a user