mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 19:24:01 +02:00
[ticket/17135] Move notify method constants to interface class
PHPBB-17135
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use phpbb\messenger\method\messenger_interface;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@@ -156,9 +158,9 @@ class acp_email
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) ||
|
||||
($row['user_notify_type'] == NOTIFY_IM && $row['user_jabber']) ||
|
||||
($row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])))
|
||||
if (($row['user_notify_type'] == messenger_interface::NOTIFY_EMAIL && $row['user_email']) ||
|
||||
($row['user_notify_type'] == messenger_interface::NOTIFY_IM && $row['user_jabber']) ||
|
||||
($row['user_notify_type'] == messenger_interface::NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])))
|
||||
{
|
||||
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type)
|
||||
{
|
||||
@@ -228,14 +230,14 @@ class acp_email
|
||||
foreach ($messenger_collection_iterator as $messenger_method)
|
||||
{
|
||||
$notify_method = $messenger_method->get_id();
|
||||
if ($notify_method == $used_method || $used_method == NOTIFY_BOTH)
|
||||
if ($notify_method == $used_method || $used_method == messenger_interface::NOTIFY_BOTH)
|
||||
{
|
||||
$messenger_method->set_use_queue($use_queue);
|
||||
$messenger_method->template($email_template, $used_lang);
|
||||
$messenger_method->subject(html_entity_decode($subject, ENT_COMPAT));
|
||||
$messenger_method->assign_vars($template_data);
|
||||
|
||||
if ($notify_method == NOTIFY_EMAIL)
|
||||
if ($notify_method == messenger_interface::NOTIFY_EMAIL)
|
||||
{
|
||||
for ($j = 0, $list_size = count($email_list[$i]); $j < $list_size; $j++)
|
||||
{
|
||||
@@ -243,7 +245,6 @@ class acp_email
|
||||
if (count($email_list[$i]) == 1)
|
||||
{
|
||||
$messenger_method->to($email_row['email'], $email_row['name']);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -254,7 +255,7 @@ class acp_email
|
||||
$messenger_method->anti_abuse_headers($config, $user);
|
||||
$messenger_method->set_mail_priority($priority);
|
||||
}
|
||||
else if ($notify_method == NOTIFY_IM)
|
||||
else if ($notify_method == messenger_interface::NOTIFY_IM)
|
||||
{
|
||||
for ($j = 0, $list_size = count($email_list[$i]); $j < $list_size; $j++)
|
||||
{
|
||||
|
@@ -207,7 +207,7 @@ class acp_inactive
|
||||
{
|
||||
foreach ($messenger_collection_iterator as $messenger_method)
|
||||
{
|
||||
if ($messenger_method->get_id() == $user_row['user_notify_type'] || $user_row['user_notify_type'] == NOTIFY_BOTH)
|
||||
if ($messenger_method->get_id() == $user_row['user_notify_type'] || $user_row['user_notify_type'] == $messenger_method::NOTIFY_BOTH)
|
||||
{
|
||||
$messenger_method->template('user_remind_inactive', $row['user_lang']);
|
||||
$messenger_method->set_addresses($row);
|
||||
|
@@ -30,15 +30,10 @@ class acp_jabber
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $user, $template, $phpbb_log, $request;
|
||||
global $config, $phpbb_root_path, $phpEx;
|
||||
global $config, $phpbb_container, $phpbb_root_path, $phpEx;
|
||||
|
||||
$user->add_lang('acp/board');
|
||||
|
||||
if (!class_exists('jabber'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
|
||||
}
|
||||
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
|
||||
if ($mode != 'settings')
|
||||
@@ -73,11 +68,11 @@ class acp_jabber
|
||||
$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, $jab_use_ssl, $jab_verify_peer, $jab_verify_peer_name, $jab_allow_self_signed);
|
||||
$jabber = $phpbb_container->get('messenger.method.jabber');
|
||||
|
||||
// Is this feature enabled? Then try to establish a connection
|
||||
if ($jabber->is_enabled())
|
||||
{
|
||||
if (!$jabber->connect())
|
||||
{
|
||||
trigger_error($user->lang['ERR_JAB_CONNECT'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
@@ -97,12 +92,12 @@ class acp_jabber
|
||||
// We update the user table to be sure all users that have IM as notify type are set to both as notify type
|
||||
// We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled.
|
||||
$sql_ary = array(
|
||||
'user_notify_type' => NOTIFY_BOTH,
|
||||
'user_notify_type' => $jabber::NOTIFY_BOTH,
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_notify_type = ' . NOTIFY_IM;
|
||||
WHERE user_notify_type = ' . $jabber::NOTIFY_IM;
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
@@ -137,7 +132,7 @@ class acp_jabber
|
||||
'JAB_VERIFY_PEER' => $jab_verify_peer,
|
||||
'JAB_VERIFY_PEER_NAME' => $jab_verify_peer_name,
|
||||
'JAB_ALLOW_SELF_SIGNED' => $jab_allow_self_signed,
|
||||
'S_CAN_USE_SSL' => jabber::can_use_ssl(),
|
||||
'S_CAN_USE_SSL' => $jabber::can_use_ssl(),
|
||||
'S_GTALK_NOTE' => (!@function_exists('dns_get_record')) ? true : false,
|
||||
));
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
use phpbb\controller\helper;
|
||||
use phpbb\messenger\method\messenger_interface;
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
@@ -1792,9 +1793,9 @@ class acp_users
|
||||
'MASS_EMAIL' => $data['massemail'],
|
||||
'ALLOW_PM' => $data['allowpm'],
|
||||
'HIDE_ONLINE' => $data['hideonline'],
|
||||
'NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false,
|
||||
'NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false,
|
||||
'NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false,
|
||||
'NOTIFY_EMAIL' => ($data['notifymethod'] == messenger_interface::NOTIFY_EMAIL) ? true : false,
|
||||
'NOTIFY_IM' => ($data['notifymethod'] == messenger_interface::NOTIFY_IM) ? true : false,
|
||||
'NOTIFY_BOTH' => ($data['notifymethod'] == messenger_interface::NOTIFY_BOTH) ? true : false,
|
||||
'NOTIFY_PM' => $data['notifypm'],
|
||||
'BBCODE' => $data['bbcode'],
|
||||
'SMILIES' => $data['smilies'],
|
||||
|
Reference in New Issue
Block a user