diff --git a/codepot/Makefile.am b/codepot/Makefile.am index 3a215b72..71e48fa6 100644 --- a/codepot/Makefile.am +++ b/codepot/Makefile.am @@ -48,4 +48,4 @@ rpm: dist mkdir -p "@abs_top_builddir@/RPM/SRPMS" mkdir -p "@abs_top_builddir@/RPM/RPMS" cp codepot-@VERSION@.tar.gz "@abs_top_builddir@/RPM/SOURCES" - rpmbuild --define "_topdir @abs_top_builddir@/RPM" -ba codepot.spec + rpmbuild --define "_topdir @abs_top_builddir@/RPM" -ba codepot.spec --target noarch diff --git a/codepot/Makefile.in b/codepot/Makefile.in index b43822a5..afb43a64 100644 --- a/codepot/Makefile.in +++ b/codepot/Makefile.in @@ -733,7 +733,7 @@ rpm: dist mkdir -p "@abs_top_builddir@/RPM/SRPMS" mkdir -p "@abs_top_builddir@/RPM/RPMS" cp codepot-@VERSION@.tar.gz "@abs_top_builddir@/RPM/SOURCES" - rpmbuild --define "_topdir @abs_top_builddir@/RPM" -ba codepot.spec + rpmbuild --define "_topdir @abs_top_builddir@/RPM" -ba codepot.spec --target noarch # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index 9b36bac3..95b0278a 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -11,11 +11,12 @@ default_site_name = "@PACKAGE@" ;------------------------------------------------------------------------------ ; database settings ;------------------------------------------------------------------------------ -database_username = -database_password = -database_name = -database_driver = -database_prefix = +database_hostname = "localhost" +database_username = "" +database_password = "" +database_name = "" +database_driver = "" +database_prefix = "" ;------------------------------------------------------------------------------ ; ldap settings diff --git a/codepot/src/codepot/config/database.php b/codepot/src/codepot/config/database.php index 9d612daa..ea7cf656 100644 --- a/codepot/src/codepot/config/database.php +++ b/codepot/src/codepot/config/database.php @@ -37,7 +37,7 @@ $active_group = "default"; $active_record = TRUE; -$db['default']['hostname'] = "localhost"; +$db['default']['hostname'] = CODEPOT_DATABASE_HOSTNAME; $db['default']['username'] = CODEPOT_DATABASE_USERNAME; $db['default']['password'] = CODEPOT_DATABASE_PASSWORD; $db['default']['database'] = CODEPOT_DATABASE_NAME; @@ -50,5 +50,18 @@ $db['default']['cachedir'] = ""; $db['default']['char_set'] = "utf8"; $db['default']['dbcollat'] = "utf8_general_ci"; +$db['auth-mysql']['hostname'] = CODEPOT_AUTH_MYSQL_HOSTNAME; +$db['auth-mysql']['username'] = CODEPOT_AUTH_MYSQL_USERNAME; +$db['auth-mysql']['password'] = CODEPOT_AUTH_MYSQL_PASSWORD; +$db['auth-mysql']['database'] = CODEPOT_AUTH_MYSQL_NAME; +$db['auth-mysql']['dbdriver'] = "mysql"; +$db['auth-mysql']['dbprefix'] = CODEPOT_AUTH_MYSQL_PREFIX; +$db['auth-mysql']['pconnect'] = FALSE; +$db['auth-mysql']['db_debug'] = FALSE; +$db['auth-mysql']['cache_on'] = FALSE; +$db['auth-mysql']['cachedir'] = ""; +$db['auth-mysql']['char_set'] = "utf8"; +$db['auth-mysql']['dbcollat'] = "utf8_general_ci"; + /* End of file database.php */ /* Location: ./system/application/config/database.php */ diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index f41432ee..ccd5b531 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -20,6 +20,7 @@ class Code extends Controller $this->load->library ('Language', 'lang'); $this->lang->load ('common', CODEPOT_LANG); + $this->lang->load ('code', CODEPOT_LANG); } function home ($projectid = '', $subdir = '', $rev = SVN_REVISION_HEAD) diff --git a/codepot/src/codepot/language/english/Makefile.am b/codepot/src/codepot/language/english/Makefile.am index 277de438..8a9cd58c 100644 --- a/codepot/src/codepot/language/english/Makefile.am +++ b/codepot/src/codepot/language/english/Makefile.am @@ -1,5 +1,6 @@ wwwdir=$(WWWDIR)/codepot/language/english www_DATA = \ + code_lang.php \ common_lang.php \ issue_lang.php \ index.html \ diff --git a/codepot/src/codepot/language/english/Makefile.in b/codepot/src/codepot/language/english/Makefile.in index d29a3493..f956bb40 100644 --- a/codepot/src/codepot/language/english/Makefile.in +++ b/codepot/src/codepot/language/english/Makefile.in @@ -166,6 +166,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ wwwdir = $(WWWDIR)/codepot/language/english www_DATA = \ + code_lang.php \ common_lang.php \ issue_lang.php \ index.html \ diff --git a/codepot/src/codepot/language/english/code_lang.php b/codepot/src/codepot/language/english/code_lang.php new file mode 100644 index 00000000..9180e9d7 --- /dev/null +++ b/codepot/src/codepot/language/english/code_lang.php @@ -0,0 +1,9 @@ + diff --git a/codepot/src/codepot/language/korean/Makefile.am b/codepot/src/codepot/language/korean/Makefile.am index 4407ba72..98a58506 100644 --- a/codepot/src/codepot/language/korean/Makefile.am +++ b/codepot/src/codepot/language/korean/Makefile.am @@ -1,5 +1,6 @@ wwwdir=$(WWWDIR)/codepot/language/korean www_DATA = \ + code_lang.php \ common_lang.php \ issue_lang.php \ index.html \ diff --git a/codepot/src/codepot/language/korean/Makefile.in b/codepot/src/codepot/language/korean/Makefile.in index 86521974..241d1655 100644 --- a/codepot/src/codepot/language/korean/Makefile.in +++ b/codepot/src/codepot/language/korean/Makefile.in @@ -166,6 +166,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ wwwdir = $(WWWDIR)/codepot/language/korean www_DATA = \ + code_lang.php \ common_lang.php \ issue_lang.php \ index.html \ diff --git a/codepot/src/codepot/language/korean/code_lang.php b/codepot/src/codepot/language/korean/code_lang.php new file mode 100644 index 00000000..25a76bc3 --- /dev/null +++ b/codepot/src/codepot/language/korean/code_lang.php @@ -0,0 +1,9 @@ + diff --git a/codepot/src/codepot/models/Makefile.am b/codepot/src/codepot/models/Makefile.am index e24de072..94b0c5a7 100644 --- a/codepot/src/codepot/models/Makefile.am +++ b/codepot/src/codepot/models/Makefile.am @@ -6,6 +6,7 @@ www_DATA = \ ldaploginmodel.php \ loginmodel.php \ logmodel.php \ + mysqlloginmodel.php \ projectmodel.php \ sitemodel.php \ subversionmodel.php \ diff --git a/codepot/src/codepot/models/Makefile.in b/codepot/src/codepot/models/Makefile.in index ae861667..d22ddfb3 100644 --- a/codepot/src/codepot/models/Makefile.in +++ b/codepot/src/codepot/models/Makefile.in @@ -172,6 +172,7 @@ www_DATA = \ ldaploginmodel.php \ loginmodel.php \ logmodel.php \ + mysqlloginmodel.php \ projectmodel.php \ sitemodel.php \ subversionmodel.php \ diff --git a/codepot/src/codepot/models/mysqlloginmodel.php b/codepot/src/codepot/models/mysqlloginmodel.php new file mode 100644 index 00000000..cec255bf --- /dev/null +++ b/codepot/src/codepot/models/mysqlloginmodel.php @@ -0,0 +1,37 @@ +load->database ('auth-mysql'); + } + + function authenticate ($userid, $password) + { + $this->db->trans_start (); + + /* + TODO: + $this->db->select ('username'); + $this->db->where ('username', $userid); + $this->db->where ('passwd', $userid); + */ + $this->db->trans_complete (); + if ($this->db->trans_status() === FALSE) return FALSE; + + return parent::authenticate ($userid, $password, $email); + } + + function queryUserInfo ($userid) + { + $user['id'] = ''; + $user['email'] = ''; + + return $user; + } +} + +?> diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 08f6adbf..827bcd53 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -7,9 +7,21 @@ class SubversionModel extends Model parent::Model (); } + function _canonical_path($path) + { + $canonical = preg_replace('|/\.?(?=/)|','',$path); + while (($collapsed = preg_replace('|/[^/]+/\.\./|','/',$canonical,1)) !== $canonical) + { + $canonical = $collapsed; + } + $canonical = preg_replace('|^/\.\./|','/',$canonical); + return $canonical; + } + function getFile ($projectid, $path, $rev = SVN_REVISION_HEAD) { - $url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + //$url = 'file://'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $info = @svn_info ($url, FALSE, $rev); if ($info === FALSE || count($info) != 1) return FALSE; @@ -31,10 +43,20 @@ class SubversionModel extends Model 1, SVN_DISCOVER_CHANGED_PATHS); if ($log === FALSE) return FALSE; + $prop = @svn_proplist ($url, FALSE, $rev); + if ($prop === FALSE) return FALSE; + + if (array_key_exists ($url, $prop)) + { + $fileinfo['properties'] = $prop[$url]; + } + else $fileinfo['properties'] = NULL; + $fileinfo['fullpath'] = substr ( $info[0]['url'], strlen($info[0]['repos'])); $fileinfo['content'] = $str; $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; + return $fileinfo; } else if ($info[0]['kind'] == SVN_NODE_DIR) @@ -52,6 +74,13 @@ class SubversionModel extends Model if ($log === FALSE) return FALSE; } + $prop = @svn_proplist ($url, FALSE, $rev); + if ($prop === FALSE) return FALSE; + + if (array_key_exists ($url, $prop)) + $fileinfo['properties'] = $prop[$url]; + else $fileinfo['properties'] = NULL; + $fileinfo['fullpath'] = substr ( $info[0]['url'], strlen($info[0]['repos'])); $fileinfo['name'] = $info[0]['path']; @@ -69,7 +98,8 @@ class SubversionModel extends Model function getBlame ($projectid, $path, $rev = SVN_REVISION_HEAD) { - $url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + //$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $info = @svn_info ($url, FALSE, $rev); if ($info === FALSE || count($info) != 1) return FALSE; @@ -100,7 +130,8 @@ class SubversionModel extends Model function getHistory ($projectid, $path, $rev = SVN_REVISION_HEAD) { - $url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + //$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $info = @svn_info ($url, FALSE, $rev); if ($info === FALSE || count($info) != 1) return FALSE; @@ -134,7 +165,8 @@ class SubversionModel extends Model function getRevHistory ($projectid, $path, $rev) { - $url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + //$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $info = @svn_info ($url, FALSE, $rev); if ($info === FALSE || count($info) != 1) return FALSE; @@ -420,7 +452,8 @@ class SubversionModel extends Model // function getDiff ($projectid, $path, $rev1, $rev2) { - $url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + //$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $lsinfo1 = @svn_ls ($url, $rev1, FALSE, TRUE); if ($lsinfo1 === FALSE || count($lsinfo1) != 1) return FALSE; @@ -504,7 +537,8 @@ class SubversionModel extends Model function getPrevRev ($projectid, $path, $rev) { - $url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + //$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $log = @svn_log ( $url, $rev, SVN_REVISION_INITIAL, 2, @@ -520,7 +554,8 @@ class SubversionModel extends Model function getNextRev ($projectid, $path, $rev) { - $url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + //$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $log = @svn_log ( $url, SVN_REVISION_HEAD, $rev, 0, @@ -557,7 +592,8 @@ class SubversionModel extends Model function getHeadRev ($projectid, $path) { - $url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + //$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; + $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $log = @svn_log ( $url, SVN_REVISION_HEAD, SVN_REVISION_INITIAL, 1, diff --git a/codepot/src/codepot/views/code_blame.php b/codepot/src/codepot/views/code_blame.php index 50d3db4f..218c092a 100644 --- a/codepot/src/codepot/views/code_blame.php +++ b/codepot/src/codepot/views/code_blame.php @@ -10,6 +10,36 @@ + + + + + + +
+= $this->lang->line('Message') ?>+= $file['logmsg'] ?>+ + 0) +{ + print ''; + print $this->lang->line('CODE_PROPERTIES'); + print ''; + + print '
+= $this->lang->line('Message') ?>+= $file['logmsg'] ?>+ + 0) +{ + print ''; + print $this->lang->line('CODE_PROPERTIES'); + print ''; + + print '