123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856 |
- <?php
- //*********************** 专题 *********************
- //返回字段值
- function ReturnZFvalue($value)
- {
- $value=str_replace("\r\n","|",$value);
- return $value;
- }
- //取得专题表单元素html代码
- function GetZtFform($type,$f,$fvalue,$fformsize=''){
- if($type=="select"||$type=="radio"||$type=="checkbox")
- {
- return GetZFformSelect($type,$f,$fvalue,$fformsize);
- }
- $file="../data/html/classfhtml.txt";
- $data=ReadFiletext($file);
- $exp="[!--".$type."--]";
- $r=explode($exp,$data);
- $string=str_replace("[!--enews.var--]",$f,$r[1]);
- $string=str_replace("[!--enews.def.val--]",$fvalue,$string);
- if($type=='editor')//编辑器
- {
- $editortype='Default';
- $string=str_replace("[!--editor.type--]",$editortype,$string);
- $string=str_replace("[!--editor.basepath--]",'../ecmseditor/infoeditor/',$string);
- }
- elseif($type=='img'||$type=='flash'||$type=='file')//附件
- {
- $string=str_replace("[!--enews.modtype--]",'2',$string);
- $string=str_replace("[!--enews.path--]",'../',$string);
- }
- $string=RepZFformSize($f,$string,$type,$fformsize);
- return fAddAddsData($string);
- }
- //取得select/radio元素代码
- function GetZFformSelect($type,$f,$fvalue,$fformsize=''){
- $vr=explode("|",$fvalue);
- $count=count($vr);
- $change="";
- $def=':default';
- for($i=0;$i<$count;$i++)
- {
- $val=$vr[$i];
- $isdef="";
- if(strstr($val,$def))
- {
- $dr=explode($def,$val);
- $val=$dr[0];
- $isdef="||\$ecmsfirstpost==1";
- }
- if($type=='select')
- {
- $change.="<option value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' selected':''?>>".$val."</option>";
- }
- elseif($type=='checkbox')
- {
- $change.="<input name=\"".$f."[]\" type=\"checkbox\" value=\"".$val."\"<?=strstr(\$r[".$f."],\"|".$val."|\")".$isdef."?' checked':''?>>".$val;
- }
- else
- {
- $change.="<input name=\"".$f."\" type=\"radio\" value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' checked':''?>>".$val;
- }
- }
- if($type=="select")
- {
- if($fformsize)
- {
- $addsize=' style="width:'.$fformsize.'"';
- }
- $change="<select name=\"".$f."\" id=\"".$f."\"".$addsize.">".$change."</select>";
- }
- return $change;
- }
- //替换表单元素长度
- function RepZFformSize($f,$string,$type,$fformsize=''){
- $fformsize=ReturnDefZFformSize($f,$type,$fformsize);
- if($type=='textarea'||$type=='editor')
- {
- $r=explode(',',$fformsize);
- $string=str_replace('[!--fsize.w--]',$r[0],$string);
- $string=str_replace('[!--fsize.h--]',$r[1],$string);
- }
- else
- {
- $string=str_replace('[!--fsize.w--]',$fformsize,$string);
- }
- return $string;
- }
- //返回默认长度
- function ReturnDefZFformSize($f,$type,$fformsize){
- if(empty($fformsize))
- {
- if($type=='textarea')
- {
- $fformsize='60,10';
- }
- elseif($type=='img')
- {
- $fformsize='45';
- }
- elseif($type=='file')
- {
- $fformsize='45';
- }
- elseif($type=='flash')
- {
- $fformsize='45';
- }
- elseif($type=='date')
- {
- $fformsize='12';
- }
- elseif($type=='color')
- {
- $fformsize='10';
- }
- elseif($type=='linkfield')
- {
- $fformsize='45';
- }
- elseif($type=='downpath')
- {
- $fformsize='45';
- }
- elseif($type=='onlinepath')
- {
- $fformsize='45';
- }
- elseif($type=='editor')
- {
- $fformsize='100%,300';
- }
- }
- return $fformsize;
- }
- //更新栏目表单文件
- function ChangeZtForm(){
- global $empire,$dbtbpre;
- $file='../data/html/ztaddform.php';
- $mtemp='';
- $sql=$empire->query("select fname,f,fhtml from {$dbtbpre}enewsztf order by myorder,fid");
- while($r=$empire->fetch($sql))
- {
- $mtemp.="<tr bgcolor='#FFFFFF' height=25><td>".$r['fname']."</td><td>".$r['fhtml']."</td></tr>";
- }
- $mtemp="<?php
- if(!defined('InEmpireCMS'))
- {exit();}
- ?>".$mtemp;
- WriteFiletext($file,$mtemp);
- }
- //增加专题字段
- function AddZtF($add,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"ztf");
- $add[f]=RepPostVar($add[f]);
- if(empty($add[f])||empty($add[fname]))
- {
- printerror("EmptyF","");
- }
- //字段是否重复
- $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsztadd");
- $b=0;
- while($r=$empire->fetch($s))
- {
- if($r[Field]==$add[f])
- {
- $b=1;
- break;
- }
- }
- if($b)
- {
- printerror("ReF","");
- }
- $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewszt");
- $b=0;
- while($r=$empire->fetch($s))
- {
- if($r[Field]==$add[f])
- {
- $b=1;
- break;
- }
- }
- if($b)
- {
- printerror("ReF","");
- }
- $add[fvalue]=ReturnZFvalue($add[fvalue]);//初始化值
- //字段类型
- if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
- {
- $def=" default '0'";
- }
- elseif($add[ftype]=="VARCHAR")
- {
- $def=" default ''";
- }
- else
- {
- $def="";
- }
- $type=$add[ftype];
- //VARCHAR
- if($add[ftype]=='VARCHAR'&&empty($add[flen]))
- {
- $add[flen]='255';
- }
- //字段长度
- if($add[flen]){
- if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
- $type.="(".$add[flen].")";
- }
- }
- $field="`".$add[f]."` ".$type." NOT NULL".$def;
- //新增字段
- $asql=$empire->query("alter table {$dbtbpre}enewsztadd add ".$field);
- //替换代码
- $fhtml=GetZtFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
- if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
- {
- $fhtml=str_replace("\$r[","\$addr[",$fhtml);
- }
- //处理变量
- $add[myorder]=(int)$add[myorder];
- $sql=$empire->query("insert into {$dbtbpre}enewsztf(f,fname,fform,fhtml,fzs,myorder,ftype,flen,fvalue,fformsize) values('$add[f]','$add[fname]','$add[fform]','".eaddslashes2($fhtml)."','".eaddslashes($add[fzs])."',$add[myorder],'$add[ftype]','$add[flen]','".eaddslashes2($add[fvalue])."','$add[fformsize]');");
- $lastid=$empire->lastid();
- //更新表单
- ChangeZtForm();
- if($asql&&$sql)
- {
- //操作日志
- insert_dolog("fid=".$lastid."<br>f=".$add[f]);
- printerror("AddFSuccess","special/AddZtF.php?enews=AddZtF".hReturnEcmsHashStrHref2(0));
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
- //修改专题字段
- function EditZtF($add,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"ztf");
- $fid=(int)$add['fid'];
- $add[f]=RepPostVar($add[f]);
- $add[oldf]=RepPostVar($add[oldf]);
- if(empty($add[f])||empty($add[fname])||!$fid){
- printerror("EmptyF","history.go(-1)");
- }
- if($add[f]<>$add[oldf]){
- //字段是否重复
- $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsztadd");
- $b=0;
- while($r=$empire->fetch($s)){
- if($r[Field]==$add[f]){
- $b=1;
- break;
- }
- }
- if($b){
- printerror("ReF","history.go(-1)");
- }
- $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewszt");
- $b=0;
- while($r=$empire->fetch($s))
- {
- if($r[Field]==$add[f])
- {
- $b=1;
- break;
- }
- }
- if($b)
- {
- printerror("ReF","");
- }
- }
- $add[fvalue]=ReturnZFvalue($add[fvalue]);//初始化值
- //字段类型
- if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
- {
- $def=" default '0'";
- }
- elseif($add[ftype]=="VARCHAR")
- {
- $def=" default ''";
- }
- else
- {
- $def="";
- }
- $type=$add[ftype];
- //VARCHAR
- if($add[ftype]=='VARCHAR'&&empty($add[flen]))
- {
- $add[flen]='255';
- }
- //字段长度
- if($add[flen]){
- if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
- $type.="(".$add[flen].")";
- }
- }
- $field="`".$add[f]."` ".$type." NOT NULL".$def;
- $usql=$empire->query("alter table {$dbtbpre}enewsztadd change `".$add[oldf]."` ".$field);
- //替换代码
- if($add[f]<>$add[oldf]||$add[fform]<>$add[oldfform]||$add[fvalue]<>$add[oldfvalue]||$add[fformsize]<>$add[oldfformsize]){
- $fhtml=GetZtFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
- if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
- {
- $fhtml=str_replace("\$r[","\$addr[",$fhtml);
- }
- }
- else{
- $fhtml=$add[fhtml];
- }
- //处理变量
- $add[myorder]=(int)$add[myorder];
- $sql=$empire->query("update {$dbtbpre}enewsztf set f='$add[f]',fname='$add[fname]',fform='$add[fform]',fhtml='".eaddslashes2($fhtml)."',fzs='".eaddslashes($add[fzs])."',myorder=$add[myorder],ftype='$add[ftype]',flen='$add[flen]',fvalue='".eaddslashes2($add[fvalue])."',fformsize='$add[fformsize]' where fid=$fid");
- //更新表单
- ChangeZtForm();
- if($usql&&$sql)
- {
- insert_dolog("fid=".$fid."<br>f=".$add[f]);//操作日志
- printerror("EditFSuccess","special/ListZtF.php".hReturnEcmsHashStrHref2(1));
- }
- else
- {printerror("DbError","history.go(-1)");}
- }
- //删除专题字段
- function DelZtF($add,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"ztf");
- $fid=(int)$add['fid'];
- if(empty($fid)){
- printerror("EmptyFid","history.go(-1)");
- }
- $r=$empire->fetch1("select f from {$dbtbpre}enewsztf where fid='$fid'");
- if(!$r[f]){
- printerror("EmptyFid","history.go(-1)");
- }
- $usql=$empire->query("alter table {$dbtbpre}enewsztadd drop COLUMN `".$r[f]."`");
- $sql=$empire->query("delete from {$dbtbpre}enewsztf where fid='$fid'");
- //更新表单表
- ChangeZtForm();
- if($usql&&$sql)
- {
- insert_dolog("fid=".$fid."<br>f=".$r[f]);//操作日志
- printerror("DelFSuccess","special/ListZtF.php".hReturnEcmsHashStrHref2(1));
- }
- else
- {printerror("DbError","history.go(-1)");}
- }
- //修改专题字段顺序
- function EditZtFOrder($fid,$myorder,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"ztf");
- for($i=0;$i<count($myorder);$i++)
- {
- $fid[$i]=(int)$fid[$i];
- $newmyorder=(int)$myorder[$i];
- $usql=$empire->query("update {$dbtbpre}enewsztf set myorder=$newmyorder where fid='$fid[$i]'");
- }
- //更新表单表
- ChangeZtForm();
- printerror("EditFOrderSuccess","special/ListZtF.php".hReturnEcmsHashStrHref2(1));
- }
- //返回专题字段
- function ReturnZtAddF($add,$ecms=0){
- global $empire,$dbtbpre;
- $ret_r[0]='';
- $ret_r[1]='';
- $fsql=$empire->query("select f from {$dbtbpre}enewsztf");
- if($ecms==0)//增加
- {
- while($fr=$empire->fetch($fsql))
- {
- $f=$fr['f'];
- $fval=$add[$f];
- $fval=RepPhpAspJspcode($fval);
- $ret_r[0].=",`".$f."`";
- $ret_r[1].=",'".AddAddsData($fval)."'";
- }
- }
- else//修改
- {
- while($fr=$empire->fetch($fsql))
- {
- $f=$fr['f'];
- $fval=$add[$f];
- $fval=RepPhpAspJspcode($fval);
- $ret_r[0].=",`".$f."`='".AddAddsData($fval)."'";
- }
- }
- return $ret_r;
- }
- //处理专题提交变量
- function DoPostZtVar($add){
- if(empty($add[zttype])){
- $add[zttype]=".html";
- }
- if(empty($add[ztnum])){
- $add[ztnum]=25;
- }
- $add[zcid]=(int)$add['zcid'];
- $add[ztname]=eaddslashes(ehtmlspecialchars($add[ztname]));
- $add[intro]=eaddslashes(RepPhpAspJspcode($add[intro]));
- $add[ztpagekey]=eaddslashes(RepPhpAspJspcode($add[ztpagekey]));
- $add[ztnum]=(int)$add[ztnum];
- $add[listtempid]=(int)$add[listtempid];
- $add[classid]=(int)$add[classid];
- $add[islist]=(int)$add[islist];
- $add[maxnum]=(int)$add[maxnum];
- $add[showzt]=(int)$add[showzt];
- $add[classtempid]=(int)$add[classtempid];
- $add['myorder']=(int)$add['myorder'];
- $add[reorder]=RepPostVar2($add[reorder]);
- $add[classtext]=RepPhpAspJspcode($add[classtext]);
- $add[usezt]=(int)$add[usezt];
- $add[yhid]=(int)$add[yhid];
- $add['endtime']=$add['endtime']?to_time($add['endtime']):0;
- $add['closepl']=(int)$add['closepl'];
- $add['checkpl']=(int)$add['checkpl'];
- $add['from']=(int)$add['from'];
- $add['filepass']=(int)$add['filepass'];
- $add['pltempid']=(int)$add['pltempid'];
- if($add['usernames'])
- {
- $add['usernames']=','.$add['usernames'].',';
- }
- //目录
- $add[ztpath]=$add['pripath'].$add['ztpath'];
- $add[ztpath]=eaddslashes($add[ztpath]);
- return $add;
- }
- //增加专题
- function AddZt($add,$userid,$username){
- global $empire,$class_r,$dbtbpre,$public_r;
- $add[ztpath]=trim($add[ztpath]);
- if(!$add[ztname]||!$add[listtempid]||!$add[ztpath]){
- printerror("EmptyZt","");
- }
- CheckLevel($userid,$username,$classid,"zt");
- $add=DoPostZtVar($add);
- $createpath='../../'.$add[ztpath];
- //检测目录是否存在
- if(file_exists($createpath)){
- printerror("ReZtpath","");
- }
- CreateZtPath($add[ztpath]);//建立专题目录
- $addtime=time();
- //取得表名
- $tabler=GetModTable(GetListtempMid($add[listtempid]));
- $tabler[tid]=(int)$tabler[tid];
- $sql=$empire->query("insert into {$dbtbpre}enewszt(ztname,ztnum,listtempid,onclick,ztpath,zttype,zturl,classid,islist,maxnum,reorder,intro,ztimg,zcid,showzt,ztpagekey,classtempid,myorder,usezt,yhid,endtime,closepl,checkpl,restb,usernames,addtime,pltempid) values('$add[ztname]',$add[ztnum],$add[listtempid],0,'$add[ztpath]','$add[zttype]','$add[zturl]',$add[classid],$add[islist],$add[maxnum],'$add[reorder]','$add[intro]','$add[ztimg]',$add[zcid],$add[showzt],'$add[ztpagekey]','$add[classtempid]',$add[myorder],'$add[usezt]','$add[yhid]','$add[endtime]','$add[closepl]','$add[checkpl]','$public_r[pldeftb]','$add[usernames]','$addtime','$add[pltempid]');");
- $ztid=$empire->lastid();
- //副表
- $ret_zr=ReturnZtAddF($add,0);
- $empire->query("replace into {$dbtbpre}enewsztadd(ztid,classtext".$ret_zr[0].") values('$ztid','".eaddslashes2($add[classtext])."'".$ret_zr[1].");");
- //更新附件
- UpdateTheFileOther(2,$ztid,$add['filepass'],'other');
- //生成页面
- if($add[islist]==0||$add[islist]==2)
- {
- $classtemp=$add[islist]==2?GetZtText($ztid):GetClassTemp($add['classtempid']);
- NewsBq($ztid,$classtemp,3,1);
- }
- GetClass();//更新缓存
- if($sql){
- insert_dolog("ztid=".$ztid."<br>ztname=".$add[ztname]);//操作日志
- printerror("AddZtSuccess","special/AddZt.php?enews=AddZt".hReturnEcmsHashStrHref2(0));
- }
- else{
- printerror("DbError","");
- }
- }
- //修改专题
- function EditZt($add,$userid,$username){
- global $empire,$class_r,$dbtbpre,$loginlevel;
- $add[ztid]=(int)$add[ztid];
- $add[ztpath]=trim($add[ztpath]);
- if(!$add[ztname]||!$add[listtempid]||!$add[ztpath]||!$add[ztid]){
- printerror("EmptyZt","");
- }
- $add=DoPostZtVar($add);
- //CheckLevel($userid,$username,$classid,"zt");
- $returnandlevel=CheckAndUsernamesLevel('dozt',$add[ztid],$userid,$username,$loginlevel);
- $upusernames='';
- if($returnandlevel==2)
- {
- $upusernames=",usernames='$add[usernames]'";
- }
- //改变目录
- if($add[oldztpath]<>$add[ztpath]){
- $createpath='../../'.$add[ztpath];
- if(file_exists($createpath)){
- printerror("ReZtpath","");
- }
- if($add['oldpripath']==$add['pripath']){
- $new="../../";
- @rename($new.$add[oldztpath],$new.$add[ztpath]);//改变目录名
- }
- else{
- CreateZtPath($add[ztpath]);//建立专题目录
- }
- }
- //取得表名
- $tabler=GetModTable(GetListtempMid($add[listtempid]));
- $tabler[tid]=(int)$tabler[tid];
- $sql=$empire->query("update {$dbtbpre}enewszt set ztname='$add[ztname]',ztnum=$add[ztnum],listtempid=$add[listtempid],ztpath='$add[ztpath]',zttype='$add[zttype]',zturl='$add[zturl]',classid=$add[classid],islist=$add[islist],maxnum=$add[maxnum],reorder='$add[reorder]',intro='$add[intro]',ztimg='$add[ztimg]',zcid=$add[zcid],showzt=$add[showzt],ztpagekey='$add[ztpagekey]',classtempid='$add[classtempid]',myorder=$add[myorder],usezt='$add[usezt]',yhid='$add[yhid]',endtime='$add[endtime]',closepl='$add[closepl]',checkpl='$add[checkpl]',pltempid='$add[pltempid]'".$upusernames." where ztid='$add[ztid]'");
- //副表
- $ret_zr=ReturnZtAddF($add,1);
- $empire->query("update {$dbtbpre}enewsztadd set classtext='".eaddslashes2($add[classtext])."'".$ret_zr[0]." where ztid='$add[ztid]'");
- //更新专题子类
- if($add['endtime']!=$add['oldendtime'])
- {
- $empire->query("update {$dbtbpre}enewszttype set endtime='$add[endtime]' where ztid='$add[ztid]'");
- }
- //更新附件
- UpdateTheFileEditOther(2,$add['ztid'],'other');
- GetClass();//更新缓存
- //生成页面
- if($add[islist]==0||$add[islist]==2)
- {
- $classtemp=$add[islist]==2?GetZtText($add[ztid]):GetClassTemp($add['classtempid']);
- NewsBq($add[ztid],$classtemp,3,1);
- }
- if($sql)
- {
- $returnurl='special/ListZt.php'.hReturnEcmsHashStrHref2(1);
- if($add['from'])
- {
- $returnurl='special/AddZt.php?enews=EditZt&ztid='.$add[ztid].'&from=1'.hReturnEcmsHashStrHref2(0);
- }
- insert_dolog("ztid=".$add[ztid]."<br>ztname=".$add[ztname]);//操作日志
- printerror("EditZtSuccess",$returnurl);
- }
- else
- {
- printerror("DbError","");
- }
- }
- //删除专题
- function DelZt($ztid,$userid,$username){
- global $empire,$dbtbpre;
- $ztid=(int)$ztid;
- if(!$ztid){
- printerror("NotDelZtid","");
- }
- CheckLevel($userid,$username,$classid,"zt");
- $r=$empire->fetch1("select * from {$dbtbpre}enewszt where ztid='$ztid'");
- if(empty($r[ztid])){
- printerror("NotDelZtid","history.go(-1)");
- }
- //删除专题
- $sql=$empire->query("delete from {$dbtbpre}enewszt where ztid='$ztid'");
- $empire->query("delete from {$dbtbpre}enewsztadd where ztid='$ztid'");
- $delpath="../../".$r[ztpath];
- $del=DelPath($delpath);
- //删除专题子类
- $zttypesql=$empire->query("select cid from {$dbtbpre}enewszttype where ztid='$ztid'");
- while($zttyper=$empire->fetch($zttypesql))
- {
- $empire->query("delete from {$dbtbpre}enewszttypeadd where cid='$zttyper[cid]'");
- }
- $empire->query("delete from {$dbtbpre}enewszttype where ztid='$ztid'");
- $empire->query("delete from {$dbtbpre}enewsztinfo where ztid='$ztid'");
- //删除附件
- DelFileOtherTable("id='$ztid' and modtype=2");
- GetClass();//更新缓存
- //moreportdo
- if($r['ztpath'])
- {
- $eautodofname='delpath|'.$r['ztpath'].'||';
- eAutodo_AddDo('eDelFileZT',0,0,0,0,0,$eautodofname);
- }
- if($sql){
- insert_dolog("ztid=".$ztid."<br>ztname=".$r[ztname]);//操作日志
- printerror("DelZtSuccess","special/ListZt.php".hReturnEcmsHashStrHref2(1));
- }
- else{
- printerror("DbError","");
- }
- }
- //组合专题
- function TogZt($add,$userid,$username){
- global $empire,$class_r,$dbtbpre;
- $ztid=(int)$add['ztid'];
- if(empty($ztid))
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- $r=$empire->fetch1("select ztid,ztname from {$dbtbpre}enewszt where ztid='$ztid'");
- if(empty($r['ztid']))
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- $zcid=(int)$add['zcid'];
- $tbname=RepPostVar($add['tbname']);
- if(!$tbname)
- {
- printerror('EmptyTogZt','history.go(-1)');
- }
- $tbr=$empire->fetch1("select tid from {$dbtbpre}enewstable where tbname='$tbname' limit 1");
- if(!$tbr['tid'])
- {
- printerror('EmptyTogZt','history.go(-1)');
- }
- $wheresql="";
- $formvar="";
- //关键字
- $keyboard=RepPostVar2($add['keyboard']);
- if($keyboard)
- {
- $formvar.=ReturnFormHidden('keyboard',$add['keyboard']);
- $searchfsql='';
- if($add['stitle'])//标题
- {
- $searchfsql.="title like '%$keyboard%'";
- $formvar.=ReturnFormHidden('stitle',$add['stitle']);
- }
- if($add['susername'])//增加者
- {
- if($searchfsql)
- {
- $or=" or ";
- }
- $searchfsql.=$or."username like '%$keyboard%'";
- $formvar.=ReturnFormHidden('susername',$add['susername']);
- }
- if($searchfsql)
- {
- $wheresql=" and (".$searchfsql.")";
- }
- }
- //是否推荐
- if($add['isgood'])
- {
- $wheresql.=" and isgood>0";
- $formvar.=ReturnFormHidden('isgood',$add['isgood']);
- }
- //头条
- if($add['firsttitle'])
- {
- $wheresql.=" and firsttitle>0";
- $formvar.=ReturnFormHidden('firsttitle',$add['firsttitle']);
- }
- //有标题图片
- if($add['titlepic'])
- {
- $wheresql.=" and ispic=1";
- $formvar.=ReturnFormHidden('titlepic',$add['titlepic']);
- }
- //按栏目刷新
- $classid=(int)$add['classid'];
- if($classid)
- {
- $formvar.=ReturnFormHidden('classid',$classid);
- if(empty($class_r[$classid][islast]))//大栏目
- {
- $where=ReturnClass($class_r[$classid][sonclass]);
- }
- else//终极栏目
- {
- $where="classid='$classid'";
- }
- $wheresql.=" and (".$where.")";
- }
- $startid=(int)$add[startid];
- $endid=(int)$add[endid];
- $startday=RepPostVar($add[startday]);
- $endday=RepPostVar($add[endday]);
- $formvar.=ReturnFormHidden('retype',$add['retype']);
- //按ID
- if($add['retype'])
- {
- if($endid)
- {
- $wheresql.=" and id>=$startid and id<=$endid";
- $formvar.=ReturnFormHidden('startid',$add[startid]).ReturnFormHidden('endid',$add[endid]);
- }
- }
- else
- {
- if($startday&&$endday)
- {
- $wheresql.=" and truetime>=".to_time($startday." 00:00:00")." and truetime<=".to_time($endday." 23:59:59");
- $formvar.=ReturnFormHidden('startday',$add[startday]).ReturnFormHidden('endday',$add[endday]);
- }
- }
- //附件sql条件
- $query=$add['query'];
- if($query)
- {
- $query=ClearAddsData($query);//去除adds
- $wheresql.=" and (".$query.")";
- $formvar.=ReturnFormHidden('query',$add['query']);
- }
- if(empty($wheresql))
- {
- printerror('EmptyTogZt','history.go(-1)');
- }
- $wheresql=substr($wheresql,5);
- if($add['doecmszt'])
- {
- $togtype=(int)$add['togtype'];
- if($togtype==1)//组合选中
- {
- $add['inid']=eReturnInids($add['inid']);
- $wheresql="id in (".$add['inid'].")";
- }
- else//排除选中
- {
- if($add['inid'])
- {
- $add['inid']=eReturnInids($add['inid']);
- $wheresql.=" and id not in (".$add['inid'].")";
- }
- }
- AddMoreInfoToZt($ztid,$zcid,$tbname,$wheresql);
- //操作日志
- insert_dolog("ztid=$ztid&ztname=$r[ztname]");
- printerror("TogZtSuccess","TogZt.php?ztid=$ztid".hReturnEcmsHashStrHref2(0));
- }
- $re[0]=$wheresql;
- $re[1]=$formvar.ReturnFormHidden('ztid',$ztid).ReturnFormHidden('zcid',$zcid).ReturnFormHidden('tbname',$tbname).ReturnFormHidden('pline',$add[pline]).ReturnFormHidden('doecmszt',$add[doecmszt]).ReturnFormHidden('enews',$add[enews]).ReturnFormHidden('inid',$add[inid]);
- $re[2]=$tbname;
- $re[3]=$r['ztname'];
- return $re;
- }
- //保存专题信息
- function SaveTogZtInfo($add,$userid,$username){
- global $empire,$dbtbpre;
- if(!trim($add[togztname]))
- {
- printerror('EmptySaveTogZtname','history.go(-1)');
- }
- $add['doecmszt']=(int)$add['doecmszt'];
- $add[classid]=(int)$add[classid];
- //搜索字段
- $searchf=',';
- if($add[stitle]==1)
- {
- $searchf.='stitle,';
- }
- if($add[susername]==1)
- {
- $searchf.='susername,';
- }
- if($add[snewstext]==1)
- {
- $searchf.='snewstext,';
- }
- //特殊字段
- $specialsearch=',';
- if($add[isgood])
- {
- $specialsearch.='isgood,';
- }
- if($add[firsttitle])
- {
- $specialsearch.='firsttitle,';
- }
- if($add[titlepic])
- {
- $specialsearch.='titlepic,';
- }
- $add['retype']=(int)$add['retype'];
- $add['startid']=(int)$add['startid'];
- $add['endid']=(int)$add['endid'];
- $add['pline']=(int)$add['pline'];
- $r=$empire->fetch1("select togid from {$dbtbpre}enewstogzts where togztname='$add[togztname]'");
- if($r[togid])
- {
- $sql=$empire->query("update {$dbtbpre}enewstogzts set keyboard='".eaddslashes($add[keyboard])."',searchf='$searchf',query='".eaddslashes($add[query])."',specialsearch='$specialsearch',classid=$add[classid],retype=$add[retype],startday='".eaddslashes($add[startday])."',endday='".eaddslashes($add[endday])."',startid=$add[startid],endid=$add[endid],pline=$add[pline],doecmszt=$add[doecmszt] where togid='$r[togid]'");
- $togid=$r[togid];
- }
- else
- {
- $sql=$empire->query("insert into {$dbtbpre}enewstogzts(keyboard,searchf,query,specialsearch,classid,retype,startday,endday,startid,endid,pline,doecmszt,togztname) values('".eaddslashes($add[keyboard])."','$searchf','".eaddslashes($add[query])."','$specialsearch',$add[classid],$add[retype],'".eaddslashes($add[startday])."','".eaddslashes($add[endday])."',$add[startid],$add[endid],$add[pline],$add[doecmszt],'".eaddslashes($add[togztname])."');");
- $togid=$empire->lastid();
- }
- if($sql)
- {
- insert_dolog("togid=$togid&togztname=$add[togztname]");//操作日志
- printerror("SaveTogZtInfoSuccess","TogZt.php?ztid=$add[ztid]&togid=$togid".hReturnEcmsHashStrHref2(0));
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
- //删除保存专题信息
- function DelTogZtInfo($add,$userid,$username){
- global $empire,$dbtbpre;
- $togid=intval($add[togid]);
- if(!$togid)
- {
- printerror('EmptyDelTogztid','history.go(-1)');
- }
- $r=$empire->fetch1("select togid,togztname from {$dbtbpre}enewstogzts where togid='$togid'");
- if(!$r[togid])
- {
- printerror('EmptyDelTogztid','history.go(-1)');
- }
- $sql=$empire->query("delete from {$dbtbpre}enewstogzts where togid='$togid'");
- if($sql)
- {
- insert_dolog("togid=$togid&togztname=$r[togztname]");//操作日志
- printerror('DelTogZtInfoSuccess',EcmsGetReturnUrl());
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
- //************************************ 栏目 ************************************
- //返回字段值
- function ReturnCFvalue($value)
- {
- $value=str_replace("\r\n","|",$value);
- return $value;
- }
- //取得栏目表单元素html代码
- function GetClassFform($type,$f,$fvalue,$fformsize=''){
- if($type=="select"||$type=="radio"||$type=="checkbox")
- {
- return GetCFformSelect($type,$f,$fvalue,$fformsize);
- }
- $file="../data/html/classfhtml.txt";
- $data=ReadFiletext($file);
- $exp="[!--".$type."--]";
- $r=explode($exp,$data);
- $string=str_replace("[!--enews.var--]",$f,$r[1]);
- $string=str_replace("[!--enews.def.val--]",$fvalue,$string);
- if($type=='editor')//编辑器
- {
- $editortype='Default';
- $string=str_replace("[!--editor.type--]",$editortype,$string);
- $string=str_replace("[!--editor.basepath--]",'',$string);
- }
- elseif($type=='img'||$type=='flash'||$type=='file')//附件
- {
- $string=str_replace("[!--enews.modtype--]",'1',$string);
- $string=str_replace("[!--enews.path--]",'',$string);
- }
- $string=RepCFformSize($f,$string,$type,$fformsize);
- return fAddAddsData($string);
- }
- //取得select/radio元素代码
- function GetCFformSelect($type,$f,$fvalue,$fformsize=''){
- $vr=explode("|",$fvalue);
- $count=count($vr);
- $change="";
- $def=':default';
- for($i=0;$i<$count;$i++)
- {
- $val=$vr[$i];
- $isdef="";
- if(strstr($val,$def))
- {
- $dr=explode($def,$val);
- $val=$dr[0];
- $isdef="||\$ecmsfirstpost==1";
- }
- if($type=='select')
- {
- $change.="<option value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' selected':''?>>".$val."</option>";
- }
- elseif($type=='checkbox')
- {
- $change.="<input name=\"".$f."[]\" type=\"checkbox\" value=\"".$val."\"<?=strstr(\$r[".$f."],\"|".$val."|\")".$isdef."?' checked':''?>>".$val;
- }
- else
- {
- $change.="<input name=\"".$f."\" type=\"radio\" value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' checked':''?>>".$val;
- }
- }
- if($type=="select")
- {
- if($fformsize)
- {
- $addsize=' style="width:'.$fformsize.'"';
- }
- $change="<select name=\"".$f."\" id=\"".$f."\"".$addsize.">".$change."</select>";
- }
- return $change;
- }
- //替换表单元素长度
- function RepCFformSize($f,$string,$type,$fformsize=''){
- $fformsize=ReturnDefCFformSize($f,$type,$fformsize);
- if($type=='textarea'||$type=='editor')
- {
- $r=explode(',',$fformsize);
- $string=str_replace('[!--fsize.w--]',$r[0],$string);
- $string=str_replace('[!--fsize.h--]',$r[1],$string);
- }
- else
- {
- $string=str_replace('[!--fsize.w--]',$fformsize,$string);
- }
- return $string;
- }
- //返回默认长度
- function ReturnDefCFformSize($f,$type,$fformsize){
- if(empty($fformsize))
- {
- if($type=='textarea')
- {
- $fformsize='60,10';
- }
- elseif($type=='img')
- {
- $fformsize='45';
- }
- elseif($type=='file')
- {
- $fformsize='45';
- }
- elseif($type=='flash')
- {
- $fformsize='45';
- }
- elseif($type=='date')
- {
- $fformsize='12';
- }
- elseif($type=='color')
- {
- $fformsize='10';
- }
- elseif($type=='linkfield')
- {
- $fformsize='45';
- }
- elseif($type=='downpath')
- {
- $fformsize='45';
- }
- elseif($type=='onlinepath')
- {
- $fformsize='45';
- }
- elseif($type=='editor')
- {
- $fformsize='100%,300';
- }
- }
- return $fformsize;
- }
- //更新栏目表单文件
- function ChangeClassForm(){
- global $empire,$dbtbpre;
- $file='../data/html/classaddform.php';
- $mtemp='';
- $sql=$empire->query("select fname,f,fhtml from {$dbtbpre}enewsclassf order by myorder,fid");
- while($r=$empire->fetch($sql))
- {
- $mtemp.="<tr bgcolor='#FFFFFF' height=25><td>".$r['fname']."</td><td>".$r['fhtml']."</td></tr>";
- }
- $mtemp="<?php
- if(!defined('InEmpireCMS'))
- {exit();}
- ?>".$mtemp;
- WriteFiletext($file,$mtemp);
- }
- //增加栏目字段
- function AddClassF($add,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"classf");
- $add[f]=RepPostVar($add[f]);
- if(empty($add[f])||empty($add[fname]))
- {
- printerror("EmptyF","");
- }
- //字段是否重复
- $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsclassadd");
- $b=0;
- while($r=$empire->fetch($s))
- {
- if($r[Field]==$add[f])
- {
- $b=1;
- break;
- }
- }
- if($b)
- {
- printerror("ReF","");
- }
- $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsclass");
- $b=0;
- while($r=$empire->fetch($s))
- {
- if($r[Field]==$add[f])
- {
- $b=1;
- break;
- }
- }
- if($b)
- {
- printerror("ReF","");
- }
- $add[fvalue]=ReturnCFvalue($add[fvalue]);//初始化值
- //字段类型
- if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
- {
- $def=" default '0'";
- }
- elseif($add[ftype]=="VARCHAR")
- {
- $def=" default ''";
- }
- else
- {
- $def="";
- }
- $type=$add[ftype];
- //VARCHAR
- if($add[ftype]=='VARCHAR'&&empty($add[flen]))
- {
- $add[flen]='255';
- }
- //字段长度
- if($add[flen]){
- if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
- $type.="(".$add[flen].")";
- }
- }
- $field="`".$add[f]."` ".$type." NOT NULL".$def;
- //新增字段
- $asql=$empire->query("alter table {$dbtbpre}enewsclassadd add ".$field);
- //替换代码
- $fhtml=GetClassFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
- if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
- {
- $fhtml=str_replace("\$r[","\$addr[",$fhtml);
- }
- //处理变量
- $add[myorder]=(int)$add[myorder];
- $sql=$empire->query("insert into {$dbtbpre}enewsclassf(f,fname,fform,fhtml,fzs,myorder,ftype,flen,fvalue,fformsize) values('$add[f]','$add[fname]','$add[fform]','".eaddslashes2($fhtml)."','".eaddslashes($add[fzs])."',$add[myorder],'$add[ftype]','$add[flen]','".eaddslashes2($add[fvalue])."','$add[fformsize]');");
- $lastid=$empire->lastid();
- //更新表单
- ChangeClassForm();
- if($asql&&$sql)
- {
- //操作日志
- insert_dolog("fid=".$lastid."<br>f=".$add[f]);
- printerror("AddFSuccess","info/AddClassF.php?enews=AddClassF".hReturnEcmsHashStrHref2(0));
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
- //修改栏目字段
- function EditClassF($add,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"classf");
- $fid=(int)$add['fid'];
- $add[f]=RepPostVar($add[f]);
- $add[oldf]=RepPostVar($add[oldf]);
- if(empty($add[f])||empty($add[fname])||!$fid){
- printerror("EmptyF","history.go(-1)");
- }
- if($add[f]<>$add[oldf]){
- //字段是否重复
- $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsclassadd");
- $b=0;
- while($r=$empire->fetch($s)){
- if($r[Field]==$add[f]){
- $b=1;
- break;
- }
- }
- if($b){
- printerror("ReF","history.go(-1)");
- }
- $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsclass");
- $b=0;
- while($r=$empire->fetch($s))
- {
- if($r[Field]==$add[f])
- {
- $b=1;
- break;
- }
- }
- if($b)
- {
- printerror("ReF","");
- }
- }
- $add[fvalue]=ReturnCFvalue($add[fvalue]);//初始化值
- //字段类型
- if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
- {
- $def=" default '0'";
- }
- elseif($add[ftype]=="VARCHAR")
- {
- $def=" default ''";
- }
- else
- {
- $def="";
- }
- $type=$add[ftype];
- //VARCHAR
- if($add[ftype]=='VARCHAR'&&empty($add[flen]))
- {
- $add[flen]='255';
- }
- //字段长度
- if($add[flen]){
- if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
- $type.="(".$add[flen].")";
- }
- }
- $field="`".$add[f]."` ".$type." NOT NULL".$def;
- $usql=$empire->query("alter table {$dbtbpre}enewsclassadd change `".$add[oldf]."` ".$field);
- //替换代码
- if($add[f]<>$add[oldf]||$add[fform]<>$add[oldfform]||$add[fvalue]<>$add[oldfvalue]||$add[fformsize]<>$add[oldfformsize]){
- $fhtml=GetClassFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
- if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
- {
- $fhtml=str_replace("\$r[","\$addr[",$fhtml);
- }
- }
- else{
- $fhtml=$add[fhtml];
- }
- //处理变量
- $add[myorder]=(int)$add[myorder];
- $sql=$empire->query("update {$dbtbpre}enewsclassf set f='$add[f]',fname='$add[fname]',fform='$add[fform]',fhtml='".eaddslashes2($fhtml)."',fzs='".eaddslashes($add[fzs])."',myorder=$add[myorder],ftype='$add[ftype]',flen='$add[flen]',fvalue='".eaddslashes2($add[fvalue])."',fformsize='$add[fformsize]' where fid=$fid");
- //更新表单
- ChangeClassForm();
- if($usql&&$sql)
- {
- insert_dolog("fid=".$fid."<br>f=".$add[f]);//操作日志
- printerror("EditFSuccess","info/ListClassF.php".hReturnEcmsHashStrHref2(1));
- }
- else
- {printerror("DbError","history.go(-1)");}
- }
- //删除栏目字段
- function DelClassF($add,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"classf");
- $fid=(int)$add['fid'];
- if(empty($fid)){
- printerror("EmptyFid","history.go(-1)");
- }
- $r=$empire->fetch1("select f from {$dbtbpre}enewsclassf where fid='$fid'");
- if(!$r[f]){
- printerror("EmptyFid","history.go(-1)");
- }
- $usql=$empire->query("alter table {$dbtbpre}enewsclassadd drop COLUMN `".$r[f]."`");
- $sql=$empire->query("delete from {$dbtbpre}enewsclassf where fid='$fid'");
- //更新表单表
- ChangeClassForm();
- if($usql&&$sql)
- {
- insert_dolog("fid=".$fid."<br>f=".$r[f]);//操作日志
- printerror("DelFSuccess","info/ListClassF.php".hReturnEcmsHashStrHref2(1));
- }
- else
- {printerror("DbError","history.go(-1)");}
- }
- //修改栏目字段顺序
- function EditClassFOrder($fid,$myorder,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"classf");
- for($i=0;$i<count($myorder);$i++)
- {
- $fid[$i]=(int)$fid[$i];
- $newmyorder=(int)$myorder[$i];
- $usql=$empire->query("update {$dbtbpre}enewsclassf set myorder=$newmyorder where fid='$fid[$i]'");
- }
- //更新表单表
- ChangeClassForm();
- printerror("EditFOrderSuccess","info/ListClassF.php".hReturnEcmsHashStrHref2(1));
- }
- //返回栏目字段
- function ReturnClassAddF($add,$ecms=0){
- global $empire,$dbtbpre;
- $ret_r[0]='';
- $ret_r[1]='';
- $fsql=$empire->query("select f from {$dbtbpre}enewsclassf");
- if($ecms==0)//增加
- {
- while($fr=$empire->fetch($fsql))
- {
- $f=$fr['f'];
- $fval=$add[$f];
- $fval=RepPhpAspJspcode($fval);
- $ret_r[0].=",`".$f."`";
- $ret_r[1].=",'".AddAddsData($fval)."'";
- }
- }
- else//修改
- {
- while($fr=$empire->fetch($fsql))
- {
- $f=$fr['f'];
- $fval=$add[$f];
- $fval=RepPhpAspJspcode($fval);
- $ret_r[0].=",`".$f."`='".AddAddsData($fval)."'";
- }
- }
- return $ret_r;
- }
- //组合不生成的栏目信息
- function TogNotReClass($changecache=0){
- global $empire,$dbtbpre;
- $sql=$empire->query("select classid,nreclass,nreinfo,nrejs,nottobq from {$dbtbpre}enewsclass where nreclass=1 or nreinfo=1 or nrejs=1 or nottobq=1");
- $nreclass=',';
- $nreinfo=',';
- $nrejs=',';
- $nottobq=',';
- while($r=$empire->fetch($sql))
- {
- if($r['nreclass']==1)
- {
- $nreclass.=$r['classid'].',';
- }
- if($r['nreinfo']==1)
- {
- $nreinfo.=$r['classid'].',';
- }
- if($r['nrejs']==1)
- {
- $nrejs.=$r['classid'].',';
- }
- if($r['nottobq']==1)
- {
- $nottobq.=$r['classid'].',';
- }
- }
- $empire->query("update {$dbtbpre}enewspublic set nreclass='$nreclass',nreinfo='$nreinfo',nrejs='$nrejs',nottobq='$nottobq' limit 1");
- if($changecache==1)
- {
- GetConfig();
- }
- }
- //返回投稿权限
- function DoPostClassQAddGroupid($groupid){
- $count=count($groupid);
- if(!$count)
- {
- return '';
- }
- $qg=',';
- for($i=0;$i<$count;$i++)
- {
- $groupid[$i]=(int)$groupid[$i];
- $qg.=$groupid[$i].',';
- }
- return $qg;
- }
- //处理栏目提交变量
- function DoPostClassVar($add){
- if(empty($add[classtype])){
- $add[classtype]=".html";
- }
- $add[classname]=eaddslashes(ehtmlspecialchars($add[classname]));
- $add[intro]=eaddslashes(RepPhpAspJspcode($add[intro]));
- $add[classpagekey]=eaddslashes(RepPhpAspJspcode($add[classpagekey]));
- //过滤字符
- $add[listorder]=RepPostVar2($add[listorder]);
- $add[reorder]=RepPostVar2($add[reorder]);
- //处理变量
- $add[jstempid]=(int)$add['jstempid'];
- $add[bclassid]=(int)$add[bclassid];
- $add[link_num]=(int)$add[link_num];
- $add[newstempid]=(int)$add[newstempid];
- $add[islast]=(int)$add[islast];
- $add[filename]=(int)$add[filename];
- $add[openpl]=(int)$add[openpl];
- $add[openadd]=(int)$add[openadd];
- $add[newline]=(int)$add[newline];
- $add[hotline]=(int)$add[hotline];
- $add[goodline]=(int)$add[goodline];
- $add[groupid]=(int)$add[groupid];
- $add[hotplline]=(int)$add[hotplline];
- $add[modid]=(int)$add[modid];
- $add[checked]=(int)$add[checked];
- $add[firstline]=(int)$add[firstline];
- $add[islist]=(int)$add[islist];
- $add[searchtempid]=(int)$add[searchtempid];
- $add[checkpl]=(int)$add[checkpl];
- $add[down_num]=(int)$add[down_num];
- if(empty($add[down_num])){
- $add[down_num]=1;
- }
- $add[online_num]=(int)$add[online_num];
- if(empty($add[online_num])){
- $add[online_num]=1;
- }
- $add[addinfofen]=(int)$add[addinfofen];
- $add[listdt]=(int)$add[listdt];
- $add[showdt]=(int)$add[showdt];
- $add[maxnum]=(int)$add[maxnum];
- $add[showclass]=(int)$add[showclass];
- $add[checkqadd]=(int)$add[checkqadd];
- $add[qaddlist]=(int)$add[qaddlist];
- $add[qaddgroupid]=DoPostClassQAddGroupid($add[qaddgroupidck]);
- if(!$add[qaddgroupid])
- {
- $add[addinfofen]=0;
- $add['oneinfo']=0;
- }
- $add[qaddshowkey]=(int)$add[qaddshowkey];
- $add[adminqinfo]=(int)$add[adminqinfo];
- $add[doctime]=(int)$add[doctime];
- $add[nreclass]=(int)$add[nreclass];
- $add[nreinfo]=(int)$add[nreinfo];
- $add[nrejs]=(int)$add[nrejs];
- $add[nottobq]=(int)$add[nottobq];
- $add[lencord]=(int)$add[lencord];
- $add[listtempid]=(int)$add[listtempid];
- $add[dtlisttempid]=(int)$add[dtlisttempid];
- $add[classtempid]=(int)$add[classtempid];
- if(empty($add[bname])){
- $add[bname]=$add[classname];
- }
- $add[myorder]=(int)$add[myorder];
- if($add[infopath]==0)
- {
- $add[ipath]='';
- }
- $add[addreinfo]=(int)$add[addreinfo];
- $add[haddlist]=(int)$add[haddlist];
- $add[sametitle]=(int)$add[sametitle];
- $add[definfovoteid]=(int)$add[definfovoteid];
- $add[qeditchecked]=(int)$add[qeditchecked];
- $add[wapstyleid]=(int)$add[wapstyleid];
- $add[repreinfo]=(int)$add[repreinfo];
- $add[pltempid]=(int)$add[pltempid];
- $add[classtext]=RepPhpAspJspcode($add[classtext]);
- $add[yhid]=(int)$add[yhid];
- $add[wfid]=(int)$add[wfid];
- $add['repagenum']=(int)$add['repagenum'];
- $add['keycid']=(int)$add['keycid'];
- $add['oneinfo']=(int)$add['oneinfo'];
- $add['wapislist']=(int)$add['wapislist'];
- $add['filepass']=(int)$add['filepass'];
- $add[pripath]=eaddslashes($add[pripath]);
- $add[classpath]=eaddslashes($add[classpath]);
- $add['eclasspagetext']=AddAddsData(RepPhpAspJspcode($add['eclasspagetext']));
- $add['addsql']=eaddslashes($add['addsql']);
- if($add['islist']==3)
- {
- $add['bdinfoid']=RepPostVar($add['bdinfoid']);
- }
- else
- {
- $add['bdinfoid']='';
- }
- if($add[islast]&&$add['smallbdinfoid'])
- {
- $add['smallbdinfoid']=RepPostVar($add['smallbdinfoid']);
- }
- else
- {
- $add['smallbdinfoid']='';
- }
- //设置访问权限
- $add[cgroupid]=DoPostClassQAddGroupid($add[cgroupidck]);
- $add[cgtoinfo]=(int)$add[cgtoinfo];
- if($add[cgroupid])
- {
- $add[classtype]='.php';
- if($add[cgtoinfo])
- {
- $add[filetype]='.php';
- }
- }
- else
- {
- $add[cgtoinfo]=0;
- }
- return $add;
- }
- //增加外部栏目
- function AddWbClass($add,$userid,$username){
- global $empire,$dbtbpre;
- //操作权限
- CheckLevel($userid,$username,$classid,"class");
- $add=DoPostClassVar($add);
- if(!$add[classname]||!$add[wburl])
- {
- printerror("EmptyWbClass","");
- }
- $add[islast]=0;
- $addtime=time();
- $ecms_fclast=time();
- //取得表名
- $tabler=GetModTable($add[modid]);
- $tabler[tid]=(int)$tabler[tid];
- if(empty($add[bclassid]))//主栏目
- {
- $sonclass="";
- $featherclass="";
- }
- else//中级栏目
- {
- //取得上一级父栏目
- $r=$empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
- if($r[islast])//是否终极栏目
- {
- printerror("BclassNotLast","");
- }
- if($r[wburl])
- {
- printerror("BclassNotWb","");
- }
- if(empty($r[featherclass]))
- {
- $r[featherclass]="|";
- }
- $featherclass=$r[featherclass].$add[bclassid]."|";
- $sonclass="";
- }
- $sql=$empire->query("insert into {$dbtbpre}enewsclass(bclassid,classname,is_zt,sonclass,lencord,link_num,newstempid,onclick,listtempid,featherclass,islast,classpath,classtype,newspath,filename,filetype,openpl,openadd,newline,hotline,goodline,classurl,groupid,myorder,filename_qz,hotplline,modid,checked,firstline,bname,islist,searchtempid,tid,tbname,maxnum,checkpl,down_num,online_num,listorder,reorder,intro,classimg,jstempid,addinfofen,listdt,showclass,showdt,checkqadd,qaddlist,qaddgroupid,qaddshowkey,adminqinfo,doctime,classpagekey,dtlisttempid,classtempid,nreclass,nreinfo,nrejs,nottobq,ipath,addreinfo,haddlist,sametitle,definfovoteid,wburl,qeditchecked,wapstyleid,repreinfo,pltempid,cgroupid,yhid,wfid,cgtoinfo,bdinfoid,repagenum,keycid,addtime,oneinfo,addsql,wapislist,fclast) values($add[bclassid],'$add[classname]',0,'$sonclass',$add[lencord],$add[link_num],$add[newstempid],0,$add[listtempid],'$featherclass',$add[islast],'$classpath','$add[classtype]','$add[newspath]',$add[filename],'$add[filetype]',$add[openpl],$add[openadd],$add[newline],$add[hotline],$add[goodline],'$add[classurl]',$add[groupid],$add[myorder],'$add[filename_qz]',$add[hotplline],$add[modid],$add[checked],$add[firstline],'$add[bname]',$add[islist],$add[searchtempid],$tabler[tid],'$tabler[tbname]',$add[maxnum],$add[checkpl],$add[down_num],$add[online_num],'$add[listorder]','$add[reorder]','$add[intro]','$add[classimg]',$add[jstempid],$add[addinfofen],$add[listdt],$add[showclass],$add[showdt],$add[checkqadd],$add[qaddlist],'$add[qaddgroupid]',$add[qaddshowkey],$add[adminqinfo],$add[doctime],'$add[classpagekey]','$add[dtlisttempid]','$add[classtempid]',$add[nreclass],$add[nreinfo],$add[nrejs],$add[nottobq],'$add[ipath]',$add[addreinfo],$add[haddlist],$add[sametitle],$add[definfovoteid],'$add[wburl]',$add[qeditchecked],$add[wapstyleid],'$add[repreinfo]','$add[pltempid]','$add[cgroupid]','$add[yhid]','$add[wfid]','$add[cgtoinfo]','$add[bdinfoid]','$add[repagenum]','$add[keycid]','$addtime','$add[oneinfo]','$add[addsql]','$add[wapislist]','$ecms_fclast');");
- $lastid=$empire->lastid();
- //副表
- $ret_cr=ReturnClassAddF($add,0);
- $empire->query("replace into {$dbtbpre}enewsclassadd(classid,classtext,eclasspagetext".$ret_cr[0].") values('$lastid','".eaddslashes2($add[classtext])."','$add[eclasspagetext]'".$ret_cr[1].");");
- //统计表
- $empire->query("replace into {$dbtbpre}enewsclass_stats(classid) values('$lastid');");
- //更新附件
- UpdateTheFileOther(1,$lastid,$add['filepass'],'other');
- GetClass();
- //DelListEnews();//删除缓存文件
- if($sql)
- {
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass'");
- $cache_enews='doclass';
- $cache_ecmstourl=urlencode("AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
- $cache_mess='AddClassSuccess';
- $cache_url="CreateCache.php?enews=$cache_enews&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- insert_dolog("classid=".$lastid."<br>classname=".$add[classname]);//操作日志
- //printerror("AddClassSuccess","AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- else
- {
- printerror("DbError","");
- }
- }
- //增加栏目
- function AddClass($add,$userid,$username){
- global $empire,$dbtbpre;
- //增加外部栏目
- if($add[ecmsclasstype])
- {
- AddWbClass($add,$userid,$username);
- }
- $add[classpath]=trim($add[classpath]);
- if(!$add[classname]||!$add[classpath]||!$add[modid])
- {
- printerror("EmptyClass","");
- }
- if($add[islast]&&(!$add[newstempid]||!$add[listtempid]))
- {
- printerror("LastMustChange","");
- }
- //操作权限
- CheckLevel($userid,$username,$classid,"class");
- $add=DoPostClassVar($add);
- //目录已存在
- if(strstr($add[classpath],".")||strstr($add[classpath],"/")||strstr($add[classpath],"\\"))
- {
- printerror("badpath","");
- }
- $classpath=$add[pripath].$add[classpath];
- if(file_exists("../../".$classpath))
- {
- printerror("ReClasspath","");
- }
- $addtime=time();
- $ecms_fclast=time();
- //取得表名
- $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 {$dbtbpre}enewsclass where classid='$add[bclassid]'");
- if($r[islast])//是否终极栏目
- {
- printerror("BclassNotLast","");
- }
- if($r[wburl])
- {
- printerror("BclassNotWb","");
- }
- if(empty($r[featherclass]))
- {
- $r[featherclass]="|";
- }
- $featherclass=$r[featherclass].$add[bclassid]."|";
- $sonclass="";
- }
- //建立目录
- CreateClassPath($classpath);
- $sql=$empire->query("insert into {$dbtbpre}enewsclass(bclassid,classname,is_zt,sonclass,lencord,link_num,newstempid,onclick,listtempid,featherclass,islast,classpath,classtype,newspath,filename,filetype,openpl,openadd,newline,hotline,goodline,classurl,groupid,myorder,filename_qz,hotplline,modid,checked,firstline,bname,islist,searchtempid,tid,tbname,maxnum,checkpl,down_num,online_num,listorder,reorder,intro,classimg,jstempid,addinfofen,listdt,showclass,showdt,checkqadd,qaddlist,qaddgroupid,qaddshowkey,adminqinfo,doctime,classpagekey,dtlisttempid,classtempid,nreclass,nreinfo,nrejs,nottobq,ipath,addreinfo,haddlist,sametitle,definfovoteid,wburl,qeditchecked,wapstyleid,repreinfo,pltempid,cgroupid,yhid,wfid,cgtoinfo,bdinfoid,repagenum,keycid,addtime,oneinfo,addsql,wapislist,fclast) values($add[bclassid],'$add[classname]',0,'$sonclass',$add[lencord],$add[link_num],$add[newstempid],0,$add[listtempid],'$featherclass',$add[islast],'$classpath','$add[classtype]','$add[newspath]',$add[filename],'$add[filetype]',$add[openpl],$add[openadd],$add[newline],$add[hotline],$add[goodline],'$add[classurl]',$add[groupid],$add[myorder],'$add[filename_qz]',$add[hotplline],$add[modid],$add[checked],$add[firstline],'$add[bname]',$add[islist],$add[searchtempid],$tabler[tid],'$tabler[tbname]',$add[maxnum],$add[checkpl],$add[down_num],$add[online_num],'$add[listorder]','$add[reorder]','$add[intro]','$add[classimg]',$add[jstempid],$add[addinfofen],$add[listdt],$add[showclass],$add[showdt],$add[checkqadd],$add[qaddlist],'$add[qaddgroupid]',$add[qaddshowkey],$add[adminqinfo],$add[doctime],'$add[classpagekey]','$add[dtlisttempid]','$add[classtempid]',$add[nreclass],$add[nreinfo],$add[nrejs],$add[nottobq],'$add[ipath]',$add[addreinfo],$add[haddlist],$add[sametitle],$add[definfovoteid],'',$add[qeditchecked],$add[wapstyleid],'$add[repreinfo]','$add[pltempid]','$add[cgroupid]','$add[yhid]','$add[wfid]','$add[cgtoinfo]','$add[bdinfoid]','$add[repagenum]','$add[keycid]','$addtime','$add[oneinfo]','$add[addsql]','$add[wapislist]','$ecms_fclast');");
- $lastid=$empire->lastid();
- //副表
- $ret_cr=ReturnClassAddF($add,0);
- $empire->query("replace into {$dbtbpre}enewsclassadd(classid,classtext,eclasspagetext".$ret_cr[0].") values('$lastid','".eaddslashes2($add[classtext])."','$add[eclasspagetext]'".$ret_cr[1].");");
- //统计表
- $empire->query("replace into {$dbtbpre}enewsclass_stats(classid) values('$lastid');");
- //更新附件
- UpdateTheFileOther(1,$lastid,$add['filepass'],'other');
- TogNotReClass(1);
- GetClass();
- if($add[islist]==0||$add[islist]==2)
- {
- $classtemp=$add[islist]==2?GetClassText($lastid):GetClassTemp($add['classtempid']);
- NewsBq($lastid,$classtemp,0,1);
- }
- elseif($add[islist]==3)//栏目绑定信息
- {
- ReClassBdInfo($lastid);
- }
- DelListEnews();//删除缓存文件
- //GetSearch($add[modid]);//更新缓存
- if($sql)
- {
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or (navtype='modclass' and modid='$add[modid]')");
- DelFiletext("../d/js/js/addinfo".$add[modid].".js");
- $cache_enews='doclass,doinfo,domod,dostemp';
- $cache_ecmstourl=urlencode("AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
- $cache_mess='AddClassSuccess';
- $cache_mid=$add[modid];
- $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- insert_dolog("classid=".$lastid."<br>classname=".$add[classname]);//操作日志
- //printerror("AddClassSuccess","AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- else
- {
- printerror("DbError","");
- }
- }
- //增加终级栏目
- else
- {
- //文件前缀
- $add[filename_qz]=RepFilenameQz($add[filename_qz]);
- if(empty($add[bclassid]))//主类别为终级栏目时
- {
- $sonclass="";
- $featherclass="";
- }
- else//子栏目
- {
- //取得上一级父栏目
- $r=$empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
- //是否终极类别
- if($r[islast])
- {
- printerror("BclassNotLast","");
- }
- if($r[wburl])
- {
- printerror("BclassNotWb","");
- }
- if(empty($r[featherclass])){
- $r[featherclass]="|";
- }
- $featherclass=$r[featherclass].$add[bclassid]."|";
- $sonclass="";
- }
- //建立栏目目录
- CreateClassPath($classpath);
- $sql=$empire->query("insert into {$dbtbpre}enewsclass(bclassid,classname,sonclass,is_zt,lencord,link_num,newstempid,onclick,listtempid,featherclass,islast,classpath,classtype,newspath,filename,filetype,openpl,openadd,newline,hotline,goodline,classurl,groupid,myorder,filename_qz,hotplline,modid,checked,firstline,bname,islist,searchtempid,tid,tbname,maxnum,checkpl,down_num,online_num,listorder,reorder,intro,classimg,jstempid,addinfofen,listdt,showclass,showdt,checkqadd,qaddlist,qaddgroupid,qaddshowkey,adminqinfo,doctime,classpagekey,dtlisttempid,classtempid,nreclass,nreinfo,nrejs,nottobq,ipath,addreinfo,haddlist,sametitle,definfovoteid,wburl,qeditchecked,wapstyleid,repreinfo,pltempid,cgroupid,yhid,wfid,cgtoinfo,bdinfoid,repagenum,keycid,addtime,oneinfo,addsql,wapislist,fclast) values($add[bclassid],'$add[classname]','$sonclass',0,$add[lencord],$add[link_num],$add[newstempid],0,$add[listtempid],'$featherclass',$add[islast],'$classpath','$add[classtype]','$add[newspath]',$add[filename],'$add[filetype]',$add[openpl],$add[openadd],$add[newline],$add[hotline],$add[goodline],'$add[classurl]',$add[groupid],$add[myorder],'$add[filename_qz]',$add[hotplline],$add[modid],$add[checked],$add[firstline],'$add[bname]',$add[islist],$add[searchtempid],$tabler[tid],'$tabler[tbname]',$add[maxnum],$add[checkpl],$add[down_num],$add[online_num],'$add[listorder]','$add[reorder]','$add[intro]','$add[classimg]',$add[jstempid],$add[addinfofen],$add[listdt],$add[showclass],$add[showdt],$add[checkqadd],$add[qaddlist],'$add[qaddgroupid]',$add[qaddshowkey],$add[adminqinfo],$add[doctime],'$add[classpagekey]','$add[dtlisttempid]','$add[classtempid]',$add[nreclass],$add[nreinfo],$add[nrejs],$add[nottobq],'$add[ipath]',$add[addreinfo],$add[haddlist],$add[sametitle],$add[definfovoteid],'',$add[qeditchecked],$add[wapstyleid],'$add[repreinfo]','$add[pltempid]','$add[cgroupid]','$add[yhid]','$add[wfid]','$add[cgtoinfo]','$add[smallbdinfoid]','$add[repagenum]','$add[keycid]','$addtime','$add[oneinfo]','$add[addsql]','$add[wapislist]','$ecms_fclast');");
- $lastid=$empire->lastid();
- //副表
- $ret_cr=ReturnClassAddF($add,0);
- $empire->query("replace into {$dbtbpre}enewsclassadd(classid,classtext,eclasspagetext".$ret_cr[0].") values('$lastid','".eaddslashes2($add[classtext])."','$add[eclasspagetext]'".$ret_cr[1].");");
- //统计表
- $empire->query("replace into {$dbtbpre}enewsclass_stats(classid) values('$lastid');");
- //修改父栏目的子栏目
- if($add[bclassid])
- {
- $b_r=$empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
- if(empty($b_r[sonclass]))
- {
- $b_r[sonclass]="|";
- }
- $new_sonclass=$b_r[sonclass].$lastid."|";
- $update=$empire->query("update {$dbtbpre}enewsclass set sonclass='$new_sonclass' where classid='$add[bclassid]'");
- //更改父类别的父栏目的子栏目
- $where=ReturnClass($b_r[featherclass]);
- if(empty($where)){
- $where="classid=0";
- }
- $bsql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
- while($br=$empire->fetch($bsql))
- {
- if(empty($br[sonclass]))
- {
- $br[sonclass]="|";
- }
- $new_sonclass=$br[sonclass].$lastid."|";
- $update=$empire->query("update {$dbtbpre}enewsclass set sonclass='$new_sonclass' where classid='$br[classid]'");
- }
- }
- //更新附件
- UpdateTheFileOther(1,$lastid,$add['filepass'],'other');
- DelListEnews();//删除缓存文件
- TogNotReClass(1);
- GetClass();
- //GetSearch($add[modid]);//更新缓存
- if($sql)
- {
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or (navtype='modclass' and modid='$add[modid]')");
- DelFiletext("../d/js/js/addinfo".$add[modid].".js");
- $cache_enews='doclass,doinfo,domod,dostemp';
- $cache_ecmstourl=urlencode("AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
- $cache_mess='AddLastClassSuccess';
- $cache_mid=$add[modid];
- $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- insert_dolog("classid=".$lastid."<br>classname=".$add[classname]);//操作日志
- //printerror("AddLastClassSuccess","AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
- }
- //绑定域名应用于子栏目
- function UpdateSmallClassDomain($classid,$classurl,$classpath){
- global $empire,$dbtbpre;
- if(empty($classurl)){
- $query="update {$dbtbpre}enewsclass set classurl='' where featherclass like '%|".$classid."|%'";
- }
- else{
- $query="update {$dbtbpre}enewsclass set classurl=CONCAT('".$classurl."',SUBSTRING(classpath,LENGTH('".$classpath."')+1)) where featherclass like '%|".$classid."|%'";
- }
- $sql=$empire->query($query);
- }
- //栏目目录修改
- function AlterClassPath($classid,$islast,$oldclasspath,$classpath){
- global $empire,$dbtbpre;
- //更新目录名
- if($oldclasspath!=$classpath)
- {
- @rename("../../".$oldclasspath,"../../".$classpath);
- @rename("../../d/file/".$oldclasspath,"../../d/file/".$classpath);
- if(empty($islast))
- {
- $sql=$empire->query("update {$dbtbpre}enewsclass set classpath=REPLACE(classpath,'".$oldclasspath."/','".$classpath."/') where featherclass like '%|".$classid."|%'");
- }
- DelListEnews();
- }
- }
- //修改外部栏目
- function EditWbClass($add,$userid,$username){
- global $empire,$class_r,$dbtbpre;
- //操作权限
- CheckLevel($userid,$username,$classid,"class");
- $add=DoPostClassVar($add);
- $add[classid]=(int)$add[classid];
- if(!$add[classname]||!$add[classid]||!$add[wburl])
- {
- printerror("EmptyWbClass","");
- }
- $add[islast]=0;
- $ecms_fclast=time();
- //取得表名
- $tabler=GetModTable($add[modid]);
- $tabler[tid]=(int)$tabler[tid];
- //改变大栏目
- if($add[bclassid]<>$add[oldbclassid])
- {
- //转到主栏目
- if(empty($add[bclassid]))
- {
- $sonclass="";
- $featherclass="";
- }
- //转到中级栏目
- else
- {
- //大栏目跟原栏目相同
- if($add[classid]==$add[bclassid])
- {
- printerror("BclassIsself","");
- }
- //取得现在大栏目的值
- $b=$empire->fetch1("select featherclass,sonclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
- //检测大栏目是否为终级栏目
- if($b[islast])
- {
- printerror("BclassNotLast","");
- }
- if($b[wburl])
- {
- printerror("BclassNotWb","");
- }
- //是否非法父栏目
- if($b[featherclass])
- {
- $c_nb_r=explode("|".$add[classid]."|",$b[featherclass]);
- if(count($c_nb_r)<>1)
- {
- printerror("BclassIssmall","");
- }
- }
- if(empty($b[featherclass]))
- {
- $b[featherclass]="|";
- }
- $featherclass=$b[featherclass].$add[bclassid]."|";
- }
- $change=",bclassid=$add[bclassid],featherclass='$featherclass'";
- }
- //修改数据库资料
- $sql=$empire->query("update {$dbtbpre}enewsclass set classname='$add[classname]',classpath='$classpath',classtype='$add[classtype]',newline=$add[newline],hotline=$add[hotline],goodline=$add[goodline],classurl='$add[classurl]',groupid=$add[groupid],myorder=$add[myorder],filename_qz='$add[filename_qz]',hotplline=$add[hotplline],modid=$add[modid],checked=$add[checked],firstline=$add[firstline],bname='$add[bname]',islist=$add[islist],listtempid=$add[listtempid],lencord=$add[lencord],searchtempid=$add[searchtempid],tid=$tabler[tid],tbname='$tabler[tbname]',maxnum=$add[maxnum],checkpl=$add[checkpl],down_num=$add[down_num],online_num=$add[online_num],listorder='$add[listorder]',reorder='$add[reorder]',intro='$add[intro]',classimg='$add[classimg]',jstempid=$add[jstempid],listdt=$add[listdt],showclass=$add[showclass],showdt=$add[showdt],qaddgroupid='$add[qaddgroupid]',qaddshowkey=$add[qaddshowkey],adminqinfo=$add[adminqinfo],doctime=$add[doctime],classpagekey='$add[classpagekey]',dtlisttempid='$add[dtlisttempid]',classtempid='$add[classtempid]',nreclass=$add[nreclass],nreinfo=$add[nreinfo],nrejs=$add[nrejs],nottobq=$add[nottobq],ipath='$add[ipath]',addreinfo=$add[addreinfo],haddlist=$add[haddlist],sametitle=$add[sametitle],definfovoteid=$add[definfovoteid],wburl='$add[wburl]',qeditchecked=$add[qeditchecked],openadd=$add[openadd],wapstyleid='$add[wapstyleid]',repreinfo='$add[repreinfo]',pltempid='$add[pltempid]',cgroupid='$add[cgroupid]',yhid='$add[yhid]',wfid='$add[wfid]',cgtoinfo='$add[cgtoinfo]',bdinfoid='$add[bdinfoid]',repagenum='$add[repagenum]',keycid='$add[keycid]',oneinfo='$add[oneinfo]',addsql='$add[addsql]',wapislist='$add[wapislist]',fclast='$ecms_fclast'".$change." where classid='$add[classid]'");
- //副表
- $ret_cr=ReturnClassAddF($add,1);
- $empire->query("update {$dbtbpre}enewsclassadd set classtext='".eaddslashes2($add[classtext])."',eclasspagetext='$add[eclasspagetext]'".$ret_cr[0]." where classid='$add[classid]'");
- //更新附件
- UpdateTheFileEditOther(1,$add['classid'],'other');
- GetClass();
- //删除缓存文件
- $updatecache=0;
- if($add[oldclassname]<>$add[classname]||$add[bclassid]<>$add[oldbclassid]||$add[wburl]<>$add[oldwburl])
- {
- //DelListEnews();
- $updatecache=1;
- }
- //来源
- if($add['from'])
- {
- $returnurl="ListPageClass.php";
- }
- else
- {
- $returnurl="ListClass.php";
- }
- if($sql)
- {
- insert_dolog("classid=".$add[classid]."<br>classname=".$add[classname]);//操作日志
- if($updatecache)
- {
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass'");
- $cache_enews='doclass';
- $cache_ecmstourl=$returnurl.urlencode(hReturnEcmsHashStrHref2(1));
- $cache_mess='EditClassSuccess';
- $cache_url="CreateCache.php?enews=$cache_enews&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- printerror("EditClassSuccess",$returnurl.hReturnEcmsHashStrHref2(1));
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
- //修改栏目
- function EditClass($add,$userid,$username){
- global $empire,$class_r,$dbtbpre;
- //修改外部栏目
- if($add[ecmsclasstype])
- {
- EditWbClass($add,$userid,$username);
- }
- $add[classid]=(int)$add[classid];
- $add[classpath]=trim($add[classpath]);
- $checkclasspath=$add['classpath'];
- if($add['oldclasspath']<>$add['pripath'].$add['oldcpath'])//更换父栏目
- {
- $add[classpath]=$add['oldcpath'];
- }
- if(!$add[classname]||!$add[classpath]||!$add[modid]||!$add[classid]){
- printerror("EmptyClass","");
- }
- if($add[islast]&&(!$add[newstempid]||!$add[listtempid])){
- printerror("LastMustChange","");
- }
- //操作权限
- CheckLevel($userid,$username,$classid,"class");
- $add=DoPostClassVar($add);
- $add[oldmodid]=(int)$add[oldmodid];
- $ecms_fclast=time();
- //改变目录
- $classpath=$add[pripath].$add[classpath];
- if($add[oldclasspath]<>$classpath&&$checkclasspath==$add['oldcpath']){
- if(file_exists("../../".$classpath)){//检测目录是否存在
- printerror("ReClasspath","");
- }
- }
- //取得表名
- $tabler=GetModTable($add[modid]);
- $tabler[tid]=(int)$tabler[tid];
- //修改大栏目
- if(!$add[islast]){
- //改变大栏目
- if($add[bclassid]<>$add[oldbclassid]){
- //转到主栏目
- if(empty($add[bclassid])){
- $sonclass="";
- $featherclass="";
- //取得本栏目的子栏目
- $r=$empire->fetch1("select sonclass,featherclass,classpath from {$dbtbpre}enewsclass where classid='$add[classid]'");
- //改变父栏目的子栏目
- $where=ReturnClass($r[featherclass]);
- if(empty($where)){
- $where="classid=0";
- }
- $osql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
- while($o=$empire->fetch($osql)){
- $newsonclass=str_replace($r[sonclass],"|",$o[sonclass]);
- $uosql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$o[classid]'");
- }
- //修改子栏目的父栏目
- $osql=$empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|".$add[classid]."|%'");
- while($o=$empire->fetch($osql)){
- $newclasspath=str_replace($r[classpath]."/",$classpath."/",$o[classpath]);
- $newfeatherclass=str_replace($r[featherclass],"|",$o[featherclass]);
- $uosql=$empire->query("update {$dbtbpre}enewsclass set featherclass='$newfeatherclass',classpath='$newclasspath' where classid='$o[classid]'");
- }
- }
- //转到中级栏目
- else
- {
- //大栏目跟原栏目相同
- if($add[classid]==$add[bclassid]){
- printerror("BclassIsself","");
- }
- //取得现在大栏目的值
- $b=$empire->fetch1("select featherclass,sonclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
- //检测大栏目是否为终级栏目
- if($b[islast])
- {
- printerror("BclassNotLast","");
- }
- if($b[wburl])
- {
- printerror("BclassNotWb","");
- }
- //是否非法父栏目
- if($b[featherclass]){
- $c_nb_r=explode("|".$add[classid]."|",$b[featherclass]);
- if(count($c_nb_r)<>1){
- printerror("BclassIssmall","");
- }
- }
- if(empty($b[featherclass])){
- $b[featherclass]="|";
- }
- $featherclass=$b[featherclass].$add[bclassid]."|";
- //取得现在栏目本身的值
- $o=$empire->fetch1("select featherclass,sonclass,classpath from {$dbtbpre}enewsclass where classid='$add[classid]'");
- //修改子栏目的父栏目
- $osql=$empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|".$add[classid]."|%'");
- while($or=$empire->fetch($osql)){
- $newclasspath=str_replace($o[classpath]."/",$classpath."/",$or[classpath]);
- if(empty($o[featherclass])){
- $newfeatherclass=$b[featherclass].$add[bclassid].$or[featherclass];
- }
- else{
- $newfeatherclass=str_replace($o[featherclass],$featherclass,$or[featherclass]);
- }
- $uosql=$empire->query("update {$dbtbpre}enewsclass set featherclass='$newfeatherclass',classpath='$newclasspath' where classid='$or[classid]'");
- }
- //改变旧大栏目的所有子栏目
- $owhere=ReturnClass($o[featherclass]);
- if(empty($owhere)){
- $owhere="classid=0";
- }
- $oosql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$owhere);
- while($oo=$empire->fetch($oosql)){
- $newsonclass=str_replace($o[sonclass],"|",$oo[sonclass]);
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$oo[classid]'");
- }
- //改变新大栏目的子栏目
- $where=ReturnClass($featherclass);
- if(empty($where)){
- $where="classid=0";
- }
- $nbsql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
- while($nb=$empire->fetch($nbsql)){
- if(empty($nb[sonclass]))
- {$nb[sonclass]="|";}
- $newsonclass=$nb[sonclass].substr($o[sonclass],1);
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$nb[classid]'");
- }
- }
- $change=",bclassid=$add[bclassid],featherclass='$featherclass'";
- }
- //绑定域名应用于子栏目
- if($add['UrlToSmall']){
- UpdateSmallClassDomain($add['classid'],$add['classurl'],$classpath);
- }
- //wap模板应用于子栏目
- if($add['wapstylesclass'])
- {
- $empire->query("update {$dbtbpre}enewsclass set wapstyleid='$add[wapstyleid]' where featherclass like '%|".$add[classid]."|%'");
- }
- //修改数据库资料
- $sql=$empire->query("update {$dbtbpre}enewsclass set classname='$add[classname]',classpath='$classpath',classtype='$add[classtype]',newline=$add[newline],hotline=$add[hotline],goodline=$add[goodline],classurl='$add[classurl]',groupid=$add[groupid],myorder=$add[myorder],filename_qz='$add[filename_qz]',hotplline=$add[hotplline],modid=$add[modid],checked=$add[checked],firstline=$add[firstline],bname='$add[bname]',islist=$add[islist],listtempid=$add[listtempid],lencord=$add[lencord],searchtempid=$add[searchtempid],tid=$tabler[tid],tbname='$tabler[tbname]',maxnum=$add[maxnum],checkpl=$add[checkpl],down_num=$add[down_num],online_num=$add[online_num],listorder='$add[listorder]',reorder='$add[reorder]',intro='$add[intro]',classimg='$add[classimg]',jstempid=$add[jstempid],listdt=$add[listdt],showclass=$add[showclass],showdt=$add[showdt],qaddgroupid='$add[qaddgroupid]',qaddshowkey=$add[qaddshowkey],adminqinfo=$add[adminqinfo],doctime=$add[doctime],classpagekey='$add[classpagekey]',dtlisttempid='$add[dtlisttempid]',classtempid='$add[classtempid]',nreclass=$add[nreclass],nreinfo=$add[nreinfo],nrejs=$add[nrejs],nottobq=$add[nottobq],ipath='$add[ipath]',addreinfo=$add[addreinfo],haddlist=$add[haddlist],sametitle=$add[sametitle],definfovoteid=$add[definfovoteid],wburl='',qeditchecked=$add[qeditchecked],openadd=$add[openadd],wapstyleid='$add[wapstyleid]',repreinfo='$add[repreinfo]',pltempid='$add[pltempid]',cgroupid='$add[cgroupid]',yhid='$add[yhid]',wfid='$add[wfid]',cgtoinfo='$add[cgtoinfo]',bdinfoid='$add[bdinfoid]',repagenum='$add[repagenum]',keycid='$add[keycid]',oneinfo='$add[oneinfo]',addsql='$add[addsql]',wapislist='$add[wapislist]',fclast='$ecms_fclast'".$change." where classid='$add[classid]'");
- //副表
- $ret_cr=ReturnClassAddF($add,1);
- $empire->query("update {$dbtbpre}enewsclassadd set classtext='".eaddslashes2($add[classtext])."',eclasspagetext='$add[eclasspagetext]'".$ret_cr[0]." where classid='$add[classid]'");
- //更新附件
- UpdateTheFileEditOther(1,$add['classid'],'other');
- GetClass();
- //生成栏目文件
- if($add[islist]==0||$add[islist]==2)
- {
- $classtemp=$add[islist]==2?GetClassText($add[classid]):GetClassTemp($add['classtempid']);
- NewsBq($add[classid],$classtemp,0,1);
- }
- elseif($add[islist]==3)
- {
- ReClassBdInfo($add[classid]);
- }
- if($add[islist]==2)
- {
- //删除动态模板缓存文件
- DelOneTempTmpfile('classpage'.$add[classid]);
- }
- }
- //终级栏目
- else
- {
- if($add[modid]<>$add[oldmodid])//换系统模型
- {
- $chmtbr=GetModTable($add[oldmodid]);
- if($chmtbr[tid]<>$tabler[tid]&&$chmtbr[tbname])
- {
- $chmchecknum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$chmtbr[tbname]."_index where classid='$add[classid]'");
- if($chmchecknum)
- {
- printerror("ClassChangeModHaveInfo","history.go(-1)");
- }
- }
- }
- //改变大栏目
- if($add[bclassid]<>$add[oldbclassid]){
- //转到主栏目
- if(empty($add[bclassid])){
- $sonclass="";
- $featherclass="";
- //取得栏目原本的大栏目
- $r=$empire->fetch1("select featherclass,classpath from {$dbtbpre}enewsclass where classid='$add[classid]'");
- //改变原本大栏目的子栏目
- $where=ReturnClass($r[featherclass]);
- if(empty($where)){
- $where="classid=0";
- }
- $bsql=$empire->query("select classid,sonclass from {$dbtbpre}enewsclass where ".$where);
- while($br=$empire->fetch($bsql)){
- $newsonclass=str_replace("|".$add[classid]."|","|",$br[sonclass]);
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$br[classid]'");
- }
- }
- //转到中级栏目
- else
- {
- //取得现在大栏目的值
- $b=$empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
- //检测大栏目是否为终级栏目
- if($b[islast])
- {
- printerror("BclassNotLast","");
- }
- if($b[wburl])
- {
- printerror("BclassNotWb","");
- }
- if(empty($b[featherclass])){
- $b[featherclass]="|";
- }
- $featherclass=$b[featherclass].$add[bclassid]."|";
- //改变新大栏目的子栏目
- $where=ReturnClass($featherclass);
- if(empty($where)){
- $where="classid=0";
- }
- $bsql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
- while($nb=$empire->fetch($bsql))
- {
- if(empty($nb[sonclass]))
- {$nb[sonclass]="|";}
- $newsonclass=$nb[sonclass].$add[classid]."|";
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$nb[classid]'");
- }
- //改变旧大栏目的子栏目
- $o=$empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='$add[classid]'");
- $where=ReturnClass($o[featherclass]);
- if(empty($where)){
- $where="classid=0";
- }
- $osql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
- while($ob=$empire->fetch($osql)){
- $newsonclass=str_replace("|".$add[classid]."|","|",$ob[sonclass]);
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$ob[classid]'");
- }
- }
- $change=",bclassid=$add[bclassid],featherclass='$featherclass'";
- }
- //应用于已生成的信息
- if($add['tobetempinfo'])
- {
- UpdateAllDataTbField($tabler['tbname'],"newstempid='$add[newstempid]'"," where classid='$add[classid]'",1);
- }
- //文件前缀
- $add[filename_qz]=RepFilenameQz($add[filename_qz]);
- $sql=$empire->query("update {$dbtbpre}enewsclass set classname='$add[classname]',classpath='$classpath',classtype='$add[classtype]',link_num=$add[link_num],lencord=$add[lencord],newstempid=$add[newstempid],listtempid=$add[listtempid],newspath='$add[newspath]',filename=$add[filename],filetype='$add[filetype]',openpl=$add[openpl],openadd=$add[openadd],newline=$add[newline],hotline=$add[hotline],goodline=$add[goodline],classurl='$add[classurl]',groupid=$add[groupid],myorder=$add[myorder],filename_qz='$add[filename_qz]',hotplline=$add[hotplline],modid=$add[modid],checked=$add[checked],firstline=$add[firstline],bname='$add[bname]',searchtempid=$add[searchtempid],tid=$tabler[tid],tbname='$tabler[tbname]',maxnum=$add[maxnum],checkpl=$add[checkpl],down_num=$add[down_num],online_num=$add[online_num],listorder='$add[listorder]',reorder='$add[reorder]',intro='$add[intro]',classimg='$add[classimg]',jstempid=$add[jstempid],addinfofen=$add[addinfofen],listdt=$add[listdt],showclass=$add[showclass],showdt=$add[showdt],checkqadd=$add[checkqadd],qaddlist=$add[qaddlist],qaddgroupid='$add[qaddgroupid]',qaddshowkey=$add[qaddshowkey],adminqinfo=$add[adminqinfo],doctime=$add[doctime],classpagekey='$add[classpagekey]',dtlisttempid='$add[dtlisttempid]',classtempid='$add[classtempid]',nreclass=$add[nreclass],nreinfo=$add[nreinfo],nrejs=$add[nrejs],nottobq=$add[nottobq],ipath='$add[ipath]',addreinfo=$add[addreinfo],haddlist=$add[haddlist],sametitle=$add[sametitle],definfovoteid=$add[definfovoteid],wburl='',qeditchecked=$add[qeditchecked],wapstyleid='$add[wapstyleid]',repreinfo='$add[repreinfo]',pltempid='$add[pltempid]',cgroupid='$add[cgroupid]',yhid='$add[yhid]',wfid='$add[wfid]',cgtoinfo='$add[cgtoinfo]',bdinfoid='$add[smallbdinfoid]',repagenum='$add[repagenum]',keycid='$add[keycid]',oneinfo='$add[oneinfo]',addsql='$add[addsql]',wapislist='$add[wapislist]',fclast='$ecms_fclast'".$change." where classid='$add[classid]'");
- //副表
- $ret_cr=ReturnClassAddF($add,1);
- $empire->query("update {$dbtbpre}enewsclassadd set classtext='".eaddslashes2($add[classtext])."',eclasspagetext='$add[eclasspagetext]'".$ret_cr[0]." where classid='$add[classid]'");
- //更新附件
- UpdateTheFileEditOther(1,$add['classid'],'other');
- GetClass();
- }
- //移动目录
- if($add[bclassid]<>$add[oldbclassid]||($add[oldclasspath]<>$classpath&&$add['classpath']==$add['oldcpath'])){
- $opath="../../".$add[oldclasspath];
- $newpath="../../".$classpath;
- MovePath($opath,$newpath);
- $opath="../../d/file/".$add[oldclasspath];
- $npath="../../d/file/".$classpath;
- CopyPath($opath,$npath);
- }
- else{
- if($add['oldcpath']<>$add['classpath'])//更换栏目目录
- {
- AlterClassPath($add['classid'],$add['islast'],$add['oldclasspath'],$classpath);
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'");
- GetClass();
- }
- }
- //删除缓存文件
- $cache_mid=0;
- $cache_oldmid=0;
- if($add[oldclassname]<>$add[classname]||$add[bclassid]<>$add[oldbclassid])
- {
- DelListEnews();
- //GetSearch($add[modid]);
- DelFiletext("../d/js/js/addinfo".$add[modid].".js");
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews' or (navtype='modclass' and modid='$add[modid]')");
- $cache_mid=$add[modid];
- }
- else
- {
- if(($add[oldclasspath]<>$classpath&&$add['classpath']==$add['oldcpath'])||$add[listdt]<>$add[oldlistdt])
- {
- DelListEnews();
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'");
- }
- if($add[openadd]<>$add[oldopenadd]||$add[modid]<>$add[oldmodid])
- {
- //GetSearch($add[modid]);
- DelFiletext("../d/js/js/addinfo".$add[modid].".js");
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='modclass' and modid='$add[modid]'");
- $cache_mid=$add[modid];
- if($add[modid]<>$add[oldmodid])
- {
- //GetSearch($add[oldmodid]);
- DelFiletext("../d/js/js/addinfo".$add[oldmodid].".js");
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='modclass' and modid='$add[oldmodid]'");
- $cache_oldmid=$add[oldmodid];
- }
- }
- }
- //修改栏目扩展名
- if($add[oldclasstype]<>$add[classtype]){
- $todaytime=date("Y-m-d H:i:s");
- if($add[islast]){
- $query="select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where classid='$add[classid]'";
- $lencord=$add[oldlencord];
- $num=$empire->gettotal($query);
- }
- else{
- $lencord=$add[oldlencord];
- if($add[oldislist]==1){
- $where=ReturnClass($class_r[$add[classid]][sonclass]);
- $query="select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where (".$where.")";
- $num=$empire->gettotal($query);
- }
- else
- {
- $num=1;
- }
- }
- RenameListfile($add[classid],$lencord,$num,$add[oldclasstype],$add[classtype],$classpath);
- }
- //来源
- if($add['from']){
- $returnurl="ListPageClass.php";
- }
- else{
- $returnurl="ListClass.php";
- }
- TogNotReClass(1);
- if($sql)
- {
- insert_dolog("classid=".$add[classid]."<br>classname=".$add[classname]);//操作日志
- $cache_enews='doclass,doinfo,douserinfo,domod,dostemp';
- $cache_ecmstourl=urlencode($returnurl.hReturnEcmsHashStrHref2(1));
- $cache_mess='EditClassSuccess';
- $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&oldmid=$cache_oldmid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- //printerror("EditClassSuccess",$returnurl);
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
- //终极栏目与非终极栏目之间的转换
- function ChangeClassIslast($reclassid,$userid,$username){
- global $empire,$dbtbpre;
- //操作权限
- CheckLevel($userid,$username,$classid,"class");
- $count=count($reclassid);
- $classid=(int)$reclassid[0];
- if($count==0||!$classid)
- {
- printerror("NotChangeIslastClassid","");
- }
- //取得本栏目信息
- $r=$empire->fetch1("select classid,sonclass,featherclass,islist,islast,classname,modid,tbname,wburl from {$dbtbpre}enewsclass where classid=$classid");
- if(empty($r[classid]))
- {
- printerror("NotChangeIslastClassid","");
- }
- if($r[wburl])
- {
- printerror("NotChangeWbClassid","");
- }
- //非终极栏目
- if(!$r[islast])
- {
- $num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsclass where bclassid=$classid");
- if($num)
- {
- printerror("LastTheClassHaveSonclass","history.go(-1)");
- }
- //修改父栏目的子栏目
- $where=ReturnClass($r[featherclass]);
- if(empty($where))
- {
- $where="classid=0";
- }
- $sql=$empire->query("select classid,sonclass from {$dbtbpre}enewsclass where ".$where);
- while($br=$empire->fetch($sql))
- {
- if(empty($br[sonclass]))
- {
- $br[sonclass]="|";
- }
- $newsonclass=$br[sonclass].$classid."|";
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid=$br[classid]");
- }
- $dosql=$empire->query("update {$dbtbpre}enewsclass set islast=1 where classid=$classid");
- $mess="ChangeClassToLastSuccess";
- }
- //终极栏目
- else
- {
- $num=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$r[tbname]."_index where classid='$classid'");
- if($num)
- {
- printerror("LastTheClassHaveInfo","history.go(-1)");
- }
- //修改父栏目的子栏目
- $where=ReturnClass($r[featherclass]);
- if(empty($where))
- {
- $where="classid=0";
- }
- $sql=$empire->query("select classid,sonclass from {$dbtbpre}enewsclass where ".$where);
- while($br=$empire->fetch($sql))
- {
- if(empty($br[sonclass]))
- {
- $br[sonclass]="|";
- }
- $newsonclass=str_replace("|".$classid."|","|",$br[sonclass]);
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid=$br[classid]");
- }
- $dosql=$empire->query("update {$dbtbpre}enewsclass set islast=0 where classid=$classid");
- $mess="ChangeClassToNolastSuccess";
- }
- //删除缓存文件
- DelListEnews();
- //更新缓存
- GetClass();
- //GetSearch($r[modid]);
- if($dosql)
- {
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews' or (navtype='modclass' and modid='$r[modid]')");
- DelFiletext("../d/js/js/addinfo".$r[modid].".js");
- $cache_enews='doclass,doinfo,douserinfo,domod,dostemp';
- $cache_ecmstourl=urlencode(EcmsGetReturnUrl());
- $cache_mess=$mess;
- $cache_mid=$r[modid];
- $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- //操作日志
- insert_dolog("classid=".$classid."<br>classname=".$r[classname]);
- //printerror($mess,EcmsGetReturnUrl());
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
- //删除栏目
- function DelClass($classid,$userid,$username){
- global $empire,$dbtbpre;
- $classid=(int)$classid;
- if(!$classid)
- {
- printerror("NotDelClassid","");
- }
- //操作权限
- CheckLevel($userid,$username,$classid,"delclass");
- $r=$empire->fetch1("select * from {$dbtbpre}enewsclass where classid='$classid'");
- if(empty($r[classid]))
- {
- printerror("NotClassid","history.go(-1)");
- }
- DelClass1($classid);
- GetClass();
- //GetSearch($r[modid]);
- //返回地址
- if($_GET['from'])
- {$returnurl="ListPageClass.php";}
- else
- {$returnurl="ListClass.php";}
- TogNotReClass(1);
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews' or (navtype='modclass' and modid='$r[modid]')");
- $cache_enews='doclass,doinfo,douserinfo,domod,dostemp';
- $cache_ecmstourl=urlencode($returnurl.hReturnEcmsHashStrHref2(1));
- $cache_mess='DelClassSuccess';
- $cache_mid=$r[modid];
- $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- insert_dolog("classid=".$classid."<br>classname=".$r[classname]);//操作日志
- //printerror("DelClassSuccess",$returnurl);
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- //删除栏目,不返回值
- function DelClass1($classid){
- global $empire,$class_r,$dbtbpre;
- $r=$empire->fetch1("select * from {$dbtbpre}enewsclass where classid='$classid'");
- //外部栏目
- if($r[wburl])
- {
- $sql=$empire->query("delete from {$dbtbpre}enewsclass where classid='$classid'");
- $empire->query("delete from {$dbtbpre}enewsclassadd where classid='$classid'");
- $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='$classid'");
- //删除栏目附件
- DelFileOtherTable("modtype=1 and id='$classid'");
- //删除缓存
- DelListEnews();
- return "";
- }
- //删除终极栏目
- if($r[islast])
- {
- //删除主表信息
- $indexsql=$empire->query("delete from {$dbtbpre}ecms_".$r[tbname]."_index where classid='$classid'");
- $sql=$empire->query("delete from {$dbtbpre}ecms_".$r[tbname]." where classid='$classid'");
- $empire->query("delete from {$dbtbpre}ecms_".$r[tbname]."_check where classid='$classid'");
- $empire->query("delete from {$dbtbpre}ecms_".$r[tbname]."_doc where classid='$classid'");
- //删除副表信息
- DelAllDataTbInfo($r['tbname'],"classid='$classid'",1,1);
- //删除存文本文件
- DelInfoSaveTxtfile($r['modid'],$r['tbname'],"classid='$classid'");
- //删除信息附加表与附件
- DelMoreInfoOtherData($classid,0,0);
- $filepath="../../d/file/".$r[classpath];
- $delf=DelPath($filepath);
- DelFileOtherTable("modtype=1 and id='$classid'");
- //删除栏目本身
- $sql1=$empire->query("delete from {$dbtbpre}enewsclass where classid='$classid'");
- $empire->query("delete from {$dbtbpre}enewsclassadd where classid='$classid'");
- $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='$classid'");
- $delpath="../../".$r[classpath];
- $del=DelPath($delpath);
- //更新大栏目的子栏目
- $where=ReturnClass($r[featherclass]);
- if(empty($where))
- {$where="classid=0";}
- $bsql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
- while($br=$empire->fetch($bsql))
- {
- $newsonclass=str_replace("|".$classid."|","|",$br[sonclass]);
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$br[classid]'");
- }
- }
- //删除大栏目
- else
- {
- //删除栏目
- $where=ReturnClass($r[sonclass]);
- if(empty($where))
- {$where="classid=0";}
- $delcr=explode("|",$r[sonclass]);
- $count=count($delcr);
- for($i=1;$i<$count-1;$i++)
- {
- $delcid=$delcr[$i];
- //删除主表信息
- $indexsql=$empire->query("delete from {$dbtbpre}ecms_".$class_r[$delcid][tbname]."_index where classid='$delcid'");
- $sql=$empire->query("delete from {$dbtbpre}ecms_".$class_r[$delcid][tbname]." where classid='$delcid'");
- $empire->query("delete from {$dbtbpre}ecms_".$class_r[$delcid][tbname]."_check where classid='$delcid'");
- $empire->query("delete from {$dbtbpre}ecms_".$class_r[$delcid][tbname]."_doc where classid='$delcid'");
- //删除副表信息
- DelAllDataTbInfo($class_r[$delcid][tbname],"classid='$delcid'",1,1);
- //删除存文本文件
- DelInfoSaveTxtfile($class_r[$delcid][modid],$class_r[$delcid][tbname],"classid='$delcid'");
- //删除信息附加表与附件
- DelMoreInfoOtherData($delcid,0,0);
- }
- //删除附件
- $filepath="../../d/file/".$r[classpath];
- $delf=DelPath($filepath);
- if($where<>'classid=0')
- {
- DelFileOtherTable("modtype=1 and (".str_replace('classid','id',$where).")");
- }
- //删除子栏目副表
- $fcsql=$empire->query("select classid from {$dbtbpre}enewsclass where featherclass like '%|".$classid."|%'");
- while($fcr=$empire->fetch($fcsql))
- {
- $empire->query("delete from {$dbtbpre}enewsclassadd where classid='$fcr[classid]'");
- $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='$fcr[classid]'");
- }
- //删除子栏目
- $sql1=$empire->query("delete from {$dbtbpre}enewsclass where featherclass like '%|".$classid."|%'");
- //改变父栏目的子类
- $where=ReturnClass($r[featherclass]);
- if(empty($where))
- {$where="classid=0";}
- $bbsql=$empire->query("select classid,sonclass from {$dbtbpre}enewsclass where ".$where);
- while($bbr=$empire->fetch($bbsql))
- {
- $newsonclass=str_replace($r[sonclass],"|",$bbr[sonclass]);
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$bbr[classid]'");
- }
- //删除栏目本身
- $sql2=$empire->query("delete from {$dbtbpre}enewsclass where classid='$classid'");
- $empire->query("delete from {$dbtbpre}enewsclassadd where classid='$classid'");
- $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='$classid'");
- //删除栏目附件
- DelFileOtherTable("modtype=1 and id='$classid'");
- $delpath="../../".$r[classpath];
- $del=DelPath($delpath);
- }
- //删除缓存
- DelListEnews();
- //moreportdo
- if($r['classpath'])
- {
- $eautodofname='delpath|'.$r['classpath'].'||';
- eAutodo_AddDo('eDelFileClass',0,0,0,0,0,$eautodofname);
- }
- }
- //修改栏目顺序
- function EditClassOrder($classid,$myorder,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"class");
- for($i=0;$i<count($classid);$i++)
- {
- $newmyorder=(int)$myorder[$i];
- $sql=$empire->query("update {$dbtbpre}enewsclass set myorder=$newmyorder where classid='$classid[$i]'");
- }
- //删除缓存
- DelListEnews();
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'");
- $cache_enews='doclass,doinfo,douserinfo';
- $cache_ecmstourl=urlencode(EcmsGetReturnUrl());
- $cache_mess='EditClassOrderSuccess';
- $cache_url="CreateCache.php?enews=$cache_enews&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- //操作日志
- insert_dolog("");
- //printerror("EditClassOrderSuccess",EcmsGetReturnUrl());
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- //更新栏目关系
- function ChangeSonclass($start,$userid,$username){
- global $empire,$public_r,$fun_r,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"changedata");
- $moreportpid=(int)$_GET['moreportpid'];
- $mphref='';
- if($moreportpid)
- {
- $mphref=Moreport_ReturnUrlCsPid($moreportpid,0,0,'');
- }
- $start=(int)$start;
- $b=0;
- $sql=$empire->query("select classid from {$dbtbpre}enewsclass where islast=0 and classid>".$start." order by classid limit ".$public_r[relistnum]);
- while($r=$empire->fetch($sql))
- {
- $b=1;
- $newstart=$r[classid];
- //子栏目
- $sonclass="|";
- $ssql=$empire->query("select classid from {$dbtbpre}enewsclass where islast=1 and featherclass like '%|".$r[classid]."|%' order by classid");
- while($sr=$empire->fetch($ssql))
- {
- $sonclass.=$sr[classid]."|";
- }
- $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$sonclass' where classid='$r[classid]'");
- }
- //完毕
- if(empty($b))
- {
- GetClass();
- printerror("ChangeSonclassSuccess","ReHtml/ChangeData.php?".hReturnEcmsHashStrHref2(0).$mphref);
- }
- echo $fun_r['OneChangeSonclassSuccess']."(ID:<font color=red><b>".$newstart."</b></font>)<script>self.location.href='ecmsclass.php?enews=ChangeSonclass&start=$newstart".hReturnEcmsHashStrHref(0).$mphref."';</script>";
- exit();
- }
- //删除栏目缓存文件
- function DelFcListClass(){
- global $empire,$dbtbpre,$logininid,$loginin;
- //验证权限
- CheckLevel($logininid,$loginin,0,"changedata");
- DelListEnews();
- //删除导航缓存
- $empire->query("delete from {$dbtbpre}enewsclassnavcache");
- $cache_enews='doclass,doinfo,douserinfo,domod,dostemp';
- $cache_ecmstourl=urlencode("history.go(-1)");
- $cache_mess='DelListEnewsSuccess';
- $cache_url="CreateCache.php?enews=$cache_enews&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
- //操作日志
- insert_dolog("");
- //printerror("DelListEnewsSuccess","history.go(-1)");
- echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
- db_close();
- $empire=null;
- exit();
- }
- //批量设置栏目
- function SetMoreClass($add,$userid,$username){
- global $empire,$dbtbpre;
- //验证权限
- CheckLevel($userid,$username,$classid,"setmclass");
- //变量
- $add[classtype]=eaddslashes($add[classtype]);
- $add[listtempid]=(int)$add[listtempid];
- $add[dtlisttempid]=(int)$add[dtlisttempid];
- $add[maxnum]=(int)$add[maxnum];
- $add[lencord]=(int)$add[lencord];
- $add[searchtempid]=(int)$add[searchtempid];
- $add[wapstyleid]=(int)$add[wapstyleid];
- $add[listorder]=eaddslashes($add[listorder]);
- $add[reorder]=eaddslashes($add[reorder]);
- $add[listdt]=(int)$add[listdt];
- $add[showdt]=(int)$add[showdt];
- $add[showclass]=(int)$add[showclass];
- $add[openadd]=(int)$add[openadd];
- $add[classtempid]=(int)$add[classtempid];
- $add[islist]=(int)$add[islist];
- $add[newstempid]=(int)$add[newstempid];
- $add[pltempid]=(int)$add[pltempid];
- $add[link_num]=(int)$add[link_num];
- $add[ipath]=eaddslashes($add[ipath]);
- $add[newspath]=eaddslashes($add[newspath]);
- $add[filename_qz]=eaddslashes($add[filename_qz]);
- $add[filename]=eaddslashes($add[filename]);
- $add[filetype]=eaddslashes($add[filetype]);
- $add[openpl]=(int)$add[openpl];
- $add[checkpl]=(int)$add[checkpl];
- $add[qaddshowkey]=(int)$add[qaddshowkey];
- $add[checkqadd]=(int)$add[checkqadd];
- $add[qaddlist]=(int)$add[qaddlist];
- $add[addinfofen]=(int)$add[addinfofen];
- $add[adminqinfo]=(int)$add[adminqinfo];
- $add[qeditchecked]=(int)$add[qeditchecked];
- $add[addreinfo]=(int)$add[addreinfo];
- $add[haddlist]=(int)$add[haddlist];
- $add[sametitle]=(int)$add[sametitle];
- $add[checked]=(int)$add[checked];
- $add[repreinfo]=(int)$add[repreinfo];
- $add[definfovoteid]=(int)$add[definfovoteid];
- $add[groupid]=eaddslashes($add[groupid]);
- $add[doctime]=(int)$add[doctime];
- $add[down_num]=(int)$add[down_num];
- $add[online_num]=(int)$add[online_num];
- $add[jstempid]=(int)$add[jstempid];
- $add[newline]=(int)$add[newline];
- $add[hotline]=(int)$add[hotline];
- $add[goodline]=(int)$add[goodline];
- $add[hotplline]=(int)$add[hotplline];
- $add[firstline]=(int)$add[firstline];
- //栏目
- $classid=$add['classid'];
- $count=count($classid);
- if($count==0)
- {
- printerror("NotChangeSetClass","");
- }
- $cids='';
- $dh='';
- for($i=0;$i<$count;$i++)
- {
- $cids.=$dh.intval($classid[$i]);
- $dh=',';
- }
- $whereclass='classid in ('.$cids.')';
- $seting='';
- //基本属性
- if($add['doclasstype'])
- {
- $seting.=",classtype='$add[classtype]'";
- }
- if($add['dolisttempid']&&$add[listtempid])
- {
- $seting.=",listtempid='$add[listtempid]'";
- }
- if($add['dodtlisttempid'])
- {
- $seting.=",dtlisttempid='$add[dtlisttempid]'";
- }
- if($add['domaxnum'])
- {
- $seting.=",maxnum='$add[maxnum]'";
- }
- if($add['dolencord'])
- {
- $seting.=",lencord='$add[lencord]'";
- }
- if($add['dosearchtempid'])
- {
- $seting.=",searchtempid='$add[searchtempid]'";
- }
- if($add['dowapstyleid'])
- {
- $seting.=",wapstyleid='$add[wapstyleid]'";
- }
- if($add['dolistorder'])
- {
- $seting.=",listorder='$add[listorder]'";
- }
- if($add['doreorder'])
- {
- $seting.=",reorder='$add[reorder]'";
- }
- if($add['dolistdt'])
- {
- $seting.=",listdt='$add[listdt]'";
- }
- if($add['doshowdt'])
- {
- $seting.=",showdt='$add[showdt]'";
- }
- if($add['doshowclass'])
- {
- $seting.=",showclass='$add[showclass]'";
- }
- if($add['doopenadd'])
- {
- $seting.=",openadd='$add[openadd]'";
- }
- //选项设置[大栏目]
- if($add['doclasstempid'])
- {
- $seting.=",classtempid='$add[classtempid]'";
- }
- if($add['doislist'])
- {
- $seting.=",islist='$add[islist]'";
- }
- //选项设置[终极栏目]
- if($add['donewstempid']&&$add[newstempid])
- {
- $seting.=",newstempid='$add[newstempid]'";
- if($add['tobetempinfo'])
- {
- $donewstemp=1;
- }
- }
- if($add['dopltempid'])
- {
- $seting.=",pltempid='$add[pltempid]'";
- }
- if($add['dolink_num'])
- {
- $seting.=",link_num='$add[link_num]'";
- }
- if($add['doinfopath'])
- {
- if($add['infopath']==0)
- {
- $add['ipath']='';
- }
- $seting.=",ipath='$add[ipath]'";
- }
- if($add['donewspath'])
- {
- $seting.=",newspath='$add[newspath]'";
- }
- if($add['dofilename_qz'])
- {
- $seting.=",filename_qz='$add[filename_qz]'";
- }
- if($add['dofilename'])
- {
- $seting.=",filename='$add[filename]'";
- }
- if($add['dofiletype'])
- {
- $seting.=",filetype='$add[filetype]'";
- }
- if($add['doopenpl'])
- {
- $seting.=",openpl='$add[openpl]'";
- }
- if($add['docheckpl'])
- {
- $seting.=",checkpl='$add[checkpl]'";
- }
- if($add['doqaddshowkey'])
- {
- $seting.=",qaddshowkey='$add[qaddshowkey]'";
- }
- if($add['docheckqadd'])
- {
- $seting.=",checkqadd='$add[checkqadd]'";
- }
- if($add['doqaddgroupid'])
- {
- $add[qaddgroupid]=DoPostClassQAddGroupid($add[qaddgroupidck]);
- $add[qaddgroupid]=eaddslashes($add[qaddgroupid]);
- $seting.=",qaddgroupid='$add[qaddgroupid]'";
- }
- if($add['doqaddlist'])
- {
- $seting.=",qaddlist='$add[qaddlist]'";
- }
- if($add['doaddinfofen'])
- {
- $seting.=",addinfofen='$add[addinfofen]'";
- }
- if($add['doadminqinfo'])
- {
- $seting.=",adminqinfo='$add[adminqinfo]'";
- }
- if($add['doqeditchecked'])
- {
- $seting.=",qeditchecked='$add[qeditchecked]'";
- }
- if($add['doaddreinfo'])
- {
- $seting.=",addreinfo='$add[addreinfo]'";
- }
- if($add['dohaddlist'])
- {
- $seting.=",haddlist='$add[haddlist]'";
- }
- if($add['dosametitle'])
- {
- $seting.=",sametitle='$add[sametitle]'";
- }
- if($add['dochecked'])
- {
- $seting.=",checked='$add[checked]'";
- }
- if($add['dorepreinfo'])
- {
- $seting.=",repreinfo='$add[repreinfo]'";
- }
- if($add['dodefinfovoteid'])
- {
- $seting.=",definfovoteid='$add[definfovoteid]'";
- }
- if($add['dogroupid'])
- {
- $seting.=",groupid='$add[groupid]'";
- }
- if($add['dodoctime'])
- {
- $seting.=",doctime='$add[doctime]'";
- }
- //特殊模型设置
- if($add['dodown_num'])
- {
- $seting.=",down_num='$add[down_num]'";
- }
- if($add['doonline_num'])
- {
- $seting.=",online_num='$add[online_num]'";
- }
- //JS调用设置
- if($add['dojstempid'])
- {
- $seting.=",jstempid='$add[jstempid]'";
- }
- if($add['donewjs'])
- {
- $seting.=",newline='$add[newline]'";
- }
- if($add['dohotjs'])
- {
- $seting.=",hotline='$add[hotline]'";
- }
- if($add['dogoodjs'])
- {
- $seting.=",goodline='$add[goodline]'";
- }
- if($add['dohotpljs'])
- {
- $seting.=",hotplline='$add[hotplline]'";
- }
- if($add['dofirstjs'])
- {
- $seting.=",firstline='$add[firstline]'";
- }
- if(empty($seting))
- {
- printerror("NotChangeSetClassInfo","");
- }
- $seting=substr($seting,1);
- $sql=$empire->query("update {$dbtbpre}enewsclass set ".$seting." where ".$whereclass);
- //内容模板应用于子生成的信息
- if($donewstemp==1)
- {
- $csql=$empire->query("select classid,tbname from {$dbtbpre}enewsclass where (".$whereclass.") and islast=1");
- while($r=$empire->fetch($csql))
- {
- UpdateAllDataTbField($r['tbname'],"newstempid='$add[newstempid]'"," where classid='$r[classid]'",1);
- }
- }
- if($sql)
- {
- GetClass();
- //操作日志
- insert_dolog("");
- printerror("SetMoreClassSuccess","SetMoreClass.php".hReturnEcmsHashStrHref2(1));
- }
- else
- {printerror("DbError","");}
- }
- ?>
|