list.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. require LoadLang("pub/fun.php");
  7. require("../member/class/user.php");
  8. $link=db_connect();
  9. $empire=new mysqlquery();
  10. $userid=0;
  11. $username='';
  12. $spacestyle='';
  13. $search='';
  14. require('CheckUser.php');//验证用户
  15. $yhid=0;
  16. $yhvar='qmlist';
  17. //模型
  18. $mid=intval($_GET['mid']);
  19. if(!$mid)
  20. {
  21. printerror("ErrorUrl","",1);
  22. }
  23. $mr=$empire->fetch1("select tbname,qmname,sonclass from {$dbtbpre}enewsmod where mid='$mid'");
  24. if(!$mr['tbname']||InfoIsInTable($mr['tbname']))
  25. {
  26. printerror("ErrorUrl","",1);
  27. }
  28. $yhid=$etable_r[$mr[tbname]][yhid];
  29. $search.="&userid=$userid&mid=$mid";
  30. //用户
  31. $add="userid='$userid'";
  32. //显示方式
  33. if($public_r['qlistinfomod'])
  34. {
  35. $modnum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsmod where tbname='$mr[tbname]'");
  36. if($modnum>1)
  37. {
  38. $add.=' and ('.ReturnClass($mr['sonclass']).')';
  39. }
  40. }
  41. //栏目
  42. $classid=intval($_GET['classid']);
  43. if($classid)
  44. {
  45. if($class_r[$classid][islast])
  46. {
  47. $add.=" and classid='$classid'";
  48. }
  49. else
  50. {
  51. $add.=' and '.ReturnClass($class_r[$classid][sonclass]);
  52. }
  53. $yhid=$class_r[$classid][yhid];
  54. $search.="&classid=$classid";
  55. }
  56. //优化
  57. $yhadd='';
  58. if($yhid)
  59. {
  60. $yhadd=ReturnYhSql($yhid,$yhvar,1);
  61. }
  62. $start=0;
  63. $page=intval($_GET['page']);
  64. $page=RepPIntvar($page);
  65. $line=$public_r['space_num'];//每行显示
  66. $page_line=10;
  67. $offset=$page*$line;
  68. $query="select ".ReturnSqlListF($mid)." from {$dbtbpre}ecms_".$mr['tbname']." where ".$yhadd.$add." and ismember=1";
  69. $totalquery="select count(*) as total from {$dbtbpre}ecms_".$mr['tbname']." where ".$yhadd.$add." and ismember=1";
  70. $totalnum=intval($_GET['totalnum']);
  71. if(!$public_r['usetotalnum'])
  72. {
  73. $totalnum=0;
  74. }
  75. if($totalnum<1)
  76. {
  77. $num=$empire->gettotal($totalquery);//取得总条数
  78. }
  79. else
  80. {
  81. $num=$totalnum;
  82. }
  83. if($public_r['usetotalnum'])
  84. {
  85. $search.="&totalnum=$num";
  86. }
  87. //checkpageno
  88. eCheckListPageNo($page,$line,$num);
  89. $query.=" order by newstime desc limit $offset,$line";
  90. $sql=$empire->query($query);
  91. $returnpage=page1($num,$line,$page_line,$start,$page,$search);
  92. require('template/'.$spacestyle.'/list.temp.php');
  93. db_close();
  94. $empire=null;
  95. ?>