PHP8 버전에서 경고코드가 표시되는 코드 수정

This commit is contained in:
thisgun
2021-01-08 15:45:55 +09:00
parent 5e5cd396c4
commit be2f27a7fa
2 changed files with 38 additions and 38 deletions

View File

@ -96,48 +96,48 @@ function get_menu_db($use_mobile=0, $is_cache=false){
global $g5;
static $cache = array();
$cache = run_replace('get_menu_db_cache', $cache, $use_mobile, $is_cache);
$key = md5($use_mobile);
$cache = run_replace('get_menu_db_cache', $cache, $use_mobile, $is_cache);
$key = md5($use_mobile);
if( $is_cache && isset($cache[$key]) ){
return $cache[$key];
}
$where = $use_mobile ? "me_mobile_use = '1'" : "me_use = '1'";
if( !($cache[$key] = run_replace('get_menu_db', array(), $use_mobile)) ){
$sql = " select *
from {$g5['menu_table']}
where $where
and length(me_code) = '2'
order by me_order, me_id ";
$result = sql_query($sql, false);
$where = $use_mobile ? "me_mobile_use = '1'" : "me_use = '1'";
for ($i=0; $row=sql_fetch_array($result); $i++) {
$row['ori_me_link'] = $row['me_link'];
$row['me_link'] = short_url_clean($row['me_link']);
if( !($cache[$key] = run_replace('get_menu_db', array(), $use_mobile)) ){
$sql = " select *
from {$g5['menu_table']}
where $where
and length(me_code) = '2'
order by me_order, me_id ";
$result = sql_query($sql, false);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$row['ori_me_link'] = $row['me_link'];
$row['me_link'] = short_url_clean($row['me_link']);
$row['sub'] = isset($row['sub']) ? $row['sub'] : array();
$cache[$key][$i] = $row;
$cache[$key][$i] = $row;
$sql2 = " select *
from {$g5['menu_table']}
where $where
and length(me_code) = '4'
and substring(me_code, 1, 2) = '{$row['me_code']}'
order by me_order, me_id ";
$result2 = sql_query($sql2);
for ($k=0; $row2=sql_fetch_array($result2); $k++) {
$row2['ori_me_link'] = $row2['me_link'];
$row2['me_link'] = short_url_clean($row2['me_link']);
$cache[$key][$i]['sub'][$k] = $row2;
}
}
}
$sql2 = " select *
from {$g5['menu_table']}
where $where
and length(me_code) = '4'
and substring(me_code, 1, 2) = '{$row['me_code']}'
order by me_order, me_id ";
$result2 = sql_query($sql2);
for ($k=0; $row2=sql_fetch_array($result2); $k++) {
$row2['ori_me_link'] = $row2['me_link'];
$row2['me_link'] = short_url_clean($row2['me_link']);
$cache[$key][$i]['sub'][$k] = $row2;
}
}
}
return $cache[$key];
return $cache[$key];
}
// 게시판 테이블에서 하나의 행을 읽음
@ -465,7 +465,7 @@ function get_memo_not_read($mb_id, $add_where='')
$sql = " SELECT count(*) as cnt FROM {$g5['memo_table']} WHERE me_recv_mb_id = '$mb_id' and me_type= 'recv' and me_read_datetime like '0%' $add_where ";
$row = sql_fetch($sql, false);
return $row['cnt'];
return isset($row['cnt']) ? $row['cnt'] : 0;
}
function get_scrap_totals($mb_id=''){
@ -476,5 +476,5 @@ function get_scrap_totals($mb_id=''){
$sql = " select count(*) as cnt from {$g5['scrap_table']} where 1=1 $add_where";
$row = sql_fetch($sql, false);
return $row['cnt'];
return isset($row['cnt']) ? $row['cnt'] : 0;
}