불필요한 PHP 5.1 이하 코드 삭제

json_encode, json_decode 는 PHP 5.2 부터 PHP 코어에 내장되어있습니다.
https://php-legacy-docs.zend.com/manual/php5/en/json.requirements
https://php-legacy-docs.zend.com/manual/php5/en/book.json
This commit is contained in:
kit rio
2022-06-03 11:00:02 +09:00
committed by thisgun
parent 068c8818f8
commit fc43e26c14
12 changed files with 58 additions and 145 deletions

View File

@ -1,6 +1,5 @@
<?php <?php
require_once './_common.php'; require_once './_common.php';
require_once G5_LIB_PATH . '/json.lib.php';
set_session('ss_admin_token', ''); set_session('ss_admin_token', '');

View File

@ -1,7 +1,6 @@
<?php <?php
$sub_menu = "100280"; $sub_menu = "100280";
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
$data = array(); $data = array();
$data['error'] = ''; $data['error'] = '';

View File

@ -1,6 +1,5 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
$ss_name = 'ss_comment_token'; $ss_name = 'ss_comment_token';

View File

@ -1,6 +1,5 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
$token_case = isset($_POST['token_case']) ? preg_replace('/[^0-9a-z_]/i', '', $_POST['token_case']) : ''; $token_case = isset($_POST['token_case']) ? preg_replace('/[^0-9a-z_]/i', '', $_POST['token_case']) : '';

View File

@ -1,6 +1,5 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
if(!$bo_table) if(!$bo_table)
die(json_encode(array('error'=>'게시판 정보가 올바르지 않습니다.', 'url'=>G5_URL))); die(json_encode(array('error'=>'게시판 정보가 올바르지 않습니다.', 'url'=>G5_URL)));

View File

@ -1,12 +1,10 @@
<?php <?php
$g5_path['path'] = '..'; $g5_path['path'] = '..';
include_once ('../config.php'); include_once('../config.php');
include_once('../lib/json.lib.php');
include_once('../lib/common.lib.php'); // 공통 라이브러리
include_once('./install.function.php'); // 인스톨 과정 함수 모음 include_once('./install.function.php'); // 인스톨 과정 함수 모음
include_once('../lib/common.lib.php'); // 공통 라이브러리
include_once('../lib/hook.lib.php'); // hook 함수 파일 include_once('../lib/hook.lib.php'); // hook 함수 파일
include_once('../lib/get_data.lib.php'); // 데이 가져오는 함수 모음 include_once('../lib/get_data.lib.php'); // 데이 가져오는 함수 모음
$data_path = '../'.G5_DATA_DIR; $data_path = '../'.G5_DATA_DIR;

View File

@ -1,78 +0,0 @@
<?php
if (!defined('_GNUBOARD_')) exit;
// http://tinsology.net/2011/04/php-json_encode-and-json_decode-alternatives/
if(!function_exists('json_encode'))
{
function json_encode($a=false)
{
// Some basic debugging to ensure we have something returned
if (is_null($a)) return 'null';
if ($a === false) return 'false';
if ($a === true) return 'true';
if (is_scalar($a))
{
if (is_float($a))
{
// Always use '.' for floats.
return floatval(str_replace(',', '.', strval($a)));
}
if (is_string($a))
{
static $jsonReplaces = array(array('\\', '/', "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
}
else
return $a;
}
$isList = true;
for ($i = 0, reset($a); true; $i++) {
if (key($a) !== $i)
{
$isList = false;
break;
}
}
$result = array();
if ($isList)
{
foreach ($a as $v) $result[] = json_encode($v);
return '[' . join(',', $result) . ']';
}
else
{
foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
return '{' . join(',', $result) . '}';
}
}
}
if(!function_exists('json_decode'))
{
function json_decode($json)
{
$comment = false;
$out = '$x=';
for ($i=0; $i<strlen($json); $i++)
{
if (!$comment)
{
if (($json[$i] == '{') || ($json[$i] == '['))
$out .= ' array(';
else if (($json[$i] == '}') || ($json[$i] == ']'))
$out .= ')';
else if ($json[$i] == ':')
$out .= '=>';
else
$out .= $json[$i];
}
else
$out .= $json[$i];
if ($json[$i] == '"' && $json[($i-1)]!="\\")
$comment = !$comment;
}
eval($out . ';');
return $x;
}
}

View File

@ -1,6 +1,5 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
if(!$member['mb_id']) if(!$member['mb_id'])
die(json_encode(array('error' => '회원 로그인 후 이용해 주십시오.'))); die(json_encode(array('error' => '회원 로그인 후 이용해 주십시오.')));

View File

@ -1,6 +1,5 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
define('G5_IS_SHOP_AJAX_LIST', true); define('G5_IS_SHOP_AJAX_LIST', true);

View File

@ -1,6 +1,5 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php'); include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
if($default['de_pg_service'] != 'inicis' && ! ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) ) if($default['de_pg_service'] != 'inicis' && ! ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) )

View File

@ -1,20 +1,22 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
include(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php'); include(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
// 카카오페이를 사용하지 않을 경우 // 카카오페이를 사용하지 않을 경우
if( ! $default['de_kakaopay_enckey'] ) die('카카오페이를 사용하지 않습니다.'); if (!$default['de_kakaopay_enckey']) {
die('카카오페이를 사용하지 않습니다.');
}
if( ! ($default['de_kakaopay_mid'] && $default['de_kakaopay_key']) ){ if (!($default['de_kakaopay_mid'] && $default['de_kakaopay_key'])) {
die(json_encode(array('error'=>'올바른 방법으로 이용해 주십시오.'))); die(json_encode(array('error' => '올바른 방법으로 이용해 주십시오.')));
} }
$orderNumber = get_session('ss_order_id'); $orderNumber = get_session('ss_order_id');
$price = preg_replace('#[^0-9]#', '', $_POST['price']); $price = preg_replace('#[^0-9]#', '', $_POST['price']);
if(strlen($price) < 1) if (strlen($price) < 1) {
die(json_encode(array('error'=>'가격이 올바르지 않습니다.'))); die(json_encode(array('error' => '가격이 올바르지 않습니다.')));
}
// //
//################################### //###################################

View File

@ -1,6 +1,5 @@
<?php <?php
include_once('./_common.php'); include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
// LG유플러스 공통 설정 // LG유플러스 공통 설정
require_once(G5_SHOP_PATH.'/settle_lg.inc.php'); require_once(G5_SHOP_PATH.'/settle_lg.inc.php');