Advertisement:
Advertise With Us!

Author Topic: 2.0.1, attachments removed by the admin  (Read 3370 times)

Offline Doctor Deejay

  • On Hiatus
  • SMF Hero
  • *
  • Posts: 3,491
  • Gender: Male
2.0.1, attachments removed by the admin
« on: November 03, 2011, 02:22:13 PM »
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.
Doctor Deejay                                        I understand everything... except that wig. - Jack Sparrow
Simple Machines LocalizerDon't pm me for support
deejay [at] simplemachines [dot] orgGet To Know The Team - Dr. Deejay

Offline Illori

  • Doc Writer
  • SMF Master
  • *
  • Posts: 25,777
Re: 2.0.1, attachments removed by the admin
« Reply #1 on: November 18, 2011, 10:43:00 AM »
developers is this an issue we should look into further? if so can it be tracked?

Offline Doctor Deejay

  • On Hiatus
  • SMF Hero
  • *
  • Posts: 3,491
  • Gender: Male
Re: 2.0.1, attachments removed by the admin
« Reply #2 on: December 22, 2011, 10:52:30 AM »
If you like I can write a patch when I have some time ;)
Doctor Deejay                                        I understand everything... except that wig. - Jack Sparrow
Simple Machines LocalizerDon't pm me for support
deejay [at] simplemachines [dot] orgGet To Know The Team - Dr. Deejay

Online emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,875
  • Gender: Male
  • Because Orange is Orange
Re: 2.0.1, attachments removed by the admin
« Reply #3 on: December 23, 2011, 07:49:30 PM »
Yep, feel free to provide a patch here. ;)

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

Online emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,875
  • Gender: Male
  • Because Orange is Orange
Re: 2.0.1, attachments removed by the admin
« Reply #4 on: April 29, 2012, 05:51:03 PM »
* emanuele needs to track it...or fix it. :P

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

Offline Yoshi

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,136
  • Gender: Male
Re: 2.0.1, attachments removed by the admin
« Reply #5 on: April 29, 2012, 05:52:12 PM »
Why don't ya do both, eh? :P
My Mods / [WIP] Mod Builder / GitHub profile / "A programmer is just a tool which converts caffeine into code."
Quote
<FLAMER> Marketing is about to get into drug activities maybe... but we will see about that later on :P
<Yoshi2889> We're getting free drugs?
<CoreISP> He's talking about caffeine man, damn pen lifter.

Online emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,875
  • Gender: Male
  • Because Orange is Orange
Re: 2.0.1, attachments removed by the admin
« Reply #6 on: April 29, 2012, 05:54:30 PM »
* emanuele is tired... :(

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

Offline Yoshi

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,136
  • Gender: Male
Re: 2.0.1, attachments removed by the admin
« Reply #7 on: April 29, 2012, 06:03:26 PM »
* 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 / [WIP] Mod Builder / GitHub profile / "A programmer is just a tool which converts caffeine into code."
Quote
<FLAMER> Marketing is about to get into drug activities maybe... but we will see about that later on :P
<Yoshi2889> We're getting free drugs?
<CoreISP> He's talking about caffeine man, damn pen lifter.

Online emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,875
  • Gender: Male
  • Because Orange is Orange
Re: 2.0.1, attachments removed by the admin
« Reply #8 on: April 30, 2012, 03:07:51 AM »
It's no so difficult, it is "just" a matter of
Code: [Select]
loadLanguae(#forumdefault#);
[do teh job];
loadLanguage(#user's lang#);
It's more annoying find the relevant code... :P

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

Online emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,875
  • Gender: Male
  • Because Orange is Orange
Re: 2.0.1, attachments removed by the admin
« Reply #9 on: April 30, 2012, 11:49:05 AM »
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']);
}

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