📄 newposts.cgi
字号:
#!/usr/bin/perl
#############################################################
# Ikonboard v2.1
# Copyright 2000 Ikondiscussion.com - All Rights Reserved
# Ikondiscussion is a trademark of Ikondiscussion.com
#
# Software Distributed by: Ikondiscussion.com
# Visit us online at http://www.ikondiscussion.com
# Email us on boards@ikondiscussion.com
#
# All files written by Matthew Mecham
#############################################################
#use CGI::Carp "fatalsToBrowser"; # Output errors to browser
use CGI qw(:standard); # Saves loads of work
$CGI::POST_MAX=1024 * 150; # limit post data
$CGI::DISABLE_UPLOADS = 1; # Disable uploads
eval {
($0 =~ m,(.*)/[^/]+,) and unshift (@INC, "$1");
($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1");
require "ikon.lib"; # Require ikonboard ()
require "data/progs.cgi"; # Require prog names
require "data/boardinfo.cgi";# Require board info
require "data/styles.cgi"; # Require styles info
};
if ($@) {
print header(-charset=>"gb2312"); print start_html(-title=>"ib2000 出错!");
print "不能够找到文件:$@\n如果您使用的是 Windows 类操作系统,请在每一个程序中更改 require 的设置,填入绝对路径!";
print end_html; exit;
}
$|++; # Unbuffer the output
#################--- Begin the program ---###################
$thisprog = "newposts.cgi";
$query = new CGI;
$boardurltemp =$boardurl;
$boardurltemp =~ s/http\:\/\/(\S+?)\/(.*)/\/$2/;
$cookiepath = $boardurltemp;
$cookiepath =~ s/$thisprog//sg;
$action = $query -> param('action');
$inmembername = $query -> param("membername");
$inpassword = $query -> param("password");
$inmembername = &cleaninput($inmembername);
$inpassword = &cleaninput($inpassword);
if (! $inmembername) { $inmembername = cookie("amembernamecookie"); }
if (! $inpassword) { $inpassword = cookie("apasswordcookie"); }
if ($inmembername eq "") {
$inmembername = "客人";
}
else {
&getmemberstime("$inmembername");
}
if ($action eq "viewposts") {
$namecookie = cookie(-name => "amembernamecookie",
-value => "$inmembername",
-path => "$cookiepath",
-expires => "+30d");
$passcookie = cookie(-name => "apasswordcookie",
-value => "$inpassword",
-path => "$cookiepath",
-expires => "+30d");
print header(-cookie =>[$namecookie, $passcookie], -charset=>"gb2312");
}
else {
print header(-charset=>"gb2312");
}
### Print Header for the page.
$output .= qq~
<table cellpadding=0 cellspacing=0 border=0 width=95% bgcolor=$tablebordercolor align=center>
<tr>
<td>
<table cellpadding=3 cellspacing=1 border=0 width=100%>
<tr>
<td bgcolor=$miscbacktwo align=center colspan=3><font face="$font" color=$fontcolormisc><b>您最后访问本论坛后的新文章</b></td>
</tr>
<tr>
<td bgcolor=$miscbackone valign=middle align=center colspan=3><font face="$font" color=$fontcolormisc>
<br>注意:只有当您成功登陆后才能够检查<br><br>
</td>
</tr>
~;
if ($action eq "viewposts") {
# Validate user
&getmember("$inmembername");
if ($userregistered eq "no") { &messangererror("一般&您没有注册!"); }
elsif ($inpassword ne $password) { &messangererror("一般&您的密码错误!"); }
elsif ($inmembername eq "") { &login("$thisprog?action=viewposts"); }
# Lets grab the current forums
&whosonline("$inmembername|检查新贴|none|检查最新发布的贴子|");
$filetoopen = "$ikondir" . "data/allforums.cgi";
$filetoopen = &stripMETA($filetoopen);
open(FILE, "$filetoopen");
@forums = <FILE>;
close(FILE);
foreach $forum (@forums) { #start foreach @forums
chomp $forum;
($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic) = split(/\|/,$forum);
# Trim some fat off the search. If the poster doesn't have access, or has never been to a forum
# or has visited since, and no new posts found - move on to the next forum
&getlastvisit;
$forumlastvisit = $lastvisitinfo{$forumid};
if ($forumlastvisit eq "0" || $forumlastvisit eq "") { next; }
if ($forumlastvisit > $lastposttime) { next; }
if ((($privateforum eq "yes") && ($allowedentry{$forumid} ne "yes"))||($membercode eq "ad")) { next; }
$rearrange = ("$categoryplace|$category|$forumname|$forumdescription|$forummoderator|$htmlstate|$idmbcodestate|$privateforum|$startnewthreads|$lastposter|$lastposttime|$threads|$posts|$forumgraphic|$forumid|$forumlastvisit");
push (@rearrangedforums, $rearrange);
} # end foreach (@forums)
@finalsortedforums = sort numerically(@rearrangedforums);
# Lets search through the remaining forums with new posts.
foreach (@finalsortedforums) {
($categoryplace, $category, $forumname, $forumdescription,$forummoderator, $htmlstate, $idmbcodestate, $privateforum, $startnewthreads, $lastposter, $lastposttime, $threads, $posts, $forumgraphic, $forumid, $forumlastvisit) = split(/\|/,$_);
$filetoopen = "$ikondir" . "forum$forumid/list.cgi";
$filetoopen = &stripMETA($filetoopen);
open(FILE, "$filetoopen");
@topics = <FILE>;
close(FILE);
foreach $topic (@topics) { # start topic foreach
chomp $topic;
($topicid, $topictitle, $topicdescription, $threadstate, $threadposts, $threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate) = split(/\|/,$topic);
if ($forumlastvisit < $lastpostdate) {
$found = ("$categoryplace|$category|$forumid|$topicid|$forumname|$topictitle|$lastposter|$lastpostdate");
push (@founditems, $found);
}
} # end foreach @topics
} # end foreach @finalsortedforums
# if none are found...
$totals = @founditems;
if ($totals eq 0) {
$output .= qq~<tr><td bgcolor=$forumcolortwo colspan=3><font face="$font" color=$forumfontcolor><b>您最后一次访问本论坛后没有新文章</b>
<br><br>注意:可能因为您还在访问某个论坛。如果您在访问论坛,则本程序是不会返回结果的。</font></td></tr>\n~;
}
# Otherwise, lets print the results
foreach (@founditems) {
($categoryplace, $categoryname, $forumid, $topicid, $forumname, $topictitle, $lastposter, $lastpostdate) = split (/\|/,$_);
if ($categoryplace ne $lastcategoryplace) { #start if $categoryplace
$output .= qq~<tr><td bgcolor=$catback colspan=4><font face="$font" color=$catfontcolor><b>$categoryname</b></font></td></tr>\n~;
}
if ($forumid ne $lastforumid) { #start if $forumid
$output .= qq~<tr><td bgcolor=$forumcolortwo colspan=4><font face="$font" color=$forumfontcolor><b>-=> $forumname</b></font></td></tr>\n~;
}
$lastpostdate = $lastpostdate + ($timedifferencevalue*3600) + ($timezone*3600);
$longdate = &longdate("$lastpostdate");
$shorttime = &shorttime("$lastpostdate");
$topiclastpost = qq~<font face="$font" color="$lastpostfontcolor">$longdate <font face="$font" color="$lastpostfontcolor">$shorttime</font>~;
if ($badwords) {
@pairs = split(/\&/,$badwords);
foreach (@pairs) {
($bad, $good) = split(/=/,$_);
chop $good;
$topictitle=~ s/$bad/$good/isg;
}
}
$output .= qq~
<tr>
<td bgcolor=$forumcolortwo><font face="$font" color=$forumfontcolor><a href="$threadprog?forum=$forumid&topic=$topicid" target="_source">$topictitle</a></td>
<td bgcolor=$forumcolortwo><font face="$font" color=$forumfontcolor colspan=3>发言者:<a href="$profileprog?action=show&member=$lastposter" target=_blank>$lastposter</a> 时间:$topiclastpost</td>
</tr>
~;
$lastcategoryplace = $categoryplace;
$lastforumid = $forumid;
} # end foreach
} # end action
else {
&login("$thisprog?action=viewposts");
}
$output .= "</table></td></tr></table>\n";
&printmessanger(
-Title => "$boardname - 新贴子",
-ToPrint => $output,
-Version => $versionnumber
);
sub login {
local($url) = @_;
($postto, $therest) = split(/\?/,$url);
@pairs = split(/\&/,$therest);
foreach (@pairs) {
($name, $value)=split(/\=/,$_);
$hiddenvars .= qq~<input type=hidden name="$name" value="$value">\n~;
}
$output .= qq~
<tr>
<td bgcolor=$miscbacktwo valign=middle colspan=2 align=center>
<form action="$postto" method="post">$hiddenvars
<font face="$font" color=$fontcolormisc><b>请输入您的用户名、密码登陆</b></font></td></tr>
<tr>
<td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc>请输入您的用户名</font></td>
<td bgcolor=$miscbackone valign=middle><input type=text name="membername" value="$inmembername"0></td></tr>
<tr>
<td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc>请输入您的密码</font></td>
<td bgcolor=$miscbackone valign=middle><input type=password name="password" value="$inpassword"0></td></tr>
<tr>
<td bgcolor=$miscbacktwo valign=middle colspan=2 align=center><input type=submit name="submit" value="登 陆"></td></form></tr></table></td></tr></table>
~;
} # end routine
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -