mainpage.php

来自「linux/unix环境下的建站系统」· PHP 代码 · 共 577 行 · 第 1/2 页

PHP
577
字号
<?phprequire("www2-funcs.php");require("www2-board.php");if (!bbs_ext_initialized())	bbs_init_ext();	login_init();bbs_session_modify_user_mode(BBS_MODE_MMENU);# get an attribute from a particular nodefunction find_attr($parent,$name,$attr){    $nodes = $parent->child_nodes();    while($node = array_shift($nodes))        if ($node->node_name() == $name)            return $node->get_attribute($attr);    return "";}?><?phpfunction gen_hot_subjects_html(){# load xml doc$hotsubject_file = BBS_HOME . "/xml/day.xml";$doc = domxml_open_file($hotsubject_file);	if (!$doc)		return;$root = $doc->document_element();$boards = $root->child_nodes();$brdarr = array();?>	<div align="center"><table cellpadding="0" cellspacing="0" class="hot_title">        <tr>           <td>&nbsp;&nbsp;本日热点话题讨论 [<a href="rssi.php?h=1" target="_blank">RSS</a>]</td>        </tr>	</table></div>	<table border="0" cellpadding="0" cellspacing="0" class="HotTable" align="center"><?php# shift through the arraywhile($board = array_shift($boards)){    if ($board->node_type() == XML_TEXT_NODE)        continue;    $hot_title = find_content($board, "title");    $hot_author = find_content($board, "author");    $hot_board = find_content($board, "board");    $hot_time = find_content($board, "time");    $hot_number = find_content($board, "number");    $hot_groupid = find_content($board, "groupid");	$brdnum = bbs_getboard($hot_board, $brdarr);	if ($brdnum == 0)		continue;	$brd_encode = urlencode($brdarr["NAME"]);?><tr><td class="HotTitle">[<a href="bbsdoc.php?board=<?php echo $brd_encode; ?>"><?php  echo htmlspecialchars($brdarr["DESC"]); ?></a>]<a href="bbstcon.php?board=<?php echo $brd_encode; ?>&gid=<?php echo $hot_groupid; ?>"><?php echo htmlspecialchars($hot_title); ?> </a></td><td class="HotAuthor"><a href="bbsqry.php?userid=<?php echo $hot_author; ?>"><?php  echo $hot_author; ?></a>&nbsp;&nbsp;</td></tr><?php}?>		</table><?php}function gen_sec_hot_subjects_html($secid){	# load xml doc	$boardrank_file = BBS_HOME . sprintf("/xml/day_sec%d.xml", $secid);	$doc = domxml_open_file($boardrank_file);	if (!$doc)		return;	$root = $doc->document_element();	$boards = $root->child_nodes();?><?php	$brdarr = array();	# shift through the array	while($board = array_shift($boards))	{	    if ($board->node_type() == XML_TEXT_NODE)		continue;	    $hot_title = find_content($board, "title");	    $hot_author = find_content($board, "author");	    $hot_board = find_content($board, "board");	    $hot_time = find_content($board, "time");	    $hot_number = find_content($board, "number");	    $hot_groupid = find_content($board, "groupid");		$brdnum = bbs_getboard($hot_board, $brdarr);		if ($brdnum == 0)			continue;		$brd_encode = urlencode($brdarr["NAME"]);?><tr><td class="SectionItem">[<a href="bbsdoc.php?board=<?php echo $brd_encode; ?>"><?php  echo htmlspecialchars($brdarr["DESC"]); ?></a>]<a href="bbstcon.php?board=<?php echo $brd_encode; ?>&gid=<?php echo $hot_groupid; ?>"><?php echo htmlspecialchars($hot_title); ?> </a>&nbsp;&nbsp;</td></tr><?php	}}function gen_sections_html(){# load xml doc$boardrank_file = BBS_HOME . "/xml/board.xml";$doc = domxml_open_file($boardrank_file);	if (!$doc)		return;$root = $doc->document_element();$boards = $root->child_nodes();$sec_boards = array();$sec_boards_num = array();for ($i = 0; $i < BBS_SECNUM; $i++){	$sec_boards[$i] = array();	$sec_boards_num[$i] = 0;}$t = array(); // 分区序号变换表for ($i = 0; $i < BBS_SECNUM - 2; $i++)	$t[$i] = $i + 2;$t[$i] = 0;$t[$i+1] = 1;# shift through the arraywhile($board = array_shift($boards)){    if ($board->node_type() == XML_TEXT_NODE)        continue;    $ename = find_content($board, "EnglishName");    $cname = find_content($board, "ChineseName");    $visittimes = find_content($board, "VisitTimes");    $staytime = find_content($board, "StayTime");    $secid = find_content($board, "SecId");	$sec_boards[$secid][$sec_boards_num[$secid]]["EnglishName"] = $ename;	$sec_boards[$secid][$sec_boards_num[$secid]]["ChineseName"] = $cname;	$sec_boards[$secid][$sec_boards_num[$secid]]["VisitTimes"] = $visittimes;	$sec_boards[$secid][$sec_boards_num[$secid]]["StayTime"] = $staytime;	$sec_boards_num[$secid]++;}?>	<div align="center"><table cellpadding="0" cellspacing="0" class="type_title">        <tr>           <td>&nbsp;&nbsp;分类精彩讨论区</td>        </tr>	</table></div>		<table border="0" cellpadding="0" cellspacing="0" class="SecTable" align="center"><?php	for ($i = 0; $i < BBS_SECNUM; $i++)	{		if (defined("SITE_NEWSMTH") && ($t[$i]==0 || $t[$i]==1)) continue;?><tr>   <td valign="top" class="SectionTitle"><script type="text/javascript">putImage("section.gif","");</script>&nbsp;<span class="SectionName"><a href="bbsboa.php?group=<?php echo $t[$i]; ?>"><?php echo htmlspecialchars(constant("BBS_SECNAME".$t[$i]."_0")); ?></a></span>&nbsp;&nbsp;<span class="SectionList"><?php		$brd_count = $sec_boards_num[$t[$i]] > 5 ? 5 : $sec_boards_num[$t[$i]];		for ($k = 0; $k < $brd_count; $k++)		{?><a href="bbsdoc.php?board=<?php echo urlencode($sec_boards[$t[$i]][$k]["EnglishName"]); ?>"><?php echo $sec_boards[$t[$i]][$k]["ChineseName"]; ?></a>, <?php		}?><a href="rssi.php?h=2&s=<?php echo $t[$i]; ?>" target="_blank">[RSS]</a><a href="bbsboa.php?group=<?php echo $t[$i]; ?>">[更多]</a></span></td></tr><?php		gen_sec_hot_subjects_html($t[$i]);?></tr><?php		if (BBS_SECNUM - $i > 1)		{?>        <tr>           <td height="1" class="SecLine"></td>        </tr><?php		}	}?>      </table><?php}function gen_system_vote_html(){$vote_file = BBS_HOME."/vote/sysvote.html";if(!file_exists($vote_file)) return;include($vote_file);?><br />	<?php}function gen_new_boards_html(){# load xml doc$newboard_file = BBS_HOME . "/xml/newboards.xml";$doc = domxml_open_file($newboard_file);	if (!$doc)		return;$root = $doc->document_element();$boards = $root->child_nodes();?>      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="helpert">        <tr>           <td class="helpert_left"></td>          <td class="helpert_middle">新开版面</td>          <td class="helpert_right"></td>          <td>&nbsp;</td>        </tr>      </table>      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="helper">              <tr>                 <td width="100%" class="MainContentText"><ul style="margin: 5px 0px 0px 15px; padding: 0px;"><?php	$brdarr = array();	$j = 0;	# shift through the array	while($board = array_shift($boards))	{		if($j > 9)			break;				if ($board->node_type() == XML_TEXT_NODE)			continue;		$ename = find_content($board, "filename"); // EnglishName		$brdnum = bbs_getboard($ename, $brdarr);		if ($brdnum == 0)			continue;		$brd_encode = urlencode($brdarr["NAME"]);		$j ++ ;?><li class="default"><a href="bbsdoc.php?board=<?php echo $brd_encode; ?>"><?php echo htmlspecialchars($brdarr["DESC"]); ?></a></li><?php	}?></ul><?php	if($j > 9)	{?><p align="right"><a href="bbsxmlbrd.php?flag=2">&gt;&gt;更多</a></p><?php	}?>	</td></tr>      </table>      <br><?php}function gen_recommend_boards_html(){# load xml doc$boardrank_file = BBS_HOME . "/xml/rcmdbrd.xml";$doc = domxml_open_file($boardrank_file);	if (!$doc)		return;$root = $doc->document_element();$boards = $root->child_nodes();?>      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="helpert">        <tr>           <td class="helpert_left"></td>          <td class="helpert_middle">推荐版面</td>          <td class="helpert_right"></td>          <td>&nbsp;</td>        </tr>      </table>      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="helper">              <tr> 

⌨️ 快捷键说明

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