Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkMenu($permission, $id = 0) {
- $db = DB::getInstance();
- global $user;
- if ($id == 0 && $user->isLoggedIn()) $id = $user->data()->id;
- //Grant access if master user
- $access = 0;
- if ($access == 0){
- $query = $db->query("SELECT id FROM user_permission_matches WHERE user_id = ? AND permission_id = ?",array($id,$permission));
- $results = $query->count();
- if ($results > 0){
- $access = 1;
- }
- }
- if ($access == 1){
- return true;
- }
- if ($user->isLoggedIn() && $user->data()->id == 1){
- return true;
- }else{
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement