misc_ranklist_member.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: misc_ranklist_member.php 26628 2011-12-16 10:20:35Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $multi = $gettype = '';
  12. $list = array();
  13. $cachetip = TRUE;
  14. $perpage = 20;
  15. $page = empty($_GET['page']) ? 1 : intval($_GET['page']);
  16. if($page < 1) {
  17. $page = 1;
  18. }
  19. $start = ($page - 1) * $perpage;
  20. require_once libfile('function/home');
  21. ckstart($start, $perpage);
  22. $creditkey = $cache_name = '';
  23. $fuids = array();
  24. $count = 0;
  25. $now_pos = 0;
  26. $now_choose = '';
  27. if ($_GET['view'] == 'credit') {
  28. $gettype = 'credit';
  29. $creditsrank_change = 1;
  30. $extcredits = $_G['setting']['extcredits'];
  31. $now_choose = $_GET['orderby'] && $extcredits[$_GET['orderby']] ? $_GET['orderby'] : 'all';
  32. if(!$_GET['orderby'] || !$extcredits[$_GET['orderby']]) {
  33. $_GET['orderby'] = 'all';
  34. }
  35. if($_G['uid']) {
  36. $mycredits = $now_choose == 'all' ? $_G['member']['credits'] : getuserprofile('extcredits'.$now_choose);
  37. $cookie_name = 'space_top_credit_'.$_G['uid'].'_'.$now_choose;
  38. if($_G['cookie'][$cookie_name]) {
  39. $now_pos = $_G['cookie'][$cookie_name];
  40. } else {
  41. if($now_choose == 'all') {
  42. $now_pos = C::t('common_member')->count_by_credits($mycredits);
  43. } else {
  44. $now_pos = C::t('common_member_count')->count_by_extcredits($now_choose, $mycredits);
  45. }
  46. $now_pos++;
  47. dsetcookie($cookie_name, $now_pos);
  48. }
  49. } else {
  50. $now_pos = -1;
  51. }
  52. $view = $_GET['view'];
  53. $orderby = $_GET['orderby'];
  54. $list = getranklistdata($type, $view, $orderby);
  55. } elseif ($_GET['view'] == 'friendnum') {
  56. $gettype = 'friend';
  57. if($_G['uid']) {
  58. $space = $_G['member'];
  59. space_merge($space, 'count');
  60. $cookie_name = 'space_top_'.$_GET['view'].'_'.$_G['uid'];
  61. if($_G['cookie'][$cookie_name]) {
  62. $now_pos = $_G['cookie'][$cookie_name];
  63. } else {
  64. $now_pos = C::t('common_member_count')->count_by_friends($space['friends']);
  65. $now_pos++;
  66. dsetcookie($cookie_name, $now_pos);
  67. }
  68. } else {
  69. $now_pos = -1;
  70. }
  71. $view = $_GET['view'];
  72. $orderby = $_GET['orderby'];
  73. $list = getranklistdata($type, $view, $orderby);
  74. } elseif ($_GET['view'] == 'invite') {
  75. $gettype = 'invite';
  76. $now_pos = -1;
  77. $inviterank_change = 1;
  78. $now_choose = 'thisweek';
  79. switch($_GET['orderby']) {
  80. case 'thismonth':
  81. $now_choose = 'thismonth';
  82. break;
  83. case 'today':
  84. $now_choose = 'today';
  85. break;
  86. case 'thisweek':
  87. $now_choose = 'thisweek';
  88. break;
  89. default :
  90. $now_choose = 'all';
  91. }
  92. $view = $_GET['view'];
  93. $orderby = $_GET['orderby'];
  94. $list = getranklistdata($type, $view, $orderby);
  95. } elseif($_GET['view'] == 'blog') {
  96. $gettype = 'blog';
  97. $now_pos = -1;
  98. $view = $_GET['view'];
  99. $orderby = $_GET['orderby'];
  100. $list = getranklistdata($type, $view, $orderby);
  101. } elseif($_GET['view'] == 'beauty') {
  102. $gettype = 'girl';
  103. $now_pos = -1;
  104. $view = $_GET['view'];
  105. $orderby = $_GET['orderby'];
  106. $list = getranklistdata($type, $view, $orderby);
  107. } elseif($_GET['view'] == 'handsome') {
  108. $gettype = 'boy';
  109. $now_pos = -1;
  110. $view = $_GET['view'];
  111. $orderby = $_GET['orderby'];
  112. $list = getranklistdata($type, $view, $orderby);
  113. } elseif($_GET['view'] == 'post') {
  114. $gettype = 'post';
  115. $postsrank_change = 1;
  116. $now_pos = -1;
  117. $now_choose = 'posts';
  118. switch($_GET['orderby']) {
  119. case 'digestposts':
  120. $now_choose = 'digestposts';
  121. break;
  122. case 'thismonth':
  123. $now_choose = 'thismonth';
  124. break;
  125. case 'today':
  126. $now_choose = 'today';
  127. break;
  128. }
  129. $view = $_GET['view'];
  130. $orderby = $_GET['orderby'];
  131. $list = getranklistdata($type, $view, $orderby);
  132. } elseif($_GET['view'] == 'onlinetime') {
  133. $gettype = 'onlinetime';
  134. $onlinetimerank_change = 1;
  135. $now_pos = -1;
  136. $now_choose = 'thismonth';
  137. switch($_GET['orderby']) {
  138. case 'thismonth':
  139. $now_choose = 'thismonth';
  140. break;
  141. case 'all':
  142. $now_choose = 'all';
  143. break;
  144. default :
  145. $_GET['orderby'] = 'thismonth';
  146. }
  147. $view = $_GET['view'];
  148. $orderby = $_GET['orderby'];
  149. $list = getranklistdata($type, $view, $orderby);
  150. } else {
  151. $gettype = 'bid';
  152. $cachetip = FALSE;
  153. $_GET['view'] = 'show';
  154. $creditid = 0;
  155. if($_G['setting']['creditstransextra'][6]) {
  156. $creditid = intval($_G['setting']['creditstransextra'][6]);
  157. $creditkey = 'extcredits'.$creditid;
  158. } elseif ($_G['setting']['creditstrans']) {
  159. $creditid = intval($_G['setting']['creditstrans']);
  160. $creditkey = 'extcredits'.$creditid;
  161. }
  162. $extcredits = $_G['setting']['extcredits'];
  163. $count = C::t('home_show')->count_by_credit();
  164. $space = array();
  165. if($count) {
  166. $space = $_G['member'];
  167. space_merge($space, 'count');
  168. $space['credit'] = empty($creditkey) ? 0 : $space[$creditkey];
  169. $myshowinfo = C::t('home_show')->fetch_by_uid_credit($space['uid']); //DB::fetch_first("SELECT unitprice, credit FROM ".DB::table('home_show')." WHERE uid='$space[uid]' AND credit>0");
  170. $myallcredit = intval($myshowinfo['credit']);
  171. $space['unitprice'] = intval($myshowinfo['unitprice']);
  172. $now_pos = C::t('home_show')->count_by_credit($space['unitprice']);//DB::result_first("SELECT COUNT(*) FROM ".DB::table('home_show')." WHERE unitprice>='$space[unitprice]' AND credit>0");
  173. $deluser = false;
  174. $query = C::t('home_show')->fetch_all_by_unitprice($start, $perpage);
  175. foreach ($query as $value) {
  176. if(!$deluser && $value['show_credit'] < 1) {
  177. $deluser = true;
  178. } else {
  179. $list[$value['uid']] = $value;
  180. }
  181. }
  182. if($deluser) {
  183. C::t('home_show')->delete_by_credit(1);
  184. }
  185. $multi = multi($count, $perpage, $page, "misc.php?mod=ranklist&type=member&view=$_GET[view]");
  186. }
  187. }
  188. if($cachetip) {
  189. $lastupdate = $_G['lastupdate'];
  190. $nextupdate = $_G['nextupdate'];
  191. }
  192. $myfuids =array();
  193. $query = C::t('home_friend')->fetch_all($_G['uid']);
  194. foreach($query as $value) {
  195. $myfuids[$value['fuid']] = $value['fuid'];
  196. }
  197. $myfuids[$_G['uid']] = $_G['uid'];
  198. $i = $_GET['page'] ? ($_GET['page']-1)*$perpage+1 : 1;
  199. foreach($list as $key => $value) {
  200. $fuids[] = $value['uid'];
  201. if(isset($value['lastactivity'])) $value['lastactivity'] = dgmdate($value['lastactivity'], 't');
  202. $value['isfriend'] = empty($myfuids[$value['uid']])?0:1;
  203. $list[$key] = $value;
  204. $list[$key]['rank'] = $i;
  205. $i++;
  206. }
  207. $ols = array();
  208. if($fuids) {
  209. foreach(C::app()->session->fetch_all_by_uid($fuids) as $value) {
  210. if(!$value['invisible']) {
  211. $ols[$value['uid']] = $value['lastactivity'];
  212. } elseif ($_GET['view'] == 'online' && $list[$value['uid']]) {
  213. unset($list[$value['uid']]);
  214. }
  215. }
  216. }
  217. $a_actives = array($_GET['view'] => ' class="a"');
  218. $navname = $_G['setting']['navs'][8]['navname'];
  219. $navtitle = lang('ranklist/navtitle', 'ranklist_title_member_'.$gettype).' - '.$navname;
  220. $metakeywords = lang('ranklist/navtitle', 'ranklist_title_member_'.$gettype);
  221. $metadescription = lang('ranklist/navtitle', 'ranklist_title_member_'.$gettype);
  222. include template('diy:ranklist/member');
  223. ?>