From 6fe855400cbdcfd547ad9913dc61ef83a2d50c79 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Wed, 2 Dec 2026 22:20:00 -0800 Subject: [PATCH] refactor(php82): use str_starts_with and a short array Signed-off-by: Thomas Vincent --- includes/security.php | 2 +- setup.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/security.php b/includes/security.php index 97c51ae..997afc9 100644 --- a/includes/security.php +++ b/includes/security.php @@ -64,7 +64,7 @@ function quicktree_can_edit_tree(int $tree_id): bool { return true; } - $owner = db_fetch_cell_prepared('SELECT user_id FROM graph_tree WHERE id = ?', array($tree_id)); + $owner = db_fetch_cell_prepared('SELECT user_id FROM graph_tree WHERE id = ?', [$tree_id]); return $owner !== false && $owner !== null && (int) $owner === $user_id; } diff --git a/setup.php b/setup.php index 71983f3..a92999e 100644 --- a/setup.php +++ b/setup.php @@ -488,7 +488,7 @@ function quicktree_prune_files(): void { $whitelist = isset($manifest['whitelist']) && is_array($manifest['whitelist']) ? $manifest['whitelist'] : []; $protected = function (string $rel) use ($whitelist): bool { - if (strncmp($rel, '.git', 4) === 0 || strncmp($rel, '.md', 3) === 0) { + if (str_starts_with($rel, '.git') || str_starts_with($rel, '.md')) { return true; }