Skip to content

Commit 6b9a389

Browse files
committed
mailto urlencode
1 parent a9c96cf commit 6b9a389

File tree

6 files changed

+47
-33
lines changed

6 files changed

+47
-33
lines changed

webroot/admin/ajax/get_group_members.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
}
2929
$uid_escaped = htmlspecialchars($uid);
3030
$fullname = htmlspecialchars($attributes["gecos"][0]);
31-
$mail = htmlspecialchars($attributes["mail"][0]);
31+
$mail_link = "mailto:" . urlencode($attributes["mail"][0]);
32+
$mail_display = htmlspecialchars($attributes["mail"][0]);
3233
$gid_escaped = htmlspecialchars($group->gid);
3334
echo "<td>$fullname</td>";
3435
echo "<td>$uid_escaped</td>";
35-
echo "<td><a href='mailto:$mail'>$mail</a></td>";
36+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
3637
echo "<td>";
3738
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
3839
echo "
@@ -63,11 +64,12 @@
6364
}
6465
$name = htmlspecialchars($user->getFullName());
6566
$uid_escaped = htmlspecialchars($user->uid);
66-
$email = htmlspecialchars($user->getMail());
67+
$mail_link = "mailto:" . urlencode($user->getMail());
68+
$mail_display = htmlspecialchars($user->getMail());
6769
$gid_escaped = htmlspecialchars($group->gid);
6870
echo "<td>$name</td>";
6971
echo "<td>$uid_escaped</td>";
70-
echo "<td><a href='mailto:$email'>$email</a></td>";
72+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
7173
echo "<td>";
7274
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
7375
echo

webroot/admin/pi-mgmt.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@
7272
$request_user = new UnityUser($request["uid"], $LDAP, $SQL, $MAILER, $WEBHOOK);
7373
$uid = htmlspecialchars($request["uid"]);
7474
$gecos = htmlspecialchars($request_user->getFullname());
75-
$mail = htmlspecialchars($request_user->getMail());
75+
$mail_link = "mailto:" . urlencode($request_user->getMail());
76+
$mail_display = htmlspecialchars($request_user->getMail());
7677
echo "<tr>";
7778
echo "<td>$gecos</td>";
7879
echo "<td>$uid</td>";
79-
echo "<td><a href='mailto:$mail'>$mail</a></td>";
80+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
8081
echo "<td>" . date("jS F, Y", strtotime($request['timestamp'])) . "</td>";
8182
echo "<td>";
8283
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
@@ -125,11 +126,12 @@ class="filterSearch"
125126
foreach ($owner_attributes as $attributes) {
126127
$gecos = htmlspecialchars($attributes["gecos"][0]);
127128
$gid = htmlspecialchars(UnityGroup::OwnerUID2GID($attributes["uid"][0]));
128-
$mail = htmlspecialchars($attributes["mail"][0]);
129+
$mail_link = "mailto:" . urlencode($attributes["mail"][0]);
130+
$mail_display = htmlspecialchars($attributes["mail"][0]);
129131
echo "<tr class='expandable'>";
130132
echo "<td><button class='btnExpand'>&#9654;</button>$gecos</td>";
131133
echo "<td>$gid</td>";
132-
echo "<td><a href='mailto:$mail'>$mail</a></td>";
134+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
133135
echo "</tr>";
134136
}
135137
?>

webroot/admin/user-mgmt.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class="filterSearch"
5959
$uid = htmlspecialchars($attributes["uid"][0]);
6060
$gecos = htmlspecialchars($attributes["gecos"][0]);
6161
$org = htmlspecialchars($attributes["o"][0]);
62-
$mail = htmlspecialchars($attributes["mail"][0]);
62+
$mail_link = "mailto:" . urlencode($attributes["mail"][0]);
63+
$mail_display = htmlspecialchars($attributes["mail"][0]);
6364
if ($SQL->accDeletionRequestExists($uid)) {
6465
echo "<tr style='color:grey; font-style: italic'>";
6566
} else {
@@ -68,7 +69,7 @@ class="filterSearch"
6869
echo "<td>$gecos</td>";
6970
echo "<td>$uid</td>";
7071
echo "<td>$org</td>";
71-
echo "<td><a href='mailto:$mail'>$mail</a></td>";
72+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
7273
echo "<td>";
7374
if (count($UID2PIGIDs[$uid]) > 0) {
7475
echo "<table>";

webroot/panel/ajax/get_group_members.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
} else {
2424
echo "<tr class='expanded $i'>";
2525
}
26-
$fullname = $attributes["gecos"][0];
27-
$mail = $attributes["mail"][0];
28-
echo "<td>$fullname</td>";
29-
echo "<td>$uid</td>";
30-
echo "<td><a href='mailto:$mail'>$mail</a></td>";
31-
echo "<td><input type='hidden' name='uid' value='$uid'></td>";
26+
$uid_escaped = htmlspecialchars($uid);
27+
$gecos = htmlspecialchars($attributes["gecos"][0]);
28+
$mail_link = "mailto:" . urlencode($attributes["mail"][0]);
29+
$mail_display = htmlspecialchars($attributes["mail"][0]);
30+
echo "<td>$gecos</td>";
31+
echo "<td>$uid_escaped</td>";
32+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
33+
echo "<td><input type='hidden' name='uid' value='$uid_escaped'></td>";
3234
echo "</tr>";
3335
$i++;
3436
}

webroot/panel/groups.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@
9999
);
100100
$requested_owner = $requested_account->getOwner();
101101
$full_name = $requested_owner->getFirstname() . " " . $requested_owner->getLastname();
102-
$mail = $requested_owner->getMail();
102+
$mail_link = "mailto:" . urlencode($requested_owner->getMail());
103+
$mail_display = htmlspecialchars($requested_owner->getMail());
103104
echo "<tr class='pending_request'>";
104105
echo "<td>$full_name</td>";
105106
echo "<td>" . $requested_account->gid . "</td>";
106-
echo "<td><a href='mailto:$mail'>$mail</a></td>";
107+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
107108
echo "<td>" . date("jS F, Y", strtotime($request['timestamp'])) . "</td>";
108109
echo "<td>";
109110
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
@@ -146,23 +147,25 @@
146147
foreach ($PIGroupGIDs as $gid) {
147148
$group = new UnityGroup($gid, $LDAP, $SQL, $MAILER, $WEBHOOK);
148149
$owner = $group->getOwner();
149-
$full_name = $owner->getFirstname() . " " . $owner->getLastname();
150150
if ($USER->uid == $owner->uid) {
151151
continue;
152152
}
153-
153+
$gecos = htmlspecialchars($owner->getFullname());
154+
$gid = htmlspecialchars($group->gid);
155+
$mail_link = "mailto:" . urlencode($owner->getMail());
156+
$mail_display = htmlspecialchars($owner->getMail());
154157
echo "<tr class='expandable'>";
155-
echo "<td><button class='btnExpand'>&#9654;</button>$full_name</td>";
156-
echo "<td>" . $group->gid . "</td>";
157-
echo "<td><a href='mailto:" . $owner->getMail() . "'>" . $owner->getMail() . "</a></td>";
158+
echo "<td><button class='btnExpand'>&#9654;</button>$gecos</td>";
159+
echo "<td>$gid</td>";
160+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
158161
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
159162
echo
160163
"<td>
161164
<form action='' method='POST'
162-
onsubmit='return confirm(\"Are you sure you want to leave the PI group " . $group->gid . "?\")'>
165+
onsubmit='return confirm(\"Are you sure you want to leave the PI group " . $gid . "?\")'>
163166
$CSRFTokenHiddenFormInput
164167
<input type='hidden' name='form_type' value='removePIForm'>
165-
<input type='hidden' name='pi' value='" . $group->gid . "'>
168+
<input type='hidden' name='pi' value='" . $gid . "'>
166169
<input type='submit' value='Leave Group'>
167170
</form>
168171
</td>";

webroot/panel/pi.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@
5858

5959
foreach ($requests as [$user, $timestamp]) {
6060
$uid = htmlspecialchars($user->uid);
61-
$name = htmlspecialchars($user->getFullName());
62-
$email = htmlspecialchars($user->getMail());
61+
$gecos = htmlspecialchars($user->getFullName());
62+
$mail_link = "mailto:" . urlencode($user->getMail());
63+
$mail_display = htmlspecialchars($user->getMail());
6364
$date = date("jS F, Y", strtotime($timestamp));
6465
echo "<tr>";
65-
echo "<td>$name</td>";
66+
echo "<td>$gecos</td>";
6667
echo "<td>$uid</td>";
67-
echo "<td><a href='mailto:$email'>$email</a></td>";
68+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
6869
echo "<td>$date</td>";
6970
echo "<td>";
7071
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
@@ -96,7 +97,10 @@
9697
if ($assoc->uid == $USER->uid) {
9798
continue;
9899
}
99-
100+
$uid = htmlspecialchars($assoc->uid);
101+
$gecos = htmlspecialchars($assoc->getFullName());
102+
$mail_link = "mailto:" . urlencode($assoc->getMail());
103+
$mail_display = htmlspecialchars($assoc->getMail());
100104
echo "<tr>";
101105
echo "<td>";
102106
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
@@ -114,9 +118,9 @@
114118
>
115119
</form>";
116120
echo "</td>";
117-
echo "<td>" . $assoc->getFirstname() . " " . $assoc->getLastname() . "</td>";
118-
echo "<td>" . $assoc->uid . "</td>";
119-
echo "<td><a href='mailto:" . $assoc->getMail() . "'>" . $assoc->getMail() . "</a></td>";
121+
echo "<td>$gecos</td>";
122+
echo "<td>$uid</td>";
123+
echo "<td><a href='$mail_link'>$mail_display</a></td>";
120124
echo "</tr>";
121125
}
122126

0 commit comments

Comments
 (0)