本文整理汇总了PHP中core::alog方法的典型用法代码示例。如果您正苦于以下问题:PHP core::alog方法的具体用法?PHP core::alog怎么用?PHP core::alog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::alog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: join_logchan
public static function join_logchan()
{
ircd::join_chan(core::$config->global->nick, core::$config->settings->logchan);
// join the logchan
core::alog('Now sending log messages to ' . core::$config->settings->logchan);
// tell the chan we're logging shit.
}
示例2: 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.
}
示例3: ghost_command
public static function ghost_command($nick, $ircdata = array())
{
$unick = $ircdata[0];
$password = $ircdata[1];
// get the parameters.
if (trim($unick) == '' || trim($password) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'GHOST'));
return false;
}
// invalid syntax
if (!isset(core::$nicks[$unick])) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NOT_IN_USE, array('nick' => $unick));
return false;
// nickname isn't in use
}
if ($user = services::user_exists($unick, false, array('display', 'pass', 'salt'))) {
if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) {
ircd::kill(core::$config->nickserv->nick, $unick, 'GHOST command used by ' . core::get_full_hostname($nick));
core::alog(core::$config->nickserv->nick . ': GHOST command used on ' . $unick . ' by ' . core::get_full_hostname($nick));
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD);
// password isn't correct
}
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick));
return false;
// doesn't even exist..
}
}
示例4: 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..
}
}
示例5: factory
public static function factory($driver)
{
if (require BASEPATH . '/core/drivers/' . $driver . '.php') {
core::alog('factory(): using ' . $driver . ' database driver', 'BASIC');
self::$driver = new $driver();
// store the instance here
} else {
core::alog('factory(): failed to open ' . $driver . ' database driver', 'BASIC');
core::save_logs();
// force a log save
}
// see if we can require the file
// if so initiate the class
// if not, bail.
}
示例6: load_module
public static function load_module($module_name, $module_file)
{
if (!(require BASEPATH . '/modules/' . $module_file)) {
core::alog('load_module(): unable to load: ' . $module_name . ' (not found)', 'BASIC');
return false;
}
// module doesn't exist, log it
if (!(self::$list[$module_name]['class'] = new $module_name())) {
core::alog('load_module(): unable to start: ' . $module_name . ' (boot error)', 'BASIC');
return false;
}
// module failed to start
self::$list[$module_name]['class']->modload();
// onload handler.
}
示例7: drop_command
public static function drop_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
$password = $ircdata[1];
// get the nick.
if (trim($unick) == '' || trim($password) == '' && (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'DROP'));
return false;
}
// invalid syntax
if (services::is_root($unick) && !services::is_root($nick)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// is a non-root trying to drop a root?
if ($user = services::user_exists($unick, false, array('id', 'display', 'pass', 'salt', 'suspended'))) {
if ($user->suspended == 1) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_1, array('nick' => $user->display));
return false;
}
// are they suspended?
if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) {
database::delete('users', array('display', '=', $user->display));
database::delete('users_flags', array('nickname', '=', $user->display));
// delete the users record
database::delete('chans_levels', array('target', '=', $user->display));
// also delete this users channel access.
core::alog(core::$config->nickserv->nick . ': ' . $user->display . ' has been dropped by ' . core::get_full_hostname($nick));
// logchan it
core::alog('drop_command(): ' . $user->display . ' has been dropped by ' . core::get_full_hostname($nick), 'BASIC');
// log what we need to log.
if (isset(core::$nicks[$user->display])) {
ircd::on_user_logout($nick->display);
}
// if the nick is being used unregister it, even though it shouldn't be?
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_DROPPED, array('nick' => $user->display));
// let the nick know the account has been dropped.
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD);
// password isn't correct
}
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick));
return false;
// doesn't even exist..
}
}
示例8: remove
public static function remove($execution)
{
// NOTE: params in $execution, should be an array
if (!is_array($execution) || !count($execution) >= 2) {
core::alog('add(): invalid format for first parameter, timer pushed back', 'BASIC');
return false;
}
// is the format correct
foreach (self::$timers as $tid => $data) {
if ($data['class'] == $execution[0] && $data['method'] == $execution[1] && $data['params'] == $execution[2]) {
unset(self::$timers[$tid]);
core::alog('remove(): ' . $execution[0] . '::' . $execution[1] . '() overridden and removed before finish.', 'BASIC');
break;
}
}
// find a match.
}
示例9: 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..
}
示例10: logout_command
public static function logout_command($nick, $ircdata = array())
{
// no parameter commands ftw.
if ($user = services::user_exists($nick, false, array('display', 'id', 'identified', 'vhost'))) {
if ($user->identified == 1) {
ircd::on_user_logout($nick);
// here we set unregistered mode
database::update('users', array('identified' => 0, 'last_timestamp' => core::$network_time), array('display', '=', $nick));
// unidentify them
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LOGGED_OUT);
// let them know
core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' logged out of ' . core::$nicks[$nick]['nick']);
// and log it.
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NOT_IDENTIFIED);
// not even identified
}
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_UNREGISTERED);
// unregistered nick name
}
}
示例11: vhost_command
public static function vhost_command($nick, $ircdata = array())
{
$mode = $ircdata[0];
if (strtolower($mode) == 'set') {
$host = $ircdata[2];
$unick = $ircdata[1];
// some variables.
if (trim($unick) == '') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'VHOST'));
return false;
}
// are we missing nick? invalid syntax if so.
if (!($user = services::user_exists($unick, false, array('display', 'id', 'identified', 'vhost')))) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_ISNT_REGISTERED, array('nick' => $unick));
return false;
}
// is the nick registered?
if (substr_count($host, '@') == 1) {
$realhost = $host;
$new_host = explode('@', $host);
$ident = $new_host[0];
$host = $new_host[1];
} elseif (substr_count($host, '@') > 1) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_HOSTNAME);
return false;
} else {
$realhost = $host;
}
// check if there is a @
if (services::valid_host($host) === false) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_HOSTNAME);
return false;
}
// is the hostname valid?
database::update('users', array('vhost' => $realhost), array('display', '=', $user->display));
core::alog(core::$config->operserv->nick . ': vHost for ' . $unick . ' set to ' . $realhost . ' by ' . $nick);
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_VHOST_SET, array('nick' => $unick, 'host' => $realhost));
// update it and log it
if (isset(core::$nicks[$unick]) && $user->identified == 1) {
if (substr_count($realhost, '@') == 1) {
ircd::setident(core::$config->operserv->nick, $unick, $ident);
ircd::sethost(core::$config->operserv->nick, $unick, $host);
} else {
ircd::sethost(core::$config->operserv->nick, $unick, $host);
}
}
// we need to check if the user is online and identified?
} elseif (strtolower($mode) == 'del') {
$unick = $ircdata[1];
// some variables.
if (trim($unick) == '') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'VHOST'));
return false;
}
// are we missing nick? invalid syntax if so.
if (!($user = services::user_exists($unick, false, array('display', 'id', 'identified', 'vhost')))) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_ISNT_REGISTERED, array('nick' => $unick));
return false;
}
// is the nick registered?
if ($user->vhost == '') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_NO_VHOST, array('nick' => $unick));
return false;
}
// is there a vhost?!
database::update('users', array('vhost' => ''), array('display', '=', $user->display));
core::alog(core::$config->operserv->nick . ': vHost for ' . $unick . ' deleted by ' . $nick);
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_VHOST_DELETED, array('nick' => $unick));
// update and logchan
} elseif (strtolower($mode) == 'list') {
$limit = $ircdata[1];
// get limit.
if (trim($limit) == '') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'VHOST'));
return false;
}
// invalid syntax
if (!preg_match('/([0-9]+)\\-([0-9]+)/i', $limit)) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'VHOST'));
return false;
}
// invalid syntax
$total = database::select('users', array('id'), array('vhost', '!=', ''));
$total = database::num_rows($total);
// get the total
$limit = database::quote($limit);
$s_limit = explode('-', $limit);
$offset = $s_limit[0];
$max = $s_limit[1];
// split up the limit and stuff ^_^
$users_q = database::select('users', array('display', 'vhost'), array('vhost', '!=', ''), '', array($offset => $max));
// get the vhosts
if (database::num_rows($users_q) == 0) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_VHOST_LIST_B, array('num' => database::num_rows($users_q), 'total' => $total));
return false;
}
// no vhosts
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_VHOST_LIST_T);
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_VHOST_LIST_T2);
// list top.
//.........这里部分代码省略.........
示例12: confirm_command
public static function confirm_command($nick, $ircdata = array())
{
$code = $ircdata[0];
if (trim($code) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'CONFIRM'));
return false;
}
// wrong syntax
if (!($user = services::user_exists($nick, false, array('display', 'id')))) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_UNREGISTERED);
return false;
}
// unregistered
$code_array = database::select('validation_codes', array('nick', 'code'), array('nick', '=', $nick, 'AND', 'code', '=', $code));
if (database::num_rows($code_array) == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSCODE);
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_VALIDATED);
// let them know.
database::update('users', array('validated' => 1), array('id', '=', $user->id));
// user is now validated.
database::delete('validation_codes', array('nick', '=', $nick, 'AND', 'code', '=', $code));
// delete the code now that we've validated them
core::alog(core::$config->nickserv->nick . ': ' . $nick . ' activated');
// logchan
}
// no passcode found
}
示例13: modunload_command
public function modunload_command($nick, $ircdata = array())
{
$module = $ircdata[0];
// get the module thats been requested.
if (services::is_root($nick)) {
if (trim($module) == '') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'MODUNLOAD'));
// wrong syntax
return false;
}
if (!isset(modules::$list[$module])) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_MODUNLOAD_1, array('name' => $module));
return false;
}
if (modules::$list[$module]['extra'] == 'static') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_MODUNLOAD_2, array('name' => $module));
core::alog(core::$config->operserv->nick . ': unable to unload static module ' . $module);
core::alog('modunload_command(): unable to unload static module ' . $module . ' (cannot be unloaded)', 'BASIC');
// log what we need to log.
return false;
}
if (!class_exists($module)) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_MODUNLOAD_2, array('name' => $module));
core::alog(core::$config->operserv->nick . ': unable to unload module ' . $module);
core::alog('modunload_command(): unable to unload module ' . $module . ' (not booted)', 'BASIC');
// log what we need to log.
return false;
}
if (is_callable(array($module, 'modunload'), true) && method_exists($module, 'modunload')) {
modules::$list[$module]['class']->modunload();
}
// if the module has an unload method, call it now before we destroy the class.
unset(modules::$list[$module]);
// unset the module
modules::_unset_docs($module);
// unset the modules help docs etc.
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_MODUNLOAD_3, array('name' => $module));
core::alog(core::$config->operserv->nick . ': unloaded module ' . $module);
ircd::globops(core::$config->operserv->nick, $nick . ' unloaded module ' . $module);
// let everyone know :D
} else {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_ACCESS_DENIED);
}
}
示例14: main
public function main(&$ircdata, $startup = false)
{
foreach (modules::$list as $module => $data) {
if ($data['type'] == 'operserv') {
modules::$list[$module]['class']->main(&$ircdata, $startup);
// loop through the modules for operserv.
}
}
if (ircd::on_msg(&$ircdata, core::$config->operserv->nick)) {
$nick = core::get_nick(&$ircdata, 0);
$command = substr(core::get_data_after(&$ircdata, 3), 1);
// convert to lower case because all the tingy wags are in lowercase
core::alog(core::$config->operserv->nick . ': ' . $nick . ': ' . $command);
// logchan it
if (core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified') !== false)) {
self::get_command($nick, $command);
} else {
services::communicate(core::$config->operserv->nick, $nick, &self::$help->OS_DENIED_ACCESS);
}
// theyre an oper.
}
// this is what we use to handle command listens
// should be quite epic.
}
示例15: get_command
public static function get_command($hook, &$nick, &$command)
{
// this works better than i imagined
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 ($hook == 'chanserv') {
$bot = core::$config->chanserv->nick;
}
if ($hook == 'nickserv') {
$bot = core::$config->nickserv->nick;
}
if ($hook == 'operserv') {
$bot = core::$config->operserv->nick;
}
// what we sending from?
$command = trim($command);
$commands = explode(' ', $command);
$num_cmds = count($commands);
$commands_r = $commands;
// some vars..
if (strtolower($commands[0]) == 'help' || $command == '' || substr($commands[0], 0, 1) == '') {
return false;
}
// its a command we don't need to deal with, ignore it
for ($i = $num_cmds; $i > -1; $i--) {
unset($commands[$i]);
$new_params[] = trim($commands_r[$i]);
$new = strtolower(implode(' ', $commands));
// i really cba explaining this..
if (isset(self::$commands[$hook][$new])) {
break;
}
}
// just a loop to.. err can't remember what this does..
// something interesting though
$new_params = array_reverse($new_params);
// house keeping
foreach ($new_params as $ii => $pp) {
if ($pp == '') {
unset($new_params[$ii]);
}
}
// more housekeeping
if (!isset(self::$commands[$hook][$new])) {
self::$unknown_cmds++;
services::communicate($bot, $nick, 'Unknown command ' . $commands_r[0] . '.');
return false;
}
// command don't exist, at all..
$class = strtolower(self::$commands[$hook][$new]['class']);
$function = strtolower(self::$commands[$hook][$new]['function']);
// get the function stuff.
if (!is_callable(array($class, $function), true) || !method_exists($class, $function)) {
core::alog($class . '::' . $function . '() isn\'t callable, command rejected.', 'BASIC');
return false;
}
// reject the command attempt. output an error
//modules::$list[$class]['class']->$function( $nick, $new_params );
call_user_func_array(array($class, $function), array($nick, $new_params));
// it does! execute the callback
}