function RemoveAttachment()
{
global $modSettings, $txt, $smcFunc;
checkSession('post');
if (!empty($_POST['remove']))
{
$attachments = array();
// There must be a quicker way to pass this safety test??
foreach ($_POST['remove'] as $removeID => $dummy)
$attachments[] = (int) $removeID;
if ($_REQUEST['type'] == 'avatars' && !empty($attachments))
removeAttachments(array('id_attach' => $attachments));
else if (!empty($attachments))
{
$messages = removeAttachments(array('id_attach' => $attachments), 'messages', true);
// And change the message to reflect this.
if (!empty($messages))
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET body = CONCAT(body, {string:deleted_message})
WHERE id_msg IN ({array_int:messages_affected})',
array(
'messages_affected' => $messages,
'deleted_message' => '<br /><br />' . $txt['attachment_delete_admin'],
)
);
}
}
$_GET['sort'] = isset($_GET['sort']) ? $_GET['sort'] : 'date';
redirectexit('action=admin;area=manageattachments;sa=browse;' . $_REQUEST['type'] . ';sort=' . $_GET['sort'] . (isset($_GET['desc']) ? ';desc' : '') . ';start=' . $_REQUEST['start']);
}
function RemoveAttachment()
{
global $txt, $smcFunc, $language;
checkSession('post');
if (!empty($_POST['remove']))
{
$attachments = array();
// There must be a quicker way to pass this safety test??
foreach ($_POST['remove'] as $removeID => $dummy)
$attachments[] = (int) $removeID;
if ($_REQUEST['type'] == 'avatars' && !empty($attachments))
removeAttachments(array('id_attach' => $attachments));
else if (!empty($attachments))
{
$messages = removeAttachments(array('id_attach' => $attachments), 'messages', true);
// And change the message to reflect this.
if (!empty($messages))
{
loadLanguage('index', $language, true);
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET body = CONCAT(body, {string:deleted_message})
WHERE id_msg IN ({array_int:messages_affected})',
array(
'messages_affected' => $messages,
'deleted_message' => '<br /><br />' . $txt['attachment_delete_admin'],
)
);
loadLanguage('index', $user_info['language'], true);
}
}
}
$_GET['sort'] = isset($_GET['sort']) ? $_GET['sort'] : 'date';
redirectexit('action=admin;area=manageattachments;sa=browse;' . $_REQUEST['type'] . ';sort=' . $_GET['sort'] . (isset($_GET['desc']) ? ';desc' : '') . ';start=' . $_REQUEST['start']);
}