From c4c7f3a66d43dc5b80710f3dd4e9dad24dfc10d4 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 5 Feb 2010 13:28:57 +0000 Subject: [PATCH] changed the way the system admin is checked --- codepot/DEBIAN/control.in | 2 +- codepot/README | 3 + codepot/src/codepot/config/config.php | 3 +- codepot/src/codepot/controllers/file.php | 54 ++++++------- codepot/src/codepot/controllers/main.php | 1 - codepot/src/codepot/controllers/project.php | 60 +++++++------- codepot/src/codepot/controllers/source.php | 30 +++---- codepot/src/codepot/controllers/user.php | 50 ++++++++---- codepot/src/codepot/controllers/wiki.php | 46 +++++------ .../codepot/language/english/common_lang.php | 1 + .../language/indonesian/common_lang.php | 1 + .../codepot/language/korean/common_lang.php | 1 + codepot/src/codepot/models/loginmodel.php | 33 +++++--- codepot/src/codepot/views/error.php | 1 - codepot/src/codepot/views/footer.php | 3 +- codepot/src/codepot/views/login.php | 1 - codepot/src/codepot/views/project_list.php | 5 +- codepot/src/codepot/views/source_folder.php | 4 +- codepot/src/codepot/views/taskbar.php | 6 +- codepot/src/codepot/views/user_home.php | 3 +- codepot/src/config.php.in | 1 + codepot/src/css/common.css | 7 +- codepot/src/css/websvn.css | 81 +++++++++++++++++++ codepot/src/websvn/templates/calm/blame.tmpl | 8 +- codepot/src/websvn/templates/calm/log.tmpl | 20 ++--- .../src/websvn/templates/calm/revision.tmpl | 65 ++++++++------- 26 files changed, 308 insertions(+), 182 deletions(-) diff --git a/codepot/DEBIAN/control.in b/codepot/DEBIAN/control.in index 9173136e..b5546398 100644 --- a/codepot/DEBIAN/control.in +++ b/codepot/DEBIAN/control.in @@ -2,7 +2,7 @@ Package: @PACKAGE@ Version: @VERSION@ Maintainer: @PACKAGE_BUGREPORT@ Homepage: @PACKAGE_URL@ -Depends: subversion, apache2-mpm-prefork, libapache2-svn, php5, php5-ldap +Depends: subversion, apache2-mpm-prefork, libapache2-svn, php5, php5-ldap, wget Recommends: php5-mysql, php5-svn Suggests: slapd, mysql-server Section: web diff --git a/codepot/README b/codepot/README index 7ffc7ae8..0020c826 100644 --- a/codepot/README +++ b/codepot/README @@ -11,6 +11,7 @@ INSTALLATION Here is how to install Codepot into the standard locations under Ubuntu Linux. * Install required packages. + $ sudo apt-get install wget $ sudo apt-get install subversion $ sudo apt-get install apache2-mpm-prefork $ sudo apt-get install libapache2-svn @@ -56,6 +57,8 @@ INSTALLATION $ sudo make-ssl-cert generate-default-snakeoil --force-overwrite $ sudo hostname ${HOSTNAME} $ sudo /etc/init.d/apache2 restart + + Note that make-ssl-cert is provided by the ssl-cert package. LICENSE diff --git a/codepot/src/codepot/config/config.php b/codepot/src/codepot/config/config.php index 1ea77640..965f6505 100644 --- a/codepot/src/codepot/config/config.php +++ b/codepot/src/codepot/config/config.php @@ -12,7 +12,8 @@ | */ /*$config['base_url'] = "http://example.com"*/ -$config['base_url'] = "http://".$_SERVER['HTTP_HOST']; +$config['base_url'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')? 'https': 'http'; +$config['base_url'] .= "://{$_SERVER['HTTP_HOST']}"; $config['base_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/'; /* diff --git a/codepot/src/codepot/controllers/file.php b/codepot/src/codepot/controllers/file.php index 54aa42a5..70395d2c 100644 --- a/codepot/src/codepot/controllers/file.php +++ b/codepot/src/codepot/controllers/file.php @@ -25,10 +25,10 @@ class File extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('FileModel', 'files'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -43,7 +43,7 @@ class File extends Controller } else { - $files = $this->files->getAll ($loginid, $project); + $files = $this->files->getAll ($login['id'], $project); if ($files === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -63,10 +63,10 @@ class File extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('FileModel', 'files'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -83,7 +83,7 @@ class File extends Controller } else { - $file = $this->files->get ($loginid, $project, $name); + $file = $this->files->get ($login['id'], $project, $name); if ($file === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -108,10 +108,10 @@ class File extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('FileModel', 'files'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -128,7 +128,7 @@ class File extends Controller } else { - $file = $this->files->get ($loginid, $project, $name); + $file = $this->files->get ($login['id'], $project, $name); if ($file === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -164,9 +164,9 @@ class File extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('FileModel', 'files'); - $loginid = $this->login->getUserid (); - if ($loginid == '') redirect ('main'); - $data['loginid'] = $loginid; + $login = $this->login->getUser (); + if ($login['id'] == '') redirect ('main'); + $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -181,8 +181,8 @@ class File extends Controller $data['message'] = "NO SUCH PROJECT - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); } - else if (!$this->login->isSysadmin() && - $this->projects->projectHasMember($project->id, $loginid) === FALSE) + else if (!$login['sysadmin?'] && + $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['message'] = "NO PERMISSION - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); @@ -219,7 +219,7 @@ class File extends Controller { $file->name = $this->input->post('file_name'); - if ($this->files->update ($loginid, $file) === FALSE) + if ($this->files->update ($login['id'], $file) === FALSE) { $data['message'] = 'DATABASE ERROR'; $data['file'] = $file; @@ -277,7 +277,7 @@ class File extends Controller { $file->md5sum = $md5sum; - if ($this->files->create ($loginid, $file) === FALSE) + if ($this->files->create ($login['id'], $file) === FALSE) { unlink (CODEPOT_FILE_DIR . "/{$file->encname}"); $data['message'] = 'DATABASE ERROR'; @@ -304,7 +304,7 @@ class File extends Controller { if ($mode == 'update') { - $file = $this->files->get ($loginid, $project, $name); + $file = $this->files->get ($login['id'], $project, $name); if ($file === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -355,9 +355,9 @@ class File extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('FileModel', 'files'); - $loginid = $this->login->getUserid (); - if ($loginid == '') redirect ('main'); - $data['loginid'] = $loginid; + $login = $this->login->getUser (); + if ($login['id'] == '') redirect ('main'); + $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -372,8 +372,8 @@ class File extends Controller $data['message'] = "NO SUCH PROJECT - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); } - else if (!$this->login->isSysadmin() && - $this->projects->projectHasMember($project->id, $loginid) === FALSE) + else if (!$login['sysadmin?'] && + $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['message'] = "NO PERMISSION - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); @@ -396,7 +396,7 @@ class File extends Controller { if ($data['file_confirm'] == 'yes') { - $result = $this->files->delete ($loginid, $file); + $result = $this->files->delete ($login['id'], $file); if ($result === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -423,7 +423,7 @@ class File extends Controller } else { - $file = $this->files->get ($loginid, $project, $name); + $file = $this->files->get ($login['id'], $project, $name); if ($file === FALSE) { $data['message'] = 'DATABASE ERROR'; diff --git a/codepot/src/codepot/controllers/main.php b/codepot/src/codepot/controllers/main.php index 4ab74e60..a82d5ef0 100644 --- a/codepot/src/codepot/controllers/main.php +++ b/codepot/src/codepot/controllers/main.php @@ -24,7 +24,6 @@ class Main extends Controller $this->form_validation->set_error_delimiters('',''); $data['message'] = ''; - $data['loginid'] = ''; if($this->input->post('login')) { diff --git a/codepot/src/codepot/controllers/project.php b/codepot/src/codepot/controllers/project.php index 9c1f2a46..77a1b216 100644 --- a/codepot/src/codepot/controllers/project.php +++ b/codepot/src/codepot/controllers/project.php @@ -24,11 +24,11 @@ class Project extends Controller { $this->load->model ('ProjectModel', 'projects'); - $loginid = $this->login->getUserid(); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -48,12 +48,12 @@ class Project extends Controller } } - function _edit_project ($project, $mode, $loginid) + function _edit_project ($project, $mode, $login) { $this->load->helper ('form'); $this->load->library ('form_validation'); - $data['loginid'] = $loginid; + $data['login'] = $login; // SET VALIDATION RULES $this->form_validation->set_rules ( @@ -92,8 +92,8 @@ class Project extends Controller // if ok, take action $result = ($mode == 'update')? - $this->projects->update ($loginid, $project): - $this->projects->create ($loginid, $project, $api_base_url); + $this->projects->update ($login['id'], $project): + $this->projects->create ($login['id'], $project, $api_base_url); if ($result === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -132,57 +132,57 @@ class Project extends Controller { $this->load->model ('ProjectModel', 'projects'); - $loginid = $this->login->getUserid (); - if ($loginid == '') redirect ('main/signin'); + $login = $this->login->getUser (); + if ($login['id'] == '') redirect ('main/signin'); $project->id = $projectid; $project->name = ''; $project->summary = ''; $project->description = ''; - $project->members = $loginid; + $project->members = $login['id']; - $this->_edit_project ($project, 'create', $loginid); + $this->_edit_project ($project, 'create', $login); } function update ($projectid) { $this->load->model ('ProjectModel', 'projects'); - $loginid = $this->login->getUserid (); - if ($loginid == '') redirect ('main/signin'); + $login = $this->login->getUser (); + if ($login['id'] == '') redirect ('main/signin'); $project = $this->projects->get ($projectid); if ($project === FALSE) { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); } else if ($project === NULL) { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = "NO SUCH PROJECT - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); } - else if (!$this->login->isSysadmin() && - $this->projects->projectHasMember($project->id, $loginid) === FALSE) + else if (!$login['sysadmin?'] && + $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = "NO PERMISSION - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); } else { - $this->_edit_project ($project, 'update', $loginid); + $this->_edit_project ($project, 'update', $login); } } - function _delete_project ($project, $loginid) + function _delete_project ($project, $login) { $this->load->helper ('form'); $this->load->library ('form_validation'); - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = ''; $this->form_validation->set_rules ('project_confirm', 'confirm', 'alpha'); @@ -197,7 +197,7 @@ class Project extends Controller { if ($data['project_confirm'] == 'yes') { - $result = $this->projects->delete ($loginid, $project); + $result = $this->projects->delete ($login['id'], $project); if ($result === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -240,32 +240,32 @@ class Project extends Controller { $this->load->model ('ProjectModel', 'projects'); - $loginid = $this->login->getUserid (); - if ($loginid == '') redirect ('main/signin'); + $login = $this->login->getUser (); + if ($login['id'] == '') redirect ('main/signin'); $project = $this->projects->get ($projectid); if ($project === FALSE) { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); } else if ($project === NULL) { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = "NO SUCH PROJECT - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); } - else if (!$this->login->isSysadmin() && - $this->projects->projectHasMember($project->id, $loginid) === FALSE) + else if (!$login['sysadmin?'] && + $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = "NO PERMISSION - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); } else { - $this->_delete_project ($project, $loginid); + $this->_delete_project ($project, $login); } } } diff --git a/codepot/src/codepot/controllers/source.php b/codepot/src/codepot/controllers/source.php index f157574d..bd33e572 100644 --- a/codepot/src/codepot/controllers/source.php +++ b/codepot/src/codepot/controllers/source.php @@ -31,10 +31,10 @@ class Source extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('SubversionModel', 'subversion'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $path = $this->converter->HexToAscii ($path); if ($path == '.') $path = ''; /* treat a period specially */ @@ -81,10 +81,10 @@ class Source extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('SubversionModel', 'subversion'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $path = $this->converter->HexToAscii ($path); @@ -150,10 +150,10 @@ class Source extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('SubversionModel', 'subversion'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $path = $this->converter->HexToAscii ($path); @@ -207,10 +207,10 @@ class Source extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('SubversionModel', 'subversion'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $path = $this->converter->HexToAscii ($path); @@ -251,10 +251,10 @@ class Source extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('SubversionModel', 'subversion'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $path = $this->converter->HexToAscii ($path); diff --git a/codepot/src/codepot/controllers/user.php b/codepot/src/codepot/controllers/user.php index c7c3a3f4..6ecc7368 100644 --- a/codepot/src/codepot/controllers/user.php +++ b/codepot/src/codepot/controllers/user.php @@ -26,22 +26,22 @@ class User extends Controller function home () { - $loginid = $this->login->getUserid(); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); $this->load->model ('ProjectModel', 'projects'); - $latest_projects = $this->projects->getLatestProjects ($loginid, CODEPOT_MAX_LATEST_PROJECTS); + $latest_projects = $this->projects->getLatestProjects ($login['id'], CODEPOT_MAX_LATEST_PROJECTS); if ($latest_projects === FALSE) { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); } else { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['latest_projects'] = $latest_projects; $data['user_name'] = ''; $data['user_pass'] = ''; @@ -51,24 +51,24 @@ class User extends Controller function projectlist () { - $loginid = $this->login->getUserid(); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); $this->load->model ('ProjectModel', 'projects'); - $projects = $this->projects->getMyProjects ($loginid); - $other_projects = $this->projects->getOtherProjects ($loginid); + $projects = $this->projects->getMyProjects ($login['id']); + $other_projects = $this->projects->getOtherProjects ($login['id']); if ($projects === FALSE || $other_projects === FALSE) { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); } else { - $data['loginid'] = $loginid; + $data['login'] = $login; $data['projects'] = $projects; $data['other_projects'] = $other_projects; $this->load->view ($this->VIEW_PROJECT_LIST, $data); @@ -77,18 +77,40 @@ class User extends Controller function preference () { - $loginid = $this->login->getUserid(); - if ($loginid == '') redirect ('main/signin'); + $login = $this->login->getUser(); + if ($login['id'] == '') redirect ('main/signin'); $this->load->view ( $this->VIEW_ERROR, array ( - 'loginid' => $loginid, + 'login' => $login, 'message' => 'USER PREFERENCE NOT SUPPORTED YET' ) ); } + function admin () + { + $login = $this->login->getUser(); + if ($login['id'] == '') redirect ('main/signin'); + + + if ($login['sysadmin?']) + { + echo "...Site Administration..."; + } + else + { + $this->load->view ( + $this->VIEW_ERROR, + array ( + 'login' => $login, + 'message' => 'NO PERMISSION' + ) + ); + } + } + } ?> diff --git a/codepot/src/codepot/controllers/wiki.php b/codepot/src/codepot/controllers/wiki.php index 9b6ef605..0a9464ac 100644 --- a/codepot/src/codepot/controllers/wiki.php +++ b/codepot/src/codepot/controllers/wiki.php @@ -27,10 +27,10 @@ class Wiki extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('WikiModel', 'wikis'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -45,7 +45,7 @@ class Wiki extends Controller } else { - $wikis = $this->wikis->getAll ($loginid, $project); + $wikis = $this->wikis->getAll ($login['id'], $project); if ($wikis === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -65,10 +65,10 @@ class Wiki extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('WikiModel', 'wikis'); - $loginid = $this->login->getUserid (); - if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') + $login = $this->login->getUser (); + if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') redirect ('main/signin'); - $data['loginid'] = $loginid; + $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -95,7 +95,7 @@ class Wiki extends Controller } else { - $wiki = $this->wikis->get ($loginid, $project, $name); + $wiki = $this->wikis->get ($login['id'], $project, $name); if ($wiki === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -123,9 +123,9 @@ class Wiki extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('WikiModel', 'wikis'); - $loginid = $this->login->getUserid (); - if ($loginid == '') redirect ('main'); - $data['loginid'] = $loginid; + $login = $this->login->getUser (); + if ($login['id'] == '') redirect ('main'); + $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -140,8 +140,8 @@ class Wiki extends Controller $data['message'] = "NO SUCH PROJECT - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); } - else if (!$this->login->isSysadmin() && - $this->projects->projectHasMember($project->id, $loginid) === FALSE) + else if (!$login['sysadmin?'] && + $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['message'] = "NO PERMISSION - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); @@ -176,8 +176,8 @@ class Wiki extends Controller if ($this->form_validation->run()) { $result = ($mode == 'update')? - $this->wikis->update ($loginid, $wiki): - $this->wikis->create ($loginid, $wiki); + $this->wikis->update ($login['id'], $wiki): + $this->wikis->create ($login['id'], $wiki); if ($result === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -201,7 +201,7 @@ class Wiki extends Controller { if ($mode == 'update') { - $wiki = $this->wikis->get ($loginid, $project, $name); + $wiki = $this->wikis->get ($login['id'], $project, $name); if ($wiki === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -249,9 +249,9 @@ class Wiki extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('WikiModel', 'wikis'); - $loginid = $this->login->getUserid (); - if ($loginid == '') redirect ('main'); - $data['loginid'] = $loginid; + $login = $this->login->getUser (); + if ($login['id'] == '') redirect ('main'); + $data['login'] = $login; $name = $this->converter->HexToAscii ($name); @@ -266,8 +266,8 @@ class Wiki extends Controller $data['message'] = "NO SUCH PROJECT - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); } - else if (!$this->login->isSysadmin() && - $this->projects->projectHasMember($project->id, $loginid) === FALSE) + else if (!$login['sysadmin?'] && + $this->projects->projectHasMember($project->id, $login['id']) === FALSE) { $data['message'] = "NO PERMISSION - $projectid"; $this->load->view ($this->VIEW_ERROR, $data); @@ -296,7 +296,7 @@ class Wiki extends Controller { if ($data['wiki_confirm'] == 'yes') { - $result = $this->wikis->delete ($loginid, $wiki); + $result = $this->wikis->delete ($login['id'], $wiki); if ($result === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -323,7 +323,7 @@ class Wiki extends Controller } else { - $wiki = $this->wikis->get ($loginid, $project, $name); + $wiki = $this->wikis->get ($login['id'], $project, $name); if ($wiki === FALSE) { $data['message'] = 'DATABASE ERROR'; diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 706ca19b..db6c269b 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -39,6 +39,7 @@ $lang['Sign out'] = 'Sign out'; $lang['Size'] = 'Size'; $lang['Source'] = 'Source'; $lang['Summary'] = 'Summary'; +$lang['System'] = 'System'; $lang['Tag'] = 'Tag'; $lang['Text'] = 'Text'; $lang['Time'] = 'Time'; diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index 9b8a89c5..8c3e540d 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -39,6 +39,7 @@ $lang['Sign out'] = 'Keluar'; $lang['Size'] = 'Ukuran'; $lang['Source'] = 'Sumber'; $lang['Summary'] = 'Rangkuman'; +$lang['System'] = 'Sistem'; $lang['Tag'] = 'Label'; $lang['Text'] = 'Teks'; $lang['Time'] = 'Waktu'; diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index cbe691f8..7f3a11db 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -39,6 +39,7 @@ $lang['Sign out'] = '로그아웃'; $lang['Size'] = '크기'; $lang['Source'] = '소스'; $lang['Summary'] = '요약'; +$lang['System'] = '시스템'; $lang['Tag'] = '태그'; $lang['Text'] = '본문'; $lang['Time'] = '시간'; diff --git a/codepot/src/codepot/models/loginmodel.php b/codepot/src/codepot/models/loginmodel.php index 68a7fc60..091df7c5 100644 --- a/codepot/src/codepot/models/loginmodel.php +++ b/codepot/src/codepot/models/loginmodel.php @@ -15,20 +15,28 @@ class LoginModel extends Model $this->load->library ('session'); } - function isSysadmin () - { - $userid = $this->getUserid (); - if ($userid === NULL) return FALSE; - return $userid == CODEPOT_SYSADMIN_USERID; - } - - function getUserid () + function getUser () { $server1 = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT']; $server2 = $this->session->userdata('server'); - if ($server1 != $server2) return ''; - $userid = $this->session->userdata('userid'); - return ($userid === NULL)? '': $userid; + if ($server1 != $server2) + { + $userid = ''; + $issysadmin = FALSE; + } + else + { + $userid = $this->session->userdata('userid'); + if ($userid === NULL) $userid = ''; + + $issysadmin = $this->session->userdata('sysadmin?'); + if ($issysadmin === NULL) $issysadmin = FALSE; + } + + return array ( + 'id' => $userid, + 'sysadmin?' => $issysadmin + ); } function authenticate ($userid, $password) @@ -37,7 +45,8 @@ class LoginModel extends Model $this->session->set_userdata ( array ( 'userid' => $userid, - 'server' => $server + 'server' => $server, + 'sysadmin?' => ($userid == CODEPOT_SYSADMIN_USERID) ) ); return TRUE; diff --git a/codepot/src/codepot/views/error.php b/codepot/src/codepot/views/error.php index d1f5a9d5..40af9479 100644 --- a/codepot/src/codepot/views/error.php +++ b/codepot/src/codepot/views/error.php @@ -23,7 +23,6 @@ $this->load->view ( 'projectbar', array ( - 'loginid' => $loginid, 'project' => NULL, 'pageid' => '', 'ctxmenuitems' => array () diff --git a/codepot/src/codepot/views/footer.php b/codepot/src/codepot/views/footer.php index ebaed372..9f041da4 100644 --- a/codepot/src/codepot/views/footer.php +++ b/codepot/src/codepot/views/footer.php @@ -1,3 +1,4 @@ diff --git a/codepot/src/codepot/views/login.php b/codepot/src/codepot/views/login.php index f2042c50..0ac444f5 100644 --- a/codepot/src/codepot/views/login.php +++ b/codepot/src/codepot/views/login.php @@ -28,7 +28,6 @@ $this->load->view ( 'projectbar', array ( - 'loginid' => $loginid, 'project' => NULL, 'pageid' => '', 'ctxmenuitems' => array () diff --git a/codepot/src/codepot/views/project_list.php b/codepot/src/codepot/views/project_list.php index 78debb42..ab6652b3 100644 --- a/codepot/src/codepot/views/project_list.php +++ b/codepot/src/codepot/views/project_list.php @@ -5,8 +5,8 @@ lang->line('Home'); - if (isset($loginid) && $loginid != '') $caption .= "({$loginid})"; + $caption = $this->lang->line('Projects'); + if ($login['id'] != '') $caption .= "({$login['id']})"; ?> <?=htmlspecialchars($caption)?> @@ -25,7 +25,6 @@ $this->load->view ( 'projectbar', array ( - 'loginid' => $loginid, 'project' => NULL, 'pageid' => '', 'ctxmenuitems' => array ( diff --git a/codepot/src/codepot/views/source_folder.php b/codepot/src/codepot/views/source_folder.php index 655a051c..9ba0f75e 100644 --- a/codepot/src/codepot/views/source_folder.php +++ b/codepot/src/codepot/views/source_folder.php @@ -114,8 +114,8 @@ if ($folder != '') print '' . $this->lang->line('Size') . ''; print '' . $this->lang->line('Author') . ''; print '' . $this->lang->line('Time') . ''; - print '' . ''; - print '' . ''; + print '' . $this->lang->line('Blame') . ''; + print '' . $this->lang->line('Difference') . ''; print ''; $rowclasses = array ('even', 'odd'); diff --git a/codepot/src/codepot/views/taskbar.php b/codepot/src/codepot/views/taskbar.php index ae03deec..97eb005b 100644 --- a/codepot/src/codepot/views/taskbar.php +++ b/codepot/src/codepot/views/taskbar.php @@ -1,6 +1,6 @@ '; @@ -39,12 +39,14 @@ function show_taskbar ($con, $loginid) print '
'; print anchor ('user/home', $con->lang->line('Home')); print anchor ('user/projectlist', $con->lang->line('Projects')); + if ($issysadmin) + print anchor ('user/admin', $con->lang->line('System')); print '
'; print ''; } -show_taskbar ($this, $loginid); +show_taskbar ($this, $login['id'], $login['sysadmin?']); ?> diff --git a/codepot/src/codepot/views/user_home.php b/codepot/src/codepot/views/user_home.php index 76dcf626..7eb27de8 100644 --- a/codepot/src/codepot/views/user_home.php +++ b/codepot/src/codepot/views/user_home.php @@ -6,7 +6,7 @@ lang->line('Home'); - if (isset($loginid) && $loginid != '') $caption .= "({$loginid})"; + if ($login['id'] != '') $caption .= "({$login['id']})"; ?> <?=htmlspecialchars($caption)?> @@ -25,7 +25,6 @@ $this->load->view ( 'projectbar', array ( - 'loginid' => $loginid, 'project' => NULL, 'pageid' => '', 'ctxmenuitems' => array () diff --git a/codepot/src/config.php.in b/codepot/src/config.php.in index 9344d928..4cc85a12 100644 --- a/codepot/src/config.php.in +++ b/codepot/src/config.php.in @@ -1,5 +1,6 @@ -
+
[websvn-test:noaccess] [lang:NOACCESS] @@ -41,10 +41,10 @@ [websvn:fileviewloglink]
-
- +
+
- + diff --git a/codepot/src/websvn/templates/calm/log.tmpl b/codepot/src/websvn/templates/calm/log.tmpl index 6d18f351..3c51136e 100755 --- a/codepot/src/websvn/templates/calm/log.tmpl +++ b/codepot/src/websvn/templates/calm/log.tmpl @@ -27,17 +27,17 @@ [lang:NOACCESS] [websvn-else] -
+
Log messages
-
[lang:LINENO] [lang:REV] [lang:AUTHOR]
+
- + @@ -88,21 +88,23 @@ [websvn-endlisting]
  [lang:REV] [lang:LOGMSG]
-

[websvn:compare_submit][websvn:compare_hidden] -

[websvn:compare_endform] [websvn-endtest] [websvn-test:logsearch_nomorematches]

[lang:NOMORERESULTS]

[websvn-endtest] + +
+
+

[websvn:logsearch_moreresultslink]

[websvn:pagelinks]

[websvn:showalllink]

-
+
[websvn-endtest] diff --git a/codepot/src/websvn/templates/calm/revision.tmpl b/codepot/src/websvn/templates/calm/revision.tmpl index 62f91ee8..c93910e4 100644 --- a/codepot/src/websvn/templates/calm/revision.tmpl +++ b/codepot/src/websvn/templates/calm/revision.tmpl @@ -27,7 +27,7 @@ [lang:NOACCESS] [websvn-else] -
+