Beispiel #1
0
 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.
     }
 }
Beispiel #2
0
 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
 }
Beispiel #3
0
 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
 }
Beispiel #4
0
 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
 }
Beispiel #5
0
 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..
     }
 }
Beispiel #6
0
 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.
 }
Beispiel #7
0
 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 f**k 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]
     }
 }
Beispiel #8
0
 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
 }
Beispiel #9
0
 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
     }
 }
Beispiel #10
0
 public function main(&$ircdata, $startup = false)
 {
     if ($startup) {
         return false;
     }
     // we're booting, f**k 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
 }
Beispiel #11
0
 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.
 }
Beispiel #12
0
 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
         }
         // !op command
         if (commands::on_fantasy_cmd(&$ircdata, 'deop', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('o', '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], '-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
         }
         // !deop command
         if (commands::on_fantasy_cmd(&$ircdata, 'halfop', core::$config->chanserv->nick) && ircd::$halfop) {
             if (chanserv::check_levels($nick, $channel->channel, array('h', 'o', 'a', 'q', 'f', 'F')) === false) {
                 return false;
             }
             if (strpos($ircdata[4], ':') !== false) {
                 mode::type_check($chan, $ircdata[4], '+h', core::$config->chanserv->nick);
             } elseif (isset($ircdata[4])) {
                 ircd::mode(core::$config->chanserv->nick, $chan, '+h ' . $ircdata[4]);
             } else {
                 ircd::mode(core::$config->chanserv->nick, $chan, '+h ' . $nick);
             }
             // check if another param is specified
         }
         // !hop command
         if (commands::on_fantasy_cmd(&$ircdata, 'dehalfop', core::$config->chanserv->nick) && ircd::$halfop) {
             if (chanserv::check_levels($nick, $channel->channel, array('h', 'o', '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], '-h', core::$config->chanserv->nick);
             } elseif (isset($ircdata[4])) {
                 ircd::mode(core::$config->chanserv->nick, $chan, '-h ' . $ircdata[4]);
             } else {
                 ircd::mode(core::$config->chanserv->nick, $chan, '-h ' . $nick);
             }
             // check if another param is specified
         }
         // !dehop command
         if (commands::on_fantasy_cmd(&$ircdata, 'voice', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('v', 'h', 'o', 'a', 'q', 'f', 'F')) === false) {
                 return false;
             }
             if (strpos($ircdata[4], ':') !== false) {
                 mode::type_check($chan, $ircdata[4], '+v', core::$config->chanserv->nick);
             } elseif (isset($ircdata[4])) {
                 ircd::mode(core::$config->chanserv->nick, $chan, '+v ' . $ircdata[4]);
             } else {
                 ircd::mode(core::$config->chanserv->nick, $chan, '+v ' . $nick);
             }
             // check if another param is specified
         }
         // !voice command
         if (commands::on_fantasy_cmd(&$ircdata, 'devoice', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('v', 'h', 'o', 'a', 'q', 'f', 'F')) === false) {
                 return false;
             }
             if (strpos($ircdata[4], ':') !== false) {
                 mode::type_check($chan, $ircdata[4], '-v', core::$config->chanserv->nick);
             } elseif (isset($ircdata[4])) {
                 ircd::mode(core::$config->chanserv->nick, $chan, '-v ' . $ircdata[4]);
             } else {
                 ircd::mode(core::$config->chanserv->nick, $chan, '-v ' . $nick);
             }
             // check if another param is specified
         }
         // !devoice command
         if (commands::on_fantasy_cmd(&$ircdata, 'topic', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('t', 'F')) === false) {
                 return false;
             }
             if (isset($ircdata[4])) {
                 $topicmask = chanserv::get_flags($chan, 't');
                 // get the topicmask
                 if ($topicmask != null) {
                     $new_topic = core::get_data_after(&$ircdata, 4);
                     $new_topic = str_replace(' *', ' ' . $new_topic, $topicmask);
                     $new_topic = str_replace('\\*', '*', $new_topic);
                     ircd::topic(core::$config->chanserv->nick, $channel->channel, $new_topic);
                     database::update('chans', array('topic' => $new_topic, 'topic_setter' => core::$config->chanserv->nick), array('channel', '=', $channel->channel));
                 } else {
                     $new_topic = trim(core::get_data_after(&$ircdata, 4));
                     ircd::topic(core::$config->chanserv->nick, $channel->channel, $new_topic);
                     database::update('chans', array('topic' => $new_topic, 'topic_setter' => core::$config->chanserv->nick), array('channel', '=', $channel->channel));
                 }
                 // if there isnt, just set it normally.
             }
             // make sure there is another mask x]
         }
         // !topic command
         if (commands::on_fantasy_cmd(&$ircdata, 'mode', core::$config->chanserv->nick) || commands::on_fantasy_cmd(&$ircdata, 'm', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('h', 'o', 'a', 'q', 'F')) === false) {
                 return false;
             }
             if (isset($ircdata[4])) {
                 $mode_queue = core::get_data_after(&$ircdata, 4);
                 // get the mode queue
                 if (!core::$nicks[$nick]['ircop']) {
                     $mode_queue[0] = str_replace('O', '', $mode_queue[0]);
                 }
                 // don't let them MODE +O if they're not an IRCop
                 ircd::mode(core::$config->chanserv->nick, $chan, $mode_queue);
                 // check if there are any other parameters in the !mode command
             }
             // are we even setting a mode?
         }
         // !mode command
         if (commands::on_fantasy_cmd(&$ircdata, 'kick', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('r', 'F')) === false) {
                 return false;
             }
             // ignore if the nick doesn't have access to perform this
             if (isset($ircdata[4])) {
                 if (chanserv::check_levels($nick, $channel->channel, array('o', 'F')) && chanserv::check_levels($nick, $channel->channel, array('o', 'F')) === false) {
                     return false;
                 }
                 // check if the user kicking, has the access to kick them. that doesn't make sense, but yeah.
                 if (isset($ircdata[5])) {
                     $reason = core::get_data_after(&$ircdata, 5);
                     ircd::kick(core::$config->chanserv->nick, $ircdata[4], $chan, '(' . $nick . ') ' . ($reason != '') ? $reason : 'No reason');
                     // kick them with the reason
                 } else {
                     ircd::kick(core::$config->chanserv->nick, $ircdata[4], $chan, $nick);
                     // kick them with no reason
                 }
             }
             // make sure a parameter is issued
         }
         // !kick command
         if (commands::on_fantasy_cmd(&$ircdata, 'kickban', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('r', 'F')) === false) {
                 return false;
             }
             // ignore if the nick doesn't have access to perform this
             if (isset($ircdata[4])) {
                 if (chanserv::check_levels($nick, $channel->channel, array('o', 'F')) && chanserv::check_levels($nick, $channel->channel, array('o', 'F')) === false) {
                     return false;
                 }
                 // check if the user kicking, has the access to kick them. that doesn't make sense, but yeah.
                 if ($user = core::search_nick($ircdata[4])) {
                     ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . $user['host']);
                     if (isset($ircdata[5])) {
                         $reason = core::get_data_after(&$ircdata, 5);
                         ircd::kick(core::$config->chanserv->nick, $ircdata[4], $chan, '(' . $nick . ') ' . ($reason != '') ? $reason : 'No reason');
                         // kick them with the reason
                     } else {
                         ircd::kick(core::$config->chanserv->nick, $ircdata[4], $chan, $nick);
                         // kick them with no reason
                     }
                     // check if there is a reason etc.
                 } else {
                     return false;
                 }
             }
             // make sure a parameter is issued
         }
         // !ban command
         if (commands::on_fantasy_cmd(&$ircdata, 'ban', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('r', 'F')) === false) {
                 return false;
             }
             // ignore if the nick doesn't have access to perform this
             if (isset($ircdata[4])) {
                 if (chanserv::check_levels($nick, $channel->channel, array('o', 'F')) && chanserv::check_levels($nick, $channel->channel, array('o', 'F')) === false) {
                     return false;
                 }
                 // check if the user kicking, has the access to kick them. that doesn't make sense, but yeah.
                 if (strpos($ircdata[4], '@') === false && ($user = core::search_nick($ircdata[4]))) {
                     ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . $user['host']);
                 } else {
                     ircd::mode(core::$config->chanserv->nick, $chan, '+b ' . $ircdata[4]);
                 }
                 // is the hostname in our cache? if not just set a ban on it lol.
             }
         }
         // !ban command
         if (commands::on_fantasy_cmd(&$ircdata, 'unban', core::$config->chanserv->nick)) {
             if (chanserv::check_levels($nick, $channel->channel, array('r', 'F')) === false) {
                 return false;
             }
             if (isset($ircdata[4])) {
                 if (strpos($ircdata[4], '@') === false && ($user = core::search_nick($ircdata[4]))) {
                     ircd::mode(core::$config->chanserv->nick, $chan, '-b *@' . $user['host']);
                 } else {
                     ircd::mode(core::$config->chanserv->nick, $chan, '-b ' . $ircdata[4]);
                 }
                 // is the hostname in our cache? if not unban it..
             }
         }
         // !unban command
         if (commands::on_fantasy_cmd(&$ircdata, 'flags', core::$config->chanserv->nick) && isset(modules::$list['cs_flags'])) {
             $n_ircdata = $ircdata;
             unset($n_ircdata[0], $n_ircdata[1], $n_ircdata[2], $n_ircdata[3]);
             array_unshift($n_ircdata, $chan);
             // construct a new ircdata array
             cs_flags::flags_command($nick, $n_ircdata, true);
             // execute the flags command with the new data
             unset($n_ircdata);
             // get rid of this, isn't longer needed
         }
         // !flags command (experimental)
         if (commands::on_fantasy_cmd(&$ircdata, 'levels', core::$config->chanserv->nick) && isset(modules::$list['cs_levels'])) {
             $n_ircdata = $ircdata;
             unset($n_ircdata[0], $n_ircdata[1], $n_ircdata[2], $n_ircdata[3]);
             array_unshift($n_ircdata, $chan);
             // construct a new ircdata array
             cs_levels::levels_command($nick, $n_ircdata, true);
             // execute the flags command with the new data
             unset($n_ircdata);
             // get rid of this, isn't longer needed
         }
         // !levels command (experimental)
         if (commands::on_fantasy_cmd(&$ircdata, 'sync', core::$config->chanserv->nick) && isset(modules::$list['cs_levels'])) {
             cs_levels::on_create(core::$chans[$chan]['users'], $channel);
             // execute on_create, cause we just treat it as that
             // this is kinda a shortcut, but well worth it.
             ircd::notice(core::$config->chanserv->nick, $chan, '' . $nick . ' used SYNC');
         }
         // !sync command (experimental)
     }
     // only trigger on channel messages
 }
Beispiel #13
0
 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')))) {
                 return false;
             }
             // channel isnt registered
             if (chanserv::check_flags($chan, array('I'))) {
                 foreach ($nusers as $nick => $mode) {
                     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.');
                     }
                     // 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) {
                 foreach ($nusers as $nick => $mode) {
                     if ($nick == core::$config->chanserv->nick) {
                         continue;
                     }
                     // skip if it's chanserv
                     ircd::notice(core::$config->chanserv->nick, $nick, '(' . $chan . ') ' . $welcome);
                     // we give them the entrymsg
                 }
             }
             // check for a welcome msg, if so
             // message it to the joining users.
             if (chanserv::check_flags($chan, array('L'))) {
                 cs_flags::increase_limit($chan, 1);
                 // add a timer to update the limit, in 15 seconds
             }
             // is there auto-limit enabled?
         }
     }
     // on channel create, we send out the welcome message
     // if there is one.
 }
Beispiel #14
0
 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));
         unset(self::$not_set[$unick]);
     }
     // send back the target stuff..
 }
Beispiel #15
0
 public static function handle_oper_up(&$ircdata)
 {
     $nick = core::get_nick($ircdata, 0);
     core::$nicks[$nick]['ircop'] = true;
 }
Beispiel #16
0
 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
 }
Beispiel #17
0
 public function main(&$ircdata, $startup = false)
 {
     if ((core::$config->settings->loglevel == 'server' || core::$config->settings->loglevel == 'all') && ircd::on_connect(&$ircdata)) {
         $nick = core::get_nick(&$ircdata, core::$config->server->ircd == 'inspircd12' ? 4 : 3);
         // get nick
         ircd::notice(core::$config->global->nick, $nick, 'Services are currently running in debug mode, please be careful when sending passwords.');
         // give them a quick notice that people can see their passwords.
     }
     if (ircd::on_chan_create(&$ircdata)) {
         $chans = explode(',', $ircdata[2]);
         // chan
         foreach ($chans as $chan) {
             if (core::$config->settings->logchan == $chan) {
                 self::join_logchan();
             }
             // join global to the logchan.
         }
         // on chan create bring our bot into it.
     }
 }
Beispiel #18
0
 public function main(&$ircdata, $startup = false)
 {
     if (ircd::on_connect(&$ircdata)) {
         $nick = core::get_nick(&$ircdata, core::$config->server->ircd == 'inspircd12' ? 4 : 3);
         if ($user = services::user_exists($nick, false, array('display', 'suspended'))) {
             if ($user->suspended == 1) {
                 $random_nick = 'Unknown' . rand(10000, 99999);
                 services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_1, array('nick' => $user->display));
                 services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_CHANGE, array('nick' => $random_nick));
                 ircd::svsnick($nick, $random_nick, core::$network_time);
             }
         }
         // check if the nick is suspended etc.
     }
     // trigger on connect
     if (ircd::on_nick_change(&$ircdata)) {
         $nick = core::get_nick($ircdata, 2);
         // get the nicknames
         if ($user = services::user_exists($nick, false, array('display', 'suspended'))) {
             if ($user->suspended == 1) {
                 $random_nick = 'Unknown' . rand(10000, 99999);
                 services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_1, array('nick' => $user->display));
                 services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_CHANGE, array('nick' => $random_nick));
                 ircd::svsnick($nick, $random_nick, core::$network_time);
             }
         }
         // check if the nick is suspended etc.
     }
     // trigger on nick change
 }
Beispiel #19
0
 public function main(&$ircdata, $startup = false)
 {
     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', 'suspended', 'suspend_reason'))) {
                 if ($channel->suspended == 1) {
                     if (!core::$nicks[$nick]['ircop']) {
                         ircd::kick(core::$config->chanserv->nick, $nick, $channel->channel, $channel->suspend_reason);
                     }
                     // boot
                 }
                 // it's also suspended
             }
             // channel is registered
         }
     }
     // on_join trigger for forbidden channels
     if (ircd::on_chan_create(&$ircdata)) {
         $chans = explode(',', $ircdata[2]);
         // 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', 'suspended', 'suspend_reason'))) {
                 if ($channel->suspended == 1) {
                     foreach ($nusers as $nick => $modes) {
                         if (!core::$nicks[$nick]['ircop']) {
                             ircd::kick(core::$config->chanserv->nick, $nick, $channel->channel, $channel->suspend_reason);
                         }
                     }
                     // boot
                 }
                 // it's also suspended
             }
             // channel is registered
         }
     }
     // and same with channels being created
 }