diff options
42 files changed, 550 insertions, 101 deletions
diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php index f81ec46579..87e676b8ff 100644 --- a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php +++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php @@ -24,6 +24,23 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff  		return array(T_USE);  	} +	protected function check($found_name, $full_name, $short_name, $line) +	{ + +		if ($found_name === $full_name) +		{ +			$error = 'Either use statement or full name must be used.'; +			$phpcsFile->addError($error, $line, 'FullName'); +		} + +		if ($found_name === $short_name) +		{ +			return true; +		} + +		return false; +	} +  	/**  	* {@inheritdoc}  	*/ @@ -74,16 +91,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff  				$simple_class_name = trim($phpcsFile->getTokensAsString($simple_class_name_start, ($simple_class_name_end - $simple_class_name_start))); -				if ($simple_class_name === $class_name_full) -				{ -					$error = 'Either use statement or full name must be used.'; -					$phpcsFile->addError($error, $simple_statement, 'FullName'); -				} - -				if ($simple_class_name === $class_name_short) -				{ -					$ok = true; -				} +				$ok = $this->check($simple_class_name, $class_name_full, $class_name_short, $simple_statement) ? true : $ok;  			}  		} @@ -98,16 +106,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff  			$paamayim_nekudotayim_class_name = trim($phpcsFile->getTokensAsString($paamayim_nekudotayim_class_name_start + 1, ($paamayim_nekudotayim_class_name_end - $paamayim_nekudotayim_class_name_start))); -			if ($paamayim_nekudotayim_class_name === $class_name_full) -			{ -				$error = 'Either use statement or full name must be used.'; -				$phpcsFile->addError($error, $paamayim_nekudotayim, 'FullName'); -			} - -			if ($paamayim_nekudotayim_class_name === $class_name_short) -			{ -				$ok = true; -			} +			$ok = $this->check($paamayim_nekudotayim_class_name, $class_name_full, $class_name_short, $paamayim_nekudotayim) ? true : $ok;  		}  		// Checks in implements @@ -126,16 +125,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff  				$implements_class_name = trim($phpcsFile->getTokensAsString($implements_class_name_start, ($implements_class_name_end - $implements_class_name_start))); -				if ($implements_class_name === $class_name_full) -				{ -					$error = 'Either use statement or full name must be used.'; -					$phpcsFile->addError($error, $implements, 'FullName'); -				} - -				if ($implements_class_name === $class_name_short) -				{ -					$ok = true; -				} +				$ok = $this->check($implements_class_name, $class_name_full, $class_name_short, $implements) ? true : $ok;  			}  		} @@ -145,34 +135,64 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff  		{  			$old_function_declaration = $function_declaration; -			$end_function = $phpcsFile->findNext(array(T_CLOSE_PARENTHESIS), ($function_declaration + 1)); -			$old_argument = $function_declaration; -			while (($argument = $phpcsFile->findNext(T_VARIABLE, ($old_argument + 1), $end_function)) !== false) +			// Check docblocks +			$find = array( +				T_COMMENT, +				T_DOC_COMMENT, +				T_CLASS, +				T_FUNCTION, +				T_OPEN_TAG, +			); + +			$comment_end = $phpcsFile->findPrevious($find, ($function_declaration - 1)); +			if ($comment_end !== false)  			{ -				$old_argument = $argument; - -				$start_argument = $phpcsFile->findPrevious(array(T_OPEN_PARENTHESIS, T_COMMA), $argument); -				$argument_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($start_argument + 1), $argument); - -				// Skip the parameter if no type is defined. -				if ($argument_class_name_start !== false) +				if (!$tokens[$comment_end]['code'] !== T_DOC_COMMENT)  				{ -					$argument_class_name_end = $phpcsFile->findNext($find, ($argument_class_name_start + 1), null, true); - -					$argument_class_name = $phpcsFile->getTokensAsString($argument_class_name_start, ($argument_class_name_end - $argument_class_name_start - 1)); +					$comment_start = ($phpcsFile->findPrevious(T_DOC_COMMENT, ($comment_end - 1), null, true) + 1); +					$comment      = $phpcsFile->getTokensAsString($comment_start, ($comment_end - $comment_start + 1)); -					if ($argument_class_name === $class_name_full) +					try  					{ -						$error = 'Either use statement or full name must be used.'; -						$phpcsFile->addError($error, $function_declaration, 'FullName'); +						$comment_parser = new PHP_CodeSniffer_CommentParser_FunctionCommentParser($comment, $phpcsFile); +						$comment_parser->parse(); + +						// Check @param +						foreach ($comment_parser->getParams() as $param) { +							$type = $param->getType(); +							$types = explode('|', str_replace('[]', '', $type)); +							foreach ($types as $type) +							{ +								$ok = $this->check($type, $class_name_full, $class_name_short, $param->getLine() + $comment_start) ? true : $ok; +							} +						} + +						// Check @return +						$return = $comment_parser->getReturn(); +						if ($return !== null) +						{ +							$type = $return->getValue(); +							$types = explode('|', str_replace('[]', '', $type)); +							foreach ($types as $type) +							{ +								$ok = $this->check($type, $class_name_full, $class_name_short, $return->getLine() + $comment_start) ? true : $ok; +							} +						}  					} - -					if ($argument_class_name === $class_name_short) +					catch (PHP_CodeSniffer_CommentParser_ParserException $e)  					{ -						$ok = true; +						$line = ($e->getLineWithinComment() + $comment_start); +						$phpcsFile->addError($e->getMessage(), $line, 'FailedParse');  					}  				}  			} + +			// Check type hint +			$params = $phpcsFile->getMethodParameters($function_declaration); +			foreach ($params as $param) +			{ +				$ok = $this->check($param['type_hint'], $class_name_full, $class_name_short, $function_declaration) ? true : $ok; +			}  		}  		if (!$ok) diff --git a/phpBB/docs/FAQ.html b/phpBB/docs/FAQ.html index d9ba651032..cd1ec4ae14 100644 --- a/phpBB/docs/FAQ.html +++ b/phpBB/docs/FAQ.html @@ -243,7 +243,7 @@ I want to sue you because i think you host an illegal board!</h2>  		<div class="content"> -<p>Please read the paragraph about permissions in our extensive <a href="https://www.phpbb.com/support/documentation/3.0/">online documentation</a>.</p> +<p>Please read the paragraph about permissions in our extensive <a href="https://www.phpbb.com/support/docs/en/3.1/ug/">online documentation</a>.</p>  		</div> @@ -299,7 +299,7 @@ I want to sue you because i think you host an illegal board!</h2>  		<div class="content"> -<p>Please read our <a href="https://www.phpbb.com/support/documentation/3.0/">extensive user documentation</a> first, it may just explain what you want to know.</p> +<p>Please read our <a href="https://www.phpbb.com/support/docs/en/3.1/ug/">extensive user documentation</a> first, it may just explain what you want to know.</p>  <p>Feel free to search our community forum for the information you require. <strong>PLEASE DO NOT</strong> post your question without having first used search, chances are someone has already asked and answered your question. You can find our board here:</p> diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 80e09f1bf9..534d9eff73 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -39,7 +39,7 @@  <p>This document will walk you through the basics on installing, updating and converting the forum software.</p> -<p>A basic overview of running phpBB can be found in the accompanying <a href="README.html">README</a> file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB you should read <a href="https://www.phpbb.com/support/documentation/3.0/">the documentation</a> available online.</p> +<p>A basic overview of running phpBB can be found in the accompanying <a href="README.html">README</a> file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB you should read <a href="https://www.phpbb.com/support/docs/en/3.1/ug/">the documentation</a> available online.</p>  <h1>Install</h1> diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 77d5d33115..b66f47178e 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -134,7 +134,7 @@  	<p>Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included <code>language</code> and <code>styles</code> folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: <code>Customise tab -> Language management -> Language packs</code>. A more detailed description of the process is in the Knowledge Base article, <a href="https://www.phpbb.com/kb/article/how-to-install-a-language-pack/">How to Install a Language Pack</a>.</p> -	<p>If your language is not available, please visit our <a href="https://www.phpbb.com/community/viewforum.php?f=66">[3.0.x] Translations</a> forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can <a href="https://www.phpbb.com/languages/apply.php">Apply to become a translator</a>.</p> +	<p>If your language is not available, please visit our <a href="https://www.phpbb.com/community/viewforum.php?f=491">[3.1.x] Translations</a> forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can <a href="https://www.phpbb.com/languages/apply.php">Apply to become a translator</a>.</p>  	<a name="styles"></a><h3>2.ii. Styles</h3> @@ -150,7 +150,7 @@  	<a name="extensions"></a><h3>2.iii. Extensions</h3> -	<p>We are proud to have a thriving extensions community. These third party extensions to the standard phpBB software, extend its capabilities still further. You can browse through many of the extensions in the <a href="https://www.phpbb.com/customise/db/extensions-27/">Extensions</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> +	<p>We are proud to have a thriving extensions community. These third party extensions to the standard phpBB software, extend its capabilities still further. You can browse through many of the extensions in the <a href="https://www.phpbb.com/customise/db/extensions-36">Extensions</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p>  	<p>For more information about extensions, please see: <a href="https://www.phpbb.com/extensions">https://www.phpbb.com/extensions</a></p> @@ -180,7 +180,7 @@  	<p>Comprehensive documentation is now available on the phpBB website:</p> -	<p><a href="https://www.phpbb.com/support/documentation/3.0/">https://www.phpbb.com/support/documentation/3.0/</a></p> +	<p><a href="https://www.phpbb.com/support/docs/en/3.1/ug/">https://www.phpbb.com/support/docs/en/3.1/ug/</a></p>  	<p>This covers everything from installation to setting permissions and managing users.</p> diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 7863814daa..fd4241a759 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -456,6 +456,46 @@ mcp_ban_unban_before  * Since: 3.1.0-RC3  * Purpose: Add additional fields to the unban form in MCP +mcp_front_latest_logs_after +=== +* Locations: +    + styles/prosilver/template/mcp_front.html +    + styles/subsilver2/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content after latest logs list + +mcp_front_latest_logs_before +=== +* Locations: +    + styles/prosilver/template/mcp_front.html +    + styles/subsilver2/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content before latest logs list + +mcp_front_latest_reported_before +=== +* Locations: +    + styles/prosilver/template/mcp_front.html +    + styles/subsilver2/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content before latest reported posts list + +mcp_front_latest_reported_pms_before +=== +* Locations: +    + styles/prosilver/template/mcp_front.html +    + styles/subsilver2/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content before latest reported private messages list + +mcp_front_latest_unapproved_before +=== +* Locations: +    + styles/prosilver/template/mcp_front.html +    + styles/subsilver2/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content before latest unapproved posts list +  memberlist_body_username_append  ===  * Locations: @@ -635,6 +675,14 @@ overall_footer_after  * Since: 3.1.0-a1  * Purpose: Add content at the end of the file, directly prior to the `</body>` tag +overall_footer_body_after +=== +* Locations: +    + styles/prosilver/template/overall_footer.html +    + styles/subsilver2/template/overall_footer.html +* Since: 3.1.3-RC1 +* Purpose: Add content before the `</body>` tag but after the $SCRIPTS var, i.e. after the js scripts have been loaded +  overall_footer_breadcrumb_append  ===  * Locations: diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 4fefd6bec3..4671a026eb 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -40,6 +40,7 @@ class acp_email  		$error = array();  		$usernames	= request_var('usernames', '', true); +		$usernames	= explode("\n", $usernames);  		$group_id	= request_var('g', 0);  		$subject	= utf8_normalize_nfc(request_var('subject', '', true));  		$message	= utf8_normalize_nfc(request_var('message', '', true)); @@ -69,7 +70,7 @@ class acp_email  			if (!sizeof($error))  			{ -				if ($usernames) +				if (!empty($usernames))  				{  					// If giving usernames the admin is able to email inactive users too...  					$sql_ary = array( @@ -77,7 +78,7 @@ class acp_email  						'FROM'		=> array(  							USERS_TABLE		=> '',  						), -						'WHERE'		=> $db->sql_in_set('username_clean', array_map('utf8_clean_string', explode("\n", $usernames))) . ' +						'WHERE'		=> $db->sql_in_set('username_clean', array_map('utf8_clean_string', $usernames)) . '  							AND user_allow_massemail = 1',  						'ORDER_BY'	=> 'user_lang, user_notify_type',  					); @@ -194,6 +195,39 @@ class acp_email  				$errored = false; +				$email_template = 'admin_send_email'; +				$template_data = array( +					'CONTACT_EMAIL' => phpbb_get_board_contact($config, $phpEx), +					'MESSAGE'		=> htmlspecialchars_decode($message), +				); +				$generate_log_entry = true; + +				/** +				* Modify email template data before the emails are sent +				* +				* @event core.acp_email_send_before +				* @var	string	email_template		The template to be used for sending the email +				* @var	string	subject				The subject of the email +				* @var	array	template_data		Array with template data assigned to email template +				* @var	bool	generate_log_entry	If false, no log entry will be created +				* @var	array	usernames			Usernames which will be displayed in log entry, if it will be created +				* @var	int		group_id			The group this email will be sent to +				* @var	bool	use_queue			If true, email queue will be used for sending +				* @var	int		priority			Priority of sent emails +				* @since 3.1.3-RC1 +				*/ +				$vars = array( +					'email_template', +					'subject', +					'template_data', +					'generate_log_entry', +					'usernames', +					'group_id', +					'use_queue', +					'priority', +				); +				extract($phpbb_dispatcher->trigger_event('core.acp_email_send_before', compact($vars))); +  				for ($i = 0, $size = sizeof($email_list); $i < $size; $i++)  				{  					$used_lang = $email_list[$i][0]['lang']; @@ -207,17 +241,14 @@ class acp_email  						$messenger->im($email_row['jabber'], $email_row['name']);  					} -					$messenger->template('admin_send_email', $used_lang); +					$messenger->template($email_template, $used_lang);  					$messenger->anti_abuse_headers($config, $user);  					$messenger->subject(htmlspecialchars_decode($subject));  					$messenger->set_mail_priority($priority); -					$messenger->assign_vars(array( -						'CONTACT_EMAIL' => phpbb_get_board_contact($config, $phpEx), -						'MESSAGE'		=> htmlspecialchars_decode($message)) -					); +					$messenger->assign_vars($template_data);  					if (!($messenger->send($used_method)))  					{ @@ -228,24 +259,26 @@ class acp_email  				$messenger->save_queue(); -				if ($usernames) -				{ -					$usernames = explode("\n", $usernames); -					add_log('admin', 'LOG_MASS_EMAIL', implode(', ', utf8_normalize_nfc($usernames))); -				} -				else +				if ($generate_log_entry)  				{ -					if ($group_id) +					if (!empty($usernames))  					{ -						$group_name = get_group_name($group_id); +						add_log('admin', 'LOG_MASS_EMAIL', implode(', ', utf8_normalize_nfc($usernames)));  					}  					else  					{ -						// Not great but the logging routine doesn't cope well with localising on the fly -						$group_name = $user->lang['ALL_USERS']; -					} +						if ($group_id) +						{ +							$group_name = get_group_name($group_id); +						} +						else +						{ +							// Not great but the logging routine doesn't cope well with localising on the fly +							$group_name = $user->lang['ALL_USERS']; +						} -					add_log('admin', 'LOG_MASS_EMAIL', $group_name); +						add_log('admin', 'LOG_MASS_EMAIL', $group_name); +					}  				}  				if (!$errored) @@ -286,7 +319,7 @@ class acp_email  			'WARNING_MSG'			=> (sizeof($error)) ? implode('<br />', $error) : '',  			'U_ACTION'				=> $this->u_action,  			'S_GROUP_OPTIONS'		=> $select_list, -			'USERNAMES'				=> $usernames, +			'USERNAMES'				=> implode("\n", $usernames),  			'U_FIND_USERNAME'		=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_email&field=usernames'),  			'SUBJECT'				=> $subject,  			'MESSAGE'				=> $message, diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 31b033604d..881e50dd5a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -173,6 +173,21 @@ class acp_users  				$delete_type	= request_var('delete_type', '');  				$ip				= request_var('ip', 'ip'); +				/** +				 * Run code at beginning of ACP users overview +				 * +				 * @event core.acp_users_overview_before +				 * @var	array   user_row    Current user data +				 * @var	string  mode        Active module +				 * @var	string  action      Module that should be run +				 * @var	bool    submit      Do we display the form only +				 *                          or did the user press submit +				 * @var	array   error       Array holding error messages +				 * @since 3.1.3-RC1 +				 */ +				$vars = array('user_row', 'mode', 'action', 'submit', 'error'); +				extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_before', compact($vars))); +  				if ($submit)  				{  					if ($delete) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 1a3560dbb1..a016f8e62a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2922,6 +2922,19 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa  			break;  		} + +		/** +		 * This event allows an extension to process when a user fails a login attempt +		 * +		 * @event core.login_box_failed +		 * @var array   result      Login result data +		 * @var string  username    User name used to login +		 * @var string  password    Password used to login +		 * @var string  err         Error message +		 * @since 3.1.3-RC1 +		 */ +		$vars = array('result', 'username', 'password', 'err'); +		extract($phpbb_dispatcher->trigger_event('core.login_box_failed', compact($vars)));  	}  	// Assign credential for username/password pair diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 0b9ea23fe7..b016659541 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2311,7 +2311,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  */  function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true)  { -	global $db; +	global $db, $phpbb_dispatcher;  	if (!is_array($forum_id))  	{ @@ -2351,6 +2351,21 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync  		$sql_and .= ' AND topic_status = ' . ITEM_MOVED . " AND topic_last_post_time < $prune_date";  	} +	/** +	* Use this event to modify the SQL that selects topics to be pruned +	* +	* @event core.prune_sql +	* @var string	forum_id		The forum id +	* @var string	prune_mode		The prune mode +	* @var string	prune_date		The prune date +	* @var int		prune_flags		The prune flags +	* @var bool		auto_sync		Whether or not to perform auto sync +	* @var string	sql_and			SQL text appended to where clause +	* @since 3.1.3-RC1 +	*/ +	$vars = array('forum_id', 'prune_mode', 'prune_date', 'prune_flags', 'auto_sync', 'sql_and'); +	extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars))); +  	$sql = 'SELECT topic_id  		FROM ' . TOPICS_TABLE . '  		WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 9d480692e9..61ab4721c4 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -2148,6 +2148,7 @@ function fix_empty_primary_groups()  	}  	$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('global_moderators'); +	$result = $db->sql_query($sql);  	$user_ids = array();  	while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 17161b5eae..6a892a7373 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -2014,7 +2014,7 @@ class install_convert extends module  					{  						$value = $fields[1][$firstkey];  					} -					else if (is_array($fields[2])) +					else if (is_array($fields[2]) && !is_callable($fields[2]))  					{  						// Execute complex function/eval/typecast  						$value = $fields[1]; diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ea51e5df76..7efbd3166c 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -805,7 +805,7 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len  INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_aol', 'profilefields.type.string', 'phpbb_aol', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 5, 1, '', '');  INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_icq', 'profilefields.type.string', 'phpbb_icq', '20', '3', '15', '', '', '[0-9]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 6, 1, 'SEND_ICQ_MESSAGE', 'https://www.icq.com/people/%s/');  INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_wlm', 'profilefields.type.string', 'phpbb_wlm', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 7, 1, '', ''); -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'ymsgr:sendim?%s');  INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_facebook', 'profilefields.type.string', 'phpbb_facebook', '20', '5', '50', '', '', '[\w.]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 9, 1, 'VIEW_FACEBOOK_PROFILE', 'http://facebook.com/%s/');  INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s');  INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_skype', 'profilefields.type.string', 'phpbb_skype', '20', '6', '32', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 11, 1, 'VIEW_SKYPE_PROFILE', 'skype:%s?userinfo'); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 91fc1215fc..fdbc4aebd0 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -558,6 +558,7 @@ $lang = array_merge($lang, array(  	'LOG_LOCK_POST'				=> '<strong>Locked post</strong><br />» %s',  	'LOG_MERGE'					=> '<strong>Merged posts</strong> into topic<br />» %s',  	'LOG_MOVE'					=> '<strong>Moved topic</strong><br />» from %1$s to %2$s', +	'LOG_MOVED_TOPIC'			=> '<strong>Moved topic</strong><br />» %s',  	'LOG_PM_REPORT_CLOSED'		=> '<strong>Closed PM report</strong><br />» %s',  	'LOG_PM_REPORT_DELETED'		=> '<strong>Deleted PM report</strong><br />» %s',  	'LOG_POST_APPROVED'			=> '<strong>Approved post</strong><br />» %s', diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index 8654a9e88c..1ade2d6eb8 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -54,7 +54,7 @@ $lang = array_merge($lang, array(  		<br /> -		<p>For further information on setting up and managing permissions on your phpBB3 board, please see <a href="https://www.phpbb.com/support/documentation/3.0/quickstart/quick_permissions.html">Chapter 1.5 of our Quick Start Guide</a>.</p> +		<p>For further information on setting up and managing permissions on your phpBB3 board, please see the section on <a href="https://www.phpbb.com/support/docs/en/3.1/ug/quickstart/permissions/">Setting permissions of our Quick Start Guide</a>.</p>  	',  	'ACL_NEVER'				=> 'Never', diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php index 98412cb050..bda965b615 100644 --- a/phpBB/language/en/acp/search.php +++ b/phpBB/language/en/acp/search.php @@ -84,7 +84,7 @@ $lang = array_merge($lang, array(  	'FULLTEXT_SPHINX_WRONG_DATABASE'		=> 'The sphinx search for phpBB supports MySQL and PostgreSQL only.',  	'FULLTEXT_SPHINX_CONFIG_FILE'			=> 'Sphinx config file',  	'FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'	=> 'The generated content of the sphinx config file. This data needs to be pasted into the sphinx.conf which is used by sphinx search daemon. Replace the [dbuser] and [dbpassword] placeholders with your database credentials.', -	'FULLTEXT_SPHINX_NO_CONFIG_DATA'		=> 'The sphinx data and config directory paths are not defined. Please define them to generate the config file.', +	'FULLTEXT_SPHINX_NO_CONFIG_DATA'		=> 'The sphinx data directory path is not defined. Please define the path and submit to generate the config file.',  	'GENERAL_SEARCH_SETTINGS'				=> 'General search settings',  	'GO_TO_SEARCH_INDEX'					=> 'Go to search index page', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 107de9c64f..dd22e84fcb 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -80,7 +80,7 @@ $lang = array_merge($lang, array(  	'CONTINUE_OLD_CONVERSION'	=> 'Continue previously started conversion',  	'CONVERT'					=> 'Convert',  	'CONVERT_COMPLETE'			=> 'Conversion completed', -	'CONVERT_COMPLETE_EXPLAIN'	=> 'You have now successfully converted your board to phpBB 3.1. You can now login and <a href="../">access your board</a>. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the <a href="https://www.phpbb.com/support/documentation/3.0/">Documentation</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=46">support forums</a>.', +	'CONVERT_COMPLETE_EXPLAIN'	=> 'You have now successfully converted your board to phpBB 3.1. You can now login and <a href="../">access your board</a>. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the <a href="https://www.phpbb.com/support/docs/en/3.1/ug/">Documentation</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=466">support forums</a>.',  	'CONVERT_INTRO'				=> 'Welcome to the phpBB Unified Convertor Framework',  	'CONVERT_INTRO_BODY'		=> 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.',  	'CONVERT_NEW_CONVERSION'	=> 'New conversion', @@ -192,7 +192,7 @@ $lang = array_merge($lang, array(  		<h2>Convert an existing board to phpBB3</h2>  		<p>The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please <a href="%2$s">proceed to the convertor</a>.</p>  		<h2>Go live with your phpBB3!</h2> -		<p>Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the <a href="https://www.phpbb.com/support/documentation/3.0/">Documentation</a>, <a href="%3$s">README</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=46">Support Forums</a>.</p><p><strong>Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.</strong>', +		<p>Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the <a href="https://www.phpbb.com/support/docs/en/3.1/ug/">Documentation</a>, <a href="%3$s">README</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=466">Support Forums</a>.</p><p><strong>Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.</strong>',  	'INSTALL_INTRO'				=> 'Welcome to Installation',  	'INSTALL_INTRO_BODY'		=> 'With this option, it is possible to install phpBB3 onto your server.</p><p>In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:</p> @@ -274,7 +274,7 @@ $lang = array_merge($lang, array(  	'MAKE_FOLDER_WRITABLE'		=> 'Please make sure that this folder exists and is writable by the webserver then try again:<br />»<strong>%s</strong>.',  	'MAKE_FOLDERS_WRITABLE'		=> 'Please make sure that these folders exist and are writable by the webserver then try again:<br />»<strong>%s</strong>.', -	'MYSQL_SCHEMA_UPDATE_REQUIRED'	=> 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.<br /><strong>Before you proceed the update, you need to upgrade the schema.</strong><br /><br />Please refer to the <a href="https://www.phpbb.com/kb/article/doesnt-have-a-default-value-errors/">Knowledge Base article about upgrading the MySQL schema</a>. If you encounter problems, please use <a href="https://www.phpbb.com/community/viewforum.php?f=46">our support forums</a>.', +	'MYSQL_SCHEMA_UPDATE_REQUIRED'	=> 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.<br /><strong>Before you proceed the update, you need to upgrade the schema.</strong><br /><br />Please refer to the <a href="https://www.phpbb.com/kb/article/doesnt-have-a-default-value-errors/">Knowledge Base article about upgrading the MySQL schema</a>. If you encounter problems, please use <a href="https://www.phpbb.com/community/viewforum.php?f=466">our support forums</a>.',  	'NAMING_CONFLICT'			=> 'Naming conflict: %s and %s are both aliases<br /><br />%s',  	'NEXT_STEP'					=> 'Proceed to next step', @@ -345,7 +345,7 @@ $lang = array_merge($lang, array(  	'SUB_LICENSE'				=> 'License',  	'SUB_SUPPORT'				=> 'Support',  	'SUCCESSFUL_CONNECT'		=> 'Successful connection', -	'SUPPORT_BODY'				=> 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:</p><ul><li>installation</li><li>configuration</li><li>technical questions</li><li>problems relating to potential bugs in the software</li><li>updating from Release Candidate (RC) versions to the latest stable version</li><li>converting from phpBB 2.0.x to phpBB3</li><li>converting from other discussion board software to phpBB3 (please see the <a href="https://www.phpbb.com/community/viewforum.php?f=486">Convertors Forum</a>)</li></ul><p>We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.</p><h2>Extensions / Styles</h2><p>For issues relating to Extensions, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=451">Extensions Forum</a>.<br />For issues relating to styles, templates and themes, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=471">Styles Forum</a>.<br /><br />If your question relates to a specific package, please post directly in the topic dedicated to the package.</p><h2>Obtaining Support</h2><p><a href="https://www.phpbb.com/community/viewtopic.php?f=14&t=571070">The phpBB Welcome Package</a><br /><a href="https://www.phpbb.com/support/">Support Section</a><br /><a href="https://www.phpbb.com/support/documentation/3.1/quickstart/">Quick Start Guide</a><br /><br />To ensure you stay up to date with the latest news and releases, why not <a href="https://www.phpbb.com/support/">subscribe to our mailing list</a>?<br /><br />', +	'SUPPORT_BODY'				=> 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:</p><ul><li>installation</li><li>configuration</li><li>technical questions</li><li>problems relating to potential bugs in the software</li><li>updating from Release Candidate (RC) versions to the latest stable version</li><li>converting from phpBB 2.0.x to phpBB3</li><li>converting from other discussion board software to phpBB3 (please see the <a href="https://www.phpbb.com/community/viewforum.php?f=486">Convertors Forum</a>)</li></ul><p>We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.</p><h2>Extensions / Styles</h2><p>For issues relating to Extensions, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=451">Extensions Forum</a>.<br />For issues relating to styles, templates and themes, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=471">Styles Forum</a>.<br /><br />If your question relates to a specific package, please post directly in the topic dedicated to the package.</p><h2>Obtaining Support</h2><p><a href="https://www.phpbb.com/community/viewtopic.php?f=14&t=571070">The phpBB Welcome Package</a><br /><a href="https://www.phpbb.com/support/">Support Section</a><br /><a href="https://www.phpbb.com/support/docs/en/3.1/ug/quickstart/">Quick Start Guide</a><br /><br />To ensure you stay up to date with the latest news and releases, why not <a href="https://www.phpbb.com/support/">subscribe to our mailing list</a>?<br /><br />',  	'SYNC_FORUMS'				=> 'Starting to synchronise forums',  	'SYNC_POST_COUNT'			=> 'Synchronising post_counts',  	'SYNC_POST_COUNT_ID'		=> 'Synchronising post_counts from <var>entry</var> %1$s to %2$s.', diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 25765b1af7..f9d46db528 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -137,6 +137,28 @@ if ($forum_id && !$auth->acl_get('f_read', $forum_id))  	trigger_error('NOT_AUTHORISED');  } +/** +* Allow applying additional permissions to MCP access besides f_read +* +* @event core.mcp_global_f_read_auth_after +* @var	string		action			The action the user tried to execute +* @var	int			forum_id		The forum the user tried to access +* @var	string		mode			The MCP module the user is trying to access +* @var	p_master	module			Module system class +* @var	bool		quickmod		True if the user is accessing using quickmod tools +* @var	int			topic_id		The topic the user tried to access +* @since 3.1.3-RC1 +*/ +$vars = array( +	'action', +	'forum_id', +	'mode', +	'module', +	'quickmod', +	'topic_id', +); +extract($phpbb_dispatcher->trigger_event('core.mcp_global_f_read_auth_after', compact($vars))); +  if ($forum_id)  {  	$module->acl_forum_id = $forum_id; diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 5a5be6f761..e64dab635b 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -173,6 +173,22 @@ switch ($mode)  			'ORDER_BY'	=> 'u.username_clean ASC',  		); +		/** +		 * Modify the query used to get the users for the team page +		 * +		 * @event core.memberlist_team_modify_query +		 * @var array	sql_ary			Array containing the query +		 * @var array	group_ids		Array of group ids +		 * @var array	teampage_data	The teampage data +		 * @since 3.1.3-RC1 +		 */ +		$vars = array( +			'sql_ary', +			'group_ids', +			'teampage_data', +		); +		extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_query', compact($vars))); +  		$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));  		$user_ary = $user_ids = $group_users = array(); @@ -285,7 +301,7 @@ switch ($mode)  						$user_rank_data = phpbb_get_user_rank($row, (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts'])); -						$template->assign_block_vars('group.user', array( +						$template_vars = array(  							'USER_ID'		=> $row['user_id'],  							'FORUMS'		=> $row['forums'],  							'FORUM_OPTIONS'	=> (isset($row['forums_options'])) ? true : false, @@ -304,7 +320,25 @@ switch ($mode)  							'USERNAME'			=> get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),  							'USER_COLOR'		=> get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),  							'U_VIEW_PROFILE'	=> get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), -						)); +						); + +						/** +						 * Modify the template vars for displaying the user in the groups on the teampage +						 * +						 * @event core.memberlist_team_modify_template_vars +						 * @var array	template_vars		Array containing the query +						 * @var array	row					Array containing the action user row +						 * @var array	groups_ary			Array of groups with all users that should be displayed +						 * @since 3.1.3-RC1 +						 */ +						$vars = array( +							'template_vars', +							'row', +							'groups_ary', +						); +						extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_template_vars', compact($vars))); + +						$template->assign_block_vars('group.user', $template_vars);  						if ($config['teampage_memberships'] != 2)  						{ diff --git a/phpBB/phpbb/db/migration/data/v31x/profilefield_yahoo_update_url.php b/phpBB/phpbb/db/migration/data/v31x/profilefield_yahoo_update_url.php new file mode 100644 index 0000000000..4df9083bdf --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/profilefield_yahoo_update_url.php @@ -0,0 +1,38 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class profilefield_yahoo_update_url extends \phpbb\db\migration\migration +{ +	static public function depends_on() +	{ +		return array('\phpbb\db\migration\data\v31x\v312'); +	} + +	public function update_data() +	{ +		return array( +			array('custom', array(array($this, 'update_contact_url'))), +		); +	} + +	public function update_contact_url() +	{ +		$sql = 'UPDATE ' . $this->table_prefix . "profile_fields +			SET field_contact_url = 'ymsgr:sendim?%s' +			WHERE field_name = 'phpbb_yahoo' +				AND field_contact_url = 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg'"; +		$this->sql_query($sql); +	} +} diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index c8d25f23a2..f523b39fb3 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -2175,7 +2175,7 @@ class tools  				}  			// no break  			case 'mysql_41': -				$statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . '(' . implode(', ', $column) . ')'; +				$statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . ' (' . implode(', ', $column) . ')';  			break;  			case 'mssql': diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 2af8b50b54..0c5205530b 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -708,6 +708,50 @@ class log implements \phpbb\log\log_interface  			}  		} +		/** +		* Allow modifying or execute extra final filter on log entries +		* +		* @event core.get_logs_after +		* @var	array	log			Array with all our log entries +		* @var	array	topic_id_list		Array of topic ids, for which we +		*									get the permission data +		* @var	array	reportee_id_list	Array of additional user IDs we +		*									get the username strings for +		* @var	string	mode		Mode of the entries we display +		* @var	bool	count_logs	Do we count all matching entries? +		* @var	int		limit		Limit the number of entries +		* @var	int		offset		Offset when fetching the entries +		* @var	mixed	forum_id	Limit entries to the forum_id, +		*							can also be an array of forum_ids +		* @var	int		topic_id	Limit entries to the topic_id +		* @var	int		user_id		Limit entries to the user_id +		* @var	int		log_time	Limit maximum age of log entries +		* @var	string	sort_by		SQL order option +		* @var	string	keywords	Will only return entries that have the +		*							keywords in log_operation or log_data +		* @var	string	profile_url	URL to the users profile +		* @var	int		log_type	The type of logs it was filtered +		* @since 3.1.3-RC1 +		*/ +		$vars = array( +			'log', +			'topic_id_list', +			'reportee_id_list', +			'mode', +			'count_logs', +			'limit', +			'offset', +			'forum_id', +			'topic_id', +			'user_id', +			'log_time', +			'sort_by', +			'keywords', +			'profile_url', +			'log_type', +		); +		extract($this->dispatcher->trigger_event('core.get_logs_after', compact($vars))); +  		return $log;  	} diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 691d0d5bef..0a6a18ffbe 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1082,7 +1082,7 @@ class session  	*/  	function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false)  	{ -		global $config, $db; +		global $config, $db, $phpbb_dispatcher;  		if (defined('IN_CHECK_BAN') || defined('SKIP_CHECK_BAN'))  		{ @@ -1196,6 +1196,20 @@ class session  		}  		$db->sql_freeresult($result); +		/** +		* Event to set custom ban type +		* +		* @event core.session_set_custom_ban +		* @var	bool		return				If $return is false this routine does not return on finding a banned user, it outputs a relevant message and stops execution +		* @var	bool		banned				Check if user already banned +		* @var	array|false	ban_row				Ban data +		* @var	string		ban_triggered_by	Method that caused ban, can be your custom method +		* @since 3.1.3-RC1 +		*/ +		$ban_row = isset($ban_row) ? $ban_row : false; +		$vars = array('return', 'banned', 'ban_row', 'ban_triggered_by'); +		extract($phpbb_dispatcher->trigger_event('core.session_set_custom_ban', compact($vars))); +  		if ($banned && !$return)  		{  			global $template, $phpbb_root_path, $phpEx; diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 5b71bb5e8a..db3a8e3571 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -115,6 +115,11 @@ class twig extends \phpbb\template\base  			)  		); +		if (defined('DEBUG')) +		{ +			$this->twig->addExtension(new \Twig_Extension_Debug()); +		} +  		$lexer = new \phpbb\template\twig\lexer($this->twig);  		$this->twig->setLexer($lexer); diff --git a/phpBB/posting.php b/phpBB/posting.php index dda7455845..10c3b696e6 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -344,6 +344,48 @@ switch ($mode)  		}  	break;  } +/** +* This event allows you to do extra auth checks and verify if the user +* has the required permissions +* +* Extensions should only change the error and is_authed variables. +* +* @event core.modify_posting_auth +* @var	int		post_id		ID of the post +* @var	int		topic_id	ID of the topic +* @var	int		forum_id	ID of the forum +* @var	int		draft_id	ID of the draft +* @var	int		lastclick	Timestamp of when the form was last loaded +* @var	bool	submit		Whether or not the form has been submitted +* @var	bool	preview		Whether or not the post is being previewed +* @var	bool	save		Whether or not a draft is being saved +* @var	bool	load		Whether or not a draft is being loaded +* @var	bool	refresh		Whether or not to retain previously submitted data +* @var	string	mode		What action to take if the form has been submitted +*							post|reply|quote|edit|delete|bump|smilies|popup +* @var	array	error		Any error strings; a non-empty array aborts +*							form submission. +*							NOTE: Should be actual language strings, NOT +*							language keys. +* @var	bool	is_authed	Does the user have the required permissions? +* @since 3.1.3-RC1 +*/ +$vars = array( +	'post_id', +	'topic_id', +	'forum_id', +	'draft_id', +	'lastclick', +	'submit', +	'preview', +	'save', +	'load', +	'refresh', +	'mode', +	'error', +	'is_authed', +); +extract($phpbb_dispatcher->trigger_event('core.modify_posting_auth', compact($vars)));  if (!$is_authed)  { diff --git a/phpBB/report.php b/phpBB/report.php index 1b5d3c9d46..3ea6bb40c5 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -99,6 +99,24 @@ if ($post_id)  	// Check required permissions  	$acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT'); +	/** +	* This event allows you to do extra auth checks and verify if the user +	* has the required permissions +	* +	* @event core.report_post_auth +	* @var	array	forum_data		All data available from the forums table on this post's forum +	* @var	array	report_data		All data available from the topics and the posts tables on this post (and its topic) +	* @var	array	acl_check_ary	An array with the ACL to be tested. The evaluation is made in the same order as the array is sorted +	*								The key is the ACL name and the value is the language key for the error message. +	* @since 3.1.3-RC1 +	*/ +	$vars = array( +		'forum_data', +		'report_data', +		'acl_check_ary', +	); +	extract($phpbb_dispatcher->trigger_event('core.report_post_auth', compact($vars))); +  	foreach ($acl_check_ary as $acl => $error)  	{  		if (!$auth->acl_get($acl, $forum_id)) diff --git a/phpBB/search.php b/phpBB/search.php index 2598e407cc..164d834ff2 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -311,6 +311,26 @@ if ($keywords || $author || $author_id || $search_id || $submit)  	// define some variables needed for retrieving post_id/topic_id information  	$sort_by_sql = array('a' => 'u.username_clean', 't' => (($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'), 'f' => 'f.forum_id', 'i' => 't.topic_title', 's' => (($show_results == 'posts') ? 'p.post_subject' : 't.topic_title')); +	/** +	* Event to modify the SQL parameters before pre-made searches +	* +	* @event core.search_modify_param_before +	* @var	string	keywords		String of the specified keywords +	* @var	array	sort_by_sql		Array of SQL sorting instructions +	* @var	array	ex_fid_ary		Array of excluded forum ids +	* @var	array	author_id_ary	Array of exclusive author ids +	* @var	string	search_id		The id of the search request +	* @since 3.1.3-RC1 +	*/ +	$vars = array( +		'keywords', +		'sort_by_sql', +		'ex_fid_ary', +		'author_id_ary', +		'search_id', +	); +	extract($phpbb_dispatcher->trigger_event('core.search_modify_param_before', compact($vars))); +  	// pre-made searches  	$sql = $field = $l_search_title = '';  	if ($search_id) diff --git a/phpBB/styles/prosilver/template/mcp_front.html b/phpBB/styles/prosilver/template/mcp_front.html index 44295611cf..8fe7dfdf65 100644 --- a/phpBB/styles/prosilver/template/mcp_front.html +++ b/phpBB/styles/prosilver/template/mcp_front.html @@ -2,6 +2,8 @@  <h2>{PAGE_TITLE}</h2> +<!-- EVENT mcp_front_latest_unapproved_before --> +  <!-- IF S_SHOW_UNAPPROVED -->  	<form id="mcp_queue" method="post" action="{S_MCP_QUEUE_ACTION}"> @@ -59,6 +61,8 @@  		</form>  <!-- ENDIF --> +<!-- EVENT mcp_front_latest_reported_before --> +  <!-- IF S_SHOW_REPORTS -->  	<div class="panel">  		<div class="inner"> @@ -100,6 +104,8 @@  	</div>  <!-- ENDIF --> +<!-- EVENT mcp_front_latest_reported_pms_before --> +  <!-- IF S_SHOW_PM_REPORTS -->  	<div class="panel">  		<div class="inner"> @@ -141,6 +147,8 @@  	</div>  <!-- ENDIF --> +<!-- EVENT mcp_front_latest_logs_before --> +  <!-- IF S_SHOW_LOGS -->  	<div class="panel">  		<div class="inner"> @@ -180,4 +188,6 @@  	</div>  <!-- ENDIF --> +<!-- EVENT mcp_front_latest_logs_after --> +  <!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 275859ac97..6f35d0e80b 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -48,5 +48,7 @@  <!-- IF S_PLUPLOAD --><!-- INCLUDE plupload.html --><!-- ENDIF -->  {$SCRIPTS} +<!-- EVENT overall_footer_body_after --> +  </body>  </html> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index ad08c1220b..121094f6e0 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -1,7 +1,7 @@  <!DOCTYPE html>  <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">  <head> -<meta charset="utf-8"> +<meta charset="utf-8" />  <meta name="viewport" content="width=device-width" />  {META}  <title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 6d22a074be..a0c7bc68bb 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -1,7 +1,7 @@  <!DOCTYPE html>  <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">  <head> -<meta charset="utf-8"> +<meta charset="utf-8" />  <meta name="viewport" content="width=device-width" />  {META}  <title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html index ce0f4941a5..7fe0d67077 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -1,7 +1,7 @@  <!DOCTYPE html>  <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">  <head> -<meta charset="utf-8"> +<meta charset="utf-8" />  <meta name="robots" content="noindex" />  {META}  <title>{SITENAME} • {PAGE_TITLE}</title> diff --git a/phpBB/styles/prosilver/template/viewtopic_print.html b/phpBB/styles/prosilver/template/viewtopic_print.html index 5c44f58adb..66199295bb 100644 --- a/phpBB/styles/prosilver/template/viewtopic_print.html +++ b/phpBB/styles/prosilver/template/viewtopic_print.html @@ -1,7 +1,7 @@  <!DOCTYPE html>  <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">  <head> -<meta charset="utf-8"> +<meta charset="utf-8" />  <meta name="robots" content="noindex" />  {META}  <title>{SITENAME} • {PAGE_TITLE}</title> diff --git a/phpBB/styles/subsilver2/template/index.htm b/phpBB/styles/subsilver2/template/index.htm index 4763c05f0e..a1356823e2 100644 --- a/phpBB/styles/subsilver2/template/index.htm +++ b/phpBB/styles/subsilver2/template/index.htm @@ -1,7 +1,7 @@  <html>  <head>  <title>subSilver created by subBlue Design</title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />  </head>  <body bgcolor="#FFFFFF" text="#000000"> diff --git a/phpBB/styles/subsilver2/template/mcp_front.html b/phpBB/styles/subsilver2/template/mcp_front.html index 7c17e13c52..55adb3b550 100644 --- a/phpBB/styles/subsilver2/template/mcp_front.html +++ b/phpBB/styles/subsilver2/template/mcp_front.html @@ -1,5 +1,7 @@  <!-- INCLUDE mcp_header.html --> +<!-- EVENT mcp_front_latest_unapproved_before --> +  <!-- IF S_SHOW_UNAPPROVED -->  	<form name="mcp_queue" method="post" action="{S_MCP_QUEUE_ACTION}"> @@ -44,6 +46,8 @@  	<br clear="all" /><br />  <!-- ENDIF --> +<!-- EVENT mcp_front_latest_reported_before --> +  <!-- IF S_SHOW_REPORTS -->  	<table class="tablebg" width="100%" cellspacing="1">  	<tr> @@ -73,6 +77,8 @@  	<br clear="all" /><br />  <!-- ENDIF --> +<!-- EVENT mcp_front_latest_reported_pms_before --> +  <!-- IF S_SHOW_PM_REPORTS -->  	<table class="tablebg" width="100%" cellspacing="1">  	<tr> @@ -104,6 +110,8 @@  	<br clear="all" /><br />  <!-- ENDIF --> +<!-- EVENT mcp_front_latest_logs_before --> +  <!-- IF S_SHOW_LOGS -->  	<table class="tablebg" width="100%" cellspacing="1" cellpadding="4" border="0" align="{S_CONTENT_FLOW_END}">  	<tr> @@ -134,4 +142,6 @@  	<br clear="all" />  <!-- ENDIF --> +<!-- EVENT mcp_front_latest_logs_after --> +  <!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html index 42ee17f2ed..176110c58d 100644 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ b/phpBB/styles/subsilver2/template/overall_footer.html @@ -23,5 +23,7 @@  {$SCRIPTS} +<!-- EVENT overall_footer_body_after --> +  </body>  </html> diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 4741154889..225a7d85ff 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -1,7 +1,7 @@  <!DOCTYPE html>  <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">  <head> -<meta charset="utf-8"> +<meta charset="utf-8" />  {META}  <title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title> diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html index d292c4594a..3abf89719f 100644 --- a/phpBB/styles/subsilver2/template/simple_header.html +++ b/phpBB/styles/subsilver2/template/simple_header.html @@ -1,7 +1,7 @@  <!DOCTYPE html>  <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">  <head> -<meta charset="utf-8"> +<meta charset="utf-8" />  {META}  <title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html index f70f39f9d8..fd5e390d83 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html @@ -1,7 +1,7 @@  <!DOCTYPE html>  <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">  <head> -<meta charset="utf-8"> +<meta charset="utf-8" />  <meta name="robots" content="noindex" />  <title>{SITENAME} :: {PAGE_TITLE}</title> @@ -78,7 +78,7 @@ hr.sep {  	<td width="10%" nowrap="nowrap">{L_PM_FROM}{L_COLON} </td>  	<td><b>{MESSAGE_AUTHOR}</b> [ {SENT_DATE} ]</td>  </tr> -	 +  <!-- IF S_TO_RECIPIENT -->  	<tr>  		<td width="10%" nowrap="nowrap">{L_TO}{L_COLON}</td> diff --git a/phpBB/styles/subsilver2/template/viewtopic_print.html b/phpBB/styles/subsilver2/template/viewtopic_print.html index a99d807cf2..9497fda121 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_print.html +++ b/phpBB/styles/subsilver2/template/viewtopic_print.html @@ -1,7 +1,7 @@  <!DOCTYPE html>  <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">  <head> -<meta charset="utf-8"> +<meta charset="utf-8" />  <meta name="robots" content="noindex" />  <title>{SITENAME} :: {PAGE_TITLE}</title> @@ -23,7 +23,7 @@ td {  	line-height: 150%;  } -.code, .codecontent,  +.code, .codecontent,  .quote, .quotecontent {  	margin: 0 5px 0 5px;  	padding: 5px; diff --git a/phpBB/styles/subsilver2/theme/images/index.htm b/phpBB/styles/subsilver2/theme/images/index.htm index 29531416fe..957f68a803 100644 --- a/phpBB/styles/subsilver2/theme/images/index.htm +++ b/phpBB/styles/subsilver2/theme/images/index.htm @@ -1,7 +1,7 @@  <html>  <head>  <title>subSilver created by subBlue Design</title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />  </head>  <body bgcolor="#FFFFFF" text="#000000"> diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 182bc2e285..8c74ca1f3c 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -164,6 +164,22 @@ switch ($mode)  				$cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name); +				/** +				* Event to save custom cookies from deletion +				* +				* @event core.ucp_delete_cookies +				* @var	string	cookie_name		Cookie name to checking +				* @var	bool	retain_cookie	Do we retain our cookie or not, true if retain +				* @since 3.1.3-RC1 +				*/ +				$retain_cookie = false; +				$vars = array('cookie_name', 'retain_cookie'); +				extract($phpbb_dispatcher->trigger_event('core.ucp_delete_cookies', compact($vars))); +				if ($retain_cookie) +				{ +					continue; +				} +  				// Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_  				if (strpos($cookie_name, 'poll_') !== 0)  				{ diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 1f455494f7..97a979ed13 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -395,7 +395,7 @@ $sql_array = array(  * @var	array	forum_data			Array with forum data  * @var	array	sql_array			The SQL array to get the data of all topics  * @since 3.1.0-a1 -* @change 3.1.0-RC4 Added forum_data var  +* @change 3.1.0-RC4 Added forum_data var  */  $vars = array(  	'forum_data', @@ -554,6 +554,7 @@ $sql_ary = array(  * Event to modify the SQL query before the topic ids data is retrieved  *  * @event core.viewforum_get_topic_ids_data +* @var	array	forum_data		Data about the forum  * @var	array	sql_ary			SQL query array to get the topic ids data  * @var	string	sql_approved	Topic visibility SQL string  * @var	int		sql_limit		Number of records to select @@ -564,8 +565,11 @@ $sql_ary = array(  * @var	bool	store_reverse	Flag indicating if we select from the late pages  *  * @since 3.1.0-RC4 +* +* @changed 3.1.3 Added forum_data  */  $vars = array( +	'forum_data',  	'sql_ary',  	'sql_approved',  	'sql_limit', @@ -883,6 +887,28 @@ if (sizeof($topic_list))  		$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; +		/** +		* Event after the topic data has been assigned to the template +		* +		* @event core.viewforum_topic_row_after +		* @var	array	row				Array with the topic data +		* @var	array	rowset			Array with topics data (in topic_id => topic_data format) +		* @var	bool	s_type_switch	Flag indicating if the topic type is [global] announcement +		* @var	int		topic_id		The topic ID +		* @var	array	topic_list		Array with current viewforum page topic ids +		* @var	array	topic_row		Template array with topic data +		* @since 3.1.3-RC1 +		*/ +		$vars = array( +			'row', +			'rowset', +			's_type_switch', +			'topic_id', +			'topic_list', +			'topic_row', +		); +		extract($phpbb_dispatcher->trigger_event('core.viewforum_topic_row_after', compact($vars))); +  		if ($unread_topic)  		{  			$mark_forum_read = false;  | 
