⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editpost.cgi

📁 一个linux论坛
💻 CGI
📖 第 1 页 / 共 3 页
字号:
#!/usr/bin/perl
#############################################################
#  LeoBoard ver.5000 / LB5000 / 雷傲超级论坛 ver.5000
#
#  版权所有: 雷傲工作室(原蓝宝石软件工作室)
#
#  制作人  : 山鹰糊 (Shining Hu)
#            花无缺 (Ifairy Han)
#
#  主页地址: http://www.CGIer.com/      CGI 编程者之家
#	     http://www.LeoBoard.com/   雷傲论坛支持主页
#	     http://www.leoBBS.com/     本论坛直通车
#
#############################################################
BEGIN {
    $start_time = (times)[0] + (times)[1];
    $LBPATH = '.';
    my $pgm = $0;
    $pgm =~s/\\/\//g;
    $pgm =~s/^.*\/([^\/]+)$/$1/g;
    unless (-e $LBPATH.'/'.$pgm) {
        foreach ($0, $ENV{'SCRIPT_FILENAME'}, $ENV{'PATH_TRANSLATED'}) {
            s!\\!/!g; s/^(.*)\/[^\/]+$/$1/g;
            if (-e $_ . '/' .$pgm) { $LBPATH = $_; last; }
        }
    }
    unshift (@INC, "$LBPATH");
#	$ENV{'TMP'}="$LBPATH/lock"; #如果你不能上传图片,请去掉前面的#
#   $ENV{'TEMP'}="$LBPATH/lock";#如果你不能上传图片,请去掉前面的#
}
use LBCGI;
$LBCGI::DISABLE_UPLOADS = 0;
$LBCGI::HEADERS_ONCE = 1;
require "code.cgi";
require "data/boardinfo.cgi";
require "data/styles.cgi";
require "lb.lib.pl";

$|++;                                     # Unbuffer the output
$thisprog = "editpost.cgi";
$query = new LBCGI;

$addme=$query->param('addme');

for ('forum','topic','membername','password','action','postno',
     'notify','deletepost','intopictitle','intopicdescription',
     'inpost','inshowemoticons','inshowsignature','checked','movetoid','posticon',
     'newtopictitle','inhiddentopic','postweiwang','moneyhidden','moneypost','uselbcode','inwater') {
    next unless defined $_;
    next if $_ eq 'SEND_MAIL';
    $tp = $query->param($_);
    $tp = &cleaninput("$tp");
    ${$_} = $tp;
}
$inforum       = $forum;
$intopic       = $topic;
&error("打开文件&老大,别乱黑我的程序呀!") if (($intopic) && ($intopic !~ /^[0-9 ]+$/));
&error("打开文件&老大,别乱黑我的程序呀!") if ($inforum !~ /^[0-9 ]+$/);
&error("普通&请以正确的方式访问本程序!") if (($postweiwang > $maxweiwang)&&($inhiddentopic eq "yes"));
$moneypost = int($moneypost) if (($moneypost ne "")&&($moneyhidden eq "yes"));
&error("普通&请以正确的方式访问本程序!") if ((($moneypost > 99999)||($moneypost <= 0))&&($moneyhidden eq "yes"));
$inmembername  = $membername;
$inpassword    = $password;
$inpostno      = $postno;
$innotify      = $notify;
$indeletepost  = $deletepost;
$currenttime   = time;
$inposticon    = $posticon;
$inpost        =~ s/LBHIDDEN/LBHIDD\&\#069\;N/sg;
$inpost        =~ s/\[DISABLELBCODE\]/\[DISABLELBCOD\&\#069\;\]/sg;
$inpost        .=($uselbcode eq "yes")?"":"[DISABLELBCODE]" if($action eq "processedit");
$inmembername = &stripMETA($inmembername);

if (-e "${lbdir}data/style${inforum}.cgi") { require "${lbdir}data/style${inforum}.cgi"; }$maxupload = 300 if ($maxupload eq "");
$LBCGI::POST_MAX=1024 * $maxupload;

if ($inshowemoticons ne "yes") { $inshowemoticons eq "no"; }
if ($innotify ne "yes")        { $innotify eq "no"; }
if (($inpostno) && ($inpostno !~ /^[0-9]+$/)) { &error("普通错误&请不要修改生成的 URL!"); }
if (($movetoid) && ($movetoid !~ /^[0-9]+$/)) { &error("普通错误&请不要修改生成的 URL!"); }

$addtypedisp = $addtype;
$addtypedisp =~ s/\, /\,/gi;
$addtypedisp =~ s/ \,/\,/gi;
$addtypedisp =~ tr/A-Z/a-z/;
my @addtypedisp = split(/\,/, $addtypedisp);
$addtypedisp = "<select><option value=#>支持类型:</option><option value=#>----------</option>";
foreach my $name (@addtypedisp) {
    chomp $name;
    $addtypedisp .= qq~<option>$name</option>~;
}
$addtypedisp .= qq~</select>~;

if (! $inmembername) { $inmembername = $query->cookie("amembernamecookie"); }
if (! $inpassword) { $inpassword = $query->cookie("apasswordcookie"); }
$inmembername =~ s/[\a\f\n\e\0\r\t\`\~\!\@\#\$\%\^\&\*\(\)\+\=\\\{\}\;\'\:\"\,\.\/\<\>\?]//isg;
$inpassword =~ s/[\a\f\n\e\0\r\t\|\@\;\#\{\}\$]//isg;

if ($inmembername eq "" || $inmembername eq "客人" ) {
    $inmembername = "客人";
} else {
    &getmember("$inmembername");
#    &getmembernolock("$inmembername");
    &error("普通错误&此用户根本不存在!") if ($userregistered eq "no");
    &error("普通错误&密码与用户名不相符,请重新登录!") if ($inpassword ne $password);
}
require "postjs.cgi";

$cpudisp = 1 if (($membercode eq "ad")||($membercode eq "smo")||($membercode eq "cmo"));
$maxpoststr = "" if ($maxpoststr eq 0);
$maxpoststr = 100 if (($maxpoststr < 100)&&($maxpoststr ne ""));

print header(-charset=>gb2312);

#&getoneforum("$inforum");
&moderator("$inforum");

if ($action eq "edit") { &editform;}
    elsif ($action eq "processedit")  { &processedit;  }
    else { &error("普通&请以正确的方式访问本程序"); }
    
&output( -Title => $boardname, -ToPrint => $output, -Version => $versionnumber );
exit;

sub editform {
    $filetoopen = "$lbdir" . "forum$inforum/$intopic.thd.cgi";
    &winlock($filetoopen) if ($OS_USED eq "Nt");
    open(FILE, "$filetoopen");
    flock(FILE, 1) if ($OS_USED eq "Unix");
    @threads = <FILE>;
    close(FILE);
    &winunlock($filetoopen) if ($OS_USED eq "Nt");

    $posttoget = $inpostno;
    $posttoget--;
    
    ($postermembername, $topictitle, $postipaddress, $showemoticons, $showsignature ,$postdate, $post, $posticon, $water) = split(/\t/, $threads[$posttoget]);
    $topictitle =~ s/^*#!&*//;
    $post =~ s/\<p\>/\n\n/ig;
    $post =~ s/\<br\>/\n/ig;

    &error("发表&对不起,不允许编辑投票贴子!") if (($posticon =~ m/<BR>/i)&&($posttoget eq 0));
    if (($membercode ne "ad")&&($membercode ne "smo")&&($inmembmod ne "yes")&&(($inmembername ne $postermembername)||($usereditpost eq "no"))) {&error("编辑帖子&您不是原作者、论坛管理员,或者密码错誤,或者此区不允许编辑帖子!");} 

    $testentry  = $query->cookie("forumsallowed$inforum");
    if (($allowedentry{$inforum} eq "yes")||(($testentry eq $forumpass)&&($testentry ne ""))||($membercode eq "ad")||($membercode eq 'smo')||($inmembmod eq "yes")) { $allowed = "yes"; }
    else { $allowed  = "no"; }
    if (($privateforum eq "yes") && ($allowed ne "yes")) { &error("发表&对不起,您不允许在此论坛发表!"); }
    
    $rawpost = $post;
    
    if ($emailfunctions eq "on") {
	if ($innotify eq "yes") { $requestnotify = " checked"; } else { $requestnotify = ""; }
	$requestnotify = qq~<input type=checkbox name="notify" value="yes"$requestnotify>有回复时使用邮件通知您?<br>~;
    }
    if ($emoticons eq "on") {
        $emoticonslink   = qq~<a href="javascript:openScript('misc.cgi?action=showsmilies',300,350)">允许<B>使用</B>表情字符转换</a>~;
        $emoticonsbutton = qq~<input type=checkbox name="inshowemoticons" value="yes" checked>您是否希望<b>使用</b>表情字符转换在您的文章中?<br>~;
    }
    if ($htmlstate eq "on")         { $htmlstates = "可用";         } else { $htmlstates = "不可用";       }
    if ($idmbcodestate eq "on")     { $idmbcodestates = "可用";     } else { $idmbcodestates = "不可用";   }
    if ($arrawpostflash eq "on")    { $postflashstates = "允许";    } else { $postflashstates = "禁止";    }
    if ($arrawpostpic eq "on")      { $postpicstates = "允许";      } else { $postpicstates = "禁止";      }
    if ($arrawpostfontsize eq "on") { $postfontsizestates = "允许"; } else { $postfontsizestates = "禁止"; }
    if ($arrawpostsound eq "on")    { $postsoundstates = "允许";    } else { $postsoundstates = "禁止";    }
    if ($postjf eq "yes")           { $postjfstates = "允许";       } else { $postjfstates = "禁止";       }
    if ($hidejf eq "yes")           { $hidejfstates = "允许";       } else { $hidejfstates = "禁止";       }

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

    if (($dofilter eq "no")||($dofilter eq "all")) {
        my $temp = &postwordfilter("$rawpost\t$topictitle");
	($rawpost,$topictitle) = split(/\t/,$temp);
    }

if (($nowater eq "on")&&($inpostno eq "1")) { 
    $gsnum = 0 if ($gsnum<=0);
    $nowaterpost =qq~<tr><td bgcolor=$miscbackone><font color=$fontcolormisc><b>灌水限制</b></font></td><td bgcolor=$miscbackone><input type="radio" name="inwater" value=no> 不许灌水  <input name="inwater" type="radio" value=yes> 允许灌水     [如果选择“不许灌水”,则回复不得少于 <B>$gsnum</B> 字节]</td></tr>~;
    $nowaterpost =~ s/value=$water/value=$water checked/i if ($water ne "");
}

    $rawpost =~ s/\[这个(.+?)最后由(.+?)编辑\]\n//isg;
    if ($wwjf ne "no") {
	if ($rawpost=~/LBHIDDEN\[(.*?)\]LBHIDDEN/sg) {
	    $weiwangchecked=" checked";
	    $weiwangchoice=$1;
        } else {
	    undef $weiwangchecked;
	    undef $weiwangchoice;
        }
        for (my $i=0;$i<$maxweiwang;$i++) {
	    $weiwangoption.=qq~<option value=$i>$i</option>~;
        }
        $weiwangoptionbutton=qq~<input type=checkbox name="inhiddentopic" value="yes" $weiwangchecked>加密此帖,只对部分用户可见,用户威望至少需要  <select name=postweiwang>$weiwangoption</select><br>~;
        $weiwangoptionbutton =~ s/option value=$weiwangchoice/option value=$weiwangchoice selected/i if ($weiwangchoice ne "");
    } else {
        undef $weiwangoptionbutton;
    }

    $rawpost=~s/LBHIDDEN\[(.*?)\]LBHIDDEN//sg;
    $uselbcodecheck=($rawpost =~/\[DISABLELBCODE\]/)?"":" checked";
    $rawpost =~ s/\[DISABLELBCODE\]//isg;

    &mischeader("编辑贴子");

    $helpurl = &helpfiles("阅读标记");
    $helpurl = qq~$helpurl<img src="$imagesurl/images/help_b.gif" border=0></a>~;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -