case $_GET['update']: $contactForm->success("Updated successfully"); break; case $_GET['add']: $contactForm->success("Added new item successfully"); break; case $_GET['delete']: $contactForm->success("Deleted item successfully"); break; } if ($_GET['action'] == editGroup && $_SESSION['access'] >= 50 || $_GET['action'] == showGroup) { //get the new group type corresponding to the ID $group = new Contact($_GET['groupID']); //if this is an update then update the contact if (isset($_POST['updateGroup'])) { updateGroup($group); } else { displayGroups($group); } } else { if ($_GET['action'] == editContacts && $_SESSION['access'] >= 50 || $_GET['action'] == showContacts) { //get the new group type corresponding to the ID $contact = new Person($_GET['contactID']); //if this is an update then update the contact if (isset($_POST['updateContact'])) { updateContact($contact); } else { if (isset($_POST['updateContactType'])) { $contactType = new PersonType($_GET['contactTypeID']); updateContactType($contactType); } else {
function updateRack() { assertUIntArg('row_id'); assertStringArg('name'); assertUIntArg('height'); assertStringArg('asset_no', TRUE); assertStringArg('comment', TRUE); $taglist = genericAssertion('taglist', 'array0'); $rack_id = getBypassValue(); ############################################################################################### # update zabbix group $rack = spotEntity("rack", $rack_id); if ($rack['name'] != $_REQUEST['name']) { $result = updateGroup($rack["name"], $_REQUEST["name"]); if (isset($result["error"])) { showError("Updating zabbix group is failed. Error message:" . $result["error"]); return; } } # update table rack_airconditioner if ($rack['row_id'] != $_REQUEST['row_id']) { usePreparedUpdateBlade('rack_airconditioner', array('row_id' => $_REQUEST['row_id']), array('rack_id' => $rack_id)); } # END ############################################################################################### usePreparedDeleteBlade('RackThumbnail', array('rack_id' => $rack_id)); commitUpdateRack($rack_id, $_REQUEST['row_id'], $_REQUEST['name'], $_REQUEST['height'], isCheckSet('has_problems', 'yesno'), $_REQUEST['asset_no'], $_REQUEST['comment']); updateObjectAttributes($rack_id); rebuildTagChainForEntity('rack', $rack_id, buildTagChainFromIds($taglist), TRUE); showFuncMessage(__FUNCTION__, 'OK', array($_REQUEST['name'])); }
<?php require_once dirname(__FILE__) . "/../../../include/master.inc.php"; $error = ""; $success = ""; if (!isLogin()) { redirect(BASEURL . "app/login.php"); } if (isset($_POST['save'])) { if (strlen($_POST['name']) < 2) { $error = "Layer Name Too Short."; } else { if (!updateGroup($_SESSION['user']['id'], $_POST['id'], $_POST['name'])) { $error = "Something went wrong. Please refresh and try again!"; } else { $success = "Successfully Updated!"; } } } else { $error = "Invalid Request"; } $_SESSION['response']['group-edit']['error'] = $error; $_SESSION['response']['group-edit']['success'] = $success; redirect(BASEURL . "app/group-edit.php?id=" . $_POST['id']);
/** \brief Gruppe bearbeiten Ändert die Daten einer Gruppe */ function Group_edit() { if (!$this->userdata['rights']['groupedit']) { #no permission $this->_header("", "no permission"); } $id = param_num("id"); if (!$id) { $this->_header(); } $page = param_num("page", 1); $return = getGroup($id); if (!$return) { $this->_header(); } $data = $_SESSION['steps']; #information message, step 2 if ($data['groupedit']) { #save step unset($data['groupedit']); $_SESSION['steps'] = $data; $this->forms['information']['action'] = "groupdetails"; $this->forms['information']['url'] = $this->backtracking->backlink(); $this->forms['information']['title'] = "Gruppe bearbeiten"; $this->forms['information']['message'] = "Änderung erfolgreich"; $this->forms['information']['style'] = "green"; $this->show('message_information', "Gruppe bearbeiten"); } #formular send if ($_REQUEST['send']) { $items['name'] = param_str("name", true); $items['descr'] = param_str("descr", true); if (!$items['name']) { $errors[] = "Name darf nicht leer sein!"; $this->forms['addgroup']['fields']['name']['bgrd'] = '_error'; } if (!$items['descr']) { $errors[] = "Beschreibung darf nicht leer sein!"; $this->forms['addgroup']['fields']['descr']['bgrd'] = '_error'; } #optional parameters $items['usertitle'] = param_str("usertitle", true); if (!$errors && $items['name'] != $return['name'] && getGroupByName($items['name'])) { $errors[] = 'Gruppe existiert bereits!'; $this->forms['addgroup']['fields']['name']['bgrd'] = '_error'; } if (!$errors) { #save step $data['groupedit'] = 1; $_SESSION['steps'] = $data; addToLogfile("Gruppe " . $return['name'] . " bearbeitet", "Admin", $this->userdata['uid']); updateGroup($return['gid'], $items['name'], $items['descr'], $items['usertitle']); $this->_header("admin.php?action=editgroup&id=" . $return['gid'] . "&send"); } else { $this->template->assign("errors", $errors); } } else { $this->forms['groupedit']['fields']['usertitle']['value'] = $return['usertitle']; $this->forms['groupedit']['fields']['name']['value'] = $return['name']; $this->forms['groupedit']['fields']['descr']['value'] = $return['descr']; } $this->forms['groupedit']['id'] = $return['gid']; $this->forms['groupedit']['name'] = $return['name']; $this->forms['groupedit']['url'] = 'admin.php?id=' . $return['gid']; $this->forms['groupedit']['action'] = 'editgroup'; $this->show('group_edit_form', "Gruppe bearbeiten"); }
} } if (isset($_GET['action']) && $_GET['action'] == 'remove') { removeFromGroup($_GET['user'], $db, $group); echo "<meta http-equiv='REFRESH' content='0;url=/?page=group'>"; } else { if (isset($_GET['action']) && $_GET['action'] == 'add') { addToGroup($_GET['user'], $db, $group, false); } else { if (isset($_GET['action']) && $_GET['action'] == 'addMeToExisting') { if (addToGroup($userId, $db, $_GET['group'], false)) { echo "<meta http-equiv='REFRESH' content='0;url=/?page=group'>"; } } else { if (isset($_GET['action']) && $_GET['action'] == 'editGroup') { updateGroup($group, $_POST['name'], $_POST['description'], $_POST['type'], $db); } else { if (isset($_GET['action']) && $_GET['action'] == 'setLeader') { setLeader($group, $_GET['user'], $userId, $db); echo "<meta http-equiv='REFRESH' content='0;url=/?page=group'>"; } } } } } /* login/permissions check Role numbers: 1: student 2: course coordinator 3: site admin if they're not logged in, only render the login page */
function submitEditGroup() { $data = getContinuationVar(); updateGroup($data); $_SESSION['userresources'] = array(); $_SESSION['nodeprivileges'] = array(); $_SESSION['usersessiondata'] = array(); #$_SESSION['cascadenodeprivileges'] = array(); // might need this uncommented viewGroups(); }
if ($memSubArray[0] == 'users') { $userArray[] = $memSubArray[1]; } } $groupMemberArray['groups'] = $groupArray; $groupMemberArray['roles'] = $roleArray; $groupMemberArray['rs'] = $roleSubordinateArray; $groupMemberArray['users'] = $userArray; return $groupMemberArray; } if (isset($_REQUEST['returnaction']) && $_REQUEST['returnaction'] != '') { $returnaction = $_REQUEST['returnaction'] . '&roleid=' . $_REQUEST['roleid']; } else { $returnaction = 'GroupDetailView'; } //Inserting values into Role Table if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'edit') { $groupId = vtlib_purify($_REQUEST['groupId']); $selected_col_string = vtlib_purify($_REQUEST['selectedColumnsString']); $member_array = explode(';', $selected_col_string); $groupMemberArray = constructGroupMemberArray($member_array); updateGroup($groupId, $groupName, $groupMemberArray, $description); $loc = "Location: index.php?action=" . vtlib_purify($returnaction) . "&module=Settings&parenttab=Settings&groupId=" . vtlib_purify($groupId); } elseif (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'create') { $selected_col_string = vtlib_purify($_REQUEST['selectedColumnsString']); $member_array = explode(';', $selected_col_string); $groupMemberArray = constructGroupMemberArray($member_array); $groupId = createGroup($groupName, $groupMemberArray, $description); $loc = "Location: index.php?action=" . vtlib_purify($returnaction) . "&parenttab=Settings&module=Settings&groupId=" . vtlib_purify($groupId); } header($loc);
} // Fetch data for this group $group = fetchGroupDetails($group_id); $group_name = $validator->optionalPostVar('group_name'); if (!$group_name) { $group_name = $group['name']; } $is_default = $validator->optionalPostVar('is_default'); if ($is_default === null) { $is_default = $group['is_default']; } $home_page_id = $validator->optionalPostVar('home_page_id'); if (!$home_page_id) { $home_page_id = $group['home_page_id']; } if (!updateGroup($group_id, $group_name, $is_default, $home_page_id)) { echo json_encode(array("errors" => 1, "successes" => 0)); exit; } /* //Remove access for users if(!empty($_POST['removePermission'])){ $remove = $_POST['removePermission']; if ($deletion_count = removeUsersFromGroup($permissionId, $remove)) { $successes[] = lang("PERMISSION_REMOVE_USERS", array($deletion_count)); } else { $errors[] = lang("SQL_ERROR"); } }
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 msgSettingsupdate($aRequest) { if (validAdmin()) { $Connector = Connector::getInstance(); // Update settings $Settings = Settings::getInstance(); $Settings['PurgeRaids']['IntValue'] = $aRequest['purgeTime']; $Settings['LockRaids']['IntValue'] = $aRequest['lockTime']; $Settings['TimeFormat']['IntValue'] = $aRequest['timeFormat']; $Settings['StartOfWeek']['IntValue'] = $aRequest['startOfWeek']; $Settings['RaidStartHour']['IntValue'] = $aRequest['raidStartHour']; $Settings['RaidStartMinute']['IntValue'] = $aRequest['raidStartMinute']; $Settings['RaidEndHour']['IntValue'] = $aRequest['raidEndHour']; $Settings['RaidEndMinute']['IntValue'] = $aRequest['raidEndMinute']; $Settings['RaidSize']['IntValue'] = $aRequest['raidSize']; $Settings['RaidMode']['TextValue'] = $aRequest['raidMode']; $Settings['Site']['TextValue'] = $aRequest['site']; $Settings['Theme']['TextValue'] = $aRequest['theme']; $Settings['GameConfig']['TextValue'] = $aRequest['game']; $Settings['HelpPage']['TextValue'] = $aRequest['helpPage']; $Settings['PrimaryRole']['TextValue'] = $aRequest['primaryRole']; $Settings->serialize(); do { // Update locations $Connector->beginTransaction(); $ExistingLocations = $Connector->prepare('SELECT * FROM `' . RP_TABLE_PREFIX . 'Location`'); $CurrentValues = array(); $ExistingLocations->loop(function ($Data) use(&$CurrentValues) { $CurrentValues[$Data['LocationId']] = array('Name' => $Data['Name'], 'Image' => $Data['Image']); }); $QueryString = ''; $BindValues = array(); // Build location query if (isset($aRequest['locationIds'])) { for ($i = 0; $i < count($aRequest['locationIds']); ++$i) { $LocationId = intval($aRequest['locationIds'][$i]); $CurrentLocation = $CurrentValues[$LocationId]; $LocationName = requestToXML($aRequest['locationNames'][$i], ENT_COMPAT, 'UTF-8'); $LocationImage = isset($aRequest['locationImages']) && isset($aRequest['locationImages'][$i]) && $aRequest['locationImages'][$i] != 'undefined' ? $aRequest['locationImages'][$i] : $CurrentLocation['Image']; if ($LocationName != $CurrentLocation['Name'] || $LocationImage != $CurrentLocation['Image']) { array_push($BindValues, array(':Name' . $LocationId, $LocationName, PDO::PARAM_STR)); array_push($BindValues, array(':Image' . $LocationId, $LocationImage, PDO::PARAM_STR)); $QueryString .= 'UPDATE `' . RP_TABLE_PREFIX . 'Location` SET Name = :Name' . $LocationId . ', Image = :Image' . $LocationId . ' WHERE LocationId=' . $LocationId . '; '; } } } if (isset($aRequest['locationRemoved'])) { foreach ($aRequest['locationRemoved'] as $LocationId) { $QueryString .= 'DELETE `' . RP_TABLE_PREFIX . 'Location`, `' . RP_TABLE_PREFIX . 'Raid`, `' . RP_TABLE_PREFIX . 'Attendance` FROM `' . RP_TABLE_PREFIX . 'Location` ' . 'LEFT JOIN `' . RP_TABLE_PREFIX . 'Raid` USING(LocationId) ' . 'LEFT JOIN `' . RP_TABLE_PREFIX . 'Attendance` USING(RaidId) ' . ' WHERE LocationId=' . intval($LocationId) . '; '; } } if ($QueryString != '') { $LocationUpdate = $Connector->prepare($QueryString); foreach ($BindValues as $BindData) { $LocationUpdate->bindValue($BindData[0], $BindData[1], $BindData[2]); } if (!$LocationUpdate->execute()) { $Connector->rollBack(); return; // ### return, error ### } } // Update users and groups $BannedIds = isset($aRequest['banned']) ? $aRequest['banned'] : array(); $MemberIds = isset($aRequest['member']) ? $aRequest['member'] : array(); $RaidleadIds = isset($aRequest['raidlead']) ? $aRequest['raidlead'] : array(); $AdminIds = isset($aRequest['admin']) ? $aRequest['admin'] : array(); $RemovedIds = isset($aRequest['removed']) ? $aRequest['removed'] : array(); $UnlinkedIds = isset($aRequest['unlinked']) ? $aRequest['unlinked'] : array(); $RelinkedIds = isset($aRequest['relinked']) ? $aRequest['relinked'] : array(); if (!updateGroup($Connector, 'none', $BannedIds)) { return; } if (!updateGroup($Connector, 'member', $MemberIds)) { return; } if (!updateGroup($Connector, 'raidlead', $RaidleadIds)) { return; } if (!updateGroup($Connector, 'admin', $AdminIds)) { return; } // Update unlinked users foreach ($UnlinkedIds as $UserId) { $UnlinkUser = $Connector->prepare('UPDATE `' . RP_TABLE_PREFIX . 'User` SET `BindingActive` = "false" WHERE UserId = :UserId LIMIT 1'); $UnlinkUser->bindValue(':UserId', $UserId, PDO::PARAM_INT); if (!$UnlinkUser->execute()) { $Connector->rollBack(); return; // ### return, error ### } } // Update relinked users foreach ($RelinkedIds as $UserId) { $UserInfo = tryGetUserLink($UserId); if ($UserInfo != null) { $UpdateQuery = $Connector->prepare('UPDATE `' . RP_TABLE_PREFIX . 'User` SET ' . 'Password = :Password, Salt = :Salt, `Group` = :Group, ' . 'ExternalId = :ExternalId, ExternalBinding = :Binding, BindingActive = "true" ' . 'WHERE UserId = :UserId LIMIT 1'); $UpdateQuery->bindValue(':Password', $UserInfo->Password, PDO::PARAM_STR); $UpdateQuery->bindValue(':Group', $UserInfo->Group, PDO::PARAM_STR); $UpdateQuery->bindValue(':Salt', $UserInfo->Salt, PDO::PARAM_STR); $UpdateQuery->bindValue(':Binding', $UserInfo->BindingName, PDO::PARAM_STR); $UpdateQuery->bindValue(':ExternalId', $UserInfo->UserId, PDO::PARAM_STR); $UpdateQuery->bindValue(':UserId', intval($UserId), PDO::PARAM_INT); if (!$UpdateQuery->execute()) { $Connector->rollBack(); return; // ### return, error ### } } } // Update removed users foreach ($RemovedIds as $UserId) { // remove characters and attendances $DropCharacter = $Connector->prepare('DELETE FROM `' . RP_TABLE_PREFIX . 'Character` WHERE UserId = :UserId LIMIT 1'); $DropAttendance = $Connector->prepare('DELETE FROM `' . RP_TABLE_PREFIX . 'Attendance` WHERE UserId = :UserId'); $DropCharacter->bindValue(':UserId', $UserId, PDO::PARAM_INT); $DropAttendance->bindValue(':UserId', $UserId, PDO::PARAM_INT); if (!$DropCharacter->execute()) { $Connector->rollBack(); return; // ### return, error ### } if (!$DropAttendance->execute()) { $Connector->rollBack(); return; // ### return, error ### } // remove user $DropUser = $Connector->prepare('DELETE FROM `' . RP_TABLE_PREFIX . 'User` WHERE UserId = :UserId LIMIT 1'); $DropUser->bindValue(':UserId', $UserId, PDO::PARAM_INT); if (!$DropUser->execute()) { $Connector->rollBack(); return; // ### return, error ### } } } while (!$Connector->commit()); msgQuerySettings($aRequest); } else { $Out = Out::getInstance(); $Out->pushError(L('AccessDenied')); } }
$id = $_GET['id']; $form = findGroupById($id); } if ($_POST['submit'] == "Delete Group") { header("Location: deletegroup.php?id={$id}"); return; } $form["status"] = $_POST["status"]; $form["comment"] = $_POST["comment"]; if (isset($id)) { // this is an update operation $pageTitle = "Unable to update Group"; // update the data base accordingly $rs = true; // update the org values $rs = updateGroup($id, $form); if ($rs) { header("Location: editgroup.php?id={$id}"); return; } $pageInfo = "<b>Update operation failed</b>"; } else { // this is a group creation request; fill in fields $pageTitle = "Unable to create Group"; $form["name"] = $_POST["name"]; $id = createGroup($form); // redirect to edit group with the new id if ($id) { header("Location: editgroup.php?id={$id}"); return; }
} } // *** edit group *** if (isset($_POST['gedit']) && $_POST['gedit'] == "true" && $_POST['gedit'] != "") { $data['gname'] = trim($_POST['gname']); $data['gin'] = trim($_POST['gin']); $data['gout'] = trim($_POST['gout']); $data['gid'] = trim($_POST['gid']); $err = array(); // validation if (!isset($_POST['gname']) || $_POST['gname'] == "") { $err['gname'] = "Please enter your group name"; } if (!isset($_POST['gin']) || $_POST['gin'] == "") { $err['gin'] = "Please set your work in time for the group"; } if (!isset($_POST['gout']) || $_POST['gout'] == "") { $err['gout'] = "Please set your work out time for the group"; } // if no error if (empty($err)) { if (updateGroup($data, $db)) { echo "<script>alert('User group successfully updated')</script>"; } else { header("location: " . ROOT . "error.html"); exit; } } else { echo "<script>alert('In time or out time can not be blank or misinsert.')</script>"; } }
/** * Update the specified resource in storage. * * @param int $id * @param UpdateGroupRequest $request * @return Response */ public function update($id, UpdateGroupRequest $request) { $request->type = $request->type == "private" ? true : false; updateGroup($id, $request); flash()->success('Your group has been successfully updated.'); return redirect('groups/' . $request->name); }
delUserFromGroup(); } else { if (isset($_POST['delUser'])) { removeUser(); } else { if (isset($_POST['updateUser'])) { updateUser(); } else { if (isset($_POST['addGroup'])) { addGroup(); } else { if (isset($_POST['delGroup'])) { removeGroup(); } else { if (isset($_POST['updateGroup'])) { updateGroup(); } else { if (isset($_POST['update_group_key'])) { updateGroupKey(); } else { if ($_GET['action'] == add) { } else { if ($_GET['action'] == remove) { } else { if (isset($_POST['updateProp'])) { updateProperties($properties); } else { displayLDAP($properties); } } }