설치시 서버의 기본 경로를 받도록 설정
This commit is contained in:
@@ -11,6 +11,15 @@ function getGlobalSalt(){
|
||||
return '_tK_globalSalt_';
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getServerBasepath(){
|
||||
return '_tK_serverBasePath_';
|
||||
}
|
||||
|
||||
/**
|
||||
* DB 객체 생성
|
||||
*
|
||||
|
||||
@@ -66,6 +66,14 @@ use utilphp\util as util;
|
||||
<input type="text" class="form-control" name="db_name" id="db_name" placeholder="DB명(예:sammo)"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="serv_host" class="col-sm-3 col-form-label">접속 경로</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" name="serv_host" id="serv_host" placeholder="접속경로(예:http://www.example.com)"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-9">
|
||||
|
||||
@@ -25,14 +25,22 @@ $port = util::array_get($_POST['db_port']);
|
||||
$username = util::array_get($_POST['db_id']);
|
||||
$password = util::array_get($_POST['db_pw']);
|
||||
$dbName = util::array_get($_POST['db_name']);
|
||||
$servHost = util::array_get($_POST['serv_host']);
|
||||
|
||||
if(!$host || !$port || !$username || !$password || !$dbName){
|
||||
if(!$host || !$port || !$username || !$password || !$dbName || !$servHost){
|
||||
returnJson([
|
||||
'result'=>false,
|
||||
'reason'=>'입력 값이 올바르지 않습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!filter_var($servHost, FILTER_VALIDATE_URL)){
|
||||
returnJson([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 경로가 올바르지 않습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if(file_exists(ROOT.'/d_setting/conf.php') && is_dir(ROOT.'/d_setting/conf.php')){
|
||||
returnJson([
|
||||
'result'=>false,
|
||||
@@ -141,7 +149,8 @@ $result = generateFileUsingSimpleTemplate(
|
||||
'password'=>$password,
|
||||
'dbName'=>$dbName,
|
||||
'port'=>$port,
|
||||
'globalSalt'=>$globalSalt
|
||||
'globalSalt'=>$globalSalt,
|
||||
'serverBasePath'=>$servHost
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
+8
-3
@@ -43,14 +43,18 @@ function changeInstallMode(){
|
||||
|
||||
$(document).ready( function () {
|
||||
changeInstallMode();
|
||||
|
||||
var parentPathname = location.pathname.split('/').slice(0,-2).join('/');
|
||||
$('#serv_host').val(
|
||||
[location.protocol, '//', location.host, parentPathname].join('')
|
||||
);
|
||||
$('#db_form').validate({
|
||||
rules:{
|
||||
db_host:"required",
|
||||
db_port:"required",
|
||||
db_id:"required",
|
||||
db_pw:"required",
|
||||
db_name:"required"
|
||||
db_name:"required",
|
||||
serv_host:"required"
|
||||
},
|
||||
errorElement: "div",
|
||||
errorPlacement: function ( error, element ) {
|
||||
@@ -85,7 +89,8 @@ $(document).ready( function () {
|
||||
db_port:$('#db_port').val(),
|
||||
db_id:$('#db_id').val(),
|
||||
db_pw:$('#db_pw').val(),
|
||||
db_name:$('#db_name').val()
|
||||
db_name:$('#db_name').val(),
|
||||
serv_host:$('#serv_host').val()
|
||||
}
|
||||
}).then(function(result){
|
||||
var deferred = $.Deferred();
|
||||
|
||||
Reference in New Issue
Block a user