function _moduleContent(&$smarty, $module_name) { //global variables global $arrConf; global $arrConfModule; $arrConf = array_merge($arrConf, $arrConfModule); $pDB = new paloDB($arrConf['elastix_dsn']['elastix']); //folder path for custom templates $local_templates_dir = getWebDirModule($module_name); //user credentials global $arrCredentials; $userLevel1 = $arrCredentials['userlevel']; $userAccount = $_SESSION['elastix_user']; $idOrganization = $arrCredentials['id_organization']; $action = getAction(); $content = ""; switch ($action) { case "new_group": $content = viewFormGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); break; case "view": $content = viewFormGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); break; case "view_edit": $content = viewFormGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); break; case "save_new": $content = saveNewGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); break; case "save_edit": $content = saveEditGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); break; case "delete": $content = deleteGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); break; default: // report $content = reportGroup($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $userLevel1, $userAccount, $idOrganization); break; } return $content; }
public function json_RemoveGroup() { $data = json_decode(file_get_contents('php://input'), true); $data['username'] = user_decrypt($data['username']); $check = $this->checkInput($data, array('username', 'gid')); if ($check == '') { $return['error'] = deleteGroup($data['gid'], $data['username']); if ($return['error'] == 0) { $return['value'] = "Successfully removed"; } elseif ($return['error'] == -1) { $return['value'] = "Cannot remove: Don't have owner privileges"; } elseif ($return['error'] == -2) { $return['value'] = "Not a member of this group"; } else { $return['value'] = "Something has gone terribly wrong"; } } else { $return['error'] = -3; $return['value'] = $check; } $jsonstring = json_encode($return); echo $jsonstring; }
"></p> </form> <?php } if (!$_SESSION["user_id"]) { mysql_close($link); header("Location: " . $path . "login.php?return_to=" . $PHP_SELF); } else { include "includes/header.php"; $query = mysql_query("SELECT add_groups from " . $table_prefix . "users where user_id = " . $_SESSION["user_id"] . " limit 1"); $row = mysql_fetch_row($query); if ($row[0] == 1) { $edit = true; } else { echo "<p class=\"warning\">" . $lang["not_authorized_edit_groups"] . "</p>\n"; } } if ($edit) { switch ($_REQUEST["mode"]) { case "edit_group": editGroup($id); break; case "delete_group": deleteGroup($id); break; default: showGroups(); break; } } include "includes/footer.php";
if ($type == "readRulesets") { $rulesets = readRulesets($conn); $message = "Rules read."; } else { if ($type == "addGroup") { $message = addGroup($conn); $groups = readGroups($conn); } else { if ($type == "editGroup") { $message = editGroup($conn); $groups = readGroups($conn); $players = readPlayers($conn); $records = readRecords($conn); } else { if ($type == "deleteGroup") { $message = deleteGroup($conn); $groups = readGroups($conn); } else { if ($type == "addPlayer") { $message = addPlayer($conn); $players = readPlayers($conn); } else { if ($type == "editPlayer") { $message = editPlayer($conn); $players = readPlayers($conn); $characters = readCharacters($conn); } else { if ($type == "deletePlayer") { $message = deletePlayer($conn); $players = readPlayers($conn); } else {
<?php //falta por aqui algum html para perguntar se o gajo quer mm apagar a poll include 'database/polls_fetch.php'; include 'database/polls_modify.php'; $group_id = $_POST['group_id']; deleteGroup($group_id); header("Location:manage_polls.php");
<?php \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('ownnote'); require_once 'ownnote/lib/backend.php'; echo deleteGroup("Notes", $_POST['group']); ?>
function deleteRack() { assertUIntArg('rack_id'); $rackData = spotEntity('rack', $_REQUEST['rack_id']); ############################################################################################### # delete zabbix group $result = deleteGroup($rackData["name"]); if (isset($result["error"])) { showError("Deleting zabbix group is failed. Error message:" . $result["error"]); } # END ############################################################################################### amplifyCell($rackData); if (count($rackData['mountedObjects'])) { showFuncMessage(__FUNCTION__, 'ERR1'); return; } releaseFiles('rack', $_REQUEST['rack_id']); destroyTagsForEntity('rack', $_REQUEST['rack_id']); usePreparedDeleteBlade('RackSpace', array('rack_id' => $_REQUEST['rack_id'])); commitDeleteObject($_REQUEST['rack_id']); resetRackSortOrder($rackData['row_id']); showFuncMessage(__FUNCTION__, 'OK', array($rackData['name'])); ############################################################################################## # delete position information from DB usePreparedDeleteBlade('rack_position', array('rack_id' => $_REQUEST["rack_id"])); # delete airconditioner information from DB usePreparedDeleteBlade('rack_airconditioner', array('rack_id' => $_REQUEST["rack_id"])); ############################################################################################## return buildRedirectURL('rackspace', 'default'); }
<?php /*+******************************************************************************** ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 * ("License"); You may not use this file except in compliance with the License * The Original Code is: vtiger CRM Open Source * The Initial Developer of the Original Code is vtiger. * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. ********************************************************************************/ require_once 'include/utils/UserInfoUtil.php'; global $adb; $del_id = vtlib_purify($_REQUEST['delete_group_id']); $transfer_group_id = vtlib_purify($_REQUEST['transfer_group_id']); $assignType = vtlib_purify($_REQUEST['assigntype']); if ($assignType == 'T') { $transferId = vtlib_purify($_REQUEST['transfer_group_id']); } elseif ($assignType == 'U') { $transferId = vtlib_purify($_REQUEST['transfer_user_id']); } //Updating the user2 vtiger_role vtiger_table deleteGroup($del_id, $transferId); header("Location: index.php?action=listgroups&module=Settings&parenttab=Settings");
} ?> <form action="?category=admin/groups" method="post"><p>Nazwa grupy: <input type="text" maxlength="30" size="16" name="group" /> <input type="submit" name="addgroup" value="Dodaj" /></p></form> <hr /> <hr /> <h3>Istniejące grupy</h3> <?php if ($action == 'delete') { if (!empty($_GET['id'])) { $id = clearVariable($_GET['id']); $deleteStatus; include('php/deletegroup.php'); $deleteStatus = deleteGroup($id); echo $deleteStatus; } } ?> <table cellpadding="0" cellspacing="2"> <tr> <th>Id</th> <th>Nazwa grupy</th> <th>Ilość użyt.</th> </tr> <?php // wywołanie funkcji łączącej się z bazą $database = connectDatabase();
$options['owner'] = "zhangsan"; $options['members'] = array("wangwu", "lisi"); var_dump(createGroup($options)); break; case 45: //修改群组信息 $group_id = "124113058216804760"; $options['groupname'] = "group002"; $options['description'] = "修改群描述"; $options['maxusers'] = 300; var_dump(modifyGroupInfo($group_id, $options)); break; case 46: //删除群组 $group_id = "124113058216804760"; var_dump(deleteGroup($group_id)); break; case 47: //获取群组中的成员 $group_id = "122633509780062768"; var_dump(getGroupUsers($group_id)); break; case 48: //群组单个加人----------- $group_id = "122633509780062768"; $username = "******"; var_dump(addGroupMember($group_id, $username)); break; case 49: //群组批量加人 $group_id = "122633509780062768";
$rv = array(); $rv['result'] = array(); //result foreach ($data['group']['defs'] as $recID => $rt) { array_push($rv['result'], updateUserGroup('group', $colNames, $recID, null, $rt)); } break; case 'deleteGroup': $rv = array(); if (!$recID) { $rv['error'] = "invalid or not ID sent with deleteGroup method call to saveUsergrps.php"; } else { if (intval($recID) == 2) { $rv['error'] = "Can't delete system group 'Database Managers'"; } else { $rv = deleteGroup($recID); } } break; case 'changeRole': $recIds = @$_REQUEST['recIDs']; $newRole = @$_REQUEST['role']; $oldRole = @$_REQUEST['oldrole']; if (!$recID || !$recIds || !$newRole) { $rv = array(); $rv['error'] = "invalid or not IDs sent with changeRole method call to saveUsergrps.php"; } else { $rv = changeRole($recID, $recIds, $newRole, $oldRole, true, true); if (!array_key_exists('error', $rv)) { //$rv['rectypes'] = getAllRectypeStructures(); }
deleteDepartment($_POST["dep_id"]); //edit category } else { if ($_POST["procedure"] == "EDIT_DEPARTMENT") { editDepartment($_POST["dep_id"], $_POST["dep_newName"]); } } } //################ Job Group Functions ############## //add group if ($_POST["procedure"] == "ADD_GROUP") { addGroup($_POST["grp_name"], $_POST["dep_id"]); //delete group } else { if ($_POST["procedure"] == "DELETE_GROUP") { deleteGroup($_POST["grp_id"]); //edit group } else { if ($_POST["procedure"] == "EDIT_GROUP") { editGroup($_POST["grp_id"], $_POST["grp_newName"]); } } } $pageTitle = "Manage Jobs"; $javascript = "manageJobs.js"; require 'includes/adminHeader.php'; ?> <br> <div class="tabs">
<?php include "adminapi.php"; $id = $_GET['id']; if (!isset($_POST["id"])) { if (!isset($_GET["id"])) { return header("Location: index.php"); } } else { $rs = deleteGroup($id); if ($rs == true) { header("Location: index.php"); } } $form = findGroupById($id); $pageTitle = "Deleting Group: {$form['name']}"; $pageInfo = ""; $submitPage = $_SERVER["REQUEST_URI"]; $submitLabel = "Delete Group"; include 'header.php'; ?> <body id="edit_organization" class="organizations"> <?php make_navbar('Groups'); ?> <div id="body" class="wrap"> <h3><?php echo $pageTitle; ?> </h3> <form name="viewGroupForm" method="post" action="<?php
function groupManagementForm($currentUserId, $modifiableGroups, &$pagePath) { require_once "group.lib.php"; global $ICONS; global $urlRequestRoot, $cmsFolder, $templateFolder, $moduleFolder, $sourceFolder; $scriptsFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts"; $imagesFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/images"; /// Parse any get variables, do necessary validation and stuff, so that we needn't check inside every if $groupRow = $groupId = $userId = null; $subAction = ''; //isset($_GET['subaction']) ? $_GET['subaction'] : ''; if (isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'editgroup' && isset($_GET['groupname']) || isset($_POST['btnEditGroup']) && isset($_POST['selEditGroups'])) { $subAction = 'showeditform'; } elseif (isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'associateform') { $subAction = 'associateform'; } elseif (isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'deleteuser' && isset($_GET['groupname']) && isset($_GET['useremail'])) { $subAction = 'deleteuser'; } elseif (isset($_POST['btnAddUserToGroup'])) { $subAction = 'addusertogroup'; } elseif (isset($_POST['btnSaveGroupProperties'])) { $subAction = 'savegroupproperties'; } elseif (isset($_POST['btnEditGroupPriorities']) || isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'editgrouppriorities') { $subAction = 'editgrouppriorities'; } if (isset($_POST['selEditGroups']) || isset($_GET['groupname'])) { $groupRow = getGroupRow(isset($_POST['selEditGroups']) ? escape($_POST['selEditGroups']) : escape($_GET['groupname'])); $groupId = $groupRow['group_id']; if ($subAction != 'editgrouppriorities' && (!$groupRow || !$groupId || $groupId < 2)) { displayerror('Error! Invalid group requested.'); return; } if (!is_null($groupId)) { if ($modifiableGroups[count($modifiableGroups) - 1]['group_priority'] < $groupRow['group_priority']) { displayerror('You do not have the permission to modify the selected group.'); return ''; } } } if (isset($_GET['useremail'])) { $userId = getUserIdFromEmail($_GET['useremail']); } if ($subAction != 'editgrouppriorities' && (isset($_GET['subaction']) && $_GET['subaction'] == 'editgroups' && !is_null($groupId))) { if ($subAction == 'deleteuser') { if ($groupRow['form_id'] != 0) { displayerror('The group is associated with a form. To remove a user, use the edit registrants in the assoicated form.'); } elseif (!$userId) { displayerror('Unknown E-mail. Could not find a registered user with the given E-mail Id'); } else { $deleteQuery = 'DELETE FROM `' . MYSQL_DATABASE_PREFIX . 'usergroup` WHERE `user_id` = \'' . $userId . '\' AND `group_id` = ' . $groupId; $deleteResult = mysql_query($deleteQuery); if (!$deleteResult || mysql_affected_rows() != 1) { displayerror('Could not delete user with the given E-mail from the given group.'); } else { displayinfo('Successfully removed user from the current group'); if ($userId == $currentUserId) { $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagePath, $currentUserId, array_reverse(getGroupIds($currentUserId)), $virtue); $modifiableGroups = getModifiableGroups($currentUserId, $maxPriorityGroup, $ordering = 'asc'); } } } } elseif ($subAction == 'savegroupproperties' && isset($_POST['txtGroupDescription'])) { $updateQuery = "UPDATE `" . MYSQL_DATABASE_PREFIX . "groups` SET `group_description` = '" . escape($_POST['txtGroupDescription']) . "' WHERE `group_id` = '{$groupId}'"; $updateResult = mysql_query($updateQuery); if (!$updateResult) { displayerror('Could not update database.'); } else { displayinfo('Changes to the group have been successfully saved.'); } $groupRow = getGroupRow($groupRow['group_name']); } elseif ($subAction == 'addusertogroup' && isset($_POST['txtUserEmail']) && trim($_POST['txtUserEmail']) != '') { if ($groupRow['form_id'] != 0) { displayerror('The selected group is associated with a form. To add a user, register the user to the form.'); } else { $passedEmails = explode(',', escape($_POST['txtUserEmail'])); for ($i = 0; $i < count($passedEmails); $i++) { $hyphenPos = strpos($passedEmails[$i], '-'); if ($hyphenPos >= 0) { $userEmail = trim(substr($passedEmails[$i], 0, $hyphenPos - 1)); } else { $userEmail = escape($_POST['txtUserEmail']); } $userId = getUserIdFromEmail($userEmail); if (!$userId || $userId < 1) { displayerror('Unknown E-mail. Could not find a registered user with the given E-mail Id'); } if (!addUserToGroupName($groupRow['group_name'], $userId)) { displayerror('Could not add the given user to the current group.'); } else { displayinfo('User has been successfully inserted into the given group.'); } } } } elseif ($subAction == 'associateform') { if (isset($_POST['btnAssociateGroup'])) { $pageIdArray = array(); $formPageId = parseUrlReal(escape($_POST['selFormPath']), $pageIdArray); if ($formPageId <= 0 || getPageModule($formPageId) != 'form') { displayerror('Invalid page selected! The page you selected is not a form.'); } elseif (!getPermissions($currentUserId, $formPageId, 'editregistrants', 'form')) { displayerror('You do not have the permissions to associate the selected form with a group.'); } else { $formModuleId = getModuleComponentIdFromPageId($formPageId, 'form'); require_once "{$sourceFolder}/{$moduleFolder}/form.lib.php"; if (isGroupEmpty($groupId) || form::getRegisteredUserCount($formModuleId) == 0) { associateGroupWithForm($groupId, $formModuleId); $groupRow = getGroupRow($groupRow['group_name']); } else { displayerror('Both the group and the form already contain registered users, and the group cannot be associated with the selected form.'); } } } elseif (isset($_POST['btnUnassociateGroup'])) { if ($groupRow['form_id'] <= 0) { displayerror('The selected group is currently not associated with any form.'); } elseif (!getPermissions($currentUserId, getPageIdFromModuleComponentId('form', $groupRow['form_id']), 'editregistrants', 'form')) { displayerror('You do not have the permissions to unassociate the form from this group.'); } else { unassociateFormFromGroup($groupId); $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagePath, $currentUserId, array_reverse(getGroupIds($currentUserId)), $virtue); $modifiableGroups = getModifiableGroups($currentUserId, $maxPriorityGroup, $ordering = 'asc'); $groupRow = getGroupRow($groupRow['group_name']); } } } if ($modifiableGroups[count($modifiableGroups) - 1]['group_priority'] < $groupRow['group_priority']) { displayerror('You do not have the permission to modify the selected group.'); return ''; } $usersTable = '`' . MYSQL_DATABASE_PREFIX . 'users`'; $usergroupTable = '`' . MYSQL_DATABASE_PREFIX . 'usergroup`'; $userQuery = "SELECT `user_email`, `user_fullname` FROM {$usergroupTable}, {$usersTable} WHERE `group_id` = '{$groupId}' AND {$usersTable}.`user_id` = {$usergroupTable}.`user_id` ORDER BY `user_email`"; $userResult = mysql_query($userQuery); if (!$userResult) { displayerror('Error! Could not fetch group information.'); return ''; } $userEmails = array(); $userFullnames = array(); while ($userRow = mysql_fetch_row($userResult)) { $userEmails[] = $userRow[0]; $userFullnames[] = $userRow[1]; } $groupEditForm = <<<GROUPEDITFORM \t\t\t<h2>Group '{$groupRow['group_name']}' - '{$groupRow['group_description']}'</h2><br /> \t\t\t<fieldset style="padding: 8px"> \t\t\t\t<legend>{$ICONS['User Groups']['small']}Group Properties</legend> \t\t\t\t<form name="groupeditform" method="POST" action="./+admin&subaction=editgroups&groupname={$groupRow['group_name']}"> \t\t\t\t\tGroup Description: <input type="text" name="txtGroupDescription" value="{$groupRow['group_description']}" /> \t\t\t\t\t<input type="submit" name="btnSaveGroupProperties" value="Save Group Properties" /> \t\t\t\t</form> \t\t\t</fieldset> \t\t\t<br /> \t\t\t<fieldset style="padding: 8px"> \t\t\t\t<legend>{$ICONS['User Groups']['small']}Existing Users in Group:</legend> GROUPEDITFORM; $userCount = mysql_num_rows($userResult); global $urlRequestRoot, $cmsFolder, $templateFolder, $sourceFolder; $deleteImage = "<img src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/edit-delete.png\" alt=\"Remove user from the group\" title=\"Remove user from the group\" />"; for ($i = 0; $i < $userCount; $i++) { $isntAssociatedWithForm = $groupRow['form_id'] == 0; if ($isntAssociatedWithForm) { $groupEditForm .= '<a onclick="return confirm(\'Are you sure you wish to remove this user from this group?\')" href="./+admin&subaction=editgroups&subsubaction=deleteuser&groupname=' . $groupRow['group_name'] . '&useremail=' . $userEmails[$i] . '">' . $deleteImage . "</a>"; } $groupEditForm .= " {$userEmails[$i]} - {$userFullnames[$i]}<br />\n"; } $associateForm = ''; if ($groupRow['form_id'] == 0) { $associableForms = getAssociableFormsList($currentUserId, !isGroupEmpty($groupId)); $associableFormCount = count($associableForms); $associableFormsBox = '<select name="selFormPath">'; for ($i = 0; $i < $associableFormCount; ++$i) { $associableFormsBox .= '<option value="' . $associableForms[$i][2] . '">' . $associableForms[$i][1] . ' - ' . $associableForms[$i][2] . '</option>'; } $associableFormsBox .= '</select>'; $associateForm = <<<GROUPASSOCIATEFORM \t\t\tSelect a form to associate the group with: {$associableFormsBox} \t\t\t<input type="submit" name="btnAssociateGroup" value="Associate Group with Form" /> GROUPASSOCIATEFORM; } else { $associatedFormPageId = getPageIdFromModuleComponentId('form', $groupRow['form_id']); $associateForm = 'This group is currently associated with the form: ' . getPageTitle($associatedFormPageId) . ' (' . getPagePath($associatedFormPageId) . ')<br />' . '<input type="submit" name="btnUnassociateGroup" value="Unassociate" />'; } $groupEditForm .= '</fieldset>'; if ($groupRow['form_id'] == 0) { $groupEditForm .= <<<GROUPEDITFORM \t\t\t\t<br /> \t\t\t\t<fieldset style="padding: 8px"> \t\t\t\t\t<legend>{$ICONS['Add']['small']}Add Users to Group</legend> \t\t\t\t\t<form name="addusertogroup" method="POST" action="./+admin&subaction=editgroups&groupname={$groupRow['group_name']}"> \t\t\t\t\t\tEmail ID: <input type="text" name="txtUserEmail" id="txtUserEmail" value="" style="width: 256px" autocomplete="off" /> \t\t\t\t\t\t<div id="suggestionDiv" class="suggestionbox"></div> \t\t\t\t\t\t<script language="javascript" type="text/javascript" src="{$scriptsFolder}/ajaxsuggestionbox.js"></script> \t\t\t\t\t\t<script language="javascript" type="text/javascript"> \t\t\t\t\t\t<!-- \t\t\t\t\t\t\tvar addUserBox = new SuggestionBox(document.getElementById('txtUserEmail'), document.getElementById('suggestionDiv'), "./+admin&doaction=getsuggestions&forwhat=%pattern%"); \t\t\t\t\t\t\taddUserBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t--> \t\t\t\t\t\t</script> \t\t\t\t\t\t<input type="submit" name="btnAddUserToGroup" value="Add User to Group" /> \t\t\t\t\t</form> \t\t\t\t</fieldset> GROUPEDITFORM; } $groupEditForm .= <<<GROUPEDITFORM \t\t\t<br /> \t\t\t<fieldset style="padding: 8px"> \t\t\t\t<legend>{$ICONS['Group Associate Form']['small']}Associate With Form</legend> \t\t\t\t<form name="groupassociationform" action="./+admin&subaction=editgroups&subsubaction=associateform&groupname={$groupRow['group_name']}" method="POST"> \t\t\t\t\t{$associateForm} \t\t\t\t</form> \t\t\t</fieldset> GROUPEDITFORM; return $groupEditForm; } if ($subAction == 'editgrouppriorities') { $modifiableCount = count($modifiableGroups); $userMaxPriority = $maxPriorityGroup = 1; if ($modifiableCount != 0) { $userMaxPriority = max($modifiableGroups[0]['group_priority'], $modifiableGroups[$modifiableCount - 1]['group_priority']); $maxPriorityGroup = $modifiableGroups[0]['group_priority'] > $modifiableGroups[$modifiableCount - 1]['group_priority'] ? $modifiableGroups[0]['group_id'] : $modifiableGroups[$modifiableCount - 1]['group_id']; } if (isset($_GET['dowhat']) && !is_null($groupId)) { if ($_GET['dowhat'] == 'incrementpriority' || $_GET['dowhat'] == 'decrementpriority') { shiftGroupPriority($currentUserId, $groupRow['group_name'], $_GET['dowhat'] == 'incrementpriority' ? 'up' : 'down', $userMaxPriority, true); } elseif ($_GET['dowhat'] == 'movegroupup' || $_GET['dowhat'] == 'movegroupdown') { shiftGroupPriority($currentUserId, $groupRow['group_name'], $_GET['dowhat'] == 'movegroupup' ? 'up' : 'down', $userMaxPriority, false); } elseif ($_GET['dowhat'] == 'emptygroup') { emptyGroup($groupRow['group_name']); } elseif ($_GET['dowhat'] == 'deletegroup') { if (deleteGroup($groupRow['group_name'])) { $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagePath, $currentUserId, array_reverse(getGroupIds($currentUserId)), $virtue); $modifiableGroups = getModifiableGroups($currentUserId, $maxPriorityGroup, $ordering = 'asc'); } } $modifiableGroups = reevaluateGroupPriorities($modifiableGroups); } elseif (isset($_GET['dowhat']) && $_GET['dowhat'] == 'addgroup') { if (isset($_POST['txtGroupName']) && isset($_POST['txtGroupDescription']) && isset($_POST['selGroupPriority'])) { $existsQuery = 'SELECT `group_id` FROM `' . MYSQL_DATABASE_PREFIX . "groups` WHERE `group_name` = '" . escape($_POST['txtGroupName']) . "'"; $existsResult = mysql_query($existsQuery); if (trim($_POST['txtGroupName']) == '') { displayerror('Cannot create a group with an empty name. Please type in a name for the new group.'); } elseif (mysql_num_rows($existsResult) >= 1) { displayerror('A group with the name you specified already exists.'); } else { $idQuery = 'SELECT MAX(`group_id`) FROM `' . MYSQL_DATABASE_PREFIX . 'groups`'; $idResult = mysql_query($idQuery); $idRow = mysql_fetch_row($idResult); $newGroupId = 2; if (!is_null($idRow[0])) { $newGroupId = $idRow[0] + 1; } $newGroupPriority = 1; if ($_POST['selGroupPriority'] <= $userMaxPriority && $_POST['selGroupPriority'] > 0) { $newGroupPriority = escape($_POST['selGroupPriority']); } $addGroupQuery = 'INSERT INTO `' . MYSQL_DATABASE_PREFIX . 'groups` (`group_id`, `group_name`, `group_description`, `group_priority`) ' . "VALUES({$newGroupId}, '" . escape($_POST['txtGroupName']) . "', '" . escape($_POST['txtGroupDescription']) . "', '{$newGroupPriority}')"; $addGroupResult = mysql_query($addGroupQuery); if ($addGroupResult) { displayinfo('New group added successfully.'); if (isset($_POST['chkAddMe'])) { $insertQuery = 'INSERT INTO `' . MYSQL_DATABASE_PREFIX . "usergroup`(`user_id`, `group_id`) VALUES ('{$currentUserId}', '{$newGroupId}')"; if (!mysql_query($insertQuery)) { displayerror('Error adding user to newly created group: ' . $insertQuery . '<br />' . mysql_query()); } } $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagePath, $currentUserId, array_reverse(getGroupIds($currentUserId)), $virtue); $modifiableGroups = getModifiableGroups($currentUserId, $maxPriorityGroup, $ordering = 'asc'); } else { displayerror('Could not run MySQL query. New group could not be added.'); } } } $modifiableGroups = reevaluateGroupPriorities($modifiableGroups); } $modifiableCount = count($modifiableGroups); if ($modifiableGroups[0]['group_priority'] < $modifiableGroups[$modifiableCount - 1]['group_priority']) { $modifiableGroups = array_reverse($modifiableGroups); } $previousPriority = $modifiableGroups[0]['group_priority']; global $cmsFolder, $urlRequestRoot, $moduleFolder, $templateFolder, $sourceFolder; $iconsFolderUrl = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16"; $moveUpImage = '<img src="' . $iconsFolderUrl . '/actions/go-up.png" title="Increment Group Priority" alt="Increment Group Priority" />'; $moveDownImage = '<img src="' . $iconsFolderUrl . '/actions/go-down.png" alt="Decrement Group Priority" title="Decrement Group Priority" />'; $moveTopImage = '<img src="' . $iconsFolderUrl . '/actions/go-top.png" alt="Move to next higher priority level" title="Move to next higher priority level" />'; $moveBottomImage = '<img src="' . $iconsFolderUrl . '/actions/go-bottom.png" alt="Move to next lower priority level" title="Move to next lower priority level" />'; $emptyImage = '<img src="' . $iconsFolderUrl . '/actions/edit-clear.png" alt="Empty Group" title="Empty Group" />'; $deleteImage = '<img src="' . $iconsFolderUrl . '/actions/edit-delete.png" alt="Delete Group" title="Delete Group" />'; $groupsForm = '<h3>Edit Group Priorities</h3><br />'; for ($i = 0; $i < $modifiableCount; $i++) { if ($modifiableGroups[$i]['group_priority'] != $previousPriority) { $groupsForm .= '<br /><br /><hr /><br />'; } $groupsForm .= '<span style="margin: 4px;" title="' . $modifiableGroups[$i]['group_description'] . '">' . '<a href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=incrementpriority&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $moveUpImage . '</a>' . '<a href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=decrementpriority&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $moveDownImage . '</a>' . '<a href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=movegroupup&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $moveTopImage . '</a>' . '<a href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=movegroupdown&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $moveBottomImage . '</a>' . '<a onclick="return confirm(\'Are you sure you want to empty this group?\')" href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=emptygroup&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $emptyImage . '</a>' . '<a onclick="return confirm(\'Are you sure you want to delete this group?\')" href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=deletegroup&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $deleteImage . '</a>' . '<a href="./+admin&subaction=editgroups&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $modifiableGroups[$i]['group_name'] . "</a></span>\n"; $previousPriority = $modifiableGroups[$i]['group_priority']; } $priorityBox = '<option value="1">1</option>'; for ($i = 2; $i <= $userMaxPriority; ++$i) { $priorityBox .= '<option value="' . $i . '">' . $i . '</option>'; } $groupsForm .= <<<GROUPSFORM \t\t<br /><br /> \t\t<fieldset style="padding: 8px"> \t\t\t<legend>Create New Group:</legend> \t\t\t<form name="groupaddform" method="POST" action="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=addgroup"> \t\t\t\t<label>Group Name: <input type="text" name="txtGroupName" value="" /></label><br /> \t\t\t\t<label>Group Description: <input type="text" name="txtGroupDescription" value="" /></label><br /> \t\t\t\t<label>Group Priority: <select name="selGroupPriority">{$priorityBox}</select><br /> \t\t\t\t<label><input type="checkbox" name="chkAddMe" value="addme" /> Add me to group</label><br /> \t\t\t\t<input type="submit" name="btnAddNewGroup" value="Add Group" /> \t\t\t</form> \t\t</fieldset> GROUPSFORM; return $groupsForm; } $modifiableCount = count($modifiableGroups); $groupsBox = '<select name="selEditGroups">'; for ($i = 0; $i < $modifiableCount; ++$i) { $groupsBox .= '<option value="' . $modifiableGroups[$i]['group_name'] . '">' . $modifiableGroups[$i]['group_name'] . ' - ' . $modifiableGroups[$i]['group_description'] . "</option>\n"; } $groupsBox .= '</select>'; $groupsForm = <<<GROUPSFORM \t\t<form name="groupeditform" method="POST" action="./+admin&subaction=editgroups"> \t\t\t{$groupsBox} \t\t\t<input type="submit" name="btnEditGroup" value="Edit Selected Group" /><br /><br /> \t\t\t<input type="submit" name="btnEditGroupPriorities" value="Add/Shuffle/Remove Groups" /> \t\t</form> GROUPSFORM; return $groupsForm; }
$errors[] = lang("GROUP_USER_ADD_FAILED"); } } } } else { if ($form == "deleteUser") { $user_id = $_POST["userId"]; $deleted = deleteGroupMember($groupId, $user_id); if ($deleted) { $successes[] = lang("GROUP_USER_UNSUBSCRIBE"); } else { $errors[] = lang("GROUP_USER_UNSUBSCRIBE_FAILED"); } } else { if ($form == "deleteGroup") { $deleted = deleteGroup($groupId); if ($deleted) { $successes[] = lang("GROUP_DELETED"); } else { $errors[] = lang("GROUP_DELETE_FAILED"); } } } } } //Fetch information of specific group $groupData = fetchGroupDetail($loggedInUser->user_id, $groupId); //Fetch member of specific group $memberData = fetchGroupMember($groupId); require_once "{$path}/models/header.php"; ?>
} $error = ""; $success = ""; if (strlen($_SESSION['response']['group']['error']) > 0) { $error = '<div ng-show="authMsg" class="alert alert-danger text-center ng-binding">' . $_SESSION['response']['group']['error'] . '</div>'; } else { if (strlen($_SESSION['response']['group']['success']) > 0) { $success = '<div ng-show="authMsg" class="alert alert-success text-center ng-binding">' . $_SESSION['response']['group']['success'] . '</div>'; } } unset($_SESSION['response']['group']['error']); unset($_SESSION['response']['group']['success']); $PAGE = "VIEW_GROUP"; $user = $_SESSION['user']; if (isset($_GET['id'])) { deleteGroup($user['id'], $_GET['id']); } $group = getGroupsByUserId($user['id']); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>View Group(s)</title> <?php require_once dirname(__FILE__) . "/../include/header.tpl.php"; ?>
protected function delete_id_handler() { deleteGroup($this->id); header('Location: ' . filter_input(INPUT_SERVER, 'PHP_SELF')); return false; }
<?php if (isset($_POST["box_groups"])) { foreach ($_POST["box_groups"] as $f_groupid) { deleteGroup((int) $f_groupid); } } else { $f_groupid = (int) readGetVar('groupid'); deleteGroup($f_groupid); } gotoLocation('groups.php' . getURLAddon('', array('action', 'confirmed'))); function deleteGroup($i_groupid) { global $g_db, $srv_settings; if ($i_groupid > SYSTEM_GROUP_MAX_INDEX) { //9917//9917 if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "groups_users WHERE groupid={$i_groupid}") === false) { showDBError(__FILE__, 1); } //9917//9917 if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "groups_tests WHERE groupid={$i_groupid}") === false) { showDBError(__FILE__, 2); } //9917 if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "groups WHERE groupid={$i_groupid}") === false) { showDBError(__FILE__, 3); } } }
if (!$deleted) { $msg = "Database Error: {$ax['grp_not_deleted']}"; break; } $msg = $ax['grp_deleted']; } while (false); return $msg; } //Control logic if ($privs >= 4) { //manager or admin $msg = ''; if (isset($_POST['addExe'])) { $msg = addGroup($group); } elseif (isset($_POST['updExe'])) { $msg = updateGroup($group); } elseif (isset($_GET['delExe'])) { $msg = deleteGroup($group); } echo "<p class='error'>{$msg}</p>\n\t\t<div class='scrollBoxAd'>\n\t\t<div class='centerBox'>\n"; if (!$mode or isset($_POST["back"])) { showGroups(); //no add / no edit } else { editGroup($group); //add or edit } echo "</div>\n</div>\n"; } else { echo "<p class='error'>{$ax['no_way']}</p>\n"; }
function groups_admin_main($var) { $op = pnVarCleanFromInput('op'); extract($var); if (!pnSecAuthAction(0, 'Groups::', '::', ACCESS_EDIT)) { include 'header.php'; echo _GROUPSNOAUTH; include 'footer.php'; } else { switch ($op) { case "secviewgroups": viewGroups(); break; case "secviewgroup": viewGroup(); break; case "secnewgroup": newGroup(); break; case "secaddgroup": addGroup(); break; case "secdeletegroup": deleteGroup(); break; case "secselectuserforgroup": selectUserForGroup(); break; case "secaddusertogroup": addUserToGroup(); break; case "secdeleteuserfromgroup": deleteUserFromGroup(); break; case "secmodifygroup": modifyGroup(); break; case "secrenamegroup": renameGroup(); break; default: viewGroups(); break; } } }
} else { return COM_refresh($_CONF['site_admin_url'] . '/group.php?msg=50'); } } // MAIN $mode = ''; if (isset($_REQUEST['mode'])) { $mode = $_REQUEST['mode']; } if ($mode == $LANG_ADMIN['delete'] && !empty($LANG_ADMIN['delete'])) { $grp_id = COM_applyFilter($_REQUEST['grp_id'], true); if (!isset($grp_id) || empty($grp_id) || $grp_id == 0) { COM_errorLog('Attempted to delete group grp_id=' . $grp_id); $display .= COM_refresh($_CONF['site_admin_url'] . '/group.php'); } elseif (SEC_checkToken()) { $display .= deleteGroup($grp_id); } else { COM_accessLog("User {$_USER['username']} tried to illegally delete group {$grp_id} and failed CSRF checks."); echo COM_refresh($_CONF['site_admin_url'] . '/index.php'); } } elseif ($mode == $LANG_ADMIN['save'] && !empty($LANG_ADMIN['save']) && SEC_checkToken()) { $grp_gl_core = COM_applyFilter($_POST['grp_gl_core'], true); $grp_default = 0; if (isset($_POST['chk_grpdefault'])) { $grp_default = 1; } $grp_applydefault = 0; if (isset($_POST['chk_applydefault'])) { $grp_applydefault = 1; } $chk_grpadmin = '';
$user_groups = getGroups($data); $pagination = new Pagination(); $pagination->total = $total_group; $pagination->page = $page; $pagination->limit = $numrows; $pagination->url = "user_group/page{page}.html"; $pagination = $pagination->render(); $url = ''; if ($order == 'ASC') { $url .= '/DESC'; } else { $url .= '/ASC'; } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['selected'])) { foreach ($_POST['selected'] as $group_id) { $delete_query = deleteGroup($group_id); if ($delete_query) { $_SESSION['success'] = $lang['success_delete']; header('Location:user_group.html'); } else { $_SESSION['error_warning'] = $lang['error_query']; } } } ?> <div id="content"> <div class="breadcrumb"> <a href="home.html"><?php echo $lang['text_home']; ?>
break; case "getmygroups": $userid = optional_param('userid', '', PARAM_ALPHANUMEXT); $response = getMyGroups($userid); break; case "getmyadmingroups": $userid = optional_param('userid', '', PARAM_ALPHANUMEXT); $response = getMyAdminGroups($userid); break; case "addgroup": $groupname = required_param('groupname', PARAM_TEXT); $response = addGroup($groupname); break; case "deletegroup": $groupid = required_param('groupid', PARAM_ALPHANUMEXT); $response = deleteGroup($groupid); break; case "addgroupmember": $groupid = required_param('groupid', PARAM_ALPHANUMEXT); $userid = required_param('userid', PARAM_ALPHANUMEXT); $response = addGroupMember($groupid, $userid); break; case "makegroupadmin": $groupid = required_param('groupid', PARAM_ALPHANUMEXT); $userid = required_param('userid', PARAM_ALPHANUMEXT); $response = makeGroupAdmin($groupid, $userid); break; case "removegroupadmin": $groupid = required_param('groupid', PARAM_ALPHANUMEXT); $userid = required_param('userid', PARAM_ALPHANUMEXT); $response = removeGroupAdmin($groupid, $userid);
<?php require "../settings.php"; // store the post vars in get vars, so that both vars can be accessed at once // it is done this was around, so post vars get's higher priority and overwrites duplicated in get vars if (isset($_POST)) { foreach ($_POST as $arr => $arrval) { $_GET[$arr] = $arrval; } } // see what to do if (isset($_GET["key"])) { switch ($_GET["key"]) { case "delete": case "confirm_delete": $OUTPUT = deleteGroup(); break; default: $OUTPUT = viewGroup(); } } else { $OUTPUT = viewGroup(); } # display output require "../template.php"; # enter new data function viewGroup() { global $_GET; global $user_admin; foreach ($_GET as $key => $value) {
// remove from group deleteMemberFromGroup($request_obj); break; case "POST": // add to group addMemberToGroup($request_obj); break; } } break; case "groupList": // this for adding groups, removeing groups or changeging group name if ($request_obj->account_priv == "Admin") { switch ($request_obj->action) { case "DELETE": deleteGroup($request_obj); break; case "POST": createNewGroup($request_obj); break; case "PUT": changeGroupName($request_obj); break; } } break; case "memberList": // this is for adding people to members or changing their rank switch ($request_obj->action) { case "POST": if ($request_obj->account_priv == "Admin" or $request_obj->account_priv == "Officer") {
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ require_once "../models/config.php"; set_error_handler('logAllErrors'); // Request method: POST $ajax = checkRequestMode("post"); // User must be logged in checkLoggedInUser($ajax); $validator = new Validator(); $group_id = $validator->requiredPostVar('group_id'); // Add alerts for any failed input validation foreach ($validator->errors as $error) { addAlert("danger", $error); } if (count($validator->errors) > 0) { apiReturnError($ajax, getReferralPage()); } //Forms posted if ($group_id) { if (!deleteGroup($group_id)) { apiReturnError($ajax, getReferralPage()); } } else { apiReturnError($ajax, getReferralPage()); } restore_error_handler(); // Allows for functioning in either ajax mode or synchronous request mode apiReturnSuccess($ajax, getReferralPage());
} redirect_header('privmanager.php', 2, _AM_WEBLOG_DBUPDATED); } function deleteGroup($post) { if (isset($post['gid'])) { $group_handler =& xoops_getmodulehandler('priv'); foreach ($post['gid'] as $gid) { $criteria =& new Criteria('priv_gid', $gid); $group =& $group_handler->getObjects($criteria); if (is_object($group[0])) { $group_handler->delete($group[0]); } } } redirect_header('privmanager.php', 2, _AM_WEBLOG_DBUPDATED); } switch ($action) { case "comments": synchronizeComments(); break; case "add": addGroup($_POST); break; case "delete": deleteGroup($_POST); break; default: privmanager(); break; }
public function deleteGroup($params) { $res = deleteGroup($params["id"]); $this->logGroup($params, 2); return $res; }
/** * @NoAdminRequired * @CORS * @NoCSRFRequired */ public function delgroup() { require_once 'ownnote/lib/backend.php'; if (isset($_GET["group"])) return deleteGroup("Notes", $_GET["group"]); if (isset($_POST["group"])) return deleteGroup("Notes", $_POST["group"]); }
showUserEditor($_REQUEST['userid'], $_REQUEST['add']); break; case "deleteuser": deleteUser($_REQUEST['user']); break; case "addyear": addYear($_REQUEST['year']); break; case "deleteyear": deleteYear($_REQUEST['year']); break; case "addgroup": addGroup($_REQUEST['group']); break; case "deletegroup": print deleteGroup($_REQUEST['group']); break; case "deleteblockeduser": deleteBlockedUser($_REQUEST['user']); break; case "addblockeduser": addBlockedUser($_REQUEST['user']); break; case "removependingpayment": removePendingPayment($_REQUEST); break; case "getpendingpayments": getPendingPayments($_REQUEST); break; case "removependingform": removePendingForm($_REQUEST);