Add More Attachments 0.1a A hack which allows users to add more that one attachment to there posts, Courtesy of spyderscripts.com @ Boardmod Project Forum. Zarren Spry http://www.norfolklights.net Admin/AdvSettings.pl $imsubject =~ s/\>/>/g; ##########Multiple FA mod. Norfolklights.net########## if ($globalimagecount == 1) { $ics1 = ' selected="selected"'; } elsif ($globalimagecount == 2) { $ics2 = ' selected="selected"'; } elsif ($globalimagecount == 3) { $ics3 = ' selected="selected"'; } elsif ($globalimagecount == 4) { $ics4 = ' selected="selected"'; } elsif ($globalimagecount == 5) { $ics5 = ' selected="selected"'; } elsif ($globalimagecount == 6) { $ics6 = ' selected="selected"'; } elsif ($globalimagecount == 7) { $ics7 = ' selected="selected"'; } elsif ($globalimagecount == 8) { $ics8 = ' selected="selected"'; } elsif ($globalimagecount == 9) { $ics9 = ' selected="selected"'; } elsif ($globalimagecount == 10) { $ics10 = ' selected="selected"'; } else { $ics1 = ' selected="selected"'; } #####END######
$fatxt{'18'}



$fatxt{'61'}


Languages/English/FA.lng ); '61' => "How Many Download boxes displayed?" Sources/Display.pl if ($mfn && $mfn ne "") { if (-e ("$uploaddir/$mfn")) { $attachment = qq~ $mfn~; if (($mfn =~ /(jpg|gif|bmp|png|jpeg)$/i) && ($amdisplaypics == 1)) { $showattach = qq~
$mfn
~; $showattachhr = qq~
~; } else { $showattach = ''; $showattachhr = ''; } } else { $attachment = qq~ $mfn $fatxt{'1'}~; $showattach = ''; $showattachhr = ''; } } else { $attachment = ''; $showattach = ''; $showattachhr = ''; }
##########Multiple FA mod. Norfolklights.net########## my @files = (); @files = split(/[\,]/, $mfn); foreach (@files) { if (-e ("$uploaddir/$_")) { $attachment .= qq~ $_~; if (($_ =~ /(jpg|gif|bmp|png|jpeg)$/i) && ($amdisplaypics == 1)) { $showattach .= qq~
$_
~; $showattachhr = qq~
~; } } else { $attachment .= qq~ $_ $fatxt{'1'}~; } } ####END####
Sources/ModifyMessage.pl } } if ($FORM{'file'} && $FORM{'w_file'} eq "attachnew") { $file = $FORM{'file'}; $OS = $^O; # operating system name if ($OS =~ /darwin/i) { $isUNIX = 1; } elsif ($OS =~ /win/i) { $isWIN = 1; } else { $isUNIX = 1; } $mylimit = 1024 * $limit; $mydirlimit = 1024 * $dirlimit; $fixfile = $filename; $fixfile =~ s/.+\\([^\\]+)$|.+\/([^\/]+)$/$1/; $fixfile =~ s/[#%+,\/:?"<>'|@^!]//g; # edit in between [ ] to include characters you dont want to allow in filenames (dont put a . there or you wont be able to get any file extensions). $fixfile =~ s/ /_/g; # replaces spaces in filenames with a "_" character. # replace . with _ in the filename except for the extension $fixname = $fixfile; $fixname =~ s/(\S+)(\.\S+\Z)/$1/gi; $fixext = $2; $fixext =~ s/(pl|cgi|php)/_$1/gi; $fixname =~ s/\./\_/g; $fixfile = qq~$fixname$fixext~; if ($overwrite == 2 && (-e "$uploaddir/$fixfile")) { &fatal_error("$fatxt{'8'}"); } if (!$overwrite) { $fixfile = check_existence($uploaddir, $fixfile); } if ($checkext == 0) { $match = 1; } else { foreach $ext (@ext) { chomp($ext); if (grep /$ext$/i, $fixfile) { $match = 1; last; } } } if ($match) { if ($allowattach == 1 && (($allowguestattach == 0 && $username ne 'Guest') || $allowguestattach == 1)) { $upload_okay = 1; } } else { &write_error("$fatxt{'20'} @ext ($fixfile)"); } if ($mydirlimit > 0) { &dirstats; } $filesize = $ENV{'CONTENT_LENGTH'} - $postsize; $filesizekb = int($filesize / 1024); if ($filesize > $mylimit && $mylimit != 0) { $filesizediff = $filesizekb - $limit; if ($filesizediff == 1) { $sizevar = "kilobyte"; } else { $sizevar = "kilobytes"; } &write_error("$fatxt{'21'} $filesizediff $sizevar $fatxt{'21b'}"); } elsif ($filesize > $spaceleft && $mydirlimit != 0) { $filesizediff = $filesizekb - $kbspaceleft; if ($filesizediff == 1) { $sizevar = "kilobyte"; } else { $sizevar = "kilobytes"; } &write_error("$fatxt{'22'} $filesizediff $sizevar $fatxt{'22b'}"); } $save_file = "$uploadurl/$fixfile"; if ($upload_okay == 1) { # create a new file on the server using the formatted ( new instance ) filename if (fopen(NEWFILE, ">$uploaddir/$fixfile")) { if ($isWIN) { binmode NEWFILE; } # start reading users HD 1 kb at a time. while (read($filename, $buffer, 1024)) { # print each kb to the new file on the server print NEWFILE $buffer; } # close the new file on the server and we're done fclose(NEWFILE); } else { # return the server's error message if the new file could not be created &fatal_error("$fatxt{'60'} $uploaddir"); } } # check if file has actually been uploaded, by checking the file has a size if (-s "$uploaddir/$fixfile") { $upload_ok = 1; } else { # delete the file as it has no content unlink("$uploaddir/$fixfile"); &fatal_error("$fatxt{'59'} $fixfile"); } if (($fixfile =~ /(jpg|gif|png|jpeg)$/i)) { $okatt = 1; if ($fixfile =~ /(gif)$/i) { fopen(ATTFILE, "$uploaddir/$fixfile"); read(ATTFILE, $header, 10); ($giftest, undef, undef, undef, undef, undef) = unpack("a3a3C4", $header); fclose(ATTFILE); if ($giftest ne "GIF") { $okatt = 0; } } fopen(ATTFILE, "$uploaddir/$fixfile"); while ( read(ATTFILE, $buffer, 1024) ) { if ($buffer =~ /\ } } ##########Multiple FA mod. Norfolklights.net########## my @filelist = (); #Contains only files my @fileMaster = (); #Contains file and place holders for files for ($y=1;$y<=$globalimagecount;++$y) { $file = $query->param("file$y"); $fileAction = $query->param("w_file$y"); $fileOriginal = $query->param("w_filename$y"); #Make sure there is a file, and the user want to attach new, or check that there is no action listed if ($file && ($fileAction eq "attachnew" || !$fileAction)) { $OS = $^O; # operating system name if ($OS =~ /darwin/i) { $isUNIX = 1; } elsif ($OS =~ /win/i) { $isWIN = 1; } else { $isUNIX = 1; } $mylimit = 1024 * $limit; $mydirlimit = 1024 * $dirlimit; $fixfile = $file; $fixfile =~ s/.+\\([^\\]+)$|.+\/([^\/]+)$/$1/; $fixfile =~ s/[#%+,\/:?"<>'|@^!]//g; # edit in between [ ] to include characters you dont want to allow in filenames (dont put a . there or you wont be able to get any file extensions). $fixfile =~ s/ /_/g; # replaces spaces in filenames with a "_" character. # replace . with _ in the filename except for the extension $fixname = $fixfile; $fixname =~ s/(\S+)(\.\S+\Z)/$1/gi; $fixext = $2; $fixext =~ s/(pl|cgi|php)/_$1/gi; $fixname =~ s/\./\_/g; $fixfile = qq~$fixname$fixext~; if ($overwrite == 2 && (-e "$uploaddir/$fixfile")) { &fatal_error("$fatxt{'8'}"); } if (!$overwrite) { $fixfile = check_existence($uploaddir, $fixfile); } if ($checkext == 0) { $match = 1; } else { foreach $ext (@ext) { chomp($ext); if (grep /$ext$/i, $fixfile) { $match = 1; last; } } } if ($match) { if ($allowattach == 1 && (($allowguestattach == 0 && $username ne 'Guest') || $allowguestattach == 1)) { $upload_okay = 1; } } else { &write_error("$fatxt{'20'} @ext ($fixfile)"); } if ($mydirlimit > 0) { &dirstats; } $filesize = $ENV{'CONTENT_LENGTH'} - $postsize; $filesizekb = int($filesize / 1024); if ($filesize > $mylimit && $mylimit != 0) { $filesizediff = $filesizekb - $limit; if ($filesizediff == 1) { $sizevar = "kilobyte"; } else { $sizevar = "kilobytes"; } &write_error("$fatxt{'21'} $filesizediff $sizevar $fatxt{'21b'}"); } elsif ($filesize > $spaceleft && $mydirlimit != 0) { $filesizediff = $filesizekb - $kbspaceleft; if ($filesizediff == 1) { $sizevar = "kilobyte"; } else { $sizevar = "kilobytes"; } &write_error("$fatxt{'22'} $filesizediff $sizevar $fatxt{'22b'}"); } $save_file = "$uploadurl/$fixfile"; if ($upload_okay == 1) { # create a new file on the server using the formatted ( new instance ) filename $upload_filehandle = $query->upload("file".$y); open UPLOADFILE, ">$uploaddir/$fixfile"; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE; } # check if file has actually been uploaded, by checking the file has a size if (-s "$uploaddir/$fixfile") { $upload_ok = 1; } else { unlink("$uploaddir/$fixfile"); &fatal_error("$fatxt{'59'} $fixfile"); } if (($fixfile =~ /(jpg|gif|png|jpeg)$/i)) { $okatt = 1; if ($fixfile =~ /(gif)$/i) { fopen(ATTFILE, "$uploaddir/$fixfile"); read(ATTFILE, $header, 10); ($giftest, undef, undef, undef, undef, undef) = unpack("a3a3C4", $header); fclose(ATTFILE); if ($giftest ne "GIF") { $okatt = 0; } } fopen(ATTFILE, "$uploaddir/$fixfile"); while ( read(ATTFILE, $buffer, 1024) ) { if ($buffer =~ /\ Sources/Post.pl $selnewatt = qq~ onchange="selectNewattach();"~; $selnewatt = qq~ "~; if (($is_preview == 1) && $FORM{'file'}) { if (($is_preview == 1) && $FORM{'file1'}) { } $yymain .= qq~ $fatxt{'6'} $filetype_info
$filesize_info
~; if ($action eq 'modify' && (-e "$uploaddir/$isatt")) { if ($isatt ne "") { $oldattcheck = qq~selected="selected"~; $newattcheck = qq~~; $atistxt = qq~$fatxt{'40'}: $isatt~; } else { $newattcheck = qq~selected="selected"~; $oldattcheck = qq~~; $atistxt = ""; } $yymain .= qq~  $atistxt ~; }
} ############ # Multiple FA, Norfolklights.com ############ if ($action ne 'modify' && $action ne 'modify2') { for ($y=1;$y<=$globalimagecount;++$y) { $yymain .= qq~ $fatxt{'6'} $y: ~; } } $yymain .= qq~ $filetype_info
$filesize_info
~; ############ # Multiple FA, Norfolklights.com ############ if ($action eq 'modify' || $action eq 'modify2'){ @files = split(/[\,]/, $isatt); for ($y=1;$y<=$globalimagecount;++$y) { if ($y <= $#files+1) { $selectAttached = qq~ onchange="selectNewattach($y);"~;; } else { $selectAttached = ""; } $yymain .= qq~ $fatxt{'6'} $y: ~; if (($files[$y-1]) && (-e ("$uploaddir/$files[$y-1]"))) { if ($files[$y-1] ne "") { $oldattcheck = qq~selected="selected"~; $newattcheck = qq~~; $atistxt = qq~$fatxt{'40'}: $files[$y-1]~; } else { $newattcheck = qq~selected="selected"~; $oldattcheck = qq~~; $atistxt = ""; } $yymain .= qq~  $atistxt~; } else { $yymain .= qq~~; } } $yymain .= qq~~; } ###########END###########
} if ($FORM{'file'} ne "") { $file = $FORM{'file'}; $OS = $^O; # operating system name if ($OS =~ /darwin/i) { $isUNIX = 1; } elsif ($OS =~ /win/i) { $isWIN = 1; } else { $isUNIX = 1; } $mylimit = 1024 * $limit; $mydirlimit = 1024 * $dirlimit; $fixfile = $file; $fixfile =~ s/.+\\([^\\]+)$|.+\/([^\/]+)$/$1/; $fixfile =~ s/[\(\)\$#%+,\/:?"<>'\*\;|@^!]//g; # edit in between [ ] to include characters you dont want to allow in filenames (dont put a . there or you wont be able to get any file extensions). $fixfile =~ s/ /_/g; # replaces spaces in filenames with a "_" character. $fixfile =~ s/&//g; # replaces ampersands with nothing. $fixfile =~ s/\+//g; # replaces + with nothing $fixfile =~ s~[^/\\0-9A-Za-z#%+\,\-\ \.\:@^_]~~g; # Remove all inappropriate characters. # replace . with _ in the filename except for the extension $fixname = $fixfile; $fixname =~ s/(\S+)(\.\S+\Z)/$1/gi; $fixext = $2; $fixext =~ s/(pl|cgi|php)/_$1/gi; $fixname =~ s/\./\_/g; $fixfile = qq~$fixname$fixext~; if ($overwrite == 2 && (-e "$uploaddir/$fixfile")) { &fatal_error("$fatxt{'8'}"); } if (!$overwrite) { $fixfile = check_existence($uploaddir, $fixfile); } if ($checkext == 0) { $match = 1; } else { foreach $ext (@ext) { chomp($ext); if (grep /$ext$/i, $fixfile) { $match = 1; last; } } } if ($match) { if ($allowattach == 1 && (($allowguestattach == 0 && $username ne 'Guest') || $allowguestattach == 1)) { $upload_okay = 1; } } else { &Preview("

$fatxt{'20'} @ext ($fixfile)") } if ($mydirlimit > 0) { &dirstats; } $filesize = $ENV{'CONTENT_LENGTH'} - $postsize; $filesizekb = int($filesize / 1024); if ($filesize > $mylimit && $mylimit != 0) { $filesizediff = $filesizekb - $limit; if ($filesizediff == 1) { $sizevar = "kilobyte"; } else { $sizevar = "kilobytes"; } &Preview("

$fatxt{'21'} $filesizediff $sizevar $fatxt{'21b'}") } elsif ($filesize > $spaceleft && $mydirlimit != 0) { $filesizediff = $filesizekb - $kbspaceleft; if ($filesizediff == 1) { $sizevar = "kilobyte"; } else { $sizevar = "kilobytes"; } &Preview("

$fatxt{'22'} $filesizediff $sizevar $fatxt{'22b'}"); } if ($upload_okay == 1) { # create a new file on the server using the formatted ( new instance ) filename if (fopen(NEWFILE, ">$uploaddir/$fixfile")) { if ($isWIN) { binmode NEWFILE; } # start reading users HD. while (<$filename>) { # print to the new file on the server print NEWFILE; } # close the new file on the server and we're done fclose(NEWFILE); } else { # return the server's error message if the new file could not be created &fatal_error("$fatxt{'60'} $uploaddir"); } } # check if file has actually been uploaded, by checking the file has a size if (-s "$uploaddir/$fixfile") { $upload_ok = 1; } else { # delete the file as it has no content unlink("$uploaddir/$fixfile"); &fatal_error("$fatxt{'59'} $fixfile"); } if ($fixfile =~ /(jpg|gif|png|jpeg)$/i) { $okatt = 1; if ($fixfile =~ /(gif)$/i) { fopen(ATTFILE, "$uploaddir/$fixfile"); read(ATTFILE, $header, 10); ($giftest, undef, undef, undef, undef, undef) = unpack("a3a3C4", $header); fclose(ATTFILE); if ($giftest ne "GIF") { $okatt = 0; } } fopen(ATTFILE, "$uploaddir/$fixfile"); while ( read(ATTFILE, $buffer, 1024) ) { if ($buffer =~ /\ } ################# # Multiple FA, Norfolklights.com ################## my @filelist = (); for ($y=1;$y<=$globalimagecount;++$y) { $file = $query->param("file$y"); if ($file ne "") { $OS = $^O; # operating system name if ($OS =~ /darwin/i) { $isUNIX = 1; } elsif ($OS =~ /win/i) { $isWIN = 1; } else { $isUNIX = 1; } $mylimit = 1024 * $limit; $mydirlimit = 1024 * $dirlimit; $fixfile = $file; $fixfile =~ s/.+\\([^\\]+)$|.+\/([^\/]+)$/$1/; $fixfile =~ s/[\(\)\$#%+,\/:?"<>'\*\;|@^!]//g; # edit in between [ ] to include characters you dont want to allow in filenames (dont put a . there or you wont be able to get any file extensions). $fixfile =~ s/ /_/g; # replaces spaces in filenames with a "_" character. $fixfile =~ s/&//g; # replaces ampersands with nothing. $fixfile =~ s/\+//g; # replaces + with nothing $fixfile =~ s~[^/\\0-9A-Za-z#%+\,\-\ \.\:@^_]~~g; # Remove all inappropriate characters. # replace . with _ in the filename except for the extension $fixname = $fixfile; $fixname =~ s/(\S+)(\.\S+\Z)/$1/gi; $fixext = $2; $fixext =~ s/(pl|cgi|php)/_$1/gi; $fixname =~ s/\./\_/g; $fixfile = qq~$fixname$fixext~; if ($overwrite == 2 && (-e "$uploaddir/$fixfile")) { &fatal_error("$fatxt{'8'}"); } if (!$overwrite) { $fixfile = check_existence($uploaddir, $fixfile); } if ($checkext == 0) { $match = 1; } else { foreach $ext (@ext) { chomp($ext); if (grep /$ext$/i, $fixfile) { $match = 1; last; } } } if ($match) { if ($allowattach == 1 && (($allowguestattach == 0 && $username ne 'Guest') || $allowguestattach == 1)) { $upload_okay = 1; } } else { &Preview("

$fatxt{'20'} @ext ($fixfile)") } if ($mydirlimit > 0) { &dirstats; } $filesize = $ENV{'CONTENT_LENGTH'} - $postsize; $filesizekb = int($filesize / 1024); if ($filesize > $mylimit && $mylimit != 0) { $filesizediff = $filesizekb - $limit; if ($filesizediff == 1) { $sizevar = "kilobyte"; } else { $sizevar = "kilobytes"; } &Preview("

$fatxt{'21'} $filesizediff $sizevar $fatxt{'21b'}") } elsif ($filesize > $spaceleft && $mydirlimit != 0) { $filesizediff = $filesizekb - $kbspaceleft; if ($filesizediff == 1) { $sizevar = "kilobyte"; } else { $sizevar = "kilobytes"; } &Preview("

$fatxt{'22'} $filesizediff $sizevar $fatxt{'22b'}"); } if ($upload_okay == 1) { # create a new file on the server using the formatted ( new instance ) filename $upload_filehandle = $query->upload("file".$y); open UPLOADFILE, ">$uploaddir/$fixfile"; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE; } # check if file has actually been uploaded, by checking the file has a size if (-s "$uploaddir/$fixfile") { $upload_ok = 1; } else { # delete every file that has been uploaded foreach (@filelist) { unlink("$uploaddir/$_"); } &fatal_error("$fatxt{'59'} $uploaddir/$fixfile"); } if ($fixfile =~ /(jpg|gif|png|jpeg)$/i) { $okatt = 1; if ($fixfile =~ /(gif)$/i) { fopen(ATTFILE, "$uploaddir/$fixfile"); read(ATTFILE, $header, 10); ($giftest, undef, undef, undef, undef, undef) = unpack("a3a3C4", $header); fclose(ATTFILE); if ($giftest ne "GIF") { $okatt = 0; } } fopen(ATTFILE, "$uploaddir/$fixfile"); while ( read(ATTFILE, $buffer, 1024) ) { if ($buffer =~ /\ Admin/ModList.pl ### END BOARDMOD ANCHOR ### $attachments = "Attachments Mod|Zarren Spry & spyderscripts.com|Allows users to add more than one attachment to their post.|0.1|28-04-2006"; push (@installed_mods, "$attachments");