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@
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

View File

@ -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
@ -57,6 +58,8 @@ INSTALLATION
$ sudo hostname ${HOSTNAME}
$ sudo /etc/init.d/apache2 restart
Note that make-ssl-cert is provided by the ssl-cert package.
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://".$_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'])).'/';
/*

View File

@ -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';

View File

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

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -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'
)
);
}
}
}
?>

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

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

View File

@ -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;

View File

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

View File

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

View File

@ -28,7 +28,6 @@
$this->load->view (
'projectbar',
array (
'loginid' => $loginid,
'project' => NULL,
'pageid' => '',
'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/project.css" />
<?php
$caption = $this->lang->line('Home');
if (isset($loginid) && $loginid != '') $caption .= "({$loginid})";
$caption = $this->lang->line('Projects');
if ($login['id'] != '') $caption .= "({$login['id']})";
?>
<title><?=htmlspecialchars($caption)?></title>
</head>
@ -25,7 +25,6 @@
$this->load->view (
'projectbar',
array (
'loginid' => $loginid,
'project' => NULL,
'pageid' => '',
'ctxmenuitems' => array (

View File

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

View File

@ -1,6 +1,6 @@
<?php
function show_taskbar ($con, $loginid)
function show_taskbar ($con, $loginid, $issysadmin)
{
print '<div class="taskbar">';
@ -39,12 +39,14 @@ function show_taskbar ($con, $loginid)
print '<div class="boxa">';
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 '</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" />
<?php
$caption = $this->lang->line('Home');
if (isset($loginid) && $loginid != '') $caption .= "({$loginid})";
if ($login['id'] != '') $caption .= "({$login['id']})";
?>
<title><?=htmlspecialchars($caption)?></title>
</head>
@ -25,7 +25,6 @@
$this->load->view (
'projectbar',
array (
'loginid' => $loginid,
'project' => NULL,
'pageid' => '',
'ctxmenuitems' => array ()

View File

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

View File

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

View File

@ -26,6 +26,87 @@
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
*-----------------------------------------------*/

View File

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

View File

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

View File

@ -27,7 +27,7 @@
[lang:NOACCESS]
[websvn-else]
<div class="mainarea">
<div class="mainarea" id="websvn_revision_mainarea">
<div class="sidebar">
@ -58,38 +58,43 @@
[websvn-endtest]
</div> <!-- menu -->
<div id="wrap">
<div id="websvn_revision_mainarea_result">
<table>
<thead>
<tr align="left" valign="middle">
<th scope="col" class="path" colspan="4">[lang:PATH]</th>
</tr>
</thead>
<tbody>
[websvn-startlisting]
<tr class="row[websvn:rowparity]">
<td>
[websvn-test:modified]
<a href="[websvn:detailurl]" class="modified">
[websvn-endtest]
[websvn-test:added]
<a href="[websvn:detailurl]" class="added">
[websvn-endtest]
[websvn-test:deleted]
<a href="[websvn:detailurl]" class="deleted">
[websvn-endtest]
<table id="websvn_revision_mainarea_result_table">
<thead>
<tr class="heading">
<th>[lang:PATH]</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
[websvn-startlisting]
<tr class="row[websvn:rowparity]">
<td>
[websvn-test:modified]
<a href="[websvn:detailurl]" class="modified">
[websvn-endtest]
[websvn:file]</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:blameurl]" title="[lang:BLAME]"><img src="[websvn:locwebsvnhttp]/templates/calm/images/blame.png" class="icon" alt="" /></a></td>
</tr>
[websvn-endlisting]
</tbody>
[websvn-test:added]
<a href="[websvn:detailurl]" class="added">
[websvn-endtest]
</table>
[websvn-test:deleted]
<a href="[websvn:detailurl]" class="deleted">
[websvn-endtest]
[websvn:file]</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:blameurl]" title="[lang:BLAME]"><img src="[websvn:locwebsvnhttp]/templates/calm/images/blame.png" class="icon" alt="" /></a></td>
</tr>
[websvn-endlisting]
</tbody>
</table>
</div>