DoTimeRepage.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../class/connect.php");
  4. require("../class/db_sql.php");
  5. require("../class/functions.php");
  6. require LoadLang("pub/fun.php");
  7. require("../class/delpath.php");
  8. require("../class/copypath.php");
  9. require("../class/t_functions.php");
  10. require("../data/dbcache/class.php");
  11. require("../data/dbcache/MemberLevel.php");
  12. $link=db_connect();
  13. $empire=new mysqlquery();
  14. //验证用户
  15. $lur=is_login();
  16. $logininid=$lur['userid'];
  17. $loginin=$lur['username'];
  18. $loginrnd=$lur['rnd'];
  19. $loginlevel=$lur['groupid'];
  20. $loginadminstyleid=$lur['adminstyleid'];
  21. //ehash
  22. $ecms_hashur=hReturnEcmsHashStrAll();
  23. @set_time_limit(0);
  24. //加载
  25. $incftp=0;
  26. if($public_r['phpmode'])
  27. {
  28. include("../class/ftp.php");
  29. $incftp=1;
  30. }
  31. //防采集
  32. if($public_r['opennotcj'])
  33. {
  34. @include("../data/dbcache/notcj.php");
  35. }
  36. //定时刷新任务
  37. function DoTimeRepage($time){
  38. global $empire,$dbtbpre;
  39. if(empty($time))
  40. {$time=120;}
  41. echo"<meta http-equiv=\"refresh\" content=\"".$time.";url=DoTimeRepage.php".hReturnEcmsHashStrHref(1)."\">";
  42. DoAutoUpAndDownInfo();//自动上/下线
  43. $todaytime=time();
  44. $b=0;
  45. $sql=$empire->query("select doing,classid,doid from {$dbtbpre}enewsdo where isopen=1 and lasttime+dotime*60<$todaytime");
  46. while($r=$empire->fetch($sql))
  47. {
  48. $b=1;
  49. if($r[doing]==1)//生成栏目
  50. {
  51. $cr=explode(',',$r[classid]);
  52. $count=count($cr)-1;
  53. for($i=1;$i<$count;$i++)
  54. {
  55. if(empty($cr[$i]))
  56. {
  57. continue;
  58. }
  59. $cr[$i]=(int)$cr[$i];
  60. ReListHtml($cr[$i],1);
  61. }
  62. }
  63. elseif($r[doing]==2)//生成专题
  64. {
  65. $cr=explode(',',$r[classid]);
  66. $count=count($cr)-1;
  67. for($i=1;$i<$count;$i++)
  68. {
  69. if(empty($cr[$i]))
  70. {
  71. continue;
  72. }
  73. $cr[$i]=(int)$cr[$i];
  74. ListHtmlIndex($cr[$i],$ret_r[0],0);
  75. }
  76. }
  77. elseif($r[doing]==3)//生成自定义列表
  78. {
  79. $cr=explode(',',$r[classid]);
  80. $count=count($cr)-1;
  81. for($i=1;$i<$count;$i++)
  82. {
  83. if(empty($cr[$i]))
  84. {
  85. continue;
  86. }
  87. $cr[$i]=(int)$cr[$i];
  88. $ur=$empire->fetch1("select listid,pagetitle,filepath,filetype,totalsql,listsql,maxnum,lencord,listtempid,pagekeywords,pagedescription from {$dbtbpre}enewsuserlist where listid='".$cr[$i]."'");
  89. ReUserlist($ur,"");
  90. }
  91. }
  92. elseif($r[doing]==4)//生成自定义页面
  93. {
  94. $cr=explode(',',$r[classid]);
  95. $count=count($cr)-1;
  96. for($i=1;$i<$count;$i++)
  97. {
  98. if(empty($cr[$i]))
  99. {
  100. continue;
  101. }
  102. $cr[$i]=(int)$cr[$i];
  103. $ur=$empire->fetch1("select id,path,pagetext,title,pagetitle,pagekeywords,pagedescription,tempid from {$dbtbpre}enewspage where id='".$cr[$i]."'");
  104. ReUserpage($ur[id],$ur[pagetext],$ur[path],$ur[title],$ur[pagetitle],$ur[pagekeywords],$ur[pagedescription],$ur[tempid]);
  105. }
  106. }
  107. elseif($r[doing]==5)//生成自定义JS
  108. {
  109. $cr=explode(',',$r[classid]);
  110. $count=count($cr)-1;
  111. for($i=1;$i<$count;$i++)
  112. {
  113. if(empty($cr[$i]))
  114. {
  115. continue;
  116. }
  117. $cr[$i]=(int)$cr[$i];
  118. $ur=$empire->fetch1("select jsid,jsname,jssql,jstempid,jsfilename from {$dbtbpre}enewsuserjs where jsid='".$cr[$i]."'");
  119. ReUserjs($ur,'');
  120. }
  121. }
  122. elseif($r[doing]==6)//生成标题分类页面
  123. {
  124. $cr=explode(',',$r[classid]);
  125. $count=count($cr)-1;
  126. for($i=1;$i<$count;$i++)
  127. {
  128. if(empty($cr[$i]))
  129. {
  130. continue;
  131. }
  132. $cr[$i]=(int)$cr[$i];
  133. ListHtml($cr[$i],$ret_r,5);
  134. }
  135. }
  136. else//生成首页
  137. {
  138. $indextemp=GetIndextemp();
  139. NewsBq($classid,$indextemp,1,0);
  140. }
  141. $empire->query("update {$dbtbpre}enewsdo set lasttime=$todaytime where doid='$r[doid]'");
  142. }
  143. if($b)
  144. {
  145. echo "最后执行时间:".date("Y-m-d H:i:s",$todaytime)."<br><br>";
  146. }
  147. }
  148. //定时上线/下线
  149. function DoAutoUpAndDownInfo(){
  150. global $empire,$dbtbpre,$class_r,$emod_r,$public_r;
  151. $todaytime=time();
  152. $sql=$empire->query("select id,classid,infouptime,infodowntime from {$dbtbpre}enewsinfovote where infouptime>0 or infodowntime>0");
  153. while($r=$empire->fetch($sql))
  154. {
  155. if(!$class_r[$r[classid]]['tbname'])
  156. {
  157. continue;
  158. }
  159. //上线
  160. if($r['infouptime']&&$r['infouptime']<=$todaytime)
  161. {
  162. $infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_check where id='$r[id]' limit 1");
  163. if(!$infor['id'])
  164. {
  165. continue;
  166. }
  167. //签发
  168. if($infor['isqf'])
  169. {
  170. $qfr=$empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='$r[id]' and classid='$r[classid]' limit 1");
  171. if($qfr['checktno']!='100')
  172. {
  173. continue;
  174. }
  175. }
  176. $empire->query("update {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_index set checked=1 where id='$r[id]' limit 1");
  177. $pubid=ReturnInfoPubid($r['classid'],$r['id']);
  178. $empire->query("update {$dbtbpre}enewsinfovote set infouptime=0 where pubid='$pubid' limit 1");
  179. //互转
  180. MoveCheckInfoData($class_r[$r[classid]][tbname],0,$infor['stb'],"id='$r[id]'");
  181. AddClassInfos($r['classid'],'','+1');
  182. //刷新信息
  183. GetHtml($infor['classid'],$infor['id'],$infor,1);
  184. //刷新列表
  185. ReListHtml($r[classid],1);
  186. }
  187. //下线
  188. if($r['infodowntime']&&$r['infodowntime']<=$todaytime)
  189. {
  190. $mid=$class_r[$r[classid]][modid];
  191. $tbname=$class_r[$r[classid]][tbname];
  192. $pf=$emod_r[$mid]['pagef'];
  193. $stf=$emod_r[$mid]['savetxtf'];
  194. //主表
  195. $infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='".$r[id]."' limit 1");
  196. if(!$infor['id'])
  197. {
  198. continue;
  199. }
  200. //签发
  201. if($infor['isqf'])
  202. {
  203. $qfr=$empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='$r[id]' and classid='$r[classid]' limit 1");
  204. if($qfr['checktno']!='100')
  205. {
  206. continue;
  207. }
  208. }
  209. //分页字段
  210. if($pf)
  211. {
  212. if(strstr($emod_r[$mid]['tbdataf'],','.$pf.','))
  213. {
  214. $finfor=$empire->fetch1("select ".$pf." from {$dbtbpre}ecms_".$tbname."_data_".$infor[stb]." where id='$r[id]' limit 1");
  215. $infor[$pf]=$finfor[$pf];
  216. }
  217. if($stf&&$stf==$pf)//存放文本
  218. {
  219. $infor[$pf]=GetTxtFieldText($infor[$pf]);
  220. }
  221. }
  222. DelNewsFile($infor[filename],$infor[newspath],$infor[classid],$infor[$pf],$infor[groupid]);
  223. $empire->query("update {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_index set checked=0,havehtml=0 where id='$r[id]' limit 1");
  224. $pubid=ReturnInfoPubid($r['classid'],$r['id']);
  225. $empire->query("update {$dbtbpre}enewsinfovote set infodowntime=0 where pubid='$pubid' limit 1");
  226. //互转
  227. MoveCheckInfoData($class_r[$r[classid]][tbname],1,$infor['stb'],"id='$r[id]'");
  228. AddClassInfos($r['classid'],'','-1');
  229. //刷新列表
  230. ReListHtml($r[classid],1);
  231. }
  232. }
  233. }
  234. DoTimeRepage(120);//自动刷新页面
  235. db_close();
  236. $empire=null;
  237. ?>
  238. <b>说明:本页面为定时刷新任务执行窗口.</b>