<a
href="https://unrealircd.org"
role="button"
- data-mdb-ripple-color="dark"
- ><img class="btn btn-link btn-floating btn-xs text-white" src="<?php echo BASE_URL; ?>img/favicon.ico" width="25" height="25"></i
- ></a>
+ data-mdb-ripple-color="dark">
+ <img class="btn btn-link btn-floating btn-xs text-white" src="<?php echo BASE_URL; ?>img/favicon.ico" width="25" height="25"></a>
<?php $arr = []; Hook::run(HOOKTYPE_FOOTER, $arr); ?>
</section>
-</footer>
-</body>
-</html>
</div>
</div>
+
+</footer>
+</body>
+</html>
\ No newline at end of file
$str = substr($str, 0, $x);
return $str;
}
+
+
+function how_long_ago($timestamp)
+{
+ $now = time();
+ $diff = $now - strtotime($timestamp);
+
+ $units = array(
+ 31536000 => 'year',
+ 2592000 => 'month',
+ 604800 => 'week',
+ 86400 => 'day',
+ 3600 => 'hour',
+ 60 => 'minute',
+ 1 => 'second'
+ );
+
+ foreach ($units as $unit => $text) {
+ if ($diff < $unit) continue;
+ $numberOfUnits = floor($diff / $unit);
+ return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'').' ago';
+ }
+}
\ No newline at end of file
{
echo "<td scope=\"col\"><input type=\"checkbox\" value='" .$user->id . "' name=\"userch[]\"></td>";
- echo "<td scope=\"col\">".$user->username."</td>";
+ echo "<td scope=\"col\"><a href=\"".BASE_URL."settings/user-edit.php?id=$user->id\">$user->username</a></td>";
echo "<td scope=\"col\">".$user->first_name."</td>";
echo "<td scope=\"col\">".$user->last_name."</td>";
- echo "<td scope=\"col\">".$user->created."</td>";
+ echo "<td scope=\"col\"><code>".$user->created."</code></td>";
echo "<td scope=\"col\">".$user->bio."</td>";
- echo "<td scope=\"col\">".$user->user_meta['last_login']."</td>";
+ $last = (isset($user->user_meta['last_login'])) ? "<code>".$user->user_meta['last_login'] . "</code> <span class=\"badge rounded-pill badge-dark\">".how_long_ago($user->user_meta['last_login'])."</span>" : "none";
+ echo "<td scope=\"col\">$last</td>";
echo "</tr>";
}
?></tbody></table><p><button type="button" class="btn btn-danger" data-toggle="modal" data-target="#myModal2">
<?php
require_once "../common.php";
-require_once "../header.php";
\ No newline at end of file
+require_once "../header.php";
+
+do_log($_POST, $_GET, $_FILES);
+
+$us = unreal_get_current_user();
+$id = (isset($_GET['id'])) ? $_GET['id'] : $us->id;
+$edit_user = new PanelUser(NULL, $id);
+$can_edit = (current_user_can(PERMISSION_MANAGE_USERS) || $edit_user->id == $us->id) ? "" : "disabled";
+
+?>
+<h4>Edit User: "<?php echo $edit_user->username; ?>"</h4>
+<br><br>
+<form method="post" action="user-edit.php?id=<?php echo $edit_user->id; ?>" autocomplete="off" enctype="multipart/form-data">
+
+<div class="input-group mb-3">
+ <div class="input-group-prepend">
+ <span class="input-group-text" style="width: 100px;">@</span>
+ </div><input disabled type="text" class="form-control" name="username" id="username" placeholder="<?php echo $edit_user->username; ?>">
+</div>
+
+<div class="input-group mb-3">
+ <div class="input-group-prepend">
+ <span class="input-group-text" style="width: 100px;">First Name</span>
+ </div><input <?php echo $can_edit; ?> type="text" class="form-control" name="first_name" id="first_name" placeholder="<?php echo $edit_user->first_name; ?>">
+</div>
+
+
+<div class="input-group mb-3">
+ <div class="input-group-prepend">
+ <span class="input-group-text" style="width: 100px;">Last Name</span>
+ </div><input <?php echo $can_edit; ?> type="text" class="form-control" name="last_name" id="last_name" placeholder="<?php echo $edit_user->last_name; ?>">
+</div>
+
+
+<div class="input-group mb-3">
+ <div class="input-group-prepend">
+ <span class="input-group-text" style="width: 100px;">Bio</span>
+ </div><textarea <?php echo $can_edit; ?> class="form-control" name="bio" id="username"><?php echo $edit_user->bio; ?></textarea>
+</div>
+
+
+<div class="input-group mb-3">
+ <div class="input-group-prepend">
+ <span class="input-group-text" style="width: 100px;">Email</span>
+ </div><input <?php echo $can_edit; ?> type="text" class="form-control" name="email" id="email" autocomplete="off">
+</div>
+
+<div class="input-group mb-3">
+ <div class="input-group-prepend">
+ <span class="input-group-text" style="width: 100px;">Password</span>
+ </div><input <?php echo $can_edit; ?> type="password" class="form-control" name="password" id="password" autocomplete="off">
+ <div class="input-group-append">
+ <br><button type="submit" name="update_pass" class="btn btn-primary">Update Password</button>
+ </div>
+</div>
+
+<br>
+<button type="submit" name="update_user" class="btn btn-primary">Update User</button><br><p>
+<h6>Note: This button will not update your password.<br>
+Please use the 'Update Password' button on the Password field for this instead.</h6></p>
+</form>
\ No newline at end of file