View Full Version : Private Attachments! (Attachments in Private Messages)
Admin
03-01-2002, 10:00 PM
*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:
+-------------------------------------------------------------------------------------------------+
| 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,at tachment.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... ;)
thanks firefly.. i guess my start idea on the requests helped you ;) good job, as usual.
firefly, edit your .txt file and replace this 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 if (intval($privatemessage['attachmentid'])!=0) {
$attach = '<img src="{ imagesfolder }/paperclip.gif" border="0" align="absmiddle">';
} else {
$attach = '';
}
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.
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?
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
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/showthread.php?s=&threadid=35193
Follow the instruction as provided by the master hacker Firefly ;)
But instead in attachment.php look for:
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_invalidid')."\");");
exit;
}
and replace that by:
if ($postid) {
$postid=verifyid("post",$postid);
} elseif($privatemessageid) {
$privatemessageid=verifyid("privatemessage",$privatemessageid);
} 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_invalidid')."\");");
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_invalidid')."\");");
exit;
}
also in function.php:
$DB_site->query("INSERT INTO attachment (attachmentid,userid,dateline,filename,visible,has h) VALUES (NULL,$bbuserinfo[userid],".time().",'".addslashes($attachment_name)."','$visible','$attachment_hash')");
and replace it with:
$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....
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.
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:
ALTER TABLE attachment ADD private TINYINT(1) UNSIGNED DEFAULT "0" NOT NULL AFTER visible;
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?
Keyser S?ze
05-03-2002, 02:24 AM
getting this error Database error in vBulletin 2.2.5:
Invalid SQL: SELECT privatemessage.*,icon.title as icontitle,icon.iconpath,attachment.attachmentid,at tachment.filename,attachment.counter
FROM privatemessage
LEFT JOIN icon ON (privatemessage.iconid = icon.iconid)
LEFT JOIN attachment ON (attachment.attachmentid = privatemessage.attachmentid)
WHERE privatemessageid=97729
mysql error: Unknown column 'privatemessage.attachmentid' in 'on clause'
mysql error number: 1054
Date: Thursday 02nd of May 2002 07:13:57 PM
Script: http://www.emusanet.com/forums/forums/private.php?s=&action=show&privatemessageid=97729
Referer: http://www.emusanet.com/forums/private.php?s=
i assume thats a problem with my private.php file, its attached, as far as i can tell everything is fine with it :(
----
Originally posted by sub
Awesome hack! Installed this for 2.2.5 had to improvise a template for it to work but other than that it went smoothly.
can u explain that pls?
JagenSWPC
05-14-2002, 02:20 PM
Originally posted by FireFly
*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.
my txt is [better wash my mouth][better wash my mouth][better wash my mouth][better wash my mouth]ed up
<?php
// removed
?>
Recluse
06-11-2002, 03:46 AM
any reason why when i delete the messages from the sender and reciver that the attachments are still in the database?
tkeil69575
06-13-2002, 05:28 AM
Hallo fire,
I have a weird error with this one. All seems to be working but if I have a look at my pm sent box a day later, then the attachment is gone. The attachment Icon in the pm does not show up anymore and the amount of downloads also no longer. This attachment link is also gone.
Any Ideas what that might be. This happens on the sender als well as the recipient side.
greetings tina
globalwin
06-20-2002, 07:22 PM
can anyone please help me get thisd hack working cause it still doesnt work with kidney's fix :(
Keyser S?ze
06-22-2002, 11:38 PM
getting this error when i try to view a attachment
Database error in vBulletin 2.2.6:
Invalid SQL: SELECT forumid FROM thread WHERE threadid=
mysql error: You have an error in your SQL syntax near '' at line 1
mysql error number: 1064
Date: Saturday 22nd of June 2002 06:26:17 PM
Script: http://www.totalshock.net/forums/forums/attachment.php?privatemessageid=5
Referer: http://www.totalshock.net/forums/private.php?action=show&privatemessageid=5
any help pls
dreamhost
07-24-2002, 12:48 AM
I am able to attach files to pm's however when a person goes to view them they get
Parse error: parse error in /home/xxxxxxxxxxxxxx/forums/attachment.php on line 67
I did this step correctly
In file attacment.php replace this: |
+-------------------------------------------------------------------------------------------------+
updateuserforum($getforuminfo['forumid']);
+-------------------------------------------------------------------------------------------------+
| |
+-------------------------------------------------------------------------------------------------+
| With this: |
+-------------------------------------------------------------------------------------------------+
if ($privateok==0) {
updateuserforum($getforuminfo['forumid']);
}
-----------------------------------------------------------------------
the updateuserforum line is line 67 in my file
here are the lines surrounding that part
if ($privateok==0) {
updateuserforum($getforuminfo['forumid']);
}
$getforuminfo['threadid']);
if ($noshutdownfunc) {
does anyone see any errors here?
thanks in advance.
p.s. it seems to have problems attachming anywhere even to posts.
DrkFusion
07-24-2002, 01:32 AM
Nice work Chen
*clicks install*
Admin
07-24-2002, 07:09 AM
Email me your attachment.php file by email.
wot-Mike
07-24-2002, 11:18 PM
Oh bummer :(
This one is no longer working. Upgraded to vB2.2.6 a while ago, and changed php (register_globals = Off)
Now there's no more attachment in pm's. I've taken a peek with phpMyAdmin, and the private message that's supposed to have an attachment shows no attachmentid (= 0)
:ermm:
Admin
07-25-2002, 06:54 AM
Turn reg_globals on.
tkeil69575
07-28-2002, 09:51 PM
Hallo Firefly,
i already posted about this problem before, but didnt get any feedback yet. I rechecked the hack installation today and updated it to the current version, but it hasnt made any difference to my problem.
At first all seems to work fine, the attachment can be added and shows up in the receveivers and senders pm's. However after about 30 min. the icon and link for the attachment download disappears aswell at the number for the amount of times it was downloaded. Its really weird.
Im attaching a screenshot, of how the pm looks after 30 min or so. Would appreciate any help.
Tina
Admin
07-29-2002, 07:01 AM
Do you have my hack of keeping attachments on preview post?
tkeil69575
07-29-2002, 07:14 AM
No chen, I dont have a hack for keeping PM attachments installed (only for the normal postings).
Tina
Admin
07-29-2002, 07:15 AM
That's not what I'm talking about. Do you have this hack installed?
https://vborg.vbsupport.ru/showthread.php?s=&threadid=38995
tkeil69575
07-29-2002, 07:16 AM
Yes I have that installed.
Admin
07-29-2002, 07:33 AM
In newreply.php and newthread.php replace this:
// **************************************** \\
// *** Keep attachments when previewing *** \\
// **************************************** \\
$postinfo = $DB_site->query_first('
SELECT attachmentid, filename FROM attachment
WHERE attachmentid = '.intval($HTTP_POST_VARS['attachmentid']).' AND visible = 0
');
if (intval($HTTP_POST_VARS['attachmentid']) != 0 and $postinfo) {
$oldattachid = $postinfo['attachmentid'];
} else {
unset($oldattachid);
}
if ($orphans = $DB_site->query("SELECT a.attachmentid FROM attachment AS a LEFT JOIN post USING (attachmentid) WHERE postid IS NULL") and $DB_site->num_rows($orphans) > 0) {
$orphanids = '0';
while ($orphan = $DB_site->fetch_array($orphans)) {
$orphanids .= ",$orphan[attachmentid]";
}
$DB_site->query("DELETE FROM attachment WHERE attachmentid IN ($orphanids) AND dateline < ".(time() - (60*15))." AND attachmentid <> ".intval($oldattachid));
}
// **************************************** \\
// *** Keep attachments when previewing *** \\
// **************************************** \\
With this:
// **************************************** \\
// *** Keep attachments when previewing *** \\
// **************************************** \\
$postinfo = $DB_site->query_first('
SELECT attachmentid, filename FROM attachment
WHERE attachmentid = '.intval($HTTP_POST_VARS['attachmentid']).' AND visible = 0
');
if (intval($HTTP_POST_VARS['attachmentid']) != 0 and $postinfo) {
$oldattachid = $postinfo['attachmentid'];
} else {
unset($oldattachid);
}
if ($orphans = $DB_site->query("
SELECT a.attachmentid
FROM attachment AS a
LEFT JOIN post ON (post.attachmentid = a.attachmentid)
LEFT JOIN privatemessage ON (privatemessage.attachmentid = a.attachmentid)
WHERE postid IS NULL AND privatemessageid IS NULL
") and $DB_site->num_rows($orphans) > 0) {
$orphanids = '0';
while ($orphan = $DB_site->fetch_array($orphans)) {
$orphanids .= ",$orphan[attachmentid]";
}
$DB_site->query("DELETE FROM attachment WHERE attachmentid IN ($orphanids) AND dateline < ".(time() - (60*15))." AND attachmentid <> ".intval($oldattachid));
}
// **************************************** \\
// *** Keep attachments when previewing *** \\
// **************************************** \\
tkeil69575
07-29-2002, 08:33 AM
Thank you chen!!!
Looks like that has solved my Problem :)
Tina
bravo firefly, another fantastic hack :)
Hellburn
08-10-2002, 09:50 AM
Have everybody make this one:
"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"
i want that only mods and admins can posting attachements. Can everybody help me?
Hellburn
08-11-2002, 06:19 PM
hmm is nobody here there can fix this hack?
I want that only mods and admins can posting attachements. Can everybody help me?
grooveh
09-21-2002, 03:42 PM
Great hack!!! Thanks a ton! :)
trainer
09-21-2002, 04:17 PM
Originally posted by Hellburn
hmm is nobody here there can fix this hack?
I want that only mods and admins can posting attachements. Can everybody help me?
it would be nice to specify the usergroup allowed to use PM attachments
Bison
09-22-2002, 06:16 AM
Originally posted by Hellburn
hmm is nobody here there can fix this hack?
I want that only mods and admins can posting attachements. Can everybody help me?
You can probably do that yourself ... a simple "if ($usergroup=6 || $usergroup=7){ condition before all functions that does the attachment procedure ... when help is not given when you request it, somemight help you if you attempt to do it for yourself. You might get a quick response for trying yourself! :)
TheComputerGuy
09-28-2002, 11:48 AM
Hi I am having the same problem as IceMalee...I get some database errors at line 1
Invalid SQL: INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid,receipt,attachmentid) VALUES (NULL,1,1,1,'test','test',1033217057,'0','0',0,0,1 ,)
mysql error: You have an error in your SQL syntax near ')' at line 1
Any help would be great.
ontherun
11-04-2002, 09:04 AM
I really want to install this Hack, but after reading all post and downloading the the text file, I have one question.
Has the install privattach.txt file been updated with all the changes I see in the 5 pages of post? Or do I have to follow the instructions and then come back and make the other changes I see posted here?
Thanks
Database error in vBulletin 2.2.6:
I'm getting the following error aftertrying to send a PM:
Invalid SQL: INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid,receipt,attachmentid) VALUES (NULL,1,1,1,'hahah','ahaha',1036464302,'1','0',0,0 ,1,)
mysql error: You have an error in your SQL syntax near ')' at line 1
mysql error number: 1064
Is Firefly still watching this thread?I Hope. :)
ontherun
11-05-2002, 01:39 PM
Invalid SQL: INSERT INTO attachment (attachmentid,userid,dateline,filename,filedata,vi sible,private) VALUES
(NULL,1,1036510300,'java msg anim.txt','','1','1')
mysql error: Unknown column 'private' in 'field list'
mysql error number: 1054
Date: Tuesday 05th of November 2002 08:31:40 AM
Script: http://dev.********.com/private.php
Referer: http://dev.********.com/private.php?s=&action=newmessage&userid=218
Hey FireFly Got your Wings On? Or is this now a unsupported HACK now that its out of Bata?
Bison
11-05-2002, 01:46 PM
You forgot to add the field 'private' in your database ....
Erwin
11-05-2002, 05:10 PM
Read the statement under the thread title:
"The hacker cannot guarantee to provide support for this hack."
Also, most of the problems are because the installer has not followed the instructions properly. For example, like Rolodex said, you didn't run the query to insert the column "private" in the "attachment" table.
ontherun
11-05-2002, 05:29 PM
I have ran the
query(s):
ALTER TABLE attachment ADD private TINYINT(1) UNSIGNED DEFAULT "0" NOT NULL AFTER visible;
ALTER TABLE privatemessage ADD attachmentid SMALLINT(5) UNSIGNED NOT NULL;
Which produced these lines in the db.
Database dsstv_forum2 - table privatemessage
Field = attachmentid
Type = SMALLINT
Length/Values* = 5
Attributes = UNSIGNED
Null = not null
default = 0
Extra =
Database dsstv_forum2 - table attachment running on localhost
Field = private
Type = TINYINT
Length/Values* = 1
Attributes = UNSIGNED
Null = not null
Default = 0
Extra =
~ So much for not following the instructions ~
Bison
11-05-2002, 05:31 PM
Originally posted by VAN
Database error in vBulletin 2.2.6:
I'm getting the following error aftertrying to send a PM:
Invalid SQL: INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid,receipt,attachmentid) VALUES (NULL,1,1,1,'hahah','ahaha',1036464302,'1','0',0,0 ,1,)<-- Here
mysql error: You have an error in your SQL syntax near ')' at line 1
mysql error number: 1064
Is Firefly still watching this thread?I Hope. :)
If what you added in this thread is the SQL error message you got then I can tell you that the 12 values you're trying to enter into the database doesn't match with amount of 13 tables you're trying to add the data to.
13 tables ... 12 Values
Bison
11-05-2002, 05:40 PM
Originally posted by ontherun
I have ran the
query(s):
ALTER TABLE attachment ADD private TINYINT(1) UNSIGNED DEFAULT "0" NOT NULL AFTER visible;
ALTER TABLE privatemessage ADD attachmentid SMALLINT(5) UNSIGNED NOT NULL;
Which produced these lines in the db.
Database dsstv_forum2 - table privatemessage
Field = attachmentid
Type = SMALLINT
Length/Values* = 5
Attributes = UNSIGNED
Null = not null
default = 0
Extra =
Database dsstv_forum2 - table attachment running on localhost
Field = private
Type = TINYINT
Length/Values* = 1
Attributes = UNSIGNED
Null = not null
Default = 0
Extra =
~ So much for not following the instructions ~
If you "Physically" see the column inside your database then you have a good case to debate ... if you haven't then that should be your next move.
Second, look at the attachment.php for that SQL INSERT string and look for anything that might not seem valid on or around the column name. Make sure that the column inside the database has the same name that the query is trying to enter data to ...
Originally posted by Rolodex
If what you added in this thread is the SQL error message you got then I can tell you that the 12 values you're trying to enter into the database doesn't match with amount of 13 tables you're trying to add the data to.
13 tables ... 12 Values
Thanks for the push in the right direction, Rolodex. I've got it working now. :)
Now onto the next problem...
Nothing "major", but the paperclip.gif image is not appearing next to the PM title.
Here's what I have in Private.php:
if (intval($privatemessage['attachmentid'])!=0) {
$attach = '<img src="{images folder}/paperclip.gif" border="0" align="absmiddle">';
} else {
$attach = ' ';
}
What am I missing?? (space in "{images folder}" added for example)
Bison
11-05-2002, 11:56 PM
My Question ....
How many themes are you working with? Also, i'd check the spelling of the paperclip image for caps ... I had a simular problem like that and that was the problem.
Make sure it's in lower case!
Just a single theme on my test board, and the code I pasted is taken directly from my private.php file...paperclip.gif is in all lowercase. Just to cleare it up, I'm not getting a "broken image"...theres just nothing showing up where paperclip.gif should be. Weird.
ontherun
11-06-2002, 10:14 PM
Originally posted by Rolodex
If you "Physically" see the column inside your database then you have a good case to debate ... if you haven't then that should be your next move.
Second, look at the attachment.php for that SQL INSERT string and look for anything that might not seem valid on or around the column name. Make sure that the column inside the database has the same name that the query is trying to enter data to ...
I have removed the Altered Tables and re-ran the query's
I have gone back to the Org. php files and added all the lines need to them. I have added the new lines to Template and created the new template. Uploaded all files
And Im right back to the Org. error:
Database error in vBulletin 2.2.8:
Invalid SQL: INSERT INTO attachment (attachmentid,userid,dateline,filename,filedata,vi sible,private) VALUES (NULL,1,1036627824,'newbie guide.txt',','1','1')
mysql error: Unknown column 'private' in 'field list'
mysql error number: 1054
Date: Wednesday 06th of November 2002 05:10:24 PM
Script: http://dev.*********.com/private.php
Referer: http://dev.*********.com/private.php?s=&action=newmessage&userid=218
How do I fix this
And yes the tables where added to the DB.
Mike11212
11-19-2002, 06:02 PM
I need help
I installed the hack fine with out any problems
but when someone clicks the attachments in the PM
they get the following error
Parse error: parse error in /home/mike1121/public_html/board/attachment.php on line 100
here are lines 89 to 102 in my attachments.php file
if ($extension=='gif') {
header('Content-type: image/gif');
} elseif ($extension=='jpg' or $extension=='jpeg') {
header('Content-type: image/jpeg');
} elseif ($extension=='png') {
header('Content-type: image/png');
} elseif ($extension=='pdf') {
header('Content-type: application/pdf');
} else {
header('Content-type: unknown/unknown');
}
echo $attachmentinfo[filedata];
?>
Mike11212
11-20-2002, 02:21 AM
anyone?
maoz440
11-23-2002, 02:04 PM
I wonder if it is possible to limit this function to only certain user groups? :)
glenmax
12-11-2002, 03:06 PM
Well,
I did some checking and looking. I also tried to find the location that Rolodex mentionned here:
You can probably do that yourself ... a simple "if ($usergroup=6 || $usergroup=7){ condition before all functions that does the attachment procedure ... when help is not given when you request it, somemight help you if you attempt to do it for yourself. You might get a quick response for trying yourself!
Now I admit, I am new to this and I am learning. But, a little direction could go a long way for me to this working for mods and admins only.
Please give a hand if anyone can.....
Cheers,
GM
Warcaptain
12-22-2002, 09:09 PM
i cant view it.
the code is all over the place
anyway you can post a more friendly version?
Just upgraded to 2.2.9 on my test board, and this works flawlessly with one tiny exception...
I still cannot get paperclip.gif to appear next to the message title.
$attach = '<img src="{ imagesfolder}/paperclip.gif" border="0" align="absmiddle">';
} else {
$attach = '';
Anyone else run into this....and fix it?
MetroSports82
01-29-2003, 10:39 AM
Originally posted by Mike11212
I need help
I installed the hack fine with out any problems
but when someone clicks the attachments in the PM
they get the following error
Parse error: parse error in /home/mike1121/public_html/board/attachment.php on line 100
here are lines 89 to 102 in my attachments.php file
if ($extension=='gif') {
header('Content-type: image/gif');
} elseif ($extension=='jpg' or $extension=='jpeg') {
header('Content-type: image/jpeg');
} elseif ($extension=='png') {
header('Content-type: image/png');
} elseif ($extension=='pdf') {
header('Content-type: application/pdf');
} else {
header('Content-type: unknown/unknown');
}
echo $attachmentinfo[filedata];
?>
Mike, I was having the same exact problem, but when I double checked to see that I had all the code work right, I really didn't. I was missing a '}' at the end of one of the lines. I think this is the same problem that you might be encountering. try doing this, with the modifications that you already have.
open- attachment.php
REPLACE
updateuserforum($getforuminfo['forumid']);
WITH
if ($privateok==0) {
updateuserforum($getforuminfo['forumid']);
}
BE SURE TO INCLUDE THE } at the end of that line. that should do the trick, let me know how it goes. :) working great with 2.2.9.
Nerpin
01-30-2003, 01:43 AM
I installed it and as far as I can tell I did everything properly...but when the person who recieves the pm tries to open it...it says it cannot find the attachment specified...any ideas why?
Jugglor
02-13-2003, 02:24 AM
When the member on the receiving end deletes the PM, is the attachment deleted from the database?
Slynderdale
03-03-2003, 11:00 PM
Nice hack but theres a small problem, If some one deletes the private message that has an attachment, it does not delete the attachment itself, I made a fix for this, Ill post a text below with the fix.
Slynderdale
03-03-2003, 11:02 PM
With the fix, It only deletes the attachment when the last private message that contains the attachment is deleted, so it doesnt accidentaly delete the attachment on the sender or receiver when one deletes the private message and the other doesnt.
Enjoy
clown2003
03-21-2003, 05:27 PM
Hi, very neat hack but can any 1 help me, I want only selected members to be able to send attachments.....
Steve123
03-22-2003, 03:21 AM
Hey,
Ive installed this hack and gone over it twice..
For some reason it wont work..
When i send an attachment in a pm and read it.. it dosent show the attachment.. it shows nothing..
Ive check the mysql tables and it dosent seem to be adding anything to the attachment and privatemessage sql tables..
using vb 2.2.6.. any ideas??
/Steve
Steve123
03-23-2003, 09:31 AM
*bump*
Steve123
03-25-2003, 04:21 AM
Fixed by turning Reg_Globals On
in php..
Is there any way around this?
msimplay
05-10-2003, 04:16 PM
seems to be working fine on Vbulletin 2.30 release candidate 3
Crazy Pete
05-10-2003, 09:24 PM
03-22-03 at 01:21 AM Steve123 said this in Post #90 (https://vborg.vbsupport.ru/showthread.php?postid=371122#post371122)
Hey,
Ive installed this hack and gone over it twice..
For some reason it wont work..
When i send an attachment in a pm and read it.. it dosent show the attachment.. it shows nothing..
Ive check the mysql tables and it dosent seem to be adding anything to the attachment and privatemessage sql tables..
using vb 2.2.6.. any ideas??
/Steve
Same issue with me, though I'm running 2.3.0. I'd rather not turn on register_globals like Steve had to, though.
SemperFidelis
05-22-2003, 01:53 PM
Can anyone confirm that this hack is working 100% correctly for vb 2.3.0 with reg_glbals OFF ?
ontherun
06-23-2003, 08:52 AM
Running vBulletin (2.3.0)
I have install the hack Scott MacVicar's Attachments as files.
[vB v2.2.3] Attachments as files (post #1) (https://vborg.vbsupport.ru/showthread.php?postid=221213#post221213)
I have installed Private Attachments! (Attachments in Private Messages)
Let me say the Attachments as files has been working with no issues for a few months.
After installing Private Attachments, it appears that every thing works, (no errors) except the attacment never appears on the pm to the user.
Now there is a earler post about This modification will allow you to have private attachment working with file attachment hack by PNP.
It looks to me that PA has been updated and the added notes in that post (post #33) (https://vborg.vbsupport.ru/showthread.php?postid=232147#post232147) are included in the current hack.
I Complete restore of test site to before install and re-installed the hack again............with the same results.
Everything looks great............ allows me attach the file to the PM but when the PM is received there is no attachment. ( No error messages).
What do I need to do? Help please......... I really need this to work on our system.
Thanks ahead of time for your help.
Guess this Thred is DEAD post this 06-23-03 02:52 AM and not a post....................hmmmmmmmmm
asweetdeal
08-03-2003, 05:15 PM
I too have had this hack installed for quite some time now. Our server upgraded the php and turned off reg globals and now we can not receive our attachement in our PM's.
Is there a fix for this yet?
Thanks
ASD
Robert9
08-19-2003, 04:14 AM
Have installed it, thank you for doing it. So i could get to bed some hours earlier now (it´s 7 in morning ;-(
But as i see the code there is no delete for the attachment, if the message is deleted, isn´t it so?
Will see if i can fix this ...
Robert9
08-19-2003, 04:34 AM
Improvements:
1) If you want to see the pic instead download it, try this for the new template privmsg_attachment
<p><normalfont><img src="{imagesfolder}/attach/$message[attachmentextension].gif" width="16" height="16" border="0" alt="">
Attachment:<br> <img src="attachment.php?s=$session[sessionhash]&privatemessageid=$message[privatemessageid]" border="0" alt="" vspace="8" hspace="4">
</normalfont><br>
<smallfont>Downloads: $message[counter]</smallfont></p>
Robert9
08-19-2003, 04:44 AM
Ok. The better one:
make another template called privmsg_attachmentimage
with this code:
<p><normalfont><img src="{imagesfolder}/attach/$message[attachmentextension].gif" width="16" height="16" border="0" alt="">
Attachment:<br> <img src="attachment.php?s=$session[sessionhash]&privatemessageid=$message[privatemessageid]" border="0" alt="" vspace="8" hspace="4">
</normalfont><br>
<smallfont>Downloads: $message[counter]</smallfont></p>
Then found the place with:
if ($message['attachmentid'] != 0) {
$message['attachmentextension'] = strtolower(getextension($message['filename']));
eval("\$message[attachment] = \"".gettemplate('privmsg_attachment')."\";");
} else {
$message['attachment'] = '';
}
and substitute it with this:
if ($message['attachmentid'] != 0) {
$message['attachmentextension'] = strtolower(getextension($message['filename']));
if (($viewattachedimages) and ($bbuserinfo[showimages]) ) {
eval("\$message[attachment] = \"".gettemplate('privmsg_attachmentimage')."\";");
} else {
eval("\$message[attachment] = \"".gettemplate('privmsg_attachment')."\";");
}
} else {
$message['attachment'] = '';
}
Robert9
08-19-2003, 04:55 AM
Wow. Now i got a problem. Want to kill the attachment when the pm is killed. Problem:
If someone sends a multiple message to more than one users.
While the first kills his pm, the attachment is killed, too.
Seems another query is needed:
count pms with attachmentid = x, if > 0, dont kill the file:
(Query after killing the first pm, while query before must be >1)
and so on.
Will do it in a minute ...
Robert9
08-19-2003, 05:04 AM
Seems something forgotten:
In template privfolder_bit, you have to insert $attach bevore
<normalfont><a href="private.php?s=$session[sessionhash]&action=show&privatemessageid=$privatemessage[privatemessageid]">$privatemessage[title]</a></normalfont>
Robert9
08-19-2003, 05:18 AM
ok. Here we go:
find in private.php this line: if ($what=="delete") {
then substitute the whole block till // end while
with this code.
if ($what=="delete") {
if (is_array($privatemessage)) {
while(list($key,$val)=each($privatemessage)) {
// for every pm get the attachmentid first !
$ata = array(); $atas = array();
echo "SELECT attachmentid FROM privatemessage WHERE privatemessageid=".intval($key)." AND userid=$bbuserinfo[userid] LIMIT 1";
$ata = $DB_site->query_first("SELECT attachmentid FROM privatemessage WHERE privatemessageid=".intval($key)." AND userid=$bbuserinfo[userid]");
// then look if there are more than one
if ($ata[0] != '') {
$ataid = $ata[0];
// Count if there are more than one !
$atas = $DB_site->query_first("SELECT COUNT(*) FROM privatemessage WHERE attachmentid = $ataid");
echo "<br>SELECT COUNT(*) FROM attachment WHERE attachmentid = $ataid";
// If there is only 1, delete it !
if ($atas[0] == '1') {
$atasid = $atas[0];
echo"<br>$atas[0]<br>DELETE FROM attachment WHERE attachmentid = $ataid";
$DB_site->query("DELETE FROM attachment WHERE attachmentid = $ataid");
} // else make error message !
}
// $DB_site->query("DELETE FROM privatemessage WHERE privatemessageid=".intval($key)." AND userid=$bbuserinfo[userid]");
} //end while
Im no programer at all, maybe something to improve ?
Robert9
08-19-2003, 05:20 AM
Hmm. Is there any query to ask:
How many attachmentids in table with attachmentid like the one where x=y and t=o ?
I really hate it to make more than one query if not needed ;-)
Maybe it´s really time to go to bed, 8:30 now at morning ;-(
Robert9
08-19-2003, 05:25 AM
Hehe. Last words for this day. Im really happy that the upload runs with the same function from functions.php, so my mogrify resizes pics greater than the allowed value and no +++++ of user could destroy the tables with to heavy stuff uploaded ;-)
Maybe in two or three days i could show my HotOrNot-Hack with all the same functions from the original and some more.
If someone is interested pm me, think i will not have the time to make clear instructions on this.
Oblivion Knight
08-19-2003, 06:40 AM
The edit button is your friend.. ;)
Thanks for your contribution towards making the mod work how others have requested though!
Slynderdale
08-19-2003, 05:07 PM
I already fixed the problem where the private attachment stayed on the server even when the private messsage is deleted. It also checks to see if theres more them one private message that has it.
See the following post:
https://vborg.vbsupport.ru/showthread.php?postid=360835#post360835
glenmax
08-29-2003, 01:47 AM
I seem to have a small problem with this...
I installed this great hack about 6 months ago and it ran fine. Until 4 days ago. It just seemed to stop.
I never installed the delete attachment fix, so could there be an issue with there being too many files hanging around?
If so, how can I change this?
If that is not the case then, how can I go about correcting this problem.
Any suggestions would be great.
Cheers.
gengar003
08-30-2003, 06:24 PM
09-28-02 at 01:48 PM TheComputerGuy said this in Post #65 (https://vborg.vbsupport.ru/showthread.php?postid=303529#post303529)
Hi I am having the same problem as IceMalee...I get some database errors at line 1
Invalid SQL: INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid,receipt,attachmentid) VALUES (NULL,1,1,1,'test','test',1033217057,'0','0',0,0,1 ,)
mysql error: You have an error in your SQL syntax near ')' at line 1
Any help would be great.
How was this fixed?
Robert9
09-01-2003, 11:12 PM
Sorry, dont know your code and be very in hassle with some other stuff, the error comes from the last value not set
see:
... 0,0,1,)
It seems there is no attachmentid passed, try to set the variable in '', so if nothing is here, it will be a 0 because of the default in mysql.
*removed links as they contained adult pics*
gengar003
09-02-2003, 12:43 AM
But I KNOW where the problem resides; WHY does it happen and HOW can i fix it? I can't figure it out... and the default is set to "0"
gengar003
09-16-2003, 12:07 PM
*bump*
glenmax
10-06-2003, 12:35 AM
I have been seeing some funny. Not sure if anyone has seen it or if there is just a simple solution,
We have been noticing that any files over 150kb do not get processed.
Any thoughts?
Thanks,
G
torqueroll
11-11-2003, 12:23 AM
Will this work ok with version 2.3.2?
Thanks!
In case anyone is curious, this works great on 2.3.3. The only issue I'm having is the same I mentioned before... the friggn' paperclip.gif image won't show up. Grrr. It's a minor issue, though.
h?kkiz
01-02-2004, 10:42 PM
Very nice hack, and very easy to install! thanks! :)
Keith
01-06-2004, 07:25 PM
Chen, would any of the code in your hack (including the table setup queries) affect the logic used to kick off a new PM popup notification? I'm trying to troubleshoot why users aren't getting a PM notification popup anymore. We are getting email notification.
So far I've checked code in global.php, and forums/admin/functions.php and it all looks right. So does the headinclude file with the $headnewpm
Loading up private.php also shows an unterminated string constant as well, but I don't believe that to be related. Thanks in advance for any ideas.
pigsy
01-22-2004, 05:35 PM
Great hack,
But if I install it and we then decide to upgrade to v.3 - will all the members then lose their attachments?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.