diff --git a/composer.json b/composer.json index 0b6148b6..b82f2228 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ }, "autoload": { "psr-4": { - "sammo\\": "src" + "sammo\\": "src/sammo", + "kakao\\": "src/kakao" } } diff --git a/d_setting/conf.orig.php b/d_setting/conf.orig.php index cbd9405e..5b047876 100644 --- a/d_setting/conf.orig.php +++ b/d_setting/conf.orig.php @@ -25,7 +25,7 @@ function getServerBasepath(){ /** * DB 객체 생성 * - * @return MeekroDB + * @return \MeekroDB */ function getRootDB(){ $host = '_tK_host_'; @@ -38,7 +38,7 @@ function getRootDB(){ static $uDB = null; if($uDB === null){ - $uDB = new MeekroDB($host,$user,$password,$dbName,$port,$encoding); + $uDB = new \MeekroDB($host,$user,$password,$dbName,$port,$encoding); $uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; } diff --git a/d_setting/conf_kakao.orig.php b/d_setting/conf_kakao.orig.php index 1b3d7324..0a48e25e 100644 --- a/d_setting/conf_kakao.orig.php +++ b/d_setting/conf_kakao.orig.php @@ -1,7 +1,7 @@ connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; $rootDB->throw_exception_on_nonsql_error = false; diff --git a/i_entrance/entrance.php b/i_entrance/entrance.php index 0e771e96..3295a648 100644 --- a/i_entrance/entrance.php +++ b/i_entrance/entrance.php @@ -5,7 +5,7 @@ require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); require_once(ROOT.'/f_config/SESSION.php'); -$templates = new League\Plates\Engine('templates'); +$templates = new \League\Plates\Engine('templates'); $db = getRootDB(); $notice = $db->queryFirstField('SELECT `NOTICE` FROM `SYSTEM` WHERE `NO`=1'); diff --git a/i_entrance/j_server_change_status.php b/i_entrance/j_server_change_status.php index 6e44bf04..395a7e49 100644 --- a/i_entrance/j_server_change_status.php +++ b/i_entrance/j_server_change_status.php @@ -40,7 +40,7 @@ function doServerModeSet($server, $action, &$response){ $realServerPath = realpath(dirname(__FILE__)).'/'.$serverPath; if($action == 'close') { //폐쇄 - $templates = new League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine('templates'); //TODO: .htaccess가 서버 오픈에도 사용될 수 있으니 별도의 방법이 필요함 $allow_ip = util::get_client_ip(false); diff --git a/index.php b/index.php index ba3f8ba1..4188e0ff 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,7 @@ isExists()){ require(ROOT.'/f_config/DB.php'); require(ROOT.'/f_func/class._Session.php'); -require(ROOT.'/d_setting/conf_kakao.php'); + $SESSION = new _SESSION(); +use \kakao\KakaoKey as KakaoKey; if($SESSION->isLoggedIn()){ diff --git a/j_login.php b/j_login.php index 6b1c3eca..9dd76fe0 100644 --- a/j_login.php +++ b/j_login.php @@ -1,4 +1,6 @@ diff --git a/oauth_kakao/j_change_pw.php b/oauth_kakao/j_change_pw.php index e6b99a41..c8af5bfb 100644 --- a/oauth_kakao/j_change_pw.php +++ b/oauth_kakao/j_change_pw.php @@ -1,12 +1,13 @@ isLoggedIn()){ diff --git a/oauth_kakao/oauth.php b/oauth_kakao/oauth.php index aa509da5..ac3e580a 100644 --- a/oauth_kakao/oauth.php +++ b/oauth_kakao/oauth.php @@ -1,10 +1,11 @@ REST_KEY; - $params['redirect_uri'] = $this->REDIRECT_URI; - $params['code'] = $this->AUTHORIZATION_CODE; - $this->create_or_refresh_access_token($params); -*/ - -/* - // refresh token으로 access token 얻기 - $params = array(); - $params['grant_type'] = 'refresh_token'; - $params['client_id'] = $this->REST_KEY; - $params['refresh_token'] = $this->REFRESH_TOKEN; - echo $this->create_or_refresh_access_token($params); -*/ - -/* - // 앱 사용자 정보 요청 (signup 후에 사용 가능) - echo $this->me(); -*/ - -/* - // 앱 연결 - echo $this->signup(); -*/ - -/* - // 앱 탈퇴 (unlink를 하면 access/refresh token이 삭제됩니다.) - //echo $this->unlink(); -*/ - -/* - // 앱 로그아웃 (로그아웃을 하면 access/refresh token이 삭제됩니다.) - echo $this->logout(); -*/ - -/* - // 앱 사용자 정보 업데이트 - $params = array(); - $params['properties'] = '{"nickname":"test11"}'; - echo $this->updateProfile($params); - echo $this->me(); -*/ - -/* - // 앱 사용자 리스트 요청 (파라미터) - // 테스트하시려면 admin key 지정해야 합니다. - echo $this->user_ids(); -*/ - - } - - /* - * 카카오스토리 API 테스트 - */ - public function test_story_api() - { - -/* - // 스토리 프로파일 요청 - echo $this->story_profile(); -*/ - -/* - // 스토리 유저인지 확인 - //echo $this->isstoryuser(); -*/ - -/* - $story_common_params = array(); - - // 글 포스팅이면 필수 - $story_common_params['content'] = '더 나은 세상을 꿈꾸고 그것을 현실로 만드는 이를 위하여 카카오에서 앱 개발 플랫폼 서비스를 시작합니다.'; - - // 스토리 포스팅 공통 파라미터. 필요한 것만 선택하여 사용. - //$story_common_params['permission'] = 'A'; // A : 전체공개, F: 친구에게만 공개, M: 나만보기 - //$story_common_params['enable_share'] = 'true'; // 공개 기능 허용 여부 - //$story_common_params['android_exec_param'] = 'cafe_id=1234'; // 앱 이동시 추가 파라미터 - //$story_common_params['ios_exec_param'] = 'cafe_id=1234'; - //$story_common_params['android_market_param'] = 'cafe_id=1234'; - //$story_common_params['ios_market_param'] = 'cafe_id=1234'; - - //$res = $helper->post_note($story_common_params); - //echo $res; - //$obj = json_decode($res); - //this->delete_mystory($obj->id); // 포스팅된 스토리 삭제. -*/ - -/* - // 스토리 포스팅 공통 파라미터. 필요한 것만 선택하여 사용. - $story_common_params = array(); - //$story_common_params['content'] = '더 나은 세상을 꿈꾸고 그것을 현실로 만드는 이를 위하여 카카오에서 앱 개발 플랫폼 서비스를 시작합니다.'; - //$story_common_params['permission'] = 'A'; // A : 전체공개, F: 친구에게만 공개, M: 나만보기 - //$story_common_params['enable_share'] = 'true'; // 공개 기능 허용 여부 - //$story_common_params['android_exec_param'] = 'cafe_id=1234'; // 앱 이동시 추가 파라미터 - //$story_common_params['ios_exec_param'] = 'cafe_id=1234'; - //$story_common_params['android_market_param'] = 'cafe_id=1234'; - //$story_common_params['ios_market_param'] = 'cafe_id=1234'; - - // 링크 포스팅 - $test_site_url = 'https://developers.kakao.com'; - $res = $this->post_link($test_site_url, $story_common_params); - echo $res; - $obj = json_decode($res); - //$this->delete_mystory($obj->id); // 포스팅된 테스트 스토리 삭제. -*/ - -/* - // 스토리 포스팅 공통 파라미터. 필요한 것만 선택하여 사용. - $story_common_params = array(); - $story_common_params['content'] = '더 나은 세상을 꿈꾸고 그것을 현실로 만드는 이를 위하여 카카오에서 앱 개발 플랫폼 서비스를 시작합니다.'; - //$story_common_params['permission'] = 'A'; // A : 전체공개, F: 친구에게만 공개, M: 나만보기 - //$story_common_params['enable_share'] = 'true'; // 공개 기능 허용 여부 - //$story_common_params['android_exec_param'] = 'cafe_id=1234'; // 앱 이동시 추가 파라미터 - //$story_common_params['ios_exec_param'] = 'cafe_id=1234'; - //$story_common_params['android_market_param'] = 'cafe_id=1234'; - //$story_common_params['ios_market_param'] = 'cafe_id=1234'; - - // 사진 포스팅 (최대 10개까지 가능) - $file_params = array( - 'file[0]'=>"@/Users/tom/sample1.png", - 'file[1]'=>"@/Users/tom/sample2.png" - ); - - // PHP 5 >= 5.5.0 - $file_params = array( - 'file[0]'=>new CurlFile('/Users/tom/sample1.png','image/png','sample1'), - 'file[1]'=>new CurlFile('/Users/tom/sample2.png','image/png','sample2') - ); - - $res = $this->post_photo($file_params, $story_common_params); - echo $res; - $obj = json_decode($res); - $this->delete_mystory($obj->id); // 포스팅된 테스트 스토리 삭제. -*/ - -/* - $test_mystory_id = '_cDLHO.GBNzGysmIZ9'; - - // 복수개의 내스토리 정보 요청 - echo $this->get_mystories(); - - // 복수개의 내스토리 정보 요청 (특정 아이디 부터) - echo $this->get_mystories($test_mystory_id); - - // 내스토리 정보 요청 - echo $this->get_mystory($test_mystory_id); // 포스팅된 테스트 스토리 삭제. -*/ - - } - - /* - * 카카오톡 API 테스트 - */ - public function test_talk_api() - { - // 카카오톡 프로필 요청 - //echo $this->talk_profile(); - } - - /* - * 푸시 알림 API 테스트 - */ - public function test_push_notification_api() - { - // 파라미터 설명 - // @param uuid 사용자의 고유 ID. 1~(2^63 -1), 숫자만 가능 - // @param push_type gcm or apns - // @param push_token apns(64자) or GCM으로부터 발급받은 push token - // @param uuids 기기의 고유한 ID 리스트 (최대 100개까지 가능) - - // 푸시 알림 관련 API를 테스트하시려면 admin key 지정해야 합니다. - -/* - // 푸시 등록 - $params = array( - "uuid" => "10000", - "push_type" => "gcm", - "push_token" => "xxxxxxxxxx", - "device_id" => "" - ); - $this->register_push($params); -*/ - -/* - // 푸시 토큰 조회 - $param = array("uuid" => "10000"); - $this->get_push_tokens($param); -*/ - -/* - // 푸시 해제 - $params = array( - "uuid" => "10000", - "push_type" => "gcm", - "push_token" => "xxxxxxxxxx" - ); - $this->deregister_push($params); -*/ - -/* - // 푸시 보내기 - $param = array("uuids" => "[\"1\",\"2\", \"3\"]"); - $this->sendPush($param); -*/ - } } \ No newline at end of file diff --git a/src/Json.php b/src/sammo/Json.php similarity index 100% rename from src/Json.php rename to src/sammo/Json.php diff --git a/src/Lock.php b/src/sammo/Lock.php similarity index 100% rename from src/Lock.php rename to src/sammo/Lock.php diff --git a/src/Util.php b/src/sammo/Util.php similarity index 100% rename from src/Util.php rename to src/sammo/Util.php diff --git a/twe/d_setting/conf.orig.php b/twe/d_setting/conf.orig.php index fd3c41c9..2998ac7c 100644 --- a/twe/d_setting/conf.orig.php +++ b/twe/d_setting/conf.orig.php @@ -4,7 +4,7 @@ require_once(__dir__.'/../../d_setting/conf.php'); /** * DB 객체 생성 * - * @return MeekroDB + * @return \MeekroDB */ function getDB(){ $host = '_tK_host_'; @@ -17,7 +17,7 @@ function getDB(){ static $uDB = null; if($uDB === null){ - $uDB = new MeekroDB($host,$user,$password,$dbName,$port,$encoding); + $uDB = new \MeekroDB($host,$user,$password,$dbName,$port,$encoding); $uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; } diff --git a/twe/func_template.php b/twe/func_template.php index 1d41b815..907c56f3 100644 --- a/twe/func_template.php +++ b/twe/func_template.php @@ -77,7 +77,7 @@ function allButton() { $call = "설문조사"; } - $templates = new League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine('templates'); return $templates->render('allButton', [ 'call' => $call, @@ -156,7 +156,7 @@ function commandButton() { function getMapHtml(){ //NOTE: 필요한가? - $templates = new League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine('templates'); return $templates->render('map'); } \ No newline at end of file diff --git a/twe/lib.php b/twe/lib.php index 2c318d2f..2e528bc9 100644 --- a/twe/lib.php +++ b/twe/lib.php @@ -12,9 +12,6 @@ class Autoloader public static function register() { spl_autoload_register(function ($class) { - if(util::starts_with($class, 'sammo\\')){ - $class = substr($class, strlen('sammo\\')); - } $file = __DIR__.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; if (file_exists($file)) { require $file; diff --git a/twe/process_war.php b/twe/process_war.php index b6480905..de66b977 100644 --- a/twe/process_war.php +++ b/twe/process_war.php @@ -4,7 +4,7 @@ namespace sammo; function processWar($connect, $general, $city) { - $templates = new League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine('templates'); global $_maximumatmos, $_maximumtrain, $_dexLimit; $date = substr($general['turntime'],11,5); diff --git a/twe/GameConst.php b/twe/sammo/GameConst.php similarity index 100% rename from twe/GameConst.php rename to twe/sammo/GameConst.php diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index f7cfd367..2bf16400 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,7 +6,8 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'sammo\\' => array($baseDir . '/src'), + 'sammo\\' => array($baseDir . '/src/sammo'), + 'kakao\\' => array($baseDir . '/src/kakao'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index d825715a..b40101ea 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -17,6 +17,10 @@ class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a array ( 'sammo\\' => 6, ), + 'k' => + array ( + 'kakao\\' => 6, + ), 'P' => array ( 'Psr\\Log\\' => 8, @@ -42,7 +46,11 @@ class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a public static $prefixDirsPsr4 = array ( 'sammo\\' => array ( - 0 => __DIR__ . '/../..' . '/src', + 0 => __DIR__ . '/../..' . '/src/sammo', + ), + 'kakao\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/kakao', ), 'Psr\\Log\\' => array (