private function logOutput($to, $message) { if ($this->isLogging()) { if (false !== ($channel = Dog::getChannel())) { Dog_Log::channel($channel, $message); } if (false !== ($user = $this->getUserByName($to))) { Dog_Log::user($user, $message); } } }
# :gizmore!gizmore@localhost PRIVMSG Dog :.join #sr if (false === ($user = Dog::getOrCreateUser())) { return; } $serv = Dog::getServer(); $serv->addUser($user); $user = Dog::setupUser(); $chan = Dog::setupChannel(); if ($user === false) { return Dog::suppressModules(); } # Log PRIVMSGs $msg = Dog::getIRCMsg()->getArg(1); if (Dog::getIRCMsg()->shouldLog()) { Dog_Log::user($user, $msg); Dog_Log::channel($chan, $msg); } # Exec Stuff if (!$user->isBot()) { if ('' !== ($trigger = Common::substrUntil($msg, ' '))) { if (Dog_Init::isTrigger($serv, $chan, $trigger[0])) { if ($user->isFlooding()) { return; } Dog::setTriggered(); $trigger = substr($trigger, 1); if (false !== ($plug = Dog_Plugin::getPlug($trigger))) { if (!$plug->isInScope($serv, $chan)) { Dog::scopeError($plug->getScope()); } elseif (!$plug->hasPermission($serv, $chan, $user)) {
private function onAdd(Dog_User $user, $url) { if (false !== ($link = Dog_Link::getByURL($url))) { return true; } if (false === ($description = $this->getDescription($url))) { Dog_Log::error('Mod_Link::onAdd() failed. URL: ' . $url); return false; } $type = $description[0]; $description = $description[1]; switch ($type) { case 'image': if (false === ($link = Dog_Link::insertImage($user->getID(), $url, $description))) { GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); return; } break; case 'html': if (false === ($link = Dog_Link::insertLink($user->getID(), $url, $description))) { GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); return; } break; default: echo "UNKNOWN TYPE: {$type}\n"; return; } Dog_Log::user($user, sprintf('Inserted Link %s (ID:%d)', $url, $link->getID())); }