diff --git a/admin/themes/default/js/batchManagerGlobal.js b/admin/themes/default/js/batchManagerGlobal.js
index f26ab11db..3e48a74f0 100644
--- a/admin/themes/default/js/batchManagerGlobal.js
+++ b/admin/themes/default/js/batchManagerGlobal.js
@@ -373,7 +373,9 @@ function delete_orphans_block(blockSize) {
document.location = redirect_to;
}
},
- error:function(XMLHttpRequest, textStatus, errorThrows) {
+ error:function(XMLHttpRequest) {
+ jQuery('#orphans_deletion').hide();
+ jQuery('#orphans_deletion_error').show().html('error '+XMLHttpRequest.status+' : '+XMLHttpRequest.statusText);
}
});
}
\ No newline at end of file
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index 254bdf551..f66bb0546 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -356,6 +356,8 @@ var sliders = {
{'orphans to delete'|translate}
+
+
{'based on'|translate}
diff --git a/include/ws_functions/pwg.images.php b/include/ws_functions/pwg.images.php
index aa9cc1189..393e42c13 100644
--- a/include/ws_functions/pwg.images.php
+++ b/include/ws_functions/pwg.images.php
@@ -1770,6 +1770,11 @@ function ws_images_checkUpload($params, $service)
*/
function ws_images_deleteOrphans($params, $service)
{
+ if (get_pwg_token() != $params['pwg_token'])
+ {
+ return new PwgError(403, 'Invalid security token');
+ }
+
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
$orphan_ids_to_delete = array_slice(get_orphans(), 0, $params['block_size']);