[Customisation Database Commits] r1056 [2/3] - /branches/stable/titania/ /branches/stable/titania/docs/ /branches/stable/titania/includes/manage_tools/ /branches/stable/titania/manage/ /misc/ /misc/includes/ /misc/includes/manage_tools/ /trunk/titania/ /trunk/titania/docs/

Nathan Guse exreaction at phpbb.com
Mon Apr 12 20:11:28 BST 2010


Modified: branches/stable/titania/install.php
==============================================================================
*** branches/stable/titania/install.php (original)
--- branches/stable/titania/install.php Mon Apr 12 20:11:28 2010
***************
*** 8,13 ****
--- 8,15 ----
   *
   */
  
+ die('Do not use me!');
+ 
  /**
   * @ignore
   */
***************
*** 42,48 ****
  $version_config_name = 'titania_version';
  
  $versions = array(
! 	'0.1.31'	=> array(
  		'table_add' => array(
  			array(TITANIA_ATTACHMENTS_TABLE, array(
  				'COLUMNS'		=> array(
--- 44,50 ----
  $version_config_name = 'titania_version';
  
  $versions = array(
! 	'0.3.0'	=> array(
  		'table_add' => array(
  			array(TITANIA_ATTACHMENTS_TABLE, array(
  				'COLUMNS'		=> array(
***************
*** 71,76 ****
--- 73,118 ----
  					'is_orphan'				=> array('INDEX', 'is_orphan'),
  				),
  			)),
+ 			array(TITANIA_ATTENTION_TABLE, array(
+ 				'COLUMNS'		=> array(
+ 					'attention_id'					=> array('UINT', NULL, 'auto_increment'),
+ 					'attention_type'				=> array('UINT', 0), // attention type constants (reported, needs approval, etc)
+ 					'attention_object_type'			=> array('UINT', 0),
+ 					'attention_object_id'			=> array('UINT', 0),
+ 					'attention_url'					=> array('VCHAR_CI', ''),
+ 					'attention_requester'			=> array('UINT', 0),
+ 					'attention_time'				=> array('TIMESTAMP', 0),
+ 					'attention_close_time'			=> array('TIMESTAMP', 0),
+ 					'attention_close_user'			=> array('UINT', 0),
+ 					'attention_title'				=> array('STEXT_UNI', ''),
+ 					'attention_description'			=> array('MTEXT_UNI', ''),
+ 					'attention_poster_id'			=> array('UINT', 0),
+ 					'attention_post_time'			=> array('TIMESTAMP', 0),
+ 				),
+ 				'PRIMARY_KEY'	=> 'attention_id',
+ 				'KEYS'			=> array(
+ 					'attention_type'				=> array('INDEX', 'attention_type'),
+ 					'attention_object_type'			=> array('INDEX', 'attention_object_type'),
+ 					'attention_object_id'			=> array('INDEX', 'attention_object_id'),
+ 					'attention_time'				=> array('INDEX', 'attention_time'),
+ 					'attention_close_time'			=> array('INDEX', 'attention_close_time'),
+ 					'attention_close_user'			=> array('INDEX', 'attention_close_user'),
+ 					'attention_poster_id'			=> array('INDEX', 'attention_poster_id'),
+ 					'attention_post_time'			=> array('INDEX', 'attention_post_time'),
+ 				),
+ 			)),
+ 			array(TITANIA_AUTOMOD_QUEUE_TABLE, array(
+ 				'COLUMNS'		=> array(
+ 					'row_id'					=> array('UINT', NULL, 'auto_increment'),
+ 					'revision_id'				=> array('UINT', 0),
+ 					'phpbb_version_branch'		=> array('TINT:1', 0),
+ 					'phpbb_version_revision'	=> array('VCHAR', ''),
+ 				),
+ 				'PRIMARY_KEY'	=> 'row_id',
+ 				'KEYS'			=> array(
+ 					'revision_id'				=> array('INDEX', 'revision_id'),
+ 				),
+ 			)),
  			array(TITANIA_AUTHORS_TABLE, array(
  				'COLUMNS'		=> array(
  					'author_id'				=> array('UINT', NULL, 'auto_increment'),
***************
*** 144,149 ****
--- 186,192 ----
  					'contrib_visible'				=> array('BOOL', 1),
  					'contrib_last_update'			=> array('TIMESTAMP', 0),
  					'contrib_demo'					=> array('VCHAR_UNI:200', ''),
+ 					'contrib_release_topic_id'		=> array('UINT', 0),
  				),
  				'PRIMARY_KEY'	=> 'contrib_id',
  				'KEYS'			=> array(
***************
*** 154,159 ****
--- 197,203 ----
  					'contrib_downloads'		=> array('INDEX', 'contrib_downloads'),
  					'contrib_rating'		=> array('INDEX', 'contrib_rating'),
  					'contrib_visible'		=> array('INDEX', 'contrib_visible'),
+ 					'contrib_last_update'	=> array('INDEX', 'contrib_last_update'),
  				),
  			)),
  			array(TITANIA_CONTRIB_COAUTHORS_TABLE, array(
***************
*** 171,177 ****
  				'COLUMNS'		=> array(
  					'faq_id'				=> array('UINT', NULL, 'auto_increment'),
  					'contrib_id'			=> array('UINT', 0),
! 					'faq_order_id'			=> array('UINT', 0),
  					'faq_subject'			=> array('STEXT_UNI', '', 'true_sort'),
  					'faq_text'				=> array('MTEXT_UNI', ''),
  					'faq_text_bitfield'		=> array('VCHAR:255', ''),
--- 215,222 ----
  				'COLUMNS'		=> array(
  					'faq_id'				=> array('UINT', NULL, 'auto_increment'),
  					'contrib_id'			=> array('UINT', 0),
! 					'left_id'				=> array('UINT', 0),
! 					'right_id'				=> array('UINT', 0),
  					'faq_subject'			=> array('STEXT_UNI', '', 'true_sort'),
  					'faq_text'				=> array('MTEXT_UNI', ''),
  					'faq_text_bitfield'		=> array('VCHAR:255', ''),
***************
*** 183,190 ****
  				'PRIMARY_KEY'	=> 'faq_id',
  				'KEYS'			=> array(
  					'contrib_id'		=> array('INDEX', 'contrib_id'),
- 					'faq_order_id'		=> array('INDEX', 'faq_order_id'),
  					'faq_access'		=> array('INDEX', 'faq_access'),
  				),
  			)),
  			array(TITANIA_CONTRIB_IN_CATEGORIES_TABLE, array(
--- 228,235 ----
  				'PRIMARY_KEY'	=> 'faq_id',
  				'KEYS'			=> array(
  					'contrib_id'		=> array('INDEX', 'contrib_id'),
  					'faq_access'		=> array('INDEX', 'faq_access'),
+ 					'left_right_id'		=> array('INDEX', array('left_id', 'right_id')),
  				),
  			)),
  			array(TITANIA_CONTRIB_IN_CATEGORIES_TABLE, array(
***************
*** 198,203 ****
--- 243,249 ----
  				'COLUMNS'		=> array(
  					'post_id'				=> array('UINT', NULL, 'auto_increment'),
  					'topic_id'				=> array('UINT', 0),
+ 					'post_url'				=> array('VCHAR_CI', ''),
  					'post_type'				=> array('TINT:1', 0), // Post Type, Main TITANIA_ constants
  					'post_access'			=> array('TINT:1', 0), // Access level, TITANIA_ACCESS_ constants
  					'post_locked'			=> array('BOOL', 0),
***************
*** 237,249 ****
  					'queue_type'			=> array('TINT:1', 0),
  					'queue_status'			=> array('TINT:1', 0),
  					'submitter_user_id'		=> array('UINT', 0),
  					'queue_notes'			=> array('MTEXT_UNI', ''),
  					'queue_notes_bitfield'	=> array('VCHAR:255', ''),
  					'queue_notes_uid'		=> array('VCHAR:8', ''),
  					'queue_notes_options'	=> array('UINT:11', 7),
! 					'queue_progress'		=> array('TINT:3', 0),
  					'queue_submit_time'		=> array('UINT:11', 0),
  					'queue_close_time'		=> array('UINT:11', 0),
  				),
  				'PRIMARY_KEY'	=> 'queue_id',
  				'KEYS'			=> array(
--- 283,307 ----
  					'queue_type'			=> array('TINT:1', 0),
  					'queue_status'			=> array('TINT:1', 0),
  					'submitter_user_id'		=> array('UINT', 0),
+ 					'queue_allow_repack'	=> array('BOOL', 1),
  					'queue_notes'			=> array('MTEXT_UNI', ''),
  					'queue_notes_bitfield'	=> array('VCHAR:255', ''),
  					'queue_notes_uid'		=> array('VCHAR:8', ''),
  					'queue_notes_options'	=> array('UINT:11', 7),
! 					'queue_validation_notes'			=> array('MTEXT_UNI', ''),
! 					'queue_validation_notes_bitfield'	=> array('VCHAR:255', ''),
! 					'queue_validation_notes_uid'		=> array('VCHAR:8', ''),
! 					'queue_validation_notes_options'	=> array('UINT:11', 7),
  					'queue_submit_time'		=> array('UINT:11', 0),
+ 					'queue_progress'		=> array('UINT', 0), // user_id
+ 					'queue_progress_time'	=> array('UINT:11', 0),
  					'queue_close_time'		=> array('UINT:11', 0),
+ 					'queue_close_user'		=> array('UINT', 0),
+ 					'queue_topic_id'		=> array('UINT', 0),
+ 					'mpv_results'			=> array('MTEXT_UNI', ''),
+ 					'mpv_results_bitfield'	=> array('VCHAR:255', ''),
+ 					'mpv_results_uid'		=> array('VCHAR:8', ''),
+ 					'automod_results'		=> array('MTEXT_UNI', ''),
  				),
  				'PRIMARY_KEY'	=> 'queue_id',
  				'KEYS'			=> array(
***************
*** 278,296 ****
  					'revision_time'				=> array('UINT:11', 0),
  					'revision_validated'		=> array('UINT:11', 0),
  					'validation_date'			=> array('UINT:11', 0),
- 					'phpbb_version'				=> array('STEXT', 0),
  					'install_time'				=> array('USINT', 0),
  					'install_level'				=> array('TINT:1', 0),
  					'revision_submitted'		=> array('BOOL', 0), // So we can hide the revision while we are creating it, false means someone is working on creating it (or did not finish creating it)
! 					'queue_topic_id'			=> array('UINT:11', 0), // Store the queue topic id so we can track it
  				),
  				'PRIMARY_KEY'	=> 'revision_id',
  				'KEYS'			=> array(
  					'contrib_id'			=> array('INDEX', 'contrib_id'),
! 					'revision_validated'	=> array('INDEX', 'revision_validated'),
  					'revision_time'			=> array('INDEX', 'revision_time'),
  					'validation_date'		=> array('INDEX', 'validation_date'),
  					'revision_submitted'	=> array('INDEX', 'revision_submitted'),
  				),
  			)),
  			array(TITANIA_TAG_APPLIED_TABLE, array(
--- 336,372 ----
  					'revision_time'				=> array('UINT:11', 0),
  					'revision_validated'		=> array('UINT:11', 0),
  					'validation_date'			=> array('UINT:11', 0),
  					'install_time'				=> array('USINT', 0),
  					'install_level'				=> array('TINT:1', 0),
  					'revision_submitted'		=> array('BOOL', 0), // So we can hide the revision while we are creating it, false means someone is working on creating it (or did not finish creating it)
! 					'revision_queue_id'			=> array('UINT', 0),
  				),
  				'PRIMARY_KEY'	=> 'revision_id',
  				'KEYS'			=> array(
  					'contrib_id'			=> array('INDEX', 'contrib_id'),
! 					'contrib_validated'		=> array('INDEX', 'contrib_validated'),
  					'revision_time'			=> array('INDEX', 'revision_time'),
  					'validation_date'		=> array('INDEX', 'validation_date'),
  					'revision_submitted'	=> array('INDEX', 'revision_submitted'),
+ 					'revision_queue_id'		=> array('INDEX', 'revision_queue_id'),
+ 				),
+ 			)),
+ 			array(TITANIA_REVISIONS_PHPBB_TABLE, array(
+ 				'COLUMNS'		=> array(
+ 					'row_id'					=> array('UINT', NULL, 'auto_increment'),
+ 					'revision_id'				=> array('UINT', 0),
+ 					'contrib_id'				=> array('UINT', 0),
+ 					'phpbb_version_branch'		=> array('TINT:1', 0),
+ 					'phpbb_version_revision'	=> array('VCHAR', ''),
+ 					'revision_validated'		=> array('BOOL', 0),
+ 				),
+ 				'PRIMARY_KEY'	=> 'row_id',
+ 				'KEYS'			=> array(
+ 					'revision_id'				=> array('INDEX', 'revision_id'),
+ 					'contrib_id'				=> array('INDEX', 'contrib_id'),
+ 					'phpbb_version_branch'		=> array('INDEX', 'phpbb_version_branch'),
+ 					'phpbb_version_revision'	=> array('INDEX', 'phpbb_version_revision'),
+ 					'revision_validated'		=> array('INDEX', 'revision_validated'),
  				),
  			)),
  			array(TITANIA_TAG_APPLIED_TABLE, array(
***************
*** 326,332 ****
  			array(TITANIA_TOPICS_TABLE, array(
  				'COLUMNS'		=> array(
  					'topic_id'						=> array('UINT', NULL, 'auto_increment'),
! 					'contrib_id'					=> array('UINT', 0),
  					'topic_type'					=> array('TINT:1', 0), // Post Type, Main TITANIA_ constants
  					'topic_access'					=> array('TINT:1', 0), // Access level, TITANIA_ACCESS_ constants
  					'topic_category'				=> array('UINT', 0), // Category for the topic. For the Tracker
--- 402,409 ----
  			array(TITANIA_TOPICS_TABLE, array(
  				'COLUMNS'		=> array(
  					'topic_id'						=> array('UINT', NULL, 'auto_increment'),
! 					'parent_id'						=> array('UINT', 0),
! 					'topic_url'						=> array('VCHAR_CI', ''),
  					'topic_type'					=> array('TINT:1', 0), // Post Type, Main TITANIA_ constants
  					'topic_access'					=> array('TINT:1', 0), // Access level, TITANIA_ACCESS_ constants
  					'topic_category'				=> array('UINT', 0), // Category for the topic. For the Tracker
***************
*** 337,343 ****
  					'topic_locked'					=> array('BOOL', 0),
  					'topic_approved'				=> array('BOOL', 1),
  					'topic_reported'				=> array('BOOL', 0), // True if any posts in the topic are reported
- 					'topic_deleted'					=> array('BOOL', 0), // True if the topic is soft deleted
  					'topic_views'					=> array('UINT', 0),
  					'topic_posts'					=> array('VCHAR', ''), // Post count; separated by : between access levels ('10:9:8' = 10 team; 9 Mod Author; 8 Public)
  					'topic_subject'					=> array('STEXT_UNI', ''),
--- 414,419 ----
***************
*** 356,362 ****
  				),
  				'PRIMARY_KEY'	=> 'topic_id',
  				'KEYS'			=> array(
! 					'contrib_id'			=> array('INDEX', 'contrib_id'),
  					'topic_type'			=> array('INDEX', 'topic_type'),
  					'topic_access'			=> array('INDEX', 'topic_access'),
  					'topic_category'		=> array('INDEX', 'topic_category'),
--- 432,438 ----
  				),
  				'PRIMARY_KEY'	=> 'topic_id',
  				'KEYS'			=> array(
! 					'parent_id'				=> array('INDEX', 'parent_id'),
  					'topic_type'			=> array('INDEX', 'topic_type'),
  					'topic_access'			=> array('INDEX', 'topic_access'),
  					'topic_category'		=> array('INDEX', 'topic_category'),
***************
*** 365,371 ****
  					'topic_sticky'			=> array('INDEX', 'topic_sticky'),
  					'topic_approved'		=> array('INDEX', 'topic_approved'),
  					'topic_reported'		=> array('INDEX', 'topic_reported'),
- 					'topic_deleted'			=> array('INDEX', 'topic_deleted'),
  					'topic_time'			=> array('INDEX', 'topic_time'),
  					'topic_last_post_time'	=> array('INDEX', 'topic_last_post_time'),
  				),
--- 441,446 ----
***************
*** 382,403 ****
  			array(TITANIA_WATCH_TABLE, array(
  				'COLUMNS'		=> array(
  					'watch_type'			=> array('TINT:1', 0),
  					'watch_object_id'		=> array('UINT', 0),
  					'watch_user_id'			=> array('UINT', 0),
  					'watch_mark_time'		=> array('UINT:11', 0),
  				),
! 				'PRIMARY_KEY'	=> array('watch_type', 'watch_object_id', 'watch_user_id'),
  			)),
  		),
  
  		'permission_add' => array(
! 			'u_titania_',
  
! 			'm_titania_author_mod',			// Can moderate author profiles
! 			'm_titania_contrib_mod',		// Can moderate all contrib items
! 			'm_titania_rate_reset',			// Can reset the rating on items
! 			'm_titania_faq_mod',			// Can moderate FAQ entries
! 			'm_titania_post_mod',			// Can moderate topics
  
  			'u_titania_contrib_submit',		// Can submit contrib items
  			'u_titania_rate',				// Can rate items
--- 457,479 ----
  			array(TITANIA_WATCH_TABLE, array(
  				'COLUMNS'		=> array(
  					'watch_type'			=> array('TINT:1', 0),
+ 					'watch_object_type'		=> array('UINT', 0),
  					'watch_object_id'		=> array('UINT', 0),
  					'watch_user_id'			=> array('UINT', 0),
  					'watch_mark_time'		=> array('UINT:11', 0),
  				),
! 				'PRIMARY_KEY'	=> array('watch_object_type', 'watch_object_id', 'watch_user_id', 'watch_type'),
  			)),
  		),
  
  		'permission_add' => array(
! 			'u_titania_admin',				// Can administrate titania
  
! 			'u_titania_mod_author_mod',		// Can moderate author profiles
! 			'u_titania_mod_contrib_mod',	// Can moderate all contrib items
! 			'u_titania_mod_rate_reset',		// Can reset the rating on items
! 			'u_titania_mod_faq_mod',		// Can moderate FAQ entries
! 			'u_titania_mod_post_mod',		// Can moderate topics
  
  			'u_titania_contrib_submit',		// Can submit contrib items
  			'u_titania_rate',				// Can rate items
***************
*** 408,413 ****
--- 484,490 ----
  			'u_titania_bbcode',				// Can post bbcode
  			'u_titania_smilies',			// Can post smilies
  			'u_titania_post',				// Can create new posts
+ 			'u_titania_post_approved',		// Posts are approved?
  			'u_titania_post_edit_own',		// Can edit own posts
  			'u_titania_post_delete_own',	// Can delete own posts
  			'u_titania_post_mod_own',		// Can moderate own topics
***************
*** 415,473 ****
  		),
  
  		'permission_role_add' => array(
! 			array('ROLE_TITANIA_MODIFICATION_TEAM', 'm_'),
! 			array('ROLE_TITANIA_STYLE_TEAM', 'm_'),
! 			array('ROLE_TITANIA_MODERATOR_TEAM', 'm_'),
! 			array('ROLE_TITANIA_ADMINISTRATOR_TEAM', 'm_'),
  		),
  
  		'permission_set' => array(
  			array('ROLE_ADMIN_FULL', array(
! 				'm_titania_author_mod',			// Can moderate author profiles
! 				'm_titania_contrib_mod',		// Can moderate all contrib items
! 				'm_titania_rate_reset',			// Can reset the rating on items
! 				'm_titania_faq_mod',			// Can moderate FAQ entries
! 				'm_titania_post_mod',			// Can moderate topics
! 				'm_titania_mod_queue',			// Can see the modifications queue
! 				'm_titania_mod_validate',		// Can validate modifications
! 				'm_titania_mod_moderate',		// Can moderate modifications
! 				'm_titania_style_queue',		// Can see the styles queue
! 				'm_titania_style_validate',		// Can validate styles
! 				'm_titania_style_moderate',		// Can moderate styles
  			)),
  			array('ROLE_TITANIA_ADMINISTRATOR_TEAM', array(
! 				'm_titania_author_mod',			// Can moderate author profiles
! 				'm_titania_contrib_mod',		// Can moderate all contrib items
! 				'm_titania_rate_reset',			// Can reset the rating on items
! 				'm_titania_faq_mod',			// Can moderate FAQ entries
! 				'm_titania_post_mod',			// Can moderate topics
! 				'm_titania_mod_queue',			// Can see the modifications queue
! 				'm_titania_mod_validate',		// Can validate modifications
! 				'm_titania_mod_moderate',		// Can moderate modifications
! 				'm_titania_style_queue',		// Can see the styles queue
! 				'm_titania_style_validate',		// Can validate styles
! 				'm_titania_style_moderate',		// Can moderate styles
  			)),
  			array('ROLE_TITANIA_MODIFICATION_TEAM', array(
! 				'm_titania_author_mod',			// Can moderate author profiles
! 				'm_titania_faq_mod',			// Can moderate FAQ entries
! 				'm_titania_post_mod',			// Can moderate topics
! 				'm_titania_mod_queue',			// Can see the modifications queue
! 				'm_titania_mod_validate',		// Can validate modifications
! 				'm_titania_mod_moderate',		// Can moderate modifications
  			)),
  			array('ROLE_TITANIA_STYLE_TEAM', array(
! 				'm_titania_author_mod',			// Can moderate author profiles
! 				'm_titania_faq_mod',			// Can moderate FAQ entries
! 				'm_titania_post_mod',			// Can moderate topics
! 				'm_titania_style_queue',		// Can see the styles queue
! 				'm_titania_style_validate',		// Can validate styles
! 				'm_titania_style_moderate',		// Can moderate styles
  			)),
  			array('ROLE_TITANIA_MODERATOR_TEAM', array(
! 				'm_titania_author_mod',			// Can moderate author profiles
! 				'm_titania_faq_mod',			// Can moderate FAQ entries
! 				'm_titania_post_mod',			// Can moderate topics
  			)),
  			array('ROLE_USER_STANDARD', array(
  				'u_titania_contrib_submit',		// Can submit contrib items
--- 492,552 ----
  		),
  
  		'permission_role_add' => array(
! 			array('ROLE_TITANIA_MODIFICATION_TEAM', 'u_'),
! 			array('ROLE_TITANIA_STYLE_TEAM', 'u_'),
! 			array('ROLE_TITANIA_MODERATOR_TEAM', 'u_'),
! 			array('ROLE_TITANIA_ADMINISTRATOR_TEAM', 'u_'),
  		),
  
  		'permission_set' => array(
  			array('ROLE_ADMIN_FULL', array(
! 				'u_titania_admin',					// Can administrate titania
! 				'u_titania_mod_author_mod',			// Can moderate author profiles
! 				'u_titania_mod_contrib_mod',		// Can moderate all contrib items
! 				'u_titania_mod_rate_reset',			// Can reset the rating on items
! 				'u_titania_mod_faq_mod',			// Can moderate FAQ entries
! 				'u_titania_mod_post_mod',			// Can moderate topics
! 				'u_titania_mod_modification_queue',			// Can see the modifications queue
! 				'u_titania_mod_modification_validate',		// Can validate modifications
! 				'u_titania_mod_modification_moderate',		// Can moderate modifications
! 				'u_titania_mod_style_queue',		// Can see the styles queue
! 				'u_titania_mod_style_validate',		// Can validate styles
! 				'u_titania_mod_style_moderate',		// Can moderate styles
  			)),
  			array('ROLE_TITANIA_ADMINISTRATOR_TEAM', array(
! 				'u_titania_admin',					// Can administrate titania
! 				'u_titania_mod_author_mod',			// Can moderate author profiles
! 				'u_titania_mod_contrib_mod',		// Can moderate all contrib items
! 				'u_titania_mod_rate_reset',			// Can reset the rating on items
! 				'u_titania_mod_faq_mod',			// Can moderate FAQ entries
! 				'u_titania_mod_post_mod',			// Can moderate topics
! 				'u_titania_mod_modification_queue',			// Can see the modifications queue
! 				'u_titania_mod_modification_validate',		// Can validate modifications
! 				'u_titania_mod_modification_moderate',		// Can moderate modifications
! 				'u_titania_mod_style_queue',		// Can see the styles queue
! 				'u_titania_mod_style_validate',		// Can validate styles
! 				'u_titania_mod_style_moderate',		// Can moderate styles
  			)),
  			array('ROLE_TITANIA_MODIFICATION_TEAM', array(
! 				'u_titania_mod_author_mod',			// Can moderate author profiles
! 				'u_titania_mod_faq_mod',			// Can moderate FAQ entries
! 				'u_titania_mod_post_mod',			// Can moderate topics
! 				'u_titania_mod_modification_queue',			// Can see the modifications queue
! 				'u_titania_mod_modification_validate',		// Can validate modifications
! 				'u_titania_mod_modification_moderate',		// Can moderate modifications
  			)),
  			array('ROLE_TITANIA_STYLE_TEAM', array(
! 				'u_titania_mod_author_mod',			// Can moderate author profiles
! 				'u_titania_mod_faq_mod',			// Can moderate FAQ entries
! 				'u_titania_mod_post_mod',			// Can moderate topics
! 				'u_titania_mod_style_queue',		// Can see the styles queue
! 				'u_titania_mod_style_validate',		// Can validate styles
! 				'u_titania_mod_style_moderate',		// Can moderate styles
  			)),
  			array('ROLE_TITANIA_MODERATOR_TEAM', array(
! 				'u_titania_mod_author_mod',			// Can moderate author profiles
! 				'u_titania_mod_faq_mod',			// Can moderate FAQ entries
! 				'u_titania_mod_post_mod',			// Can moderate topics
  			)),
  			array('ROLE_USER_STANDARD', array(
  				'u_titania_contrib_submit',		// Can submit contrib items
***************
*** 479,484 ****
--- 558,564 ----
  				'u_titania_bbcode',				// Can post bbcode
  				'u_titania_smilies',			// Can post smilies
  				'u_titania_post',				// Can create new posts
+ 				'u_titania_post_approved',		// Posts are approved?
  				'u_titania_post_edit_own',		// Can edit own posts
  				'u_titania_post_delete_own',	// Can delete own posts
  				'u_titania_post_attach',		// Can attach files to posts
***************
*** 493,917 ****
  				'u_titania_bbcode',				// Can post bbcode
  				'u_titania_smilies',			// Can post smilies
  				'u_titania_post',				// Can create new posts
  				'u_titania_post_edit_own',		// Can edit own posts
  				'u_titania_post_delete_own',	// Can delete own posts
  				'u_titania_post_attach',		// Can attach files to posts
  			)),
  		),
  
- 		'custom' => 'titania_custom',
- 
- 		'cache_purge' => array('', 'auth'),
- 	),
- 	// Merged in 0.1.31
- 
- 	'0.1.32' => array(
- 		'table_index_add' => array(
- 			array(TITANIA_CONTRIBS_TABLE, 'contrib_last_update'),
- 		),
- 		'table_remove' => array(
- 			TITANIA_WATCH_TABLE,
- 		),
- 		'table_add' => array(
- 			array(TITANIA_WATCH_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'watch_type'			=> array('TINT:1', 0),
- 					'watch_object_type'		=> array('UINT', 0),
- 					'watch_object_id'		=> array('UINT', 0),
- 					'watch_user_id'			=> array('UINT', 0),
- 					'watch_mark_time'		=> array('UINT:11', 0),
- 				),
- 				'PRIMARY_KEY'	=> array('watch_object_type', 'watch_object_id', 'watch_user_id', 'watch_type'),
- 			)),
- 		)
- 	),
- 
- 	'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',
- 	),
- 
- 	'0.1.34' => array(
- 		'custom' => 'titania_custom',
- 	),
- 
- 	'0.1.35' => array(
- 		'table_column_remove' => array(
- 			array(TITANIA_REVISIONS_TABLE, 'queue_topic_id'),
- 		),
- 	),
- 
- 	'0.1.36' => array(
  		'config_add' => array(
  			array('titania_num_contribs', 0, true),
  		),
- 		'custom' => 'titania_ext_groups',
- 	),
- 
- 	'0.1.37' => array(
- 		'table_column_add' => array(
- 			array(TITANIA_REVISIONS_TABLE, 'revision_queue_id', array('UINT', 0)),
- 		),
- 		'custom' => 'titania_custom',
- 	),
- 
- 	'0.1.38' => array(
- 		'table_index_add' => array(
- 			array(TITANIA_REVISIONS_TABLE, 'revision_queue_id'),
- 		),
- 		'custom'	=> 'titania_tags',
- 	),
- 
- 	'0.1.39' => array(
- 		'table_column_add' => array(
- 			array(TITANIA_QUEUE_TABLE, 'queue_close_user', array('UINT', 0)),
- 			array(TITANIA_QUEUE_TABLE, 'queue_progress', array('UINT', 0)), // user_id
- 			array(TITANIA_QUEUE_TABLE, 'queue_progress_time', array('UINT:11', 0)),
- 		),
- 	),
- 
- 	'0.1.40' => array(
- 		'table_column_add' => array(
- 			array(TITANIA_TOPICS_TABLE, 'parent_id', array('UINT', 0)),
- 			array(TITANIA_TOPICS_TABLE, 'topic_url', array('VCHAR_CI', '')),
- 			array(TITANIA_POSTS_TABLE, 'post_url', array('VCHAR_CI', '')),
- 		),
- 		'table_index_add' => array(
- 			array(TITANIA_TOPICS_TABLE, 'parent_id'),
- 		),
- 
- 		'custom' => 'titania_custom',
- 
- 		'table_column_remove' => array(
- 			array(TITANIA_TOPICS_TABLE, 'contrib_id'),
- 			array(TITANIA_QUEUE_TABLE, 'contrib_name_clean'),
- 		),
- 	),
- 
- 	'0.1.41' => array(
- 		// topic_deleted is now regulated automatically by the topic access level
- 		'table_index_remove' => array(
- 			array(TITANIA_TOPICS_TABLE, 'topic_deleted'),
- 		),
- 		'table_column_remove' => array(
- 			array(TITANIA_TOPICS_TABLE, 'topic_deleted'),
- 		),
- 	),
- 
- 	'0.1.42' => array(
- 		'permission_role_remove' => array(
- 			array('ROLE_TITANIA_MODIFICATION_TEAM'),
- 			array('ROLE_TITANIA_STYLE_TEAM'),
- 			array('ROLE_TITANIA_MODERATOR_TEAM'),
- 			array('ROLE_TITANIA_ADMINISTRATOR_TEAM'),
- 		),
- 		'permission_role_add' => array(
- 			array('ROLE_TITANIA_MODIFICATION_TEAM', 'u_'),
- 			array('ROLE_TITANIA_STYLE_TEAM', 'u_'),
- 			array('ROLE_TITANIA_MODERATOR_TEAM', 'u_'),
- 			array('ROLE_TITANIA_ADMINISTRATOR_TEAM', 'u_'),
- 		),
- 
- 		'permission_remove' => array(
- 			'u_titania_',
- 
- 			'm_titania_author_mod',
- 			'm_titania_contrib_mod',
- 			'm_titania_rate_reset',
- 			'm_titania_faq_mod',
- 			'm_titania_post_mod',
- 			'm_titania_mod_queue',
- 			'm_titania_mod_validate',
- 			'm_titania_mod_moderate',
- 			'm_titania_style_queue',
- 			'm_titania_style_validate',
- 			'm_titania_style_moderate',
- 		),
- 
- 		'permission_add' => array(
- 			'u_titania_mod_author_mod',
- 			'u_titania_mod_contrib_mod',
- 			'u_titania_mod_rate_reset',
- 			'u_titania_mod_faq_mod',
- 			'u_titania_mod_post_mod',
- 			'u_titania_mod_modification_queue',
- 			'u_titania_mod_modification_validate',
- 			'u_titania_mod_modification_moderate',
- 			'u_titania_mod_style_queue',
- 			'u_titania_mod_style_validate',
- 			'u_titania_mod_style_moderate',
- 		),
- 
- 		'permission_set' => array(
- 			array('ROLE_ADMIN_FULL', array(
- 				'u_titania_mod_author_mod',
- 				'u_titania_mod_contrib_mod',
- 				'u_titania_mod_rate_reset',
- 				'u_titania_mod_faq_mod',
- 				'u_titania_mod_post_mod',
- 				'u_titania_mod_modification_queue',
- 				'u_titania_mod_modification_validate',
- 				'u_titania_mod_modification_moderate',
- 				'u_titania_mod_style_queue',
- 				'u_titania_mod_style_validate',
- 				'u_titania_mod_style_moderate',
- 			)),
- 			array('ROLE_TITANIA_ADMINISTRATOR_TEAM', array(
- 				'u_titania_mod_author_mod',
- 				'u_titania_mod_contrib_mod',
- 				'u_titania_mod_rate_reset',
- 				'u_titania_mod_faq_mod',
- 				'u_titania_mod_post_mod',
- 				'u_titania_mod_modification_queue',
- 				'u_titania_mod_modification_validate',
- 				'u_titania_mod_modification_moderate',
- 				'u_titania_mod_style_queue',
- 				'u_titania_mod_style_validate',
- 				'u_titania_mod_style_moderate',
- 			)),
- 			array('ROLE_TITANIA_MODIFICATION_TEAM', array(
- 				'u_titania_mod_author_mod',
- 				'u_titania_mod_rate_reset',
- 				'u_titania_mod_faq_mod',
- 				'u_titania_mod_post_mod',
- 				'u_titania_mod_modification_queue',
- 				'u_titania_mod_modification_validate',
- 				'u_titania_mod_modification_moderate',
- 			)),
- 			array('ROLE_TITANIA_STYLE_TEAM', array(
- 				'u_titania_mod_author_mod',
- 				'u_titania_mod_rate_reset',
- 				'u_titania_mod_faq_mod',
- 				'u_titania_mod_post_mod',
- 				'u_titania_mod_style_queue',
- 				'u_titania_mod_style_validate',
- 				'u_titania_mod_style_moderate',
- 			)),
- 			array('ROLE_TITANIA_MODERATOR_TEAM', array(
- 				'u_titania_mod_author_mod',
- 				'u_titania_mod_rate_reset',
- 				'u_titania_mod_faq_mod',
- 				'u_titania_mod_post_mod',
- 			)),
- 		),
- 	),
- 
- 	'0.1.43' => array(
- 		'table_column_add' => array(
- 			array(TITANIA_QUEUE_TABLE, 'revision_repack', array('TINT:1', 1)),
- 		),
- 	),
- 
- 	'0.1.44' => array(
- 		'table_column_remove' => array(
- 			array(TITANIA_QUEUE_TABLE, 'revision_repack'),
- 		),
- 
- 		'table_column_add' => array(
- 			array(TITANIA_QUEUE_TABLE, 'queue_allow_repack', array('BOOL', 1)),
- 		),
- 	),
- 
- 	'0.1.45' => array(
- 		'table_add' => array(
- 			array(TITANIA_ATTENTION_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'attention_id'					=> array('UINT', NULL, 'auto_increment'),
- 					'attention_type'				=> array('UINT', 0), // attention type constants (reported, needs approval, etc)
- 					'attention_object_type'			=> array('UINT', 0),
- 					'attention_object_id'			=> array('UINT', 0),
- 					'attention_url'					=> array('VCHAR_CI', ''),
- 					'attention_requester'			=> array('UINT', 0),
- 					'attention_time'				=> array('TIMESTAMP', 0),
- 					'attention_close_time'			=> array('TIMESTAMP', 0),
- 					'attention_close_user'			=> array('UINT', 0),
- 					'attention_title'				=> array('STEXT_UNI', ''),
- 					'attention_description'			=> array('MTEXT_UNI', ''),
- 				),
- 				'PRIMARY_KEY'	=> 'attention_id',
- 				'KEYS'			=> array(
- 					'attention_type'				=> array('INDEX', 'attention_type'),
- 					'attention_object_type'			=> array('INDEX', 'attention_object_type'),
- 					'attention_object_id'			=> array('INDEX', 'attention_object_id'),
- 					'attention_time'				=> array('INDEX', 'attention_time'),
- 					'attention_close_time'			=> array('INDEX', 'attention_close_time'),
- 					'attention_close_user'			=> array('INDEX', 'attention_close_user'),
- 				),
- 			)),
- 		),
- 	),
- 
- 	'0.1.46' => array(
- 		'permission_add' => array(
- 			'u_titania_mod_style_queue_discussion',
- 			'u_titania_mod_modification_queue_discussion',
- 		),
  
- 		'permission_set' => array(
- 			array('ROLE_ADMIN_FULL', array(
- 				'u_titania_mod_style_queue_discussion',
- 				'u_titania_mod_modification_queue_discussion',
- 			)),
- 			array('ROLE_TITANIA_ADMINISTRATOR_TEAM', array(
- 				'u_titania_mod_style_queue_discussion',
- 				'u_titania_mod_modification_queue_discussion',
- 			)),
- 			array('ROLE_TITANIA_MODIFICATION_TEAM', array(
- 				'u_titania_mod_modification_queue_discussion',
- 			)),
- 			array('ROLE_TITANIA_STYLE_TEAM', array(
- 				'u_titania_mod_style_queue_discussion',
- 			)),
- 		),
- 	),
- 
- 	'0.1.47' => array(
  		'custom' => 'titania_custom',
- 	),
- 
- 	'0.1.48' => array(
- 		'table_column_add' => array(
- 			array(TITANIA_ATTENTION_TABLE, 'attention_poster_id', array('UINT', 0)),
- 			array(TITANIA_ATTENTION_TABLE, 'attention_post_time', array('TIMESTAMP', 0)),
- 		),
- 
- 		'table_index_add' => array(
- 			array(TITANIA_ATTENTION_TABLE, 'attention_poster_id'),
- 			array(TITANIA_ATTENTION_TABLE, 'attention_post_time'),
- 		),
- 	),
- 
- 	'0.1.49' => array(
- 		'custom' => 'titania_custom',
- 	),
- 
- 	'0.1.50' => array(
- 		'permission_add' => array(
- 			'u_titania_post_approved',
- 		),
- 
- 		'permission_set' => array(
- 			array('ROLE_USER_STANDARD', array(
- 				'u_titania_post_approved',
- 			)),
- 			array('ROLE_USER_FULL', array(
- 				'u_titania_post_approved',
- 			)),
- 		),
- 	),
- 
- 	'0.1.51' => array(
- 		'table_column_add' => array(
- 			array(TITANIA_QUEUE_TABLE, 'queue_validation_notes', array('MTEXT_UNI', '')),
- 			array(TITANIA_QUEUE_TABLE, 'queue_validation_notes_bitfield', array('VCHAR:255', '')),
- 			array(TITANIA_QUEUE_TABLE, 'queue_validation_notes_uid', array('VCHAR:8', '')),
- 			array(TITANIA_QUEUE_TABLE, 'queue_validation_notes_options', array('UINT:11', 7)),
- 		),
- 	),
- 
- 	'0.1.52' => array(
- 		'table_column_add' => array(
- 			array(TITANIA_CONTRIBS_TABLE, 'contrib_release_topic_id', array('UINT', 0)),
- 		),
- 	),
  
! 	'0.1.53' => array(
! 		'table_add' => array(
! 			array(TITANIA_REVISIONS_PHPBB_TABLE, array(
! 				'COLUMNS'		=> array(
! 					'row_id'					=> array('UINT', NULL, 'auto_increment'),
! 					'revision_id'				=> array('UINT', 0),
! 					'contrib_id'				=> array('UINT', 0),
! 					'phpbb_version_branch'		=> array('TINT:1', 0),
! 					'phpbb_version_revision'	=> array('VCHAR', ''),
! 				),
! 				'PRIMARY_KEY'	=> 'row_id',
! 				'KEYS'			=> array(
! 					'revision_id'				=> array('INDEX', 'revision_id'),
! 					'contrib_id'				=> array('INDEX', 'contrib_id'),
! 					'phpbb_version_branch'		=> array('INDEX', 'phpbb_version_branch'),
! 					'phpbb_version_revision'	=> array('INDEX', 'phpbb_version_revision'),
! 				),
! 			)),
! 		),
! 		'custom' => 'titania_custom',
! 		'table_column_remove' => array(
! 			array(TITANIA_REVISIONS_TABLE, 'phpbb_version'),
! 		),
! 	),
! 
! 	'0.1.54' => array(
! 		'permission_add' => array(
! 			'u_titania_admin',
! 		),
! 
! 		'permission_set' => array(
! 			array('ROLE_ADMIN_FULL', array(
! 				'u_titania_admin',
! 			)),
! 			array('ROLE_TITANIA_ADMINISTRATOR_TEAM', array(
! 				'u_titania_admin',
! 			)),
! 		),
! 	),
! 
! 	'0.1.55' => array(
! 		'table_column_add' => array(
! 			array(TITANIA_REVISIONS_PHPBB_TABLE, 'revision_validated', array('BOOL', 0)),
! 		),
! 
! 		'table_index_add' => array(
! 			array(TITANIA_REVISIONS_PHPBB_TABLE, 'revision_validated'),
! 		),
! 
! 		'custom' => 'titania_custom',
! 	),
! 
! 	'0.1.56' => array(
! 		'table_column_remove' => array(
! 			array(TITANIA_CONTRIB_FAQ_TABLE, 'faq_order_id'),
! 		),
! 
! 		'table_column_add' => array(
! 			array(TITANIA_CONTRIB_FAQ_TABLE, 'left_id', array('UINT', 0)),
! 			array(TITANIA_CONTRIB_FAQ_TABLE, 'right_id', array('UINT', 0)),
! 		),
! 
! 		'table_index_add' => array(
! 			array(TITANIA_CONTRIB_FAQ_TABLE, 'left_right_id', array('left_id', 'right_id')),
! 		),
! 	),
! 
! 	'0.1.57' => array(
! 		'table_add' => array(
! 			array(TITANIA_AUTOMOD_QUEUE_TABLE, array(
! 				'COLUMNS'		=> array(
! 					'row_id'					=> array('UINT', NULL, 'auto_increment'),
! 					'revision_id'				=> array('UINT', 0),
! 					'phpbb_version_branch'		=> array('TINT:1', 0),
! 					'phpbb_version_revision'	=> array('VCHAR', ''),
! 				),
! 				'PRIMARY_KEY'	=> 'row_id',
! 				'KEYS'			=> array(
! 					'revision_id'				=> array('INDEX', 'revision_id'),
! 				),
! 			)),
! 		),
  	),
  
  	// IF YOU ADD A NEW VERSION DO NOT FORGET TO INCREMENT THE VERSION NUMBER IN common.php!
  );
  
! include(PHPBB_ROOT_PATH . 'umil/umil_auto.' . PHP_EXT);
\ No newline at end of file
--- 573,595 ----
  				'u_titania_bbcode',				// Can post bbcode
  				'u_titania_smilies',			// Can post smilies
  				'u_titania_post',				// Can create new posts
+ 				'u_titania_post_approved',		// Posts are approved?
  				'u_titania_post_edit_own',		// Can edit own posts
  				'u_titania_post_delete_own',	// Can delete own posts
  				'u_titania_post_attach',		// Can attach files to posts
  			)),
  		),
  
  		'config_add' => array(
  			array('titania_num_contribs', 0, true),
  		),
  
  		'custom' => 'titania_custom',
  
! 		'cache_purge' => '',
  	),
  
  	// IF YOU ADD A NEW VERSION DO NOT FORGET TO INCREMENT THE VERSION NUMBER IN common.php!
  );
  
! include(PHPBB_ROOT_PATH . 'umil/umil_auto.' . PHP_EXT);

Removed: branches/stable/titania/manage/categories.php
==============================================================================
*** branches/stable/titania/manage/categories.php (original)
--- branches/stable/titania/manage/categories.php (removed)
***************
*** 1,337 ****
- <?php
- /**
- *
- * @package Titania
- * @version $Id: categories.php 937 2010-03-30 01:21:50Z Tom $
- * @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 (!phpbb::$auth->acl_gets('u_titania_admin'))
- {
- 	titania::needs_auth();
- }
- 
- phpbb::$user->add_lang('acp/common');
- 
- titania::_include('functions_posting', 'generate_type_select');
- 
- $category_id 	= request_var('c', 0);
- $submit 	= (isset($_POST['submit'])) ? true : false;
- $action		= request_var('action', '');
- 
- switch ($action)
- {
- 	case 'add' :
- 	case 'edit' :
- 		$category_object = new titania_category;
- 
- 		if ($action == 'edit')
- 		{
- 			if (!$category_id)
- 			{
- 				trigger_error(phpbb::$user->lang['NO_CATEGORY']);
- 			}
- 
- 			$category_object->load($category_id);
- 		}
- 
- 		// Load the message object
- 		$message_object = new titania_message($category_object);
- 		$message_object->set_auth(array(
- 			'bbcode'		=> phpbb::$auth->acl_get('u_titania_bbcode'),
- 			'smilies'		=> phpbb::$auth->acl_get('u_titania_smilies'),
- 		));
- 		$message_object->set_settings(array(
- 			'display_error'		=> false,
- 			'display_subject'	=> false,
- 		));
- 
- 		$category_object->post_data($message_object);
- 
- 		$message_object->display();
- 
- 		// Define some variables for use later with keeping language-based category names the same in the DB during submit
- 		$old_category_name = $category_object->category_name;
- 		$old_category_name_clean = $category_object->category_name_clean;
- 		$old_category_name_lang = (isset(phpbb::$user->lang[$old_category_name])) ? phpbb::$user->lang[$old_category_name] : $old_category_name;
- 
- 		$error = array();
- 
- 		if($submit)
- 		{
- 			// Goodbye to some of the old category data...
- 			unset($category_object->category_name);
- 
- 			$category_object->category_id = ($action == 'edit') ? $category_id : '';
- 			$category_name = request_var('category_name', '');
- 			$category_object->category_name = ($category_name == $old_category_name_lang) ? $old_category_name : $category_name;
- 			$category_object->category_name_clean = (isset(phpbb::$user->lang[$category_object->category_name])) ? $old_category_name_clean : utf8_clean_string($category_object->category_name);
- 			$category_object->parent_id = request_var('category_parent', 0);
- 			$category_object->category_visible = request_var('category_visible', 1);
- 			$category_object->category_type = request_var('category_type', 0);
- 
- 			// Check for errors
- 			if (!$category_object->category_name)
- 			{
- 				$error[] = phpbb::$user->lang['NO_CATEGORY_NAME'];
- 			}
- 			if ($action == 'edit' && $category_object->parent_id == $category_object->category_id)
- 			{
- 				$error[] = phpbb::$user->lang['CATEGORY_DUPLICATE_PARENT'];
- 			}
- 
- 			// We have no errors
- 			if (!sizeof($error))
- 			{
- 				// Set left_id and right_id to proper values
- 				if (!$category_object->category_id)
- 				{
- 					// no category_id means we're creating a new category
- 					if ($category_object->parent_id)
- 					{
- 						$sql = 'SELECT left_id, right_id
- 							FROM ' . TITANIA_CATEGORIES_TABLE . '
- 							WHERE category_id = ' . $category_object->parent_id;
- 						$result = phpbb::$db->sql_query($sql);
- 						$row = phpbb::$db->sql_fetchrow($result);
- 						phpbb::$db->sql_freeresult($result);
- 
- 						if (!$row)
- 						{
- 							trigger_error(phpbb::$user->lang['PARENT_NOT_EXIST']);
- 						}
- 
- 						$sql = 'UPDATE ' . TITANIA_CATEGORIES_TABLE . '
- 							SET left_id = left_id + 2, right_id = right_id + 2
- 							WHERE left_id > ' . $row['right_id'];
- 						phpbb::$db->sql_query($sql);
- 
- 						$sql = 'UPDATE ' . TITANIA_CATEGORIES_TABLE . '
- 							SET right_id = right_id + 2
- 							WHERE ' . $row['left_id'] . ' BETWEEN left_id AND right_id';
- 						phpbb::$db->sql_query($sql);
- 
- 						$category_object->left_id = $row['right_id'];
- 						$category_object->right_id = $row['right_id'] + 1;
- 					}
- 					else
- 					{
- 						$sql = 'SELECT MAX(right_id) AS right_id
- 							FROM ' . TITANIA_CATEGORIES_TABLE;
- 						$result = phpbb::$db->sql_query($sql);
- 						$row = phpbb::$db->sql_fetchrow($result);
- 						phpbb::$db->sql_freeresult($result);
- 
- 						$category_object->left_id = $row['right_id'] + 1;
- 						$category_object->right_id = $row['right_id'] + 2;
- 					}
- 				}
- 				else
- 				{
- 					$row = $category_object->get_category_info($category_object->category_id);
- 
- 					$errors_extra = array();
- 					if ($row['parent_id'] != $category_object->parent_id)
- 					{
- 						if ($row['category_id'] != $category_object->parent_id)
- 						{
- 							$errors_extra = $category_object->move_category($category_object->category_id, $category_object->parent_id);
- 						}
- 						else
- 						{
- 							$category_object->parent_id = $row['parent_id'];
- 						}
- 					}
- 
- 					if (sizeof($errors_extra))
- 					{
- 						return $errors_extra;
- 					}
- 				}
- 
- 				// Now we submit the category information...
- 				$category_object->submit();
- 
- 				// Redirect back to the previous category
- 				redirect(titania_url::build_url('manage/categories', array('c' => $category_object->parent_id)));
- 			}
- 		}
- 
- 		// Generate data for category type dropdown box
- 		generate_type_select($category_object->category_type);
- 
- 		phpbb::$template->assign_vars(array(
- 			'ERROR_MSG'						=> (sizeof($error)) ? implode('<br />', $error) : '',
- 			'CATEGORY' 						=> $category_id,
- 			'CATEGORY_NAME'					=> (isset(phpbb::$user->lang[$category_object->category_name])) ? phpbb::$user->lang[$category_object->category_name] : $category_object->category_name,
- 			'CATEGORY_VISIBLE' 				=> $category_object->category_visible,
- 			'SECTION_NAME'					=> ($action == 'add') ? phpbb::$user->lang['CREATE_CATEGORY'] : phpbb::$user->lang['EDIT_CATEGORY'] . ' - ' . ((isset(phpbb::$user->lang[$old_category_name])) ? phpbb::$user->lang[$old_category_name] : $old_category_name),
- 
- 			'U_ACTION'						=> ($action == 'add') ? titania_url::build_url('manage/categories', array('c' => $category_id, 'action' => 'add')) : titania_url::build_url('manage/categories', array('c' => $category_id, 'action' => 'edit')),
- 			'U_BACK'						=> ($action == 'add') ? titania_url::build_url('manage/categories', array('c' => $category_id)) : titania_url::build_url('manage/categories', array('c' => $category_object->parent_id)),
- 
- 			'S_ADD_CATEGORY' 				=> ($action == 'add') ? true : false,
- 			'S_EDIT_CATEGORY' 				=> ($action == 'edit') ? true : false,
- 			'S_MOVE_CATEGORY_OPTIONS'		=> (isset($category_object->parent_id)) ? generate_category_select($category_object->parent_id, true) : generate_category_select($category_id, true),
- 		));
- 	break;
- 	case 'move_up' :
- 	case 'move_down' :
- 		$category_object = new titania_category;
- 
- 		if (!$category_id)
- 		{
- 			trigger_error(phpbb::$user->lang['NO_CATEGORY']);
- 		}
- 
- 		$sql = 'SELECT *
- 			FROM ' . TITANIA_CATEGORIES_TABLE . "
- 			WHERE category_id = $category_id";
- 		$result = phpbb::$db->sql_query($sql);
- 		$row = phpbb::$db->sql_fetchrow($result);
- 		phpbb::$db->sql_freeresult($result);
- 
- 		if (!$row)
- 		{
- 			trigger_error(phpbb::$user->lang['NO_CATEGORY']);
- 		}
- 
- 		$move_category_name = $category_object->move_category_by($row, $action, 1);
- 
- 		phpbb::$template->assign_vars(array(
- 			'CATEGORY' 				=> $category_id,
- 
- 			'S_MOVE_CATEGORY' 		=> true,
- 		));
- 
- 		// Redirect back to previous category to avoid problems
- 		redirect(titania_url::build_url('manage/categories', array('c' => $row['parent_id'])));
- 	break;
- 	case 'delete' :
- 		$category_object = new titania_category;
- 
- 		if (!$category_id)
- 		{
- 			trigger_error(phpbb::$user->lang['NO_CATEGORY']);
- 		}
- 
- 		$category_data = $category_object->get_category_info($category_id);
- 
- 		$parent_id = ($category_data['parent_id'] == $category_id) ? 0 : $category_data['parent_id'];
- 
- 		$error = array();
- 
- 		if($submit)
- 		{
- 			$action_subcats		= request_var('action_subcats', '');
- 			$subcats_to_id		= request_var('subcats_to_id', 0);
- 			$action_contribs	= request_var('action_contribs', '');
- 			$contribs_to_id		= request_var('contribs_to_id', 0);
- 
- 			// Check for errors
- 			$sql = 'SELECT category_id
- 				FROM ' . TITANIA_CATEGORIES_TABLE . "
- 				WHERE parent_id = $category_id";
- 			$result = phpbb::$db->sql_query($sql);
- 			$children_row = phpbb::$db->sql_fetchrow($result);
- 			phpbb::$db->sql_freeresult($result);
- 
- 			// Check if category contains subcategories. If yes, then return an error.
- 			if ($children_row)
- 			{
- 				$error[] = phpbb::$user->lang['CATEGORY_HAS_CHILDREN'];
- 			}
- 			else
- 			{
- 				$error = array_merge($error, $category_object->delete_category($category_id, $action_contribs, $action_subcats, $contribs_to_id, $subcats_to_id));
- 			}
- 
- 			if (!sizeof($error))
- 			{
- 				// Redirect back to the previous category
- 				redirect(titania_url::build_url('manage/categories', array('c' => $parent_id)));
- 			}
- 		}
- 
- 		phpbb::$template->assign_vars(array(
- 			'S_DELETE_CATEGORY'				=> true,
- 			'U_ACTION'						=> titania_url::build_url('manage/categories', array('c' => $category_id, 'action' => 'delete')),
- 			'U_BACK'						=> 'c_' . $category_object->parent_id,
- 
- 			'CATEGORY' 						=> $category_id,
- 			'CATEGORY_NAME'					=> (isset(phpbb::$user->lang[$category_data['category_name']])) ? phpbb::$user->lang[$category_data['category_name']] : $category_data['category_name'],
- 			'SECTION_NAME'					=> phpbb::$user->lang['DELETE_CATEGORY'] . ' - ' . ((isset(phpbb::$user->lang[$category_data['category_name']])) ? phpbb::$user->lang[$category_data['category_name']] : $category_data['category_name']),
- 			'S_HAS_SUBCATS'					=> ($category_data['right_id'] - $category_data['left_id'] > 1) ? true : false,
- 			'S_MOVE_CATEGORY_OPTIONS'		=> generate_category_select($category_data['parent_id'], true),
- 			'ERROR_MSG'						=> (sizeof($error)) ? implode('<br />', $error) : '')
- 		);
- 
- 	break;
- 	default :
- 		titania::_include('functions_display', 'titania_display_categories');
- 
- 		titania_display_categories($category_id, 'categories', true);
- 
- 		if ($category_id != 0)
- 		{
- 			// Breadcrumbs
- 			$category_object = new titania_category;
- 			$categories_ary = titania::$cache->get_categories();
- 
- 			// Parents
- 			foreach (array_reverse(titania::$cache->get_category_parents($category_id)) as $row)
- 			{
- 				$category_object->__set_array($categories_ary[$row['category_id']]);
- 				titania::generate_breadcrumbs(array(
- 					((isset(phpbb::$user->lang[$categories_ary[$row['category_id']]['category_name']])) ? phpbb::$user->lang[$categories_ary[$row['category_id']]['category_name']] : $categories_ary[$row['category_id']]['category_name'])	=> titania_url::build_url('manage/categories', array('c' => $row['category_id'])),
- 				));
- 			}
- 
- 			// Self
- 			$category_object->__set_array($categories_ary[$category_id]);
- 			titania::generate_breadcrumbs(array(
- 				((isset(phpbb::$user->lang[$categories_ary[$category_id]['category_name']])) ? phpbb::$user->lang[$categories_ary[$category_id]['category_name']] : $categories_ary[$category_id]['category_name'])	=> titania_url::build_url('manage/categories', array('c' => $category_id)),
- 			));
- 			unset($categories_ary, $category_object);
- 		}
- 
- 		phpbb::$template->assign_vars(array(
- 			'ICON_MOVE_UP'				=> '<img src="' . titania::$absolute_board . 'adm/images/icon_up.gif" alt="' . phpbb::$user->lang['MOVE_UP'] . '" title="' . phpbb::$user->lang['MOVE_UP'] . '" />',
- 			'ICON_MOVE_UP_DISABLED'		=> '<img src="' . titania::$absolute_board . 'adm/images/icon_up_disabled.gif" alt="' . phpbb::$user->lang['MOVE_UP'] . '" title="' . phpbb::$user->lang['MOVE_UP'] . '" />',
- 			'ICON_MOVE_DOWN'			=> '<img src="' . titania::$absolute_board . 'adm/images/icon_down.gif" alt="' . phpbb::$user->lang['MOVE_DOWN'] . '" title="' . phpbb::$user->lang['MOVE_DOWN'] . '" />',
- 			'ICON_MOVE_DOWN_DISABLED'	=> '<img src="' . titania::$absolute_board . 'adm/images/icon_down_disabled.gif" alt="' . phpbb::$user->lang['MOVE_DOWN'] . '" title="' . phpbb::$user->lang['MOVE_DOWN'] . '" />',
- 			'ICON_EDIT'					=> '<img src="' . titania::$absolute_board . 'adm/images/icon_edit.gif" alt="' . phpbb::$user->lang['EDIT'] . '" title="' . phpbb::$user->lang['EDIT'] . '" />',
- 			'ICON_EDIT_DISABLED'		=> '<img src="' . titania::$absolute_board . 'adm/images/icon_edit_disabled.gif" alt="' . phpbb::$user->lang['EDIT'] . '" title="' . phpbb::$user->lang['EDIT'] . '" />',
- 			'ICON_DELETE'				=> '<img src="' . titania::$absolute_board . 'adm/images/icon_delete.gif" alt="' . phpbb::$user->lang['DELETE'] . '" title="' . phpbb::$user->lang['DELETE'] . '" />',
- 			'ICON_DELETE_DISABLED'		=> '<img src="' . titania::$absolute_board . 'adm/images/icon_delete_disabled.gif" alt="' . phpbb::$user->lang['DELETE'] . '" title="' . phpbb::$user->lang['DELETE'] . '" />',
- 
- 			'U_CREATE_CATEGORY'			=> titania_url::build_url('manage/categories', array('c' => $category_id, 'action' => 'add')),
- 
- 			'S_MANAGE' 					=> true,
- 		));
- 	break;
- }
- 
- function trigger_back($message)
- {
- 	$message = (isset(phpbb::$user->lang[$message])) ? phpbb::$user->lang[$message] : $message;
- 
- 	$message .= '<br /><br /><a href="' . titania_url::build_url('manage/categories') . '">' . phpbb::$user->lang['BACK'] . '</a>';
- 
- 	trigger_error($message);
- 
- }
- 
- titania::page_header('MANAGE_CATEGORIES');
- 
- titania::page_footer(true, 'manage/categories.html');
--- 0 ----

Modified: branches/stable/titania/manage/index.php
==============================================================================
*** branches/stable/titania/manage/index.php (original)
--- branches/stable/titania/manage/index.php Mon Apr 12 20:11:28 2010
***************
*** 52,62 ****
  		'url'		=> titania_url::build_url('manage/administration'),
  		'auth'		=> (phpbb::$auth->acl_get('u_titania_admin')) ? true : false,
  	),
- 	'categories' => array(
- 		'title'		=> 'MANAGE_CATEGORIES',
- 		'url'		=> titania_url::build_url('manage/categories'),
- 		'auth'		=> (phpbb::$auth->acl_get('u_titania_admin')) ? true : false,
- 	),
  );
  
  // Display nav menu
--- 52,57 ----

Added: misc/ariel constants.php
==============================================================================
*** misc/ariel constants.php (added)
--- misc/ariel constants.php Mon Apr 12 20:11:28 2010
***************
*** 0 ****
--- 1,144 ----
+ <?php
+ /**
+ *
+ * @package ariel
+ * @version $Id$
+ * @copyright (c) 2005 phpBB Group
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ *
+ */
+ 
+ if (!defined('IN_PHPBB'))
+ {
+ 	exit;
+ }
+ 
+ /**#@+
+ * Enum constants for separating contrib types
+ */
+ define('CONTRIB_MODS', 1);
+ define('CONTRIB_STYLES', 2);
+ /**#@-*/
+ 
+ /**#@+
+ * Enum constants for separating contrib status
+ */
+ define('CONTRIB_REJECTED', -1);			// Not suitable for the database (spam, troll, wrong contrib, or N/A)
+ define('CONTRIB_NEW', 0);						// Submitted by Author for approval
+ define('CONTRIB_DEVELOPMENT', 1);		// Accepted into the database but not approved for release
+ define('CONTRIB_RELEASED', 2);			// Released
+ define('CONTRIB_PULLED', 3);				// Removed from the database for a NON security reason 
+ define('CONTRIB_CLEANED', 4);				// Contrib is waiting for MOD/STYLE db cleanup.
+ define('CONTRIB_SECURITY', 5);      // MOD has been pulled for a security reason.
+ /**#@-*/
+ 
+ /**#@+
+ * Enum constants for contrib roles
+ */
+ define('CONTRIB_OWNER', 1);					// Creator/founder/project manager
+ define('CONTRIB_DEVELOPER', 2);				// can update & submit bug fixes, etc
+ define('CONTRIB_DOCUMENTOR', 3);			// can update documentation, etc
+ /**#@-*/
+ 
+ /**#@+
+ * Enum constants for queue_statuses.
+ * Negative numbers denote closed status.
+ * Positive Numbers denote open status.
+ */
+ define('QUEUE_NEW', 1);						// Item is new in queue
+ define('QUEUE_SPECIAL', 2);				// Item is undergoing validation (fallback status != new)
+ define('QUEUE_APPROVE', 3);				// Item is ready for approval
+ define('QUEUE_DENY', 4);					// Item is ready to be denied
+ 
+ define('QUEUE_CLOSED', -1);				// Item approved
+ define('QUEUE_DENIED', -2);				// Item denied
+ define('QUEUE_DEPRECATED', -3);		// Item outdated by a replacement submission from author
+ define('QUEUE_CANCELLED', -4);		// Item cancelled by author
+ define('QUEUE_REPLACED', -5);			// Item outdated by a replacement submission from validator (Not used?)
+ define('QUEUE_CANNED', -6);       // Item canned by teammember
+ /**#@-*/
+ 
+ /**#@+
+ * Enum constants for queue statuses.
+ * Negative numbers denote closed status.
+ * Positive Numbers denote open status.
+ */
+ define('CONTRIB_TOPIC_ANNOUNCEMENTS', 1);	// Announcements topic
+ define('CONTRIB_TOPIC_SUPPORT', 2);				// Support/release topic
+ define('CONTRIB_TOPIC_DEVELOPMENT', 3);		// Development topic
+ define('CONTRIB_TOPIC_QUEUE', 4);					// Validation topic
+ define('CONTRIB_TOPIC_DISCUSS', 5);				// Author/Team discussion topic
+ /**#@-*/
+ 
+ /**#@+
+ * Queue types ("queue_action")
+ */
+ define('QUEUE_CREATE', 1);
+ define('QUEUE_UPDATE', 2);
+ define('QUEUE_DESCRIPTION', 3);
+ define('QUEUE_TAGS', 4);
+ define('QUEUE_AUTHOR', 5);
+ define('QUEUE_NAME', 6);
+ /**#@-*/
+ 
+ /**#@+
+ * Tracker constants
+ */
+ define('TRACKERS_ENV_DISABLED', 0);
+ define('TRACKERS_ENV_OPTIONAL', 1);
+ define('TRACKERS_ENV_REQUIRED', 2);
+ 
+ define('STATUS_OPEN', 0);
+ define('STATUS_ALL', -1);
+ define('STATUS_CLOSED', -2);
+ 
+ define('SEARCH_TITLE', 0);
+ define('SEARCH_BODY', 1);
+ define('SEARCH_COMMENTS', 3);
+ define('SEARCH_ALL', 4);
+ /**#@-*/
+ 
+ /**#@+
+  * Language packs
+  */
+ define('LANG_PACKS_TABLE', 'lang_packs');
+ define('LANG_PACKS_AUTHORS_TABLE', 'lang_packs_authors');
+ 
+ define('REQUIRED', 1);			// Required file, error out if not existing
+ define('NOT_REQUIRED', 2);		// Not required file, just do not include if missing
+ define('REQUIRED_EMPTY', 3);	// Required file, add data if missing
+ define('REQUIRED_DEFAULT', 4);	// Required file, add english file if missing
+ /**#@-*/
+ 
+ /**#@+
+  * Group Constants
+  */
+ define('TRANSLATORS_GROUP', 228655);
+ define('GROUP_REGISTERED', 228650);
+ /**#@-*/
+ 
+ $site_prefix = $table_prefix . 'site_';
+ 
+ /**#@+
+ * Database table constants
+ */
+ define('SITE_CONTRIBS_TABLE',			$site_prefix . 'contribs');
+ define('SITE_CONTRIB_USER_TABLE',	$site_prefix . 'contributers');
+ define('SITE_CONTRIB_TAGS_TABLE',	$site_prefix . 'contrib_tags');
+ define('SITE_EMAILS_TABLE',				$site_prefix . 'emails');
+ define('SITE_SUBSCRIBE_TABLE',		$site_prefix . 'subscribe');
+ define('SITE_QUEUE_TABLE',				$site_prefix . 'queue');
+ define('SITE_REVISIONS_TABLE',		$site_prefix . 'contrib_revisions');
+ define('SITE_TAGS_TABLE',					$site_prefix . 'tags');
+ define('SITE_TOPICS_TABLE',				$site_prefix . 'contrib_topics');
+ define('SITE_CHANGE_OWNER_TABLE', $site_prefix . 'change_owner');
+ define('SITE_CONTRIB_REPORTS_TABLE', $site_prefix . 'contrib_reports');
+ /**#@-*/
+ 
+ /**#@+
+ * Styles demo
+ */
+ define('STYLE_DEMO_PATH_30', $root_path . 'styles/demo/3.0/board/');
+ /**#@-*/
+ 
+ ?>

Propchange: misc/ariel constants.php
------------------------------------------------------------------------------
    svn:keywords = Revision Author Date Id

Added: misc/ariel_convert.php
==============================================================================
*** misc/ariel_convert.php (added)
--- misc/ariel_convert.php Mon Apr 12 20:11:28 2010
***************
*** 0 ****
--- 1,896 ----
+ <?php
+ /**
+  *
+  * @package titania
+  * @version $Id$
+  * @copyright (c) 2008 phpBB Customisation Database Team
+  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+  *
+  */
+ 
+ /**
+ * Instructions!
+ *
+ * Ariel needs indexes or this will take forever
+ * ALTER TABLE community_site_queue ADD INDEX (contrib_id)
+ * ALTER TABLE community_site_queue ADD INDEX (revision_id)
+ * ALTER TABLE community_site_queue ADD INDEX (queue_status)
+ * ALTER TABLE community_site_contrib_tags ADD INDEX (contrib_id)
+ */
+ 
+ /**
+  * @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;
+ titania::add_lang('manage');
+ 
+ // Give founders and myself access to run this on .com
+ if (phpbb::$user->data['user_type'] != USER_FOUNDER && phpbb::$user->data['user_id'] != 202401)
+ {
+ 	titania::needs_auth();
+ }
+ 
+ // 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/';
+ 
+ // Table prefix
+ $ariel_prefix = 'community_site_';
+ $limit = 1000;
+ $mod_validation_trash_forum = 28;
+ $style_validation_trash_forum = 83;
+ 
+ $step = request_var('step', 0);
+ $start = request_var('start', 0);
+ 
+ // Populated later
+ $total = 0;
+ $display_message = '';
+ 
+ // We index later...
+ titania_search::initialize();
+ titania_search::$do_not_index = true;
+ 
+ $tags_to_cats = array(
+ 	9 => 12, // Board Styles
+ 	10 => 13, // Smilies
+ 	11 => 15, // Ranks
+ 	12 => 14, // Avatars
+ 	30 => 8, // Add-ons
+ 	31 => 3, // Cosmetic
+ 	32 => 4, // Admin Tools -> Tools
+ 	33 => 6, // Syndication -> Communication
+ 	34 => 6, // BBCode -> Communication
+ 	35 => 5, // Security
+ 	36 => 6, // Communication
+ 	37 => 7, // Profile
+ 	106 => 9, // Anti-Spam
+ 	107 => 4, // Moderator Tools -> Tools
+ 	108 => 10, // Entertainment
+ 	155 => 12, // Imageset -> Board Styles
+ 	165 => 12, // Theme -> Board Styles
+ 	175 => 12, // Template -> Board Styles
+ 	195 => 16, // Topic Icons -> Miscellaneous
+ 	235 => 16, // Tools -> Miscellaneous
+ );
+ 
+ $queue_swap = array(
+ 	1	=> TITANIA_QUEUE_NEW, // QUEUE_NEW
+ 	2	=> TITANIA_QUEUE_NEW, //17, // QUEUE_SPECIAL
+ 	3	=> 19, // QUEUE_APPROVE
+ 	4	=> 20, // QUEUE_DENY
+ 	-1	=> TITANIA_QUEUE_APPROVED, // QUEUE_CLOSED
+ 	-2	=> TITANIA_QUEUE_DENIED, // QUEUE_DENIED
+ );
+ 
+ switch ($step)
+ {
+ 	case 0 :
+ 		trigger_error('Are you ready to begin the conversion?  All old data in Titania will be lost!<br /><br /><a href="' . append_sid(TITANIA_ROOT . 'ariel_convert.' . PHP_EXT, 'step=1') . '">Continue with the converter</a>');
+ 	break;
+ 
+ 	case 1 :
+ 		$truncate = array(TITANIA_AUTOMOD_QUEUE_TABLE, TITANIA_REVISIONS_PHPBB_TABLE, TITANIA_ATTENTION_TABLE, TITANIA_QUEUE_TABLE, TITANIA_ATTACHMENTS_TABLE, TITANIA_AUTHORS_TABLE, TITANIA_CONTRIBS_TABLE, TITANIA_CONTRIB_COAUTHORS_TABLE, TITANIA_CONTRIB_FAQ_TABLE, TITANIA_CONTRIB_IN_CATEGORIES_TABLE, TITANIA_POSTS_TABLE, TITANIA_RATINGS_TABLE, TITANIA_REVISIONS_TABLE, TITANIA_TOPICS_TABLE, TITANIA_TRACK_TABLE, TITANIA_WATCH_TABLE);
+ 
+ 		foreach ($truncate as $table)
+ 		{
+ 			phpbb::$db->sql_query('TRUNCATE TABLE ' . $table);
+ 		}
+ 
+ 		// Truncate search index
+ 		titania_search::truncate();
+ 
+ 		// Clean up the files directory
+ 		foreach (scandir(titania::$config->upload_path) as $item)
+ 		{
+             if ($item == '.' || $item == '..' || $item == '.svn' || $item == 'contrib_temp')
+ 			{
+ 				continue;
+ 			}
+ 
+ 			if (is_dir(titania::$config->upload_path . $item))
+ 			{
+ 				titania_rmdir_recursive(titania::$config->upload_path . $item . '/');
+ 			}
+ 		}
+ 
+ 		titania_mkdir_recursive(titania::$config->upload_path . 'titania_screenshots');
+ 
+ 		$display_message = 'Truncating Tables, Cleaning File Storage';
+ 	break;
+ 
+ 	case 2 :
+ 		$sql = 'SELECT COUNT(contrib_id) AS cnt FROM ' . $ariel_prefix . 'contribs';
+ 		phpbb::$db->sql_query($sql);
+ 		$total = phpbb::$db->sql_fetchfield('cnt');
+ 		phpbb::$db->sql_freeresult();
+ 
+ 		$sql_ary = array(
+ 			'SELECT'	=> 't.topic_id, c.*',
+ 
+ 			'FROM'		=> array(
+ 				$ariel_prefix . 'contribs' => 'c',
+ 			),
+ 
+ 			'LEFT_JOIN'	=> array(
+ 				array(
+ 					'FROM'	=> array($ariel_prefix . 'contrib_topics' => 't'),
+ 					'ON'	=> 't.contrib_id = c.contrib_id AND t.topic_type = 1',
+ 				),
+ 			),
+ 
+ 			'ORDER_BY'	=> 'c.contrib_id ASC',
+ 		);
+ 		$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
+ 
+ 		$result = phpbb::$db->sql_query_limit($sql, $limit, $start);
+ 		while ($row = phpbb::$db->sql_fetchrow($result))
+ 		{
+ 			$ignore = array(-1, 3);
+ 			if (in_array($row['contrib_status'], $ignore) || !in_array($row['contrib_type'], array_keys(titania_types::$types)))
+ 			{
+ 				// Skip contribs that were denied or pulled and weird ones
+ 				continue;
+ 			}
+ 
+ 			// Ignore things marked as new that do not have contributions in the queue
+ 			if ($row['contrib_status'] == 0)
+ 			{
+ 				$sql = 'SELECT COUNT(revision_id) AS cnt FROM ' . $ariel_prefix . 'queue
+ 					WHERE ' . phpbb::$db->sql_in_set('queue_status', array(1, 2, 3, 4)) . '
+ 						AND contrib_id = ' . $row['contrib_id'];
+ 				$result1 = phpbb::$db->sql_query($sql);
+ 				$cnt = phpbb::$db->sql_fetchfield('cnt', $result1);
+ 				phpbb::$db->sql_freeresult($result1);
+ 
+ 				if (!$cnt)
+ 				{
+ 					// Somebody changed the status manually to new, should have been 3
+ 					continue;
+ 				}
+ 			}
+ 
+ 			$permalink = titania_url::url_slug($row['contrib_name']);
+ 			$conflict = $cnt = false;
+ 			do {
+ 				$permalink_test = ($cnt !== false) ? $permalink . '_' . $cnt : $permalink;
+ 				$sql = 'SELECT contrib_id FROM ' . TITANIA_CONTRIBS_TABLE . '
+ 					WHERE contrib_name_clean = \'' . phpbb::$db->sql_escape($permalink_test) . '\'';
+ 				$p_result = phpbb::$db->sql_query($sql);
+ 				if (phpbb::$db->sql_fetchrow($p_result))
+ 				{
+ 					$conflict = true;
+ 					$cnt = ($cnt === false) ? 2 : $cnt + 1;
+ 				}
+ 				else
+ 				{
+ 					$conflict = false;
+ 					$permalink = $permalink_test;
+ 				}
+ 				phpbb::$db->sql_freeresult($p_result);
+ 			} while ($conflict == true);
+ 
+ 			switch ((int) $row['contrib_status'])
+ 			{
+ 				case 4 : // Cleaned
+ 					$contrib_status = TITANIA_CONTRIB_CLEANED;
+ 				break;
+ 
+ 				// None have been pulled for security reasons...
+ 
+ 				default :
+ 					$contrib_status = TITANIA_CONTRIB_APPROVED;
+ 				break;
+ 			}
+ 
+ 			// Set 2.0 mods to cleaned
+ 			if ($row['contrib_phpbb_version'][0] != '3')
+ 			{
+ 				$contrib_status = TITANIA_CONTRIB_CLEANED;
+ 			}
+ 
+ 			$sql_ary = array(
+ 				'contrib_id'					=> $row['contrib_id'],
+ 				'contrib_user_id'				=> $row['user_id'],
+ 				'contrib_type'					=> $row['contrib_type'],
+ 				'contrib_name'					=> $row['contrib_name'],
+ 				'contrib_name_clean'			=> $permalink,
+ 				'contrib_desc'					=> $row['contrib_description'],
+ 				'contrib_desc_bitfield'			=> $row['contrib_bbcode_bitfield'],
+ 				'contrib_desc_uid'				=> $row['contrib_bbcode_uid'],
+ 				'contrib_desc_options'			=> $row['contrib_bbcode_flags'],
+ 				'contrib_status'				=> $contrib_status,
+ 				'contrib_downloads'				=> $row['contrib_downloads'],
+ 				'contrib_views'					=> 0,
+ 				'contrib_rating'				=> 0,
+ 				'contrib_rating_count'			=> 0,
+ 				'contrib_visible'				=> 1,
+ 				'contrib_last_update'			=> 0, // Update with ariel revisions table
+ 				'contrib_demo'					=> ($row['contrib_style_demo']) ? 'http://www.phpbb.com/styles/demo/3.0/index.php?style_id=' . $row['contrib_style_demo'] : '',
+ 				'contrib_release_topic_id'		=> ($row['topic_id']) ? $row['topic_id'] : 0,
+ 			);
+ 
+ 			// Insert
+ 			titania_insert(TITANIA_CONTRIBS_TABLE, $sql_ary);
+ 
+ 			// Convert 2.0 mods, but do not put them in any categories
+ 			if ($row['contrib_phpbb_version'][0] == '3')
+ 			{
+ 				$sql = 'SELECT tag_id FROM ' . $ariel_prefix . 'contrib_tags
+ 					WHERE contrib_id = ' . (int) $row['contrib_id'];
+ 				$result1 = phpbb::$db->sql_query($sql);
+ 				while ($tag_row = phpbb::$db->sql_fetchrow($result1))
+ 				{
+ 					$sql_ary = array(
+ 						'contrib_id'	=> $row['contrib_id'],
+ 					);
+ 
+ 					if (isset($tags_to_cats[$tag_row['tag_id']]))
+ 					{
+ 						$sql_ary['category_id'] = $tags_to_cats[$tag_row['tag_id']];
+ 
+ 						titania_insert(TITANIA_CONTRIB_IN_CATEGORIES_TABLE, $sql_ary);
+ 					}
+ 				}
+ 				phpbb::$db->sql_freeresult($result1);
+ 			}
+ 
+ 			// Screenshots
+ 			if (file_exists(TITANIA_ROOT . $screenshots_dir . (int) $row['contrib_id'] . '.gif'))
+ 			{
+ 				$new_filename = md5($row['contrib_id'] . rand(0, 100));
+ 				if (!copy(TITANIA_ROOT . $screenshots_dir . (int) $row['contrib_id'] . '.gif', titania::$config->upload_path . 'titania_screenshots/' . $new_filename))
+ 				{
+ 					echo 'Could Not Copy File - ' . TITANIA_ROOT . $screenshots_dir . (int) $row['contrib_id'] . '.gif<br />';
+ 					continue;
+ 				}
+ 
+ 				$sql_ary = array(
+ 					'object_type'			=> TITANIA_SCREENSHOT,
+ 					'object_id'				=> $row['contrib_id'],
+ 					'attachment_access'		=> TITANIA_ACCESS_PUBLIC,
+ 					'attachment_comment'	=> '',
+ 					'attachment_directory'	=> 'titania_screenshots',
+ 					'physical_filename'		=> $new_filename,
+ 					'real_filename'			=> 'Screenshot',
+ 					'download_count'		=> 0,
+ 					'filesize'				=> filesize(titania::$config->upload_path . 'titania_screenshots/' . $new_filename),
+ 					'filetime'				=> 0,
+ 					'extension'				=> 'gif',
+ 					'mimetype'				=> 'image/gif',
+ 					'hash'					=> md5_file(titania::$config->upload_path . 'titania_screenshots/' . $new_filename),
+ 					'thumbnail'				=> false,
+ 					'is_orphan'				=> 0,
+ 				);
+ 
+ 				// Insert
+ 				titania_insert(TITANIA_ATTACHMENTS_TABLE, $sql_ary);
+ 			}
+ 		}
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		$display_message = 'Contributions table';
+ 	break;
+ 
+ 	case 3 :
+ 		$sql = 'SELECT COUNT(revision_id) AS cnt FROM ' . $ariel_prefix . 'contrib_revisions';
+ 		phpbb::$db->sql_query($sql);
+ 		$total = phpbb::$db->sql_fetchfield('cnt');
+ 		phpbb::$db->sql_freeresult();
+ 
+ 		$sql_ary = array(
+ 			'SELECT'	=> 'q.queue_id, q.queue_status, r.*, c.contrib_name, c.contrib_phpbb_version, c.contrib_status, c.contrib_type, c.contrib_filename_internal, c.contrib_phpbb_version',
+ 
+ 			'FROM'		=> array(
+ 				$ariel_prefix . 'contrib_revisions' => 'r',
+ 				$ariel_prefix . 'contribs' => 'c',
+ 			),
+ 
+ 			'LEFT_JOIN'	=> array(
+ 				array(
+ 					'FROM'	=> array($ariel_prefix . 'queue' => 'q'),
+ 					'ON'	=> 'q.revision_id = r.revision_id',
+ 				),
+ 			),
+ 
+ 			'WHERE'		=> 'c.contrib_id = r.contrib_id',
+ 
+ 			'ORDER_BY'	=> 'r.revision_id DESC, q.queue_id DESC',
+ 		);
+ 		$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
+ 
+ 		$result = phpbb::$db->sql_query_limit($sql, $limit, $start);
+ 		while ($row = phpbb::$db->sql_fetchrow($result))
+ 		{
+ 			$ignore = array(-1, 3);
+ 			if (in_array($row['contrib_status'], $ignore) || !in_array($row['contrib_type'], array_keys(titania_types::$types)))
+ 			{
+ 				// Skip contribs that were denied or pulled and weird ones
+ 				continue;
+ 			}
+ 
+ 			$ignore = array(-3, -4, -5, -6);
+ 			if (in_array($row['queue_status'], $ignore))
+ 			{
+ 				// Skip revisions that were canned, etc
+ 				continue;
+ 			}
+ 
+ 			// mime_content_type bitches on me without using realpath
+ 			$filename = realpath(TITANIA_ROOT . phpbb::$config['site_upload_dir'] . '/' . $row['revision_filename_internal']);
+ 			if (!file_exists($filename))
+ 			{
+ 				echo 'Could Not Find File - ' . TITANIA_ROOT . phpbb::$config['site_upload_dir'] . '/' . $row['revision_filename_internal'] . '<br />';
+ 				continue;
+ 			}
+ 
+ 			if (function_exists('mime_content_type'))
+ 			{
+ 				$mime_type = mime_content_type($filename);
+ 			}
+ 			else
+ 			{
+ 				ob_start();
+ 				system('/usr/bin/file -i -b ' . $filename);
+ 				$type = ob_get_clean();
+ 				$parts = explode(';', $type);
+ 				$mime_type = trim($parts[0]);
+ 			}
+ 
+ 			switch ($mime_type)
+ 			{
+ 				case 'application/zip' :
+ 				case 'application/octet-stream' :
+ 					if (!strpos($row['revision_filename'], '.zip'))
+ 					{
+ 						$row['revision_filename'] .= '.zip';
+ 					}
+ 				break;
+ 
+ 				case 'text/plain' :
+ 				case 'text/x-c' :
+ 				case 'text/x-c++' :
+ 				case 'text/x-pascal' :
+ 				case 'text/x-lisp' :
+ 				case 'application/xml' :
+ 					if (!strpos($row['revision_filename'], '.mod'))
+ 					{
+ 						$row['revision_filename'] .= '.mod';
+ 					}
+ 				break;
+ 
+ 				case 'application/x-rar' :
+ 					continue; // Silently ignore...
+ 				break;
+ 
+ 				default :
+ 					echo $row['revision_filename'] . ' ' . $mime_type . ' ' . $filename . '<br />';
+ 					continue;
+ 				break;
+ 			}
+ 
+ 			$move_dir = 'titania_contributions';
+ 			$move_file = md5(unique_id());
+ 			if (!file_exists(titania::$config->upload_path . $move_dir))
+ 			{
+ 				mkdir(titania::$config->upload_path . $move_dir);
+ 				phpbb_chmod(titania::$config->upload_path . $move_dir, CHMOD_ALL);
+ 			}
+ 			if (!copy($filename, titania::$config->upload_path . $move_dir . '/' . $move_file))
+ 			{
+ 				echo 'Could Not Copy File - ' . $filename . '<br />';
+ 				continue;
+ 			}
+ 
+ 			$sql_ary = array(
+ 				'object_type'			=> TITANIA_CONTRIB,
+ 				'object_id'				=> $row['contrib_id'],
+ 				'attachment_access'		=> TITANIA_ACCESS_PUBLIC,
+ 				'attachment_comment'	=> '',
+ 				'attachment_directory'	=> $move_dir,
+ 				'physical_filename'		=> $move_file,
+ 				'real_filename'			=> $row['revision_filename'],
+ 				'download_count'		=> 0,
+ 				'filesize'				=> $row['revision_filesize'],
+ 				'filetime'				=> $row['revision_date'],
+ 				'extension'				=> (strpos($row['revision_filename'], '.zip')) ? 'zip' : 'mod',
+ 				'mimetype'				=> (strpos($row['revision_filename'], '.zip')) ? 'application/x-zip-compressed' : 'text/plain',
+ 				'hash'					=> $row['revision_md5'],
+ 				'thumbnail'				=> 0,
+ 				'is_orphan'				=> 0,
+ 			);
+ 
+ 			// Insert
+ 			$attach_id = titania_insert(TITANIA_ATTACHMENTS_TABLE, $sql_ary);
+ 
+ 			$sql_ary = array(
+ 				'revision_id'				=> $row['revision_id'],
+ 				'contrib_id'				=> $row['contrib_id'],
+ 				'attachment_id'				=> $attach_id,
+ 				'revision_version'			=> $row['revision_version'],
+ 				'revision_name'				=> $row['revision_name'],
+ 				'revision_time'				=> $row['revision_date'],
+ 				'revision_validated'		=> ($row['queue_status'] == -1) ? true : false,
+ 				'validation_date'			=> ($row['queue_status'] == -1) ? $row['revision_date'] : 0,
+ 				'install_time'				=> 0,
+ 				'install_level'				=> 0,
+ 				'revision_submitted'		=> 1,
+ 				'revision_queue_id'			=> (isset($row['queue_id'])) ? (int) $row['queue_id'] : 0,
+ 			);
+ 
+ 			// Insert
+ 			$revision_id = titania_insert(TITANIA_REVISIONS_TABLE, $sql_ary);
+ 
+ 			if ($row['contrib_filename_internal'] == $row['revision_filename_internal'])
+ 			{
+ 				// More Ariel nubish.
+ 				$sql_ary = array(
+ 					'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,
+ 				);
+ 			}
+ 			else
+ 			{
+ 				$sql_ary = array(
+ 					'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,
+ 				);
+ 			}
+ 			titania_insert(TITANIA_REVISIONS_PHPBB_TABLE, $sql_ary);
+ 
+ 			// Update the contrib_last_update
+ 			if ($row['queue_status'] == -1 || !titania::$config->require_validation)
+ 			{
+ 				$sql = 'UPDATE ' . TITANIA_CONTRIBS_TABLE . '
+ 					SET contrib_last_update = ' . (int) $row['revision_date'] . '
+ 					WHERE contrib_id = ' . (int) $row['contrib_id'] . '
+ 						AND contrib_last_update < ' . (int) $row['revision_date'];
+ 				phpbb::$db->sql_query($sql);
+ 			}
+ 		}
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		$display_message = 'Revisions table';
+ 	break;
+ 
+ 	case 4 :
+ 		$limit = $limit / 2;
+ 
+ 		$sql = 'SELECT COUNT(topic_id) AS cnt FROM ' . $ariel_prefix . 'contrib_topics t, ' . TITANIA_CONTRIBS_TABLE . ' c
+ 			WHERE t.topic_type = 5
+ 				AND c.contrib_id = t.contrib_id';
+ 		phpbb::$db->sql_query($sql);
+ 		$total = phpbb::$db->sql_fetchfield('cnt');
+ 		phpbb::$db->sql_freeresult();
+ 
+ 		// Move the queue discussion topics to our own side
+ 		$sql = 'SELECT * FROM ' . $ariel_prefix . 'contrib_topics t, ' . TITANIA_CONTRIBS_TABLE . ' c
+ 			WHERE t.topic_type = 5
+ 				AND c.contrib_id = t.contrib_id
+ 			ORDER BY t.topic_id DESC';
+ 		$result = phpbb::$db->sql_query_limit($sql, $limit, $start);
+ 		while ($row = phpbb::$db->sql_fetchrow($result))
+ 		{
+ 			$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_category = $row['contrib_type'];
+ 			$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);
+ 		}
+ 		phpbb::$db->sql_freeresult();
+ 
+ 		$display_message = 'Queue Discussion';
+ 	break;
+ 
+ 	case 5 :
+ 		$limit = $limit / 2;
+ 
+ 		$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();
+ 
+ 		$sql_ary = array(
+ 			'SELECT' => 'q.*, ct.topic_id, c.contrib_name, c.contrib_name_clean, c.contrib_type, r.revision_version',
+ 			'FROM'		=> array(
+ 				$ariel_prefix . 'queue'		=> 'q',
+ 				TITANIA_CONTRIBS_TABLE		=> 'c',
+ 				TITANIA_REVISIONS_TABLE		=> 'r',
+ 			),
+ 			'LEFT_JOIN'	=> array(
+ 				array(
+ 					'FROM'	=> array($ariel_prefix . 'contrib_topics' => 'ct'),
+ 					'ON'	=> 'ct.topic_type = 4 AND ct.contrib_id = q.contrib_id'
+ 				)
+ 			),
+ 			'WHERE' => 'c.contrib_id = q.contrib_id
+ 				AND r.revision_id = q.revision_id',
+ 			'ORDER_BY' => 'queue_id DESC',
+ 		);
+ 		$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
+ 		$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;
+ 			}
+ 
+ 			// Ariel only stores the latest
+ 			$sql = 'SELECT MAX(queue_id) AS max FROM ' . $ariel_prefix . 'queue
+ 				WHERE contrib_id = ' . (int) $row['contrib_id'];
+ 			phpbb::$db->sql_query($sql);
+ 			$max = phpbb::$db->sql_fetchfield('max');
+ 			phpbb::$db->sql_freeresult();
+ 			if ($max != $row['queue_id'])
+ 			{
+ 				// So we attempt to find older ones in the trash can forums
+ 				$sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
+ 					WHERE forum_id = ' . (($row['contrib_type'] == 1) ? $mod_validation_trash_forum : $style_validation_trash_forum) . '
+ 						AND topic_title = \'' . phpbb::$db->sql_escape($row['contrib_name']) . '\'
+ 						AND topic_time BETWEEN ' . ($row['queue_opened'] - 10) . '
+ 							AND ' . ($row['queue_opened'] + 10);
+ 				phpbb::$db->sql_query($sql);
+ 				$row['topic_id'] = phpbb::$db->sql_fetchfield('topic_id');
+ 				phpbb::$db->sql_freeresult();
+ 			}
+ 
+ 			$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'];
+ 			$topic->topic_category = $row['contrib_type'];
+ 			titania_move_topic($row['topic_id'], $topic, TITANIA_QUEUE, $row['contrib_name'], $row['revision_version']);
+ 			$queue_topic_id = $topic->topic_id;
+ 			unset($topic);
+ 
+ 			// Ariel = shit.  Closing queue items but leaving them as not approved or denied.  Going to have to assume they were denied.
+ 			if ($row['queue_closed'] && $row['queue_status'] != -1)
+ 			{
+ 				$row['queue_status'] = -2;
+ 			}
+ 
+ 			// Now insert to the queue table
+ 			$sql_ary = array(
+ 				'queue_id'				=> $row['queue_id'],
+ 				'revision_id'			=> $row['revision_id'],
+ 				'contrib_id'			=> $row['contrib_id'],
+ 				'submitter_user_id'		=> $row['user_id'],
+ 				'queue_topic_id'		=> $queue_topic_id,
+ 
+ 				'queue_type'			=> $row['contrib_type'],
+ 				'queue_status'			=> (isset($queue_swap[$row['queue_status']])) ? $queue_swap[$row['queue_status']] : TITANIA_QUEUE_NEW,
+ 				'queue_submit_time'		=> $row['queue_opened'],
+ 				'queue_close_time'		=> $row['queue_closed'],
+ 
+ 				'queue_notes'			=> '',
+ 				'queue_notes_bitfield'	=> '',
+ 				'queue_notes_uid'		=> '',
+ 				'queue_notes_options'	=> 7,
+ 
+ 				'queue_validation_notes'			=> '',
+ 				'queue_validation_notes_bitfield'	=> '',
+ 				'queue_validation_notes_uid'		=> '',
+ 				'queue_validation_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 6 :
+ 		$sql_ary = $contrib_ids = array();
+ 		$sql = 'SELECT contrib_id FROM ' . TITANIA_CONTRIB_IN_CATEGORIES_TABLE . '
+ 			WHERE ' . phpbb::$db->sql_in_set('category_id', array(13, 14, 15, 16));
+ 		$result = phpbb::$db->sql_query($sql);
+ 		while ($row = phpbb::$db->sql_fetchrow($result))
+ 		{
+ 			$contrib_ids[] = $row['contrib_id'];
+ 		}
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		$sql = 'DELETE FROM ' . TITANIA_REVISIONS_PHPBB_TABLE . '
+ 			WHERE ' . phpbb::$db->sql_in_set('contrib_id', $contrib_ids);
+ 		phpbb::$db->sql_query($sql);
+ 
+ 		$versions = array(
+ 			array(20, '23'),
+ 			array(30, '0'),
+ 			array(30, '1'),
+ 			array(30, '2'),
+ 			array(30, '3'),
+ 			array(30, '4'),
+ 			array(30, '5'),
+ 			array(30, '6'),
+ 			array(30, '7'),
+ 			array(30, '7-pl1'),
+ 		);
+ 
+ 		$sql = 'SELECT contrib_id, revision_id, revision_validated FROM ' . TITANIA_REVISIONS_TABLE . '
+ 			WHERE ' . phpbb::$db->sql_in_set('contrib_id', $contrib_ids);
+ 		$result = phpbb::$db->sql_query($sql);
+ 		while ($row = phpbb::$db->sql_fetchrow($result))
+ 		{
+ 			foreach ($versions as $data)
+ 			{
+ 				$sql_ary[] = array(
+ 					'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'],
+ 				);
+ 			}
+ 		}
+ 		phpbb::$db->sql_freeresult($result);
+ 
+ 		phpbb::$db->sql_multi_insert(TITANIA_REVISIONS_PHPBB_TABLE, $sql_ary);
+ 
+ 		$display_message = 'Smilies, Avatars, Ranks, Styles Misc support the latest phpBB';
+ 	break;
+ 
+ 	case 7 :
+ 		$sync = new titania_sync;
+ 
+ 		$sync->authors('count');
+ 
+ 		$display_message = 'Authors';
+ 	break;
+ 
+ 	case 8 :
+ 		$sync = new titania_sync;
+ 
+ 		$sync->contribs('validated');
+ 
+ 		$sync->categories('count');
+ 
+ 		$display_message = 'Syncing';
+ 	break;
+ 
+ 	case 9 :
+ 		phpbb::$cache->purge();
+ 
+ 		trigger_error('Ariel Conversion Finished!');
+ 	break;
+ }
+ 
+ if (($start + $limit) >= $total)
+ {
+ 	// Move to the next step
+ 	$next = append_sid(TITANIA_ROOT . 'ariel_convert.' . PHP_EXT, 'step=' . ++$step);
+ 	$display_message .= '...done!';
+ }
+ else
+ {
+ 	// Still more to do
+ 	$next = append_sid(TITANIA_ROOT . 'ariel_convert.' . PHP_EXT, "step={$step}&amp;start=" . ($start + $limit));
+ 	$display_message .= '...done with ' . ($start + $limit) . ' of ' . $total;
+ }
+ 
+ $display_message .= '<br /><br /><a href="' . $next . '">Manual Continue</a>';
+ 
+ // Meta refresh only if no errors
+ if (!headers_sent())
+ {
+ 	meta_refresh(0, $next);
+ }
+ 
+ trigger_error($display_message);
+ 
+ // Move a topic from phpBB ($topic_id) to Titania ($topic; object)
+ function titania_move_topic($topic_id, $topic, $topic_type, $contrib_name = '', $revision_version = '')
+ {
+ 	$post = false;
+ 
+ 	// Convert the topics over from the phpBB forums
+ 	if ($topic_id)
+ 	{
+ 		$sql = 'SELECT * FROM ' . POSTS_TABLE . '
+ 			WHERE topic_id = ' . (int) $topic_id . '
+ 			ORDER BY post_id ASC';
+ 		$post_result = phpbb::$db->sql_query($sql);
+ 		while ($post_row = phpbb::$db->sql_fetchrow($post_result))
+ 		{
+ 			$post = new titania_post($topic_type, $topic);
+ 
+ 			// Rewrite some URLs
+ 			$contrib_view = titania_url::build_url('contribution/$1');
+ 			$contrib_view_full = '<a class="postlink" href="' . $contrib_view . '">' . $contrib_view . '</a>';
+ 			$replace = array(
+ 				'#<a class="postlink" href="http://www.phpbb.com/mods/db/index.php\?i=queue&amp;mode=overview&amp;contrib_id=([0-9]+)">http://www.phpbb.com/mods/db/index.php\? ... [^=]+=[0-9]+</a>#',
+ 				'#<a class="postlink" href="http://www.phpbb.com/mods/db/index.php\?i=misc&amp;mode=display&amp;contrib_id=([0-9]+)">http://www.phpbb.com/mods/db/index.php\? ... [^=]+=[0-9]+</a>#',
+ 			);
+ 			$post_row['post_text'] = preg_replace($replace, $contrib_view_full, $post_row['post_text']);
+ 			$replace = array(
+ 				'#http://www.phpbb.com/mods/db/index.php\?i=queue&amp;mode=overview&amp;contrib_id=([0-9]+)#',
+ 				'#http://www.phpbb.com/mods/db/index.php\?i=misc&amp;mode=display&amp;contrib_id=([0-9]+)#',
+ 			);
+ 			$post_row['post_text'] = preg_replace($replace, $contrib_view, $post_row['post_text']);
+ 			$post_row['post_text'] = str_replace("===INT===", '', $post_row['post_text']);
+ 
+ 			$post->__set_array(array(
+ 				'post_access'			=> ($topic_type == TITANIA_QUEUE) ? TITANIA_ACCESS_TEAMS : TITANIA_ACCESS_AUTHORS,
+ 				'post_user_id'			=> $post_row['poster_id'],
+ 				'post_ip'				=> $post_row['poster_ip'],
+ 				'post_time'				=> $post_row['post_time'],
+ 				'post_subject'			=> $post_row['post_subject'],
+ 				'post_text'				=> $post_row['post_text'],
+ 				'post_text_bitfield'	=> $post_row['bbcode_bitfield'],
+ 				'post_text_uid'			=> $post_row['bbcode_uid'],
+ 				'post_text_options'		=> (($post_row['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0) + (($post_row['enable_smilies']) ? OPTION_FLAG_SMILIES : 0) + (($post_row['enable_magic_url']) ? OPTION_FLAG_LINKS : 0),
+ 			));
+ 
+ 			if ($topic_type == TITANIA_QUEUE_DISCUSSION)
+ 			{
+ 				$post->topic->topic_sticky = true;
+ 			}
+ 
+ 			$post->submit();
+ 		}
+ 		phpbb::$db->sql_freeresult($post_result);
+ 	}
+ 
+ 	// We didn't convert any posts?  (Local install perhaps?)
+ 	if ($post === false && $contrib_name)
+ 	{
+ 		$post = new titania_post($topic_type, $topic);
+ 		$post->__set_array(array(
+ 			'post_access'			=> TITANIA_ACCESS_TEAMS,
+ 			'post_subject'			=> phpbb::$user->lang['VALIDATION'] . ' - ' . $contrib_name . ' - ' . $revision_version,
+ 			'post_text'				=> 'Converted from Ariel',
+ 		));
+ 		switch ($post->topic->topic_category)
+ 		{
+ 			case TITANIA_TYPE_MOD :
+ 				$post->post_user_id = titania::$config->forum_mod_robot;
+ 			break;
+ 
+ 			case TITANIA_TYPE_STYLE :
+ 				$post->post_user_id = titania::$config->forum_style_robot;
+ 			break;
+ 		}
+ 
+ 		$post->submit();
+ 	}
+ }
+ 
+ function titania_insert($table, $sql_ary)
+ {
+ 	$sql = 'INSERT INTO ' . $table . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary);
+ 
+ 	phpbb::$db->sql_return_on_error(true);
+ 
+ 	phpbb::$db->sql_query($sql);
+ 
+ 	if (phpbb::$db->sql_error_triggered && phpbb::$db->sql_error_returned['code'] != 1062) // Ignore duplicate entry errors
+ 	{
+ 		echo '<br />' . $sql . '<br />';
+ 		echo 'SQL ERROR [ ' . phpbb::$db->sql_layer . ' ]<br /><br />' . phpbb::$db->sql_error_returned['message'] . ' [' . phpbb::$db->sql_error_returned['code'] . ']<br />';
+ 	}
+ 
+ 	phpbb::$db->sql_return_on_error(false);
+ 
+ 	return phpbb::$db->sql_nextid();
+ }
+ 
+ function titania_rmdir_recursive($target_filename)
+ {
+ 	if (!is_dir($target_filename))
+ 	{
+ 		return;
+ 	}
+ 
+     foreach (scandir($target_filename) as $item)
+ 	{
+         if ($item == '.' || $item == '..')
+ 		{
+ 			continue;
+ 		}
+ 
+ 		if (is_dir($target_filename . $item))
+ 		{
+ 			titania_rmdir_recursive($target_filename . $item . '/');
+ 		}
+ 		else
+ 		{
+ 			@unlink($target_filename . $item);
+ 		}
+     }
+ 
+ 	return @rmdir($target_filename);
+ }
+ 
+ /**
+ * Make a directory recursively (from functions_compress)
+ *
+ * @param string $target_filename The target directory we wish to have
+ */
+ function titania_mkdir_recursive($target_filename)
+ {
+ 	if (!is_dir($target_filename))
+ 	{
+ 		$str = '';
+ 		$folders = explode('/', $target_filename);
+ 
+ 		// Create and folders and subfolders if they do not exist
+ 		foreach ($folders as $folder)
+ 		{
+ 			$folder = trim($folder);
+ 			if (!$folder)
+ 			{
+ 				continue;
+ 			}
+ 
+ 			$str = (!empty($str)) ? $str . '/' . $folder : $folder;
+ 			if (!is_dir($str))
+ 			{
+ 				@mkdir($str, 0777);
+ 				phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE);
+ 			}
+ 		}
+ 	}
+ }

Propchange: misc/ariel_convert.php
------------------------------------------------------------------------------
    svn:keywords = Revision Author Date Id

Added: misc/includes/manage_tools/organize_lang.php
==============================================================================
*** misc/includes/manage_tools/organize_lang.php (added)
--- misc/includes/manage_tools/organize_lang.php Mon Apr 12 20:11:28 2010
***************
*** 0 ****
--- 1,278 ----
+ <?php
+ /**
+ *
+ * @package Support Tool Kit - Organize Language Files
+ * @version $Id$
+ * @copyright (c) 2009 phpBB Group
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ *
+ */
+ 
+ if (!defined('IN_PHPBB'))
+ {
+ 	exit;
+ }
+ 
+ class organize_lang
+ {
+ 	/**
+ 	* Tool Info
+ 	*
+ 	* @return Returns an array with the info about this tool.
+ 	*/
+ 	function info()
+ 	{
+ 		global $user;
+ 
+ 		return array(
+ 			'NAME'			=> $user->lang['ORGANIZE_LANG'],
+ 			'NAME_EXPLAIN'	=> $user->lang['ORGANIZE_LANG_EXPLAIN'],
+ 		);
+ 	}
+ 
+ 	/**
+ 	* Display Options
+ 	*
+ 	* Output the options available
+ 	*/
+ 	function display_options()
+ 	{
+ 		return array(
+ 			'title'	=> 'ORGANIZE_LANG',
+ 			'vars'	=> array(
+ 				'legend1'			=> 'ORGANIZE_LANG',
+ 				'file'				=> array('lang' => 'ORGANIZE_LANG_FILE', 'type' => 'text:40:255', 'explain' => true),
+ 			)
+ 		);
+ 	}
+ 
+ 	/**
+ 	* Run Tool
+ 	*
+ 	* Does the actual stuff we want the tool to do after submission
+ 	*/
+ 	function run_tool(&$error)
+ 	{
+         if (!check_form_key('organize_lang'))
+ 		{
+ 			$error[] = 'FORM_INVALID';
+ 			return;
+ 		}
+ 
+ 		$file = request_var('file', '');
+ 		if (!$file || (!file_exists(TITANIA_ROOT . 'language/' . $file) && !file_exists(TITANIA_ROOT . 'language/' . $file . '.' . PHP_EXT)))
+ 		{
+ 			$error[] = 'NO_FILE';
+ 			return;
+ 		}
+ 
+ 		organize_lang($file);
+ 
+ 		trigger_back('ORGANIZE_LANG_SUCCESS');
+ 	}
+ }
+ 
+ /**
+ * For finding the max string length for the organize_lang function
+ */
+ function find_max_length($lang, &$max_length, $start = 0)
+ {
+ 	$start_length = $start * 4;
+ 
+ 	foreach($lang as $name => $value)
+ 	{
+ 		if (is_array($value))
+ 		{
+ 			find_max_length($value, $max_length, ($start + 1));
+ 		}
+ 
+ 		if ((utf8_strlen($name) + $start_length) > $max_length)
+ 		{
+ 			$max_length = (utf8_strlen($name) + $start_length);
+ 		}
+ 	}
+ }
+ 
+ /**
+ * For outputting the lines for the organize_lang function
+ */
+ function lang_lines($lang, $max_length, &$output, $start = 0)
+ {
+ 	$last_letter = '';
+ 	$total_tabs = ceil(($max_length + 3) / 4) - $start;
+ 
+ 	if ($start != 0)
+ 	{
+ 		//ksort($lang);
+ 	}
+ 
+ 	$last_name = '';
+ 	foreach($lang as $name => $value)
+ 	{
+ 		if ($name == $last_name)
+ 		{
+ 			echo 'Lang Duplicate: ' . $name . '<br />';
+ 		}
+ 		$last_name = $name;
+ 
+ 		// make sure to add slashes to single quotes!
+ 		$name = addcslashes($name, "'");
+ 
+ 		// add an extra end line if the next word starts with a different letter then the last
+ 		if (substr($name, 0, 1) != $last_letter && $start == 0)
+ 		{
+ 			$output .= "\n";
+ 			$last_letter = substr($name, 0, 1);
+ 		}
+ 
+ 		// add the beggining tabs
+ 		for ($i=0; $i <= $start; $i++)
+ 		{
+ 			$output .= "\t";
+ 		}
+ 
+ 		// add the beginning of the lang section and add slashes to single quotes for the name
+ 		$output .= "'" . $name . "'";
+ 
+ 		// figure out the number of tabs we need to add to the middle, then add them
+ 		$tabs = ($total_tabs - ceil((utf8_strlen($name) + 3) / 4));
+ 
+ 		for($i=0; $i <= $tabs; $i++)
+ 		{
+ 			$output .= "\t";
+ 		}
+ 
+ 		if (is_array($value))
+ 		{
+ 			$output .= "=> array(\n";
+ 			lang_lines($value, $max_length, $output, ($start + 1));
+ 
+ 			for ($i=0; $i <= $start; $i++)
+ 			{
+ 				$output .= "\t";
+ 			}
+ 			$output .= "),\n\n";
+ 		}
+ 		else
+ 		{
+ 			// add =>, then slashes to single quotes and add to the output
+ 			$output .= "=> '" . addcslashes($value, "'") . "',\n";
+ 		}
+ 	}
+ }
+ 
+ /**
+ * Organize the language file by the lang keys, then re-output the data to the file
+ */
+ function organize_lang($file, $skip_errors = false)
+ {
+ 	if (substr($file, -1) == '/')
+ 	{
+ 		$file = substr($file, 0, -1);
+ 	}
+ 
+ 	// If the user submitted a directory, do every language file in that directory
+ 	if (is_dir(TITANIA_ROOT . 'language/' . $file))
+ 	{
+ 		if ($handle = opendir(TITANIA_ROOT . 'language/' . $file))
+ 		{
+ 		    while (false !== ($file1 = readdir($handle)))
+ 			{
+ 				if ($file1 == '.' || $file1 == '..' || $file1 == '.svn')
+ 				{
+ 					continue;
+ 				}
+ 
+ 				if (strpos($file1, '.' . PHP_EXT))
+ 				{
+ 					organize_lang($file . '/' . substr($file1, 0, strpos($file1, '.' . PHP_EXT)), true);
+ 				}
+ 				else if (is_dir(TITANIA_ROOT . 'language/' . $file . '/' . $file1))
+ 				{
+ 					organize_lang($file . '/' . $file1);
+ 				}
+ 		    }
+ 		    closedir($handle);
+ 		}
+ 
+ 		// if we went to a subdirectory, return
+ 		if ($file != request_var('file', '') && $file . '/' != request_var('file', ''))
+ 		{
+ 			return;
+ 		}
+ 
+ 		// Finished entire directory
+ 		return;
+ 	}
+ 
+ 	// include the file
+ 	@include(TITANIA_ROOT . 'language/' . $file . '.' . PHP_EXT);
+ 
+ 	// make sure it is a valid language file
+ 	if (!isset($lang) || !is_array($lang))
+ 	{
+ 		if ($skip_errors)
+ 		{
+ 			return;
+ 		}
+ 
+ 		trigger_back('Bad Language File. language/' . $file);
+ 	}
+ 
+ 	// setup the $output var
+ 	$output = '';
+ 
+ 	// lets get the header of the file...
+ 	$handle = @fopen(TITANIA_ROOT . 'language/' . $file . '.' . PHP_EXT, "r");
+ 	if ($handle)
+ 	{
+ 		$stopped = false;
+ 
+ 		while (!feof($handle))
+ 		{
+ 			$line = fgets($handle, 4096);
+ 
+ 			// if the line is $lang = array_merge($lang, array( break out of the while loop
+ 			if ($line == '$lang = array_merge($lang, array(' . "\n")
+ 			{
+ 				$stopped = true;
+ 				break;
+ 			}
+ 
+ 			$output .= $line;
+ 		}
+ 		fclose($handle);
+ 
+ 		if (!$stopped)
+ 		{
+ 			if ($skip_errors)
+ 			{
+ 				echo 'Bad line endings in ' . TITANIA_ROOT . 'language/' . $file . '.' . PHP_EXT . '<br />';
+ 				return;
+ 			}
+ 
+ 			trigger_back('Please make sure you are using UNIX line endings.');
+ 		}
+ 	}
+ 
+ 	// sort the languages by keys
+ 	ksort($lang);
+ 
+ 	// get the maximum length of the name string so we can format the page nicely when we output it
+ 	$max_length = 1;
+ 
+ 	find_max_length($lang, $max_length);
+ 
+ 	// now add $lang = array_merge($lang, array( to the output
+ 	$output .= '$lang = array_merge($lang, array(';
+ 
+ 	lang_lines($lang, $max_length, $output);
+ 
+ 	// add the end
+ 	$output .= '));
+ ';
+ 
+ 	// write the contents to the specified file
+ 	file_put_contents(TITANIA_ROOT . 'language/' . $file . '.' . PHP_EXT, $output);
+ }
+ ?>
\ No newline at end of file

Propchange: misc/includes/manage_tools/organize_lang.php
------------------------------------------------------------------------------
    svn:keywords = Revision Author Date Id




More information about the customisationdb-commits mailing list