📄 creathtm.php
字号:
<?php
!function_exists('adminmsg') && exit('Forbidden');
$basename="admin.php?adminjob=creathtm&type=$type";
if(!$action){
@include_once(R_P.'data/bbscache/forumcache.php');
$num=0; $forumcheck="<table cellspacing='0' cellpadding='0' border='0' width='100%' align='center'><tr>";
$sqladd=" AND f_type!='hidden' AND cms='0'";
$forumsel=$forumcache;
$query=$db->query("SELECT fid,name,allowhtm FROM pw_forums WHERE type<>'category' AND allowvisit='' $sqladd");
while($forum=$db->fetch_array($query)){
$fids.=$add.$forum['fid'];$add=',';
$htm_tr='';$num++;$num%5==0?$htm_tr='</tr><tr>':'';
if($forum['allowhtm']){
$htmfid.=$add2.$forum['fid'];$add2=',';
$checked='checked';
} else{
$checked='';
}
$forumcheck.="<td><input type='checkbox' name='allowhtm[]' value='$forum[fid]' $checked>$forum[name]</td>$htm_tr";
$forums.="<option value=$forum[fid]> $forum[name]</option>";
}
$forumcheck.="</tr></table>";
include PrintEot('creathtm');exit;
} elseif($_POST['action']=='submit'){
settype($allowhtm,'array');
$fids_a=explode(',',$fids);
unset($fids,$adddot);
foreach($fids_a as $value){
if(is_numeric($value)){
$fids.=$adddot.$value;
$adddot=',';
}
}
$query=$db->query("SELECT fid FROM pw_forums WHERE fid IN($fids)");
while($forum=$db->fetch_array($query)){
if(@in_array($forum['fid'],$allowhtm)){
$db->update("UPDATE pw_forums SET allowhtm='1' WHERE fid='$forum[fid]'");
} else{
$db->update("UPDATE pw_forums SET allowhtm='0' WHERE fid='$forum[fid]'");
}
}
updatecache_f();
adminmsg('operate_success');
} elseif($action=='creat'){
list($db_moneyname,$db_moneyunit,$db_rvrcname,$db_rvrcunit,$db_creditname,$db_creditunit)=explode("\t",$db_credits);
if(is_numeric($creatfid)){
$rt=$db->get_one("SELECT allowhtm FROM pw_forums WHERE fid='$creatfid'");
if(!$rt['allowhtm']){
adminmsg('template_error');
}
}
$output='readtpl';
include_once(R_P."data/style/$db_defaultstyle.php");
if(!file_exists("./template/$tplpath/$output.htm")){
$tplpath='wind';
}
require_once(R_P.'require/forum.php');
include_once R_P.'require/template.php';
include_once(R_P.'data/bbscache/forum_cache.php');
$path='../../..';
$yeyestyle=='no' ? $i_table="bgcolor=$tablecolor" : $i_table='class=i_table';
$db_union && $db_union=explode("\t",stripslashes($db_union));
$url="$path/read.php";
$db_http=='N' && $imgpath=$path.'/'.$imgpath;
$S_sql=',tm.*,p.voteopts,p.pollid,m.uid,m.username,m.oicq,m.groupid,m.memberid,m.icon AS micon,m.hack,m.honor,m.signature,m.regdate,m.signchange,md.onlinetime,md.postnum,md.digests,md.digests,md.rvrc,md.money,md.credit,md.thisvisit';
$J_sql='LEFT JOIN pw_tmsgs tm ON t.tid=tm.tid LEFT JOIN pw_members m ON m.uid=t.authorid LEFT JOIN pw_memberdata md ON md.uid=t.authorid LEFT JOIN pw_polls p ON p.pollid=t.pollid';
!$step && $step=1;
!$percount && $percount=100;
$start=($step-1)*$percount;
$next=$start+$percount;
$step++;
$jumpurl="$basename&action=$action&step=$step&percount=$percount&creatfid=$creatfid&fids=$fids";
$goon=0;
if($creatfid=='all'){
if($fids){
$creatadd=" WHERE t.fid IN('".str_replace(",","','",$fids)."')";
unset($fids);
} else{
adminmsg('template_noforum');
}
} elseif(is_numeric($creatfid)){
$creatadd="WHERE t.fid='$creatfid'";
} else{
adminmsg('forumid_error');
}
$query=$db->query("SELECT t.* $S_sql FROM pw_threads t $J_sql $creatadd ORDER BY topped DESC, lastpost DESC LIMIT $start,$percount");
unset($creatadd);
$topicdb=$articledb=array(); $tids='';
while($topic =$db->fetch_array($query)){
if(!$topic['tid'])continue;
$goon=1;
is_numeric($topic['tid']) && $tids.=$topic['tid'].',';
$topicdb[]=$topic;
}
$db->free_result($query);
$tids=substr($tids,0,-1);
if($tids){
$readnum=$db_readperpage-1;
$query = $db->query("SELECT p.*,m.uid,m.username,m.oicq,m.groupid,m.memberid,m.icon AS micon,m.hack,m.honor,m.signature,m.regdate,m.signchange,md.onlinetime,md.postnum,md.digests,md.digests,md.rvrc,md.money,md.credit,md.thisvisit FROM pw_posts p LEFT JOIN pw_members m ON m.uid=p.authorid LEFT JOIN pw_memberdata md ON md.uid=p.authorid WHERE p.tid IN($tids) ORDER BY postdate");
unset($tids);
while($article=$db->fetch_array($query)){
if(!is_array($articledb[$article['tid']]))settype($articledb[$article['tid']],'array');
$articledb[$article['tid']][]=$article;
}
$db->free_result($query);
}
//ob_end_clean();
foreach($topicdb as $key=>$read){
$readdb=$votedb=array();
$fid=$read['fid'];$tid=$read['tid'];
$foruminfo=$db->get_one("SELECT * FROM pw_forums WHERE fid='$fid'");
$date=date('ym',$read['postdate']);
$page=floor($article/$db_readperpage)+1;//修改的帖子所在的页数
$count= $read['replies']+1;
$pollid=$read['pollid'];
if($read['voteopts']){
$tpc_date=get_date($read['postdate']);
htmvote($read['voteopts']);
}
$readdb[]=htmread($read,0);
unset($topicdb[$key]);
$subject=$read['subject'];
$tpctitle='- '.$subject;
$favortitle=str_replace("'","‘",$subject);
if($read['replies']>0){
$floors=1;
if($articledb[$tid]){
foreach($articledb[$tid] as $key=>$read){
$readdb[]=htmread($read,$floors);
unset($articledb[$tid][$key]);
$floors++;
if($floors>9)break;
}
}
unset($sign);
}
$name=$forum[$fid]['name'];
if ($count%$db_readperpage==0){ //$count $db_readperpage read.php?fid=$fid&tid=$tid&
$numofpage=$count/$db_readperpage;
} else{
$numofpage=floor($count/$db_readperpage)+1;
}
if ($page=='lastpost' || $page>$numofpage){
$page=$numofpage;
}
$fengye=numofpage($count,$page,$numofpage,"$url?fid=$fid&tid=$tid&");//文章数,页码,共几页,路径
if(!is_dir(R_P.'htm_data/'.$fid)){
mkdir(R_P.'htm_data/'.$fid,0777);
writeover(R_P."htm_data/$fid/index.html",'');
}
if(!is_dir(R_P.'htm_data/'.$fid.'/'.$date)){
mkdir(R_P.'htm_data/'.$fid.'/'.$date,0777);
writeover(R_P."htm_data/$fid/$date/index.html",'');
}
ob_start();
include("./template/$tplpath/$output.htm");
writeover(R_P."htm_data/$fid/$date/$tid.html",ob_get_contents(),"rb+",0);ob_end_clean();
}
if($goon){
adminmsg('updatecache_step',$jumpurl);
} else{
adminmsg('operate_success');
}
} elseif($_POST['action']=='delete'){
@include_once(R_P.'data/bbscache/forum_cache.php');
if($creatfid=='all'){
$handle = opendir('htm_data/');
while ($file = readdir($handle)) {
if (($file!=".") && ($file!="..") && ($file!="")){
if (is_dir('htm_data/'.$file)){
//cms
if(!$forum[$file]['cms']){
deldir('htm_data/'.$file);
}
//cms
}
}
}
} elseif(is_numeric($creatfid)){
deldir('htm_data/'.$creatfid);
} else{
adminmsg('forumid_error');
}
adminmsg('operate_success');
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -