#!/usr/local/bin/perl
#------------------------------------------------------#
#                 本程序為Yuzi工作室提供 
#                Yuzi論壇3000 免費版 v3.47             
#                                                      
#                                                      
#                此程式由 飛喵喵空服網 中文化            
#                                                      
#    中文化版本 : v3.47b5                              
#    日期       : 2001.2.11                            
#    中文化作者 : 飛喵喵空服網站長 DC                    
#                                                      
#    飛喵喵空服網 http://meowfly.myweb.hinet.net                  
#                                                      
#------------------------------------------------------#
require "setup.cgi";
######################
## 以下部分不需修改 ##
######################
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
else {
$buffer = $ENV{'QUERY_STRING'};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$value =~ s/\t/--/g;
$value =~ s/>/&gt;/g;
$value =~ s/</&lt;/g;
$FORM{$name} = $value;
}
$id  = $FORM{'id'};
$fid  = $FORM{'fid'};
$replytime  = $FORM{'replytime'};
$bbs  = $FORM{'bbs'};
$menu = $FORM{'menu'};
$fff = $FORM{'fff'};
if($menu eq "ok"){&ok; exit;}
if($id ne ""){
open (CHAT,"$filepath/list/$id.cgi");
@lines=<CHAT>;
close(CHAT);
foreach $line (@lines){
($rname,$rpass,$bzrmail,$rhome,$bbsname)=split(/\t/,$line);
}
}
&GetCookies;
if ($username eq ""){$username=$Cookies{username}};
if ($userpsd eq ""){$userpsd=$Cookies{password}};
open(PSD,"$filepath/list/$id/$replytime");
@lines=<PSD>;
close(PSD);
foreach $line (@lines) {
$line=~ s/\n//g;
($titles,$rthistime,$rusername,$nr,$rfrom,$rhasreply,$remote,$rlastname,$rlasttime,$re,$rhassee)=split(/\t/,$line);
}
$nr=~ s/<([^>]|\n)*>/\n/g;
if($id ne ""){
open (CHAT,"$filepath/list/$id.cgi");
@lines=<CHAT>;
close(CHAT);
foreach $line (@lines){
$line=~ s/\n//g;
if($line  ne ""){
($rname,$rpass,$bzrmail,$rhome,$rtitle,$yhq,$rtime,$htmlt,$htmlw,$jj,$fbzmc)=split(/\t/,$line);
open(TITLESyu,"$filepath/yhzl/$rname.cgi");
@ayu=<TITLESyu>;
close(TITLESyu);
foreach $myu (@ayu){
$myu=~ s/\n//g;
($bzdel)=split(/\t/,$myu);
}
if($fbzmc ne ""){
open(TITLESyu2,"$filepath/yhzl/$fbzmc.cgi");
@ayu2=<TITLESyu2>;
close(TITLESyu2);
foreach $myu2 (@ayu2){
$myu2=~ s/\n//g;
($fbzdel)=split(/\t/,$myu2);
}
}
}
}
}
if($userpsd eq ""){&errorview("對不起，您當前的身份是訪客！");exit;}
if(($userpsd ne $delpsd)&&($userpsd ne $fbzdel)&&($userpsd ne $bzdel)){&errorview("對不起，您不是版主！");exit;}
open(ROOM,"$list");
@lines=<ROOM>;
close(ROOM);
&send_html;
print <<EOF;
<html>
<head>
<title>移動文章</title>
<style type=text/css>
a:link {  font-family: 宋體, serif; font-size: 9pt; color: #004080; text-decoration: none}
a:hover {  color: #004080; text-decoration: underline; background-color: #CCCC99}
a:visited {  text-decoration: none}
td {  font-family: 宋體, serif; font-size: 9pt}
body {  font-family: 宋體,serif; font-size: 9pt}
</style>
</head>
<SCRIPT LANGUAGE="JavaScript">
var i=0;
function formCheck()
{
i++;
if (i>1) {alert('正在移動中，請耐心等待！'); return false;}
return true;
}
</SCRIPT>
<body background="$imagurl/bei.gif" leftmargin="0" topmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="37%" height="110" valign="top">
<div align="center"><img src="$imagurl/bei1.gif" width="298" height="92"></div>
</td>
<td width="30%" height="110" valign="bottom">
<div align="left"><img src="$imagurl/bbtitle5.gif" width="200" height="80"></div>
</td>
<td width="33%" valign="bottom" height="110">
<p>&nbsp;</p>
</td>
</tr>
</table>
<br>
<form name=form ACTION=move.cgi  METHOD="POST" onSubmit="return formCheck()">
<INPUT TYPE="HIDDEN" NAME="menu" VALUE=ok>
<INPUT TYPE="HIDDEN" NAME="id" VALUE=$id>
<INPUT TYPE="HIDDEN" NAME="replytime" VALUE=$replytime>
<table width="80%" border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<td width="34%">
<div align="left">論壇：$bbsname</div>
</td>
<td width="66%">主題：$titles</td>
</tr>
</table>
<div align="center"></div>
<table width="80%" border="1" cellspacing="0" cellpadding="2" align="center" bordercolor="#D9DAFF">
<tr bgcolor="#B8BCFF">
<td colspan="3">
<div align="center"><span><font color="#FFFFFF">移動文章功能（注意：只有社區長或版主才擁有此權限)</font></span>　</div>
</td>
</tr>
<tr>
<td height="19" width="5%" valign="top">
<p>
<input type="radio" checked>
</p>
</td>
<td height="19" width="67%"><span>主題轉移到論壇： </span> <br>
<span>注意: 你有兩個選項. 轉移之後刪除主題在當前的論壇或保持主題在當前的論壇.
<br>
<br>
　
<input type="radio" name=fff>
轉移之後保持主題在當前的論壇.<br>
　
<input type="radio" name=fff checked value=2>
轉移之後刪除主題從當前的論壇.</span></td>
<td height="19" width="28%" valign="top">
<div align="center">
<p><br>
<select name=fid>
<option selected value="">將主題移動到</option>
EOF
for ($i=0; $i<100; $i++){
$line=@lines[$i];
$line=~ s/\n//g;
if($line ne ""){
($username1)=split(/\t/,$line);
open(TITLES,"$filepath/list/$username1.cgi");
@a=<TITLES>;
close(TITLES);
foreach $m (@a){
$m=~ s/\n//g;
if($m ne ""){
($rname,$rpass,$rmail,$rhome,$rtitle,$yhq,$rtime,$htmlt,$htmlw,$jj,$fbzmc)=split(/\t/,$m);
}
print <<EOF;
<OPTION value=$username1>『$rtitle』
EOF
}
}
}
print <<EOF;
</select>
</p>
<input type="image" src=$imagurl/ok.gif alt="確定">
</div>
</td>
</tr>
</table>
</form>
<div align="center"><br>
<br>
Powered by Infopop <a href="http://meowfly.myweb.hinet.net">meowfly.myweb.hinet.net</a> &copy; 2000<br>
Yuzi Bulletin Board Version 3000 <br>中文化 :<a href="http://meowfly.myweb.hinet.net" target="_blank"><font color=ff0000>飛喵喵空服網</a></font></div>
<p>&nbsp;</p>
</body>
</html>
EOF
exit;
sub ok{
if($fid eq ""){&errorview("請選擇您要將主題移動到哪個論壇！");exit;}
unless ( -e "$filepath/list/$id/$replytime"){&errorview("文章已經移動到其它的論壇了!");exit;}
open(PSD,"$filepath/list/$id/$replytime");
$index=<PSD>;
close(PSD);
open(PSD,">$filepath/list/$fid/$replytime");
print PSD $index;
close(PSD);
chmod(0666,"$filepath/list/$fid/$replytime");
open(PSD,"$filepath/list/$id/$replytime"."b");
@lines=<PSD>;
close(PSD);
foreach $line (@lines) {
if ($line ne ""){
$aaa="$aaa$line";
}
}
open(PSD,">$filepath/list/$fid/$replytime"."b");
print PSD $aaa;
close(PSD);
chmod(0666,"$filepath/list/$fid/$replytime"."b");
open(TITLES,"$filepath/list/$fid/bbs");
@hastitles=<TITLES>;
close(TITLES);
open(TITLES,">$filepath/list/$fid/bbs");
print TITLES "$replytime\n";
foreach $m (@hastitles) {
print TITLES "$m";
}
close(TITLES);
if($fff eq 2){
open(TITLES,"$filepath/list/$id/bbs");
@hastitles=<TITLES>;
close(TITLES);
open(TITLES,">$filepath/list/$id/bbs");
foreach $m (@hastitles){
$m=~ s/\n//g;
if($m ne ""){
($rthistime)=split(/\t/,$m);
if($rthistime ne $replytime){
print TITLES $m."\n";
}
}
}
close(TITLES);
unlink("$filepath/list/$id/$replytime");
unlink("$filepath/list/$id/$replytime"."b");
}
&send_html;
print <<EOF;
<HTML>
<head>
<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=bbs.cgi?id=$id">
<LINK href="$imagurl/bbs.css" type=text/css rel=stylesheet>
</head>
您已經成功地將主題移動到您選擇的論壇了，請稍候，系統將自動返回......
<BR><BR>
<A HREF="bbs.cgi?id=$id">如果系統沒有反應，請點這返回！</A>
</html>
EOF
exit;
}
######################### END OF SCRIPT #########################
