Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[VB3 RC3] Attachments in private messages Details »»
[VB3 RC3] Attachments in private messages
Version: 1.00, by Kentaurus Kentaurus is offline
Developer Last Online: Jul 2014 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 01-06-2004 Last Update: Never Installs: 134
 
No support by the author.

Unsupported. VB3.5 version is here:
https://vborg.vbsupport.ru/showthread.php?t=91220

Tested on 3.0.3


This hack enables you to send attachments in a private message. This feature was really useful to me in vb2 and I kind of missed it on vb3 so I rehacked it myself.

When a user writes a private message they will be given the option to add an attachment, the same as when writing a post. It uses the same rules you have defined for a convencional attachment including file types, quotas, etc. It is only an extension for attachments to be used in private messages.

As always it is advised to backup your files before hacking in case you want to go back, this is some big hack including modification of multiple files, some templates and adding two extra columns in the database tables.

Instructions are provided in the txt, and some screenshots on where the attachment option appears.

Info for hackers:
You may modify, improve, upgrade, redistribute this hack, include it
in another hack or yours or translate it provided you do it free of
charge and you distribute it in www.vbulletin.org at least, there is no
need to pm me asking for permission
Some portions of the code are (c) Jelsoft Enterprises Ltd.

Edit by MarcoH64:
Because of multiple requests to make this hack work on vB3.0.7 i created upgrade instructions. These upgrade instructions can be followed after the original instructions (the 3.0.3 version). The original coder can not be held responsible for my modification.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #212  
Old 09-14-2004, 02:34 AM
RobinHood RobinHood is offline
 
Join Date: Sep 2002
Location: Philly
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Weasel
I'm having problems with your code RobinHood, it seems to break the permissions of normal attachments, i.e. no one can view them now.
Okay, try this:

Change:

PHP Code:
if (!($forumperms CANGETATTACHMENT)) 

    
$vboptions['viewattachedimages'] = 0
    
$vboptions['attachthumbs'] = 0

To:

PHP Code:
if (!($forumperms CANVIEW) OR !($forumperms CANGETATTACHMENT)) 

    
$vboptions['viewattachedimages'] = 0
    
$vboptions['attachthumbs'] = 0

That should do the trick. Let me know how it goes.
Reply With Quote
  #213  
Old 09-14-2004, 05:08 AM
BamaStangGuy's Avatar
BamaStangGuy BamaStangGuy is offline
 
Join Date: Mar 2004
Location: Alabama
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RobinHood
Okay, try this:

Change:

PHP Code:
if (!($forumperms CANGETATTACHMENT)) 

    
$vboptions['viewattachedimages'] = 0
    
$vboptions['attachthumbs'] = 0

To:

PHP Code:
if (!($forumperms CANVIEW) OR !($forumperms CANGETATTACHMENT)) 

    
$vboptions['viewattachedimages'] = 0
    
$vboptions['attachthumbs'] = 0

That should do the trick. Let me know how it goes.
all my thumbnails are red x's and I get a no permisson

I have done what you said to do above and it still doesnt work
Reply With Quote
  #214  
Old 09-14-2004, 05:12 AM
BamaStangGuy's Avatar
BamaStangGuy BamaStangGuy is offline
 
Join Date: Mar 2004
Location: Alabama
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Something I just realized

It breaks all the thumbnails and images that were uploaded before the pm hack was installed. But if I upload a new image on the forum it works fine.

Basically all my old attachments show up as red x's and give a no permission when clicked.

But if I add a new attachment to a thread then it works fine
Reply With Quote
  #215  
Old 09-14-2004, 05:57 AM
BamaStangGuy's Avatar
BamaStangGuy BamaStangGuy is offline
 
Join Date: Mar 2004
Location: Alabama
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Code:
if (!($forumperms & CANGETATTACHMENT)) 
{ 
    $vboptions['viewattachedimages'] = 0; 
    $vboptions['attachthumbs'] = 0; 
} 

// check if there is a forum password and if so, ensure the user has it set 
    verify_forum_password($attachmentinfo['forumid'], $attachmentinfo['password']); 

$pmUsers = $DB_site->query_first("SELECT toUserArray FROM ".TABLE_PREFIX."pmtext WHERE pmtextid='".$attachmentinfo['private']."'"); 
    $toUserArray = unserialize($pmUsers['toUserArray']);          
    if ($toUserArray[$bbuserinfo['userid']] != $bbuserinfo['username'] && $attachmentinfo['userid'] != $bbuserinfo['userid']) { 
            print_no_permission();         
           }
It works fine until I had this part. Id di it in steps. Aded the first uploaded images showed. Added the second part images still showed. When I added the above part the images broke.

It still does it with what you posted in your lsat post as well
Reply With Quote
  #216  
Old 09-14-2004, 10:38 AM
Weasel's Avatar
Weasel Weasel is offline
 
Join Date: Dec 2001
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea same here, it breaks all previously uploaded attechments to the forum (thumbs and permissions to view).
Reply With Quote
  #217  
Old 09-14-2004, 05:49 PM
Saphrym's Avatar
Saphrym Saphrym is offline
 
Join Date: Sep 2004
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Weasel
Yea same here, it breaks all previously uploaded attechments to the forum (thumbs and permissions to view).
Ok. Got this thing to work right in 3.0.3. I spent some time trying to figure out exactly what was trying to be done with the edits, and figured out how to do it.


Start with a fresh attachment.php (or one without the modifications for pms)

Find:
PHP Code:
attachment.visiblemimetypeNOT ISNULL(deletionlog.primaryid) AS isdeleted,
        
thread.forumidforum.passwordthread.threadid 
Change to: (Purpose: Adds private as an option variable)
PHP Code:
attachment.visiblemimetypeNOT ISNULL(deletionlog.primaryid) AS isdeleted,
        
thread.forumidforum.passwordthread.threadid, private 
Find:
PHP Code:
if ($attachment['postid'] == AND $bbuserinfo['userid'] == $attachmentinfo['userid']) 
Add Above: (Purpose: Starts an if/then statement that if it's not a private message attachment do things like normal)
PHP Code:
if (!$attachmentinfo['private']) { 
Find:
PHP Code:
    // check if there is a forum password and if so, ensure the user has it set
    
verify_forum_password($attachmentinfo['forumid'], $attachmentinfo['password']);

    if (!
$attachmentinfo['visible'] AND !can_moderate($attachmentinfo['forumid'], 'canmoderateattachments') AND $attachmentinfo['userid'] != $bbuserinfo['userid'])
    {
        
$idname 'attachment';
        eval(
print_standard_error('error_invalidid'));
    }

Add Below: (Purpose: Ends the if/then statement and adds what to do if it IS a private message attachment.)
PHP Code:
} else {
    
$pmUsers $DB_site->query_first("SELECT toUserArray FROM ".TABLE_PREFIX."pmtext WHERE pmtextid='".$attachmentinfo['private']."'");
    
$toUserArray unserialize($pmUsers['toUserArray']);         
    if (
$toUserArray[$bbuserinfo['userid']] != $bbuserinfo['username'] && $attachmentinfo['userid'] != $bbuserinfo['userid']) {
            
print_no_permission();        
           }

I've tested it with different users until I got the code working properly for both regular attachments and pm attachments. So this should work fine for those of you using 3.0.3.

Hope this helps.
Reply With Quote
  #218  
Old 09-14-2004, 06:02 PM
BamaStangGuy's Avatar
BamaStangGuy BamaStangGuy is offline
 
Join Date: Mar 2004
Location: Alabama
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It worked!!!

Thanks
Reply With Quote
  #219  
Old 09-14-2004, 09:16 PM
Weasel's Avatar
Weasel Weasel is offline
 
Join Date: Dec 2001
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good job, the simplest solution is always the best, huh?
Reply With Quote
  #220  
Old 09-18-2004, 09:46 PM
RobinHood RobinHood is offline
 
Join Date: Sep 2002
Location: Philly
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Weasel
Good job, the simplest solution is always the best, huh?
Is it just me or is there something wrong with the script? Why does it kept deleting the attachments right after a few hours or so???
Reply With Quote
  #221  
Old 09-19-2004, 06:23 PM
AZone's Avatar
AZone AZone is offline
 
Join Date: Nov 2002
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am sorry, but can someone summarize all the steps I need to do to get it work? Or does the file in the first post contain complete solution?
Thank you.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:15 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07605 seconds
  • Memory Usage 2,345KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (10)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete