]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - Classes/class-paneluser.php
Finalize ability to edit channel modes
[irc/unrealircd/unrealircd-webpanel.git] / Classes / class-paneluser.php
index fc8337be7459311499b0539cb9545700a31d88a7..c813992813780dc57363b7a21000a40e3e906a1f 100644 (file)
@@ -25,6 +25,8 @@ define('PERMISSION_BAN_EXCEPTION_DEL', 'be_del');
 define('PERMISSION_SPAMFILTER_ADD', 'sf_add'); 
 /** Can delete spamfilter entries */
 define('PERMISSION_SPAMFILTER_DEL', 'sf_del'); 
+/** Can rehash servers */
+define('PERMISSION_REHASH', 'rhs');
 /**
  * PanelUser
  * This is the User class for the SQL_Auth plugin
@@ -51,7 +53,6 @@ class PanelUser
                $user["name"] = $name;
                $user["id"] = $id;
                $user["object"] = NULL;
-
                Hook::run(HOOKTYPE_USER_LOOKUP, $user);
                foreach ($user['object'] as $key => $value)
                        $this->$key = $value;
@@ -131,6 +132,15 @@ class PanelUser
                $this->user_meta['permissions'] = serialize($meta);
        }
 
+       /** Updates core user info.
+        * CAUTION: Updating a non-existent column will crash
+        * your shit
+        */
+       function update_core_info($array)
+       {
+               $arr = ['info' => $array, 'user' => $this];
+               Hook::run(HOOKTYPE_EDIT_USER, $arr);
+       }
 }
 
 
@@ -148,7 +158,6 @@ class PanelUser_Meta
                $arr["id"] = $id;
                $arr['meta'] = &$array;
                Hook::run(HOOKTYPE_USERMETA_GET, $arr);
-               do_log($array);
                $this->list = $arr['meta'];
                
        }
@@ -179,6 +188,7 @@ function create_new_user(array &$user) : bool
        $user['fname'] = (isset($user['fname'])) ? htmlspecialchars($user['fname']) : NULL;
        $last['lname'] = (isset($user['lname'])) ? htmlspecialchars($user['lname']) : NULL;
        $user['user_bio'] = (isset($user['user_bio'])) ? htmlspecialchars($user['user_bio']) : NULL;
+       $user['email'] = (isset($user['user_email'])) ? htmlspecialchars($user['user_email']) : NULL;
 
        if (($u = new PanelUser($user['user_name']))->id)
        {
@@ -224,6 +234,8 @@ function unreal_get_current_user() : PanelUser|bool
 function current_user_can($permission) : bool
 {
        $user = unreal_get_current_user();
+       if (!$user)
+               return false;
        return user_can($user, $permission);
 }
 
@@ -274,9 +286,9 @@ function get_panel_user_permission_list()
        $list = [
                "Can add/delete/edit Admin Panel users" => PERMISSION_MANAGE_USERS,
                "Can ban/kill IRC users" => PERMISSION_BAN_USERS,
-               "Can hange properties of a user, i.e. vhost, modes and more" => PERMISSION_EDIT_USER,
+               "Can change properties of a user, i.e. vhost, modes and more" => PERMISSION_EDIT_USER,
                "Can change properties of a channel, i.e. topic, modes and more" => PERMISSION_EDIT_CHANNEL,
-               "Change properties of a user on a channel i.e give/remove voice or ops and more" => PERMISSION_EDIT_CHANNEL_USER,
+               "Can change properties of a user on a channel i.e give/remove voice or ops and more" => PERMISSION_EDIT_CHANNEL_USER,
                "Can add manual bans, including G-Lines, Z-Lines and more" => PERMISSION_SERVER_BAN_ADD,
                "Can remove set bans, including G-Lines, Z-Lines and more" => PERMISSION_SERVER_BAN_DEL,
                "Can forbid usernames and channels" => PERMISSION_NAME_BAN_ADD,
@@ -313,4 +325,4 @@ function generate_panel_user_permission_table($user)
 
                <?php
        }
-}
\ No newline at end of file
+}