forked from devsam/core
autoload 경로 재 변경
kakao를 별도의 namespace로 분리 외부 class의 namespace 문제 해결
This commit is contained in:
+2
-1
@@ -18,7 +18,8 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"sammo\\": "src"
|
||||
"sammo\\": "src/sammo",
|
||||
"kakao\\": "src/kakao"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
namespace kakao;
|
||||
require(__dir__.'/../vendor/autoload.php');
|
||||
|
||||
namespace sammo;
|
||||
class KakaoKey{
|
||||
const REST_KEY = '_tK_REST_API_KEY_';
|
||||
const ADMIN_KEY = '_tK_ADMIN_KEY_';
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ function getmicrotime() {
|
||||
return $microtimestmp[0] + $microtimestmp[1];
|
||||
}
|
||||
|
||||
function logErrorByCustomHandler(int $errno , string $errstr, string $errfile, int $errline, array $errcontext){
|
||||
function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext){
|
||||
if (!(error_reporting() & $errno)) {
|
||||
// This error code is not included in error_reporting, so let it fall
|
||||
// through to the standard PHP error handler
|
||||
@@ -36,7 +36,7 @@ function logErrorByCustomHandler(int $errno , string $errstr, string $errfile, i
|
||||
/* Don't execute PHP internal error handler */
|
||||
return true;
|
||||
}
|
||||
set_error_handler("logErrorByCustomHandler");
|
||||
set_error_handler("\sammo\logErrorByCustomHandler");
|
||||
|
||||
function Error($msg) {
|
||||
AppendToFile(ROOT.'/d_log/err.txt', $msg."\n");
|
||||
|
||||
@@ -118,7 +118,7 @@ if(!file_exists(ROOT.'/d_setting/.htaccess')){
|
||||
|
||||
//DB 접근 권한 검사
|
||||
|
||||
$rootDB = new MeekroDB($host,$username,$password,$dbName,$port,'utf8');
|
||||
$rootDB = new \MeekroDB($host,$username,$password,$dbName,$port,'utf8');
|
||||
$rootDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
|
||||
|
||||
$rootDB->throw_exception_on_nonsql_error = false;
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require('d_setting/conf_kakao.php');
|
||||
require('_common.php');
|
||||
require(ROOT.'/f_config/SETTING.php');
|
||||
|
||||
@@ -11,10 +12,11 @@ if(!$SETTING->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()){
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require_once('_common.php');
|
||||
require_once(ROOT.'/f_func/class._Session.php');
|
||||
require_once(ROOT.'/f_func/class._String.php');
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
namespace sammo;
|
||||
|
||||
require(__DIR__.'/../d_setting/conf_kakao.php');
|
||||
use \kakao\KakaoKey as KakaoKey;
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require(__DIR__.'/../d_setting/conf_kakao.php');
|
||||
require('_common.php');
|
||||
require(ROOT.'/f_func/class._Session.php');
|
||||
require(ROOT.'/f_config/DB.php');
|
||||
require(ROOT.'/f_func/class._Time.php');
|
||||
require('kakao.php');
|
||||
|
||||
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
$nowDate = _Time::DatetimeNow();
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require(__DIR__.'/../d_setting/conf_kakao.php');
|
||||
require_once('_common.php');
|
||||
require('lib.join.php');
|
||||
require_once(ROOT.'/f_func/class._Time.php');
|
||||
require('kakao.php');
|
||||
|
||||
|
||||
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
session_start();
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require(__DIR__.'/../d_setting/conf_kakao.php');
|
||||
require('_common.php');
|
||||
require(ROOT.'/f_func/class._Session.php');
|
||||
require(ROOT.'/f_config/DB.php');
|
||||
require(ROOT.'/f_func/class._Time.php');
|
||||
require('kakao.php');
|
||||
|
||||
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
$SESSION = new _Session();
|
||||
if($SESSION->isLoggedIn()){
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require(__DIR__.'/../d_setting/conf_kakao.php');
|
||||
require('_common.php');
|
||||
require(ROOT.'/f_func/class._Time.php');
|
||||
require('kakao.php');
|
||||
|
||||
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
$auth_code = util::array_get($_GET['code']);
|
||||
if(!$auth_code){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace kakao;
|
||||
|
||||
if ((@include(__DIR__.'/../d_setting/conf_kakao.php')) === false) {
|
||||
if (class_exists('KakaoKey') === false) {
|
||||
class KakaoKey{
|
||||
const REST_KEY = '';
|
||||
const ADMIN_KEY = '';
|
||||
@@ -255,220 +256,4 @@ class Kakao_REST_API_Helper
|
||||
private $REDIRECT_URI = KakaoKey::REDIRECT_URI; // 설정에 등록한 사이트 도메인 + redirect uri
|
||||
private $AUTHORIZATION_CODE = ''; // 동의를 한 후 발급되는 code
|
||||
private $REFRESH_TOKEN = '';
|
||||
|
||||
/*
|
||||
* 유저 관리 API 테스트
|
||||
*/
|
||||
public function test_user_management_api()
|
||||
{
|
||||
|
||||
/*
|
||||
// authorization code로 access token 얻기
|
||||
$params = array();
|
||||
$params['grant_type'] = 'authorization_code';
|
||||
$params['client_id'] = $this->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);
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Vendored
+2
-1
@@ -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'),
|
||||
|
||||
Vendored
+9
-1
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user