diff --git a/f_config/config.php b/f_config/config.php
index adab8473..1c40c8f2 100644
--- a/f_config/config.php
+++ b/f_config/config.php
@@ -8,11 +8,6 @@ define('IMAGES', '../../images');
define('ROOT', realpath(__dir__.'/..'));
-function CustomHeader() {
- //xxx: CustomHeader를 제거하기 전까진 유지
- WebUtil::setHeaderNoCache();
-}
-
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
@@ -22,14 +17,9 @@ function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, in
$date = date("Ymd_His");
- file_put_contents(__DIR__.'/../d_log/err_log.txt',"$date, $errno, $errstr, $errfile, $errline\n", FILE_APPEND);
+ file_put_contents(ROOT.'/d_log/err_log.txt',"$date, $errno, $errstr, $errfile, $errline\n", FILE_APPEND);
/* Don't execute PHP internal error handler */
//return true;
}
set_error_handler("\sammo\logErrorByCustomHandler");
-
-function Error($msg) {
- file_put_contents(ROOT.'/d_log/err.txt', $msg."\n", FILE_APPEND);
- exit(1);
-}
diff --git a/f_install/install.php b/f_install/install.php
index 77bfdb9f..05ed12ad 100644
--- a/f_install/install.php
+++ b/f_install/install.php
@@ -3,8 +3,6 @@ namespace sammo;
require(__dir__.'/../vendor/autoload.php');
-
-
?>
@@ -35,14 +33,16 @@ require(__dir__.'/../vendor/autoload.php');
@@ -57,28 +57,32 @@ require(__dir__.'/../vendor/autoload.php');
@@ -94,7 +98,8 @@ require(__dir__.'/../vendor/autoload.php');
@@ -102,21 +107,24 @@ require(__dir__.'/../vendor/autoload.php');
@@ -125,7 +133,8 @@ require(__dir__.'/../vendor/autoload.php');
diff --git a/hwe/error.php b/hwe/error.php
deleted file mode 100644
index 8d3fc79d..00000000
--- a/hwe/error.php
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-에러
-
-
-
-
-
-
-
-
-
diff --git a/hwe/func.php b/hwe/func.php
index d3c5aae9..92447a50 100644
--- a/hwe/func.php
+++ b/hwe/func.php
@@ -1,7 +1,6 @@
addPsr4('sammo\\', __DIR__.'/sammo', true);
+
+$loader->addClassMap((function(){
+ $d_settingMap = [];
+ foreach(glob(__dir__.'/d_setting/*.php') as $filepath){
+ $filename = basename($filepath);
+ if(Util::ends_with($filename, '.orig.php')){
+ continue;
}
+ $classname = explode('.', $filename)[0];
+ $d_settingMap['sammo\\'.$classname] = $filepath;
+ };
+ return $d_settingMap;
+})());
- //trick, 개인용 세팅의 경우 d_setting의 값을 우선시하도록 함.
- spl_autoload_register(function ($class) {
- $class = Util::array_last(explode('\\', $class));
- $file = __DIR__."/d_setting/{$class}.php";
- if (file_exists($file)) {
- require $file;
- return true;
- }
- return false;
- });
-
- $isRegisterd = true;
- spl_autoload_register(function ($class) {
- $file = __DIR__.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
- if (file_exists($file)) {
- require $file;
- return true;
- }
- return false;
- });
-
-
- }
-}
-Autoloader::register();
-
-require(__dir__.'/../vendor/autoload.php');
/******************************************************************************
체섭용 인클루드 파일
@@ -50,8 +27,6 @@ require(__dir__.'/../vendor/autoload.php');
// @header ("P3P : CP=\"ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC\"");
//디버그용 매크로
-define('__OLINE__',__LINE__);
-define('__LINE__',__FILE__." ".__FUNCTION__." ".__LINE__." : ");
ini_set("session.cache_expire", 10080); // minutes
@@ -105,60 +80,78 @@ session_cache_limiter('nocache');//NOTE: 캐시가 가능하도록 설정해야
* Session에 보관된 장수 정보를 제거함.
* _prefix_p_no, _prefix_p_name 두 값임
*/
-function resetSessionGeneralValues(){
+function resetSessionGeneralValues()
+{
Session::Instance()->logoutGame();
}
// MySQL 데이타 베이스에 접근
-function dbConn($isRoot=false) {
- if($isRoot){
+function dbConn($isRoot=false)
+{
+ if ($isRoot) {
return RootDB::db()->get();
}
return DB::db()->get();
}
// 에러 메세지 출력
-function Error($message, $url="") {
- global $setup, $connect, $dir, $config_dir;
- include "error.php";
- if($connect) @MYDB_close($connect);
- exit;
+function Error($message, $url="")
+{
+ if(!$url){
+ $url = $_SERVER['REQUEST_URI'];
+ }
+ WebUtil::setHeaderNoCache();
+ file_put_contents(__dir__."/logs/_db_bug.txt", "{\"url\":$url,\"msg\":\"$message\"}\n", FILE_APPEND);
+
+ $templates = new \League\Plates\Engine('templates');
+
+ die($templates->render('error', [
+ 'message' => $msg
+ ]));
}
// 게시판의 생성유무 검사
-function isTable($connect, $str, $dbname='') {
- if(!$dbname) {
+function isTable($connect, $str, $dbname='')
+{
+ if (!$dbname) {
$f=@file("d_setting/DB.php") or Error("DB.php파일이 없습니다. DB설정을 먼저 하십시요");
- for($i=1;$i<=4;$i++) $f[$i]=str_replace("\n","",$f[$i]);
+ for ($i=1;$i<=4;$i++) {
+ $f[$i]=str_replace("\n", "", $f[$i]);
+ }
$dbname=$f[4];
}
- $result = MYDB_list_tables($dbname, $connect) or Error(__LINE__." : list_table error : ".MYDB_error($connect),"");
+ $result = MYDB_list_tables($dbname, $connect) or Error(__LINE__." : list_table error : ".MYDB_error($connect), "");
$cnt = MYDB_num_rows($result);
- for($i=0; $i < $cnt; $i++) {
+ for ($i=0; $i < $cnt; $i++) {
$tablename = MYDB_fetch_row($result);
- if($str == $tablename[0]) return 1;
+ if ($str == $tablename[0]) {
+ return 1;
+ }
}
return 0;
}
-function MessageBox($str) {
+function MessageBox($str)
+{
echo "";
}
-function PrintElapsedTime() {
+function PrintElapsedTime()
+{
global $_startTime;
$_endTime = round(microtime(true) - $_startTime, 3);
echo "";
}
-function LogText($prefix, $variable){
+function LogText($prefix, $variable)
+{
$fp = fopen('logs/dbg_logs.txt', 'a+');
- if($fp == false){
+ if ($fp == false) {
$directory_name = dirname('logs/dbg_logs.txt');
- if(!is_dir($directory_name)){
+ if (!is_dir($directory_name)) {
mkdir($directory_name);
$fp = fopen('logs/dbg_logs.txt', 'a+');
}
@@ -168,9 +161,9 @@ function LogText($prefix, $variable){
}
-if(isset($_POST) && count($_POST) > 0){
+if (isset($_POST) && count($_POST) > 0) {
LogText($_SERVER['REQUEST_URI'], $_POST);
}
-extract($_POST, EXTR_SKIP);
+extract($_POST, EXTR_SKIP);
//XXX: $_POST를 추출 없이 그냥 쓰는 경우가 많아서 일단 디버깅을 위해 씀!!!! 절대 production 서버에서 사용 금지!
-//todo: $_POST로 제공되는 데이터를 각 페이지마다 분석할것.
\ No newline at end of file
+//todo: $_POST로 제공되는 데이터를 각 페이지마다 분석할것.
diff --git a/hwe/templates/error.php b/hwe/templates/error.php
new file mode 100644
index 00000000..4d35d607
--- /dev/null
+++ b/hwe/templates/error.php
@@ -0,0 +1,32 @@
+
+
+
+
+ 에러
+
+
+
+
+
+
+
서 버 에 러
+
+ 두가지 중 한가지 이유일 수 있습니다.
+ 1. 현재 서버가 처리중입니다. 몇초 후 아래 버튼을 눌러주세요.
+ 2. 오랫동안 이 메세지가 뜰 경우는 서버에 에러가 발생하여 잠시 중단된 상태입니다.
+ 운영자가 처리할 때까지 기다려주세요
+
+
+
+
+
+ =$message?>
+
+
+
+
+
+
+
+
diff --git a/i_entrance/entrance.php b/i_entrance/entrance.php
index 387e0ec9..ea984058 100644
--- a/i_entrance/entrance.php
+++ b/i_entrance/entrance.php
@@ -3,6 +3,7 @@ namespace sammo;
require(__dir__.'/../vendor/autoload.php');
+WebUtil::setHeaderNoCache();
$session = Session::requireLogin()->setReadOnly();
$templates = new \League\Plates\Engine('templates');
diff --git a/i_other/help.php b/i_other/help.php
index 0a6cc481..b6d8566f 100644
--- a/i_other/help.php
+++ b/i_other/help.php
@@ -3,7 +3,7 @@ namespace sammo;
require(__dir__.'/../vendor/autoload.php');
-
+WebUtil::setHeaderNoCache();
$category = Util::array_get($_GET['category'], 0);
//FIXME: 겨우 category 구분을 위해 php를 써야하는가? JavaScript로 바꾸자
$images = IMAGES;
diff --git a/i_other/screenshot.php b/i_other/screenshot.php
index 95fe991e..b820d9c0 100644
--- a/i_other/screenshot.php
+++ b/i_other/screenshot.php
@@ -2,7 +2,7 @@
namespace sammo;
require(__dir__.'/../vendor/autoload.php');
-
+WebUtil::setHeaderNoCache();//FIXME: 이 파일에는 이럴 이유가 없다. javascript 기반으로 바꿔도 충분
$images = IMAGES;
if($sel == 0) $sel = 1;
diff --git a/oauth_kakao/join.php b/oauth_kakao/join.php
index c4792b1e..d5243623 100644
--- a/oauth_kakao/join.php
+++ b/oauth_kakao/join.php
@@ -4,7 +4,7 @@ namespace sammo;
require(__dir__.'/../vendor/autoload.php');
-
+WebUtil::setHeaderNoCache();
$session = Session::Instance()->setReadOnly();
$access_token = $session->access_token;
diff --git a/oauth_kakao/oauth.php b/oauth_kakao/oauth.php
index 38b1f1b9..1775d1a3 100644
--- a/oauth_kakao/oauth.php
+++ b/oauth_kakao/oauth.php
@@ -5,6 +5,8 @@ require(__dir__.'/../vendor/autoload.php');
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
+WebUtil::setHeaderNoCache();
+
$auth_code = Util::array_get($_GET['code']);
if(!$auth_code){