First commit
This commit is contained in:
30
source/module/group/group_attentiongroup.php
Normal file
30
source/module/group/group_attentiongroup.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: group_attentiongroup.php 25889 2011-11-24 09:52:20Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$_GET['handlekey'] = 'attentiongroup';
|
||||
require_once libfile('function/group');
|
||||
$usergroups = update_usergroups($_G['uid']);
|
||||
$attentiongroup = !empty($_G['member']['attentiongroup']) ? explode(',', $_G['member']['attentiongroup']) : array();
|
||||
$counttype = count($attentiongroup);
|
||||
if(submitcheck('attentionsubmit')) {
|
||||
if(is_array($_GET['attentiongroupid'])) {
|
||||
$_GET['attentiongroupid'] = array_slice($_GET['attentiongroupid'], 0, 5);
|
||||
C::t('common_member_field_forum')->update($_G['uid'], array('attentiongroup' => implode(',', $_GET['attentiongroupid'])));
|
||||
} else {
|
||||
C::t('common_member_field_forum')->update($_G['uid'], array('attentiongroup' => ''));
|
||||
}
|
||||
showmessage('setup_finished', 'group.php?mod=my&view=groupthread');
|
||||
}
|
||||
include template('group/group_attentiongroup');
|
||||
|
||||
?>
|
168
source/module/group/group_index.php
Normal file
168
source/module/group/group_index.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: group_index.php 36284 2016-12-12 00:47:50Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$navtitle = '';
|
||||
|
||||
$gid = intval(getgpc('gid'));
|
||||
$sgid = intval(getgpc('sgid'));
|
||||
$groupids = $typelist = array();
|
||||
$groupnav = '';
|
||||
$selectorder = array('default' => '', 'thread' => '', 'membernum' => '', 'dateline' => '', 'activity' => '');
|
||||
if(!empty($_GET['orderby'])) {
|
||||
$selectorder[$_GET['orderby']] = 'selected';
|
||||
} else {
|
||||
$selectorder['default'] = 'selected';
|
||||
}
|
||||
$first = &$_G['cache']['grouptype']['first'];
|
||||
$second = &$_G['cache']['grouptype']['second'];
|
||||
require_once libfile('function/group');
|
||||
$url = $_G['basescript'].'.php';
|
||||
|
||||
if($gid) {
|
||||
if(!empty($first[$gid])) {
|
||||
$curtype = $first[$gid];
|
||||
if($curtype['secondlist']) {
|
||||
foreach($curtype['secondlist'] as $fid) {
|
||||
$typelist[$fid] = $second[$fid];
|
||||
}
|
||||
$groupids = $first[$gid]['secondlist'];
|
||||
}
|
||||
$groupids[] = $gid;
|
||||
$url .= '?gid='.$gid;
|
||||
$fup = $gid;
|
||||
} else {
|
||||
$gid = 0;
|
||||
}
|
||||
} elseif($sgid) {
|
||||
if(!empty($second[$sgid])) {
|
||||
$curtype = $second[$sgid];
|
||||
$fup = $curtype['fup'];
|
||||
$groupids = array($sgid);
|
||||
$url .= '?sgid='.$sgid;
|
||||
} else {
|
||||
$sgid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($curtype)) {
|
||||
if($_G['uid'] && empty($_G['mod'])) {
|
||||
$usergroups = getuserprofile('groups');
|
||||
if(!empty($usergroups)) {
|
||||
dheader('Location:group.php?mod=my');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$curtype = array();
|
||||
|
||||
} else {
|
||||
$nav = get_groupnav($curtype);
|
||||
$groupnav = $nav['nav'];
|
||||
$_G['grouptypeid'] = $curtype['fid'];
|
||||
$perpage = 10;
|
||||
if($curtype['forumcolumns'] > 1) {
|
||||
$curtype['forumcolwidth'] = (floor(100 / $curtype['forumcolumns']) - 0.1).'%';
|
||||
$perpage = $curtype['forumcolumns'] * 10;
|
||||
}
|
||||
}
|
||||
$seodata = array('first' => $nav['first']['name'], 'second' => $nav['second']['name']);
|
||||
list($navtitle, $metadescription, $metakeywords) = get_seosetting('group', $seodata);
|
||||
|
||||
$data = $randgrouplist = $randgroupdata = $grouptop = $newgrouplist = $fids = array();
|
||||
$topgrouplist = $_G['cache']['groupindex']['topgrouplist'];
|
||||
$lastupdategroup = $_G['cache']['groupindex']['lastupdategroup'];
|
||||
$todayposts = intval($_G['cache']['groupindex']['todayposts']);
|
||||
$groupnum = intval($_G['cache']['groupindex']['groupnum']);
|
||||
$cachetimeupdate = TIMESTAMP - intval($_G['cache']['groupindex']['updateline']);
|
||||
|
||||
if(empty($_G['cache']['groupindex']) || $cachetimeupdate > 3600 || empty($lastupdategroup)) {
|
||||
$data['randgroupdata'] = $randgroupdata = grouplist('lastupdate', array('ff.membernum', 'ff.icon'), 80);
|
||||
$data['topgrouplist'] = $topgrouplist = grouplist('activity', array('f.commoncredits', 'ff.membernum', 'ff.icon'), 10);
|
||||
$data['updateline'] = TIMESTAMP;
|
||||
$groupdata = C::t('forum_forum')->fetch_group_counter();
|
||||
$data['todayposts'] = $todayposts = $groupdata['todayposts'];
|
||||
$data['groupnum'] = $groupnum = $groupdata['groupnum'];
|
||||
foreach($first as $id => $toptype) {
|
||||
if(empty($toptype['secondlist'])) $toptype['secondlist'][] = $id;
|
||||
$query = C::t('forum_forum')->fetch_all_sub_group_by_fup($toptype['secondlist']);
|
||||
foreach($query as $row) {
|
||||
if(!in_array($row['fid'], $fids)){
|
||||
$fids[] = $row['fid'];
|
||||
}
|
||||
}
|
||||
foreach($query as $row) {
|
||||
$data['lastupdategroup'][$id][] = $row;
|
||||
}
|
||||
if(empty($data['lastupdategroup'][$id])) $data['lastupdategroup'][$id] = array();
|
||||
}
|
||||
$lastupdategroupdetail = grouplist('activity', array('ff.membernum', 'ff.icon'), count($fids), $fids);
|
||||
foreach($data['lastupdategroup'] as $id => $toptype) {
|
||||
foreach($toptype as $key => $detail) {
|
||||
$data['lastupdategroup'][$id][$key] = array_merge($lastupdategroupdetail[$detail['fid']], $detail);
|
||||
}
|
||||
}
|
||||
$lastupdategroup = $data['lastupdategroup'];
|
||||
savecache('groupindex', $data);
|
||||
}
|
||||
|
||||
$list = array();
|
||||
if($groupids) {
|
||||
$orderby = in_array(getgpc('orderby'), array('membernum', 'dateline', 'thread', 'activity')) ? getgpc('orderby') : 'displayorder';
|
||||
$page = intval(getgpc('page')) ? intval($_GET['page']) : 1;
|
||||
$page = $page > 65535 ? 1 : $page;
|
||||
$start = ($page - 1) * $perpage;
|
||||
$getcount = grouplist('', '', '', $groupids, 1, 1);
|
||||
if($getcount) {
|
||||
$list = grouplist($orderby, '', array($start, $perpage), $groupids, 1);
|
||||
$multipage = multi($getcount, $perpage, $page, $url."&orderby=$orderby");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$endrows = $curtype['forumcolumns'] > 1 ? str_repeat('<td width="'.$curtype['forumcolwidth'].'"></td>', $curtype['forumcolumns'] - count($list) % $curtype['forumcolumns']) : '';
|
||||
$groupviewed_list = get_viewedgroup();
|
||||
|
||||
if(empty($sgid) && empty($gid)) {
|
||||
foreach($first as $key => $val) {
|
||||
if(is_array($val['secondlist']) && !empty($val['secondlist'])) {
|
||||
$first[$key]['secondlist'] = array_slice($val['secondlist'], 0, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$navtitle || !empty($sgid) || !empty($gid)) {
|
||||
if(!$navtitle) {
|
||||
$navtitle = !empty($gid) ? $nav['first']['name'] : (!empty($sgid) ? $nav['second']['name'] : '');
|
||||
}
|
||||
$navtitle = (!empty($sgid) || !empty($gid) ? helper_seo::get_title_page($navtitle, $_G['page']).' - ' : '').$_G['setting']['navs'][3]['navname'];
|
||||
$nobbname = false;
|
||||
} else {
|
||||
$nobbname = true;
|
||||
}
|
||||
|
||||
if(!$metakeywords) {
|
||||
$metakeywords = $_G['setting']['navs'][3]['navname'];
|
||||
}
|
||||
if(!$metadescription) {
|
||||
$metadescription = $_G['setting']['navs'][3]['navname'];
|
||||
}
|
||||
if(empty($curtype)) {
|
||||
include template('diy:group/index');
|
||||
} else {
|
||||
if(empty($sgid)) {
|
||||
include template('diy:group/type:'.$gid);
|
||||
} else {
|
||||
include template('diy:group/type:'.$fup);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
165
source/module/group/group_my.php
Normal file
165
source/module/group/group_my.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: group_my.php 30630 2012-06-07 07:16:14Z zhengqingpeng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$_G['mnid'] = 'mn_group';
|
||||
if(!$_G['uid']) {
|
||||
showmessage('to_login', null, array(), array('showmsg' => true, 'login' => 1));
|
||||
}
|
||||
require_once libfile('function/group');
|
||||
|
||||
$view = $_GET['view'] && in_array($_GET['view'], array('manager', 'join', 'groupthread', 'mythread')) ? $_GET['view'] : 'groupthread';
|
||||
$actives = array('manager' => '', 'join' => '', 'groupthread' => '', 'mythread' => '');
|
||||
$actives[$view] = ' class="a"';
|
||||
|
||||
$perpage = 20;
|
||||
$page = intval($_GET['page']) ? intval($_GET['page']) : 1;
|
||||
$start = ($page - 1) * $perpage;
|
||||
if($view == 'groupthread' || $view == 'mythread') {
|
||||
$typeid = intval($_GET['typeid']);
|
||||
$attentiongroups = $usergroups = array();
|
||||
$usergroups = update_usergroups($_G['uid']);
|
||||
if($view == 'groupthread' && empty($typeid) && !empty($usergroups['grouptype'])) {
|
||||
$attentiongroup = $_G['member']['attentiongroup'];
|
||||
if(empty($attentiongroup)) {
|
||||
$attentiongroups = array_slice(array_keys($usergroups['groups']), 0, 1);
|
||||
} else {
|
||||
$attentiongroups = explode(',', $attentiongroup);
|
||||
}
|
||||
$attentionthread = $attentiongroup_icon = array();
|
||||
$attentiongroupfid = '';
|
||||
$query = C::t('forum_forum')->fetch_all_info_by_fids($attentiongroups);
|
||||
foreach($query as $row) {
|
||||
$attentiongroup_icon[$row['fid']] = get_groupimg($row['icon'], 'icon');
|
||||
}
|
||||
foreach($attentiongroups as $groupid) {
|
||||
$attentiongroupfid .= $attentiongroupfid ? ','.$groupid : $groupid;
|
||||
if($page == 1) {
|
||||
foreach(C::t('forum_thread')->fetch_all_by_fid_displayorder($groupid, 0, null, null, 0, 5, 'lastpost', 'DESC', '=') as $thread) {
|
||||
$attentionthread[$groupid][$thread['tid']]['fid'] = $thread['fid'];
|
||||
$attentionthread[$groupid][$thread['tid']]['subject'] = $thread['subject'];
|
||||
$attentionthread[$groupid][$thread['tid']]['groupname'] = $usergroups['groups'][$thread['fid']];
|
||||
$attentionthread[$groupid][$thread['tid']]['views'] = $thread['views'];
|
||||
$attentionthread[$groupid][$thread['tid']]['replies'] = $thread['replies'];
|
||||
$attentionthread[$groupid][$thread['tid']]['lastposter'] = $thread['lastposter'];
|
||||
$attentionthread[$groupid][$thread['tid']]['lastpost'] = dgmdate($thread['lastpost'], 'u');
|
||||
$attentionthread[$groupid][$thread['tid']]['folder'] = 'common';
|
||||
if(empty($_G['cookie']['oldtopics']) || strpos($_G['cookie']['oldtopics'], 'D'.$thread['tid'].'D') === FALSE) {
|
||||
$attentionthread[$groupid][$thread['tid']]['folder'] = 'new';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mygrouplist = mygrouplist($_G['uid'], 'lastupdate', array('f.name', 'ff.icon'), 50);
|
||||
if($mygrouplist) {
|
||||
$managegroup = $commongroup = $groupthreadlist = array();
|
||||
foreach($mygrouplist as $fid => $group) {
|
||||
if($group['level'] == 1 || $group['level'] == 2) {
|
||||
if(count($managegroup) == 8) {
|
||||
continue;
|
||||
}
|
||||
$managegroup[$fid]['name'] = $group['name'];
|
||||
$managegroup[$fid]['icon'] = $group['icon'];
|
||||
} else {
|
||||
if(count($commongroup) == 8) {
|
||||
continue;
|
||||
}
|
||||
$commongroup[$fid]['name'] = $group['name'];
|
||||
$commongroup[$fid]['icon'] = $group['icon'];
|
||||
}
|
||||
}
|
||||
|
||||
$mygroupfid = array_keys($mygrouplist);
|
||||
if($typeid && !empty($usergroups['grouptype'][$typeid]['groups'])) {
|
||||
$mygroupfid = explode(',', $usergroups['grouptype'][$typeid]['groups']);
|
||||
$typeurl = '&typeid='.$typeid;
|
||||
} else {
|
||||
$typeid = 0;
|
||||
}
|
||||
if(!empty($attentiongroupfid) && !empty($mygroupfid)) {
|
||||
$mygroupfid = array_diff($mygroupfid, explode(',', $attentiongroupfid));
|
||||
}
|
||||
if($mygroupfid) {
|
||||
$lastpost = 0;
|
||||
$displayorder = null;
|
||||
if($view != 'mythread') {
|
||||
$displayorder = 0;
|
||||
$lastpost = TIMESTAMP - 86400*30;
|
||||
}
|
||||
$authorid = $_G['uid'];
|
||||
foreach(C::t('forum_thread')->fetch_all_by_fid_authorid_displayorder($mygroupfid, $authorid, $displayorder, $lastpost, $start, $perpage) as $thread) {
|
||||
$groupthreadlist[$thread['tid']]['fid'] = $thread['fid'];
|
||||
$groupthreadlist[$thread['tid']]['subject'] = $thread['subject'];
|
||||
$groupthreadlist[$thread['tid']]['groupname'] = $mygrouplist[$thread['fid']]['name'];
|
||||
$groupthreadlist[$thread['tid']]['views'] = $thread['views'];
|
||||
$groupthreadlist[$thread['tid']]['replies'] = $thread['replies'];
|
||||
$groupthreadlist[$thread['tid']]['lastposter'] = $thread['lastposter'];
|
||||
$groupthreadlist[$thread['tid']]['lastpost'] = dgmdate($thread['lastpost'], 'u');
|
||||
$groupthreadlist[$thread['tid']]['folder'] = 'common';
|
||||
if(empty($_G['cookie']['oldtopics']) || strpos($_G['cookie']['oldtopics'], 'D'.$thread['tid'].'D') === FALSE) {
|
||||
$groupthreadlist[$thread['tid']]['folder'] = 'new';
|
||||
}
|
||||
}
|
||||
if($view == 'mythread') {
|
||||
$multipage = simplepage(count($groupthreadlist), $perpage, $page, 'group.php?mod=my&view='.$view.$typeurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif($view == 'manager' || $view == 'join') {
|
||||
$perpage = 40;
|
||||
$start = ($page - 1) * $perpage;
|
||||
$ismanager = $view == 'manager' ? 1 : 2;
|
||||
$num = mygrouplist($_G['uid'], 'lastupdate', array('f.name', 'ff.icon'), 0, 0, $ismanager, 1);
|
||||
$multipage = multi($num, $perpage, $page, 'group.php?mod=my&view='.$view);
|
||||
$grouplist = mygrouplist($_G['uid'], 'lastupdate', array('f.name', 'ff.icon'), $perpage, $start, $ismanager);
|
||||
}
|
||||
|
||||
$frienduidarray = $friendgrouplist = $randgroupdata = $randgrouplist = $randgroup = array();
|
||||
loadcache('groupindex');
|
||||
$randgroupdata = $_G['cache']['groupindex']['randgroupdata'];
|
||||
if($randgroupdata) {
|
||||
foreach($randgroupdata as $groupid => $rgroup) {
|
||||
if($rgroup['iconstatus']) {
|
||||
$randgrouplist[$groupid] = $rgroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(count($randgrouplist) > 9) {
|
||||
foreach(array_rand($randgrouplist, 9) as $fid) {
|
||||
$randgroup[] = $randgrouplist[$fid];
|
||||
}
|
||||
} elseif (count($randgrouplist)) {
|
||||
$randgroup = $randgrouplist;
|
||||
}
|
||||
|
||||
require_once libfile('function/friend');
|
||||
$frienduid = friend_list($_G['uid'], 50);
|
||||
if($frienduid && is_array($frienduid)) {
|
||||
foreach($frienduid as $friend) {
|
||||
$frienduidarray[] = $friend['fuid'];
|
||||
}
|
||||
$fids = C::t('forum_groupuser')->fetch_all_fid_by_uids($frienduidarray);
|
||||
$query = C::t('forum_forum')->fetch_all_info_by_fids($fids, 0, 9);
|
||||
foreach($query as $group) {
|
||||
$icon = get_groupimg($group['icon'], 'icon');
|
||||
$friendgrouplist[$group['fid']] = array('fid' => $group['fid'], 'name' => $group['name'], 'icon' => $icon);
|
||||
}
|
||||
}
|
||||
|
||||
$navtitle = $_G['username'].lang('core', 'title_of').$_G['setting']['navs'][3]['navname'];
|
||||
|
||||
include_once template("diy:group/group_my");
|
||||
|
||||
?>
|
0
source/module/group/index.htm
Normal file
0
source/module/group/index.htm
Normal file
Reference in New Issue
Block a user