list.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. require("../class/connect.php");
  3. require("../class/db_sql.php");
  4. require("../class/q_functions.php");
  5. require("../data/dbcache/class.php");
  6. $link=db_connect();
  7. $empire=new mysqlquery();
  8. define('WapPage','list');
  9. $usewapstyle='';
  10. $wapstyle=0;
  11. $pr=array();
  12. require("wapfun.php");
  13. //栏目ID
  14. $classid=(int)$_GET['classid'];
  15. $bclassid=(int)$_GET['bclassid'];
  16. if(!$classid||!$class_r[$classid]['tbname']||InfoIsInTable($class_r[$classid]['tbname']))
  17. {
  18. DoWapShowMsg('您来自的链接不存在','index.php?style='.$wapstyle);
  19. }
  20. $cr=$empire->fetch1("select classid,classpagekey,intro,classimg,cgroupid,islist,bdinfoid,islast,infos,addsql,wapstyleid,wapislist from {$dbtbpre}enewsclass where classid='$classid'");
  21. if(!$cr['classid'])
  22. {
  23. DoWapShowMsg('您来自的链接不存在','index.php?style='.$wapstyle);
  24. }
  25. $GLOBALS['navclassid']=$classid;
  26. $pagetitle=$class_r[$classid]['classname'];
  27. $pagekey=$cr['classpagekey'];
  28. $pagedes=$cr['intro'];
  29. $classimg=$cr['classimg']?$cr['classimg']:$public_r[newsurl].'e/data/images/notimg.gif';
  30. //权限
  31. if($cr['cgroupid'])
  32. {
  33. DoWapShowMsg('您来自的链接不存在','index.php?style='.$wapstyle);
  34. }
  35. //封面式
  36. $waptempfile='';
  37. if($cr['wapislist']==1)//封面
  38. {
  39. //参数
  40. $ecmsvar_mbr=array();
  41. $ecmsvar_mbr['wapstyle']=$wapstyle;
  42. $ecmsvar_mbr['fbclassid']=$bclassid;
  43. $ecmsvar_mbr['fclassid']=$classid;
  44. $ecmsvar_mbr['fcpage']=0;
  45. $ecmsvar_mbr['urladdcs']=ewap_UrlAddCs();
  46. $waptempfile='template/'.$usewapstyle.'/cpage.temp.php';
  47. if(file_exists($waptempfile))
  48. {
  49. include($waptempfile);
  50. db_close();
  51. $empire=null;
  52. exit();
  53. }
  54. }
  55. elseif($cr['wapislist']==2)//页面
  56. {
  57. //参数
  58. $ecmsvar_mbr=array();
  59. $ecmsvar_mbr['wapstyle']=$wapstyle;
  60. $ecmsvar_mbr['fbclassid']=$bclassid;
  61. $ecmsvar_mbr['fclassid']=$classid;
  62. $ecmsvar_mbr['fcpage']=0;
  63. $ecmsvar_mbr['urladdcs']=ewap_UrlAddCs();
  64. $waptempfile='template/'.$usewapstyle.'/c'.$classid.'.php';
  65. if(file_exists($waptempfile))
  66. {
  67. include($waptempfile);
  68. db_close();
  69. $empire=null;
  70. exit();
  71. }
  72. }
  73. else//列表
  74. {
  75. $waptempfile='template/'.$usewapstyle.'/list.temp.php';
  76. if(!file_exists($waptempfile))
  77. {
  78. db_close();
  79. $empire=null;
  80. exit();
  81. }
  82. }
  83. $search='';
  84. $add='';
  85. if($class_r[$classid]['islast'])
  86. {
  87. $add.="classid='$classid'";
  88. }
  89. else
  90. {
  91. $where=ReturnClass($class_r[$classid][sonclass]);
  92. $add.="(".$where.")";
  93. }
  94. $modid=$class_r[$classid][modid];
  95. //优化
  96. $yhid=$class_r[$classid][yhid];
  97. $yhvar='qlist';
  98. $yhadd='';
  99. if($yhid)
  100. {
  101. $yhadd=ReturnYhSql($yhid,$yhvar,1);
  102. }
  103. $search.="&classid=$classid&style=$wapstyle&bclassid=$bclassid";
  104. $page=intval($_GET['page']);
  105. $page=RepPIntvar($page);
  106. $line=$pr['waplistnum'];//每页显示记录数
  107. $offset=$page*$line;
  108. $query="select ".ReturnSqlListF($modid)." from {$dbtbpre}ecms_".$class_r[$classid]['tbname']." where ".$yhadd.$add;
  109. $totalnum=intval($_GET['totalnum']);
  110. if(!$public_r['usetotalnum'])
  111. {
  112. $totalnum=0;
  113. }
  114. if($totalnum<1)
  115. {
  116. $totalquery="select count(*) as total from {$dbtbpre}ecms_".$class_r[$classid]['tbname']." where ".$yhadd.$add;
  117. $num=$empire->gettotal($totalquery);//取得总条数
  118. }
  119. else
  120. {
  121. $num=$totalnum;
  122. }
  123. if($public_r['usetotalnum'])
  124. {
  125. $search.="&totalnum=$num";
  126. }
  127. //checkpageno
  128. eCheckListPageNo($page,$line,$num);
  129. //排序
  130. if(empty($class_r[$classid][reorder]))
  131. {
  132. $addorder="newstime desc";
  133. }
  134. else
  135. {
  136. $addorder=$class_r[$classid][reorder];
  137. }
  138. $query.=" order by ".ReturnSetTopSql('list').$addorder." limit $offset,$line";
  139. $sql=$empire->query($query);
  140. $returnpage=DoWapListPage($num,$line,$page,$search);
  141. //系统模型
  142. $ret_r=ReturnAddF($modid,2);
  143. //参数
  144. $ecmsvar_mbr=array();
  145. $ecmsvar_mbr['wapstyle']=$wapstyle;
  146. $ecmsvar_mbr['fbclassid']=$bclassid;
  147. $ecmsvar_mbr['fclassid']=$classid;
  148. $ecmsvar_mbr['fcpage']=$page;
  149. $ecmsvar_mbr['urladdcs']=ewap_UrlAddCs();
  150. require('template/'.$usewapstyle.'/list.temp.php');
  151. db_close();
  152. $empire=null;
  153. ?>