<?php
if(!defined('IN_MYBB')) die();

function mnxt_links_directory_info(){
	return array(
		'name'			=> 'XThreads Links Directory',
		'description'	=> 'XThreads Links Directory',
		'website'		=> 'http://mybbhacks.zingaburga.com',
		'author'		=> 'My Nie',
		'authorsite'	=> 'http://mybbhacks.zingaburga.com',
		'version'		=> '1.0',
		'compatibility' => '1*',
		'guid'        	=> ''
	);
}

$plugins->add_hook('newthread_do_newthread_end','mnxt_links_directory');
function mnxt_links_directory(){
	$xtld_cat_key = 'xtld_cat';
	$xtld_fids = array(4,5);
	if(!in_array($GLOBALS['fid'],$xtld_fids)) return;
	if($GLOBALS['new_thread']['savedraft'] == 1) return;
	$dfid = $GLOBALS['db']->fetch_field($GLOBALS['db']->simple_select('threadfields_data',$xtld_cat_key,'tid='.$GLOBALS['tid']),$xtld_cat_key);
	if(!$dfid) return;
	if(!in_array($dfid,$xtld_fids)) return;
	if($dfid == $GLOBALS['fid']) return;
	require_once MYBB_ROOT.'inc/class_moderation.php';
	$mod = new Moderation;
	$mod->move_thread($GLOBALS['tid'],$dfid,'move');
	redirect(get_forum_link($dfid));
}
?>