Checked PSR-1: Basic Coding Standard & type error

This commit is contained in:
kjh
2022-05-27 06:50:13 +00:00
parent 44650b31f6
commit 9199b7c986
4 changed files with 36 additions and 22 deletions

View File

@ -2,11 +2,13 @@
$sub_menu = "100510"; $sub_menu = "100510";
include_once('./_common.php'); include_once('./_common.php');
if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) {
alert('사용할 수 없는 기능입니다.', correct_goto_url(G5_ADMIN_URL)); alert('사용할 수 없는 기능입니다.', correct_goto_url(G5_ADMIN_URL));
}
if ($is_admin != 'super') if ($is_admin != 'super') {
alert('최고관리자만 접근 가능합니다.'); alert('최고관리자만 접근 가능합니다.');
}
$g5['title'] = 'Browscap 업데이트'; $g5['title'] = 'Browscap 업데이트';
include_once('./admin.head.php'); include_once('./admin.head.php');

View File

@ -2,15 +2,18 @@
$sub_menu = "100520"; $sub_menu = "100520";
include_once('./_common.php'); include_once('./_common.php');
if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) {
alert('사용할 수 없는 기능입니다.', correct_goto_url(G5_ADMIN_URL)); alert('사용할 수 없는 기능입니다.', correct_goto_url(G5_ADMIN_URL));
}
if ($is_admin != 'super') if ($is_admin != 'super') {
alert('최고관리자만 접근 가능합니다.'); alert('최고관리자만 접근 가능합니다.');
}
$rows = isset($_GET['rows']) ? preg_replace('#[^0-9]#', '', $_GET['rows']) : 0; $rows = isset($_GET['rows']) ? preg_replace('#[^0-9]#', '', $_GET['rows']) : 0;
if(!$rows) if (!$rows) {
$rows = 100; $rows = 100;
}
$g5['title'] = '접속로그 변환'; $g5['title'] = '접속로그 변환';
include_once('./admin.head.php'); include_once('./admin.head.php');
@ -29,7 +32,7 @@ $(function() {
$.ajax({ $.ajax({
method: "GET", method: "GET",
url: "./browscap_converter.php", url: "./browscap_converter.php",
data: { rows: "<?php echo $rows; ?>" }, data: { rows: "<?php echo strval($rows); ?>" },
async: true, async: true,
cache: false, cache: false,
dataType: "html", dataType: "html",

View File

@ -5,14 +5,16 @@ include_once('./_common.php');
// clean the output buffer // clean the output buffer
ob_end_clean(); ob_end_clean();
if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) {
die('사용할 수 없는 기능입니다.'); die('사용할 수 없는 기능입니다.');
}
if($is_admin != 'super') if ($is_admin != 'super') {
die('최고관리자로 로그인 후 실행해 주세요.'); die('최고관리자로 로그인 후 실행해 주세요.');
}
// browscap cache 파일 체크 // browscap cache 파일 체크
if(!is_file(G5_DATA_PATH.'/cache/browscap_cache.php')) { if (!is_file(G5_DATA_PATH.'/cache/browscap_cache.php')) {
echo '<p>Browscap 정보가 없습니다. 아래 링크로 이동해 Browscap 정보를 업데이트 하세요.</p>'.PHP_EOL; echo '<p>Browscap 정보가 없습니다. 아래 링크로 이동해 Browscap 정보를 업데이트 하세요.</p>'.PHP_EOL;
echo '<p><a href="'.G5_ADMIN_URL.'/browscap.php">Browscap 업데이트</a></p>'.PHP_EOL; echo '<p><a href="'.G5_ADMIN_URL.'/browscap.php">Browscap 업데이트</a></p>'.PHP_EOL;
exit; exit;
@ -24,13 +26,14 @@ $browscap->doAutoUpdate = false;
$browscap->cacheFilename = 'browscap_cache.php'; $browscap->cacheFilename = 'browscap_cache.php';
// 데이터 변환 // 데이터 변환
$rows = preg_replace('#[^0-9]#', '', $_GET['rows']); $rows = isset($_GET['rows']) ? preg_replace('#[^0-9]#', '', $_GET['rows']) : 0;
if(!$rows) if (!$rows) {
$rows = 100; $rows = 100;
}
$sql_common = " from {$g5['visit_table']} where vi_agent <> '' and ( vi_browser = '' or vi_os = '' or vi_device = '' ) "; $sql_common = " from {$g5['visit_table']} where vi_agent <> '' and ( vi_browser = '' or vi_os = '' or vi_device = '' ) ";
$sql_order = " order by vi_id desc "; $sql_order = " order by vi_id desc ";
$sql_limit = " limit 0, $rows "; $sql_limit = " limit 0, " . strval($rows) . " ";
$sql = " select count(vi_id) as cnt $sql_common "; $sql = " select count(vi_id) as cnt $sql_common ";
$row = sql_fetch($sql); $row = sql_fetch($sql);
@ -43,20 +46,23 @@ $sql = " select vi_id, vi_agent, vi_browser, vi_os, vi_device
$result = sql_query($sql); $result = sql_query($sql);
$cnt = 0; $cnt = 0;
for($i=0; $row=sql_fetch_array($result); $i++) { for ($i = 0; $row = sql_fetch_array($result); $i++) {
$info = $browscap->getBrowser($row['vi_agent']); $info = $browscap->getBrowser($row['vi_agent']);
$brow = $row['vi_browser']; $brow = $row['vi_browser'];
if(!$brow) if (!$brow) {
$brow = $info->Comment; $brow = $info->Comment;
}
$os = $row['vi_os']; $os = $row['vi_os'];
if(!$os) if (!$os) {
$os = $info->Platform; $os = $info->Platform;
}
$device = $row['vi_device']; $device = $row['vi_device'];
if(!$device) if (!$device) {
$device = $info->Device_Type; $device = $info->Device_Type;
}
$sql2 = " update {$g5['visit_table']} $sql2 = " update {$g5['visit_table']}
set vi_browser = '$brow', set vi_browser = '$brow',
@ -68,7 +74,8 @@ for($i=0; $row=sql_fetch_array($result); $i++) {
$cnt++; $cnt++;
} }
if(($total_count - $cnt) == 0 || $total_count == 0) if (($total_count - $cnt) == 0 || $total_count == 0) {
echo '<div class="check_processing"></div><p>변환완료</p>'; echo '<div class="check_processing"></div><p>변환완료</p>';
else } else {
echo '<p>총 '.number_format($total_count).'건 중 '.number_format($cnt).'건 변환완료<br><br>접속로그를 추가로 변환하시려면 아래 업데이트 버튼을 클릭해 주세요.</p><button type="button" id="run_update">업데이트</button>'; echo '<p>총 '.number_format($total_count).'건 중 '.number_format($cnt).'건 변환완료<br><br>접속로그를 추가로 변환하시려면 아래 업데이트 버튼을 클릭해 주세요.</p><button type="button" id="run_update">업데이트</button>';
}

View File

@ -7,11 +7,13 @@ include_once('./_common.php');
// clean the output buffer // clean the output buffer
ob_end_clean(); ob_end_clean();
if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) {
die('사용할 수 없는 기능입니다.'); die('사용할 수 없는 기능입니다.');
}
if ($is_admin != 'super') if ($is_admin != 'super') {
die('최고관리자만 접근 가능합니다.'); die('최고관리자만 접근 가능합니다.');
}
include_once(G5_PLUGIN_PATH.'/browscap/Browscap.php'); include_once(G5_PLUGIN_PATH.'/browscap/Browscap.php');