getDB(), getRootDB()를 autoload 클래스로 변경

- 각각 DB::db(), RootDB::db()임.
This commit is contained in:
2018-03-25 00:07:37 +09:00
parent bb1a496835
commit 9e1aadf486
62 changed files with 258 additions and 269 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
$session = Session::requireLogin();
$db = getRootDB();
$db = RootDB::db();
$userGrade = $session->userGrade;
$session->setReadOnly();
+1 -1
View File
@@ -7,7 +7,7 @@ $session = Session::requireLogin();
$templates = new \League\Plates\Engine('templates');
$db = getRootDB();
$db = RootDB::db();
$notice = $db->queryFirstField('SELECT `NOTICE` FROM `SYSTEM` WHERE `NO`=1');
$userGrade = $session->userGrade;
?>
+1 -1
View File
@@ -23,7 +23,7 @@ $newPw = $_POST['new_pw'];
$response['result'] = false;
$db = getRootDB();
$db = RootDB::db();
$userInfo = $db->update('member',[
'pw'=>$db->sqleval('sha2(concat(salt, %s, salt), 512)', $newPw)
+1 -1
View File
@@ -25,7 +25,7 @@ if(!$pw){
}
//TODO: 탈퇴 처리하되 한달간 유지.
$db = getRootDB();
$db = RootDB::db();
$userInfo = $db->queryFirstRow('SELECT oauth_id, oauth_type, email, delete_after FROM MEMBER '.
'WHERE `no`=%i and pw=sha2(concat(salt, %s, salt), 512)',
+2 -2
View File
@@ -15,7 +15,7 @@ if(!$session->isLoggedIn()) {
// 외부 파라미터
$db = getRootDB();
$db = RootDB::db();
$member = $db->queryFirstRow('SELECT `id`, `name`, `grade`, `picture` FROM `MEMBER` WHERE `NO` = %i', $session->userID);
if(!$member['picture']){
@@ -51,5 +51,5 @@ Json::die([
'name'=>$member['name'],
'grade'=>$grade,
'picture'=>$picture,
'global_salt'=>getGlobalSalt()
'global_salt'=>RootDB::getGlobalSalt()
]);
+2 -2
View File
@@ -28,7 +28,7 @@ $imageType = $size[2];
$availableImageType = array('.jpg'=>IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF);
$db = getRootDB();
$db = RootDB::db();
$member = $db->queryFirstRow('SELECT `ID`, `PICTURE` FROM `MEMBER` WHERE `NO` = %i', $session->userID);
@@ -84,7 +84,7 @@ if(!is_uploaded_file($image['tmp_name'])) {
$response['result'] = false;
} else {
$pic = "{$newPicName}?={$rf}";
getRootDB()->update('MEMBER',[
RootDB::db()->update('MEMBER',[
'PICTURE' => $pic,
'IMGSVR' => 1
], 'NO=%i', $session->userID);
+1 -1
View File
@@ -16,7 +16,7 @@ if(!$session->isLoggedIn()) {
// 외부 파라미터
$respone = [];
$db = getRootDB();
$db = RootDB::db();
$picName = $db->queryFirstField('SELECT picture FROM `MEMBER` WHERE `NO` = %i', $session->userID);
if($picName && strlen($picName) > 11){
+4 -4
View File
@@ -20,7 +20,7 @@ $action = Util::array_get($_POST['action'], '');
$notice = Util::array_get($_POST['notice'], '');
$server = Util::array_get($_POST['server'], '');
$db = getRootDB();
$db = RootDB::db();
$userGrade = $session->userGrade;
session_write_close();
@@ -58,8 +58,8 @@ function doServerModeSet($server, $action, &$response){
file_put_contents($serverPath.'/.htaccess', $htaccess);
} elseif($action == 'reset') {//리셋
//FIXME: reset, reset_full 구현
if(file_exists($serverPath.'/d_setting/conf.php')){
@unlink($serverPath.'/d_setting/conf.php');
if(file_exists($serverPath.'/d_setting/DB.php')){
@unlink($serverPath.'/d_setting/DB.php');
}
$response['installURL'] = $serverDir."/install.php";
@@ -77,7 +77,7 @@ function doAdminPost($action, $notice, $server){
$response['result'] = 'FAIL';
if($action == 'notice') {
getRootDB()->update('SYSTEM', ['NOTICE'=>$notice], 'NO=1');
RootDB::db()->update('SYSTEM', ['NOTICE'=>$notice], 'NO=1');
$response['result'] = 'SUCCESS';
return $response;
}
+2 -2
View File
@@ -11,7 +11,7 @@ $session = Session::requireLogin();
// $_GET['select'] : 정렬선택
$select = $_GET['select'];
$db = getRootDB();
$db = RootDB::db();
$userGrade = $session->userGrade;
if($userGrade < 6) {
Json::die([
@@ -70,7 +70,7 @@ $response['members'] .= '</table>';
$response['count'] = "(0000/{$count})";
$system = getRootDB()->queryFirstRow('SELECT `REG`, `LOGIN` FROM `SYSTEM` WHERE `NO`=1');
$system = RootDB::db()->queryFirstRow('SELECT `REG`, `LOGIN` FROM `SYSTEM` WHERE `NO`=1');
$response['state'] = "가입: {$system['REG']}, 로그인: {$system['LOGIN']}";
+1 -1
View File
@@ -11,7 +11,7 @@ $session = Session::requireLogin();
$select = $_POST['select'];
$no = $_POST['no'];
$db = getRootDB();
$db = RootDB::db();
$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `NO` = %i', $session->userID);
if($member['GRADE'] < 6) {