#####################################################
#  LEO SuperCool BBS / LeoBBS X / 雷傲極酷超級論壇  #
#####################################################
# 基於山鷹(糊)、花無缺製作的 LB5000 XP 2.30 免費版  #
#   新版程式製作 & 版權所有: 雷傲科技 (C)(R)2004    #
#####################################################
#      主頁地址： http://www.LeoBBS.com/            #
#      論壇地址： http://bbs.LeoBBS.com/            #
#####################################################

    $tempaccess = "forumsallowed". "$inforum";
    $testentry = $query->cookie("$tempaccess");
    if ((($testentry eq $forumpass)&&($testentry ne ""))||($allowedentry{$inforum} eq "yes")||($membercode eq "ad")||($membercode eq 'smo')||($inmembmod eq "yes")) { $allowed = "yes"; }
    if (($privateforum eq "yes") && ($allowed ne "yes")) { &error("複製文章&對不起，您不准許\複製保密論壇的文章！"); }
    &error("普通錯$div_wrong&訪客不能查看文章內容，請註冊或登入後再試") if (($guestregistered eq "off")&&($inmembername eq "訪客"));
    &error("普通錯$div_wrong&訪客不能查看文章內容，請註冊或登入後再試") if ($waterwhenguest eq "yes" && $inmembername eq "訪客");

    open(FILE, "${lbdir}forum$inforum/$intopic.thd.cgi");
    my @threads = <FILE>;
    close(FILE);
    $posttoget = $inpostno - 1;
    ($membername, $topictitle, $postipaddress, $showemoticons, $showsignature ,$postdate, $post) = split(/\t/, $threads[$posttoget]);
    $topictitle =~ s/^＊＃！＆＊//;
    $post =~ s/\<p\>/\n\n/ig;
    $post =~ s/\<br\>/\n/ig;
    
     if (($post=~/LBHIDDEN\[(.*?)\]LBHIDDEN/sg)||($post=~/LBSALE\[(.*?)\]LBSALE/sg)) {
        unless ((lc($inmembername) eq lc($membername))||($mymembercode eq "ad") || ($mymembercode eq 'smo') || ($inmembmod eq "yes")|| ($myrating >= $1)) {
	    &error("複製文章&對不起，您不准許\複製保密文章！");
        }
        else {
	    $post=~ s/LBHIDDEN\[(.*?)\]LBHIDDEN//isg;
	    $post=~ s/LBSALE\[(.*?)\]LBSALE//isg;
	}        	
    }
    &getmember($membername, "no");
    &error("複製文章&對不起，您不准許\複製被屏蔽的文章！") if (($membercode eq "masked")&&($mymembercode ne "ad")&&($mymembercode ne 'smo')&&($inmembmod ne "yes"));

    $post =~ s/\[post=(.+?)\](.+?)\[\/post\]//isg;
    $post =~ s/\[jf=(.+?)\](.+?)\[\/jf\]//isg;
    $post =~ s/\[hide\](.+?)\[\/hide\]//isg;
    $post =~ s/\[watermark\](.+?)\[\/watermark\]/\n\(水印部分不能複製\)\n/isg;
    $post =~ s/\[curl=\s*(http|https|ftp):\/\/(.*?)\s*\]/\[加密連結\]/isg if ($usecurl ne "no");
    $postdate = $postdate + ($timedifferencevalue + $timezone)*3600;
    $postdate = &dateformat("$postdate");
    $rawpost  = $post;
    $rawpost  =~ s/\[hide\](.*)\[\/hide\]//isg; 
    $rawpost =~ s/\[jf=(.+?)\](.+?)\[\/jf\]//isg;
    $rawpost  =~ s/\[post=(.+?)\](.+?)\[\/post\]//isg; 
    $rawpost =~ s/\[DISABLELBCODE\]//isg;
    $rawpost =~ s/\[ADMINOPE=(.+?)\]//isg;
    if ($rawpost =~ /\[POSTISDELETE=(.+?)\]/) {
    	if ($1 ne " ") { $presult = "屏蔽理由：$1"; } else { $presult = "<BR>"; }
        $rawpost = "此文章內容已經被單獨屏蔽！$presult";
    }

    &mischeader("複製文章");

    my $filetoopens = "$lbdir" . "data/onlinedata.cgi";
    $filetoopens = &lockfilename($filetoopens);
    if (!(-e "$filetoopens.lck")) {
	if ($privateforum ne "yes") {
     	    &whosonline("$inmembername\t$forumname\tnone\t複製文章<a href=\"topic.cgi?forum=$inforum&topic=$intopic\"><b>$topictitle</b></a>\t");
	} else {
	    &whosonline("$inmembername\t$forumname(密)\tnone\t複製保密文章\t");
	}
    }

    $temppost = qq~-=-=-=-=-=>\n$rawpost\n-=-=-=-=-=>~;
    $output .= qq~<SCRIPT>valigntop()</SCRIPT><table cellpadding=0 cellspacing=0 width=$tablewidth bgcolor=$tablebordercolor align=center><tr><td>
<table cellpadding=4 cellspacing=1 width=100%><tr><td bgcolor=$titlecolor $catbackpic colspan=2>
<form action="$thisprog" method=post><font color=$titlefontcolor>主題： $topictitle</td></tr>
<tr><td bgcolor=$miscbackone valign=top><font color=$fontcolormisc><b>複製文章</b><p></font></td><td bgcolor=$miscbackone>&nbsp;&nbsp;<textarea cols=90 rows=12 wrap="soft" name="inpost">$temppost</textarea><BR><BR></td></tr>
<tr><td bgcolor=$miscbacktwo colspan=2 align=center><input type="button" value="高亮顯示文字" onClick="this.form.inpost.focus();this.form.inpost.select();">　　<input type="button" value="複製到剪貼簿" name="cmdCopy" onClick="copy(this.form.inpost)"></center></td></tr></td></table></table>
<SCRIPT>valignend()</SCRIPT>
    ~;
1;
