Index: branches/beta/data/lib/glib.php
===================================================================
--- branches/beta/data/lib/glib.php	(revision 15373)
+++ branches/beta/data/lib/glib.php	(revision 16927)
@@ -15,11 +15,11 @@
  *----------------------------------------------------------------------*/
 function gfDownloadCsv($header, $contents){
-	
+
 	$fiest_name = date("YmdHis") .".csv";
-	
+
 	/* HTTP¥Ø¥Ã¥À¤Î½ÐÎÏ */
 	Header("Content-disposition: attachment; filename=${fiest_name}");
 	Header("Content-type: application/octet-stream; name=${fiest_name}");
-	
+
 	$return = $header.$contents;
 	if (mb_detect_encoding($return) == CHAR_CODE){						//Ê¸»ú¥³¡¼¥ÉÊÑ´¹
@@ -38,22 +38,22 @@
  * [Ãí¼á] -
  *----------------------------------------------------------------------*/
-function gfSetCsv( $array, $arrayIndex = "" ){	
+function gfSetCsv( $array, $arrayIndex = "" ){
 	//°ú¿ô$arrayIndex¤Ï¡¢$array¤¬Ï¢ÁÛÇÛÎó¤Î¤È¤­¤ËÅº¤¨»ú¤ò»ØÄê¤·¤Æ¤ä¤ë¤¿¤á¤Ë»ÈÍÑ¤¹¤ë
-	
+
 	$return = "";
 	for ($i=0; $i<count($array); $i++){
-		
+
 		for ($j=0; $j<count($array[$i]); $j++ ){
 			if ( $j > 0 ) $return .= ",";
-			$return .= "\"";			
+			$return .= "\"";
 			if ( $arrayIndex ){
-				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";			
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";
 			} else {
 				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
 			}
 		}
-		$return .= "\n";			
-	}
-	
+		$return .= "\n";
+	}
+
 	return $return;
 }
@@ -87,13 +87,8 @@
  *----------------------------------------------------------------------*/
 function gfDebugLog($obj, $path = DEBUG_LOG_PATH){
-		gfPrintLog("*** start Debug ***");
-		ob_start();
-		print_r($obj);
-		$buffer = ob_get_contents();
-		ob_end_clean();
-		$fp = fopen($path, "a+");
-		fwrite( $fp, $buffer."\n" );
-		fclose( $fp );
-		gfPrintLog("*** end Debug ***");
+        $debugStr = print_r($obj, true);
+        gfPrintLog("*** start Debug ***", $path);
+        gfPrintLog($debugStr, $path);
+        gfPrintLog("*** end Debug ***", $path);
 
 		// ¥í¥°¥Æ¡¼¥·¥ç¥ó
@@ -127,24 +122,24 @@
 		fclose( $fp );
 	}
-	
+
 	// ¥í¥°¥Æ¡¼¥·¥ç¥ó
 	gfLogRotation(MAX_LOG_QUANTITY, MAX_LOG_SIZE, $path);
 }
 
-/**			
- * ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥óµ¡Ç½			
- *			
+/**
+ * ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥óµ¡Ç½
+ *
  * @param integer $max_log ºÇÂç¥Õ¥¡¥¤¥ë¿ô
  * @param integer $max_size ºÇÂç¥µ¥¤¥º
  * @param string  $path ¥Õ¥¡¥¤¥ë¥Ñ¥¹
  * @return void ¤Ê¤·
- */			
+ */
 function gfLogRotation($max_log, $max_size, $path) {
-	
+
 	// ¥Ç¥£¥ì¥¯¥È¥êÌ¾¤ò¼èÆÀ
 	$dirname = dirname($path);
 	// ¥Õ¥¡¥¤¥ëÌ¾¤ò¼èÆÀ
 	$basename = basename($path);
-	
+
 	// ¥Õ¥¡¥¤¥ë¤¬ºÇÂç¥µ¥¤¥º¤òÄ¶¤¨¤Æ¤¤¤Ê¤¤¤«¥Á¥§¥Ã¥¯
 	if(filesize($path) > $max_size) {
@@ -156,5 +151,5 @@
 				}
 			}
-			
+
 			// ¥Õ¥¡¥¤¥ë¥í¥°¤¬ºÇÂç¸Ä¿ô¤Ê¤é°Ê¾å¤Ê¤é¸Å¤¤¥Õ¥¡¥¤¥ë¤«¤éºï½ü¤¹¤ë
 			$count = count($arrLog);
@@ -163,7 +158,7 @@
 				for($i = 0; $diff >= $i ; $i++) {
 					unlink($dirname. "/" .array_pop($arrLog));
-				}	
-			}
-			
+				}
+			}
+
 			// ¥í¥°¥Õ¥¡¥¤¥ë¤ÎÅº¤¨»ú¤ò¤º¤é¤¹
 			$count = count($arrLog);
@@ -173,8 +168,8 @@
 			}
 			$ret = copy($path, "$path.1");
-			
+
 			// ¿·µ¬¥í¥°¥Õ¥¡¥¤¥ë¤òºîÀ®
 			if($ret) {
-				unlink($path);			
+				unlink($path);
 				touch($path);
 				chmod($path, 0666);
@@ -193,12 +188,12 @@
  *----------------------------------------------------------------------*/
 function gfMakePassword($pwLength) {
-	
+
 	// Íð¿ôÉ½¤Î¥·¡¼¥É¤ò·èÄê
 	srand((double)microtime() * 54234853);
-	
+
 	// ¥Ñ¥¹¥ï¡¼¥ÉÊ¸»úÎó¤ÎÇÛÎó¤òºîÀ®
 	$character = "abcdefghkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ2345679";
 	$pw = preg_split("//", $character, 0, PREG_SPLIT_NO_EMPTY);
-	
+
 	$password = "";
 	for($i = 0; $i<$pwLength; $i++ ) {
@@ -207,5 +202,5 @@
 
 	return $password;
-} 
+}
 
 /*----------------------------------------------------------------------
