本文整理汇总了PHP中rcube::write_log方法的典型用法代码示例。如果您正苦于以下问题:PHP rcube::write_log方法的具体用法?PHP rcube::write_log怎么用?PHP rcube::write_log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rcube
的用法示例。
在下文中一共展示了rcube::write_log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _do_list
private function _do_list($uids, $spam)
{
$rcmail = rcube::get_instance();
$this->sa_user = $rcmail->config->get('sauserprefs_userid', "%u");
$this->sa_table = $rcmail->config->get('sauserprefs_sql_table_name');
$this->sa_username_field = $rcmail->config->get('sauserprefs_sql_username_field');
$this->sa_preference_field = $rcmail->config->get('sauserprefs_sql_preference_field');
$this->sa_value_field = $rcmail->config->get('sauserprefs_sql_value_field');
$identity_arr = $rcmail->user->get_identity();
$identity = $identity_arr['email'];
$this->sa_user = str_replace('%u', $_SESSION['username'], $this->sa_user);
$this->sa_user = str_replace('%l', $rcmail->user->get_username('local'), $this->sa_user);
$this->sa_user = str_replace('%d', $rcmail->user->get_username('domain'), $this->sa_user);
$this->sa_user = str_replace('%i', $identity, $this->sa_user);
if (is_file($rcmail->config->get('markasjunk2_sauserprefs_config')) && !$rcmail->config->load_from_file($rcmail->config->get('markasjunk2_sauserprefs_config'))) {
rcube::raise_error(array('code' => 527, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Failed to load config from " . $rcmail->config->get('markasjunk2_sauserprefs_config')), true, false);
return false;
}
$db = rcube_db::factory($rcmail->config->get('sauserprefs_db_dsnw'), $rcmail->config->get('sauserprefs_db_dsnr'), $rcmail->config->get('sauserprefs_db_persistent'));
$db->set_debug((bool) $rcmail->config->get('sql_debug'));
$db->db_connect('w');
// check DB connections and exit on failure
if ($err_str = $db->is_error()) {
rcube::raise_error(array('code' => 603, 'type' => 'db', 'message' => $err_str), FALSE, TRUE);
}
foreach ($uids as $uid) {
$message = new rcube_message($uid);
$email = $message->sender['mailto'];
if ($spam) {
// delete any whitelisting for this address
$db->query("DELETE FROM `{$this->sa_table}` WHERE `{$this->sa_username_field}` = ? AND `{$this->sa_preference_field}` = ? AND `{$this->sa_value_field}` = ?;", $this->sa_user, 'whitelist_from', $email);
// check address is not already blacklisted
$sql_result = $db->query("SELECT `value` FROM `{$this->sa_table}` WHERE `{$this->sa_username_field}` = ? AND `{$this->sa_preference_field}` = ? AND `{$this->sa_value_field}` = ?;", $this->sa_user, 'blacklist_from', $email);
if (!$db->fetch_array($sql_result)) {
$db->query("INSERT INTO `{$this->sa_table}` (`{$this->sa_username_field}`, `{$this->sa_preference_field}`, `{$this->sa_value_field}`) VALUES (?, ?, ?);", $this->sa_user, 'blacklist_from', $email);
if ($rcmail->config->get('markasjunk2_debug')) {
rcube::write_log('markasjunk2', $this->sa_user . ' blacklist ' . $email);
}
}
} else {
// delete any blacklisting for this address
$db->query("DELETE FROM `{$this->sa_table}` WHERE `{$this->sa_username_field}` = ? AND `{$this->sa_preference_field}` = ? AND `{$this->sa_value_field}` = ?;", $this->sa_user, 'blacklist_from', $email);
// check address is not already whitelisted
$sql_result = $db->query("SELECT `value` FROM `{$this->sa_table}` WHERE `{$this->sa_username_field}` = ? AND `{$this->sa_preference_field}` = ? AND `{$this->sa_value_field}` = ?;", $this->sa_user, 'whitelist_from', $email);
if (!$db->fetch_array($sql_result)) {
$db->query("INSERT INTO `{$this->sa_table}` (`{$this->sa_username_field}`, `{$this->sa_preference_field}`, `{$this->sa_value_field}`) VALUES (?, ?, ?);", $this->sa_user, 'whitelist_from', $email);
if ($rcmail->config->get('markasjunk2_debug')) {
rcube::write_log('markasjunk2', $this->sa_user . ' whitelist ' . $email);
}
}
}
}
}
示例2: _do_salearn
private function _do_salearn($uids, $spam)
{
$rcmail = rcube::get_instance();
$temp_dir = realpath($rcmail->config->get('temp_dir'));
if ($spam) {
$command = $rcmail->config->get('markasjunk2_spam_cmd');
} else {
$command = $rcmail->config->get('markasjunk2_ham_cmd');
}
if (!$command) {
return;
}
$command = str_replace('%u', $_SESSION['username'], $command);
$command = str_replace('%l', $rcmail->user->get_username('local'), $command);
$command = str_replace('%d', $rcmail->user->get_username('domain'), $command);
if (preg_match('/%i/', $command)) {
$identity_arr = $rcmail->user->get_identity();
$command = str_replace('%i', $identity_arr['email'], $command);
}
foreach ($uids as $uid) {
// reset command for next message
$tmp_command = $command;
// get DSPAM signature from header (if %xds macro is used)
if (preg_match('/%xds/', $command)) {
if (preg_match('/^X\\-DSPAM\\-Signature:\\s+((\\d+,)?([a-f\\d]+))\\s*$/im', $rcmail->storage->get_raw_headers($uid), $dspam_signature)) {
$tmp_command = str_replace('%xds', $dspam_signature[1], $tmp_command);
} else {
continue;
}
// no DSPAM signature found in headers -> continue with next uid/message
}
if (preg_match('/%f/', $command)) {
$tmpfname = tempnam($temp_dir, 'rcmSALearn');
file_put_contents($tmpfname, $rcmail->storage->get_raw_body($uid));
$tmp_command = str_replace('%f', $tmpfname, $tmp_command);
}
exec($tmp_command, $output);
if ($rcmail->config->get('markasjunk2_debug')) {
rcube::write_log('markasjunk2', $tmp_command);
rcube::write_log('markasjunk2', $output);
}
if (preg_match('/%f/', $command)) {
unlink($tmpfname);
}
$output = '';
}
}
示例3: save
public function save($curpass, $passwd)
{
$rcmail = rcmail::get_instance();
if ($curpass == '' || $passwd == '') {
return PASSWORD_ERROR;
}
try {
$remote = $rcmail->config->get('hmailserver_remote_dcom', false);
if ($remote) {
$obApp = new COM("hMailServer.Application", $rcmail->config->get('hmailserver_server'));
} else {
$obApp = new COM("hMailServer.Application");
}
} catch (Exception $e) {
rcube::write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage())));
rcube::write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set.");
return PASSWORD_ERROR;
}
$username = $rcmail->user->data['username'];
if (strstr($username, '@')) {
$temparr = explode('@', $username);
$domain = $temparr[1];
} else {
$domain = $rcmail->config->get('username_domain', false);
if (!$domain) {
rcube::write_log('errors', 'Plugin password (hmail driver): $config[\'username_domain\'] is not defined.');
return PASSWORD_ERROR;
}
$username = $username . "@" . $domain;
}
$obApp->Authenticate($username, $curpass);
try {
$obDomain = $obApp->Domains->ItemByName($domain);
$obAccount = $obDomain->Accounts->ItemByAddress($username);
$obAccount->Password = $passwd;
$obAccount->Save();
return PASSWORD_SUCCESS;
} catch (Exception $e) {
rcube::write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage())));
rcube::write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set.");
return PASSWORD_ERROR;
}
}
示例4: _do_list
private function _do_list($uids, $spam)
{
$rcmail = rcube::get_instance();
if (is_file($rcmail->config->get('markasjunk2_sauserprefs_config')) && !$rcmail->config->load_from_file($rcmail->config->get('markasjunk2_sauserprefs_config'))) {
rcube::raise_error(array('code' => 527, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Failed to load config from " . $rcmail->config->get('markasjunk2_sauserprefs_config')), true, false);
return false;
}
$db = rcube_db::factory($rcmail->config->get('sauserprefs_db_dsnw'), $rcmail->config->get('sauserprefs_db_dsnr'), $rcmail->config->get('sauserprefs_db_persistent'));
$db->db_connect('w');
// check DB connections and exit on failure
if ($err_str = $db->is_error()) {
rcube::raise_error(array('code' => 603, 'type' => 'db', 'message' => $err_str), FALSE, TRUE);
}
foreach (explode(",", $uids) as $uid) {
$message = new rcube_message($uid);
$email = $message->sender['mailto'];
if ($spam) {
// delete any whitelisting for this address
$db->query("DELETE FROM " . $rcmail->config->get('sauserprefs_sql_table_name') . " WHERE " . $rcmail->config->get('sauserprefs_sql_username_field') . " = ? AND " . $rcmail->config->get('sauserprefs_sql_preference_field') . " = ? AND " . $rcmail->config->get('sauserprefs_sql_value_field') . " = ?;", $_SESSION['username'], 'whitelist_from', $email);
// check address is not already blacklisted
$sql_result = $db->query("SELECT value FROM " . $rcmail->config->get('sauserprefs_sql_table_name') . " WHERE " . $rcmail->config->get('sauserprefs_sql_username_field') . " = ? AND " . $rcmail->config->get('sauserprefs_sql_preference_field') . " = ? AND " . $rcmail->config->get('sauserprefs_sql_value_field') . " = ?;", $_SESSION['username'], 'blacklist_from', $email);
if (!$db->fetch_array($sql_result)) {
$db->query("INSERT INTO " . $rcmail->config->get('sauserprefs_sql_table_name') . " (" . $rcmail->config->get('sauserprefs_sql_username_field') . ", " . $rcmail->config->get('sauserprefs_sql_preference_field') . ", " . $rcmail->config->get('sauserprefs_sql_value_field') . ") VALUES (?, ?, ?);", $_SESSION['username'], 'blacklist_from', $email);
if ($rcmail->config->get('markasjunk2_debug')) {
rcube::write_log('markasjunk2', $_SESSION['username'] . ' blacklist ' . $email);
}
}
} else {
// delete any blacklisting for this address
$db->query("DELETE FROM " . $rcmail->config->get('sauserprefs_sql_table_name') . " WHERE " . $rcmail->config->get('sauserprefs_sql_username_field') . " = ? AND " . $rcmail->config->get('sauserprefs_sql_preference_field') . " = ? AND " . $rcmail->config->get('sauserprefs_sql_value_field') . " = ?;", $_SESSION['username'], 'blacklist_from', $email);
// check address is not already whitelisted
$sql_result = $db->query("SELECT value FROM " . $rcmail->config->get('sauserprefs_sql_table_name') . " WHERE " . $rcmail->config->get('sauserprefs_sql_username_field') . " = ? AND " . $rcmail->config->get('sauserprefs_sql_preference_field') . " = ? AND " . $rcmail->config->get('sauserprefs_sql_value_field') . " = ?;", $_SESSION['username'], 'whitelist_from', $email);
if (!$db->fetch_array($sql_result)) {
$db->query("INSERT INTO " . $rcmail->config->get('sauserprefs_sql_table_name') . " (" . $rcmail->config->get('sauserprefs_sql_username_field') . ", " . $rcmail->config->get('sauserprefs_sql_preference_field') . ", " . $rcmail->config->get('sauserprefs_sql_value_field') . ") VALUES (?, ?, ?);", $_SESSION['username'], 'whitelist_from', $email);
if ($rcmail->config->get('markasjunk2_debug')) {
rcube::write_log('markasjunk2', $_SESSION['username'] . ' whitelist ' . $email);
}
}
}
}
}
示例5: log
/**
* Prints debug/error info to the log
*/
public function log($level, $msg)
{
$msg = implode("\n", $msg);
switch ($level) {
case LOG_DEBUG:
case LOG_INFO:
case LOG_NOTICE:
if ($this->config['debug']) {
rcube::write_log('ldap', $msg);
}
break;
case LOG_EMERGE:
case LOG_ALERT:
case LOG_CRIT:
rcube::raise_error($msg, true, true);
break;
case LOG_ERR:
case LOG_WARNING:
$this->error = $msg;
rcube::raise_error($msg, true, false);
break;
}
}
示例6: _do_messagemove
private function _do_messagemove($uids, $spam)
{
$rcmail = rcube::get_instance();
if ($spam) {
$dest_dir = unslashify($rcmail->config->get('markasjunk2_spam_dir'));
} else {
$dest_dir = unslashify($rcmail->config->get('markasjunk2_ham_dir'));
}
if (!$dest_dir) {
return;
}
$filename = $rcmail->config->get('markasjunk2_filename');
$filename = str_replace('%u', $_SESSION['username'], $filename);
$filename = str_replace('%t', $spam ? 'spam' : 'ham', $filename);
$filename = str_replace('%l', $rcmail->user->get_username('local'), $filename);
$filename = str_replace('%d', $rcmail->user->get_username('domain'), $filename);
foreach ($uids as $uid) {
$tmpfname = tempnam($dest_dir, $filename);
file_put_contents($tmpfname, $rcmail->storage->get_raw_body($uid));
if ($rcmail->config->get('markasjunk2_debug')) {
rcube::write_log('markasjunk2', $tmpfname);
}
}
}
示例7: debug
/**
* Writes debug information/query to 'sql' log file
*
* @param string $query SQL query
*/
protected function debug($query)
{
if ($this->options['debug_mode']) {
if (($len = strlen($query)) > self::DEBUG_LINE_LENGTH) {
$diff = $len - self::DEBUG_LINE_LENGTH;
$query = substr($query, 0, self::DEBUG_LINE_LENGTH) . "... [truncated {$diff} bytes]";
}
rcube::write_log('sql', '[' . ++$this->db_index . '] ' . $query . ';');
}
}
示例8: debug_handler
/**
* This is our own debug handler for connection
*/
public function debug_handler(&$sieve, $message)
{
rcube::write_log('sieve', preg_replace('/\\r\\n$/', '', $message));
}
示例9: _do_emaillearn
//.........这里部分代码省略.........
// compose headers array
$headers = array();
$headers['Date'] = date('r');
$headers['From'] = format_email_recipient($identity_arr['email'], $identity_arr['name']);
$headers['To'] = $mailto;
$headers['Subject'] = $subject;
foreach ($uids as $uid) {
$MESSAGE = new rcube_message($uid);
// set message charset as default
if (!empty($MESSAGE->headers->charset)) {
$rcmail->storage->set_charset($MESSAGE->headers->charset);
}
$MAIL_MIME = new Mail_mime($rcmail->config->header_delimiter());
if ($rcmail->config->get('markasjunk2_email_attach', false)) {
$tmpPath = tempnam($temp_dir, 'rcmMarkASJunk2');
// send mail as attachment
$MAIL_MIME->setTXTBody(($spam ? 'Spam' : 'Ham') . ' report from ' . $rcmail->config->get('product_name'), false, true);
$raw_message = $rcmail->storage->get_raw_body($uid);
$subject = $MESSAGE->get_header('subject');
if (isset($subject) && $subject != "") {
$disp_name = $subject . ".eml";
} else {
$disp_name = "message_rfc822.eml";
}
if (file_put_contents($tmpPath, $raw_message)) {
$MAIL_MIME->addAttachment($tmpPath, "message/rfc822", $disp_name, true, $transfer_encoding, 'attachment', '', '', '', $rcmail->config->get('mime_param_folding') ? 'quoted-printable' : NULL, $rcmail->config->get('mime_param_folding') == 2 ? 'quoted-printable' : NULL, '', RCUBE_CHARSET);
}
// encoding settings for mail composing
$MAIL_MIME->setParam('text_encoding', $transfer_encoding);
$MAIL_MIME->setParam('html_encoding', 'quoted-printable');
$MAIL_MIME->setParam('head_encoding', 'quoted-printable');
$MAIL_MIME->setParam('head_charset', $message_charset);
$MAIL_MIME->setParam('html_charset', $message_charset);
$MAIL_MIME->setParam('text_charset', $message_charset);
// pass headers to message object
$MAIL_MIME->headers($headers);
} else {
$headers['Resent-From'] = $headers['From'];
$headers['Resent-Date'] = $headers['Date'];
$headers['Date'] = $MESSAGE->headers->date;
$headers['From'] = $MESSAGE->headers->from;
$headers['Subject'] = $MESSAGE->headers->subject;
$MAIL_MIME->headers($headers);
if ($MESSAGE->has_html_part()) {
$body = $MESSAGE->first_html_part();
$MAIL_MIME->setHTMLBody($body);
}
$body = $MESSAGE->first_text_part();
$MAIL_MIME->setTXTBody($body, false, true);
foreach ($MESSAGE->attachments as $attachment) {
$MAIL_MIME->addAttachment($MESSAGE->get_part_body($attachment->mime_id, true), $attachment->mimetype, $attachment->filename, false, $attachment->encoding, $attachment->disposition, '', $attachment->charset);
}
foreach ($MESSAGE->mime_parts as $attachment) {
if (!empty($attachment->content_id)) {
// covert CID to Mail_MIME format
$attachment->content_id = str_replace('<', '', $attachment->content_id);
$attachment->content_id = str_replace('>', '', $attachment->content_id);
if (empty($attachment->filename)) {
$attachment->filename = $attachment->content_id;
}
$message_body = $MAIL_MIME->getHTMLBody();
$dispurl = 'cid:' . $attachment->content_id;
$message_body = str_replace($dispurl, $attachment->filename, $message_body);
$MAIL_MIME->setHTMLBody($message_body);
$MAIL_MIME->addHTMLImage($MESSAGE->get_part_body($attachment->mime_id, true), $attachment->mimetype, $attachment->filename, false);
}
}
// encoding settings for mail composing
$MAIL_MIME->setParam('head_encoding', $MESSAGE->headers->encoding);
$MAIL_MIME->setParam('head_charset', $MESSAGE->headers->charset);
foreach ($MESSAGE->mime_parts as $mime_id => $part) {
$mimetype = strtolower($part->ctype_primary . '/' . $part->ctype_secondary);
if ($mimetype == 'text/html') {
$MAIL_MIME->setParam('text_encoding', $part->encoding);
$MAIL_MIME->setParam('html_charset', $part->charset);
} else {
if ($mimetype == 'text/plain') {
$MAIL_MIME->setParam('html_encoding', $part->encoding);
$MAIL_MIME->setParam('text_charset', $part->charset);
}
}
}
}
$rcmail->deliver_message($MAIL_MIME, $from, $mailto, $smtp_error, $body_file);
// clean up
if (file_exists($tmpPath)) {
unlink($tmpPath);
}
if ($rcmail->config->get('markasjunk2_debug')) {
if ($spam) {
rcube::write_log('markasjunk2', $uid . ' SPAM ' . $mailto . ' (' . $subject . ')');
} else {
rcube::write_log('markasjunk2', $uid . ' HAM ' . $mailto . ' (' . $subject . ')');
}
if ($smtp_error['vars']) {
rcube::write_log('markasjunk2', $smtp_error['vars']);
}
}
}
}
示例10: password_save
function password_save()
{
$this->register_handler('plugin.body', array($this, 'password_form'));
$rcmail = rcmail::get_instance();
$rcmail->output->set_pagetitle($this->gettext('changepasswd'));
$confirm = $rcmail->config->get('password_confirm_current');
$required_length = intval($rcmail->config->get('password_minimum_length'));
$check_strength = $rcmail->config->get('password_require_nonalpha');
if ($confirm && !isset($_POST['_curpasswd']) || !isset($_POST['_newpasswd'])) {
$rcmail->output->command('display_message', $this->gettext('nopassword'), 'error');
} else {
$charset = strtoupper($rcmail->config->get('password_charset', 'ISO-8859-1'));
$rc_charset = strtoupper($rcmail->output->get_charset());
$sespwd = $rcmail->decrypt($_SESSION['password']);
$curpwd = $confirm ? rcube_utils::get_input_value('_curpasswd', rcube_utils::INPUT_POST, true, $charset) : $sespwd;
$newpwd = rcube_utils::get_input_value('_newpasswd', rcube_utils::INPUT_POST, true);
$conpwd = rcube_utils::get_input_value('_confpasswd', rcube_utils::INPUT_POST, true);
// check allowed characters according to the configured 'password_charset' option
// by converting the password entered by the user to this charset and back to UTF-8
$orig_pwd = $newpwd;
$chk_pwd = rcube_charset::convert($orig_pwd, $rc_charset, $charset);
$chk_pwd = rcube_charset::convert($chk_pwd, $charset, $rc_charset);
// WARNING: Default password_charset is ISO-8859-1, so conversion will
// change national characters. This may disable possibility of using
// the same password in other MUA's.
// We're doing this for consistence with Roundcube core
$newpwd = rcube_charset::convert($newpwd, $rc_charset, $charset);
$conpwd = rcube_charset::convert($conpwd, $rc_charset, $charset);
if ($chk_pwd != $orig_pwd) {
$rcmail->output->command('display_message', $this->gettext('passwordforbidden'), 'error');
} else {
if ($conpwd != $newpwd) {
$rcmail->output->command('display_message', $this->gettext('passwordinconsistency'), 'error');
} else {
if ($confirm && $sespwd != $curpwd) {
$rcmail->output->command('display_message', $this->gettext('passwordincorrect'), 'error');
} else {
if ($required_length && strlen($newpwd) < $required_length) {
$rcmail->output->command('display_message', $this->gettext(array('name' => 'passwordshort', 'vars' => array('length' => $required_length))), 'error');
} else {
if ($check_strength && (!preg_match("/[0-9]/", $newpwd) || !preg_match("/[^A-Za-z0-9]/", $newpwd))) {
$rcmail->output->command('display_message', $this->gettext('passwordweak'), 'error');
} else {
if ($sespwd == $newpwd && !$rcmail->config->get('password_force_save')) {
$rcmail->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation');
} else {
if (!($res = $this->_save($curpwd, $newpwd))) {
$rcmail->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation');
// allow additional actions after password change (e.g. reset some backends)
$plugin = $rcmail->plugins->exec_hook('password_change', array('old_pass' => $curpwd, 'new_pass' => $newpwd));
// Reset session password
$_SESSION['password'] = $rcmail->encrypt($plugin['new_pass']);
// Log password change
if ($rcmail->config->get('password_log')) {
rcube::write_log('password', sprintf('Password changed for user %s (ID: %d) from %s', $rcmail->get_user_name(), $rcmail->user->ID, rcube_utils::remote_ip()));
}
} else {
$rcmail->output->command('display_message', $res, 'error');
}
}
}
}
}
}
}
}
$rcmail->overwrite_action('plugin.password');
$rcmail->output->send('plugin');
}
示例11: debug_handler
/**
* This is our own debug handler for the IMAP connection
* @access public
*/
public function debug_handler(&$imap, $message)
{
rcube::write_log('imap', $message);
}
示例12: debug_handler
/**
* This is our own debug handler for the SMTP connection
*/
public function debug_handler(&$smtp, $message)
{
// catch AUTH commands and set anonymization flag for subsequent sends
if (preg_match('/^Send: AUTH ([A-Z]+)/', $message, $m)) {
$this->anonymize_log = $m[1] == 'LOGIN' ? 2 : 1;
} else {
if ($this->anonymize_log > 0 && strpos($message, 'Send:') === 0 && --$this->anonymize_log == 0) {
$message = sprintf('Send: ****** [%d]', strlen($message) - 8);
}
}
if (($len = strlen($message)) > self::DEBUG_LINE_LENGTH) {
$diff = $len - self::DEBUG_LINE_LENGTH;
$message = substr($message, 0, self::DEBUG_LINE_LENGTH) . "... [truncated {$diff} bytes]";
}
rcube::write_log('smtp', preg_replace('/\\r\\n$/', '', $message));
}
示例13: debug_handler
/**
* This is our own debug handler for the SMTP connection
*/
public function debug_handler(&$smtp, $message)
{
if (($len = strlen($message)) > self::DEBUG_LINE_LENGTH) {
$diff = $len - self::DEBUG_LINE_LENGTH;
$message = substr($message, 0, self::DEBUG_LINE_LENGTH) . "... [truncated {$diff} bytes]";
}
rcube::write_log('smtp', preg_replace('/\\r\\n$/', '', $message));
}
示例14: send_request
function send_request($body)
{
$bosh_xml = $this->request_body($body);
if ($this->debug) {
rcube::write_log('xmpp', "C: " . $bosh_xml);
}
if ($ch = curl_init()) {
curl_setopt_array($ch, array(CURLOPT_URL => $this->bosh_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $bosh_xml, CURLOPT_FRESH_CONNECT => true, CURLOPT_HTTPHEADER => array('Content-Type: application/xml')));
$out = curl_exec($ch);
if ($this->debug) {
rcube::write_log('xmpp', "S: " . ($out ?: '<no-response>'));
}
if ($err = curl_error($ch)) {
rcube::raise_error("Converse-XMPP: HTTP connection error: " . $err);
}
return strlen($out) ? simplexml_load_string($out) : null;
}
}
示例15: debug
/**
* Write debug info from Crypt_GPG to logs/enigma
*/
public function debug($line)
{
rcube::write_log('enigma', 'GPG: ' . $line);
}