public function dismiss() { $this->checkAuth('Group/Manager/dismiss', get_group_creator($this->groupId), '您没有解散群组的权限。'); $res = D('Group')->delGroup($this->groupId); if ($res) { $this->success('解散成功', U('group/index/index')); } else { $this->error('解散失败'); } }
function member_display($requestID) { global $db, $main_smarty, $current_user; if (!is_numeric($requestID)) { die; } $change_role = $main_smarty->get_config_vars("PLIGG_Visual_Group_Change_Role"); $role_normal = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Normal"); $role_admin = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Admin"); $role_moderator = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Moderator"); $role_flagged = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Flagged"); $role_banned = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Banned"); $gcreator = get_group_creator($requestID); if ($gcreator == $current_user->user_id) { $member = $db->get_results("SELECT * FROM " . table_group_member . " WHERE member_group_id = {$requestID} AND member_user_id!=0"); } else { $member = $db->get_results("SELECT * FROM " . table_group_member . " WHERE member_group_id = {$requestID} AND member_user_id!=0 and member_status = 'active'"); } if ($member) { foreach ($member as $memberid) { $member_user_id = $memberid->member_user_id; $member_role = $memberid->member_role; //role change urls $member_adminchange_url = getmyurl('group_admin', $requestID, 'admin', $member_user_id); $member_normalchange_url = getmyurl('group_normal', $requestID, 'normal', $member_user_id); $member_moderatorchange_url = getmyurl('group_moderator', $requestID, 'moderator', $member_user_id); $member_flaggedchange_url = getmyurl('group_flagged', $requestID, 'flagged', $member_user_id); $member_bannedchange_url = getmyurl('group_banned', $requestID, 'banned', $member_user_id); //get group creator and his url,avatar $member_name = get_group_username($member_user_id); $group_member_url = getmyurl('user', $member_name); $group_member_avatar = get_avatar('small', "", "", "", $member_user_id); $member_display .= '<tr><td><a href="' . $group_member_url . '" class="group_member"><img src="' . $group_member_avatar . '" alt="' . $member_name . '" align="absmiddle" /></a></td><td><a href="' . $group_member_url . '" class="group_member">' . $member_name . '</a></td>'; if ($gcreator == $current_user->user_id) { if ($memberid->member_status == 'active') { if ($member_user_id == $current_user->user_id) { $main_smarty->assign('is_group_admin', 'true'); $member_display .= '<td>' . $member_role . '</td><td><a class="btn btn-default" href="#groupadminlinks-' . $index . '" data-toggle="modal"><i class="fa fa-edit" title="' . $change_role . '"></i> Edit</a></td><td> </td>'; } else { $member_display .= '<td>' . $member_role . '</td><td><a class="btn btn-default" href="#groupadminlinks-' . $index . '" data-toggle="modal"><i class="fa fa-edit" title="' . $change_role . '"></i> Edit</a></td><td><a class="btn btn-danger" href="' . my_base_url . my_pligg_base . '/join_group.php?activate=false&group_id=' . $requestID . '&user_id=' . $member_user_id . '">Deactivate</a></td>'; } $member_display .= ' <div class="modal fade" id="groupadminlinks-' . $index . '"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Group User Management</h4> </div> <div class="modal-body"> <a class="btn btn-default" href="' . $member_adminchange_url . '">' . $role_admin . '</a> <a class="btn btn-default" href="' . $member_normalchange_url . '">' . $role_normal . '</a> <a class="btn btn-default" href="' . $member_moderatorchange_url . '">' . $role_moderator . '</a> <hr /> <a class="btn btn-warning" href="' . $member_flaggedchange_url . '">' . $role_flagged . '</a> <a class="btn btn-danger" href="' . $member_bannedchange_url . '">' . $role_banned . '</a> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> '; } else { $member_display .= '<td> </td><td> </td><td><a class="btn btn-success" href="' . my_base_url . my_pligg_base . '/join_group.php?activate=true&group_id=' . $requestID . '&user_id=' . $member_user_id . '">Activate</a></td>'; } } $index = $index + 1; $member_display .= '</tr>'; } } //echo $member_display; $main_smarty->assign('member_display', $member_display); }
include mnminclude . 'html1.php'; include mnminclude . 'link.php'; include mnminclude . 'group.php'; include mnminclude . 'smartyvariables.php'; if (isset($_REQUEST['id'])) { $requestID = strip_tags($_REQUEST['id']); } if (!is_numeric($requestID)) { $requestID = 0; } if (isset($_REQUEST['title'])) { $requestTitle = $db->escape(strip_tags($_REQUEST['title'])); } //check group admin $canIhaveAccess = $canIhaveAccess + checklevel('god'); if ($current_user->user_id != get_group_creator($requestID) && $canIhaveAccess != 1) { //page redirect $redirect = ''; $redirect = getmyurl("group_story", $requestID); header("Location: {$redirect}"); die; } // pagename define('pagename', 'editgroup'); $main_smarty->assign('pagename', pagename); $group_res = group_display($requestID); if ($group_res) { $group_title = $group_res[0]; $group_description = $group_res[1]; $group_privacy = $group_res[2]; }
/** * 解散群组 */ public function dismiss() { $aGroup = I('post.group_id', 0, 'op_t'); $this->checkAuth('Group/Manager/dismiss', get_group_creator($aGroup), '您没有解散群组的权限。'); $res = M('Mob/Group')->delGroup($aGroup); if ($res) { $this->success('解散成功', U('group/index/index')); } else { $this->error('解散失败'); } }
include_once 'internal/Smarty.class.php'; $main_smarty = new Smarty(); include 'config.php'; include mnminclude . 'html1.php'; include mnminclude . 'link.php'; include mnminclude . 'group.php'; include mnminclude . 'smartyvariables.php'; check_referrer(); // sidebar $main_smarty = do_sidebar($main_smarty); // require user to log in force_authentication(); // restrict access to admins $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($current_user->user_id != get_group_creator($_REQUEST['id']) && $canIhaveAccess == 0) { // $main_smarty->assign('tpl_center', '/templates/admin/admin_access_denied'); // $main_smarty->display($template_dir . '/admin/admin.tpl'); header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI'])); die; } // pagename define('pagename', 'delete'); $main_smarty->assign('pagename', pagename); if (isset($_REQUEST['id'])) { global $db; $group_id = $_REQUEST['id']; if (!is_numeric($group_id)) { die; } $group_delete = $db->query(" Delete from " . table_groups . " where group_id =" . $group_id);
function member_display($requestID) { global $db, $main_smarty, $current_user; if (!is_numeric($requestID)) { die; } $change_role = $main_smarty->get_config_vars("PLIGG_Visual_Group_Change_Role"); $role_normal = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Normal"); $role_admin = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Admin"); $role_moderator = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Moderator"); $role_flagged = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Flagged"); $role_banned = $main_smarty->get_config_vars("PLIGG_Visual_Group_Role_Banned"); $gcreator = get_group_creator($requestID); if ($gcreator == $current_user->user_id) { $member = $db->get_results("SELECT * FROM " . table_group_member . " WHERE member_group_id = {$requestID}"); } else { $member = $db->get_results("SELECT * FROM " . table_group_member . " WHERE member_group_id = {$requestID} and member_status = 'active'"); } if ($member) { foreach ($member as $memberid) { $member_user_id = $memberid->member_user_id; $member_role = $memberid->member_role; //role change urls $member_adminchange_url = getmyurl('group_admin', $requestID, 'admin', $member_user_id); $member_normalchange_url = getmyurl('group_normal', $requestID, 'normal', $member_user_id); $member_moderatorchange_url = getmyurl('group_moderator', $requestID, 'moderator', $member_user_id); $member_flaggedchange_url = getmyurl('group_flagged', $requestID, 'flagged', $member_user_id); $member_bannedchange_url = getmyurl('group_banned', $requestID, 'banned', $member_user_id); //get group creator and his url,avatar $member_name = get_group_username($member_user_id); $group_member_url = getmyurl('user', $member_name); $group_member_avatar = get_avatar('large', "", "", "", $member_user_id); $member_display .= '<img src="' . $group_member_avatar . '" /><a href="' . $group_member_url . '"> ' . $member_name . '</a>'; if ($gcreator == $current_user->user_id) { if ($memberid->member_status == 'active') { if ($member_user_id == $current_user->user_id) { $member_display .= '<span id="groupadminlinksbutton"> <a href="javascript://" onclick=\'var replydisplay=document.getElementById("ls_groupadminlinks-' . $index . '").style.display ? "" : "none";document.getElementById("ls_groupadminlinks-' . $index . '").style.display = replydisplay;\'>' . $change_role . '</a></span><br/>'; } else { $member_display .= '<span id="groupadminlinksbutton"> <a href="javascript://" onclick=\'var replydisplay=document.getElementById("ls_groupadminlinks-' . $index . '").style.display ? "" : "none";document.getElementById("ls_groupadminlinks-' . $index . '").style.display = replydisplay;\'>' . $change_role . '</a> <a href="' . my_base_url . my_pligg_base . '/join_group.php?activate=false&group_id=' . $requestID . '&user_id=' . $member_user_id . '">Freeze</a></span><br/>'; } } else { $member_display .= '<span id="groupadminlinksbutton"> <a href="' . my_base_url . my_pligg_base . '/join_group.php?activate=true&group_id=' . $requestID . '&user_id=' . $member_user_id . '">Activate</a></span><br/>'; } } $member_display .= '<span id="ls_groupadminlinks-' . $index . '" style="display:none"> <span class="rolelinks" id="ls_groupadminlinks-' . $index . '"> <a href="' . $member_adminchange_url . '">' . $role_admin . '</a> <a href="' . $member_normalchange_url . '">' . $role_normal . '</a> <a href="' . $member_moderatorchange_url . '">' . $role_moderator . '</a> <a href="' . $member_flaggedchange_url . '">' . $role_flagged . '</a> <a href="' . $member_bannedchange_url . '">' . $role_banned . '</a> </span> </span><br/><br/>'; $index = $index + 1; } } //echo $member_display; $main_smarty->assign('member_display', $member_display); }