added the 'https_compulsory' option.

added the 'https_url' option.
renamed 'always_require_signin' to 'signin_compulsory'
fixed the bug of not displaying an empty line properly in source_diff.php
This commit is contained in:
hyung-hwan 2010-02-22 11:58:55 +00:00
parent 407e889c3a
commit 8a6ed40c03
12 changed files with 71 additions and 23 deletions

View File

@ -37,16 +37,24 @@ ldap_password_format = "${password}"
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
language = "auto" language = "auto"
;------------------------------------------------------------------------------
; When set to yes, viewing pages require a user to sign in.
;------------------------------------------------------------------------------
always_require_signin = "no"
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Use websvn as a repository browser. ; Use websvn as a repository browser.
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
enable_websvn = "no" enable_websvn = "no"
;------------------------------------------------------------------------------
; When set to yes, viewing pages require a user to sign in.
;------------------------------------------------------------------------------
singin_compulsory = "no"
;------------------------------------------------------------------------------
; When set to yes, non-http access is diverted to https using
; the base URL specified in https_base_url. api calls are not affected.
; change api_base_url to force https api calls instead.
;------------------------------------------------------------------------------
https_compulsory = "no"
https_url = "https://${SERVER_NAME}${REQUEST_URI}"
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; API base URL ; API base URL
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -26,7 +26,7 @@ class File extends Controller
$this->load->model ('FileModel', 'files'); $this->load->model ('FileModel', 'files');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;
@ -64,7 +64,7 @@ class File extends Controller
$this->load->model ('FileModel', 'files'); $this->load->model ('FileModel', 'files');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;
@ -109,7 +109,7 @@ class File extends Controller
$this->load->model ('FileModel', 'files'); $this->load->model ('FileModel', 'files');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;

View File

@ -25,7 +25,7 @@ class Project extends Controller
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;

View File

@ -33,7 +33,7 @@ class Source extends Controller
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;
@ -105,7 +105,7 @@ class Source extends Controller
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;
@ -164,7 +164,7 @@ class Source extends Controller
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;
@ -213,7 +213,7 @@ class Source extends Controller
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;
@ -262,7 +262,7 @@ class Source extends Controller
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;

View File

@ -27,7 +27,7 @@ class User extends Controller
function home () function home ()
{ {
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$this->load->model ('SiteModel', 'sites'); $this->load->model ('SiteModel', 'sites');
@ -74,7 +74,7 @@ class User extends Controller
function projectlist () function projectlist ()
{ {
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');

View File

@ -28,7 +28,7 @@ class Wiki extends Controller
$this->load->model ('WikiModel', 'wikis'); $this->load->model ('WikiModel', 'wikis');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;
@ -66,7 +66,7 @@ class Wiki extends Controller
$this->load->model ('WikiModel', 'wikis'); $this->load->model ('WikiModel', 'wikis');
$login = $this->login->getUser (); $login = $this->login->getUser ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '') if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin'); redirect ('main/signin');
$data['login'] = $login; $data['login'] = $login;

View File

@ -121,7 +121,7 @@ print anchor ("source/history/{$project->id}/{$xpar}", $this->lang->line('Histor
if ($fileext == "") $fileext = "html" if ($fileext == "") $fileext = "html"
?> ?>
<pre class="prettyprint lang-<?=$fileext?>"> <pre class="prettyprint lang-<?=$fileext?>" id="project_source_blame_mainarea_result_pre">
<?php <?php
$content = $file['content']; $content = $file['content'];

View File

@ -184,7 +184,8 @@ $this->load->view (
$diffclass = array_key_exists('rev1diffclass', $x)? $x['rev1diffclass']: 'diff'; $diffclass = array_key_exists('rev1diffclass', $x)? $x['rev1diffclass']: 'diff';
print "<td class='{$diffclass}'>"; print "<td class='{$diffclass}'>";
print "<pre class='prettyprint lang-{$fileext}'>"; print "<pre class='prettyprint lang-{$fileext}'>";
print htmlspecialchars($x['rev1line']); if ($x['rev1line'] == '') print '&nbsp;';
else print htmlspecialchars($x['rev1line']);
print '</pre>'; print '</pre>';
print '</td>'; print '</td>';
} }
@ -200,7 +201,8 @@ $this->load->view (
$diffclass = array_key_exists('rev2diffclass', $x)? $x['rev2diffclass']: 'diff'; $diffclass = array_key_exists('rev2diffclass', $x)? $x['rev2diffclass']: 'diff';
print "<td class='{$diffclass}'>"; print "<td class='{$diffclass}'>";
print "<pre class='prettyprint lang-{$fileext}'>"; print "<pre class='prettyprint lang-{$fileext}'>";
print htmlspecialchars($x['rev2line']); if ($x['rev2line'] == '') print '&nbsp;';
else print htmlspecialchars($x['rev2line']);
print '</pre>'; print '</pre>';
print '</td>'; print '</td>';
} }

View File

@ -13,12 +13,15 @@ function load_ini ($file)
if (/*$cfg === FALSE*/ $cfg == FALSE) die ("ERROR: cannot parse $file"); if (/*$cfg === FALSE*/ $cfg == FALSE) die ("ERROR: cannot parse $file");
$xcfgs = array ( $xcfgs = array (
array ('default_banner', 'string', '@PACKAGE@'),
array ('default_siteid', 'string', 'default'), array ('default_siteid', 'string', 'default'),
array ('default_banner', 'string', '@PACKAGE@'),
array ('language', 'string', 'auto'), array ('language', 'string', 'auto'),
array ('always_require_signin', 'boolean', FALSE),
array ('enable_websvn', 'boolean', FALSE), array ('enable_websvn', 'boolean', FALSE),
array ('signin_compulsory', 'boolean', FALSE),
array ('https_compulsory', 'boolean', FALSE),
array ('https_url', 'string', 'https://${SERVER_NAME}${REQUEST_URI}'),
array ('api_base_url', 'string', 'http://127.0.0.1'), array ('api_base_url', 'string', 'http://127.0.0.1'),
array ('svn_base_url', 'string', 'http://${SERVER_NAME}:${SERVER_PORT}/svn'), array ('svn_base_url', 'string', 'http://${SERVER_NAME}:${SERVER_PORT}/svn'),

View File

@ -121,6 +121,7 @@ body {
margin-top: 0.2em; margin-top: 0.2em;
margin-bottom: 0.2em; margin-bottom: 0.2em;
font-weight: bold; font-weight: bold;
overflow: auto;
} }
.content .mainarea .title a { .content .mainarea .title a {

View File

@ -54,6 +54,11 @@
position: relative; position: relative;
} }
#project_source_file_mainarea_result_pre {
/* make it the same as font-size of info .title below */
padding-top: 0.8em;
}
#project_source_file_mainarea_result_info { #project_source_file_mainarea_result_info {
position: absolute; position: absolute;
top: 0; top: 0;
@ -93,6 +98,11 @@
position: relative; position: relative;
} }
#project_source_blame_mainarea_result_pre {
/* make it the same as font-size of info .title below */
padding-top: 0.8em;
}
#project_source_blame_mainarea_result_info { #project_source_blame_mainarea_result_info {
position: absolute; position: absolute;
top: 0; top: 0;

View File

@ -39,6 +39,30 @@ define('FCPATH', str_replace(SELF, '', __FILE__));
define('BASEPATH', $system_folder.'/'); define('BASEPATH', $system_folder.'/');
define('APPPATH', $application_folder.'/'); define('APPPATH', $application_folder.'/');
/*
|---------------------------------------------------------------
| COMPULSORY HTTPS
|---------------------------------------------------------------
*/
if (CODEPOT_HTTPS_COMPULSORY)
{
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')
{
/* force https except api calls */
$tail = substr ($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
//$tail = $_SERVER['PATH_INFO'];
if (strncmp ($tail, "/api/", 5) != 0)
{
require_once dirname(__FILE__) . '/codepot/libraries/converter.php';
$converter = new Converter ();
$url = $converter->expand (CODEPOT_HTTPS_URL, $_SERVER);
header("Location: $url");
exit;
}
}
}
/* /*
|--------------------------------------------------------------- |---------------------------------------------------------------
| LOAD THE FRONT CONTROLLER | LOAD THE FRONT CONTROLLER