diff --git a/d_setting/conf.orig.php b/d_setting/conf.orig.php index baa536ab..f9b1674d 100644 --- a/d_setting/conf.orig.php +++ b/d_setting/conf.orig.php @@ -11,6 +11,15 @@ function getGlobalSalt(){ return '_tK_globalSalt_'; } +/** + * 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함 + * + * @return string + */ +function getServerBasepath(){ + return '_tK_serverBasePath_'; +} + /** * DB 객체 생성 * diff --git a/f_install/install.php b/f_install/install.php index ee2b48ea..307013c1 100644 --- a/f_install/install.php +++ b/f_install/install.php @@ -66,6 +66,14 @@ use utilphp\util as util; + +
+ +
+ +
+
+
diff --git a/f_install/j_setup_db.php b/f_install/j_setup_db.php index c6d12c80..c30341cb 100644 --- a/f_install/j_setup_db.php +++ b/f_install/j_setup_db.php @@ -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 ] ); diff --git a/js/install.js b/js/install.js index 3c4f2ddf..70d09e82 100644 --- a/js/install.js +++ b/js/install.js @@ -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();