当前位置: 首页>>代码示例>>PHP>>正文


PHP core::get_chan方法代码示例

本文整理汇总了PHP中core::get_chan方法的典型用法代码示例。如果您正苦于以下问题:PHP core::get_chan方法的具体用法?PHP core::get_chan怎么用?PHP core::get_chan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core的用法示例。


在下文中一共展示了core::get_chan方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:32,代码来源:drop.cs.php

示例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
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:54,代码来源:nickserv.php

示例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..
     }
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:51,代码来源:register.cs.php

示例4: chanclear_command

 public static function chanclear_command($nick, $ircdata = array())
 {
     $chan = core::get_chan(&$ircdata, 1);
     $reason = core::get_data_after(&$ircdata, 2);
     $mode = strtoupper($ircdata[0]);
     // get the data.
     if (trim($chan) == '' || trim($reason) == '' || !in_array($mode, array('KICK', 'KILL', 'GLINE'))) {
         services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'CHANCLEAR'));
         return false;
         // wrong syntax
     }
     if ($chan[0] != '#') {
         services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'CHANCLEAR'));
         return false;
         // wrong syntax
     }
     if (isset(core::$chans[$chan])) {
         foreach (core::$chans[$chan]['users'] as $user => $umode) {
             if (core::$nicks[$user]['ircop']) {
                 core::alog(core::$config->operserv->nick . ': Ignoring IRC Operator (' . $user . ')');
                 // ignore irc operator, infact, logchan it too
             } else {
                 if ($mode == 'KICK') {
                     ircd::kick(core::$config->operserv->nick, $user, $chan, 'CHANKILL by ' . $nick . ' (' . $reason . ')');
                     ircd::mode(core::$config->operserv->nick, $chan, '+b *@' . core::$nicks[$user]['host']);
                     // kick and +b them
                 } elseif ($mode == 'KILL') {
                     ircd::kill(core::$config->operserv->nick, $user, 'CHANKILL by ' . $nick . ' (' . $reason . ')');
                 } elseif ($mode == 'GLINE') {
                     ircd::gline(core::$config->operserv->nick, '*@' . core::$nicks[$user]['oldhost'], 604800, 'CHANKILL by ' . $nick . ' (' . $reason . ')');
                 }
                 // remove all other users.
             }
         }
         // loop through the people in the channel/
     } else {
         services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_CHAN_INVALID, array('chan' => $chan));
     }
     // check if the channel is in use..
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:40,代码来源:chanclear.os.php

示例5: handle_kick

 public static function handle_kick(&$ircdata)
 {
     $chan = core::get_chan(&$ircdata, 2);
     $who = self::get_nick(&$ircdata, 3);
     unset(core::$chans[$chan]['users'][$who]);
     // again, move them out.
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:7,代码来源:inspircd11.php

示例6: info_command

 public static function info_command($nick, $ircdata = array())
 {
     $chan = core::get_chan(&$ircdata, 0);
     // get the channel.
     if ($chan == '' || $chan[0] != '#') {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'INFO'));
         return false;
         // wrong syntax
     }
     // make sure they've entered a channel
     if (!($channel = services::chan_exists($chan, array('channel', 'timestamp', 'last_timestamp', 'suspended', 'suspend_reason')))) {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_UNREGISTERED_CHAN, array('chan' => $chan));
         return false;
     }
     // make sure the channel exists
     if ($channel->suspended == 1) {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_SUSPENDED_1, array('chan' => $channel->channel));
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_SUSPENDED_2, array('reason' => $channel->suspend_reason));
     } else {
         $founder = database::select('chans_levels', array('id', 'channel', 'target', 'flags'), array('channel', '=', $chan));
         $founders = '';
         while ($f_row = database::fetch($founder)) {
             if (strpos($f_row->flags, 'F') !== false) {
                 $founders .= $f_row->target . ', ';
             }
         }
         // get the founder(s)
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_1, array('chan' => $channel->channel));
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_2, array('nicks' => substr($founders, 0, -2)));
         $desc = chanserv::get_flags($channel->channel, 'd');
         if ($desc != null) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_3, array('desc' => $desc));
         }
         // description?
         if (core::$chans[$chan]['topic'] != '') {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_4, array('topic' => core::$chans[$chan]['topic']));
         }
         // topic
         $email = chanserv::get_flags($channel->channel, 'e');
         if ($email != null) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_5, array('email' => $email));
         }
         // is there an email?
         $url = chanserv::get_flags($channel->channel, 'u');
         if ($url != null) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_6, array('url' => $url));
         }
         // or a url?
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_7, array('time' => date("F j, Y, g:i a", $channel->timestamp)));
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_8, array('time' => date("F j, Y, g:i a", $channel->last_timestamp)));
         $modelock = chanserv::get_flags($channel->channel, 'm');
         if ($modelock != null) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_9, array('mode_lock' => $modelock));
         }
         // is there a mode lock?
         $entrymsg = chanserv::get_flags($channel->channel, 'w');
         if ($entrymsg != null) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_10, array('entrymsg' => $entrymsg));
         }
         // is there an entry msg?
         $list = '';
         if (chanserv::check_flags($channel->channel, array('T'))) {
             $list .= 'Topiclock, ';
         }
         if (chanserv::check_flags($channel->channel, array('K'))) {
             $list .= 'Keeptopic, ';
         }
         if (chanserv::check_flags($channel->channel, array('G'))) {
             $list .= 'Guard, ';
         }
         if (chanserv::check_flags($channel->channel, array('S'))) {
             $list .= 'Secure, ';
         }
         if (chanserv::check_flags($channel->channel, array('F'))) {
             $list .= 'Fantasy';
         }
         if (substr($list, -2, 2) == ', ') {
             $list = substr($list, 0, -2);
         }
         // compile our list of options
         if ($list != '') {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_11, 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->chanserv->expire != 0) {
             $expiry_time = core::$config->chanserv->expire * 86400;
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_12, array('time' => date("F j, Y, g:i a", $channel->last_timestamp + $expiry_time)));
         }
         // if the nick in question has staff powers, we show the expiry times.
     }
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:91,代码来源:info.cs.php

示例7: 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.
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:25,代码来源:commands.php

示例8: 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]
     }
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:27,代码来源:chanserv.php

示例9: levels_command

 public static function levels_command($nick, $ircdata = array(), $announce = false)
 {
     $chan = core::get_chan(&$ircdata, 0);
     $target = $ircdata[2];
     $flags = $ircdata[1];
     // get the channel.
     if ($target == '' && $flags == '' && chanserv::check_levels($nick, $chan, array('v', 'h', 'o', 'a', 'q', 'r', 'f', 'F'))) {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LEVELS_LIST_TOP, array('chan' => $chan));
         // start of flag list
         $flags_q = database::select('chans_levels', array('id', 'channel', 'target', 'flags', 'reason'), array('channel', '=', $chan));
         // get the flag records
         $x = 0;
         while ($flags = database::fetch($flags_q)) {
             $x++;
             $false_flag = $flags->flags;
             if (!isset($flags->flags[13])) {
                 $y = strlen($flags->flags);
                 for ($i = $y; $i <= 12; $i++) {
                     $false_flag .= ' ';
                 }
             }
             // this is just a bit of fancy fancy, so everything displays neat, like so:
             // +ao  N0valyfe
             // +v   tool
             if ($flags->reason != '') {
                 $extra = '(' . $flags->reason . ')';
             } else {
                 $extra = '';
             }
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LEVELS_LIST, array('num' => $x, 'target' => $flags->target, 'flags' => '+' . $false_flag, 'reason' => $extra));
             // show the flag
         }
         // loop through them
         return false;
     }
     // no params
     // lets show the current flags.
     if ($target == '' || $flags == '') {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'LEVELS'));
         return false;
     }
     // missing params?
     if (services::chan_exists($chan, array('channel')) === false) {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_UNREGISTERED_CHAN, array('chan' => $chan));
         return false;
     }
     // make sure the channel exists.
     $flag_a = array();
     foreach (str_split($flags) as $pos => $flag) {
         if (strpos(self::$flags, $flag) === false) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LEVELS_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
     if (strpos($target, '@') === false) {
         if (!($user = services::user_exists($target, false, array('id', 'display')))) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_UNREGISTERED_NICK, array('nick' => $target));
             return false;
         }
         // they aint even identified..
         // were dealing with a nickname, check if it is registered
         // if not, back out
     } else {
         if (strpos($target, '!') === false) {
             $target = '*!' . $target;
         }
         // we're dealing with a mask, check if it a proper mask
         // *!*@* < like so.
     }
     $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($flag_array['plus']) as $flag) {
         // ----------- +k ----------- //
         if ($flag == 'k') {
             if (chanserv::check_levels($nick, $chan, array('h', 'o', 'a', 'q', 'f', 'F')) === false) {
                 services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_ACCESS_DENIED);
                 return false;
             }
             // do they have access to alter this?
             self::set_flag($nick, $chan, $target, '+k');
             // +k the target in question
         } elseif ($flag == 'v') {
             if (chanserv::check_levels($nick, $chan, array('h', 'o', 'a', 'q', 'f', 'F')) === false) {
                 services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_ACCESS_DENIED);
                 return false;
             }
             // do they have access to alter this?
//.........这里部分代码省略.........
开发者ID:rickihastings,项目名称:acorairc,代码行数:101,代码来源:levels.cs.php

示例10: main

 public function main(&$ircdata, $startup = false)
 {
     if (ircd::on_topic(&$ircdata) || ircd::on_ftopic(&$ircdata)) {
         $chan = core::get_chan(&$ircdata, 2);
         $topic = core::$chans[$chan]['topic'];
         $setter = core::$chans[$chan]['topic_setter'];
         // i forgot this was done by the protocol modules
         if ($channel = services::chan_exists($chan, array('channel', 'topic'))) {
             if (chanserv::check_flags($chan, array('T')) && chanserv::check_flags($chan, array('K')) && $channel->topic != $topic) {
                 ircd::topic(core::$config->chanserv->nick, $channel->channel, $channel->topic);
                 database::update('chans', array('topic_setter' => core::$config->chanserv->nick), array('channel', '=', $chan));
                 return false;
                 // reset it i reckon.
             } elseif ($channel->topiclock == 0) {
                 database::update('chans', array('topic' => $topic, 'topic_setter' => $setter), array('channel', '=', $chan));
                 // OTHERWISE, update it.
             }
             // some housekeepin.
         }
         // make sure the channel exists.
     }
     // now we check for topiclocking
     // moved this from cs_set to here
     // there was 2 versions O.o
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:25,代码来源:topic.cs.php

示例11: 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
//.........这里部分代码省略.........
开发者ID:rickihastings,项目名称:acorairc,代码行数:101,代码来源:fantasy.cs.php

示例12: 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')))) {
//.........这里部分代码省略.........
开发者ID:rickihastings,项目名称:acorairc,代码行数:101,代码来源:flags.cs.php

示例13: kick_command

 public static function kick_command($nick, $ircdata = array())
 {
     $unick = $ircdata[0];
     $channel = core::get_chan(&$ircdata, 1);
     $reason = core::get_data_after(&$ircdata, 2);
     // grab the parameters: nick; channel; reason (optional)
     if (trim($unick) == '' || trim($channel) == '') {
         services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'KICK'));
         return false;
     }
     // are we missing nick and channel? invalid syntax if so.
     $ntemplate = $template;
     if (trim($reason) == '') {
         $reason = 'Kick command issued by ' . $nick;
     }
     // if they haven't suplied a reason let's fill it in.
     if (isset(core::$nicks[$unick]) && isset(core::$chans[$channel]) && isset(core::$chans[$channel]['users'][$unick])) {
         ircd::kick(core::$config->operserv->nick, $unick, $channel, $reason);
         core::alog(core::$config->operserv->nick . ': ' . $nick . ' used KICK to remove ' . $unick . ' from ' . $chan);
     }
     // now we check 3 things, if the user exists, if the channel exists
     // and if the user is even in that channel, if they arn't we just leave it
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:23,代码来源:utilities.os.php

示例14: unsuspend_command

 public static function unsuspend_command($nick, $ircdata = array())
 {
     $chan = core::get_chan(&$ircdata, 0);
     // get the channel.
     if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_ACCESS_DENIED);
         return false;
     }
     // they've gotta be identified.
     if ($chan == '' || $chan[0] != '#') {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'UNSUSPEND'));
         return false;
         // wrong syntax
     }
     // make sure they've entered a channel
     if ($channel = services::chan_exists($chan, array('channel', 'suspended'))) {
         if ($channel->suspended == 0) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_4, array('chan' => $chan));
             return false;
         }
         // channel isn't even suspended
         $check_row = database::select('chans_levels', array('channel'), array('channel', '=', $chan));
         if (database::num_rows($check_row) == 0) {
             database::delete('chans', array('channel', '=', $chan));
             database::delete('chans_flags', array('channel', '=', $chan));
         }
         // the channel has no access records, drop it.
     } else {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_4, array('chan' => $chan));
         return false;
     }
     services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_5, array('chan' => $chan));
     core::alog(core::$config->chanserv->nick . ': ' . $nick . ' UNSUSPENDED ' . $chan);
     ircd::globops(core::$config->chanserv->nick, $nick . ' UNSUSPENDED ' . $chan);
     // oh well, was fun while it lasted eh?
     // unsuspend it :P
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:37,代码来源:suspend.cs.php


注:本文中的core::get_chan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。