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)

Keyser S?ze 07-22-2004 10:52 PM

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

moley 07-25-2004 12:12 PM

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?

Datenpapst 07-26-2004 01:27 PM

aren't privat messages privat and only for the users themselfs?

moley 07-27-2004 03:19 PM

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.

weaver 08-02-2004 03:28 PM

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']);

Weasel 08-24-2004 03:32 AM

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?

RobinHood 09-12-2004 12:37 AM

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. :)

RobinHood 09-12-2004 01:13 AM

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. :)

btappan 09-12-2004 08:34 PM

Props to RobinHood! up and working on my forums, no problems thus far! man does this hack take a while to install though!

Weasel 09-14-2004 02:00 AM

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.


All times are GMT. The time now is 08: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.01287 seconds
  • Memory Usage 1,775KB
  • 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
  • (6)bbcode_php_printable
  • (2)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