<?php

	function get_mods(){
 		$main = opendir ('modules');
 		while ($one = readdir ($main))
 		{
 			if($one != '.' && $one != '..')
	 		{	
			 	if($mod=opendir ("modules/".$one."/sub")) {
			 		while ($two = readdir ($mod))
			 		{
			 			if($two != '.' && $two != '..')
			 			{	
						if(file_exists("./modules/".$one."/sub/".$two."/js/Api.js"))
						echo "<script type=\"text/javascript\" src=\"./modules/".$one."/sub/".$two."/js/Api.js\"></script> \n";
						if(file_exists("./modules/".$one."/sub/".$two."/css/styles.css"))
						echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"./modules/".$one."/sub/".$two."/css/styles.css\" /> \n";	
			 			}
			 		}
					closedir ($mod);
				} 
				if(file_exists("./modules/".$one."/js/Api.js"))
				echo "<script type=\"text/javascript\" src=\"./modules/".$one."/js/Api.js\"></script> \n";
				if(file_exists("./modules/".$one."/css/styles.css"))
				echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"./modules/".$one."/css/styles.css\" /> \n";	 		
			}
 		}
		closedir ($main);
	}	
	get_mods();
?>