ChangeInfoShow.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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("../../data/dbcache/class.php");
  8. $link=db_connect();
  9. $empire=new mysqlquery();
  10. $editor=1;
  11. //验证用户
  12. $lur=is_login();
  13. $logininid=$lur['userid'];
  14. $loginin=$lur['username'];
  15. $loginrnd=$lur['rnd'];
  16. $loginlevel=$lur['groupid'];
  17. $loginadminstyleid=$lur['adminstyleid'];
  18. //ehash
  19. $ecms_hashur=hReturnEcmsHashStrAll();
  20. $enews=ehtmlspecialchars($_POST['enews']);
  21. $changeinfoid=RepPostVar($_POST['changeinfoid']);
  22. $keyboard=RepPostVar2($_POST['keyboard']);
  23. $show=(int)$_POST['show'];
  24. $sear=(int)$_POST['sear'];
  25. $tbname=RepPostVar($_POST['tbname']);
  26. $classid=(int)$_POST['classid'];
  27. if(!$tbname||!trim($keyboard))
  28. {
  29. exit();
  30. }
  31. //表名
  32. $tbr=$empire->fetch1("select tbname from {$dbtbpre}enewstable where tbname='$tbname' limit 1");
  33. if(!$tbr['tbname'])
  34. {
  35. exit();
  36. }
  37. $changeinfonum=0;
  38. if($changeinfoid)
  39. {
  40. $changeinfonumr=explode(',',$changeinfoid);
  41. $changeinfonum=count($changeinfonumr);
  42. }
  43. $search="&enews=$enews&changeinfoid=$changeinfoid&keyboard=$keyboard&show=$show&sear=$sear&tbname=$tbname&classid=$classid".$ecms_hashur['ehref'];
  44. $add='';
  45. $and=' where ';
  46. //分页
  47. $page=(int)$_POST['page'];
  48. $page=RepPIntvar($page);
  49. $start=0;
  50. $line=30;//每页显示条数
  51. $page_line=6;//每页显示链接数
  52. $offset=$page*$line;//总偏移量
  53. //栏目
  54. if($classid)
  55. {
  56. if($class_r[$classid][islast])
  57. {
  58. $add.=$and."classid='$classid'";
  59. }
  60. else
  61. {
  62. $add.=$and."(".ReturnClass($class_r[$classid][sonclass]).")";
  63. }
  64. $and=' and ';
  65. }
  66. //搜索
  67. if($keyboard)
  68. {
  69. $kbr=explode(' ',$keyboard);
  70. $kbcount=count($kbr);
  71. $kbor='';
  72. $kbwhere='';
  73. for($kbi=0;$kbi<$kbcount;$kbi++)
  74. {
  75. if(!$kbr[$kbi])
  76. {
  77. continue;
  78. }
  79. if($show==1)
  80. {
  81. $kbwhere.=$kbor."title like '%".$kbr[$kbi]."%'";
  82. }
  83. elseif($show==2)
  84. {
  85. $kbwhere.=$kbor."keyboard like '%".$kbr[$kbi]."%'";
  86. }
  87. else
  88. {
  89. $kbwhere.=$kbor."id='".$kbr[$kbi]."'";
  90. }
  91. $kbor=' or ';
  92. }
  93. if($kbwhere)
  94. {
  95. $add.=$and.'('.$kbwhere.')';
  96. }
  97. }
  98. $query="select isurl,titleurl,classid,id,newstime,username,userid,title from {$dbtbpre}ecms_".$tbr['tbname'].$add;
  99. $totalquery="select count(*) as total from {$dbtbpre}ecms_".$tbr['tbname'].$add;
  100. $totalnum=(int)$_POST['totalnum'];
  101. if($totalnum<1)
  102. {
  103. $num=$empire->gettotal($totalquery);//取得总条数
  104. }
  105. else
  106. {
  107. $num=$totalnum;
  108. }
  109. $query=$query." order by newstime desc limit $offset,$line";
  110. $sql=$empire->query($query);
  111. $returnpage=postpage($num,$line,$page_line,$start,$page,"document.changeinfoform");
  112. ?>
  113. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  114. <html>
  115. <head>
  116. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  117. <title>选择信息</title>
  118. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  119. <script>
  120. function CheckAll(form)
  121. {
  122. for (var i=0;i<form.elements.length;i++)
  123. {
  124. var e = form.elements[i];
  125. if (e.name != 'chkall')
  126. e.checked = form.chkall.checked;
  127. }
  128. }
  129. function AddInfoid(id){
  130. var inid=document.changeinfoform.changeinfoid.value;
  131. var dh="",cinid="",num=0,numlen=0;
  132. if(inid=="")
  133. {
  134. dh="";
  135. }
  136. else
  137. {
  138. dh=",";
  139. }
  140. cinid=","+inid+",";
  141. if(cinid.indexOf(","+id+",")==-1)
  142. {
  143. if(inid=='')
  144. {
  145. numlen=0;
  146. }
  147. else
  148. {
  149. num=inid.split(',');
  150. numlen=num.length;
  151. }
  152. document.changeinfoform.changeinfoid.value+=dh+id;
  153. parent.document.truechangeinfoform.trueinfoid.value=document.changeinfoform.changeinfoid.value;
  154. parent.document.getElementById("truechangeinfonum").innerHTML=numlen+1;
  155. }
  156. }
  157. function DelInfoid(id){
  158. var inid=","+document.changeinfoform.changeinfoid.value+",";
  159. var dh="",newinid="",len,num=0,numlen=0;
  160. if(inid=="")
  161. {
  162. return "";
  163. }
  164. if(inid.indexOf(","+id+",")!=-1)
  165. {
  166. newinid=inid.replace(","+id+",",",");
  167. if(newinid==",")
  168. {
  169. document.changeinfoform.changeinfoid.value="";
  170. parent.document.truechangeinfoform.trueinfoid.value='';
  171. parent.document.getElementById("truechangeinfonum").innerHTML=0;
  172. return "";
  173. }
  174. num=inid.split(',');
  175. //去掉前后,
  176. len=newinid.length;
  177. newinid=newinid.substring(1,len-1);
  178. document.changeinfoform.changeinfoid.value=newinid;
  179. parent.document.truechangeinfoform.trueinfoid.value=document.changeinfoform.changeinfoid.value;
  180. parent.document.getElementById("truechangeinfonum").innerHTML=num.length-1;
  181. }
  182. }
  183. </script>
  184. </head>
  185. <body>
  186. <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
  187. <form name="changeinfoform" method="post" action="ChangeInfoShow.php">
  188. <?=$ecms_hashur['eform']?>
  189. <input type=hidden name=totalnum value="<?=$num?>">
  190. <input type=hidden name=page value="<?=$page?>">
  191. <input type=hidden name=start value="<?=$start?>">
  192. <input type=hidden name=keyboard value="<?=$keyboard?>">
  193. <input type=hidden name=show value="<?=$show?>">
  194. <input type=hidden name=classid value="<?=$classid?>">
  195. <input type=hidden name=sear value="<?=$sear?>">
  196. <input type=hidden name=enews value="<?=$enews?>">
  197. <?php
  198. while($infor=$empire->fetch($sql))
  199. {
  200. $titleurl=sys_ReturnBqTitleLink($infor);
  201. $bgcolor="#FFFFFF";
  202. $checked='';
  203. if(strstr(",".$changeinfoid.",",",".$infor[id].","))
  204. {
  205. $bgcolor="#DBEAF5";
  206. $checked=' checked';
  207. }
  208. ?>
  209. <tr bgcolor="<?=$bgcolor?>" id="news<?=$infor[id]?>">
  210. <td width="6%" height="25"> <div align="center">
  211. <input name="id[]" type="checkbox" id="id[]" value="<?=$infor['id']?>" onClick="if(this.checked){AddInfoid(<?=$infor[id]?>);news<?=$infor[id]?>.style.backgroundColor='#DBEAF5';}else{DelInfoid(<?=$infor[id]?>);news<?=$infor[id]?>.style.backgroundColor='#ffffff';}"<?=$checked?>>
  212. </div></td>
  213. <td width="12%"> <div align="center">
  214. <?=$infor['id']?>
  215. </div></td>
  216. <td width="66%"><a href="<?=$titleurl?>" target="_blank" title="发布时间:<?=date('Y-m-d H:i:s',$infor['newstime'])?>">
  217. <?=stripSlashes($infor['title'])?>
  218. </a></td>
  219. </tr>
  220. <?php
  221. }
  222. ?>
  223. <tr bgcolor="#FFFFFF">
  224. <td height="25"> <div align="center"></div></td>
  225. <td height="25" colspan="2">
  226. <?=$returnpage?>
  227. <input name="changeinfoid" type="hidden" id="changeinfoid" value="<?=$changeinfoid?>">
  228. <input name="tbname" type="hidden" id="tbname" value="<?=$tbname?>"></td>
  229. </tr>
  230. </form>
  231. </table>
  232. <script>
  233. parent.document.truechangeinfoform.trueinfoid.value='<?=$changeinfoid?>';
  234. parent.document.truechangeinfoform.truetbname.value='<?=$tbname?>';
  235. parent.document.getElementById("truechangeinfonum").innerHTML=<?=$changeinfonum?>;
  236. </script>
  237. </body>
  238. </html>
  239. <?php
  240. db_close();
  241. $empire=null;
  242. ?>