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-08-2004 07:35 PM

Try sending yourself an attachment and see what that does.

Convergys 01-08-2004 07:37 PM

Quote:

Originally Posted by Boofo
Try sending yourself an attachment and see what that does.

It shows the private message as if the hack was not installed.. IE... there is nothing indicating an attachment was sent...

I can send you my private.php if you want.

Kentaurus 01-08-2004 07:53 PM

Quote:

Originally Posted by Convergys
It shows the private message as if the hack was not installed.. IE... there is nothing indicating an attachment was sent...

I can send you my private.php if you want.

Erase this lines:

if ($pm['attach'])
{

and the "}" at the end, ej.

Code:

$pm['attachments'] = array();
                  $attachments = $DB_site->query("
                                  SELECT filename, filesize, visible, attachmentid, counter, postid, IF(thumbnail = '', 0, 1) AS hasthumbnail, LENGTH(thumbnail) AS thumbnailsize
                                  FROM " . TABLE_PREFIX . "attachment
                                  WHERE private='".$pm['pmtextid']."'
                  ");
                  while ($attachment = $DB_site->fetch_array($attachments))
                  {
                                  $attachment['kilobytes'] = vb_number_format($attachment['filesize'] / 1024, 1);
                                  $pm['attachments']["$attachment[attachmentid]"] = $attachment;
                  }

and see if it does the trick. That check is there for some code optimization and normally it isn't a problem.

Kentaurus 01-08-2004 08:20 PM

Quote:

Originally Posted by Convergys
I am having problems with this...
When I view trhe attachments i have posted in the user cp, it shows, In Progress... Have i dont something wrong?

That is yet another modification to make. The txt is already updated but if you downloaded it before this post you might not have this changes:

################################################## #################
# Code modifications in file "profile.php"
################################################## #################
-------------------------------------------------------------------
at line 2327, search for this code:
-------------------------------------------------------------------

Code:

// Get attachment info
$attachments = $DB_site->query("
SELECT thread.forumid, post.postid, post.threadid AS p_threadid, post.title AS p_title, post.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
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
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
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
");

-------------------------------------------------------------------
at line 2360, search for this code:
-------------------------------------------------------------------

Code:

$show['inprogress'] = iif(!$post['postid'], true, false);
------------------------------------------------------------------
change it to:
-------------------------------------------------------------------

Code:

$show['inprogress'] = iif(!$post['postid'] && !$post['private'], true, false);
                                $show['privateattachment'] = iif($post['private'], true, false);

################################################## #################
# Template modifications in template "modifyattachmentsbit"
################################################## #################
-------------------------------------------------------------------
search for this:
-------------------------------------------------------------------

Code:

<div><strong>$vbphrase[thread]</strong>: <a href="showthread.php?$session[sessionurl]t=$post[p_threadid]">$post[t_title]</a></div>
<div><strong>$vbphrase[post]</strong>: <a href="showthread.php?$session[sessionurl]p=$post[postid]#post$post[postid]">$post[p_title]</a></div>
</div>

------------------------------------------------------------------
change it to:
-------------------------------------------------------------------

Code:

<if condition="$show[privateattachment]">
<div><strong>$vbphrase[in_private_message]</strong></div>
<else />
<div><strong>$vbphrase[thread]</strong>: <a href="showthread.php?$session[sessionurl]t=$post[p_threadid]">$post[t_title]</a></div>
<div><strong>$vbphrase[post]</strong>: <a href="showthread.php?$session[sessionurl]p=$post[postid]#post$post[postid]">$post[p_title]</a></div>
</div>
</if>

################################################## #################
# New phrases to add
################################################## #################
Add a new phrase and make sure it is in the posting group, otherwise it won't work
phrase: in_private_message
Text: Private Message




With that when you go to the manage attachment section of the usercp instead of saying "In progress" it will show the correct posting date and an indicator that it really was a private message and not a post

Boofo 01-08-2004 08:35 PM

This

Code:

</end if>
should be

Code:

</if>
or I get an error when I try to save the template. ;)

Thank you for the fix, by the way. ;)

Boofo 01-08-2004 08:40 PM

The indicator in the usercp almost works. The box for the regular attachments is blank now. Also, is there any way to take the words Thread and Post out of the pm attachments box in the usercp?

Convergys 01-08-2004 08:42 PM

Quote:

Originally Posted by kentaurus
Erase this lines:

if ($pm['attach'])
{

and the "}" at the end, ej.

Code:

$pm['attachments'] = array();
                  $attachments = $DB_site->query("
                                  SELECT filename, filesize, visible, attachmentid, counter, postid, IF(thumbnail = '', 0, 1) AS hasthumbnail, LENGTH(thumbnail) AS thumbnailsize
                                  FROM " . TABLE_PREFIX . "attachment
                                  WHERE private='".$pm['pmtextid']."'
                  ");
                  while ($attachment = $DB_site->fetch_array($attachments))
                  {
                                  $attachment['kilobytes'] = vb_number_format($attachment['filesize'] / 1024, 1);
                                  $pm['attachments']["$attachment[attachmentid]"] = $attachment;
                  }

and see if it does the trick. That check is there for some code optimization and normally it isn't a problem.

still not working.

Kentaurus 01-08-2004 08:43 PM

Quote:

Originally Posted by Boofo
The indicator in the usercp almost works. The box for the regular attachments is blank now. Also, is there any way to take the words Thread and Post out of the pm attachments box in the usercp?

Yes, there is one more glitch I forgot to edit, in the template edit <else> should be <else />, otherwise Thread and Post are still shown. I don't know how that code managed to go through the instructions. (well, I do know...)

Boofo 01-08-2004 08:58 PM

I should have caught that, I'm sorry. ;)

Much better now. Is there a way to maybe grab the pmid and put it in the area right under Private Message (in case we need to track anything soemtime)?

Kentaurus 01-08-2004 09:11 PM

Quote:

Originally Posted by Boofo
I should have caught that, I'm sorry. ;)

Much better now. Is there a way to maybe grab the pmid and put it in the area right under Private Message (in case we need to track anything soemtime)?

Yes, you have to do a left join of the pm table to get the pmid, I didn't code it because I don't like mysql doing extra work and that query had a lot of joins already, but it should be easy to do, a left join of the pm table using the pmtextid as the foreign key and checking that the message belongs to the user. That may be useful, I'll see what else is missing and add that to the hack.


All times are GMT. The time now is 04:10 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.01232 seconds
  • Memory Usage 1,769KB
  • 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
  • (10)bbcode_code_printable
  • (6)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