Move photo deletion from ViewPhoto to EditAsset
Removes the intermediate confirmation page, instead using JavaScript for confirmation. Fixes an XSS issue, in that the previous method was not passing or checking the session (!)
This commit is contained in:
@@ -22,8 +22,14 @@ class EditAsset extends HTMLController
|
||||
if (!($user->isAdmin() || $asset->isOwnedBy($user)))
|
||||
throw new NotAllowedException();
|
||||
|
||||
if (isset($_REQUEST['delete']))
|
||||
throw new Exception('Not implemented.');
|
||||
if (isset($_REQUEST['delete']) && Session::validateSession('get'))
|
||||
{
|
||||
$redirectUrl = BASEURL . '/' . $asset->getSubdir();
|
||||
$asset->delete();
|
||||
|
||||
header('Location: ' . $redirectUrl);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!empty($_POST))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user