diff options
Diffstat (limited to 'phpBB/includes/ucp')
23 files changed, 346 insertions, 246 deletions
diff --git a/phpBB/includes/ucp/info/ucp_attachments.php b/phpBB/includes/ucp/info/ucp_attachments.php index 84edce446c..adc7b92920 100644 --- a/phpBB/includes/ucp/info/ucp_attachments.php +++ b/phpBB/includes/ucp/info/ucp_attachments.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -33,5 +32,3 @@ class ucp_attachments_info  	{  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/info/ucp_groups.php b/phpBB/includes/ucp/info/ucp_groups.php index 2002123c50..b7ffcd0971 100644 --- a/phpBB/includes/ucp/info/ucp_groups.php +++ b/phpBB/includes/ucp/info/ucp_groups.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -34,5 +33,3 @@ class ucp_groups_info  	{  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/info/ucp_main.php b/phpBB/includes/ucp/info/ucp_main.php index 722b7865e6..e40a0cc1c5 100644 --- a/phpBB/includes/ucp/info/ucp_main.php +++ b/phpBB/includes/ucp/info/ucp_main.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -36,5 +35,3 @@ class ucp_main_info  	{  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/info/ucp_pm.php b/phpBB/includes/ucp/info/ucp_pm.php index ade12005c0..02931e9d31 100644 --- a/phpBB/includes/ucp/info/ucp_pm.php +++ b/phpBB/includes/ucp/info/ucp_pm.php @@ -1,9 +1,8 @@  <?php  /**  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -36,5 +35,3 @@ class ucp_pm_info  	{  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/info/ucp_prefs.php b/phpBB/includes/ucp/info/ucp_prefs.php index 58359e8a19..91fbd7a14c 100644 --- a/phpBB/includes/ucp/info/ucp_prefs.php +++ b/phpBB/includes/ucp/info/ucp_prefs.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -35,5 +34,3 @@ class ucp_prefs_info  	{  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/info/ucp_profile.php b/phpBB/includes/ucp/info/ucp_profile.php index 4591776768..201216e9fd 100644 --- a/phpBB/includes/ucp/info/ucp_profile.php +++ b/phpBB/includes/ucp/info/ucp_profile.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -24,6 +23,7 @@ class ucp_profile_info  				'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')),  				'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')),  			),  		);  	} @@ -36,5 +36,3 @@ class ucp_profile_info  	{  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/info/ucp_zebra.php b/phpBB/includes/ucp/info/ucp_zebra.php index 5fc1f8bee7..db57102aae 100644 --- a/phpBB/includes/ucp/info/ucp_zebra.php +++ b/phpBB/includes/ucp/info/ucp_zebra.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -34,5 +33,3 @@ class ucp_zebra_info  	{  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index 82c1937919..a0d0baf10f 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -143,5 +142,3 @@ class ucp_activate  		trigger_error($user->lang[$message]);  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index b011b4f75d..dc095e7b73 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -171,9 +170,11 @@ 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); +  		$template->assign_vars(array( -			'PAGE_NUMBER'			=> on_page($num_attachments, $config['topics_per_page'], $start), -			'PAGINATION'			=> generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start), +			'PAGE_NUMBER'			=> phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start),  			'TOTAL_ATTACHMENTS'		=> $num_attachments,  			'L_TITLE'				=> $user->lang['UCP_ATTACHMENTS'], @@ -197,5 +198,3 @@ class ucp_attachments  		$this->page_title = 'UCP_ATTACHMENTS';  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php index 445f7c7d2a..aafb92d8e4 100644 --- a/phpBB/includes/ucp/ucp_confirm.php +++ b/phpBB/includes/ucp/ucp_confirm.php @@ -2,9 +2,8 @@  /**  *  * @package VC -* @version $Id$  * @copyright (c) 2005 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -46,5 +45,3 @@ class ucp_confirm  		exit_handler();  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index d62dbb1866..9652986cf2 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -28,14 +27,15 @@ class ucp_groups  	{  		global $config, $phpbb_root_path, $phpEx;  		global $db, $user, $auth, $cache, $template; +		global $request;  		$user->add_lang('groups');  		$return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');  		$mark_ary	= request_var('mark', array(0)); -		$submit		= (!empty($_POST['submit'])) ? true : false; -		$delete		= (!empty($_POST['delete'])) ? true : false; +		$submit		= $request->variable('submit', false, false, phpbb_request_interface::POST); +		$delete		= $request->variable('delete', false, false, phpbb_request_interface::POST);  		$error = $data = array();  		switch ($mode) @@ -513,7 +513,8 @@ class ucp_groups  							$data['height']		= request_var('height', '');  							$delete				= request_var('delete', ''); -							if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink']) +							$uploadfile = $request->file('uploadfile'); +							if (!empty($uploadfile['tmp_name']) || $data['uploadurl'] || $data['remotelink'])  							{  								// Avatar stuff  								$var_ary = array( @@ -527,7 +528,7 @@ class ucp_groups  								{  									$data['user_id'] = "g$group_id"; -									if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) +									if ((!empty($uploadfile['tmp_name']) || $data['uploadurl']) && $can_upload)  									{  										list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);  									} @@ -560,7 +561,7 @@ class ucp_groups  								{  									if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])  									{ -										$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']); +										$error[] = phpbb_avatar_error_wrong_size($data['width'], $data['height']);  									}  								} @@ -570,7 +571,7 @@ class ucp_groups  									{  										if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height'])  										{ -											$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']); +											$error[] = phpbb_avatar_error_wrong_size($data['width'], $data['height']);  										}  									}  								} @@ -731,7 +732,7 @@ class ucp_groups  							'U_SWATCH'			=> append_sid("{$phpbb_root_path}adm/swatch.$phpEx", 'form=ucp&name=group_colour'),  							'S_UCP_ACTION'		=> $this->u_action . "&action=$action&g=$group_id", -							'L_AVATAR_EXPLAIN'	=> sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), +							'L_AVATAR_EXPLAIN'	=> phpbb_avatar_explanation_string(),  						));  					break; @@ -844,11 +845,13 @@ class ucp_groups  							$s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>';  						} +						$base_url = $this->u_action . "&action=$action&g=$group_id"; +						phpbb_generate_template_pagination($template, $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'			=> on_page($total_members, $config['topics_per_page'], $start), -							'PAGINATION'		=> generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start), +							'S_ON_PAGE'			=> phpbb_on_page($template, $user, $base_url, $total_members, $config['topics_per_page'], $start),  							'U_ACTION'			=> $this->u_action . "&g=$group_id",  							'S_UCP_ACTION'		=> $this->u_action . "&g=$group_id", @@ -1067,7 +1070,8 @@ class ucp_groups  								'mode'		=> $mode,  								'action'	=> $action  							); -							confirm_box(false, sprintf($user->lang['GROUP_CONFIRM_ADD_USER' . ((sizeof($name_ary) == 1) ? '' : 'S')], implode(', ', $name_ary)), build_hidden_fields($s_hidden_fields)); + +							confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', sizeof($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields));  						}  						trigger_error($user->lang['NO_USERS_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); @@ -1109,5 +1113,3 @@ class ucp_groups  		$this->tpl_name = 'ucp_groups_' . $mode;  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index a6f71669ce..94fd59433b 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -34,6 +33,7 @@ class ucp_main  	function main($id, $mode)  	{  		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; +		global $request;  		switch ($mode)  		{ @@ -56,39 +56,29 @@ class ucp_main  					$sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id  						AND tt.user_id = ' . $user->data['user_id'] . ')';  					$sql_select .= ', tt.mark_time'; + +					$sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id +						AND ft.user_id = ' . $user->data['user_id'] . ')'; +					$sql_select .= ', ft.mark_time AS forum_mark_time';  				}  				$topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];  				$folder = 'global_read';  				$folder_new = 'global_unread'; -				// Get cleaned up list... return only those forums not having the f_read permission -				$forum_ary = $auth->acl_getf('!f_read', true); +				// Get cleaned up list... return only those forums having the f_read permission +				$forum_ary = $auth->acl_getf('f_read', true);  				$forum_ary = array_unique(array_keys($forum_ary)); - -				// Determine first forum the user is able to read into - for global announcement link -				$sql = 'SELECT forum_id -					FROM ' . FORUMS_TABLE . ' -					WHERE forum_type = ' . FORUM_POST; - -				if (sizeof($forum_ary)) -				{ -					$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true); -				} -				$result = $db->sql_query_limit($sql, 1); -				$g_forum_id = (int) $db->sql_fetchfield('forum_id'); -				$db->sql_freeresult($result); - -				$sql = "SELECT t.* $sql_select -					FROM $sql_from -					WHERE t.forum_id = 0 -						AND t.topic_type = " . POST_GLOBAL . ' -					ORDER BY t.topic_last_post_time DESC'; -  				$topic_list = $rowset = array(); +  				// If the user can't see any forums, he can't read any posts because fid of 0 is invalid -				if ($g_forum_id) +				if (!empty($forum_ary))  				{ +					$sql = "SELECT t.* $sql_select +						FROM $sql_from +						WHERE t.topic_type = " . POST_GLOBAL . ' +							AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . ' +						ORDER BY t.topic_last_post_time DESC';  					$result = $db->sql_query($sql);  					while ($row = $db->sql_fetchrow($result)) @@ -99,15 +89,34 @@ class ucp_main  					$db->sql_freeresult($result);  				} -				$topic_tracking_info = array(); +				$topic_forum_list = array(); +				foreach ($rowset as $t_id => $row) +				{ +					if (isset($forum_tracking_info[$row['forum_id']])) +					{ +						$row['forum_mark_time'] = $forum_tracking_info[$row['forum_id']]; +					} + +					$topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered'] && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0; +					$topic_forum_list[$row['forum_id']]['topics'][] = (int) $t_id; +				} + +				$topic_tracking_info = $tracking_topics = array();  				if ($config['load_db_lastread'])  				{ -					$topic_tracking_info = get_topic_tracking(0, $topic_list, $rowset, false, $topic_list); +					foreach ($topic_forum_list as $f_id => $topic_row) +					{ +						$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time'])); +					}  				}  				else  				{ -					$topic_tracking_info = get_complete_topic_tracking(0, $topic_list, $topic_list); +					foreach ($topic_forum_list as $f_id => $topic_row) +					{ +						$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics']); +					}  				} +				unset($topic_forum_list);  				foreach ($topic_list as $topic_id)  				{ @@ -148,18 +157,18 @@ class ucp_main  						'TOPIC_TITLE'				=> censor_text($row['topic_title']),  						'TOPIC_TYPE'				=> $topic_type, +						'TOPIC_IMG_STYLE'		=> $folder_img,  						'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt), -						'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),  						'ATTACH_ICON_IMG'		=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '',  						'S_USER_POSTED'		=> (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false,  						'S_UNREAD'			=> $unread_topic,  						'U_TOPIC_AUTHOR'		=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), -						'U_LAST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], +						'U_LAST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],  						'U_LAST_POST_AUTHOR'	=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), -						'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&view=unread") . '#unread', -						'U_VIEW_TOPIC'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id")) +						'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', +						'U_VIEW_TOPIC'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"))  					);  				} @@ -183,8 +192,8 @@ class ucp_main  					'VISITED'			=> (empty($last_visit)) ? ' - ' : $user->format_date($last_visit),  					'WARNINGS'			=> ($user->data['user_warnings']) ? $user->data['user_warnings'] : 0,  					'POSTS'				=> ($user->data['user_posts']) ? $user->data['user_posts'] : 0, -					'POSTS_DAY'			=> sprintf($user->lang['POST_DAY'], $posts_per_day), -					'POSTS_PCT'			=> sprintf($user->lang['POST_PCT'], $percentage), +					'POSTS_DAY'			=> $user->lang('POST_DAY', $posts_per_day), +					'POSTS_PCT'			=> $user->lang('POST_PCT', $percentage),  					'OCCUPATION'	=> (!empty($row['user_occ'])) ? $row['user_occ'] : '',  					'INTERESTS'		=> (!empty($row['user_interests'])) ? $row['user_interests'] : '', @@ -287,7 +296,7 @@ class ucp_main  					}  					else  					{ -						$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : ''; +						$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);  						$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();  					} @@ -334,8 +343,8 @@ class ucp_main  						$template->assign_block_vars('forumrow', array(  							'FORUM_ID'				=> $forum_id, +							'FORUM_IMG_STYLE'		=> $folder_image,  							'FORUM_FOLDER_IMG'		=> $user->img($folder_image, $folder_alt), -							'FORUM_FOLDER_IMG_SRC'	=> $user->img($folder_image, $folder_alt, false, '', 'src'),  							'FORUM_IMAGE'			=> ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',  							'FORUM_IMAGE_SRC'		=> ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',  							'FORUM_NAME'			=> $row['forum_name'], @@ -435,7 +444,7 @@ class ucp_main  				$edit		= (isset($_REQUEST['edit'])) ? true : false;  				$submit		= (isset($_POST['submit'])) ? true : false; -				$draft_id	= ($edit) ? intval($_REQUEST['edit']) : 0; +				$draft_id	= $request->variable('edit', 0);  				$delete		= (isset($_POST['delete'])) ? true : false;  				$s_hidden_fields = ($edit) ? '<input type="hidden" name="edit" value="' . $draft_id . '" />' : ''; @@ -660,11 +669,12 @@ class ucp_main  		if ($topics_count)  		{ +			phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start); +  			$template->assign_vars(array( -				'PAGINATION'	=> generate_pagination($this->u_action, $topics_count, $config['topics_per_page'], $start), -				'PAGE_NUMBER'	=> on_page($topics_count, $config['topics_per_page'], $start), -				'TOTAL_TOPICS'	=> ($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count)) -			); +				'PAGE_NUMBER'	=> phpbb_on_page($template, $user, $this->u_action, $topics_count, $config['topics_per_page'], $start), +				'TOTAL_TOPICS'	=> $user->lang('VIEW_FORUM_TOPICS', (int) $topics_count), +			));  		}  		if ($mode == 'subscribed') @@ -747,14 +757,14 @@ class ucp_main  		{  			foreach ($topic_forum_list as $f_id => $topic_row)  			{ -				$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']), ($f_id == 0) ? $global_announce_list : false); +				$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']));  			}  		}  		else  		{  			foreach ($topic_forum_list as $f_id => $topic_row)  			{ -				$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics'], $global_announce_list); +				$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics']);  			}  		} @@ -802,17 +812,15 @@ class ucp_main  				'U_LAST_POST_AUTHOR'		=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),  				'S_DELETED_TOPIC'	=> (!$row['topic_id']) ? true : false, -				'S_GLOBAL_TOPIC'	=> (!$forum_id) ? true : false, -				'PAGINATION'		=> topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")),  				'REPLIES'			=> $replies,  				'VIEWS'				=> $row['topic_views'],  				'TOPIC_TITLE'		=> censor_text($row['topic_title']),  				'TOPIC_TYPE'		=> $topic_type,  				'FORUM_NAME'		=> $row['forum_name'], +				'TOPIC_IMG_STYLE'		=> $folder_img,  				'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt), -				'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),  				'TOPIC_FOLDER_IMG_ALT'	=> $user->lang[$folder_alt],  				'TOPIC_ICON_IMG'		=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',  				'TOPIC_ICON_IMG_WIDTH'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', @@ -828,8 +836,8 @@ class ucp_main  				'U_VIEW_TOPIC'			=> $view_topic_url,  				'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'] . "&t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);  		}  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index 447b6ebe87..d4ce8e41ee 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -1,9 +1,8 @@  <?php  /**  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -345,8 +344,8 @@ class ucp_pm  					'NUM_NOT_MOVED'			=> $num_not_moved,  					'NUM_REMOVED'			=> $num_removed,  					'RELEASE_MESSAGE_INFO'	=> sprintf($user->lang['RELEASE_MESSAGES'], '<a href="' . $this->u_action . '&folder=' . $folder_id . '&release=1">', '</a>'), -					'NOT_MOVED_MESSAGES'	=> ($num_not_moved == 1) ? $user->lang['NOT_MOVED_MESSAGE'] : sprintf($user->lang['NOT_MOVED_MESSAGES'], $num_not_moved), -					'RULE_REMOVED_MESSAGES'	=> ($num_removed == 1) ? $user->lang['RULE_REMOVED_MESSAGE'] : sprintf($user->lang['RULE_REMOVED_MESSAGES'], $num_removed), +					'NOT_MOVED_MESSAGES'	=> $user->lang('NOT_MOVED_MESSAGES', (int) $num_not_moved), +					'RULE_REMOVED_MESSAGES'	=> $user->lang('RULE_REMOVED_MESSAGES', (int) $num_removed),  					'S_FOLDER_OPTIONS'		=> $s_folder_options,  					'S_TO_FOLDER_OPTIONS'	=> $s_to_folder_options, @@ -412,5 +411,3 @@ class ucp_pm  		$this->page_title = 'UCP_PM_' . strtoupper($mode);  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index d1786dd9ba..5577e8dab3 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -24,6 +23,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())  {  	global $template, $db, $auth, $user;  	global $phpbb_root_path, $phpEx, $config; +	global $request;  	// Damn php and globals - i know, this is horrible  	// Needed for handle_message_list_actions() @@ -49,13 +49,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())  	// Reply to all triggered (quote/reply)  	$reply_to_all	= request_var('reply_to_all', 0); -	// Do NOT use request_var or specialchars here -	$address_list	= isset($_REQUEST['address_list']) ? $_REQUEST['address_list'] : array(); - -	if (!is_array($address_list)) -	{ -		$address_list = array(); -	} +	$address_list	= $request->variable('address_list', array('' => array(0 => '')));  	$submit		= (isset($_POST['post'])) ? true : false;  	$preview	= (isset($_POST['preview'])) ? true : false; @@ -844,11 +838,11 @@ function compose_pm($id, $mode, $action, $user_folders = array())  			$post_id = request_var('p', 0);  			if ($config['allow_post_links'])  			{ -				$message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}: {$message_subject}[/url]\n\n"; +				$message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}[/url]\n\n";  			}  			else  			{ -				$message_link = $user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id})\n\n"; +				$message_link = $user->lang['SUBJECT'] . $user->lang['COLON'] . ' ' . $message_subject . " (" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id})\n\n";  			}  		}  		else @@ -881,7 +875,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())  		$forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject));  		$forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time, false, true));  		$forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text); -		$forward_text[] = sprintf($user->lang['FWD_TO'], implode(', ', $fwd_to_field['to'])); +		$forward_text[] = sprintf($user->lang['FWD_TO'], implode($user->lang['COMMA_SEPARATOR'], $fwd_to_field['to']));  		$message_parser->message = implode("\n", $forward_text) . "\n\n[quote="{$quote_username}"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]";  		$message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject); @@ -1051,7 +1045,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())  	$s_hidden_fields = '<input type="hidden" name="lastclick" value="' . $current_time . '" />';  	$s_hidden_fields .= (isset($check_value)) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : ''; -	$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . ((isset($_REQUEST['draft_loaded'])) ? intval($_REQUEST['draft_loaded']) : $draft_id) . '" />' : ''; +	$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . ((isset($_REQUEST['draft_loaded'])) ? $request->variable('draft_loaded', 0) : $draft_id) . '" />' : '';  	$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"'; @@ -1059,7 +1053,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())  	$template->assign_vars(array(  		'L_POST_A'					=> $page_title,  		'L_ICON'					=> $user->lang['PM_ICON'], -		'L_MESSAGE_BODY_EXPLAIN'	=> (intval($config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '', +		'L_MESSAGE_BODY_EXPLAIN'	=> $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']),  		'SUBJECT'				=> (isset($message_subject)) ? $message_subject : '',  		'MESSAGE'				=> $message_text, @@ -1127,11 +1121,12 @@ function compose_pm($id, $mode, $action, $user_folders = array())  function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove_g, $add_to, $add_bcc)  {  	global $auth, $db, $user; +	global $request;  	// Delete User [TO/BCC] -	if ($remove_u && !empty($_REQUEST['remove_u']) && is_array($_REQUEST['remove_u'])) +	if ($remove_u && $request->variable('remove_u', array(0 => '')))  	{ -		$remove_user_id = array_keys($_REQUEST['remove_u']); +		$remove_user_id = array_keys($request->variable('remove_u', array(0 => '')));  		if (isset($remove_user_id[0]))  		{ @@ -1140,9 +1135,9 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove  	}  	// Delete Group [TO/BCC] -	if ($remove_g && !empty($_REQUEST['remove_g']) && is_array($_REQUEST['remove_g'])) +	if ($remove_g && $request->variable('remove_g', array(0 => '')))  	{ -		$remove_group_id = array_keys($_REQUEST['remove_g']); +		$remove_group_id = array_keys($request->variable('remove_g', array(0 => '')));  		if (isset($remove_group_id[0]))  		{ @@ -1210,7 +1205,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove  		}  		// Add Friends if specified -		$friend_list = (isset($_REQUEST['add_' . $type]) && is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array(); +		$friend_list = array_keys($request->variable('add_' . $type, array(0)));  		$user_id_ary = array_merge($user_id_ary, $friend_list);  		foreach ($user_id_ary as $user_id) @@ -1308,5 +1303,3 @@ function get_recipients($address_list, $num_recipients = 1)  	return $recipient;  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index efa390ed87..bf7334b307 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -231,7 +230,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit  					// Something went wrong, only partially moved?  					if ($num_moved != $folder_row['pm_count'])  					{ -						trigger_error(sprintf($user->lang['MOVE_PM_ERROR'], $num_moved, $folder_row['pm_count'])); +						trigger_error($user->lang('MOVE_PM_ERROR', (int) $folder_row['pm_count'], $num_moved));  					}  				break; @@ -422,7 +421,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit  	$folder[PRIVMSGS_INBOX] = array(  		'folder_name'		=> $user->lang['PM_INBOX'], -		'message_status'	=> sprintf($user->lang['FOLDER_MESSAGE_STATUS'], $num_messages, $user->data['message_limit']) +		'message_status'	=> $user->lang('FOLDER_MESSAGE_STATUS', (int) $user->data['message_limit'], $num_messages),  	);  	$sql = 'SELECT folder_id, folder_name, pm_count @@ -436,7 +435,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit  		$num_user_folder++;  		$folder[$row['folder_id']] = array(  			'folder_name'		=> $row['folder_name'], -			'message_status'	=> sprintf($user->lang['FOLDER_MESSAGE_STATUS'], $row['pm_count'], $user->data['message_limit']) +			'message_status'	=> $user->lang('FOLDER_MESSAGE_STATUS', (int) $user->data['message_limit'], $row['pm_count']),  		);  	}  	$db->sql_freeresult($result); @@ -862,5 +861,3 @@ function show_defined_rules($user_id, $check_lang, $rule_lang, $action_lang, $fo  	}  	$db->sql_freeresult($result);  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index bd7bf89854..625da23736 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -165,7 +164,7 @@ function view_folder($id, $mode, $folder_id, $folder)  					'PM_ICON_IMG'		=> (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',  					'PM_ICON_URL'		=> (!empty($icons[$row['icon_id']])) ? $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '',  					'FOLDER_IMG'		=> $user->img($folder_img, $folder_alt), -					'FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'), +					'FOLDER_IMG_STYLE'	=> $folder_img,  					'PM_IMG'			=> ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '',  					'ATTACH_ICON_IMG'	=> ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', @@ -177,7 +176,7 @@ function view_folder($id, $mode, $folder_id, $folder)  					'U_VIEW_PM'			=> ($row['pm_deleted']) ? '' : $view_message_url,  					'U_REMOVE_PM'		=> ($row['pm_deleted']) ? $remove_message_url : '',  					'U_MCP_REPORT'		=> (isset($row['report_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&mode=pm_report_details&r=' . $row['report_id']) : '', -					'RECIPIENTS'		=> ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode(', ', $address_list[$message_id]) : '') +					'RECIPIENTS'		=> ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode($user->lang['COMMA_SEPARATOR'], $address_list[$message_id]) : '')  				);  			}  			unset($folder_info['rowset']); @@ -267,9 +266,9 @@ function view_folder($id, $mode, $folder_id, $folder)  					}  				} -				// There is the chance that all recipients of the message got deleted. To avoid creating  +				// 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'])) &&  +				if (!(isset($address[$message_id]['g']) && sizeof($address[$message_id]['g'])) &&  				    !(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u'])))  				{  					$address[$message_id]['u'] = array(); @@ -278,12 +277,12 @@ function view_folder($id, $mode, $folder_id, $folder)  				}  				decode_message($message_row['message_text'], $message_row['bbcode_uid']); -				 +  				$data[] = array(  					'subject'	=> censor_text($row['message_subject']),  					'sender'	=> $row['username'],  					// ISO 8601 date. For PHP4 we are able to hardcode the timezone because $user->format_date() does not set it. -					'date'		=> $user->format_date($row['message_time'], (PHP_VERSION >= 5) ? 'c' : "Y-m-d\TH:i:s+00:00", true), +					'date'		=> $user->format_date($row['message_time'], 'c', true),  					'to'		=> ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? $address[$message_id] : '',  					'message'	=> $message_row['message_text']  				); @@ -452,10 +451,12 @@ function get_pm_from($folder_id, $folder, $user_id)  		$sql_limit_time = '';  	} +	$base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"); +	phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start); +  	$template->assign_vars(array( -		'PAGINATION'		=> generate_pagination(append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"), $pm_count, $config['topics_per_page'], $start), -		'PAGE_NUMBER'		=> on_page($pm_count, $config['topics_per_page'], $start), -		'TOTAL_MESSAGES'	=> (($pm_count == 1) ? $user->lang['VIEW_PM_MESSAGE'] : sprintf($user->lang['VIEW_PM_MESSAGES'], $pm_count)), +		'PAGE_NUMBER'		=> phpbb_on_page($template, $user, $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'), @@ -552,5 +553,3 @@ function get_pm_from($folder_id, $folder, $user_id)  		'rowset'	=> $rowset  	);  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 82a095dd9c..c85b05f144 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -22,7 +21,7 @@ if (!defined('IN_PHPBB'))  function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)  {  	global $user, $template, $auth, $db, $cache; -	global $phpbb_root_path, $phpEx, $config; +	global $phpbb_root_path, $request, $phpEx, $config, $phpbb_dispatcher;  	$user->add_lang(array('viewtopic', 'memberlist')); @@ -59,6 +58,18 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)  		$bbcode = new bbcode($message_row['bbcode_bitfield']);  	} +	// Load the custom profile fields +	if ($config['load_cpf_pm']) +	{ +		if (!class_exists('custom_profile')) +		{ +			include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); +		} +		$cp = new custom_profile(); + +		$profile_fields = $cp->generate_profile_fields_template('grab', $author_id); +	} +  	// Assign TO/BCC Addresses to template  	write_pm_addresses(array('to' => $message_row['to_address'], 'bcc' => $message_row['bcc_address']), $author_id); @@ -174,7 +185,26 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)  	$bbcode_status	= ($config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode')) ? true : false; -	$template->assign_vars(array( +	// Get the profile fields template data +	$cp_row = array(); +	if ($config['load_cpf_pm'] && isset($profile_fields[$author_id])) +	{ +		// Filter the fields we don't want to show +		foreach ($profile_fields[$author_id] as $used_ident => $profile_field) +		{ +			if (!$profile_field['data']['field_show_on_pm']) +			{ +				unset($profile_fields[$author_id][$used_ident]); +			} +		} + +		if (isset($profile_fields[$author_id])) +		{ +			$cp_row = $cp->generate_profile_fields_template('show', false, $profile_fields[$author_id]); +		} +	} + +	$msg_data = array(  		'MESSAGE_AUTHOR_FULL'		=> get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']),  		'MESSAGE_AUTHOR_COLOUR'		=> get_username_string('colour', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']),  		'MESSAGE_AUTHOR'			=> get_username_string('username', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), @@ -227,19 +257,57 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)  		'U_PM_ACTION'		=> $url . '&mode=compose&f=' . $folder_id . '&p=' . $message_row['msg_id'],  		'S_HAS_ATTACHMENTS'	=> (sizeof($attachments)) ? true : false, +		'S_HAS_MULTIPLE_ATTACHMENTS' => (sizeof($attachments) > 1),  		'S_DISPLAY_NOTICE'	=> $display_notice && $message_row['message_attachment'],  		'S_AUTHOR_DELETED'	=> ($author_id == ANONYMOUS) ? true : false,  		'S_SPECIAL_FOLDER'	=> in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)),  		'S_PM_RECIPIENTS'	=> $num_recipients,  		'S_BBCODE_ALLOWED'	=> ($bbcode_status) ? 1 : 0, +		'S_CUSTOM_FIELDS'	=> (!empty($cp_row['row'])) ? true : false,  		'U_PRINT_PM'		=> ($config['print_pm'] && $auth->acl_get('u_pm_printpm')) ? "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=print" : '', -		'U_FORWARD_PM'		=> ($config['forward_pm'] && $auth->acl_get('u_sendpm') && $auth->acl_get('u_pm_forward')) ? "$url&mode=compose&action=forward&f=$folder_id&p=" . $message_row['msg_id'] : '') +		'U_FORWARD_PM'		=> ($config['forward_pm'] && $auth->acl_get('u_sendpm') && $auth->acl_get('u_pm_forward')) ? "$url&mode=compose&action=forward&f=$folder_id&p=" . $message_row['msg_id'] : '',  	); +	/** +	* Modify pm and sender data before it is assigned to the template +	* +	* @event core.ucp_pm_view_messsage +	* @var	mixed	id			Active module category (can be int or string) +	* @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	cp_row		Array with senders custom profile field data +	* @var	array	msg_data	Template array with message data +	* @since 3.1-A1 +	*/ +	$vars = array('id', 'mode', 'folder_id', 'msg_id', 'folder', 'message_row', 'cp_row', 'msg_data'); +	extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_messsage', compact($vars))); + +	$template->assign_vars($msg_data); + +	// Display the custom profile fields +	if (!empty($cp_row['row'])) +	{ +		$template->assign_vars($cp_row['row']); + +		foreach ($cp_row['blockrow'] as $cp_block_row) +		{ +			$template->assign_block_vars('custom_fields', $cp_block_row); +		} +	} +  	// Display not already displayed Attachments for this post, we already parsed them. ;)  	if (isset($attachments) && sizeof($attachments))  	{ +		$methods = phpbb_gen_download_links('post_msg_id', $msg_id, $phpbb_root_path, $phpEx); +		foreach ($methods as $method) +		{ +			$template->assign_block_vars('dl_method', $method); +		} +	  		foreach ($attachments as $attachment)  		{  			$template->assign_block_vars('attachment', array( @@ -248,7 +316,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)  		}  	} -	if (!isset($_REQUEST['view']) || $_REQUEST['view'] != 'print') +	if (!isset($_REQUEST['view']) || $request->variable('view', '') != 'print')  	{  		// Message History  		if (message_history($msg_id, $user->data['user_id'], $message_row, $folder)) @@ -319,5 +387,3 @@ function get_user_information($user_id, $user_row)  	return $user_row;  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 17d7d23f02..2228bc7931 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -42,9 +41,8 @@ class ucp_prefs  					'dateformat'	=> request_var('dateformat', $user->data['user_dateformat'], true),  					'lang'			=> basename(request_var('lang', $user->data['user_lang'])),  					'style'			=> request_var('style', (int) $user->data['user_style']), -					'tz'			=> request_var('tz', (float) $user->data['user_timezone']), +					'tz'			=> request_var('tz', $user->data['user_timezone']), -					'dst'			=> request_var('dst', (bool) $user->data['user_dst']),  					'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']), @@ -73,7 +71,7 @@ class ucp_prefs  					$error = validate_data($data, array(  						'dateformat'	=> array('string', false, 1, 30),  						'lang'			=> array('language_iso_name'), -						'tz'			=> array('num', false, -14, 14), +						'tz'			=> array('timezone'),  					));  					if (!check_form_key('ucp_prefs_personal')) @@ -94,7 +92,6 @@ class ucp_prefs  							'user_notify_pm'		=> $data['notifypm'],  							'user_options'			=> $user->data['user_options'], -							'user_dst'				=> $data['dst'],  							'user_dateformat'		=> $data['dateformat'],  							'user_lang'				=> $data['lang'],  							'user_timezone'			=> $data['tz'], @@ -112,7 +109,7 @@ class ucp_prefs  					}  					// Replace "error" strings with their real, localised form -					$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); +					$error = array_map(array($user, 'lang'), $error);  				}  				$dateformat_options = ''; @@ -134,6 +131,7 @@ class ucp_prefs  				}  				$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; +				$timezone_selects = phpbb_timezone_select($user, $data['tz'], true);  				$template->assign_vars(array(  					'ERROR'				=> (sizeof($error)) ? implode('<br />', $error) : '', @@ -146,7 +144,6 @@ class ucp_prefs  					'S_HIDE_ONLINE'		=> $data['hideonline'],  					'S_NOTIFY_PM'		=> $data['notifypm'],  					'S_POPUP_PM'		=> $data['popuppm'], -					'S_DST'				=> $data['dst'],  					'DATE_FORMAT'			=> $data['dateformat'],  					'A_DATE_FORMAT'			=> addslashes($data['dateformat']), @@ -157,7 +154,8 @@ class ucp_prefs  					'S_LANG_OPTIONS'		=> language_select($data['lang']),  					'S_STYLE_OPTIONS'		=> ($config['override_user_style']) ? '' : style_select($data['style']), -					'S_TZ_OPTIONS'			=> tz_select($data['tz'], true), +					'S_TZ_OPTIONS'			=> $timezone_selects['tz_select'], +					'S_TZ_DATE_OPTIONS'		=> $timezone_selects['tz_dates'],  					'S_CAN_HIDE_ONLINE'		=> ($auth->acl_get('u_hideonline')) ? true : false,  					'S_SELECT_NOTIFY'		=> ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false)  				); @@ -234,7 +232,7 @@ class ucp_prefs  					}  					// Replace "error" strings with their real, localised form -					$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); +					$error = array_map(array($user, 'lang'), $error);  				}  				$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); @@ -360,5 +358,3 @@ class ucp_prefs  		$this->page_title = 'UCP_PREFS_' . strtoupper($mode);  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index d35d13b6c1..89bf20a30f 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -30,12 +29,13 @@ class ucp_profile  	function main($id, $mode)  	{  		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; +		global $request;  		$user->add_lang('posting'); -		$preview	= (!empty($_POST['preview'])) ? true : false; -		$submit		= (!empty($_POST['submit'])) ? true : false; -		$delete		= (!empty($_POST['delete'])) ? true : false; +		$preview	= $request->variable('preview', false, false, phpbb_request_interface::POST); +		$submit		= $request->variable('submit', false, false, phpbb_request_interface::POST); +		$delete		= $request->variable('delete', false, false, phpbb_request_interface::POST);  		$error = $data = array();  		$s_hidden_fields = ''; @@ -46,10 +46,9 @@ class ucp_profile  				$data = array(  					'username'			=> utf8_normalize_nfc(request_var('username', $user->data['username'], true)),  					'email'				=> strtolower(request_var('email', $user->data['user_email'])), -					'email_confirm'		=> strtolower(request_var('email_confirm', '')), -					'new_password'		=> request_var('new_password', '', true), -					'cur_password'		=> request_var('cur_password', '', true), -					'password_confirm'	=> request_var('password_confirm', '', true), +					'new_password'		=> $request->variable('new_password', '', true), +					'cur_password'		=> $request->variable('cur_password', '', true), +					'password_confirm'	=> $request->variable('password_confirm', '', true),  				);  				add_form_key('ucp_reg_details'); @@ -65,7 +64,6 @@ class ucp_profile  						'email'				=> array(  							array('string', false, 6, 60),  							array('email')), -						'email_confirm'		=> array('string', true, 6, 60),  					);  					if ($auth->acl_get('u_chgname') && $config['allow_namechange']) @@ -78,11 +76,6 @@ class ucp_profile  					$error = validate_data($data, $check_ary); -					if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) -					{ -						$error[] = ($data['email_confirm']) ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY'; -					} -  					if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password'])  					{  						$error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY'; @@ -235,7 +228,7 @@ class ucp_profile  					}  					// Replace "error" strings with their real, localised form -					$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); +					$error = array_map(array($user, 'lang'), $error);  				}  				$template->assign_vars(array( @@ -247,8 +240,8 @@ class ucp_profile  					'NEW_PASSWORD'		=> $data['new_password'],  					'CUR_PASSWORD'		=> '', -					'L_USERNAME_EXPLAIN'		=> sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), -					'L_CHANGE_PASSWORD_EXPLAIN'	=> sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), +					'L_USERNAME_EXPLAIN'		=> $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), +					'L_CHANGE_PASSWORD_EXPLAIN'	=> $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])),  					'S_FORCE_PASSWORD'	=> ($auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) ? true : false,  					'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false, @@ -382,7 +375,7 @@ class ucp_profile  					}  					// Replace "error" strings with their real, localised form -					$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); +					$error = array_map(array($user, 'lang'), $error);  				}  				if ($config['allow_birthdays']) @@ -507,7 +500,7 @@ class ucp_profile  					}  					// Replace "error" strings with their real, localised form -					$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); +					$error = array_map(array($user, 'lang'), $error);  				}  				$signature_preview = ''; @@ -536,7 +529,7 @@ class ucp_profile  					'URL_STATUS'			=> ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],  					'MAX_FONT_SIZE'			=> (int) $config['max_sig_font_size'], -					'L_SIGNATURE_EXPLAIN'	=> sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), +					'L_SIGNATURE_EXPLAIN'	=> $user->lang('SIGNATURE_EXPLAIN', (int) $config['max_sig_chars']),  					'S_BBCODE_ALLOWED'		=> $config['allow_sig_bbcode'],  					'S_SMILIES_ALLOWED'		=> $config['allow_sig_smilies'], @@ -578,7 +571,7 @@ class ucp_profile  						$error[] = 'FORM_INVALID';  					}  					// Replace "error" strings with their real, localised form -					$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); +					$error = array_map(array($user, 'lang'), $error);  				}  				if (!$config['allow_avatar'] && $user->data['user_avatar_type']) @@ -601,7 +594,7 @@ class ucp_profile  					'S_FORM_ENCTYPE'	=> ($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_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), +					'L_AVATAR_EXPLAIN'	=> phpbb_avatar_explanation_string(),  				));  				if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) @@ -625,6 +618,60 @@ class ucp_profile  				}  			break; + +			case 'autologin_keys': + +				add_form_key('ucp_autologin_keys'); + +				if ($submit) +				{ +					$keys = request_var('keys', array('')); + +					if (!check_form_key('ucp_autologin_keys')) +					{ +						$error[] = 'FORM_INVALID'; +					} + +					if (!sizeof($error)) +					{ +						if (!empty($keys)) +						{ +							$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' +								WHERE user_id = ' . (int) $user->data['user_id'] . ' +								AND ' . $db->sql_in_set('key_id', $keys) ; + +							$db->sql_query($sql); + +							meta_refresh(3, $this->u_action); +							$message = $user->lang['AUTOLOGIN_SESSION_KEYS_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); +							trigger_error($message); +						} +					} + +					// Replace "error" strings with their real, localised form +					$error = array_map(array($user, 'lang'), $error); +				} + +				$sql = 'SELECT key_id, last_ip, last_login +					FROM ' . SESSIONS_KEYS_TABLE . ' +					WHERE user_id = ' . (int) $user->data['user_id']; + +				$result = $db->sql_query($sql); + +				while ($row = $db->sql_fetchrow($result)) +				{ +					$template->assign_block_vars('sessions', array( +						'errors' => $error, + +						'KEY' => $row['key_id'], +						'IP' => $row['last_ip'], +						'LOGIN_TIME' => $user->format_date($row['last_login']), +					)); +				} + +				$db->sql_freeresult($result); + +			break;  		}  		$template->assign_vars(array( @@ -639,5 +686,3 @@ class ucp_profile  		$this->page_title = 'UCP_PROFILE_' . strtoupper($mode);  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 6ad3a55589..c57aec00a0 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -28,6 +27,7 @@ class ucp_register  	function main($id, $mode)  	{  		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; +		global $request;  		//  		if ($config['require_activation'] == USER_ACTIVATION_DISABLE) @@ -37,9 +37,9 @@ class ucp_register  		include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); -		$coppa			= (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; -		$agreed			= (!empty($_POST['agreed'])) ? 1 : 0; -		$submit			= (isset($_POST['submit'])) ? true : false; +		$coppa			= $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false; +		$agreed			= (int) $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 = (empty($_GET['change_lang'])) ? 0 : $agreed; +					$agreed = ($request->variable('change_lang', false)) ? 0 : $agreed;  				}  				$user->lang_name = $user_lang = $use_lang; @@ -99,9 +99,8 @@ class ucp_register  				$s_hidden_fields = array_merge($s_hidden_fields, array(  					'username'			=> utf8_normalize_nfc(request_var('username', '', true)),  					'email'				=> strtolower(request_var('email', '')), -					'email_confirm'		=> strtolower(request_var('email_confirm', '')),  					'lang'				=> $user->lang_name, -					'tz'				=> request_var('tz', (float) $config['board_timezone']), +					'tz'				=> request_var('tz', $config['board_timezone']),  				));  			} @@ -121,7 +120,10 @@ class ucp_register  			if ($coppa === false && $config['coppa_enable'])  			{  				$now = getdate(); -				$coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']); +				$coppa_birthday = $user->create_datetime() +					->setDate($now['year'] - 13, $now['mon'], $now['mday'] - 1) +					->setTime(0, 0, 0) +					->format($user->lang['DATE_FORMAT'], true);  				unset($now);  				$template->assign_vars(array( @@ -156,26 +158,23 @@ class ucp_register  			return;  		} - -		// The CAPTCHA kicks in here. We can't help that the information gets lost on language change.  +		// The CAPTCHA kicks in here. We can't help that the information gets lost on language change.  		if ($config['enable_confirm'])  		{  			include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); -			$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); +			$captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);  			$captcha->init(CONFIRM_REG);  		} -		$is_dst = $config['board_dst'];  		$timezone = $config['board_timezone'];  		$data = array(  			'username'			=> utf8_normalize_nfc(request_var('username', '', true)), -			'new_password'		=> request_var('new_password', '', true), -			'password_confirm'	=> request_var('password_confirm', '', true), +			'new_password'		=> $request->variable('new_password', '', true), +			'password_confirm'	=> $request->variable('password_confirm', '', true),  			'email'				=> strtolower(request_var('email', '')), -			'email_confirm'		=> strtolower(request_var('email_confirm', '')),  			'lang'				=> basename(request_var('lang', $user->lang_name)), -			'tz'				=> request_var('tz', (float) $timezone), +			'tz'				=> request_var('tz', $timezone),  		);  		// Check and initialize some variables if needed @@ -192,8 +191,7 @@ class ucp_register  				'email'				=> array(  					array('string', false, 6, 60),  					array('email')), -				'email_confirm'		=> array('string', false, 6, 60), -				'tz'				=> array('num', false, -14, 14), +				'tz'				=> array('timezone'),  				'lang'				=> array('language_iso_name'),  			)); @@ -203,7 +201,7 @@ class ucp_register  			}  			// Replace "error" strings with their real, localised form -			$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); +			$error = array_map(array($user, 'lang'), $error);  			if ($config['enable_confirm'])  			{ @@ -237,11 +235,6 @@ class ucp_register  				{  					$error[] = $user->lang['NEW_PASSWORD_ERROR'];  				} - -				if ($data['email'] != $data['email_confirm']) -				{ -					$error[] = $user->lang['NEW_EMAIL_ERROR']; -				}  			}  			if (!sizeof($error)) @@ -288,8 +281,7 @@ class ucp_register  					'user_password'			=> phpbb_hash($data['new_password']),  					'user_email'			=> $data['email'],  					'group_id'				=> (int) $group_id, -					'user_timezone'			=> (float) $data['tz'], -					'user_dst'				=> $is_dst, +					'user_timezone'			=> $data['tz'],  					'user_lang'				=> $data['lang'],  					'user_type'				=> $user_type,  					'user_actkey'			=> $user_actkey, @@ -450,20 +442,21 @@ class ucp_register  			break;  		} +		$timezone_selects = phpbb_timezone_select($user, $data['tz'], true);  		$template->assign_vars(array(  			'ERROR'				=> (sizeof($error)) ? implode('<br />', $error) : '',  			'USERNAME'			=> $data['username'],  			'PASSWORD'			=> $data['new_password'],  			'PASSWORD_CONFIRM'	=> $data['password_confirm'],  			'EMAIL'				=> $data['email'], -			'EMAIL_CONFIRM'		=> $data['email_confirm'],  			'L_REG_COND'				=> $l_reg_cond, -			'L_USERNAME_EXPLAIN'		=> sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), -			'L_PASSWORD_EXPLAIN'		=> sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), +			'L_USERNAME_EXPLAIN'		=> $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), +			'L_PASSWORD_EXPLAIN'		=> $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])),  			'S_LANG_OPTIONS'	=> language_select($data['lang']), -			'S_TZ_OPTIONS'		=> tz_select($data['tz']), +			'S_TZ_OPTIONS'			=> $timezone_selects['tz_select'], +			'S_TZ_DATE_OPTIONS'		=> $timezone_selects['tz_dates'],  			'S_CONFIRM_REFRESH'	=> ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false,  			'S_REGISTRATION'	=> true,  			'S_COPPA'			=> $coppa, @@ -482,5 +475,3 @@ class ucp_register  		$this->page_title = 'UCP_REGISTRATION';  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index cb89ad99be..4f65ed1866 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -67,7 +66,7 @@ class ucp_remind  			}  			// Check users permissions -			$auth2 = new auth(); +			$auth2 = new phpbb_auth();  			$auth2->acl($user_row);  			if (!$auth2->acl_get('u_chgpasswd')) @@ -122,5 +121,3 @@ class ucp_remind  		$this->page_title = 'UCP_REMIND';  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index 4d181dba49..5f1e3a92c3 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -160,5 +159,3 @@ class ucp_resend  		$this->page_title = 'UCP_RESEND';  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index 5ed4db7520..a669c450a4 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -26,7 +25,7 @@ class ucp_zebra  	function main($id, $mode)  	{ -		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; +		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher;  		$submit	= (isset($_POST['submit']) || isset($_GET['add']) || isset($_GET['remove'])) ? true : false;  		$s_hidden_fields = ''; @@ -55,9 +54,22 @@ class ucp_zebra  					// Remove users  					if (!empty($data['usernames']))  					{ +						$user_ids = $data['usernames']; + +						/** +						* Remove users from friends/foes +						* +						* @event core.ucp_remove_zebra +						* @var	string	mode		Zebra type: friends|foes +						* @var	array	user_ids	User ids we remove +						* @since 3.1-A1 +						*/ +						$vars = array('user_ids'); +						extract($phpbb_dispatcher->trigger_event('core.ucp_remove_zebra', compact($vars))); +  						$sql = 'DELETE FROM ' . ZEBRA_TABLE . '  							WHERE user_id = ' . $user->data['user_id'] . ' -								AND ' . $db->sql_in_set('zebra_id', $data['usernames']); +								AND ' . $db->sql_in_set('zebra_id', $user_ids);  						$db->sql_query($sql);  						$updated = true; @@ -187,6 +199,19 @@ class ucp_zebra  										);  									} +									/** +									* Add users to friends/foes +									* +									* @event core.ucp_add_zebra +									* @var	string	mode		Zebra type: +									*							friends|foes +									* @var	array	sql_ary		Array of +									*							entries we add +									* @since 3.1-A1 +									*/ +									$vars = array('mode', 'sql_ary'); +									extract($phpbb_dispatcher->trigger_event('core.ucp_add_zebra', compact($vars))); +  									$db->sql_multi_insert(ZEBRA_TABLE, $sql_ary);  									$updated = true; @@ -199,8 +224,24 @@ class ucp_zebra  							}  						}  					} - -					if ($updated) +					 +					if ($request->is_ajax()) +					{ +						$message = ($updated) ? $user->lang[$l_mode . '_UPDATED'] : implode('<br />', $error); +						 +						$json_response = new phpbb_json_response; +						$json_response->send(array( +							'success' => $updated, +							 +							'MESSAGE_TITLE'	=> $user->lang['INFORMATION'], +							'MESSAGE_TEXT'	=> $message, +							'REFRESH_DATA'	=> array( +								'time'	=> 3, +								'url'		=> $this->u_action +							) +						)); +					} +					else if ($updated)  					{  						meta_refresh(3, $this->u_action);  						$message = $user->lang[$l_mode . '_UPDATED'] . '<br />' . implode('<br />', $error) . ((sizeof($error)) ? '<br />' : '') . '<br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); @@ -253,5 +294,3 @@ class ucp_zebra  		$this->page_title = 'UCP_ZEBRA_' . $l_mode;  	}  } - -?>
\ No newline at end of file  | 
