}
            $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);
        } else {
            $conflict = false;
            $permalink = $permalink_test;
        }
        phpbb::$db->sql_freeresult($p_result);
    } while ($conflict == true);
    // This basically maps old entries to the contribution format
    $pack = array('contrib_type' => TITANIA_TYPE_TRANSLATION, 'contrib_user_id' => $row['user_id'], 'contrib_name' => $row['english_name'], 'contrib_name_clean' => $permalink, 'contrib_desc' => $row['intro_text'], 'contrib_status' => TITANIA_CONTRIB_NEW, 'contrib_visible' => true, 'contrib_views' => 0, 'contrib_rating' => 0, 'contrib_rating_count' => 0, 'contrib_last_update' => $row['last_update'], 'contrib_iso_code' => $row['package_name'], 'contrib_local_name' => $row['local_name']);
    $id = titania_insert(TITANIA_CONTRIBS_TABLE, $pack);
    $cat_ary = array('category_id' => TRANSLATION_CAT_ID, 'contrib_id' => $id);
    titania_insert(TITANIA_CONTRIB_IN_CATEGORIES_TABLE, $cat_ary);
    // and add the respective authors
    foreach ($authors as $author) {
        if ($author['lang_id'] == $row['lang_id']) {
            $sql_ary = array('contrib_id' => $id, 'user_id' => $author['user_id'], 'active' => true);
            titania_insert(TITANIA_CONTRIB_COAUTHORS_TABLE, $sql_ary);
        }
    }
    $i++;
}
$sync = new titania_sync();
$sync->authors('count');
$sync->contribs('validated');
$sync->categories('count');
phpbb::$cache->purge();
echo $i . ' language packs added to Titania';
/**
 * Wrapper for inserting data into a table for Titania
 *
 * @author EXReaction
 * @param string $table