|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* @package acp
|
|
|
4c79b5 |
* @version $Id: acp_jabber.php 8990 2008-10-09 15:41:19Z acydburn $
|
|
|
4c79b5 |
* @copyright (c) 2005 phpBB Group
|
|
|
4c79b5 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* @todo Check/enter/update transport info
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @ignore
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
if (!defined('IN_PHPBB'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @package acp
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
class acp_jabber
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
var $u_action;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function main($id, $mode)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $db, $user, $auth, $template;
|
|
|
4c79b5 |
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->add_lang('acp/board');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$action = request_var('action', '');
|
|
|
4c79b5 |
$submit = (isset($_POST['submit'])) ? true : false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($mode != 'settings')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->tpl_name = 'acp_jabber';
|
|
|
4c79b5 |
$this->page_title = 'ACP_JABBER_SETTINGS';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$jab_enable = request_var('jab_enable', $config['jab_enable']);
|
|
|
4c79b5 |
$jab_host = request_var('jab_host', $config['jab_host']);
|
|
|
4c79b5 |
$jab_port = request_var('jab_port', $config['jab_port']);
|
|
|
4c79b5 |
$jab_username = request_var('jab_username', $config['jab_username']);
|
|
|
4c79b5 |
$jab_password = request_var('jab_password', $config['jab_password']);
|
|
|
4c79b5 |
$jab_package_size = request_var('jab_package_size', $config['jab_package_size']);
|
|
|
4c79b5 |
$jab_use_ssl = request_var('jab_use_ssl', $config['jab_use_ssl']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$form_name = 'acp_jabber';
|
|
|
4c79b5 |
add_form_key($form_name);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($submit)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!check_form_key($form_name))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$error = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$message = $user->lang['JAB_SETTINGS_CHANGED'];
|
|
|
4c79b5 |
$log = 'JAB_SETTINGS_CHANGED';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Is this feature enabled? Then try to establish a connection
|
|
|
4c79b5 |
if ($jab_enable)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password, $jab_use_ssl);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$jabber->connect())
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['ERR_JAB_CONNECT'] . '
' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// We'll try to authorise using this account
|
|
|
4c79b5 |
if (!$jabber->login())
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['ERR_JAB_AUTH'] . '
' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$jabber->disconnect();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// This feature is disabled.
|
|
|
4c79b5 |
// We update the user table to be sure all users that have IM as notify type are set to both as notify type
|
|
|
4c79b5 |
$sql_ary = array(
|
|
|
4c79b5 |
'user_notify_type' => NOTIFY_BOTH,
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
4c79b5 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
4c79b5 |
WHERE user_notify_type = ' . NOTIFY_IM;
|
|
|
4c79b5 |
$db->sql_query($sql);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
set_config('jab_enable', $jab_enable);
|
|
|
4c79b5 |
set_config('jab_host', $jab_host);
|
|
|
4c79b5 |
set_config('jab_port', $jab_port);
|
|
|
4c79b5 |
set_config('jab_username', $jab_username);
|
|
|
4c79b5 |
set_config('jab_password', $jab_password);
|
|
|
4c79b5 |
set_config('jab_package_size', $jab_package_size);
|
|
|
4c79b5 |
set_config('jab_use_ssl', $jab_use_ssl);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_log('admin', 'LOG_' . $log);
|
|
|
4c79b5 |
trigger_error($message . adm_back_link($this->u_action));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'U_ACTION' => $this->u_action,
|
|
|
4c79b5 |
'JAB_ENABLE' => $jab_enable,
|
|
|
4c79b5 |
'L_JAB_SERVER_EXPLAIN' => sprintf($user->lang['JAB_SERVER_EXPLAIN'], '', ''),
|
|
|
4c79b5 |
'JAB_HOST' => $jab_host,
|
|
|
4c79b5 |
'JAB_PORT' => $jab_port,
|
|
|
4c79b5 |
'JAB_USERNAME' => $jab_username,
|
|
|
4c79b5 |
'JAB_PASSWORD' => $jab_password,
|
|
|
4c79b5 |
'JAB_PACKAGE_SIZE' => $jab_package_size,
|
|
|
4c79b5 |
'JAB_USE_SSL' => $jab_use_ssl,
|
|
|
4c79b5 |
'S_CAN_USE_SSL' => jabber::can_use_ssl(),
|
|
|
4c79b5 |
'S_GTALK_NOTE' => (!@function_exists('dns_get_record')) ? true : false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|