Browse Source

Arguments and names uniformation of integrate_create_[board|category|event] and integrate_before_create_topic

Signed-off-by: emanuele <[email protected]>
emanuele 11 years ago
parent
commit
5571ce7a0d
4 changed files with 38 additions and 30 deletions
  1. 12 10
      Sources/Subs-Boards.php
  2. 13 10
      Sources/Subs-Calendar.php
  3. 11 8
      Sources/Subs-Categories.php
  4. 2 2
      Sources/Subs-Post.php

+ 12 - 10
Sources/Subs-Boards.php

@@ -768,8 +768,6 @@ function createBoard($boardOptions)
 	if (in_array($boardOptions['move_to'], array('child', 'before', 'after')) && !isset($boardOptions['target_board']))
 		trigger_error('createBoard(): Target board is not set', E_USER_ERROR);
 
-	call_integration_hook('integrate_create_board', array(&$boardOptions));
-
 	// Set every optional value to its default value.
 	$boardOptions += array(
 		'posts_count' => true,
@@ -782,18 +780,22 @@ function createBoard($boardOptions)
 		'inherit_permissions' => true,
 		'dont_log' => true,
 	);
+	$board_columns = array(
+		'id_cat' => 'int', 'name' => 'string-255', 'description' => 'string', 'board_order' => 'int',
+		'member_groups' => 'string', 'redirect' => 'string',
+	);
+	$board_parameters = array(
+		$boardOptions['target_category'], $boardOptions['board_name'] , '', 0,
+		'-1,0', '',
+	);
+
+	call_integration_hook('integrate_create_board', array(&$boardOptions, &$board_columns, &$board_parameters));
 
 	// Insert a board, the settings are dealt with later.
 	$smcFunc['db_insert']('',
 		'{db_prefix}boards',
-		array(
-			'id_cat' => 'int', 'name' => 'string-255', 'description' => 'string', 'board_order' => 'int',
-			'member_groups' => 'string', 'redirect' => 'string',
-		),
-		array(
-			$boardOptions['target_category'], $boardOptions['board_name'] , '', 0,
-			'-1,0', '',
-		),
+		$board_columns,
+		$board_parameters,
 		array('id_board')
 	);
 	$board_id = $smcFunc['db_insert_id']('{db_prefix}boards', 'id_board');

+ 13 - 10
Sources/Subs-Calendar.php

@@ -869,25 +869,28 @@ function insertEvent(&$eventOptions)
 	$eventOptions['board'] = isset($eventOptions['board']) ? (int) $eventOptions['board'] : 0;
 	$eventOptions['topic'] = isset($eventOptions['topic']) ? (int) $eventOptions['topic'] : 0;
 
+	$event_columns = array(
+		'id_board' => 'int', 'id_topic' => 'int', 'title' => 'string-60', 'id_member' => 'int',
+		'start_date' => 'date', 'end_date' => 'date',
+	);
+	$event_parameters = array(
+		$eventOptions['board'], $eventOptions['topic'], $eventOptions['title'], $eventOptions['member'],
+		$eventOptions['start_date'], $eventOptions['end_date'],
+	);
+
+	call_integration_hook('integrate_create_event', array(&$eventOptions, &$event_columns, &$event_parameters));
+
 	// Insert the event!
 	$smcFunc['db_insert']('',
 		'{db_prefix}calendar',
-		array(
-			'id_board' => 'int', 'id_topic' => 'int', 'title' => 'string-60', 'id_member' => 'int',
-			'start_date' => 'date', 'end_date' => 'date',
-		),
-		array(
-			$eventOptions['board'], $eventOptions['topic'], $eventOptions['title'], $eventOptions['member'],
-			$eventOptions['start_date'], $eventOptions['end_date'],
-		),
+		$event_columns,
+		$event_parameters,
 		array('id_event')
 	);
 
 	// Store the just inserted id_event for future reference.
 	$eventOptions['id'] = $smcFunc['db_insert_id']('{db_prefix}calendar', 'id_event');
 
-	call_integration_hook('integrate_insert_event', array($eventOptions));
-
 	// Update the settings to show something calendarish was updated.
 	updateSettings(array(
 		'calendar_updated' => time(),

+ 11 - 8
Sources/Subs-Categories.php

@@ -127,8 +127,6 @@ function createCategory($catOptions)
 {
 	global $smcFunc;
 
-	call_integration_hook('integrate_create_category', array(&$catOptions));
-
 	// Check required values.
 	if (!isset($catOptions['cat_name']) || trim($catOptions['cat_name']) == '')
 		trigger_error('createCategory(): A category name is required', E_USER_ERROR);
@@ -141,15 +139,20 @@ function createCategory($catOptions)
 	// Don't log an edit right after.
 	$catOptions['dont_log'] = true;
 
+	$cat_columns = array(
+		'name' => 'string-48',
+	);
+	$cat_parameters = array(
+		$catOptions['cat_name'],
+	);
+	
+	call_integration_hook('integrate_create_category', array(&$catOptions, &$cat_columns, &$cat_parameters));
+
 	// Add the category to the database.
 	$smcFunc['db_insert']('',
 		'{db_prefix}categories',
-		array(
-			'name' => 'string-48',
-		),
-		array(
-			$catOptions['cat_name'],
-		),
+		$cat_columns,
+		$cat_parameters,
 		array('id_cat')
 	);
 

+ 2 - 2
Sources/Subs-Post.php

@@ -1846,7 +1846,7 @@ function createPost(&$msgOptions, &$topicOptions, &$posterOptions)
 	);
 
 	// What if we want to do anything with posts?
-	call_integration_hook('integrate_create_post', array(&$message_columns, &$message_parameters, &$msgOptions, &$topicOptions, &$posterOptions));
+	call_integration_hook('integrate_create_post', array(&$msgOptions, &$topicOptions, &$posterOptions, &$message_columns, &$message_parameters));
 
 	// Insert the post.
 	$smcFunc['db_insert']('',
@@ -1889,7 +1889,7 @@ function createPost(&$msgOptions, &$topicOptions, &$posterOptions)
 			$topicOptions['redirect_expires'] === null ? 0 : $topicOptions['redirect_expires'], $topicOptions['redirect_topic'] === null ? 0 : $topicOptions['redirect_topic'],
 		);
 
-		call_integration_hook('integrate_before_create_topic', array(&$topic_columns, &$topic_parameters, &$msgOptions, &$topicOptions, &$posterOptions));
+		call_integration_hook('integrate_before_create_topic', array(&$msgOptions, &$topicOptions, &$posterOptions, &$topic_columns, &$topic_parameters));
 
 		$smcFunc['db_insert']('',
 			'{db_prefix}topics',