vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   [VB3 RC3] Attachments in private messages (https://vborg.vbsupport.ru/showthread.php?t=59840)

Boofo 01-13-2004 03:57 AM

Will this hurt anything for anyone who doesn't have Erwin's hack installed? Or is this ONLY to be used if you are using his hack, too?

Kentaurus 01-13-2004 04:01 AM

Quote:

Originally Posted by Boofo
Will this hurt anything for anyone who doesn't have Erwin's hack installed? Or is this ONLY to be used if you are using his hack, too?

Either if you have Erwin's hack installed or not it won't hurt. It's just an additional security check. I would recommend installing it though.

In the txt this code is included for the people that install the hack for their first time to ensure that they don't have any problems if they install the quick reply after.

Boofo 01-13-2004 04:06 AM

Thank you very much, sir, for the fast fix. ;)

I'm looking forward to more of your great hacks in the future. You seem to care about fixing things to work with and around other's hacks, when it is a lot easier to pass the buck, sometimes. ;)

Boofo 01-13-2004 04:52 AM

I hate to be the bearer of bad news, but there is a small problem now. Oh, it works great with Erwin's hack now but all of my attachments are showing as Private Message even when they aren't. ;)

Kentaurus 01-13-2004 01:50 PM

Quote:

Originally Posted by Boofo
I hate to be the bearer of bad news, but there is a small problem now. Oh, it works great with Erwin's hack now but all of my attachments are showing as Private Message even when they aren't. ;)

I'm afraid that is because when you sent a private message all the forum attachments were marked to belong to that new private message.

That is why I told before that it was really bad, because without the fix as soon as you used quick reply all the attachments in the forum would go to the private message.

Right now there is no easy way to fix this, since the damage is already done... I wish I had seen that coming before. However, you can run a query to recover all the attachments in posts, this will return them to think they belong to a post and not to a private message, the only ones that can't be recovered are the ones in the private message, they already belong to the last pm that was sent.

Ok, this is the scenario:
attachment1 - in private message
attachment2 - in private message
attachment3 - in private message
attachment4 - in private message

after running the query
attachment1 - in post xxx
attachment2 - in post yyy
attachment3 - in private message
attachment4 - in post zzz

the attachment 3 remains in a private message, but potentially not the one that it should but the last one sent via pm quick reply. The next time you use attachments in private message there will be no problem, it's just that the quick reply messed up the attachments that weren't expecting a hashless post to come along.

Query:
Code:

update attachment set private=0 where postid<>0

Boofo 01-13-2004 07:47 PM

Thanks for the query. All seems well again. ;)

Is there any way to add a From: and Sent to: the listing of attachments under the Private Message part? It might be nice to know at a quick glance who the attachment was sent to or came from. ;)

Kentaurus 01-17-2004 10:34 PM

I have a small change (template edit). It is completely optional.

This will add a paperclip to the left of the title of the private message if the private message contains an attachment.

In pm_messagelistbit

find this:

Code:

<a href="private.php?$session[sessionurl]do=showpm&amp;pmid=$pm[pmid]"><if condition="$show['unread']"><strong>$pm[title]</strong><else />$pm[title]</if></a>
add before:

Code:

<if condition="$pm['attach']"><img class="inlineimg" src="$stylevar[imgdir_misc]/paperclip.gif" alt="<phrase 1="$pm[attach]">$vbphrase[x_attachments]</phrase>" /></if>

Next I will do is that From and Title for the attachments' screen.

Kentaurus 01-17-2004 11:33 PM

Only for the people that already have it installed.

This will add a link to the private message sent in the attachments screen so you can go and read to message or at least know which private message it was.

Find this query in profile.php

Code:

$attachments = $DB_site->query("
SELECT thread.forumid, post.postid, post.threadid AS p_threadid, post.title AS p_title, if(post.postid,post.dateline,pmtext.dateline) AS p_dateline, attachment.attachmentid,
thread.title AS t_title, attachment.filename, attachment.counter, attachment.filesize AS size, IF(thumbnail = '', 0, 1) AS hasthumbnail,
user.username, thread.open, attachment.userid, attachment.private, FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
                                LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON (pmtext.pmtextid = attachment.private)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (attachment.userid = user.userid)
WHERE attachment.userid = $userid
AND ((forumid IN (0$forumids) AND thread.visible = 1 AND post.visible = 1 AND deletionlog.primaryid IS NULL) " . iif($userid==$bbuserinfo['userid'], "OR attachment.postid = 0") . ")
ORDER BY attachment.attachmentid DESC
LIMIT " . ($limitlower - 1) . ", $perpage
");

change it to:

Code:

$attachments = $DB_site->query("
SELECT thread.forumid, post.postid, post.threadid AS p_threadid, post.title AS p_title, if(post.postid,post.dateline,pmtext.dateline) AS p_dateline, attachment.attachmentid,
thread.title AS t_title, attachment.filename, attachment.counter, attachment.filesize AS size, IF(thumbnail = '', 0, 1) AS hasthumbnail,
user.username, thread.open, attachment.userid, attachment.private, pmtext.title, pm.pmid
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
                                LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON (pmtext.pmtextid = attachment.private)
                                LEFT JOIN " . TABLE_PREFIX . "pm AS pm ON (pmtext.pmtextid=pm.pmtextid AND pm.userid=$userid)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (attachment.userid = user.userid)
WHERE attachment.userid = $userid
AND ((forumid IN (0$forumids) AND thread.visible = 1 AND post.visible = 1 AND deletionlog.primaryid IS NULL) " . iif($userid==$bbuserinfo['userid'], "OR attachment.postid = 0") . ")
ORDER BY attachment.attachmentid DESC
LIMIT " . ($limitlower - 1) . ", $perpage
");

and in the modifyattachmentsbit template

change
Code:

<div><strong>$vbphrase[in_private_message]</strong></div>
to this
Code:

<div><strong>$vbphrase[in_private_message]:</strong> <a href="private.php?do=showpm&pmid=$post[pmid]">$post[title]</a></div>
I'll leave the from and sent-to, that's because a private message can be sent to multiple members. And deciding who the attachment belongs to can be real tricky.. right now it only appears to the person that sent the private message.

Boofo 01-18-2004 03:29 AM

Ok, that works but it now shows each pm attachment twice in the attachments list. ;)

Have the instructions from the first post been updated with this and the paperclip code?

SloppyGoat 01-18-2004 09:29 PM

Quote:

Originally Posted by kentaurus
Wouldn't that be a little hard on your users? I usually download an attachment more than once, and after I download it I expect it to remain there. That would seem a little un(user-friendly) to me.

This hack uses the same quotas and options that you have already defined for your attachments so if you have a quota for each user no matter if they attach files to posts or private message once they reach their limit they would have to delete some to continue attaching files.

How would that be hard on users? I could see your point if more than one person was dnlding the attachment, but there will always only be one person viewing the PM, right? Once they have the file, I see no reason to let them store the attachments indefinitely. The only way this could be bad, is if a dnld failed, I guess. But I've yet to see that happen.


All times are GMT. The time now is 11:42 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01339 seconds
  • Memory Usage 1,756KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete