[Customisation Database Commits] r1034 - in /trunk/titania: ./ includes/ includes/core/ includes/hooks/ includes/manage_tools/ includes/objects/ includes/tools/

Nathan Guse exreaction at phpbb.com
Fri Apr 9 23:51:01 BST 2010


Author: exreaction
Date: Fri Apr  9 23:51:01 2010
New Revision: 1034

Log:
Fixing some issues

Adding some hookable locations

Adding some stuff to our phpBB.com hook to post replies and topics in the queue/queue discussion forums in phpBB for modifications.

Modified:
    trunk/titania/ariel_convert.php
    trunk/titania/cron.php
    trunk/titania/includes/core/hook.php
    trunk/titania/includes/core/object.php
    trunk/titania/includes/functions.php
    trunk/titania/includes/functions_install.php
    trunk/titania/includes/functions_posting.php
    trunk/titania/includes/hooks/_hook_phpbb.com.php
    trunk/titania/includes/manage_tools/phpbb_version_add.php
    trunk/titania/includes/manage_tools/phpbb_version_test.php
    trunk/titania/includes/objects/contribution.php
    trunk/titania/includes/objects/post.php
    trunk/titania/includes/objects/queue.php
    trunk/titania/includes/objects/revision.php
    trunk/titania/includes/objects/topic.php
    trunk/titania/includes/tools/contrib_tools.php
    trunk/titania/index.php

Modified: trunk/titania/ariel_convert.php
==============================================================================
*** trunk/titania/ariel_convert.php (original)
--- trunk/titania/ariel_convert.php Fri Apr  9 23:51:01 2010
***************
*** 22,27 ****
--- 22,28 ----
   * @ignore
   */
  define('IN_TITANIA', true);
+ define('IN_TITANIA_CONVERT', true);
  if (!defined('TITANIA_ROOT')) define('TITANIA_ROOT', './');
  if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
  require TITANIA_ROOT . 'common.' . PHP_EXT;
***************
*** 36,41 ****
--- 37,60 ----
  // Hopefully this helps
  @set_time_limit(0);
  
+ if (!isset(phpbb::$config['titania_hook_phpbb_com']))
+ {
+ 	phpbb::_include('../umil/umil', false, 'umil');
+ 
+ 	$umil = new umil(true, phpbb::$db);
+ 
+ 	$umil->run_actions('update', array(
+ 		'1.0.0' => array(
+ 			'table_column_add' => array(
+ 				array(TITANIA_TOPICS_TABLE, 'phpbb_topic_id', array('UINT', 0)),
+ 			),
+ 		),
+ 	),
+ 	'titania_hook_phpbb_com');
+ 
+ 	unset($umil);
+ }
+ 
  // Hack for local
  phpbb::$config['site_upload_dir'] = (!isset(phpbb::$config['site_upload_dir'])) ? '../phpBB3_titania/files/contribdb' : '../../' . phpbb::$config['site_upload_dir'];
  $screenshots_dir = phpbb::$config['site_upload_dir'] . '/demo/';
***************
*** 454,460 ****
  					'revision_id'				=> $revision_id,
  					'contrib_id'				=> $row['contrib_id'],
  					'phpbb_version_branch'		=> ($row['contrib_phpbb_version'][0] == '3') ? 30 : 20,
! 					'phpbb_version_revision'	=> substr($row['contrib_phpbb_version'], 4),
  					'revision_validated'		=> ($row['queue_status'] == -1) ? true : false,
  				);
  			}
--- 473,479 ----
  					'revision_id'				=> $revision_id,
  					'contrib_id'				=> $row['contrib_id'],
  					'phpbb_version_branch'		=> ($row['contrib_phpbb_version'][0] == '3') ? 30 : 20,
! 					'phpbb_version_revision'	=> get_real_revision_version(substr($row['contrib_phpbb_version'], 4)),
  					'revision_validated'		=> ($row['queue_status'] == -1) ? true : false,
  				);
  			}
***************
*** 464,470 ****
  					'revision_id'				=> $revision_id,
  					'contrib_id'				=> $row['contrib_id'],
  					'phpbb_version_branch'		=> ($row['revision_phpbb_version'][0] == '3') ? 30 : 20,
! 					'phpbb_version_revision'	=> substr($row['revision_phpbb_version'], 4),
  					'revision_validated'		=> ($row['queue_status'] == -1) ? true : false,
  				);
  			}
--- 483,489 ----
  					'revision_id'				=> $revision_id,
  					'contrib_id'				=> $row['contrib_id'],
  					'phpbb_version_branch'		=> ($row['revision_phpbb_version'][0] == '3') ? 30 : 20,
! 					'phpbb_version_revision'	=> get_real_revision_version(substr($row['revision_phpbb_version'], 4)),
  					'revision_validated'		=> ($row['queue_status'] == -1) ? true : false,
  				);
  			}
***************
*** 506,511 ****
--- 525,531 ----
  			$topic = new titania_topic;
  			$topic->parent_id = $row['contrib_id'];
  			$topic->topic_category = $row['contrib_type'];
+ 			$topic->phpbb_topic_id = $row['topic_id'];
  			$topic->topic_url = titania_types::$types[$row['contrib_type']]->url . '/' . $row['contrib_name_clean'] . '/support/';
  			titania_move_topic($row['topic_id'], $topic, TITANIA_QUEUE_DISCUSSION);
  			unset($topic);
***************
*** 573,578 ****
--- 593,599 ----
  			$topic = new titania_topic;
  			$topic->parent_id = $row['queue_id'];
  			$topic->topic_url = 'manage/queue/q_' . $row['queue_id'];
+ 			$topic->phpbb_topic_id = $row['topic_id'];
  			titania_move_topic($row['topic_id'], $topic, TITANIA_QUEUE, $row['contrib_name'], $row['revision_version']);
  			$queue_topic_id = $topic->topic_id;
  			unset($topic);
***************
*** 658,664 ****
  					'contrib_id'				=> $row['contrib_id'],
  					'revision_id'				=> $row['revision_id'],
  					'phpbb_version_branch'		=> $data[0],
! 					'phpbb_version_revision'	=> $data[1],
  					'revision_validated'		=> $row['revision_validated'],
  				);
  			}
--- 679,685 ----
  					'contrib_id'				=> $row['contrib_id'],
  					'revision_id'				=> $row['revision_id'],
  					'phpbb_version_branch'		=> $data[0],
! 					'phpbb_version_revision'	=> get_real_revision_version($data[1]),
  					'revision_validated'		=> $row['revision_validated'],
  				);
  			}

Modified: trunk/titania/cron.php
==============================================================================
*** trunk/titania/cron.php (original)
--- trunk/titania/cron.php Fri Apr  9 23:51:01 2010
***************
*** 69,76 ****
  			continue;
  		}
  
- 		$contrib_tools->mvdir_recursive($contrib_tools->unzip_dir, $contrib_tools->unzip_dir . '/' . $new_dir_name);
- 
  		if (!($phpbb_path = $contrib_tools->automod_phpbb_files($version)))
  		{
  			continue;
--- 69,74 ----
***************
*** 82,88 ****
  				'revision_id'				=> $row['revision_id'],
  				'contrib_id'				=> $row['contrib_id'],
  				'phpbb_version_branch'		=> $row['phpbb_version_branch'],
! 				'phpbb_version_revision'	=> $row['phpbb_version_revision'],
  				'revision_validated'		=> $row['revision_validated'],
  			);
  			phpbb::$db->sql_query('INSERT INTO ' . TITANIA_REVISIONS_PHPBB_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));
--- 80,86 ----
  				'revision_id'				=> $row['revision_id'],
  				'contrib_id'				=> $row['contrib_id'],
  				'phpbb_version_branch'		=> $row['phpbb_version_branch'],
! 				'phpbb_version_revision'	=> get_real_revision_version($row['phpbb_version_revision']),
  				'revision_validated'		=> $row['revision_validated'],
  			);
  			phpbb::$db->sql_query('INSERT INTO ' . TITANIA_REVISIONS_PHPBB_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));

Modified: trunk/titania/includes/core/hook.php
==============================================================================
*** trunk/titania/includes/core/hook.php (original)
--- trunk/titania/includes/core/hook.php Fri Apr  9 23:51:01 2010
***************
*** 73,76 ****
--- 73,159 ----
  			break;
  		}
  	}
+ 
+ 	public function register_ary($prefix, $definitions, $mode = 'normal')
+ 	{
+ 		foreach ($definitions as $definition)
+ 		{
+ 			$this->register($definition, $prefix . ((is_array($definition)) ? implode('_', $definition) : $definition), $mode);
+ 		}
+ 	}
+ 
+ 	/**
+ 	* Calling all functions/methods attached to a specified hook by reference (only the first argument allows for a reference)
+ 	*
+ 	* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
+ 	* @param mixed $args The arguments to be used as reference
+ 	*/
+ 	function call_hook_ref($definition, &$reference)
+ 	{
+ 		$class = (!is_array($definition)) ? '__global' : $definition[0];
+ 		$function = (!is_array($definition)) ? $definition : $definition[1];
+ 
+ 		if (!empty($this->hooks[$class][$function]))
+ 		{
+ 			// Developer tries to call a hooked function within the hooked function...
+ 			if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function)
+ 			{
+ 				return false;
+ 			}
+ 
+ 			// Call the hook with the arguments attached and store result
+ 			$arguments = func_get_args();
+ 			$this->current_hook = array('class' => $class, 'function' => $function);
+ 			$arguments[0] = &$this;
+ 			$arguments[1] = &$reference;
+ 
+ 			// Call the hook chain...
+ 			if (isset($this->hooks[$class][$function]['standalone']))
+ 			{
+ 				$hook = $this->hooks[$class][$function]['standalone'];
+ 				if (function_exists($hook))
+ 				{
+ 					$function_call = '$this->hook_result[$class][$function] = ' . $hook . '(';
+ 					for ($i = 0; $i < sizeof($arguments); $i++)
+ 					{
+ 						$function_call .= '$arguments[' . $i . '], ';
+ 					}
+ 					$function_call = substr($function_call, 0, -2) . ');';
+ 
+ 					eval($function_call);
+ 				}
+ 			}
+ 			else
+ 			{
+ 				foreach (array('first', 'normal', 'last') as $mode)
+ 				{
+ 					if (!isset($this->hooks[$class][$function][$mode]))
+ 					{
+ 						continue;
+ 					}
+ 
+ 					foreach ($this->hooks[$class][$function][$mode] as $hook)
+ 					{
+ 						if (function_exists($hook))
+ 						{
+ 							$function_call = '$this->hook_result[$class][$function] = ' . $hook . '(';
+ 							for ($i = 0; $i < sizeof($arguments); $i++)
+ 							{
+ 								$function_call .= '$arguments[' . $i . '], ';
+ 							}
+ 							$function_call = substr($function_call, 0, -2) . ');';
+ 
+ 							eval($function_call);
+ 						}
+ 					}
+ 				}
+ 			}
+ 
+ 			$this->current_hook = NULL;
+ 			return true;
+ 		}
+ 
+ 		$this->current_hook = NULL;
+ 		return false;
+ 	}
  }
\ No newline at end of file

Modified: trunk/titania/includes/core/object.php
==============================================================================
*** trunk/titania/includes/core/object.php (original)
--- trunk/titania/includes/core/object.php Fri Apr  9 23:51:01 2010
***************
*** 70,76 ****
  	* 	);
  	* </code>
  	*/
! 	protected $object_config = array();
  
  	/**
  	* Catches calles to non-existing methods.
--- 70,76 ----
  	* 	);
  	* </code>
  	*/
! 	public $object_config = array();
  
  	/**
  	* Catches calles to non-existing methods.

Modified: trunk/titania/includes/functions.php
==============================================================================
*** trunk/titania/includes/functions.php (original)
--- trunk/titania/includes/functions.php Fri Apr  9 23:51:01 2010
***************
*** 17,22 ****
--- 17,33 ----
  }
  
  /**
+ * phpBB is nub like that
+ *
+ * @param string $revision
+ * @return string
+ */
+ function get_real_revision_version($revision)
+ {
+ 	return str_replace('rc', 'RC', strtolower($revision));
+ }
+ 
+ /**
  * Generate text for display
  * Returns the result of generate_text_for_display() from phpBB's functions_content.php file, but has hacks in place to let us use our own bbcode.html file
  *

Modified: trunk/titania/includes/functions_install.php
==============================================================================
*** trunk/titania/includes/functions_install.php (original)
--- trunk/titania/includes/functions_install.php Fri Apr  9 23:51:01 2010
***************
*** 64,70 ****
  							'revision_id'				=> $row['revision_id'],
  							'contrib_id'				=> $row['contrib_id'],
  							'phpbb_version_branch'		=> $row['phpbb_version'][0] . $row['phpbb_version'][2],
! 							'phpbb_version_revision'	=> substr($row['phpbb_version'], 4),
  						);
  					}
  					phpbb::$db->sql_freeresult($result);
--- 64,70 ----
  							'revision_id'				=> $row['revision_id'],
  							'contrib_id'				=> $row['contrib_id'],
  							'phpbb_version_branch'		=> $row['phpbb_version'][0] . $row['phpbb_version'][2],
! 							'phpbb_version_revision'	=> get_real_revision_version(substr($row['phpbb_version'], 4)),
  						);
  					}
  					phpbb::$db->sql_freeresult($result);

Modified: trunk/titania/includes/functions_posting.php
==============================================================================
*** trunk/titania/includes/functions_posting.php (original)
--- trunk/titania/includes/functions_posting.php Fri Apr  9 23:51:01 2010
***************
*** 369,380 ****
  
  	// Aaaand, submit it.
  	submit_post('post', $options['topic_title'], $user_data['username'], $options['topic_type'], $poll, $data, true);
! 	
! 	// If we provide support in titania, we lock the topic
! 	if (titania::$config->support_in_titania)
  	{
  		$sql = 'UPDATE ' . TOPICS_TABLE . '
! 			SET topic_status = ' . ITEM_LOCKED . '
  			WHERE topic_id = ' . $data['topic_id'] . '
  				AND topic_moved_id = 0';
  		phpbb::$db->sql_query($sql);
--- 369,380 ----
  
  	// Aaaand, submit it.
  	submit_post('post', $options['topic_title'], $user_data['username'], $options['topic_type'], $poll, $data, true);
! 
! 	// Change the status?
! 	if (isset($options['topic_status']))
  	{
  		$sql = 'UPDATE ' . TOPICS_TABLE . '
! 			SET topic_status = ' . (int) $options['topic_status'] . '
  			WHERE topic_id = ' . $data['topic_id'] . '
  				AND topic_moved_id = 0';
  		phpbb::$db->sql_query($sql);

Modified: trunk/titania/includes/hooks/_hook_phpbb.com.php
==============================================================================
*** trunk/titania/includes/hooks/_hook_phpbb.com.php (original)
--- trunk/titania/includes/hooks/_hook_phpbb.com.php Fri Apr  9 23:51:01 2010
***************
*** 16,25 ****
  	exit;
  }
  
! titania::$hook->register('titania_page_header', 'phpbb_com_header');
! titania::$hook->register('titania_page_footer', 'phpbb_com_footer');
  
! function phpbb_com_header($page_title)
  {
  	phpbb::$template->assign_vars(array(
  		'S_BODY_CLASS'		=> 'customise customisation-database',
--- 16,48 ----
  	exit;
  }
  
! titania::$hook->register_ary('phpbb_com_', array(
! 	'titania_page_header',
! 	'titania_page_footer',
! 	array('titania_topic', '__construct'),
! 	array('titania_post', 'post'),
! ));
  
! // Do we need to install the DB stuff?
! if (!isset(phpbb::$config['titania_hook_phpbb_com']))
! {
! 	phpbb::_include('../umil/umil', false, 'umil');
! 
! 	$umil = new umil(true, phpbb::$db);
! 
! 	$umil->run_actions('update', array(
! 		'1.0.0' => array(
! 			'table_column_add' => array(
! 				array(TITANIA_TOPICS_TABLE, 'phpbb_topic_id', array('UINT', 0)),
! 			),
! 		),
! 	),
! 	'titania_hook_phpbb_com');
! 
! 	unset($umil);
! }
! 
! function phpbb_com_titania_page_header($hook, $page_title)
  {
  	phpbb::$template->assign_vars(array(
  		'S_BODY_CLASS'		=> 'customise customisation-database',
***************
*** 41,47 ****
  	titania::set_custom_template();
  }
  
! function phpbb_com_footer($run_cron, $template_body)
  {
  	// Setup the phpBB.com footer
  	phpbb::$template->set_custom_template(TITANIA_ROOT . '../../template/', 'website');
--- 64,70 ----
  	titania::set_custom_template();
  }
  
! function phpbb_com_page_footer($hook, $run_cron, $template_body)
  {
  	// Setup the phpBB.com footer
  	phpbb::$template->set_custom_template(TITANIA_ROOT . '../../template/', 'website');
***************
*** 51,54 ****
--- 74,188 ----
  	phpbb::$template->assign_display('phpbb_com_footer', 'PHPBB_COM_FOOTER', false);
  
  	titania::set_custom_template();
+ }
+ 
+ function phpbb_com_titania_topic_submit($hook, &$topic_object)
+ {
+ 	if (defined('IN_TITANIA_CONVERT') || $topic_object->topic_category != TITANIA_TYPE_MOD || $topic_object->phpbb_topic_id)
+ 	{
+ 		return;
+ 	}
+ 
+ 	$forum_id = false;
+ 	switch ($topic_object->topic_type)
+ 	{
+ 		case TITANIA_QUEUE_DISCUSSION :
+ 			$forum_id = 61;
+ 		break;
+ 
+ 		case TITANIA_QUEUE :
+ 			$forum_id = 38;
+ 		break;
+ 	}
+ 
+ 	if (!$forum_id)
+ 	{
+ 		return;
+ 	}
+ 
+ 	titania::_include('functions_posting', 'phpbb_post_add');
+ 
+ 	$sql = 'SELECT post_text, post_text_uid FROM ' . TITANIA_POSTS_TABLE . '
+ 		WHERE post_id = ' . $topic_object->topic_first_post_id;
+ 	$result = phpbb::$db->sql_query($sql);
+ 	$row = phpbb::$db->sql_fetchrow($result);
+ 	phpbb::$db->sql_freeresult($result);
+ 
+ 	decode_message($row['post_text'], $row['post_text_uid']);
+ 
+ 	$post_text .= "\n\n" . $topic_object->get_url();
+ 
+ 	$options = array(
+ 		'poster_id'				=> $topic_object->topic_first_post_user_id,
+ 		'forum_id' 				=> $forum_id,
+ 		'topic_title'			=> $topic_object->topic_subject,
+ 		'post_text'				=> $row['post_text'],
+ 		'topic_status'			=> ITEM_LOCKED,
+ 	);
+ 
+ 	$topic_id = phpbb_topic_add($options);
+ 
+ 	$topic_object->phpbb_topic_id = $topic_id;
+ 
+ 	$sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
+ 		SET phpbb_topic_id = ' . (int) $topic_id . '
+ 		WHERE topic_id = ' . $topic_object->topic_id;
+ 	phpbb::$db->sql_query($sql);
+ }
+ 
+ 
+ function phpbb_com_titania_post_post($hook, &$post_object)
+ {
+ 	if (defined('IN_TITANIA_CONVERT') || $post_object->topic->topic_category != TITANIA_TYPE_MOD || !$post_object->topic->phpbb_topic_id)
+ 	{
+ 		return;
+ 	}
+ 
+ 	$forum_id = false;
+ 	switch ($post_object->post_type)
+ 	{
+ 		case TITANIA_QUEUE_DISCUSSION :
+ 			$forum_id = 61;
+ 		break;
+ 
+ 		case TITANIA_QUEUE :
+ 			$forum_id = 38;
+ 		break;
+ 	}
+ 
+ 	if (!$forum_id)
+ 	{
+ 		return;
+ 	}
+ 
+ 	titania::_include('functions_posting', 'phpbb_post_add');
+ 
+ 	$post_text = $post_object->post_text;
+ 	decode_message($post_text, $post_object->post_text_uid);
+ 
+ 	$post_text .= "\n\n" . $post_object->get_url();
+ 
+ 	$options = array(
+ 		'poster_id'				=> $post_object->post_user_id,
+ 		'forum_id' 				=> $forum_id,
+ 		'topic_id'				=> $post_object->topic->phpbb_topic_id,
+ 		'topic_title'			=> $post_object->post_subject,
+ 		'post_text'				=> $post_text,
+ 	);
+ 
+ 	phpbb_post_add($options);
+ 
+ 	// Make sure the topic is locked
+ 	$sql = 'UPDATE ' . TOPICS_TABLE . '
+ 		SET topic_status = ' . (int) $options['topic_status'] . '
+ 		WHERE topic_id = ' . $post_object->topic->phpbb_topic_id . '
+ 			AND topic_moved_id = 0';
+ 	phpbb::$db->sql_query($sql);
+ }
+ 
+ function phpbb_com_titania_topic___construct($hook, &$topic_object)
+ {
+ 	$topic_object->object_config = array_merge($topic_object->object_config, array(
+ 		'phpbb_topic_id'	=> array('default' => 0),
+ 	));
  }
\ No newline at end of file

Modified: trunk/titania/includes/manage_tools/phpbb_version_add.php
==============================================================================
*** trunk/titania/includes/manage_tools/phpbb_version_add.php (original)
--- trunk/titania/includes/manage_tools/phpbb_version_add.php Fri Apr  9 23:51:01 2010
***************
*** 39,45 ****
  		}
  
  		$phpbb_version_branch = (int) $new_phpbb_version[0] . (int) $new_phpbb_version[2];
! 		$phpbb_version_revision = substr($new_phpbb_version, 4);
  
  		// Is it in our version cache?
  		$versions = titania::$cache->get_phpbb_versions();
--- 39,45 ----
  		}
  
  		$phpbb_version_branch = (int) $new_phpbb_version[0] . (int) $new_phpbb_version[2];
! 		$phpbb_version_revision = get_real_revision_version(substr($new_phpbb_version, 4));
  
  		// Is it in our version cache?
  		$versions = titania::$cache->get_phpbb_versions();

Modified: trunk/titania/includes/manage_tools/phpbb_version_test.php
==============================================================================
*** trunk/titania/includes/manage_tools/phpbb_version_test.php (original)
--- trunk/titania/includes/manage_tools/phpbb_version_test.php Fri Apr  9 23:51:01 2010
***************
*** 44,50 ****
  		}
  
  		$phpbb_version_branch = (int) $new_phpbb_version[0] . (int) $new_phpbb_version[2];
! 		$phpbb_version_revision = substr($new_phpbb_version, 4);
  
  		// Is it in our version cache?
  		$versions = titania::$cache->get_phpbb_versions();
--- 44,50 ----
  		}
  
  		$phpbb_version_branch = (int) $new_phpbb_version[0] . (int) $new_phpbb_version[2];
! 		$phpbb_version_revision = get_real_revision_version(substr($new_phpbb_version, 4));
  
  		// Is it in our version cache?
  		$versions = titania::$cache->get_phpbb_versions();
***************
*** 156,159 ****
  
  		return $select;
  	}
! }
\ No newline at end of file
--- 156,159 ----
  
  		return $select;
  	}
! }

Modified: trunk/titania/includes/objects/contribution.php
==============================================================================
*** trunk/titania/includes/objects/contribution.php (original)
--- trunk/titania/includes/objects/contribution.php Fri Apr  9 23:51:01 2010
***************
*** 115,120 ****
--- 115,123 ----
  
  			'contrib_release_topic_id'		=> array('default' => 0),
  		));
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 390,395 ****
--- 393,401 ----
  			));
  		}
  
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $vars, $this);
+ 
  		// Display real author
  		if ($return)
  		{
***************
*** 484,489 ****
--- 490,498 ----
  
  		// Index!
  		$this->index();
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	public function report($reason = '')
***************
*** 569,574 ****
--- 578,586 ----
  
  		// Index!
  		$this->index();
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 738,743 ****
--- 750,758 ----
  			}
  		}
  
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $error, $this);
+ 
  		return $error;
  	}
  

Modified: trunk/titania/includes/objects/post.php
==============================================================================
*** trunk/titania/includes/objects/post.php (original)
--- trunk/titania/includes/objects/post.php Fri Apr  9 23:51:01 2010
***************
*** 152,157 ****
--- 152,160 ----
  		{
  			$this->topic = new titania_topic;
  		}
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 450,455 ****
--- 453,461 ----
  		$this->topic->submit();
  
  		$this->index();
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 494,499 ****
--- 500,508 ----
  		$this->index();
  
  		parent::submit();
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 528,533 ****
--- 537,545 ----
  		$this->topic->submit();
  
  		parent::submit();
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 561,566 ****
--- 573,581 ----
  		$this->topic->submit();
  
  		parent::submit();
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 598,603 ****
--- 613,621 ----
  				AND attention_object_id = ' . $this->post_id;
  		phpbb::$db->sql_query($sql);
  
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
+ 
  		// Initiate self-destruct mode
  		parent::delete();
  
***************
*** 635,640 ****
--- 653,661 ----
  
  		// Self submission
  		parent::submit();
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 795,800 ****
--- 816,824 ----
  			'S_ACCESS_AUTHORS'				=> ($this->post_access == TITANIA_ACCESS_AUTHORS) ? true : false,
  		);
  
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $details, $this);
+ 
  		return $details;
  	}
  }

Modified: trunk/titania/includes/objects/queue.php
==============================================================================
*** trunk/titania/includes/objects/queue.php (original)
--- trunk/titania/includes/objects/queue.php Fri Apr  9 23:51:01 2010
***************
*** 423,429 ****
  				'poster_id'				=> titania_types::$types[$contrib->contrib_type]->forum_robot,
  				'forum_id' 				=> titania_types::$types[$contrib->contrib_type]->forum_database,
  				'topic_title'			=> $contrib->contrib_name,
! 				'post_text'				=> $body
  			);
  
  			if ($options['forum_id'] && $options['poster_id'])
--- 423,430 ----
  				'poster_id'				=> titania_types::$types[$contrib->contrib_type]->forum_robot,
  				'forum_id' 				=> titania_types::$types[$contrib->contrib_type]->forum_database,
  				'topic_title'			=> $contrib->contrib_name,
! 				'post_text'				=> $body,
! 				'topic_status'			=> (titania::$config->support_in_titania) ? ITEM_LOCKED : ITEM_UNLOCKED,
  			);
  
  			if ($options['forum_id'] && $options['poster_id'])

Modified: trunk/titania/includes/objects/revision.php
==============================================================================
*** trunk/titania/includes/objects/revision.php (original)
--- trunk/titania/includes/objects/revision.php Fri Apr  9 23:51:01 2010
***************
*** 189,195 ****
  						'poster_id'				=> titania_types::$types[$this->contrib->contrib_type]->forum_robot,
  						'forum_id' 				=> titania_types::$types[$this->contrib->contrib_type]->forum_database,
  						'topic_title'			=> $this->contrib->contrib_name,
! 						'post_text'				=> $body
  					);
  
  					if ($options['forum_id'] && $options['poster_id'])
--- 189,196 ----
  						'poster_id'				=> titania_types::$types[$this->contrib->contrib_type]->forum_robot,
  						'forum_id' 				=> titania_types::$types[$this->contrib->contrib_type]->forum_database,
  						'topic_title'			=> $this->contrib->contrib_name,
! 						'post_text'				=> $body,
! 						'topic_status'			=> (titania::$config->support_in_titania) ? ITEM_LOCKED : ITEM_UNLOCKED,
  					);
  
  					if ($options['forum_id'] && $options['poster_id'])
***************
*** 254,260 ****
  					'contrib_id'				=> $this->contrib_id,
  					'revision_validated'		=> $this->revision_validated,
  					'phpbb_version_branch'		=> $row['phpbb_version_branch'],
! 					'phpbb_version_revision'	=> (isset($row['phpbb_version_revision'])) ? $row['phpbb_version_revision'] : titania::$config->phpbb_versions[$row['phpbb_version_branch']]['latest_revision'],
  				);
  			}
  
--- 255,261 ----
  					'contrib_id'				=> $this->contrib_id,
  					'revision_validated'		=> $this->revision_validated,
  					'phpbb_version_branch'		=> $row['phpbb_version_branch'],
! 					'phpbb_version_revision'	=> get_real_revision_version(((isset($row['phpbb_version_revision'])) ? $row['phpbb_version_revision'] : titania::$config->phpbb_versions[$row['phpbb_version_branch']]['latest_revision'])),
  				);
  			}
  

Modified: trunk/titania/includes/objects/topic.php
==============================================================================
*** trunk/titania/includes/objects/topic.php (original)
--- trunk/titania/includes/objects/topic.php Fri Apr  9 23:51:01 2010
***************
*** 100,105 ****
--- 100,108 ----
  		));
  
  		$this->topic_id = $topic_id;
+ 
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	public function submit()
***************
*** 108,114 ****
  
  		$this->topic_subject_clean = titania_url::url_slug($this->topic_subject);
  
! 		return parent::submit();
  	}
  
  	/**
--- 111,120 ----
  
  		$this->topic_subject_clean = titania_url::url_slug($this->topic_subject);
  
! 		parent::submit();
! 
! 		// Hooks
! 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
  	}
  
  	/**
***************
*** 251,256 ****
--- 257,265 ----
  			'TOPIC_FOLDER_IMG_HEIGHT'		=> phpbb::$user->img($folder_img, '', false, '', 'height'),
  		);
  
+ 		// Hooks
+ 		titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $details, $this);
+ 
  		return $details;
  	}
  }

Modified: trunk/titania/includes/tools/contrib_tools.php
==============================================================================
*** trunk/titania/includes/tools/contrib_tools.php (original)
--- trunk/titania/includes/tools/contrib_tools.php Fri Apr  9 23:51:01 2010
***************
*** 441,459 ****
  		titania::add_lang('automod');
  
  		// Find the main modx file
! 		$modx_file = $this->unzip_dir . $this->new_dir_name . '/';
! 		if (file_exists($modx_file . 'install.xml'))
  		{
! 			$modx_file .= 'install.xml';
  		}
  		else
  		{
  			// Find the first item with install in the name
! 			foreach (scandir($modx_file) as $item)
  			{
  		       if (strpos($item, 'install') !== false && strpos($item, '.xml'))
  		       {
! 				   $modx_file .= $item;
  				   break;
  		       }
  			}
--- 441,458 ----
  		titania::add_lang('automod');
  
  		// Find the main modx file
! 		if (file_exists($this->unzip_dir . 'install.xml'))
  		{
! 			$modx_file = $this->unzip_dir . 'install.xml';
  		}
  		else
  		{
  			// Find the first item with install in the name
! 			foreach (scandir($this->unzip_dir) as $item)
  			{
  		       if (strpos($item, 'install') !== false && strpos($item, '.xml'))
  		       {
! 				   $modx_file = $this->unzip_dir . $item;
  				   break;
  		       }
  			}

Modified: trunk/titania/index.php
==============================================================================
*** trunk/titania/index.php (original)
--- trunk/titania/index.php Fri Apr  9 23:51:01 2010
***************
*** 140,147 ****
  			$package_root = $contrib_tools->find_root();
  			$contrib_tools->restore_root($package_root);
  
- 			$contrib_tools->mvdir_recursive($contrib_tools->unzip_dir, $contrib_tools->unzip_dir . '/' . $new_dir_name);
- 
  			// Automod testing time
  			$details = '';
  			$html_results = $bbcode_results = array();
--- 140,145 ----




More information about the customisationdb-commits mailing list