diff options
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/ucp/ucp_activate.php | 7 | ||||
| -rw-r--r-- | phpBB/includes/ucp/ucp_attachments.php | 89 | ||||
| -rw-r--r-- | phpBB/includes/ucp/ucp_confirm.php | 12 | ||||
| -rw-r--r-- | phpBB/includes/ucp/ucp_main.php | 96 | ||||
| -rw-r--r-- | phpBB/includes/ucp/ucp_prefs.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 2 | 
6 files changed, 117 insertions, 91 deletions
diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index 0667f4dfa9..d50b87bf52 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -45,8 +45,8 @@ class ucp_activate extends module  		$sql_update_pass = ($row['user_newpasswd']) ? ", user_password = '" . $db->sql_escape($row['user_newpasswd']) . "', user_newpasswd = ''" : '';  		$sql = 'UPDATE ' . USERS_TABLE . ' -			SET user_type = ' . USER_NORMAL . ", user_actkey = ''$sql_update_pass  -			WHERE user_id = " . $row['user_id']; +			SET user_type = ' . USER_NORMAL . ", user_actkey = '$sql_update_pass'  +			WHERE user_id = {$row['user_id']}";  		$result = $db->sql_query($sql);  		if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass) @@ -77,7 +77,6 @@ class ucp_activate extends module  			$messenger->queue->save();  			$message = 'ACCOUNT_ACTIVE_ADMIN'; -  		}  		else  		{ @@ -91,7 +90,7 @@ class ucp_activate extends module  			set_config('num_users', $config['num_users'] + 1, TRUE);  		} -		meta_refresh(3, "index.$phpEx$SID"); +		meta_refresh(3, "{$phpbb_root_path}index.$phpEx$SID");  		trigger_error($user->lang[$message]);  	}  } diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index b708d209bf..16b3dc3d77 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -26,36 +26,28 @@ class ucp_attachments extends module  		$confirm = (isset($_POST['confirm'])) ? true : false;  		$delete_ids = isset($_REQUEST['attachment']) ? array_keys(array_map('intval', $_REQUEST['attachment'])) : array(); -		if ($delete && $confirm && sizeof($delete_ids)) -		{ -			include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); -			delete_attachments('attach', $delete_ids); - -			meta_refresh(3, "ucp.$phpEx$SID&i=$id"); -			$message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id\">", '</a>'); -			trigger_error($message); -		} -		else if ($delete && sizeof($delete_ids)) +		if ($delete && sizeof($delete_ids))  		{  			$s_hidden_fields = '<input type="hidden" name="delete" value="1" />';  			foreach ($delete_ids as $attachment_id)  			{  				$s_hidden_fields .= '<input type="hidden" name="attachment[' . $attachment_id . ']" value="1" />';  			} -			 -			// Confirm Attachment Deletion -			$template->assign_vars(array( -				'S_CONFIRM_DELETE'	=> true, -				'S_HIDDEN_FIELDS'	=> $s_hidden_fields, -				'L_TITLE'			=> $user->lang['UCP_ATTACH'], - -				'MESSAGE_TITLE'		=> $user->lang['CONFIRM'], -				'MESSAGE_TEXT'		=> (sizeof($delete_ids) == 1) ? $user->lang['CONFIRM_DELETE_ATTACHMENT'] : $user->lang['CONFIRM_DELETE_ATTACHMENTS'], -				'S_UCP_ACTION'		=> "ucp.$phpEx$SID&i=$id") -			); - -			$this->display($user->lang['UCP_ATTACHMENTS'], 'ucp_attachments.html'); -			exit; + +			if (confirm_box(true)) +			{ +				include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); +				delete_attachments('attach', $delete_ids); + +				$refresh_url = "{$phpbb_root_path}ucp.$phpEx$SID&i=$id"; +				meta_refresh(3, $refresh_url); +				$message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $refresh_url . '">', '</a>'); +				trigger_error($message); +			} +			else +			{ +				confirm_box(false, (sizeof($delete_ids) == 1) ? 'DELETE_ATTACHMENT' : 'DELETE_ATTACHMENTS', $s_hidden_fields); +			}  		}  		$sort_key = request_var('sk', 'a'); @@ -89,11 +81,14 @@ class ucp_attachments extends module  		$result = $db->sql_query_limit($sql, 1);  		$num_attachments = $db->sql_fetchfield('num_attachments', 0, $result);  		$db->sql_freeresult($result); - -		$sql = 'SELECT a.*, t.topic_title -			FROM ' . ATTACHMENTS_TABLE . ' a, ' . TOPICS_TABLE . ' t -			WHERE a.topic_id = t.topic_id -				AND a.poster_id = ' . $user->data['user_id'] . " +		 +		$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) +				LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id +					AND a.in_message = 1) +			WHERE a.poster_id = ' . $user->data['user_id'] . "  			ORDER BY $order_by";  		$result = $db->sql_query_limit($sql, $config['posts_per_page'], $start); @@ -104,23 +99,31 @@ class ucp_attachments extends module  			do  			{ -				$view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . '#' . $row['post_id']; +				if ($row['in_message']) +				{ +					$view_topic = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&p={$row['post_msg_id']}"; +				} +				else +				{ +					$view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&t=" . $row['topic_id'] . '&p=' . $row['post_msg_id'] . '#' . $row['post_msg_id']; +				}  				$template->assign_block_vars('attachrow', array(  					'ROW_NUMBER'		=> $row_count + ($start + 1),  					'FILENAME'			=> $row['real_filename'],  					'COMMENT'			=> str_replace("\n", '<br />', $row['comment']),  					'EXTENSION'			=> $row['extension'], -					'SIZE'				=> ($row['filesize'] >= 1048576) ? (round($row['filesize'] / 1048576 * 100) / 100) . ' ' . $user->lang['MB'] : (($row['filesize'] >= 1024) ? (round($row['filesize'] / 1024 * 100) / 100) . ' ' . $user->lang['KB'] : $row['filesize'] . ' ' . $user->lang['BYTES']), +					'SIZE'				=> ($row['filesize'] >= 1048576) ? ($row['filesize'] >> 20) . ' ' . $user->lang['MB'] : (($row['filesize'] >= 1024) ? ($row['filesize'] >> 10) . ' ' . $user->lang['KB'] : $row['filesize'] . ' ' . $user->lang['BYTES']),  					'DOWNLOAD_COUNT'	=> $row['download_count'],  					'POST_TIME'			=> $user->format_date($row['filetime'], $user->lang['DATE_FORMAT']), -					'TOPIC_TITLE'		=> $row['topic_title'], +					'TOPIC_TITLE'		=> ($row['in_message']) ? $row['message_title'] : $row['topic_title'],  					'ATTACH_ID'			=> $row['attach_id'], -					'POST_ID'			=> $row['post_id'], +					'POST_ID'			=> $row['post_msg_id'],  					'TOPIC_ID'			=> $row['topic_id'],  					'S_ROW_COUNT'		=> $row_count++, +					'S_IN_MESSAGE'		=> $row['in_message'],  					'U_VIEW_ATTACHMENT'	=> $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $row['attach_id'],  					'U_VIEW_TOPIC'		=> $view_topic) @@ -132,21 +135,21 @@ class ucp_attachments extends module  		$template->assign_vars(array(   			'PAGE_NUMBER'			=> on_page($num_attachments, $config['posts_per_page'], $start), -			'PAGINATION'			=> generate_pagination("ucp.$phpEx$SID&i=$id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['posts_per_page'], $start), +			'PAGINATION'			=> generate_pagination("{$phpbb_root_path}ucp.$phpEx$SID&i=$id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['posts_per_page'], $start), -			'L_TITLE'				=> $user->lang['UCP_ATTACH'], +			'L_TITLE'				=> $user->lang['UCP_ATTACHMENTS'], -			'U_SORT_FILENAME'		=> "ucp.$phpEx$SID&i=$id&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),  -			'U_SORT_FILE_COMMENT'	=> "ucp.$phpEx$SID&i=$id&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),  -			'U_SORT_EXTENSION'		=> "ucp.$phpEx$SID&i=$id&sk=c&sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),  -			'U_SORT_FILESIZE'		=> "ucp.$phpEx$SID&i=$id&sk=d&sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),  -			'U_SORT_DOWNLOADS'		=> "ucp.$phpEx$SID&i=$id&sk=e&sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),  -			'U_SORT_POST_TIME'		=> "ucp.$phpEx$SID&i=$id&sk=f&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),  -			'U_SORT_TOPIC_TITLE'	=> "ucp.$phpEx$SID&i=$id&sk=g&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),  +			'U_SORT_FILENAME'		=> "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),  +			'U_SORT_FILE_COMMENT'	=> "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),  +			'U_SORT_EXTENSION'		=> "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&sk=c&sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),  +			'U_SORT_FILESIZE'		=> "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&sk=d&sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),  +			'U_SORT_DOWNLOADS'		=> "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&sk=e&sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),  +			'U_SORT_POST_TIME'		=> "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&sk=f&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),  +			'U_SORT_TOPIC_TITLE'	=> "{$phpbb_root_path}ucp.$phpEx$SID&i=$id&sk=g&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),   			'S_DISPLAY_MARK_ALL'	=> ($num_attachments) ? true : false,  			'S_DISPLAY_PAGINATION'	=> ($num_attachments) ? true : false, -			'S_UCP_ACTION'			=> "ucp.$phpEx$SID&i=$id", +			'S_UCP_ACTION'			=> "{$phpbb_root_path}ucp.$phpEx$SID&i=$id",  			'S_SORT_OPTIONS' 		=> $s_sort_key,  			'S_ORDER_SELECT'		=> $s_sort_dir)  		); diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php index cec4e18be1..fdf0b8aeaf 100644 --- a/phpBB/includes/ucp/ucp_confirm.php +++ b/phpBB/includes/ucp/ucp_confirm.php @@ -25,13 +25,13 @@ class ucp_confirm extends module  		global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;  		// Do we have an id? No, then just exit -		if (empty($_GET['id'])) +		$confirm_id = request_var('id', ''); + +		if (!$confirm_id)  		{  			exit;  		} -		$confirm_id = $_GET['id']; -  		// Define available charset  		$chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); @@ -140,11 +140,13 @@ class ucp_confirm extends module  		}  		else  		{ -			if (!empty($_GET['c'])) +			$char = request_var('c', 0); + +			if ($char)  			{  				$_png = $this->define_raw_pngs(); -				$char = substr($code, intval($HTTP_GET_VARS['c']) - 1, 1); +				$char = substr($code, $char - 1, 1);  				header('Content-Type: image/png');  				header('Cache-control: no-cache, no-store');  				echo base64_decode($_png[$char]); diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 3419cb2993..30a1a63ee0 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -21,6 +21,8 @@ class ucp_main extends module  		{  			case 'front': +				$user->add_lang('memberlist'); +  				if ($config['load_db_lastread'] || $config['load_db_track'])  				{  					if ($config['load_db_lastread']) @@ -145,42 +147,63 @@ class ucp_main extends module  				}  				$db->sql_freeresult($result); +				$post_count_ary = $auth->acl_getf('f_postcount'); +				 +				$forum_ary = array(); +				foreach ($post_count_ary as $forum_id => $allowed) +				{ +					if ($allowed) +					{ +						$forum_ary[] = $forum_id; +					} +				} -				// Grab all the relevant data -				$sql = 'SELECT COUNT(p.post_id) AS num_posts    -					FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f -					WHERE p.poster_id = ' . $user->data['user_id'] . "  -						AND f.forum_id = p.forum_id  -						$post_count_sql"; -				$result = $db->sql_query($sql); +				$post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id IN (' . implode(', ', $forum_ary) . ')' : ''; +				unset($forum_ary, $post_count_ary); -				$num_real_posts = min($user->data['user_posts'], $db->sql_fetchfield('num_posts', 0, $result)); -				$db->sql_freeresult($result); +				if ($post_count_sql) +				{ +					// Grab all the relevant data +					$sql = 'SELECT COUNT(p.post_id) AS num_posts    +						FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f +						WHERE p.poster_id = ' . $user->data['user_id'] . "  +							AND f.forum_id = p.forum_id  +							$post_count_sql"; +					$result = $db->sql_query($sql); -				$sql = 'SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts    -					FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f  -					WHERE p.poster_id = ' . $user->data['user_id'] . "  -						AND f.forum_id = p.forum_id  -						$post_count_sql -					GROUP BY f.forum_id, f.forum_name   -					ORDER BY num_posts DESC";  -				$result = $db->sql_query_limit($sql, 1); +					$num_real_posts = min($user->data['user_posts'], $db->sql_fetchfield('num_posts', 0, $result)); +					$db->sql_freeresult($result); -				$active_f_row = $db->sql_fetchrow($result); -				$db->sql_freeresult($result); +					$sql = 'SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts    +						FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f  +						WHERE p.poster_id = ' . $user->data['user_id'] . "  +							AND f.forum_id = p.forum_id  +							$post_count_sql +						GROUP BY f.forum_id, f.forum_name   +						ORDER BY num_posts DESC";  +					$result = $db->sql_query_limit($sql, 1); -				$sql = 'SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts    -					FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f   -					WHERE p.poster_id = ' . $user->data['user_id'] . "  -						AND t.topic_id = p.topic_id   -						AND f.forum_id = t.forum_id  -						$post_count_sql -					GROUP BY t.topic_id, t.topic_title   -					ORDER BY num_posts DESC"; -				$result = $db->sql_query_limit($sql, 1); - -				$active_t_row = $db->sql_fetchrow($result); -				$db->sql_freeresult($result); +					$active_f_row = $db->sql_fetchrow($result); +					$db->sql_freeresult($result); + +					$sql = 'SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts    +						FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f   +						WHERE p.poster_id = ' . $user->data['user_id'] . "  +							AND t.topic_id = p.topic_id   +							AND f.forum_id = t.forum_id  +							$post_count_sql +						GROUP BY t.topic_id, t.topic_title   +						ORDER BY num_posts DESC"; +					$result = $db->sql_query_limit($sql, 1); + +					$active_t_row = $db->sql_fetchrow($result); +					$db->sql_freeresult($result); +				} +				else +				{ +					$num_real_posts = 0; +					$active_f_row = $active_t_row = array(); +				}  				// Do the relevant calculations   				$memberdays = max(1, round((time() - $user->data['user_regdate']) / 86400)); @@ -210,7 +233,6 @@ class ucp_main extends module  				$template->assign_vars(array(  					'USER_COLOR'		=> (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '',  -					'RANK_TITLE'		=> $rank_title,   					'KARMA'				=> ($config['enable_karma']) ? $user->lang['KARMA'][$user->data['user_karma']] : '',   					'JOINED'			=> $user->format_date($user->data['user_regdate'], $user->lang['DATE_FORMAT']),  					'VISITED'			=> (empty($last_visit)) ? ' - ' : $user->format_date($last_visit, $user->lang['DATE_FORMAT']), @@ -231,7 +253,7 @@ class ucp_main extends module  					'KARMA_LEFT_IMG'	=> $user->img('karma_left', ''),  					'KARMA_RIGHT_IMG'	=> $user->img('karma_right', ''), -					'S_GROUP_OPTIONS'	=> $group_options,  +//					'S_GROUP_OPTIONS'	=> $group_options,   					'U_SEARCH_USER'		=> ($auth->acl_get('u_search')) ? "search.$phpEx$SID&search_author=" . urlencode($user->data['username']) . "&show_results=posts" : '',    					'U_ACTIVE_FORUM'	=> "viewforum.$phpEx$SID&f=$active_f_id", @@ -674,11 +696,11 @@ class ucp_main extends module  		$template->assign_vars(array(  -			'L_TITLE'	=> $user->lang['UCP_' . strtoupper($mode)], +			'L_TITLE'			=> $user->lang['UCP_MAIN_' . strtoupper($mode)], -			'S_DISPLAY_MARK_ALL'				=> ($mode == 'watched' || ($mode == 'drafts' && !isset($_GET['edit']))) ? true : false,  -			'S_HIDDEN_FIELDS'					=> $s_hidden_fields, -			'S_UCP_ACTION'						=> $phpbb_root_path . "ucp.$phpEx$SID&i=$id&mode=$mode") +			'S_DISPLAY_MARK_ALL'=> ($mode == 'watched' || ($mode == 'drafts' && !isset($_GET['edit']))) ? true : false,  +			'S_HIDDEN_FIELDS'	=> (isset($s_hidden_fields)) ? $s_hidden_fields : '', +			'S_UCP_ACTION'		=> $phpbb_root_path . "ucp.$phpEx$SID&i=$id&mode=$mode")  		);  		$this->display($user->lang['UCP_MAIN'], 'ucp_main_' . $mode . '.html'); diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index c2ebef5438..f73157d1cd 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -350,7 +350,7 @@ class ucp_prefs extends module  		}  		$template->assign_vars(array(  -			'L_TITLE'			=> $user->lang['UCP_' . strtoupper($mode)], +			'L_TITLE'			=> $user->lang['UCP_PREFS_' . strtoupper($mode)],  			'S_HIDDEN_FIELDS'	=> $s_hidden_fields,  			'S_UCP_ACTION'		=> "ucp.$phpEx$SID&i=$id&mode=$mode") diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index f404536b42..0ac721b1be 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -631,7 +631,7 @@ class ucp_profile extends module  		}  		$template->assign_vars(array( -			'L_TITLE'	=> $user->lang['UCP_' . strtoupper($mode)], +			'L_TITLE'	=> $user->lang['UCP_PROFILE_' . strtoupper($mode)],  			'S_HIDDEN_FIELDS'	=> $s_hidden_fields,  			'S_UCP_ACTION'		=> "ucp.$phpEx$SID&i=$id&mode=$mode")  | 
