~azzar1/unity/add-show-desktop-key

443 by dcoles
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0
1
<?php
2
/**
3
*
4
* @package acp
5
* @version $Id: acp_jabber.php,v 1.25 2007/10/05 14:36:32 acydburn Exp $
6
* @copyright (c) 2005 phpBB Group
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
8
*
9
* @todo Check/enter/update transport info
10
*/
11
12
/**
13
* @ignore
14
*/
15
if (!defined('IN_PHPBB'))
16
{
17
	exit;
18
}
19
20
/**
21
* @package acp
22
*/
23
class acp_jabber
24
{
25
	var $u_action;
26
27
	function main($id, $mode)
28
	{
29
		global $db, $user, $auth, $template;
30
		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
31
32
		$user->add_lang('acp/board');
33
34
		include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
35
36
		$action	= request_var('action', '');
37
		$submit = (isset($_POST['submit'])) ? true : false;
38
39
		if ($mode != 'settings')
40
		{
41
			return;
42
		}
43
44
		$this->tpl_name = 'acp_jabber';
45
		$this->page_title = 'ACP_JABBER_SETTINGS';
46
47
		$jab_enable			= request_var('jab_enable', $config['jab_enable']);
48
		$jab_host			= request_var('jab_host', $config['jab_host']);
49
		$jab_port			= request_var('jab_port', $config['jab_port']);
50
		$jab_username		= request_var('jab_username', $config['jab_username']);
51
		$jab_password		= request_var('jab_password', $config['jab_password']);
52
		$jab_package_size	= request_var('jab_package_size', $config['jab_package_size']);
53
		$jab_use_ssl		= request_var('jab_use_ssl', $config['jab_use_ssl']);
54
55
		$form_name = 'acp_jabber';
56
		add_form_key($form_name);
57
58
		if ($submit)
59
		{
60
			if (!check_form_key($form_name))
61
			{
62
				trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
63
			}
64
65
			$error = array();
66
67
			$message = $user->lang['JAB_SETTINGS_CHANGED'];
68
			$log = 'JAB_SETTINGS_CHANGED';
69
70
			// Is this feature enabled? Then try to establish a connection
71
			if ($jab_enable)
72
			{
73
				$jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password, $jab_use_ssl);
74
75
				if (!$jabber->connect())
76
				{
77
					trigger_error($user->lang['ERR_JAB_CONNECT'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
78
				}
79
80
				// We'll try to authorise using this account
81
				if (!$jabber->login())
82
				{
83
					trigger_error($user->lang['ERR_JAB_AUTH'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
84
				}
85
86
				$jabber->disconnect();
87
			}
88
89
			set_config('jab_enable', $jab_enable);
90
			set_config('jab_host', $jab_host);
91
			set_config('jab_port', $jab_port);
92
			set_config('jab_username', $jab_username);
93
			set_config('jab_password', $jab_password);
94
			set_config('jab_package_size', $jab_package_size);
95
			set_config('jab_use_ssl', $jab_use_ssl);
96
97
			add_log('admin', 'LOG_' . $log);
98
			trigger_error($message . adm_back_link($this->u_action));
99
		}
100
101
		$template->assign_vars(array(
102
			'U_ACTION'				=> $this->u_action,
103
			'JAB_ENABLE'			=> $jab_enable,
104
			'L_JAB_SERVER_EXPLAIN'	=> sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/">', '</a>'),
105
			'JAB_HOST'				=> $jab_host,
106
			'JAB_PORT'				=> $jab_port,
107
			'JAB_USERNAME'			=> $jab_username,
108
			'JAB_PASSWORD'			=> $jab_password,
109
			'JAB_PACKAGE_SIZE'		=> $jab_package_size,
110
			'JAB_USE_SSL'			=> $jab_use_ssl,
111
			'S_CAN_USE_SSL'			=> jabber::can_use_ssl(),
112
			'S_GTALK_NOTE'			=> (!@function_exists('dns_get_record')) ? true : false,
113
		));
114
	}
115
}
116
117
?>