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:
parent
407e889c3a
commit
8a6ed40c03
@ -37,16 +37,24 @@ ldap_password_format = "${password}"
|
||||
;------------------------------------------------------------------------------
|
||||
language = "auto"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; When set to yes, viewing pages require a user to sign in.
|
||||
;------------------------------------------------------------------------------
|
||||
always_require_signin = "no"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Use websvn as a repository browser.
|
||||
;------------------------------------------------------------------------------
|
||||
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
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -26,7 +26,7 @@ class File extends Controller
|
||||
$this->load->model ('FileModel', 'files');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
@ -64,7 +64,7 @@ class File extends Controller
|
||||
$this->load->model ('FileModel', 'files');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
@ -109,7 +109,7 @@ class File extends Controller
|
||||
$this->load->model ('FileModel', 'files');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
|
@ -25,7 +25,7 @@ class Project extends Controller
|
||||
$this->load->model ('ProjectModel', 'projects');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
|
||||
$data['login'] = $login;
|
||||
|
@ -33,7 +33,7 @@ class Source extends Controller
|
||||
$this->load->model ('SubversionModel', 'subversion');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
@ -105,7 +105,7 @@ class Source extends Controller
|
||||
$this->load->model ('SubversionModel', 'subversion');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
@ -164,7 +164,7 @@ class Source extends Controller
|
||||
$this->load->model ('SubversionModel', 'subversion');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
@ -213,7 +213,7 @@ class Source extends Controller
|
||||
$this->load->model ('SubversionModel', 'subversion');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
@ -262,7 +262,7 @@ class Source extends Controller
|
||||
$this->load->model ('SubversionModel', 'subversion');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
|
@ -27,7 +27,7 @@ class User extends Controller
|
||||
function home ()
|
||||
{
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
|
||||
$this->load->model ('SiteModel', 'sites');
|
||||
@ -74,7 +74,7 @@ class User extends Controller
|
||||
function projectlist ()
|
||||
{
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
|
||||
$this->load->model ('ProjectModel', 'projects');
|
||||
|
@ -28,7 +28,7 @@ class Wiki extends Controller
|
||||
$this->load->model ('WikiModel', 'wikis');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
@ -66,7 +66,7 @@ class Wiki extends Controller
|
||||
$this->load->model ('WikiModel', 'wikis');
|
||||
|
||||
$login = $this->login->getUser ();
|
||||
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||
redirect ('main/signin');
|
||||
$data['login'] = $login;
|
||||
|
||||
|
@ -121,7 +121,7 @@ print anchor ("source/history/{$project->id}/{$xpar}", $this->lang->line('Histor
|
||||
if ($fileext == "") $fileext = "html"
|
||||
?>
|
||||
|
||||
<pre class="prettyprint lang-<?=$fileext?>">
|
||||
<pre class="prettyprint lang-<?=$fileext?>" id="project_source_blame_mainarea_result_pre">
|
||||
<?php
|
||||
|
||||
$content = $file['content'];
|
||||
|
@ -184,7 +184,8 @@ $this->load->view (
|
||||
$diffclass = array_key_exists('rev1diffclass', $x)? $x['rev1diffclass']: 'diff';
|
||||
print "<td class='{$diffclass}'>";
|
||||
print "<pre class='prettyprint lang-{$fileext}'>";
|
||||
print htmlspecialchars($x['rev1line']);
|
||||
if ($x['rev1line'] == '') print ' ';
|
||||
else print htmlspecialchars($x['rev1line']);
|
||||
print '</pre>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -200,7 +201,8 @@ $this->load->view (
|
||||
$diffclass = array_key_exists('rev2diffclass', $x)? $x['rev2diffclass']: 'diff';
|
||||
print "<td class='{$diffclass}'>";
|
||||
print "<pre class='prettyprint lang-{$fileext}'>";
|
||||
print htmlspecialchars($x['rev2line']);
|
||||
if ($x['rev2line'] == '') print ' ';
|
||||
else print htmlspecialchars($x['rev2line']);
|
||||
print '</pre>';
|
||||
print '</td>';
|
||||
}
|
||||
|
@ -13,12 +13,15 @@ function load_ini ($file)
|
||||
if (/*$cfg === FALSE*/ $cfg == FALSE) die ("ERROR: cannot parse $file");
|
||||
|
||||
$xcfgs = array (
|
||||
array ('default_banner', 'string', '@PACKAGE@'),
|
||||
array ('default_siteid', 'string', 'default'),
|
||||
array ('default_banner', 'string', '@PACKAGE@'),
|
||||
|
||||
array ('language', 'string', 'auto'),
|
||||
array ('always_require_signin', '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 ('svn_base_url', 'string', 'http://${SERVER_NAME}:${SERVER_PORT}/svn'),
|
||||
|
||||
|
@ -121,6 +121,7 @@ body {
|
||||
margin-top: 0.2em;
|
||||
margin-bottom: 0.2em;
|
||||
font-weight: bold;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.content .mainarea .title a {
|
||||
|
@ -54,6 +54,11 @@
|
||||
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 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@ -93,6 +98,11 @@
|
||||
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 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
@ -39,6 +39,30 @@ define('FCPATH', str_replace(SELF, '', __FILE__));
|
||||
define('BASEPATH', $system_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
|
||||
|
Loading…
Reference in New Issue
Block a user