아이콘, 게임 이미지 경로를 일괄 지정 가능하도록 변경
This commit is contained in:
+32
-14
@@ -31,56 +31,74 @@ require(__dir__.'/../vendor/autoload.php');
|
||||
<div class="card-body">
|
||||
<form id="db_form" method="post" action="#">
|
||||
<div class="form-group row">
|
||||
<label for="db_host" class="col-sm-3 col-form-label">DB호스트</label>
|
||||
<div class="col-sm-9">
|
||||
<label for="db_host" class="col-sm-4 col-form-label">DB호스트</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="db_host" id="db_host"
|
||||
placeholder="호스트" value="localhost" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="db_port" class="col-sm-3 col-form-label">DB포트</label>
|
||||
<div class="col-sm-9">
|
||||
<label for="db_port" class="col-sm-4 col-form-label">DB포트</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="db_port" id="db_port"
|
||||
placeholder="접속 포트" value="3306" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="db_id" class="col-sm-3 col-form-label">DB계정명</label>
|
||||
<div class="col-sm-9">
|
||||
<label for="db_id" class="col-sm-4 col-form-label">DB계정명</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="db_id" id="db_id" placeholder="DB계정"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="db_pw" class="col-sm-3 col-form-label">DB비밀번호</label>
|
||||
<div class="col-sm-9">
|
||||
<label for="db_pw" class="col-sm-4 col-form-label">DB비밀번호</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="password" class="form-control" name="db_pw" id="db_pw"
|
||||
placeholder="DB비밀번호"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="db_name" class="col-sm-3 col-form-label">DB명</label>
|
||||
<div class="col-sm-9">
|
||||
<label for="db_name" class="col-sm-4 col-form-label">DB명</label>
|
||||
<div class="col-sm-8">
|
||||
<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">
|
||||
<label for="serv_host" class="col-sm-4 col-form-label">접속 경로</label>
|
||||
<div class="col-sm-8">
|
||||
<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">
|
||||
<label for="shared_icon_path" class="col-sm-4 col-form-label">공용 아이콘 주소</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="shared_icon_path" id="shared_icon_path"
|
||||
placeholder="공용 아이콘 주소(웹 주소, 또는 접속 경로에 따른 상대 주소)"
|
||||
value="image/icons" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="game_image_path" class="col-sm-4 col-form-label">게임 이미지 주소</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="game_image_path" id="game_image_path"
|
||||
placeholder="게임 이미지 주소(웹 주소, 또는 접속 경로에 따른 상대 주소)"
|
||||
value="image/game" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-4"></div>
|
||||
<div class="col-sm-8">
|
||||
<button type="submit"
|
||||
class="btn btn-primary btn-lg btn-block login-button">설정 파일 생성</button>
|
||||
</div>
|
||||
|
||||
@@ -9,8 +9,10 @@ $username = Util::getReq('db_id');
|
||||
$password = Util::getReq('db_pw');
|
||||
$dbName = Util::getReq('db_name');
|
||||
$servHost = Util::getReq('serv_host');
|
||||
$sharedIconPath = Util::getReq('shared_icon_path');
|
||||
$gameImagePath = Util::getReq('game_image_path');
|
||||
|
||||
if(!$host || !$port || !$username || !$password || !$dbName || !$servHost){
|
||||
if(!$host || !$port || !$username || !$password || !$dbName || !$servHost || !$sharedIconPath || !$gameImagePath){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'입력 값이 올바르지 않습니다'
|
||||
@@ -39,10 +41,10 @@ if(class_exists('\\sammo\\RootDB')){
|
||||
}
|
||||
|
||||
//파일 권한 검사
|
||||
if(file_exists(ROOT.'/d_pic') && !is_dir(ROOT.'/d_pic')){
|
||||
if(file_exists(AppConf::getUserIconPathFS()) && !is_dir(AppConf::getUserIconPathFS())){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'d_pic 이 디렉토리가 아닙니다'
|
||||
'reason'=>AppConf::$userIconPath.' 이 디렉토리가 아닙니다'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -60,10 +62,10 @@ if(!file_exists(ROOT.'/d_setting')){
|
||||
]);
|
||||
}
|
||||
|
||||
if(!is_writable(ROOT.'/d_pic')){
|
||||
if(!is_writable(AppConf::getUserIconPathFS())){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'d_pic 디렉토리의 쓰기 권한이 없습니다'
|
||||
'reason'=>AppConf::$userIconPath.' 디렉토리의 쓰기 권한이 없습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -82,8 +84,8 @@ if(!is_writable(ROOT.'/d_setting')){
|
||||
}
|
||||
|
||||
//기본 파일 생성
|
||||
if(!file_exists(ROOT.'/d_pic')){
|
||||
mkdir(ROOT.'/d_pic');
|
||||
if(!file_exists(AppConf::getUserIconPathFS())){
|
||||
mkdir(AppConf::getUserIconPathFS());
|
||||
}
|
||||
|
||||
if(!file_exists(ROOT.'/d_log')){
|
||||
@@ -140,6 +142,22 @@ $rootDB->insert('system', array(
|
||||
|
||||
$globalSalt = bin2hex(random_bytes(16));
|
||||
|
||||
$result = Util::generateFileUsingSimpleTemplate(
|
||||
ROOT.'/d_setting/ServConfig.orig.php',
|
||||
ROOT.'/d_setting/ServConfig.php',[
|
||||
'serverBasePath'=>$servHost,
|
||||
'sharedIconPath'=>$sharedIconPath,
|
||||
'gameImagePath'=>$gameImagePath
|
||||
]
|
||||
, true);
|
||||
|
||||
if($result !== true){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>$result
|
||||
]);
|
||||
}
|
||||
|
||||
$result = Util::generateFileUsingSimpleTemplate(
|
||||
ROOT.'/d_setting/RootDB.orig.php',
|
||||
ROOT.'/d_setting/RootDB.php',[
|
||||
@@ -149,9 +167,8 @@ $result = Util::generateFileUsingSimpleTemplate(
|
||||
'dbName'=>$dbName,
|
||||
'port'=>$port,
|
||||
'globalSalt'=>$globalSalt,
|
||||
'serverBasePath'=>$servHost
|
||||
]
|
||||
);
|
||||
);
|
||||
|
||||
if($result !== true){
|
||||
Json::die([
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
DROP TABLE IF EXISTS `system`;
|
||||
DROP TABLE IF EXISTS `member`;
|
||||
DROP TABLE IF EXISTS `member_log`;
|
||||
DROP TABLE IF EXISTS `auth_kakao`;
|
||||
|
||||
-- 시스템 테이블
|
||||
-- TODO:장기적으로는 key-value(json) storage 형태로 바꾸는게 나을 듯.
|
||||
@@ -15,7 +14,7 @@ CREATE TABLE `system` (
|
||||
`MDF_DATE` DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`NO`)
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=UTF8;
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 회원 테이블
|
||||
CREATE TABLE `member` (
|
||||
@@ -41,7 +40,7 @@ CREATE TABLE `member` (
|
||||
UNIQUE INDEX `kauth_id` (`oauth_id`),
|
||||
INDEX `delete_after` (`delete_after`)
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=UTF8;
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 로그인 로그 테이블
|
||||
CREATE TABLE `member_log` (
|
||||
@@ -54,4 +53,4 @@ CREATE TABLE `member_log` (
|
||||
INDEX `action` (`member_no`, `action_type`, `date`),
|
||||
INDEX `member` (`member_no`, `date`)
|
||||
)
|
||||
ENGINE=MyISAM DEFAULT CHARSET=UTF8;
|
||||
ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||
Reference in New Issue
Block a user