mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/8323
# By Joas Schilling (613) and others # Via Andreas Fischer (214) and others * 'develop' of github.com:phpbb/phpbb3: (2494 commits) [ticket/11825] Move schema_data.php into includes/ instead of phpbb/ [ticket/11215] Remove unnecessary comment [ticket/11755] MySQL upgrader out of date [prep-release-3.0.12] Update Changelog for 3.0.12-RC3 release. [prep-release-3.0.12] Bumping version number for 3.0.12-RC3. [ticket/11823] Set up nginx server to match PHP files with characters after .php [ticket/11812] Fix empty define [ticket/11818] Update Symfony dependencies to 2.3.* [ticket/11791] Load adm/ events from styles/adm/event/ [ticket/11215] Fix helper_url_test.php tests [ticket/11215] Add newline back to .htaccess, fix wording [ticket/11215] Update comment in .htaccess [ticket/11215] Uncomment rewrite rules in .htaccess [ticket/11215] Make controller helper url() method use correct format [ticket/11215] Add commented-out URL rewrite capability to .htaccess [ticket/11821] Fix comma usage next to "You are receiving this notification". [ticket/11769] Allow using 0 as poster name [ticket/11769] Allow '0' as username [ticket/11215] Use new URL structure for controllers [ticket/11215] Everything appears to be working... ... Conflicts: phpBB/includes/functions_privmsgs.php
This commit is contained in:
35
phpBB/includes/ucp/info/ucp_notifications.php
Normal file
35
phpBB/includes/ucp/info/ucp_notifications.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package notifications
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package module_install
|
||||
*/
|
||||
class ucp_notifications_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => 'ucp_notifications',
|
||||
'title' => 'UCP_NOTIFICATION_OPTIONS',
|
||||
'version' => '1.0.0',
|
||||
'modes' => array(
|
||||
'notification_options' => array('title' => 'UCP_NOTIFICATION_OPTIONS', 'auth' => '', 'cat' => array('UCP_PREFS')),
|
||||
'notification_list' => array('title' => 'UCP_NOTIFICATION_LIST', 'auth' => '', 'cat' => array('UCP_MAIN')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
}
|
||||
}
|
@@ -21,7 +21,7 @@ class ucp_profile_info
|
||||
'modes' => array(
|
||||
'profile_info' => array('title' => 'UCP_PROFILE_PROFILE_INFO', 'auth' => 'acl_u_chgprofileinfo', 'cat' => array('UCP_PROFILE')),
|
||||
'signature' => array('title' => 'UCP_PROFILE_SIGNATURE', 'auth' => 'acl_u_sig', 'cat' => array('UCP_PROFILE')),
|
||||
'avatar' => array('title' => 'UCP_PROFILE_AVATAR', 'auth' => 'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)', 'cat' => array('UCP_PROFILE')),
|
||||
'avatar' => array('title' => 'UCP_PROFILE_AVATAR', 'auth' => 'cfg_allow_avatar', 'cat' => array('UCP_PROFILE')),
|
||||
'reg_details' => array('title' => 'UCP_PROFILE_REG_DETAILS', 'auth' => '', 'cat' => array('UCP_PROFILE')),
|
||||
'autologin_keys'=> array('title' => 'UCP_PROFILE_AUTOLOGIN_KEYS', 'auth' => '', 'cat' => array('UCP_PROFILE')),
|
||||
),
|
||||
|
@@ -50,7 +50,7 @@ class ucp_activate
|
||||
trigger_error('ALREADY_ACTIVATED');
|
||||
}
|
||||
|
||||
if (($user_row['user_inactive_reason'] == INACTIVE_MANUAL) || $user_row['user_actkey'] != $key)
|
||||
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL || $user_row['user_actkey'] !== $key)
|
||||
{
|
||||
trigger_error('WRONG_ACTIVATION');
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class ucp_activate
|
||||
|
||||
$messenger->template('admin_welcome_activated', $user_row['user_lang']);
|
||||
|
||||
$messenger->to($user_row['user_email'], $user_row['username']);
|
||||
$messenger->set_addresses($user_row);
|
||||
|
||||
$messenger->anti_abuse_headers($config, $user);
|
||||
|
||||
|
@@ -25,9 +25,9 @@ class ucp_groups
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $config, $phpbb_root_path, $phpEx;
|
||||
global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
|
||||
global $db, $user, $auth, $cache, $template;
|
||||
global $request;
|
||||
global $request, $phpbb_container;
|
||||
|
||||
$user->add_lang('groups');
|
||||
|
||||
@@ -212,8 +212,7 @@ class ucp_groups
|
||||
{
|
||||
$messenger->template('group_request', $row['user_lang']);
|
||||
|
||||
$messenger->to($row['user_email'], $row['username']);
|
||||
$messenger->im($row['user_jabber'], $row['username']);
|
||||
$messenger->set_addresses($row);
|
||||
|
||||
$messenger->assign_vars(array(
|
||||
'USERNAME' => htmlspecialchars_decode($row['username']),
|
||||
@@ -417,9 +416,11 @@ class ucp_groups
|
||||
|
||||
if ($group_id)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_id = $group_id";
|
||||
$sql = 'SELECT g.*, t.teampage_position AS group_teampage
|
||||
FROM ' . GROUPS_TABLE . ' g
|
||||
LEFT JOIN ' . TEAMPAGE_TABLE . ' t
|
||||
ON (t.group_id = g.group_id)
|
||||
WHERE g.group_id = ' . $group_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$group_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
@@ -438,7 +439,7 @@ class ucp_groups
|
||||
$group_name = $group_row['group_name'];
|
||||
$group_type = $group_row['group_type'];
|
||||
|
||||
$avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />';
|
||||
$avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
|
||||
@@ -447,8 +448,8 @@ class ucp_groups
|
||||
'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']),
|
||||
'GROUP_TYPE' => $group_row['group_type'],
|
||||
|
||||
'AVATAR' => $avatar_img,
|
||||
'AVATAR_IMAGE' => $avatar_img,
|
||||
'AVATAR' => (empty($avatar) ? '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />' : $avatar),
|
||||
'AVATAR_IMAGE' => (empty($avatar) ? '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />' : $avatar),
|
||||
'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',
|
||||
'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '',
|
||||
));
|
||||
@@ -483,10 +484,20 @@ class ucp_groups
|
||||
|
||||
$error = array();
|
||||
|
||||
$avatar_select = basename(request_var('avatar_select', ''));
|
||||
$category = basename(request_var('category', ''));
|
||||
// Setup avatar data for later
|
||||
$avatars_enabled = false;
|
||||
$avatar_drivers = null;
|
||||
$avatar_data = null;
|
||||
$avatar_error = array();
|
||||
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
if ($config['allow_avatar'])
|
||||
{
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
||||
|
||||
// This is normalised data, without the group_ prefix
|
||||
$avatar_data = phpbb_avatar_manager::clean_row($group_row);
|
||||
}
|
||||
|
||||
// Did we submit?
|
||||
if ($update)
|
||||
@@ -505,90 +516,44 @@ class ucp_groups
|
||||
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
|
||||
'message_limit' => request_var('group_message_limit', 0),
|
||||
'max_recipients'=> request_var('group_max_recipients', 0),
|
||||
'legend' => $group_row['group_legend'],
|
||||
'teampage' => $group_row['group_teampage'],
|
||||
);
|
||||
|
||||
$data['uploadurl'] = request_var('uploadurl', '');
|
||||
$data['remotelink'] = request_var('remotelink', '');
|
||||
$data['width'] = request_var('width', '');
|
||||
$data['height'] = request_var('height', '');
|
||||
$delete = request_var('delete', '');
|
||||
|
||||
$uploadfile = $request->file('uploadfile');
|
||||
if (!empty($uploadfile['tmp_name']) || $data['uploadurl'] || $data['remotelink'])
|
||||
if ($config['allow_avatar'])
|
||||
{
|
||||
// Avatar stuff
|
||||
$var_ary = array(
|
||||
'uploadurl' => array('string', true, 5, 255),
|
||||
'remotelink' => array('string', true, 5, 255),
|
||||
'width' => array('string', true, 1, 3),
|
||||
'height' => array('string', true, 1, 3),
|
||||
);
|
||||
// Handle avatar
|
||||
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));
|
||||
$config_name = preg_replace('#^avatar\.driver.#', '', $driver_name);
|
||||
|
||||
if (!($error = validate_data($data, $var_ary)))
|
||||
if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete'))
|
||||
{
|
||||
$data['user_id'] = "g$group_id";
|
||||
$driver = $phpbb_avatar_manager->get_driver($driver_name);
|
||||
$result = $driver->process_form($request, $template, $user, $avatar_data, $avatar_error);
|
||||
|
||||
if ((!empty($uploadfile['tmp_name']) || $data['uploadurl']) && $can_upload)
|
||||
if ($result && empty($avatar_error))
|
||||
{
|
||||
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
|
||||
}
|
||||
else if ($data['remotelink'])
|
||||
{
|
||||
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
|
||||
$result['avatar_type'] = $driver_name;
|
||||
|
||||
$submit_ary = array_merge($submit_ary, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($avatar_select && $config['allow_avatar_local'])
|
||||
{
|
||||
// check avatar gallery
|
||||
if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category))
|
||||
else
|
||||
{
|
||||
$submit_ary['avatar_type'] = AVATAR_GALLERY;
|
||||
|
||||
list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
|
||||
$submit_ary['avatar'] = $category . '/' . $avatar_select;
|
||||
}
|
||||
}
|
||||
else if ($delete)
|
||||
{
|
||||
$submit_ary['avatar'] = '';
|
||||
$submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
|
||||
}
|
||||
else if ($data['width'] && $data['height'])
|
||||
{
|
||||
// Only update the dimensions?
|
||||
if ($config['avatar_max_width'] || $config['avatar_max_height'])
|
||||
{
|
||||
if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
|
||||
if ($driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']))
|
||||
{
|
||||
$error[] = phpbb_avatar_error_wrong_size($data['width'], $data['height']);
|
||||
$driver->delete($avatar_data);
|
||||
}
|
||||
|
||||
// Removing the avatar
|
||||
$submit_ary['avatar_type'] = '';
|
||||
$submit_ary['avatar'] = '';
|
||||
$submit_ary['avatar_width'] = 0;
|
||||
$submit_ary['avatar_height'] = 0;
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if ($config['avatar_min_width'] || $config['avatar_min_height'])
|
||||
{
|
||||
if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height'])
|
||||
{
|
||||
$error[] = phpbb_avatar_error_wrong_size($data['width'], $data['height']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$submit_ary['avatar_width'] = $data['width'];
|
||||
$submit_ary['avatar_height'] = $data['height'];
|
||||
}
|
||||
}
|
||||
|
||||
if ((isset($submit_ary['avatar']) && $submit_ary['avatar'] && (!isset($group_row['group_avatar']))) || $delete)
|
||||
{
|
||||
if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
|
||||
{
|
||||
avatar_delete('group', $group_row, true);
|
||||
}
|
||||
// Merge any avatars errors into the primary error array
|
||||
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
||||
}
|
||||
|
||||
if (!check_form_key('ucp_groups'))
|
||||
@@ -596,29 +561,40 @@ class ucp_groups
|
||||
$error[] = $user->lang['FORM_INVALID'];
|
||||
}
|
||||
|
||||
// Validate submitted colour value
|
||||
if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour', true))))
|
||||
{
|
||||
// Replace "error" string with its real, localised form
|
||||
$error = array_merge($error, $colour_error);
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
// Only set the rank, colour, etc. if it's changed or if we're adding a new
|
||||
// group. This prevents existing group members being updated if no changes
|
||||
// were made.
|
||||
// However there are some attributes that need to be set everytime,
|
||||
// otherwise the group gets removed from the feature.
|
||||
$set_attributes = array('legend', 'teampage');
|
||||
|
||||
$group_attributes = array();
|
||||
$test_variables = array(
|
||||
'rank' => 'int',
|
||||
'colour' => 'string',
|
||||
'avatar' => 'string',
|
||||
'avatar_type' => 'int',
|
||||
'avatar_type' => 'string',
|
||||
'avatar_width' => 'int',
|
||||
'avatar_height' => 'int',
|
||||
'receive_pm' => 'int',
|
||||
'legend' => 'int',
|
||||
'teampage' => 'int',
|
||||
'message_limit' => 'int',
|
||||
'max_recipients'=> 'int',
|
||||
);
|
||||
|
||||
foreach ($test_variables as $test => $type)
|
||||
{
|
||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test]))
|
||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || isset($group_attributes['group_avatar']) && strpos($test, 'avatar') === 0 || in_array($test, $set_attributes)))
|
||||
{
|
||||
settype($submit_ary[$test], $type);
|
||||
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
|
||||
@@ -628,6 +604,7 @@ class ucp_groups
|
||||
if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies)))
|
||||
{
|
||||
$cache->destroy('sql', GROUPS_TABLE);
|
||||
$cache->destroy('sql', TEAMPAGE_TABLE);
|
||||
|
||||
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
|
||||
trigger_error($user->lang[$message] . $return_page);
|
||||
@@ -636,6 +613,7 @@ class ucp_groups
|
||||
|
||||
if (sizeof($error))
|
||||
{
|
||||
$error = array_map(array(&$user, 'lang'), $error);
|
||||
$group_rank = $submit_ary['rank'];
|
||||
|
||||
$group_desc_data = array(
|
||||
@@ -683,28 +661,51 @@ class ucp_groups
|
||||
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
|
||||
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';
|
||||
|
||||
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
|
||||
|
||||
if ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery)
|
||||
// Load up stuff for avatars
|
||||
if ($config['allow_avatar'])
|
||||
{
|
||||
avatar_gallery($category, $avatar_select, 4);
|
||||
$avatars_enabled = false;
|
||||
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $avatar_data['avatar_type']));
|
||||
|
||||
foreach ($avatar_drivers as $current_driver)
|
||||
{
|
||||
$driver = $phpbb_avatar_manager->get_driver($current_driver);
|
||||
|
||||
$avatars_enabled = true;
|
||||
$template->set_filenames(array(
|
||||
'avatar' => $driver->get_template_name(),
|
||||
));
|
||||
|
||||
if ($driver->prepare_form($request, $template, $user, $avatar_data, $avatar_error))
|
||||
{
|
||||
$driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver);
|
||||
$driver_upper = strtoupper($driver_name);
|
||||
$template->assign_block_vars('avatar_drivers', array(
|
||||
'L_TITLE' => $user->lang($driver_upper . '_TITLE'),
|
||||
'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'),
|
||||
|
||||
'DRIVER' => $driver_name,
|
||||
'SELECTED' => $current_driver == $selected_driver,
|
||||
'OUTPUT' => $template->assign_display('avatar'),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$avatars_enabled = ($config['allow_avatar'] && (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) || ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false;
|
||||
if (isset($phpbb_avatar_manager) && !$update)
|
||||
{
|
||||
// Merge any avatars errors into the primary error array
|
||||
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_INCLUDE_SWATCH' => true,
|
||||
'S_FORM_ENCTYPE' => ($config['allow_avatar'] && $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '',
|
||||
'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
|
||||
'S_AVATARS_ENABLED' => $avatars_enabled,
|
||||
'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false,
|
||||
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
|
||||
|
||||
'S_UPLOAD_AVATAR_FILE' => ($config['allow_avatar'] && $config['allow_avatar_upload'] && $can_upload) ? true : false,
|
||||
'S_UPLOAD_AVATAR_URL' => ($config['allow_avatar'] && $config['allow_avatar_remote_upload'] && $can_upload) ? true : false,
|
||||
'S_LINK_AVATAR' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false,
|
||||
'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
|
||||
'S_GROUP_MANAGE' => true,
|
||||
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '',
|
||||
@@ -717,7 +718,6 @@ class ucp_groups
|
||||
'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'],
|
||||
|
||||
'S_RANK_OPTIONS' => $rank_options,
|
||||
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
|
||||
|
||||
'GROUP_TYPE_FREE' => GROUP_FREE,
|
||||
'GROUP_TYPE_OPEN' => GROUP_OPEN,
|
||||
@@ -730,7 +730,7 @@ class ucp_groups
|
||||
'GROUP_CLOSED' => $type_closed,
|
||||
'GROUP_HIDDEN' => $type_hidden,
|
||||
|
||||
'U_SWATCH' => append_sid("{$phpbb_root_path}adm/swatch.$phpEx", 'form=ucp&name=group_colour'),
|
||||
'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=ucp&name=group_colour'),
|
||||
'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id",
|
||||
'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(),
|
||||
));
|
||||
|
@@ -642,7 +642,7 @@ class ucp_main
|
||||
*/
|
||||
function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
|
||||
{
|
||||
global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx;
|
||||
global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx, $phpbb_container;
|
||||
|
||||
$table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
|
||||
$start = request_var('start', 0);
|
||||
@@ -768,6 +768,8 @@ class ucp_main
|
||||
}
|
||||
}
|
||||
|
||||
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||
|
||||
foreach ($topic_list as $topic_id)
|
||||
{
|
||||
$row = &$rowset[$topic_id];
|
||||
@@ -778,7 +780,7 @@ class ucp_main
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
|
||||
// Replies
|
||||
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
$replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
|
||||
|
||||
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id']))
|
||||
{
|
||||
|
230
phpBB/includes/ucp/ucp_notifications.php
Normal file
230
phpBB/includes/ucp/ucp_notifications.php
Normal file
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package notifications
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class ucp_notifications
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
public function main($id, $mode)
|
||||
{
|
||||
global $config, $template, $user, $request, $phpbb_container;
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
add_form_key('ucp_notification');
|
||||
|
||||
$start = $request->variable('start', 0);
|
||||
$form_time = min($request->variable('form_time', 0), time());
|
||||
|
||||
$phpbb_notifications = $phpbb_container->get('notification_manager');
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'notification_options':
|
||||
$subscriptions = $phpbb_notifications->get_global_subscriptions(false);
|
||||
|
||||
// Add/remove subscriptions
|
||||
if ($request->is_set_post('submit'))
|
||||
{
|
||||
if (!check_form_key('ucp_notification'))
|
||||
{
|
||||
trigger_error('FORM_INVALID');
|
||||
}
|
||||
|
||||
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
||||
|
||||
foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types)
|
||||
{
|
||||
foreach($subscription_types as $type => $data)
|
||||
{
|
||||
foreach($notification_methods as $method => $method_data)
|
||||
{
|
||||
if ($request->is_set_post($type . '_' . $method_data['id']) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type])))
|
||||
{
|
||||
$phpbb_notifications->add_subscription($type, 0, $method_data['id']);
|
||||
}
|
||||
else if (!$request->is_set_post($type . '_' . $method_data['id']) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type]))
|
||||
{
|
||||
$phpbb_notifications->delete_subscription($type, 0, $method_data['id']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
|
||||
{
|
||||
$phpbb_notifications->add_subscription($type);
|
||||
}
|
||||
else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
|
||||
{
|
||||
$phpbb_notifications->delete_subscription($type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
meta_refresh(3, $this->u_action);
|
||||
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
$this->output_notification_methods('notification_methods', $phpbb_notifications, $template, $user);
|
||||
|
||||
$this->output_notification_types($subscriptions, 'notification_types', $phpbb_notifications, $template, $user);
|
||||
|
||||
$this->tpl_name = 'ucp_notifications';
|
||||
$this->page_title = 'UCP_NOTIFICATION_OPTIONS';
|
||||
break;
|
||||
|
||||
case 'notification_list':
|
||||
default:
|
||||
// Mark all items read
|
||||
if ($request->variable('mark', '') == 'all' && (confirm_box(true) || check_link_hash($request->variable('token', ''), 'mark_all_notifications_read')))
|
||||
{
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$phpbb_notifications->mark_notifications_read(false, false, $user->data['user_id'], $form_time);
|
||||
|
||||
meta_refresh(3, $this->u_action);
|
||||
$message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, 'NOTIFICATIONS_MARK_ALL_READ', build_hidden_fields(array(
|
||||
'mark' => 'all',
|
||||
'form_time' => $form_time,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
// Mark specific notifications read
|
||||
if ($request->is_set_post('submit'))
|
||||
{
|
||||
if (!check_form_key('ucp_notification'))
|
||||
{
|
||||
trigger_error('FORM_INVALID');
|
||||
}
|
||||
|
||||
$mark_read = $request->variable('mark', array(0));
|
||||
|
||||
if (!empty($mark_read))
|
||||
{
|
||||
$phpbb_notifications->mark_notifications_read_by_id($mark_read, $form_time);
|
||||
}
|
||||
}
|
||||
|
||||
$notifications = $phpbb_notifications->load_notifications(array(
|
||||
'start' => $start,
|
||||
'limit' => $config['topics_per_page'],
|
||||
'count_total' => true,
|
||||
));
|
||||
|
||||
foreach ($notifications['notifications'] as $notification)
|
||||
{
|
||||
$template->assign_block_vars('notification_list', $notification->prepare_for_display());
|
||||
}
|
||||
|
||||
$base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=ucp_notifications&mode=notification_list");
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $notifications['total_count'], $config['topics_per_page'], $start),
|
||||
'TOTAL_COUNT' => $user->lang('NOTIFICATIONS_COUNT', $notifications['total_count']),
|
||||
'U_MARK_ALL' => $base_url . '&mark=all&token=' . generate_link_hash('mark_all_notifications_read'),
|
||||
));
|
||||
|
||||
$this->tpl_name = 'ucp_notifications';
|
||||
$this->page_title = 'UCP_NOTIFICATION_LIST';
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TITLE' => $user->lang($this->page_title),
|
||||
'TITLE_EXPLAIN' => $user->lang($this->page_title . '_EXPLAIN'),
|
||||
|
||||
'MODE' => $mode,
|
||||
|
||||
'FORM_TIME' => time(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Output all the notification types to the template
|
||||
*
|
||||
* @param string $block
|
||||
* @param phpbb_notification_manager $phpbb_notifications
|
||||
* @param phpbb_template $template
|
||||
* @param phpbb_user $user
|
||||
*/
|
||||
public function output_notification_types($subscriptions, $block = 'notification_types', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user)
|
||||
{
|
||||
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
||||
|
||||
foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types)
|
||||
{
|
||||
$template->assign_block_vars($block, array(
|
||||
'GROUP_NAME' => $user->lang($group),
|
||||
));
|
||||
|
||||
foreach($subscription_types as $type => $data)
|
||||
{
|
||||
$template->assign_block_vars($block, array(
|
||||
'TYPE' => $type,
|
||||
|
||||
'NAME' => $user->lang($data['lang']),
|
||||
'EXPLAIN' => (isset($user->lang[$data['lang'] . '_EXPLAIN'])) ? $user->lang($data['lang'] . '_EXPLAIN') : '',
|
||||
|
||||
'SUBSCRIBED' => (isset($subscriptions[$type])) ? true : false,
|
||||
));
|
||||
|
||||
foreach($notification_methods as $method => $method_data)
|
||||
{
|
||||
$template->assign_block_vars($block . '.notification_methods', array(
|
||||
'METHOD' => $method_data['id'],
|
||||
|
||||
'NAME' => $user->lang($method_data['lang']),
|
||||
|
||||
'SUBSCRIBED' => (isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type])) ? true : false,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
strtoupper($block) . '_COLS' => sizeof($notification_methods) + 2,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Output all the notification methods to the template
|
||||
*
|
||||
* @param string $block
|
||||
* @param phpbb_notification_manager $phpbb_notifications
|
||||
* @param phpbb_template $template
|
||||
* @param phpbb_user $user
|
||||
*/
|
||||
public function output_notification_methods($block = 'notification_methods', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user)
|
||||
{
|
||||
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
||||
|
||||
foreach($notification_methods as $method => $method_data)
|
||||
{
|
||||
$template->assign_block_vars($block, array(
|
||||
'METHOD' => $method_data['id'],
|
||||
|
||||
'NAME' => $user->lang($method_data['lang']),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
@@ -265,19 +265,16 @@ function compose_pm($id, $mode, $action, $user_folders = array())
|
||||
// Passworded forum?
|
||||
if ($post['forum_id'])
|
||||
{
|
||||
$sql = 'SELECT forum_password
|
||||
$sql = 'SELECT forum_id, forum_name, forum_password
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id = ' . (int) $post['forum_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_password = (string) $db->sql_fetchfield('forum_password');
|
||||
$forum_data = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($forum_password)
|
||||
if (!empty($forum_data['forum_password']))
|
||||
{
|
||||
login_forum_box(array(
|
||||
'forum_id' => $post['forum_id'],
|
||||
'forum_password' => $forum_password,
|
||||
));
|
||||
login_forum_box($forum_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,7 +350,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
|
||||
$message_attachment = 0;
|
||||
$message_text = $message_subject = '';
|
||||
|
||||
if ($to_user_id && $action == 'post')
|
||||
if ($to_user_id && $to_user_id != ANONYMOUS && $action == 'post')
|
||||
{
|
||||
$address_list['u'][$to_user_id] = 'to';
|
||||
}
|
||||
|
@@ -76,17 +76,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||
$user_info = get_user_information($author_id, $message_row);
|
||||
|
||||
// Parse the message and subject
|
||||
$message = censor_text($message_row['message_text']);
|
||||
|
||||
// Second parse bbcode here
|
||||
if ($message_row['bbcode_bitfield'])
|
||||
{
|
||||
$bbcode->bbcode_second_pass($message, $message_row['bbcode_uid'], $message_row['bbcode_bitfield']);
|
||||
}
|
||||
|
||||
// Always process smilies after parsing bbcodes
|
||||
$message = bbcode_nl2br($message);
|
||||
$message = smiley_text($message);
|
||||
$parse_flags = ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
|
||||
$message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], $parse_flags, true);
|
||||
|
||||
// Replace naughty words such as farty pants
|
||||
$message_row['message_subject'] = censor_text($message_row['message_subject']);
|
||||
@@ -94,8 +85,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||
// Editing information
|
||||
if ($message_row['message_edit_count'] && $config['display_last_edited'])
|
||||
{
|
||||
$l_edit_time_total = ($message_row['message_edit_count'] == 1) ? $user->lang['EDITED_TIME_TOTAL'] : $user->lang['EDITED_TIMES_TOTAL'];
|
||||
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, (!$message_row['message_edit_user']) ? $message_row['username'] : $message_row['message_edit_user'], $user->format_date($message_row['message_edit_time'], false, true), $message_row['message_edit_count']);
|
||||
$l_edited_by = '<br /><br />' . $user->lang('EDITED_TIMES_TOTAL', (int) $message_row['message_edit_count'], (!$message_row['message_edit_user']) ? $message_row['username'] : $message_row['message_edit_user'], $user->format_date($message_row['message_edit_time'], false, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -161,21 +151,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||
// End signature parsing, only if needed
|
||||
if ($signature)
|
||||
{
|
||||
$signature = censor_text($signature);
|
||||
|
||||
if ($user_info['user_sig_bbcode_bitfield'])
|
||||
{
|
||||
if ($bbcode === false)
|
||||
{
|
||||
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
||||
$bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']);
|
||||
}
|
||||
|
||||
$bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']);
|
||||
}
|
||||
|
||||
$signature = bbcode_nl2br($signature);
|
||||
$signature = smiley_text($signature);
|
||||
$parse_flags = ($user_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
|
||||
$signature = generate_text_for_display($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield'], $parse_flags, true);
|
||||
}
|
||||
|
||||
$url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm');
|
||||
@@ -371,12 +348,12 @@ function get_user_information($user_id, $user_row)
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_user_avatar'))
|
||||
if (!function_exists('phpbb_get_user_avatar'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
}
|
||||
|
||||
$user_row['avatar'] = ($user->optionget('viewavatars')) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '';
|
||||
$user_row['avatar'] = ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($user_row) : '';
|
||||
|
||||
get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']);
|
||||
|
||||
|
@@ -26,7 +26,7 @@ class ucp_prefs
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
||||
global $config, $db, $user, $auth, $template, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
$error = $data = array();
|
||||
@@ -46,8 +46,6 @@ class ucp_prefs
|
||||
'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']),
|
||||
'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']),
|
||||
'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']),
|
||||
'notifypm' => request_var('notifypm', (bool) $user->data['user_notify_pm']),
|
||||
'popuppm' => request_var('popuppm', (bool) $user->optionget('popuppm')),
|
||||
'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']),
|
||||
);
|
||||
|
||||
@@ -57,6 +55,20 @@ class ucp_prefs
|
||||
$data['notifymethod'] = NOTIFY_BOTH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add UCP edit global settings data before they are assigned to the template or submitted
|
||||
*
|
||||
* To assign data to the template, use $template->assign_vars()
|
||||
*
|
||||
* @event core.ucp_prefs_personal_data
|
||||
* @var bool submit Do we display the form only
|
||||
* or did the user press submit
|
||||
* @var array data Array with current ucp options data
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('submit', 'data');
|
||||
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars)));
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
if ($config['override_user_style'])
|
||||
@@ -81,15 +93,12 @@ class ucp_prefs
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$user->optionset('popuppm', $data['popuppm']);
|
||||
|
||||
$sql_ary = array(
|
||||
'user_allow_pm' => $data['allowpm'],
|
||||
'user_allow_viewemail' => $data['viewemail'],
|
||||
'user_allow_massemail' => $data['massemail'],
|
||||
'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'],
|
||||
'user_notify_type' => $data['notifymethod'],
|
||||
'user_notify_pm' => $data['notifypm'],
|
||||
'user_options' => $user->data['user_options'],
|
||||
|
||||
'user_dateformat' => $data['dateformat'],
|
||||
@@ -98,6 +107,17 @@ class ucp_prefs
|
||||
'user_style' => $data['style'],
|
||||
);
|
||||
|
||||
/**
|
||||
* Update UCP edit global settings data on form submit
|
||||
*
|
||||
* @event core.ucp_prefs_personal_update_data
|
||||
* @var array data Submitted display options data
|
||||
* @var array sql_ary Display options data we udpate
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('data', 'sql_ary');
|
||||
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_update_data', compact($vars)));
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_id = ' . $user->data['user_id'];
|
||||
@@ -172,8 +192,6 @@ class ucp_prefs
|
||||
'S_MASS_EMAIL' => $data['massemail'],
|
||||
'S_ALLOW_PM' => $data['allowpm'],
|
||||
'S_HIDE_ONLINE' => $data['hideonline'],
|
||||
'S_NOTIFY_PM' => $data['notifypm'],
|
||||
'S_POPUP_PM' => $data['popuppm'],
|
||||
|
||||
'DATE_FORMAT' => $data['dateformat'],
|
||||
'A_DATE_FORMAT' => addslashes($data['dateformat']),
|
||||
@@ -216,6 +234,20 @@ class ucp_prefs
|
||||
'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')),
|
||||
);
|
||||
|
||||
/**
|
||||
* Add UCP edit display options data before they are assigned to the template or submitted
|
||||
*
|
||||
* To assign data to the template, use $template->assign_vars()
|
||||
*
|
||||
* @event core.ucp_prefs_view_data
|
||||
* @var bool submit Do we display the form only
|
||||
* or did the user press submit
|
||||
* @var array data Array with current ucp options data
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('submit', 'data');
|
||||
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_data', compact($vars)));
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$error = validate_data($data, array(
|
||||
@@ -254,6 +286,17 @@ class ucp_prefs
|
||||
'user_post_show_days' => $data['post_st'],
|
||||
);
|
||||
|
||||
/**
|
||||
* Update UCP edit display options data on form submit
|
||||
*
|
||||
* @event core.ucp_prefs_view_update_data
|
||||
* @var array data Submitted display options data
|
||||
* @var array sql_ary Display options data we udpate
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('data', 'sql_ary');
|
||||
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_update_data', compact($vars)));
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_id = ' . $user->data['user_id'];
|
||||
@@ -274,7 +317,7 @@ class ucp_prefs
|
||||
$limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
|
||||
|
||||
$sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
|
||||
$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
|
||||
$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views');
|
||||
|
||||
// Post ordering options
|
||||
$limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
|
||||
@@ -342,6 +385,20 @@ class ucp_prefs
|
||||
);
|
||||
add_form_key('ucp_prefs_post');
|
||||
|
||||
/**
|
||||
* Add UCP edit posting defaults data before they are assigned to the template or submitted
|
||||
*
|
||||
* To assign data to the template, use $template->assign_vars()
|
||||
*
|
||||
* @event core.ucp_prefs_post_data
|
||||
* @var bool submit Do we display the form only
|
||||
* or did the user press submit
|
||||
* @var array data Array with current ucp options data
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('submit', 'data');
|
||||
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_post_data', compact($vars)));
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
if (check_form_key('ucp_prefs_post'))
|
||||
@@ -355,6 +412,17 @@ class ucp_prefs
|
||||
'user_notify' => $data['notify'],
|
||||
);
|
||||
|
||||
/**
|
||||
* Update UCP edit posting defaults data on form submit
|
||||
*
|
||||
* @event core.ucp_prefs_post_update_data
|
||||
* @var array data Submitted display options data
|
||||
* @var array sql_ary Display options data we udpate
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('data', 'sql_ary');
|
||||
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_post_update_data', compact($vars)));
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_id = ' . $user->data['user_id'];
|
||||
|
@@ -28,8 +28,9 @@ class ucp_profile
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
||||
global $cache, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
||||
global $request;
|
||||
global $phpbb_container;
|
||||
|
||||
$user->add_lang('posting');
|
||||
|
||||
@@ -174,8 +175,7 @@ class ucp_profile
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$messenger->template('admin_activate', $row['user_lang']);
|
||||
$messenger->to($row['user_email'], $row['username']);
|
||||
$messenger->im($row['user_jabber'], $row['username']);
|
||||
$messenger->set_addresses($row);
|
||||
|
||||
$messenger->assign_vars(array(
|
||||
'USERNAME' => htmlspecialchars_decode($data['username']),
|
||||
@@ -546,82 +546,136 @@ class ucp_profile
|
||||
// Build custom bbcodes array
|
||||
display_custom_bbcodes();
|
||||
|
||||
// Generate smiley listing
|
||||
generate_smilies('inline', 0);
|
||||
|
||||
break;
|
||||
|
||||
case 'avatar':
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
|
||||
$display_gallery = request_var('display_gallery', '0');
|
||||
$avatar_select = basename(request_var('avatar_select', ''));
|
||||
$category = basename(request_var('category', ''));
|
||||
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
|
||||
if (!function_exists('phpbb_get_user_avatar'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
}
|
||||
|
||||
add_form_key('ucp_avatar');
|
||||
|
||||
if ($submit)
|
||||
$avatars_enabled = false;
|
||||
|
||||
if ($config['allow_avatar'] && $auth->acl_get('u_chgavatar'))
|
||||
{
|
||||
if (check_form_key('ucp_avatar'))
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
||||
|
||||
// This is normalised data, without the user_ prefix
|
||||
$avatar_data = phpbb_avatar_manager::clean_row($user->data);
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
if (avatar_process_user($error, false, $can_upload))
|
||||
if (check_form_key('ucp_avatar'))
|
||||
{
|
||||
meta_refresh(3, $this->u_action);
|
||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
||||
trigger_error($message);
|
||||
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));
|
||||
|
||||
if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete'))
|
||||
{
|
||||
$driver = $phpbb_avatar_manager->get_driver($driver_name);
|
||||
$result = $driver->process_form($request, $template, $user, $avatar_data, $error);
|
||||
|
||||
if ($result && empty($error))
|
||||
{
|
||||
// Success! Lets save the result in the database
|
||||
$result = array(
|
||||
'user_avatar_type' => $driver_name,
|
||||
'user_avatar' => $result['avatar'],
|
||||
'user_avatar_width' => $result['avatar_width'],
|
||||
'user_avatar_height' => $result['avatar_height'],
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $result) . '
|
||||
WHERE user_id = ' . (int) $user->data['user_id'];
|
||||
|
||||
$db->sql_query($sql);
|
||||
|
||||
meta_refresh(3, $this->u_action);
|
||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']))
|
||||
{
|
||||
$driver->delete($avatar_data);
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'user_avatar' => '',
|
||||
'user_avatar_type' => '',
|
||||
'user_avatar_width' => 0,
|
||||
'user_avatar_height' => 0,
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $result) . '
|
||||
WHERE user_id = ' . (int) $user->data['user_id'];
|
||||
|
||||
$db->sql_query($sql);
|
||||
|
||||
meta_refresh(3, $this->u_action);
|
||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = 'FORM_INVALID';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user->data['user_avatar_type']));
|
||||
|
||||
foreach ($avatar_drivers as $current_driver)
|
||||
{
|
||||
$error[] = 'FORM_INVALID';
|
||||
$driver = $phpbb_avatar_manager->get_driver($current_driver);
|
||||
|
||||
$avatars_enabled = true;
|
||||
$template->set_filenames(array(
|
||||
'avatar' => $driver->get_template_name(),
|
||||
));
|
||||
|
||||
if ($driver->prepare_form($request, $template, $user, $avatar_data, $error))
|
||||
{
|
||||
$driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver);
|
||||
$driver_upper = strtoupper($driver_name);
|
||||
|
||||
$template->assign_block_vars('avatar_drivers', array(
|
||||
'L_TITLE' => $user->lang($driver_upper . '_TITLE'),
|
||||
'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'),
|
||||
|
||||
'DRIVER' => $driver_name,
|
||||
'SELECTED' => $current_driver == $selected_driver,
|
||||
'OUTPUT' => $template->assign_display('avatar'),
|
||||
));
|
||||
}
|
||||
}
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = array_map(array($user, 'lang'), $error);
|
||||
}
|
||||
|
||||
if (!$config['allow_avatar'] && $user->data['user_avatar_type'])
|
||||
{
|
||||
$error[] = $user->lang['AVATAR_NOT_ALLOWED'];
|
||||
}
|
||||
else if ((($user->data['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) ||
|
||||
(($user->data['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) ||
|
||||
(($user->data['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local']))
|
||||
{
|
||||
$error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];
|
||||
}
|
||||
// Replace "error" strings with their real, localised form
|
||||
$error = $phpbb_avatar_manager->localize_errors($user, $error);
|
||||
|
||||
$avatar = phpbb_get_user_avatar($user->data, 'USER_AVATAR', true);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height'], 'USER_AVATAR', true),
|
||||
'AVATAR_SIZE' => $config['avatar_filesize'],
|
||||
'AVATAR' => $avatar,
|
||||
|
||||
'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=avatar&display_gallery=1'),
|
||||
|
||||
'S_FORM_ENCTYPE' => ($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '',
|
||||
'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',
|
||||
|
||||
'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(),
|
||||
|
||||
'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
|
||||
));
|
||||
|
||||
if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'])
|
||||
{
|
||||
avatar_gallery($category, $avatar_select, 4);
|
||||
}
|
||||
else if ($config['allow_avatar'])
|
||||
{
|
||||
$avatars_enabled = (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_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']),
|
||||
|
||||
'S_AVATARS_ENABLED' => $avatars_enabled,
|
||||
'S_UPLOAD_AVATAR_FILE' => ($can_upload && $config['allow_avatar_upload']) ? true : false,
|
||||
'S_UPLOAD_AVATAR_URL' => ($can_upload && $config['allow_avatar_remote_upload']) ? true : false,
|
||||
'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
|
||||
'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false)
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'autologin_keys':
|
||||
|
@@ -38,7 +38,7 @@ class ucp_register
|
||||
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
||||
|
||||
$coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false;
|
||||
$agreed = (int) $request->variable('agreed', false);
|
||||
$agreed = $request->variable('agreed', false);
|
||||
$submit = $request->is_set_post('submit');
|
||||
$change_lang = request_var('change_lang', '');
|
||||
$user_lang = request_var('lang', $user->lang_name);
|
||||
@@ -63,7 +63,7 @@ class ucp_register
|
||||
$submit = false;
|
||||
|
||||
// Setting back agreed to let the user view the agreement in his/her language
|
||||
$agreed = ($request->variable('change_lang', false)) ? 0 : $agreed;
|
||||
$agreed = false;
|
||||
}
|
||||
|
||||
$user->lang_name = $user_lang = $use_lang;
|
||||
@@ -89,7 +89,7 @@ class ucp_register
|
||||
$add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : '';
|
||||
|
||||
$s_hidden_fields = array(
|
||||
'change_lang' => $change_lang,
|
||||
'change_lang' => '',
|
||||
);
|
||||
|
||||
// If we change the language, we want to pass on some more possible parameter.
|
||||
@@ -384,8 +384,7 @@ class ucp_register
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$messenger->template('admin_activate', $row['user_lang']);
|
||||
$messenger->to($row['user_email'], $row['username']);
|
||||
$messenger->im($row['user_jabber'], $row['username']);
|
||||
$messenger->set_addresses($row);
|
||||
|
||||
$messenger->assign_vars(array(
|
||||
'USERNAME' => htmlspecialchars_decode($data['username']),
|
||||
@@ -457,6 +456,7 @@ class ucp_register
|
||||
'S_LANG_OPTIONS' => language_select($data['lang']),
|
||||
'S_TZ_OPTIONS' => $timezone_selects['tz_select'],
|
||||
'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'],
|
||||
'S_TZ_PRESELECT' => !$submit,
|
||||
'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false,
|
||||
'S_REGISTRATION' => true,
|
||||
'S_COPPA' => $coppa,
|
||||
|
@@ -29,6 +29,11 @@ class ucp_remind
|
||||
global $config, $phpbb_root_path, $phpEx;
|
||||
global $db, $user, $auth, $template;
|
||||
|
||||
if (!$config['allow_password_reset'])
|
||||
{
|
||||
trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'));
|
||||
}
|
||||
|
||||
$username = request_var('username', '', true);
|
||||
$email = strtolower(request_var('email', ''));
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
@@ -94,8 +99,9 @@ class ucp_remind
|
||||
|
||||
$messenger->template('user_activate_passwd', $user_row['user_lang']);
|
||||
|
||||
$messenger->to($user_row['user_email'], $user_row['username']);
|
||||
$messenger->im($user_row['user_jabber'], $user_row['username']);
|
||||
$messenger->set_addresses($user_row);
|
||||
|
||||
$messenger->anti_abuse_headers($config, $user);
|
||||
|
||||
$messenger->assign_vars(array(
|
||||
'USERNAME' => htmlspecialchars_decode($user_row['username']),
|
||||
|
@@ -91,7 +91,7 @@ class ucp_resend
|
||||
if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa)
|
||||
{
|
||||
$messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']);
|
||||
$messenger->to($user_row['user_email'], $user_row['username']);
|
||||
$messenger->set_addresses($user_row);
|
||||
|
||||
$messenger->anti_abuse_headers($config, $user);
|
||||
|
||||
@@ -126,8 +126,7 @@ class ucp_resend
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$messenger->template('admin_activate', $row['user_lang']);
|
||||
$messenger->to($row['user_email'], $row['username']);
|
||||
$messenger->im($row['user_jabber'], $row['username']);
|
||||
$messenger->set_addresses($row);
|
||||
|
||||
$messenger->anti_abuse_headers($config, $user);
|
||||
|
||||
|
Reference in New Issue
Block a user