회원관리파일 병합연산자 -> 삼항연산자로 수정

This commit is contained in:
chym1217
2025-09-18 14:41:40 +09:00
parent 7e8eff5395
commit b98d45615c
4 changed files with 57 additions and 57 deletions

View File

@ -260,7 +260,7 @@ $colspan = 16;
<td headers="mb_list_mailr" class="td_consent"> <td headers="mb_list_mailr" class="td_consent">
<label for="mb_mailling_<?php echo $i; ?>" class="sound_only">메일수신</label> <label for="mb_mailling_<?php echo $i; ?>" class="sound_only">메일수신</label>
<input type="checkbox" name="mb_mailling[<?php echo $i; ?>]" <?php echo $row['mb_mailling'] ? 'checked' : ''; ?> value="1" id="mb_mailling_<?php echo $i; ?>"> <input type="checkbox" name="mb_mailling[<?php echo $i; ?>]" <?php echo $row['mb_mailling'] ? 'checked' : ''; ?> value="1" id="mb_mailling_<?php echo $i; ?>">
<input type="hidden" name="mb_mailling_default[<?php echo $i; ?>]" value="<?php echo $row['mb_mailling'] ?? '0'; ?> " id="mb_mailling_default_<?php echo $i; ?>"> <input type="hidden" name="mb_mailling_default[<?php echo $i; ?>]" value="<?php echo isset($row['mb_mailling']) ? $row['mb_mailling'] : '0'; ?> " id="mb_mailling_default_<?php echo $i; ?>">
</td> </td>
<td headers="mb_list_auth" class="td_mbstat"> <td headers="mb_list_auth" class="td_mbstat">
<?php <?php
@ -285,7 +285,7 @@ $colspan = 16;
<td headers="mb_list_sms"> <td headers="mb_list_sms">
<label for="mb_sms_<?php echo $i; ?>" class="sound_only">SMS수신</label> <label for="mb_sms_<?php echo $i; ?>" class="sound_only">SMS수신</label>
<input type="checkbox" name="mb_sms[<?php echo $i; ?>]" <?php echo $row['mb_sms'] ? 'checked' : ''; ?> value="1" id="mb_sms_<?php echo $i; ?>"> <input type="checkbox" name="mb_sms[<?php echo $i; ?>]" <?php echo $row['mb_sms'] ? 'checked' : ''; ?> value="1" id="mb_sms_<?php echo $i; ?>">
<input type="hidden" name="mb_sms_default[<?php echo $i; ?>]" value="<?php echo $row['mb_sms'] ?? '0'; ?> " id="mb_sms_default_<?php echo $i; ?>"> <input type="hidden" name="mb_sms_default[<?php echo $i; ?>]" value="<?php echo isset($row['mb_sms']) ? $row['mb_sms'] : '0'; ?> " id="mb_sms_default_<?php echo $i; ?>">
</td> </td>
<td headers="mb_list_adultc"> <td headers="mb_list_adultc">
<label for="mb_adult_<?php echo $i; ?>" class="sound_only">성인인증</label> <label for="mb_adult_<?php echo $i; ?>" class="sound_only">성인인증</label>

View File

@ -49,7 +49,7 @@ function get_export_config($type = null)
], ],
]; ];
return $type ? ($config[$type] ?? []) : $config; return $type ? (isset($config[$type]) ? $config[$type] : []) : $config;
} }
/** /**
@ -58,7 +58,7 @@ function get_export_config($type = null)
function get_member_export_params() function get_member_export_params()
{ {
// 친구톡 양식 - 엑셀 양식에 포함할 항목 // 친구톡 양식 - 엑셀 양식에 포함할 항목
$fieldArray = array_map('trim', explode(',', $_GET['fields'] ?? '')); $fieldArray = array_map('trim', explode(',', isset($_GET['fields']) ? $_GET['fields'] : ''));
$vars = []; $vars = [];
foreach ($fieldArray as $index => $field) { foreach ($fieldArray as $index => $field) {
if(!empty($field)){ if(!empty($field)){
@ -68,29 +68,29 @@ function get_member_export_params()
$params = [ $params = [
'page' => 1, 'page' => 1,
'formatType' => (int)($_GET['formatType'] ?? 1), 'formatType' => (int)(isset($_GET['formatType']) ? $_GET['formatType'] : 1),
'use_stx' => $_GET['use_stx'] ?? 0, 'use_stx' => isset($_GET['use_stx']) ? $_GET['use_stx'] : 0,
'stx_cond' => clean_xss_tags($_GET['stx_cond'] ?? 'like'), 'stx_cond' => clean_xss_tags(isset($_GET['stx_cond']) ? $_GET['stx_cond'] : 'like'),
'sfl' => clean_xss_tags($_GET['sfl'] ?? ''), 'sfl' => clean_xss_tags(isset($_GET['sfl']) ? $_GET['sfl'] : ''),
'stx' => clean_xss_tags($_GET['stx'] ?? ''), 'stx' => clean_xss_tags(isset($_GET['stx']) ? $_GET['stx'] : ''),
'use_level' => $_GET['use_level'] ?? 0, 'use_level' => isset($_GET['use_level']) ? $_GET['use_level'] : 0,
'level_start' => (int)($_GET['level_start'] ?? 1), 'level_start' => (int)(isset($_GET['level_start']) ? $_GET['level_start'] : 1),
'level_end' => (int)($_GET['level_end'] ?? 10), 'level_end' => (int)(isset($_GET['level_end']) ? $_GET['level_end'] : 10),
'use_date' => $_GET['use_date'] ?? 0, 'use_date' => isset($_GET['use_date']) ? $_GET['use_date'] : 0,
'date_start' => clean_xss_tags($_GET['date_start'] ?? ''), 'date_start' => clean_xss_tags(isset($_GET['date_start']) ? $_GET['date_start'] : ''),
'date_end' => clean_xss_tags($_GET['date_end'] ?? ''), 'date_end' => clean_xss_tags(isset($_GET['date_end']) ? $_GET['date_end'] : ''),
'use_point' => $_GET['use_point'] ?? 0, 'use_point' => isset($_GET['use_point']) ? $_GET['use_point'] : 0,
'point' => $_GET['point'] ?? '', 'point' => isset($_GET['point']) ? $_GET['point'] : '',
'point_cond' => $_GET['point_cond'] ?? 'gte', 'point_cond' => isset($_GET['point_cond']) ? $_GET['point_cond'] : 'gte',
'use_hp_exist' => $_GET['use_hp_exist'] ?? 0, 'use_hp_exist' => isset($_GET['use_hp_exist']) ? $_GET['use_hp_exist'] : 0,
'ad_range_only' => $_GET['ad_range_only'] ?? 0, 'ad_range_only' => isset($_GET['ad_range_only']) ? $_GET['ad_range_only'] : 0,
'ad_range_type' => clean_xss_tags($_GET['ad_range_type'] ?? 'all'), 'ad_range_type' => clean_xss_tags(isset($_GET['ad_range_type']) ? $_GET['ad_range_type'] : 'all'),
'ad_mailling' => $_GET['ad_mailling'] ?? 0, 'ad_mailling' => isset($_GET['ad_mailling']) ? $_GET['ad_mailling'] : 0,
'ad_sms' => $_GET['ad_sms'] ?? 0, 'ad_sms' => isset($_GET['ad_sms']) ? $_GET['ad_sms'] : 0,
'agree_date_start' => clean_xss_tags($_GET['agree_date_start'] ?? ''), 'agree_date_start' => clean_xss_tags(isset($_GET['agree_date_start']) ? $_GET['agree_date_start'] : ''),
'agree_date_end' => clean_xss_tags($_GET['agree_date_end'] ?? ''), 'agree_date_end' => clean_xss_tags(isset($_GET['agree_date_end']) ? $_GET['agree_date_end'] : ''),
'use_intercept' => $_GET['use_intercept'] ?? 0, 'use_intercept' => isset($_GET['use_intercept']) ? $_GET['use_intercept'] : 0,
'intercept' => clean_xss_tags($_GET['intercept'] ?? 'exclude'), 'intercept' => clean_xss_tags(isset($_GET['intercept']) ? $_GET['intercept'] : 'exclude'),
'vars' => $vars, 'vars' => $vars,
]; ];
@ -212,7 +212,7 @@ function member_export_build_where($params)
// 정보수신동의 조건 // 정보수신동의 조건
if (!empty($params['ad_range_only']) && $params['ad_range_only'] === '1') { if (!empty($params['ad_range_only']) && $params['ad_range_only'] === '1') {
$range = $params['ad_range_type'] ?? ''; $range = isset($params['ad_range_type']) ? $params['ad_range_type'] : '';
// 공통: 마케팅 목적 수집·이용 동의 + (필요 시) 제3자 동의 // 공통: 마케팅 목적 수집·이용 동의 + (필요 시) 제3자 동의
$thirdparty_clause = $config['cf_sms_use'] !== '' ? " AND mb_thirdparty_agree = 1" : ""; $thirdparty_clause = $config['cf_sms_use'] !== '' ? " AND mb_thirdparty_agree = 1" : "";
@ -241,8 +241,8 @@ function member_export_build_where($params)
} else { } else {
// 수신동의기간 직접 입력 - custom_period // 수신동의기간 직접 입력 - custom_period
$date_start = $params['agree_date_start'] ?? ''; $date_start = isset($params['agree_date_start']) ? $params['agree_date_start'] : '';
$date_end = $params['agree_date_end'] ?? ''; $date_end = isset($params['agree_date_end']) ? $params['agree_date_end'] : '';
if ($date_start && $date_end) { if ($date_start && $date_end) {
$emailDateCond = "mb_mailling_date BETWEEN '{$date_start} 00:00:00' AND '{$date_end} 23:59:59'"; $emailDateCond = "mb_mailling_date BETWEEN '{$date_start} 00:00:00' AND '{$date_end} 23:59:59'";

View File

@ -69,10 +69,10 @@ $colspan = 14;
} }
?> ?>
</select> </select>
<input type="text" name="stx" value="<?php echo htmlspecialchars($_GET['stx'] ?? ''); ?>" placeholder="검색어 입력"> <input type="text" name="stx" value="<?php echo htmlspecialchars(isset($_GET['stx']) ? $_GET['stx'] : ''); ?>" placeholder="검색어 입력">
<span class="radio_group"> <span class="radio_group">
<label><input type="radio" name="stx_cond" value="like" <?php echo ($_GET['stx_cond'] ?? 'like') === 'like' ? 'checked' : ''; ?>> 포함</label> <label><input type="radio" name="stx_cond" value="like" <?php echo (isset($_GET['stx_cond']) ? $_GET['stx_cond'] : 'like') === 'like' ? 'checked' : ''; ?>> 포함</label>
<label><input type="radio" name="stx_cond" value="equal" <?php echo ($_GET['stx_cond'] ?? '') === 'equal' ? 'checked' : ''; ?>> 일치</label> <label><input type="radio" name="stx_cond" value="equal" <?php echo (isset($_GET['stx_cond']) ? $_GET['stx_cond'] : '') === 'equal' ? 'checked' : ''; ?>> 일치</label>
</span> </span>
</div> </div>
</div> </div>
@ -102,8 +102,8 @@ $colspan = 14;
<label><input type="checkbox" name="use_date" value="1" <?php echo isset($_GET['use_date']) ? 'checked' : ''; ?>> 가입기간 적용</label> <label><input type="checkbox" name="use_date" value="1" <?php echo isset($_GET['use_date']) ? 'checked' : ''; ?>> 가입기간 적용</label>
</div> </div>
<div class="field"> <div class="field">
<input type="date" name="date_start" max="9999-12-31" value="<?php echo htmlspecialchars($_GET['date_start'] ?? ''); ?>"> ~ <input type="date" name="date_start" max="9999-12-31" value="<?php echo htmlspecialchars(isset($_GET['date_start']) ? $_GET['date_start'] : ''); ?>"> ~
<input type="date" name="date_end" max="9999-12-31" value="<?php echo htmlspecialchars($_GET['date_end'] ?? ''); ?>"> <input type="date" name="date_end" max="9999-12-31" value="<?php echo htmlspecialchars(isset($_GET['date_end']) ? $_GET['date_end'] : ''); ?>">
</div> </div>
</div> </div>
@ -113,11 +113,11 @@ $colspan = 14;
<label><input type="checkbox" name="use_point" value="1" <?php echo isset($_GET['use_point']) ? 'checked' : ''; ?>> 포인트 적용</label> <label><input type="checkbox" name="use_point" value="1" <?php echo isset($_GET['use_point']) ? 'checked' : ''; ?>> 포인트 적용</label>
</div> </div>
<div class="field"> <div class="field">
<input type="number" name="point" value="<?php echo htmlspecialchars($_GET['point'] ?? ''); ?>" placeholder="포인트 입력"> <input type="number" name="point" value="<?php echo htmlspecialchars(isset($_GET['point']) ? $_GET['point'] : ''); ?>" placeholder="포인트 입력">
<span class="radio_group"> <span class="radio_group">
<label><input type="radio" name="point_cond" value="gte" <?php echo ($_GET['point_cond'] ?? 'gte') === 'gte' ? 'checked' : ''; ?>> 이상</label> <label><input type="radio" name="point_cond" value="gte" <?php echo (isset($_GET['point_cond']) ? $_GET['point_cond'] : 'gte') === 'gte' ? 'checked' : ''; ?>> 이상</label>
<label><input type="radio" name="point_cond" value="lte" <?php echo ($_GET['point_cond'] ?? '') === 'lte' ? 'checked' : ''; ?>> 이하</label> <label><input type="radio" name="point_cond" value="lte" <?php echo (isset($_GET['point_cond']) ? $_GET['point_cond'] : '') === 'lte' ? 'checked' : ''; ?>> 이하</label>
<label><input type="radio" name="point_cond" value="eq" <?php echo ($_GET['point_cond'] ?? '') === 'eq' ? 'checked' : ''; ?>> 일치</label> <label><input type="radio" name="point_cond" value="eq" <?php echo (isset($_GET['point_cond']) ? $_GET['point_cond'] : '') === 'eq' ? 'checked' : ''; ?>> 일치</label>
</span> </span>
</div> </div>
</div> </div>
@ -132,7 +132,7 @@ $colspan = 14;
<?php <?php
// 차단회원 옵션 : [정의] get_export_config() - adm/member_list_exel.lib.php // 차단회원 옵션 : [정의] get_export_config() - adm/member_list_exel.lib.php
foreach (get_export_config('intercept_list') as $val => $label) { foreach (get_export_config('intercept_list') as $val => $label) {
$selected = (($_GET['intercept'] ?? '') === $val) ? 'selected' : ''; $selected = ((isset($_GET['intercept']) ? $_GET['intercept'] : '') === $val) ? 'selected' : '';
echo "<option value=\"$val\" $selected>$label</option>"; echo "<option value=\"$val\" $selected>$label</option>";
} }
?> ?>
@ -171,7 +171,7 @@ $colspan = 14;
<select name="ad_range_type" id="ad_range_type"> <select name="ad_range_type" id="ad_range_type">
<?php <?php
foreach (get_export_config('ad_range_list') as $val => $label) { foreach (get_export_config('ad_range_list') as $val => $label) {
$selected = (($_GET['ad_range_type'] ?? '') === $val) ? 'selected' : ''; $selected = ((isset($_GET['ad_range_type']) ? $_GET['ad_range_type'] : '') === $val) ? 'selected' : '';
echo "<option value=\"$val\" $selected>$label</option>"; echo "<option value=\"$val\" $selected>$label</option>";
} }
?> ?>
@ -179,10 +179,10 @@ $colspan = 14;
<div class="ad_range_wrap"> <div class="ad_range_wrap">
<!-- 기간 직접 입력 --> <!-- 기간 직접 입력 -->
<div class="ad_range_box <?php echo isset($_GET['ad_range_only']) && ($_GET['ad_range_type'] ?? '') == 'custom_period' ? '' : 'is-hidden'; ?>"> <div class="ad_range_box <?php echo isset($_GET['ad_range_only']) && (isset($_GET['ad_range_type']) ? $_GET['ad_range_type'] : '') == 'custom_period' ? '' : 'is-hidden'; ?>">
<div class="field"> <div class="field">
<input type="date" name="agree_date_start" max="9999-12-31" value="<?php echo htmlspecialchars($_GET['agree_date_start'] ?? date('Y-m-d', strtotime('-1 month'))); ?>"> ~ <input type="date" name="agree_date_start" max="9999-12-31" value="<?php echo htmlspecialchars(isset($_GET['agree_date_start']) ? $_GET['agree_date_start'] : date('Y-m-d', strtotime('-1 month'))); ?>"> ~
<input type="date" name="agree_date_end" max="9999-12-31" value="<?php echo htmlspecialchars($_GET['agree_date_end'] ?? date('Y-m-d')); ?>"> <input type="date" name="agree_date_end" max="9999-12-31" value="<?php echo htmlspecialchars(isset($_GET['agree_date_end']) ? $_GET['agree_date_end'] : date('Y-m-d')); ?>">
<p>* 광고성 정보 수신(<b>이메일 또는 SMS/카카오톡</b>) 동의일자 기준</p> <p>* 광고성 정보 수신(<b>이메일 또는 SMS/카카오톡</b>) 동의일자 기준</p>
</div> </div>
</div> </div>

View File

@ -25,7 +25,7 @@ $resultExcelDelete = member_export_delete();
member_export_set_sse_headers(); member_export_set_sse_headers();
// 모드 확인 // 모드 확인
$mode = $_GET['mode'] ?? ''; $mode = isset($_GET['mode']) ? $_GET['mode'] : '';
if ($mode !== 'start') { if ($mode !== 'start') {
member_export_send_progress("error", "잘못된 요청 입니다."); member_export_send_progress("error", "잘못된 요청 입니다.");
member_export_write_log($params, ['success' => false, 'error' => '잘못된 요청 입니다.']); member_export_write_log($params, ['success' => false, 'error' => '잘못된 요청 입니다.']);
@ -107,7 +107,7 @@ function main_member_export($params)
member_export_send_progress("progress", "", 1, $total, $total); member_export_send_progress("progress", "", 1, $total, $total);
} }
member_export_write_log($params, ['success' => true, 'total' => $total, 'files' => $fileList, 'zip' => $zipFileName ?? null]); member_export_write_log($params, ['success' => true, 'total' => $total, 'files' => $fileList, 'zip' => isset($zipFileName) ? $zipFileName : null]);
member_export_send_progress("done", "", 2, $total, $total, $pages, $pages, $fileList, $zipFileName); member_export_send_progress("done", "", 2, $total, $total, $pages, $pages, $fileList, $zipFileName);
} }
@ -211,13 +211,13 @@ function member_export_get_data($params)
// SQL 필드 생성 // SQL 필드 생성
$sqlFields = []; $sqlFields = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$sqlFields[] = $sqlTransformMap[$field] ?? $field; $sqlFields[] = isset($sqlTransformMap[$field]) ? $sqlTransformMap[$field] : $field;
} }
$field_list = implode(', ', $sqlFields); $field_list = implode(', ', $sqlFields);
$where = member_export_build_where($params); $where = member_export_build_where($params);
$page = (int)($params['page'] ?? 1); $page = (int)(isset($params['page']) ? $params['page'] : 1);
if ($page < 1) $page = 1; if ($page < 1) $page = 1;
$offset = ($page - 1) * MEMBER_EXPORT_PAGE_SIZE; $offset = ($page - 1) * MEMBER_EXPORT_PAGE_SIZE;
@ -233,7 +233,7 @@ function member_export_get_data($params)
while ($row = sql_fetch_array($result)) { while ($row = sql_fetch_array($result)) {
$rowData = []; $rowData = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$rowData[] = $row[$field] ?? ''; $rowData[] = isset($row[$field]) ? $row[$field] : '';
} }
$excelData[] = $rowData; $excelData[] = $rowData;
} }
@ -430,7 +430,7 @@ function member_export_write_log($params, $result = [])
$maxSize = 1024 * 1024 * 2; // 2MB $maxSize = 1024 * 1024 * 2; // 2MB
$maxFiles = 10; // 최대 로그 파일 수 (필요시 조정) $maxFiles = 10; // 최대 로그 파일 수 (필요시 조정)
$username = $member['mb_id'] ?? 'guest'; $username = isset($member['mb_id']) ? $member['mb_id'] : 'guest';
$datetime = date("Y-m-d H:i:s"); $datetime = date("Y-m-d H:i:s");
if (!is_dir(MEMBER_LOG_DIR)) { if (!is_dir(MEMBER_LOG_DIR)) {
@ -443,7 +443,7 @@ function member_export_write_log($params, $result = [])
// 최신 파일 기준 정렬 (최신 → 오래된) // 최신 파일 기준 정렬 (최신 → 오래된)
usort($logFiles, fn($a, $b) => filemtime($b) - filemtime($a)); usort($logFiles, fn($a, $b) => filemtime($b) - filemtime($a));
$latestLogFile = $logFiles[0] ?? null; $latestLogFile = isset($logFiles[0]) ? $logFiles[0] : null;
// 용량 기준으로 새 파일 생성 // 용량 기준으로 새 파일 생성
if (!$latestLogFile || filesize($latestLogFile) >= $maxSize) { if (!$latestLogFile || filesize($latestLogFile) >= $maxSize) {
@ -470,7 +470,7 @@ function member_export_write_log($params, $result = [])
if ($params['use_stx'] == 1 && !empty($params['stx'])) { if ($params['use_stx'] == 1 && !empty($params['stx'])) {
$sfl_list = get_export_config('sfl_list'); $sfl_list = get_export_config('sfl_list');
$label = $sfl_list[$params['sfl']] ?? ''; $label = isset($sfl_list[$params['sfl']]) ? $sfl_list[$params['sfl']] : '';
$condition[] = "검색({$params['stx_cond']}) : {$label} - {$params['stx']}"; $condition[] = "검색({$params['stx_cond']}) : {$label} - {$params['stx']}";
} }
@ -487,7 +487,7 @@ function member_export_write_log($params, $result = [])
// 포인트 조건 // 포인트 조건
if ($params['use_point'] == 1 && $params['point'] !== '') { if ($params['use_point'] == 1 && $params['point'] !== '') {
$point_cond_map = get_export_config('point_cond_map'); $point_cond_map = get_export_config('point_cond_map');
$symbol = $point_cond_map[$params['point_cond']] ?? '≥'; $symbol = isset($point_cond_map[$params['point_cond']]) ? $point_cond_map[$params['point_cond']] : '≥';
$condition[] = "포인트 {$symbol} {$params['point']}"; $condition[] = "포인트 {$symbol} {$params['point']}";
} }
@ -499,7 +499,7 @@ function member_export_write_log($params, $result = [])
// 광고 수신 동의 // 광고 수신 동의
if ($params['ad_range_only'] == 1) { if ($params['ad_range_only'] == 1) {
$ad_range_list = get_export_config('ad_range_list'); $ad_range_list = get_export_config('ad_range_list');
$label = $ad_range_list[$params['ad_range_type']] ?? ''; $label = isset($ad_range_list[$params['ad_range_type']]) ? $ad_range_list[$params['ad_range_type']] : '';
$condition[] = "수신동의: 예 ({$label})"; $condition[] = "수신동의: 예 ({$label})";
if ($params['ad_range_type'] == "custom_period" && ($params['agree_date_start'] || $params['agree_date_end'])) { if ($params['ad_range_type'] == "custom_period" && ($params['agree_date_start'] || $params['agree_date_end'])) {
@ -521,7 +521,7 @@ function member_export_write_log($params, $result = [])
// 차단회원 처리 // 차단회원 처리
if ($params['use_intercept'] == 1) { if ($params['use_intercept'] == 1) {
$intercept_list = get_export_config('intercept_list'); $intercept_list = get_export_config('intercept_list');
$label = $intercept_list[$params['intercept']] ?? ''; $label = isset($intercept_list[$params['intercept']]) ? $intercept_list[$params['intercept']] : '';
if ($label) $condition[] = $label; if ($label) $condition[] = $label;
} }
@ -530,8 +530,8 @@ function member_export_write_log($params, $result = [])
// 성공일 경우 추가 정보 // 성공일 경우 추가 정보
if ($success) { if ($success) {
$total = $result['total'] ?? 0; $total = isset($result['total']) ? $result['total'] : 0;
$fileCount = isset($result['zip']) ? 1 : count($result['files'] ?? []); $fileCount = isset($result['zip']) ? 1 : count(isset($result['files']) ? $result['files'] : []);
$line1 .= " | 총 {$total}건 | 파일: {$fileCount}"; $line1 .= " | 총 {$total}건 | 파일: {$fileCount}";
} }