eXtplorer-2.0.1-ja.2.patch [ダウンロード]

diff -Nur eXtplorer-2.0.1/admin.extplorer.php eXtplorer-2.0.1-ja.2/admin.extplorer.php
--- eXtplorer-2.0.1/admin.extplorer.php	2009-01-16 06:30:14.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/admin.extplorer.php	2009-07-07 14:52:48.000000000 +0900
@@ -82,7 +82,7 @@
 
 if( $action == 'include_javascript' ) {
   	while (@ob_end_clean());
-  	header("Content-type: application/x-javascript; charset=iso-8859-1");
+  	header("Content-type: application/x-javascript; charset=utf-8");
   	include( _EXT_PATH.'/scripts/'.basename(extGetParam($_REQUEST, 'file' )).'.php');
   	ext_exit();
 }
diff -Nur eXtplorer-2.0.1/include/admin.php eXtplorer-2.0.1-ja.2/include/admin.php
--- eXtplorer-2.0.1/include/admin.php	2008-01-30 08:39:54.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/include/admin.php	2009-07-07 14:52:48.000000000 +0900
@@ -244,7 +244,7 @@
 	}
 	activate_user($data[0],NULL);
 	
-	ext_Result::sendResult('changepwd', false, ext_Lang::msg('change_password_success'));
+	ext_Result::sendResult('changepwd', true, ext_Lang::msg('change_password_success'));
 }
 //------------------------------------------------------------------------------
 function adduser($dir) {			// Add User
@@ -314,7 +314,7 @@
 		if($self) {
 			activate_user($nuser,NULL);
 		}
-		ext_Result::sendResult('edituser', true, $user.": ".$GLOBALS["error_msg"]["saveuser"]);
+		ext_Result::sendResult('edituser', true, $user.": ".$GLOBALS["messages"]["saveuser"]);
 	}
 	
 	// Javascript functions:
diff -Nur eXtplorer-2.0.1/include/archive.php eXtplorer-2.0.1-ja.2/include/archive.php
--- eXtplorer-2.0.1/include/archive.php	2008-05-31 15:55:46.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/include/archive.php	2009-07-07 14:52:48.000000000 +0900
@@ -50,7 +50,7 @@
 
 		// If we have something to archive, let's do it now
 		if(extGetParam($_POST, 'confirm' ) == 'true' ) {
-			$saveToDir = utf8_decode($GLOBALS['__POST']['saveToDir']);
+			$saveToDir = utf8_decode2($GLOBALS['__POST']['saveToDir']);
 			if( !file_exists( get_abs_dir($saveToDir ) )) {
 				ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_notexists'));
 			}
@@ -68,7 +68,7 @@
 
 			$cnt=count($GLOBALS['__POST']["selitems"]);
 			$abs_dir= get_abs_dir($dir);
-			$name=basename(stripslashes($GLOBALS['__POST']["name"]));
+			$name=basename2($GLOBALS['__POST']["name"]);
 			if($name=="") {
 				ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnoname"]);
 			}
@@ -98,15 +98,15 @@
 					if( $selitem == 'ext_root') { 
 						$selitem = '';
 					}
-					if( is_dir( utf8_decode($abs_dir ."/". $selitem ))) {					
-						$items = extReadDirectory(utf8_decode($abs_dir ."/".  $selitem), '.', true, true );
+					if( is_dir( utf8_decode2($abs_dir ."/". $selitem ))) {					
+						$items = extReadDirectory(utf8_decode2($abs_dir ."/".  $selitem), '.', true, true );
 						foreach ( $items as $item ) {
 							if( is_dir( $item ) || !is_readable( $item ) || $item == $archive_name ) continue;
 							$v_list[] = str_replace('\\', '/', $item );
 						}
 					}
 					else {					
-						$v_list[] = utf8_decode(str_replace('\\', '/', $abs_dir ."/". $selitem ));
+						$v_list[] = utf8_decode2(str_replace('\\', '/', $abs_dir ."/". $selitem ));
 					}
 				}
 				if( count($v_list) > $files_per_step ) {
diff -Nur eXtplorer-2.0.1/include/bookmarks.php eXtplorer-2.0.1-ja.2/include/bookmarks.php
--- eXtplorer-2.0.1/include/bookmarks.php	2008-02-03 19:16:40.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/include/bookmarks.php	2009-07-07 14:52:48.000000000 +0900
@@ -62,6 +62,11 @@
 		}
 	}
 }
+
+function strip_invalid_key_char($s, $replacement ="") {
+  return preg_replace('/[{}|&~![()"]/u', $replacement, $s);
+}
+
 /**
  * Adds a new bookmark to the bookmark ini file
  *
@@ -91,7 +96,8 @@
 			if( in_array( $dir, $bookmarks )) {
 				echo ext_alertBox( $GLOBALS['messages']['already_bookmarked'] ); exit;
 			}
-			$alias = preg_replace('~[^\w-.\/\\\]~','', $alias ); // Make the alias ini-safe by removing all non-word characters
+			// $alias = preg_replace('~[^\w-.\/\\\]~','', $alias ); // Make the alias ini-safe by removing all non-word characters
+			$alias = strip_invalid_key_char($alias, "_");
 			$bookmarks[$alias] = $dir; //we deal with the flippped array here
 			$msg = ext_alertBox( $GLOBALS['messages']['bookmark_was_added'] );
 			break;
diff -Nur eXtplorer-2.0.1/include/chmod.php eXtplorer-2.0.1-ja.2/include/chmod.php
--- eXtplorer-2.0.1/include/chmod.php	2008-07-29 19:20:00.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/include/chmod.php	2009-07-07 14:52:48.000000000 +0900
@@ -126,7 +126,7 @@
 			$abs_item = get_item_info( $dir, $GLOBALS['__POST']["selitems"][0]);
 		} else {
 			$abs_item = get_abs_item( $dir, $GLOBALS['__POST']["selitems"][0]);
-			$abs_item = utf8_decode($abs_item);
+			$abs_item = utf8_decode2($abs_item);
 		}
 		
 		$mode = parse_file_perms(get_file_perms( $abs_item ));
diff -Nur eXtplorer-2.0.1/include/copy_move.php eXtplorer-2.0.1-ja.2/include/copy_move.php
--- eXtplorer-2.0.1/include/copy_move.php	2008-07-31 17:23:46.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/include/copy_move.php	2009-07-07 14:52:48.000000000 +0900
@@ -65,8 +65,8 @@
 	// copy / move files
 	$err=false;
 	for($i=0;$i<$cnt;++$i) {
-		$tmp = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
-		$new = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
+		$tmp = basename2($GLOBALS['__POST']["selitems"][$i]);
+		$new = basename2($GLOBALS['__POST']["selitems"][$i]);
 		
 		if( ext_isFTPMode() ) {
 			$abs_item = get_item_info($dir,$tmp);
diff -Nur eXtplorer-2.0.1/include/delete.php eXtplorer-2.0.1-ja.2/include/delete.php
--- eXtplorer-2.0.1/include/delete.php	2008-07-29 19:20:00.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/include/delete.php	2009-07-07 14:52:48.000000000 +0900
@@ -50,7 +50,7 @@
 		
 		// delete files & check for errors
 		for($i=0;$i<$cnt;++$i) {
-			$items[$i] = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
+			$items[$i] = basename2($GLOBALS['__POST']["selitems"][$i]);
 			if( ext_isFTPMode() ) {
 				$abs = get_item_info( $dir,$items[$i]);
 			} else {
diff -Nur eXtplorer-2.0.1/include/download.php eXtplorer-2.0.1-ja.2/include/download.php
--- eXtplorer-2.0.1/include/download.php	2008-02-03 19:16:40.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/include/download.php	2009-07-07 14:52:48.000000000 +0900
@@ -82,10 +82,10 @@
 			header('Pragma: no-cache');
 		}
 		@set_time_limit( 0 );
-		@readFileChunked(utf8_decode($abs_item));
+		@readFileChunked(utf8_decode2($abs_item));
 		
 		if( $unlink==true ) {
-		  	unlink( utf8_decode($abs_item) );
+		  	unlink( utf8_decode2($abs_item) );
 		}
 	    ob_end_flush();
 		ext_exit();
diff -Nur eXtplorer-2.0.1/include/edit.php eXtplorer-2.0.1-ja.2/include/edit.php
--- eXtplorer-2.0.1/include/edit.php	2008-05-31 15:55:46.000000000 +0900
+++ eXtplorer-2.0.1-ja.2/include/edit.php	2009-07-07 14:52:48.000000000 +0900
@@ -38,6 +38,24 @@
  *
  */
 class ext_Edit extends ext_Action {
+	var	$lang_tbl = Array(
+		'czech' => 'cs',
+		'german' => 'de',
+		'danish' => 'dk',
+		'english' => 'en',
+		'esperanto' => 'eo',
+		'spanish' => 'es',
+		'french' => 'fr',
+		'croatian' => 'hr',
+		'italian' => 'it',
+		'japanese' => 'ja',
+		'macedonian' => 'mk',
+		'dutch' => 'nl',
+		'polish' => 'pl',
+		'portuguese' => 'pt',
+		'russian' => 'ru',
+		'slovenian' => 'sk'
+	);
 	
 	function execAction($dir, $item) {		// edit file
 		global $mainframe, $mosConfig_live_site;
@@ -47,7 +65,7 @@
 		}
 		$fname = get_abs_item($dir, $item);
 		
-		if(!get_is_file(utf8_decode($fname)))  {
+		if(!get_is_file(utf8_decode2($fname)))  {
 			ext_Result::sendResult('edit', false, $item.": ".ext_Lang::err('fileexist' ));
 		}
 		if(!get_show_item($dir, $item)) {
@@ -56,7 +74,7 @@
 		
 		if(isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"]=="yes") {
 			// Save / Save As
-			$item=basename(stripslashes($GLOBALS['__POST']["fname"]));
+			$item=basename2($GLOBALS['__POST']["fname"]);
 			$fname2=get_abs_item($dir, $item);
 			
 			if(!isset($item) || $item=="") {
@@ -72,6 +90,28 @@
 			ext_Result::sendResult('edit', true, ext_Lang::msg('savefile').': '.$item );
 			
 		}
+		if(isset($GLOBALS['__POST']["doreopen"]) && $GLOBALS['__POST']["doreopen"]=="yes") {
+			// File Reopen
+			$extra = Array();
+			$content = $GLOBALS['ext_File']->file_get_contents( $fname );
+			if( get_magic_quotes_gpc() ) {
+				$content = stripslashes( $content );
+			}
+
+			$langs = $GLOBALS["language"];
+			if ($langs == "japanese"){
+				$_encoding = $GLOBALS['__POST']["file_encoding"];
+				if ($content){
+					$content = mb_convert_encoding($content, "UTF-8", $_encoding);
+				}
+				$extra["file_encoding"] = $_encoding;
+			}
+
+			$extra["content"] = $content;
+
+			ext_Result::sendResult('edit', true, ext_Lang::msg('reopenfile').': '.$item, $extra);
+
+		}
 		
 		// header
 		$s_item=get_rel_item($dir,$item);	if(strlen($s_item)>50) $s_item="...".substr($s_item,-47);
@@ -129,6 +169,29 @@
 	if( get_magic_quotes_runtime()) {
 		$content = stripslashes( $content );
 	}
+
+	$cw = 250;
+	$langs = $GLOBALS["language"];
+	if ($langs == "japanese"){
+		$cw = 200;
+		if ($content){
+			$_encoding = strtoupper(mb_detect_encoding($content, Array("ASCII", "ISO-2022-JP", "UTF-8", "EUCJP-WIN", "SJIS-WIN"), true));
+			$content = mb_convert_encoding($content, "UTF-8", $_encoding);
+			if ($_encoding == "SJIS-WIN"){
+				$_encoding_label = "SJIS";
+			} elseif ($_encoding == "EUCJP-WIN"){
+				$_encoding_label = "EUC-JP";
+			} elseif ($_encoding == "ISO-2022-JP"){
+				$_encoding_label = "JIS";
+			} elseif ($_encoding == "ASCII"){
+				$_encoding_label = "UTF-8";
+			} else {
+				$_encoding_label = $_encoding;
+			}
+		} else {
+			$_encoding_label = "UTF-8";
+		}
+	}
 	//$content = htmlspecialchars( $content );
 		
 	?>