Setting 클래스 변경. 해당 클래스에서 한국어명 등을 모두 관리.
- 해당 클래스를 참조하는 코드들 수정
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require_once('_common.php');
|
||||
|
||||
$session = Session::requireLogin();
|
||||
$db = RootDB::db();
|
||||
|
||||
$session->setReadOnly();
|
||||
|
||||
if($session->userGrade < 6){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다'
|
||||
]);
|
||||
}
|
||||
|
||||
$userList = [];
|
||||
foreach($db->query('SELECT * FROM MEMBER order by `no`') as $member){
|
||||
$userID = $member['NO'];
|
||||
$userName = $member['ID'];
|
||||
$email = $member['EMAIL'];
|
||||
$grade = $member['GRADE'];
|
||||
$blockUntil = $member['BLOCK_DATE'];
|
||||
|
||||
$nickname = $member['NAME'];
|
||||
if($member['IMGSVR']){
|
||||
$icon = RootDB::getServerBasepath().'/'.$member['PICTURE'];
|
||||
}
|
||||
else{
|
||||
$icon = IMAGES.'/'.$member['PICTURE'];
|
||||
}
|
||||
|
||||
$deleteAfter = $member['delete_after'];
|
||||
|
||||
}
|
||||
|
||||
$serverList = [];
|
||||
foreach(AppConf::getList() as $serverName => $setting){
|
||||
|
||||
}
|
||||
@@ -90,9 +90,8 @@ if(!is_uploaded_file($image['tmp_name'])) {
|
||||
|
||||
$servers = [];
|
||||
|
||||
foreach(AppConf::getList() as $key=>$server){
|
||||
$setting = $server[2];
|
||||
if($setting->isExists()){
|
||||
foreach(AppConf::getList() as $key=>$setting){
|
||||
if($setting->isRunning()){
|
||||
$servers[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ if($dt == $rf) {
|
||||
|
||||
$servers = [];
|
||||
|
||||
foreach(AppConf::getList() as $key=>$server){
|
||||
$setting = $server[2];
|
||||
if($setting->isExists()){
|
||||
foreach(AppConf::getList() as $key=>$setting){
|
||||
|
||||
if($setting->isRunning()){
|
||||
$servers[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ if($userGrade < 6) {
|
||||
|
||||
function doServerModeSet($server, $action, &$response){
|
||||
$serverList = AppConf::getList();
|
||||
$settingObj = $serverList[$server][2];
|
||||
$settingObj = $serverList[$server];
|
||||
|
||||
$serverDir = $settingObj->getShortName();
|
||||
$serverPath = $settingObj->getBasePath();
|
||||
|
||||
@@ -10,8 +10,9 @@ $result = [];
|
||||
|
||||
session_write_close();
|
||||
|
||||
foreach (AppConf::getList() as $server) {
|
||||
list($serverKorName, $serverColor, $setting) = $server;
|
||||
foreach (AppConf::getList() as $setting) {
|
||||
$serverColor = $setting->getColor();
|
||||
$serverKorname = $setting->getKorName();
|
||||
|
||||
$serverPath = $setting->getBasePath();
|
||||
$serverDir = $setting->getShortName();
|
||||
@@ -34,7 +35,7 @@ foreach (AppConf::getList() as $server) {
|
||||
'run'=>false,
|
||||
'reason'=>'설정 파일 없음'
|
||||
];
|
||||
} elseif (file_exists($serverPath.'/.htaccess')) {
|
||||
} elseif (!$setting->isRunning()) {
|
||||
// 폐쇄중
|
||||
$state = [
|
||||
'valid'=>true,
|
||||
|
||||
@@ -6,14 +6,13 @@ require_once('_common.php');
|
||||
// 외부 파라미터
|
||||
$response['server'] = [];
|
||||
|
||||
foreach(AppConf::getList() as $serverInfo){
|
||||
list($serverKorName, $serverColor, $setting) = $serverInfo;
|
||||
foreach(AppConf::getList() as $setting){
|
||||
|
||||
$serverObj = [
|
||||
'color'=>$serverColor,
|
||||
'korName'=>$serverKorName,
|
||||
'color'=>$setting->getColor(),
|
||||
'korName'=>$setting->getKorName(),
|
||||
'name'=>$setting->getShortName(),
|
||||
'enable'=>$setting->isExists()
|
||||
'enable'=>$setting->isRunning()
|
||||
];
|
||||
|
||||
$response['server'][] = $serverObj;
|
||||
|
||||
+10
-5
@@ -8,14 +8,19 @@ if(!defined('ROOT')){
|
||||
class AppConf{
|
||||
private static $serverList = null;
|
||||
|
||||
/**
|
||||
* 서버 설정 반환
|
||||
*
|
||||
* @return \sammo\Setting[]
|
||||
*/
|
||||
public static function getList(){
|
||||
if(self::$serverList === null){
|
||||
self::$serverList = [
|
||||
'che'=>['체', 'white', new Setting(ROOT.'/che')],
|
||||
'kwe'=>['퀘', 'yellow', new Setting(ROOT.'/kwe')],
|
||||
'pwe'=>['풰', 'orange', new Setting(ROOT.'/pwe')],
|
||||
'twe'=>['퉤', 'magenta', new Setting(ROOT.'/twe')],
|
||||
'hwe'=>['훼', 'red', new Setting(ROOT.'/hwe')]
|
||||
'che'=>new Setting(ROOT.'/che', '체', 'white'),
|
||||
'kwe'=>new Setting(ROOT.'/kwe', '퀘', 'yellow'),
|
||||
'pwe'=>new Setting(ROOT.'/pwe', '풰', 'orange'),
|
||||
'twe'=>new Setting(ROOT.'/twe', '퉤', 'magenta'),
|
||||
'hwe'=>new Setting(ROOT.'/hwe', '훼', 'red')
|
||||
];
|
||||
}
|
||||
return self::$serverList;
|
||||
|
||||
+34
-2
@@ -4,23 +4,55 @@ namespace sammo;
|
||||
class Setting {
|
||||
private $basepath;
|
||||
private $settingFile;
|
||||
private $htaccessFile;
|
||||
private $exist = false;
|
||||
private $running = false;
|
||||
|
||||
public function __construct($basepath = __DIR__.'/../..') {
|
||||
private $shortName;
|
||||
private $korName;
|
||||
private $color;
|
||||
|
||||
public function __construct(string $basepath, string $korName, string $color, string $name=null) {
|
||||
$this->basepath = $basepath;
|
||||
$this->settingFile = realpath($basepath.'/d_setting/DB.php');
|
||||
$this->htaccessFile = realpath($basepath.'/.htaccess');
|
||||
|
||||
$this->korName = $korName;
|
||||
$this->color = $color;
|
||||
if($name){
|
||||
$this->shortName = $name;
|
||||
}
|
||||
else{
|
||||
$this->shortName = basename($this->basepath);
|
||||
}
|
||||
|
||||
if(file_exists($this->settingFile)) {
|
||||
$this->exist = true;
|
||||
|
||||
if(!file_exists($this->htaccessFile)){
|
||||
$this->running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function isRunning(){
|
||||
return $this->running;
|
||||
}
|
||||
|
||||
public function isExists() {
|
||||
return $this->exist;
|
||||
}
|
||||
|
||||
public function getShortName(){
|
||||
return basename($this->basepath);
|
||||
return $this->shortName;
|
||||
}
|
||||
|
||||
public function getColor(){
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
public function getKorName(){
|
||||
return $this->korName;
|
||||
}
|
||||
|
||||
public function getBasePath(){
|
||||
|
||||
Reference in New Issue
Block a user