changed the way the system admin is checked

This commit is contained in:
hyung-hwan 2010-02-05 13:28:57 +00:00
parent 00e1d5f401
commit c4c7f3a66d
26 changed files with 308 additions and 182 deletions

View File

@ -2,7 +2,7 @@ Package: @PACKAGE@
Version: @VERSION@ Version: @VERSION@
Maintainer: @PACKAGE_BUGREPORT@ Maintainer: @PACKAGE_BUGREPORT@
Homepage: @PACKAGE_URL@ 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 Recommends: php5-mysql, php5-svn
Suggests: slapd, mysql-server Suggests: slapd, mysql-server
Section: web Section: web

View File

@ -11,6 +11,7 @@ INSTALLATION
Here is how to install Codepot into the standard locations under Ubuntu Linux. Here is how to install Codepot into the standard locations under Ubuntu Linux.
* Install required packages. * Install required packages.
$ sudo apt-get install wget
$ sudo apt-get install subversion $ sudo apt-get install subversion
$ sudo apt-get install apache2-mpm-prefork $ sudo apt-get install apache2-mpm-prefork
$ sudo apt-get install libapache2-svn $ sudo apt-get install libapache2-svn
@ -57,6 +58,8 @@ INSTALLATION
$ sudo hostname ${HOSTNAME} $ sudo hostname ${HOSTNAME}
$ sudo /etc/init.d/apache2 restart $ sudo /etc/init.d/apache2 restart
Note that make-ssl-cert is provided by the ssl-cert package.
LICENSE LICENSE
This software is licensed under the GNU General Public License. This software is licensed under the GNU General Public License.

View File

@ -12,7 +12,8 @@
| |
*/ */
/*$config['base_url'] = "http://example.com"*/ /*$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'])).'/'; $config['base_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/';
/* /*

View File

@ -25,10 +25,10 @@ class File extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('FileModel', 'files'); $this->load->model ('FileModel', 'files');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
@ -43,7 +43,7 @@ class File extends Controller
} }
else else
{ {
$files = $this->files->getAll ($loginid, $project); $files = $this->files->getAll ($login['id'], $project);
if ($files === FALSE) if ($files === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -63,10 +63,10 @@ class File extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('FileModel', 'files'); $this->load->model ('FileModel', 'files');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$name = $this->converter->HexToAscii ($name); $name = $this->converter->HexToAscii ($name);
@ -83,7 +83,7 @@ class File extends Controller
} }
else else
{ {
$file = $this->files->get ($loginid, $project, $name); $file = $this->files->get ($login['id'], $project, $name);
if ($file === FALSE) if ($file === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -108,10 +108,10 @@ class File extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('FileModel', 'files'); $this->load->model ('FileModel', 'files');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$name = $this->converter->HexToAscii ($name); $name = $this->converter->HexToAscii ($name);
@ -128,7 +128,7 @@ class File extends Controller
} }
else else
{ {
$file = $this->files->get ($loginid, $project, $name); $file = $this->files->get ($login['id'], $project, $name);
if ($file === FALSE) if ($file === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -164,9 +164,9 @@ class File extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('FileModel', 'files'); $this->load->model ('FileModel', 'files');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if ($loginid == '') redirect ('main'); if ($login['id'] == '') redirect ('main');
$data['loginid'] = $loginid; $data['login'] = $login;
$name = $this->converter->HexToAscii ($name); $name = $this->converter->HexToAscii ($name);
@ -181,8 +181,8 @@ class File extends Controller
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$this->login->isSysadmin() && else if (!$login['sysadmin?'] &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE) $this->projects->projectHasMember($project->id, $login['id']) === FALSE)
{ {
$data['message'] = "NO PERMISSION - $projectid"; $data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
@ -219,7 +219,7 @@ class File extends Controller
{ {
$file->name = $this->input->post('file_name'); $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['message'] = 'DATABASE ERROR';
$data['file'] = $file; $data['file'] = $file;
@ -277,7 +277,7 @@ class File extends Controller
{ {
$file->md5sum = $md5sum; $file->md5sum = $md5sum;
if ($this->files->create ($loginid, $file) === FALSE) if ($this->files->create ($login['id'], $file) === FALSE)
{ {
unlink (CODEPOT_FILE_DIR . "/{$file->encname}"); unlink (CODEPOT_FILE_DIR . "/{$file->encname}");
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -304,7 +304,7 @@ class File extends Controller
{ {
if ($mode == 'update') if ($mode == 'update')
{ {
$file = $this->files->get ($loginid, $project, $name); $file = $this->files->get ($login['id'], $project, $name);
if ($file === FALSE) if ($file === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -355,9 +355,9 @@ class File extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('FileModel', 'files'); $this->load->model ('FileModel', 'files');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if ($loginid == '') redirect ('main'); if ($login['id'] == '') redirect ('main');
$data['loginid'] = $loginid; $data['login'] = $login;
$name = $this->converter->HexToAscii ($name); $name = $this->converter->HexToAscii ($name);
@ -372,8 +372,8 @@ class File extends Controller
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$this->login->isSysadmin() && else if (!$login['sysadmin?'] &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE) $this->projects->projectHasMember($project->id, $login['id']) === FALSE)
{ {
$data['message'] = "NO PERMISSION - $projectid"; $data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
@ -396,7 +396,7 @@ class File extends Controller
{ {
if ($data['file_confirm'] == 'yes') if ($data['file_confirm'] == 'yes')
{ {
$result = $this->files->delete ($loginid, $file); $result = $this->files->delete ($login['id'], $file);
if ($result === FALSE) if ($result === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -423,7 +423,7 @@ class File extends Controller
} }
else else
{ {
$file = $this->files->get ($loginid, $project, $name); $file = $this->files->get ($login['id'], $project, $name);
if ($file === FALSE) if ($file === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';

View File

@ -24,7 +24,6 @@ class Main extends Controller
$this->form_validation->set_error_delimiters('<span class="form_field_error">','</span>'); $this->form_validation->set_error_delimiters('<span class="form_field_error">','</span>');
$data['message'] = ''; $data['message'] = '';
$data['loginid'] = '';
if($this->input->post('login')) if($this->input->post('login'))
{ {

View File

@ -24,11 +24,11 @@ class Project extends Controller
{ {
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$loginid = $this->login->getUserid(); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) 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->helper ('form');
$this->load->library ('form_validation'); $this->load->library ('form_validation');
$data['loginid'] = $loginid; $data['login'] = $login;
// SET VALIDATION RULES // SET VALIDATION RULES
$this->form_validation->set_rules ( $this->form_validation->set_rules (
@ -92,8 +92,8 @@ class Project extends Controller
// if ok, take action // if ok, take action
$result = ($mode == 'update')? $result = ($mode == 'update')?
$this->projects->update ($loginid, $project): $this->projects->update ($login['id'], $project):
$this->projects->create ($loginid, $project, $api_base_url); $this->projects->create ($login['id'], $project, $api_base_url);
if ($result === FALSE) if ($result === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -132,57 +132,57 @@ class Project extends Controller
{ {
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if ($loginid == '') redirect ('main/signin'); if ($login['id'] == '') redirect ('main/signin');
$project->id = $projectid; $project->id = $projectid;
$project->name = ''; $project->name = '';
$project->summary = ''; $project->summary = '';
$project->description = ''; $project->description = '';
$project->members = $loginid; $project->members = $login['id'];
$this->_edit_project ($project, 'create', $loginid); $this->_edit_project ($project, 'create', $login);
} }
function update ($projectid) function update ($projectid)
{ {
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if ($loginid == '') redirect ('main/signin'); if ($login['id'] == '') redirect ('main/signin');
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$this->login->isSysadmin() && else if (!$login['sysadmin?'] &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE) $this->projects->projectHasMember($project->id, $login['id']) === FALSE)
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = "NO PERMISSION - $projectid"; $data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else 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->helper ('form');
$this->load->library ('form_validation'); $this->load->library ('form_validation');
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = ''; $data['message'] = '';
$this->form_validation->set_rules ('project_confirm', 'confirm', 'alpha'); $this->form_validation->set_rules ('project_confirm', 'confirm', 'alpha');
@ -197,7 +197,7 @@ class Project extends Controller
{ {
if ($data['project_confirm'] == 'yes') if ($data['project_confirm'] == 'yes')
{ {
$result = $this->projects->delete ($loginid, $project); $result = $this->projects->delete ($login['id'], $project);
if ($result === FALSE) if ($result === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -240,32 +240,32 @@ class Project extends Controller
{ {
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if ($loginid == '') redirect ('main/signin'); if ($login['id'] == '') redirect ('main/signin');
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$this->login->isSysadmin() && else if (!$login['sysadmin?'] &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE) $this->projects->projectHasMember($project->id, $login['id']) === FALSE)
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = "NO PERMISSION - $projectid"; $data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
{ {
$this->_delete_project ($project, $loginid); $this->_delete_project ($project, $login);
} }
} }
} }

View File

@ -31,10 +31,10 @@ class Source extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$path = $this->converter->HexToAscii ($path); $path = $this->converter->HexToAscii ($path);
if ($path == '.') $path = ''; /* treat a period specially */ if ($path == '.') $path = ''; /* treat a period specially */
@ -81,10 +81,10 @@ class Source extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$path = $this->converter->HexToAscii ($path); $path = $this->converter->HexToAscii ($path);
@ -150,10 +150,10 @@ class Source extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$path = $this->converter->HexToAscii ($path); $path = $this->converter->HexToAscii ($path);
@ -207,10 +207,10 @@ class Source extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$path = $this->converter->HexToAscii ($path); $path = $this->converter->HexToAscii ($path);
@ -251,10 +251,10 @@ class Source extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$path = $this->converter->HexToAscii ($path); $path = $this->converter->HexToAscii ($path);

View File

@ -26,22 +26,22 @@ class User extends Controller
function home () function home ()
{ {
$loginid = $this->login->getUserid(); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$this->load->model ('ProjectModel', 'projects'); $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) if ($latest_projects === FALSE)
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['latest_projects'] = $latest_projects; $data['latest_projects'] = $latest_projects;
$data['user_name'] = ''; $data['user_name'] = '';
$data['user_pass'] = ''; $data['user_pass'] = '';
@ -51,24 +51,24 @@ class User extends Controller
function projectlist () function projectlist ()
{ {
$loginid = $this->login->getUserid(); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$projects = $this->projects->getMyProjects ($loginid); $projects = $this->projects->getMyProjects ($login['id']);
$other_projects = $this->projects->getOtherProjects ($loginid); $other_projects = $this->projects->getOtherProjects ($login['id']);
if ($projects === FALSE || $other_projects === FALSE) if ($projects === FALSE || $other_projects === FALSE)
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
{ {
$data['loginid'] = $loginid; $data['login'] = $login;
$data['projects'] = $projects; $data['projects'] = $projects;
$data['other_projects'] = $other_projects; $data['other_projects'] = $other_projects;
$this->load->view ($this->VIEW_PROJECT_LIST, $data); $this->load->view ($this->VIEW_PROJECT_LIST, $data);
@ -77,18 +77,40 @@ class User extends Controller
function preference () function preference ()
{ {
$loginid = $this->login->getUserid(); $login = $this->login->getUser();
if ($loginid == '') redirect ('main/signin'); if ($login['id'] == '') redirect ('main/signin');
$this->load->view ( $this->load->view (
$this->VIEW_ERROR, $this->VIEW_ERROR,
array ( array (
'loginid' => $loginid, 'login' => $login,
'message' => 'USER PREFERENCE NOT SUPPORTED YET' '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'
)
);
}
}
} }
?> ?>

View File

@ -27,10 +27,10 @@ class Wiki extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('WikiModel', 'wikis'); $this->load->model ('WikiModel', 'wikis');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
@ -45,7 +45,7 @@ class Wiki extends Controller
} }
else else
{ {
$wikis = $this->wikis->getAll ($loginid, $project); $wikis = $this->wikis->getAll ($login['id'], $project);
if ($wikis === FALSE) if ($wikis === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -65,10 +65,10 @@ class Wiki extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('WikiModel', 'wikis'); $this->load->model ('WikiModel', 'wikis');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '') if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['loginid'] = $loginid; $data['login'] = $login;
$name = $this->converter->HexToAscii ($name); $name = $this->converter->HexToAscii ($name);
@ -95,7 +95,7 @@ class Wiki extends Controller
} }
else else
{ {
$wiki = $this->wikis->get ($loginid, $project, $name); $wiki = $this->wikis->get ($login['id'], $project, $name);
if ($wiki === FALSE) if ($wiki === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -123,9 +123,9 @@ class Wiki extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('WikiModel', 'wikis'); $this->load->model ('WikiModel', 'wikis');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if ($loginid == '') redirect ('main'); if ($login['id'] == '') redirect ('main');
$data['loginid'] = $loginid; $data['login'] = $login;
$name = $this->converter->HexToAscii ($name); $name = $this->converter->HexToAscii ($name);
@ -140,8 +140,8 @@ class Wiki extends Controller
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$this->login->isSysadmin() && else if (!$login['sysadmin?'] &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE) $this->projects->projectHasMember($project->id, $login['id']) === FALSE)
{ {
$data['message'] = "NO PERMISSION - $projectid"; $data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
@ -176,8 +176,8 @@ class Wiki extends Controller
if ($this->form_validation->run()) if ($this->form_validation->run())
{ {
$result = ($mode == 'update')? $result = ($mode == 'update')?
$this->wikis->update ($loginid, $wiki): $this->wikis->update ($login['id'], $wiki):
$this->wikis->create ($loginid, $wiki); $this->wikis->create ($login['id'], $wiki);
if ($result === FALSE) if ($result === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -201,7 +201,7 @@ class Wiki extends Controller
{ {
if ($mode == 'update') if ($mode == 'update')
{ {
$wiki = $this->wikis->get ($loginid, $project, $name); $wiki = $this->wikis->get ($login['id'], $project, $name);
if ($wiki === FALSE) if ($wiki === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -249,9 +249,9 @@ class Wiki extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('WikiModel', 'wikis'); $this->load->model ('WikiModel', 'wikis');
$loginid = $this->login->getUserid (); $login = $this->login->getUser ();
if ($loginid == '') redirect ('main'); if ($login['id'] == '') redirect ('main');
$data['loginid'] = $loginid; $data['login'] = $login;
$name = $this->converter->HexToAscii ($name); $name = $this->converter->HexToAscii ($name);
@ -266,8 +266,8 @@ class Wiki extends Controller
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$this->login->isSysadmin() && else if (!$login['sysadmin?'] &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE) $this->projects->projectHasMember($project->id, $login['id']) === FALSE)
{ {
$data['message'] = "NO PERMISSION - $projectid"; $data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
@ -296,7 +296,7 @@ class Wiki extends Controller
{ {
if ($data['wiki_confirm'] == 'yes') if ($data['wiki_confirm'] == 'yes')
{ {
$result = $this->wikis->delete ($loginid, $wiki); $result = $this->wikis->delete ($login['id'], $wiki);
if ($result === FALSE) if ($result === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -323,7 +323,7 @@ class Wiki extends Controller
} }
else else
{ {
$wiki = $this->wikis->get ($loginid, $project, $name); $wiki = $this->wikis->get ($login['id'], $project, $name);
if ($wiki === FALSE) if ($wiki === FALSE)
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';

View File

@ -39,6 +39,7 @@ $lang['Sign out'] = 'Sign out';
$lang['Size'] = 'Size'; $lang['Size'] = 'Size';
$lang['Source'] = 'Source'; $lang['Source'] = 'Source';
$lang['Summary'] = 'Summary'; $lang['Summary'] = 'Summary';
$lang['System'] = 'System';
$lang['Tag'] = 'Tag'; $lang['Tag'] = 'Tag';
$lang['Text'] = 'Text'; $lang['Text'] = 'Text';
$lang['Time'] = 'Time'; $lang['Time'] = 'Time';

View File

@ -39,6 +39,7 @@ $lang['Sign out'] = 'Keluar';
$lang['Size'] = 'Ukuran'; $lang['Size'] = 'Ukuran';
$lang['Source'] = 'Sumber'; $lang['Source'] = 'Sumber';
$lang['Summary'] = 'Rangkuman'; $lang['Summary'] = 'Rangkuman';
$lang['System'] = 'Sistem';
$lang['Tag'] = 'Label'; $lang['Tag'] = 'Label';
$lang['Text'] = 'Teks'; $lang['Text'] = 'Teks';
$lang['Time'] = 'Waktu'; $lang['Time'] = 'Waktu';

View File

@ -39,6 +39,7 @@ $lang['Sign out'] = '로그아웃';
$lang['Size'] = '크기'; $lang['Size'] = '크기';
$lang['Source'] = '소스'; $lang['Source'] = '소스';
$lang['Summary'] = '요약'; $lang['Summary'] = '요약';
$lang['System'] = '시스템';
$lang['Tag'] = '태그'; $lang['Tag'] = '태그';
$lang['Text'] = '본문'; $lang['Text'] = '본문';
$lang['Time'] = '시간'; $lang['Time'] = '시간';

View File

@ -15,20 +15,28 @@ class LoginModel extends Model
$this->load->library ('session'); $this->load->library ('session');
} }
function isSysadmin () function getUser ()
{
$userid = $this->getUserid ();
if ($userid === NULL) return FALSE;
return $userid == CODEPOT_SYSADMIN_USERID;
}
function getUserid ()
{ {
$server1 = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT']; $server1 = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
$server2 = $this->session->userdata('server'); $server2 = $this->session->userdata('server');
if ($server1 != $server2) return ''; if ($server1 != $server2)
{
$userid = '';
$issysadmin = FALSE;
}
else
{
$userid = $this->session->userdata('userid'); $userid = $this->session->userdata('userid');
return ($userid === NULL)? '': $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) function authenticate ($userid, $password)
@ -37,7 +45,8 @@ class LoginModel extends Model
$this->session->set_userdata ( $this->session->set_userdata (
array ( array (
'userid' => $userid, 'userid' => $userid,
'server' => $server 'server' => $server,
'sysadmin?' => ($userid == CODEPOT_SYSADMIN_USERID)
) )
); );
return TRUE; return TRUE;

View File

@ -23,7 +23,6 @@
$this->load->view ( $this->load->view (
'projectbar', 'projectbar',
array ( array (
'loginid' => $loginid,
'project' => NULL, 'project' => NULL,
'pageid' => '', 'pageid' => '',
'ctxmenuitems' => array () 'ctxmenuitems' => array ()

View File

@ -1,3 +1,4 @@
<div class="footer"> <div class="footer">
Codepot © 2009-2010 Hyung-Hwan Chung Powered by Codepot <?=CODEPOT_VERSION?><br/>
Copyright © 2009-2010 Hyung-Hwan Chung
</div> </div>

View File

@ -28,7 +28,6 @@
$this->load->view ( $this->load->view (
'projectbar', 'projectbar',
array ( array (
'loginid' => $loginid,
'project' => NULL, 'project' => NULL,
'pageid' => '', 'pageid' => '',
'ctxmenuitems' => array () 'ctxmenuitems' => array ()

View File

@ -5,8 +5,8 @@
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/common.css" /> <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/common.css" />
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/project.css" /> <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/project.css" />
<?php <?php
$caption = $this->lang->line('Home'); $caption = $this->lang->line('Projects');
if (isset($loginid) && $loginid != '') $caption .= "({$loginid})"; if ($login['id'] != '') $caption .= "({$login['id']})";
?> ?>
<title><?=htmlspecialchars($caption)?></title> <title><?=htmlspecialchars($caption)?></title>
</head> </head>
@ -25,7 +25,6 @@
$this->load->view ( $this->load->view (
'projectbar', 'projectbar',
array ( array (
'loginid' => $loginid,
'project' => NULL, 'project' => NULL,
'pageid' => '', 'pageid' => '',
'ctxmenuitems' => array ( 'ctxmenuitems' => array (

View File

@ -114,8 +114,8 @@ if ($folder != '')
print '<th>' . $this->lang->line('Size') . '</th>'; print '<th>' . $this->lang->line('Size') . '</th>';
print '<th>' . $this->lang->line('Author') . '</th>'; print '<th>' . $this->lang->line('Author') . '</th>';
print '<th>' . $this->lang->line('Time') . '</th>'; print '<th>' . $this->lang->line('Time') . '</th>';
print '<th>' . '</th>'; print '<th>' . $this->lang->line('Blame') . '</th>';
print '<th>' . '</th>'; print '<th>' . $this->lang->line('Difference') . '</th>';
print '</tr>'; print '</tr>';
$rowclasses = array ('even', 'odd'); $rowclasses = array ('even', 'odd');

View File

@ -1,6 +1,6 @@
<?php <?php
function show_taskbar ($con, $loginid) function show_taskbar ($con, $loginid, $issysadmin)
{ {
print '<div class="taskbar">'; print '<div class="taskbar">';
@ -39,12 +39,14 @@ function show_taskbar ($con, $loginid)
print '<div class="boxa">'; print '<div class="boxa">';
print anchor ('user/home', $con->lang->line('Home')); print anchor ('user/home', $con->lang->line('Home'));
print anchor ('user/projectlist', $con->lang->line('Projects')); print anchor ('user/projectlist', $con->lang->line('Projects'));
if ($issysadmin)
print anchor ('user/admin', $con->lang->line('System'));
print '</div>'; print '</div>';
print '</div>'; print '</div>';
} }
show_taskbar ($this, $loginid); show_taskbar ($this, $login['id'], $login['sysadmin?']);
?> ?>

View File

@ -6,7 +6,7 @@
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/project.css" /> <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/project.css" />
<?php <?php
$caption = $this->lang->line('Home'); $caption = $this->lang->line('Home');
if (isset($loginid) && $loginid != '') $caption .= "({$loginid})"; if ($login['id'] != '') $caption .= "({$login['id']})";
?> ?>
<title><?=htmlspecialchars($caption)?></title> <title><?=htmlspecialchars($caption)?></title>
</head> </head>
@ -25,7 +25,6 @@
$this->load->view ( $this->load->view (
'projectbar', 'projectbar',
array ( array (
'loginid' => $loginid,
'project' => NULL, 'project' => NULL,
'pageid' => '', 'pageid' => '',
'ctxmenuitems' => array () 'ctxmenuitems' => array ()

View File

@ -1,5 +1,6 @@
<?php <?php
define ('CODEPOT_VERSION', '@VERSION@');
define ('CODEPOT_DEPOT_DIR', '@DEPOTDIR@'); define ('CODEPOT_DEPOT_DIR', '@DEPOTDIR@');
define ('CODEPOT_CFG_DIR', '@CFGDIR@'); define ('CODEPOT_CFG_DIR', '@CFGDIR@');
define ('CODEPOT_WWW_DIR', '@WWWDIR@'); define ('CODEPOT_WWW_DIR', '@WWWDIR@');

View File

@ -328,6 +328,7 @@ pre.prettyprint .nocode a:hover {
display:block; display:block;
border: none; border: none;
background: #E5ECF9 none repeat scroll 0 0; background: #E5ECF9 none repeat scroll 0 0;
overflow: auto;
} }
.content .sidebar .boxtitle { .content .sidebar .boxtitle {
@ -375,11 +376,11 @@ pre.prettyprint .nocode a:hover {
} }
.content .footer { .content .footer {
padding: 0.3em 0em 0.3em 0em; padding: 0.3em 0.5em 0.3em 0.5em;
font-size: .9em; font-size: .8em;
font-weight: bold; font-weight: bold;
font-style: italic; font-style: italic;
text-align: center; text-align: right;
color: #FFFFFF; color: #FFFFFF;
background-color: #203150; background-color: #203150;
} }

View File

@ -26,6 +26,87 @@
padding-right: 0.2em; padding-right: 0.2em;
} }
/*-----------------------------------------------
* websvn source blame view
*-----------------------------------------------*/
#websvn_blame_mainarea_result {
overflow: auto;
}
#websvn_blame_mainarea_result_table {
border: 0;
border-collapse: collapse;
vertical-align: top;
}
#websvn_blame_mainarea_result_table tr {
border: 0;
margin: 0;
padding: 0;
white-space: nowrap;
}
#websvn_blame_mainarea_result_table tr td {
margin: 0;
padding: 0;
padding-left: 0.3em;
padding-right: 0.3em;
}
/*-----------------------------------------------
* websvn source revision view
*-----------------------------------------------*/
#websvn_revision_mainarea_result {
overflow: auto;
}
#websvn_revision_mainarea_result_table {
border: 0;
border-collapse: collapse;
vertical-align: top;
}
#websvn_revision_mainarea_result_table tr {
border: 0;
margin: 0;
padding: 0;
white-space: nowrap;
}
#websvn_revision_mainarea_result_table tr td {
margin: 0;
padding: 0;
padding-left: 0.3em;
padding-right: 0.3em;
}
/*-----------------------------------------------
* websvn source log view
*-----------------------------------------------*/
#websvn_log_mainarea_result {
overflow: auto;
}
#websvn_log_mainarea_result_table {
border: 0;
border-collapse: collapse;
vertical-align: top;
}
#websvn_log_mainarea_result_table tr {
border: 0;
margin: 0;
padding: 0;
white-space: nowrap;
}
#websvn_log_mainarea_result_table tr td {
margin: 0;
padding: 0;
padding-left: 0.2em;
padding-right: 0.2em;
}
/*----------------------------------------------- /*-----------------------------------------------
* websvn source diff view * websvn source diff view
*-----------------------------------------------*/ *-----------------------------------------------*/

View File

@ -23,7 +23,7 @@
</div> </div>
</div> </div>
<div class="mainarea"> <div class="mainarea" id="websvn_blame_mainarea">
[websvn-test:noaccess] [websvn-test:noaccess]
[lang:NOACCESS] [lang:NOACCESS]
@ -41,10 +41,10 @@
<span class="log">[websvn:fileviewloglink]</span> <span class="log">[websvn:fileviewloglink]</span>
</div> </div>
<div> <div id="websvn_blame_mainarea_result">
<table> <table id="websvn_blame_mainarea_result_table">
<thead> <thead>
<tr> <tr class="heading">
<th scope="col" class="collno">[lang:LINENO]</th> <th scope="col" class="collno">[lang:LINENO]</th>
<th scope="col" class="colrev">[lang:REV]</th> <th scope="col" class="colrev">[lang:REV]</th>
<th scope="col" class="colauth">[lang:AUTHOR]</th> <th scope="col" class="colauth">[lang:AUTHOR]</th>

View File

@ -27,17 +27,17 @@
[lang:NOACCESS] [lang:NOACCESS]
[websvn-else] [websvn-else]
<div class="mainarea"> <div class="mainarea" id="websvn_log_mainarea">
<div class="title">Log messages</div> <div class="title">Log messages</div>
<div class="menu"> <div class="menu" id="websvn_log_mainarea_menu">
[websvn-test:goyoungestlink] [websvn-test:goyoungestlink]
[websvn:goyoungestlink] [websvn:goyoungestlink]
[websvn-endtest] [websvn-endtest]
</div> <!-- menu --> </div> <!-- menu -->
<div id="filter"> <div id="websvn_log_mainarea_filter">
<!-- <div class="title">[lang:FILTER]</div> --> <!-- <div class="title">[lang:FILTER]</div> -->
[websvn:logsearch_form] [websvn:logsearch_form]
@ -57,7 +57,7 @@
</div> <!-- filter --> </div> <!-- filter -->
<div id="result" style="margin-top: 1em"> <div id="websvn_log_mainarea_result">
[websvn-test:logsearch_nomatches] [websvn-test:logsearch_nomatches]
[lang:NORESULTS] [lang:NORESULTS]
@ -65,9 +65,9 @@
[websvn-test:logsearch_resultsfound] [websvn-test:logsearch_resultsfound]
[websvn:compare_form] [websvn:compare_form]
<table width="100%"> <table id="websvn_log_mainarea_result_table">
<thead> <thead>
<tr> <tr class="heading">
<th>&nbsp;</th> <th>&nbsp;</th>
<th>[lang:REV]</th> <th>[lang:REV]</th>
<th>[lang:LOGMSG]</th> <th>[lang:LOGMSG]</th>
@ -88,9 +88,7 @@
</tr> </tr>
[websvn-endlisting] [websvn-endlisting]
</table> </table>
<p class="submit">
[websvn:compare_submit][websvn:compare_hidden] [websvn:compare_submit][websvn:compare_hidden]
</p>
[websvn:compare_endform] [websvn:compare_endform]
[websvn-endtest] [websvn-endtest]
@ -98,11 +96,15 @@
<p>[lang:NOMORERESULTS]</p> <p>[lang:NOMORERESULTS]</p>
[websvn-endtest] [websvn-endtest]
</div> <!-- result -->
<div id="websvn_log_mainarea_extra">
<p>[websvn:logsearch_moreresultslink]</p> <p>[websvn:logsearch_moreresultslink]</p>
<p>[websvn:pagelinks]</p> <p>[websvn:pagelinks]</p>
<p>[websvn:showalllink]</p> <p>[websvn:showalllink]</p>
</div> <!-- result --> </div>
</div> <!-- mainarea --> </div> <!-- mainarea -->
[websvn-endtest] [websvn-endtest]

View File

@ -27,7 +27,7 @@
[lang:NOACCESS] [lang:NOACCESS]
[websvn-else] [websvn-else]
<div class="mainarea"> <div class="mainarea" id="websvn_revision_mainarea">
<div class="sidebar"> <div class="sidebar">
@ -58,12 +58,15 @@
[websvn-endtest] [websvn-endtest]
</div> <!-- menu --> </div> <!-- menu -->
<div id="wrap"> <div id="websvn_revision_mainarea_result">
<table> <table id="websvn_revision_mainarea_result_table">
<thead> <thead>
<tr align="left" valign="middle"> <tr class="heading">
<th scope="col" class="path" colspan="4">[lang:PATH]</th> <th>[lang:PATH]</th>
<th></th>
<th></th>
<th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -73,22 +76,24 @@
[websvn-test:modified] [websvn-test:modified]
<a href="[websvn:detailurl]" class="modified"> <a href="[websvn:detailurl]" class="modified">
[websvn-endtest] [websvn-endtest]
[websvn-test:added] [websvn-test:added]
<a href="[websvn:detailurl]" class="added"> <a href="[websvn:detailurl]" class="added">
[websvn-endtest] [websvn-endtest]
[websvn-test:deleted] [websvn-test:deleted]
<a href="[websvn:detailurl]" class="deleted"> <a href="[websvn:detailurl]" class="deleted">
[websvn-endtest] [websvn-endtest]
[websvn:file]</a> [websvn:file]</a>
</td> </td>
<td><a href="[websvn:logurl]" title="[lang:VIEWLOG]"><img src="[websvn:locwebsvnhttp]/templates/calm/images/log.png" class="icon" alt="" /></a></td> <td><a href="[websvn:logurl]" title="[lang:VIEWLOG]"><img src="[websvn:locwebsvnhttp]/templates/calm/images/log.png" class="icon" alt="" /></a></td>
<td><a href="[websvn:diffurl]" title="[lang:DIFFPREV]"><img src="[websvn:locwebsvnhttp]/templates/calm/images/diff.png" class="icon" alt="" /></a></td> <td><a href="[websvn:diffurl]" title="[lang:DIFFPREV]"><img src="[websvn:locwebsvnhttp]/templates/calm/images/diff.png" class="icon" alt="" /></a></td>
<td><a href="[websvn:blameurl]" title="[lang:BLAME]"><img src="[websvn:locwebsvnhttp]/templates/calm/images/blame.png" class="icon" alt="" /></a></td> <td><a href="[websvn:blameurl]" title="[lang:BLAME]"><img src="[websvn:locwebsvnhttp]/templates/calm/images/blame.png" class="icon" alt="" /></a></td>
</tr> </tr>
[websvn-endlisting] [websvn-endlisting]
</tbody> </tbody>
</table> </table>
</div> </div>