/** * checks if menu should be displayed to the user depending * on the users credentials * @param array $item menu item * @return boolean $res true if we display and false if we don't */ public static function checkMenuAuth($item = array()) { if (!empty($item['auth'])) { // anon if ($item['auth'] == 'anon') { return true; } // anon_only if ($item['auth'] == 'anon_only') { if (session::isUser()) { return false; } else { return true; } } // if set we need at least a user if (!session::isUser()) { return false; } // if admin is set we need admin if (!session::isAdmin() && $item['auth'] == 'admin') { return false; } // we need super if (!session::isSuper() && $item['auth'] == 'super') { return false; } return true; } return true; }