本文整理汇总了PHP中group_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP group_delete函数的具体用法?PHP group_delete怎么用?PHP group_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了group_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deletegroup_submit
function deletegroup_submit(Pieform $form, $values)
{
global $SESSION, $USER, $groupid;
group_delete($groupid);
$SESSION->add_ok_msg(get_string('deletegroup', 'group'));
redirect('/group/mygroups.php');
}
示例2: admindeletegroup_submit
function admindeletegroup_submit(Pieform $form, $values)
{
global $SESSION, $groupid;
require_once get_config('libroot') . 'group.php';
group_delete($groupid);
$SESSION->add_ok_msg(get_string('deletegroup', 'group'));
redirect(get_config('wwwroot') . 'admin/groups/groups.php');
}
示例3: deletegroup_submit
function deletegroup_submit(Pieform $form, $values)
{
require_once 'embeddedimage.php';
global $SESSION, $USER, $groupid;
group_delete($groupid);
EmbeddedImage::delete_embedded_images('group', $groupid);
$SESSION->add_ok_msg(get_string('deletegroup', 'group'));
redirect('/group/mygroups.php');
}
示例4: delete_groups
/**
* Delete one or more groups
*
* @param array $groups
*/
public static function delete_groups($groups)
{
global $USER, $WEBSERVICE_INSTITUTION;
$params = self::validate_parameters(self::delete_groups_parameters(), array('groups' => $groups));
db_begin();
foreach ($params['groups'] as $group) {
// Make sure that the group doesn't already exist
if (!empty($group['id'])) {
if (!($dbgroup = get_record('group', 'id', $group['id'], 'deleted', 0))) {
throw new WebserviceInvalidParameterException('delete_groups | ' . get_string('groupnotexist', 'auth.webservice', $group['id']));
}
} else {
if (!empty($group['name'])) {
if (!($dbgroup = get_record('group', 'name', $group['name'], 'deleted', 0))) {
throw new WebserviceInvalidParameterException('delete_groups | ' . get_string('groupnotexist', 'auth.webservice', $group['name']));
}
} else {
if (!empty($group['shortname'])) {
if (empty($group['institution'])) {
throw new WebserviceInvalidParameterException('delete_groups | ' . get_string('instmustset', 'auth.webservice', $group['shortname']));
}
if (!($dbgroup = get_record('group', 'shortname', $group['shortname'], 'institution', $group['institution'], 'deleted', 0))) {
throw new WebserviceInvalidParameterException('delete_groups | ' . get_string('groupnotexist', 'auth.webservice', $group['shortname'] . '/' . $group['institution']));
}
} else {
throw new WebserviceInvalidParameterException('delete_groups | ' . get_string('nogroup', 'auth.webservice'));
}
}
}
// are we allowed to delete for this institution
if (!empty($dbgroup->institution)) {
if ($WEBSERVICE_INSTITUTION != $dbgroup->institution) {
throw new WebserviceInvalidParameterException('delete_groups | ' . get_string('accessdeniedforinstgroup', 'auth.webservice', $group['institution'], $group['name']));
}
if (!$USER->can_edit_institution($dbgroup->institution)) {
throw new WebserviceInvalidParameterException('delete_groups | ' . get_string('accessdeniedforinstgroup', 'auth.webservice', $group['institution'], $group['shortname']));
}
}
// now do the delete
group_delete($dbgroup->id);
}
db_commit();
return null;
}
示例5: fud_egw
* $Id: admgroups.php,v 1.2 2003/12/18 16:42:31 iliaa Exp $
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
***************************************************************************/
require './GLOBALS.php';
fud_egw();
fud_use('adm.inc', true);
fud_use('widgets.inc', true);
fud_use('groups_adm.inc', true);
fud_use('groups.inc');
$edit = isset($_GET['edit']) ? (int) $_GET['edit'] : (isset($_POST['edit']) ? (int) $_POST['edit'] : 0);
if (isset($_GET['del'])) {
group_delete((int) $_GET['del']);
}
$hdr = group_perm_array();
$error_reason = $error = 0;
/* check for errors */
if (isset($_POST['btn_submit'])) {
$gr_inherit_id = (int) $_POST['gr_inherit_id'];
if (isset($_POST['gr_resource'])) {
$gr_resource = is_string($_POST['gr_resource']) ? array($_POST['gr_resource']) : array_unique($_POST['gr_resource']);
} else {
$gr_resource = array();
}
$gr_ramasks = (int) (!empty($_POST['gr_ramasks']));
$perm = $permi = 0;
$res = array();
foreach ($hdr as $k => $v) {
示例6: anchor
?>
">
<td class="title">
<?php
echo anchor('groups/set/' . $g['g_id'], $g['g_name']);
?>
</td>
<td><?php
echo $g['user_count'];
?>
</td>
<td class="text-right"><?php
echo group_delete($g);
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<div class="pagination-wrapper">
<?php
示例7: param
$allowthread = param('allowthread', 0);
$allowpost = param('allowpost', 0);
$allowattach = param('allowattach', 0);
$allowdown = param('allowdown', 0);
$allowagree = param('allowagree', 0);
$allowtop = param('allowtop', 0);
$allowupdate = param('allowupdate', 0);
$allowdelete = param('allowdelete', 0);
$allowmove = param('allowmove', 0);
$allowbanuser = param('allowbanuser', 0);
$allowdeleteuser = param('allowdeleteuser', 0);
$allowviewip = param('allowviewip', 0);
$allowcustomurl = param('allowcustomurl', 0);
$arr2 = array('allowread' => $allowread, 'allowthread' => $allowthread, 'allowpost' => $allowpost, 'allowattach' => $allowattach, 'allowdown' => $allowdown, 'allowagree' => $allowagree, 'allowtop' => $allowtop, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete, 'allowmove' => $allowmove, 'allowbanuser' => $allowbanuser, 'allowdeleteuser' => $allowdeleteuser, 'allowviewip' => $allowviewip, 'allowcustomurl' => $allowcustomurl);
$arr += $arr2;
}
// 更新
$r = group_update($gid, $arr);
$r !== FALSE ? message(0, '更新成功') : message(-1, '更新失败');
}
} elseif ($action == 'delete') {
if ($method != 'POST') {
message(-1, 'Method Error.');
}
$gid = param(2, 0);
$group = group_read($gid);
empty($group) and message(1, '用户组不存在');
$gid <= 101 and message(-1, '该用户组不允许删除!');
$r = group_delete($gid);
$r !== FALSE ? message(0, '删除成功') : message(1, '删除失败');
}
示例8: tearDown
/**
* clean out all the test data
*/
protected function tearDown()
{
// fix the connection - this gets lost because of the tests
configure_dbconnection();
// clean down the institution
$this->clean_institution();
// delete test token
if ($this->testtoken) {
delete_records('external_tokens', 'token', $this->testtoken);
}
// remove the web service descriptions
$dbservice = get_record('external_services', 'name', $this->servicename);
if ($dbservice) {
$dbregistry = get_record('oauth_server_registry', 'externalserviceid', $dbservice->id);
if ($dbregistry) {
delete_records('oauth_server_token', 'osr_id_ref', $dbregistry->id);
}
delete_records('oauth_server_registry', 'externalserviceid', $dbservice->id);
delete_records('external_services_users', 'externalserviceid', $dbservice->id);
delete_records('external_tokens', 'externalserviceid', $dbservice->id);
delete_records('external_services_functions', 'externalserviceid', $dbservice->id);
delete_records('external_services', 'id', $dbservice->id);
}
// remove the test user
$dbuser = get_record('usr', 'username', $this->testuser);
if ($dbuser) {
$this->created_users[] = $dbuser->id;
}
// remove all left over users
if ($this->created_users) {
foreach ($this->created_users as $userid) {
delete_user($userid);
}
}
// remove left over groups
$dbgroup = get_record('group', 'shortname', 'mytestgroup1', 'institution', 'mahara');
if ($dbgroup) {
$this->created_groups[] = $dbgroup->id;
}
if ($this->created_groups) {
foreach ($this->created_groups as $groupid) {
group_delete($groupid);
}
}
}
示例9: display_options
//.........这里部分代码省略.........
));
}
break;
case 6:
// Add/remove selected system groups
if ($apply_changes)
{
$group_rows = $existing_groups = array();
get_group_rows($cleaner, $group_rows, $existing_groups);
foreach ($group_rows as $name)
{
// Skip ones that are in the default install and are in the existing permissions
if (isset($cleaner->groups[$name]) && in_array($name, $existing_groups))
{
continue;
}
if (isset($selected[$name]))
{
if (isset($cleaner->groups[$name]) && !in_array($name, $existing_groups))
{
// Add it with the default settings we've got...
$group_id = false;
group_create($group_id, $cleaner->groups[$name]['group_type'], $name, $cleaner->groups[$name]['group_desc'], array('group_colour' => $cleaner->groups[$name]['group_colour'], 'group_legend' => $cleaner->groups[$name]['group_legend'], 'group_avatar' => $cleaner->groups[$name]['group_avatar'], 'group_max_recipients' => $cleaner->groups[$name]['group_max_recipients']));
}
else if (!isset($cleaner->groups[$name]) && in_array($name, $existing_groups))
{
// Remove it
$db->sql_query('SELECT group_id FROM ' . GROUPS_TABLE . ' WHERE group_name = \'' . $name . '\'');
$group_id = $db->sql_fetchfield('group_id');
group_delete($group_id, $name);
}
}
}
}
// Ask if they would like to reset the modules (handled in the template)
$template->assign_vars(array(
'S_MODULE_OPTIONS' => true,
'S_NO_INSTRUCTIONS' => true,
));
break;
case 7 :
// Reset the modules if they wanted to
if (isset($_POST['yes']) && $apply_changes)
{
// Remove existing modules
$db->sql_query('DELETE FROM ' . MODULES_TABLE);
// Add the modules
$db->sql_multi_insert(MODULES_TABLE, $cleaner->modules);
$template->assign_var('SUCCESS_MESSAGE', $user->lang['RESET_MODULE_SUCCESS']);
}
// Ask if they would like to reset the bots (handled in the template)
$template->assign_vars(array(
'S_BOT_OPTIONS' => true,
'S_NO_INSTRUCTIONS' => true,
));
示例10: main
//.........这里部分代码省略.........
$mark_ary[] = $row['user_id'];
} while ($row = $db->sql_fetchrow($result));
group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
$start = sizeof($mark_ary) < 200 ? 0 : $start + 200;
} else {
$start = 0;
}
$db->sql_freeresult($result);
} while ($start);
} else {
group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
}
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id));
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('mark' => $mark_ary, 'g' => $group_id, 'i' => $id, 'mode' => $mode, 'action' => $action)));
}
break;
case 'deleteusers':
case 'delete':
if (!$group_id) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
} else {
if ($action === 'delete' && $group_row['group_type'] == GROUP_SPECIAL) {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
}
if (confirm_box(true)) {
$error = '';
switch ($action) {
case 'delete':
if (!$auth->acl_get('a_groupdel')) {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$error = group_delete($group_id, $group_row['group_name']);
break;
case 'deleteusers':
$group_name = $group_row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
$error = group_user_del($group_id, $mark_ary, false, $group_name);
break;
}
$back_link = $action == 'delete' ? $this->u_action : $this->u_action . '&action=list&g=' . $group_id;
if ($error) {
trigger_error($user->lang[$error] . adm_back_link($back_link), E_USER_WARNING);
}
$message = $action == 'delete' ? 'GROUP_DELETED' : 'GROUP_USERS_REMOVE';
trigger_error($user->lang[$message] . adm_back_link($back_link));
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('mark' => $mark_ary, 'g' => $group_id, 'i' => $id, 'mode' => $mode, 'action' => $action)));
}
break;
case 'addusers':
if (!$group_id) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if (!$name_ary) {
trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING);
}
$name_ary = array_unique(explode("\n", $name_ary));
$group_name = $group_row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
// Add user/s to group
if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, $leader, 0, $group_row)) {
trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING);
}
$message = $leader ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED';
trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&action=list&g=' . $group_id));
break;
示例11: tearDown
/**
* Superclass tearDown method takes care to delete all data that has been created with any of the create_test_ methods.
*
* <b>always</b> call this, even if you override it.
*/
protected function tearDown()
{
foreach ($this->testusers as $userid) {
delete_user($userid);
}
foreach ($this->testgroups as $group) {
group_delete($group);
}
foreach ($this->testinstitutions as $institution) {
delete_records('institution', 'name', $institution);
}
}
示例12: mahara_group_update_group_members
function mahara_group_update_group_members($client)
{
//Set test data
$dbuser1 = $this->create_user1_for_update();
$dbuser2 = $this->create_user2_for_update();
//Test data
//a full group: group1
$group1 = new stdClass();
$group1->name = 'The test group 1 - create';
$group1->shortname = 'testgroupshortname1';
$group1->description = 'a description for test group 1';
$group1->institution = 'mahara';
$group1->grouptype = 'standard';
$group1->open = 1;
$group1->request = 0;
$group1->controlled = 0;
$group1->submitpages = 0;
$group1->public = 0;
$group1->usersautoadded = 0;
$group1->members = array($dbuser1->id => 'admin', $dbuser2->id => 'admin');
//a small group: group2
$group2 = new stdClass();
$group2->shortname = 'testgroupshortname2';
$group2->name = 'The test group 2 - create';
$group2->description = 'a description for test group 2';
$group2->institution = 'mahara';
$group2->grouptype = 'standard';
$group2->open = 1;
$group2->request = 0;
$group2->controlled = 0;
$group2->submitpages = 0;
$group2->public = 0;
$group2->usersautoadded = 0;
$group2->members = array($dbuser1->id => 'admin');
//do not run the test if group1 or group2 already exists
foreach (array($group1->shortname, $group2->shortname) as $shortname) {
$existinggroup = get_record('group', 'shortname', $shortname, 'institution', 'mahara');
if (!empty($existinggroup)) {
group_delete($existinggroup->id);
}
}
// setup test groups
$groupid1 = group_create((array) $group1);
$groupid2 = group_create((array) $group2);
$this->created_groups[] = $groupid1;
$this->created_groups[] = $groupid2;
$dbgroup1 = get_record('group', 'shortname', $group1->shortname, 'institution', 'mahara');
$dbgroup2 = get_record('group', 'shortname', $group2->shortname, 'institution', 'mahara');
//update the test data
$group1 = new stdClass();
$group1->id = $dbgroup1->id;
$group1->shortname = 'testgroupshortname1';
$group1->institution = 'mahara';
$group1->members = array(array('id' => $dbuser1->id, 'action' => 'remove'));
//a small group: group2
$group2 = new stdClass();
$group2->shortname = 'testgroupshortname2';
$group2->institution = 'mahara';
$group2->members = array(array('username' => $dbuser2->username, 'role' => 'admin', 'action' => 'add'));
$groups = array($group1, $group2);
//update the users by web service
$function = 'mahara_group_update_group_members';
$params = array('groups' => $groups);
$client->call($function, $params);
$dbgroup1 = get_record('group', 'id', $groupid1);
$dbgroupmembers1 = get_records_array('group_member', 'group', $dbgroup1->id);
$dbgroup2 = get_record('group', 'id', $groupid2);
$dbgroupmembers2 = get_records_array('group_member', 'group', $dbgroup2->id);
//compare DB group with the test data
// current user added as admin
$this->assertEquals(count($dbgroupmembers1), 1);
// current user added as admin
$this->assertEquals(count($dbgroupmembers2), 2);
}
示例13: group_received_create
}
global $DOCUMENT_ROOT, $action, $id;
include $DOCUMENT_ROOT . '/admin/inc/menu.php';
include '../menu.php';
$manage_menu->SetActive('usergroup');
$usergroup_menu->SetActive('group');
if ($action == 'create') {
group_received_create();
}
/* Printing da page */
print $manage_menu->InnerHTML();
print $usergroup_menu->InnerHTML();
print '${information}';
/* Print the create form */
if ($action == 'edit') {
include 'edit.php';
} else {
if ($action == 'save') {
group_update($id);
} else {
if ($action == 'delete') {
group_delete($id);
}
}
$list = group_list();
if (count($list) > 0) {
include 'list.php';
}
/* Print the create form */
include 'create_form.php';
}
示例14: groups
/**
* Correct the system groups
*/
function groups(&$error, $selected)
{
global $db;
$data = $group_rows = $existing_groups = array();
get_group_rows($data, $group_rows, $existing_groups);
foreach ($group_rows as $name) {
// Skip ones that are in the default install and are in the existing permissions
if (isset($this->db_cleaner->data->groups[$name]) && in_array($name, $existing_groups)) {
continue;
}
if (isset($selected[$name])) {
if (isset($this->db_cleaner->data->groups[$name]) && !in_array($name, $existing_groups)) {
// Add it with the default settings we've got...
$group_id = false;
group_create($group_id, $this->db_cleaner->data->groups[$name]['group_type'], $name, $this->db_cleaner->data->groups[$name]['group_desc'], array('group_colour' => $this->db_cleaner->data->groups[$name]['group_colour'], 'group_legend' => $this->db_cleaner->data->groups[$name]['group_legend'], 'group_avatar' => $this->db_cleaner->data->groups[$name]['group_avatar'], 'group_max_recipients' => $this->db_cleaner->data->groups[$name]['group_max_recipients']));
} else {
if (!isset($this->db_cleaner->data->groups[$name]) && in_array($name, $existing_groups)) {
if (!function_exists('group_delete')) {
include PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT;
}
// Remove it
$db->sql_query('SELECT group_id FROM ' . GROUPS_TABLE . ' WHERE group_name = \'' . $db->sql_escape($name) . '\'');
$group_id = $db->sql_fetchfield('group_id');
group_delete($group_id, $name);
}
}
}
}
}
示例15: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
$user->add_lang('acp/groups');
$this->tpl_name = 'acp_groups';
$this->page_title = 'ACP_GROUPS_MANAGE';
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
// Check and set some common vars
$action = isset($_POST['add']) ? 'add' : (isset($_POST['addusers']) ? 'addusers' : request_var('action', ''));
$group_id = request_var('g', 0);
$mark_ary = request_var('mark', array(0));
$name_ary = request_var('usernames', '');
$leader = request_var('leader', 0);
$default = request_var('default', 0);
$start = request_var('start', 0);
$update = isset($_POST['update']) ? true : false;
// Clear some vars
$can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $file_uploads ? true : false;
$group_row = array();
// Grab basic data for group, if group_id is set and exists
if ($group_id) {
$sql = 'SELECT *
FROM ' . GROUPS_TABLE . " \n\t\t\t\tWHERE group_id = {$group_id}";
$result = $db->sql_query($sql);
$group_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$group_row) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action));
}
}
// Which page?
switch ($action) {
case 'approve':
case 'demote':
case 'promote':
if (!$group_id) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action));
}
// Approve, demote or promote
group_user_attributes($action, $group_id, $mark_ary, false, $group_id ? $group_row['group_name'] : false);
switch ($action) {
case 'demote':
$message = 'GROUP_MODS_DEMOTED';
break;
case 'promote':
$message = 'GROUP_MODS_PROMOTED';
break;
case 'approve':
$message = 'USERS_APPROVED';
break;
}
trigger_error($user->lang[$message] . adm_back_link($this->u_action));
break;
case 'default':
if (!$group_id) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action));
}
if (confirm_box(true)) {
if (!sizeof($mark_ary)) {
$start = 0;
do {
$sql = 'SELECT user_id
FROM ' . USER_GROUP_TABLE . "\n\t\t\t\t\t\t\t\tWHERE group_id = {$group_id} \n\t\t\t\t\t\t\t\tORDER BY user_id";
$result = $db->sql_query_limit($sql, 200, $start);
$mark_ary = array();
if ($row = $db->sql_fetchrow($result)) {
do {
$mark_ary[] = $row['user_id'];
} while ($row = $db->sql_fetchrow($result));
group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
$start = sizeof($mark_ary) < 200 ? 0 : $start + 200;
} else {
$start = 0;
}
$db->sql_freeresult($result);
} while ($start);
} else {
group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
}
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action));
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('mark' => $mark_ary, 'g' => $group_id, 'i' => $id, 'mode' => $mode, 'action' => $action)));
}
break;
case 'deleteusers':
case 'delete':
if (confirm_box(true)) {
if (!$group_id) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action));
}
$error = '';
switch ($action) {
case 'delete':
if (!$auth->acl_get('a_groupdel')) {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action));
}
$error = group_delete($group_id, $group_row['group_name']);
break;
case 'deleteusers':
//.........这里部分代码省略.........