vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Private Attachments! (Attachments in Private Messages) (https://vborg.vbsupport.ru/showthread.php?t=35593)

Admin 03-01-2002 10:00 PM

Private Attachments! (Attachments in Private Messages)
 
*drums* :D
This hack is now out of beta! Safe to use. :)

My latest and one of the more extensive hacks -- Private Attachments!
This huge (I ain't kidding, it's pretty big) hack will allow your members to send private messages with attachments in them, so they don't need to use e-mail for that.

Since this hack requires a large number of edits, this is how I recommend installing it:
(a) Run the queries.
(b) Edit all the files, offline.
(c) When you are done with (b) upload all the files at once.
(d) Perform the template edits.
If you do all actions in this order your users shouldn't notice you are installing the hack.

All feature requests (except for limiting this for usergroups -- if you want that do it yourself it's not hard but I'm tired of adding permissions to the dreaded usergroup.php) are welcome before this goes out of beta. :)

As always, have fun.

Jadelit 03-02-2002 09:04 AM

GEEZE!! its 3am..

when I saw all that code, i passed out for 4 mins. LOL!!

btw.. this is great chen.. I'll install tomorrow..

MrLister 03-02-2002 01:09 PM

WOW! Awsome job! thank you

Xelation 03-02-2002 01:56 PM

I'm going to install it now! :D

Xelation 03-02-2002 02:12 PM

I just finished installing it.... heres the first problem for the hack... Ok I can send the file perfectly, but when the user that recieves the pm, he can do everything except open the file. here what happens.....

Admin 03-02-2002 02:50 PM

Xelation, I forgot to add something. Do this change:
Code:

+-------------------------------------------------------------------------------------------------+
| In file private.php replace this:                                                              |
+-------------------------------------------------------------------------------------------------+
  $message = $DB_site->query_first("SELECT privatemessage.*,icon.title as icontitle,icon.iconpath
                                    FROM privatemessage
                                    LEFT JOIN icon ON (privatemessage.iconid = icon.iconid)
+-------------------------------------------------------------------------------------------------+
|                                                                                                |
+-------------------------------------------------------------------------------------------------+
| With this:                                                                                      |
+-------------------------------------------------------------------------------------------------+
  $message = $DB_site->query_first("SELECT privatemessage.*,icon.title as icontitle,icon.iconpath,attachment.attachmentid,attachment.filename,attachment.counter
                                    FROM privatemessage
                                    LEFT JOIN icon ON (privatemessage.iconid = icon.iconid)
                                    LEFT JOIN attachment ON (attachment.attachmentid = privatemessage.attachmentid)
+-------------------------------------------------------------------------------------------------+

and you'll be fine. :)

Xelation 03-02-2002 03:07 PM

Works like a charm! Great Hack! :D :up: ...... do you plan to add this to vb.org? because this would be a real time saver.

Xelation 03-02-2002 03:08 PM

I see you already did, Great!

Admin 03-02-2002 03:08 PM

It's running here for almost a day... ;)

TECK 03-02-2002 03:41 PM

thanks firefly.. i guess my start idea on the requests helped you ;) good job, as usual.

TECK 03-02-2002 03:49 PM

firefly, edit your .txt file and replace this code:
PHP Code:

    if (intval($privatemessage['attachmentid'])!=0) {
      
$attach '<img src="https://vborg.vbsupport.ru/images/paperclip.gif" border="0" align="absmiddle">';
    } else {
      
$attach '';
    } 

with this one
PHP Code:

    if (intval($privatemessage['attachmentid'])!=0) {
      
$attach '<img src="{ imagesfolder }/paperclip.gif" border="0" align="absmiddle">';
    } else {
      
$attach '';
    } 


TECK 03-02-2002 03:52 PM

and i want to see also that is comming from me the idea!!!!.. hehe

Admin 03-02-2002 03:54 PM

The idea didn't come from you, people have been screaming for this forever.

TECK 03-02-2002 03:56 PM

true.... :p

Lionel 03-02-2002 04:17 PM

will this work in 2.21?

Admin 03-02-2002 04:22 PM

Yes but you might have a problem with attachment.php as it changed since then.

JJR512 03-02-2002 10:13 PM

Will this work with PPN's attachments as files hack?

Soma 03-03-2002 06:34 PM

great hack w00ting out loud

Admin 03-03-2002 06:41 PM

lol

Can anyone please test the hack a bit more and make sure attachment.php is ok, so I can release this as a full hack? Thanks. :)

Xelation 03-03-2002 07:13 PM

I've done about 10 tests with mine, works like a charm!

Jawelin 03-03-2002 08:55 PM

I know it shouldn't the right most path, but do you think it'll aware of the PPN's Attachment as files WONDERFUL hack ?
;)

I didn't try to install this yet, but the other is too important to my board... so ...

Thanks forever, Chen

afterlab 03-04-2002 05:22 AM

Great idea.. I'll install it later tonight.

Admin 03-04-2002 11:43 AM

Thanks Xelation -- will release it tonight. :)

Jawelin, it should work except for probably some problems with attachment.php. You'll need to do changes there on your own to make sure you don't ruin anything.

Jawelin 03-05-2002 04:24 PM

Quote:

Originally posted by FireFly
Jawelin, it should work except for probably some problems with attachment.php. You'll need to do changes there on your own to make sure you don't ruin anything.
Thnx, FF.
I'll pay attention when installing and let you know.
A question: these attachments are normally stored into DB (or outside, on the server dir with the above hack) and made available the same way those in post are, aren't they ?
This way, putting on the url row the exact attachment id I could download it even outside the PM, is it right ?

Thanks a lot for your hardest hack, as you said... :supwink:
Bye

Admin 03-05-2002 04:33 PM

No, attachment.php is edited so you can't access private attachments by just specifying their attachmentid.

Tim Wheatley 03-09-2002 06:00 PM

Firefly, heavily edited attachment.php here, I had to be careful - I was, and this works perfectly on my test board (which is exactly the same as my main board). :up:

Jawelin 03-11-2002 09:01 AM

The opposite question: if I wouldn't edit attachment.php almost at all, the same file could be accessible via a direct written url, but should your hack get working the same ?
;)

Note: I have a lot of hacks installed on my attachment.php, so I'm considering would install this one getting some compromise ... :p

Admin 03-11-2002 11:22 AM

Jawelin -- if you don't edit attachment.php your users will just get an invalid attachment error.

Jawelin 03-11-2002 11:33 AM

Ok. I'll try to make a mixup... ;)
Thnx

Lucky 03-11-2002 09:25 PM

Great hack.

I was one of the people many months ago reguesting this hack as well. hehehe :)

I would like to know how to limit usergroups so only users in the group can attach files, if anyone knows how please post as I could really use this.

I am wondering if anyone knows how to make this hack so that it shows up like firefly's attachment viewer.

Also, I am wondering about PPN's read others PM. Just wondering if the admin would be able to view these attachments.

Thanks.

kidney 03-23-2002 04:51 PM

If I installed the hack from pnp, which makes all the attachment as files, will the private attachments be files too, or they will be in the database?

Admin 03-23-2002 04:55 PM

See Jawelin's posts, kidney.

kidney 03-23-2002 05:42 PM

I guess I should read more before posting questions, sorry.

kidney 03-23-2002 10:41 PM

Hope this makes up for the stupid question I asked a couple of post earlier....
This modification will allow to have private attachment to work with file attachment hack by PNP.

PS you must have PNPs' hack before doing this.
https://vborg.vbsupport.ru/showthrea...threadid=35193

Follow the instruction as provided by the master hacker Firefly ;)

But instead in attachment.php look for:
Quote:

if ($postid) {
$postid=verifyid("post",$postid);
} else {
$attachmentid=verifyid("attachment",$attachmentid) ;
}

$getforuminfo=$DB_site->query_first("SELECT forumid".
iif($postid,',attachmentid ','')."
FROM thread,post
WHERE post.threadid=thread.threadid ".
iif($postid,"AND post.postid='$postid'","AND post.attachmentid='$attachmentid'")."
");

$permissions=getpermissions($getforuminfo[forumid]);
if (!$permissions[canview] or !$permissions[cangetattachment]) {
show_nopermission();
}

if ($postid) {
$attachmentid=$getforuminfo[attachmentid];
}

if (!$attachmentinfo=$DB_site->query_first("SELECT filename,hash,filedata,dateline,visible
FROM attachment
WHERE attachmentid='$attachmentid'")){
$idname='attachment';
eval("standarderror(\"".gettemplate('error_invalid id')."\");");
exit;
}
and replace that by:
Quote:

if ($postid) {
$postid=verifyid("post",$postid);
} elseif($privatemessageid) {
$privatemessageid=verifyid("privatemessage",$priva temessageid);
} else {
$attachmentid=verifyid("attachment",$attachmentid) ;
}

if (!$privatemessageid) {
/* ### */
$getforuminfo=$DB_site->query_first("SELECT forumid".
iif($postid,',attachmentid ','')."
FROM thread,post
WHERE post.threadid=thread.threadid ".
iif($postid,"AND post.postid='$postid'","AND post.attachmentid='$attachmentid'")."
");

$permissions=getpermissions($getforuminfo[forumid]);
if (!$permissions[canview] or !$permissions[cangetattachment]) {
show_nopermission();
}

if ($postid) {
$attachmentid=$getforuminfo[attachmentid];
}
$privateok = 0;
/* ### */
} else {
/* ### */
$pminfo = $DB_site->query_first("SELECT * FROM privatemessage WHERE privatemessageid=$privatemessageid");
$attachmentid = $pminfo['attachmentid'];
if ($attachmentid == 0 or $pminfo['userid'] != $bbuserinfo['userid']) {
$idname='attachment';
eval("standarderror(\"".gettemplate('error_invalid id')."\");");
exit;
}
$privateok = 1;
/* ### */
}

if (!$attachmentinfo=$DB_site->query_first("SELECT filename,hash,filedata,dateline,visible
FROM attachment
WHERE attachmentid='$attachmentid'".iif($privateok==0, 'AND private=0', ''))){
$idname='attachment';
eval("standarderror(\"".gettemplate('error_invalid id')."\");");
exit;
}
also in function.php:
Quote:

$DB_site->query("INSERT INTO attachment (attachmentid,userid,dateline,filename,visible,has h) VALUES (NULL,$bbuserinfo[userid],".time().",'".addslashes($attachment_name)."','$v isible','$attachment_hash')");
and replace it with:
Quote:

$DB_site->query("INSERT INTO attachment (attachmentid,userid,dateline,filename,filedata,vi sible,hash,private) VALUES (NULL,$bbuserinfo[userid],".time().",'".addslashes($attachment_name)."','". addslashes($filestuff)."','$visible','$attachment_ hash','$private')");
This should do the trick...

Now if someone can help me figure out how to have the file removed with the deletion on the private message that be nice...

Keep in mind that I'm only beginner so there might be oversight, just let me know! :nervous:

Austin Dea 03-23-2002 11:28 PM

bah, n/m...fixed it....

sub 04-22-2002 08:13 AM

Awesome hack! Installed this for 2.2.5 had to improvise a template for it to work but other than that it went smoothly.

Dark Odin 04-27-2002 02:33 PM

Hmm. I get errors when I try to run the mySQL queries.

Quote:

Database error in vBulletin Control Panel 2.2.5:

Invalid SQL: ALTER TABLE attachment ADD private TINYINT(1) UNSIGNED DEFAULT
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064
Any ideas?

Admin 04-27-2002 02:47 PM

You only ran part of the query, the full query is:
[codel]ALTER TABLE attachment ADD private TINYINT(1) UNSIGNED DEFAULT "0" NOT NULL AFTER visible;[/code]

Dark Odin 04-27-2002 06:10 PM

Okay got it. I was trying to run both queries as one. :/

Dark Odin 04-28-2002 06:15 PM

Anyone know how to get this to work with attachment viewer?


All times are GMT. The time now is 04:47 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.01462 seconds
  • Memory Usage 1,828KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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