mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:07 +01:00
do NOT allow to call Api\Etemplate\Widget\Link::ajax_delete() without a positive link_id
This commit is contained in:
parent
3e5b6cc570
commit
4d31516929
@ -13,6 +13,7 @@
|
||||
|
||||
namespace EGroupware\Api\Etemplate\Widget;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use EGroupware\Api\Etemplate;
|
||||
use EGroupware\Api;
|
||||
|
||||
@ -310,8 +311,19 @@ class Link extends Etemplate\Widget
|
||||
$response->message(lang('%1 files copied',count($copied)));
|
||||
}
|
||||
|
||||
public static function ajax_delete($value)
|
||||
/**
|
||||
* Delete a link specified by its link_id
|
||||
*
|
||||
* @param int $value link_id to delete
|
||||
* @return void
|
||||
* @throws Api\Json\Exception|InvalidArgumentException
|
||||
*/
|
||||
public static function ajax_delete(int $value)
|
||||
{
|
||||
if ($value <= 0)
|
||||
{
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
$response = Api\Json\Response::get();
|
||||
$response->data(Api\Link::unlink($value));
|
||||
}
|
||||
@ -430,4 +442,4 @@ class Link extends Etemplate\Widget
|
||||
//error_log(" " . array2string($valid));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user