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
  #202  
Old 07-22-2004, 10:52 PM
Keyser S?ze's Avatar
Keyser S?ze Keyser S?ze is offline
 
Join Date: Apr 2002
Location: USA
Posts: 690
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok this works fine for me in 3.0.1 BUT, when i load a PM with a attachment, takes forever, like a full 2 minutes to load the PM

thats the only problem, other PMs load very fast, almost instantly
Reply With Quote
  #203  
Old 07-25-2004, 12:12 PM
moley's Avatar
moley moley is offline
 
Join Date: Sep 2002
Location: England
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

when i used it on 3.0.1 i got an error

An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ';
ALTER TABLE pmtext add attach int not null;
ALTER TABLE att

anyone know how to fix it?
Reply With Quote
  #204  
Old 07-26-2004, 01:27 PM
Datenpapst Datenpapst is offline
 
Join Date: Mar 2004
Location: Vienna
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

aren't privat messages privat and only for the users themselfs?
Reply With Quote
  #205  
Old 07-27-2004, 03:19 PM
moley's Avatar
moley moley is offline
 
Join Date: Sep 2002
Location: England
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

a private message is from one person to another this hack can be used in this sorta of case user 1 made a new wallpaper and he wants to show his friend user 2. Instead of making a thread user 1 goes and makes a pm with the image attahment so that way the only two people who will see it are user 1 and user 2.

Also on your sites portal you seem to have latest thread replies twince once on the left hand colum and once under the latest news. justing pointing out.
Reply With Quote
  #206  
Old 08-02-2004, 03:28 PM
weaver weaver is offline
 
Join Date: Mar 2004
Posts: 183
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't find either of these pieces of code in private.php. I'm running 3.0.3.

Quote:
$postid = verify_id('post', $attachmentinfo['postid']);
Quote:
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
Reply With Quote
  #207  
Old 08-24-2004, 03:32 AM
Weasel's Avatar
Weasel Weasel is offline
 
Join Date: Dec 2001
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

snobbymom, in that last piece of code just replace foruminfo with attachmentinfo everywhere you see it in the edit.

As for the " $postid = ..." I'm wondering the same thing myself. Its possible that that edit could be skipped.

Otherwise all of the edits are fairly straightforward even if they dont match the new 3.0.3 code exactly. Can anyone get this working in 3.0.3?
Reply With Quote
  #208  
Old 09-12-2004, 12:37 AM
RobinHood RobinHood is offline
 
Join Date: Sep 2002
Location: Philly
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, guess what? I got this working for VB 3.0.3!

Took me an hour, but I got it!

A working demo of it is at http://www.generazn.com.

I will post a fix for this hack very soon.
Reply With Quote
  #209  
Old 09-12-2004, 01:13 AM
RobinHood RobinHood is offline
 
Join Date: Sep 2002
Location: Philly
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, here is the fix!

First,

Open attachment.php:

Find:


PHP Code:
if (!$attachmentinfo $DB_site->query_first("
    SELECT filename, attachment.postid, attachment.userid, attachmentid,
        " 
iif($thumb'thumbnail AS filedata, thumbnail_dateline AS dateline, thumbnail_filesize AS filesize,''attachment.dateline, filedata, filesize,') . "
        attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted,
        thread.forumid, forum.password, thread.threadid
    FROM " 
TABLE_PREFIX "attachment AS attachment
    LEFT JOIN " 
TABLE_PREFIX "attachmenttype AS attachmenttype ON(attachmenttype.extension = SUBSTRING_INDEX(attachment.filename, '.', -1))
    LEFT JOIN " 
TABLE_PREFIX "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
    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 "forum AS forum ON (forum.forumid = thread.forumid)
    " 
iif($postid"WHERE attachment.postid = $postid""WHERE attachmentid = $attachmentid") . "
"
)) 
Replace with:

PHP Code:
if (!$attachmentinfo $DB_site->query_first("
    SELECT filename, attachment.postid, attachment.userid, attachmentid,
        " 
iif($thumb'thumbnail AS filedata, thumbnail_dateline AS dateline, thumbnail_filesize AS filesize,''attachment.dateline, filedata, filesize,') . "
        attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted, private, 
        thread.forumid, forum.password, thread.threadid
    FROM " 
TABLE_PREFIX "attachment AS attachment
    LEFT JOIN " 
TABLE_PREFIX "attachmenttype AS attachmenttype ON(attachmenttype.extension = SUBSTRING_INDEX(attachment.filename, '.', -1))
    LEFT JOIN " 
TABLE_PREFIX "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
    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 "forum AS forum ON (forum.forumid = thread.forumid)
    " 
iif($postid"WHERE attachment.postid = $postid""WHERE attachmentid = $attachmentid") . "
"
)) 
Next, find:

PHP Code:
if ($attachment['postid'] == AND $bbuserinfo['userid'] == $attachmentinfo['userid']) 
On top of that, add the following:

PHP Code:
if (!$attachmentinfo['private']) {
    
$postid verify_id('post'$attachmentinfo['postid']);

Next, find:

PHP Code:
if (!($forumperms CANVIEW) OR !($forumperms CANGETATTACHMENT))
    {
        
print_no_permission();
    }

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

PHP 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();        
           } 

THAT'S IT! YOU'RE DONE!

It should be working now. If not, let me know because it is working for me.
Reply With Quote
  #210  
Old 09-12-2004, 08:34 PM
btappan's Avatar
btappan btappan is offline
 
Join Date: May 2004
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Props to RobinHood! up and working on my forums, no problems thus far! man does this hack take a while to install though!
Reply With Quote
  #211  
Old 09-14-2004, 02:00 AM
Weasel's Avatar
Weasel Weasel is offline
 
Join Date: Dec 2001
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
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 10:09 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.04737 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
  • (6)bbcode_php
  • (2)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