classfun.php 94 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856
  1. <?php
  2. //*********************** 专题 *********************
  3. //返回字段值
  4. function ReturnZFvalue($value)
  5. {
  6. $value=str_replace("\r\n","|",$value);
  7. return $value;
  8. }
  9. //取得专题表单元素html代码
  10. function GetZtFform($type,$f,$fvalue,$fformsize=''){
  11. if($type=="select"||$type=="radio"||$type=="checkbox")
  12. {
  13. return GetZFformSelect($type,$f,$fvalue,$fformsize);
  14. }
  15. $file="../data/html/classfhtml.txt";
  16. $data=ReadFiletext($file);
  17. $exp="[!--".$type."--]";
  18. $r=explode($exp,$data);
  19. $string=str_replace("[!--enews.var--]",$f,$r[1]);
  20. $string=str_replace("[!--enews.def.val--]",$fvalue,$string);
  21. if($type=='editor')//编辑器
  22. {
  23. $editortype='Default';
  24. $string=str_replace("[!--editor.type--]",$editortype,$string);
  25. $string=str_replace("[!--editor.basepath--]",'../ecmseditor/infoeditor/',$string);
  26. }
  27. elseif($type=='img'||$type=='flash'||$type=='file')//附件
  28. {
  29. $string=str_replace("[!--enews.modtype--]",'2',$string);
  30. $string=str_replace("[!--enews.path--]",'../',$string);
  31. }
  32. $string=RepZFformSize($f,$string,$type,$fformsize);
  33. return fAddAddsData($string);
  34. }
  35. //取得select/radio元素代码
  36. function GetZFformSelect($type,$f,$fvalue,$fformsize=''){
  37. $vr=explode("|",$fvalue);
  38. $count=count($vr);
  39. $change="";
  40. $def=':default';
  41. for($i=0;$i<$count;$i++)
  42. {
  43. $val=$vr[$i];
  44. $isdef="";
  45. if(strstr($val,$def))
  46. {
  47. $dr=explode($def,$val);
  48. $val=$dr[0];
  49. $isdef="||\$ecmsfirstpost==1";
  50. }
  51. if($type=='select')
  52. {
  53. $change.="<option value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' selected':''?>>".$val."</option>";
  54. }
  55. elseif($type=='checkbox')
  56. {
  57. $change.="<input name=\"".$f."[]\" type=\"checkbox\" value=\"".$val."\"<?=strstr(\$r[".$f."],\"|".$val."|\")".$isdef."?' checked':''?>>".$val;
  58. }
  59. else
  60. {
  61. $change.="<input name=\"".$f."\" type=\"radio\" value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' checked':''?>>".$val;
  62. }
  63. }
  64. if($type=="select")
  65. {
  66. if($fformsize)
  67. {
  68. $addsize=' style="width:'.$fformsize.'"';
  69. }
  70. $change="<select name=\"".$f."\" id=\"".$f."\"".$addsize.">".$change."</select>";
  71. }
  72. return $change;
  73. }
  74. //替换表单元素长度
  75. function RepZFformSize($f,$string,$type,$fformsize=''){
  76. $fformsize=ReturnDefZFformSize($f,$type,$fformsize);
  77. if($type=='textarea'||$type=='editor')
  78. {
  79. $r=explode(',',$fformsize);
  80. $string=str_replace('[!--fsize.w--]',$r[0],$string);
  81. $string=str_replace('[!--fsize.h--]',$r[1],$string);
  82. }
  83. else
  84. {
  85. $string=str_replace('[!--fsize.w--]',$fformsize,$string);
  86. }
  87. return $string;
  88. }
  89. //返回默认长度
  90. function ReturnDefZFformSize($f,$type,$fformsize){
  91. if(empty($fformsize))
  92. {
  93. if($type=='textarea')
  94. {
  95. $fformsize='60,10';
  96. }
  97. elseif($type=='img')
  98. {
  99. $fformsize='45';
  100. }
  101. elseif($type=='file')
  102. {
  103. $fformsize='45';
  104. }
  105. elseif($type=='flash')
  106. {
  107. $fformsize='45';
  108. }
  109. elseif($type=='date')
  110. {
  111. $fformsize='12';
  112. }
  113. elseif($type=='color')
  114. {
  115. $fformsize='10';
  116. }
  117. elseif($type=='linkfield')
  118. {
  119. $fformsize='45';
  120. }
  121. elseif($type=='downpath')
  122. {
  123. $fformsize='45';
  124. }
  125. elseif($type=='onlinepath')
  126. {
  127. $fformsize='45';
  128. }
  129. elseif($type=='editor')
  130. {
  131. $fformsize='100%,300';
  132. }
  133. }
  134. return $fformsize;
  135. }
  136. //更新栏目表单文件
  137. function ChangeZtForm(){
  138. global $empire,$dbtbpre;
  139. $file='../data/html/ztaddform.php';
  140. $mtemp='';
  141. $sql=$empire->query("select fname,f,fhtml from {$dbtbpre}enewsztf order by myorder,fid");
  142. while($r=$empire->fetch($sql))
  143. {
  144. $mtemp.="<tr bgcolor='#FFFFFF' height=25><td>".$r['fname']."</td><td>".$r['fhtml']."</td></tr>";
  145. }
  146. $mtemp="<?php
  147. if(!defined('InEmpireCMS'))
  148. {exit();}
  149. ?>".$mtemp;
  150. WriteFiletext($file,$mtemp);
  151. }
  152. //增加专题字段
  153. function AddZtF($add,$userid,$username){
  154. global $empire,$dbtbpre;
  155. //验证权限
  156. CheckLevel($userid,$username,$classid,"ztf");
  157. $add[f]=RepPostVar($add[f]);
  158. if(empty($add[f])||empty($add[fname]))
  159. {
  160. printerror("EmptyF","");
  161. }
  162. //字段是否重复
  163. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsztadd");
  164. $b=0;
  165. while($r=$empire->fetch($s))
  166. {
  167. if($r[Field]==$add[f])
  168. {
  169. $b=1;
  170. break;
  171. }
  172. }
  173. if($b)
  174. {
  175. printerror("ReF","");
  176. }
  177. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewszt");
  178. $b=0;
  179. while($r=$empire->fetch($s))
  180. {
  181. if($r[Field]==$add[f])
  182. {
  183. $b=1;
  184. break;
  185. }
  186. }
  187. if($b)
  188. {
  189. printerror("ReF","");
  190. }
  191. $add[fvalue]=ReturnZFvalue($add[fvalue]);//初始化值
  192. //字段类型
  193. if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
  194. {
  195. $def=" default '0'";
  196. }
  197. elseif($add[ftype]=="VARCHAR")
  198. {
  199. $def=" default ''";
  200. }
  201. else
  202. {
  203. $def="";
  204. }
  205. $type=$add[ftype];
  206. //VARCHAR
  207. if($add[ftype]=='VARCHAR'&&empty($add[flen]))
  208. {
  209. $add[flen]='255';
  210. }
  211. //字段长度
  212. if($add[flen]){
  213. if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
  214. $type.="(".$add[flen].")";
  215. }
  216. }
  217. $field="`".$add[f]."` ".$type." NOT NULL".$def;
  218. //新增字段
  219. $asql=$empire->query("alter table {$dbtbpre}enewsztadd add ".$field);
  220. //替换代码
  221. $fhtml=GetZtFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
  222. if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
  223. {
  224. $fhtml=str_replace("\$r[","\$addr[",$fhtml);
  225. }
  226. //处理变量
  227. $add[myorder]=(int)$add[myorder];
  228. $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]');");
  229. $lastid=$empire->lastid();
  230. //更新表单
  231. ChangeZtForm();
  232. if($asql&&$sql)
  233. {
  234. //操作日志
  235. insert_dolog("fid=".$lastid."<br>f=".$add[f]);
  236. printerror("AddFSuccess","special/AddZtF.php?enews=AddZtF".hReturnEcmsHashStrHref2(0));
  237. }
  238. else
  239. {
  240. printerror("DbError","history.go(-1)");
  241. }
  242. }
  243. //修改专题字段
  244. function EditZtF($add,$userid,$username){
  245. global $empire,$dbtbpre;
  246. //验证权限
  247. CheckLevel($userid,$username,$classid,"ztf");
  248. $fid=(int)$add['fid'];
  249. $add[f]=RepPostVar($add[f]);
  250. $add[oldf]=RepPostVar($add[oldf]);
  251. if(empty($add[f])||empty($add[fname])||!$fid){
  252. printerror("EmptyF","history.go(-1)");
  253. }
  254. if($add[f]<>$add[oldf]){
  255. //字段是否重复
  256. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsztadd");
  257. $b=0;
  258. while($r=$empire->fetch($s)){
  259. if($r[Field]==$add[f]){
  260. $b=1;
  261. break;
  262. }
  263. }
  264. if($b){
  265. printerror("ReF","history.go(-1)");
  266. }
  267. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewszt");
  268. $b=0;
  269. while($r=$empire->fetch($s))
  270. {
  271. if($r[Field]==$add[f])
  272. {
  273. $b=1;
  274. break;
  275. }
  276. }
  277. if($b)
  278. {
  279. printerror("ReF","");
  280. }
  281. }
  282. $add[fvalue]=ReturnZFvalue($add[fvalue]);//初始化值
  283. //字段类型
  284. if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
  285. {
  286. $def=" default '0'";
  287. }
  288. elseif($add[ftype]=="VARCHAR")
  289. {
  290. $def=" default ''";
  291. }
  292. else
  293. {
  294. $def="";
  295. }
  296. $type=$add[ftype];
  297. //VARCHAR
  298. if($add[ftype]=='VARCHAR'&&empty($add[flen]))
  299. {
  300. $add[flen]='255';
  301. }
  302. //字段长度
  303. if($add[flen]){
  304. if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
  305. $type.="(".$add[flen].")";
  306. }
  307. }
  308. $field="`".$add[f]."` ".$type." NOT NULL".$def;
  309. $usql=$empire->query("alter table {$dbtbpre}enewsztadd change `".$add[oldf]."` ".$field);
  310. //替换代码
  311. if($add[f]<>$add[oldf]||$add[fform]<>$add[oldfform]||$add[fvalue]<>$add[oldfvalue]||$add[fformsize]<>$add[oldfformsize]){
  312. $fhtml=GetZtFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
  313. if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
  314. {
  315. $fhtml=str_replace("\$r[","\$addr[",$fhtml);
  316. }
  317. }
  318. else{
  319. $fhtml=$add[fhtml];
  320. }
  321. //处理变量
  322. $add[myorder]=(int)$add[myorder];
  323. $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");
  324. //更新表单
  325. ChangeZtForm();
  326. if($usql&&$sql)
  327. {
  328. insert_dolog("fid=".$fid."<br>f=".$add[f]);//操作日志
  329. printerror("EditFSuccess","special/ListZtF.php".hReturnEcmsHashStrHref2(1));
  330. }
  331. else
  332. {printerror("DbError","history.go(-1)");}
  333. }
  334. //删除专题字段
  335. function DelZtF($add,$userid,$username){
  336. global $empire,$dbtbpre;
  337. //验证权限
  338. CheckLevel($userid,$username,$classid,"ztf");
  339. $fid=(int)$add['fid'];
  340. if(empty($fid)){
  341. printerror("EmptyFid","history.go(-1)");
  342. }
  343. $r=$empire->fetch1("select f from {$dbtbpre}enewsztf where fid='$fid'");
  344. if(!$r[f]){
  345. printerror("EmptyFid","history.go(-1)");
  346. }
  347. $usql=$empire->query("alter table {$dbtbpre}enewsztadd drop COLUMN `".$r[f]."`");
  348. $sql=$empire->query("delete from {$dbtbpre}enewsztf where fid='$fid'");
  349. //更新表单表
  350. ChangeZtForm();
  351. if($usql&&$sql)
  352. {
  353. insert_dolog("fid=".$fid."<br>f=".$r[f]);//操作日志
  354. printerror("DelFSuccess","special/ListZtF.php".hReturnEcmsHashStrHref2(1));
  355. }
  356. else
  357. {printerror("DbError","history.go(-1)");}
  358. }
  359. //修改专题字段顺序
  360. function EditZtFOrder($fid,$myorder,$userid,$username){
  361. global $empire,$dbtbpre;
  362. //验证权限
  363. CheckLevel($userid,$username,$classid,"ztf");
  364. for($i=0;$i<count($myorder);$i++)
  365. {
  366. $fid[$i]=(int)$fid[$i];
  367. $newmyorder=(int)$myorder[$i];
  368. $usql=$empire->query("update {$dbtbpre}enewsztf set myorder=$newmyorder where fid='$fid[$i]'");
  369. }
  370. //更新表单表
  371. ChangeZtForm();
  372. printerror("EditFOrderSuccess","special/ListZtF.php".hReturnEcmsHashStrHref2(1));
  373. }
  374. //返回专题字段
  375. function ReturnZtAddF($add,$ecms=0){
  376. global $empire,$dbtbpre;
  377. $ret_r[0]='';
  378. $ret_r[1]='';
  379. $fsql=$empire->query("select f from {$dbtbpre}enewsztf");
  380. if($ecms==0)//增加
  381. {
  382. while($fr=$empire->fetch($fsql))
  383. {
  384. $f=$fr['f'];
  385. $fval=$add[$f];
  386. $fval=RepPhpAspJspcode($fval);
  387. $ret_r[0].=",`".$f."`";
  388. $ret_r[1].=",'".AddAddsData($fval)."'";
  389. }
  390. }
  391. else//修改
  392. {
  393. while($fr=$empire->fetch($fsql))
  394. {
  395. $f=$fr['f'];
  396. $fval=$add[$f];
  397. $fval=RepPhpAspJspcode($fval);
  398. $ret_r[0].=",`".$f."`='".AddAddsData($fval)."'";
  399. }
  400. }
  401. return $ret_r;
  402. }
  403. //处理专题提交变量
  404. function DoPostZtVar($add){
  405. if(empty($add[zttype])){
  406. $add[zttype]=".html";
  407. }
  408. if(empty($add[ztnum])){
  409. $add[ztnum]=25;
  410. }
  411. $add[zcid]=(int)$add['zcid'];
  412. $add[ztname]=eaddslashes(ehtmlspecialchars($add[ztname]));
  413. $add[intro]=eaddslashes(RepPhpAspJspcode($add[intro]));
  414. $add[ztpagekey]=eaddslashes(RepPhpAspJspcode($add[ztpagekey]));
  415. $add[ztnum]=(int)$add[ztnum];
  416. $add[listtempid]=(int)$add[listtempid];
  417. $add[classid]=(int)$add[classid];
  418. $add[islist]=(int)$add[islist];
  419. $add[maxnum]=(int)$add[maxnum];
  420. $add[showzt]=(int)$add[showzt];
  421. $add[classtempid]=(int)$add[classtempid];
  422. $add['myorder']=(int)$add['myorder'];
  423. $add[reorder]=RepPostVar2($add[reorder]);
  424. $add[classtext]=RepPhpAspJspcode($add[classtext]);
  425. $add[usezt]=(int)$add[usezt];
  426. $add[yhid]=(int)$add[yhid];
  427. $add['endtime']=$add['endtime']?to_time($add['endtime']):0;
  428. $add['closepl']=(int)$add['closepl'];
  429. $add['checkpl']=(int)$add['checkpl'];
  430. $add['from']=(int)$add['from'];
  431. $add['filepass']=(int)$add['filepass'];
  432. $add['pltempid']=(int)$add['pltempid'];
  433. if($add['usernames'])
  434. {
  435. $add['usernames']=','.$add['usernames'].',';
  436. }
  437. //目录
  438. $add[ztpath]=$add['pripath'].$add['ztpath'];
  439. $add[ztpath]=eaddslashes($add[ztpath]);
  440. return $add;
  441. }
  442. //增加专题
  443. function AddZt($add,$userid,$username){
  444. global $empire,$class_r,$dbtbpre,$public_r;
  445. $add[ztpath]=trim($add[ztpath]);
  446. if(!$add[ztname]||!$add[listtempid]||!$add[ztpath]){
  447. printerror("EmptyZt","");
  448. }
  449. CheckLevel($userid,$username,$classid,"zt");
  450. $add=DoPostZtVar($add);
  451. $createpath='../../'.$add[ztpath];
  452. //检测目录是否存在
  453. if(file_exists($createpath)){
  454. printerror("ReZtpath","");
  455. }
  456. CreateZtPath($add[ztpath]);//建立专题目录
  457. $addtime=time();
  458. //取得表名
  459. $tabler=GetModTable(GetListtempMid($add[listtempid]));
  460. $tabler[tid]=(int)$tabler[tid];
  461. $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]');");
  462. $ztid=$empire->lastid();
  463. //副表
  464. $ret_zr=ReturnZtAddF($add,0);
  465. $empire->query("replace into {$dbtbpre}enewsztadd(ztid,classtext".$ret_zr[0].") values('$ztid','".eaddslashes2($add[classtext])."'".$ret_zr[1].");");
  466. //更新附件
  467. UpdateTheFileOther(2,$ztid,$add['filepass'],'other');
  468. //生成页面
  469. if($add[islist]==0||$add[islist]==2)
  470. {
  471. $classtemp=$add[islist]==2?GetZtText($ztid):GetClassTemp($add['classtempid']);
  472. NewsBq($ztid,$classtemp,3,1);
  473. }
  474. GetClass();//更新缓存
  475. if($sql){
  476. insert_dolog("ztid=".$ztid."<br>ztname=".$add[ztname]);//操作日志
  477. printerror("AddZtSuccess","special/AddZt.php?enews=AddZt".hReturnEcmsHashStrHref2(0));
  478. }
  479. else{
  480. printerror("DbError","");
  481. }
  482. }
  483. //修改专题
  484. function EditZt($add,$userid,$username){
  485. global $empire,$class_r,$dbtbpre,$loginlevel;
  486. $add[ztid]=(int)$add[ztid];
  487. $add[ztpath]=trim($add[ztpath]);
  488. if(!$add[ztname]||!$add[listtempid]||!$add[ztpath]||!$add[ztid]){
  489. printerror("EmptyZt","");
  490. }
  491. $add=DoPostZtVar($add);
  492. //CheckLevel($userid,$username,$classid,"zt");
  493. $returnandlevel=CheckAndUsernamesLevel('dozt',$add[ztid],$userid,$username,$loginlevel);
  494. $upusernames='';
  495. if($returnandlevel==2)
  496. {
  497. $upusernames=",usernames='$add[usernames]'";
  498. }
  499. //改变目录
  500. if($add[oldztpath]<>$add[ztpath]){
  501. $createpath='../../'.$add[ztpath];
  502. if(file_exists($createpath)){
  503. printerror("ReZtpath","");
  504. }
  505. if($add['oldpripath']==$add['pripath']){
  506. $new="../../";
  507. @rename($new.$add[oldztpath],$new.$add[ztpath]);//改变目录名
  508. }
  509. else{
  510. CreateZtPath($add[ztpath]);//建立专题目录
  511. }
  512. }
  513. //取得表名
  514. $tabler=GetModTable(GetListtempMid($add[listtempid]));
  515. $tabler[tid]=(int)$tabler[tid];
  516. $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]'");
  517. //副表
  518. $ret_zr=ReturnZtAddF($add,1);
  519. $empire->query("update {$dbtbpre}enewsztadd set classtext='".eaddslashes2($add[classtext])."'".$ret_zr[0]." where ztid='$add[ztid]'");
  520. //更新专题子类
  521. if($add['endtime']!=$add['oldendtime'])
  522. {
  523. $empire->query("update {$dbtbpre}enewszttype set endtime='$add[endtime]' where ztid='$add[ztid]'");
  524. }
  525. //更新附件
  526. UpdateTheFileEditOther(2,$add['ztid'],'other');
  527. GetClass();//更新缓存
  528. //生成页面
  529. if($add[islist]==0||$add[islist]==2)
  530. {
  531. $classtemp=$add[islist]==2?GetZtText($add[ztid]):GetClassTemp($add['classtempid']);
  532. NewsBq($add[ztid],$classtemp,3,1);
  533. }
  534. if($sql)
  535. {
  536. $returnurl='special/ListZt.php'.hReturnEcmsHashStrHref2(1);
  537. if($add['from'])
  538. {
  539. $returnurl='special/AddZt.php?enews=EditZt&ztid='.$add[ztid].'&from=1'.hReturnEcmsHashStrHref2(0);
  540. }
  541. insert_dolog("ztid=".$add[ztid]."<br>ztname=".$add[ztname]);//操作日志
  542. printerror("EditZtSuccess",$returnurl);
  543. }
  544. else
  545. {
  546. printerror("DbError","");
  547. }
  548. }
  549. //删除专题
  550. function DelZt($ztid,$userid,$username){
  551. global $empire,$dbtbpre;
  552. $ztid=(int)$ztid;
  553. if(!$ztid){
  554. printerror("NotDelZtid","");
  555. }
  556. CheckLevel($userid,$username,$classid,"zt");
  557. $r=$empire->fetch1("select * from {$dbtbpre}enewszt where ztid='$ztid'");
  558. if(empty($r[ztid])){
  559. printerror("NotDelZtid","history.go(-1)");
  560. }
  561. //删除专题
  562. $sql=$empire->query("delete from {$dbtbpre}enewszt where ztid='$ztid'");
  563. $empire->query("delete from {$dbtbpre}enewsztadd where ztid='$ztid'");
  564. $delpath="../../".$r[ztpath];
  565. $del=DelPath($delpath);
  566. //删除专题子类
  567. $zttypesql=$empire->query("select cid from {$dbtbpre}enewszttype where ztid='$ztid'");
  568. while($zttyper=$empire->fetch($zttypesql))
  569. {
  570. $empire->query("delete from {$dbtbpre}enewszttypeadd where cid='$zttyper[cid]'");
  571. }
  572. $empire->query("delete from {$dbtbpre}enewszttype where ztid='$ztid'");
  573. $empire->query("delete from {$dbtbpre}enewsztinfo where ztid='$ztid'");
  574. //删除附件
  575. DelFileOtherTable("id='$ztid' and modtype=2");
  576. GetClass();//更新缓存
  577. //moreportdo
  578. if($r['ztpath'])
  579. {
  580. $eautodofname='delpath|'.$r['ztpath'].'||';
  581. eAutodo_AddDo('eDelFileZT',0,0,0,0,0,$eautodofname);
  582. }
  583. if($sql){
  584. insert_dolog("ztid=".$ztid."<br>ztname=".$r[ztname]);//操作日志
  585. printerror("DelZtSuccess","special/ListZt.php".hReturnEcmsHashStrHref2(1));
  586. }
  587. else{
  588. printerror("DbError","");
  589. }
  590. }
  591. //组合专题
  592. function TogZt($add,$userid,$username){
  593. global $empire,$class_r,$dbtbpre;
  594. $ztid=(int)$add['ztid'];
  595. if(empty($ztid))
  596. {
  597. printerror("ErrorUrl","history.go(-1)");
  598. }
  599. $r=$empire->fetch1("select ztid,ztname from {$dbtbpre}enewszt where ztid='$ztid'");
  600. if(empty($r['ztid']))
  601. {
  602. printerror("ErrorUrl","history.go(-1)");
  603. }
  604. $zcid=(int)$add['zcid'];
  605. $tbname=RepPostVar($add['tbname']);
  606. if(!$tbname)
  607. {
  608. printerror('EmptyTogZt','history.go(-1)');
  609. }
  610. $tbr=$empire->fetch1("select tid from {$dbtbpre}enewstable where tbname='$tbname' limit 1");
  611. if(!$tbr['tid'])
  612. {
  613. printerror('EmptyTogZt','history.go(-1)');
  614. }
  615. $wheresql="";
  616. $formvar="";
  617. //关键字
  618. $keyboard=RepPostVar2($add['keyboard']);
  619. if($keyboard)
  620. {
  621. $formvar.=ReturnFormHidden('keyboard',$add['keyboard']);
  622. $searchfsql='';
  623. if($add['stitle'])//标题
  624. {
  625. $searchfsql.="title like '%$keyboard%'";
  626. $formvar.=ReturnFormHidden('stitle',$add['stitle']);
  627. }
  628. if($add['susername'])//增加者
  629. {
  630. if($searchfsql)
  631. {
  632. $or=" or ";
  633. }
  634. $searchfsql.=$or."username like '%$keyboard%'";
  635. $formvar.=ReturnFormHidden('susername',$add['susername']);
  636. }
  637. if($searchfsql)
  638. {
  639. $wheresql=" and (".$searchfsql.")";
  640. }
  641. }
  642. //是否推荐
  643. if($add['isgood'])
  644. {
  645. $wheresql.=" and isgood>0";
  646. $formvar.=ReturnFormHidden('isgood',$add['isgood']);
  647. }
  648. //头条
  649. if($add['firsttitle'])
  650. {
  651. $wheresql.=" and firsttitle>0";
  652. $formvar.=ReturnFormHidden('firsttitle',$add['firsttitle']);
  653. }
  654. //有标题图片
  655. if($add['titlepic'])
  656. {
  657. $wheresql.=" and ispic=1";
  658. $formvar.=ReturnFormHidden('titlepic',$add['titlepic']);
  659. }
  660. //按栏目刷新
  661. $classid=(int)$add['classid'];
  662. if($classid)
  663. {
  664. $formvar.=ReturnFormHidden('classid',$classid);
  665. if(empty($class_r[$classid][islast]))//大栏目
  666. {
  667. $where=ReturnClass($class_r[$classid][sonclass]);
  668. }
  669. else//终极栏目
  670. {
  671. $where="classid='$classid'";
  672. }
  673. $wheresql.=" and (".$where.")";
  674. }
  675. $startid=(int)$add[startid];
  676. $endid=(int)$add[endid];
  677. $startday=RepPostVar($add[startday]);
  678. $endday=RepPostVar($add[endday]);
  679. $formvar.=ReturnFormHidden('retype',$add['retype']);
  680. //按ID
  681. if($add['retype'])
  682. {
  683. if($endid)
  684. {
  685. $wheresql.=" and id>=$startid and id<=$endid";
  686. $formvar.=ReturnFormHidden('startid',$add[startid]).ReturnFormHidden('endid',$add[endid]);
  687. }
  688. }
  689. else
  690. {
  691. if($startday&&$endday)
  692. {
  693. $wheresql.=" and truetime>=".to_time($startday." 00:00:00")." and truetime<=".to_time($endday." 23:59:59");
  694. $formvar.=ReturnFormHidden('startday',$add[startday]).ReturnFormHidden('endday',$add[endday]);
  695. }
  696. }
  697. //附件sql条件
  698. $query=$add['query'];
  699. if($query)
  700. {
  701. $query=ClearAddsData($query);//去除adds
  702. $wheresql.=" and (".$query.")";
  703. $formvar.=ReturnFormHidden('query',$add['query']);
  704. }
  705. if(empty($wheresql))
  706. {
  707. printerror('EmptyTogZt','history.go(-1)');
  708. }
  709. $wheresql=substr($wheresql,5);
  710. if($add['doecmszt'])
  711. {
  712. $togtype=(int)$add['togtype'];
  713. if($togtype==1)//组合选中
  714. {
  715. $add['inid']=eReturnInids($add['inid']);
  716. $wheresql="id in (".$add['inid'].")";
  717. }
  718. else//排除选中
  719. {
  720. if($add['inid'])
  721. {
  722. $add['inid']=eReturnInids($add['inid']);
  723. $wheresql.=" and id not in (".$add['inid'].")";
  724. }
  725. }
  726. AddMoreInfoToZt($ztid,$zcid,$tbname,$wheresql);
  727. //操作日志
  728. insert_dolog("ztid=$ztid&ztname=$r[ztname]");
  729. printerror("TogZtSuccess","TogZt.php?ztid=$ztid".hReturnEcmsHashStrHref2(0));
  730. }
  731. $re[0]=$wheresql;
  732. $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]);
  733. $re[2]=$tbname;
  734. $re[3]=$r['ztname'];
  735. return $re;
  736. }
  737. //保存专题信息
  738. function SaveTogZtInfo($add,$userid,$username){
  739. global $empire,$dbtbpre;
  740. if(!trim($add[togztname]))
  741. {
  742. printerror('EmptySaveTogZtname','history.go(-1)');
  743. }
  744. $add['doecmszt']=(int)$add['doecmszt'];
  745. $add[classid]=(int)$add[classid];
  746. //搜索字段
  747. $searchf=',';
  748. if($add[stitle]==1)
  749. {
  750. $searchf.='stitle,';
  751. }
  752. if($add[susername]==1)
  753. {
  754. $searchf.='susername,';
  755. }
  756. if($add[snewstext]==1)
  757. {
  758. $searchf.='snewstext,';
  759. }
  760. //特殊字段
  761. $specialsearch=',';
  762. if($add[isgood])
  763. {
  764. $specialsearch.='isgood,';
  765. }
  766. if($add[firsttitle])
  767. {
  768. $specialsearch.='firsttitle,';
  769. }
  770. if($add[titlepic])
  771. {
  772. $specialsearch.='titlepic,';
  773. }
  774. $add['retype']=(int)$add['retype'];
  775. $add['startid']=(int)$add['startid'];
  776. $add['endid']=(int)$add['endid'];
  777. $add['pline']=(int)$add['pline'];
  778. $r=$empire->fetch1("select togid from {$dbtbpre}enewstogzts where togztname='$add[togztname]'");
  779. if($r[togid])
  780. {
  781. $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]'");
  782. $togid=$r[togid];
  783. }
  784. else
  785. {
  786. $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])."');");
  787. $togid=$empire->lastid();
  788. }
  789. if($sql)
  790. {
  791. insert_dolog("togid=$togid&togztname=$add[togztname]");//操作日志
  792. printerror("SaveTogZtInfoSuccess","TogZt.php?ztid=$add[ztid]&togid=$togid".hReturnEcmsHashStrHref2(0));
  793. }
  794. else
  795. {
  796. printerror("DbError","history.go(-1)");
  797. }
  798. }
  799. //删除保存专题信息
  800. function DelTogZtInfo($add,$userid,$username){
  801. global $empire,$dbtbpre;
  802. $togid=intval($add[togid]);
  803. if(!$togid)
  804. {
  805. printerror('EmptyDelTogztid','history.go(-1)');
  806. }
  807. $r=$empire->fetch1("select togid,togztname from {$dbtbpre}enewstogzts where togid='$togid'");
  808. if(!$r[togid])
  809. {
  810. printerror('EmptyDelTogztid','history.go(-1)');
  811. }
  812. $sql=$empire->query("delete from {$dbtbpre}enewstogzts where togid='$togid'");
  813. if($sql)
  814. {
  815. insert_dolog("togid=$togid&togztname=$r[togztname]");//操作日志
  816. printerror('DelTogZtInfoSuccess',EcmsGetReturnUrl());
  817. }
  818. else
  819. {
  820. printerror("DbError","history.go(-1)");
  821. }
  822. }
  823. //************************************ 栏目 ************************************
  824. //返回字段值
  825. function ReturnCFvalue($value)
  826. {
  827. $value=str_replace("\r\n","|",$value);
  828. return $value;
  829. }
  830. //取得栏目表单元素html代码
  831. function GetClassFform($type,$f,$fvalue,$fformsize=''){
  832. if($type=="select"||$type=="radio"||$type=="checkbox")
  833. {
  834. return GetCFformSelect($type,$f,$fvalue,$fformsize);
  835. }
  836. $file="../data/html/classfhtml.txt";
  837. $data=ReadFiletext($file);
  838. $exp="[!--".$type."--]";
  839. $r=explode($exp,$data);
  840. $string=str_replace("[!--enews.var--]",$f,$r[1]);
  841. $string=str_replace("[!--enews.def.val--]",$fvalue,$string);
  842. if($type=='editor')//编辑器
  843. {
  844. $editortype='Default';
  845. $string=str_replace("[!--editor.type--]",$editortype,$string);
  846. $string=str_replace("[!--editor.basepath--]",'',$string);
  847. }
  848. elseif($type=='img'||$type=='flash'||$type=='file')//附件
  849. {
  850. $string=str_replace("[!--enews.modtype--]",'1',$string);
  851. $string=str_replace("[!--enews.path--]",'',$string);
  852. }
  853. $string=RepCFformSize($f,$string,$type,$fformsize);
  854. return fAddAddsData($string);
  855. }
  856. //取得select/radio元素代码
  857. function GetCFformSelect($type,$f,$fvalue,$fformsize=''){
  858. $vr=explode("|",$fvalue);
  859. $count=count($vr);
  860. $change="";
  861. $def=':default';
  862. for($i=0;$i<$count;$i++)
  863. {
  864. $val=$vr[$i];
  865. $isdef="";
  866. if(strstr($val,$def))
  867. {
  868. $dr=explode($def,$val);
  869. $val=$dr[0];
  870. $isdef="||\$ecmsfirstpost==1";
  871. }
  872. if($type=='select')
  873. {
  874. $change.="<option value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' selected':''?>>".$val."</option>";
  875. }
  876. elseif($type=='checkbox')
  877. {
  878. $change.="<input name=\"".$f."[]\" type=\"checkbox\" value=\"".$val."\"<?=strstr(\$r[".$f."],\"|".$val."|\")".$isdef."?' checked':''?>>".$val;
  879. }
  880. else
  881. {
  882. $change.="<input name=\"".$f."\" type=\"radio\" value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' checked':''?>>".$val;
  883. }
  884. }
  885. if($type=="select")
  886. {
  887. if($fformsize)
  888. {
  889. $addsize=' style="width:'.$fformsize.'"';
  890. }
  891. $change="<select name=\"".$f."\" id=\"".$f."\"".$addsize.">".$change."</select>";
  892. }
  893. return $change;
  894. }
  895. //替换表单元素长度
  896. function RepCFformSize($f,$string,$type,$fformsize=''){
  897. $fformsize=ReturnDefCFformSize($f,$type,$fformsize);
  898. if($type=='textarea'||$type=='editor')
  899. {
  900. $r=explode(',',$fformsize);
  901. $string=str_replace('[!--fsize.w--]',$r[0],$string);
  902. $string=str_replace('[!--fsize.h--]',$r[1],$string);
  903. }
  904. else
  905. {
  906. $string=str_replace('[!--fsize.w--]',$fformsize,$string);
  907. }
  908. return $string;
  909. }
  910. //返回默认长度
  911. function ReturnDefCFformSize($f,$type,$fformsize){
  912. if(empty($fformsize))
  913. {
  914. if($type=='textarea')
  915. {
  916. $fformsize='60,10';
  917. }
  918. elseif($type=='img')
  919. {
  920. $fformsize='45';
  921. }
  922. elseif($type=='file')
  923. {
  924. $fformsize='45';
  925. }
  926. elseif($type=='flash')
  927. {
  928. $fformsize='45';
  929. }
  930. elseif($type=='date')
  931. {
  932. $fformsize='12';
  933. }
  934. elseif($type=='color')
  935. {
  936. $fformsize='10';
  937. }
  938. elseif($type=='linkfield')
  939. {
  940. $fformsize='45';
  941. }
  942. elseif($type=='downpath')
  943. {
  944. $fformsize='45';
  945. }
  946. elseif($type=='onlinepath')
  947. {
  948. $fformsize='45';
  949. }
  950. elseif($type=='editor')
  951. {
  952. $fformsize='100%,300';
  953. }
  954. }
  955. return $fformsize;
  956. }
  957. //更新栏目表单文件
  958. function ChangeClassForm(){
  959. global $empire,$dbtbpre;
  960. $file='../data/html/classaddform.php';
  961. $mtemp='';
  962. $sql=$empire->query("select fname,f,fhtml from {$dbtbpre}enewsclassf order by myorder,fid");
  963. while($r=$empire->fetch($sql))
  964. {
  965. $mtemp.="<tr bgcolor='#FFFFFF' height=25><td>".$r['fname']."</td><td>".$r['fhtml']."</td></tr>";
  966. }
  967. $mtemp="<?php
  968. if(!defined('InEmpireCMS'))
  969. {exit();}
  970. ?>".$mtemp;
  971. WriteFiletext($file,$mtemp);
  972. }
  973. //增加栏目字段
  974. function AddClassF($add,$userid,$username){
  975. global $empire,$dbtbpre;
  976. //验证权限
  977. CheckLevel($userid,$username,$classid,"classf");
  978. $add[f]=RepPostVar($add[f]);
  979. if(empty($add[f])||empty($add[fname]))
  980. {
  981. printerror("EmptyF","");
  982. }
  983. //字段是否重复
  984. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsclassadd");
  985. $b=0;
  986. while($r=$empire->fetch($s))
  987. {
  988. if($r[Field]==$add[f])
  989. {
  990. $b=1;
  991. break;
  992. }
  993. }
  994. if($b)
  995. {
  996. printerror("ReF","");
  997. }
  998. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsclass");
  999. $b=0;
  1000. while($r=$empire->fetch($s))
  1001. {
  1002. if($r[Field]==$add[f])
  1003. {
  1004. $b=1;
  1005. break;
  1006. }
  1007. }
  1008. if($b)
  1009. {
  1010. printerror("ReF","");
  1011. }
  1012. $add[fvalue]=ReturnCFvalue($add[fvalue]);//初始化值
  1013. //字段类型
  1014. if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
  1015. {
  1016. $def=" default '0'";
  1017. }
  1018. elseif($add[ftype]=="VARCHAR")
  1019. {
  1020. $def=" default ''";
  1021. }
  1022. else
  1023. {
  1024. $def="";
  1025. }
  1026. $type=$add[ftype];
  1027. //VARCHAR
  1028. if($add[ftype]=='VARCHAR'&&empty($add[flen]))
  1029. {
  1030. $add[flen]='255';
  1031. }
  1032. //字段长度
  1033. if($add[flen]){
  1034. if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
  1035. $type.="(".$add[flen].")";
  1036. }
  1037. }
  1038. $field="`".$add[f]."` ".$type." NOT NULL".$def;
  1039. //新增字段
  1040. $asql=$empire->query("alter table {$dbtbpre}enewsclassadd add ".$field);
  1041. //替换代码
  1042. $fhtml=GetClassFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
  1043. if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
  1044. {
  1045. $fhtml=str_replace("\$r[","\$addr[",$fhtml);
  1046. }
  1047. //处理变量
  1048. $add[myorder]=(int)$add[myorder];
  1049. $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]');");
  1050. $lastid=$empire->lastid();
  1051. //更新表单
  1052. ChangeClassForm();
  1053. if($asql&&$sql)
  1054. {
  1055. //操作日志
  1056. insert_dolog("fid=".$lastid."<br>f=".$add[f]);
  1057. printerror("AddFSuccess","info/AddClassF.php?enews=AddClassF".hReturnEcmsHashStrHref2(0));
  1058. }
  1059. else
  1060. {
  1061. printerror("DbError","history.go(-1)");
  1062. }
  1063. }
  1064. //修改栏目字段
  1065. function EditClassF($add,$userid,$username){
  1066. global $empire,$dbtbpre;
  1067. //验证权限
  1068. CheckLevel($userid,$username,$classid,"classf");
  1069. $fid=(int)$add['fid'];
  1070. $add[f]=RepPostVar($add[f]);
  1071. $add[oldf]=RepPostVar($add[oldf]);
  1072. if(empty($add[f])||empty($add[fname])||!$fid){
  1073. printerror("EmptyF","history.go(-1)");
  1074. }
  1075. if($add[f]<>$add[oldf]){
  1076. //字段是否重复
  1077. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsclassadd");
  1078. $b=0;
  1079. while($r=$empire->fetch($s)){
  1080. if($r[Field]==$add[f]){
  1081. $b=1;
  1082. break;
  1083. }
  1084. }
  1085. if($b){
  1086. printerror("ReF","history.go(-1)");
  1087. }
  1088. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsclass");
  1089. $b=0;
  1090. while($r=$empire->fetch($s))
  1091. {
  1092. if($r[Field]==$add[f])
  1093. {
  1094. $b=1;
  1095. break;
  1096. }
  1097. }
  1098. if($b)
  1099. {
  1100. printerror("ReF","");
  1101. }
  1102. }
  1103. $add[fvalue]=ReturnCFvalue($add[fvalue]);//初始化值
  1104. //字段类型
  1105. if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
  1106. {
  1107. $def=" default '0'";
  1108. }
  1109. elseif($add[ftype]=="VARCHAR")
  1110. {
  1111. $def=" default ''";
  1112. }
  1113. else
  1114. {
  1115. $def="";
  1116. }
  1117. $type=$add[ftype];
  1118. //VARCHAR
  1119. if($add[ftype]=='VARCHAR'&&empty($add[flen]))
  1120. {
  1121. $add[flen]='255';
  1122. }
  1123. //字段长度
  1124. if($add[flen]){
  1125. if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
  1126. $type.="(".$add[flen].")";
  1127. }
  1128. }
  1129. $field="`".$add[f]."` ".$type." NOT NULL".$def;
  1130. $usql=$empire->query("alter table {$dbtbpre}enewsclassadd change `".$add[oldf]."` ".$field);
  1131. //替换代码
  1132. if($add[f]<>$add[oldf]||$add[fform]<>$add[oldfform]||$add[fvalue]<>$add[oldfvalue]||$add[fformsize]<>$add[oldfformsize]){
  1133. $fhtml=GetClassFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
  1134. if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
  1135. {
  1136. $fhtml=str_replace("\$r[","\$addr[",$fhtml);
  1137. }
  1138. }
  1139. else{
  1140. $fhtml=$add[fhtml];
  1141. }
  1142. //处理变量
  1143. $add[myorder]=(int)$add[myorder];
  1144. $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");
  1145. //更新表单
  1146. ChangeClassForm();
  1147. if($usql&&$sql)
  1148. {
  1149. insert_dolog("fid=".$fid."<br>f=".$add[f]);//操作日志
  1150. printerror("EditFSuccess","info/ListClassF.php".hReturnEcmsHashStrHref2(1));
  1151. }
  1152. else
  1153. {printerror("DbError","history.go(-1)");}
  1154. }
  1155. //删除栏目字段
  1156. function DelClassF($add,$userid,$username){
  1157. global $empire,$dbtbpre;
  1158. //验证权限
  1159. CheckLevel($userid,$username,$classid,"classf");
  1160. $fid=(int)$add['fid'];
  1161. if(empty($fid)){
  1162. printerror("EmptyFid","history.go(-1)");
  1163. }
  1164. $r=$empire->fetch1("select f from {$dbtbpre}enewsclassf where fid='$fid'");
  1165. if(!$r[f]){
  1166. printerror("EmptyFid","history.go(-1)");
  1167. }
  1168. $usql=$empire->query("alter table {$dbtbpre}enewsclassadd drop COLUMN `".$r[f]."`");
  1169. $sql=$empire->query("delete from {$dbtbpre}enewsclassf where fid='$fid'");
  1170. //更新表单表
  1171. ChangeClassForm();
  1172. if($usql&&$sql)
  1173. {
  1174. insert_dolog("fid=".$fid."<br>f=".$r[f]);//操作日志
  1175. printerror("DelFSuccess","info/ListClassF.php".hReturnEcmsHashStrHref2(1));
  1176. }
  1177. else
  1178. {printerror("DbError","history.go(-1)");}
  1179. }
  1180. //修改栏目字段顺序
  1181. function EditClassFOrder($fid,$myorder,$userid,$username){
  1182. global $empire,$dbtbpre;
  1183. //验证权限
  1184. CheckLevel($userid,$username,$classid,"classf");
  1185. for($i=0;$i<count($myorder);$i++)
  1186. {
  1187. $fid[$i]=(int)$fid[$i];
  1188. $newmyorder=(int)$myorder[$i];
  1189. $usql=$empire->query("update {$dbtbpre}enewsclassf set myorder=$newmyorder where fid='$fid[$i]'");
  1190. }
  1191. //更新表单表
  1192. ChangeClassForm();
  1193. printerror("EditFOrderSuccess","info/ListClassF.php".hReturnEcmsHashStrHref2(1));
  1194. }
  1195. //返回栏目字段
  1196. function ReturnClassAddF($add,$ecms=0){
  1197. global $empire,$dbtbpre;
  1198. $ret_r[0]='';
  1199. $ret_r[1]='';
  1200. $fsql=$empire->query("select f from {$dbtbpre}enewsclassf");
  1201. if($ecms==0)//增加
  1202. {
  1203. while($fr=$empire->fetch($fsql))
  1204. {
  1205. $f=$fr['f'];
  1206. $fval=$add[$f];
  1207. $fval=RepPhpAspJspcode($fval);
  1208. $ret_r[0].=",`".$f."`";
  1209. $ret_r[1].=",'".AddAddsData($fval)."'";
  1210. }
  1211. }
  1212. else//修改
  1213. {
  1214. while($fr=$empire->fetch($fsql))
  1215. {
  1216. $f=$fr['f'];
  1217. $fval=$add[$f];
  1218. $fval=RepPhpAspJspcode($fval);
  1219. $ret_r[0].=",`".$f."`='".AddAddsData($fval)."'";
  1220. }
  1221. }
  1222. return $ret_r;
  1223. }
  1224. //组合不生成的栏目信息
  1225. function TogNotReClass($changecache=0){
  1226. global $empire,$dbtbpre;
  1227. $sql=$empire->query("select classid,nreclass,nreinfo,nrejs,nottobq from {$dbtbpre}enewsclass where nreclass=1 or nreinfo=1 or nrejs=1 or nottobq=1");
  1228. $nreclass=',';
  1229. $nreinfo=',';
  1230. $nrejs=',';
  1231. $nottobq=',';
  1232. while($r=$empire->fetch($sql))
  1233. {
  1234. if($r['nreclass']==1)
  1235. {
  1236. $nreclass.=$r['classid'].',';
  1237. }
  1238. if($r['nreinfo']==1)
  1239. {
  1240. $nreinfo.=$r['classid'].',';
  1241. }
  1242. if($r['nrejs']==1)
  1243. {
  1244. $nrejs.=$r['classid'].',';
  1245. }
  1246. if($r['nottobq']==1)
  1247. {
  1248. $nottobq.=$r['classid'].',';
  1249. }
  1250. }
  1251. $empire->query("update {$dbtbpre}enewspublic set nreclass='$nreclass',nreinfo='$nreinfo',nrejs='$nrejs',nottobq='$nottobq' limit 1");
  1252. if($changecache==1)
  1253. {
  1254. GetConfig();
  1255. }
  1256. }
  1257. //返回投稿权限
  1258. function DoPostClassQAddGroupid($groupid){
  1259. $count=count($groupid);
  1260. if(!$count)
  1261. {
  1262. return '';
  1263. }
  1264. $qg=',';
  1265. for($i=0;$i<$count;$i++)
  1266. {
  1267. $groupid[$i]=(int)$groupid[$i];
  1268. $qg.=$groupid[$i].',';
  1269. }
  1270. return $qg;
  1271. }
  1272. //处理栏目提交变量
  1273. function DoPostClassVar($add){
  1274. if(empty($add[classtype])){
  1275. $add[classtype]=".html";
  1276. }
  1277. $add[classname]=eaddslashes(ehtmlspecialchars($add[classname]));
  1278. $add[intro]=eaddslashes(RepPhpAspJspcode($add[intro]));
  1279. $add[classpagekey]=eaddslashes(RepPhpAspJspcode($add[classpagekey]));
  1280. //过滤字符
  1281. $add[listorder]=RepPostVar2($add[listorder]);
  1282. $add[reorder]=RepPostVar2($add[reorder]);
  1283. //处理变量
  1284. $add[jstempid]=(int)$add['jstempid'];
  1285. $add[bclassid]=(int)$add[bclassid];
  1286. $add[link_num]=(int)$add[link_num];
  1287. $add[newstempid]=(int)$add[newstempid];
  1288. $add[islast]=(int)$add[islast];
  1289. $add[filename]=(int)$add[filename];
  1290. $add[openpl]=(int)$add[openpl];
  1291. $add[openadd]=(int)$add[openadd];
  1292. $add[newline]=(int)$add[newline];
  1293. $add[hotline]=(int)$add[hotline];
  1294. $add[goodline]=(int)$add[goodline];
  1295. $add[groupid]=(int)$add[groupid];
  1296. $add[hotplline]=(int)$add[hotplline];
  1297. $add[modid]=(int)$add[modid];
  1298. $add[checked]=(int)$add[checked];
  1299. $add[firstline]=(int)$add[firstline];
  1300. $add[islist]=(int)$add[islist];
  1301. $add[searchtempid]=(int)$add[searchtempid];
  1302. $add[checkpl]=(int)$add[checkpl];
  1303. $add[down_num]=(int)$add[down_num];
  1304. if(empty($add[down_num])){
  1305. $add[down_num]=1;
  1306. }
  1307. $add[online_num]=(int)$add[online_num];
  1308. if(empty($add[online_num])){
  1309. $add[online_num]=1;
  1310. }
  1311. $add[addinfofen]=(int)$add[addinfofen];
  1312. $add[listdt]=(int)$add[listdt];
  1313. $add[showdt]=(int)$add[showdt];
  1314. $add[maxnum]=(int)$add[maxnum];
  1315. $add[showclass]=(int)$add[showclass];
  1316. $add[checkqadd]=(int)$add[checkqadd];
  1317. $add[qaddlist]=(int)$add[qaddlist];
  1318. $add[qaddgroupid]=DoPostClassQAddGroupid($add[qaddgroupidck]);
  1319. if(!$add[qaddgroupid])
  1320. {
  1321. $add[addinfofen]=0;
  1322. $add['oneinfo']=0;
  1323. }
  1324. $add[qaddshowkey]=(int)$add[qaddshowkey];
  1325. $add[adminqinfo]=(int)$add[adminqinfo];
  1326. $add[doctime]=(int)$add[doctime];
  1327. $add[nreclass]=(int)$add[nreclass];
  1328. $add[nreinfo]=(int)$add[nreinfo];
  1329. $add[nrejs]=(int)$add[nrejs];
  1330. $add[nottobq]=(int)$add[nottobq];
  1331. $add[lencord]=(int)$add[lencord];
  1332. $add[listtempid]=(int)$add[listtempid];
  1333. $add[dtlisttempid]=(int)$add[dtlisttempid];
  1334. $add[classtempid]=(int)$add[classtempid];
  1335. if(empty($add[bname])){
  1336. $add[bname]=$add[classname];
  1337. }
  1338. $add[myorder]=(int)$add[myorder];
  1339. if($add[infopath]==0)
  1340. {
  1341. $add[ipath]='';
  1342. }
  1343. $add[addreinfo]=(int)$add[addreinfo];
  1344. $add[haddlist]=(int)$add[haddlist];
  1345. $add[sametitle]=(int)$add[sametitle];
  1346. $add[definfovoteid]=(int)$add[definfovoteid];
  1347. $add[qeditchecked]=(int)$add[qeditchecked];
  1348. $add[wapstyleid]=(int)$add[wapstyleid];
  1349. $add[repreinfo]=(int)$add[repreinfo];
  1350. $add[pltempid]=(int)$add[pltempid];
  1351. $add[classtext]=RepPhpAspJspcode($add[classtext]);
  1352. $add[yhid]=(int)$add[yhid];
  1353. $add[wfid]=(int)$add[wfid];
  1354. $add['repagenum']=(int)$add['repagenum'];
  1355. $add['keycid']=(int)$add['keycid'];
  1356. $add['oneinfo']=(int)$add['oneinfo'];
  1357. $add['wapislist']=(int)$add['wapislist'];
  1358. $add['filepass']=(int)$add['filepass'];
  1359. $add[pripath]=eaddslashes($add[pripath]);
  1360. $add[classpath]=eaddslashes($add[classpath]);
  1361. $add['eclasspagetext']=AddAddsData(RepPhpAspJspcode($add['eclasspagetext']));
  1362. $add['addsql']=eaddslashes($add['addsql']);
  1363. if($add['islist']==3)
  1364. {
  1365. $add['bdinfoid']=RepPostVar($add['bdinfoid']);
  1366. }
  1367. else
  1368. {
  1369. $add['bdinfoid']='';
  1370. }
  1371. if($add[islast]&&$add['smallbdinfoid'])
  1372. {
  1373. $add['smallbdinfoid']=RepPostVar($add['smallbdinfoid']);
  1374. }
  1375. else
  1376. {
  1377. $add['smallbdinfoid']='';
  1378. }
  1379. //设置访问权限
  1380. $add[cgroupid]=DoPostClassQAddGroupid($add[cgroupidck]);
  1381. $add[cgtoinfo]=(int)$add[cgtoinfo];
  1382. if($add[cgroupid])
  1383. {
  1384. $add[classtype]='.php';
  1385. if($add[cgtoinfo])
  1386. {
  1387. $add[filetype]='.php';
  1388. }
  1389. }
  1390. else
  1391. {
  1392. $add[cgtoinfo]=0;
  1393. }
  1394. return $add;
  1395. }
  1396. //增加外部栏目
  1397. function AddWbClass($add,$userid,$username){
  1398. global $empire,$dbtbpre;
  1399. //操作权限
  1400. CheckLevel($userid,$username,$classid,"class");
  1401. $add=DoPostClassVar($add);
  1402. if(!$add[classname]||!$add[wburl])
  1403. {
  1404. printerror("EmptyWbClass","");
  1405. }
  1406. $add[islast]=0;
  1407. $addtime=time();
  1408. $ecms_fclast=time();
  1409. //取得表名
  1410. $tabler=GetModTable($add[modid]);
  1411. $tabler[tid]=(int)$tabler[tid];
  1412. if(empty($add[bclassid]))//主栏目
  1413. {
  1414. $sonclass="";
  1415. $featherclass="";
  1416. }
  1417. else//中级栏目
  1418. {
  1419. //取得上一级父栏目
  1420. $r=$empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
  1421. if($r[islast])//是否终极栏目
  1422. {
  1423. printerror("BclassNotLast","");
  1424. }
  1425. if($r[wburl])
  1426. {
  1427. printerror("BclassNotWb","");
  1428. }
  1429. if(empty($r[featherclass]))
  1430. {
  1431. $r[featherclass]="|";
  1432. }
  1433. $featherclass=$r[featherclass].$add[bclassid]."|";
  1434. $sonclass="";
  1435. }
  1436. $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');");
  1437. $lastid=$empire->lastid();
  1438. //副表
  1439. $ret_cr=ReturnClassAddF($add,0);
  1440. $empire->query("replace into {$dbtbpre}enewsclassadd(classid,classtext,eclasspagetext".$ret_cr[0].") values('$lastid','".eaddslashes2($add[classtext])."','$add[eclasspagetext]'".$ret_cr[1].");");
  1441. //统计表
  1442. $empire->query("replace into {$dbtbpre}enewsclass_stats(classid) values('$lastid');");
  1443. //更新附件
  1444. UpdateTheFileOther(1,$lastid,$add['filepass'],'other');
  1445. GetClass();
  1446. //DelListEnews();//删除缓存文件
  1447. if($sql)
  1448. {
  1449. //删除导航缓存
  1450. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass'");
  1451. $cache_enews='doclass';
  1452. $cache_ecmstourl=urlencode("AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
  1453. $cache_mess='AddClassSuccess';
  1454. $cache_url="CreateCache.php?enews=$cache_enews&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  1455. insert_dolog("classid=".$lastid."<br>classname=".$add[classname]);//操作日志
  1456. //printerror("AddClassSuccess","AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
  1457. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  1458. db_close();
  1459. $empire=null;
  1460. exit();
  1461. }
  1462. else
  1463. {
  1464. printerror("DbError","");
  1465. }
  1466. }
  1467. //增加栏目
  1468. function AddClass($add,$userid,$username){
  1469. global $empire,$dbtbpre;
  1470. //增加外部栏目
  1471. if($add[ecmsclasstype])
  1472. {
  1473. AddWbClass($add,$userid,$username);
  1474. }
  1475. $add[classpath]=trim($add[classpath]);
  1476. if(!$add[classname]||!$add[classpath]||!$add[modid])
  1477. {
  1478. printerror("EmptyClass","");
  1479. }
  1480. if($add[islast]&&(!$add[newstempid]||!$add[listtempid]))
  1481. {
  1482. printerror("LastMustChange","");
  1483. }
  1484. //操作权限
  1485. CheckLevel($userid,$username,$classid,"class");
  1486. $add=DoPostClassVar($add);
  1487. //目录已存在
  1488. if(strstr($add[classpath],".")||strstr($add[classpath],"/")||strstr($add[classpath],"\\"))
  1489. {
  1490. printerror("badpath","");
  1491. }
  1492. $classpath=$add[pripath].$add[classpath];
  1493. if(file_exists("../../".$classpath))
  1494. {
  1495. printerror("ReClasspath","");
  1496. }
  1497. $addtime=time();
  1498. $ecms_fclast=time();
  1499. //取得表名
  1500. $tabler=GetModTable($add[modid]);
  1501. $tabler[tid]=(int)$tabler[tid];
  1502. //增加大栏目
  1503. if(!$add[islast])
  1504. {
  1505. if(empty($add[bclassid]))//主栏目
  1506. {
  1507. $sonclass="";
  1508. $featherclass="";
  1509. }
  1510. else//中级栏目
  1511. {
  1512. //取得上一级父栏目
  1513. $r=$empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
  1514. if($r[islast])//是否终极栏目
  1515. {
  1516. printerror("BclassNotLast","");
  1517. }
  1518. if($r[wburl])
  1519. {
  1520. printerror("BclassNotWb","");
  1521. }
  1522. if(empty($r[featherclass]))
  1523. {
  1524. $r[featherclass]="|";
  1525. }
  1526. $featherclass=$r[featherclass].$add[bclassid]."|";
  1527. $sonclass="";
  1528. }
  1529. //建立目录
  1530. CreateClassPath($classpath);
  1531. $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');");
  1532. $lastid=$empire->lastid();
  1533. //副表
  1534. $ret_cr=ReturnClassAddF($add,0);
  1535. $empire->query("replace into {$dbtbpre}enewsclassadd(classid,classtext,eclasspagetext".$ret_cr[0].") values('$lastid','".eaddslashes2($add[classtext])."','$add[eclasspagetext]'".$ret_cr[1].");");
  1536. //统计表
  1537. $empire->query("replace into {$dbtbpre}enewsclass_stats(classid) values('$lastid');");
  1538. //更新附件
  1539. UpdateTheFileOther(1,$lastid,$add['filepass'],'other');
  1540. TogNotReClass(1);
  1541. GetClass();
  1542. if($add[islist]==0||$add[islist]==2)
  1543. {
  1544. $classtemp=$add[islist]==2?GetClassText($lastid):GetClassTemp($add['classtempid']);
  1545. NewsBq($lastid,$classtemp,0,1);
  1546. }
  1547. elseif($add[islist]==3)//栏目绑定信息
  1548. {
  1549. ReClassBdInfo($lastid);
  1550. }
  1551. DelListEnews();//删除缓存文件
  1552. //GetSearch($add[modid]);//更新缓存
  1553. if($sql)
  1554. {
  1555. //删除导航缓存
  1556. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or (navtype='modclass' and modid='$add[modid]')");
  1557. DelFiletext("../d/js/js/addinfo".$add[modid].".js");
  1558. $cache_enews='doclass,doinfo,domod,dostemp';
  1559. $cache_ecmstourl=urlencode("AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
  1560. $cache_mess='AddClassSuccess';
  1561. $cache_mid=$add[modid];
  1562. $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  1563. insert_dolog("classid=".$lastid."<br>classname=".$add[classname]);//操作日志
  1564. //printerror("AddClassSuccess","AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
  1565. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  1566. db_close();
  1567. $empire=null;
  1568. exit();
  1569. }
  1570. else
  1571. {
  1572. printerror("DbError","");
  1573. }
  1574. }
  1575. //增加终级栏目
  1576. else
  1577. {
  1578. //文件前缀
  1579. $add[filename_qz]=RepFilenameQz($add[filename_qz]);
  1580. if(empty($add[bclassid]))//主类别为终级栏目时
  1581. {
  1582. $sonclass="";
  1583. $featherclass="";
  1584. }
  1585. else//子栏目
  1586. {
  1587. //取得上一级父栏目
  1588. $r=$empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
  1589. //是否终极类别
  1590. if($r[islast])
  1591. {
  1592. printerror("BclassNotLast","");
  1593. }
  1594. if($r[wburl])
  1595. {
  1596. printerror("BclassNotWb","");
  1597. }
  1598. if(empty($r[featherclass])){
  1599. $r[featherclass]="|";
  1600. }
  1601. $featherclass=$r[featherclass].$add[bclassid]."|";
  1602. $sonclass="";
  1603. }
  1604. //建立栏目目录
  1605. CreateClassPath($classpath);
  1606. $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');");
  1607. $lastid=$empire->lastid();
  1608. //副表
  1609. $ret_cr=ReturnClassAddF($add,0);
  1610. $empire->query("replace into {$dbtbpre}enewsclassadd(classid,classtext,eclasspagetext".$ret_cr[0].") values('$lastid','".eaddslashes2($add[classtext])."','$add[eclasspagetext]'".$ret_cr[1].");");
  1611. //统计表
  1612. $empire->query("replace into {$dbtbpre}enewsclass_stats(classid) values('$lastid');");
  1613. //修改父栏目的子栏目
  1614. if($add[bclassid])
  1615. {
  1616. $b_r=$empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
  1617. if(empty($b_r[sonclass]))
  1618. {
  1619. $b_r[sonclass]="|";
  1620. }
  1621. $new_sonclass=$b_r[sonclass].$lastid."|";
  1622. $update=$empire->query("update {$dbtbpre}enewsclass set sonclass='$new_sonclass' where classid='$add[bclassid]'");
  1623. //更改父类别的父栏目的子栏目
  1624. $where=ReturnClass($b_r[featherclass]);
  1625. if(empty($where)){
  1626. $where="classid=0";
  1627. }
  1628. $bsql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
  1629. while($br=$empire->fetch($bsql))
  1630. {
  1631. if(empty($br[sonclass]))
  1632. {
  1633. $br[sonclass]="|";
  1634. }
  1635. $new_sonclass=$br[sonclass].$lastid."|";
  1636. $update=$empire->query("update {$dbtbpre}enewsclass set sonclass='$new_sonclass' where classid='$br[classid]'");
  1637. }
  1638. }
  1639. //更新附件
  1640. UpdateTheFileOther(1,$lastid,$add['filepass'],'other');
  1641. DelListEnews();//删除缓存文件
  1642. TogNotReClass(1);
  1643. GetClass();
  1644. //GetSearch($add[modid]);//更新缓存
  1645. if($sql)
  1646. {
  1647. //删除导航缓存
  1648. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or (navtype='modclass' and modid='$add[modid]')");
  1649. DelFiletext("../d/js/js/addinfo".$add[modid].".js");
  1650. $cache_enews='doclass,doinfo,domod,dostemp';
  1651. $cache_ecmstourl=urlencode("AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
  1652. $cache_mess='AddLastClassSuccess';
  1653. $cache_mid=$add[modid];
  1654. $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  1655. insert_dolog("classid=".$lastid."<br>classname=".$add[classname]);//操作日志
  1656. //printerror("AddLastClassSuccess","AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
  1657. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  1658. db_close();
  1659. $empire=null;
  1660. exit();
  1661. }
  1662. else
  1663. {
  1664. printerror("DbError","history.go(-1)");
  1665. }
  1666. }
  1667. }
  1668. //绑定域名应用于子栏目
  1669. function UpdateSmallClassDomain($classid,$classurl,$classpath){
  1670. global $empire,$dbtbpre;
  1671. if(empty($classurl)){
  1672. $query="update {$dbtbpre}enewsclass set classurl='' where featherclass like '%|".$classid."|%'";
  1673. }
  1674. else{
  1675. $query="update {$dbtbpre}enewsclass set classurl=CONCAT('".$classurl."',SUBSTRING(classpath,LENGTH('".$classpath."')+1)) where featherclass like '%|".$classid."|%'";
  1676. }
  1677. $sql=$empire->query($query);
  1678. }
  1679. //栏目目录修改
  1680. function AlterClassPath($classid,$islast,$oldclasspath,$classpath){
  1681. global $empire,$dbtbpre;
  1682. //更新目录名
  1683. if($oldclasspath!=$classpath)
  1684. {
  1685. @rename("../../".$oldclasspath,"../../".$classpath);
  1686. @rename("../../d/file/".$oldclasspath,"../../d/file/".$classpath);
  1687. if(empty($islast))
  1688. {
  1689. $sql=$empire->query("update {$dbtbpre}enewsclass set classpath=REPLACE(classpath,'".$oldclasspath."/','".$classpath."/') where featherclass like '%|".$classid."|%'");
  1690. }
  1691. DelListEnews();
  1692. }
  1693. }
  1694. //修改外部栏目
  1695. function EditWbClass($add,$userid,$username){
  1696. global $empire,$class_r,$dbtbpre;
  1697. //操作权限
  1698. CheckLevel($userid,$username,$classid,"class");
  1699. $add=DoPostClassVar($add);
  1700. $add[classid]=(int)$add[classid];
  1701. if(!$add[classname]||!$add[classid]||!$add[wburl])
  1702. {
  1703. printerror("EmptyWbClass","");
  1704. }
  1705. $add[islast]=0;
  1706. $ecms_fclast=time();
  1707. //取得表名
  1708. $tabler=GetModTable($add[modid]);
  1709. $tabler[tid]=(int)$tabler[tid];
  1710. //改变大栏目
  1711. if($add[bclassid]<>$add[oldbclassid])
  1712. {
  1713. //转到主栏目
  1714. if(empty($add[bclassid]))
  1715. {
  1716. $sonclass="";
  1717. $featherclass="";
  1718. }
  1719. //转到中级栏目
  1720. else
  1721. {
  1722. //大栏目跟原栏目相同
  1723. if($add[classid]==$add[bclassid])
  1724. {
  1725. printerror("BclassIsself","");
  1726. }
  1727. //取得现在大栏目的值
  1728. $b=$empire->fetch1("select featherclass,sonclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
  1729. //检测大栏目是否为终级栏目
  1730. if($b[islast])
  1731. {
  1732. printerror("BclassNotLast","");
  1733. }
  1734. if($b[wburl])
  1735. {
  1736. printerror("BclassNotWb","");
  1737. }
  1738. //是否非法父栏目
  1739. if($b[featherclass])
  1740. {
  1741. $c_nb_r=explode("|".$add[classid]."|",$b[featherclass]);
  1742. if(count($c_nb_r)<>1)
  1743. {
  1744. printerror("BclassIssmall","");
  1745. }
  1746. }
  1747. if(empty($b[featherclass]))
  1748. {
  1749. $b[featherclass]="|";
  1750. }
  1751. $featherclass=$b[featherclass].$add[bclassid]."|";
  1752. }
  1753. $change=",bclassid=$add[bclassid],featherclass='$featherclass'";
  1754. }
  1755. //修改数据库资料
  1756. $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]'");
  1757. //副表
  1758. $ret_cr=ReturnClassAddF($add,1);
  1759. $empire->query("update {$dbtbpre}enewsclassadd set classtext='".eaddslashes2($add[classtext])."',eclasspagetext='$add[eclasspagetext]'".$ret_cr[0]." where classid='$add[classid]'");
  1760. //更新附件
  1761. UpdateTheFileEditOther(1,$add['classid'],'other');
  1762. GetClass();
  1763. //删除缓存文件
  1764. $updatecache=0;
  1765. if($add[oldclassname]<>$add[classname]||$add[bclassid]<>$add[oldbclassid]||$add[wburl]<>$add[oldwburl])
  1766. {
  1767. //DelListEnews();
  1768. $updatecache=1;
  1769. }
  1770. //来源
  1771. if($add['from'])
  1772. {
  1773. $returnurl="ListPageClass.php";
  1774. }
  1775. else
  1776. {
  1777. $returnurl="ListClass.php";
  1778. }
  1779. if($sql)
  1780. {
  1781. insert_dolog("classid=".$add[classid]."<br>classname=".$add[classname]);//操作日志
  1782. if($updatecache)
  1783. {
  1784. //删除导航缓存
  1785. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass'");
  1786. $cache_enews='doclass';
  1787. $cache_ecmstourl=$returnurl.urlencode(hReturnEcmsHashStrHref2(1));
  1788. $cache_mess='EditClassSuccess';
  1789. $cache_url="CreateCache.php?enews=$cache_enews&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  1790. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  1791. db_close();
  1792. $empire=null;
  1793. exit();
  1794. }
  1795. printerror("EditClassSuccess",$returnurl.hReturnEcmsHashStrHref2(1));
  1796. }
  1797. else
  1798. {
  1799. printerror("DbError","history.go(-1)");
  1800. }
  1801. }
  1802. //修改栏目
  1803. function EditClass($add,$userid,$username){
  1804. global $empire,$class_r,$dbtbpre;
  1805. //修改外部栏目
  1806. if($add[ecmsclasstype])
  1807. {
  1808. EditWbClass($add,$userid,$username);
  1809. }
  1810. $add[classid]=(int)$add[classid];
  1811. $add[classpath]=trim($add[classpath]);
  1812. $checkclasspath=$add['classpath'];
  1813. if($add['oldclasspath']<>$add['pripath'].$add['oldcpath'])//更换父栏目
  1814. {
  1815. $add[classpath]=$add['oldcpath'];
  1816. }
  1817. if(!$add[classname]||!$add[classpath]||!$add[modid]||!$add[classid]){
  1818. printerror("EmptyClass","");
  1819. }
  1820. if($add[islast]&&(!$add[newstempid]||!$add[listtempid])){
  1821. printerror("LastMustChange","");
  1822. }
  1823. //操作权限
  1824. CheckLevel($userid,$username,$classid,"class");
  1825. $add=DoPostClassVar($add);
  1826. $add[oldmodid]=(int)$add[oldmodid];
  1827. $ecms_fclast=time();
  1828. //改变目录
  1829. $classpath=$add[pripath].$add[classpath];
  1830. if($add[oldclasspath]<>$classpath&&$checkclasspath==$add['oldcpath']){
  1831. if(file_exists("../../".$classpath)){//检测目录是否存在
  1832. printerror("ReClasspath","");
  1833. }
  1834. }
  1835. //取得表名
  1836. $tabler=GetModTable($add[modid]);
  1837. $tabler[tid]=(int)$tabler[tid];
  1838. //修改大栏目
  1839. if(!$add[islast]){
  1840. //改变大栏目
  1841. if($add[bclassid]<>$add[oldbclassid]){
  1842. //转到主栏目
  1843. if(empty($add[bclassid])){
  1844. $sonclass="";
  1845. $featherclass="";
  1846. //取得本栏目的子栏目
  1847. $r=$empire->fetch1("select sonclass,featherclass,classpath from {$dbtbpre}enewsclass where classid='$add[classid]'");
  1848. //改变父栏目的子栏目
  1849. $where=ReturnClass($r[featherclass]);
  1850. if(empty($where)){
  1851. $where="classid=0";
  1852. }
  1853. $osql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
  1854. while($o=$empire->fetch($osql)){
  1855. $newsonclass=str_replace($r[sonclass],"|",$o[sonclass]);
  1856. $uosql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$o[classid]'");
  1857. }
  1858. //修改子栏目的父栏目
  1859. $osql=$empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|".$add[classid]."|%'");
  1860. while($o=$empire->fetch($osql)){
  1861. $newclasspath=str_replace($r[classpath]."/",$classpath."/",$o[classpath]);
  1862. $newfeatherclass=str_replace($r[featherclass],"|",$o[featherclass]);
  1863. $uosql=$empire->query("update {$dbtbpre}enewsclass set featherclass='$newfeatherclass',classpath='$newclasspath' where classid='$o[classid]'");
  1864. }
  1865. }
  1866. //转到中级栏目
  1867. else
  1868. {
  1869. //大栏目跟原栏目相同
  1870. if($add[classid]==$add[bclassid]){
  1871. printerror("BclassIsself","");
  1872. }
  1873. //取得现在大栏目的值
  1874. $b=$empire->fetch1("select featherclass,sonclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
  1875. //检测大栏目是否为终级栏目
  1876. if($b[islast])
  1877. {
  1878. printerror("BclassNotLast","");
  1879. }
  1880. if($b[wburl])
  1881. {
  1882. printerror("BclassNotWb","");
  1883. }
  1884. //是否非法父栏目
  1885. if($b[featherclass]){
  1886. $c_nb_r=explode("|".$add[classid]."|",$b[featherclass]);
  1887. if(count($c_nb_r)<>1){
  1888. printerror("BclassIssmall","");
  1889. }
  1890. }
  1891. if(empty($b[featherclass])){
  1892. $b[featherclass]="|";
  1893. }
  1894. $featherclass=$b[featherclass].$add[bclassid]."|";
  1895. //取得现在栏目本身的值
  1896. $o=$empire->fetch1("select featherclass,sonclass,classpath from {$dbtbpre}enewsclass where classid='$add[classid]'");
  1897. //修改子栏目的父栏目
  1898. $osql=$empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|".$add[classid]."|%'");
  1899. while($or=$empire->fetch($osql)){
  1900. $newclasspath=str_replace($o[classpath]."/",$classpath."/",$or[classpath]);
  1901. if(empty($o[featherclass])){
  1902. $newfeatherclass=$b[featherclass].$add[bclassid].$or[featherclass];
  1903. }
  1904. else{
  1905. $newfeatherclass=str_replace($o[featherclass],$featherclass,$or[featherclass]);
  1906. }
  1907. $uosql=$empire->query("update {$dbtbpre}enewsclass set featherclass='$newfeatherclass',classpath='$newclasspath' where classid='$or[classid]'");
  1908. }
  1909. //改变旧大栏目的所有子栏目
  1910. $owhere=ReturnClass($o[featherclass]);
  1911. if(empty($owhere)){
  1912. $owhere="classid=0";
  1913. }
  1914. $oosql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$owhere);
  1915. while($oo=$empire->fetch($oosql)){
  1916. $newsonclass=str_replace($o[sonclass],"|",$oo[sonclass]);
  1917. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$oo[classid]'");
  1918. }
  1919. //改变新大栏目的子栏目
  1920. $where=ReturnClass($featherclass);
  1921. if(empty($where)){
  1922. $where="classid=0";
  1923. }
  1924. $nbsql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
  1925. while($nb=$empire->fetch($nbsql)){
  1926. if(empty($nb[sonclass]))
  1927. {$nb[sonclass]="|";}
  1928. $newsonclass=$nb[sonclass].substr($o[sonclass],1);
  1929. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$nb[classid]'");
  1930. }
  1931. }
  1932. $change=",bclassid=$add[bclassid],featherclass='$featherclass'";
  1933. }
  1934. //绑定域名应用于子栏目
  1935. if($add['UrlToSmall']){
  1936. UpdateSmallClassDomain($add['classid'],$add['classurl'],$classpath);
  1937. }
  1938. //wap模板应用于子栏目
  1939. if($add['wapstylesclass'])
  1940. {
  1941. $empire->query("update {$dbtbpre}enewsclass set wapstyleid='$add[wapstyleid]' where featherclass like '%|".$add[classid]."|%'");
  1942. }
  1943. //修改数据库资料
  1944. $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]'");
  1945. //副表
  1946. $ret_cr=ReturnClassAddF($add,1);
  1947. $empire->query("update {$dbtbpre}enewsclassadd set classtext='".eaddslashes2($add[classtext])."',eclasspagetext='$add[eclasspagetext]'".$ret_cr[0]." where classid='$add[classid]'");
  1948. //更新附件
  1949. UpdateTheFileEditOther(1,$add['classid'],'other');
  1950. GetClass();
  1951. //生成栏目文件
  1952. if($add[islist]==0||$add[islist]==2)
  1953. {
  1954. $classtemp=$add[islist]==2?GetClassText($add[classid]):GetClassTemp($add['classtempid']);
  1955. NewsBq($add[classid],$classtemp,0,1);
  1956. }
  1957. elseif($add[islist]==3)
  1958. {
  1959. ReClassBdInfo($add[classid]);
  1960. }
  1961. if($add[islist]==2)
  1962. {
  1963. //删除动态模板缓存文件
  1964. DelOneTempTmpfile('classpage'.$add[classid]);
  1965. }
  1966. }
  1967. //终级栏目
  1968. else
  1969. {
  1970. if($add[modid]<>$add[oldmodid])//换系统模型
  1971. {
  1972. $chmtbr=GetModTable($add[oldmodid]);
  1973. if($chmtbr[tid]<>$tabler[tid]&&$chmtbr[tbname])
  1974. {
  1975. $chmchecknum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$chmtbr[tbname]."_index where classid='$add[classid]'");
  1976. if($chmchecknum)
  1977. {
  1978. printerror("ClassChangeModHaveInfo","history.go(-1)");
  1979. }
  1980. }
  1981. }
  1982. //改变大栏目
  1983. if($add[bclassid]<>$add[oldbclassid]){
  1984. //转到主栏目
  1985. if(empty($add[bclassid])){
  1986. $sonclass="";
  1987. $featherclass="";
  1988. //取得栏目原本的大栏目
  1989. $r=$empire->fetch1("select featherclass,classpath from {$dbtbpre}enewsclass where classid='$add[classid]'");
  1990. //改变原本大栏目的子栏目
  1991. $where=ReturnClass($r[featherclass]);
  1992. if(empty($where)){
  1993. $where="classid=0";
  1994. }
  1995. $bsql=$empire->query("select classid,sonclass from {$dbtbpre}enewsclass where ".$where);
  1996. while($br=$empire->fetch($bsql)){
  1997. $newsonclass=str_replace("|".$add[classid]."|","|",$br[sonclass]);
  1998. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$br[classid]'");
  1999. }
  2000. }
  2001. //转到中级栏目
  2002. else
  2003. {
  2004. //取得现在大栏目的值
  2005. $b=$empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='$add[bclassid]'");
  2006. //检测大栏目是否为终级栏目
  2007. if($b[islast])
  2008. {
  2009. printerror("BclassNotLast","");
  2010. }
  2011. if($b[wburl])
  2012. {
  2013. printerror("BclassNotWb","");
  2014. }
  2015. if(empty($b[featherclass])){
  2016. $b[featherclass]="|";
  2017. }
  2018. $featherclass=$b[featherclass].$add[bclassid]."|";
  2019. //改变新大栏目的子栏目
  2020. $where=ReturnClass($featherclass);
  2021. if(empty($where)){
  2022. $where="classid=0";
  2023. }
  2024. $bsql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
  2025. while($nb=$empire->fetch($bsql))
  2026. {
  2027. if(empty($nb[sonclass]))
  2028. {$nb[sonclass]="|";}
  2029. $newsonclass=$nb[sonclass].$add[classid]."|";
  2030. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$nb[classid]'");
  2031. }
  2032. //改变旧大栏目的子栏目
  2033. $o=$empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='$add[classid]'");
  2034. $where=ReturnClass($o[featherclass]);
  2035. if(empty($where)){
  2036. $where="classid=0";
  2037. }
  2038. $osql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
  2039. while($ob=$empire->fetch($osql)){
  2040. $newsonclass=str_replace("|".$add[classid]."|","|",$ob[sonclass]);
  2041. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$ob[classid]'");
  2042. }
  2043. }
  2044. $change=",bclassid=$add[bclassid],featherclass='$featherclass'";
  2045. }
  2046. //应用于已生成的信息
  2047. if($add['tobetempinfo'])
  2048. {
  2049. UpdateAllDataTbField($tabler['tbname'],"newstempid='$add[newstempid]'"," where classid='$add[classid]'",1);
  2050. }
  2051. //文件前缀
  2052. $add[filename_qz]=RepFilenameQz($add[filename_qz]);
  2053. $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]'");
  2054. //副表
  2055. $ret_cr=ReturnClassAddF($add,1);
  2056. $empire->query("update {$dbtbpre}enewsclassadd set classtext='".eaddslashes2($add[classtext])."',eclasspagetext='$add[eclasspagetext]'".$ret_cr[0]." where classid='$add[classid]'");
  2057. //更新附件
  2058. UpdateTheFileEditOther(1,$add['classid'],'other');
  2059. GetClass();
  2060. }
  2061. //移动目录
  2062. if($add[bclassid]<>$add[oldbclassid]||($add[oldclasspath]<>$classpath&&$add['classpath']==$add['oldcpath'])){
  2063. $opath="../../".$add[oldclasspath];
  2064. $newpath="../../".$classpath;
  2065. MovePath($opath,$newpath);
  2066. $opath="../../d/file/".$add[oldclasspath];
  2067. $npath="../../d/file/".$classpath;
  2068. CopyPath($opath,$npath);
  2069. }
  2070. else{
  2071. if($add['oldcpath']<>$add['classpath'])//更换栏目目录
  2072. {
  2073. AlterClassPath($add['classid'],$add['islast'],$add['oldclasspath'],$classpath);
  2074. //删除导航缓存
  2075. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'");
  2076. GetClass();
  2077. }
  2078. }
  2079. //删除缓存文件
  2080. $cache_mid=0;
  2081. $cache_oldmid=0;
  2082. if($add[oldclassname]<>$add[classname]||$add[bclassid]<>$add[oldbclassid])
  2083. {
  2084. DelListEnews();
  2085. //GetSearch($add[modid]);
  2086. DelFiletext("../d/js/js/addinfo".$add[modid].".js");
  2087. //删除导航缓存
  2088. $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]')");
  2089. $cache_mid=$add[modid];
  2090. }
  2091. else
  2092. {
  2093. if(($add[oldclasspath]<>$classpath&&$add['classpath']==$add['oldcpath'])||$add[listdt]<>$add[oldlistdt])
  2094. {
  2095. DelListEnews();
  2096. //删除导航缓存
  2097. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'");
  2098. }
  2099. if($add[openadd]<>$add[oldopenadd]||$add[modid]<>$add[oldmodid])
  2100. {
  2101. //GetSearch($add[modid]);
  2102. DelFiletext("../d/js/js/addinfo".$add[modid].".js");
  2103. //删除导航缓存
  2104. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='modclass' and modid='$add[modid]'");
  2105. $cache_mid=$add[modid];
  2106. if($add[modid]<>$add[oldmodid])
  2107. {
  2108. //GetSearch($add[oldmodid]);
  2109. DelFiletext("../d/js/js/addinfo".$add[oldmodid].".js");
  2110. //删除导航缓存
  2111. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='modclass' and modid='$add[oldmodid]'");
  2112. $cache_oldmid=$add[oldmodid];
  2113. }
  2114. }
  2115. }
  2116. //修改栏目扩展名
  2117. if($add[oldclasstype]<>$add[classtype]){
  2118. $todaytime=date("Y-m-d H:i:s");
  2119. if($add[islast]){
  2120. $query="select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where classid='$add[classid]'";
  2121. $lencord=$add[oldlencord];
  2122. $num=$empire->gettotal($query);
  2123. }
  2124. else{
  2125. $lencord=$add[oldlencord];
  2126. if($add[oldislist]==1){
  2127. $where=ReturnClass($class_r[$add[classid]][sonclass]);
  2128. $query="select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where (".$where.")";
  2129. $num=$empire->gettotal($query);
  2130. }
  2131. else
  2132. {
  2133. $num=1;
  2134. }
  2135. }
  2136. RenameListfile($add[classid],$lencord,$num,$add[oldclasstype],$add[classtype],$classpath);
  2137. }
  2138. //来源
  2139. if($add['from']){
  2140. $returnurl="ListPageClass.php";
  2141. }
  2142. else{
  2143. $returnurl="ListClass.php";
  2144. }
  2145. TogNotReClass(1);
  2146. if($sql)
  2147. {
  2148. insert_dolog("classid=".$add[classid]."<br>classname=".$add[classname]);//操作日志
  2149. $cache_enews='doclass,doinfo,douserinfo,domod,dostemp';
  2150. $cache_ecmstourl=urlencode($returnurl.hReturnEcmsHashStrHref2(1));
  2151. $cache_mess='EditClassSuccess';
  2152. $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&oldmid=$cache_oldmid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  2153. //printerror("EditClassSuccess",$returnurl);
  2154. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  2155. db_close();
  2156. $empire=null;
  2157. exit();
  2158. }
  2159. else
  2160. {
  2161. printerror("DbError","history.go(-1)");
  2162. }
  2163. }
  2164. //终极栏目与非终极栏目之间的转换
  2165. function ChangeClassIslast($reclassid,$userid,$username){
  2166. global $empire,$dbtbpre;
  2167. //操作权限
  2168. CheckLevel($userid,$username,$classid,"class");
  2169. $count=count($reclassid);
  2170. $classid=(int)$reclassid[0];
  2171. if($count==0||!$classid)
  2172. {
  2173. printerror("NotChangeIslastClassid","");
  2174. }
  2175. //取得本栏目信息
  2176. $r=$empire->fetch1("select classid,sonclass,featherclass,islist,islast,classname,modid,tbname,wburl from {$dbtbpre}enewsclass where classid=$classid");
  2177. if(empty($r[classid]))
  2178. {
  2179. printerror("NotChangeIslastClassid","");
  2180. }
  2181. if($r[wburl])
  2182. {
  2183. printerror("NotChangeWbClassid","");
  2184. }
  2185. //非终极栏目
  2186. if(!$r[islast])
  2187. {
  2188. $num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsclass where bclassid=$classid");
  2189. if($num)
  2190. {
  2191. printerror("LastTheClassHaveSonclass","history.go(-1)");
  2192. }
  2193. //修改父栏目的子栏目
  2194. $where=ReturnClass($r[featherclass]);
  2195. if(empty($where))
  2196. {
  2197. $where="classid=0";
  2198. }
  2199. $sql=$empire->query("select classid,sonclass from {$dbtbpre}enewsclass where ".$where);
  2200. while($br=$empire->fetch($sql))
  2201. {
  2202. if(empty($br[sonclass]))
  2203. {
  2204. $br[sonclass]="|";
  2205. }
  2206. $newsonclass=$br[sonclass].$classid."|";
  2207. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid=$br[classid]");
  2208. }
  2209. $dosql=$empire->query("update {$dbtbpre}enewsclass set islast=1 where classid=$classid");
  2210. $mess="ChangeClassToLastSuccess";
  2211. }
  2212. //终极栏目
  2213. else
  2214. {
  2215. $num=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$r[tbname]."_index where classid='$classid'");
  2216. if($num)
  2217. {
  2218. printerror("LastTheClassHaveInfo","history.go(-1)");
  2219. }
  2220. //修改父栏目的子栏目
  2221. $where=ReturnClass($r[featherclass]);
  2222. if(empty($where))
  2223. {
  2224. $where="classid=0";
  2225. }
  2226. $sql=$empire->query("select classid,sonclass from {$dbtbpre}enewsclass where ".$where);
  2227. while($br=$empire->fetch($sql))
  2228. {
  2229. if(empty($br[sonclass]))
  2230. {
  2231. $br[sonclass]="|";
  2232. }
  2233. $newsonclass=str_replace("|".$classid."|","|",$br[sonclass]);
  2234. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid=$br[classid]");
  2235. }
  2236. $dosql=$empire->query("update {$dbtbpre}enewsclass set islast=0 where classid=$classid");
  2237. $mess="ChangeClassToNolastSuccess";
  2238. }
  2239. //删除缓存文件
  2240. DelListEnews();
  2241. //更新缓存
  2242. GetClass();
  2243. //GetSearch($r[modid]);
  2244. if($dosql)
  2245. {
  2246. //删除导航缓存
  2247. $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]')");
  2248. DelFiletext("../d/js/js/addinfo".$r[modid].".js");
  2249. $cache_enews='doclass,doinfo,douserinfo,domod,dostemp';
  2250. $cache_ecmstourl=urlencode(EcmsGetReturnUrl());
  2251. $cache_mess=$mess;
  2252. $cache_mid=$r[modid];
  2253. $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  2254. //操作日志
  2255. insert_dolog("classid=".$classid."<br>classname=".$r[classname]);
  2256. //printerror($mess,EcmsGetReturnUrl());
  2257. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  2258. db_close();
  2259. $empire=null;
  2260. exit();
  2261. }
  2262. else
  2263. {
  2264. printerror("DbError","history.go(-1)");
  2265. }
  2266. }
  2267. //删除栏目
  2268. function DelClass($classid,$userid,$username){
  2269. global $empire,$dbtbpre;
  2270. $classid=(int)$classid;
  2271. if(!$classid)
  2272. {
  2273. printerror("NotDelClassid","");
  2274. }
  2275. //操作权限
  2276. CheckLevel($userid,$username,$classid,"delclass");
  2277. $r=$empire->fetch1("select * from {$dbtbpre}enewsclass where classid='$classid'");
  2278. if(empty($r[classid]))
  2279. {
  2280. printerror("NotClassid","history.go(-1)");
  2281. }
  2282. DelClass1($classid);
  2283. GetClass();
  2284. //GetSearch($r[modid]);
  2285. //返回地址
  2286. if($_GET['from'])
  2287. {$returnurl="ListPageClass.php";}
  2288. else
  2289. {$returnurl="ListClass.php";}
  2290. TogNotReClass(1);
  2291. //删除导航缓存
  2292. $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]')");
  2293. $cache_enews='doclass,doinfo,douserinfo,domod,dostemp';
  2294. $cache_ecmstourl=urlencode($returnurl.hReturnEcmsHashStrHref2(1));
  2295. $cache_mess='DelClassSuccess';
  2296. $cache_mid=$r[modid];
  2297. $cache_url="CreateCache.php?enews=$cache_enews&mid=$cache_mid&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  2298. insert_dolog("classid=".$classid."<br>classname=".$r[classname]);//操作日志
  2299. //printerror("DelClassSuccess",$returnurl);
  2300. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  2301. db_close();
  2302. $empire=null;
  2303. exit();
  2304. }
  2305. //删除栏目,不返回值
  2306. function DelClass1($classid){
  2307. global $empire,$class_r,$dbtbpre;
  2308. $r=$empire->fetch1("select * from {$dbtbpre}enewsclass where classid='$classid'");
  2309. //外部栏目
  2310. if($r[wburl])
  2311. {
  2312. $sql=$empire->query("delete from {$dbtbpre}enewsclass where classid='$classid'");
  2313. $empire->query("delete from {$dbtbpre}enewsclassadd where classid='$classid'");
  2314. $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='$classid'");
  2315. //删除栏目附件
  2316. DelFileOtherTable("modtype=1 and id='$classid'");
  2317. //删除缓存
  2318. DelListEnews();
  2319. return "";
  2320. }
  2321. //删除终极栏目
  2322. if($r[islast])
  2323. {
  2324. //删除主表信息
  2325. $indexsql=$empire->query("delete from {$dbtbpre}ecms_".$r[tbname]."_index where classid='$classid'");
  2326. $sql=$empire->query("delete from {$dbtbpre}ecms_".$r[tbname]." where classid='$classid'");
  2327. $empire->query("delete from {$dbtbpre}ecms_".$r[tbname]."_check where classid='$classid'");
  2328. $empire->query("delete from {$dbtbpre}ecms_".$r[tbname]."_doc where classid='$classid'");
  2329. //删除副表信息
  2330. DelAllDataTbInfo($r['tbname'],"classid='$classid'",1,1);
  2331. //删除存文本文件
  2332. DelInfoSaveTxtfile($r['modid'],$r['tbname'],"classid='$classid'");
  2333. //删除信息附加表与附件
  2334. DelMoreInfoOtherData($classid,0,0);
  2335. $filepath="../../d/file/".$r[classpath];
  2336. $delf=DelPath($filepath);
  2337. DelFileOtherTable("modtype=1 and id='$classid'");
  2338. //删除栏目本身
  2339. $sql1=$empire->query("delete from {$dbtbpre}enewsclass where classid='$classid'");
  2340. $empire->query("delete from {$dbtbpre}enewsclassadd where classid='$classid'");
  2341. $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='$classid'");
  2342. $delpath="../../".$r[classpath];
  2343. $del=DelPath($delpath);
  2344. //更新大栏目的子栏目
  2345. $where=ReturnClass($r[featherclass]);
  2346. if(empty($where))
  2347. {$where="classid=0";}
  2348. $bsql=$empire->query("select sonclass,classid from {$dbtbpre}enewsclass where ".$where);
  2349. while($br=$empire->fetch($bsql))
  2350. {
  2351. $newsonclass=str_replace("|".$classid."|","|",$br[sonclass]);
  2352. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$br[classid]'");
  2353. }
  2354. }
  2355. //删除大栏目
  2356. else
  2357. {
  2358. //删除栏目
  2359. $where=ReturnClass($r[sonclass]);
  2360. if(empty($where))
  2361. {$where="classid=0";}
  2362. $delcr=explode("|",$r[sonclass]);
  2363. $count=count($delcr);
  2364. for($i=1;$i<$count-1;$i++)
  2365. {
  2366. $delcid=$delcr[$i];
  2367. //删除主表信息
  2368. $indexsql=$empire->query("delete from {$dbtbpre}ecms_".$class_r[$delcid][tbname]."_index where classid='$delcid'");
  2369. $sql=$empire->query("delete from {$dbtbpre}ecms_".$class_r[$delcid][tbname]." where classid='$delcid'");
  2370. $empire->query("delete from {$dbtbpre}ecms_".$class_r[$delcid][tbname]."_check where classid='$delcid'");
  2371. $empire->query("delete from {$dbtbpre}ecms_".$class_r[$delcid][tbname]."_doc where classid='$delcid'");
  2372. //删除副表信息
  2373. DelAllDataTbInfo($class_r[$delcid][tbname],"classid='$delcid'",1,1);
  2374. //删除存文本文件
  2375. DelInfoSaveTxtfile($class_r[$delcid][modid],$class_r[$delcid][tbname],"classid='$delcid'");
  2376. //删除信息附加表与附件
  2377. DelMoreInfoOtherData($delcid,0,0);
  2378. }
  2379. //删除附件
  2380. $filepath="../../d/file/".$r[classpath];
  2381. $delf=DelPath($filepath);
  2382. if($where<>'classid=0')
  2383. {
  2384. DelFileOtherTable("modtype=1 and (".str_replace('classid','id',$where).")");
  2385. }
  2386. //删除子栏目副表
  2387. $fcsql=$empire->query("select classid from {$dbtbpre}enewsclass where featherclass like '%|".$classid."|%'");
  2388. while($fcr=$empire->fetch($fcsql))
  2389. {
  2390. $empire->query("delete from {$dbtbpre}enewsclassadd where classid='$fcr[classid]'");
  2391. $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='$fcr[classid]'");
  2392. }
  2393. //删除子栏目
  2394. $sql1=$empire->query("delete from {$dbtbpre}enewsclass where featherclass like '%|".$classid."|%'");
  2395. //改变父栏目的子类
  2396. $where=ReturnClass($r[featherclass]);
  2397. if(empty($where))
  2398. {$where="classid=0";}
  2399. $bbsql=$empire->query("select classid,sonclass from {$dbtbpre}enewsclass where ".$where);
  2400. while($bbr=$empire->fetch($bbsql))
  2401. {
  2402. $newsonclass=str_replace($r[sonclass],"|",$bbr[sonclass]);
  2403. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$newsonclass' where classid='$bbr[classid]'");
  2404. }
  2405. //删除栏目本身
  2406. $sql2=$empire->query("delete from {$dbtbpre}enewsclass where classid='$classid'");
  2407. $empire->query("delete from {$dbtbpre}enewsclassadd where classid='$classid'");
  2408. $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='$classid'");
  2409. //删除栏目附件
  2410. DelFileOtherTable("modtype=1 and id='$classid'");
  2411. $delpath="../../".$r[classpath];
  2412. $del=DelPath($delpath);
  2413. }
  2414. //删除缓存
  2415. DelListEnews();
  2416. //moreportdo
  2417. if($r['classpath'])
  2418. {
  2419. $eautodofname='delpath|'.$r['classpath'].'||';
  2420. eAutodo_AddDo('eDelFileClass',0,0,0,0,0,$eautodofname);
  2421. }
  2422. }
  2423. //修改栏目顺序
  2424. function EditClassOrder($classid,$myorder,$userid,$username){
  2425. global $empire,$dbtbpre;
  2426. //验证权限
  2427. CheckLevel($userid,$username,$classid,"class");
  2428. for($i=0;$i<count($classid);$i++)
  2429. {
  2430. $newmyorder=(int)$myorder[$i];
  2431. $sql=$empire->query("update {$dbtbpre}enewsclass set myorder=$newmyorder where classid='$classid[$i]'");
  2432. }
  2433. //删除缓存
  2434. DelListEnews();
  2435. //删除导航缓存
  2436. $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'");
  2437. $cache_enews='doclass,doinfo,douserinfo';
  2438. $cache_ecmstourl=urlencode(EcmsGetReturnUrl());
  2439. $cache_mess='EditClassOrderSuccess';
  2440. $cache_url="CreateCache.php?enews=$cache_enews&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  2441. //操作日志
  2442. insert_dolog("");
  2443. //printerror("EditClassOrderSuccess",EcmsGetReturnUrl());
  2444. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  2445. db_close();
  2446. $empire=null;
  2447. exit();
  2448. }
  2449. //更新栏目关系
  2450. function ChangeSonclass($start,$userid,$username){
  2451. global $empire,$public_r,$fun_r,$dbtbpre;
  2452. //验证权限
  2453. CheckLevel($userid,$username,$classid,"changedata");
  2454. $moreportpid=(int)$_GET['moreportpid'];
  2455. $mphref='';
  2456. if($moreportpid)
  2457. {
  2458. $mphref=Moreport_ReturnUrlCsPid($moreportpid,0,0,'');
  2459. }
  2460. $start=(int)$start;
  2461. $b=0;
  2462. $sql=$empire->query("select classid from {$dbtbpre}enewsclass where islast=0 and classid>".$start." order by classid limit ".$public_r[relistnum]);
  2463. while($r=$empire->fetch($sql))
  2464. {
  2465. $b=1;
  2466. $newstart=$r[classid];
  2467. //子栏目
  2468. $sonclass="|";
  2469. $ssql=$empire->query("select classid from {$dbtbpre}enewsclass where islast=1 and featherclass like '%|".$r[classid]."|%' order by classid");
  2470. while($sr=$empire->fetch($ssql))
  2471. {
  2472. $sonclass.=$sr[classid]."|";
  2473. }
  2474. $usql=$empire->query("update {$dbtbpre}enewsclass set sonclass='$sonclass' where classid='$r[classid]'");
  2475. }
  2476. //完毕
  2477. if(empty($b))
  2478. {
  2479. GetClass();
  2480. printerror("ChangeSonclassSuccess","ReHtml/ChangeData.php?".hReturnEcmsHashStrHref2(0).$mphref);
  2481. }
  2482. 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>";
  2483. exit();
  2484. }
  2485. //删除栏目缓存文件
  2486. function DelFcListClass(){
  2487. global $empire,$dbtbpre,$logininid,$loginin;
  2488. //验证权限
  2489. CheckLevel($logininid,$loginin,0,"changedata");
  2490. DelListEnews();
  2491. //删除导航缓存
  2492. $empire->query("delete from {$dbtbpre}enewsclassnavcache");
  2493. $cache_enews='doclass,doinfo,douserinfo,domod,dostemp';
  2494. $cache_ecmstourl=urlencode("history.go(-1)");
  2495. $cache_mess='DelListEnewsSuccess';
  2496. $cache_url="CreateCache.php?enews=$cache_enews&ecmstourl=$cache_ecmstourl&mess=$cache_mess".hReturnEcmsHashStrHref2(0);
  2497. //操作日志
  2498. insert_dolog("");
  2499. //printerror("DelListEnewsSuccess","history.go(-1)");
  2500. echo'<meta http-equiv="refresh" content="0;url='.$cache_url.'">';
  2501. db_close();
  2502. $empire=null;
  2503. exit();
  2504. }
  2505. //批量设置栏目
  2506. function SetMoreClass($add,$userid,$username){
  2507. global $empire,$dbtbpre;
  2508. //验证权限
  2509. CheckLevel($userid,$username,$classid,"setmclass");
  2510. //变量
  2511. $add[classtype]=eaddslashes($add[classtype]);
  2512. $add[listtempid]=(int)$add[listtempid];
  2513. $add[dtlisttempid]=(int)$add[dtlisttempid];
  2514. $add[maxnum]=(int)$add[maxnum];
  2515. $add[lencord]=(int)$add[lencord];
  2516. $add[searchtempid]=(int)$add[searchtempid];
  2517. $add[wapstyleid]=(int)$add[wapstyleid];
  2518. $add[listorder]=eaddslashes($add[listorder]);
  2519. $add[reorder]=eaddslashes($add[reorder]);
  2520. $add[listdt]=(int)$add[listdt];
  2521. $add[showdt]=(int)$add[showdt];
  2522. $add[showclass]=(int)$add[showclass];
  2523. $add[openadd]=(int)$add[openadd];
  2524. $add[classtempid]=(int)$add[classtempid];
  2525. $add[islist]=(int)$add[islist];
  2526. $add[newstempid]=(int)$add[newstempid];
  2527. $add[pltempid]=(int)$add[pltempid];
  2528. $add[link_num]=(int)$add[link_num];
  2529. $add[ipath]=eaddslashes($add[ipath]);
  2530. $add[newspath]=eaddslashes($add[newspath]);
  2531. $add[filename_qz]=eaddslashes($add[filename_qz]);
  2532. $add[filename]=eaddslashes($add[filename]);
  2533. $add[filetype]=eaddslashes($add[filetype]);
  2534. $add[openpl]=(int)$add[openpl];
  2535. $add[checkpl]=(int)$add[checkpl];
  2536. $add[qaddshowkey]=(int)$add[qaddshowkey];
  2537. $add[checkqadd]=(int)$add[checkqadd];
  2538. $add[qaddlist]=(int)$add[qaddlist];
  2539. $add[addinfofen]=(int)$add[addinfofen];
  2540. $add[adminqinfo]=(int)$add[adminqinfo];
  2541. $add[qeditchecked]=(int)$add[qeditchecked];
  2542. $add[addreinfo]=(int)$add[addreinfo];
  2543. $add[haddlist]=(int)$add[haddlist];
  2544. $add[sametitle]=(int)$add[sametitle];
  2545. $add[checked]=(int)$add[checked];
  2546. $add[repreinfo]=(int)$add[repreinfo];
  2547. $add[definfovoteid]=(int)$add[definfovoteid];
  2548. $add[groupid]=eaddslashes($add[groupid]);
  2549. $add[doctime]=(int)$add[doctime];
  2550. $add[down_num]=(int)$add[down_num];
  2551. $add[online_num]=(int)$add[online_num];
  2552. $add[jstempid]=(int)$add[jstempid];
  2553. $add[newline]=(int)$add[newline];
  2554. $add[hotline]=(int)$add[hotline];
  2555. $add[goodline]=(int)$add[goodline];
  2556. $add[hotplline]=(int)$add[hotplline];
  2557. $add[firstline]=(int)$add[firstline];
  2558. //栏目
  2559. $classid=$add['classid'];
  2560. $count=count($classid);
  2561. if($count==0)
  2562. {
  2563. printerror("NotChangeSetClass","");
  2564. }
  2565. $cids='';
  2566. $dh='';
  2567. for($i=0;$i<$count;$i++)
  2568. {
  2569. $cids.=$dh.intval($classid[$i]);
  2570. $dh=',';
  2571. }
  2572. $whereclass='classid in ('.$cids.')';
  2573. $seting='';
  2574. //基本属性
  2575. if($add['doclasstype'])
  2576. {
  2577. $seting.=",classtype='$add[classtype]'";
  2578. }
  2579. if($add['dolisttempid']&&$add[listtempid])
  2580. {
  2581. $seting.=",listtempid='$add[listtempid]'";
  2582. }
  2583. if($add['dodtlisttempid'])
  2584. {
  2585. $seting.=",dtlisttempid='$add[dtlisttempid]'";
  2586. }
  2587. if($add['domaxnum'])
  2588. {
  2589. $seting.=",maxnum='$add[maxnum]'";
  2590. }
  2591. if($add['dolencord'])
  2592. {
  2593. $seting.=",lencord='$add[lencord]'";
  2594. }
  2595. if($add['dosearchtempid'])
  2596. {
  2597. $seting.=",searchtempid='$add[searchtempid]'";
  2598. }
  2599. if($add['dowapstyleid'])
  2600. {
  2601. $seting.=",wapstyleid='$add[wapstyleid]'";
  2602. }
  2603. if($add['dolistorder'])
  2604. {
  2605. $seting.=",listorder='$add[listorder]'";
  2606. }
  2607. if($add['doreorder'])
  2608. {
  2609. $seting.=",reorder='$add[reorder]'";
  2610. }
  2611. if($add['dolistdt'])
  2612. {
  2613. $seting.=",listdt='$add[listdt]'";
  2614. }
  2615. if($add['doshowdt'])
  2616. {
  2617. $seting.=",showdt='$add[showdt]'";
  2618. }
  2619. if($add['doshowclass'])
  2620. {
  2621. $seting.=",showclass='$add[showclass]'";
  2622. }
  2623. if($add['doopenadd'])
  2624. {
  2625. $seting.=",openadd='$add[openadd]'";
  2626. }
  2627. //选项设置[大栏目]
  2628. if($add['doclasstempid'])
  2629. {
  2630. $seting.=",classtempid='$add[classtempid]'";
  2631. }
  2632. if($add['doislist'])
  2633. {
  2634. $seting.=",islist='$add[islist]'";
  2635. }
  2636. //选项设置[终极栏目]
  2637. if($add['donewstempid']&&$add[newstempid])
  2638. {
  2639. $seting.=",newstempid='$add[newstempid]'";
  2640. if($add['tobetempinfo'])
  2641. {
  2642. $donewstemp=1;
  2643. }
  2644. }
  2645. if($add['dopltempid'])
  2646. {
  2647. $seting.=",pltempid='$add[pltempid]'";
  2648. }
  2649. if($add['dolink_num'])
  2650. {
  2651. $seting.=",link_num='$add[link_num]'";
  2652. }
  2653. if($add['doinfopath'])
  2654. {
  2655. if($add['infopath']==0)
  2656. {
  2657. $add['ipath']='';
  2658. }
  2659. $seting.=",ipath='$add[ipath]'";
  2660. }
  2661. if($add['donewspath'])
  2662. {
  2663. $seting.=",newspath='$add[newspath]'";
  2664. }
  2665. if($add['dofilename_qz'])
  2666. {
  2667. $seting.=",filename_qz='$add[filename_qz]'";
  2668. }
  2669. if($add['dofilename'])
  2670. {
  2671. $seting.=",filename='$add[filename]'";
  2672. }
  2673. if($add['dofiletype'])
  2674. {
  2675. $seting.=",filetype='$add[filetype]'";
  2676. }
  2677. if($add['doopenpl'])
  2678. {
  2679. $seting.=",openpl='$add[openpl]'";
  2680. }
  2681. if($add['docheckpl'])
  2682. {
  2683. $seting.=",checkpl='$add[checkpl]'";
  2684. }
  2685. if($add['doqaddshowkey'])
  2686. {
  2687. $seting.=",qaddshowkey='$add[qaddshowkey]'";
  2688. }
  2689. if($add['docheckqadd'])
  2690. {
  2691. $seting.=",checkqadd='$add[checkqadd]'";
  2692. }
  2693. if($add['doqaddgroupid'])
  2694. {
  2695. $add[qaddgroupid]=DoPostClassQAddGroupid($add[qaddgroupidck]);
  2696. $add[qaddgroupid]=eaddslashes($add[qaddgroupid]);
  2697. $seting.=",qaddgroupid='$add[qaddgroupid]'";
  2698. }
  2699. if($add['doqaddlist'])
  2700. {
  2701. $seting.=",qaddlist='$add[qaddlist]'";
  2702. }
  2703. if($add['doaddinfofen'])
  2704. {
  2705. $seting.=",addinfofen='$add[addinfofen]'";
  2706. }
  2707. if($add['doadminqinfo'])
  2708. {
  2709. $seting.=",adminqinfo='$add[adminqinfo]'";
  2710. }
  2711. if($add['doqeditchecked'])
  2712. {
  2713. $seting.=",qeditchecked='$add[qeditchecked]'";
  2714. }
  2715. if($add['doaddreinfo'])
  2716. {
  2717. $seting.=",addreinfo='$add[addreinfo]'";
  2718. }
  2719. if($add['dohaddlist'])
  2720. {
  2721. $seting.=",haddlist='$add[haddlist]'";
  2722. }
  2723. if($add['dosametitle'])
  2724. {
  2725. $seting.=",sametitle='$add[sametitle]'";
  2726. }
  2727. if($add['dochecked'])
  2728. {
  2729. $seting.=",checked='$add[checked]'";
  2730. }
  2731. if($add['dorepreinfo'])
  2732. {
  2733. $seting.=",repreinfo='$add[repreinfo]'";
  2734. }
  2735. if($add['dodefinfovoteid'])
  2736. {
  2737. $seting.=",definfovoteid='$add[definfovoteid]'";
  2738. }
  2739. if($add['dogroupid'])
  2740. {
  2741. $seting.=",groupid='$add[groupid]'";
  2742. }
  2743. if($add['dodoctime'])
  2744. {
  2745. $seting.=",doctime='$add[doctime]'";
  2746. }
  2747. //特殊模型设置
  2748. if($add['dodown_num'])
  2749. {
  2750. $seting.=",down_num='$add[down_num]'";
  2751. }
  2752. if($add['doonline_num'])
  2753. {
  2754. $seting.=",online_num='$add[online_num]'";
  2755. }
  2756. //JS调用设置
  2757. if($add['dojstempid'])
  2758. {
  2759. $seting.=",jstempid='$add[jstempid]'";
  2760. }
  2761. if($add['donewjs'])
  2762. {
  2763. $seting.=",newline='$add[newline]'";
  2764. }
  2765. if($add['dohotjs'])
  2766. {
  2767. $seting.=",hotline='$add[hotline]'";
  2768. }
  2769. if($add['dogoodjs'])
  2770. {
  2771. $seting.=",goodline='$add[goodline]'";
  2772. }
  2773. if($add['dohotpljs'])
  2774. {
  2775. $seting.=",hotplline='$add[hotplline]'";
  2776. }
  2777. if($add['dofirstjs'])
  2778. {
  2779. $seting.=",firstline='$add[firstline]'";
  2780. }
  2781. if(empty($seting))
  2782. {
  2783. printerror("NotChangeSetClassInfo","");
  2784. }
  2785. $seting=substr($seting,1);
  2786. $sql=$empire->query("update {$dbtbpre}enewsclass set ".$seting." where ".$whereclass);
  2787. //内容模板应用于子生成的信息
  2788. if($donewstemp==1)
  2789. {
  2790. $csql=$empire->query("select classid,tbname from {$dbtbpre}enewsclass where (".$whereclass.") and islast=1");
  2791. while($r=$empire->fetch($csql))
  2792. {
  2793. UpdateAllDataTbField($r['tbname'],"newstempid='$add[newstempid]'"," where classid='$r[classid]'",1);
  2794. }
  2795. }
  2796. if($sql)
  2797. {
  2798. GetClass();
  2799. //操作日志
  2800. insert_dolog("");
  2801. printerror("SetMoreClassSuccess","SetMoreClass.php".hReturnEcmsHashStrHref2(1));
  2802. }
  2803. else
  2804. {printerror("DbError","");}
  2805. }
  2806. ?>