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 @@ + + + + + + + <?=htmlspecialchars($project->name)?> @@ -112,12 +142,11 @@ print anchor ("code/history/{$project->id}/{$xpar}", $this->lang->line('History'
- id}/${xpar}/{$file['prev_rev']}", '<<')?> + id}/${xpar}/{$file['prev_rev']}", '<<')?> lang->line('Revision')?>: - id}/${xpar}/{$file['next_rev']}", '>>')?> | - lang->line('Author')?>: | + id}/${xpar}/{$file['next_rev']}", '>>')?> | lang->line('Size')?>: | - lang->line('Last updated on')?>: + lang->line('Details')?>
@@ -174,21 +203,34 @@ print anchor ("code/history/{$project->id}/{$xpar}", $this->lang->line('History'
- +
lang->line('CODE_COMMIT') ?>
+lang->line('CODE_MSG_COMMITTED_BY_ON'), $file['last_author'], $file['time']); ?> - -
+
lang->line('Message') ?>
+
 
 
+ + 0) +{ + print '
'; + print $this->lang->line('CODE_PROPERTIES'); + print '
'; + + print '
    '; + foreach ($file['properties'] as $pn => $pv) + { + print '
  • '; + print htmlspecialchars($pn); + print ' - '; + print htmlspecialchars($pv); + print '
  • '; + } + print '
'; +} +?> +
diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index cd0be0f9..eaf9a36f 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -10,6 +10,36 @@ + + + + + + + <?=htmlspecialchars($project->name)?> @@ -113,9 +143,8 @@ $this->load->view ( id}/${xpar}/{$file['prev_rev']}", '<<')?> lang->line('Revision')?>: id}/${xpar}/{$file['next_rev']}", '>>')?> | - lang->line('Author')?>: | lang->line('Size')?>: | - lang->line('Last updated on')?>: + lang->line('Details')?>
@@ -153,21 +182,34 @@ if ($fileext == '') $fileext = "html"
- +
lang->line('CODE_COMMIT') ?>
+lang->line('CODE_MSG_COMMITTED_BY_ON'), $file['last_author'], $file['time']); ?> - -
+
lang->line('Message') ?>
+
 
 
+ + 0) +{ + print '
'; + print $this->lang->line('CODE_PROPERTIES'); + print '
'; + + print '
    '; + foreach ($file['properties'] as $pn => $pv) + { + print '
  • '; + print htmlspecialchars($pn); + print ' - '; + print htmlspecialchars($pv); + print '
  • '; + } + print '
'; +} +?> +
diff --git a/codepot/src/config.php.in b/codepot/src/config.php.in index 0d17f3d0..846dc12b 100644 --- a/codepot/src/config.php.in +++ b/codepot/src/config.php.in @@ -35,12 +35,19 @@ function load_ini ($file) array ('max_logs_in_site_home', 'integer', 10), array ('max_logs_in_project_home', 'integer', 5), + array ('database_hostname', 'string', 'localhost'), array ('database_username', 'string', ''), array ('database_password', 'string', ''), array ('database_name', 'string', ''), array ('database_driver', 'string', ''), array ('database_prefix', 'string', ''), + array ('auth_mysql_hostname', 'string', 'localhost'), + array ('auth_mysql_username', 'string', ''), + array ('auth_mysql_password', 'string', ''), + array ('auth_mysql_name', 'string', ''), + array ('auth_mysql_prefix', 'string', ''), + array ('ldap_server_host', 'string', '127.0.0.1'), array ('ldap_server_port', 'integer', 389), array ('ldap_server_protocol_version', 'integer', 3), diff --git a/codepot/src/css/code.css b/codepot/src/css/code.css index 82d847e2..e6f2b514 100644 --- a/codepot/src/css/code.css +++ b/codepot/src/css/code.css @@ -28,9 +28,14 @@ #code_file_mainarea_result_info { position: absolute; - top: 0; - right: 0; + top: 5; + right: 5; width: 22em; + background: #E5ECF9 none repeat scroll 0 0; + border: #D4DBE8 1px solid; + overflow: auto; + padding: 0.2em 0.4em 0.2em 0.4em; + font-size: 0.9em; } #code_file_mainarea_result_info pre { @@ -38,24 +43,20 @@ border: 0; margin: 0; padding: 0; + background-color: inherit; + white-space: -moz-pre-wrap; + white-space: -o-pre-wrap; + white-space: pre-wrap; } #code_file_mainarea_result_info .title { - background-color: #7777FF; - border: 0; - margin: 0; - font-size: 0.8em; - text-align: right; -} - -#code_file_mainarea_result_info .title a { - color: white; + background-color: #8888FF; + color: #FFFFFF; + border: #D4DBE8 1px solid; + margin: 0.3em 0 0.3em 0; + padding: 0.1em 0.1em 0.1em 0.1em; font-size: inherit; - background-color: inherit; -} - -#code_file_mainarea_result_info .title a:hover { - background-color: inherit; + text-transform: uppercase; } /*----------------------------------------------- @@ -72,9 +73,14 @@ #code_blame_mainarea_result_info { position: absolute; - top: 0; - right: 0; + top: 5; + right: 5; width: 22em; + background: #E5ECF9 none repeat scroll 0 0; + border: #D4DBE8 1px solid; + overflow: auto; + padding: 0.2em 0.4em 0.2em 0.4em; + font-size: 0.9em; } #code_blame_mainarea_result_info pre { @@ -82,24 +88,20 @@ border: 0; margin: 0; padding: 0; + background-color: inherit; + white-space: -moz-pre-wrap; + white-space: -o-pre-wrap; + white-space: pre-wrap; } #code_blame_mainarea_result_info .title { - background-color: #7777FF; - border: 0; - margin: 0; - font-size: 0.8em; - text-align: right; -} - -#code_blame_mainarea_result_info .title a { - color: white; + background-color: #8888FF; + color: #FFFFFF; + border: #D4DBE8 1px solid; + margin: 0.3em 0 0.3em 0; + padding: 0.1em 0.1em 0.1em 0.1em; font-size: inherit; - background-color: inherit; -} - -#code_blame_mainarea_result_info .title a:hover { - background-color: inherit; + text-transform: uppercase; } /*----------------------------------------------- @@ -127,6 +129,9 @@ background-color: inherit; padding: 0; margin: 0; + white-space: -moz-pre-wrap; + white-space: -o-pre-wrap; + white-space: pre-wrap; } #code_history_mainarea_result_table .title {