Advertisement:

Author Topic: PM Attachments  (Read 110500 times)

Offline landyvlad

  • Full Member
  • ***
  • Posts: 474
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Re: PM Attachments
« Reply #340 on: January 17, 2018, 04:57:31 AM »
Hi, trying to uninstall existing version 2.0 Beta 2, in order to instal v 2.6

Getting this error:
Quote
   Replace   ./Sources/ManagePermissions.php   Test failed

Suggestions / help appreciated. :)
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,691
  • Mod King
    • XPtsp.com Community
Re: PM Attachments
« Reply #341 on: January 19, 2018, 08:37:13 PM »
Uploaded v2.9 - January 19th, 2018
o Fixed "Wrong value type send to database" issue, discussed here.
o Fixed missing "Clear Attachment" link for new PM attachments.
o Omitted "More Attachments" link when user has hit the PM attachment limit.



@Geor'G:  Thank you for coming up with the quick fix!  It's been incorporated into the mod.  Thanks!

@aegersz:  This update incorporates the Geor'G's quick fix.  Thank you for reporting it, and apologizes for not seeing what was causing that error!

@Everybody:  Please be advised that the Post and PM Inline Attachments mod (up to version 6.3) will conflict with this mod.  I am working on a solution to get the two mods working together again....  You will have to upgrade both mods in order to have the full functionality.....
News: Missing GitHub repository...

My Free Simple Machines mods on XPtsp.com, Simple Machines Customization Site, and at GitHub!
Problem uninstalling mods?  Try Arantor's Sortable Packages (and Installed Time) mod!  It's super helpful!

Offline landyvlad

  • Full Member
  • ***
  • Posts: 474
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Re: PM Attachments
« Reply #342 on: January 22, 2018, 06:59:29 PM »
OK so I got this in the uninstall test:

Quote
5.   Execute Modification   ./Sources/ManagePermissions.php   Test failed
   1.   Replace   ./Sources/ManagePermissions.php   Test successful
   2.   Replace   ./Sources/ManagePermissions.php   Test successful
   3.   Replace   ./Sources/ManagePermissions.php   Test failed

My reading of this is that there are three changes made to this file when the mod is installed?

And yet, the file edit instructions for that file show only the following:
Quote
./Sources/ManagePermissions.php

Find: [Select]
'modify_any',
      'approve_posts',
   ));
Add After: [Select]

   PMA_Load_Levels($groupLevels, $boardLevels);

Find: [Select]
'send_mail',
      'approve_posts',
   );
Add After: [Select]

   PMA_Non_Guest();


only two changes noted here.

I have uninstalled the mod but am a bit confused as to what or where the remaining error is. And I figure I better find out before I install the new version...

I'd appreciate any tips.
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Offline landyvlad

  • Full Member
  • ***
  • Posts: 474
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Re: PM Attachments
« Reply #343 on: January 23, 2018, 06:47:50 PM »
Hmm I'm still hopeful someone will pop in and offer some help re the above.

The reason that I am holding off on installing the new version, is that if I do, the test shows several failures:

Quote
* 4 Execute Modification ./Sources/ManageAttachments.php Test failed

  1. Add Before ./Sources/ManageAttachments.php Test failed
  2. Replace ./Sources/ManageAttachments.php Test successful
  3. Replace ./Sources/ManageAttachments.php Test successful
 
* 5. Execute Modification ./Sources/ManagePermissions.php Test failed

  1. Add After ./Sources/ManagePermissions.php Test successful
  2. Add After ./Sources/ManagePermissions.php Test failed
 

I'm assuming this may be something to do with the uninstall error in the previous post.

Tips on how to resolve these issues would be very welcome.

I'm trying to get this sorted before I upgrade from 2.0.13 through .14 to .15
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Offline aegersz

  • Sophist Member
  • *****
  • Posts: 1,342
  • Gender: Male
  • "mods" junkie
    • dopetalk
Re: PM Attachments
« Reply #344 on: January 25, 2018, 01:20:12 AM »
what version of PM Attach mod are you running ?

it helps to list your installed mods (Package Manager) as it displays the sequence of your installs.

most "Test failed" issues come from conflicts with other mods but it could be from an uninstall if done manually (without Package Manager).

if you can access those source files then try to find bits of the lines of code that failed locating, with an editor, because sometimes it is quite obvious what the issue is if you are lucky.

otherwise you may have to attach ManageAttachments.php and ManagePermissions.php to your reply along with screenshots of each of the failed tests.

at least then you have done what you can ... i may not be able to investigate soon but someone else may.
Linux CentOS VPS running SMF 2.0 with 140+ mods installed (the full h/w and s/w can be seen at http://forum.drugs-and-users.org/index.php/topic,3301)

Offline DarkAngel612

  • Sophist Member
  • *****
  • Posts: 1,023
  • Gender: Female
Re: PM Attachments
« Reply #345 on: January 25, 2018, 05:19:04 PM »
Forum installed on: http://art-by-amaranth.net/forum/index.php?action=forum (registered members only)
SMF: 2.0.15


I have used this mod for ages and just love it...however this time I had a wee bit of trouble with the 2.8 update.

First I uninstalled the previous version, then I installed this one and although it installed proper it would not let anyone send pm's at all.

The forum had just been updated to 2.0.15 so I thought maybe to uninstall all the mods in case of problems. Tested without mods and pm's worked proper. Install only the pm attachments and again no allowing of it.

So to play it safe I redid the entire forum update with freshly uploaded files, deleting the files on the server, installed only the pm mod and again no allowing....hence installing version 2.3 again.

This is the error it put to me: Wrong value type sent to the database. Array of integers expected. (recipients)
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

Offline landyvlad

  • Full Member
  • ***
  • Posts: 474
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Re: PM Attachments
« Reply #346 on: January 28, 2018, 09:13:42 PM »
what version of PM Attach mod are you running ?

it helps to list your installed mods (Package Manager) as it displays the sequence of your installs.

most "Test failed" issues come from conflicts with other mods but it could be from an uninstall if done manually (without Package Manager).

if you can access those source files then try to find bits of the lines of code that failed locating, with an editor, because sometimes it is quite obvious what the issue is if you are lucky.

otherwise you may have to attach ManageAttachments.php and ManagePermissions.php to your reply along with screenshots of each of the failed tests.

at least then you have done what you can ... i may not be able to investigate soon but someone else may.

Currently running version? none.
As noted I uninstalled it and deleted it.(in hindsight prob shouldn't have but it's done now anyway)
I can't be sure what version it was running previously.


These are my mods - I updated them all just prior to upgrading from SMF2.0.3 - 2.0.15
Quote
1. @mention members 1.1.2   Friday, 17 February 2017, 10:20 pm [ Uninstall ] [ List Files ] [ Delete ] 
2. Automatic Attachment Rotation 3.8   Tuesday, 23 January 2018, 08:59 am [ Uninstall ] [ List Files ] [ Delete ] 
3. Copyright and Footer Links 3.2   Thursday, 01 June 2017, 10:50 pm [ Uninstall ] [ List Files ] [ Delete ] 
4. Country Flags 3.0   Saturday, 08 April 2017, 03:07 pm [ Uninstall ] [ List Files ] [ Delete ] 
5. Downloads System 3.0.2   Saturday, 20 January 2018, 05:07 pm [ Uninstall ] [ List Files ] [ Delete ] 
6. Downloads System 3.0  Saturday, 20 January 2018, 05:07 pm [ Upgrade ] [ List Files ] [ Delete ] 
7. Google Member Map 3.0.4   Saturday, 20 January 2018, 04:57 pm [ Uninstall ] [ List Files ] [ Delete ] 
8. httpBL 2.5.1   Wednesday, 22 March 2017, 08:26 am [ Uninstall ] [ List Files ] [ Delete ] 
9. Image Processing Memory Limit 0.1.2   Friday, 10 February 2017, 08:51 am [ Uninstall ] [ List Files ] [ Delete ] 
10. Like Posts 2.0.5   Thursday, 26 January 2017, 10:51 pm [ Uninstall ] [ List Files ] [ Delete ] 
11. PM Attachments 2.9  N/A [ Install Mod ] [ List Files ] [ Delete ] 
12. Responsive Curve 1.0.0   Wednesday, 22 March 2017, 08:28 am [ Uninstall ] [ List Files ] [ Delete ] 
13. Show JDALLAUI in Post and PM 1.4   Tuesday, 23 January 2018, 09:12 am [ Uninstall ] [ List Files ] [ Delete ] 
14. SMF 2.0.14 Update 1.0   Wednesday, 24 January 2018, 08:46 pm [ List Files ] [ Delete ] 
15. SMF 2.0.15 Update 1.0   Wednesday, 24 January 2018, 09:38 pm [ Uninstall ] [ List Files ] [ Delete ] 
16. SMF Gallery Pro 7.2.4   Saturday, 20 January 2018, 05:26 pm [ Uninstall ] [ List Files ] [ Delete ] 
17. SMF Gallery Pro 7.2.2  Saturday, 20 January 2018, 05:26 pm [ Upgrade ] [ List Files ] [ Delete ] 
18. SMF Gallery Pro SSI 3.0   Wednesday, 29 March 2017, 07:42 am [ Uninstall ] [ List Files ] [ Delete ] 
19. SMF Links 3.0.6   Saturday, 20 January 2018, 05:02 pm [ Uninstall ] [ List Files ] [ Delete ] 
20. SMF Links 3.0.5  Saturday, 20 January 2018, 05:02 pm [ Upgrade ] [ List Files ] [ Delete ] 
21. SMF Post Prefix 2.0.3   Wednesday, 01 February 2017, 09:28 pm [ Uninstall ] [ List Files ] [ Delete ] 
22. Social Login 3.6   Wednesday, 17 January 2018, 08:39 pm [ Uninstall ] [ List Files ] [ Delete ] 
23. Sortable Packages (and Installed Time) 1.3.5   Thursday, 26 January 2017, 09:47 pm [ Uninstall ] [ List Files ] [ Delete ] 
24. Stop Spammer 2.3.9   Wednesday, 24 January 2018, 09:40 pm [ Uninstall ] [ List Files ] [ Delete ] 
25. Tapatalk SMF 2.0 Plugin 4.4.1   Wednesday, 24 January 2018, 11:25 pm [ Uninstall ] [ List Files ] [ Delete ] 
26. TinyPortal 1.3R   Wednesday, 17 January 2018, 07:48 pm [ Uninstall ] [ List Files ] [ Delete ] 
27. Topics Created And Participated In 2.7  Sunday, 21 January 2018, 01:06 pm [ List Files ] [ Delete ] 
28. Topics Created And Participated In 2.8   Sunday, 21 January 2018, 01:06 pm [ Uninstall ] [ List Files ] [ Delete ] 
29. Yet Another YouTube BBCode Tag 4.7   Sunday, 21 January 2018, 09:26 pm [ Uninstall ] [ List Files ] [ Delete ] 

I can't access the files from where I am but will do so when next I can.  :)
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Offline schoolclubsforum

  • Semi-Newbie
  • *
  • Posts: 13
Re: PM Attachments
« Reply #347 on: January 29, 2018, 03:58:31 PM »
Quote
Uploaded v2.9 - January 19th, 2018
o Fixed "Wrong value type send to database" issue, discussed here.

Installed v2.9 and got "Wrong value type send to database" error message.

Uninstalled the mod and error disappears.
So unfortunately the fix did not work for me.

Have not used this mod before so have not got an earlier version to try.

Am running SMF 2.014


Offline DarkAngel612

  • Sophist Member
  • *****
  • Posts: 1,023
  • Gender: Female
Re: PM Attachments
« Reply #348 on: January 29, 2018, 07:48:02 PM »
Quote
Uploaded v2.9 - January 19th, 2018
o Fixed "Wrong value type send to database" issue, discussed here.

Installed v2.9 and got "Wrong value type send to database" error message.

Uninstalled the mod and error disappears.
So unfortunately the fix did not work for me.

Have not used this mod before so have not got an earlier version to try.

Am running SMF 2.014

Same here about the error, uninstalled it and tested all is perfect. Then uninstalled all mods, reuploaded main smf files, installed only this mod and again no joy so redid it again without this version but did install the earlier version.

I also forgot to mention I also tried using the advanced link to install like a more older version of SMF and still no joy.

IF Dougie doesn't have the older version I do and can with his permission add it to this thread.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

Offline schoolclubsforum

  • Semi-Newbie
  • *
  • Posts: 13
Re: PM Attachments
« Reply #349 on: February 01, 2018, 05:08:01 AM »
Thanks DarkAngel612
I have now used a copy of version 2.6 from Dougie's GitHub repository (link in his signature) and this worked without the error message.
So something that changes between v2.6 and 2.9 causes the error for me.

Will stick with v2.6 and see how that goes. Seems like an excellent mod. Thanks Dougie.

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 411
  • Gender: Female
Re: PM Attachments
« Reply #350 on: February 17, 2018, 07:09:58 AM »
I installed V2.9 today and spent some time resolving the Wrong value type sent to the database. Array of integers expected. (recipients) issue.  In ./Sources/Subs-PMAttachments.php I changed the 'canViewPMAttachment' function as follows:
Code: [Select]
function canViewPMAttachments($recipients)
{
global $smcFunc, $modSettings, $txt, $context;

// No members or attachments?  Then just return to the caller:
if (empty($recipients))
return;

// Load the groups that are allowed to view PM attachments.
$allowed_groups = $disallowed_groups = array();
$request = $smcFunc['db_query']('', '
SELECT id_group, add_deny
FROM {db_prefix}permissions
WHERE permission = {string:read_permission}',
array(
'read_permission' => 'pm_view_attachments',
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if (empty($row['add_deny']))
$disallowed_groups[] = $row['id_group'];
else
$allowed_groups[] = $row['id_group'];
}
$smcFunc['db_free_result']($request);

if (empty($modSettings['permission_enable_deny']))
$disallowed_groups = array();

// Make sure there are no duplicate recipients.
$recipients['to'] = array_unique($recipients['to']);
$recipients['bcc'] = array_diff(array_unique($recipients['bcc']), $recipients['to']);
$all_to = array_merge($recipients['to'], $recipients['bcc']);

// Is a member part of a membergroup that can/cannot view PM attachments?
$request = $smcFunc['db_query']('', '
SELECT
real_name, id_member, additional_groups, id_group, id_post_group
FROM {db_prefix}members
WHERE id_member IN ({array_int:recipients})
LIMIT {int:count_recipients}',
array(
'recipients' => $all_to,
'count_recipients' => count($all_to),
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$groups = explode(',', $row['additional_groups']);
$groups[] = $row['id_group'];
$groups[] = $row['id_post_group'];
if (!in_array(1, $groups) && (count(array_intersect($allowed_groups, $groups)) == 0 || count(array_intersect($disallowed_groups, $groups)) != 0))
$context['send_log']['failed'][$row['id_member']] = sprintf($txt['pm_error_user_cannot_view_atts'], $row['real_name']);
}
$smcFunc['db_free_result']($request);

// Return true if all members are allowed to view PM attachments.
return empty($context['send_log']['failed']);
}

This change also requires the text string '$txt['pm_error_user_cannot_view_atts']' to be added to ./Themes/default/languages/PersonalMessage.english.php (the error message that was being used reported that the recipient could not receive any PMs when the issue was that they could not view PM attachments.) - add the following code to install20x.xml
Code: [Select]
<file name="$languagedir/PersonalMessage.english.php">
<operation>
<search position="end" />
<add><![CDATA[
$txt['pm_error_user_cannot_view_atts'] = 'User \'%1$s\' is not allowed to view personal message attachments.';
]]></add>
</operation>
</file>



After fixing this issue I then discovered I could not send a PM without an attachment to a member who could not view attachments - I kept getting the error message above.  Very strange indeed ...  The fix for this is the following change in ./Sources/PersonalMessage.php:
Find:
Code: [Select]
// Check if they are trying to attach a new file...
if (isset($_FILES['attachment']['name']) || !empty($_SESSION['temp_pm_attachments']))

Replace with:
Code: [Select]
// Check if they are trying to attach a new file...
if (!empty($_FILES['attachment']['name'][0]) || !empty($_SESSION['temp_pm_attachments']))



The horizontal scroll bar issue reported here seems to have been missed.  In ./Themes/default/PersonalMessage.template.php:
Find:
Code: [Select]
echo '
<hr width="98%" size="1" class="hrcolor" />
<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', '; width: 100%;">';

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



Finally - as per this message my PM Attachment configuration settings get overwritten everytime I install this mod.  The fix for requires a change in db_install.php
Find:
Code: [Select]
// Insert the settings
$smcFunc['db_insert']('replace',

Replace with:
Code: [Select]
// Insert the settings
$smcFunc['db_insert']('ignore',

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,691
  • Mod King
    • XPtsp.com Community
Re: PM Attachments
« Reply #351 on: February 17, 2018, 10:38:25 AM »
Uploaded v2.10 - February 17th, 2018
o Implemented GL700Wing's fixes, as discussed here.



@GL700Wing:  Thank you for telling me how you fixed the issues!  Those changes have been integrated into this version!
News: Missing GitHub repository...

My Free Simple Machines mods on XPtsp.com, Simple Machines Customization Site, and at GitHub!
Problem uninstalling mods?  Try Arantor's Sortable Packages (and Installed Time) mod!  It's super helpful!

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 411
  • Gender: Female
Re: PM Attachments
« Reply #352 on: March 27, 2018, 05:40:49 AM »
Discovered that 'PM File Maintenance/Attachment Integrity Check' doesn't work - clicking on 'Run Check Now' generates the error message 'Call to undefined function getPMAttachmentFilename()'

Fix in ./Sources/Subs-PMAttachmentsAdmin.php is as follows:
Find:
Code: [Select]
function RepairPMAttachments()
{
global $modSettings, $context, $txt, $smcFunc;

checkSession('get');

Replace With:
Code: [Select]
function RepairPMAttachments()
{
global $modSettings, $context, $txt, $smcFunc, $sourcedir;

checkSession('get');
require_once($sourcedir . '/Subs-PMAttachments.php');

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 411
  • Gender: Female
Re: PM Attachments
« Reply #353 on: March 28, 2018, 09:49:10 AM »
The following tweak changes how attachment details (eg, name, size, dimensions, etc) are displayed so that they use less horizontal space (similar to Inline Attachments).  This tweak also removes the 'downloaded/viewed' detail (seems a bit redundant for a PM attachment) and adds support for the Highslide viewer if it is installed.

In ./Themes/default/PersonalMessage.template.php
Find:
Code: [Select]
foreach ($message['attachment'] as $attachment)
{
if ($attachment['is_image'])
{
if ($attachment['thumbnail']['has_thumb'])
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
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> ';

echo '
(', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
}

Replace With:
Code: [Select]
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>';
}


The attached images show the layout changes and the Highslide viewer working.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,691
  • Mod King
    • XPtsp.com Community
Re: PM Attachments
« Reply #354 on: March 28, 2018, 08:42:17 PM »
Uploaded v2.11 - March 28th, 2018
o Fixed PM File Maintenance code, per GL700Wing's post.
o Tweaked attachment detail code, per GL700Wing's post.
o Removed downloaded attachment code, , per GL700Wing's post.



@GL700Wing:  Thanks again for your continuous contributions to this mod!  Your changes have been included in the mod!
News: Missing GitHub repository...

My Free Simple Machines mods on XPtsp.com, Simple Machines Customization Site, and at GitHub!
Problem uninstalling mods?  Try Arantor's Sortable Packages (and Installed Time) mod!  It's super helpful!