1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-16 05:34:01 +02:00

Merge branch 'develop' of https://github.com/phpbb/phpbb into feature/passwords

Conflicts:
	phpBB/config/services.yml
This commit is contained in:
Marc Alexander
2013-12-29 13:46:42 +01:00
619 changed files with 13392 additions and 5996 deletions

View File

@@ -22,7 +22,6 @@ class ucp_pm_info
'compose' => array('title' => 'UCP_PM_COMPOSE', 'auth' => 'cfg_allow_privmsg', 'cat' => array('UCP_PM')),
'drafts' => array('title' => 'UCP_PM_DRAFTS', 'auth' => 'cfg_allow_privmsg', 'cat' => array('UCP_PM')),
'options' => array('title' => 'UCP_PM_OPTIONS', 'auth' => 'cfg_allow_privmsg', 'cat' => array('UCP_PM')),
'popup' => array('title' => 'UCP_PM_POPUP_TITLE', 'auth' => 'cfg_allow_privmsg', 'display' => false, 'cat' => array('UCP_PM')),
),
);
}

View File

@@ -27,7 +27,7 @@ class ucp_activate
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
global $db, $user, $auth, $template, $phpbb_container;
$user_id = request_var('u', 0);
$key = request_var('k', '');
@@ -108,6 +108,9 @@ class ucp_activate
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']);
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$messenger = new messenger(false);

View File

@@ -26,7 +26,7 @@ class ucp_attachments
function main($id, $mode)
{
global $template, $user, $db, $config, $phpEx, $phpbb_root_path;
global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container;
$start = request_var('start', 0);
$sort_key = request_var('sk', 'a');
@@ -119,6 +119,10 @@ class ucp_attachments
$num_attachments = $db->sql_fetchfield('num_attachments');
$db->sql_freeresult($result);
// Ensure start is a valid value
$pagination = $phpbb_container->get('pagination');
$start = $pagination->validate_start($start, $config['topics_per_page'], $num_attachments);
$sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title
FROM ' . ATTACHMENTS_TABLE . ' a
LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id AND a.in_message = 0)
@@ -171,10 +175,10 @@ class ucp_attachments
$db->sql_freeresult($result);
$base_url = $this->u_action . "&sk=$sort_key&sd=$sort_dir";
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start);
$template->assign_vars(array(
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start),
'PAGE_NUMBER' => $pagination->on_page($base_url, $num_attachments, $config['topics_per_page'], $start),
'TOTAL_ATTACHMENTS' => $num_attachments,
'L_TITLE' => $user->lang['UCP_ATTACHMENTS'],

View File

@@ -465,7 +465,7 @@ class ucp_groups
$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);
$avatar_data = \phpbb\avatar\manager::clean_row($group_row, 'group');
}
// Did we submit?
@@ -509,7 +509,7 @@ class ucp_groups
}
else
{
if ($driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']))
if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']))
{
$driver->delete($avatar_data);
}
@@ -699,7 +699,6 @@ class ucp_groups
'GROUP_CLOSED' => $type_closed,
'GROUP_HIDDEN' => $type_hidden,
'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(),
));
@@ -814,13 +813,15 @@ class ucp_groups
$s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>';
}
$pagination = $phpbb_container->get('pagination');
$base_url = $this->u_action . "&amp;action=$action&amp;g=$group_id";
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start);
$start = $pagination->validate_start($start, $config['topics_per_page'], $total_members);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start);
$template->assign_vars(array(
'S_LIST' => true,
'S_ACTION_OPTIONS' => $s_action_options,
'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $total_members, $config['topics_per_page'], $start),
'S_ON_PAGE' => $pagination->on_page($template, $user, $base_url, $total_members, $config['topics_per_page'], $start),
'U_ACTION' => $this->u_action . "&amp;g=$group_id",
'S_UCP_ACTION' => $this->u_action . "&amp;g=$group_id",

View File

@@ -646,6 +646,7 @@ class ucp_main
$table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
$start = request_var('start', 0);
$pagination = $phpbb_container->get('pagination');
// Grab icons
$icons = $cache->obtain_icons();
@@ -669,10 +670,11 @@ class ucp_main
if ($topics_count)
{
phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
$start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count);
$pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
'PAGE_NUMBER' => phpbb_on_page($template, $user, $this->u_action, $topics_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => $pagination->on_page($this->u_action, $topics_count, $config['topics_per_page'], $start),
'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $topics_count),
));
}
@@ -839,7 +841,7 @@ class ucp_main
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
));
phpbb_generate_template_pagination($template, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&amp;t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
$pagination->generate_template_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&amp;t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
}
}
}

View File

@@ -27,9 +27,11 @@ class ucp_notifications
add_form_key('ucp_notification');
$start = $request->variable('start', 0);
$form_time = min($request->variable('form_time', 0), time());
$form_time = $request->variable('form_time', 0);
$form_time = ($form_time <= 0 || $form_time > time()) ? time() : $form_time;
$phpbb_notifications = $phpbb_container->get('notification_manager');
$pagination = $phpbb_container->get('pagination');
switch ($mode)
{
@@ -78,9 +80,9 @@ class ucp_notifications
trigger_error($message);
}
$this->output_notification_methods('notification_methods', $phpbb_notifications, $template, $user);
$this->output_notification_methods($phpbb_notifications, $template, $user, 'notification_methods');
$this->output_notification_types($subscriptions, 'notification_types', $phpbb_notifications, $template, $user);
$this->output_notification_types($subscriptions, $phpbb_notifications, $template, $user, 'notification_types');
$this->tpl_name = 'ucp_notifications';
$this->page_title = 'UCP_NOTIFICATION_OPTIONS';
@@ -136,11 +138,12 @@ class ucp_notifications
}
$base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=ucp_notifications&amp;mode=notification_list");
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start);
$start = $pagination->validate_start($start, $config['topics_per_page'], $notifications['total_count']);
$pagination->generate_template_pagination($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']),
'PAGE_NUMBER' => $pagination->on_page($base_url, $notifications['total_count'], $config['topics_per_page'], $start),
'TOTAL_COUNT' => $notifications['total_count'],
'U_MARK_ALL' => $base_url . '&amp;mark=all&amp;token=' . generate_link_hash('mark_all_notifications_read'),
));
@@ -162,12 +165,13 @@ class ucp_notifications
/**
* Output all the notification types to the template
*
* @param string $block
* @param array $subscriptions Array containing global subscriptions
* @param \phpbb\notification\manager $phpbb_notifications
* @param \phpbb\template\template $template
* @param \phpbb\user $user
* @param string $block
*/
public function output_notification_types($subscriptions, $block = 'notification_types', \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user)
public function output_notification_types($subscriptions, \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user, $block = 'notification_types')
{
$notification_methods = $phpbb_notifications->get_subscription_methods();
@@ -209,12 +213,12 @@ class ucp_notifications
/**
* Output all the notification methods to the template
*
* @param string $block
* @param \phpbb\notification\manager $phpbb_notifications
* @param \phpbb\template\template $template
* @param \phpbb\user $user
* @param string $block
*/
public function output_notification_methods($block = 'notification_methods', \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user)
public function output_notification_methods(\phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user, $block = 'notification_methods')
{
$notification_methods = $phpbb_notifications->get_subscription_methods();

View File

@@ -83,33 +83,6 @@ class ucp_pm
switch ($mode)
{
// New private messages popup
case 'popup':
$l_new_message = '';
if ($user->data['is_registered'])
{
if ($user->data['user_new_privmsg'])
{
$l_new_message = ($user->data['user_new_privmsg'] == 1) ? $user->lang['YOU_NEW_PM'] : $user->lang['YOU_NEW_PMS'];
}
else
{
$l_new_message = $user->lang['YOU_NO_NEW_PM'];
}
}
$template->assign_vars(array(
'MESSAGE' => $l_new_message,
'S_NOT_LOGGED_IN' => ($user->data['user_id'] == ANONYMOUS) ? true : false,
'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox') . '" onclick="jump_to_inbox(this.href); return false;">', '</a>'),
'U_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox'),
'UA_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox', false))
);
$tpl_file = 'ucp_pm_popup';
break;
// Compose message
case 'compose':
$action = request_var('action', 'post');

View File

@@ -21,9 +21,10 @@ if (!defined('IN_PHPBB'))
*/
function compose_pm($id, $mode, $action, $user_folders = array())
{
global $template, $db, $auth, $user;
global $template, $db, $auth, $user, $cache;
global $phpbb_root_path, $phpEx, $config;
global $request;
global $phpbb_container;
// Damn php and globals - i know, this is horrible
// Needed for handle_message_list_actions()
@@ -385,6 +386,8 @@ function compose_pm($id, $mode, $action, $user_folders = array())
}
$message_parser = new parse_message();
$plupload = $phpbb_container->get('plupload');
$message_parser->set_plupload($plupload);
$message_parser->message = ($action == 'reply') ? '' : $message_text;
unset($message_text);
@@ -1099,6 +1102,11 @@ function compose_pm($id, $mode, $action, $user_folders = array())
// Show attachment box for adding attachments if true
$allowed = ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype);
if ($allowed)
{
$plupload->configure($cache, $template, $s_action, false);
}
// Attachment entry
posting_gen_attachment_entry($attachment_data, $filename_data, $allowed);

View File

@@ -269,7 +269,7 @@ function view_folder($id, $mode, $folder_id, $folder)
// There is the chance that all recipients of the message got deleted. To avoid creating
// exports without recipients, we add a bogus "undisclosed recipient".
if (!(isset($address[$message_id]['g']) && sizeof($address[$message_id]['g'])) &&
!(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u'])))
!(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u'])))
{
$address[$message_id]['u'] = array();
$address[$message_id]['u']['to'] = array();
@@ -393,7 +393,7 @@ function view_folder($id, $mode, $folder_id, $folder)
*/
function get_pm_from($folder_id, $folder, $user_id)
{
global $user, $db, $template, $config, $auth, $phpbb_root_path, $phpEx;
global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx;
$start = request_var('start', 0);
@@ -402,6 +402,8 @@ function get_pm_from($folder_id, $folder, $user_id)
$sort_key = request_var('sk', 't');
$sort_dir = request_var('sd', 'd');
$pagination = $phpbb_container->get('pagination');
// PM ordering options
$limit_days = array(0 => $user->lang['ALL_MESSAGES'], 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']);
@@ -452,10 +454,11 @@ function get_pm_from($folder_id, $folder, $user_id)
}
$base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&amp;mode=view&amp;action=view_folder&amp;f=$folder_id&amp;$u_sort_param");
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
$start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $pm_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => $pagination->on_page($base_url, $pm_count, $config['topics_per_page'], $start),
'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count),
'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'),
@@ -481,14 +484,10 @@ function get_pm_from($folder_id, $folder, $user_id)
{
$store_reverse = true;
if ($start + $config['topics_per_page'] > $pm_count)
{
$sql_limit = min($config['topics_per_page'], max(1, $pm_count - $start));
}
// Select the sort order
$direction = ($sort_dir == 'd') ? 'ASC' : 'DESC';
$sql_start = max(0, $pm_count - $sql_limit - $start);
$sql_limit = $pagination->reverse_limit($start, $sql_limit, $pm_count);
$sql_start = $pagination->reverse_start($start, $sql_limit, $pm_count);
}
else
{

View File

@@ -254,8 +254,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
* @var string mode Active module
* @var int folder_id ID of the folder the message is in
* @var int msg_id ID of the private message
* var array folder Array with data of user's message folders
* @var array message_row Array with message data
* @var array folder Array with data of user's message folders
* @var array message_row Array with message data
* @var array cp_row Array with senders custom profile field data
* @var array msg_data Template array with message data
* @since 3.1-A1

View File

@@ -570,7 +570,7 @@ class ucp_profile
$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);
$avatar_data = \phpbb\avatar\manager::clean_row($user->data, 'user');
if ($submit)
{
@@ -606,7 +606,7 @@ class ucp_profile
}
else
{
if ($driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']))
if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']))
{
$driver->delete($avatar_data);
}
@@ -661,10 +661,10 @@ class ucp_profile
));
}
}
}
// Replace "error" strings with their real, localised form
$error = $phpbb_avatar_manager->localize_errors($user, $error);
// 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);

View File

@@ -382,41 +382,16 @@ class ucp_register
}
$messenger->send(NOTIFY_EMAIL);
}
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
// Grab an array of user_id's with a_user permissions ... these users can activate a user
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
// Also include founders
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
if (sizeof($admin_ary))
{
$where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
FROM ' . USERS_TABLE . ' ' .
$where_sql;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$messenger->template('admin_activate', $row['user_lang']);
$messenger->set_addresses($row);
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($data['username']),
'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
);
$messenger->send($row['user_notify_type']);
}
$db->sql_freeresult($result);
}
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->add_notifications('admin_activate_user', array(
'user_id' => $user_id,
'user_actkey' => $user_row['user_actkey'],
'user_regdate' => $user_row['user_regdate'],
));
}
// Perform account linking if necessary

View File

@@ -64,7 +64,7 @@ class ucp_zebra
* @var array user_ids User ids we remove
* @since 3.1-A1
*/
$vars = array('user_ids');
$vars = array('mode', 'user_ids');
extract($phpbb_dispatcher->trigger_event('core.ucp_remove_zebra', compact($vars)));
$sql = 'DELETE FROM ' . ZEBRA_TABLE . '