Skip to content
Permalink
Browse files
Extend method hook validation for deletes
  • Loading branch information
jekkos committed Sep 28, 2021
1 parent 2b031e6 commit e8f27f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
@@ -28,8 +28,8 @@

$hook['pre_controller'][] = array(
'class' => '',
'function' => 'validate_save',
'filename' => 'save_hook.php',
'function' => 'validate_method',
'filename' => 'method_hook.php',
'filepath' => 'hooks'
);

@@ -0,0 +1,16 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

function validate_method()
{

$url = $_SERVER['REQUEST_URI'];

$post_required = preg_match('/(save|delete|delete_item)\/?\d*?/', $url);

if($post_required && $_SERVER["REQUEST_METHOD"] != "POST" && empty($_POST))
{
echo "Method not allowed";
die;
}

}

This file was deleted.

2 comments on commit e8f27f5

@odiea
Copy link
Collaborator

@odiea odiea commented on e8f27f5 Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing all this on your time off.LOL

@jekkos
Copy link
Member Author

@jekkos jekkos commented on e8f27f5 Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back home already here, had a busy day indeed

Please sign in to comment.