News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

PM Attachments

Started by SoLoGHoST, August 20, 2009, 09:08:18 AM

Previous topic - Next topic

3dickulus

#400
Having the same/similar problem as Dave J

Site is v2.1.4, upgraded from v2.0.19 successfully, post attachments are visible and downloadable.

PM Attachments problem: can view images attached by clicking the thumbnail but the download link fails with 404 file not found.

The file exists in pm_attachments folder, id_hash name format, file type does not matter, anything that is not an image is not accessible via the dl-link .zip .txt etc. although these are all in the allowed extensions list.

PM Attachments mod v2.13 and v2.12 exhibit the same problem. currently v2.13 is installed.

I have 2 sites in the same state, everything else seems to be fine after upgrading, one site has 37,546 Posts in 4,792 Topics by 684 Members and the other has 99,334 Posts in 24,438 Topics by 1,807 Members.

It's kind of important that this mod is functioning correctly for SMF v2.1.4 , my knowledge and skills aren't quite enough to get this working (yet) I hope someone can provide a fix or replacement for the PM_Attachments mod.

GL700Wing

Quote from: 3dickulus on July 13, 2024, 06:51:17 PMHaving the same/similar problem as Dave J
@Dave J and @3dickulus : I think the attachment download issue may be caused by the Subs-PMAttachments.php containing 'create_function' calls which have been deprecated in PHP 8.x.

In the attached Subs-PMAttachments.php file the 'create_function' calls have been replaced with equivalent 'function' calls and I have confirmed that PM attachments can now be downloaded successfully on SMF 2.1.4.

Note: The Subs-PMAttachments.php file I updated is from the 'moyack' distribution.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

3dickulus

#402
 8) just looking at create_function now, thanks for the quick response... and fix

edit: works like a charm :D

Dave J

Thank you GL for the file.

I still had an issue after sending a PM with an attachment.

The error was as per the attached.

To resolve it I went into the 'install_21x.xml' and found

$email_template .= "\n" . $txt['instant_reply'] . ' ' . $scripturl . '?action=pm;sa=send;f=inbox;pmsg=' . $id_pm . ';quote;u=' . $from['id'];
and removed $txt['instant_reply'] .
So the resulting finished line was

$email_template .= "\n" . ' ' . $scripturl . '?action=pm;sa=send;f=inbox;pmsg=' . $id_pm . ';quote;u=' . $from['id'];
I then sent another PM with an attachment and the issue is resolved.

I cannot see anything else that is affected by the changes to the code.

GL700Wing

Quote from: Dave J on July 14, 2024, 04:11:22 AMThank you GL for the file.
You're welcome.

Quote... and removed
$txt['instant_reply']
FYI: In SMF 2.0 the following string, which is missing in SMF 2.1, was in the file ./Themes/default/languages/PersonalMessage.english.php
$txt['instant_reply'] = 'Reply to this Personal Message here:';
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Dave J

Quote from: GL700Wing on July 14, 2024, 04:21:16 AM
Quote from: Dave J on July 14, 2024, 04:11:22 AMThank you GL for the file.
You're welcome.

Quote... and removed
$txt['instant_reply']
FYI: In SMF 2.0 the following string, which is missing in SMF 2.1, was in the file ./Themes/default/languages/PersonalMessage.english.php
$txt['instant_reply'] = 'Reply to this Personal Message here:';

That explains why that was happening then as my site was an upgrade to 2.1 from 2.0.

Thanks again for the info GL

Dave J

Hi GL,

I have found another issue with this mod now. When installed it works perfectly, but

If you create a PM and then save as a draft or it auto saves as a draft when you go to edit the draft you get an error as attached 'drafts1'.
As you can see the mod is installed 'drafts3'

If I uninstall the mod I can edit the draft with no errors.

Any idea what might be causing that.

This actually happens on a nearly fresh install of 2.1.4, I gradually added packages until I found the culprit ;)

GL700Wing

Quote from: Dave J on September 22, 2024, 05:38:18 AMAny idea what might be causing that.
Hmm - took a while to find this bug ...

In ./Sources/PersonalMessage.php either delete or comment out the following line in the messagePostError function:
    checkSession('request');

Note: Doing either of the above actions will result in an error message being generated if the mod is subsequently uninstalled so maybe comment the line out and add a comment above that line which includes a link to this message as a reminder for why the line was commented out.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Dave J

Once again GL you've come to the rescue, thank you very much that worked great

DarkAngel612

I just now tried to install this one into my 2.1.4 forum

Is it working with my version because I get this error message


Installations actions for "PM Attachments"

The package you are trying to download or install is either corrupt or not compatible with this version of SMF.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.1.4 with various mods and TinyPortal

Arantor

It hasn't been updated in some time ahd probably won't work with 2.1.4.
Holder of controversial views, all of which my own.


DarkAngel612

ok too bad cause in 2.0.19 I found it very useful.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.1.4 with various mods and TinyPortal

Dave J

It does work on 2.1.4 as I have it installed on my sites.

Have a look at the bottom of the Package Manager page and select 'Emulation Support' and make sure it's on 2.1.4

DarkAngel612

I tried it both ways, I tried it as is first on 2.1.4 and it said it was either corrupt or not for this version  then I when I returned to the package manager - in the list it had the button telling me to emulate using the older forum version so I hit it and still no joy.

I will try it again actually using the emulate area and be back with results.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.1.4 with various mods and TinyPortal

DarkAngel612

got this:


Code (Find) Select
[code]if ($message['can_report'] || $context['can_send_pm'])
echo '
<div class="under_message">';

Code (Add Before) Select Expand
// Assuming there are attachments...
if (allowedTo('pm_view_attachments') && !empty($message['attachment']))
{
echo '
<div id="post_', $message['id'], '_footer" class="attachments">';

echo '
<hr width="98%" size="1" class="hrcolor" />
<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', '; width: 98%;">';

foreach ($message['attachment'] as $attachment)
{
if ($attachment['is_image'])
{
if ($attachment['thumbnail']['has_thumb'])
echo '
<a
 href="', $attachment['href'], ';image" id="link_', $attachment['id'] .
(function_exists('highslide_images') ? '" class="highslide"
rel="highslide"' : '" onclick="' .
$attachment['thumbnail']['javascript']) . '"><img src="',
$attachment['thumbnail']['href'], '" alt="' , $attachment['name'] , '"
id="thumb_', $attachment['id'], '" border="0" /></a><br
/>' . ($attachment['is_image'] &&
function_exists('highslide_images') ? '<div
class="highslide-heading">' . $message['subject'] . '</div>' :
'');
else
echo '
<img
 src="' . $attachment['href'] . ';image" alt="" width="' .
$attachment['width'] . '" height="' . $attachment['height'] . '"
border="0" /><br />';
}
echo '
<a
 href="' . $attachment['href'] . '"><img src="' .
$settings['images_url'] . '/icons/clip.gif" align="middle" alt="*"
border="0" />&nbsp;' . $attachment['name'] . '</a>
<div
 style="padding-left:1.0em; margin-top:-0.5em;">(',
$attachment['size'] . ($attachment['is_image'] ? ', ' .
$attachment['real_width'] . 'x' . $attachment['real_height'] : '') .
')</div>';
}
echo '
</div></div>';
}




I don't seem to have that file in the server nor in the actual 2.1.4 zip.[/code]
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.1.4 with various mods and TinyPortal

Dave J

Just realised you need to install 'Post and PM Attachments' first, that's why it can't find the file

DarkAngel612

I tried that too but then I read, cause it did not install either, that first came the pm mod then the post/pm inline mod.


which I did not mind cause I would rather have the attachments under the post...LOL

neither one will install.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.1.4 with various mods and TinyPortal

Advertisement: