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

📄 editpost.cgi

📁 一个linux论坛
💻 CGI
📖 第 1 页 / 共 3 页
字号:
    if ($inpostno eq "1") {
    	$topictitle = $newtopictitle if ($newtopictitle ne "");
        $topictitle =~s/ \(无内容\)$//;
        $topictitlehtml = qq~<td bgcolor=$miscbackone><font color=$fontcolormisc><b>贴子主题</b></font></td><td bgcolor=$miscbackone><input type=text size=60 maxlength=80 name="newtopictitle" value="$topictitle"> 不得超过 40 个汉字</td>~;
        $topictitlehtml1="&nbsp;";
    }
    else {
        undef $topictitlehtml;
        $topictitlehtml1 = "<b>* 贴子主题</b>: $topictitle";
    }
    $output .= qq~<script>
function smilie(smilietext) {smilietext=' :'+smilietext+': ';if (document.FORM.inpost.createTextRange && document.FORM.inpost.caretPos) {var caretPos = document.FORM.inpost.caretPos;caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? smilietext + ' ' : smilietext;document.FORM.inpost.focus();} else {document.FORM.inpost.value+=smilietext;document.FORM.inpost.focus();}}
function storeCaret(textEl) {if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();}
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")}
</script>
<form action="$thisprog" method=post name="FORM" enctype="multipart/form-data">
<input type=hidden name="action" value="processedit">
<input type=hidden name="postno" value="$inpostno">
<input type=hidden name="forum" value="$inforum">
<input type=hidden name="topic" value="$intopic">
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
<tr><td>
<table cellpadding=4 cellspacing=1 border=0 width=100%>
<tr><td bgcolor=$titlecolor colspan=2><font color=$titlefontcolor>$topictitlehtml1</td></tr>
$topictitlehtml$nowaterpost
<tr><td bgcolor=$miscbackone><font color=$fontcolormisc><b>用户名</b></font></td>
<td bgcolor=$miscbackone><input type=text name="membername" value="$inmembername"> &nbsp; <font color=$fontcolormisc><span onclick="javascript:location.href='register.cgi?forum=$inforum'" style="cursor:hand">您没有注册?</span></td>
</tr><tr>
<td bgcolor=$miscbackone><font color=$fontcolormisc><b>密 码</b></font></td>
<td bgcolor=$miscbackone><input type=password name="password" value="$inpassword"> &nbsp; <font color=$fontcolormisc><a href="profile.cgi?action=lostpass" style="cursor:help">忘记密码?</a></font></td>
</tr><tr>
<td bgcolor=$miscbackone valign=top><font color=$fontcolormisc><b>当前心情</b><BR><li>将放在贴子的前面<BR></font></td>
<td bgcolor=$miscbackone valign=top>
~;
    open (FILE, "${lbdir}data/lbpost.cgi");
    my @posticondata = <FILE>;
    close (FILE);
    chomp @posticondata;
    my $tempiconnum=1;
    foreach (@posticondata) {
        $_ =~ s/[\a\f\n\e\0\r\t]//isg;
	if ($tempiconnum > 12) {
	    $tempiconnum = 1;
	    $tempoutput .= qq~<BR>~;
	}
	if ($_ eq $posticon) { $tempselect = " checked"; } else { $tempselect = ""; }
	$tempoutput .= qq~<input type=radio value="$_" name="posticon"$tempselect><img src=$imagesurl/posticons/$_>&nbsp;~;
	$tempiconnum ++;
    }
  
    $output .= qq~$tempoutput</td></tr>~;

    my $p1=$inpostno-1;
    $dirtoopen2 = "$imagesdir" . "usr/$inforum";
    opendir (DIR, "$dirtoopen2");
    @files = readdir(DIR);
    closedir (DIR);
    @files = grep(/^$inforum\_$intopic/,@files);
    if ($p1>0) { @files = grep(/^$inforum\_$intopic\_$p1\./,@files); } else { @files = grep(/^$inforum\_$intopic\./,@files); }
    if ( $#files >= 0 ) { $delimg="<BR><input type=checkbox name='delimg' value='no'>删除原图像或附件</input>"; }

    if (((($inpostno eq "1")&&($arrowupload ne "off"))||(($inpostno ne "1")&&($allowattachment ne "no"))||($membercode eq "ad")||($membercode eq 'smo')||($inmembmod eq "yes"))) {
        $uploadreqire= "" if ($uploadreqire <= 0);
        $uploadreqire = "<BR>发帖数要大于 <B>$uploadreqire</B> 篇(认证用户不限)" if ($uploadreqire ne "");
        $output .= qq~<tr><td bgcolor=$miscbacktwo><b>上传附件或图片</b>(最大 $maxupload KB)$uploadreqire</td><td bgcolor=$miscbacktwo> <input type="file" size=30 name="addme">  $addtypedisp$delimg</td></tr>~;
    }
    $maxpoststr = "(帖子中最多包含 <B>$maxpoststr</B> 个字符)" if ($maxpoststr ne "");

    $output .= qq~<td bgcolor=$miscbackone valign=top><font color=$fontcolormisc><b>内容</b> $maxpoststr<p>
在此论坛中:<li>HTML 标签 : <b>$htmlstates</b><li><a href="javascript:openScript('misc.cgi?action=lbcode',300,350)">LB5000 标签</a>: <b>$idmbcodestates</b><li>贴图标签  : <b>$postpicstates</b><li>Flash 标签 : <b>$postflashstates</b><li>音乐标签  : <b>$postsoundstates</b><li>文字大小  : <b>$postfontsizestates</b><li>积分标签  : <b>$postjfstates</b><li>保密标签  : <b>$hidejfstates</b><li>$emoticonslink</font></td>
<td bgcolor=$miscbackone>$insidejs
<TEXTAREA cols=80 name=inpost rows=12 wrap="soft" onkeydown=ctlent() onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">$rawpost</TEXTAREA><br>
&nbsp; 模式:<input type="radio" name="mode" value="help" onClick="thelp(1)"> 帮助 <input type="radio" name="mode" value="prompt" CHECKED onClick="thelp(2)"> 完全 <input type="radio" name="mode" value="basic"  onClick="thelp(0)"> 基本     >> <a href=javascript:HighlightAll('FORM.inpost')>复制到剪贴板</a> | <a href=javascript:checklength(document.FORM);>查看文章长度</a> <<</td></tr>
<tr><td bgcolor=$miscbackone valign=top colspan=2>
~;

    if ($emoticons eq "on"){
	$output.=qq~
	<font color=$fontcolormisc><b>点击表情图即可在贴子中加入相应的表情(帖子中每个表情最多同时显示 3 次)</B></font><br>&nbsp;
	~;
        if (open (FILE, "${lbdir}data/lbemot.cgi")) {
	    @emoticondata = <FILE>;
	    close (FILE);
    	    chomp @emoticondata;
        }
        foreach (@emoticondata) {
	    my $smileyname = $_;
	    $smileyname =~ s/\.gif$//ig;
	    $output .= qq~<img src=$imagesurl/emot/$_ border=0 onClick="smilie('$smileyname');FORM.inpost.focus()" style="cursor:hand"> ~;
        }
    }
    if (($inpostno ne 1)&&(($membercode eq "ad")||($membercode eq 'smo')||($inmembmod eq "yes")||(($arrowuserdel eq "on")&&(lc($inmembername) eq lc($postermembername))))) {
        $managetable = qq~<tr><td bgcolor=$miscbackone><font color=$fontcolormisc><b>管理员选项</b></td><td bgcolor=$miscbackone>&nbsp;<a href="delpost.cgi?action=processedit&postno=$inpostno&forum=$inforum&topic=$intopic&deletepost=yes" OnClick="return confirm('真的要删除此回复么?');">删除此回复(谨慎使用,不可恢复)</a></td></tr>~;
    }
    $output .= qq~</td></tr>
<tr><td bgcolor=$miscbacktwo valign=top><font color=$fontcolormisc><b>选项</b><p>$helpurl
</font></td>
<td bgcolor=$miscbacktwo><font color=$fontcolormisc><input type=checkbox name="uselbcode" value="yes"$uselbcodecheck>使用 LB5000 标签?<br>
<input type=checkbox name="inshowsignature" value="yes" checked>是否显示您的签名?<br>$requestnotify$emoticonsbutton$weiwangoptionbutton
</font></td></tr>$managetable
<tr><td bgcolor=$miscbackone colspan=2 align=center>
<input type=Submit value="发 表" name=Submit>  <input type="reset" name="Clear" value="清 除"></td></form></tr></table></tr></td></table>
~;

}

sub processedit {
    $inpostno1=$inpostno;
    $filetoopen = "$lbdir" . "forum$inforum/$intopic.thd.cgi";
    if (-e $filetoopen) {
        &winlock($filetoopen) if ($OS_USED eq "Nt");
        open(FILE, "$filetoopen") or &error("编辑&这个主题不存在!");
        flock(FILE, 1) if ($OS_USED eq "Unix");
        @allthreads = <FILE>;
        close(FILE);
        &winunlock($filetoopen) if ($OS_USED eq "Nt");
    }
    else { unlink ("$lbdir" . "forum$inforum/$intopic.pl"); &error("编辑&这个主题不存在!"); }

    if (($inhiddentopic eq "yes") && ($moneyhidden eq "yes")) { &error("发表主题&请不要在一个贴子内同时使用威望和金钱加密!"); }
    if ((($inhiddentopic eq "yes")||($moneyhidden eq "yes")) && ($userregistered eq "no")) { &error("发表主题&未注册用户无权进行威望和金钱加密!"); }

    $delimg=$query->param('delimg');
    $posttoget = $inpostno;
    $posttoget--;
    $postcountcheck = 0;

    ($postermembername, $topictitle, $postipaddress, $showemoticons, $showsignature ,$postdate, $post, $posticon) = split(/\t/, $allthreads[$posttoget]);
($edittimes, $temp) = split(/ 次编辑/, $post);
($temp, $edittimes) = split(/第 /, $edittimes);
$edittimes = 0 unless ($edittimes);

    $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("编辑主题&对不起,您不允许在此论坛发表!"); }

    &error("编辑帖子&对不起,本论坛不允许发表超过 <B>$maxpoststr</B> 个字符的文章!") if ((length($inpost) > $maxpoststr)&&($maxpoststr ne "")&&($membercode ne "ad")&&($membercode ne 'smo') && ($membercode ne "mo")&&($membercode ne 'cmo') && ($membercode ne "rz") && ($inmembmod ne "yes"));
    &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("编辑帖子&您不是原作者、论坛管理员,或者密码错誤,或者此区不允许编辑帖子!");} 

    if (($membercode eq "banned")||($membercode eq "masked"))      { &error("编辑帖子&您被禁止发言或者发言已经被屏蔽,请联系坛主以便解决!"); }

    $cleartoedit = "no";
    if (($membercode eq "ad") && ($inpassword eq $password)) { $cleartoedit = "yes"; }
    if(($membercode eq 'smo') && ($inpassword eq $password)) { $cleartoedit = "yes"; }
    if (($inmembmod eq "yes") && ($inpassword eq $password)) { $cleartoedit = "yes"; }
    if ((lc($inmembername) eq lc($postermembername)) && ($inpassword eq $password) && ($usereditpost ne "no")) { $cleartoedit = "yes"; }
    unless ($cleartoedit eq "yes") { $cleartoedit eq "no"; }

    if ($cleartoedit eq "yes") {
        $editpostdate = $currenttime;
        $editpostdate = $editpostdate + ($timezone + $timedifferencevalue)*3600;
        $editpostdate = &dateformat("$editpostdate");
        $inpost =~ s/[\a\f\n\e\0\r\t]//g;
        $inpost =~ s/  / /g;
        $inpost =~ s/\n\n/\<p\>/g;
        $inpost =~ s/\n/\<br\>/g;
        $inpost =~ s/\[这个(.+?)最后由(.+?)编辑\]//isg;

	$newtopictitle =~ s/\(无内容\)$//;
	if (($dofilter eq "yes")||($dofilter eq "all")) {
	    my $temp = &dofilter("$newtopictitle\t$inpost");
	    ($newtopictitle,$inpost) = split(/\t/,$temp);
	}
	
        if ($inpostno eq 1){ 
	    $newtopictitle =~ s/()+//isg;
	    my $tempintopictitle = $newtopictitle;
	    $tempintopictitle =~ s/ //g;
	    $tempintopictitle =~ s/\&nbsp\;//g;
	    $tempintopictitle =~ s/ //g;
	    $tempintopictitle =~ s/^*#!&*//;
	    if ($tempintopictitle eq "") { &error("编辑主题&主题标题有问题!"); }
	    undef $tempintopictitle; 
        }   
        
        if (($newtopictitle eq "")&&($inpostno eq 1)) { &error("编辑主题&对不起,贴子主题不能为空!"); }
        if ((length($newtopictitle) > 82)&&($inpostno eq 1))  { &error("编辑主题&对不起,主题标题过长!"); }
        $newtopictitle  = "*#!&*$newtopictitle";

	if (($nowater eq "on")&&($membercode ne "ad")&&($membercode ne 'smo')&&($membercode ne 'cmo')&&($membercode ne 'mo')&&($inmembmod ne "yes")) {
          ($trash, $trash, $trash, $trash, $trash, $trash, $post, $trash,my $water) = split(/\t/,$allthreads[0]);
	  if ($water eq "no") {
	    my $inposttemp = $inpost;
	    $inposttemp =~ s/\[这个(.+?)最后由(.+?)编辑\]\<BR\>\<BR\>//isg;
	    $inposttemp =~ s/\[这个(.+?)最后由(.+?)编辑\]\<BR\>//isg;
	    $inposttemp =~ s/\[这个(.+?)最后由(.+?)编辑\]//isg;
	    $inposttemp =~ s/\[quote\]\[b\]下面引用由\[u\].+?\[\/u\]在 \[i\].+?\[\/i\] 发表的内容:\[\/b\].+?\[\/quote\]\<br\>//isg;
	    $inposttemp =~ s/\[quote\]\[b\]下面引用由\[u\].+?\[\/u\]在 \[i\].+?\[\/i\] 发表的内容:\[\/b\].+?\[\/quote\]//isg;
	    if ((length($inposttemp) < $gsnum)&&($gsnum > 0)) {
	        &error("发表回复&请不要灌水,本主题禁止 $gsnum 字节以下的灌水!");
                unlink ("${imagesdir}usr/$inforum/$inforum\_$intopic\_$replynumber.$up_ext") if ($addme);
	    }
	  }
	}

        if ($inpostno eq 1) {
	    $newtopictitle = "$newtopictitle (无内容)" if (($inpost eq "")&&($addme eq ""));
	    if ($topictitle eq $newtopictitle) {
		$topictitlecomp = 1;
	    }
	    else {
	        $topictitle = $newtopictitle;
		$topictitlecomp = 0;
	    }
        }

⌨️ 快捷键说明

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