mirror of
https://github.com/itflow-org/itflow
synced 2026-03-11 08:14:52 +00:00
Add missing CSRF Checks in admin area and settings
This commit is contained in:
@@ -8,6 +8,8 @@ defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
||||
|
||||
if (isset($_POST['add_category'])) {
|
||||
|
||||
validateCSRFToken($_POST['csrf_token']);
|
||||
|
||||
require_once 'category_model.php';
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO categories SET category_name = '$name', category_type = '$type', category_color = '$color'");
|
||||
@@ -24,6 +26,8 @@ if (isset($_POST['add_category'])) {
|
||||
|
||||
if (isset($_POST['edit_category'])) {
|
||||
|
||||
validateCSRFToken($_POST['csrf_token']);
|
||||
|
||||
require_once 'category_model.php';
|
||||
|
||||
$category_id = intval($_POST['category_id']);
|
||||
@@ -40,6 +44,8 @@ if (isset($_POST['edit_category'])) {
|
||||
|
||||
if (isset($_GET['archive_category'])) {
|
||||
|
||||
validateCSRFToken($_GET['csrf_token']);
|
||||
|
||||
$category_id = intval($_GET['archive_category']);
|
||||
|
||||
// Get Category Name and Type for logging
|
||||
@@ -58,9 +64,11 @@ if (isset($_GET['archive_category'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['unarchive_category'])) {
|
||||
if (isset($_GET['restore_category'])) {
|
||||
|
||||
$category_id = intval($_GET['unarchive_category']);
|
||||
validateCSRFToken($_GET['csrf_token']);
|
||||
|
||||
$category_id = intval($_GET['retore_category']);
|
||||
|
||||
// Get Category Name and Type for logging
|
||||
$sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id");
|
||||
@@ -70,9 +78,9 @@ if (isset($_GET['unarchive_category'])) {
|
||||
|
||||
mysqli_query($mysqli,"UPDATE categories SET category_archived_at = NULL WHERE category_id = $category_id");
|
||||
|
||||
logAction("Category", "Unarchive", "$session_name unarchived category $category_type $category_name", 0, $category_id);
|
||||
logAction("Category", "Restore", "$session_name retored category $category_type $category_name", 0, $category_id);
|
||||
|
||||
flash_alert("Category $category_type <strong>$category_name</strong> unarchived");
|
||||
flash_alert("Category $category_type <strong>$category_name</strong> restored");
|
||||
|
||||
redirect();
|
||||
|
||||
@@ -80,6 +88,8 @@ if (isset($_GET['unarchive_category'])) {
|
||||
|
||||
if (isset($_GET['delete_category'])) {
|
||||
|
||||
validateCSRFToken($_GET['csrf_token']);
|
||||
|
||||
$category_id = intval($_GET['delete_category']);
|
||||
|
||||
// Get Category Name and Type for logging
|
||||
|
||||
Reference in New Issue
Block a user