[Customisation Database Commits] r1056 [1/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


Author: exreaction
Date: Mon Apr 12 20:11:28 2010
New Revision: 1056

Log:
Clean-up

Added:
    misc/
    misc/ariel constants.php   (with props)
    misc/ariel_convert.php   (with props)
    misc/includes/
    misc/includes/manage_tools/
    misc/includes/manage_tools/organize_lang.php   (with props)
Removed:
    branches/stable/titania/ariel_convert.php
    branches/stable/titania/compiled_install.php
    branches/stable/titania/docs/ariel constants.php
    branches/stable/titania/docs/style_validation_checklist.txt
    branches/stable/titania/docs/validation_checklist.txt
    branches/stable/titania/includes/manage_tools/organize_lang.php
    branches/stable/titania/manage/categories.php
    trunk/titania/ariel_convert.php
    trunk/titania/docs/ariel constants.php
    trunk/titania/docs/style_validation_checklist.txt
    trunk/titania/docs/validation_checklist.txt
Modified:
    branches/stable/titania/common.php
    branches/stable/titania/install.php
    branches/stable/titania/manage/index.php
    trunk/titania/common.php
    trunk/titania/compiled_install.php
    trunk/titania/install.php

Removed: branches/stable/titania/ariel_convert.php
==============================================================================
*** branches/stable/titania/ariel_convert.php (original)
--- branches/stable/titania/ariel_convert.php (removed)
***************
*** 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);
- 			}
- 		}
- 	}
- }
--- 0 ----

Modified: branches/stable/titania/common.php
==============================================================================
*** branches/stable/titania/common.php (original)
--- branches/stable/titania/common.php Mon Apr 12 20:11:28 2010
***************
*** 17,23 ****
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.1.57');
  
  define('PHPBB_USE_BOARD_URL_PATH', true);
  if (!defined('IN_TITANIA_INSTALL'))
--- 17,23 ----
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.3.0');
  
  define('PHPBB_USE_BOARD_URL_PATH', true);
  if (!defined('IN_TITANIA_INSTALL'))

Removed: branches/stable/titania/compiled_install.php
==============================================================================
*** branches/stable/titania/compiled_install.php (original)
--- branches/stable/titania/compiled_install.php (removed)
***************
*** 1,595 ****
- <?php
- /**
-  *
-  * @package titania
-  * @version $Id$
-  * @copyright (c) 2008 phpBB Customisation Database Team
-  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
-  *
-  */
- 
- die('Do not use me!');
- 
- /**
-  * @ignore
-  */
- define('IN_TITANIA', true);
- define('IN_TITANIA_INSTALL', true);
- define('UMIL_AUTO', true);
- if (!defined('TITANIA_ROOT')) define('TITANIA_ROOT', './');
- if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
- include(TITANIA_ROOT . 'common.' . PHP_EXT);
- titania::add_lang('install');
- 
- include(TITANIA_ROOT . 'includes/functions_install.' . PHP_EXT);
- 
- // Just to be on the safe side, add a php version check.
- if (version_compare(PHP_VERSION, '5.2.0') < 0)
- {
- 	die('You are running an unsupported PHP version. Please upgrade to PHP 5.2.0 or higher before trying to install Titania');
- }
- 
- if (!file_exists(PHPBB_ROOT_PATH . 'umil/umil_auto.' . PHP_EXT))
- {
- 	trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
- }
- 
- // Make sure we are not using the same table prefix as phpBB (will cause conflicts).
- if (titania::$config->table_prefix == $GLOBALS['table_prefix'])
- {
- 	trigger_error('You can not use the same table prefix for Titania as you are using for phpBB.');
- }
- 
- $mod_name = 'CUSTOMISATION_DATABASE';
- $version_config_name = 'titania_version';
- 
- $versions = array(
- 	'0.1.57'	=> array(
- 		'table_add' => array(
- 			array(TITANIA_ATTACHMENTS_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'attachment_id'			=> array('UINT', NULL, 'auto_increment'),
- 					'object_type'			=> array('TINT:1', 0),
- 					'object_id'				=> array('UINT', 0),
- 					'attachment_access'		=> array('UINT', 2),
- 					'attachment_comment'	=> array('TEXT_UNI', ''),
- 					'attachment_directory'	=> array('VCHAR', ''),
- 					'physical_filename'		=> array('VCHAR', ''),
- 					'real_filename'			=> array('VCHAR', ''),
- 					'download_count'		=> array('UINT', 0),
- 					'filesize'				=> array('INT:11', 0),
- 					'filetime'				=> array('INT:11', 0),
- 					'extension'				=> array('VCHAR:100', ''),
- 					'mimetype'				=> array('VCHAR:100', ''),
- 					'hash'					=> array('VCHAR:32', ''),
- 					'thumbnail'				=> array('BOOL', 0),
- 					'is_orphan'				=> array('TINT:1', 1),
- 				),
- 				'PRIMARY_KEY'	=> 'attachment_id',
- 				'KEYS'			=> array(
- 					'object_type'			=> array('INDEX', 'object_type'),
- 					'object_id'				=> array('INDEX', 'object_id'),
- 					'attachment_access'		=> array('INDEX', 'attachment_access'),
- 					'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'),
- 					'user_id'				=> array('UINT', 0),
- 					'phpbb_user_id'			=> array('UINT', 0),
- 					'author_realname'		=> array('VCHAR_CI', ''),
- 					'author_website'		=> array('VCHAR_UNI:200', ''),
- 					'author_rating'			=> array('DECIMAL', 0),
- 					'author_rating_count'	=> array('UINT', 0),
- 					'author_contribs'		=> array('UINT', 0), // Total # of contribs
- 					'author_snippets'		=> array('UINT', 0), // Number of snippets
- 					'author_mods'			=> array('UINT', 0), // Number of mods
- 					'author_styles'			=> array('UINT', 0), // Number of styles
- 					'author_visible'		=> array('BOOL', 1),
- 					'author_desc'			=> array('MTEXT_UNI', ''),
- 					'author_desc_bitfield'	=> array('VCHAR:255', ''),
- 					'author_desc_uid'		=> array('VCHAR:8', ''),
- 					'author_desc_options'	=> array('UINT:11', 7),
- 				),
- 				'PRIMARY_KEY'	=> 'author_id',
- 				'KEYS'			=> array(
- 					'user_id'				=> array('UNIQUE', 'user_id'),
- 					'author_rating'			=> array('INDEX', 'author_rating'),
- 					'author_contribs'		=> array('INDEX', 'author_contribs'),
- 					'author_snippets'		=> array('INDEX', 'author_snippets'),
- 					'author_mods'			=> array('INDEX', 'author_mods'),
- 					'author_styles'			=> array('INDEX', 'author_styles'),
- 					'author_visible'		=> array('INDEX', 'author_visible'),
- 				),
- 			)),
- 			array(TITANIA_CATEGORIES_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'category_id'				=> array('UINT', NULL, 'auto_increment'),
- 					'parent_id'					=> array('UINT', 0),
- 					'left_id'					=> array('UINT', 0),
- 					'right_id'					=> array('UINT', 0),
- 					'category_type'				=> array('TINT:1', 0),
- 					'category_contribs'			=> array('UINT', 0), // Number of items
- 					'category_visible'			=> array('BOOL', 1),
- 					'category_name'				=> array('STEXT_UNI', '', 'true_sort'),
- 					'category_name_clean'		=> array('VCHAR_CI', ''),
- 					'category_desc'				=> array('MTEXT_UNI', ''),
- 					'category_desc_bitfield'	=> array('VCHAR:255', ''),
- 					'category_desc_uid'			=> array('VCHAR:8', ''),
- 					'category_desc_options'		=> array('UINT:11', 7),
- 				),
- 				'PRIMARY_KEY'	=> 'category_id',
- 				'KEYS'			=> array(
- 					'parent_id'			=> array('INDEX', 'parent_id'),
- 					'left_right_id'		=> array('INDEX', array('left_id', 'right_id')),
- 					'category_type'		=> array('INDEX', 'category_type'),
- 					'category_visible'	=> array('INDEX', 'category_visible'),
- 				),
- 			)),
- 			array(TITANIA_CONTRIBS_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'contrib_id'					=> array('UINT', NULL, 'auto_increment'),
- 					'contrib_user_id'				=> array('UINT', 0),
- 					'contrib_type'					=> array('TINT:1', 0),
- 					'contrib_name'					=> array('STEXT_UNI', '', 'true_sort'),
- 					'contrib_name_clean'			=> array('VCHAR_CI', ''),
- 					'contrib_desc'					=> array('MTEXT_UNI', ''),
- 					'contrib_desc_bitfield'			=> array('VCHAR:255', ''),
- 					'contrib_desc_uid'				=> array('VCHAR:8', ''),
- 					'contrib_desc_options'			=> array('UINT:11', 7),
- 					'contrib_status'				=> array('TINT:2', 0),
- 					'contrib_downloads'				=> array('UINT', 0),
- 					'contrib_views'					=> array('UINT', 0),
- 					'contrib_rating'				=> array('DECIMAL', 0),
- 					'contrib_rating_count'			=> array('UINT', 0),
- 					'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(
- 					'contrib_user_id'		=> array('INDEX', 'contrib_user_id'),
- 					'contrib_type'			=> array('INDEX', 'contrib_type'),
- 					'contrib_name_clean'	=> array('INDEX', 'contrib_name_clean'),
- 					'contrib_status'		=> array('INDEX', 'contrib_status'),
- 					'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(
- 				'COLUMNS'		=> array(
- 					'contrib_id'			=> array('UINT', 0),
- 					'user_id'				=> array('UINT', 0),
- 					'active'				=> array('BOOL', 0),
- 				),
- 				'PRIMARY_KEY'	=> array('contrib_id', 'user_id'),
- 				'KEYS'			=> array(
- 					'active'		=> array('INDEX', 'active'),
- 				),
- 			)),
- 			array(TITANIA_CONTRIB_FAQ_TABLE, array(
- 				'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', ''),
- 					'faq_text_uid'			=> array('VCHAR:8', ''),
- 					'faq_text_options'		=> array('UINT:11', 7),
- 					'faq_views'				=> array('UINT', 0),
- 					'faq_access'			=> array('TINT:1', 2),
- 				),
- 				'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(
- 				'COLUMNS'		=> array(
- 					'contrib_id'			=> array('UINT', 0),
- 					'category_id'			=> array('UINT', 0),
- 				),
- 				'PRIMARY_KEY'	=> array('contrib_id', 'category_id'),
- 			)),
- 			array(TITANIA_POSTS_TABLE, array(
- 				'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),
- 					'post_approved'			=> array('BOOL', 1),
- 					'post_reported'			=> array('BOOL', 0),
- 					'post_attachment'		=> array('BOOL', 0),
- 					'post_user_id'			=> array('UINT', 0),
- 					'post_ip'				=> array('VCHAR:40', ''),
- 					'post_time'				=> array('UINT:11', 0),
- 					'post_edited'			=> array('UINT:11', 0), // Post edited; 0 for not edited, timestamp if (when) last edited
- 					'post_deleted'			=> array('UINT:11', 0), // Post deleted; 0 for not edited, timestamp if (when) last edited
- 					'post_delete_user'		=> array('UINT', 0), // The last user to delete the post
- 					'post_edit_user'		=> array('UINT', 0), // The last user to edit the post
- 					'post_edit_reason'		=> array('STEXT_UNI', ''), // Reason for deleting/editing
- 					'post_subject'			=> array('STEXT_UNI', '', 'true_sort'),
- 					'post_text'				=> array('MTEXT_UNI', '', 'true_sort'),
- 					'post_text_bitfield'	=> array('VCHAR:255', ''),
- 					'post_text_uid'			=> array('VCHAR:8', ''),
- 					'post_text_options'		=> array('UINT:11', 7),
- 				),
- 				'PRIMARY_KEY'	=> 'post_id',
- 				'KEYS'			=> array(
- 					'topic_id'				=> array('INDEX', 'topic_id'),
- 					'post_type'				=> array('INDEX', 'post_type'),
- 					'post_access'			=> array('INDEX', 'post_access'),
- 					'post_approved'			=> array('INDEX', 'post_approved'),
- 					'post_reported'			=> array('INDEX', 'post_reported'),
- 					'post_user_id'			=> array('INDEX', 'post_user_id'),
- 					'post_deleted'			=> array('INDEX', 'post_deleted'),
- 				),
- 			)),
- 			array(TITANIA_QUEUE_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'queue_id'				=> array('UINT', NULL, 'auto_increment'),
- 					'revision_id'			=> array('UINT', 0),
- 					'contrib_id'			=> array('UINT', 0),
- 					'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(
- 					'revision_id'			=> array('INDEX', 'revision_id'),
- 					'contrib_id'			=> array('INDEX', 'contrib_id'),
- 					'queue_type'			=> array('INDEX', 'queue_type'),
- 					'queue_status'			=> array('INDEX', 'queue_status'),
- 					'submitter_user_id'		=> array('INDEX', 'submitter_user_id'),
- 					'queue_submit_time'		=> array('INDEX', 'queue_submit_time'),
- 				),
- 			)),
- 			array(TITANIA_RATINGS_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'rating_id'				=> array('UINT', NULL, 'auto_increment'),
- 					'rating_type_id'		=> array('UINT', 0),
- 					'rating_user_id'		=> array('UINT', 0),
- 					'rating_object_id'		=> array('UINT', 0),
- 					'rating_value'			=> array('DECIMAL', 0), // Not sure if we should allow partial ratings (like 4.5/5) or just integer ratings...
- 				),
- 				'PRIMARY_KEY'	=> 'rating_id',
- 				'KEYS'			=> array(
- 					'type_user_object'		=> array('UNIQUE', array('rating_type_id', 'rating_user_id', 'rating_object_id')),
- 				),
- 			)),
- 			array(TITANIA_REVISIONS_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'revision_id'				=> array('UINT', NULL, 'auto_increment'),
- 					'contrib_id'				=> array('UINT', 0),
- 					'attachment_id'				=> array('UINT', 0),
- 					'revision_version'			=> array('VCHAR', ''),
- 					'revision_name'				=> array('STEXT_UNI', '', 'true_sort'),
- 					'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(
- 				'COLUMNS'		=> array(
- 					'object_type'			=> array('UINT', 0),
- 					'object_id'				=> array('UINT', 0),
- 					'tag_id'				=> array('UINT', 0),
- 					'tag_value'				=> array('STEXT_UNI', '', 'true_sort'),
- 				),
- 				'PRIMARY_KEY'	=> array('object_type', 'object_id', 'tag_id'),
- 			)),
- 			array(TITANIA_TAG_FIELDS_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'tag_id'				=> array('UINT', NULL, 'auto_increment'),
- 					'tag_type_id'			=> array('UINT', 0),
- 					'tag_field_name'		=> array('XSTEXT_UNI', '', 'true_sort'),
- 					'tag_clean_name'		=> array('XSTEXT_UNI', '', 'true_sort'),
- 					'tag_field_desc'		=> array('STEXT_UNI', '', 'true_sort'),
- 					'no_delete'				=> array('BOOL', 0), // A few tags we have to hard-code (like new status for a queue item)
- 				),
- 				'PRIMARY_KEY'	=> 'tag_id',
- 				'KEYS'			=> array(
- 					'tag_type_id'			=> array('INDEX', 'tag_type_id'),
- 				),
- 			)),
- 			array(TITANIA_TAG_TYPES_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'tag_type_id'			=> array('UINT', NULL, 'auto_increment'),
- 					'tag_type_name'			=> array('STEXT_UNI', '', 'true_sort'),
- 				),
- 				'PRIMARY_KEY'	=> 'tag_type_id',
- 			)),
- 			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
- 					'topic_status'					=> array('UINT', 0), // Topic Status, use tags from the DB
- 					'topic_assigned'				=> array('VCHAR:255', ''), // Topic assigned status; u- for user, g- for group (followed by the id).  For the tracker
- 					'topic_time'					=> array('UINT:11', 0),
- 					'topic_sticky'					=> array('BOOL', 0),
- 					'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_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', ''),
- 					'topic_subject_clean'			=> array('STEXT_UNI', ''), // used for building the url
- 					'topic_first_post_id'			=> array('UINT', 0),
- 					'topic_first_post_user_id'		=> array('UINT', 0),
- 					'topic_first_post_username'		=> array('VCHAR_UNI', ''),
- 					'topic_first_post_user_colour'	=> array('VCHAR:6', ''),
- 					'topic_first_post_time'			=> array('UINT:11', 0),
- 					'topic_last_post_id'			=> array('UINT', 0),
- 					'topic_last_post_user_id'		=> array('UINT', 0),
- 					'topic_last_post_username'		=> array('VCHAR_UNI', ''),
- 					'topic_last_post_user_colour'	=> array('VCHAR:6', ''),
- 					'topic_last_post_time'			=> array('UINT:11', 0),
- 					'topic_last_post_subject'		=> array('STEXT_UNI', ''),
- 				),
- 				'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'),
- 					'topic_status'			=> array('INDEX', 'topic_status'),
- 					'topic_assigned'		=> array('INDEX', 'topic_assigned'),
- 					'topic_sticky'			=> array('INDEX', 'topic_sticky'),
- 					'topic_approved'		=> array('INDEX', 'topic_approved'),
- 					'topic_reported'		=> array('INDEX', 'topic_reported'),
- 					'topic_time'			=> array('INDEX', 'topic_time'),
- 					'topic_last_post_time'	=> array('INDEX', 'topic_last_post_time'),
- 				),
- 			)),
- 			array(TITANIA_TRACK_TABLE, array(
- 				'COLUMNS'		=> array(
- 					'track_type'			=> array('UINT', 0),
- 					'track_id'				=> array('UINT', 0),
- 					'track_user_id'			=> array('UINT', 0),
- 					'track_time'			=> array('UINT:11', 0),
- 				),
- 				'PRIMARY_KEY'	=> array('track_type', 'track_id', 'track_user_id'),
- 			)),
- 			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
- 			'u_titania_faq_create',			// Can create FAQ entries
- 			'u_titania_faq_edit',			// Can edit own FAQ entries
- 			'u_titania_faq_delete',			// Can delete own FAQ entries
- 			'u_titania_topic',				// Can create new topics
- 			'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
- 			'u_titania_post_attach',		// Can attach files to posts
- 		),
- 
- 		'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
- 				'u_titania_rate',				// Can rate items
- 				'u_titania_faq_create',			// Can create FAQ entries
- 				'u_titania_faq_edit',			// Can edit own FAQ entries
- 				'u_titania_faq_delete',			// Can delete own FAQ entries
- 				'u_titania_topic',				// Can create new topics
- 				'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
- 			)),
- 			array('ROLE_USER_FULL', array(
- 				'u_titania_contrib_submit',		// Can submit contrib items
- 				'u_titania_rate',				// Can rate items
- 				'u_titania_faq_create',			// Can create FAQ entries
- 				'u_titania_faq_edit',			// Can edit own FAQ entries
- 				'u_titania_faq_delete',			// Can delete own FAQ entries
- 				'u_titania_topic',				// Can create new topics
- 				'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);
--- 0 ----

Removed: branches/stable/titania/docs/ariel constants.php
==============================================================================
*** branches/stable/titania/docs/ariel constants.php (original)
--- branches/stable/titania/docs/ariel constants.php (removed)
***************
*** 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/');
- /**#@-*/
- 
- ?>
--- 0 ----

Removed: branches/stable/titania/docs/style_validation_checklist.txt
==============================================================================
*** branches/stable/titania/docs/style_validation_checklist.txt (original)
--- branches/stable/titania/docs/style_validation_checklist.txt (removed)
***************
*** 1,33 ****
- Style validation list
- 
-     For All Submissions:
- 
-         * Valid name, valid directory structure, no extraneous files?
-         * Original work? Not a copy of someone else's?
-         * Has a reasonable level of aesthetic quality? Not offensive or inappropriate?
-         * Does not require PHP code modifications, or files from external sites?
- 
- 
-     For Board Styles:
- 
-         * phpBB copyright intact?
-         * Compatible with the latest version of phpBB? (Some exceptions depending on specific release)
-         * Compatible with IE6 and Firefox?
-         * No hard-coded text in any files?
- 
-           Individual Areas:
-           Check each section one-at-a-time to make sure it (A) looks correct, (B) functions correct, and (C) has no obvious errors in layout, design, CSS, etc.
-               o Index (incl. Header, Footer)
-               o ACP
-               o MCP
-               o UCP (incl. PM's, Registering)
-               o FAQ
-               o Memberlist (incl. Email, Leaders, Member Search)
-               o Search (incl. Form, Results)
-               o Posting (incl. BBCode, Topic Review, Attachments)
-               o View Posts/Topics (incl. Reporting, Print View)
-               o View Forums (incl. Jumpbox)
-               o View Online Users
-               o View Profiles
-               o Login
-               o Error/Information
\ No newline at end of file
--- 0 ----

Removed: branches/stable/titania/docs/validation_checklist.txt
==============================================================================
*** branches/stable/titania/docs/validation_checklist.txt (original)
--- branches/stable/titania/docs/validation_checklist.txt (removed)
***************
*** 1,79 ****
- Validation Checklist for MODS with possible deny reasons..
- 
- {x} = deny worthy
- [o] = note worthy??
- 
- * Insta Deny
- 	o MOD Description is complete and informative
- 	o license.txt present
- 	o install file name = install.xml or other variations as long as it has the word install in it
- 	o modx style => modx.prosilver.en.xsl, the prosilver xsl for displaying the MOD in the browser of the user
- 	o placement of files => Both the install.xml and the license.txt should be in the root of your zip file
- 	o non english or non prosilver file edit in install.xml
- 	o wrong directory of new / optional files
- 	o Usage of register long arrays. ($HTTP_*_VARS)
- 	o RFI (Remote File inclusion) -- bad (not isset) or no usage of $phpbb_root_path/PHPBB_ROOT_PATH and $phpEx/PHP_EXT
- 	o No IN_PHPBB check in class files, function files, and language files.
- 
- * Packaging - items + any packaging errors or problems
- 	o Correct Package file name
- 	o Language Files within the language directory and correct lang_name translations
- 	o Alternate lang MODX files used correctly
- 	o Template and Theme files contained in correct directory
- 	o Alternate template MODX files used correctly
- 	o Scripts/installation placed in /contrib/ directory
- 
- * MODX - MODX files + any MODX errors or problems
- 	o If PHP5.x specific functions are used, the requirement is noted in MODX
- 	o Installation problems
- 	o Does not work as intended
- 	o Version checker missing
- 
- * Templates - Template files, theme files, images etc.
- 	o Hard-coded PHP used in template files
- 	o prosilver HTML not XHTML 1.0 strict (XTHML errors)
- 	o subSilver2 HTML not XHTML 1.0 Transitional (XHTML errors)
- 	o Broken/missing images
- 	o Does no use/supply English images by default
- 	o no HTML or CSS validation errors
- 
- * Language Files - Translations, etc.
- 	o Hard-coded Language in PHP files
- 	o No assigning language vars in the PHP Controller (phpBB2 method)
- 	o Hard-coded Language in Template files
- 
- * PHP/Coding - All the coding issues defined in the below list
- 	o Predefinied Variables like request_var() etc.
- 		# Usage of request_var instead of POST/GET/REQUEST for everything except submit. Even for array, default param should be checked to ensure proper var type handling.
- 		# Use login_forum_box() or login_box() for logins.
- 		# Use confirm_box() for the user to confirm sensitive actions (such as delets)
- 		# Use trigger_error() for error handling/messages and user messages
- 		# Usage of append_sid() for URLs
- 		# use: sizeof() instead of count(), else if instead of elseif, use true/false instead of TRUE/FALSE
- 		# int request_vars are request_var('var', 0); and not request_var('var', '0');
- 	o Int and float Variables are enforced (int) and (float) when inserting into SQL queries
- 	o No usage of banned functions: eval(), *exec() functions, system(), passthru(), pcntl_exec(), mysql*(), echo, or any print function.
- 	o $_SERVER variables properly sanitised (many are user input)
- 	o Sessions initiated on the PHP Controller
- 	o Hard-coded HTML used in PHP files
- 	o Descriptive but concise lowercase variable and function names with words separated by underscores.
- 	o One character loop indices
- 	o Spacing and braces on newlines, enforce brackets on conditionals and loops
- 	o Single quotes instead of double quotes
- 	o No magic numbers
- 	o No uninitialised variables or indices (test MODs with DEBUG/DEBUG_EXTRA enabled)
- 	o SQL issues
- 		# Strings are properly $db->sql_escape(); when inserting into SQL Queries.
- 		# phpBB3 DBAL is used instead of sql functions.
- 		# sql_build_query() is used on large SQL Queries (containing joins)
- 		# sql_build_array() is used on inserts and updates
- 		# sql_in_set() is used for SQL IN() statements
- 		# Avoid DB specific SQL unless case is used for each DB type
- 		# No usage of LIMIT in SQL, use sql_query_limit() function instead.
- 		# Cache static or heavy SQL Queries
- 		# No SQL Queries in loops
- 
- * Defaults (very minor issues):
- 	o Tabs instead of spaces
- 	o Always use LF line endings
- 	o Proper file headers and php DocBlocks
--- 0 ----

Removed: branches/stable/titania/includes/manage_tools/organize_lang.php
==============================================================================
*** branches/stable/titania/includes/manage_tools/organize_lang.php (original)
--- branches/stable/titania/includes/manage_tools/organize_lang.php (removed)
***************
*** 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
--- 0 ----




More information about the customisationdb-commits mailing list