2.0.1, attachments removed by the admin

Started by Robert., November 03, 2011, 02:22:13 PM

Previous topic - Next topic

Robert.

Clean and fresh SMF 2.0.1 install, no mods installed, using the default theme. But, when removing attachments by deleting the files within the admin panel removes the attachments like it should. No problem with that. But, when you are using an other language than the forum default one, it will add [Attachment removed by the administrator] in the language of the admin that removes the attachment. In other words, it should use the string from the forum default language instead.

Illori

developers is this an issue we should look into further? if so can it be tracked?

Robert.

If you like I can write a patch when I have some time ;)

emanuele



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

* emanuele needs to track it...or fix it. :P


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

NanoSector

My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

emanuele



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

NanoSector

* Yoshi2889 isn't at midnight but doesn't feel like writing a patch either ::)

No, really, I dunno how to fix something like that.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

emanuele

It's no so difficult, it is "just" a matter of

loadLanguae(#forumdefault#);
[do teh job];
loadLanguage(#user's lang#);

It's more annoying find the relevant code... :P


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

Code (find) Select
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']);
}


Code (replace with) Select
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']);
}


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: