本文整理汇总了PHP中core::get_full_hostname方法的典型用法代码示例。如果您正苦于以下问题:PHP core::get_full_hostname方法的具体用法?PHP core::get_full_hostname怎么用?PHP core::get_full_hostname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::get_full_hostname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drop_command
public static function drop_command($nick, $ircdata = array())
{
$chan = core::get_chan(&$ircdata, 0);
// get the channel.
if (self::_drop_check($nick, $chan) === false) {
return false;
}
// do nessicary checks
if ($channel = services::chan_exists($chan, array('channel', 'suspended'))) {
if ($channel->suspended == 1) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_1, array('chan' => $chan));
return false;
}
}
// is the channel suspended?
database::delete('chans', array('channel', '=', $chan));
database::delete('chans_levels', array('channel', '=', $chan));
// delete all associated records
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_CHAN_DROPPED, array('chan' => $chan));
// let the user know
if (isset(core::$chans[$chan])) {
ircd::part_chan(core::$config->chanserv->nick, $chan);
// now lets leave the channel if we're in it
}
// is the channel in existance? if so unregister mode
// remember we DON'T unset the channel record, because the channel
// is still there, just isnt registered, completely different things
core::alog(core::$config->chanserv->nick . ': ' . $chan . ' has been dropped by ' . core::get_full_hostname($nick));
// logchan it
core::alog('drop_command(): ' . $chan . ' has been dropped by ' . core::get_full_hostname($nick), 'BASIC');
// log what we need to log.
}
示例2: ghost_command
public static function ghost_command($nick, $ircdata = array())
{
$unick = $ircdata[0];
$password = $ircdata[1];
// get the parameters.
if (trim($unick) == '' || trim($password) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'GHOST'));
return false;
}
// invalid syntax
if (!isset(core::$nicks[$unick])) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NOT_IN_USE, array('nick' => $unick));
return false;
// nickname isn't in use
}
if ($user = services::user_exists($unick, false, array('display', 'pass', 'salt'))) {
if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) {
ircd::kill(core::$config->nickserv->nick, $unick, 'GHOST command used by ' . core::get_full_hostname($nick));
core::alog(core::$config->nickserv->nick . ': GHOST command used on ' . $unick . ' by ' . core::get_full_hostname($nick));
} 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..
}
}
示例3: register_command
public static function register_command($nick, $ircdata = array())
{
$chan = core::get_chan(&$ircdata, 0);
$desc = core::get_data_after(&$ircdata, 1);
// get the channel.
if ($user = services::user_exists($nick, true, array('display', 'id'))) {
if (trim($desc) == '' || $chan == '' || $chan[0] != '#' || stristr($channel, ' ')) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'INFO'));
// wrong syntax
return false;
}
if (services::chan_exists($chan, array('channel')) !== false) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_REGISTERED_CHAN, array('chan' => $chan));
return false;
}
// check if its registered?
if (!strstr(core::$chans[$chan]['users'][$nick], 'o')) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_NEED_CHAN_OP, array('chan' => $chan));
return false;
}
// we need to check if the user trying to register it has +o
// if not we tell them to GET IT!
$chan_info = array('channel' => $chan, 'timestamp' => core::$network_time, 'last_timestamp' => core::$network_time, 'topic' => core::$chans[$chan]['topic'], 'topic_setter' => core::$chans[$chan]['topic_setter']);
$rflags = core::$config->chanserv->default_flags;
$rflags = str_replace('d', '', $rflags);
$rflags = str_replace('u', '', $rflags);
$rflags = str_replace('e', '', $rflags);
$rflags = str_replace('w', '', $rflags);
$rflags = str_replace('m', '', $rflags);
$rflags = str_replace('t', '', $rflags);
// ignore parameter flags
database::insert('chans', $chan_info);
database::insert('chans_levels', array('channel' => $chan, 'target' => $user->display, 'flags' => 'Ftfrsqao'));
database::insert('chans_flags', array('channel' => $chan, 'flags' => $rflags . 'd', 'desc' => $desc));
// create the channel! WOOOH
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_CHAN_REGISTERED, array('chan' => $chan));
core::alog(core::$config->chanserv->nick . ': ' . $chan . ' registered by ' . core::get_full_hostname($nick));
// logchan
core::alog('register_command(): ' . $chan . ' registered by ' . core::get_full_hostname($nick), 'BASIC');
// log what we need to log.
if ($channel = services::chan_exists($chan, array('channel', 'topic', 'suspended'))) {
chanserv::_join_channel(&$channel);
// join the channel
}
// does the channel exist?
} else {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_UNREGISTERED);
return false;
// ph00s aint even registered..
}
}
示例4: 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..
}
}
示例5: stats_command
public static function stats_command($nick, $ircdata = array())
{
$type = $ircdata[0];
// what type is it, currently valid types are
// UPTIME, NETWORK, SERVERS, OPERS
if (strtolower($type) == 'uptime') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_U_1, array('time' => core::format_time(core::$uptime)));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_U_2, array('memory' => core::get_size(memory_get_usage()), 'real' => memory_get_usage()));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_U_3, array('memory' => core::get_size(core::$incoming), 'real' => core::$incoming));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_U_4, array('memory' => core::get_size(core::$outgoing), 'real' => core::$outgoing));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_U_5, array('lines' => core::$lines_processed));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_U_6, array('lines' => core::$lines_sent));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_U_7, array('time' => core::$burst_time . 's'));
// uptime info, etc.
} elseif (strtolower($type) == 'network') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_N_1, array('network' => core::$config->server->network_name));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_N_2, array('version' => core::$version));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_N_3, array('users' => core::$max_users));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_N_4, array('users' => count(core::$nicks)));
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_N_5, array('chans' => count(core::$chans)));
// network info.
} elseif (strtolower($type) == 'opers') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_O_1);
foreach (core::$nicks as $user => $info) {
if (!$info['ircop'] || $info['server'] == core::$config->server->name) {
continue;
}
// skip if they aint an ircop
$false_host = core::get_full_hostname($user);
if (!isset($false_host[45])) {
$y = strlen($false_host);
for ($i = $y; $i <= 44; $i++) {
$false_host .= ' ';
}
}
// this is just a bit of fancy fancy, so everything displays neat
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_STATS_O_2, array('host' => $false_host, 'time' => date("F j, Y, g:i a", $info['timestamp'])));
}
// opers info.
} else {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'STATS'));
return false;
// wrong syntax
}
// if/else for our type, if one isnt given we bail out.
}
示例6: logout_command
public static function logout_command($nick, $ircdata = array())
{
// no parameter commands ftw.
if ($user = services::user_exists($nick, false, array('display', 'id', 'identified', 'vhost'))) {
if ($user->identified == 1) {
ircd::on_user_logout($nick);
// here we set unregistered mode
database::update('users', array('identified' => 0, 'last_timestamp' => core::$network_time), array('display', '=', $nick));
// unidentify them
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LOGGED_OUT);
// let them know
core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' logged out of ' . core::$nicks[$nick]['nick']);
// and log it.
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NOT_IDENTIFIED);
// not even identified
}
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_UNREGISTERED);
// unregistered nick name
}
}
示例7: global_notice
public static function global_notice($nick, $mask, $message)
{
core::alog('global_notice(): sent from ' . $nick, 'BASIC');
// debug info
foreach (core::$nicks as $user => $data) {
$hostname = core::get_full_hostname($user);
// hostname
if ($data['server'] != core::$config->server->name && services::match($hostname, $mask)) {
services::communicate($nick, $user, $message);
}
}
}
示例8: register_command
public static function register_command($nick, $ircdata = array())
{
$password = $ircdata[0];
$email = $ircdata[1];
if (trim($password) == '' || trim($email) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'REGISTER'));
return false;
}
// wrong syntax
if (strtolower($password) == strtolower($nick)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_PASSWORD_NICK);
return false;
}
// are they using a reasonable password, eg. != their nick, lol.
if (services::valid_email($email) === false) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_EMAIL);
return false;
}
// is the email valid?
if ($user = services::user_exists($nick, false, array('display', 'id'))) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ALREADY_REGISTERED);
return false;
}
// are we registered?
// apprently not, let's move on!
$check_e = database::select('users_flags', array('email'), array('email', '=', $email));
if (database::num_rows($check_e) > 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_EMAIL_IN_USE);
return false;
}
// check if the email is in use.
$salt = '';
for ($i = 0; $i < 8; $i++) {
$possible = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$salt .= substr($possible, rand(0, strlen($possible) - 1), 1);
}
$user_info = array('display' => $nick, 'pass' => sha1($password . $salt), 'salt' => $salt, 'last_hostmask' => core::get_full_hostname($nick), 'last_timestamp' => core::$network_time, 'timestamp' => core::$network_time, 'identified' => 0, 'validated' => core::$config->nickserv->force_validation === true ? 0 : 1, 'real_user' => 1);
// setup the user info array.
$flags = core::$config->nickserv->default_flags;
$flags = str_replace('u', '', $flags);
$flags = str_replace('e', '', $flags);
// ignore parameter flags
database::insert('users', $user_info);
database::insert('users_flags', array('nickname' => $nick, 'flags' => $flags . 'e', 'email' => $email));
// insert it into the database.
if (core::$config->nickserv->force_validation === true) {
$validation_code = mt_rand();
core::alog(core::$config->nickserv->nick . ': ' . $nick . ' requested by ' . core::get_full_hostname($nick));
// logchan
database::insert('validation_codes', array('nick' => $nick, 'code' => $validation_code));
// insert the random code to the database
$to = $nick . ' <' . $email . '>';
$subject = 'Registration';
$headers = 'From: ' . core::$config->server->network_name . ' <' . isset(core::$config->email_from) ? core::$config->email_from : core::$config->service_user . '>\\n';
$message = '
Thank you for using ' . core::$config->server->network_name . '
Nickname: ' . $nick . '
Password: ' . $password . '
Confirmation Code: ' . $validation_code . '
To confirm your nickname type the following when connected to ' . core::$config->server->network_name . '
/msg ' . core::$config->nickserv->nick . ' confirm ' . $validation_code . '
You will then be able to identify with the password you chose by typing
/msg ' . core::$config->nickserv->nick . ' identify ' . $password . '
';
// generate the email information
@mail($to, $subject, $message, $headers);
// let's send the email
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_REQUESTED, array('email' => $email));
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_REGISTERED);
core::alog(core::$config->nickserv->nick . ': ' . $nick . ' registered by ' . core::get_full_hostname($nick));
// logchan
core::alog('register_command(): ' . $nick . ' registered by ' . core::get_full_hostname($nick), 'BASIC');
// log what we need to log.
}
}
示例9: check_levels
public static function check_levels($nick, $chan, $flags, $force = true, $ident = true, $return = false, $or_check = true)
{
if ($ident && !($user = services::user_exists($nick, true, array('id', 'display')))) {
return false;
}
// they aint even identified..
$user_flags_q = database::select('chans_levels', array('id', 'channel', 'target', 'flags', 'reason'), array('channel', '=', $chan));
// get our flags records
$hostname = core::get_full_hostname($nick);
// generate a hostname
while ($chan_flags = database::fetch($user_flags_q)) {
if ($or_check && core::$nicks[$nick]['override']) {
return true;
}
// is override enabled for this user?
if ($nick == $chan_flags->target || $force && (strpos($chan_flags->target, '@') !== false && services::match($hostname, $chan_flags->target))) {
foreach ($flags as $flag) {
if (strpos($chan_flags->flags, $flag) !== false) {
if ($return) {
return $chan_flags->reason;
} else {
return true;
}
}
// hurrah, we've found a match!
}
// loop through the flags, if we find a match, return true
continue;
}
// only trigger if this is the user we are in question of.
}
// loop through the flag records
return false;
}
示例10: release_command
public static function release_command($nick, $ircdata = array())
{
$unick = $ircdata[0];
$password = $ircdata[1];
// get the parameters.
if (trim($unick) == '' || trim($password) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'RELEASE'));
return false;
}
// invalid syntax
if ($user = services::user_exists($unick, false, array('display', 'pass', 'salt'))) {
if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) {
if (!isset(self::$held_nicks[$unick])) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NO_HOLD, array('nick' => $unick));
return false;
// nickname isnt locked.
}
ircd::remove_client($unick, 'RELEASED by ' . $nick);
core::alog(core::$config->nickserv->nick . ': RELEASE command on ' . $unick . ' used by ' . core::get_full_hostname($nick));
timer::remove(array('ns_recover', 'remove_callback', array($unick)));
// if they are, remove client, respectively
// unsetting data and removing them.
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_RELEASED, array('nick' => $unick));
// tell the user their nick has been released (Y)
} 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..
}
}
示例11: on_create
public static function on_create($nusers, $channel)
{
$access_array = self::get_access($channel->channel);
// get the access array
foreach ($nusers as $nick => $modes) {
if ($nick == core::$config->chanserv->nick) {
continue;
}
// skip us :D
$hostname = core::get_full_hostname($nick);
// get the hostname ready.
if ($reason = chanserv::check_levels($nick, $channel->channel, array('b'), true, false, true)) {
ircd::mode(core::$config->chanserv->nick, $channel->channel, '+b *@' . core::$nicks[$nick]['host']);
ircd::kick(core::$config->chanserv->nick, $nick, $channel->channel, $reason);
}
// check for bans before access
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
continue 2;
// continue to next loop 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
continue 2;
// continue to next loop 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
}
// loop through the users
}
示例12: check_mask_ignore
static function check_mask_ignore($nick)
{
$ignored_user = database::select('ignored_users', array('who'));
$hostname = core::get_full_hostname($nick);
// we generate the hostname
if (database::num_rows($ignored_user) > 0) {
while ($ignore = database::fetch($ignored_user)) {
if ($nick == $ignore->who) {
return true;
} elseif (strpos($ignore->who, '@') && self::match($hostname, $ignore->who)) {
return true;
}
// we've found a match!
}
// loop through records, on the first match we instantly break the loop.
} else {
return false;
}
// there are records
}
示例13: 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
}
}
示例14: sapass_command
public static function sapass_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
$new_pass = $ircdata[1];
$conf_pass = $ircdata[2];
// new password.
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?
if (strtolower($new_pass) == strtolower($unick)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_PASSWORD_NICK_U);
return false;
}
// are they using a reasonable password, eg. != their nick, lol.
if ($new_pass != $conf_pass) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_PASSWORD_DIFF);
return false;
}
// the passwords are different
database::update('users', array('pass' => sha1($new_pass . $user->salt)), array('display', '=', $unick));
// we update the password here, with the users salt.
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NEW_PASSWORD_U, array('nick' => $unick, 'pass' => $new_pass));
// let them know
core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' changed the password for ' . $unick);
// logchan
}
示例15: type_check
public static function type_check($chan, $level, $mode, $cnick)
{
$part = explode(':', $level);
$nicks = array();
if ($part[1] == '') {
return false;
}
// we need to make sure we're actually given something.
if ($mode[0] != '+' && $mode[0] != '-') {
return false;
}
// make sure we're getting +/-
if (strpos('qaohv', $mode[1]) === false) {
return false;
}
// we can only set on these modes, for now.
if (count(core::$chans[$chan]['users']) == 0) {
return false;
}
// is the channel empty?
if ($part[0] == 'level') {
if ($part[1] == '0') {
foreach (core::$chans[$chan]['users'] as $nick => $modes) {
if (strpos($modes, 'o') === false && strpos($modes, 'h') === false && strpos($modes, 'v') === false) {
$nicks[] .= $nick;
}
}
// loop through, finding users that are level 0, or more
// commonly, don't have any status modes.
} elseif ($part[1] == 'v' || $part[1] == ircd::$prefix_modes['v']) {
foreach (core::$chans[$chan]['users'] as $nick => $modes) {
if (strpos($modes, 'v') !== false) {
$nicks[] .= $nick;
}
}
// again we loop, finding users that have voice.
} elseif (($part[1] == 'h' || $part[1] == ircd::$prefix_modes['h']) && ircd::$halfop) {
foreach (core::$chans[$chan]['users'] as $nick => $modes) {
if (strpos($modes, 'h') !== false) {
$nicks[] .= $nick;
}
}
// again we loop, finding users that have halfop.
} elseif ($part[1] == 'o' || $part[1] == ircd::$prefix_modes['o']) {
foreach (core::$chans[$chan]['users'] as $nick => $modes) {
if (strpos($modes, 'o') !== false) {
$nicks[] .= $nick;
}
}
// again we loop, finding users that have operator.
} elseif (($part[1] == 'a' || $part[1] == ircd::$prefix_modes['a']) && ircd::$protect) {
foreach (core::$chans[$chan]['users'] as $nick => $modes) {
if (strpos($modes, 'a') !== false) {
$nicks[] .= $nick;
}
}
// again we loop, finding users that have admin.
} elseif (($part[1] == 'q' || $part[1] == ircd::$prefix_modes['q']) && ircd::$owner) {
foreach (core::$chans[$chan]['users'] as $nick => $modes) {
if (strpos($modes, 'q') !== false) {
$nicks[] .= $nick;
}
}
// again we loop, finding users that have owner.
} elseif ($part[1] == '*') {
foreach (core::$chans[$chan]['users'] as $nick => $modes) {
$nicks[] .= $nick;
}
// and last but not least, all :)
// note we don't need to do any checks here.
} else {
return false;
}
} elseif ($part[0] == 'mask') {
if (strpos($part[1], '@') === false) {
$part[1] = '*@' . $part[1];
}
if (strpos($part[1], '!') === false) {
$part[1] = '*!' . $part[1];
}
// mask is malformed
foreach (core::$chans[$chan]['users'] as $nick => $modes) {
$hostname = core::get_full_hostname($nick);
if (services::match($hostname, $part[1])) {
$nicks[] .= $nick;
}
// this needs tested, although i'm purty confident i'll work.
}
// loop through our users, and find a matching mask >:D
} else {
return false;
}
// something is invalid here, back out.
if (count($nicks) == 0) {
return false;
}
// empty array :(
foreach ($nicks as $id => $nick) {
if ($nick == $cnick) {
unset($nicks[$id]);
//.........这里部分代码省略.........