📄 global.php
字号:
<table bgcolor=$bordercolor border=0 cellpadding=0 cellspacing=1 width=600 align=center>
<form action=action.php?votejob=vote method=post>
<tr bgcolor=$article_color1><td>
<table border=0 cellpadding=1 cellspacing=0 width=100%>
<tr height=22><td bgcolor=$titlecolor><font color=$titlefontcolor> <b>* 投票:</b>$topic_name</font></td></tr>
<tr height=1 bgcolor=$bordercolor><td></td></tr>
<tr>
<td>
<table width=100% align=center>
<tr>
<td width=25% valign=top rowspan=3>$print_info[$topic_author]</td>
<td width=70% style="WORD-WRAP: break-word">
EOT;
echo convert($topic_content,$ftbcode_post);
print <<<EOT
<hr width=100% color=$bordercolor size=1>
</td>
<td width=5% rowspan=3></td>
</tr>
<tr bgcolor=#EEEEF8 height=100><td>$pic</td></tr>
<tr height=*><td><hr width=100% color=$bordercolor size=1>$picinfo</td></tr>
</table>
</td>
</tr>
<tr bgcolor=$bordercolor height=1><td></td></tr>
<tr height=22 bgcolor=$article_color1><td>$status</td></tr>
</table></td>
</tr>
</form>
</table>
<br>
EOT;
}
//---------Display the Message Table-------------------
function msg_box($title,$content) {
global $titlecolor,$bordercolor,$subcolor,$backgroundcolor,$tablewidth,$style_path;
print <<<EOT
<table width=$tablewidth border=0 cellspacing=0 cellpadding=0 align=center bgcolor=$bordercolor>
<tr>
<td>
<table width=100% border=0 cellspacing=1 cellpadding=3>
<tr bgcolor=$titlecolor>
<td class=title bgcolor=$titlecolor>$title</td>
</tr>
<tr bgcolor=$backgroundcolor>
<td><br>$content</td>
</tr>
<tr align=left bgcolor=$subcolor>
<td bgcolor=$titlecolor height=22></td>
</tr>
</table>
</td>
</tr>
</table>
EOT;
}
//---------Display the Navigation Bar-------------------
function headguide($des,$l2,$l3="",$echorefresh="yes") {
global $bbs_title,$tablewidth,$forumid;
$closepic = "<img src='images/system/home.gif'>";
$openpic = "-> ";
$barpic = "";
$space = " ";
if ($l3) $l2pic=$closepic; else $l2pic=$openpic;
print "<table width=$tablewidth border=0 cellspacing=0 cellpadding=0 align=center>
<tr>
<td width=* align=left valign=middle>"
.$space.$closepic."<a href='index.php'>$bbs_title</a>"
.$space.$barpic.$openpic."$l2";
if ($l3) echo "".$space.$space.$barpic.$openpic."".$l3;
print "</td><td align=right valign=bottom width=30%>".$des;
echo "</td></tr></table><TABLE><TR><TD></TD></TR></TABLE>
";
}
//--------------add lastvist time-----------------------------
function writetime($user) {
global $userpath,$timestamp,$u;
if (!$user) return 0;
if(file_exists("$userpath/$user.php")){
$useri=explode("|",readfromfile("$userpath/$user.php"));
$useri[16]=trim($useri[16]);
$useri[17]=$useri[18];
$useri[18]=$timestamp;
$uu=implode('|',$useri);
writetofile("$userpath/$user.php",$uu);
}
}
//-----------add lastvist time-----------------
//----find out the next available post file name------
function get_next_filename($list,$id) {
global $idpath;
$list=explode("\n",$list,11);
$count=min(count($list),11);
$filecount=0;
for ($i=0; $i<$count; $i++) {
$temp=explode("|",$list[$i]);
list($nouse,$thiscount)=explode("_",$temp[5]);
if ($thiscount>$filecount) $filecount=$thiscount;
}
$filecount++;
while (file_exists("{$idpath}forum$id/f_$filecount")) $filecount++;
return("f_$filecount");
}
//----push the Held Topics to the beginning of the list------
function push_heldtopics($list) {
$list=explode("\n",$list,12);
$count=count($list);
for ($i=0; $i<$count-1; $i++) {
$detail = explode("|",$list[$i]);
if ($detail[10] > 2) {
$held_topics[]=$list[$i];
unset($list[$i]);
}
}
if ($held_topics) $list= implode("\n",$held_topics)."\n".implode("\n",$list);
else $list=implode("\n",$list);
return $list;
}
//+-----------read & write------------
function readfromfile($file_name) {
$filenum=fopen($file_name,"r");
flock($filenum,LOCK_SH);
$file_data=fread($filenum,filesize($file_name));
fclose($filenum);
return $file_data;
}
function writetofile($file_name,$data,$method="w") {
$filenum=fopen($file_name,$method);
flock($filenum,LOCK_EX);
$file_data=fwrite($filenum,$data);
fclose($filenum);
return $file_data;
}
function check_permission($user,$type) {
global $manager,$forum_admin,$cg_admin;
if ($type=='forum'||$type=='former'||$type=='locked'||$type=='readonly') return 1;
if ($user==$manager) return 1;
return 0;
}
function get_forum_info() {
global $forum_name,$forum_type,$forumid,$forumlist,$forum_father,$forum_pwd,$forum_skin,$forum_type2,$forum_hide,$forum_post,$forum_sell,$cate_id,$cate_name,$cate_admins,$announce_title,$forum_announce,$ifchildren;
$forumlist=file("bbsdata/forumdata.php");
$count=count($forumlist);
for ($i=0; $i<$count; $i++) {
$detail=explode("|", trim($forumlist[$i]));
if ($detail[0]=="category") {$cate_id=$detail[3];$cate_name=$detail[1];$cate_admins=$detail[2];}
if ($detail[3]==$forumid) {
$forum_name=$detail[1];
$forum_father=$detail[4];
$forum_type=$detail[0];
$forum_pwd=$detail[5];
if($forum_pwd!="") $forum_type2="jiami";
$forum_skin=$detail[6];
$forum_hide=$detail[7];
$forum_post=$detail[8];
$forum_sell=$detail[9];
$announce_title=$detail[10];
$forum_announce=$detail[11];
$ifchildren=$detail[13];
break;
}
}
}
function get_children_info() {
global $forumid,$forumlist,$children_name,$children_type,$children_logo,$children_pwd,$children_id,$forum_children,$childrennum,$children_info;
$forumlist=file("bbsdata/forumdata.php");
$count=count($forumlist);
$forum_children=0;
$childrennum=0;
for ($i=0; $i<$count; $i++) {
$detail=explode("|", trim($forumlist[$i]));
if ($detail[4]==$forumid && $detail[0]!=category) {
$children_name[$childrennum]=$detail[1];
$children_id[$childrennum]=$detail[3];
$children_type[$childrennum]=$detail[0];
$children_info[$childrennum]=$detail[2];
$children_logo[$childrennum]=$detail[14];
$children_pwd[$childrennum]=$detail[5];
$forum_children=1;
$childrennum++;
}
}
}
function get_father_info() {
global $forumid,$forumlist,$father_name,$father_type,$father_id,$forum_father,$exists_forum_father;
$forumlist=file("bbsdata/forumdata.php");
$count=count($forumlist);
$exists_forum_father=0;
for ($i=0; $i<$count; $i++) {
$detail=explode("|", trim($forumlist[$i]));
if ($detail[3]==$forum_father) {
$father_name=$detail[1];
$father_id=$detail[3];
$father_type=$detail[0];
$exists_forum_father=1;
break;
}
}
}
//+------------Display the Jump-page---------------
function jump_page($URL,$content) {
global $login_status,$username,$skin,$bbs_title;
eval("\$css = \"".gettemplate('css')."\";");
echo $css;
require("userdata/style.php");
if($skin=='蓝天星穗')
{
$head_bodycolor="bgcolor=$background_color";
}
else
$head_bodycolor="background=$background_color";
$tablewidth=$tablewidth*2/3;
print <<<EOT
<meta http-equiv="refresh" content="1;url=$URL">
<body $head_bodycolor text="#000000" id="all" leftmargin="10" topmargin="0" marginwidth="10" marginheight="10" link="#000020" vlink="#000020" alink="#000020">
<br><table width="100%" border="0" cellspacing="0" cellpadding="0" height="90%" align="center">
<tr align="center" valign="middle"><td><table border="0" cellspacing="1" cellpadding="10" bgcolor="$backgroundcolor" width="$tablewidth">
<tr><td bgcolor="#FFFFFF" align="center"><p>
{$bbs_title}</a> » 提示信息 $title<br><br>
$content<br><br><a href=$URL>如果你不想继续等待请点击这里<br>
(或者你的浏览器无法自动返回)</a></p></td></tr></table></td></tr></table>
EOT;
exit;
}
//+---------ipban---------------
function ipbanned() {
global $ip;
if (!file_exists("bbsdata/ipbans.php")) return;
$term_bannedmembers = file("bbsdata/ipbans.php");
if (empty($term_bannedmembers)) return;
$count = count($term_bannedmembers);
for ($i=0; $i<$count; $i++) {
$bannedip = trim($term_bannedmembers[$i]);
if (!$bannedip) continue;
if (strpos($ip,$bannedip)===0) {
print (
'<html><head><title>IP 被禁止</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor=green><br>
<font color=000000 size=2>
你违反了网络管理安全法,你的一切操作已被屏蔽并已记录下你的IP与主机,交付有关部门审查,如发现你再次恶意破坏论坛,发表不良言语,我们将追究法律责任!<br><br>
希望你自重,不要让我们鄙视你!如有疑问,请联系管理员。<br><br>
[<a onfocus=this.blur() href="javascript:history.go(-1)">点击这里返回前一个页面</a>]
</body>
</html>');
exit;
}
}
}
//+-----------User functions---------------------
function get_user_portait($usericon) {
$portait=explode('%',$usericon);
$img=rand(1,2);
if (empty($usericon)) return "<img src='images/face/".$img.".gif' border=0>";
if ($portait[1] && $portait[2] && $portait[3])
return "<img src='$portait[1]' width=$portait[2] height=$portait[3] border=0>";
else {
if (file_exists("images/face/".$portait[0])) return "<img src='images/face/$portait[0]' border=0>";
else return "<img src='images/face/".$img.".gif' border=0>";
}
}
function getUserInfo() {
global $ofstarid,$username,$lastlogindate,$postamount,$level,$gotNewMessage,$usermoney,$userpath,$msgpath;
$username=$ofstarid;
if (file_exists("$userpath/$username.php"))
$usertemp=readfromfile("$userpath/$username.php");
$userdetail=explode("|",$usertemp);
$lastlogindate=$userdetail[17];
$postamount=$userdetail[13];
$usermoney=$userdetail[24];
$level=getUserLevel($postamount,$username);
$gotNewMessage=0;
if (file_exists("userdata
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -