[Customisation Database Commits] r582 - in /trunk/titania: ./ includes/ includes/core/ includes/objects/ includes/overlords/

Nathan Guse exreaction at phpbb.com
Sat Feb 6 23:41:42 GMT 2010


Author: exreaction
Date: Sat Feb  6 23:41:41 2010
New Revision: 582

Log:
Starting stuff for the queue (almost completely untested)

Added:
    trunk/titania/includes/objects/queue.php   (with props)
    trunk/titania/includes/overlords/queue.php   (with props)
Modified:
    trunk/titania/ariel_convert.php
    trunk/titania/common.php
    trunk/titania/includes/constants.php
    trunk/titania/includes/core/object_message.php
    trunk/titania/includes/functions_install.php
    trunk/titania/includes/objects/contribution.php
    trunk/titania/includes/objects/revision.php
    trunk/titania/install.php

Modified: trunk/titania/ariel_convert.php
==============================================================================
*** trunk/titania/ariel_convert.php (original)
--- trunk/titania/ariel_convert.php Sat Feb  6 23:41:41 2010
***************
*** 275,284 ****
  				//echo 'Revision phpBB version is ' . $row['revision_phpbb_version'] . ' - ' . $row['contrib_name'] . ' - ' . $row['revision_id'] . '<br />';
  			}
  
! 			$ignore = array(-2, -3, -4, -5, -6);
  			if (in_array($row['queue_status'], $ignore))
  			{
! 				// Skip revisions that were denied, canned, etc
  				continue;
  			}
  
--- 275,284 ----
  				//echo 'Revision phpBB version is ' . $row['revision_phpbb_version'] . ' - ' . $row['contrib_name'] . ' - ' . $row['revision_id'] . '<br />';
  			}
  
! 			$ignore = array(-3, -4, -5, -6);
  			if (in_array($row['queue_status'], $ignore))
  			{
! 				// Skip revisions that were canned, etc
  				continue;
  			}
  
***************
*** 302,308 ****
  				break;
  
  				default :
! 					//echo $row['revision_filename'] . ' ' . $mime_type . ' ' . $filename . '<br />';
  					continue;
  				break;
  			}
--- 302,308 ----
  				break;
  
  				default :
! 					echo $row['revision_filename'] . ' ' . $mime_type . ' ' . $filename . '<br />';
  					continue;
  				break;
  			}
***************
*** 374,382 ****
  		$display_message = 'Revisions table';
  	break;
  
- 	// @todo Queue
- 
  	case 4 :
  		$sync = new titania_sync;
  
  		$sync->authors('count');
--- 374,442 ----
  		$display_message = 'Revisions table';
  	break;
  
  	case 4 :
+ 		$sql = 'SELECT COUNT(queue_id) AS cnt FROM ' . $ariel_prefix . 'queue';
+ 		phpbb::$db->sql_query($sql);
+ 		$total = phpbb::$db->sql_fetchfield('cnt');
+ 		phpbb::$db->sql_freeresult();
+ 
+ 		$queue_swap = array(
+ 			1	=> TITANIA_QUEUE_NEW, // QUEUE_NEW
+ 			2	=> 17, // QUEUE_SPECIAL -> QUEUE_VALIDATING
+ 			3	=> 19, // QUEUE_APPROVE
+ 			4	=> 20, // QUEUE_DENY
+ 			-1	=> TITANIA_QUEUE_APPROVED, // QUEUE_CLOSED
+ 			-2	=> TITANIA_QUEUE_DENIED, // QUEUE_DENIED
+ 		);
+ 
+ 		$sql = 'SELECT q.*, ct.topic_id, c.contrib_name_clean
+ 			FROM ' . $ariel_prefix . 'queue q, ' . $ariel_prefix . 'contrib_topics ct, ' . TITANIA_CONTRIBS_TABLE . ' c
+ 			WHERE ct.contrib_id = q.contrib_id
+ 				AND ct.topic_type = 4
+ 				AND c.contrib_id = q.contrib_id
+ 			ORDER BY queue_id ASC';
+ 		$result = phpbb::$db->sql_query_limit($sql, $limit, $start);
+ 		while ($row = phpbb::$db->sql_fetchrow($result))
+ 		{
+ 			$ignore = array(-3, -4, -5, -6);
+ 			if (in_array($row['queue_status'], $ignore))
+ 			{
+ 				// Skip revisions that were canned, etc
+ 				continue;
+ 			}
+ 
+ 			$sql_ary = array(
+ 				'queue_id'				=> $row['queue_id'],
+ 				'revision_id'			=> $row['revision_id'],
+ 				'contrib_id'			=> $row['contrib_id'],
+ 				'contrib_name_clean'	=> $row['contrib_name_clean'],
+ 				'submitter_user_id'		=> $row['user_id'],
+ 				'queue_topic_id'		=> $row['topic_id'],
+ 
+ 				'queue_type'			=> $row['contrib_type'],
+ 				'queue_status'			=> $queue_swap[$row['queue_status']],
+ 				'queue_submit_time'		=> $row['queue_opened'],
+ 				'queue_close_time'		=> $row['queue_closed'],
+ 
+ 				'queue_notes'			=> '',
+ 				'queue_notes_bitfield'	=> '',
+ 				'queue_notes_uid'		=> '',
+ 				'queue_notes_options'	=> 7,
+ 
+ 				'mpv_results'			=> '',
+ 				'mpv_results_bitfield'	=> '',
+ 				'mpv_results_uid'		=> '',
+ 				'automod_results'		=> '',
+ 			);
+ 
+ 			titania_insert(TITANIA_QUEUE_TABLE, $sql_ary);
+ 		}
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		$display_message = 'Queue';
+ 	break;
+ 
+ 	case 5 :
  		$sync = new titania_sync;
  
  		$sync->authors('count');
***************
*** 384,390 ****
  		$display_message = 'Authors';
  	break;
  
! 	case 5 :
  		$sync = new titania_sync;
  
  		$sync->contribs('validated');
--- 444,450 ----
  		$display_message = 'Authors';
  	break;
  
! 	case 6 :
  		$sync = new titania_sync;
  
  		$sync->contribs('validated');
***************
*** 394,411 ****
  		$display_message = 'Syncing';
  	break;
  
! 	case 6 :
  		$sync = new titania_sync;
  
  		// Truncate index first
! 		titania_search::truncate();
  
! 		$sync->contribs('index');
  
  		$display_message = 'Indexing';
  	break;
  
! 	case 7 :
  		phpbb::$cache->purge();
  
  		trigger_error('Ariel Conversion Finished!');
--- 454,471 ----
  		$display_message = 'Syncing';
  	break;
  
! 	case 7 :
  		$sync = new titania_sync;
  
  		// Truncate index first
! 		//titania_search::truncate();
  
! 		//$sync->contribs('index');
  
  		$display_message = 'Indexing';
  	break;
  
! 	case 8 :
  		phpbb::$cache->purge();
  
  		trigger_error('Ariel Conversion Finished!');

Modified: trunk/titania/common.php
==============================================================================
*** trunk/titania/common.php (original)
--- trunk/titania/common.php Sat Feb  6 23:41:41 2010
***************
*** 17,23 ****
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.1.32');
  
  define('PHPBB_MSG_HANDLER', 'titania_msg_handler');
  define('PHPBB_USE_BOARD_URL_PATH', true);
--- 17,23 ----
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.1.33');
  
  define('PHPBB_MSG_HANDLER', 'titania_msg_handler');
  define('PHPBB_USE_BOARD_URL_PATH', true);

Modified: trunk/titania/includes/constants.php
==============================================================================
*** trunk/titania/includes/constants.php (original)
--- trunk/titania/includes/constants.php Sat Feb  6 23:41:41 2010
***************
*** 49,56 ****
  define('TITANIA_WATCH_TABLE',					$table_prefix . 'watch');
  
  // Contribution revision/queue status
! define('TITANIA_QUEUE_HIDE', 0); // Special case to hide revisions from the queue as they are in the process of being created (so we can store stuff like MPV, Automod test)
! define('TITANIA_QUEUE_NEW', 1);
  
  // Contrib status
  define('TITANIA_CONTRIB_NEW', 1); // Does not have any validated revisions
--- 49,57 ----
  define('TITANIA_WATCH_TABLE',					$table_prefix . 'watch');
  
  // Contribution revision/queue status
! define('TITANIA_QUEUE_DENIED', -2); // Special case to hide denied revisions from the queue
! define('TITANIA_QUEUE_APPROVED', -1); // Special case to hide approved revisions from the queue
! define('TITANIA_QUEUE_NEW', 1); // Same as QUEUE_NEW in the Tag Fields table
  
  // Contrib status
  define('TITANIA_CONTRIB_NEW', 1); // Does not have any validated revisions

Modified: trunk/titania/includes/core/object_message.php
==============================================================================
*** trunk/titania/includes/core/object_message.php (original)
--- trunk/titania/includes/core/object_message.php Sat Feb  6 23:41:41 2010
***************
*** 37,42 ****
--- 37,55 ----
  	protected $message_parsed_for_storage = false;
  
  	/**
+ 	* Catch submits and make sure we parse messages for storage
+ 	*/
+ 	public function submit()
+ 	{
+ 		if (!$this->message_parsed_for_storage)
+ 		{
+ 			$this->generate_text_for_storage();
+ 		}
+ 
+ 		parent::submit();
+ 	}
+ 
+ 	/**
  	 * Submit data in the post_data format (from includes/tools/message.php)
  	 *
  	 * @param object $message The message object

Modified: trunk/titania/includes/functions_install.php
==============================================================================
*** trunk/titania/includes/functions_install.php (original)
--- trunk/titania/includes/functions_install.php Sat Feb  6 23:41:41 2010
***************
*** 52,58 ****
  	$tag_types = array(
  		array(
  			'tag_type_id'	=> 1,
! 			'tag_type_name'	=> 'Validation Queue',
  		)
  	);
  
--- 52,58 ----
  	$tag_types = array(
  		array(
  			'tag_type_id'	=> 1,
! 			'tag_type_name'	=> 'QUEUE_TAGS',
  		)
  	);
  
***************
*** 95,100 ****
--- 95,114 ----
  			'tag_clean_name'	=> 'testing',
  			'no_delete'			=> false,
  		),
+ 		array(
+ 			'tag_id'			=> 19,
+ 			'tag_type_id'		=> 1,
+ 			'tag_field_name'	=> 'QUEUE_APPROVE',
+ 			'tag_clean_name'	=> 'approve',
+ 			'no_delete'			=> false,
+ 		),
+ 		array(
+ 			'tag_id'			=> 20,
+ 			'tag_type_id'		=> 1,
+ 			'tag_field_name'	=> 'QUEUE_DENY',
+ 			'tag_clean_name'	=> 'deny',
+ 			'no_delete'			=> false,
+ 		),
  	);
  
  	$umil->table_row_insert(TITANIA_TAG_FIELDS_TABLE, $tags);

Modified: trunk/titania/includes/objects/contribution.php
==============================================================================
*** trunk/titania/includes/objects/contribution.php (original)
--- trunk/titania/includes/objects/contribution.php Sat Feb  6 23:41:41 2010
***************
*** 826,839 ****
  			return false;
  		}
  
! 		$sql = 'SELECT revision_id FROM ' . TITANIA_REVISIONS_TABLE . '
  			WHERE contrib_id = ' . (int) $this->contrib_id . '
! 				AND revision_validated = 0
! 				AND revision_submitted = 1';
! 		$result = phpbb::$db->sql_query($sql);
! 		$row = phpbb::$db->sql_fetchrow($result);
! 		phpbb::$db->sql_freeresult($result);
  
! 		return (!$row) ? false : true;
  	}
  }
--- 826,838 ----
  			return false;
  		}
  
! 		$sql = 'SELECT COUNT(revision_id) AS cnt FROM ' . TITANIA_QUEUE_TABLE . '
  			WHERE contrib_id = ' . (int) $this->contrib_id . '
! 				AND queue_status > 1';
! 		phpbb::$db->sql_query($sql);
! 		$cnt = phpbb::$db->sql_fetchfield('cnt');
! 		phpbb::$db->sql_freeresult();
  
! 		return ($cnt) ? true : false;
  	}
  }

Added: trunk/titania/includes/objects/queue.php
==============================================================================
*** trunk/titania/includes/objects/queue.php (added)
--- trunk/titania/includes/objects/queue.php Sat Feb  6 23:41:41 2010
***************
*** 0 ****
--- 1,134 ----
+ <?php
+ /**
+ *
+ * @package Titania
+ * @version $Id$
+ * @copyright (c) 2008 phpBB Customisation Database Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ *
+ */
+ 
+ /**
+ * @ignore
+ */
+ if (!defined('IN_TITANIA'))
+ {
+ 	exit;
+ }
+ 
+ if (!class_exists('titania_message_object'))
+ {
+ 	require TITANIA_ROOT . 'includes/core/object_message.' . PHP_EXT;
+ }
+ 
+ /**
+ * Class to abstract titania queue
+ * @package Titania
+ */
+ class titania_queue extends titania_message_object
+ {
+ 	/**
+ 	 * SQL Table
+ 	 *
+ 	 * @var string
+ 	 */
+ 	protected $sql_table = TITANIA_QUEUE_TABLE;
+ 
+ 	/**
+ 	 * SQL identifier field
+ 	 *
+ 	 * @var string
+ 	 */
+ 	protected $sql_id_field = 'queue_id';
+ 
+ 	/**
+ 	 * Object type (for message tool)
+ 	 *
+ 	 * @var string
+ 	 */
+ 	protected $object_type = TITANIA_QUEUE;
+ 
+ 	/**
+ 	* Unread
+ 	*
+ 	* @var bool
+ 	*/
+ 	public $unread = true;
+ 
+ 	public function __construct()
+ 	{
+ 		// Configure object properties
+ 		$this->object_config = array_merge($this->object_config, array(
+ 			'queue_id'				=> array('default' => 0),
+ 			'revision_id'			=> array('default' => 0),
+ 			'contrib_id'			=> array('default' => 0),
+ 			'contrib_name_clean'	=> array('default' => ''),
+ 			'submitter_user_id'		=> array('default' => (int) phpbb::$user->data['user_id']),
+ 			'queue_topic_id'		=> array('default' => 0),
+ 
+ 			'queue_type'			=> array('default' => 0),
+ 			'queue_status'			=> array('default' => TITANIA_QUEUE_NEW), // Uses either TITANIA_QUEUE_NEW or one of the tags for the queue status from the DB
+ 			'queue_submit_time'		=> array('default' => titania::$time),
+ 			'queue_close_time'		=> array('default' => 0),
+ 
+ 			'queue_notes'			=> array('default' => '',	'message_field' => 'message'),
+ 			'queue_notes_bitfield'	=> array('default' => '',	'message_field' => 'message_bitfield'),
+ 			'queue_notes_uid'		=> array('default' => '',	'message_field' => 'message_uid'),
+ 			'queue_notes_options'	=> array('default' => 7,	'message_field' => 'message_options'),
+ 
+ 			'mpv_results'			=> array('default' => ''),
+ 			'mpv_results_bitfield'	=> array('default' => ''),
+ 			'mpv_results_uid'		=> array('default' => ''),
+ 			'automod_results'		=> array('default' => ''),
+ 		));
+ 	}
+ 
+ 	public function submit()
+ 	{
+ 		$sql = 'SELECT contrib_name_clean, contrib_type FROM ' . TITANIA_CONTRIBS_TABLE . '
+ 			WHERE contrib_id = ' . (int) $this->contrib_id;
+ 		$result = phpbb::$db->sql_query($sql);
+ 		$row = phpbb::$db->sql_fetchrow($result);
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		$this->contrib_name_clean = $row['contrib_name_clean'];
+ 		$this->queue_type = $row['contrib_type'];
+ 	}
+ 
+ 	public function assign_details($return = false)
+ 	{
+ 		$folder_img = $folder_alt = '';
+ 		$this->folder_img($folder_img, $folder_alt);
+ 
+ 		$output = array(
+ 			'U_VIEW_TOPIC'				=> phpbb::append_sid('viewtopic', 't=' . $this->queue_topic_id),
+ 			'U_VIEW_CONTRIB'			=> titania_url::build_url(titania_types::$types[$this->queue_type]->url . '/' . $this->contrib_name_clean . '/'),
+ 
+ 			'S_UNREAD'					=> ($this->unread) ? true : false,
+ 
+ 			'FOLDER_IMG'				=> phpbb::$user->img($folder_img, $folder_alt),
+ 			'FOLDER_IMG_SRC'			=> phpbb::$user->img($folder_img, $folder_alt, false, '', 'src'),
+ 			'FOLDER_IMG_ALT'			=> phpbb::$user->lang[$folder_alt],
+ 			'FOLDER_IMG_ALT'			=> phpbb::$user->lang[$folder_alt],
+ 			'FOLDER_IMG_WIDTH'			=> phpbb::$user->img($folder_img, '', false, '', 'width'),
+ 			'FOLDER_IMG_HEIGHT'			=> phpbb::$user->img($folder_img, '', false, '', 'height'),
+ 		);
+ 
+ 		if ($return)
+ 		{
+ 			return $output;
+ 		}
+ 
+ 		phpbb::$template->assign_vars($output);
+ 	}
+ 
+ 	/**
+ 	* Generate topic status
+ 	*/
+ 	public function folder_img(&$folder_img, &$folder_alt)
+ 	{
+ 		titania::_include('functions_display', 'titania_topic_folder_img');
+ 
+ 		titania_topic_folder_img($folder_img, $folder_alt, 0, $this->unread);
+ 	}
+ }
\ No newline at end of file

Propchange: trunk/titania/includes/objects/queue.php
------------------------------------------------------------------------------
    svn:keywords = Revision Author Date Id

Modified: trunk/titania/includes/objects/revision.php
==============================================================================
*** trunk/titania/includes/objects/revision.php (original)
--- trunk/titania/includes/objects/revision.php Sat Feb  6 23:41:41 2010
***************
*** 107,117 ****
  		{
  			// Set to the correct phpBB version (only support 3.0.x for now)
  			$this->phpbb_version = titania::$config->phpbb_versions['30'];
- 		}
  
- 		// Some stuff for new submissions
- 		if (!$this->revision_id && $this->revision_submitted || ($this->revision_id && !$this->sql_data['revision_submitted'] && $this->revision_submitted))
- 		{
  			// Update the contrib_last_update if required here
  			if (!titania::$config->require_validation)
  			{
--- 107,113 ----
***************
*** 120,128 ****
  					WHERE contrib_id = ' . $this->contrib_id;
  				phpbb::$db->sql_query($sql);
  			}
  
! 			// Create queue topic if required
! 			$this->queue_topic();
  		}
  
  		parent::submit();
--- 116,137 ----
  					WHERE contrib_id = ' . $this->contrib_id;
  				phpbb::$db->sql_query($sql);
  			}
+ 		}
  
! 		$create_queue = (!$this->revision_id && $this->revision_submitted || ($this->revision_id && !$this->sql_data['revision_submitted'] && $this->revision_submitted)) ? true : false;
! 
! 		parent::submit();
! 
! 		// Create queue entry
! 		if (titania::$config->use_queue && $create_queue)
! 		{
! 			$queue = new titania_queue;
! 			$queue->__set_array(array(
! 				'revision_id'			=> $this->revision_id,
! 				'contrib_id'			=> $this->contrib_id,
! 				'contrib_name_clean'	=> $this->contrib->contrib_name_clean,
! 				'queue_status'			=> TITANIA_QUEUE_NEW,
! 			));
  		}
  
  		parent::submit();
***************
*** 145,227 ****
  	}
  
  	/**
- 	* Handle the queue topic
- 	*
- 	* @param bool $hide_topic True to keep it hidden from the queue yet (during the process of creating the revision yet)
- 	* @param string $add_to_message A string to attach to the post_text of the post (if the topic already exists, appends to the already created post, else adds to the new topic we'll make)
- 	* @param regex|bool $remove_from_message Remove something from the message (only when editing).  Used for removing an error message that was added after a test succeeds
- 	*/
- 	public function queue_topic($hide_topic = false, $add_to_message = '', $remove_from_message = false)
- 	{
- 		if (!titania::$config->use_queue)
- 		{
- 			return;
- 		}
- 
- 		titania::add_lang('manage');
- 
- 		$add_to_message = ($add_to_message) ? "\n\n" . $add_to_message : '';
- 
- 		if (!$this->queue_topic_id)
- 		{
- 			$post = new titania_post(TITANIA_QUEUE);
- 			$post->topic->contrib = $this->contrib;
- 			$post->__set_array(array(
- 				'post_subject'		=> $this->contrib->contrib_name . ' - ' . $this->revision_version,
- 				'post_text'			=> sprintf(phpbb::$user->lang['VALIDATION_POST'], $this->contrib->get_url(), $this->get_url()) . $add_to_message,
- 				'post_access'		=> TITANIA_ACCESS_AUTHORS,
- 			));
- 			$post->topic->__set_array(array(
- 				'contrib_id'		=> $this->contrib->contrib_id,
- 				'topic_status'		=> ($hide_topic) ? TITANIA_QUEUE_HIDE : TITANIA_QUEUE_NEW,
- 			));
- 			$post->submit();
- 
- 			$this->queue_topic_id = $post->topic->topic_id;
- 
- 			$sql = 'UPDATE ' . $this->sql_table . ' SET queue_topic_id = ' . (int) $this->queue_topic_id . '
- 				WHERE revision_id = ' . $this->revision_id;
- 			phpbb::$db->sql_query($sql);
- 
- 			return $post->topic->get_url();
- 		}
- 		else
- 		{
- 			// Load the post and topic
- 			$topic = new titania_topic(TITANIA_QUEUE, $this->contrib, $this->queue_topic_id);
- 			$topic->load();
- 
- 			$post = new titania_post(TITANIA_QUEUE, $topic, $topic->topic_first_post_id);
- 			$post->load();
- 			$for_edit = $post->generate_text_for_edit();
- 			$post->post_text = $for_edit['text'];
- 
- 			// Remove what was wanted, if any
- 			if ($remove_from_message !== false)
- 			{
- 				$post->post_text = preg_replace($remove_from_message, '', $post->post_text);
- 			}
- 
- 			// Add to the post text what is wanted
- 			if ($add_to_message)
- 			{
- 				$post->post_text .= $add_to_message;
- 			}
- 
- 			// Reparse the text
- 			$post->reparse();
- 
- 			$post->topic->__set_array(array(
- 				'topic_status'		=> ($hide_topic) ? TITANIA_QUEUE_HIDE : TITANIA_QUEUE_NEW,
- 			));
- 
- 			$post->submit();
- 
- 			return $post->topic->get_url();
- 		}
- 	}
- 
- 	/**
  	 * Download URL
  	 */
  	public function get_url()
--- 154,159 ----

Added: trunk/titania/includes/overlords/queue.php
==============================================================================
*** trunk/titania/includes/overlords/queue.php (added)
--- trunk/titania/includes/overlords/queue.php Sat Feb  6 23:41:41 2010
***************
*** 0 ****
--- 1,164 ----
+ <?php
+ /**
+ *
+ * @package Titania
+ * @version $Id$
+ * @copyright (c) 2008 phpBB Customisation Database Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ *
+ */
+ 
+ /**
+ * @ignore
+ */
+ if (!defined('IN_TITANIA'))
+ {
+ 	exit;
+ }
+ 
+ class queue_overlord
+ {
+ 	/**
+ 	* Queue array
+ 	* Stores [id] => row
+ 	*
+ 	* @var array
+ 	*/
+ 	public static $queue = array();
+ 
+ 	public static $sort_by = array(
+ 		't' => array('POST_TIME', 'q.queue_submit_time', true),
+ 	);
+ 
+ 	/**
+ 	* Load queue(s) from queue id(s)
+ 	*
+ 	* @param int|array $queue_id queue_id or an array of queue_ids
+ 	*/
+ 	public static function load_queue($queue_id)
+ 	{
+ 		if (!is_array($queue_id))
+ 		{
+ 			$queue_id = array($queue_id);
+ 		}
+ 
+ 		// Only get the rows for those we have not gotten already
+ 		$queue_id = array_diff($queue_id, array_keys(self::$queue));
+ 
+ 		if (!sizeof($queue_id))
+ 		{
+ 			return;
+ 		}
+ 
+ 		$sql_ary = array(
+ 			'SELECT' => 'q.*',
+ 
+ 			'FROM'		=> array(
+ 				TITANIA_QUEUE_TABLE	=> 'q',
+ 				TITANIA_CONTRIBS_TABLE	=> 'c',
+ 			),
+ 
+ 			'WHERE' => phpbb::$db->sql_in_set('q.queue_id', array_map('intval', $queue_id)) . '
+ 				AND c.contrib_id = q.contrib_id'
+ 		);
+ 
+ 		$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
+ 
+ 		$result = phpbb::$db->sql_query($sql);
+ 
+ 		while($row = phpbb::$db->sql_fetchrow($result))
+ 		{
+ 			self::$queue[$row['queue_id']] = $row;
+ 		}
+ 
+ 		phpbb::$db->sql_freeresult($result);
+ 	}
+ 
+ 	/**
+ 	* Display forum-like list for queue
+ 	*
+ 	* @param string $type The type of queue (the contrib type)
+ 	* @param object|boolean $sort The sort object (includes/tools/sort.php)
+ 	* @param object|boolean $pagination The pagination object (includes/tools/pagination.php)
+ 	*/
+ 	public static function display_forums($type, $sort = false, $pagination = false)
+ 	{
+ 		if ($sort === false)
+ 		{
+ 			// Setup the sort tool
+ 			$sort = new titania_sort();
+ 			$sort->set_sort_keys(self::$sort_by);
+ 			$sort->default_dir = phpbb::$user->data['user_topic_sortby_dir'];
+ 		}
+ 
+ 		if ($pagination === false)
+ 		{
+ 			// Setup the pagination tool
+ 			$pagination = new titania_pagination();
+ 			$pagination->default_limit = phpbb::$config['topics_per_page'];
+ 			$pagination->request();
+ 		}
+ 		//$pagination->result_lang = 'TOTAL_TOPICS';
+ 
+ 		$queue_ids = array();
+ 
+ 		$sql_ary = array(
+ 			'SELECT' => 'q.*',
+ 
+ 			'FROM'		=> array(
+ 				TITANIA_QUEUE_TABLE	=> 'q',
+ 				TITANIA_CONTRIBS_TABLE	=> 'c',
+ 			),
+ 
+ 			'WHERE' => 'q.queue_type = ' . (int) $type . '
+ 				AND c.contrib_id = q.contrib_id',
+ 
+ 			'ORDER_BY'	=> $sort->get_order_by(),
+ 		);
+ 
+ 		titania_tracking::get_track_sql($sql_ary, TITANIA_QUEUE, 'q.queue_id');
+ 
+ 		// Main SQL Query
+ 		$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
+ 
+ 		// Handle pagination
+ 		$pagination->sql_count($sql_ary, 'q.queue_id');
+ 		$pagination->build_pagination(titania_url::$current_page, titania_url::$params);
+ 
+ 		$queue = new titania_queue();
+ 		$queue_ids = $user_ids = array();
+ 
+ 		// Get the data
+ 		$result = phpbb::$db->sql_query_limit($sql, $pagination->limit, $pagination->start);
+ 
+ 		while ($row = phpbb::$db->sql_fetchrow($result))
+ 		{
+ 			// Store the tracking info we grabbed in the tool
+ 			if (isset($row['track_time']))
+ 			{
+ 				titania_tracking::store_track(TITANIA_QUEUE, $row['queue_id'], $row['track_time']);
+ 			}
+ 
+ 			$queue_ids[] = $row['queue_id'];
+ 			$user_ids[] = $row['submitter_user_id'];
+ 
+ 			self::$queue[$row['queue_id']] = $row;
+ 		}
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		users_overlord::load_users($user_ids);
+ 
+ 		foreach ($queue_ids as $queue_id)
+ 		{
+ 			$queue->__set_array(self::$queue[$queue_id]);
+ 			$queue->unread = titania_tracking::is_unread(TITANIA_QUEUE, $queue_id, $queue->queue_submit_time);
+ 
+ 			phpbb::$template->assign_block_vars('queue_list', array_merge(
+ 				$queue->assign_details(true),
+ 				users_overlord::assign_details($queue->submitter_user_id)
+ 			));
+ 		}
+ 
+ 		unset($queue);
+ 	}
+ }

Propchange: trunk/titania/includes/overlords/queue.php
------------------------------------------------------------------------------
    svn:keywords = Revision Author Date Id

Modified: trunk/titania/install.php
==============================================================================
*** trunk/titania/install.php (original)
--- trunk/titania/install.php Sat Feb  6 23:41:41 2010
***************
*** 517,522 ****
--- 517,539 ----
  		)
  	),
  
+ 	'0.1.33' => array(
+ 		'table_column_remove' => array(
+ 			array(TITANIA_QUEUE_TABLE, 'queue_progress'),
+ 		),
+ 
+ 		'table_column_add' => array(
+ 			array(TITANIA_QUEUE_TABLE, 'contrib_name_clean', array('VCHAR_CI', '')),
+ 			array(TITANIA_QUEUE_TABLE, 'queue_topic_id', array('UINT', 0)),
+ 			array(TITANIA_QUEUE_TABLE, 'mpv_results', array('MTEXT_UNI', '')),
+ 			array(TITANIA_QUEUE_TABLE, 'mpv_results_bitfield', array('VCHAR:255', '')),
+ 			array(TITANIA_QUEUE_TABLE, 'mpv_results_uid', array('VCHAR:8', '')),
+ 			array(TITANIA_QUEUE_TABLE, 'automod_results', array('MTEXT_UNI', '')),
+ 		),
+ 
+ 		'custom' => 'titania_tags',
+ 	),
+ 
  	// IF YOU ADD A NEW VERSION DO NOT FORGET TO INCREMENT THE VERSION NUMBER IN common.php!
  );
  




More information about the customisationdb-commits mailing list