Skip to content

Commit

Permalink
Ajout: Supression des permissions et du logo lors de la suppression d…
Browse files Browse the repository at this point in the history
…'un contenu
  • Loading branch information
GregMage committed Sep 26, 2018
1 parent 285cd8d commit b80a994
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions admin/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,24 @@
redirect_header('content.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
if ($contentHandler->delete($obj)) {
//Del logo
if ($obj->getVar('content_logo') != 'blank.gif') {
// Test if the image is used
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('content_logo', $obj->getVar('content_logo')));
$content_count = $contentHandler->getCount($criteria);
if ($content_count == 0){
$uploadirectory = '/xmcontent/images/';
$urlfile = XOOPS_UPLOAD_PATH . $uploadirectory . $obj->getVar('content_logo');
if (is_file($urlfile)) {
chmod($urlfile, 0777);
unlink($urlfile);
}
}
}
// Del permissions
$permHelper = new \Xmf\Module\Helper\Permission();
$permHelper->deletePermissionForItem('xmcontent_contentview', $content_id);
redirect_header('content.php', 2, _AM_XMCONTENT_REDIRECT_SAVE);
} else {
xoops_error($obj->getHtmlErrors());
Expand Down

0 comments on commit b80a994

Please sign in to comment.