space_poll.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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_poll.php 28220 2012-02-24 07:52:50Z zhengqingpeng $
  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. $_GET['order'] = in_array($_GET['order'], array('dateline', 'hot')) ? $_GET['order'] : 'dateline';
  16. $opactives['poll'] = 'class="a"';
  17. if(empty($_GET['view'])) $_GET['view'] = 'we';
  18. $perpage = 20;
  19. $perpage = mob_perpage($perpage);
  20. $start = ($page-1)*$perpage;
  21. ckstart($start, $perpage);
  22. $list = array();
  23. $userlist = array();
  24. $count = $pricount = 0;
  25. $gets = array(
  26. 'mod' => 'space',
  27. 'uid' => $space['uid'],
  28. 'do' => 'poll',
  29. 'view' => $_GET['view'],
  30. 'order' => $_GET['order'],
  31. 'fuid' => $_GET['fuid'],
  32. 'filter' => $_GET['filter'],
  33. 'searchkey' => $_GET['searchkey']
  34. );
  35. $theurl = 'home.php?'.url_implode($gets);
  36. $multi = '';
  37. $f_index = '';
  38. $ordersql = 't.dateline DESC';
  39. $need_count = true;
  40. $join = $authorid = $replies = 0;
  41. $displayorder = null;
  42. $subject = '';
  43. if($_GET['view'] == 'me') {
  44. $filter = in_array($_GET['filter'], array('publish', 'join')) ? $_GET['filter'] : 'publish';
  45. if($filter == 'join') {
  46. $join = true;
  47. $authorid = $space['uid'];
  48. } else {
  49. $authorid = $space['uid'];
  50. }
  51. $filteractives = array($filter => ' class="a"');
  52. } else {
  53. space_merge($space, 'field_home');
  54. if($space['feedfriend']) {
  55. $fuid_actives = array();
  56. require_once libfile('function/friend');
  57. $fuid = intval($_GET['fuid']);
  58. if($fuid && friend_check($fuid, $space['uid'])) {
  59. $authorid = $fuid;
  60. $fuid_actives = array($fuid=>' selected');
  61. } else {
  62. $authorid = explode(',', $space['feedfriend']);
  63. $theurl = "home.php?mod=space&uid=$space[uid]&do=$do&view=we";
  64. }
  65. $query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 100, true);
  66. foreach($query as $value) {
  67. $userlist[] = $value;
  68. }
  69. } else {
  70. $need_count = false;
  71. }
  72. }
  73. $actives = array($_GET['view'] =>' class="a"');
  74. if($need_count) {
  75. if($_GET['view'] != 'me') {
  76. $displayorder = 0;
  77. }
  78. if($searchkey = stripsearchkey($_GET['searchkey'])) {
  79. $subject = $searchkey;
  80. $searchkey = dhtmlspecialchars($searchkey);
  81. }
  82. $count = C::t('forum_thread')->count_by_special(1, $authorid, $replies, $displayorder, $subject, $join);
  83. if($count) {
  84. loadcache('forums');
  85. $tids = array();
  86. require_once libfile('function/misc');
  87. foreach(C::t('forum_thread')->fetch_all_by_special(1, $authorid, $replies, $displayorder, $subject, $join, $start, $perpage) as $value) {
  88. if(empty($value['author']) && $value['authorid'] != $_G['uid']) {
  89. $hiddennum++;
  90. continue;
  91. }
  92. $tids[$value['tid']] = $value['tid'];
  93. $list[$value['tid']] = procthread($value);
  94. }
  95. if($tids) {
  96. $query = C::t('forum_poll')->fetch_all($tids);
  97. foreach($query as $value) {
  98. $value['pollpreview'] = explode("\t", trim($value['pollpreview']));
  99. $list[$value['tid']]['poll'] = $value;
  100. }
  101. }
  102. $multi = multi($count, $perpage, $page, $theurl);
  103. }
  104. }
  105. if($_G['uid']) {
  106. $_GET['view'] = !$_GET['view'] ? 'we' : $_GET['view'];
  107. $navtitle = lang('core', 'title_'.$_GET['view'].'_poll');
  108. } else {
  109. $_GET['order'] = !$_GET['order'] ? 'dateline' : $_GET['order'];
  110. $navtitle = lang('core', 'title_'.$_GET['order'].'_poll');
  111. }
  112. $actives = array($_GET['view'] => ' class="a"');
  113. include_once template("diy:home/space_poll");
  114. ?>