fix EventHandler and call origin run_event, fix event names

This commit is contained in:
Amberstone 2024-09-29 06:47:33 +09:00
parent d92f53b754
commit 39adda76cc
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
7 changed files with 226 additions and 92 deletions

View file

@ -12,7 +12,7 @@ if ($w == 's') {
} }
if (!check_password($wr_password, $wr['wr_password'])) { if (!check_password($wr_password, $wr['wr_password'])) {
EventHandler::triggerEvent("gnuboard.bbs.password_is_wrong", 'bbs', $wr, $qstr); EventHandler::triggerEvent("gnuboard.member.password_is_wrong", 'bbs', $wr, $qstr);
alert('비밀번호가 틀립니다.'); alert('비밀번호가 틀립니다.');
} }
@ -28,7 +28,7 @@ if ($w == 's') {
$wr = get_write($write_table, $wr_id); $wr = get_write($write_table, $wr_id);
if ($wr_password != $wr['wr_protect']) { if ($wr_password != $wr['wr_protect']) {
EventHandler::triggerEvent("gnuboard.bbs.password_is_wrong", 'bbs', $wr, $qstr); EventHandler::triggerEvent("gnuboard.member.password_is_wrong", 'bbs', $wr, $qstr);
alert('비밀번호가 틀립니다.'); alert('비밀번호가 틀립니다.');
} }
@ -49,7 +49,7 @@ if ($w == 's') {
} }
if (!check_password($wr_password, $wr['wr_password'])) { if (!check_password($wr_password, $wr['wr_password'])) {
EventHandler::triggerEvent("gnuboard.bbs.password_is_wrong", 'bbs', $wr, $qstr); EventHandler::triggerEvent("gnuboard.member.password_is_wrong", 'bbs', $wr, $qstr);
alert('비밀번호가 틀립니다.'); alert('비밀번호가 틀립니다.');
} }
@ -63,7 +63,7 @@ if ($w == 's') {
$bo = sql_fetch("select bo_pass from {$g5['board_table']} where bo_table='{$bo_table}'"); $bo = sql_fetch("select bo_pass from {$g5['board_table']} where bo_table='{$bo_table}'");
$pw = get_encrypt_string($bo['bo_pass']); $pw = get_encrypt_string($bo['bo_pass']);
if (!check_password($wr_password, $pw)) { if (!check_password($wr_password, $pw)) {
EventHandler::triggerEvent("gnuboard.bbs.password_is_wrong", 'bbs', $wr, $qstr); EventHandler::triggerEvent("gnuboard.member.password_is_wrong", 'bbs', $wr, $qstr);
alert('비밀번호가 틀립니다.'); alert('비밀번호가 틀립니다.');
} }

View file

@ -71,6 +71,6 @@ $content .= '</div>';
mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb['mb_email'], $subject, $content, 1); mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb['mb_email'], $subject, $content, 1);
EventHandler::triggerEvent("gnuboard.bbs.password_lost2_after", $mb, $mb_nonce, $mb_lost_certify); EventHandler::triggerEvent("gnuboard.member.password_lost2_after", $mb, $mb_nonce, $mb_lost_certify);
alert_close($email . ' 메일로 회원아이디와 비밀번호를 인증할 수 있는 메일이 발송 되었습니다.\\n\\n메일을 확인하여 주십시오.'); alert_close($email . ' 메일로 회원아이디와 비밀번호를 인증할 수 있는 메일이 발송 되었습니다.\\n\\n메일을 확인하여 주십시오.');

View file

@ -6,7 +6,7 @@ if (function_exists('check_mail_bot')) {
check_mail_bot($_SERVER['REMOTE_ADDR']); check_mail_bot($_SERVER['REMOTE_ADDR']);
} }
EventHandler::triggerEvent("gnuboard.bbs.lost_certify_before"); EventHandler::triggerEvent("gnuboard.member.password_lost_certify_before");
// 오류시 공히 Error 라고 처리하는 것은 회원정보가 있는지? 비밀번호가 틀린지? 를 알아보려는 해킹에 대비한것 // 오류시 공히 Error 라고 처리하는 것은 회원정보가 있는지? 비밀번호가 틀린지? 를 알아보려는 해킹에 대비한것
@ -27,7 +27,7 @@ if ($mb_nonce === substr($mb['mb_lost_certify'], 0, 32)) {
$new_password_hash = substr($mb['mb_lost_certify'], 33); $new_password_hash = substr($mb['mb_lost_certify'], 33);
sql_query(" update {$g5['member_table']} set mb_password = '$new_password_hash' where mb_no = '$mb_no' "); sql_query(" update {$g5['member_table']} set mb_password = '$new_password_hash' where mb_no = '$mb_no' ");
EventHandler::triggerEvent("gnuboard.bbs.lost_certify_after", $mb, $mb_nonce); EventHandler::triggerEvent("gnuboard.member.password_lost_certify_after", $mb, $mb_nonce);
alert('비밀번호가 변경됐습니다.\\n\\n회원아이디와 변경된 비밀번호로 로그인 하시기 바랍니다.', G5_BBS_URL . '/login.php'); alert('비밀번호가 변경됐습니다.\\n\\n회원아이디와 변경된 비밀번호로 로그인 하시기 바랍니다.', G5_BBS_URL . '/login.php');
} else { } else {

View file

@ -1,6 +1,5 @@
<?php <?php
/** /**
* THIS MODULE PROHIBITS DISTRIBUTION TO OTHERS WITHOUT AUTHOR'S PERMISSION.
* Base Module (minimum support version) * Base Module (minimum support version)
* @author arcturus (https://info.drk.st/about contact@drk.st) * @author arcturus (https://info.drk.st/about contact@drk.st)
*/ */
@ -9,8 +8,168 @@ include_once __DIR__ . "/event.php";
class EventHandler class EventHandler
{ {
/**
* ... gnuboard5 plugin and skin compatible code ...
* event list 참고용으로 사용하셔도 됩니다.
* gnuboard5의 run_event 대체하는 함수로 기존 run_event 호출하기 위해 선언되어 있는 이름- 배열입니다.
* @var string[]
*/
protected static $gnuboardCompatibleList = [
// common.php
"gnuboard.loadlibs.after" => "", // amber only
"gnuboard.htmlprocess.before" => "common_header",
"gnuboard.htmlprocess.after" => "", // amber only
// head.php
"gnuboard.head.before" => "pre_head",
// tail.php
"gnuboard.tail.before" => "", // amber only
"gnuboard.tail.after" => "", // amber only
// tail.sub.php
"gnuboard.tail_sub" => "tail_sub",
// adm/_common.php
"gnuboard.admin.load_common" => "admin_common",
// adm/board_copy_update.php
"gnuboard.admin.board_copy_file" => "admin_board_copy_file",
// adm/board_form_update.php
"gnuboard.admin.board_form_update" => "admin_board_form_update",
// adm/board_form_before.php
"gnuboard.admin.board_form_before" => "adm_board_form_before",
// adm/board_list_update.php
"gnuboard.admin.board_list_update" => "admin_board_list_update",
// adm/boardgroup_form_update.php
"gnuboard.admin.boardgroup_form_update" => "admin_boardgroup_form_update",
// adm/boardgroup_list_update.php
"gnuboard.admin.boardgroup_list_update" => "admin_boardgroup_list_update",
// adm/cache_file_delete.php
"gnuboard.admin.cache_file_delete_before" => "adm_cache_file_delete_before",
"gnuboard.admin.cache_file_delete" => "adm_cache_file_delete",
// adm/config_form_update.php
"gnuboard.admin.config_form_update" => "admin_config_form_update",
// adm/contentformupdate.php
"gnuboard.admin.content_created" => "admin_content_created",
"gnuboard.admin.content_updated" => "admin_content_updated",
"gnuboard.admin.content_deleted" => "admin_content_deleted",
// adm/member_form_update.php
"gnuboard.admin.member_form_update" => "admin_member_form_update",
// adm/member_form.php
"gnuboard.admin.member_form_add" => "admin_member_form_add",
"gnuboard.admin.member_form_after" => "admin_member_form_after",
// adm/member_list_update.php
"gnuboard.admin.member_list_update" => "admin_member_list_update",
// adm/menu_list_update.php
"gnuboard.admin.menu_list_update" => "admin_menu_list_update",
// adm/theme_update.php
"gnuboard.admin.theme_update" => "adm_theme_update",
// adm/viewer_form_update.php
"gnuboard.admin.viewer_update" => "", // amber only
// bbs/delete_all.php
"gnuboard.bbs.delete_all" => "bbs_delete_all",
// bbs/delete_comment.php
"gnuboard.bbs.delete_comment" => "bbs_delete_comment",
// bbs/delete.php
"gnuboard.bbs.delete" => "bbs_delete",
// bbs/download.php
"gnuboard.bbs.download_file_header" => "download_file_header",
// bbs/good.php
"gnuboard.bbs.good_before" => "bbs_good_before",
"gnuboard.bbs.increase_good_json" => "bbs_increase_good_json",
"gnuboard.bbs.increase_good_html" => "bbs_increase_good_html",
"gnuboard.bbs.good_after" => "bbs_good_after",
// bbs/login_check.php
"gnuboard.member.login_check_before" => "member_login_check_before",
"gnuboard.member.login_session_before" => "login_session_before",
"gnuboard.member.login_check" => "member_login_check",
// bbs/login.php
"gnuboard.member.login_tail" => "member_login_tail",
// bbs/logout.php
"gnuboard.member.logout" => "member_logout",
// bbs/member_leave.php
"gnuboard.member.leave" => "member_leave",
// bbs/memo_delete.php
"gnuboard.memo.delete" => "memo_delete",
// bbs/memo_form_update.php
"gnuboard.memo.form_update_before" => "memo_form_update_before",
"gnuboard.memo.form_update_after" => "memo_form_update_after",
"gnuboard.memo.form_update_failed" => "memo_form_update_failed",
// bbs/memo.php
"gnuboard.memo.list" => "memo_list",
// bbs/move_update.php
"gnuboard.bbs.move_copy" => "bbs_move_copy",
"gnuboard.bbs.move_update" => "bbs_move_update",
// bbs/move.php
"gnuboard.bbs.move_html_footer" => "move_html_footer",
// bbs/new_delete.php
"gnuboard.bbs.new_delete" => "bbs_new_delete",
// bbs/password_check.php
"gnuboard.member.password_is_wrong" => "password_is_wrong",
// bbs/password_lost_certify.php
"gnuboard.member.password_lost_certify_before" => "password_lost_certify_before",
"gnuboard.member.password_lost_certify_after" => "password_lost_certify_after",
// bbs/password_lost2.php
"gnuboard.member.password_lost2_after" => "password_lost2_after",
// bbs/qadelete.php
"gnuboard.bbs.qa_delete" => "qa_delete",
// bbs/qadownload.php
"gnuboard.bbs.qa_download_file_header" => "qa_download_file_header",
// bbs/qawrite_update.php
"gnuboard.bbs.qawrite_update" => "qawrite_update",
// bbs/register_form_update.php
"gnuboard.member.register_form_update_before" => "register_form_update_before",
"gnuboard.member.register_form_update_valid" => "register_form_update_valid",
"gnuboard.member.register_form_update_send_mb_mail" => "register_form_update_send_mb_mail",
"gnuboard.member.register_form_update_send_admin_mail" => "register_form_update_send_admin_mail",
"gnuboard.member.register_form_update_send_certify_mail" => "register_form_update_send_certify_mail",
"gnuboard.member.register_form_update_after" => "register_form_update_after",
// bbs/register_form.php
"gnuboard.member.register_form_before" => "register_form_before",
"gnuboard.member.register_form_after" => "register_form_after",
// bbs/write_comment_update.php
"gnuboard.bbs.comment_update_after" => "comment_update_after",
// bbs/write_update.php
"gnuboard.bbs.write_update_before" => "write_update_before",
"gnuboard.bbs.write_update_document_create" => "", // amber only
"gnuboard.bbs.write_update_document_update" => "", // amber only
"gnuboard.bbs.write_update_file_insert" => "write_update_file_insert",
"gnuboard.bbs.write_update_after" => "write_update_after",
// bbs/write.php
"gnuboard.bbs.write" => "bbs_write",
// lib/cache.lib.php
"gnuboard.set_cache_event" => "g5_set_cache_event",
"gnuboard.admin.cache_delete" => "adm_cache_delete",
// lib/common.lib.php
"gnuboard.goto_url" => "goto_url",
"gnuboard.alert" => "alert",
"gnuboard.alert_close" => "alert_close",
"gnuboard.html_purifier_config" => "html_purifier_config",
"gnuboard.sql_query_after" => "sql_query_after",
"gnuboard.delete_cache_latest" => "delete_cache_latest",
"gnuboard.delete_editor_thumbnail_before" => "delete_editor_thumbnail_before",
"gnuboard.delete_editor_thumbnail_after" => "delete_editor_thumbnail_after",
"gnuboard.member_delete_after" => "member_delete_after",
// lib/mailer.lib.php
"gnuboard.mail_send_result" => "mail_send_result",
// lib/thumbnail.lib.php
"gnuboard.is_animated_gif_after" => "is_animated_gif_after",
// plugin/editor/cheditor5/imageUpload/upload.php
"gnuboard.cheditor_photo_upload" => "cheditor_photo_upload",
// plugin/editor/smarteditor2/photo_uploader/popup/php/index.php
"gnuboard.smarteditor_photo_upload" => "smarteditor_photo_upload",
// plugin/editor/cheditor5/imageUpload/delete.php
// plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php
"gnuboard.delete_editor_file" => "delete_editor_file",
];
/**
* Summary of eventHandlers
* @var Event[][]
*/
protected static $eventHandlers = []; protected static $eventHandlers = [];
protected static $performanceStopwatch = []; protected static $performanceStopwatch = [];
/**
* script build start time of gnuboard5
* @var float
*/
protected static $createdAt; protected static $createdAt;
public function __construct() public function __construct()
@ -43,6 +202,13 @@ class EventHandler
} }
} }
/**
* Adding Custom Functions at the declared time
* @param string $event : event list 참조
* @param Event $callback
* @param int $priority : optional
* @return void
*/
public static function addEventHandler($event, $callback, $priority = 10) public static function addEventHandler($event, $callback, $priority = 10)
{ {
if (!isset(self::$eventHandlers[$event])) { if (!isset(self::$eventHandlers[$event])) {
@ -57,6 +223,18 @@ class EventHandler
foreach (self::$eventHandlers[$event] as $callback) { foreach (self::$eventHandlers[$event] as $callback) {
$callback->getAction($data); $callback->getAction($data);
} }
if (function_exists("run_event")) {
self::gnuboardCompatibleRunEvent($event, $data);
}
}
}
protected static function gnuboardCompatibleRunEvent($event, $data)
{
if (array_key_exists($event, self::$gnuboardCompatibleList) && self::$gnuboardCompatibleList[$event] != "") {
$compatibleEvent = self::$gnuboardCompatibleList[$event];
run_event($compatibleEvent, ...$data);
} }
} }
} }

View file

@ -14,6 +14,18 @@ if (!defined('G5_SET_TIME_LIMIT')) {
@set_time_limit(G5_SET_TIME_LIMIT); @set_time_limit(G5_SET_TIME_LIMIT);
define("__ADVDIR__", __DIR__); define("__ADVDIR__", __DIR__);
/**
* func(...$args) 지원을 위해 최소 버전이 gnuboard5 최소인 5.2.17 보다 높게 설정되었습니다.
* 5.6.x 지원종료된지 한참 되었는데 굳이 구버전을 사용할 이유가 있다면
* 구버전에서만 동작하는 코드가 있기 때문이겠지요...
*/
if (version_compare(PHP_VERSION, '5.6.0', '<')) {
echo "<h1>php 버전이 지원하는 버전보다 낮습니다.</h1>" . PHP_EOL;
echo "<p>지원하는 최소 php 버전은 5.6.0 이상입니다.</p>" . PHP_EOL;
echo "<p>현재 php 버전은 <b>" . PHP_VERSION . "</b> 입니다.</p>" . PHP_EOL;
exit();
}
include_once __DIR__ . "/classes/event_handler.php"; include_once __DIR__ . "/classes/event_handler.php";
$extra_headers = [ $extra_headers = [
@ -23,7 +35,6 @@ $extra_headers = [
'HTTP_X_FORWARDED_SSL', 'HTTP_X_FORWARDED_SSL',
]; ];
// filter for dynamic variables // filter for dynamic variables
$var_filter = [ $var_filter = [
'PHP_SELF', 'PHP_SELF',
@ -45,7 +56,7 @@ $var_filter = [
'GLOBALS' 'GLOBALS'
]; ];
foreach($var_filter as $val) { foreach ($var_filter as $val) {
if (array_key_exists($val, $_GET) && isset($_GET[$val])) { if (array_key_exists($val, $_GET) && isset($_GET[$val])) {
unset($_GET[$val]); unset($_GET[$val]);
} }
@ -77,15 +88,15 @@ function load_libs($base_dir, $load_type = "class")
try { try {
if ($file->isDir()) { if ($file->isDir()) {
$parent_folder_name = $file->getFilename(); $parent_folder_name = $file->getFilename();
$class_file = $file->getPathname() . DIRECTORY_SEPARATOR . "{$parent_folder_name}.{$load_type}.php"; $class_file = $file->getPathname() . DIRECTORY_SEPARATOR . "{$parent_folder_name}.{$load_type}.php";
if (file_exists($class_file)) { if (file_exists($class_file)) {
require_once $class_file; require_once $class_file;
$loaded_files[] = $class_file; $loaded_files[] = $class_file;
} }
} }
} catch(Exception $x) { } catch (Exception $x) {
} }
} }
@ -475,7 +486,7 @@ if (isset($_REQUEST['sfl'])) {
if (isset($_REQUEST['stx'])) { // search text (검색어) if (isset($_REQUEST['stx'])) { // search text (검색어)
$stx = get_search_string(trim($_REQUEST['stx'])); $stx = get_search_string(trim($_REQUEST['stx']));
if ($stx) if ($stx || $stx === '0')
$qstr .= '&amp;stx=' . urlencode(cut_str($stx, 20, '')); $qstr .= '&amp;stx=' . urlencode(cut_str($stx, 20, ''));
} else { } else {
$stx = ''; $stx = '';
@ -528,13 +539,14 @@ if (isset($_REQUEST['w'])) {
$w = ''; $w = '';
} }
/** @var int $wr_id 게시판 글의 ID */
if (isset($_REQUEST['wr_id'])) { if (isset($_REQUEST['wr_id'])) {
$wr_id = (int) $_REQUEST['wr_id']; $wr_id = (int) $_REQUEST['wr_id'];
} else { } else {
$wr_id = 0; $wr_id = 0;
} }
if (isset($_REQUEST['bo_table'])) { if (isset($_REQUEST['bo_table']) && !is_array($_REQUEST['bo_table'])) {
$bo_table = preg_replace('/[^a-z0-9_]/i', '', trim($_REQUEST['bo_table'])); $bo_table = preg_replace('/[^a-z0-9_]/i', '', trim($_REQUEST['bo_table']));
$bo_table = substr($bo_table, 0, 20); $bo_table = substr($bo_table, 0, 20);
} else { } else {
@ -715,33 +727,7 @@ if (isset($config['cf_theme']) && trim($config['cf_theme'])) {
// 테마 설정 로드 // 테마 설정 로드
if (defined('G5_THEME_PATH') && is_file(G5_THEME_PATH . '/theme.config.php')) if (defined('G5_THEME_PATH') && is_file(G5_THEME_PATH . '/theme.config.php'))
include_once(G5_THEME_PATH . '/theme.config.php'); include_once G5_THEME_PATH . '/theme.config.php';
//=====================================================================================
// 사용기기 설정
// 테마의 G5_THEME_DEVICE 설정에 따라 사용자 화면 제한됨
// 테마에 별도 설정이 없는 경우 config.php G5_SET_DEVICE 설정에 따라 사용자 화면 제한됨
// pc 설정 시 모바일 기기에서도 PC화면 보여짐
// mobile 설정 시 PC에서도 모바일화면 보여짐
// both 설정 시 접속 기기에 따른 화면 보여짐
//-------------------------------------------------------------------------------------
$is_mobile = false;
$set_device = true;
if (defined('G5_THEME_DEVICE') && G5_THEME_DEVICE != '') {
switch (G5_THEME_DEVICE) {
case 'pc':
$is_mobile = false;
$set_device = false;
break;
case 'mobile':
$is_mobile = true;
$set_device = false;
break;
default:
break;
}
}
if (defined('G5_SET_DEVICE') && $set_device) { if (defined('G5_SET_DEVICE') && $set_device) {
switch (G5_SET_DEVICE) { switch (G5_SET_DEVICE) {
@ -778,46 +764,17 @@ if (G5_USE_MOBILE && $set_device) {
$set_device = false; $set_device = false;
} }
// php 에서 장치 구분은 amber 에서 추후 비권장으로 변경됩니다.
$_SESSION['ss_is_mobile'] = $is_mobile; $_SESSION['ss_is_mobile'] = $is_mobile;
define('G5_IS_MOBILE', $is_mobile); define('G5_IS_MOBILE', $is_mobile);
define('G5_DEVICE_BUTTON_DISPLAY', $set_device); define('G5_DEVICE_BUTTON_DISPLAY', $set_device);
if (G5_IS_MOBILE) { if (G5_IS_MOBILE) {
$g5['mobile_path'] = G5_PATH . '/' . $g5['mobile_dir']; $g5['mobile_path'] = G5_PATH . '/' . $g5['mobile_dir'];
} }
//============================================================================== //==============================================================================
//==============================================================================
// 스킨경로
//------------------------------------------------------------------------------
/*if (G5_IS_MOBILE) {
$board_skin_path = get_skin_path('board', $board['bo_mobile_skin']);
$board_skin_url = get_skin_url('board', $board['bo_mobile_skin']);
$member_skin_path = get_skin_path('member', $config['cf_mobile_member_skin']);
$member_skin_url = get_skin_url('member', $config['cf_mobile_member_skin']);
$new_skin_path = get_skin_path('new', $config['cf_mobile_new_skin']);
$new_skin_url = get_skin_url('new', $config['cf_mobile_new_skin']);
$search_skin_path = get_skin_path('search', $config['cf_mobile_search_skin']);
$search_skin_url = get_skin_url('search', $config['cf_mobile_search_skin']);
$connect_skin_path = get_skin_path('connect', $config['cf_mobile_connect_skin']);
$connect_skin_url = get_skin_url('connect', $config['cf_mobile_connect_skin']);
$faq_skin_path = get_skin_path('faq', $config['cf_mobile_faq_skin']);
$faq_skin_url = get_skin_url('faq', $config['cf_mobile_faq_skin']);
} else {
$board_skin_path = get_skin_path('board', $board['bo_skin']);
$board_skin_url = get_skin_url('board', $board['bo_skin']);
$member_skin_path = get_skin_path('member', $config['cf_member_skin']);
$member_skin_url = get_skin_url('member', $config['cf_member_skin']);
$new_skin_path = get_skin_path('new', $config['cf_new_skin']);
$new_skin_url = get_skin_url('new', $config['cf_new_skin']);
$search_skin_path = get_skin_path('search', $config['cf_search_skin']);
$search_skin_url = get_skin_url('search', $config['cf_search_skin']);
$connect_skin_path = get_skin_path('connect', $config['cf_connect_skin']);
$connect_skin_url = get_skin_url('connect', $config['cf_connect_skin']);
$faq_skin_path = get_skin_path('faq', $config['cf_faq_skin']);
$faq_skin_url = get_skin_url('faq', $config['cf_faq_skin']);
}*/
$board_skin_path = get_skin_path('board', $board['bo_skin']); $board_skin_path = get_skin_path('board', $board['bo_skin']);
$board_skin_url = get_skin_url('board', $board['bo_skin']); $board_skin_url = get_skin_url('board', $board['bo_skin']);
$member_skin_path = get_skin_path('member', $config['cf_member_skin']); $member_skin_path = get_skin_path('member', $config['cf_member_skin']);
@ -834,10 +791,10 @@ $faq_skin_url = get_skin_url('faq', $config['cf_faq_skin']);
//============================================================================== //==============================================================================
// 방문자수의 접속을 남김 // 방문자수의 접속을 남김
include_once(G5_BBS_PATH . '/visit_insert.inc.php'); include_once G5_BBS_PATH . '/visit_insert.inc.php';
// 일정 기간이 지난 DB 데이터 삭제 및 최적화 // 일정 기간이 지난 DB 데이터 삭제 및 최적화
include_once(G5_BBS_PATH . '/db_table.optimize.php'); include_once G5_BBS_PATH . '/db_table.optimize.php';
// common.php 파일을 수정할 필요가 없도록 확장합니다. // common.php 파일을 수정할 필요가 없도록 확장합니다.
$extend_file = []; $extend_file = [];
@ -852,7 +809,7 @@ if (!empty($extend_file) && is_array($extend_file)) {
natsort($extend_file); natsort($extend_file);
foreach ($extend_file as $file) { foreach ($extend_file as $file) {
include_once(G5_EXTEND_PATH . '/' . $file); include_once G5_EXTEND_PATH . '/' . $file;
} }
} }
unset($extend_file); unset($extend_file);
@ -861,15 +818,17 @@ unset($extend_file);
if (defined('G5_THEME_PATH')) { if (defined('G5_THEME_PATH')) {
$extend_file = []; $extend_file = [];
$tmp = dir(G5_THEME_PATH . '/' . G5_EXTEND_DIR); $tmp = dir(G5_THEME_PATH . '/' . G5_EXTEND_DIR);
while ($entry = $tmp->read()) { while ($entry = $tmp->read()) {
// php 파일만 include 함 // php 파일만 include 함
if (preg_match("/(\.php)$/i", $entry)) if (preg_match("/(\.php)$/i", $entry))
$extend_file[] = $entry; $extend_file[] = $entry;
} }
if (!empty($extend_file) && is_array($extend_file)) { if (!empty($extend_file) && is_array($extend_file)) {
natsort($extend_file); natsort($extend_file);
foreach ($extend_file as $file) { foreach ($extend_file as $file) {
include_once(G5_THEME_PATH . '/' . G5_EXTEND_DIR . "/" . $file); include_once G5_THEME_PATH . '/' . G5_EXTEND_DIR . "/" . $file;
} }
} }
unset($extend_file); unset($extend_file);
@ -878,13 +837,12 @@ if (defined('G5_THEME_PATH')) {
ob_start(); ob_start();
$gmnow = gmdate('D, d M Y H:i:s') . ' GMT'; $gmnow = gmdate('D, d M Y H:i:s') . ' GMT';
header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
header('Expires: 0'); header('Expires: 0'); // rfc2616 - Section 14.21
header('Last-Modified: ' . $gmnow); header("Last-Modified: {$gmnow}");
header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Pragma: no-cache'); header('Pragma: no-cache'); // HTTP/1.0
EventHandler::triggerEvent("gnuboard.htmlprocess.before"); EventHandler::triggerEvent("gnuboard.htmlprocess.before");

View file

@ -12,7 +12,9 @@ $theme_6 = "#7488B2";
$title = G5_VERSION . " 라이센스 확인 1/3"; $title = G5_VERSION . " 라이센스 확인 1/3";
if (version_compare(PHP_VERSION, '5.6.0', '<')) { if (version_compare(PHP_VERSION, '5.6.0', '<')) {
echo "<h1>php 버전이 지원하는 버전보다 낮습니다.</h1><p>권장 php 버전은 7.4 입니다.</p><p>최소 php 버전은 5.6.0이며 최소 권장 버전은 5.6.22 이상입니다.</p>"; echo "<h1>php 버전이 지원하는 버전보다 낮습니다.</h1>" . PHP_EOL;
echo "<p>지원하는 최소 php 버전은 5.6.0 이상입니다.</p>" . PHP_EOL;
echo "<p>현재 php 버전은 <b>" . PHP_VERSION . "</b> 입니다.</p>" . PHP_EOL;
exit(); exit();
} }

View file

@ -37,9 +37,9 @@ function g5_cache_secret_key()
return $str; return $str;
} }
function g5_latest_cache_data($bo_table, $cache_list = array(), $find_wr_id = 0) function g5_latest_cache_data($bo_table, $cache_list = [], $find_wr_id = 0)
{ {
static $cache = array(); static $cache = [];
if ($bo_table && $cache_list && !isset($cache[$bo_table])) { if ($bo_table && $cache_list && !isset($cache[$bo_table])) {
foreach ((array) $cache_list as $wr) { foreach ((array) $cache_list as $wr) {
@ -56,9 +56,8 @@ function g5_latest_cache_data($bo_table, $cache_list = array(), $find_wr_id = 0)
function g5_set_cache($key, $save_data, $ttl = null) function g5_set_cache($key, $save_data, $ttl = null)
{ {
if ($cache = get_cachemanage_instance()) { if ($cache = get_cachemanage_instance()) {
run_event('g5_set_cache_event', $cache, $key, $save_data, $ttl); EventHandler::triggerEvent("gnuboard.set_cache_event", $cache, $key, $save_data, $ttl);
if ((is_object($cache) && get_class($cache) === 'FileCache')) { if ((is_object($cache) && get_class($cache) === 'FileCache')) {
$cache->save($key, $save_data, $ttl); $cache->save($key, $save_data, $ttl);
@ -68,7 +67,6 @@ function g5_set_cache($key, $save_data, $ttl = null)
function g5_get_cache($key, $expired_time = 0) function g5_get_cache($key, $expired_time = 0)
{ {
if ($cache = get_cachemanage_instance()) { if ($cache = get_cachemanage_instance()) {
if ((is_object($cache) && get_class($cache) === 'FileCache')) { if ((is_object($cache) && get_class($cache) === 'FileCache')) {
return $cache->get($key, $expired_time); return $cache->get($key, $expired_time);
@ -91,7 +89,6 @@ function g5_delete_cache($key)
function g5_delete_all_cache() function g5_delete_all_cache()
{ {
$board_tables = get_board_names(); $board_tables = get_board_names();
foreach ($board_tables as $board_table) { foreach ($board_tables as $board_table) {
@ -103,7 +100,6 @@ function g5_delete_all_cache()
function g5_delete_cache_by_prefix($key) function g5_delete_cache_by_prefix($key)
{ {
$cache = get_cachemanage_instance(); $cache = get_cachemanage_instance();
$files = null; $files = null;