Index: temp/trunk/html/test/uehara/test.php
===================================================================
--- temp/trunk/html/test/uehara/test.php	(revision 8767)
+++ temp/trunk/html/test/uehara/test.php	(revision 8768)
@@ -1,10 +1,5 @@
 <?php
 
-$default_dir = "/home/web/test.ec-cube.net/html/user_data/";
-$arrCnt = split('/', $default_dir);
-$default_rank = count($arrCnt);
 
-$arrTree = array();
-$cnt = 0;
 
 sfGetFileTree($default_dir);
@@ -17,39 +12,45 @@
  */
 function sfGetFileTree($dir) {
-	global $arrTree;
-	global $cnt;
-	global $default_rank;
+	$default_dir = "/home/web/test.ec-cube.net/html/user_data/";
+	$arrCnt = split('/', $default_dir);
+	$default_rank = count($arrCnt);
+	
+	$arrTree = array();
+	$cnt = 0;
 
-	if(file_exists($dir)) {
-		if ($handle = opendir("$dir")) {
-			while (false !== ($item = readdir($handle))) {
-				if ($item != "." && $item != "..") {
-					// Ê¸Ëö¤Î/¤ò¼è¤ê½ü¤¯
-					$dir = ereg_replace("/$", "", $dir);
-					$path = $dir."/".$item;
-					// ¥Ç¥£¥ì¥¯¥È¥ê¤Î¤ß¼èÆÀ
-					if (is_dir($path)) {
-						$path;
-						if(sfDirChildExists($path)) {
-							$file_type = "_parent";
-						} else {
-							$file_type = "_child";	
+	function sfGetFileTreeSub($dir) {
+	
+		if(file_exists($dir)) {
+			if ($handle = opendir("$dir")) {
+				while (false !== ($item = readdir($handle))) {
+					if ($item != "." && $item != "..") {
+						// Ê¸Ëö¤Î/¤ò¼è¤ê½ü¤¯
+						$dir = ereg_replace("/$", "", $dir);
+						$path = $dir."/".$item;
+						// ¥Ç¥£¥ì¥¯¥È¥ê¤Î¤ß¼èÆÀ
+						if (is_dir($path)) {
+							$path;
+							if(sfDirChildExists($path)) {
+								$file_type = "_parent";
+							} else {
+								$file_type = "_child";	
+							}
+							
+							// ³¬ÁØ¤ò³ä¤ê½Ð¤¹
+							$arrCnt = split('/', $path);
+							$rank = count($arrCnt);
+							$rank = $rank - $default_rank;
+							
+							// javascript¤Î¥Ä¥ê¡¼À¸À®ÍÑ¤ÎÇÛÎó¤òºîÀ®
+							$arrTree[$cnt] = array($cnt, $file_type, $path, $rank);
+							$cnt++;
+							// ²¼ÁØ¥Ç¥£¥ì¥¯¥È¥ê¼èÆÀ¤Î°Ù¡¢ºÆµ¢Åª¤Ë¸Æ¤Ó½Ð¤¹
+							sfGetFileTreeSub($path);
 						}
-						
-						// ³¬ÁØ¤ò³ä¤ê½Ð¤¹
-						$arrCnt = split('/', $path);
-						$rank = count($arrCnt);
-						$rank = $rank - $default_rank;
-						
-						// javascript¤Î¥Ä¥ê¡¼À¸À®ÍÑ¤ÎÇÛÎó¤òºîÀ®
-						$arrTree[$cnt] = array($cnt, $file_type, $path, $rank);
-						$cnt++;
-						// ²¼ÁØ¥Ç¥£¥ì¥¯¥È¥ê¼èÆÀ¤Î°Ù¡¢ºÆµ¢Åª¤Ë¸Æ¤Ó½Ð¤¹
-						sfGetFileTree($path);
 					}
 				}
 			}
+			closedir($handle);
 		}
-		closedir($handle);
 	}
 }
