| ############################################################################### |
| ############################################################################### |
| # Downloads.pl # |
| # Downloads.pl # |
| ############################################################################### |
| ############################################################################### |
| # YaBB: Yet another Bulletin Board # |
| # YaBB: Yet another Bulletin Board # |
| # Open-Source Community Software for Webmasters # |
| # Open-Source Community Software for Webmasters # |
| # Version: YaBB 2.5 Anniversary Edition # |
| # Version: YaBB 2.5.2 # |
| # Packaged: July 04, 2010 # |
| # Packaged: September 30, 2012 # |
| # Distributed by: http://www.yabbforum.com # |
| # Distributed by: http://www.yabbforum.com # |
| # =========================================================================== # |
| # =========================================================================== # |
| # Copyright (c) 2000-2010 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Software by: The YaBB Development Team # |
| # Software by: The YaBB Development Team # |
| # with assistance from the YaBB community. # |
| # with assistance from the YaBB community. # |
| # Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com #
|
| |
| # Your source for web hosting, web design, and domains. #
|
| |
| ############################################################################### |
| ############################################################################### |
| |
| |
| $downloadsplver = 'YaBB 2.5 AE $Revision: 1.3 $'; |
| $downloadsplver = 'YaBB 2.5.2 $Revision: 1.1 $'; |
| if ($action eq 'detailedversion') { return 1; } |
| if ($action eq 'detailedversion') { return 1; } |
| |
| |
| sub DownloadView { |
| sub DownloadView { |
| &fatal_error("members_only") if $guest_media_disallowed && $iamguest; |
| &fatal_error("members_only") if $guest_media_disallowed && $iamguest; |
|
|
| |
| &LoadLanguage('FA'); |
| &LoadLanguage('FA'); |
|
|
| |
| &print_output_header; |
| &print_output_header; |
| |
| |
| $output = qq~<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| $output = qq~<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <head> |
| <head> |
| <title>$fatxt{'39'}</title> |
| <title>$fatxt{'39'}</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=$yycharset" /> |
| <meta http-equiv="Content-Type" content="text/html; charset=$yycharset" /> |
| <link rel="stylesheet" href="$forumstylesurl/$usestyle.css" type="text/css" /> |
| <link rel="stylesheet" href="$forumstylesurl/$usestyle.css" type="text/css" /> |
| |
| |
| <script language="JavaScript1.2" type="text/javascript"> |
| <script language="JavaScript1.2" type="text/javascript"> |
| <!-- |
| <!-- |
| function download_file(amfn) { |
| function download_file(amfn) { |
| window.open('$scripturl?action=downloadfile;file=' + amfn,'_blank'); |
| window.open('$scripturl?action=downloadfile;file=' + encodeURIComponent(amfn),'_blank'); |
| self.setTimeout('location.reload()', 3000); |
| self.setTimeout('location.reload()', 3000); |
| } |
| } |
| function load_thread(amthreadid,amreplies) { |
| function load_thread(amthreadid,amreplies) { |
| try{ |
| try{ |
| if (typeof(opener.document) == 'object') throw '1'; |
| if (typeof(opener.document) == 'object') throw '1'; |
| else throw '0'; |
| else throw '0'; |
| } catch (e) { |
| } catch (e) { |
| if (amreplies > 0 || ~ . ((($ttsureverse && ${$uid.$username}{'reversetopic'}) || $ttsreverse) ? 1 : 0) . qq~ == 1) amreplies = '/' + amreplies + '#' + amreplies; |
| if (amreplies > 0 || ~ . ((($ttsureverse && ${$uid.$username}{'reversetopic'}) || $ttsreverse) ? 1 : 0) . qq~ == 1) amreplies = '/' + amreplies + '#' + amreplies; |
| else amreplies = ''; |
| else amreplies = ''; |
| if (e == 1) { |
| if (e == 1) { |
| opener.location.href='$scripturl?num=' + amthreadid + amreplies; |
| opener.location.href='$scripturl?num=' + amthreadid + amreplies; |
| self.close(); |
| self.close(); |
| } else { |
| } else { |
| location.href='$scripturl?num=' + amthreadid + amreplies; |
| location.href='$scripturl?num=' + amthreadid + amreplies; |
| } |
| } |
| } |
| } |
| } |
| } |
| // --> |
| // --> |
| </script> |
| </script> |
| </head> |
| </head> |
| <body> |
| <body> |
| <a name="pagetop"> </a><br /> |
| <a name="pagetop"> </a><br /> |
| <div id="maincontainer"> |
| <div id="maincontainer"> |
| <div id="container"> |
| <div id="container"> |
| <br /> |
| <br /> |
| <br />~; |
| <br />~; |
| |
| |
| |
| |
| my $thread = $INFO{'thread'}; |
| my $thread = $INFO{'thread'}; |
| unless (ref($thread_arrayref{$thread})) { |
| unless (ref($thread_arrayref{$thread})) { |
| fopen(MSGTXT, "$datadir/$thread.txt") || &fatal_error("cannot_open","$datadir/$thread.txt", 1); |
| fopen(MSGTXT, "$datadir/$thread.txt") || &fatal_error("cannot_open","$datadir/$thread.txt", 1); |
| @{$thread_arrayref{$thread}} = <MSGTXT>; |
| @{$thread_arrayref{$thread}} = <MSGTXT>; |
| fclose(MSGTXT); |
| fclose(MSGTXT); |
| } |
| } |
| my $threadname = (split(/\|/, ${$thread_arrayref{$thread}}[0], 2))[0]; |
| my $threadname = (split(/\|/, ${$thread_arrayref{$thread}}[0], 2))[0]; |
| my @attachinput = map { split(/,/, (split(/\|/, $_))[12]) } @{$thread_arrayref{$thread}}; |
| my @attachinput = map { split(/,/, (split(/\|/, $_))[12]) } @{$thread_arrayref{$thread}}; |
| chomp(@attachinput); |
| chomp(@attachinput); |
| |
| |
| my (%attachinput,$viewattachments); |
| my (%attachinput,$viewattachments); |
| map { $attachinput{$_} = 1; } @attachinput; |
| map { $attachinput{$_} = 1; } @attachinput; |
| |
| |
| fopen(AML, "$vardir/attachments.txt") || &fatal_error("cannot_open","$vardir/attachments.txt", 1); |
| fopen(AML, "$vardir/attachments.txt") || &fatal_error("cannot_open","$vardir/attachments.txt", 1); |
| @attachinput = grep { $_ =~ /$thread\|.+\|(.+)\|\d+\s+/ && exists $attachinput{$1} } <AML>; |
| @attachinput = grep { $_ =~ /$thread\|.+\|(.+)\|\d+\s+/ && exists $attachinput{$1} } <AML>; |
| fclose(AML); |
| fclose(AML); |
| |
| |
| my $max = @attachinput; |
| my $max = @attachinput; |
| |
| |
| my $sort = $INFO{'sort'} || ((($ttsureverse && ${$uid.$username}{'reversetopic'}) || $ttsreverse) ? -1 : 1); |
| my $sort = $INFO{'sort'} || ((($ttsureverse && ${$uid.$username}{'reversetopic'}) || $ttsreverse) ? -1 : 1); |
| my $newstart = $INFO{'newstart'} || 0; |
| my $newstart = $INFO{'newstart'} || 0; |
| |
| |
| my $colspan = ($iamadmin || $iamgmod) ? 8 : 7; |
| my $colspan = ($iamadmin || $iamgmod) ? 8 : 7; |
| if (!$max) { |
| if (!$max) { |
| $viewattachments .= qq~<tr><td align="center" class="windowbg2" colspan="$colspan"><b><i>$fatxt{'48'}</i></b></td></tr> |
| $viewattachments .= qq~<tr><td align="center" class="windowbg2" colspan="$colspan"><b><i>$fatxt{'48'}</i></b></td></tr> |
| <tr><td align="center" class="catbg" colspan="$colspan"><a href="javascript:try{if(typeof(opener.document)=='object'){throw '1';}else{throw '0';}}catch (e){if(e==1) {opener.location.href='$scripturl?num=$thread';self.close();}else{location.href='$scripturl?num=$thread';}}">$fatxt{'70'} "<i>$threadname</i>"</a> | <a href="javascript:window.close();">$fatxt{'71'}</a></td></tr>~; |
| <tr><td align="center" class="catbg" colspan="$colspan"><a href="javascript:try{if(typeof(opener.document)=='object'){throw '1';}else{throw '0';}}catch (e){if(e==1) {opener.location.href='$scripturl?num=$thread';self.close();}else{location.href='$scripturl?num=$thread';}}">$fatxt{'70'} "<i>$threadname</i>"</a> | <a href="javascript:window.close();">$fatxt{'71'}</a></td></tr>~; |
| |
| |
| } else { |
| } else { |
| if ($iamadmin || $iamgmod) { |
| if ($iamadmin || $iamgmod) { |
| &LoadLanguage('Admin'); |
| &LoadLanguage('Admin'); |
| |
| |
| $output .= qq~ |
| $output .= qq~ |
| <script language="JavaScript1.2" type="text/javascript"> |
| <script language="JavaScript1.2" type="text/javascript"> |
| <!-- |
| <!-- |
| function checkAll() { |
| function checkAll() { |
| for (var i = 0; i < document.del_attachments.elements.length; i++) { |
| for (var i = 0; i < document.del_attachments.elements.length; i++) { |
| document.del_attachments.elements[i].checked = true; |
| document.del_attachments.elements[i].checked = true; |
| } |
| } |
| } |
| } |
| function uncheckAll() { |
| function uncheckAll() { |
| for (var i = 0; i < document.del_attachments.elements.length; i++) { |
| for (var i = 0; i < document.del_attachments.elements.length; i++) { |
| document.del_attachments.elements[i].checked = false; |
| document.del_attachments.elements[i].checked = false; |
| } |
| } |
| } |
| } |
| function verify_delete() { |
| function verify_delete() { |
| for (var i = 0; i < document.del_attachments.elements.length; i++) { |
| for (var i = 0; i < document.del_attachments.elements.length; i++) { |
| if (document.del_attachments.elements[i].checked == true) { |
| if (document.del_attachments.elements[i].checked == true) { |
| Check = confirm('$fatxt{'46a'}'); |
| Check = confirm('$fatxt{'46a'}'); |
| if (Check==true) document.del_attachments.action = '$adminurl?action=deleteattachment'; |
| if (Check==true) document.del_attachments.action = '$adminurl?action=deleteattachment'; |
| break; |
| break; |
| } |
| } |
| } |
| } |
| } |
| } |
| //--> |
| //--> |
| </script> |
| </script> |
| <form name="del_attachments" action="$scripturl?action=viewdownloads;thread=$thread" method="post" style="display: inline;" onsubmit="verify_delete();">~; |
| <form name="del_attachments" action="$scripturl?action=viewdownloads;thread=$thread" method="post" style="display: inline;" onsubmit="verify_delete();">~; |
| |
| |
| } else { |
| } else { |
| $output .= qq~ |
| $output .= qq~ |
| <form action="$scripturl?action=viewdownloads;thread=$thread" method="post" style="display: inline;">~; |
| <form action="$scripturl?action=viewdownloads;thread=$thread" method="post" style="display: inline;">~; |
| } |
| } |
| $output .= qq~ |
| $output .= qq~ |
| <input type="hidden" name="oldsort" value="$sort" /> |
| <input type="hidden" name="oldsort" value="$sort" /> |
| <input type="hidden" name="formsession" value="$formsession" />~; |
| <input type="hidden" name="formsession" value="$formsession" />~; |
| |
| |
| my @attachments; |
| my @attachments; |
| if ($sort > 0) { # sort ascending |
| if ($sort > 0) { # sort ascending |
| if ($sort == 1 || $sort == 5 || $sort == 6 || $sort == 8) { |
| if ($sort == 1 || $sort == 5 || $sort == 6 || $sort == 8) { |
| @attachments = sort { (split(/\|/, $a))[$sort] <=> (split(/\|/, $b))[$sort]; } @attachinput; # sort size, date, count numerically |
| @attachments = sort { (split(/\|/, $a))[$sort] <=> (split(/\|/, $b))[$sort]; } @attachinput; # sort size, date, count numerically |
| } elsif ($sort == 100) { |
| } elsif ($sort == 100) { |
| @attachments = sort { lc((split(/\./, (split(/\|/, $a))[7]))[1]) cmp lc((split(/\./, (split(/\|/, $b))[7]))[1]); } @attachinput; # sort extension lexically |
| @attachments = sort { lc((split(/\./, (split(/\|/, $a))[7]))[1]) cmp lc((split(/\./, (split(/\|/, $b))[7]))[1]); } @attachinput; # sort extension lexically |
| } else { |
| } else { |
| @attachments = sort { lc((split(/\|/, $a))[$sort]) cmp lc((split(/\|/, $b))[$sort]); } @attachinput; # sort lexically |
| @attachments = sort { lc((split(/\|/, $a))[$sort]) cmp lc((split(/\|/, $b))[$sort]); } @attachinput; # sort lexically |
| } |
| } |
| } else { # sort descending |
| } else { # sort descending |
| if ($sort == -1 || $sort == -5 || $sort == -6 || $sort == -8) { |
| if ($sort == -1 || $sort == -5 || $sort == -6 || $sort == -8) { |
| @attachments = sort { (split(/\|/, $b))[-$sort] <=> (split(/\|/, $a))[-$sort]; } @attachinput; # sort size, date, count numerically |
| @attachments = sort { (split(/\|/, $b))[-$sort] <=> (split(/\|/, $a))[-$sort]; } @attachinput; # sort size, date, count numerically |
| } elsif ($sort == -100) { |
| } elsif ($sort == -100) { |
| @attachments = sort { lc((split(/\./, (split(/\|/, $b))[7]))[1]) cmp lc((split(/\./, (split(/\|/, $a))[7]))[1]); } @attachinput; # sort extension lexically |
| @attachments = sort { lc((split(/\./, (split(/\|/, $b))[7]))[1]) cmp lc((split(/\./, (split(/\|/, $a))[7]))[1]); } @attachinput; # sort extension lexically |
| } else { |
| } else { |
| @attachments = sort { lc((split(/\|/, $b))[-$sort]) cmp lc((split(/\|/, $a))[-$sort]); } @attachinput; # sort lexically |
| @attachments = sort { lc((split(/\|/, $b))[-$sort]) cmp lc((split(/\|/, $a))[-$sort]); } @attachinput; # sort lexically |
| } |
| } |
| } |
| } |
| |
| |
| $postdisplaynum = 8; |
| $postdisplaynum = 8; |
| $newstart = (int($newstart / 25)) * 25; |
| $newstart = (int($newstart / 25)) * 25; |
| $tmpa = 1; |
| $tmpa = 1; |
| if ($newstart >= (($postdisplaynum - 1) * 25)) { $startpage = $newstart - (($postdisplaynum - 1) * 25); $tmpa = int( $startpage / 25 ) + 1; } |
| if ($newstart >= (($postdisplaynum - 1) * 25)) { $startpage = $newstart - (($postdisplaynum - 1) * 25); $tmpa = int( $startpage / 25 ) + 1; } |
| if ($max >= $newstart + ($postdisplaynum * 25)) { $endpage = $newstart + ($postdisplaynum * 25); } else { $endpage = $max; } |
| if ($max >= $newstart + ($postdisplaynum * 25)) { $endpage = $newstart + ($postdisplaynum * 25); } else { $endpage = $max; } |
| if ($startpage > 0) { $pageindex = qq~<a href="$scripturl?action=downloadfile;newstart=0;sort=$sort" style="font-weight: normal;">1</a> ... ~; } |
| if ($startpage > 0) { $pageindex = qq~<a href="$scripturl?action=downloadfile;newstart=0;sort=$sort" style="font-weight: normal;">1</a> ... ~; } |
| if ($startpage == 25) { $pageindex = qq~<a href="$scripturl?action=downloadfile;newstart=0;sort=$sort" style="font-weight: normal;">1</a> ~;} |
| if ($startpage == 25) { $pageindex = qq~<a href="$scripturl?action=downloadfile;newstart=0;sort=$sort" style="font-weight: normal;">1</a> ~;} |
| for ($counter = $startpage; $counter < $endpage; $counter += 25) { |
| for ($counter = $startpage; $counter < $endpage; $counter += 25) { |
| $pageindex .= $newstart == $counter ? qq~<b>$tmpa</b> ~ : qq~<a href="$scripturl?action=downloadfile;newstart=$counter;sort=$sort" style="font-weight: normal;">$tmpa</a> ~; |
| $pageindex .= $newstart == $counter ? qq~<b>$tmpa</b> ~ : qq~<a href="$scripturl?action=downloadfile;newstart=$counter;sort=$sort" style="font-weight: normal;">$tmpa</a> ~; |
| $tmpa++; |
| $tmpa++; |
| } |
| } |
| $lastpn = int($max / 25) + 1; |
| $lastpn = int($max / 25) + 1; |
| $lastptn = ($lastpn - 1) * 25; |
| $lastptn = ($lastpn - 1) * 25; |
| if ($endpage < $max - (25) ) { $pageindexadd = qq~... ~; } |
| if ($endpage < $max - (25) ) { $pageindexadd = qq~... ~; } |
| if ($endpage != $max) { $pageindexadd .= qq~<a href="$scripturl?action=downloadfile;newstart=$lastptn;sort=$sort">$lastpn</a>~; } |
| if ($endpage != $max) { $pageindexadd .= qq~<a href="$scripturl?action=downloadfile;newstart=$lastptn;sort=$sort">$lastpn</a>~; } |
| $pageindex .= $pageindexadd; |
| $pageindex .= $pageindexadd; |
| |
| |
| $pageindex = qq~<div class="small" style="text-align: right;">$fatxt{'64'}: $pageindex</div>~; |
| $pageindex = qq~<div class="small" style="text-align: right;">$fatxt{'64'}: $pageindex</div>~; |
| |
| |
| $numbegin = ($newstart + 1); |
| $numbegin = ($newstart + 1); |
| $numend = ($newstart + 25); |
| $numend = ($newstart + 25); |
| if ($numend > $max) { $numend = $max; } |
| if ($numend > $max) { $numend = $max; } |
| if ($max == 0) { $numshow = ''; } |
| if ($max == 0) { $numshow = ''; } |
| else { $numshow = qq~($numbegin - $numend)~; } |
| else { $numshow = qq~($numbegin - $numend)~; } |
| |
| |
| my (%attach_gif,$ext); |
| my (%attach_gif,$ext); |
| foreach $row (splice(@attachments, $newstart, 25)) { |
| foreach $row (splice(@attachments, $newstart, 25)) { |
| chomp $row; |
| chomp $row; |
| my ($amthreadid, $amreplies, $amthreadsub, $amposter, $amcurrentboard, $amkb, $amdate, $amfn, $amcount) = split(/\|/, $row); |
| my ($amthreadid, $amreplies, $amthreadsub, $amposter, $amcurrentboard, $amkb, $amdate, $amfn, $amcount) = split(/\|/, $row); |
| |
| |
| $amfn =~ /\.(.+?)$/; |
| $amfn =~ /\.(.+?)$/; |
| $ext = $1; |
| $ext = $1; |
| unless (exists $attach_gif{$ext}) { |
| unless (exists $attach_gif{$ext}) { |
| $attach_gif{$ext} = ($ext && -e "$forumstylesdir/$useimages/$ext.gif") ? "$ext.gif" : "paperclip.gif"; |
| $attach_gif{$ext} = ($ext && -e "$forumstylesdir/$useimages/$ext.gif") ? "$ext.gif" : "paperclip.gif"; |
| } |
| } |
| |
| |
| $amdate = &timeformat($amdate); |
| $amdate = &timeformat($amdate); |
| if (length($amthreadsub) > 20) { $amthreadsub = substr($amthreadsub, 0, 20) . "..."; } |
| if (length($amthreadsub) > 20) { $amthreadsub = substr($amthreadsub, 0, 20) . "..."; } |
| |
| |
| $viewattachments .= qq~<tr>~ . (($iamadmin || $iamgmod) ? qq~ |
| $viewattachments .= qq~<tr>~ . (($iamadmin || $iamgmod) ? qq~ |
| <td class="windowbg2" align="center" valign="middle"><input type="checkbox" name="del_$thread" value="$amfn" /></td>~ : '') . qq~ |
| <td class="windowbg2" align="center" valign="middle"><input type="checkbox" name="del_$thread" value="$amfn" /></td>~ : '') . qq~ |
| <td class="windowbg2" align="left" valign="middle"><a href="javascript:void(download_file('$amfn'));"> $amfn</a></td> |
| <td class="windowbg2" align="left" valign="middle"><a href="javascript:void(download_file('$amfn'));"> $amfn</a></td> |
| <td class="windowbg2" align="center" valign="middle"><img src="$imagesdir/$attach_gif{$ext}" border="0" align="bottom" alt="" /></td> |
| <td class="windowbg2" align="center" valign="middle"><img src="$imagesdir/$attach_gif{$ext}" border="0" align="bottom" alt="" /></td> |
| <td class="windowbg2" align="right" valign="middle">$amkb KB</td> |
| <td class="windowbg2" align="right" valign="middle">$amkb KB</td> |
| <td class="windowbg2" align="center" valign="middle">$amdate</td> |
| <td class="windowbg2" align="center" valign="middle">$amdate</td> |
| <td class="windowbg2" align="right" valign="middle">$amcount</td> |
| <td class="windowbg2" align="right" valign="middle">$amcount</td> |
| <td class="windowbg2" align="left" valign="middle"><a href="javascript:load_thread('$thread','$amreplies');">$amthreadsub</a></td> |
| <td class="windowbg2" align="left" valign="middle"><a href="javascript:load_thread('$thread','$amreplies');">$amthreadsub</a></td> |
| <td class="windowbg2" align="center" valign="middle">$amposter</td> |
| <td class="windowbg2" align="center" valign="middle">$amposter</td> |
| </tr> |
| </tr> |
| ~; |
| ~; |
| } |
| } |
| |
| |
| $viewattachments .= qq~<tr>~ . (($iamadmin || $iamgmod) ? qq~ |
| $viewattachments .= qq~<tr>~ . (($iamadmin || $iamgmod) ? qq~ |
| <td class="catbg" align="center"> |
| <td class="catbg" align="center"> |
| <input type="checkbox" name="checkall" value="" onclick="if(this.checked){checkAll();}else{uncheckAll();}" /> |
| <input type="checkbox" name="checkall" value="" onclick="if(this.checked){checkAll();}else{uncheckAll();}" /> |
| </td>~ : '') . qq~ |
| </td>~ : '') . qq~ |
| <td class="catbg" colspan="7"> |
| <td class="catbg" colspan="7"> |
| <table width="100%"> |
| <table width="100%"> |
| <colgroup> |
| <colgroup> |
| <col width="33%" /> |
| <col width="33%" /> |
| <col width="34%" /> |
| <col width="34%" /> |
| <col width="33%" /> |
| <col width="33%" /> |
| </colgroup> |
| </colgroup> |
| <tr> |
| <tr> |
| <td align="left" valign="middle" class="small">~ . (($iamadmin || $iamgmod) ? qq~<= $amv_txt{'38'} <input type="submit" value="$admin_txt{'32'}" class="button" />~ : ' ') . qq~</td> |
| <td align="left" valign="middle" class="small">~ . (($iamadmin || $iamgmod) ? qq~<= $amv_txt{'38'} <input type="submit" value="$admin_txt{'32'}" class="button" />~ : ' ') . qq~</td> |
| <td align="center" valign="middle" nowrap="nowrap"> <a href="javascript:load_thread('$thread',0);">$fatxt{'70'} "<i>$threadname</i>"</a> | <a href="javascript:window.close();">$fatxt{'71'}</a> </td> |
| <td align="center" valign="middle" nowrap="nowrap"> <a href="javascript:load_thread('$thread',0);">$fatxt{'70'} "<i>$threadname</i>"</a> | <a href="javascript:window.close();">$fatxt{'71'}</a> </td> |
| <td align="right" valign="middle" class="small">$pageindex</td> |
| <td align="right" valign="middle" class="small">$pageindex</td> |
| </tr> |
| </tr> |
| </table> |
| </table> |
| </td> |
| </td> |
| </tr>~; |
| </tr>~; |
| |
| |
| $output .= qq~ |
| $output .= qq~ |
| <input type="hidden" name="newstart" value="$newstart" />~; |
| <input type="hidden" name="newstart" value="$newstart" />~; |
| } |
| } |
| |
| |
| my $class_sortattach = $sort =~ /7/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortattach = $sort =~ /7/ ? 'windowbg2' : 'windowbg'; |
| my $class_sorttype = $sort =~ /100/ ? 'windowbg2' : 'windowbg'; |
| my $class_sorttype = $sort =~ /100/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortsize = $sort =~ /5/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortsize = $sort =~ /5/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortdate = $sort =~ /6/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortdate = $sort =~ /6/ ? 'windowbg2' : 'windowbg'; |
| my $class_sorcount = $sort =~ /8/ ? 'windowbg2' : 'windowbg'; |
| my $class_sorcount = $sort =~ /8/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortsubj = $sort =~ /1$/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortsubj = $sort =~ /1$/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortuser = $sort =~ /3/ ? 'windowbg2' : 'windowbg'; |
| my $class_sortuser = $sort =~ /3/ ? 'windowbg2' : 'windowbg'; |
| |
| |
| $output .= qq~ |
| $output .= qq~ |
| <table border="0" cellspacing="1" cellpadding="8" class="bordercolor" align="center" width="90%"> |
| <table border="0" cellspacing="1" cellpadding="8" class="bordercolor" align="center" width="90%"> |
| <tr> |
| <tr> |
| <td class="titlebg" colspan="$colspan"> |
| <td class="titlebg" colspan="$colspan"> |
| <img src="$imagesdir/xx.gif" alt="" border="0" /> <b>$fatxt{'39'}</b> |
| <img src="$imagesdir/xx.gif" alt="" border="0" /> <b>$fatxt{'39'}</b> |
| </td> |
| </td> |
| </tr><tr> |
| </tr><tr> |
| <td class="windowbg" colspan="$colspan" align="center" width="100%"> |
| <td class="windowbg" colspan="$colspan" align="center" width="100%"> |
| <br /> |
| <br /> |
| $fatxt{'75'}:<br /> |
| $fatxt{'75'}:<br /> |
| "<i>$threadname</i>"<br /> |
| "<i>$threadname</i>"<br /> |
| <br /> |
| <br /> |
| <span class="small">$fatxt{'76'}</span> |
| <span class="small">$fatxt{'76'}</span> |
| <br /> |
| <br /> |
| </td> |
| </td> |
| </tr><tr> |
| </tr><tr> |
| <td class="titlebg" colspan="$colspan" width="100%"> |
| <td class="titlebg" colspan="$colspan" width="100%"> |
| <div class="small" style="float: left; text-align: left;">$fatxt{'28'} $max $numshow</div> |
| <div class="small" style="float: left; text-align: left;">$fatxt{'28'} $max $numshow</div> |
| $pageindex |
| $pageindex |
| </td> |
| </td> |
| </tr> |
| </tr> |
| <tr>~ . (($iamadmin || $iamgmod) ? qq~ |
| <tr>~ . (($iamadmin || $iamgmod) ? qq~ |
| <td align="center" class="windowbg"><b>$fatxt{'45'}</b></td>~ : '') . qq~ |
| <td align="center" class="windowbg"><b>$fatxt{'45'}</b></td>~ : '') . qq~ |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 7 ? -7 : 7) . qq~';" align="center" class="$class_sortattach" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 7 ? -7 : 7) . qq~"><b>$fatxt{'40'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 7 ? -7 : 7) . qq~';" align="center" class="$class_sortattach" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 7 ? -7 : 7) . qq~"><b>$fatxt{'40'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 100 ? -100 : 100) . qq~';" align="center" class="$class_sorttype" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 100 ? -100 : 100) . qq~"><b>$fatxt{'40a'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 100 ? -100 : 100) . qq~';" align="center" class="$class_sorttype" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 100 ? -100 : 100) . qq~"><b>$fatxt{'40a'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -5 ? 5 : -5) . qq~';" align="center" class="$class_sortsize" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -5 ? 5 : -5) . qq~"><b>$fatxt{'41'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -5 ? 5 : -5) . qq~';" align="center" class="$class_sortsize" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -5 ? 5 : -5) . qq~"><b>$fatxt{'41'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -6 ? 6 : -6) . qq~';" align="center" class="$class_sortdate" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -6 ? 6 : -6) . qq~"><b>$fatxt{'43'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -6 ? 6 : -6) . qq~';" align="center" class="$class_sortdate" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -6 ? 6 : -6) . qq~"><b>$fatxt{'43'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -8 ? 8 : -8) . qq~';" align="center" class="$class_sorcount" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -8 ? 8 : -8) . qq~"><b>$fatxt{'41a'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -8 ? 8 : -8) . qq~';" align="center" class="$class_sorcount" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == -8 ? 8 : -8) . qq~"><b>$fatxt{'41a'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 1 ? -1 : 1) . qq~';" align="center" class="$class_sortsubj" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 1 ? -1 : 1) . qq~"><b>$fatxt{'44'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 1 ? -1 : 1) . qq~';" align="center" class="$class_sortsubj" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 1 ? -1 : 1) . qq~"><b>$fatxt{'44'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 3 ? -3 : 3) . qq~';" align="center" class="$class_sortuser" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 3 ? -3 : 3) . qq~"><b>$fatxt{'42'}</b></a></td> |
| <td onclick="location.href='$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 3 ? -3 : 3) . qq~';" align="center" class="$class_sortuser" style="border: 0px; border-style: outset; cursor: pointer;"><a href="$scripturl?action=viewdownloads;thread=$thread;sort=~ . ($sort == 3 ? -3 : 3) . qq~"><b>$fatxt{'42'}</b></a></td> |
| </tr> |
| </tr> |
| $viewattachments |
| $viewattachments |
| </table>~; |
| </table>~; |
| |
| |
| $output .= '</form>' if $max && ($iamadmin || $iamgmod); |
| $output .= '</form>' if $max && ($iamadmin || $iamgmod); |
| |
| |
| $output .= qq~ |
| $output .= qq~ |
| <br /> |
| <br /> |
| <br /> |
| <br /> |
| </div> |
| </div> |
| </div> |
| </div> |
| </body> |
| </body> |
| </html>~; |
| </html>~; |
| |
| |
| &print_HTML_output_and_finish; |
| &print_HTML_output_and_finish; |
| } |
| } |
| |
| |
| sub DownloadFileCouter { |
| sub DownloadFileCouter { |
| $dfile = $INFO{'file'}; |
| $dfile = $INFO{'file'}; |
| |
| |
| if ($guest_media_disallowed && $iamguest) { &fatal_error("",$maintxt{'40'}); } |
| if ($guest_media_disallowed && $iamguest) { &fatal_error("",$maintxt{'40'}); } |
| |
| |
| if (!-e "$uploaddir/$dfile") { &fatal_error("","$dfile $maintxt{'23'}"); } |
| if (!-e "$uploaddir/$dfile") { &fatal_error("","$dfile $maintxt{'23'}"); } |
| |
| |
| fopen(ATM, "+<$vardir/attachments.txt", 1) || &fatal_error("cannot_open","$vardir/attachments.txt", 1); |
| fopen(ATM, "+<$vardir/attachments.txt", 1) || &fatal_error("cannot_open","$vardir/attachments.txt", 1); |
| seek ATM, 0, 0; |
| seek ATM, 0, 0; |
| my @attachments = <ATM>; |
| my @attachments = <ATM>; |
| truncate ATM, 0; |
| truncate ATM, 0; |
| seek ATM, 0, 0; |
| seek ATM, 0, 0; |
| for (my $a = 0; $a < @attachments; $a++) { |
| for (my $a = 0; $a < @attachments; $a++) { |
| $attachments[$a] =~ s/(.+\|)(.+)\|(\d+)(\s+)$/ $1 . ($dfile eq $2 ? "$2|" . ($3 + 1) : "$2|$3") . $4 /e; |
| $attachments[$a] =~ s/(.+\|)(.+)\|(\d+)(\s+)$/ $1 . ($dfile eq $2 ? "$2|" . ($3 + 1) : "$2|$3") . $4 /e; |
| } |
| } |
| print ATM @attachments; |
| print ATM @attachments; |
| fclose(ATM); |
| fclose(ATM); |
| |
| |
| print "Location: $uploadurl/$dfile\n\r\n\r"; |
| print "Location: $uploadurl/$dfile\n\r\n\r"; |
| |
| |
| exit; |
| exit; |
| } |
| } |
| |
| |
| 1; |
| 1; |