News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

PM Attachments

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

Previous topic - Next topic

Kinsman

The forum changed one line, but skipped 2, without complaining about it, I only picked it up during uninstallation, so then edited the entire file manually.

GL700Wing

I'm getting the following errors in the log file (I've removed my forum name details from the links below):

./forum/index.php?action=dlpmattach;pm=43468;attach=523
8192: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
File: ./forum/Sources/Subs-PMAttachments.php
Line: 679


I think the code to replace 'preg_replace' stataments with 'preg_replace_callback' in ./Sources/Subs-PMAttachments.php should be as follows:

Find

      // Different browsers like different standards...
      if ($context['browser']['is_firefox'])
         header('Content-Disposition: attachment; filename*="UTF-8\'\'' . preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name) . '"');

      elseif ($context['browser']['is_opera'])
         header('Content-Disposition: attachment; filename="' . preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name) . '"');

      elseif ($context['browser']['is_ie'])
         header('Content-Disposition: attachment; filename="' . urlencode(preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name)) . '"');

      else
         header('Content-Disposition: attachment; filename="' . $utf8name . '"');


Replace with:

      // Different browsers like different standards...
      if ($context['browser']['is_firefox'])
         header('Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)));

      elseif ($context['browser']['is_opera'])
         header('Content-Disposition: attachment; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"');

      elseif ($context['browser']['is_ie'])
         header('Content-Disposition: attachment; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"');

      else
         header('Content-Disposition: attachment; filename="' . $utf8name . '"');
Life doesn't have to be perfect to be wonderful ...

dougiefresh

#282
Uploaded v2.1 - March 7th, 2017
o Replaced code that used preg_match with preg_match_callback.  Thanks, GL700Wing!




@GL700Wing:  Thanks for the bug report!  It's been incorporated into the mod!

@Everybody:  Since nobody has reported any new issues (aside from GL700Wing) with the mod lately, I've decided to bump it to version 2.1.....

SoLoGHoST

Looking good dougiefresh.  Glad to see some work on this mod, and you reduced the filesize dramatically as well.  The templating and modifications in the various xml files got a bit messy due to the many upgrades along the way, as I was aiming more towards compatibility and support with other mods, and not caring too much about the amount of files or code involved in making that happen.  And besides, I was still learning about all of the various hooks in SMF as well.

Haven't tested this mod yet, but look forward to giving it a test drive soon, just to see how things look and function and/or if you've added anything new besides restructuring the code base.

Cheers :)

EdjKa

Quote from: Kinsman on February 24, 2017, 01:50:39 AM
The forum changed one line, but skipped 2, without complaining about it, I only picked it up during uninstallation, so then edited the entire file manually.

Same here, is there a way to fix the installation process?

dougiefresh

Please attach your Themes/default/PersonalMessage.template.php after you've installed the mod, so I can see what is being missed by Package Manager.  Can't really investigate without knowing what operations are failing....

EdjKa


dougiefresh

@EdjKa:  I can't reproduce the missing operations that you reported.  The file you supplied uninstalls without errors on my localhost server using the version 2.1 mod.....

EdjKa

That's really strange, i've RE-installed mod again, all LOOKS good, but nothings attaches to PM's.

dougiefresh

Assuming you haven't uninstalled the mod since your post, attach your CURRENT PersonalMessage.template.php.  I need to know what mods you are running as well....

EdjKa

Nothing actually changed there, here you are :)

BTW Getting this error with installed mod: /home/hsghpmfx/public_html/smf/Themes/default/GenericControls.template.php (send sub template - eval?)

dougiefresh

Uploaded v2.2 - March 15th, 2017
o Fixed PersonalMessage.template.php so that Send screen attaches files properly (again).




@EdjKa:  Thank you for providing enough to work with.  The issue you are seeing is the result of the addition not being put in the right spot.  There are two possibilities that it could go into, and the first just doesn't work for this operation.  I've fixed it to make sure it is placed on the second operation in your file.

As for the second part of your bug report (aka: GenericControls.template.php), you haven't provided enough information for me to diagnose this bug report.  I've seen many reports where the file specified that the error originates from is wrong, usually due to another mod making a change in the menus....

EdjKa

Replaced PersonalMessage with the original one, RE-installed the mod with 2.2 version and it works now! Thank you very much!

DarkAngel612

smf 2.0.13
various mods installed


see this thread for the problem please, I forgot to come to this thread since it is the specific mod.

the gist: allowed pm attachments no longer show in the pm area, regardless of theme

https://www.simplemachines.org/community/index.php?topic=553678.0
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

SoLoGHoST

@DarkAngel612 - Yes, the allowed attachment types should be showing up as I saw in the pic via that topic you posted, it was not there.  This was there before dougiefresh took over this mod and released a few more versions of it.  It's possible this was overlooked during the crunching of the mod filesize...  Seems like a valid design flaw to me... just my 2 cents.  Have you tried reinstalling the mod, after fully uninstalling it?  Or installing this mod on a fresh install of SMF with no other modifications installed?  If so, and same thing happens, than definitely a design flaw.

DarkAngel612

Quote from: SoLoGHoST on June 02, 2017, 10:18:32 PM
@DarkAngel612 - Yes, the allowed attachment types should be showing up as I saw in the pic via that topic you posted, it was not there.  This was there before dougiefresh took over this mod and released a few more versions of it.  It's possible this was overlooked during the crunching of the mod filesize...  Seems like a valid design flaw to me... just my 2 cents.  Have you tried reinstalling the mod, after fully uninstalling it?  Or installing this mod on a fresh install of SMF with no other modifications installed?  If so, and same thing happens, than definitely a design flaw.

Yes I sure did, several times since I know 3/4 of my errors are operator trouble...can't type from time to time and then sometimes server eats files but claims they are there...LOL

No difference at all, it is still not showing up. I think I have an older version that I can look at the code to see if I can tell what is missing, then add it in there.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

GL700Wing

Quote from: DarkAngel612 on June 02, 2017, 11:46:33 PMNo difference at all, it is still not showing up. I think I have an older version that I can look at the code to see if I can tell what is missing, then add it in there.
Have you confirmed that "Check attachment's extension" is checked in Administration Center -> Attachments and Avatars -> PM Attachment Settings?  If it isn't checked 'Allowed file types' isn't displayed.
Life doesn't have to be perfect to be wonderful ...

DarkAngel612

Quote from: GL700Wing on June 03, 2017, 12:46:23 AM
Quote from: DarkAngel612 on June 02, 2017, 11:46:33 PMNo difference at all, it is still not showing up. I think I have an older version that I can look at the code to see if I can tell what is missing, then add it in there.
Have you confirmed that "Check attachment's extension" is checked in Administration Center -> Attachments and Avatars -> PM Attachment Settings?  If it isn't checked 'Allowed file types' isn't displayed.

Bless your sweet little heart sugar...you hit it on the head, not as hard as I was clobbering my own noggin though...LOL

When it got deselected I'll never know but now they show up again.

Thanks and have a great weekend.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

GL700Wing

Quote from: DarkAngel612 on June 03, 2017, 05:18:10 AM
Bless your sweet little heart sugar...you hit it on the head, not as hard as I was clobbering my own noggin though...LOL

When it got deselected I'll never know but now they show up again.

Thanks and have a great weekend.

;)

Life doesn't have to be perfect to be wonderful ...

dougiefresh

@DarkAngel612:  Glad you got your issue straightened out!

Advertisement: