📄 global.php
字号:
function article_line() {
global $a_info,$i,$managemode,$forumid,$list_color1,$list_color2,$bordercolor,$username,$tablewidth,$read_perpage,$timestamp,$login_status,$forum_admin,$father_admin,$manager,$superadmin,$idpath,$allow_emotion;
list($title,$author,$date,$des,$icon,$filename,$reply,$hit,$last_mod_data,$islock,$topic_type)=explode("|",$a_info);
$topic_type = trim($topic_type);
$topic_islock = trim($islock);
if(file_exists("{$idpath}forum$forumid/$filename"))$articlelist=file("{$idpath}forum$forumid/$filename");
list($topic_name,$topic_author,$topic_content,$topic_date,$topic_area)=explode("|",$articlelist[0]);
$toplang=strlen($topic_content);
if ($managemode==1 && $login_status==1 && (($forum_admin && in_array($username,$forum_admin)) ||($father_admin && in_array($username,$father_admin)) || $username==$manager ||($login_status==1&&($superadmin && in_array($username,$superadmin))))) {
if ($topic_islock==0 || $topic_islock==1) $toplangg= "[<a href='masingle.php?action=jihua&forumid=$forumid&filename=$filename' title=加入精华贴>精</a>";
else $toplangg.= "<a href='masingle.php?action=unjihua&forumid=$forumid&filename=$filename' title=取消精华帖子>除</a>";
if ($topic_islock==0 || $topic_islock==2) $toplangg.= "<a href='masingle.php?action=lock&forumid=$forumid&filename=$filename' title=锁定帖子不让会员再回复帖子>锁</a>";
else $toplangg.= "<a href='masingle.php?action=unlock&forumid=$forumid&filename=$filename' title=解除锁定帖子>解</a>";
$toplangg.="<a href='masingle.php?action=move&forumid=$forumid&filename=$filename' title=移动帖子到另一个版块>移</a>";
$toplangg.="<a href='masingle.php?action=copy&forumid=$forumid&filename=$filename' title=复制帖子到另一个版块>复</a>";
if ($topic_type>=3) $toplangg.= "<a href='maread.php?action=unhold&forumid=$forumid&filename=$filename' title=取消置顶:不再让主题置顶>消</a>";
else $toplangg.= "<a href='maread.php?action=holdfront&forumid=$forumid&filename=$filename' title=置顶主题:将主题置顶,以便会员查看>顶</a>";
$toplangg.="<a href='maread.php?action=btfront&forumid=$forumid&filename=$filename' title=提前帖子>提</a>";
$toplangg.="<a href='masingle.php?action=del&forumid=$forumid&filename=$filename' title删除帖子'>删</a>]";
}
if (strlen($author)>=12) $viewauthor=substr($author,0,9).'...';
else $viewauthor=$author;
//mt_srand($timestamp);
if ($icon=="ran") $icon=mt_rand(0,19).'.gif';
$icon="<a onfocus=this.blur() target=_blank href='read.php?forumid=$forumid&postid=$i&filename=$filename'><img src='images/emotion/$icon' width=19 alt=开新窗口浏览此主题 border=0></a> ";
if ($topic_type==1) {
$stats="<img src='images/statistic.gif'>";
if ($islock==1 || $islock==3) $stats="<img src='images/closesta.gif'>";
} elseif ($topic_type==2) {
$stats="<img src='images/ucommend.gif'>";
if ($islock==1 || $islock==3) $stats="<img src='images/closeu.gif'>";
} elseif ($topic_type>=3) {
$stats="<img src='images/holdtopic.gif'>";
} else {
if ($username!=$author) {
$stats="<img src='images/topicnew.gif'>";
if ($reply>=10) $stats="<img src='images/topichot.gif'>";
if ($islock==1 || $islock==3) $stats="<img src='images/topiclocked.gif'>";
} else {
$stats="<img src='images/mytopicnew.gif'>";
if ($reply>=10) $stats="<img src='images/mytopichot.gif'>";
if ($islock==1 || $islock==3) $stats="<img src='images/mytopiclocked.gif'>";
}
}
//-------if more than one page-----------
if ($reply+1>$read_perpage) {
if (($reply+1)%$read_perpage==0) $maxpageno=($reply+1)/$read_perpage;
else $maxpageno=floor(($reply+1)/$read_perpage)+1;
if ($maxpageno>5) $multipage='<br> ';
else $multipage=' ';
$multipage.='[ <b style="font-size:7pt;font-family:verdana;">';
for ($j=1; $j<=$maxpageno; $j++) {
$multipage.=" <a onfocus=this.blur() style='color:505060' href=\"read.php?forumid=$forumid&postid=$i&filename=$filename&page=$j\">$j</a>";
if ($j==23) {$multipage.=" ... <a onfocus=this.blur() style='color:000066' href=\"read.php?forumid=$forumid&postid=$i&filename=$filename&page=last\">Last</a>"; break;}
}
$multipage.='</b> 页]';
}
$lmd=explode(",",$last_mod_data);
$g=$timestamp-$lmd[2];
$lmdtime=get_date($lmd[2]).' '.get_time($lmd[2]);
$datetime=get_date($date).' '.get_time($date);
$title_reply=$reply_content;
$title_reply=preg_replace("/\[hide=(.+?)\](.+?)\[\/hide\]/is","此处已被作者加密!",$title_reply);//加密提示。
$title_reply=preg_replace("/\[post\](.+?)\[\/post\]/is","此贴已被作者隐藏!",$title_reply);//隐藏提示。
$title_reply=preg_replace("/\[luck=(.+?)\](.+?)\[\/luck\]/is","此处被作者被作者设置为幸运贴,只有第N个的回复者才可以看到!",$title_reply);//加密提示。
$title_reply=preg_replace("/\[sell=(.+?)\](.+?)\[\/sell\]/is","此贴已经被出售,需付钱才能看到内容!",$title_reply);//加密提示。
if (strlen($title_reply)>=50) $title_reply=substr($title_reply,0,44)."......";
$title_reply = str_replace("[","<",$title_reply);
$title_reply = str_replace("]",">",$title_reply);
$title_reply = str_replace("\"","“",$title_reply);
$title_reply = strip_tags($title_reply);
if ($lmd[2]==$date) $titleadd="<br>暂无回复";
else $titleadd="<br>最后回复:".$lmd[1]."<br>回复时间:".$lmdtime."<br>回复内容:".$title_reply;
$title_back=$topic_content;
$title_back=preg_replace("/\[hide=(.+?)\](.+?)\[\/hide\]/is","此处已被作者加密!",$title_back);//加密提示。
$title_back=preg_replace("/\[post\](.+?)\[\/post\]/is","此贴已被作者隐藏!",$title_back);//隐藏提示。
$title_back=preg_replace("/\[luck=(.+?)\](.+?)\[\/luck\]/is","此处被作者被作者设置为幸运贴,只有第N个的回复者才可以看到!",$title_back);//加密提示。
$title_back=preg_replace("/\[sell=(.+?)\](.+?)\[\/sell\]/is","此贴已经被出售,需付钱才能看到内容!",$title_back);//加密提示。
if (strlen($title_back)>=50) $title_back=substr($title_back,0,44)."......";
$title_back = str_replace("[","<",$title_back);
$title_back = str_replace("]",">",$title_back);
$title_back = strip_tags($title_back);
if (strlen($title_back)>=700) $title_back=substr($title_back,0,694)."......";
$title_back = safe_convert($title_back);
$title_back = str_replace("\"","“",$title_back);
$title_back = str_replace("\'","‘",$title_back);
if (strlen($title)>=40) $title=substr($title,0,37)."...";
$title=str_replace('%a%','<img src="images/addon.gif" border=0>',$title);
$title="<acronym title=\"$title_back\"><a onfocus=this.blur() href='read.php?forumid=$forumid&postid=$i&filename=$filename'\">$title</a></acronym>";
$lmd=explode(",",$last_mod_data);
$g=$timestamp-$lmd[2];
if (strpos($title,'贴图')) $title.=' <img src=images/attach/img.gif>';
if (strpos($title,'下载')) $title.=' <img src=images/attach/zip.gif>';
if (strpos($title,'音乐')) $title.=' <img src=images/attach/aud.gif>';
if (strpos($title,'电影')) $title.=' <img src=images/attach/mov.gif>';
if ($g<=3600) $title.='<img src="images/attach/new.gif">';
elseif ($g<=86400) $title.='<img src="images/attach/newblue.gif">';
elseif ($g<=172800) $title.='<img src="images/attach/newgreen.gif">';
if ($islock==2 || $islock==3) $title.=' <img src=images/attach/jh.gif alt=论坛精华贴标志>';
if (strlen($lmd[1])>=11) $sub_author=substr($lmd[1],0,9).'..';
else $sub_author=$lmd[1];
if ($lmd[2]==$date) $lmdauthor="$viewauthor";
else $lmdauthor="<a onfocus=this.blur() href=\"profile.php?job=show&target=$lmd[1]\">$sub_author</a>";
$lmdtime=get_date($lmd[2]).' '.get_time($lmd[2]);
print ("<table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=1 bordercolor=$bordercolor>
<tr align=center height=25 bgcolor=$list_color1>
<td width=32>$stats</td>");
if ($login_status==1 && (($forum_admin && in_array($username,$forum_admin)) ||($father_admin && in_array($username,$father_admin)) || $username==$manager ||($login_status==1&&($superadmin && in_array($username,$superadmin))))) {
echo "<td width=22 bgcolor=$list_color1><input type=\"checkbox\" name=\"filenamervrc[]\" value=$filename></td>";
}
echo"<td width=* bgcolor=$list_color2 align=left onmouseover=javascript:this.bgColor=\"$list_color1\" onmouseout=javascript:this.bgColor=\"$list_color2\"> ";
if($allow_emotion)echo"$icon<a onfocus=this.blur() cronym title=\"$des\">";
print(" $title ($toplang 字节)</acronym>$multipage<DIV ALIGN=Right><font color=#FF8BA2> $toplangg </font></div></td>
<td width=85 ><a onfocus=this.blur() href=\"profile.php?job=show&target=$author\">$viewauthor</a></td>
<td width=32 bgcolor=$list_color2>$reply</td>
<td width=32 bgcolor=$list_color2>$hit</td>
<td width=195 align=center><table cellpadding=0 cellspacing=0 border=0 width=100%><tr align=right><td> $lmdtime<br> by:$lmdauthor</td><td><a href=\"read.php?forumid=$forumid&postid=$i&filename=$filename&page=last\"><img src=images/lastpost2.gif border=\"0\"></a> </td></tr></table></td></tr></table>
");
}
function listwhosonline() {
global $timestamp,$online_limit,$forumid,$tablewidth,$bordercolor,$list_color2,$titlecolor,$admin_list,$manager;
$onlinefile="bbsdata/online.php";
$usernoc=0;
$userno=0;
$guestno=0;
$usergroup='';
$online_user=file($onlinefile);
$count=count($online_user);
for ($i=0; $i<$count; $i++) {
$online_user_info=explode("|",trim($online_user[$i]));
if (file_exists("bbsdata/superadmin.php")) include("bbsdata/superadmin.php");
if (file_exists("bbsdata/tbuser.php")) include("bbsdata/tbuser.php");
if ($online_user_info[0]==$manager || file_exists("userdata/admin/$online_user_info[0].php") ||$online_user_info[0]==$surpadmin) {$class="论坛管理员";$img="0";}
else if ($superadmin && in_array($online_user_info[0],$superadmin)) {$class="总版主";$img="1";}
else if ($admin_list && in_array($online_user_info[0],$admin_list)) {$class="版主";$img="2";}
else if ($tbuser && in_array($online_user_info[0],$tbuser)) {$class="认证会员";$img="3";}
else {$class="会员";$img="4";}
if ($timestamp-$online_user_info[1]<=$online_limit && $online_user_info[3]==$forumid){
if ($online_user_info[0]=="游客") $guestno++;
if ($online_user_info[0]=="隐身会员") $usernoc++;
if ($online_user_info[0]!="隐身会员" && $online_user_info[0]!="游客" ) {
$usergroup.=" <a onclick='Shows(messanger)' href='messanger.php?job=write&target=$online_user_info[0]' target=msg><img alt=给该".$class."留言 border=0 src='images/system/messages".$img.".gif'></a><a href='profile.php?job=show&target=$online_user_info[0]' title=查看该".$class."资料>$online_user_info[0]</a>";
$userno++;
}
}}
if ($usergroup) $usergroup="<tr><td bgcolor=$list_color2>$usergroup</td></tr>";
$suma=$userno+$usernoc;
$sum=$userno+$guestno+$usernoc;
print <<<EOT
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$bordercolor align=center>
<tr><td>
<table cellpadding=0 cellspacing=1 border=0 width=100%><tr><td>
<table cellpadding=0 cellspacing=0 border=0 width=100%>
<tr height=29>
<td bgcolor=$titlecolor class=title>本版块目前共有 <b>$sum</b> 人访问,包括 <b>$suma</b> 名注册用户(有 $usernoc 位隐身),和 <b>$guestno</b> 名游客</td>
<td align=center width="35%" bgcolor=$titlecolor><FORM action=thread.php method=post>
<div align="right">
<input type=hidden value=$forumid name=forumid>
<SELECT name=jinhua>
<OPTION selected value=jinhua>本版精华区</OPTION>
<OPTION value=1>显示昨天以来的主题</OPTION>
<OPTION value=2>显示二天以来的主题</OPTION>
<OPTION value=5>显示五天以来的主题</OPTION>
<OPTION value=10>显示十天以来的主题</OPTION>
<OPTION value=20>显示二十天以来的主题</OPTION>
<OPTION value=30>显示三十天以来的主题</OPTION>
<OPTION value=60>显示六十天以来的主题</OPTION>
<OPTION value=100>显示一百天以来的主题</OPTION>
<OPTION value=365>显示一年以来的主题</OPTION>
<OPTION value=''>显示所有的主题</OPTION>
</SELECT>
<INPUT type=submit value="搜索" style="height:20px; background-color:#f3f3f3; border:1 solid black;" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
</td>
</tr></table></td>
</tr></table>
<table cellpadding=0 cellspacing=1 border=0 width=100%>
$usergroup
</form></table>
</td></tr>
</table>
EOT;
}
function showarticle($print_info,$bar) {
global $bgcolor,$bottombar,$titleline,$contentline,$bordercolor,$article_color1,$tablewidth,$rvrcs;
print <<<EOT
<table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=1 bordercolor=$bordercolor>
<tr>
<td bgcolor=$bgcolor>
<table cellspacing=0 cellpadding=4 width=100% bgcolor=$bgcolor>
<tr>
<td valign=top width=20% bgcolor=$bgcolor rowspan=2>$print_info</td>
<td width=1 bgcolor=$bgcolor height=100% rowspan=2>
<table height=100% cellspacing=0 cellpadding=0 width=1 bgcolor=$bordercolor><tr><td width=1></td></tr></table>
</td>
<td valign=top width=* bgcolor=$bgcolor height=100%>$bar
<hr width=100% color=$bordercolor size=1>
<table cellspacing=0 cellpadding=0 width=100% height=85% style="TABLE-LAYOUT: fixed;WORD-WRAP: break-word" >
$titleline $contentline
</table>
</td>
</tr>
<tr>
<td valign=bottom bgcolor=$bgcolor><hr width=* color=$bordercolor size=1>$bottombar</td><td valign=bottom bgcolor=$bgcolor width=10%>$rvrcs</td></tr>
</table>
</td>
</tr>
</table>
EOT;
}
function sline() {
global $bordercolor,$article_color1,$tablewidth;
print(
"<table cellspacing=0 cellpadding=0 width=$tablewidth align=center bgcolor=$bordercolor border=0><tr><td height=1></td></tr></table>");
}
function getdaysreg($date){
$date = split("-",$date);
$date = mktime (0,0,0,$date[1],$date[2],$date[0]);
$date = (time() - $date) / (24*3600);
return $date ;
}//end function
function get_sta() {
global $forumid,$filename,$addhead,$username,$login_status,$username,
$bgcolor,$bordercolor,$titlecolor,$topic_author,$article_color1,$topic_name,$topic_date,
$topic_content,$topic_area,$print_info,$titlefontcolor,$bar,$topic_aaa,$idpath;
if (!file_exists("{$idpath}forum$forumid/$filename.sta")) return;
list($print_info[$topic_author],$bar[$topic_author])=view_user_info($topic_author);
$sta_data=file("{$idpath}forum$forumid/$filename.sta");
$detail=explode("|",$sta_data[0]);
$vote_sel=explode("|",$sta_data[1]); $pic=""; $amountsum=0;
$count=min(count($vote_sel),6);
for ($i=0; $i<$count; $i++) {
list($name[$i],$amount[$i]) =explode(",",$vote_sel[$i]);
$amountsum+=$amount[$i];
}
$zero=0;
if ($amountsum==0) {$zero=1; $amountsum=1;}
if ($detail[0]=="pie") {
$clrLst=array("777799","8ad500","eed805","FF0000","e46101","5A6633");
$pic="<img src=\"job.php?votepiejob=votepie&forumid=$forumid&filename=$filename\" align=left>";
$pic.="<table>";
for ($i=0; $i<$count; $i++) {
$pic.="<tr><td align=right><font color=$clrLst[$i]><b>$name[$i]</b></font>:</td><td align=left width=40> <b>$amount[$i]</b> 票</td></tr>";
}
$pic.="</table>";
}elseif ($detail[0]=="bar") {
$pic.="<table>";
for ($i=0; $i<$count; $i++) {
$width=floor(300*$amount[$i]/$amountsum);
$pic.="<tr><td align=right> $name[$i] :</td><td><img src=\"images/bar".($i+1).".gif\" width=$width height=10> {$amount[$i]} 票</td>";
}
$pic.="</table>";
}
if ($zero==1) $amountsum=0;
$picinfo="总共有 <b style=\"font-family:verdana\">$amountsum</b> 人参与本次投票 发起于 $topic_date 鉴定:保密";
if ($login_status==1 && (($forum_admin && in_array($username,$forum_admin)) || $username==$manager ) ) $bottombar.=" | * 来自:$area";
$status="";
if ($login_status==1) {
if (strpos($sta_data[0],"|$username|")!==false) {
$status=" * <b>您已经参与了这次投票</b>";
}
else {
for ($i=0; $i<$count; $i++) {
list($selectionname) =explode(",",$vote_sel[$i]);
$status.=("※ <input type=radio value=$i name=mychoice>$selectionname ");
}
$status.="<input type=hidden value=\"$forumid\" name=forumid><input type=hidden value=\"$filename\" name=filename>";
$status.="<input type=\"submit\" value=\"我也投\" style=\"height:20px;background-color:#f3f3f3;border:1 solid black\" onMouseOver=\"this.style.backgroundColor='#FFC864'\" onMouseOut =\"this.style.backgroundColor='#f3f3f3'\" onfocus=this.blur()>";
}
}
else $status=" * <b>对不起,您还未登录,无法参与投票</b>";
print <<<EOT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -