__dir__ -> __DIR__

This commit is contained in:
2020-03-28 19:48:09 +09:00
parent baba2d34dd
commit 8f95d4b279
51 changed files with 109 additions and 109 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
define('ROOT', realpath(__dir__.'/..')); define('ROOT', realpath(__DIR__.'/..'));
setlocale(LC_ALL, 'ko_KR.UTF-8'); setlocale(LC_ALL, 'ko_KR.UTF-8');
date_default_timezone_set('Asia/Seoul'); date_default_timezone_set('Asia/Seoul');
mb_internal_encoding("UTF-8"); mb_internal_encoding("UTF-8");
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
session_start(); session_start();
session_destroy(); session_destroy();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
if(!class_exists('\\sammo\\RootDB')){ if(!class_exists('\\sammo\\RootDB')){
Json::die([ Json::die([
+8 -8
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$host = Util::getReq('db_host'); $host = Util::getReq('db_host');
$port = Util::getReq('db_port', 'int'); $port = Util::getReq('db_port', 'int');
@@ -165,7 +165,7 @@ $rootDB->error_handler = function ($params) {
$mysqli_obj = $rootDB->get(); //로그인에 실패할 경우 자동으로 dbConnFail()이 실행됨. $mysqli_obj = $rootDB->get(); //로그인에 실패할 경우 자동으로 dbConnFail()이 실행됨.
if ($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/common_schema.sql'))) { if ($mysqli_obj->multi_query(file_get_contents(__DIR__.'/sql/common_schema.sql'))) {
while (true) { while (true) {
if (!$mysqli_obj->more_results()) { if (!$mysqli_obj->more_results()) {
break; break;
@@ -195,7 +195,7 @@ $imageRequestPath = WebUtil::resolveRelativePath($gameImagePath.'/../hook/git_pu
$imageKeyInstallPath = WebUtil::resolveRelativePath($gameImagePath.'/../hook/InstallKey.php', $servHost); $imageKeyInstallPath = WebUtil::resolveRelativePath($gameImagePath.'/../hook/InstallKey.php', $servHost);
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/ServConfig.orig.php', __DIR__.'/templates/ServConfig.orig.php',
ROOT.'/d_setting/ServConfig.php', ROOT.'/d_setting/ServConfig.php',
[ [
'serverBasePath'=>$servHost, 'serverBasePath'=>$servHost,
@@ -219,7 +219,7 @@ if ($result !== true) {
} }
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/common_path.orig.js', __DIR__.'/templates/common_path.orig.js',
ROOT.'/d_shared/common_path.js', ROOT.'/d_shared/common_path.js',
[ [
'serverBasePath'=>$servHost, 'serverBasePath'=>$servHost,
@@ -230,7 +230,7 @@ $result = Util::generateFileUsingSimpleTemplate(
); );
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/menu.orig.json', __DIR__.'/templates/menu.orig.json',
ROOT.'/d_shared/menu.json', ROOT.'/d_shared/menu.json',
[], [],
true true
@@ -245,7 +245,7 @@ if ($result !== true) {
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/common.orig.css', __DIR__.'/templates/common.orig.css',
ROOT.'/d_shared/common.css', ROOT.'/d_shared/common.css',
[ [
'serverBasePath'=>$servHost, 'serverBasePath'=>$servHost,
@@ -264,7 +264,7 @@ if ($result !== true) {
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/RootDB.orig.php', __DIR__.'/templates/RootDB.orig.php',
ROOT.'/d_setting/RootDB.php', ROOT.'/d_setting/RootDB.php',
[ [
'host'=>$host, 'host'=>$host,
@@ -279,7 +279,7 @@ $result = Util::generateFileUsingSimpleTemplate(
$kakaoRedirectURI = WebUtil::resolveRelativePath('oauth_kakao/oauth.php', $servHost.'/'); $kakaoRedirectURI = WebUtil::resolveRelativePath('oauth_kakao/oauth.php', $servHost.'/');
Util::generateFileUsingSimpleTemplate( Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/KakaoKey.orig.php', __DIR__.'/templates/KakaoKey.orig.php',
ROOT.'/d_setting/KakaoKey.php', ROOT.'/d_setting/KakaoKey.php',
[ [
'REST_API_KEY'=>$kakaoRESTKey, 'REST_API_KEY'=>$kakaoRESTKey,
+5 -5
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
if($session->userGrade < 6){ if($session->userGrade < 6){
@@ -27,7 +27,7 @@ if($servHost){
$gameImagePath = WebUtil::resolveRelativePath($gameImagePath, $servHost); $gameImagePath = WebUtil::resolveRelativePath($gameImagePath, $servHost);
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/ServConfig.orig.php', __DIR__.'/templates/ServConfig.orig.php',
ROOT.'/d_setting/ServConfig.php', ROOT.'/d_setting/ServConfig.php',
[ [
'serverBasePath'=>$servHost, 'serverBasePath'=>$servHost,
@@ -61,7 +61,7 @@ else if($sharedIconPath || $gameImagePath){
} }
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/ServConfig.orig.php', __DIR__.'/templates/ServConfig.orig.php',
ROOT.'/d_setting/ServConfig.php', ROOT.'/d_setting/ServConfig.php',
[ [
'serverBasePath'=>$servHost, 'serverBasePath'=>$servHost,
@@ -87,7 +87,7 @@ else{
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/common_path.orig.js', __DIR__.'/templates/common_path.orig.js',
ROOT.'/d_shared/common_path.js', ROOT.'/d_shared/common_path.js',
[ [
'serverBasePath'=>$servHost, 'serverBasePath'=>$servHost,
@@ -99,7 +99,7 @@ $result = Util::generateFileUsingSimpleTemplate(
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/common.orig.css', __DIR__.'/templates/common.orig.css',
ROOT.'/d_shared/common.css', ROOT.'/d_shared/common.css',
[ [
'serverBasePath'=>$servHost, 'serverBasePath'=>$servHost,
+1 -1
View File
@@ -14,7 +14,7 @@ $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("명장일람", 1); increaseRefresh("명장일람", 1);
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
+1 -1
View File
@@ -11,7 +11,7 @@ increaseRefresh("갱신정보", 2);
$admin = $gameStor->getValues(['year','month','refresh','maxrefresh','maxonline']); $admin = $gameStor->getValues(['year','month','refresh','maxrefresh','maxonline']);
$log = getRawFileLogRecent(__dir__.'/logs/'.UniqueConst::$serverID.'/_traffic.txt', 11, 100); $log = getRawFileLogRecent(__DIR__.'/logs/'.UniqueConst::$serverID.'/_traffic.txt', 11, 100);
$date = []; $date = [];
$year = []; $year = [];
+3 -3
View File
@@ -1047,7 +1047,7 @@ function increaseRefresh($type="", $cnt=1) {
$date2 = substr($date, 0, 10); $date2 = substr($date, 0, 10);
$online = getOnlineNum(); $online = getOnlineNum();
file_put_contents( file_put_contents(
__dir__."/logs/".UniqueConst::$serverID."/_{$date2}_refresh.txt", __DIR__."/logs/".UniqueConst::$serverID."/_{$date2}_refresh.txt",
sprintf( sprintf(
"%s, %s, %s, %s, %s, %d\n", "%s, %s, %s, %s, %s, %d\n",
$date, $date,
@@ -1084,7 +1084,7 @@ function increaseRefresh($type="", $cnt=1) {
} }
if($str != "") { if($str != "") {
file_put_contents( file_put_contents(
__dir__."/logs/".UniqueConst::$serverID."/_{$date2}_ipcheck.txt", __DIR__."/logs/".UniqueConst::$serverID."/_{$date2}_ipcheck.txt",
sprintf( sprintf(
"%s, %s, %s%s\n", "%s, %s, %s%s\n",
$session->userName, $session->userName,
@@ -1119,7 +1119,7 @@ function updateTraffic() {
$date = TimeUtil::now(); $date = TimeUtil::now();
//일시|년|월|총갱신|접속자|최다갱신자 //일시|년|월|총갱신|접속자|최다갱신자
file_put_contents(__dir__."/logs/".UniqueConst::$serverID."/_traffic.txt", file_put_contents(__DIR__."/logs/".UniqueConst::$serverID."/_traffic.txt",
Json::encode([ Json::encode([
$date, $date,
$admin['year'], $admin['year'],
+20 -20
View File
@@ -5,7 +5,7 @@ namespace sammo;
function delStepLog() { function delStepLog() {
$date = date('Y_m_d'); $date = date('Y_m_d');
@unlink(__dir__."/logs/".UniqueConst::$serverID."/_{$date}_steplog.txt"); @unlink(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_steplog.txt");
} }
function pushRawFileLog($path, $lines){ function pushRawFileLog($path, $lines){
@@ -50,81 +50,81 @@ function eraseTnmtFightLogAll(){
} }
function eraseTnmtFightLog(int $group){ function eraseTnmtFightLog(int $group){
$filepath = __dir__."/logs/".UniqueConst::$serverID."/fight{$group}.txt"; $filepath = __DIR__."/logs/".UniqueConst::$serverID."/fight{$group}.txt";
if(file_exists($filepath)){ if(file_exists($filepath)){
@unlink($filepath); @unlink($filepath);
} }
} }
function pushTnmtFightLog(int $group, $log) { function pushTnmtFightLog(int $group, $log) {
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/fight{$group}.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/fight{$group}.txt", $log);
} }
function getTnmtFightLogAll(int $group) { function getTnmtFightLogAll(int $group) {
return join('<br>',getFormattedFileLogAll(__dir__."/logs/".UniqueConst::$serverID."/fight{$group}.txt")); return join('<br>',getFormattedFileLogAll(__DIR__."/logs/".UniqueConst::$serverID."/fight{$group}.txt"));
} }
function pushSabotageLog($log) { function pushSabotageLog($log) {
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_sabotagelog.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_sabotagelog.txt", $log);
} }
function getSabotageLogRecent($count) { function getSabotageLogRecent($count) {
return join('<br>', getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/_sabotagelog.txt", $count, 150)); return join('<br>', getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/_sabotagelog.txt", $count, 150));
} }
function pushProcessLog($log) { function pushProcessLog($log) {
$date = date('Y_m_d'); $date = date('Y_m_d');
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_{$date}_processlog.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_processlog.txt", $log);
} }
function pushStepLog($log) { function pushStepLog($log) {
$date = date('Y_m_d'); $date = date('Y_m_d');
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_{$date}_steplog.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_steplog.txt", $log);
} }
function pushLockLog($log) { function pushLockLog($log) {
$date = date('Y_m_d'); $date = date('Y_m_d');
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_{$date}_locklog.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_locklog.txt", $log);
} }
function pushAdminLog($log) { function pushAdminLog($log) {
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_adminlog.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_adminlog.txt", $log);
} }
function pushAuctionLog($log) { function pushAuctionLog($log) {
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_auctionlog.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_auctionlog.txt", $log);
} }
function getAuctionLogRecent(int $count) { function getAuctionLogRecent(int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/_auctionlog.txt", $count, 300))); return join('<br>', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/_auctionlog.txt", $count, 300)));
} }
function pushGenLog($general, $log) { function pushGenLog($general, $log) {
$no = Util::toInt($general['no']); $no = Util::toInt($general['no']);
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $log);
} }
function getGenLogRecent(int $no, int $count) { function getGenLogRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $count, 300))); return join('<br>', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $count, 300)));
} }
function pushBatRes($general, $log) { function pushBatRes($general, $log) {
$no = Util::toInt($general['no']); $no = Util::toInt($general['no']);
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $log);
} }
function getBatResRecent(int $no, int $count) { function getBatResRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $count, 300))); return join('<br>', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $count, 300)));
} }
function pushBatLog($general, $log) { function pushBatLog($general, $log) {
$no = Util::toInt($general['no']); $no = Util::toInt($general['no']);
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $log); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $log);
} }
function getBatLogRecent(int $no, int $count) { function getBatLogRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $count, 300))); return join('<br>', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $count, 300)));
} }
function pushOldNationStop(int $no, int $nationNo){ function pushOldNationStop(int $no, int $nationNo){
@@ -132,7 +132,7 @@ function pushOldNationStop(int $no, int $nationNo){
$result = []; $result = [];
foreach($logPrefixList as $logPrefix){ foreach($logPrefixList as $logPrefix){
$path = __dir__."/logs/".UniqueConst::$serverID."/{$logPrefix}{$no}.txt"; $path = __DIR__."/logs/".UniqueConst::$serverID."/{$logPrefix}{$no}.txt";
if(file_exists($path)){ if(file_exists($path)){
$fileLen = @filesize($path); $fileLen = @filesize($path);
} }
@@ -142,7 +142,7 @@ function pushOldNationStop(int $no, int $nationNo){
$result[$logPrefix] = $fileLen; $result[$logPrefix] = $fileLen;
} }
$baseStopPath = __dir__."/logs/".UniqueConst::$serverID."/stop{$no}.txt"; $baseStopPath = __DIR__."/logs/".UniqueConst::$serverID."/stop{$no}.txt";
if(file_exists($baseStopPath)){ if(file_exists($baseStopPath)){
$oldValues = Json::decode(file_get_contents($baseStopPath)); $oldValues = Json::decode(file_get_contents($baseStopPath));
} }
+11 -11
View File
@@ -15,7 +15,7 @@ function turnTable() {
$turnList = []; $turnList = [];
$turnList[] = "<option selected value='0'>1턴</option>"; $turnList[] = "<option selected value='0'>1턴</option>";
foreach(range(1, GameConst::$maxTurn - 1) as $turnIdx){ foreach(\range(1, GameConst::$maxTurn - 1) as $turnIdx){
$turnText = $turnIdx + 1; $turnText = $turnIdx + 1;
$turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>"; $turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>";
} }
@@ -59,7 +59,7 @@ function displayiActionObjInfo(?iAction $action){
$text = $action->getName(); $text = $action->getName();
} }
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
return $templates->render('tooltip', [ return $templates->render('tooltip', [
'text'=>$text, 'text'=>$text,
@@ -71,7 +71,7 @@ function displayCharInfo(string $type):string{
$info = $class->getInfo(); $info = $class->getInfo();
$text = $class->getName(); $text = $class->getName();
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
return $templates->render('tooltip', [ return $templates->render('tooltip', [
'text'=>$text, 'text'=>$text,
@@ -84,7 +84,7 @@ function displaySpecialWarInfo(?string $type):string{
$info = $class->getInfo(); $info = $class->getInfo();
$name = $class->getName(); $name = $class->getName();
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
return $templates->render('tooltip', [ return $templates->render('tooltip', [
'text'=>$name, 'text'=>$name,
@@ -97,7 +97,7 @@ function displaySpecialDomesticInfo(?string $type):string{
$info = $class->getInfo(); $info = $class->getInfo();
$name = $class->getName(); $name = $class->getName();
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
return $templates->render('tooltip', [ return $templates->render('tooltip', [
'text'=>$name, 'text'=>$name,
@@ -117,11 +117,11 @@ function allButton() {
$call = "설문조사"; $call = "설문조사";
} }
if(\file_exists(__dir__."/d_setting/templates/allButton.php")){ if(\file_exists(__DIR__."/d_setting/templates/allButton.php")){
$templates = new \League\Plates\Engine(__dir__.'/d_setting/templates'); $templates = new \League\Plates\Engine(__DIR__.'/d_setting/templates');
} }
else{ else{
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
} }
@@ -152,7 +152,7 @@ function commandButton() {
$bgColor = Util::array_get($nation['color'])?:'#000000'; $bgColor = Util::array_get($nation['color'])?:'#000000';
$fgColor = newColor($bgColor); $fgColor = newColor($bgColor);
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
$showSecret = false; $showSecret = false;
$permission = checkSecretPermission($me); $permission = checkSecretPermission($me);
if($permission >= 1){ if($permission >= 1){
@@ -210,7 +210,7 @@ function formatName(string $name, int $npc): string{
} }
function getMapHtml(?string $mapTheme=null){ function getMapHtml(?string $mapTheme=null){
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
if($mapTheme === null){ if($mapTheme === null){
$db = DB::db(); $db = DB::db();
@@ -224,7 +224,7 @@ function getMapHtml(?string $mapTheme=null){
} }
function getInvitationList(array $nationList){ function getInvitationList(array $nationList){
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
foreach($nationList as &$nation){ foreach($nationList as &$nation){
$nation['textColor'] = newColor($nation['color']); $nation['textColor'] = newColor($nation['color']);
+1 -1
View File
@@ -44,7 +44,7 @@ if($lastTurn !== null){
if($lastTurn === null){ if($lastTurn === null){
//이미 리셋된 상태임 //이미 리셋된 상태임
} }
else if(file_exists(__dir__.'/.htaccess')){ else if(file_exists(__DIR__.'/.htaccess')){
//일단 서버는 닫혀 있음 //일단 서버는 닫혀 있음
} }
else if( else if(
+1 -1
View File
@@ -82,7 +82,7 @@ if($session->userGrade < 5 && !$allowFullReset){
//리셋 가능한 조건인지 테스트 //리셋 가능한 조건인지 테스트
$allowReset = false; $allowReset = false;
if(file_exists(__dir__.'/.htaccess')){ if(file_exists(__DIR__.'/.htaccess')){
$allowReset = true; $allowReset = true;
} }
else{ else{
+7 -7
View File
@@ -29,7 +29,7 @@ if(!$host || !$port || !$username || !$password || !$dbName){
if($fullReset && class_exists('\\sammo\\DB')){ if($fullReset && class_exists('\\sammo\\DB')){
$mysqli_obj = DB::db()->get(); $mysqli_obj = DB::db()->get();
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){ if($mysqli_obj->multi_query(file_get_contents(__DIR__.'/sql/reset.sql'))){
while(true){ while(true){
if (!$mysqli_obj->more_results()) { if (!$mysqli_obj->more_results()) {
break; break;
@@ -41,13 +41,13 @@ if($fullReset && class_exists('\\sammo\\DB')){
} }
} }
if($fullReset){ if($fullReset){
FileUtil::delInDir(__dir__."/logs"); FileUtil::delInDir(__DIR__."/logs");
FileUtil::delInDir(__dir__."/data"); FileUtil::delInDir(__DIR__."/data");
if(file_exists(__dir__.'/d_setting/DB.php')){ if(file_exists(__DIR__.'/d_setting/DB.php')){
@unlink(__dir__.'/d_setting/DB.php'); @unlink(__DIR__.'/d_setting/DB.php');
} }
if(file_exists(__dir__.'/d_setting/UniqueConst.php')){ if(file_exists(__DIR__.'/d_setting/UniqueConst.php')){
@unlink(__dir__.'/d_setting/UniqueConst.php'); @unlink(__DIR__.'/d_setting/UniqueConst.php');
} }
} }
+2 -2
View File
@@ -3,7 +3,7 @@ namespace sammo;
include "lib.php"; include "lib.php";
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
function getAutorunInfo($autorunOption){ function getAutorunInfo($autorunOption){
global $templates; global $templates;
@@ -54,7 +54,7 @@ if(!class_exists('\\sammo\\DB')){
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
if(file_exists(__dir__.'/.htaccess')){ if(file_exists(__DIR__.'/.htaccess')){
$reserved = $db->queryFirstRow( $reserved = $db->queryFirstRow(
'SELECT * FROM reserved_open ORDER BY `date` ASC LIMIT 1' 'SELECT * FROM reserved_open ORDER BY `date` ASC LIMIT 1'
); );
+3 -3
View File
@@ -2,12 +2,12 @@
namespace sammo; namespace sammo;
/** @var \Composer\Autoload\ClassLoader $loader */ /** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __dir__.'/../vendor/autoload.php'; $loader = require __DIR__.'/../vendor/autoload.php';
$loader->addPsr4('sammo\\', __DIR__.'/sammo', true); $loader->addPsr4('sammo\\', __DIR__.'/sammo', true);
$loader->addClassMap((function () { $loader->addClassMap((function () {
$d_settingMap = []; $d_settingMap = [];
foreach (glob(__dir__.'/d_setting/*.orig.php') as $filepath) { foreach (glob(__DIR__.'/d_setting/*.orig.php') as $filepath) {
$filepath = str_replace('.orig.php', '.php', $filepath); $filepath = str_replace('.orig.php', '.php', $filepath);
$filename = basename($filepath); $filename = basename($filepath);
$classname = explode('.', $filename)[0]; $classname = explode('.', $filename)[0];
@@ -36,7 +36,7 @@ function Error($message='', $url="")
$e = new \Exception(); $e = new \Exception();
logError("aux_err", $message, '', getExceptionTraceAsString($e)); logError("aux_err", $message, '', getExceptionTraceAsString($e));
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
ob_get_flush(); ob_get_flush();
WebUtil::setHeaderNoCache(); WebUtil::setHeaderNoCache();
+1 -1
View File
@@ -215,7 +215,7 @@ function processWar_NG(
WarUnitCity $city, WarUnitCity $city,
int $relYear int $relYear
):bool{ ):bool{
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
$logger = $attacker->getLogger(); $logger = $attacker->getLogger();
+1 -1
View File
@@ -264,7 +264,7 @@ class ActionLogger{
return; return;
} }
$templates = new \League\Plates\Engine(__dir__.'/../templates'); $templates = new \League\Plates\Engine(__DIR__.'/../templates');
$render_me = [ $render_me = [
'crewtype' => $me->getCrewTypeShortName(), 'crewtype' => $me->getCrewTypeShortName(),
+3 -3
View File
@@ -7,7 +7,7 @@ class ResetHelper{
} }
static public function clearDB(){ static public function clearDB(){
$servRoot = realpath(__dir__.'/../'); $servRoot = realpath(__DIR__.'/../');
if(!file_exists($servRoot.'/logs') || !file_exists($servRoot.'/data')){ if(!file_exists($servRoot.'/logs') || !file_exists($servRoot.'/data')){
if(!is_writable($servRoot)){ if(!is_writable($servRoot)){
@@ -195,8 +195,8 @@ class ResetHelper{
]; ];
} }
Util::generateFileUsingSimpleTemplate( Util::generateFileUsingSimpleTemplate(
__dir__.'/../templates/base_map.orig.js', __DIR__.'/../templates/base_map.orig.js',
__dir__.'/../d_shared/base_map.js', __DIR__.'/../d_shared/base_map.js',
[ [
'cityPosition'=>Json::encode($cityPositions), 'cityPosition'=>Json::encode($cityPositions),
'regionMap'=>Json::encode(CityConst::$regionMap), 'regionMap'=>Json::encode(CityConst::$regionMap),
+4 -4
View File
@@ -2,7 +2,7 @@
namespace sammo; namespace sammo;
class Scenario{ class Scenario{
const SCENARIO_PATH = __dir__.'/../scenario'; const SCENARIO_PATH = __DIR__.'/../scenario';
private $scenarioIdx; private $scenarioIdx;
private $scenarioPath; private $scenarioPath;
@@ -449,10 +449,10 @@ class Scenario{
} }
public function buildConf(){ public function buildConf(){
$path = __dir__.'/../d_setting'; $path = __DIR__.'/../d_setting';
$mapPath = __dir__.'/../scenario/map'; $mapPath = __DIR__.'/../scenario/map';
$unitPath = __dir__.'/../scenario/unit'; $unitPath = __DIR__.'/../scenario/unit';
$mapName = $this->gameConf['mapName']; $mapName = $this->gameConf['mapName'];
$unitSet = $this->gameConf['unitSet']; $unitSet = $this->gameConf['unitSet'];
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
+2 -2
View File
@@ -1,12 +1,12 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
WebUtil::setHeaderNoCache(); WebUtil::setHeaderNoCache();
$session = Session::requireLogin()->setReadOnly(); $session = Session::requireLogin()->setReadOnly();
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
$db = RootDB::db(); $db = RootDB::db();
$notice = $db->queryFirstField('SELECT `NOTICE` FROM `system` WHERE `NO`=1'); $notice = $db->queryFirstField('SELECT `NOTICE` FROM `system` WHERE `NO`=1');
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID(); $userID = Session::getUserID();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([]); $session = Session::requireLogin([]);
$userID = Session::getUserID(); $userID = Session::getUserID();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID(); $userID = Session::getUserID();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID(); $userID = Session::getUserID();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
$db = RootDB::db(); $db = RootDB::db();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID(); $userID = Session::getUserID();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID(); $userID = Session::getUserID();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([ $session = Session::requireLogin([
'result'=>true, 'result'=>true,
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin(null); $session = Session::requireLogin(null);
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
if($session->userGrade < 5 && !$session->acl){ if($session->userGrade < 5 && !$session->acl){
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
// 외부 파라미터 // 외부 파라미터
$response['server'] = []; $response['server'] = [];
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$session = Session::requireLogin([])->setReadOnly(); $session = Session::requireLogin([])->setReadOnly();
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
WebUtil::setHeaderNoCache(); WebUtil::setHeaderNoCache();
$category = Util::getReq('category', 'int', 0); $category = Util::getReq('category', 'int', 0);
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
WebUtil::setHeaderNoCache();//FIXME: 이 파일에는 이럴 이유가 없다. javascript 기반으로 바꿔도 충분 WebUtil::setHeaderNoCache();//FIXME: 이 파일에는 이럴 이유가 없다. javascript 기반으로 바꿔도 충분
if($sel == 0) $sel = 1; if($sel == 0) $sel = 1;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/vendor/autoload.php'); require(__DIR__.'/vendor/autoload.php');
if (!class_exists('\\sammo\\RootDB')) { if (!class_exists('\\sammo\\RootDB')) {
header('Location:install.php'); header('Location:install.php');
+2 -2
View File
@@ -1,8 +1,8 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/vendor/autoload.php'); require(__DIR__.'/vendor/autoload.php');
require(__dir__.'/oauth_kakao/lib.join.php'); require(__DIR__.'/oauth_kakao/lib.join.php');
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/vendor/autoload.php'); require(__DIR__.'/vendor/autoload.php');
function getVersion($target=null){ function getVersion($target=null){
if($target){ if($target){
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
use \kakao\KakaoKey as KakaoKey; use \kakao\KakaoKey as KakaoKey;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
$RootDB = RootDB::db(); $RootDB = RootDB::db();
$session = Session::getInstance(); $session = Session::getInstance();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
require('lib.join.php'); require('lib.join.php');
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
require('lib.join.php'); require('lib.join.php');
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
require('lib.join.php'); require('lib.join.php');
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
WebUtil::setHeaderNoCache(); WebUtil::setHeaderNoCache();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php'); require(__DIR__.'/../vendor/autoload.php');
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/vendor/autoload.php'); require(__DIR__.'/vendor/autoload.php');
$session = Session::requireLogin('./')->setReadOnly(); $session = Session::requireLogin('./')->setReadOnly();
+1 -1
View File
@@ -103,7 +103,7 @@ class Setting
if (!file_exists($this->basepath) || !is_dir($this->basepath)) { if (!file_exists($this->basepath) || !is_dir($this->basepath)) {
return false; return false;
} }
$templates = new \League\Plates\Engine(__dir__.'/templates'); $templates = new \League\Plates\Engine(__DIR__.'/templates');
//TODO: .htaccess가 서버 오픈에도 사용될 수 있으니 별도의 방법이 필요함 //TODO: .htaccess가 서버 오픈에도 사용될 수 있으니 별도의 방법이 필요함
$allow_ip = Util::get_client_ip(false); $allow_ip = Util::get_client_ip(false);
if (Util::starts_with($allow_ip, '192.168.') || if (Util::starts_with($allow_ip, '192.168.') ||