Skip to content

Commit 7373bcd

Browse files
committed
form_name -> form_type
1 parent 243c6b5 commit 7373bcd

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

resources/templates/header.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
if ($_SERVER["REQUEST_METHOD"] == "POST") {
66
if ((@$_SESSION["is_admin"] ?? false) == true
7-
&& (@$_POST["form_name"] ?? null) == "clearView"
7+
&& (@$_POST["form_type"] ?? null) == "clearView"
88
) {
99
unset($_SESSION["viewUser"]);
1010
UnitySite::redirect($CONFIG["site"]["prefix"] . "/admin/user-mgmt.php");
@@ -141,7 +141,7 @@
141141
<div id='viewAsBar'>
142142
<span>You are accessing the web portal as the user <strong>$viewUser</strong></span>
143143
<form method='POST' action=''>
144-
<input type='hidden' name='form_name' value='clearView'>
144+
<input type='hidden' name='form_type' value='clearView'>
145145
<input type='hidden' name='uid' value='$viewUser'>
146146
<input type='submit' value='Return to My User'>
147147
</form>

test/functional/PiRemoveUserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private function removeUser(string $uid)
99
{
1010
http_post(
1111
__DIR__ . "/../../webroot/panel/pi.php",
12-
["form_name" => "remUser", "uid" => $uid]
12+
["form_type" => "remUser", "uid" => $uid]
1313
);
1414
}
1515

test/functional/ViewAsUserTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function _testViewAsUser(array $beforeUser, array $afterUser)
1818
http_post(
1919
__DIR__ . "/../../webroot/admin/user-mgmt.php",
2020
[
21-
"form_name" => "viewAsUser",
21+
"form_type" => "viewAsUser",
2222
"uid" => $afterUid,
2323
],
2424
);
@@ -32,7 +32,7 @@ public function _testViewAsUser(array $beforeUser, array $afterUser)
3232
// $this->assertTrue($_SESSION["user_exists"]);
3333
http_post(
3434
__DIR__ . "/../../resources/templates/header.php",
35-
["form_name" => "clearView"],
35+
["form_type" => "clearView"],
3636
);
3737
$this->assertArrayNotHasKey("viewUser", $_SESSION);
3838
// redirect means that php process dies and user's browser will initiate a new one
@@ -68,7 +68,7 @@ public function testNonAdminViewAsAdmin()
6868
http_post(
6969
__DIR__ . "/../../webroot/admin/user-mgmt.php",
7070
[
71-
"form_name" => "viewAsUser",
71+
"form_type" => "viewAsUser",
7272
"uid" => $adminUid,
7373
],
7474
);

webroot/admin/ajax/get_group_members.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
echo
3838
"<form action='' method='POST' onsubmit='return confirm(\"Are you sure you want to remove " .
3939
$member->getUID() . " from this group?\");'>
40-
<input type='hidden' name='form_name' value='remUserChild'>
40+
<input type='hidden' name='form_type' value='remUserChild'>
4141
<input type='hidden' name='uid' value='" . $member->getUID() . "'>
4242
<input type='hidden' name='pi' value='" . $group->getPIUID() . "'>
4343
<input type='submit' value='Remove'>
@@ -63,7 +63,7 @@
6363
echo
6464
"<form action='' method='POST'
6565
onsubmit='return confirm(\"Are you sure you want to approve " . $request->getUID() . "?\");'>
66-
<input type='hidden' name='form_name' value='reqChild'>
66+
<input type='hidden' name='form_type' value='reqChild'>
6767
<input type='hidden' name='uid' value='" . $request->getUID() . "'>
6868
<input type='hidden' name='pi' value='" . $group->getPIUID() . "'>
6969
<input type='submit' name='action' value='Approve'>

webroot/admin/pi-mgmt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
$form_user = new UnityUser($_POST["uid"], $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK);
1616
}
1717

18-
switch ($_POST["form_name"]) {
18+
switch ($_POST["form_type"]) {
1919
case "req":
2020
if ($_POST["action"] == "Approve") {
2121
// approve group
@@ -84,7 +84,7 @@
8484
echo "<td>";
8585
echo
8686
"<form action='' method='POST'>
87-
<input type='hidden' name='form_name' value='req'>
87+
<input type='hidden' name='form_type' value='req'>
8888
<input type='hidden' name='uid' value='" . $request_user->getUID() . "'>
8989
<input type='submit' name='action' value='Approve'
9090
onclick='return confirm(\"Are you sure you want to approve " . $request_user->getUID() . "?\");'>

webroot/admin/user-mgmt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010

1111
if ($_SERVER["REQUEST_METHOD"] == "POST") {
12-
switch ($_POST["form_name"]) {
12+
switch ($_POST["form_type"]) {
1313
case "viewAsUser":
1414
$_SESSION["viewUser"] = $_POST["uid"];
1515
UnitySite::redirect($CONFIG["site"]["prefix"] . "/panel/account.php");
@@ -65,7 +65,7 @@
6565
echo "<td>";
6666
echo "<form class='viewAsUserForm' action='' method='POST'
6767
onsubmit='return confirm(\"Are you sure you want to switch to the user " . $user->getUID() . "?\");'>
68-
<input type='hidden' name='form_name' value='viewAsUser'>
68+
<input type='hidden' name='form_type' value='viewAsUser'>
6969
<input type='hidden' name='uid' value='" . $user->getUID() . "'>
7070
<input type='submit' name='action' value='Access'>
7171
</form>";

webroot/panel/groups.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$modalErrors = array();
1010
$errors = array();
1111

12-
if (isset($_POST["form_name"])) {
12+
if (isset($_POST["form_type"])) {
1313
if (isset($_POST["pi"])) {
1414
$pi_account = new UnityGroup(trim($_POST["pi"]), $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK);
1515
if (!$pi_account->exists()) {
@@ -18,7 +18,7 @@
1818
}
1919
}
2020

21-
switch ($_POST["form_name"]) {
21+
switch ($_POST["form_type"]) {
2222
case "addPIform":
2323
// The new PI modal was submitted
2424
// existing PI request
@@ -116,7 +116,7 @@
116116
"<td>
117117
<form action='' method='POST'
118118
onsubmit='return confirm(\"Are you sure you want to leave the PI group " . $group->getPIUID() . "?\")'>
119-
<input type='hidden' name='form_name' value='removePIForm'>
119+
<input type='hidden' name='form_type' value='removePIForm'>
120120
<input type='hidden' name='pi' value='" . $group->getPIUID() . "'>
121121
<input type='submit' value='Leave Group'>
122122
</form>

webroot/panel/modal/new_pi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
?>
55

66
<form id="newPIform" method="POST" action="<?php echo $CONFIG["site"]["prefix"]; ?>/panel/groups.php">
7-
<input type="hidden" name="form_name" value="addPIform">
7+
<input type="hidden" name="form_type" value="addPIform">
88
<div style="position: relative;">
99
<input type="text" id="pi_search" name="pi" placeholder="Search PI by NetID" required>
1010
<div class="searchWrapper" style="display: none;"></div>

webroot/panel/pi.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
$form_user = new UnityUser($_POST["uid"], $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK);
1717
}
1818

19-
switch ($_POST["form_name"]) {
19+
switch ($_POST["form_type"]) {
2020
case "userReq":
2121
if ($_POST["action"] == "Approve") {
2222
$group->approveUser($form_user);
@@ -62,7 +62,7 @@
6262
echo "<td>";
6363
echo
6464
"<form action='' method='POST'>
65-
<input type='hidden' name='form_name' value='userReq'>
65+
<input type='hidden' name='form_type' value='userReq'>
6666
<input type='hidden' name='uid' value='" . $request[0]->getUID() . "'>
6767
<input type='submit' name='action' value='Approve'
6868
onclick='return confirm(\"Are you sure you want to approve " . $request[0]->getUID() . "?\")'>
@@ -92,7 +92,7 @@
9292
echo "<td>";
9393
echo
9494
"<form action='' method='POST'>
95-
<input type='hidden' name='form_name' value='remUser'>
95+
<input type='hidden' name='form_type' value='remUser'>
9696
<input type='hidden' name='uid' value='" . $assoc->getUID() . "'>
9797
<input type='submit' value='Remove'
9898
onclick='return confirm(\"Are you sure you want to remove " . $assoc->getUID() . " from your PI group?\")'>

0 commit comments

Comments
 (0)