<?
if (function_exists ( "validcan" ))
	validcan ( false, "can_admin" );
else
	die ();
require_once ($rootpath . "admin/core.php");

function BuildMenu($url, $title, $image = '') {
	global $admin_file, $counter;
	$image_link = "admin/pic/$image";
	echo "<td align=\"center\" valign=\"top\" width=\"15%\" style=\"border: none;\"><a href=\"$url\" title=\"$title\">" . ($image != '' ? "<img src=\"$image_link\" border=\"0\" alt=\"$title\" title=\"$title\">" : "") . "<br><b>$title</b></a></td>";
	if ($counter == 5) {
		echo "</tr><tr>";
		$counter = 0;
	} else {
		$counter ++;
	}
}

switch ($op) {
	case "Main" :
		begin_frame ( "Панель администратора", "100", true );
		echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">";
		$dir = opendir ( "admin/links" );
		while ( $file = readdir ( $dir ) ) {
			if (preg_match ( "/(\.php)$/is", $file ) && $file != "." && $file != "..")
				require_once ("admin/links/" . $file . "");
		}
		echo "</table>";
		end_frame ();
		break;
	
	default :
		print ( "<b><center><a href='admincp.php'>В админпанель</a></center></b><br>" );
		$dir = opendir ( "admin/modules" );
		while ( $file = readdir ( $dir ) ) {
			if (preg_match ( "/(\.php)$/is", $file ) && $file != "." && $file != "..")
				require_once ("admin/modules/" . $file . "");
		}
		end_frame ();
		break;
}
?>