PageRenderTime 30ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/uploads/dede/content_list.php

http://pj-photohost.googlecode.com/
PHP | 217 lines | 166 code | 34 blank | 17 comment | 40 complexity | 452b1b167b92db25b6f90301eb9b10ba MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. /**
  3. *
  4. * content_s_list.php?content_i_list.php?content_select_list.php
  5. * ?????????????????????????????????????????????
  6. *
  7. */
  8. require_once(dirname(__FILE__).'/config.php');
  9. require_once(DEDEINC.'/typelink.class.php');
  10. require_once(DEDEINC.'/datalistcp.class.php');
  11. require_once(DEDEADMIN.'/inc/inc_list_functions.php');
  12. $cid = isset($cid) ? intval($cid) : 0;
  13. $channelid = isset($channelid) ? intval($channelid) : 0;
  14. $mid = isset($mid) ? intval($mid) : 0;
  15. if(!isset($keyword)) $keyword = '';
  16. if(!isset($flag)) $flag = '';
  17. if(!isset($arcrank)) $arcrank = '';
  18. if(!isset($dopost)) $dopost = '';
  19. //??????????
  20. CheckPurview('a_List,a_AccList,a_MyList');
  21. //??????
  22. $userCatalogSql = '';
  23. if(TestPurview('a_List'))
  24. {
  25. ;
  26. }
  27. else if(TestPurview('a_AccList'))
  28. {
  29. if($cid==0 && $cfg_admin_channel == 'array')
  30. {
  31. $admin_catalog = join(',', $admin_catalogs);
  32. $userCatalogSql = " arc.typeid in($admin_catalog) ";
  33. }
  34. else
  35. {
  36. CheckCatalog($cid, '??????????????');
  37. }
  38. }
  39. $adminid = $cuserLogin->getUserID();
  40. $maintable = '#@__archives';
  41. setcookie('ENV_GOBACK_URL', $dedeNowurl, time()+3600, '/');
  42. $tl = new TypeLink($cid);
  43. //----------------------------------------
  44. //??????????????????????
  45. //----------------------------------------
  46. if(empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag))
  47. {
  48. $tinyQuerys = array();
  49. if(!empty($userCatalogSql))
  50. {
  51. $tinyQuerys[] = str_replace('arc.', '', $userCatalogSql);
  52. }
  53. if(!empty($channelid) && empty($cid))
  54. {
  55. $tinyQuerys[] = " channel = '$channelid' ";
  56. }
  57. else
  58. {
  59. $tinyQuerys[] = " channel>0 ";
  60. }
  61. if(!empty($arcrank))
  62. {
  63. $tinyQuerys[] = " arcrank='$arcrank' ";
  64. }
  65. else
  66. {
  67. $tinyQuerys[] = " arcrank > -2 ";
  68. }
  69. if(!empty($mid))
  70. {
  71. $tinyQuerys[] = " mid='$mid' ";
  72. }
  73. if(!empty($cid))
  74. {
  75. $tinyQuerys[] = " typeid in(".GetSonIds($cid).") ";
  76. }
  77. if(count($tinyQuerys)>0)
  78. {
  79. $tinyQuery = "where ".join(' And ',$tinyQuerys);
  80. }
  81. $arr = $dsql->GetOne("Select count(*) as dd From `#@__arctiny` $tinyQuery ");
  82. $totalresult = $arr['dd'];
  83. }
  84. if($cid==0)
  85. {
  86. if($channelid==0)
  87. {
  88. $positionname = '????&gt;';
  89. }
  90. else
  91. {
  92. $row = $tl->dsql->GetOne("Select id,typename,maintable From `#@__channeltype` where id='$channelid'");
  93. $positionname = $row['typename']." &gt; ";
  94. $maintable = $row['maintable'];
  95. $channelid = $row['id'];
  96. }
  97. }
  98. else
  99. {
  100. $positionname = str_replace($cfg_list_symbol," &gt; ",$tl->GetPositionName())." &gt; ";
  101. }
  102. //?????????????????????????
  103. if(empty($channelid)
  104. && isset($tl->TypeInfos['channeltype']))
  105. {
  106. $channelid = $tl->TypeInfos['channeltype'];
  107. }
  108. if($channelid < -1 )
  109. {
  110. header("location:content_sg_list.php?cid=$cid&channelid=$channelid&keyword=$keyword");
  111. exit();
  112. }
  113. $optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid);
  114. $whereSql = empty($channelid) ? " where arc.channel > 0 And arc.arcrank > -2 " : " where arc.channel = '$channelid' And arc.arcrank > -2 ";
  115. $flagsArr = '';
  116. $dsql->Execute('f', 'Select * From `#@__arcatt` order by sortid asc');
  117. while($frow = $dsql->GetArray('f'))
  118. {
  119. $flagsArr .= ($frow['att']==$flag ? "<option value='{$frow['att']}' selected>{$frow['attname']}</option>\r\n" : "<option value='{$frow['att']}'>{$frow['attname']}</option>\r\n");
  120. }
  121. if(!empty($userCatalogSql))
  122. {
  123. $whereSql .= " And ".$userCatalogSql;
  124. }
  125. if(!empty($mid))
  126. {
  127. $whereSql .= " And arc.mid = '$mid' ";
  128. }
  129. if($keyword != '')
  130. {
  131. $whereSql .= " And ( CONCAT(arc.title,arc.writer) like '%$keyword%') ";
  132. }
  133. if($flag != '')
  134. {
  135. $whereSql .= " And FIND_IN_SET('$flag', arc.flag) ";
  136. }
  137. if($cid != 0)
  138. {
  139. $whereSql .= ' And arc.typeid in ('.GetSonIds($cid).')';
  140. }
  141. if($arcrank != '')
  142. {
  143. $whereSql .= " And arc.arcrank = '$arcrank' ";
  144. $CheckUserSend = "<input type='button' class='coolbg np' onClick=\"location='catalog_do.php?cid=".$cid."&dopost=listArchives&gurl=content_list.php';\" value='????' />";
  145. }
  146. else
  147. {
  148. $CheckUserSend = "<input type='button' class='coolbg np' onClick=\"location='catalog_do.php?cid=".$cid."&dopost=listArchives&arcrank=-1&gurl=content_list.php';\" value='????' />";
  149. }
  150. $orderby = empty($orderby) ? 'id' : eregi_replace("[^a-z0-9]", "", $orderby);
  151. $orderbyField = 'arc.'.$orderby;
  152. $query = "Select arc.id,arc.typeid,arc.senddate,arc.flag,arc.ismake,
  153. arc.channel,arc.arcrank,arc.click,arc.title,arc.color,arc.litpic,arc.pubdate,arc.mid,
  154. tp.typename,ch.typename as channelname,mb.uname as adminname
  155. from `$maintable` arc
  156. left join `#@__arctype` tp on tp.id=arc.typeid
  157. left join `#@__channeltype` ch on ch.id=arc.channel
  158. left join `#@__member` mb on mb.mid=arc.mid
  159. $whereSql
  160. order by $orderbyField desc";
  161. if(empty($f) || !ereg('form', $f)) $f = 'form1.arcid1';
  162. //???
  163. $dlist = new DataListCP();
  164. $dlist->pageSize = 30;
  165. //GET??
  166. $dlist->SetParameter('dopost', 'listArchives');
  167. $dlist->SetParameter('keyword', $keyword);
  168. if(!empty($mid)) $dlist->SetParameter('mid', $mid);
  169. $dlist->SetParameter('cid', $cid);
  170. $dlist->SetParameter('flag', $flag);
  171. $dlist->SetParameter('orderby', $orderby);
  172. $dlist->SetParameter('arcrank', $arcrank);
  173. $dlist->SetParameter('channelid', $channelid);
  174. $dlist->SetParameter('f', $f);
  175. //??
  176. if(empty($s_tmplets)) $s_tmplets = 'templets/content_list.htm';
  177. $dlist->SetTemplate(DEDEADMIN.'/'.$s_tmplets);
  178. //??
  179. $dlist->SetSource($query);
  180. //??
  181. $dlist->Display();
  182. $dlist->Close();
  183. ?>