public static function alog($message, $type = 'CHAN') { if ((isset(self::$config->settings->logchan) || self::$config->settings->logchan != null) && $type == 'CHAN' && isset(modules::$list['os_global'])) { ircd::msg(self::$config->global->nick, self::$config->settings->logchan, $message); // send the message into the logchan } // logging is enabled, so send the message into the channel. if ((self::$config->settings->loglevel != 'off' || !isset(self::$config->settings->loglevel)) && $type != 'CHAN') { if (self::$config->settings->loglevel == strtolower($type) || self::$config->settings->loglevel == 'all') { if (!in_array($message, self::$log_data)) { self::$log_data[] = $message; } } } // is logging to file enabled? if so, log to file. if (self::$debug && $type != 'CHAN') { if (self::$config->settings->loglevel == strtolower($type) || self::$config->settings->loglevel == 'all') { if (!is_resource(self::$socket) && self::$debug) { print "[" . date('H:i:s', self::$network_time) . "] " . $message . "\r\n"; } elseif (!in_array($message, self::$debug_data)) { self::$debug_data[] = $message; } // if we're not connected, and in debug mode // just send it out, else they wont actually see the message and // it'll just end up in the log file } } // debug on? }
public static function communicate($from, $to, $template, $data = '') { $ntemplate = $template; if ($data != '' && is_array($data)) { foreach ($data as $var => $value) { $ntemplate = str_replace('{' . $var . '}', $value, $ntemplate); } // loop through the array replacing each variable. } // IF there is a $data defined, we do some replacing // otherwise leave it alone if (nickserv::check_flags($to, array('P'))) { ircd::msg($from, $to, $ntemplate); } else { ircd::notice($from, $to, $ntemplate); } // if they are registered, we check their means of contact }