Last active
December 14, 2015 05:48
-
-
Save DivinityArcane/5037496 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_privs($ns, $user, $privs, $sort = true) { | |
if (!in_array($user, $this->bdschannel[$ns]['privs'][$privs])) { | |
array_push($this->bdschannel[$ns]['privs'][$privs], $user); | |
if ($sort) | |
ksort($this->bdschannel[$ns]['privs'][$privs]); | |
} | |
} | |
function remove_privs($ns, $user, $sort = true) { | |
foreach ($this->bdschannel[$ns]['privs'] as $priv => $arr) { | |
if (in_array($user, $arr)) { | |
unset($this->bdschannel[$ns]['privs'][$priv][array_search($user, $arr)]); | |
if ($sort) | |
ksort($this->bdschannel[$ns]['privs'][$priv]); | |
} | |
} | |
} | |
function change_privs($ns, $user, $privs, $sort = true) { | |
$this->remove_privs($ns, $user, $sort); | |
$this->add_privs($ns, $user, $privs, $sort); | |
} | |
function check_privs($ns, $user, $privs) { | |
return in_array($user, $this->bdschannel[$ns]['privs'][$privs]); | |
} | |
function get_privs($ns, $user) { | |
foreach ($this->bdschannel[$ns]['privs'] as $priv => $arr) { | |
if (in_array($user, $arr)) { | |
return $priv; | |
} | |
} | |
return -1; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment