/*
showcolumn.php
循环显示论坛标题页的文件
参数说明
fdColumnId 表示栏目的名称
isCool==1 表示是酷帖,否则是普通帖子
flag==1 表示用户选择了排序方式,否则为系统自动的选择排序方式
sortdesc1==desc 表示降序 否则为升序
sortarticle 表示是选择的那个字段为主进行排序
*/
$whereid=3;
require ("./share.php");
statuscount($fdColumnId); //站内统计
hitcount($fdColumnId);
sitepostcount("look");
$highpeople_str="
最高在线人数:".highpeople();
$sql = "select fdIsClose,fdIsPublic from $bbscolumn where id='$fdColumnId'";
$columninfo = $DB_web->query_first($sql);
$return=$columninfo[fdIsClose];
$return=($fdIsClose)?$return:"0";
$permituse=$columninfo[fdIsPublic];
if(!$permituse)
{
$permituse=fdPermitUse((passcheck("fdLogin")),$fdColumnId);
}
if($flag)
{
$sortarticle=$sortarticle1;
$sortdesc=$sortdesc1;
$sorttype=($sortdesc=='asc')?"
":"
";
}
else
{
$sorttype=($sortdesc=='asc')?"
":"
";
}
$hrefstring="showcolumn.php?totalpages=$totalpages&intGotoPage=$intShowPage&fdColumnId=$fdColumnId&flag=1&isCool=$isCool&sortdesc1=".(($sortdesc=="asc")?"desc":"asc");
if($return)//版面开放
{
list($sortstr,$pagenumber)=explode("&&",getsortype($loginstr));
if($permituse)//判断是不是私有栏目
{
require "./config/class.fasttemplate.php";
$tpl = new FastTemplate("./templates".$bbsStyleOrder);
//弹出广告
if($fdColumnId)
{
$bulltinmessage='';
$ToDay = date("Y-m-d");
$sql="SELECT id,fdTitile FROM $bbsbulletin where fdColumnId=$fdColumnId and fdEndDate>='$ToDay' order by id desc" ;
$result=$DB_web->query($sql);
if($DB_web->num_rows($result)>0)
{
$bulltinmessage="";
}
}#if($fdColumnId)
//定义使用到的模板
$tpl->define(
array(
columnMain => "main.tpl", //显示栏目信息主模板
threadCircleInfo => "column_row.tpl", //循环主题
bottom => "bottom.tpl",
erroInfo => "erro.tpl" //错误提示
)
);
//定义一个用来循环的模板
$sql = "select * from $bbscolumn where id='$fdColumnId'";
$columninfo = $DB_web->query_first($sql);
if($columninfo[id]>0)//栏目存在
{
//找出要该栏目下每页显示的文章条数
$sql="select fdMemberId from $bbsbaner where fdGroupId=2 and fdColumnId=$fdColumnId";
$columninfomember = $DB_web->query_first($sql);
$sql="select fdName,fdDispTitleNum,fdBgSound,fdContent,fdHotHits,fdHotReply from $bbscolumn where id=$fdColumnId";
$columninfo1 = $DB_web->query_first($sql);
$bannerName=$columninfo1[fdName];
$fdDispTitleNum=$columninfo1[fdDispTitleNum];
$fdBgSound=$columninfo1[fdBgSound];
$fdContent=$columninfo1[fdContent];
if(!$columninfomember[fdMemberId])
{
$justbanner="暂无正斑竹";
}
else
{
//$sql="select id,fdLogin,fdName from $member where id=$columninfomember[fdMemberId]";
//$columninfo1 = $DB_web->query_first($sql);
//$justbanner="".$columninfo1[fdLogin].""; //找到了正斑竹
//$sql = "SELECT id,fdLogin FROM $member WHERE id=".intval($columninfomember[fdMemberId]);
$sql="select a.id,a.fdLogin,a.fdName from $member a,$bbsbaner b where a.id=b.fdMemberId and b.fdGroupId=2 and b.fdColumnId=$fdColumnId";
$resultColInfo1 = $DB_web->query($sql);
$justbanner = "";
while ( $columninfo1 = $DB_web->fetch_array($resultColInfo1) ) // 找到了正斑竹
{
$justbanner .= "".$columninfo1[fdLogin]." ";
}
}
//找副斑竹
$sql="select a.id,a.fdLogin,a.fdName from $member a,$bbsbaner b where a.id=b.fdMemberId and b.fdGroupId=3 and b.fdColumnId=$fdColumnId";
$Result=$DB_web->query($sql);
if($DB_web->num_rows($Result))
{
$assistantbanner=""; // xdju 注意不要老是把空格加在代码里面,修改不方便。
while($Row=$DB_web->fetch_array($Result))
{
$assistantbanner.="".$Row[fdLogin]." ";
}
}
if ($pagenumber)
$intLineNum=$pagenumber;
else
$intLineNum=$fdDispTitleNum;
if($intGotoPage <= 0) $intGotoPage=1;
$start = ($intGotoPage-1)*$intLineNum; //起始记录数
//某个栏目下的文章总数
if($isCool)
{
$sql="SELECT count(id) as id from $bbsarticle where fdColumnId='$fdColumnId' and fdVisible=0 and fdCool=1 and fdForbidCheck=0";
}
else
{
$sql="SELECT count(id) as id from $bbsarticle where fdColumnId='$fdColumnId' and fdVisible=0 and fdForbidCheck=0";
}
$totals = $DB_web->query_first($sql);
$totalnum = $totals[id];
if(!$intLineNum) $intLineNum=1;
$totalpages = intval($totalnum/$intLineNum);
if( ($totalnum%$intLineNum)<>0 ) $totalpages = $totalpages+1;
if($totalpages<=0) $totalpages=1;
$select_field = "id,fdColumnId,fdIsClose,fdTitle,fdMemberId,fdByte,fdCreateDate,fdIsTop,fdCool,fdWebCool,fdWebOrderId,fdImage,fdFlash,fdAttack,fdGraph,fdReply,fdHits,fdVisible,fdPoint,fdHitPoint,fdEditDate,fdEditLogin,fdReplyDate,fdLogin,fdReplyAuthor,fdSign,fdSupportHtml,fdSupportImgCode,fdSupportFaceCode,fdSupportVbCode";
if($isCool)
{
$mainsql = "SELECT $select_field from $bbsarticle where fdColumnId='$fdColumnId' and fdVisible=0 and fdCool=1 and fdForbidCheck=0 order by fdIsTop desc,$sortstr $sortarticle $sortdesc limit $start,$intLineNum";
}
else
{
$mainsql = "SELECT $select_field from $bbsarticle where fdColumnId='$fdColumnId' and fdVisible=0 and fdForbidCheck=0 order by fdIsTop desc,$sortstr $sortarticle $sortdesc limit $start,$intLineNum";
}
//print $mainsql;
$result = $DB_web->query( $mainsql );
$rowsNum = $DB_web->num_rows( $result );
$i = $rowsNum;
$tpl->define_dynamic ( "row", "threadCircleInfo" );
while($i>0)
{
$i--;
$threadinfo = $DB_web->fetch_array( $result );
$attribute1=$threadinfo[fdAttack]?"附件":"";
$attribute2=$threadinfo[fdFlash]?"FLASH、":"";
$attribute3=$threadinfo[fdImage]?"附图、":"";
$attribute=$attribute3.$attribute2.$attribute1;
if (substr($attribute,-2,2)=="、"){
$attribute=str_replace("、","",$attribute);
}
$attribute=($attribute)?" [$attribute]":"";
$infoimage1=(substr($threadinfo[fdReplyDate],0,10)==date('Y-m-d'))?"
":"";
$infoimage2=(substr($threadinfo[fdCreateDate],0,10)==date('Y-m-d'))?"
":"";
$infoimage=$infoimage1;
$infoimage=(strlen($infoimage2)>5)?$infoimage2:$infoimage;
//定义循环模板中的变量
$cool=($threadinfo[fdCool])?"
":"";
$fdReplyAuthor=($threadinfo[fdReplyAuthor])?($threadinfo[fdReplyAuthor]):($threadinfo[fdLogin]);
$tpl->assign(
array(
startinfo => "",
endinfo => "",
infoimage => $infoimage,
topimage => ($threadinfo[fdIsTop]) ? "
" : "",
faceimage => $threadinfo[fdGraph],
title_href => "showthread.php?fdColumnId=$fdColumnId&threadid=$threadinfo[id]&sortype=$sortdesc1&sortfield=$sortarticle1",
articletitle=> $cool.mark($threadinfo[fdTitle]).$attribute,
bity => $threadinfo[fdByte],
author => "
":"
",
/*
isCool1 => "?fdColumnId=$fdColumnId",
isCoolname1 => "
",
isCool => "?fdColumnId=$fdColumnId&isCool=1",
isCoolname => "
",
*/
)
);
}
//定义分页模板的单元变量
else
$tpl->assign(
array(
column_title => $fdWebSiteName."--".$columninfo[fdName],
totalthreads => $totalnum,
bannertitle => $columninfo[fdContent],
bulltin => $bulltinmessage,
guide => guide($fdColumnId),
guideindex => $index,
guidetarget => $target,
thiscolumnname => $columninfo[fdName],
banner => ($justbanner) ? $justbanner : "暂无斑竹",
assistant => ($assistantbanner) ? $assistantbanner : "暂无副斑竹",
bannerwords => $columninfo[fdWords],
newthread => "newthread.php?fdColumnId=$fdColumnId",
JSCODE => $javascriptcode,
totalpeople => totalpeople(),
totalpost => totalpost(),
highpeople => ($fd_highonlinepeople)?$highpeople_str:" ",
title => $fdWebSiteName,
bgmusic => (strlen($fdBgSound)>10)?"
":"
",
/*
isCool1 => "?fdColumnId=$fdColumnId",
isCoolname1 => "
",
isCool => "?fdColumnId=$fdColumnId&isCool=1",
isCoolname => "
",
*/
)
);
$tpl->parse(main, ".threadCircleInfo"); //解析循环的模板
$tpl->parse(bottominfo, "bottom"); //解析底部模板模板
$tpl->parse(main, "columnMain"); //解析主模板模板
}//end if($columninfo[id]>0)//栏目存在
else
{
//定义分页模板的单元变量
$tpl->assign(
array(
erroinfo => "您输入的栏目号无效,没有该栏目存在",
totalpeople => totalpeople(),
totalpost => totalpost(),
highpeople => ($fd_highonlinepeople)?$highpeople_str:" ",
title => $title[7],
sitename => $fdWebSiteName,
bgmusic => (strlen($fdBgSound)>10)?"
":"
",
/*
isCool1 => "?fdColumnId=$fdColumnId",
isCoolname1 => "
",
isCool => "?fdColumnId=$fdColumnId&isCool=1",
isCoolname => "
",
*/
)
);
$tpl->parse(main, "erroInfo"); //解析非循环的模板
$tpl->parse(bottominfo, "bottom"); //解析底部模板模板
$tpl->parse(main, "columnMain"); //解析主模板模板
}
$tpl->FastPrint(); //显示结果
}#if($permituse)//判断是不是私有栏目
else//私有栏目
{
require "./config/class.fasttemplate.php";
$tpl = new FastTemplate("./templates".$bbsStyleOrder);
//定义使用到的模板
$tpl->define(
array(
columnMain => "main.tpl", //显示栏目信息主模板
threadCircleInfo => "column_row.tpl", //循环主题
bottom => "bottom.tpl",
erroInfo => "erro.tpl" //错误提示
)
);
//定义分页模板的单元变量
$tpl->assign(
array(
erroinfo => $permissionword,
totalpeople => totalpeople(),
totalpost => totalpost(),
highpeople => ($fd_highonlinepeople)?$highpeople_str:" ",
title => $title[7],
sitename => $fdWebSiteName,
bgmusic => (strlen($fdBgSound)>10)?"
":"
",
/*
isCool1 => "?fdColumnId=$fdColumnId",
isCoolname1 => "
",
isCool => "?fdColumnId=$fdColumnId&isCool=1",
isCoolname => "
",
*/
)
);
$tpl->parse(main, ".erroInfo"); //解析非循环的模板
$tpl->parse(bottominfo, "bottom"); //解析底部模板模板
$tpl->parse(main, "columnMain");
$tpl->FastPrint();
}
}#if($return)//版面开放
else//版面关闭
{
require "./config/class.fasttemplate.php";
$tpl = new FastTemplate("./templates".$bbsStyleOrder);
//定义使用到的模板
$tpl->define(
array(
columnMain => "main.tpl", //显示栏目信息主模板
threadCircleInfo => "column_row.tpl", //循环主题
bottom => "bottom.tpl",
erroInfo => "erro.tpl" //错误提示
)
);
//定义分页模板的单元变量
$tpl->assign(
array(
erroinfo => $closeword,
totalpeople => totalpeople(),
totalpost => totalpost(),
highpeople => ($fd_highonlinepeople)?$highpeople_str:" ",
title => $title[7],
sitename => $fdWebSiteName,
bgmusic => (strlen($fdBgSound)>10)?"
":"
",
/*
isCool1 => "?fdColumnId=$fdColumnId",
isCoolname1 => "
",
isCool => "?fdColumnId=$fdColumnId&isCool=1",
isCoolname => "
",
*/
)
);
$tpl->parse(main, ".erroInfo"); //解析非循环的模板
$tpl->parse(bottominfo, "bottom"); //解析底部模板模板
$tpl->parse(main, "columnMain");
$tpl->FastPrint();
}
//分页函数
function intShowPages($intLineNum,$intGotoPage,$totalpages){
global $fdColumnId,$flag,$sortdesc,$sortarticle1,$isCool;
$intWhileNum=10;
$intSelfLine=$intGotoPage; #本页
$intStartPage=(($intSelfLine-1)-(($intSelfLine-1)%$intWhileNum));
$intEndPage=$intStartPage+$intWhileNum-1;
if($totalpages<$intEndPage){
$intEndPage=$totalpages-1;
$intWhileNum=$intEndPage-$intStartPage+1;
}
$sortdesc1=($sortdesc=="asc")?"desc":"asc";
$return="| "; for($i=1;$i<$intWhileNum+1;$i++){ $intOffsetNum=($intStartPage+($i-1))*$intLineNum; $intShowPage=($intStartPage+$i); if($intSelfLine==$intStartPage+$i){ #当前页不做联接 $return.=" ".$intShowPage." "; }else{ if($intShowPage<=$totalpages){ $return.=" ".$intShowPage.""; } } } $return.=" | "; $next_page=$intSelfLine+1; #下一页的页数 $return.="