]>
jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - users.php
2 require_once "common.php";
4 require_once "header.php";
9 $bantype = $_POST['bantype'];
10 if (isset($_POST['userch']))
12 foreach ($_POST["userch"] as $user)
14 $user = base64_decode($user);
15 $bantype = (isset($_POST['bantype'])) ? $_POST['bantype'] : NULL;
16 if (!$bantype) /* shouldn't happen? */
18 Message
::Fail("An error occured");
21 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
22 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
23 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
26 if (!$banlen_d && !$banlen_h && !$banlen_w)
32 $duration .= $banlen_w;
34 $duration .= $banlen_d;
36 $duration .= $banlen_h;
39 $user = $rpc->user()->get($user);
42 Message
::Fail("Could not find that user. Maybe they disconnected after you clicked this?");
46 $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for ".rpc_convert_duration_string($duration);
47 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason";
48 if ($rpc->serverban()->add($user, $bantype, $duration, $reason))
49 Message
::Success($user->name
. " (*@".$user->hostname
.") has been $bantype" . "d
$msg_msg: $reason");
54 /* Get the user list */
55 $users = $rpc->user()->getAll();
59 <table
class='users_filter'>
60 <th
class="thuf">Filter by
: </th
>
62 <form action
="users.php" method
="post">
63 Nick
: <input name
="uf_nick" id
="uf_nick" type
="text">
64 <input
class="cute_button2" type
="submit" value
="Search">
68 <form action
="" method
="post">
69 Hostname
: <input name
="uf_host" id
="uf_host" type
="text">
70 <input
class="cute_button2" type
="submit" value
="Search">
74 <form action
="" method
="post">
75 IP
: <input name
="uf_ip" id
="uf_ip" type
="text">
76 <input
class="cute_button2" type
="submit" value
="Search">
80 <form action
="" method
="post">
81 Account
: <input name
="uf_account" id
="uf_account" type
="text">
82 <input
class="cute_button2" type
="submit" value
="Search">
88 if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']))
89 Message
::Info("Listing users which match nick: \"" . $_POST['uf_nick'] . "\"");
91 if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']))
92 Message
::Info("Listing users which match IP: \"" . $_POST['uf_ip'] . "\"");
94 if (isset($_POST['uf_host']) && strlen($_POST['uf_host']))
95 Message
::Info("Listing users which match hostmask: \"" . $_POST['uf_host'] . "\"");
97 if (isset($_POST['uf_account']) && strlen($_POST['uf_account']))
98 Message
::Info("Listing users which match account: \"" . $_POST['uf_account'] . "\"");
102 <table
class="table">
104 <th
><input type
="checkbox" label
='selectall' onClick
="toggle_user(this)" />Select all
</th
>
109 <th
>Usermodes
<a href
="https://www.unrealircd.org/docs/User_modes" target
="_blank">ℹ️
</a
></th
>
112 <th
>Connected to
</th
>
113 <th
>Reputation
<a href
="https://www.unrealircd.org/docs/Reputation_score" target
="_blank">ℹ️
</a
></th
>
117 <form action
="users.php" method
="post">
119 foreach($users as $user)
122 /* Some basic filtering for NICK */
123 if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']) &&
124 strpos(strtolower($user->name
), strtolower($_POST['uf_nick'])) !== 0 &&
125 strpos(strtolower($user->name
), strtolower($_POST['uf_nick'])) == false)
128 /* Some basic filtering for HOST */
129 if (isset($_POST['uf_host']) && strlen($_POST['uf_host']) &&
130 strpos(strtolower($user->hostname
), strtolower($_POST['uf_host'])) !== 0 &&
131 strpos(strtolower($user->hostname
), strtolower($_POST['uf_host'])) == false)
134 /* Some basic filtering for IP */
135 if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']) &&
136 strpos(strtolower($user->ip
), strtolower($_POST['uf_ip'])) !== 0 &&
137 strpos(strtolower($user->ip
), strtolower($_POST['uf_ip'])) == false)
140 /* Some basic filtering for ACCOUNT */
141 if (isset($_POST['uf_account']) && strlen($_POST['uf_account']) &&
142 strpos(strtolower($user->user
->account
), strtolower($_POST['uf_account'])) !== 0 &&
143 strpos(strtolower($user->user
->account
), strtolower($_POST['uf_account'])) == false)
147 echo "<td><input type=\"checkbox\" value='" . base64_encode($user->id
)."' name=\"userch[]\"></td>";
148 $isBot = (strpos($user->user
->modes
, "B") !== false) ? ' <span class="label">Bot</span>' : "";
149 echo "<td>".$user->name
.$isBot.'</td>';
150 echo "<td>".$user->id
."</td>";
151 echo "<td>".$user->hostname
." (".$user->ip
.")</td>";
152 //$account = (isset($user->user->account)) ? $user->user->account : '<span class="label bluelabel ">None</span>';
153 $account = (isset($user->user
->account
)) ? $user->user
->account
: '<span class="badge-pill badge-primary">None</span>';
154 echo "<td>".$account."</td>";
155 $modes = (isset($user->user
->modes
)) ? "+" . $user->user
->modes
: "<none>";
156 echo "<td>".$modes."</td>";
157 $oper = (isset($user->user
->operlogin
)) ? $user->user
->operlogin
." <span class=\"label bluelabel\">".$user->user
->operclass
."</span>" : "";
159 $oper = (strpos($user->user
->modes
, "S") !== false) ? '<span class="label secure-connection">Service</span>' : "";
160 echo "<td>".$oper."</td>";
161 //$secure = (isset($user->tls)) ? "<span class=\"label secure-connection\">Secure</span>" : "<span class=\"label redlabel\">Insecure</span>";
162 $secure = (isset($user->tls
)) ? "<span class=\"badge-pill badge-success\">Secure</span>" : "<span class=\"badge-pill badge-danger\">Insecure</span>";
163 echo "<td>".$secure."</td>";
164 echo "<td>".$user->user
->servername
."</td>";
165 echo "<td>".$user->user
->reputation
."</td>";
170 <label
for="bantype">Apply action
: </label
><br
>
171 <select name
="bantype" id
="bantype">
172 <option value
=""></option
>
173 <optgroup label
="Bans">
174 <option value
="gline">GLine
</option
>
175 <option value
="gzline">GZLine
</option
>
179 <label
for="banlen_w">Duration
: </label
><br
>
180 <select name
="banlen_w" id
="banlen_w">
182 for ($i = 0; $i <= 56; $i++
)
185 echo "<option value=\"0w\"></option>";
188 $w = ($i == 1) ? "week" : "weeks";
189 echo "<option value=\"$i" . "w\"
>$i $w" . "</option>";
194 <select name
="banlen_d" id
="banlen_d">
196 for ($i = 0; $i <= 31; $i++
)
199 echo "<option value=\"0d\"></option>";
202 $d = ($i == 1) ? "day" : "days";
203 echo "<option value=\"$i" . "d\"
>$i $d" . "</option>";
208 <select name
="banlen_h" id
="banlen_h">
210 for ($i = 0; $i <= 24; $i++
)
213 echo "<option value=\"0d\"></option>";
216 $h = ($i == 1) ? "hour" : "hours";
217 echo "<option value=\"$i" . "h\"
>$i $h" . "</option>";
222 <br
><label
for="ban_reason">Reason
:<br
></label
>
223 <textarea name
="ban_reason" id
="ban_reason">No reason
</textarea
><br
>
224 <input
class="cute_button" type
="submit" value
="Apply">
230 <?php
require_once 'footer.php'; ?>