<?php


if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}


$plugins->add_hook("usercp_menu_misc", "test_usercp_menu_built");

function test_info()
{	
	return array(
		"name"				=> "Test",
		"description"		=> "",
		"website"			=> "",
		"author"			=> "Krzysztof \"Supryk\" Supryczyński",
		"authorsite"		=> "",
		"version"			=> "1.2",
		"compatibility"		=> "1808,1809,1810",
		"codename"			=> "test",
	);
}

function test_is_installed()
{
	global $db;

	return $db->num_rows($db->simple_select("templates", "*", "title = \"test_usercp_menu\""));
}

function test_install()
{
	global $db;
	
	$templates = array();
	
	$templates[] = array(
	//	"tid" 					=> "",
		"title" 				=> "test_usercp_menu",
		"template" 		=> $db->escape_string('<tr><td class="trow1 smalltext"><a href="#" class="usercp_nav_item" style="background-position: 0 -340px;">test</a></td></tr>'),
		"sid" 				=> "-1",
	);
	
	$db->insert_query_multiple("templates", $templates);
}


function test_uninstall()
{
    global $db;

	$db->delete_query("templates", "title = \"test_usercp_menu\"");	
}

function test_usercp_menu_built()
{
	global $mybb, $templates, $usercpnav, $test;
	
	echo '<tr><td class="trow1 smalltext"><a href="#" class="usercp_nav_item" style="background-position: 0 -340px;">Test</a></td></tr>';
	eval("\$test = \"".$templates->get("test_usercp_menu")."\";");
}