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

📄 editpoll.cgi

📁 一个linux论坛
💻 CGI
📖 第 1 页 / 共 2 页
字号:
#!/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");
}
use LBCGI;
use File::Copy;
$LBCGI::DISABLE_UPLOADS = 0;
$LBCGI::HEADERS_ONCE = 1;
$LBCGI::POST_MAX=1024 * 150;
require "code.cgi";
require "data/boardinfo.cgi";
require "data/styles.cgi";
require "lb.lib.pl";

$|++;
$thisprog = "editpoll.cgi";
$query = new LBCGI;

$addme=$query->param('addme');
for ('forum','topic','membername','password','action','inshowsignature','notify','inshowemoticons','newtopictitle',
    'inpost','posticon','hidepoll','inhiddentopic','postweiwang','canpoll','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"));
$inmembername  = $membername;
$inpassword    = $password;
$innotify      = $notify;
$indeletepost  = $deletepost;
$inleavemessage= $leavemessage;
$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"; }
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);

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

if ($inshowemoticons ne "yes")  { $inshowemoticons eq "no"; }
if ($innotify ne "yes")         { $innotify eq "no"; }
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 = "禁止";}

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");
    my $threads = <FILE>;
    close(FILE);
    &winunlock($filetoopen) if ($OS_USED eq "Nt");
    chomp $threads;

    ($postermembername, $topictitle, $postipaddress, $showemoticons, $showsignature ,$postdate, $post, $posticon, $water) = split(/\t/, $threads);
    $topictitle =~ s/^*#!&*//;
    &error("编辑帖子&没搞错吧,这根本不是投票贴子啊!") if ($posticon !~ /<BR>/i);
    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("编辑投票&对不起,您不允许在此论坛发表!"); }

if ($nowater eq "on") { 
    $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 "");
}

    if ($wwjf ne "no") {
	if ($post=~/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;
    }

    $showsignature="yes25" if($showsignature eq "yes");
    if ($showsignature =~/^yes[0-9]+$/) { $duoxuan='checked';$canpoll=$showsignature;$canpoll=~s/^yes//;$Selected[$canpoll]=" selected"; } else { $duoxuan='';$canpoll=1; }
    if ($post =~m/\[hidepoll\]/isg) { $PollHiddencheck='checked'; } else { $PollHiddencheck=''; }
    $post =~ s/\<p\>/\n\n/ig;
    $post =~ s/\<br\>/\n/ig;
    $post =~ s/\[hidepoll\]//isg;
    $post =~ s/\[这个投票最后由(.+?)编辑\]\n//isg;
    $post =~ s/LBHIDDEN\[(.*?)\]LBHIDDEN//sg;
    $uselbcodecheck=($post =~/\[DISABLELBCODE\]/)?"":" checked";
    $post =~ s/\[DISABLELBCODE\]//isg;
  
    $posticon =~ s/\<p\>/\n\n/ig;
    $posticon =~ s/\<br\>/\n/ig;
    if (-e "${lbdir}forum$inforum/$intopic.poll.cgi") { $dis1 = "disabled"; }
    if ($showsignature eq 'yes') {$dis2="checked";}

    &mischeader("编辑贴子");
    $helpurl = &helpfiles("阅读标记");
    $helpurl = qq~$helpurl<img src="$imagesurl/images/help_b.gif" border=0></a>~;
    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 = "禁止";}

    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");
    }
   
    $output .= qq~<script language="javascript">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();}}</script>~;
    if (($dofilter eq "no")||($dofilter eq "all")) {
	my $temp = &postwordfilter("$post\t$topictitle");
	($post,$topictitle) = split(/\t/,$temp);
    }
    $maxpoststr = "(帖子中最多包含 <B>$maxpoststr</B> 个字符)" if ($maxpoststr ne "");
    foreach (2..25) { $canpolllist.=qq~<option value="$_"$Selected[$_]>$_</option>~; }

    $output .= qq~<script>
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="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>&nbsp;</td></tr>
<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></tr>$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=$miscbacktwo valign=top><font color=$fontcolormisc><b>投票项目</b><br><li>每行一个投票项目,最多 <B>25</b> 项<BR><li>超过自动作废,空行自动过滤<BR><li>如果投票需要多选,请在选择中打钩</font></td><td bgcolor=$miscbacktwo valign=top>
<TEXTAREA cols=58 name=posticon rows=6 wrap=soft $dis1>$posticon</TEXTAREA><BR>
<input type=checkbox name="inshowsignature" value="yes" $duoxuan>最多可投<select name="canpoll">$canpolllist</select>项  <input type=checkbox name="hidepoll" value="yes" $PollHiddencheck>是否必须投票后才可查看结果?<br></td></tr>
<td bgcolor=$miscbackone valign=top><font color=$fontcolormisc><b>内容</b> $maxpoststr<p>在此论坛中:<br>
在此论坛中:<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);">$post</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><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 = $_;

⌨️ 快捷键说明

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