本文整理汇总了PHP中core::get_nick方法的典型用法代码示例。如果您正苦于以下问题:PHP core::get_nick方法的具体用法?PHP core::get_nick怎么用?PHP core::get_nick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::get_nick方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: info_command
public static function info_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
// get the nickname.
if ($unick == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'INFO'));
// wrong syntax
return false;
}
// make sure they've entered a channel
if (!($user = services::user_exists($unick, false, array('display', 'suspended', 'suspend_reason', 'last_hostmask', 'timestamp', 'last_timestamp')))) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick));
return false;
}
// make sure the user exists
if ($user->suspended == 1) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_SUSPENDED_1, array('nick' => $user->display));
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_SUSPENDED_2, array('reason' => $user->suspend_reason));
} else {
$hostmask = explode('!', $user->last_hostmask);
$hostmask = $hostmask[1];
// get the hostmask
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_1, array('nick' => $user->display));
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_2, array('time' => date("F j, Y, g:i a", $user->timestamp)));
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_3, array('time' => date("F j, Y, g:i a", $user->last_timestamp != 0 ? $user->last_timestamp : core::$network_time)));
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_4, array('host' => $hostmask));
// standard messages
if (core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false || $unick == $nick && services::user_exists($nick, true, array('display', 'identified')) !== false) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_5, array('email' => nickserv::get_flags($nick, 'e')));
}
// if the person doing /ns info has staff powers we show the email
// or if someone is doing /ns info on themselves we show it.
$url = nickserv::get_flags($unick, 'u');
if ($url != null) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_6, array('url' => $url));
}
// url
$list = '';
if (nickserv::check_flags($unick, array('S'))) {
$list .= 'Secure, ';
}
if (nickserv::check_flags($unick, array('P'))) {
$list .= 'Private Message';
}
if (substr($list, -2, 2) == ', ') {
$list = substr($list, 0, -2);
}
// compile our list of options
if ($list != '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_7, array('options' => $list));
}
// if our list doesn't equal '', eg. empty show the info.
if (core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false && core::$config->nickserv->expire != 0) {
$expiry_time = core::$config->nickserv->expire * 86400;
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INFO_8, array('time' => date("F j, Y, g:i a", $user->last_timestamp != 0 ? $user->last_timestamp : core::$network_time + $expiry_time)));
}
// if the nick in question has staff powers, we show the expiry times.
}
}
示例2: main
public function main(&$ircdata, $startup = false)
{
foreach (modules::$list as $module => $data) {
if ($data['type'] == 'nickserv') {
modules::$list[$module]['class']->main(&$ircdata, $startup);
// loop through the modules for nickserv.
}
}
if (ircd::on_msg(&$ircdata, core::$config->nickserv->nick)) {
$nick = core::get_nick(&$ircdata, 0);
$command = substr(core::get_data_after(&$ircdata, 3), 1);
// convert to lower case because all the tingy wags are in lowercase
self::get_command($nick, $command);
}
// this is what we use to handle command listens
// should be quite epic.
if (ircd::on_mode(&$ircdata) && core::$config->server->help_chan) {
$chan = core::get_chan(&$ircdata, 2);
if ($chan == strtolower(core::$config->server->help_chan)) {
$re_data = $ircdata;
unset($re_data[0], $re_data[1], $re_data[2], $re_data[3]);
foreach ($re_data as $nick) {
// we're going to guess that it's a nick here, lol.
if (strstr(core::$chans[$chan]['users'][$nick], 'o')) {
ircd::umode(core::$config->nickserv->nick, $nick, '+h');
}
// user has +o, lets give em +h!
}
}
// only deal with it if we're talking about the help chan
}
// here we deal with giving umode +h to ops :D
if (ircd::on_chan_create(&$ircdata) && core::$config->server->help_chan) {
$chans = explode(',', $ircdata[2]);
// chans
foreach ($chans as $chan) {
if ($chan == strtolower(core::$config->server->help_chan)) {
// the chan
$nusers_str = implode(' ', $ircdata);
$nusers_str = explode(':', $nusers_str);
// right here we need to find out where the thing is
$nusers = ircd::parse_users($chan, $nusers_str, 1);
foreach ($nusers as $nick => $modes) {
if (strstr($modes, 'o')) {
ircd::umode(core::$config->nickserv->nick, $nick, '+h');
}
// user has +o, lets give em +h!
}
}
// only deal with it if we're talking about the help chan
}
}
// and on_chan_create
}
示例3: main
public function main(&$ircdata, $startup = false)
{
if (ircd::on_msg(&$ircdata, core::$config->nickserv->nick)) {
$nick = core::get_nick(&$ircdata, 0);
$query = substr(core::get_data_after(&$ircdata, 3), 1);
// convert to lower case because all the tingy wags are in lowercase
$query = strtolower($query);
nickserv::get_help($nick, $query);
}
// only hook to the privmsg towards ChanServ, not channel messages
// although chanserv shouldn't even be in any channels :P
}
示例4: main
public function main(&$ircdata, $startup = false)
{
if (ircd::on_msg(&$ircdata, core::$config->operserv->nick)) {
$nick = core::get_nick(&$ircdata, 0);
$query = substr(core::get_data_after(&$ircdata, 3), 1);
// convert to lower case because all the tingy wags are in lowercase
$query = strtolower($query);
if (core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified') !== false)) {
operserv::get_help($nick, $query);
}
}
// only hook to the privmsg towards OperServ
}
示例5: drop_command
public static function drop_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
$password = $ircdata[1];
// get the nick.
if (trim($unick) == '' || trim($password) == '' && (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'DROP'));
return false;
}
// invalid syntax
if (services::is_root($unick) && !services::is_root($nick)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// is a non-root trying to drop a root?
if ($user = services::user_exists($unick, false, array('id', 'display', 'pass', 'salt', 'suspended'))) {
if ($user->suspended == 1) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_1, array('nick' => $user->display));
return false;
}
// are they suspended?
if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) {
database::delete('users', array('display', '=', $user->display));
database::delete('users_flags', array('nickname', '=', $user->display));
// delete the users record
database::delete('chans_levels', array('target', '=', $user->display));
// also delete this users channel access.
core::alog(core::$config->nickserv->nick . ': ' . $user->display . ' has been dropped by ' . core::get_full_hostname($nick));
// logchan it
core::alog('drop_command(): ' . $user->display . ' has been dropped by ' . core::get_full_hostname($nick), 'BASIC');
// log what we need to log.
if (isset(core::$nicks[$user->display])) {
ircd::on_user_logout($nick->display);
}
// if the nick is being used unregister it, even though it shouldn't be?
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_DROPPED, array('nick' => $user->display));
// let the nick know the account has been dropped.
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD);
// password isn't correct
}
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick));
return false;
// doesn't even exist..
}
}
示例6: on_fantasy_cmd
public static function on_fantasy_cmd(&$ircdata, $command, $nick)
{
$prefix = ':' . core::$config->chanserv->fantasy_prefix;
$chan = core::get_chan(&$ircdata, 2);
$command = strtolower($command);
$realdata = strtolower($ircdata[3]);
$from = core::get_nick(&$ircdata, 0);
if (services::check_mask_ignore($nick) === true) {
return false;
}
// this is basically to check if we have
// an ignored user, via their hostmask, or their nickname.
if (core::$nicks[$from]['ignore']) {
return false;
}
// are they ignored w/ the flood system?
if (!isset(core::$chans[$chan]['users'][$nick])) {
return false;
}
// the user needs to be in the channel
if ($prefix . $command == $realdata) {
return true;
}
// return true on any command match.
}
示例7: on_kick
public static function on_kick(&$ircdata)
{
if (ircd::on_kick(&$ircdata)) {
$nick = core::get_nick(&$ircdata, 0);
$chan = core::get_chan(&$ircdata, 2);
$who = core::get_nick(&$ircdata, 3);
if ($who == core::$config->chanserv->nick || str_replace(':', '', $ircdata[0]) == array_search(core::$config->chanserv->nick, core::$uids)) {
ircd::join_chan(core::$config->chanserv->nick, $chan);
// join the chan.
core::$chans[$chan]['users'][core::$config->chanserv->nick] = '';
// add chanserv to the users array, housekeeping it :D
if (ircd::$protect) {
ircd::mode(core::$config->chanserv->nick, $chan, '+ao ' . core::$config->chanserv->nick . ' ' . core::$config->chanserv->nick);
} else {
ircd::mode(core::$config->chanserv->nick, $chan, '+o ' . core::$config->chanserv->nick);
}
// +o its self.
}
// what the fuck is this tool doing.. kicking us!!?! we SHOULD kick their ass
// but we're not gonna x]
if (count(core::$chans[$chan]['users']) == 1 && isset(core::$chans[$chan]['users'][core::$config->chanserv->nick])) {
ircd::part_chan(core::$config->chanserv->nick, $chan);
// leave the channel.
}
// we're the only person in the channel.. hopefully, lets leave x]
}
}
示例8: main
public function main(&$ircdata, $startup = false)
{
if (ircd::on_chan_create(&$ircdata)) {
$chans = explode(',', $ircdata[2]);
// the chans
foreach ($chans as $chan) {
$nusers_str = implode(' ', $ircdata);
$nusers_str = explode(':', $nusers_str);
// right here we need to find out where the thing is
$nusers = ircd::parse_users($chan, $nusers_str, 1);
if (!($channel = services::chan_exists($chan, array('channel')))) {
return false;
}
// if the channel doesn't exist we return false, to save us the hassle of wasting
// resources on this stuff below.
self::on_create($nusers, $channel);
// on_create event
}
}
// we give out the nessicary access when a channel is created :)
if (ircd::on_join(&$ircdata)) {
$nick = core::get_nick(&$ircdata, 0);
$chans = explode(',', $ircdata[2]);
// get the channel & nick
foreach ($chans as $chan) {
if (!($channel = services::chan_exists($chan, array('channel')))) {
return false;
}
// if the channel doesn't exist we return false, to save us the hassle of wasting
// resources on this stuff below.
if ($nick == core::$config->chanserv->nick) {
continue;
}
// skip us :D
$hostname = core::get_full_hostname($nick);
// generate a hostname
if ($reason = chanserv::check_levels($nick, $chan, array('b'), true, false, true)) {
ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . core::$nicks[$nick]['host']);
ircd::kick(core::$config->chanserv->nick, $nick, $chan, $reason);
return false;
}
// check for bans before access
$access_array = self::get_access($channel->channel);
// get the access array
foreach ($access_array as $target => $access) {
if ($target == $nick) {
$remove_access = false;
// don't remove access
self::give_access($channel->channel, $nick, $access, chanserv::check_flags($chan, array('S')));
// give them access
break;
// break cause we've found a match
} elseif (strpos($target, '@') !== false && services::match($hostname, $target)) {
$remove_access = false;
// don't remove access
self::give_access($channel->channel, $nick, $access, chanserv::check_flags($chan, array('S')));
// give them access
break;
// break cause we've found a match
} elseif (strpos(core::$chans[$channel->channel]['users'][$nick], 'o') !== false) {
$remove_access = true;
// set remove access to true
continue 1;
// continue to next loop to check other access records
} elseif (strpos(core::$chans[$channel->channel]['users'][$nick], 'h') !== false) {
$remove_access = true;
// set remove access to true
continue 1;
// continue to next loop to check other access records
} else {
continue 1;
// continue to next loop to check other access records
}
// we check if the user has access, if they do break;
// we also check if they dont have access and have op, if they do remove it.
}
// loop through the access records
if ($remove_access) {
ircd::mode(core::$config->chanserv->nick, $channel->channel, '-oh ' . $nick . ' ' . $nick);
}
// easy fix to stop stuff like this below happening.
// [20:27:19] * ChanServ sets mode: -o N0valyfe
// [20:27:19] * ChanServ sets mode: +o N0valyfe
}
}
// and the same when someone joins
}
示例9: main
public function main(&$ircdata, $startup = false)
{
if (ircd::on_connect(&$ircdata)) {
$nick = core::get_nick(&$ircdata, core::$config->server->ircd == 'inspircd12' ? 4 : 3);
// get nick
if ($user = services::user_exists($nick, false, array('display', 'identified', 'validated', 'last_hostmask', 'suspended'))) {
if ($user->validated == 0 && $user->suspended == 0) {
ircd::on_user_logout($nick);
// they shouldn't really have registered mode
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_AWAITING_VALIDATION);
} elseif ($user->identified == 0 && $user->suspended == 0) {
self::_registered_nick($nick, $user);
} elseif ($user->identified == 1 && $user->last_hostmask == core::get_full_hostname($nick)) {
ircd::on_user_login($nick);
if (!$startup) {
core::alog(core::$config->nickserv->nick . ': ' . core::$nicks[$nick]['ident'] . '@' . core::$nicks[$nick]['host'] . ' automatically identified for ' . $nick);
}
} else {
self::_registered_nick($nick, $user);
}
}
// is the user existing?
}
// on connect let them know that they're using
// an identified nickname
if (ircd::on_nick_change(&$ircdata)) {
$nick = core::get_nick($ircdata, 2);
$old_nick = core::$nicks[$nick]['onick'];
// get the nicknames
timer::remove(array('ns_identify', 'secured_callback', array($old_nick)));
// remove the secured timer. if there is one
ircd::on_user_logout($nick);
// we remove the registered mode
if ($user = services::user_exists($nick, false, array('display', 'identified', 'validated', 'last_hostmask', 'suspended'))) {
if ($user->validated == 0 && $user->suspended == 0) {
ircd::on_user_logout($nick);
// they shouldn't really have registered mode
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_AWAITING_VALIDATION);
} elseif ($user->identified == 0 && $user->suspended == 0) {
self::_registered_nick($nick, $user);
} elseif ($user->identified == 1 && $user->last_hostmask == core::get_full_hostname($nick)) {
ircd::on_user_login($nick);
core::alog(core::$config->nickserv->nick . ': ' . core::$nicks[$nick]['ident'] . '@' . core::$nicks[$nick]['host'] . ' automatically identified for ' . $nick);
} else {
self::_registered_nick($nick, $user);
}
}
// is the new nick registered? let them know
}
if (ircd::on_quit(&$ircdata)) {
$nick = core::get_nick(&$ircdata, 0);
timer::remove(array('ns_identify', 'secured_callback', array($nick)));
// remove the secured timer. if there is one
database::update('users', array('identified' => 0, 'last_timestamp' => core::$network_time), array('display', '=', $nick));
// change nick to unidentified imo
}
}
示例10: main
public function main(&$ircdata, $startup = false)
{
if ($startup) {
return false;
}
// we're booting, fuck sending messages to everyone, they don't want to see
// it if it's just a restart, and we don't want to waste the resources on it.
if (ircd::on_connect(&$ircdata)) {
$nick = core::get_nick(&$ircdata, core::$config->server->ircd == 'inspircd12' ? 4 : 3);
$get_news = database::select('logon_news', array('nick', 'title', 'message', 'time'), '', array('time', 'DESC'), array(0 => 3));
// get our news
if (database::num_rows($get_news) > 0) {
if (isset(operserv::$help->OS_LOGON_START)) {
services::communicate(core::$config->global->nick, $nick, &operserv::$help->OS_LOGON_START);
}
while ($news = database::fetch($get_news)) {
services::communicate(core::$config->global->nick, $nick, &operserv::$help->OS_LOGON_NEWS_1, array('title' => $news->title, 'user' => $news->nick, 'date' => date("F j, Y, g:i a", $news->time)));
services::communicate(core::$config->global->nick, $nick, &operserv::$help->OS_LOGON_NEWS_2, array('message' => $news->message));
}
// loop through the news
if (isset(operserv::$help->OS_LOGON_END)) {
services::communicate(core::$config->global->nick, $nick, &operserv::$help->OS_LOGON_END);
}
}
// there is news! epic
}
// trigger on connects
}
示例11: main
public function main(&$ircdata, $startup = false)
{
foreach (modules::$list as $module => $data) {
if ($data['type'] == 'operserv') {
modules::$list[$module]['class']->main(&$ircdata, $startup);
// loop through the modules for operserv.
}
}
if (ircd::on_msg(&$ircdata, core::$config->operserv->nick)) {
$nick = core::get_nick(&$ircdata, 0);
$command = substr(core::get_data_after(&$ircdata, 3), 1);
// convert to lower case because all the tingy wags are in lowercase
core::alog(core::$config->operserv->nick . ': ' . $nick . ': ' . $command);
// logchan it
if (core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified') !== false)) {
self::get_command($nick, $command);
} else {
services::communicate(core::$config->operserv->nick, $nick, &self::$help->OS_DENIED_ACCESS);
}
// theyre an oper.
}
// this is what we use to handle command listens
// should be quite epic.
}
示例12: main
public function main(&$ircdata, $startup = false)
{
if (ircd::on_msg(&$ircdata)) {
$nick = core::get_nick(&$ircdata, 0);
$chan = core::get_chan(&$ircdata, 2);
//if ( core::search_nick( $chan ) !== false )
//return false;
// bail if it thinks chan == nick.
if (!($channel = services::chan_exists($chan, array('channel')))) {
return false;
}
// channel isnt registered, halt immediatly..
// either something has cocked up or someone
// has forced us into a channel :S
if (chanserv::check_flags($chan, array('F')) === false) {
return false;
}
// we gotta check if the channel has fantasy commands enabled first
if (commands::on_fantasy_cmd(&$ircdata, 'help', core::$config->chanserv->nick)) {
if (ircd::$halfop) {
$help =& chanserv::$help->CS_HELP_FANTASY_ALL1;
} else {
$help =& chanserv::$help->CS_HELP_FANTASY_ALL2;
}
foreach ($help as $line) {
services::communicate(core::$config->chanserv->nick, $nick, $line, array('p' => core::$config->chanserv->fantasy_prefix));
}
}
// !help command
if (commands::on_fantasy_cmd(&$ircdata, 'owner', core::$config->chanserv->nick) && ircd::$owner) {
if (chanserv::check_levels($nick, $channel->channel, array('q', 'f', 'F')) === false) {
return false;
}
if (strpos($ircdata[4], ':') !== false) {
mode::type_check($chan, $ircdata[4], '+q', core::$config->chanserv->nick);
} elseif (isset($ircdata[4])) {
ircd::mode(core::$config->chanserv->nick, $chan, '+q ' . $ircdata[4]);
} else {
ircd::mode(core::$config->chanserv->nick, $chan, '+q ' . $nick);
}
// check if another param is specified
}
// !owner command
if (commands::on_fantasy_cmd(&$ircdata, 'deowner', core::$config->chanserv->nick) && ircd::$owner) {
if (chanserv::check_levels($nick, $channel->channel, array('q', 'f', 'F')) === false) {
return false;
}
if (strpos($ircdata[4], ':') !== false) {
mode::type_check($chan, $ircdata[4], '-q', core::$config->chanserv->nick);
} elseif (isset($ircdata[4])) {
ircd::mode(core::$config->chanserv->nick, $chan, '-q ' . $ircdata[4]);
} else {
ircd::mode(core::$config->chanserv->nick, $chan, '-q ' . $nick);
}
// check if another param is specified
}
// !deowner command
if (commands::on_fantasy_cmd(&$ircdata, 'protect', core::$config->chanserv->nick) && ircd::$protect) {
if (chanserv::check_levels($nick, $channel->channel, array('a', 'q', 'f', 'F')) === false) {
return false;
}
if (strpos($ircdata[4], ':') !== false) {
mode::type_check($chan, $ircdata[4], '+a', core::$config->chanserv->nick);
} elseif (isset($ircdata[4])) {
ircd::mode(core::$config->chanserv->nick, $chan, '+a ' . $ircdata[4]);
} else {
ircd::mode(core::$config->chanserv->nick, $chan, '+a ' . $nick);
}
// check if another param is specified
}
// !protect command
if (commands::on_fantasy_cmd(&$ircdata, 'deprotect', core::$config->chanserv->nick) && ircd::$protect) {
if (chanserv::check_levels($nick, $channel->channel, array('a', 'q', 'f', 'F')) === false) {
return false;
}
if (strtolower($ircdata[4]) == strtolower(core::$config->chanserv->nick)) {
return false;
}
if (strpos($ircdata[4], ':') !== false) {
mode::type_check($chan, $ircdata[4], '-a', core::$config->chanserv->nick);
} elseif (isset($ircdata[4])) {
ircd::mode(core::$config->chanserv->nick, $chan, '-a ' . $ircdata[4]);
} else {
ircd::mode(core::$config->chanserv->nick, $chan, '-a ' . $nick);
}
// check if another param is specified
}
// !protect command
if (commands::on_fantasy_cmd(&$ircdata, 'op', core::$config->chanserv->nick)) {
if (chanserv::check_levels($nick, $channel->channel, array('o', 'a', 'q', 'f', 'F')) === false) {
return false;
}
if (strpos($ircdata[4], ':') !== false) {
mode::type_check($chan, $ircdata[4], '+o', core::$config->chanserv->nick);
} elseif (isset($ircdata[4])) {
ircd::mode(core::$config->chanserv->nick, $chan, '+o ' . $ircdata[4]);
} else {
ircd::mode(core::$config->chanserv->nick, $chan, '+o ' . $nick);
}
// check if another param is specified
//.........这里部分代码省略.........
示例13: main
public function main(&$ircdata, $startup = false)
{
if (ircd::on_mode(&$ircdata)) {
$nick = core::get_nick(&$ircdata, 0);
$chan = core::get_chan(&$ircdata, 2);
$mode_queue = core::get_data_after(&$ircdata, 4);
if (strpos($nick, '.') !== false && core::$config->server->ircd != 'inspircd12') {
$server = $nick;
} elseif (strlen($nick) == 3 && core::$config->server->ircd == 'inspircd12') {
$server = core::$servers[$nick]['sid'];
} else {
$server = '';
}
// we've found a.in nick, which means it's a server? And it's NOT insp1.2
// OR we've noticed $nick is 3 chars long, which is a SID and it's insp1.2
if ($server == core::$config->ulined_servers || is_array(core::$config->ulined_servers) && in_array($server, core::$config->ulined_servers)) {
return false;
}
// ignore mode changing from ulined servers.
if (!($channel = services::chan_exists($chan, array('channel')))) {
return false;
}
// channel isnt registered
$modelock = chanserv::get_flags($chan, 'm');
// get the modelock
if ($modelock != null) {
$nmodelock = explode(' ', $modelock);
foreach (str_split($nmodelock[0]) as $mode) {
if (strstr($mode_queue, $mode)) {
ircd::mode(core::$config->chanserv->nick, $chan, $modelock);
}
// reset the modes
}
}
// modelock?
}
// we need to check for any modechanges here, for modelocking
if (ircd::on_part(&$ircdata)) {
$chan = core::get_chan(&$ircdata, 2);
// get the channel
if (chanserv::check_flags($chan, array('L'))) {
timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1);
// add a timer to update the limit, in 15 seconds
}
// is there auto-limit enabled?
}
// on part we check for
if (ircd::on_quit(&$ircdata)) {
foreach (core::$chans as $chan => $data) {
if (chanserv::check_flags($chan, array('L'))) {
timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1);
// add a timer to update the limit, in 15 seconds
}
// is there auto-limit enabled?
}
}
// on part we check for
if (ircd::on_join(&$ircdata)) {
$nick = core::get_nick(&$ircdata, 0);
$chans = explode(',', $ircdata[2]);
// find the nick & chan
foreach ($chans as $chan) {
if (!($channel = services::chan_exists($chan, array('channel')))) {
return false;
}
// channel isnt registered
if (chanserv::check_flags($chan, array('I'))) {
if (chanserv::check_levels($nick, $chan, array('k', 'q', 'a', 'o', 'h', 'v', 'F'), true, false) === false) {
ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . core::$nicks[$nick]['host']);
ircd::kick(core::$config->chanserv->nick, $nick, $chan, '+k only channel.');
return false;
}
// they don't have +k, KICKEM
}
// is the channel +I, eg, +k users only?
$welcome = chanserv::get_flags($chan, 'w');
// get the welcome msg
if ($welcome != null) {
ircd::notice(core::$config->chanserv->nick, $nick, '(' . $chan . ') ' . $welcome);
// we give them the welcome msg
}
// is there any welcome msg? notice it to them
if (chanserv::check_flags($chan, array('L'))) {
timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1);
// add a timer to update the limit, in 15 seconds
}
// is there auto-limit enabled?
}
}
// on_join entry msg
// this is just a basic JOIN trigger
if (ircd::on_chan_create(&$ircdata)) {
$chans = explode(',', $ircdata[2]);
// chan
foreach ($chans as $chan) {
$nusers_str = implode(' ', $ircdata);
$nusers_str = explode(':', $nusers_str);
// right here we need to find out where the thing is
$nusers = ircd::parse_users($chan, $nusers_str, 1);
if (!($channel = services::chan_exists($chan, array('channel')))) {
//.........这里部分代码省略.........
示例14: saflags_command
public static function saflags_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
$flags = $ircdata[1];
$param = core::get_data_after(&$ircdata, 2);
$rparams = explode('||', $param);
// get the channel.
if (!($user = services::user_exists($unick, false, array('display', 'id', 'identified', 'salt')))) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick));
return false;
}
// find out if our user is registered
if (services::is_root($unick) && !services::is_root($nick)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// is a non-root trying to change a root's password?
if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// do we have access to do this?
$flag_a = array();
foreach (str_split($flags) as $flag) {
if (strpos(self::$flags, $flag) === false) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_FLAGS_UNKNOWN, array('flag' => $flag));
return false;
}
// flag is invalid.
$flag_a[$flag]++;
// plus
if ($flag_a[$flag] > 1 || $flag != '-' && $flag != '+') {
$flag_a[$flag]--;
}
// check for dupes
}
// check if the flag is valid
$flags = '';
foreach ($flag_a as $flag => $count) {
$flags .= $flag;
}
// reconstruct the flags
$flag_array = mode::sort_modes($flags, false);
// sort our flags up
foreach (str_split(self::$p_flags) as $flag) {
$param_num = strpos($flag_array['plus'], $flag);
if ($param_num !== false) {
$params[$flag] = trim($rparams[$param_num]);
}
// we do!
}
// check if we have any paramtized flags, eg +me
foreach (str_split($flag_array['plus']) as $flag) {
// paramtized flags (lowercase) ones come first
// ----------- +e ----------- //
if ($flag == 'e') {
self::set_flag($nick, $unick, '+e', $params['e']);
// +e the target in question
} elseif ($flag == 'u') {
self::set_flag($nick, $unick, '+u', $params['u']);
// +u the target in question
} elseif ($flag == 'S') {
self::set_flag($nick, $unick, '+S', '');
// +S the target in question
} elseif ($flag == 'P') {
self::set_flag($nick, $unick, '+P', '');
// +P the target in question
}
// ----------- +P ----------- //
}
foreach (str_split($flag_array['minus']) as $flag) {
// paramtized flags (lowercase) ones come first
// ----------- -e ----------- //
if ($flag == 'e') {
self::set_flag($nick, $unick, '-e', $params['e']);
// -e the target in question
} elseif ($flag == 'u') {
self::set_flag($nick, $unick, '-u', $params['u']);
// -u the target in question
} elseif ($flag == 'S') {
self::set_flag($nick, $unick, '-S', '');
// -S the target in question
} elseif ($flag == 'P') {
self::set_flag($nick, $unick, '-P', '');
// -P the target in question
}
// ----------- -P ----------- //
}
if (isset(self::$set[$unick])) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_FLAGS_SET, array('flag' => self::$set[$unick], 'target' => $unick));
unset(self::$set[$unick]);
}
// send back the target stuff..
if (isset(self::$already_set[$unick])) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_FLAGS_ALREADY_SET, array('flag' => self::$already_set[$unick], 'target' => $unick));
unset(self::$already_set[$unick]);
}
// send back the target stuff..
if (isset(self::$not_set[$unick])) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_FLAGS_NOT_SET, array('flag' => self::$not_set[$unick], 'target' => $unick));
//.........这里部分代码省略.........
示例15: handle_oper_up
public static function handle_oper_up(&$ircdata)
{
$nick = core::get_nick($ircdata, 0);
core::$nicks[$nick]['ircop'] = true;
}