diff --git a/xoops_trust_path/modules/xupdate/class/Ftp.class.php b/xoops_trust_path/modules/xupdate/class/Ftp.class.php
index 314c346..ea31bd0 100644
--- a/xoops_trust_path/modules/xupdate/class/Ftp.class.php
+++ b/xoops_trust_path/modules/xupdate/class/Ftp.class.php
@@ -118,7 +118,7 @@ public function app_login($server = null){
public function uploadNakami($sourcePath, $targetPath)
{
- $this->mes .= " start FTP put (normal mode) ".htmlspecialchars($targetPath ,ENT_QUOTES ,_CHARSET)." ..
\n";
+ $this->mes .= " start FTP put (normal mode) form `".htmlspecialchars(substr($sourcePath, strlen($this->exploredDirPath) + 1) ,ENT_QUOTES ,_CHARSET)."` to `".htmlspecialchars($targetPath ,ENT_QUOTES ,_CHARSET)."` ..
\n";
$result = $this->_ftpPutNakami($sourcePath, $targetPath);
return $result;
}
diff --git a/xoops_trust_path/modules/xupdate/class/ftp/Abstract.class.php b/xoops_trust_path/modules/xupdate/class/ftp/Abstract.class.php
index 6335940..10e85a5 100644
--- a/xoops_trust_path/modules/xupdate/class/ftp/Abstract.class.php
+++ b/xoops_trust_path/modules/xupdate/class/ftp/Abstract.class.php
@@ -21,6 +21,7 @@ class Xupdate_Ftp_Abstract {
protected $Verbose;
protected $OS_local;
protected $OS_remote;
+ public $exploredDirPath;
/* Private variables */
protected $_lastaction;
diff --git a/xoops_trust_path/modules/xupdate/include/FtpModuleInstall.class.php b/xoops_trust_path/modules/xupdate/include/FtpModuleInstall.class.php
index 7dc3adb..89c689d 100644
--- a/xoops_trust_path/modules/xupdate/include/FtpModuleInstall.class.php
+++ b/xoops_trust_path/modules/xupdate/include/FtpModuleInstall.class.php
@@ -282,14 +282,20 @@ private function uploadFiles()
return false;
}
}
-
+
+ // check extra languages
+ if (! $this->html_only) {
+ $this->_copy_extra_langs($this->dirname, $this->trust_dirname, 'trust');
+ }
+ $this->_copy_extra_langs($this->dirname, $this->trust_dirname, 'html');
+
if ($this->trust_dirname === 'protector') {
- // for protector 'manip_value' update
- if (! XC_CLASS_EXISTS('Protector')) {
- // check and enable protector in mainfile.php
- if (file_exists(XOOPS_TRUST_PATH . '/modules/protector/include/precheck.inc.php')) {
- $this->Func->write_mainfile_protector(true);
- }
+ // for protector 'manip_value' update
+ if (! XC_CLASS_EXISTS('Protector')) {
+ // check and enable protector in mainfile.php
+ if (file_exists(XOOPS_TRUST_PATH . '/modules/protector/include/precheck.inc.php')) {
+ $this->Func->write_mainfile_protector(true);
+ }
}
}
@@ -323,30 +329,11 @@ private function uploadFiles()
return false;
}
- // for legacy core extra languages
+ // check extra languages
+ $this->_copy_extra_langs($this->dirname);
+
+ // for legacy only
if ($this->dirname === 'legacy') {
- // copy extras languages
- $langs = array();
- if ($handle = opendir(XOOPS_ROOT_PATH . '/language')) {
- while (false !== ($name = readdir($handle))) {
- if ($name[0] !== '.' && is_dir(XOOPS_ROOT_PATH . '/language/' . $name)) {
- $langs[] = $name;
- }
- }
- closedir($handle);
- }
- //adump($langs);
- foreach ($langs as $lang) {
- $uploadPath = XOOPS_ROOT_PATH . '/' ;
- $unzipPath = $this->exploredDirPath . '/extras/extra_languages/' . $lang;
- if (file_exists($unzipPath)) {
- $result = $this->Ftp->uploadNakami($unzipPath, $uploadPath);
- if (! $this->_check_file_upload_result($result, 'html')){
- return false;
- }
- }
- }
-
// for protector 'manip_value' update
if (XC_CLASS_EXISTS('Protector')) {
$db =& Database::getInstance();
@@ -366,6 +353,68 @@ private function uploadFiles()
return true;
}
+ /**
+ * _copy_extra_langs: copy extras languages
+ *
+ * @param string $dirname
+ * @param string $trust_dirname
+ * @param string $side
+ */
+ private function _copy_extra_langs($dirname, $trust_dirname = '', $side = 'html')
+ {
+ static $langs = null;
+
+ if (is_null($langs)) {
+ $langs = array();
+ if ($handle = opendir(XOOPS_ROOT_PATH . '/language')) {
+ while (false !== ($name = readdir($handle))) {
+ if ($name[0] !== '.' && is_dir(XOOPS_ROOT_PATH . '/language/' . $name)) {
+ $langs[] = $name;
+ }
+ }
+ closedir($handle);
+ }
+ }
+
+ $uploadDir = $checkDir = array();
+ $isLegacy = ($dirname === 'legacy');
+ if ($isLegacy) {
+ $checkDir[] = $this->exploredDirPath . '/extras/extra_languages//html';
+ $uploadDir[] = XOOPS_ROOT_PATH . '/';
+
+ $checkDir[] = $this->exploredDirPath . '/extras/extra_languages/';
+ $uploadDir[] = XOOPS_ROOT_PATH . '/';
+ } else {
+ if ($side === 'trust') {
+ $side = 'xoops_trust_path';
+ $base = XOOPS_TRUST_PATH ;
+ $arc_dirname = $trust_dirname;
+ } else {
+ $side = 'html';
+ $base = XOOPS_ROOT_PATH ;
+ $arc_dirname = $trust_dirname? $trust_dirname : $dirname;
+ }
+ $checkDir[] = $this->exploredDirPath . '/extras/'.$side.'/modules/'.$arc_dirname.'/language/';
+ $uploadDir[] = $base . '/modules/'.$dirname.'/language//';
+ }
+ foreach ($langs as $lang) {
+ $unzipPath = '';
+ foreach($checkDir as $i => $dir) {
+ $dir = str_replace('', $lang, $dir);
+ if (is_dir($dir) && (! $isLegacy || is_dir($dir . '/language'))) {
+ $unzipPath = $dir;
+ $uploadPath = str_replace('', $lang, $uploadDir[$i]);
+ break;
+ }
+ }
+ if ($unzipPath) {
+ $result = $this->Ftp->uploadNakami($unzipPath, $uploadPath);
+ $this->_check_file_upload_result($result, $side);
+ }
+ }
+ }
+
+
/**
* _get_nextlink
*
@@ -428,6 +477,7 @@ private function _exploredDirPath_DownDir($member = '', $checkfile = '')
}
}
if (isset($checker['html']) || isset($checker['xoops_trust_path'])) {
+ $this->Ftp->exploredDirPath = $this->exploredDirPath;
$this->Ftp->appendMes('found files exploredDirPath: '.$this->exploredDirPath.'
');
return true;
}