diff options
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/acp/acp_users.php | 15 | ||||
| -rw-r--r-- | phpBB/includes/functions_admin.php | 28 | ||||
| -rw-r--r-- | phpBB/includes/functions_mcp.php | 74 | ||||
| -rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 26 | ||||
| -rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 18 | 
5 files changed, 133 insertions, 28 deletions
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 3c957a7093..8c17fb6311 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1414,6 +1414,18 @@ class acp_users  						$error[] = 'FORM_INVALID';  					} +					/** +					* Validate profile data in ACP before submitting to the database +					* +					* @event core.acp_users_profile_validate +					* @var	bool	submit		Flag indicating if submit button has been pressed +					* @var	array	data		Array with user profile data +					* @var	array	error		Array with the form errors +					* @since 3.1.4-RC1 +					*/ +					$vars = array('submit', 'data', 'error'); +					extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars))); +  					if (!sizeof($error))  					{  						$sql_ary = array( @@ -1429,9 +1441,10 @@ class acp_users  						* @var	array	data		Array with user profile data  						* @var	int		user_id		The user id  						* @var	array	user_row	Array with the full user data +						* @var	array	sql_ary		Array with sql data  						* @since 3.1.4-RC1  						*/ -						$vars = array('cp_data', 'data', 'user_id', 'user_row'); +						$vars = array('cp_data', 'data', 'user_id', 'user_row', 'sql_ary');  						extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars)));  						$sql = 'UPDATE ' . USERS_TABLE . ' diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index b016659541..79f9db2f3f 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -618,7 +618,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)  */  function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true)  { -	global $db, $config, $phpbb_container; +	global $db, $config, $phpbb_container, $phpbb_dispatcher;  	$approved_topics = 0;  	$forum_ids = $topic_ids = array(); @@ -672,6 +672,20 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s  	$table_ary = array(BOOKMARKS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE); +	/** +	 * Perform additional actions before topic(s) deletion +	 * +	 * @event core.delete_topics_before_query +	 * @var	array	table_ary	Array of tables from which all rows will be deleted that hold a topic_id occuring in topic_ids +	 * @var	array	topic_ids	Array of topic ids to delete +	 * @since 3.1.4-RC1 +	 */ +	$vars = array( +			'table_ary', +			'topic_ids', +	); +	extract($phpbb_dispatcher->trigger_event('core.delete_topics_before_query', compact($vars))); +  	foreach ($table_ary as $table)  	{  		$sql = "DELETE FROM $table @@ -680,6 +694,18 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s  	}  	unset($table_ary); +	/** +	 * Perform additional actions after topic(s) deletion +	 * +	 * @event core.delete_topics_after_query +	 * @var	array	topic_ids	Array of topic ids that were deleted +	 * @since 3.1.4-RC1 +	 */ +	$vars = array( +			'topic_ids', +	); +	extract($phpbb_dispatcher->trigger_event('core.delete_topics_after_query', compact($vars))); +  	$moved_topic_ids = array();  	// update the other forums diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php index eb4fc6d44b..ed96dcf338 100644 --- a/phpBB/includes/functions_mcp.php +++ b/phpBB/includes/functions_mcp.php @@ -423,28 +423,6 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by  					AND t.topic_id = p.topic_id  					AND t.topic_visibility <> p.post_visibility'; -			/** -			* This event allows you to control the SQL query to retrieve the list of unapproved and deleted posts -			* -			* @event core.mcp_sorting_unapproved_deleted_posts_query_before -			* @var	string	sql					The current SQL search string -			* @var	int		forum_id			The forum id of the posts the user is trying to access -			* @var	int		topic_id			The topic id of the posts the user is trying to access -			* @var	int		min_time			Integer with the minimum post time that the user is searching for -			* @var	int		visibility_const	Integer with one of the possible ITEM_* constant values -			* @var	string	where_sql			Extra information included in the WHERE clause. It must end with "WHERE" or "AND" or "OR" -			* @since 3.1.4-RC1 -			*/ -			$vars = array( -				'sql', -				'forum_id', -				'topic_id', -				'min_time', -				'visibility_const', -				'where_sql', -			); -			extract($phpbb_dispatcher->trigger_event('core.mcp_sorting_unapproved_deleted_posts_query_before', compact($vars))); -  			if ($min_time)  			{  				$sql .= ' AND post_time >= ' . $min_time; @@ -575,6 +553,56 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by  			break;  	} +	// Default total to -1 to allow editing by the event +	$total = -1; + +	/** +	* This event allows you to control the SQL query used to get the total number +	* of reports the user can access. +	* +	* This total is used for the pagination and for displaying the total number +	* of reports to the user +	* +	* +	* @event core.mcp_sorting_query_before +	* @var	string	sql					The current SQL search string +	* @var	string	mode				An id related to the module(s) the user is viewing +	* @var	string	type				Which kind of information is this being used for displaying. Posts, topics, etc... +	* @var	int		forum_id			The forum id of the posts the user is trying to access, if not 0 +	* @var	int		topic_id			The topic id of the posts the user is trying to access, if not 0 +	* @var	int		sort_days			The max age of the oldest report to be shown, in days +	* @var	string	sort_key			The way the user has decided to sort the data. +	*									The valid values must be in the keys of the sort_by_* variables +	* @var	string	sort_dir			Either 'd' for "DESC" or 'a' for 'ASC' in the SQL query +	* @var	int		limit_days			The possible max ages of the oldest report for the user to choose, in days. +	* @var	array	sort_by_sql			SQL text (values) for the possible names of the ways of sorting data (keys). +	* @var	array	sort_by_text		Language text (values) for the possible names of the ways of sorting data (keys). +	* @var	int		min_time			Integer with the minimum post time that the user is searching for +	* @var	int		limit_time_sql		Time limiting options used in the SQL query. +	* @var	int		total				The total number of reports that exist. Only set if you want to override the result +	* @var	string	where_sql			Extra information included in the WHERE clause. It must end with "WHERE" or "AND" or "OR". +	*									Set to "WHERE" and set total above -1 to override the total value +	* @since 3.1.4-RC1 +	*/ +	$vars = array( +		'sql', +		'mode', +		'type', +		'forum_id', +		'topic_id', +		'sort_days', +		'sort_key', +		'sort_dir', +		'limit_days', +		'sort_by_sql', +		'sort_by_text', +		'min_time', +		'limit_time_sql', +		'total', +		'where_sql', +	); +	extract($phpbb_dispatcher->trigger_event('core.mcp_sorting_query_before', compact($vars))); +  	if (!isset($sort_by_sql[$sort_key]))  	{  		$sort_key = $default_key; @@ -606,7 +634,7 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by  		$total = (int) $db->sql_fetchfield('total');  		$db->sql_freeresult($result);  	} -	else +	else if ($total < -1)  	{  		$total = -1;  	} diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index f3b59186a6..51018e3a5d 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -90,6 +90,32 @@ function compose_pm($id, $mode, $action, $user_folders = array())  	// we include the language file here  	$user->add_lang('viewtopic'); +	/** +	* Modify the default vars before composing a PM +	* +	* @event core.ucp_pm_compose_modify_data +	* @var	int		msg_id					post_id in the page request +	* @var	int		to_user_id				The id of whom the message is to +	* @var	int		to_group_id				The id of the group the message is to +	* @var	bool	submit					Whether the form has been submitted +	* @var	bool	preview					Whether the user is previewing the PM or not +	* @var	string	action					One of: post, reply, quote, forward, quotepost, edit, delete, smilies +	* @var	bool	delete					Whether the user is deleting the PM +	* @var	int		reply_to_all			Value of reply_to_all request variable. +	* @since 3.1.4-RC1 +	*/ +	$vars = array( +		'msg_id', +		'to_user_id', +		'to_group_id', +		'submit', +		'preview', +		'action', +		'delete', +		'reply_to_all', +	); +	extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_data', compact($vars))); +  	// Output PM_TO box if message composing  	if ($action != 'edit')  	{ diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 2c786a1d39..8d8d42e742 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -115,16 +115,16 @@ class ucp_profile  					}  					/** -					* Validate user data on editing profile in UCP +					* Validate user data on editing registration data in UCP  					* -					* @event core.ucp_profile_info_validate_data +					* @event core.ucp_profile_reg_details_validate  					* @var	array	data			Array with user profile data  					* @var	bool	submit			Flag indicating if submit button has been pressed  					* @var array	error			Array of any generated errors  					* @since 3.1.4-RC1  					*/  					$vars = array('data', 'submit', 'error'); -					extract($phpbb_dispatcher->trigger_event('core.ucp_profile_info_validate_data', compact($vars))); +					extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_validate', compact($vars)));  					if (!sizeof($error))  					{ @@ -365,6 +365,18 @@ class ucp_profile  						$error[] = 'FORM_INVALID';  					} +					/** +					* Validate user data on editing profile in UCP +					* +					* @event core.ucp_profile_validate_profile_info +					* @var	array	data			Array with user profile data +					* @var	bool	submit			Flag indicating if submit button has been pressed +					* @var array	error			Array of any generated errors +					* @since 3.1.4-RC1 +					*/ +					$vars = array('data', 'submit', 'error'); +					extract($phpbb_dispatcher->trigger_event('core.ucp_profile_validate_profile_info', compact($vars))); +  					if (!sizeof($error))  					{  						$data['notify'] = $user->data['user_notify_type'];  | 
