diff --git a/i_entrance/j_get_userlist.php b/i_entrance/j_get_userlist.php new file mode 100644 index 00000000..4a636334 --- /dev/null +++ b/i_entrance/j_get_userlist.php @@ -0,0 +1,41 @@ +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){ + +} \ No newline at end of file diff --git a/i_entrance/j_icon_change.php b/i_entrance/j_icon_change.php index bedb2c2e..60782b2a 100644 --- a/i_entrance/j_icon_change.php +++ b/i_entrance/j_icon_change.php @@ -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; } } diff --git a/i_entrance/j_icon_delete.php b/i_entrance/j_icon_delete.php index f86a2079..7dce5e36 100644 --- a/i_entrance/j_icon_delete.php +++ b/i_entrance/j_icon_delete.php @@ -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; } } diff --git a/i_entrance/j_server_change_status.php b/i_entrance/j_server_change_status.php index e0541bdf..13b5f2a5 100644 --- a/i_entrance/j_server_change_status.php +++ b/i_entrance/j_server_change_status.php @@ -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(); diff --git a/i_entrance/j_server_get_admin_status.php b/i_entrance/j_server_get_admin_status.php index 574ae28c..4636a9b0 100644 --- a/i_entrance/j_server_get_admin_status.php +++ b/i_entrance/j_server_get_admin_status.php @@ -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, diff --git a/i_entrance/j_server_get_status.php b/i_entrance/j_server_get_status.php index ec1f1d76..a2f347f2 100644 --- a/i_entrance/j_server_get_status.php +++ b/i_entrance/j_server_get_status.php @@ -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; diff --git a/src/sammo/AppConf.php b/src/sammo/AppConf.php index 4893987f..874c9f18 100644 --- a/src/sammo/AppConf.php +++ b/src/sammo/AppConf.php @@ -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; diff --git a/src/sammo/Setting.php b/src/sammo/Setting.php index c23ab20e..b905795d 100644 --- a/src/sammo/Setting.php +++ b/src/sammo/Setting.php @@ -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(){