include DISCUZ_ROOT."./forumdata/cache/plugin_natz_shoutbox.php";
$shoutbox = $_DPLUGIN["natz_shoutbox"];
if($shoutbox["available"]) 
{
	define("SHOUTBOX_URL", "./plugins/".$shoutbox["directory"]);
	include DISCUZ_ROOT."./forumdata/cache/cache_shoutbox_settings.php";
	include DISCUZ_ROOT."./forumdata/cache/cache_shoutbox_usergroups.php";
	include language("template", 1, SHOUTBOX_URL."lang");
	$shoutbox = $_DPLUGIN["natz_shoutbox"]["settings"];
	$sgid = is_array($_DPLUGIN["natz_shoutbox"]["usergroups"][$groupid]) ? $groupid : 0;
	$shoutbox["usergroup"] = $_DPLUGIN["natz_shoutbox"]["usergroups"][$sgid];
	if($discuz_uid > 0) 
	{
		$member = $db->fetch_first("SELECT m.*, u.color AS groupcolor
			FROM {$tablepre}members m
			LEFT JOIN {$tablepre}usergroups u ON u.groupid=m.groupid
			WHERE m.uid='$discuz_uid'");
	} 
	else 
	{
		$member = $db->fetch_first("SELECT color AS groupcolor FROM {$tablepre}usergroups WHERE groupid='$groupid'");
	}

	if (!$shoutbox["usergroup"]["enable"])
	{
		$shoutbox["enable"] = 0;
	} 
	else if ($shoutbox["usergroup"]["posts_req"]) 
	{
		$shoutbox["usergroup"]["posts_req"] = intval($shoutbox["usergroup"]["posts_req"]);
		if ($shoutbox["usergroup"]["posts_req"] > 0 && $member["posts"] < $shoutbox["usergroup"]["posts_req"])
		{
			$shoutbox["enable"] = 0;
		}
	}

	$shoutbox_ajax_js = array
	(
		'my_uid' => $discuz_uid,
		'my_name' => ($discuz_uid) ? $discuz_user : $shout_lang['shout_guest'],
		'my_gcolor' => ($member['groupcolor']) ? $member['groupcolor'] : '',
		'flood_limit' => $shoutbox['flood_limit'],
		'max_length' => $shoutbox['max_length'],
		'shout_order' => $shoutbox['shouts_order'],
		'shouts_limit' => $shoutbox['shouts_limit'],
		'shouts_refresh' => $shoutbox['shouts_refresh'],
		'members_refresh' => $shoutbox['members_refresh'],
		'bypass_flood' => $shoutbox['usergroup']['bypass_flood'],
		'enable_fade' => $shoutbox['enable_fade'],
		'format_names' => $shoutbox['format_names'],
		'announcement' => $shoutbox['announcement'],
	);
}