서버 post를 string으로.
This commit is contained in:
@@ -3,10 +3,10 @@ var serverAdminTemplate = '\
|
|||||||
<tr class="bg0" data-server_name="<%name%>">\
|
<tr class="bg0" data-server_name="<%name%>">\
|
||||||
<th style="color:<%color%>;"><%korName%>(<%name%>)</th>\
|
<th style="color:<%color%>;"><%korName%>(<%name%>)</th>\
|
||||||
<td><%status%></td>\
|
<td><%status%></td>\
|
||||||
<td><input class="with_skin obj_fill" type="button" value="폐쇄" onclick="Entrance_AdminPost(this, 0);"></td>\
|
<td><input class="with_skin obj_fill" type="button" value="폐쇄" onclick="modifyServerStatus(this, \'close\');"></td>\
|
||||||
<td><input class="with_skin obj_fill" type="button" value="오픈" onclick="Entrance_AdminPost(this, 2);"></td>\
|
<td><input class="with_skin obj_fill" type="button" value="오픈" onclick="modifyServerStatus(this, \'open\');"></td>\
|
||||||
<td><input class="with_skin obj_fill" type="button" value="리셋" onclick="Entrance_AdminPost(this, 1);"></td>\
|
<td><input class="with_skin obj_fill" type="button" value="리셋" onclick="modifyServerStatus(this, \'reset\');"></td>\
|
||||||
<td><input class="with_skin obj_fill" type="button" value="하드리셋" onclick="Entrance_AdminPost(this, 3);"></td>\
|
<td><input class="with_skin obj_fill" type="button" value="하드리셋" onclick="modifyServerStatus(this, \'reset_full\');"></td>\
|
||||||
<td><input class="with_skin obj_fill" type="button" value="폐쇄중 로그인" onclick="Entrance_AdminClosedLogin(this);"></td>\
|
<td><input class="with_skin obj_fill" type="button" value="폐쇄중 로그인" onclick="Entrance_AdminClosedLogin(this);"></td>\
|
||||||
<td><input class="with_skin obj_fill" type="button" value="서버119" onclick="Entrance_AdminOpen119(this);"></td>\
|
<td><input class="with_skin obj_fill" type="button" value="서버119" onclick="Entrance_AdminOpen119(this);"></td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
@@ -79,7 +79,7 @@ function Entrance_AdminChangeNotice() {
|
|||||||
Popup_Wait(function() {
|
Popup_Wait(function() {
|
||||||
PostJSON(
|
PostJSON(
|
||||||
HOME+I+ENTRANCE+W+ADMIN+POST, {
|
HOME+I+ENTRANCE+W+ADMIN+POST, {
|
||||||
action: 0,
|
action: 'notice',
|
||||||
notice: notice
|
notice: notice
|
||||||
},
|
},
|
||||||
function(response, textStatus) {
|
function(response, textStatus) {
|
||||||
@@ -94,7 +94,7 @@ function Entrance_AdminChangeNotice() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function Entrance_AdminPost(caller, select) {
|
function modifyServerStatus(caller, action) {
|
||||||
var $caller = $(caller);
|
var $caller = $(caller);
|
||||||
var server = $caller.parents('tr').data('server_name');
|
var server = $caller.parents('tr').data('server_name');
|
||||||
|
|
||||||
@@ -102,14 +102,13 @@ function Entrance_AdminPost(caller, select) {
|
|||||||
Popup_Wait(function() {
|
Popup_Wait(function() {
|
||||||
PostJSON(
|
PostJSON(
|
||||||
HOME+I+ENTRANCE+W+ADMIN+POST, {
|
HOME+I+ENTRANCE+W+ADMIN+POST, {
|
||||||
action: 1,
|
|
||||||
server: server,
|
server: server,
|
||||||
select: select
|
action: action
|
||||||
},
|
},
|
||||||
function(response, textStatus) {
|
function(response, textStatus) {
|
||||||
if(response.result == "SUCCESS") {
|
if(response.result == "SUCCESS") {
|
||||||
Popup_WaitHide();
|
Popup_WaitHide();
|
||||||
if(select == 1) {
|
if(action == 'reset') {
|
||||||
ReplaceFrame(response.installURL);
|
ReplaceFrame(response.installURL);
|
||||||
} else {
|
} else {
|
||||||
Replace(ENTRANCE+PHP);
|
Replace(ENTRANCE+PHP);
|
||||||
|
|||||||
+12
-19
@@ -6,10 +6,9 @@ require_once(ROOT.'/f_config/SESSION.php');
|
|||||||
use utilphp\util as util;
|
use utilphp\util as util;
|
||||||
|
|
||||||
// 외부 파라미터
|
// 외부 파라미터
|
||||||
// $_POST['action'] : 0: 공지, 1: 서버
|
// $_POST['action'] : 'notice', 'open', 'close', 'reset', 'reset_full'
|
||||||
// $_POST['notice'] : 공지
|
// $_POST['notice'] : 공지
|
||||||
// $_POST['server'] : 서버 인덱스
|
// $_POST['server'] : 서버 인덱스
|
||||||
// $_POST['select'] : 0: 폐쇄, 1: 리셋, 2: 오픈
|
|
||||||
|
|
||||||
function escapeIPv4($ip){
|
function escapeIPv4($ip){
|
||||||
return str_replace('.', '\\.', $ip);
|
return str_replace('.', '\\.', $ip);
|
||||||
@@ -18,13 +17,12 @@ function escapeIPv4($ip){
|
|||||||
$action = util::array_get($_POST['action'], '');
|
$action = util::array_get($_POST['action'], '');
|
||||||
$notice = util::array_get($_POST['notice'], '');
|
$notice = util::array_get($_POST['notice'], '');
|
||||||
$server = util::array_get($_POST['server'], '');
|
$server = util::array_get($_POST['server'], '');
|
||||||
$select = util::array_get($_POST['select'], '');
|
|
||||||
|
|
||||||
$db = getRootDB();
|
$db = getRootDB();
|
||||||
|
|
||||||
$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember());
|
$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember());
|
||||||
|
|
||||||
function doServerModeSet($server, $select, &$response){
|
function doServerModeSet($server, $action, &$response){
|
||||||
$serverList = getServerConfigList();
|
$serverList = getServerConfigList();
|
||||||
$settingObj = $serverList[$server][2];
|
$settingObj = $serverList[$server][2];
|
||||||
|
|
||||||
@@ -32,7 +30,7 @@ function doServerModeSet($server, $select, &$response){
|
|||||||
$serverPath = $settingObj->getBasePath();
|
$serverPath = $settingObj->getBasePath();
|
||||||
$realServerPath = realpath(dirname(__FILE__)).W.$serverPath;
|
$realServerPath = realpath(dirname(__FILE__)).W.$serverPath;
|
||||||
|
|
||||||
if($select == 0) { //폐쇄
|
if($action == 'close') { //폐쇄
|
||||||
$templates = new League\Plates\Engine('templates');
|
$templates = new League\Plates\Engine('templates');
|
||||||
|
|
||||||
//TODO: .htaccess가 서버 오픈에도 사용될 수 있으니 별도의 방법이 필요함
|
//TODO: .htaccess가 서버 오픈에도 사용될 수 있으니 별도의 방법이 필요함
|
||||||
@@ -49,21 +47,21 @@ function doServerModeSet($server, $select, &$response){
|
|||||||
$htaccess = $templates->render('block_htaccess',
|
$htaccess = $templates->render('block_htaccess',
|
||||||
['allow_ip' => $allow_ip, 'xforward_allow_ip' => $xforward_allow_ip]);
|
['allow_ip' => $allow_ip, 'xforward_allow_ip' => $xforward_allow_ip]);
|
||||||
file_put_contents($serverPath.'/.htaccess', $htaccess);
|
file_put_contents($serverPath.'/.htaccess', $htaccess);
|
||||||
} elseif($select == 1) {//리셋
|
} elseif($action == 'reset') {//리셋
|
||||||
if(file_exists($serverPath.'/d_setting/conf.php')){
|
if(file_exists($serverPath.'/d_setting/conf.php')){
|
||||||
@unlink($serverPath.'/d_setting/conf.php');
|
@unlink($serverPath.'/d_setting/conf.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$response['installURL'] = $serverDir.W."install.php";
|
$response['installURL'] = $serverDir.W."install.php";
|
||||||
} elseif($select == 2) {//오픈
|
} elseif($action == 'open') {//오픈
|
||||||
if(file_exists($serverPath.'.htaccess')){
|
if(file_exists($serverPath.'/.htaccess')){
|
||||||
@unlink($serverPath.'.htaccess');
|
@unlink($serverPath.'/.htaccess');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function doAdminPost($member, $action, $notice, $server, $select){
|
function doAdminPost($member, $action, $notice, $server){
|
||||||
$response['result'] = 'FAIL';
|
$response['result'] = 'FAIL';
|
||||||
if($member['GRADE'] < 6) {
|
if($member['GRADE'] < 6) {
|
||||||
$response['result'] = 'FAIL';
|
$response['result'] = 'FAIL';
|
||||||
@@ -71,26 +69,21 @@ function doAdminPost($member, $action, $notice, $server, $select){
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action == 0) {
|
if($action == 'notice') {
|
||||||
getRootDB()->update('SYSTEM', ['NOTICE'=>$notice], 'NO=1');
|
getRootDB()->update('SYSTEM', ['NOTICE'=>$notice], 'NO=1');
|
||||||
$response['result'] = 'SUCCESS';
|
$response['result'] = 'SUCCESS';
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action == 1) {
|
if(doServerModeSet($server, $action, $response)){
|
||||||
if(doServerModeSet($server, $select, $response)){
|
$response['result'] = 'SUCCESS';
|
||||||
$response['result'] = 'SUCCESS';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response['result'] = 'FAIL';
|
|
||||||
$response['msg'] = '알 수 없는 명령입니다.';
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = doAdminPost($member, $action, $notice, $server, $select);
|
$response = doAdminPost($member, $action, $notice, $server);
|
||||||
|
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
|
|||||||
Reference in New Issue
Block a user