@H_
262_14@1、
修改admin/addclas
s.PHP文件,大约在1153行,<input type="submit" name="Submit" value="提交">
的前面
增加:<?
PHP if($docopy)
{ ?><input type="
check
Box" name="copyzlm" value="1"
checked>复制子栏目 <? }?>
2、
修改admin/emsclas
s.PHP文件,大约在52行,将“AddClass($_POST,$logininid,$loginin
);”
修改为“cAddClass($_POST,$loginin
);”
3、将以下
代码拷贝到class/userfun.
PHP中。
@H_
403_5@
@H_
262_14@function cAddClass($add,$userid,$user
Name){
global $empire,$dbtbpre;
if($add[copyzlm]=='1')
{
cAddClass1($add,$user
Name);
$r = $empire->fetch1( "
SELEct * from
{$dbtbpr
E}enewsclass order by classid desc limit 1"
);
$b
sql=$empire->query("
SELEct * from
{$dbtbpr
E}enewsclass where bclassid='$add[classid]' and bclassid<>'0'"
);
while($br=$empire->fetch($b
sql))
{
$br[copyzlm]='1';
$br[bclassid]=$r[classid];
$br[pripath]=$r[classpath];
$br[classpath]=strr
chr($br[classpath],'/'
);
if($br[islast]=
=0)
{
$brr=$br;
cAddClass($brr,$user
Name);//递归
}else
{
cAddClass1($br,$username,'1'
);
}
}
}else
{
AddClass($add,$user
Name);
}
}
//
增加栏目
function cAddClass1($add,$zz
=0)
{
global $empire,$dbtbpre;
//
增加外部栏目
if($add[ecmsclasstype])
{
AddWbClass($add,$user
Name);
}
$add[classpath]=trim($add[classpath]
);
if(!$add[classname]||!$add[classpath]||!$add[modid])
{
printerror("EmptyClass",""
);
}
if($add[islast]&&(!$add[new
stempid]||!$add[listtempid]))
{
printerror("LastMustChange",""
);
}
//操作权限
checkLevel($userid,$classid,"class"
);
if($zz=
=0)
{
$add=
dopostCla
ssvar($add
);
}
//目录已存在
if(str
chr($add[classpath],".")||str
chr($add[classpath],"/")||str
chr($add[classpath],""))
{
// printerror("badpath",""
);
}
$classpath=$add[pripath].$add[classpath];
if(file_exists("../../".$classpath))
{
printerror("ReClasspath",""
);
}
//取得表名
$tabler=GetModTable($add[modid]
);
$tabler[tid]=(
int)$tabler[tid];
//
增加大栏目
if(!$add[islast])
{
if(empty($add[bclassid]))//主栏目
{
$sonclass="";
$featherclass="";
}
else//中级栏目
{
//取得上一级父栏目
$r=$empire->fetch1("
SELEct featherclass,islast,wburl from
{$dbtbpr
E}enewsclass where classid='$add[bclassid]'"
);
if($r[islast])//是否终极栏目
{
printerror("Bclas
snotLast",""
);
}
if($r[wburl])
{
printerror("Bclas
snotWb",""
);
}
if(empty($r[featherclass]))
{
$r[featherclass]="|";
}
$featherclass=$r[featherclass].$add[bclassid]."|";
$sonclass="";
}
//建立目录
CreateClassPath($classpath
);
$
sql=$empire->query("insert into
{$dbtbpr
E}enewsclass(bclassid,classname,is_zt,sonclass,lencord,link_num,new
stempid,onclick,listtempid,featherclass,classpath,classtype,newspath,fil
ename,filetype,openpl,openadd,newline,hotline,goodline,classurl,groupid,myorder,fil
ename_qz,hotplline,modid,
checked,do
checkuser,
checkuser,firstline,bname,islist,searchtempid,tid,tbname,maxnum,
checkpl,down_num,online_num,listorderf,listorder,reorderf,reorder,intro,classimg,j
stempid,addinfofen,listdt,showclass,showdt,
checkqadd,qaddlist,qaddgroupid,qaddshowkey,adminqinfo,do
ctime,classpagekey,dtlisttempid,clas
stempid,nreclass,nreinfo,nrejs,nottobq,ipath,addreinfo,haddlist,same
title,definfo
Voteid,wburl,qedit
checked,wapstyl
EID,repreinfo,
pltempid,cgroupid) values($add[bclassid],'$add[classname]','$sonclass',$add[lencord],$add[link_num],$add[new
stempid],$add[listtempid],'$featherclass',$add[islast],'$classpath','$add[classtype]','$add[newspath]',$add[fil
ename],'$add[filetype]',$add[openpl],$add[openadd],$add[newline],$add[hotline],$add[goodline],'$add[classurl]',$add[groupid],$add[myorder],'$add[fil
ename_qz]',$add[hotplline],$add[modid],$add[
checked],$add[do
checkuser],'$add[
checkuser]',$add[firstline],'$add[bname]',$add[islist],$add[searchtempid],$tabler[tid],'$tabler[tbname]',$add[maxnum],$add[
checkpl],$add[down_num],$add[online_num],'$add[listorderf]','$add[listorder]','$add[reorderf]','$add[reorder]','$add[intro]','$add[classimg]',$add[j
stempid],$add[addinfofen],$add[listdt],$add[showclass],$add[showdt],$add[
checkqadd],$add[qaddlist],'$add[qaddgroupid]',$add[qaddshowkey],$add[adminqinfo],$add[do
ctime],'$add[classpagekey]','$add[dtlisttempid]','$add[clas
stempid]',$add[nreclass],$add[nreinfo],$add[nrejs],$add[nottobq],'$add[ipath]',$add[addreinfo],$add[haddlist],$add[same
title],$add[definfo
Voteid],'',$add[qedit
checked],$add[wapstyl
EID],'$add[repreinfo]','$add[
pltempid]','$add[cgroupid]'
);"
);
$lastid=$empire->lastid(
);
//副表
$empire->query("
replac
E into
{$dbtbpr
E}enewsclassadd(classid,classtext) values('$lastid','".addslashes($add[classtext])."'
);"
);
TogNotReClass
(1);
GetClass(
);
if($add[islist]=
=0||$add[islist]==2)
{
$clas
stemp=$add[islist]==2?GetClassText($lastid):GetClas
stemp($add['clas
stempid']
);
NewsBq($lastid,$clas
stemp,1
);
}
DelListEnews(
);//
删除缓存
文件
GetSearch($add[modid]
);//更新缓存
if($
sql)
{
insert_dolog("classid=".$lastid."<br>classname=".$add[classname]
);//操作日志
// printerror("AddClass
success","AddClas
s.PHP?enews=AddClass&from=$add[from]"
);
}
else
{
printerror("DbError",""
);
}
}
//
增加终级栏目
else
{
//
文件前缀
$add[fil
ename_qz]=RepFil
enameQz($add[fil
ename_qz]
);
if(empty($add[bclassid]))//主类别为终级栏目时
{
$sonclass="";
$featherclass="";
}
else//子栏目
{
//取得上一级父栏目
$r=$empire->fetch1("
SELEct featherclass,wburl from
{$dbtbpr
E}enewsclass where classid='$add[bclassid]'"
);
//是否终极类别
if($r[islast])
{
printerror("Bclas
snotLast",""
);
}
if(empty($r[featherclass]))
{
$r[featherclass]="|";
}
$featherclass=$r[featherclass].$add[bclassid]."|";
$sonclass="";
}
//建立
栏目目录
CreateClassPath($classpath
);
$
sql=$empire->query("insert into
{$dbtbpr
E}enewsclass(bclassid,'".addslashes($add[classtext])."'
);"
);
//
修改父栏目的子栏目
if($add[bclassid])
{
$b_r=$empire->fetch1("
SELEct sonclass,featherclass from
{$dbtbpr
E}enewsclass where classid='$add[bclassid]'"
);
if(empty($b_r[sonclass]))
{
$b_r[sonclass]="|";
}
$new_sonclass=$b_r[sonclass].$lastid."|";
$
update=$empire->query("
update
{$dbtbpr
E}enewsclass set sonclass='$new_sonclass' where classid='$add[bclassid]'"
);
//更改
父类别的父栏目的子栏目
$where=ReturnClass($b_r[featherclass]
);
if(empty($wher
E))
{
$where="classid
=0";
}
$b
sql=$empire->query("
SELEct sonclass,classid from
{$dbtbpr
E}enewsclass where ".$wher
E);
while($br=$empire->fetch($b
sql))
{
if(empty($br[sonclass]))
{
$br[sonclass]="|";
}
$new_sonclass=$br[sonclass].$lastid."|";
$
update=$empire->query("
update
{$dbtbpr
E}enewsclass set sonclass='$new_sonclass' where classid='$br[classid]'"
);
}
}
DelListEnews(
);//
删除缓存
文件
TogNotReClass
(1);
GetClass(
);
GetSearch($add[modid]
);//更新缓存
if($
sql)
{
insert_dolog("classid=".$lastid."<br>classname=".$add[classname]
);//操作日志
// printerror("AddLastClass
success","history.go(-1)"
);
}
}
}
@H_
403_5@
@H_
262_14@ @H_
403_5@
@H_
262_14@ @H_
403_5@
@H_
262_14@ @H_
403_5@
@H_
262_14@ @H_
403_5@
@H_
262_14@ @H_
403_5@
@H_
262_14@ @H_
403_5@
@H_
262_14@上面
代码,只有
函数cAddClass是我写的,下面的
函数cAddClass是对wf原来的
函数AddClass稍作
修改拷贝过来的,放到userfun.
PHP文件中目的是不对classfun.
PHP文件作改动。
好了,复制栏目试试看@H_
403_5@
@H_
262_14@
@H_
403_5@@H_
403_5@
@H_
262_14@ @H_
403_5@
@H_
262_14@ @H_
403_5@