diff --git a/CHANGELOG.md b/CHANGELOG.md index 75e57a9f..446ca6e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,9 @@ All notable changes to ITFlow will be documented in this file. - Bugfix: Asset interface losing DHCP setting - Bugfix: Editing / creating recurring expenses results in error 500 due to incorrect var name - Stripe online payment setup now prompts you to set the income/expense account -- Admin pages now once again use the new admin rolecheck +- Admin pages now once again use the new admin role-check +- Debug now shows the current git branch +- Individual POST handler logic pages can no longer be accessed directly ## 24.12 diff --git a/admin_role.php b/admin_role.php index 241a116f..800b58cc 100644 --- a/admin_role.php +++ b/admin_role.php @@ -110,11 +110,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - - - - + + Archive + diff --git a/post.php b/post.php index f09d2141..69a21561 100644 --- a/post.php +++ b/post.php @@ -10,6 +10,9 @@ require_once "functions.php"; require_once "check_login.php"; +// Define a variable that we can use to only allow running post files via inclusion (prevents people/bots poking them) +define('FROM_POST_HANDLER', true); + // Determine which files we should load @@ -28,13 +31,7 @@ if (str_contains($module, 'admin') && isset($session_is_admin) && $session_is_ad // To add a new admin POST request handler, add a file named after the admin page // e.g. changes made on the page http://itflow/admin_ticket_statues.php will load the page post/admin/admin_ticket_statues.php to handle the changes - if ($module !== 'admin_update') { - require_once "post/admin/$module.php"; - } - // IF statement is temporary - - - + require_once "post/admin/$module.php"; } elseif (str_contains($module, 'xcustom')) { // Dynamically load any custom POST logic @@ -58,10 +55,6 @@ if (str_contains($module, 'admin') && isset($session_is_admin) && $session_is_ad // Logout is the same for user and admin require_once "post/logout.php"; -// TODO: Move admin_update into the admin section to be auto-loaded -// We can't do this until everyone has the new database fields added in 1.4.9 on Sept 14th 2024 -require_once "post/admin_update.php"; // Load updater - // TODO: Find a home for these require_once "post/ai.php"; diff --git a/post/admin/admin_api.php b/post/admin/admin_api.php index 8817b62a..073f2afd 100644 --- a/post/admin/admin_api.php +++ b/post/admin/admin_api.php @@ -4,6 +4,8 @@ * ITFlow - GET/POST request handler for API settings */ +defined('FROM_POST_HANDLER') || die("Direct file access is not allowed"); + if (isset($_POST['add_api_key'])) { validateCSRFToken($_POST['csrf_token']); diff --git a/post/admin/admin_backup.php b/post/admin/admin_backup.php index 8649e91d..dfb0509a 100644 --- a/post/admin/admin_backup.php +++ b/post/admin/admin_backup.php @@ -4,6 +4,8 @@ * ITFlow - GET/POST request handler for DB / master key backup */ +defined('FROM_POST_HANDLER') || die("Direct file access is not allowed"); + if (isset($_GET['download_database'])) { validateCSRFToken($_GET['csrf_token']); diff --git a/post/admin/admin_bulk_mail.php b/post/admin/admin_bulk_mail.php index cdbf999f..4ddc0651 100644 --- a/post/admin/admin_bulk_mail.php +++ b/post/admin/admin_bulk_mail.php @@ -4,6 +4,9 @@ * ITFlow - GET/POST request handler for bulk email */ +defined('FROM_POST_HANDLER') || die("Direct file access is not allowed"); + + if (isset($_POST['send_bulk_mail_now'])) { if (isset($_POST['contact_ids'])) { diff --git a/post/admin/admin_category.php b/post/admin/admin_category.php index c3a97fc2..b5bd1273 100644 --- a/post/admin/admin_category.php +++ b/post/admin/admin_category.php @@ -4,6 +4,8 @@ * ITFlow - GET/POST request handler for categories ('category') */ +defined('FROM_POST_HANDLER') || die("Direct file access is not allowed"); + if (isset($_POST['add_category'])) { require_once 'post/admin/admin_category_model.php'; diff --git a/post/admin/admin_category_model.php b/post/admin/admin_category_model.php index 92b0c6ba..81b54a39 100644 --- a/post/admin/admin_category_model.php +++ b/post/admin/admin_category_model.php @@ -1,4 +1,6 @@