mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 00:07:44 +02:00
hopefully not too late in the game. Checked in new jabber class (the class done by the flyspray project). It would be nice if this could be tested with more servers - jabber.org seems to work fine...
- other fixes git-svn-id: file:///svn/phpbb/trunk@7687 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -41,121 +41,59 @@ class acp_jabber
|
||||
$jab_port = request_var('jab_port', $config['jab_port']);
|
||||
$jab_username = request_var('jab_username', $config['jab_username']);
|
||||
$jab_password = request_var('jab_password', $config['jab_password']);
|
||||
$jab_resource = request_var('jab_resource', $config['jab_resource']);
|
||||
$jab_package_size = request_var('jab_package_size', $config['jab_package_size']);
|
||||
$jab_use_ssl = request_var('jab_use_ssl', $config['jab_use_ssl']);
|
||||
|
||||
$jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password, $jab_resource);
|
||||
$error = array();
|
||||
|
||||
$message = $user->lang['JAB_SETTINGS_CHANGED'];
|
||||
$log = 'JAB_SETTINGS_CHANGED';
|
||||
|
||||
// Are changing (or initialising) a new host or username? If so run some checks and
|
||||
// try to create account if it doesn't exist
|
||||
if ($jab_enable)
|
||||
if ($submit)
|
||||
{
|
||||
if (($jab_host != $config['jab_host'] || $jab_username != $config['jab_username']) && $jab_username)
|
||||
$error = array();
|
||||
|
||||
$message = $user->lang['JAB_SETTINGS_CHANGED'];
|
||||
$log = 'JAB_SETTINGS_CHANGED';
|
||||
|
||||
// Is this feature enabled? Then try to establish a connection
|
||||
if ($jab_enable)
|
||||
{
|
||||
$jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password);
|
||||
|
||||
if (!$jabber->connect())
|
||||
{
|
||||
trigger_error($user->lang['ERR_JAB_CONNECT'] . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// First we'll try to authorise using this account, if that fails we'll try to create it.
|
||||
if (!($result = $jabber->send_auth()))
|
||||
{
|
||||
if (($result = $jabber->account_registration($config['board_email'], $config['sitename'])) <> 2)
|
||||
{
|
||||
$error[] = ($result == 1) ? $user->lang['ERR_JAB_USERNAME'] : sprintf($user->lang['ERR_JAB_REGISTER'], $result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $user->lang['JAB_REGISTERED'];
|
||||
$log = 'JAB_REGISTER';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $user->lang['JAB_CHANGED'];
|
||||
$log = 'JAB_CHANGED';
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
$jabber->disconnect();
|
||||
}
|
||||
else if ($jab_password != $config['jab_password'])
|
||||
{
|
||||
if (!$jabber->connect())
|
||||
{
|
||||
trigger_error($user->lang['ERR_JAB_CONNECT'] . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$jabber->send_auth())
|
||||
// We'll try to authorise using this account
|
||||
if (!$jabber->login())
|
||||
{
|
||||
trigger_error($user->lang['ERR_JAB_AUTH'] . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
$jabber->send_presence(NULL, NULL, 'online');
|
||||
|
||||
if (($result = $jabber->change_password($jab_password)) <> 2)
|
||||
{
|
||||
$error[] = ($result == 1) ? $user->lang['ERR_JAB_PASSCHG'] : sprintf($user->lang['ERR_JAB_PASSFAIL'], $result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $user->lang['JAB_PASS_CHANGED'];
|
||||
$log = 'JAB_PASSCHG';
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
$jabber->disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
// Pull relevant config data
|
||||
$sql = 'SELECT *
|
||||
FROM ' . CONFIG_TABLE . "
|
||||
WHERE config_name LIKE 'jab_%'";
|
||||
$result = $db->sql_query($sql);
|
||||
set_config('jab_enable', $jab_enable);
|
||||
set_config('jab_host', $jab_host);
|
||||
set_config('jab_port', $jab_port);
|
||||
set_config('jab_username', $jab_username);
|
||||
set_config('jab_password', $jab_password);
|
||||
set_config('jab_package_size', $jab_package_size);
|
||||
set_config('jab_use_ssl', $jab_use_ssl);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$config_name = $row['config_name'];
|
||||
$config_value = $row['config_value'];
|
||||
|
||||
$default_config[$config_name] = $config_value;
|
||||
$new[$config_name] = (isset($_POST[$config_name])) ? request_var($config_name, '') : $default_config[$config_name];
|
||||
|
||||
if ($submit && !sizeof($error))
|
||||
{
|
||||
set_config($config_name, $new[$config_name]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($submit && !sizeof($error))
|
||||
{
|
||||
add_log('admin', 'LOG_' . $log);
|
||||
trigger_error($message . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
if (sizeof($error))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_WARNING' => true,
|
||||
'WARNING_MSG' => implode('<br />', $error))
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'JAB_ENABLE' => $new['jab_enable'],
|
||||
'JAB_ENABLE' => $jab_enable,
|
||||
'L_JAB_SERVER_EXPLAIN' => sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/">', '</a>'),
|
||||
'JAB_HOST' => $new['jab_host'],
|
||||
'JAB_PORT' => $new['jab_port'],
|
||||
'JAB_USERNAME' => $new['jab_username'],
|
||||
'JAB_PASSWORD' => $new['jab_password'],
|
||||
'JAB_RESOURCE' => $new['jab_resource'],
|
||||
'JAB_PACKAGE_SIZE' => $new['jab_package_size'])
|
||||
);
|
||||
'JAB_HOST' => $jab_host,
|
||||
'JAB_PORT' => $jab_port,
|
||||
'JAB_USERNAME' => $jab_username,
|
||||
'JAB_PASSWORD' => $jab_password,
|
||||
'JAB_PACKAGE_SIZE' => $jab_package_size,
|
||||
'JAB_USE_SSL' => $jab_use_ssl,
|
||||
'S_CAN_USE_SSL' => jabber::can_use_ssl(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1067,7 +1067,7 @@ class acp_users
|
||||
|
||||
foreach ($cp_data as $key => $value)
|
||||
{
|
||||
$cp_data[$right_delim . $key . $left_delim] = $value;
|
||||
$cp_data[$left_delim . $key . $right_delim] = $value;
|
||||
unset($cp_data[$key]);
|
||||
}
|
||||
|
||||
@@ -1616,7 +1616,7 @@ class acp_users
|
||||
}
|
||||
else
|
||||
{
|
||||
$view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}#{$row['post_msg_id']}");
|
||||
$view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . '#p' . $row['post_msg_id'];
|
||||
}
|
||||
|
||||
$template->assign_block_vars('attach', array(
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -458,7 +458,7 @@ class messenger
|
||||
if (!$use_queue)
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
|
||||
$this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_resource']);
|
||||
$this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password']);
|
||||
|
||||
if (!$this->jabber->connect())
|
||||
{
|
||||
@@ -466,19 +466,17 @@ class messenger
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->jabber->send_auth())
|
||||
if (!$this->jabber->login())
|
||||
{
|
||||
$this->error('JABBER', 'Could not authorise on Jabber server<br />' . $this->jabber->get_log());
|
||||
return false;
|
||||
}
|
||||
$this->jabber->send_presence(NULL, NULL, 'online');
|
||||
|
||||
foreach ($addresses as $address)
|
||||
{
|
||||
$this->jabber->send_message($address, 'normal', NULL, array('body' => $this->msg, 'subject' => $this->subject));
|
||||
$this->jabber->send_message($address, $this->msg, $this->subject);
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
$this->jabber->disconnect();
|
||||
}
|
||||
else
|
||||
@@ -592,7 +590,7 @@ class queue
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_jabber.'.$phpEx);
|
||||
$this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_resource']);
|
||||
$this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password']);
|
||||
|
||||
if (!$this->jabber->connect())
|
||||
{
|
||||
@@ -600,12 +598,11 @@ class queue
|
||||
continue 2;
|
||||
}
|
||||
|
||||
if (!$this->jabber->send_auth())
|
||||
if (!$this->jabber->login())
|
||||
{
|
||||
messenger::error('JABBER', 'Could not authorise on Jabber server');
|
||||
continue 2;
|
||||
}
|
||||
$this->jabber->send_presence(NULL, NULL, 'online');
|
||||
|
||||
break;
|
||||
|
||||
@@ -647,7 +644,7 @@ class queue
|
||||
case 'jabber':
|
||||
foreach ($addresses as $address)
|
||||
{
|
||||
if ($this->jabber->send_message($address, 'normal', NULL, array('body' => $msg, 'subject' => $subject)) === false)
|
||||
if ($this->jabber->send_message($address, $msg, $subject) === false)
|
||||
{
|
||||
messenger::error('JABBER', $this->jabber->get_log());
|
||||
continue 3;
|
||||
@@ -669,7 +666,6 @@ class queue
|
||||
case 'jabber':
|
||||
// Hang about a couple of secs to ensure the messages are
|
||||
// handled, then disconnect
|
||||
sleep(1);
|
||||
$this->jabber->disconnect();
|
||||
break;
|
||||
}
|
||||
|
@@ -1712,7 +1712,7 @@ class user extends session
|
||||
|
||||
$img_data = &$imgs[$img];
|
||||
|
||||
if (empty($img_data) || $width !== false)
|
||||
if (empty($img_data))
|
||||
{
|
||||
if (!isset($this->img_array[$img]))
|
||||
{
|
||||
@@ -1735,7 +1735,7 @@ class user extends session
|
||||
break;
|
||||
|
||||
case 'width':
|
||||
return $img_data['width'];
|
||||
return ($width === false) ? $img_data['width'] : $width;
|
||||
break;
|
||||
|
||||
case 'height':
|
||||
@@ -1743,7 +1743,9 @@ class user extends session
|
||||
break;
|
||||
|
||||
default:
|
||||
return '<img src="' . $img_data['src'] . '"' . (($img_data['width']) ? ' width="' . $img_data['width'] . '"' : '') . (($img_data['height']) ? ' height="' . $img_data['height'] . '"' : '') . ' alt="' . $alt . '" title="' . $alt . '" />';
|
||||
$use_width = ($width === false) ? $img_data['width'] : $width;
|
||||
|
||||
return '<img src="' . $img_data['src'] . '"' . (($use_width) ? ' width="' . $use_width . '"' : '') . (($img_data['height']) ? ' height="' . $img_data['height'] . '"' : '') . ' alt="' . $alt . '" title="' . $alt . '" />';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user