space_share.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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_share.php 28049 2012-02-21 09:30:06Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $page = empty($_GET['page'])?1:intval($_GET['page']);
  12. if($page<1) $page=1;
  13. $id = empty($_GET['id'])?0:intval($_GET['id']);
  14. $_GET['type'] = in_array($_GET['type'], array('all', 'link', 'video', 'music', 'flash', 'blog', 'album', 'pic', 'poll', 'space', 'thread', 'article'))? $_GET['type'] : 'all';
  15. if($id) {
  16. if(!IS_ROBOT) {
  17. $share = C::t('home_share')->fetch_by_sid_uid($id, $space['uid']);
  18. if(empty($share)) {
  19. showmessage('share_does_not_exist');
  20. }
  21. require_once libfile('function/share');
  22. $share = mkshare($share);
  23. $perpage = 50;
  24. $start = ($page-1)*$perpage;
  25. ckstart($start, $perpage);
  26. $list = array();
  27. $cid = empty($_GET['cid'])?0:intval($_GET['cid']);
  28. $csql = $cid?"cid='$cid' AND":'';
  29. $count = C::t('home_comment')->count_by_id_idtype($id, 'sid', $cid);
  30. if($count) {
  31. $query = C::t('home_comment')->fetch_all_by_id_idtype($id, 'sid', $start, $perpage, $cid);
  32. foreach($query as $value) {
  33. $list[] = $value;
  34. }
  35. $multi = multi($count, $perpage, $page, "home.php?mod=space&uid=$share[uid]&do=share&id=$id", '', 'comment_ul');
  36. }
  37. $diymode = intval($_G['cookie']['home_diymode']);
  38. }
  39. include_once template("diy:home/space_share_view");
  40. } else {
  41. $perpage = 20;
  42. $start = ($page-1)*$perpage;
  43. ckstart($start, $perpage);
  44. $gets = array(
  45. 'mod' => 'space',
  46. 'uid' => $space['uid'],
  47. 'do' => 'share',
  48. 'view' => $_GET['view'],
  49. 'from' => $_GET['from']
  50. );
  51. $navtheurl = $theurl = 'home.php?'.url_implode($gets);
  52. $theurl .= '&type='.$_GET['type'];
  53. if(!IS_ROBOT) {
  54. $f_index = '';
  55. $need_count = true;
  56. if(empty($_GET['view'])) $_GET['view'] = 'we';
  57. $uids = 0;
  58. $type = '';
  59. if($_GET['view'] == 'all') {
  60. $wheresql = "1";
  61. } elseif($_GET['view'] == 'we') {
  62. space_merge($space, 'field_home');
  63. if($space['feedfriend']) {
  64. $uids = explode(',', $space['feedfriend']);
  65. $f_index = 'USE INDEX(dateline)';
  66. } else {
  67. $need_count = false;
  68. }
  69. } else {
  70. if($_GET['from'] == 'space') $diymode = 1;
  71. $uids = $space['uid'];
  72. }
  73. $actives = array($_GET['view'] => ' class="a"');
  74. if($_GET['type'] && $_GET['type'] != 'all') {
  75. $sub_actives = array('type_'.$_GET['type'] => ' class="a"');
  76. $type = $_GET['type'];
  77. } else {
  78. $sub_actives = array('type_all' => ' class="a"');
  79. }
  80. $list = array();
  81. $pricount = 0;
  82. $sid = empty($_GET['sid'])?0:intval($_GET['sid']);
  83. if($need_count) {
  84. $count = C::t('home_share')->count_by_sid_uid_type($sid, $uids, $type);
  85. if($count) {
  86. require_once libfile('function/share');
  87. foreach(C::t('home_share')->fetch_all_by_sid_uid_type($sid, $uids, $type, $start, $perpage) as $value) {
  88. $value = mkshare($value);
  89. if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
  90. $list[] = $value;
  91. } else {
  92. $pricount ++;
  93. }
  94. }
  95. $multi = multi($count, $perpage, $page, $theurl);
  96. }
  97. }
  98. }
  99. dsetcookie('home_diymode', $diymode);
  100. $navtitle = lang('core', 'title_share_'.$_GET['type']);
  101. $navtitle .= lang('core', 'title_share');
  102. if($space['username']) {
  103. $navtitle = lang('space', 'sb_sharing', array('who' => $space['username']));
  104. }
  105. $metakeywords = $navtitle;
  106. $metadescription = $navtitle;
  107. include_once template("diy:home/space_share_list");
  108. }
  109. ?>