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)

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/forum...essageid=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 :(

----

Quote:

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

Quote:

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 Code:

<?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/for...atemessageid=5
Referer: http://www.totalshock.net/forums/pri...atemessageid=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/showthrea...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:
PHP Code:

// **************************************** \\
// *** 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']) != 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:
PHP Code:

// **************************************** \\
// *** 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']) != 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

CJi 08-04-2002 10:34 AM

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

Quote:

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

Quote:

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
PHP Code:

Invalid SQLINSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid,receipt,attachmentidVALUES (NULL,1,1,1,'test','test',1033217057,'0','0',0,0,1,)
mysql errorYou 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

VAN 11-05-2002 01:09 AM

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?...age&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

Quote:

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

Quote:

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

VAN 11-05-2002 10:39 PM

Quote:

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:
PHP Code:

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!

VAN 11-06-2002 04:59 AM

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

Quote:

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...age&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
Code:

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


All times are GMT. The time now is 04:21 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.01340 seconds
  • Memory Usage 1,874KB
  • 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
  • (5)bbcode_php_printable
  • (8)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