php5.2 버전대에서 익명함수 처리와 불필요한 코드 주석처리

This commit is contained in:
thisgun
2022-05-25 18:01:24 +09:00
parent 9bfb3da926
commit 89ea991443
2 changed files with 23 additions and 6 deletions
+8 -1
View File
@@ -222,7 +222,14 @@ if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject']))
$wr_seo_title = exist_seo_title_recursive('bbs', generate_seo_title($wr_subject), $write_table, $wr_id);
$options = array($html,$secret,$mail);
$wr_option = implode(',', array_filter($options, function($v) { return trim($v); }));
// php 5.3버전 이상부터 익명함수가 가능합니다.
// $wr_option = implode(',', array_filter($options, function($v) { return trim($v); }));
if(! function_exists('wr_option_filter_trim')) {
function wr_option_filter_trim($v){
return trim($v);
}
}
$wr_option = implode(',', array_filter($options, 'wr_option_filter_trim'));
if ($w == '' || $w == 'r') {
+15 -5
View File
@@ -251,8 +251,18 @@ chrome_domain_session_name();
if( ! class_exists('XenoPostToForm') ){
class XenoPostToForm
{
public static function g5_session_name(){
return (defined('G5_SESSION_NAME') && G5_SESSION_NAME) ? G5_SESSION_NAME : 'PHPSESSID';
}
public static function php52_request_check(){
$cookie_session_name = self::g5_session_name();
if (isset($_REQUEST[$cookie_session_name]) && $_REQUEST[$cookie_session_name] != session_id())
goto_url(G5_BBS_URL.'/logout.php');
}
public static function check() {
$cookie_session_name = (defined('G5_SESSION_NAME') && G5_SESSION_NAME) ? G5_SESSION_NAME : 'PHPSESSID';
$cookie_session_name = self::g5_session_name();
return !isset($_COOKIE[$cookie_session_name]) && count($_POST) && ((isset($_SERVER['HTTP_REFERER']) && !preg_match('~^https://'.preg_quote($_SERVER['HTTP_HOST'], '~').'/~', $_SERVER['HTTP_REFERER']) || ! isset($_SERVER['HTTP_REFERER']) ));
}
@@ -359,8 +369,9 @@ if( $config['cf_cert_use'] || (defined('G5_YOUNGCART_VER') && G5_YOUNGCART_VER)
$headers = headers_list();
krsort($headers);
$cookie_session_name = method_exists('XenoPostToForm', 'g5_session_name') ? XenoPostToForm::g5_session_name() : 'PHPSESSID';
foreach ($headers as $header) {
if (!preg_match('~^Set-Cookie: PHPSESSID=~', $header)) continue;
if (!preg_match('~^Set-Cookie: '.$cookie_session_name.'=~', $header)) continue;
$header = preg_replace('~; secure(; HttpOnly)?$~', '', $header) . '; secure; SameSite=None';
header($header, false);
$g5['session_cookie_samesite'] = 'none';
@@ -383,9 +394,8 @@ define('G5_CAPTCHA_DIR', !empty($config['cf_captcha']) ? $config['cf_captcha'
define('G5_CAPTCHA_URL', G5_PLUGIN_URL.'/'.G5_CAPTCHA_DIR);
define('G5_CAPTCHA_PATH', G5_PLUGIN_PATH.'/'.G5_CAPTCHA_DIR);
// 4.00.03 : [보안관련] PHPSESSID 가 틀리면 로그아웃한다.
if (isset($_REQUEST['PHPSESSID']) && $_REQUEST['PHPSESSID'] != session_id())
goto_url(G5_BBS_URL.'/logout.php');
// 4.00.03 : [보안관련] PHPSESSID 가 틀리면 로그아웃한다. php5.2 버전 이하에서만 해당되는 코드이며, 오히려 무한리다이렉트 오류가 일어날수 있으므로 주석처리합니다.
// if( method_exists('XenoPostToForm', 'php52_request_check') ) XenoPostToForm::php52_request_check();
// QUERY_STRING
$qstr = '';