]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - settings/index.php
Merge branch 'main' of https://github.com/unrealircd/unrealircd-webpanel
[irc/unrealircd/unrealircd-webpanel.git] / settings / index.php
index 16f33d6791a1bbef0e09ab9ed82beb20f3514bcb..453101ba0c85ddcca1662ba992b481c25693c5f4 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 $conn = NULL;
 
-require_once "../common.php";
-require_once "../header.php";
+require_once "../inc/common.php";
+require_once "../inc/header.php";
 do_log($_POST);
 
 
@@ -27,7 +27,7 @@ if (isset($_POST))
                        if ($us->id == $user->id) // if it's the current user
                        {
                                session_destroy();
-                               header("Location: " . get_config("base_url") . "plugins/sql_auth/login.php");
+                               header("Location: " . get_config("base_url") . "plugins/sql_db/login.php");
                                die();
                        }
                        $msg = ($deleted = 1) ? "Message::Success" : "Message::Fail";
@@ -52,6 +52,7 @@ if (isset($_POST))
                }
                else if (($usr_obj = new PanelUser($user['user_name'])) && isset($usr_obj->id))
                {
+                       $usr_obj->add_meta("role", $p['user_role']);
                        Message::Success("Successfully created user \"" . $user['user_name'] . "\"");
                }
                else
@@ -60,7 +61,6 @@ if (isset($_POST))
                }
        }
 }
-
 $userlist = [];
 Hook::run(HOOKTYPE_GET_USER_LIST, $userlist);
 
@@ -96,6 +96,15 @@ Click on a username to view more information.
                                <label for="password" id="user_add">Password
                                        <input style="width: 170%;" name="password" id="password" class="form-control curvy" type="password"></label>
                        </div>
+                       <div class="input-group mb-3">
+                               <label for="user_role" id="user_add">Role
+                               <select name="user_role" class="custom-select form-control" id="user_role" style="width:170%">
+                                       <?php
+                                               foreach(get_panel_user_roles_list() as $s => $l)
+                                                       echo "<option value=\"$s\">$s</option>";
+                                       ?>
+                               </select>
+                       </div>
                        <div class="input-group mb-3">
                                <label for="user_email" id="user_add">Email
                                        <input style="width: 170%;" name="user_email" id="user_email" class="form-control curvy" type="text"></label>
@@ -130,6 +139,7 @@ Click on a username to view more information.
        <form method="post">
        <th scope="col"><input type="checkbox" label='selectall' onClick="toggle_tkl(this)" /></th>
        <th scope="col">Username</th>
+       <th scope="col">Role</th>
        <th scope="col">First Name</th>
        <th scope="col">Last Name</th>
        <th scope="col">Email</th>
@@ -145,6 +155,7 @@ Click on a username to view more information.
                        
                        echo "<td scope=\"col\"><input type=\"checkbox\" value='" .$user->id . "' name=\"userch[]\"></td>";
                        echo "<td scope=\"col\"><a href=\"".get_config("base_url")."settings/user-edit.php?id=$user->id\">$user->username</a></td>";
+                       echo "<td scope=\"col\"><code>".((isset($user->user_meta['role'])) ? $user->user_meta['role'] : "")."</code></td>";
                        echo "<td scope=\"col\">".$user->first_name."</td>";
                        echo "<td scope=\"col\">".$user->last_name."</td>";
                        echo "<td scope=\"col\"><a href=\"mailto:$user->email\">$user->email</a></td>";
@@ -182,4 +193,4 @@ Click on a username to view more information.
        </div>
        </div></form></div></div><br></div>
 <?php
-require_once '../footer.php'; ?>
+require_once '../inc/footer.php'; ?>