OtherLinkSearch.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. $pclassid=(int)$_GET['pclassid'];
  21. $pid=(int)$_GET['pid'];
  22. $enews=ehtmlspecialchars($_GET['enews']);
  23. $keyid=RepPostVar($_GET['keyid']);
  24. $keyboard=RepPostVar2($_GET['keyboard']);
  25. $show=(int)$_GET['show'];
  26. $sear=(int)$_GET['sear'];
  27. $returnkeyid=RepPostVar($_GET['returnkeyid']);
  28. $classid=(int)$_GET['classid'];
  29. if(!$pclassid||!$class_r[$pclassid]['tbname']||!trim($keyboard))
  30. {
  31. exit();
  32. }
  33. $search="&pclassid=$pclassid&pid=$pid&enews=$enews&keyid=$keyid&keyboard=$keyboard&show=$show&sear=$sear&returnkeyid=$returnkeyid&classid=$classid".$ecms_hashur['ehref'];
  34. $add='';
  35. //分页
  36. $page=(int)$_GET['page'];
  37. $page=RepPIntvar($page);
  38. $start=0;
  39. $line=30;//每页显示条数
  40. $page_line=6;//每页显示链接数
  41. $offset=$page*$line;//总偏移量
  42. //已选信息
  43. $ids='';
  44. $dh='';
  45. $keyr=explode(',',$returnkeyid);
  46. $count=count($keyr);
  47. for($i=0;$i<$count;$i++)
  48. {
  49. $infoid=(int)$keyr[$i];
  50. if(!$infoid)
  51. {
  52. continue;
  53. }
  54. $ids.=$dh.$infoid;
  55. $dh=',';
  56. }
  57. if($ids)
  58. {
  59. if($pid)
  60. {
  61. $ids.=','.$pid;
  62. }
  63. }
  64. else
  65. {
  66. $ids=$pid;
  67. }
  68. //栏目
  69. if($classid)
  70. {
  71. if($class_r[$classid][islast])
  72. {
  73. $add.=" and classid='$classid'";
  74. }
  75. else
  76. {
  77. $add.=" and (".ReturnClass($class_r[$classid][sonclass]).")";
  78. }
  79. }
  80. //搜索
  81. if($keyboard)
  82. {
  83. $kbr=explode(' ',$keyboard);
  84. $kbcount=count($kbr);
  85. $kbor='';
  86. $kbwhere='';
  87. for($kbi=0;$kbi<$kbcount;$kbi++)
  88. {
  89. if(!$kbr[$kbi])
  90. {
  91. continue;
  92. }
  93. if($show==1)
  94. {
  95. $kbwhere.=$kbor."title like '%".$kbr[$kbi]."%'";
  96. }
  97. elseif($show==2)
  98. {
  99. $kbwhere.=$kbor."keyboard like '%".$kbr[$kbi]."%'";
  100. }
  101. else
  102. {
  103. $kbwhere.=$kbor."id='".$kbr[$kbi]."'";
  104. }
  105. $kbor=' or ';
  106. }
  107. if($kbwhere)
  108. {
  109. $add.=' and ('.$kbwhere.')';
  110. }
  111. }
  112. $query="select isurl,titleurl,classid,id,newstime,username,userid,title from {$dbtbpre}ecms_".$class_r[$pclassid][tbname]." where id not in (".$ids.")".$add;
  113. $totalquery="select count(*) as total from {$dbtbpre}ecms_".$class_r[$pclassid][tbname]." where id not in (".$ids.")".$add;
  114. $num=$empire->gettotal($totalquery);//取得总条数
  115. $query=$query." order by newstime desc limit $offset,$line";
  116. $sql=$empire->query($query);
  117. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  118. ?>
  119. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  120. <html>
  121. <head>
  122. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  123. <title>相关链接</title>
  124. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  125. <script>
  126. function AddKeyid(infoid){
  127. var str;
  128. var r;
  129. var kr;
  130. var keyid;
  131. var ckinfoid;
  132. var showlinknum=<?=$class_r[$pclassid]['link_num']?>;
  133. keyid=parent.document.otherlinkform.returnkeyid.value;
  134. str=','+keyid+',';
  135. ckinfoid=','+infoid+',';
  136. r=str.split(ckinfoid);
  137. if(r.length!=1)
  138. {
  139. alert('此信息已添加');
  140. return false;
  141. }
  142. kr=keyid.split(',');
  143. if(kr.length>=showlinknum)
  144. {
  145. alert('添加数量已超过栏目设定('+showlinknum+'个)');
  146. return false;
  147. }
  148. if(keyid=='')
  149. {
  150. keyid=infoid;
  151. }
  152. else
  153. {
  154. keyid+=','+infoid;
  155. }
  156. parent.showinfopage.location.href='OtherLinkShow.php?<?=$ecms_hashur['ehref']?>&classid=<?=$pclassid?>&id=<?=$pid?>&enews=<?=$enews?>&keyid='+keyid;
  157. //document.getElementById('doaddkey'+infoid).innerHTML='---';
  158. }
  159. </script>
  160. </head>
  161. <body>
  162. <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
  163. <?php
  164. while($infor=$empire->fetch($sql))
  165. {
  166. $titleurl=sys_ReturnBqTitleLink($infor);
  167. ?>
  168. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  169. <td width="11%" height="25">
  170. <div align="center">
  171. <?=$infor['id']?>
  172. </div></td>
  173. <td width="75%"><a href="<?=$titleurl?>" target="_blank" title="发布时间:<?=date('Y-m-d H:i:s',$infor['newstime'])?>">
  174. <?=stripSlashes($infor['title'])?>
  175. </a></td>
  176. <td width="14%"><div align="center" id="doaddkey<?=$infor['id']?>"><a href="#empirecms" onclick="AddKeyid('<?=$infor['id']?>');">添加</a></div></td>
  177. </tr>
  178. <?php
  179. }
  180. ?>
  181. <tr bgcolor="#FFFFFF">
  182. <td height="25" colspan="3">
  183. <?=$returnpage?>
  184. </td>
  185. </tr>
  186. </table>
  187. </body>
  188. </html>
  189. <?php
  190. db_close();
  191. $empire=null;
  192. ?>