function getCompanyInformation($anArray) { $companies = array(); foreach ($anArray as $record) { $companies[$record[0]] = ''; } foreach ($companies as $key => $value) { $companies[$key] = findOrgByName($key); } return $companies; }
return; } $pageInfo = "<b>Update operation failed</b>"; } } } else { // this is a user creation request; fill in name and status $pageTitle = "Unable to create user"; $form["name"] = $_POST["name"]; $form["status"] = "ActiveUser"; if ($_POST["password"] != $_POST["password2"]) { $pageInfo = "<span style=\"error\">Passwords do not match</span>"; } else { $userid = createUser($form); $user = findUserById($userid); $org = findOrgByName($_POST['orgName']); $group = findGroupByName($_POST['orgName']); if (isset($user) && isset($org)) { $acct["type"] = "user"; $acct["userid"] = $user["id"]; $acct["userName"] = $user["name"]; $acct["orgid"] = $org["id"]; $acct["orgName"] = $org["name"]; $acct["role"] = $_POST["role"]; $acct["status"] = "Invited"; $id = createAccount($acct); if (isset($id)) { if (isset($_POST['activateUser'])) { sendActivationRequest('', $form); } header("Location: edituser.php?id={$userid}");
$pageInfo = "Group/Organization does not exist"; } } $landingPage = "edituser.php?id={$id}"; } if (isset($_GET["groupid"])) { // adds an account to a group $id = $_GET["groupid"]; $pageInfo = "Group does not exist"; $group = findGroupByID($id); if (isset($_POST['userName'])) { $user = findUserByName($_POST["userName"]); } if (!isset($user)) { if (isset($_POST['orgName'])) { $org = findOrgByName($_POST["orgName"]); } if (!isset($org)) { $pageInfo = "User/Org does not exist"; } } $landingPage = "editgroup.php?id={$id}"; } if (isset($user) && isset($org)) { // user in org membership $acct["type"] = "user"; $acct["userid"] = $user["id"]; $acct["userName"] = $user["name"]; $acct["orgid"] = $org["id"]; $acct["orgName"] = $org["name"]; $acct["role"] = $_POST["role"];