diff --git a/modules/issuetracker/classes/svn.class.php b/modules/issuetracker/classes/svn.class.php index 97a35c977..ec370b10e 100644 --- a/modules/issuetracker/classes/svn.class.php +++ b/modules/issuetracker/classes/svn.class.php @@ -14,8 +14,10 @@ var $tmp_dir = '/tmp'; var $oXml = null; + var $userid = null; + var $passwd = null; - function Svn($url, $svn_cmd='/usr/bin/svn', $diff_cmd='/usr/bin/diff') { + function Svn($url, $svn_cmd='/usr/bin/svn', $diff_cmd='/usr/bin/diff', $userid=null, $passwd=null) { if(substr($url,-1)!='/') $url .= '/'; $this->url = $url; @@ -26,14 +28,29 @@ $this->tmp_dir = _XE_PATH_.'files/cache/tmp'; if(!is_dir($this->tmp_dir)) FileHandler::makeDir($this->tmp_dir); + $this->userid = $userid; + $this->passwd = $passwd; + $this->oXml = new XmlParser(); } + function _getAuthInfo() + { + if($this->userid && $this->passwd) + { + return sprintf("--username %s --password %s", $this->userid, $this->passwd); + } + else + { + return ''; + } + } + function getStatus($path = '/') { if(substr($path,0,1)=='/') $path = substr($path,1); if(strpos($path,'..')!==false) return; - $command = sprintf("%s --non-interactive --config-dir %s log --xml --limit 1 %s%s", $this->svn_cmd, $this->tmp_dir, $this->url, $path); + $command = sprintf("%s --non-interactive --config-dir %s log --xml --limit 1 %s %s%s", $this->svn_cmd, $this->tmp_dir, $this->_getAuthInfo(), $this->url, $path); $buff = $this->execCmd($command, $error); $xmlDoc = $this->oXml->parse($buff); @@ -53,8 +70,9 @@ if(strpos($path,'..')!==false) return; $command = sprintf( - '%s --non-interactive --config-dir %s list %s%s%s', + '%s --non-interactive %s --config-dir %s list %s%s%s', $this->svn_cmd, + $this->_getAuthInfo(), $this->tmp_dir, $this->url, $path, @@ -95,8 +113,9 @@ if(strpos($path,'..')!==false) return; $command = sprintf( - '%s --non-interactive --config-dir %s cat %s%s%s', + '%s --non-interactive %s --config-dir %s cat %s%s%s', $this->svn_cmd, + $this->_getAuthInfo(), $this->tmp_dir, $this->url, $path, @@ -179,15 +198,16 @@ function getComp($path, $brev, $erev) { if(!$brev) { - $command = sprintf('%s --non-interactive --config-dir %s log --xml --limit 2 %s%s@%d', $this->svn_cmd, $this->tmp_dir, $this->url, $path, $erev); + $command = sprintf('%s --non-interactive %s --config-dir %s log --xml --limit 2 %s%s@%d', $this->svn_cmd, $this->_getAuthInfo(), $this->tmp_dir, $this->url, $path, $erev); $buff = $this->execCmd($command, $error); $xmlDoc = $this->oXml->parse($buff); $brev = $xmlDoc->log->logentry[1]->attrs->revision; if(!$brev) return; } - $command = sprintf('%s --non-interactive --config-dir %s diff %s%s@%d %s%s@%d', + $command = sprintf('%s --non-interactive %s --config-dir %s diff %s%s@%d %s%s@%d', $this->svn_cmd, + $this->_getAuthInfo(), $this->tmp_dir, $this->url, $path, @@ -250,8 +270,9 @@ if(strpos($path,'..')!==false) return; $command = sprintf( - '%s --non-interactive --config-dir %s log --xml %s %s %s %s%s', + '%s --non-interactive %s --config-dir %s log --xml %s %s %s %s%s', $this->svn_cmd, + $this->_getAuthInfo(), $this->tmp_dir, $quiet?'--quiet':'--verbose', $limit?'--limit '.$limit:'', diff --git a/modules/issuetracker/issuetracker.controller.php b/modules/issuetracker/issuetracker.controller.php index c6f5cb0fa..b8685ada2 100644 --- a/modules/issuetracker/issuetracker.controller.php +++ b/modules/issuetracker/issuetracker.controller.php @@ -388,7 +388,7 @@ function syncChangeset($module_info) { require_once($this->module_path.'classes/svn.class.php'); - $oSvn = new Svn($module_info->svn_url, $module_info->svn_cmd, $module_info->diff_cmd); + $oSvn = new Svn($module_info->svn_url, $module_info->svn_cmd, $module_info->diff_cmd, $module_info->svn_userid, $module_info->svn_passwd); $oModel = &getModel('issuetracker'); $status = $oSvn->getStatus(); if(!$status || !$status->revision) return; diff --git a/modules/issuetracker/lang/en.lang.php b/modules/issuetracker/lang/en.lang.php index c2bf85fac..89bb2f534 100644 --- a/modules/issuetracker/lang/en.lang.php +++ b/modules/issuetracker/lang/en.lang.php @@ -27,6 +27,10 @@ $lang->about_svn_cmd = 'Please input the location of svn client to link with SVN. (ex: /usr/bin/svn)'; $lang->diff_cmd = 'DIFF Command Location'; $lang->about_diff_cmd = 'Please input the location of diff to compare SVN revisions. (ex: /usr/bin/diff)'; + $lang->svn_userid = 'SVN ID'; + $lang->about_svn_userid = 'If authentication is necessary, input userid for accessing the SVN repository'; + $lang->svn_passwd = 'SVN password'; + $lang->about_svn_passwd = 'If authentication is necessary, input password for accessing the SVN repository'; $lang->issue = 'Issue'; $lang->total_issue = 'All Issues'; diff --git a/modules/issuetracker/lang/jp.lang.php b/modules/issuetracker/lang/jp.lang.php index b3a3e6afb..72b570827 100644 --- a/modules/issuetracker/lang/jp.lang.php +++ b/modules/issuetracker/lang/jp.lang.php @@ -27,6 +27,10 @@ $lang->about_svn_cmd = 'SVN連動のためのsvn clientファイルのロケーションを入力して下さい。 (ex: /usr/bin/svn)'; $lang->diff_cmd = 'DIFFファイルのロケーション'; $lang->about_diff_cmd = 'SVN revision間の比較のためのdiffファイルのロケーションを入力して下さい。(ex: /usr/bin/diff)'; + $lang->svn_userid = 'SVN ID'; + $lang->about_svn_userid = 'If authentication is necessary, input userid for accessing the SVN repository'; + $lang->svn_passwd = 'SVN password'; + $lang->about_svn_passwd = 'If authentication is necessary, input password for accessing the SVN repository'; $lang->issue = 'イシュー'; $lang->total_issue = 'イシュー全体'; diff --git a/modules/issuetracker/lang/ko.lang.php b/modules/issuetracker/lang/ko.lang.php index bc2f6d016..fbb2ce06f 100644 --- a/modules/issuetracker/lang/ko.lang.php +++ b/modules/issuetracker/lang/ko.lang.php @@ -27,6 +27,10 @@ $lang->about_svn_cmd = 'SVN 연동을 위해 svn client 실행파일의 위치를 입력해주세요. (ex: /usr/bin/svn)'; $lang->diff_cmd = 'DIFF 실행파일 위치'; $lang->about_diff_cmd = 'SVN revision들의 비교를 위한 diff 실행파일의 위치를 입력해주세요. (ex: /usr/bin/diff)'; + $lang->svn_userid = 'SVN 인증 아이디'; + $lang->about_svn_userid = '인증이 필요한 경우 아이디를 입력해주세요'; + $lang->svn_passwd = 'SVN 인증 패스워드'; + $lang->about_svn_passwd = '인증이 필요한 경우 패스워드를 입력해주세요'; $lang->issue = '문제'; $lang->total_issue = '전체 문제'; diff --git a/modules/issuetracker/lang/zh-CN.lang.php b/modules/issuetracker/lang/zh-CN.lang.php index 9d0d81174..717a04459 100644 --- a/modules/issuetracker/lang/zh-CN.lang.php +++ b/modules/issuetracker/lang/zh-CN.lang.php @@ -27,6 +27,10 @@ $lang->about_svn_cmd = '请输入svn clien应用程序位置。(ex: /usr/bin/svn)'; $lang->diff_cmd = 'DIF应用程序位置'; $lang->about_diff_cmd = '为比较SVN revision,请输入diff应用程序位置。 (ex: /usr/bin/diff)'; + $lang->svn_userid = 'SVN ID'; + $lang->about_svn_userid = 'If authentication is necessary, input userid for accessing the SVN repository'; + $lang->svn_passwd = 'SVN password'; + $lang->about_svn_passwd = 'If authentication is necessary, input password for accessing the SVN repository'; $lang->issue = '问题'; $lang->total_issue = '全部问题'; diff --git a/modules/issuetracker/lang/zh-TW.lang.php b/modules/issuetracker/lang/zh-TW.lang.php index d767dc65d..95589f253 100644 --- a/modules/issuetracker/lang/zh-TW.lang.php +++ b/modules/issuetracker/lang/zh-TW.lang.php @@ -27,6 +27,10 @@ $lang->about_svn_cmd = '請輸入 SVN Client應用程式位置。(ex: /usr/bin/svn)'; $lang->diff_cmd = 'DIFF應用程式位置'; $lang->about_diff_cmd = '為了比較 SVN revisions,請輸入diff應用程式位置。 (ex: /usr/bin/diff)'; + $lang->svn_userid = 'SVN ID'; + $lang->about_svn_userid = 'If authentication is necessary, input userid for accessing the SVN repository'; + $lang->svn_passwd = 'SVN password'; + $lang->about_svn_passwd = 'If authentication is necessary, input password for accessing the SVN repository'; $lang->issue = '問題'; $lang->total_issue = '所有問題'; diff --git a/modules/issuetracker/tpl/filter/insert_project.xml b/modules/issuetracker/tpl/filter/insert_project.xml index e935038b2..757c44bbd 100644 --- a/modules/issuetracker/tpl/filter/insert_project.xml +++ b/modules/issuetracker/tpl/filter/insert_project.xml @@ -16,6 +16,8 @@ + + diff --git a/modules/issuetracker/tpl/project_info.html b/modules/issuetracker/tpl/project_info.html index 5b4a15675..74571a9e3 100644 --- a/modules/issuetracker/tpl/project_info.html +++ b/modules/issuetracker/tpl/project_info.html @@ -42,11 +42,15 @@
{$lang->about_diff_cmd}
{$lang->about_svn_userid}
+{$lang->about_svn_passwd}
+