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)

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*


All times are GMT. The time now is 02:50 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.01320 seconds
  • Memory Usage 1,754KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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