public static function getPermbits(Dog_Server $server, Dog_User $user, $needlogin = true) { $bits = $user->isRegistered() ? Dog_IRCPriv::REGBIT : 0; if ($needlogin && !$user->isLoggedIn()) { return $bits; } $uid = $user->getID(); $sid = $server->getID(); if (0 === ($bits = $user->getVarDefault("dsp_{$sid}", 0))) { $bits |= Dog_IRCPriv::LOGBIT; $bits |= self::table(__CLASS__)->selectVar('priv_privs', "priv_sid={$sid} AND priv_uid={$uid}"); # Cache if ($user->isHoster()) { $bits |= Dog_IRCPriv::HOSTBIT; } $user->setVar("dsp_{$sid}", $bits); } return $bits; }