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)

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:

Quote:

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?

VAN 01-16-2003 11:41 PM

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.

Quote:

$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

Quote:

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

?>


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

updateuserforum($getforuminfo['forumid']); 

WITH
PHP Code:

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

Quote:

03-22-03 at 01:21 AM Steve123 said this in Post #90
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)

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

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

        if ($message['attachmentid'] != 0) {
                $message['attachmentextension'] = strtolower(getextension($message['filename']));
                eval("\$message[attachment] = \"".gettemplate('privmsg_attachment')."\";");
        } else {
                $message['attachment'] = '';
        }

and substitute it with this:
Code:

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

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

if ($what=="delete") {
then substitute the whole block till // end while
with this code.

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/showthrea...835#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

Quote:

09-28-02 at 01:48 PM TheComputerGuy said this in Post #65
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.


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!

VAN 11-22-2003 11:18 PM

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?


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.01579 seconds
  • Memory Usage 1,844KB
  • 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
  • (7)bbcode_code_printable
  • (3)bbcode_php_printable
  • (5)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
  • (38)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