diff --git a/hwe/func.php b/hwe/func.php index bb3538b0..93487b90 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1138,7 +1138,7 @@ function PushMsg($type, $nation, $picture, $imgsvr, $from, $fromcolor, $to, $toc $date = date('Y-m-d H:i:s'); if($type == 1) { $file = "_all_msg.txt"; } else { $file = "_nation_msg{$nation}.txt"; } - $fp = fopen("logs/{$file}", "a"); + $fp = fopen(__dir__."/logs/{$file}", "a"); //로그 파일에 기록 $str = "{$type}|".StringUtil::padStringAlignRight($from,12," ")."|".StringUtil::padStringAlignRight($to,12," ")."|".$date."|".$msg."|".$fromcolor."|".$tocolor."|".$picture."|".$imgsvr; fwrite($fp, "{$str}\n"); @@ -1287,7 +1287,7 @@ function increaseRefresh($type="", $cnt=1) { $date2 = substr($date, 0, 10); $online = getOnlineNum(); file_put_contents( - "logs/_{$date2}_refresh.txt", + __dir__."/logs/_{$date2}_refresh.txt", sprintf( "%s, %s, %s, %s, %s, %d\n", $date, @@ -1324,7 +1324,7 @@ function increaseRefresh($type="", $cnt=1) { } if($str != "") { file_put_contents( - "logs/_{$date2}_ipcheck.txt", + __dir__."/logs/_{$date2}_ipcheck.txt", sprintf( "%s, %s, %s%s\n", $session->userName, diff --git a/hwe/func_history.php b/hwe/func_history.php index ea38d3f4..d51125ad 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -5,7 +5,7 @@ namespace sammo; function delStepLog() { $date = date('Y_m_d'); - @unlink("logs/_{$date}_steplog.txt"); + @unlink(__dir__."/logs/_{$date}_steplog.txt"); } function pushRawFileLog($path, $lines){ @@ -50,81 +50,81 @@ function eraseTnmtFightLogAll(){ } function eraseTnmtFightLog(int $group){ - $filepath = "logs/fight{$group}.txt"; + $filepath = __dir__."/logs/fight{$group}.txt"; if(file_exists($filepath)){ @unlink($filepath); } } function pushTnmtFightLog(int $group, $log) { - pushRawFileLog("logs/fight{$group}.txt", $log); + pushRawFileLog(__dir__."/logs/fight{$group}.txt", $log); } function getTnmtFightLogAll(int $group) { - return join('
',getFormattedFileLogAll("logs/fight{$group}.txt")); + return join('
',getFormattedFileLogAll(__dir__."/logs/fight{$group}.txt")); } function pushSabotageLog($log) { - pushRawFileLog("logs/_sabotagelog.txt", $log); + pushRawFileLog(__dir__."/logs/_sabotagelog.txt", $log); } function getSabotageLogRecent($count) { - return join('
', getFormattedFileLogRecent("logs/_sabotagelog.txt", $count, 150)); + return join('
', getFormattedFileLogRecent(__dir__."/logs/_sabotagelog.txt", $count, 150)); } function pushProcessLog($log) { $date = date('Y_m_d'); - pushRawFileLog("logs/_{$date}_processlog.txt", $log); + pushRawFileLog(__dir__."/logs/_{$date}_processlog.txt", $log); } function pushStepLog($log) { $date = date('Y_m_d'); - pushRawFileLog("logs/_{$date}_steplog.txt", $log); + pushRawFileLog(__dir__."/logs/_{$date}_steplog.txt", $log); } function pushLockLog($log) { $date = date('Y_m_d'); - pushRawFileLog("logs/_{$date}_locklog.txt", $log); + pushRawFileLog(__dir__."/logs/_{$date}_locklog.txt", $log); } function pushAdminLog($log) { - pushRawFileLog("logs/_adminlog.txt", $log); + pushRawFileLog(__dir__."/logs/_adminlog.txt", $log); } function pushAuctionLog($log) { - pushRawFileLog("logs/_auctionlog.txt", $log); + pushRawFileLog(__dir__."/logs/_auctionlog.txt", $log); } function getAuctionLogRecent(int $count) { - return join('
', array_reverse(getFormattedFileLogRecent("logs/_auctionlog.txt", $count, 300))); + return join('
', array_reverse(getFormattedFileLogRecent(__dir__."/logs/_auctionlog.txt", $count, 300))); } function pushGenLog($general, $log) { $no = Util::toInt($general['no']); - pushRawFileLog("logs/gen{$no}.txt", $log); + pushRawFileLog(__dir__."/logs/gen{$no}.txt", $log); } function getGenLogRecent(int $no, int $count) { - return join('
', array_reverse(getFormattedFileLogRecent("logs/gen{$no}.txt", $count, 300))); + return join('
', array_reverse(getFormattedFileLogRecent(__dir__."/logs/gen{$no}.txt", $count, 300))); } function pushBatRes($general, $log) { $no = Util::toInt($general['no']); - pushRawFileLog("logs/batres{$no}.txt", $log); + pushRawFileLog(__dir__."/logs/batres{$no}.txt", $log); } function getBatResRecent(int $no, int $count) { - return join('
', array_reverse(getFormattedFileLogRecent("logs/batres{$no}.txt", $count, 300))); + return join('
', array_reverse(getFormattedFileLogRecent(__dir__."/logs/batres{$no}.txt", $count, 300))); } function pushBatLog($general, $log) { $no = Util::toInt($general['no']); - pushRawFileLog("logs/batlog{$no}.txt", $log); + pushRawFileLog(__dir__."/logs/batlog{$no}.txt", $log); } function getBatLogRecent(int $no, int $count) { - return join('
', array_reverse(getFormattedFileLogRecent("logs/batlog{$no}.txt", $count, 300))); + return join('
', array_reverse(getFormattedFileLogRecent(__dir__."/logs/batlog{$no}.txt", $count, 300))); } //DB-based diff --git a/hwe/j_install.php b/hwe/j_install.php index 97d5a8fc..b8013b90 100644 --- a/hwe/j_install.php +++ b/hwe/j_install.php @@ -100,8 +100,8 @@ $mysqli_obj = $db->get(); $scenarioObj = new Scenario($scenario, false); $startyear = $scenarioObj->getYear()??GameConst::$defaultStartYear; -FileUtil::delInDir("logs"); -FileUtil::delInDir("data"); +FileUtil::delInDir(__dir__."/logs"); +FileUtil::delInDir(__dir__."/data"); $result = Util::generateFileUsingSimpleTemplate( __DIR__.'/d_setting/UniqueConst.orig.php',