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)

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 07:47 AM.

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.01121 seconds
  • Memory Usage 1,744KB
  • 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
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (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