diff options
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/acp/acp_email.php | 73 | ||||
| -rw-r--r-- | phpBB/includes/acp/acp_users.php | 15 | ||||
| -rw-r--r-- | phpBB/includes/bbcode.php | 22 | ||||
| -rw-r--r-- | phpBB/includes/functions.php | 13 | ||||
| -rw-r--r-- | phpBB/includes/functions_admin.php | 17 | ||||
| -rw-r--r-- | phpBB/includes/functions_convert.php | 1 | ||||
| -rw-r--r-- | phpBB/includes/functions_posting.php | 24 | ||||
| -rw-r--r-- | phpBB/includes/message_parser.php | 9 | 
8 files changed, 152 insertions, 22 deletions
| diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 4fefd6bec3..fcc2bd7641 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	= (!empty($usernames)) ? explode("\n", $usernames) : array();  		$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/bbcode.php b/phpBB/includes/bbcode.php index 3460db4882..5f6dcde448 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -129,7 +129,7 @@ class bbcode  	*/  	function bbcode_cache_init()  	{ -		global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_path_helper; +		global $phpbb_root_path, $phpEx, $config, $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_path_helper;  		if (empty($this->template_filename))  		{ @@ -388,6 +388,26 @@ class bbcode  				break;  			}  		} + +		$bbcode_cache = $this->bbcode_cache; +		$bbcode_bitfield = $this->bbcode_bitfield; +		$bbcode_uid = $this->bbcode_uid; + +		/** +		* Use this event to modify the bbcode_cache +		* +		* @event core.bbcode_cache_init_end +		* @var	array	bbcode_cache		The array of cached search and replace patterns of bbcodes +		* @var	string	bbcode_bitfield		The bbcode bitfield +		* @var	string	bbcode_uid			The bbcode uid +		* @since 3.1.3-RC1 +		*/ +		$vars = array('bbcode_cache', 'bbcode_bitfield', 'bbcode_uid'); +		extract($phpbb_dispatcher->trigger_event('core.bbcode_cache_init_end', compact($vars))); + +		$this->bbcode_cache = $bbcode_cache; +		$this->bbcode_bitfield = $bbcode_bitfield; +		$this->bbcode_uid = $bbcode_uid;  	}  	/** diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9cd43765a4..321394639b 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/includes/functions_posting.php b/phpBB/includes/functions_posting.php index af44f6270e..22ade15b48 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1825,6 +1825,30 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u  		break;  	} +	/** +	* Modify sql query data for post submitting +	* +	* @event core.submit_post_modify_sql_data +	* @var	array	data				Array with the data for the post +	* @var	array	poll				Array with the poll data for the post +	* @var	string	post_mode			Variable containing posting mode value +	* @var	bool	sql_data			Array with the data for the posting SQL query +	* @var	string	subject				Variable containing post subject value +	* @var	int		topic_type			Variable containing topic type value +	* @var	string	username			Variable containing post author name +	* @since 3.1.3-RC1 +	*/ +	$vars = array( +		'data', +		'poll', +		'post_mode', +		'sql_data', +		'subject', +		'topic_type', +		'username', +	); +	extract($phpbb_dispatcher->trigger_event('core.submit_post_modify_sql_data', compact($vars))); +  	// Submit new topic  	if ($post_mode == 'post')  	{ diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 07fe969ce2..04a2726d22 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1172,13 +1172,18 @@ class parse_message extends bbcode_firstpass  		* @var bool		update_this_message		Do we alter the parsed message  		* @var string	mode					Posting mode  		* @var string	message					The message text to parse +		* @var string	bbcode_bitfield			The bbcode_bitfield before parsing +		* @var string	bbcode_uid				The bbcode_uid before parsing  		* @var bool		return					Do we return after the event is triggered if $warn_msg is not empty  		* @var array	warn_msg				Array of the warning messages  		* @since 3.1.2-RC1 +		* @change 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid  		*/  		$message = $this->message;  		$warn_msg = $this->warn_msg;  		$return = false; +		$bbcode_bitfield = $this->bbcode_bitfield; +		$bbcode_uid = $this->bbcode_uid;  		$vars = array(  			'allow_bbcode',  			'allow_magic_url', @@ -1190,12 +1195,16 @@ class parse_message extends bbcode_firstpass  			'update_this_message',  			'mode',  			'message', +			'bbcode_bitfield', +			'bbcode_uid',  			'return',  			'warn_msg',  		);  		extract($phpbb_dispatcher->trigger_event('core.message_parser_check_message', compact($vars)));  		$this->message = $message;  		$this->warn_msg = $warn_msg; +		$this->bbcode_bitfield = $bbcode_bitfield; +		$this->bbcode_uid = $bbcode_uid;  		if ($return && !empty($this->warn_msg))  		{  			return (!$update_this_message) ? $return_message : $this->warn_msg; | 
