From 746b617807048de6f768a74c6d852aeeea8f3a28 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 9 Oct 2008 15:42:08 +0000 Subject: [PATCH] Add two standard language items - #30885 Make sure users still get notifications if they set to only be notified by Jabber, but Jabber service disabled. (Bug #29715 - Patch by Paul) git-svn-id: file:///svn/phpbb/trunk@8991 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_jabber.php | 13 +++++++++++++ phpBB/includes/ucp/ucp_prefs.php | 6 ++++++ phpBB/includes/ucp/ucp_profile.php | 18 ++++++++++++++---- phpBB/language/en/common.php | 4 ++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index a8b55ab397..8f51c84ea2 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -84,6 +84,19 @@ class acp_jabber $jabber->disconnect(); } + else + { + // This feature is disabled. + // We update the user table to be sure all users that have IM as notify type are set to both as notify type + $sql_ary = array( + 'user_notify_type' => NOTIFY_BOTH, + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_notify_type = ' . NOTIFY_IM; + $db->sql_query($sql); + } set_config('jab_enable', $jab_enable); set_config('jab_host', $jab_host); diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index ba0ec4a3cb..31dc0cdeb8 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -53,6 +53,12 @@ class ucp_prefs 'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']), ); + if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml'))) + { + // Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct. + $data['notifymethod'] = NOTIFY_BOTH; + } + if ($submit) { $data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style']; diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index b19fd1056e..95bfee642c 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -347,6 +347,15 @@ class ucp_profile if (!sizeof($error)) { + $data['notify'] = $user->data['user_notify_type']; + + if (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')) + { + // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled) + // Disable notify by Jabber now for this user. + $data['notify'] = NOTIFY_BOTH; + } + $sql_ary = array( 'user_icq' => $data['icq'], 'user_aim' => $data['aim'], @@ -357,6 +366,7 @@ class ucp_profile 'user_from' => $data['location'], 'user_occ' => $data['occupation'], 'user_interests'=> $data['interests'], + 'user_notify_type' => $data['notify'], ); if ($config['allow_birthdays']) @@ -460,7 +470,7 @@ class ucp_profile { trigger_error('NO_AUTH_SIGNATURE'); } - + include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); @@ -589,9 +599,9 @@ class ucp_profile 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']), 'AVATAR_SIZE' => $config['avatar_filesize'], - + 'U_GALLERY' => append_sid('ucp', 'i=profile&mode=avatar&display_gallery=1'), - + 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), @@ -604,7 +614,7 @@ class ucp_profile else { $avatars_enabled = ($can_upload || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false; - + $template->assign_vars(array( 'AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']), 'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']), diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index b6ab95c818..cc8859d851 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -545,6 +545,8 @@ $lang = array_merge($lang, array( 'THE_TEAM' => 'The team', 'TIME' => 'Time', + 'TOO_LONG' => 'The value you entered is too long', + 'TOO_LONG_AIM' => 'The screenname you entered is too long.', 'TOO_LONG_CONFIRM_CODE' => 'The confirm code you entered is too long.', 'TOO_LONG_DATEFORMAT' => 'The date format you entered is too long.', @@ -565,6 +567,8 @@ $lang = array_merge($lang, array( 'TOO_MANY_VOTE_OPTIONS' => 'You have tried to vote for too many options.', + 'TOO_SHORT' => 'The value you entered is too short.', + 'TOO_SHORT_AIM' => 'The screenname you entered is too short.', 'TOO_SHORT_CONFIRM_CODE' => 'The confirm code you entered is too short.', 'TOO_SHORT_DATEFORMAT' => 'The date format you entered is too short.',