space_activity.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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: space_activity.php 30378 2012-05-24 09:52:46Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $minhot = $_G['setting']['feedhotmin']<1?3:$_G['setting']['feedhotmin'];
  12. $page = empty($_GET['page'])?1:intval($_GET['page']);
  13. if($page<1) $page=1;
  14. $id = empty($_GET['id'])?0:intval($_GET['id']);
  15. $opactives['activity'] = 'class="a"';
  16. if(empty($_GET['view'])) $_GET['view'] = 'we';
  17. $_GET['order'] = empty($_GET['order']) ? 'dateline' : $_GET['order'];
  18. $perpage = 20;
  19. $perpage = mob_perpage($perpage);
  20. $start = ($page-1)*$perpage;
  21. ckstart($start, $perpage);
  22. $list = array();
  23. $userlist = array();
  24. $hiddennum = $count = $pricount = 0;
  25. $gets = array(
  26. 'mod' => 'space',
  27. 'uid' => $space['uid'],
  28. 'do' => 'activity',
  29. 'view' => $_GET['view'],
  30. 'order' => $_GET['order'],
  31. 'type' => $_GET['type'],
  32. 'fuid' => $_GET['fuid'],
  33. 'searchkey' => $_GET['searchkey']
  34. );
  35. $theurl = 'home.php?'.url_implode($gets);
  36. $multi = '';
  37. $wheresql = '1';
  38. $threadsql = $apply_sql = '';
  39. $f_index = '';
  40. $need_count = true;
  41. require_once libfile('function/misc');
  42. if($_GET['view'] == 'me') {
  43. $viewtype = in_array($_GET['type'], array('orig', 'apply')) ? $_GET['type'] : 'orig';
  44. $orderactives = array($viewtype => ' class="a"');
  45. } else {
  46. space_merge($space, 'field_home');
  47. if($space['feedfriend']) {
  48. $fuid_actives = array();
  49. require_once libfile('function/friend');
  50. $fuid = intval($_GET['fuid']);
  51. if($fuid && friend_check($fuid, $space['uid'])) {
  52. $fuid_actives = array($fuid=>' selected');
  53. $frienduid = $fuid;
  54. } else {
  55. $theurl = "home.php?mod=space&uid=$space[uid]&do=$do&view=we";
  56. $frienduid = explode(',', $space['feedfriend']);
  57. }
  58. $query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 100, true);
  59. foreach($query as $value) {
  60. $userlist[] = $value;
  61. }
  62. } else {
  63. $need_count = false;
  64. }
  65. }
  66. $actives = array($_GET['view'] =>' class="a"');
  67. if($need_count) {
  68. if(!empty($_GET['searchkey'])) {
  69. $_GET['searchkey'] = stripsearchkey($_GET['searchkey']);
  70. }
  71. $count = C::t('forum_activity')->fetch_all_for_search($_GET['view'], $_GET['order'], $_GET['searchkey'], $_GET['type'], $frienduid, $space['uid'], $minhot, 1);
  72. if($count) {
  73. $query = C::t('forum_activity')->fetch_all_for_search($_GET['view'], $_GET['order'], $_GET['searchkey'], $_GET['type'], $frienduid, $space['uid'], $minhot, 0, $start, $perpage);
  74. loadcache('forums');
  75. $daytids = $tids = array();
  76. foreach($query as $value) {
  77. if(empty($value['author']) && $value['authorid'] != $_G['uid']) {
  78. $hiddennum++;
  79. continue;
  80. }
  81. $date = dgmdate($value['starttimefrom'], 'Ymd');
  82. $posttableid = $value['posttableid'] ? $value['posttableid'] : 0;
  83. $tids[$posttableid][$value['tid']] = $value['tid'];
  84. $value['week'] = dgmdate($value['starttimefrom'], 'w');
  85. $value['month'] = dgmdate($value['starttimefrom'], 'n'.lang('space', 'month'));
  86. $value['day'] = dgmdate($value['starttimefrom'], 'j');
  87. $value['time'] = dgmdate($value['starttimefrom'], 'Y'.lang('space', 'year').'m'.lang('space', 'month').'d'.lang('space', 'day'));
  88. $value['starttimefrom'] = dgmdate($value['starttimefrom']);
  89. $daytids[$value['tid']] = $date;
  90. $list[$date][$value['tid']] = procthread($value);
  91. }
  92. if($tids) {
  93. require_once libfile('function/post');
  94. foreach($tids as $ptid=>$ids) {
  95. foreach(C::t('forum_post')->fetch_all_by_tid($ptid, $ids, true, '', 0, 0, 1) as $value) {
  96. $date = $daytids[$value['tid']];
  97. $value['message'] = messagecutstr($value['message'], 150);
  98. $list[$date][$value['tid']]['message'] = $value['message'];
  99. }
  100. }
  101. }
  102. $multi = multi($count, $perpage, $page, $theurl);
  103. }
  104. }
  105. if($_G['uid']) {
  106. if($_GET['view'] == 'all') {
  107. $navtitle = lang('core', 'title_view_all').lang('core', 'title_activity');
  108. } elseif($_GET['view'] == 'me') {
  109. $navtitle = lang('core', 'title_my_activity');
  110. } else {
  111. $navtitle = lang('core', 'title_friend_activity');
  112. }
  113. } else {
  114. if($_GET['order'] == 'hot') {
  115. $navtitle = lang('core', 'title_top_activity');
  116. } else {
  117. $navtitle = lang('core', 'title_newest_activity');
  118. }
  119. }
  120. include_once template("diy:home/space_activity");
  121. ?>