first commit 2
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
/**
|
||||
* 이메일의 본문 내용을 받아 전체 레이아웃 HTML을 반환하는 함수
|
||||
*
|
||||
* @param string $content 본문 내용 HTML
|
||||
* @return string 완성된 전체 이메일 HTML
|
||||
*/
|
||||
function get_mail_layout($content)
|
||||
{
|
||||
// HEREDOC 문법을 사용하여 HTML 구조를 정의합니다.
|
||||
// EOT; 로 끝날 때까지의 모든 내용을 $html 변수에 담습니다.
|
||||
$html = <<<EOT
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>메일 미리보기</title>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #fff;">
|
||||
<div style="width: 100%; max-width: 600px; margin: 40px auto; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden; font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;">
|
||||
|
||||
<!-- Header: 모든 메일에 공통으로 적용되는 상단 부분 -->
|
||||
<div style="padding: 30px; text-align: center; background-color: #f1f3f5; border-bottom: 1px solid #dee2e6;">
|
||||
<span style="font-size: 14px; color: #868e96; letter-spacing: 1px;">Contact Us</span>
|
||||
<h2 style="margin: 10px 0 0; font-size: 28px; color: #212529; font-weight: 600;">공간의 가능성을 열어보세요.</h2>
|
||||
<p style="margin: 10px 0 0; font-size: 16px; color: #495057;">성진미도어의 전문가와 상담하고, 당신의 공간에 꼭 맞는 솔루션을 찾아보세요.</p>
|
||||
</div>
|
||||
|
||||
<!-- Body: 이 부분이 템플릿 에디터의 내용으로 채워집니다. -->
|
||||
<div style="padding: 30px;">
|
||||
{$content}
|
||||
</div>
|
||||
|
||||
<!-- Footer: 모든 메일에 공통으로 적용되는 하단 부분 -->
|
||||
<div style="padding: 20px 30px; background-color: #f1f3f5; border-top: 1px solid #dee2e6; font-size: 14px; color: #868e96;">
|
||||
<h4 style="margin: 0 0 15px; font-size: 16px; color: #495057;">Information</h4>
|
||||
<p style="margin: 0 0 10px;">
|
||||
<strong>본사 및 전시장:</strong> 충청남도 아산시 음봉면 월산로 128-130
|
||||
</p>
|
||||
<p style="margin: 0 0 10px;">
|
||||
<strong>대표 연락처:</strong> T. 041-532-0555 / H. 010-5434-4126
|
||||
</p>
|
||||
<p style="margin: 0 0 10px;">
|
||||
<strong>청주 전시장:</strong> T. 043-235-2352 / H. 010-2066-4126
|
||||
</p>
|
||||
<p style="margin: 0;">
|
||||
<strong>운영시간:</strong> 평일 09:00 - 18:00 (주말 및 공휴일 휴무)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EOT;
|
||||
|
||||
return $html;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
/**
|
||||
* 이메일의 본문 내용을 받아 전체 레이아웃 HTML을 반환하는 함수
|
||||
*
|
||||
* @param string $content 본문 내용 HTML
|
||||
* @return string 완성된 전체 이메일 HTML
|
||||
*/
|
||||
function get_mail_layout($content)
|
||||
{
|
||||
// HEREDOC 문법을 사용하여 HTML 구조를 정의합니다.
|
||||
// EOT; 로 끝날 때까지의 모든 내용을 $html 변수에 담습니다.
|
||||
$html = <<<EOT
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>메일 미리보기</title>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #f8f9fa;">
|
||||
<div style="width: 100%; max-width: 600px; margin: 40px auto; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden; font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;">
|
||||
|
||||
<!-- Header: 모든 메일에 공통으로 적용되는 상단 부분 -->
|
||||
<div style="padding: 30px; text-align: center; background-color: #f1f3f5; border-bottom: 1px solid #dee2e6;">
|
||||
<span style="font-size: 14px; color: #868e96; letter-spacing: 1px;">Contact Us</span>
|
||||
<h2 style="margin: 10px 0 0; font-size: 28px; color: #212529; font-weight: 600;">공간의 가능성을 열어보세요.</h2>
|
||||
<p style="margin: 10px 0 0; font-size: 16px; color: #495057;">성진미도어의 전문가와 상담하고, 당신의 공간에 꼭 맞는 솔루션을 찾아보세요.</p>
|
||||
</div>
|
||||
|
||||
<!-- Body: 이 부분이 템플릿 에디터의 내용으로 채워집니다. -->
|
||||
<div style="padding: 30px;">
|
||||
{$content}
|
||||
</div>
|
||||
|
||||
<!-- Footer: 모든 메일에 공통으로 적용되는 하단 부분 -->
|
||||
<div style="padding: 20px 30px; background-color: #f1f3f5; border-top: 1px solid #dee2e6; font-size: 14px; color: #868e96;">
|
||||
<h4 style="margin: 0 0 15px; font-size: 16px; color: #495057;">Information</h4>
|
||||
<p style="margin: 0 0 10px;">
|
||||
<strong>본사 및 전시장:</strong> 충청남도 아산시 음봉면 월산로 128-130
|
||||
</p>
|
||||
<p style="margin: 0 0 10px;">
|
||||
<strong>대표 연락처:</strong> T. 041-532-0555 / H. 010-5434-4126
|
||||
</p>
|
||||
<p style="margin: 0 0 10px;">
|
||||
<strong>청주 전시장:</strong> T. 043-235-2352 / H. 010-2066-4126
|
||||
</p>
|
||||
<p style="margin: 0;">
|
||||
<strong>운영시간:</strong> 평일 09:00 - 18:00 (주말 및 공휴일 휴무)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EOT;
|
||||
|
||||
return $html;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
// 이 파일은 새 메일 템플릿 생성 시 기본으로 로드되는 헤더와 푸터 HTML을 정의합니다.
|
||||
|
||||
$default_header_html = <<<EOT
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{메일제목}</title>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #f8f9fa;">
|
||||
<div style="width: 100%; max-width: 600px; margin: 40px auto; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden; font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;">
|
||||
|
||||
<!-- Header -->
|
||||
<div style="padding: 30px; text-align: center; background-color: #f1f3f5; border-bottom: 1px solid #dee2e6;">
|
||||
<h2 style="margin: 10px 0 0; font-size: 28px; color: #212529; font-weight: 600;">공간의 가능성을 열어보세요.</h2>
|
||||
<p style="margin: 10px 0 0; font-size: 16px; color: #495057;">성진미도어의 전문가와 상담하고, 당신의 공간에 꼭 맞는 솔루션을 찾아보세요.</p>
|
||||
</div>
|
||||
EOT;
|
||||
|
||||
$default_footer_html = <<<EOT
|
||||
<!-- Footer -->
|
||||
<div style="padding: 20px 30px; background-color: #f1f3f5; border-top: 1px solid #dee2e6; font-size: 14px; color: #868e96;">
|
||||
<h4 style="margin: 0 0 15px; font-size: 16px; color: #495057;">Information</h4>
|
||||
<p style="margin: 0 0 10px;"><strong>본사 및 전시장:</strong> 충청남도 아산시 음봉면 월산로 128-130</p>
|
||||
<p style="margin: 0 0 10px;"><strong>대표 연락처:</strong> T. 041-532-0555 / H. 010-5434-4126</p>
|
||||
<p style="margin: 0 0 10px;"><strong>청주 전시장:</strong> T. 043-235-2352 / H. 010-2066-4126</p>
|
||||
<p style="margin: 0;"><strong>운영시간:</strong> 평일 09:00 - 18:00 (주말 및 공휴일 휴무)</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EOT;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
// 이 파일은 새 메일 템플릿 생성 시 기본으로 로드되는 헤더와 푸터 HTML을 정의합니다.
|
||||
$base_mail_templates_php_path = __DIR__.'/base/mail_layout.php';
|
||||
$mail_templates_php_path =__DIR__.'/'.$config['cf_theme'].'/mail_layout.php';
|
||||
if(file_exists($mail_templates_php_path)){
|
||||
include_once ($mail_templates_php_path);
|
||||
}else {
|
||||
include_once ($base_mail_templates_php_path);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
// 이 파일은 새 메일 템플릿 생성 시 기본으로 로드되는 헤더와 푸터 HTML을 정의합니다.
|
||||
|
||||
$default_header_html = <<<EOT
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{메일제목}</title>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #f8f9fa;">
|
||||
<div style="width: 100%; max-width: 600px; margin: 40px auto; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden; font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;">
|
||||
|
||||
<!-- Header -->
|
||||
<div style="padding: 30px; text-align: center; background-color: #f1f3f5; border-bottom: 1px solid #dee2e6;">
|
||||
<h2>귀사의 기술을 알리고 싶으신가요?</h2>
|
||||
<p>월간 레이저 기술이 귀사의 비즈니스 파트너가 되어드립니다.</p>
|
||||
</div>
|
||||
EOT;
|
||||
|
||||
$default_footer_html = <<<EOT
|
||||
<!-- Footer -->
|
||||
<div style="padding: 20px 30px; background-color: #f1f3f5; border-top: 1px solid #dee2e6; font-size: 14px; color: #868e96;">
|
||||
<h4 style="margin: 0 0 15px; font-size: 16px; color: #495057;">Information</h4>
|
||||
<p><strong>(주)레이저월드 / (주)한국산업정보센타</strong></p>
|
||||
<p><span>T. 02-868-0211</span></p>
|
||||
<p></p>
|
||||
<p>개인정보보호책임자: laser@laserworld.co.kr</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EOT;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<strong><?= $g5['title'] ?></strong>
|
||||
<p>시스템에서 발송된 모든 이메일의 성공 및 실패 기록을 확인할 수 있습니다.</p>
|
||||
</div>
|
||||
|
||||
<form name="fmaillog" id="fmaillog" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo get_admin_token(); ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>메일 발송 이력 목록</caption>
|
||||
<colgroup>
|
||||
<col class="grid_1"> <!-- Checkbox -->
|
||||
<col class="grid_1"> <!-- ID -->
|
||||
<col class="grid_2"> <!-- 받는사람 -->
|
||||
<col class="grid_2"> <!-- 참조 -->
|
||||
<col class="grid_2"> <!-- 숨은참조 -->
|
||||
<col> <!-- 제목 -->
|
||||
<col class="grid_1"> <!-- 상태 -->
|
||||
<col class="grid_3"> <!-- 관리 -->
|
||||
<col class="grid_4"> <!-- 상세 정보 -->
|
||||
<col class="grid_2"> <!-- 발송 시간 -->
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><input type="checkbox" name="chkall" value="1" id="chkall"></th>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">받는사람</th>
|
||||
<th scope="col">참조</th>
|
||||
<th scope="col">숨은참조</th>
|
||||
<th scope="col">제목</th>
|
||||
<th scope="col">상태</th>
|
||||
<th scope="col">관리</th>
|
||||
<th scope="col">발송에러 상세 정보</th>
|
||||
<th scope="col">발송 시간</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$is_empty = empty($list);
|
||||
if (!$is_empty) {
|
||||
foreach ($list as $row) {
|
||||
// 상태에 따라 다른 CSS 클래스 적용 (성공: 파란색, 실패: 빨간색)
|
||||
$status_class = $row['status'] === 'success' ? 'txt_true' : 'txt_done';
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_chk">
|
||||
<input type="checkbox" name="chk[]" value="<?= $row['id'] ?>" id="chk_<?= $row['id'] ?>">
|
||||
</td>
|
||||
<td class="td_num"><?= $row['id'] ?></td>
|
||||
<td class="td_left" title="<?= htmlspecialchars($row['to_email']) ?>"><?= htmlspecialchars($row['to_email']) ?></td>
|
||||
<td class="td_left" title="<?= htmlspecialchars($row['cc_email']) ?>"><?= htmlspecialchars($row['cc_email']) ?></td>
|
||||
<td class="td_left" title="<?= htmlspecialchars($row['bcc_email']) ?>"><?= htmlspecialchars($row['bcc_email']) ?></td>
|
||||
<td class="td_left"><?= htmlspecialchars($row['subject']) ?></td>
|
||||
<td class="td_state"><strong class="<?= $status_class ?>"><?= htmlspecialchars(ucfirst($row['status'])) ?></strong></td>
|
||||
<td class="td_mng td_mng_s">
|
||||
<button type="button" class="btn btn_03 preview-btn" data-content="<?php echo base64_encode(htmlspecialchars_decode(stripslashes($row['body']))); ?>">본문보기</button>
|
||||
<button type="button" class="btn btn_01 resend-btn" data-id="<?= $row['id'] ?>">재발송</button>
|
||||
</td>
|
||||
<td class="td_left" style="color: #666;"><?= htmlspecialchars($row['error_msg']) ?: '-' ?></td>
|
||||
<td class="td_datetime"><?= $row['send_time'] ?: 'N/A' ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_empty) {
|
||||
echo '<tr><td colspan="10" class="empty_table">발송된 이력이 없습니다.</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_list01 btn_list">
|
||||
<button type="button" id="bulk-resend-btn" class="btn btn_02">선택 재발송</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php echo $paging; ?>
|
||||
|
||||
<?php
|
||||
// [추가] AJAX 재발송 요청을 위한 URL을 자바스크립트에 전달합니다.
|
||||
?>
|
||||
<script>
|
||||
const ajax_resend_url = "<?php echo G5_ADMIN_URL; ?>/mail_manage/ajax_resend_mail.php";
|
||||
</script>
|
||||
<?php
|
||||
// 이 페이지에서 사용할 자바스크립트 파일을 로드합니다.
|
||||
add_javascript('<script src="'.G5_ADMIN_URL.'/mail_manage/assets/js/send_log_list.js?ver='.G5_JS_VER.'"></script>', 10);
|
||||
?>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
?>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>
|
||||
이 페이지에서 등록된 템플릿을 사용하여 테스트 메일을 발송할 수 있습니다.<br>
|
||||
템플릿을 선택하면 해당 템플릿에 정의된 변수 입력란이 자동으로 나타납니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form name="sendTestForm" id="sendTestForm" method="post" action="./send_test.php">
|
||||
<input type="hidden" name="token" value="<?php echo get_admin_token(); ?>">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>테스트 메일 발송</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="to_email">받는 사람 이메일</label></th>
|
||||
<td>
|
||||
<input type="email" name="to_email" id="to_email" required class="required frm_input" size="40" placeholder="test@example.com">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="template_code">메일 템플릿</label></th>
|
||||
<td>
|
||||
<select name="template_code" id="template_code" required class="required">
|
||||
<option value="">템플릿을 선택하세요</option>
|
||||
<?php foreach ($templates as $tpl): ?>
|
||||
<?php if ($tpl['is_use']): // 사용 중인 템플릿만 표시 ?>
|
||||
<option value="<?php echo htmlspecialchars($tpl['code']); ?>">
|
||||
<?php echo htmlspecialchars($tpl['title']); ?> (코드: <?php echo htmlspecialchars($tpl['code']); ?>)
|
||||
</option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- [수정] 템플릿 변수 입력 필드가 동적으로 추가될 영역 -->
|
||||
<div id="variable_fields" class="tbl_frm01 tbl_wrap" style="display: none; margin-top:0;">
|
||||
<!-- 템플릿을 선택하면 이곳에 변수 입력란이 자동으로 생성됩니다. -->
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<input type="submit" value="테스트 발송하기" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
const ajax_template_vars_url = "<?php echo G5_ADMIN_URL; ?>/mail_manage/ajax_get_template_vars.php";
|
||||
</script>
|
||||
<?php
|
||||
add_javascript('<script src="'.G5_ADMIN_URL.'/mail_manage/assets/js/send_test_form.js?ver='.G5_JS_VER.'"></script>', 10);
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
$g5['title'] = $smtp ? 'SMTP 설정 수정' : 'SMTP 설정 추가';
|
||||
include_once(G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$row = $smtp ?? [
|
||||
'id' => 0,
|
||||
'name' => '',
|
||||
'host' => '',
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'port' => 465,
|
||||
'encryption' => 'ssl',
|
||||
'from_email' => '',
|
||||
'from_name' => '',
|
||||
'is_use' => 1,
|
||||
];
|
||||
?>
|
||||
|
||||
<form name="fsmtpconfig" id="fsmtpconfig" method="post" action="./smtp_config.php">
|
||||
<input type="hidden" name="action" value="<?php echo $row['id'] ? 'update' : 'create'; ?>">
|
||||
<input type="hidden" name="id" value="<?php echo (int)$row['id']; ?>">
|
||||
<input type="hidden" name="token" value="<?php echo get_admin_token(); ?>">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="name">이름(용도)</label></th>
|
||||
<td><input type="text" name="name" id="name" required class="required frm_input" size="40" value="<?php echo get_text($row['name']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="host">SMTP 호스트</label></th>
|
||||
<td><input type="text" name="host" id="host" required class="required frm_input" size="40" value="<?php echo get_text($row['host']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="username">계정(아이디)</label></th>
|
||||
<td><input type="text" name="username" id="username" required class="required frm_input" size="40" value="<?php echo get_text($row['username']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="password">비밀번호</label></th>
|
||||
<td>
|
||||
<input type="password" name="password" id="password" class="frm_input" size="40" <?php if (!$row['id']) echo 'required'; ?>>
|
||||
<?php if ($row['id']) { ?>
|
||||
<span class="frm_info">비밀번호를 변경할 경우에만 입력하세요.</span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="port">포트</label></th>
|
||||
<td><input type="number" name="port" id="port" required class="required frm_input" size="10" value="<?php echo get_text($row['port']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="encryption">암호화 방식</label></th>
|
||||
<td>
|
||||
<select name="encryption" id="encryption" required>
|
||||
<option value="none" <?php echo ($row['encryption']=='none')?'selected':''; ?>>none</option>
|
||||
<option value="ssl" <?php echo ($row['encryption']=='ssl')?'selected':''; ?>>SSL</option>
|
||||
<option value="tls" <?php echo ($row['encryption']=='tls')?'selected':''; ?>>TLS</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="from_email">발신자 이메일</label></th>
|
||||
<td><input type="email" name="from_email" id="from_email" required class="required frm_input" size="40" value="<?php echo get_text($row['from_email']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="from_name">발신자 이름</label></th>
|
||||
<td><input type="text" name="from_name" id="from_name" required class="required frm_input" size="40" value="<?php echo get_text($row['from_name']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="is_use">사용 여부</label></th>
|
||||
<td><input type="checkbox" name="is_use" id="is_use" value="1" <?php echo $row['is_use'] ? 'checked' : ''; ?>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<a href="./smtp_config.php" class="btn_cancel btn">목록으로</a>
|
||||
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php include_once(G5_ADMIN_PATH.'/admin.tail.php'); ?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
?>
|
||||
<div class="local_ov01 local_ov">
|
||||
<strong>SMTP 설정 목록</strong>
|
||||
<p>이곳에서 메일 발송에 사용할 여러 SMTP 서버를 등록하고 관리할 수 있습니다.</p>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="?action=create_form" class="btn btn_01">SMTP 설정 추가</a>
|
||||
</div>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>SMTP 설정 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">이름(용도)</th>
|
||||
<th scope="col">호스트</th>
|
||||
<th scope="col">계정</th>
|
||||
<th scope="col">포트</th>
|
||||
<th scope="col">암호화</th>
|
||||
<th scope="col">발신자 이메일</th>
|
||||
<th scope="col">사용여부</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($smtp_list && count($smtp_list) > 0): ?>
|
||||
<?php foreach ($smtp_list as $row): ?>
|
||||
<tr>
|
||||
<td class="td_num"><?php echo $row['id']; ?></td>
|
||||
<td><?php echo get_text($row['name']); ?></td>
|
||||
<td><?php echo get_text($row['host']); ?></td>
|
||||
<td><?php echo get_text($row['username']); ?></td>
|
||||
<td class="td_num"><?php echo $row['port']; ?></td>
|
||||
<td class="td_num"><?php echo strtoupper($row['encryption']); ?></td>
|
||||
<td><?php echo get_text($row['from_email']); ?></td>
|
||||
<td class="td_num"><?php echo $row['is_use'] ? '<strong class="txt_true">사용</strong>' : '미사용'; ?></td>
|
||||
<td class="td_mng">
|
||||
<a href="?action=edit_form&id=<?php echo $row['id']; ?>" class="btn btn_03">수정</a>
|
||||
<form name="fdelete_<?php echo $row['id']; ?>" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" style="display:inline;">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
|
||||
<!-- token 값은 admin.js 에서 자동으로 채워주므로 비워둬도 괜찮습니다. -->
|
||||
<input type="hidden" name="token" value="">
|
||||
<button type="submit" class="btn btn_02" onclick="return confirm('정말 삭제하시겠습니까?');">삭제</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<tr>
|
||||
<td colspan="9" class="empty_table">등록된 SMTP 설정이 없습니다.</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
// $template 변수가 존재하면 '수정', 없으면 '추가'로 제목 설정
|
||||
$g5['title'] = isset($template) && $template['id'] ? '메일 템플릿 수정' : '메일 템플릿 추가';
|
||||
|
||||
// [수정] DHTML 에디터를 사용하므로 admin.head.php를 먼저 include 합니다.
|
||||
include_once(G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
// [수정] '추가' 모드일 때 기본 레이아웃을 로드하고, '수정' 모드일 때는 DB 데이터를 사용합니다.
|
||||
if (isset($template) && $template['id']) {
|
||||
// 수정 모드
|
||||
$row = $template;
|
||||
} else {
|
||||
// 추가 모드: 기본 레이아웃 파일을 불러와 기본값을 설정합니다.
|
||||
// 파일 경로는 사용자가 지정한 'mail_layout' 디렉토리를 사용합니다.
|
||||
include_once(__DIR__.'/mail_layout/mail_layout.php');
|
||||
$row = [
|
||||
'id' => 0,
|
||||
'code' => '',
|
||||
'title' => '',
|
||||
'content' => '<p>이곳에 메일 본문 내용을 입력하세요.</p>',
|
||||
'header_html' => $default_header_html ?? '',
|
||||
'footer_html' => $default_footer_html ?? '',
|
||||
'is_use' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- [삭제] Summernote 관련 CSS, JS 링크를 모두 제거합니다. -->
|
||||
|
||||
<style>
|
||||
/* 템플릿 폼 레이아웃을 위한 CSS */
|
||||
.template-container { display: flex; gap: 20px; margin-top: 20px; }
|
||||
.template-editor { flex: 3; } /* 에디터 영역을 더 넓게 */
|
||||
.template-vars { flex: 1; background: #f9f9f9; padding: 15px; border: 1px solid #ddd; border-radius: 4px; }
|
||||
.template-vars h3 { margin-top: 0; padding-bottom: 10px; border-bottom: 1px solid #eee; }
|
||||
.template-vars label { display: block; margin-top: 10px; font-weight: bold; }
|
||||
/* [추가] 헤더/푸터 textarea 스타일 */
|
||||
.template-layout-editor { margin-bottom: 20px; }
|
||||
.template-layout-editor h3 { margin: 0 0 5px; font-size: 1.1em; }
|
||||
.template-layout-editor textarea { width: 100%; height: 150px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-family: consolas, monospace; font-size: 1em; }
|
||||
</style>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>
|
||||
메일 내용에 <code>{변수명}</code> 형식으로 입력하면 오른쪽에 해당 변수에 대한 테스트 및 기본값 입력 창이 자동으로 생성됩니다.<br>
|
||||
이곳에 입력된 값은 템플릿과 함께 저장되며, 실제 발송 시 다른 값으로 치환되지 않았을 때의 기본값으로 사용될 수 있습니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- [수정] onsubmit 이벤트를 추가하여 에디터 내용을 전송前に textarea에 반영합니다. -->
|
||||
<form name="templateForm" id="templateForm" method="post" action="./template.php" onsubmit="return form_check(this);">
|
||||
<input type="hidden" name="action" value="<?php echo $row['id'] ? 'update' : 'create'; ?>">
|
||||
<input type="hidden" name="id" value="<?php echo (int)$row['id']; ?>">
|
||||
<input type="hidden" name="token" value="">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="code">템플릿 코드</label></th>
|
||||
<td>
|
||||
<input type="text" name="code" id="code" required class="required frm_input" size="40" value="<?php echo get_text($row['code']); ?>">
|
||||
<?php if ($row['id']): ?>
|
||||
<span class="frm_info">이 코드는 템플릿을 식별하는 고유 값이므로 변경에 주의하세요.</span>
|
||||
<?php else: ?>
|
||||
<span class="frm_info">영문, 숫자, 언더바(_)만 사용 가능하며, 다른 템플릿과 중복될 수 없습니다. (예: `member_join`)</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="title">이메일 제목</label></th>
|
||||
<td>
|
||||
<input type="text" name="title" id="title" required class="required frm_input" size="80" value="<?php echo get_text($row['title']); ?>" placeholder="예: {쇼핑몰명} - {username}님의 주문이 완료되었습니다.">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="is_use">사용 여부</label></th>
|
||||
<td><input type="checkbox" name="is_use" id="is_use" value="1" <?php echo $row['is_use'] ? 'checked' : ''; ?>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- [추가] 헤더 HTML 입력 영역 -->
|
||||
<div class="template-layout-editor">
|
||||
<h3>헤더 HTML</h3>
|
||||
<p class="frm_info">메일 본문 내용 위에 위치할 상단 레이아웃입니다. (로고, 인사말 등) 변수 감지 기능은 지원하지 않습니다.</p>
|
||||
<?php echo editor_html('header_html', get_text(stripslashes(htmlspecialchars_decode($row['header_html'], 1)))); ?>
|
||||
</div>
|
||||
|
||||
<div class="template-container">
|
||||
<div class="template-editor">
|
||||
<h3>이메일 내용 (HTML)</h3>
|
||||
<!-- [수정] GnuBoard DHTML 에디터(SmartEditor2)로 변경 -->
|
||||
<!-- 메일의 핵심 본문 영역입니다. -->
|
||||
<?php echo editor_html('content', get_text(stripslashes(htmlspecialchars_decode($row['content'], 1)))); ?>
|
||||
</div>
|
||||
|
||||
<div class="template-vars">
|
||||
<h3><strong>변수 기본값 설정</strong></h3>
|
||||
<p class="frm_info">'이메일 내용' 영역에서 감지된 변수 목록입니다.</p>
|
||||
<div id="variableInputs">
|
||||
<!-- 변수 감지 시 이곳에 입력 필드가 자동으로 생성됩니다. -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<!-- <a href="./template.php" class="btn_cancel btn">목록</a>-->
|
||||
<!-- [개선] 변수 새로고침 버튼 추가 -->
|
||||
<button type="button" onclick="refreshVariables()" class="btn">변수 새로고침</button>
|
||||
<!-- <button type="button" onclick="previewTemplate()" class="btn">미리보기</button>-->
|
||||
<!-- <input type="submit" value="저장하기" class="btn_submit btn" accesskey="s">-->
|
||||
</div>
|
||||
<!-- [추가] 푸터 HTML 입력 영역 -->
|
||||
<div class="template-layout-editor" style="margin-top: 20px;">
|
||||
<h3>푸터 HTML</h3>
|
||||
<p class="frm_info">메일 본문 내용 아래에 위치할 하단 레이아웃입니다. (회사 정보, 저작권 등) 변수 감지 기능은 지원하지 않습니다.</p>
|
||||
<?php echo editor_html('footer_html', get_text(stripslashes(htmlspecialchars_decode($row['footer_html'], 1)))); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<a href="./template.php" class="btn_cancel btn">목록</a>
|
||||
<!-- [개선] 변수 새로고침 버튼 추가 -->
|
||||
<button type="button" onclick="refreshVariables()" class="btn">변수 새로고침</button>
|
||||
<button type="button" onclick="previewTemplate()" class="btn">미리보기</button>
|
||||
<input type="submit" value="저장하기" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- PHP의 템플릿 변수 데이터를 JavaScript에서 사용할 수 있도록 변환 -->
|
||||
<script>
|
||||
const serverVars = <?php echo json_encode($template_vars ?? []); ?>;
|
||||
</script>
|
||||
|
||||
<?php
|
||||
// [수정] template_form.js 파일을 GnuBoard의 add_javascript 함수를 통해 로드합니다.
|
||||
// 이렇게 하면 jQuery 라이브러리가 먼저 로드된 후 이 스크립트가 실행되어 'jQuery is not defined' 오류를 해결합니다.
|
||||
// URL은 웹 경로로 지정해야 합니다.
|
||||
add_javascript('<script src="'.G5_ADMIN_URL.'/mail_manage/assets/js/template.js"></script>', 1);
|
||||
add_javascript('<script src="'.G5_ADMIN_URL.'/mail_manage/assets/js/template_form.js"></script>', 1);
|
||||
|
||||
// [수정] GnuBoard DHTML 에디터의 JS 파일을 로드합니다.
|
||||
// 이 함수는 에디터를 활성화하는 필수 스크립트를 생성하며, 반드시 호출해야 합니다.
|
||||
//echo get_editor_js('header_html');
|
||||
//echo get_editor_js('content');
|
||||
//echo get_editor_js('footer_html');
|
||||
|
||||
include_once(G5_ADMIN_PATH.'/admin.tail.php');
|
||||
?>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
?>
|
||||
<div class="local_ov01 local_ov">
|
||||
<strong>메일 템플릿 목록</strong>
|
||||
<p>이곳에서 메일 발송에 사용할 여러 템플릿을 등록하고 관리할 수 있습니다.</p>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="?action=create_form" class="btn btn_01">메일 템플릿 추가</a>
|
||||
</div>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>메일 템플릿 목록</caption>
|
||||
<colgroup>
|
||||
<col class="grid_1"> <!-- ID -->
|
||||
<col class="grid_3"> <!-- 코드 -->
|
||||
<col> <!-- 제목 -->
|
||||
<col class="grid_2"> <!-- 미리보기 -->
|
||||
<col class="grid_1"> <!-- 사용 -->
|
||||
<col class="grid_3"> <!-- 관리 -->
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">코드</th>
|
||||
<th scope="col">제목</th>
|
||||
<th scope="col">미리보기</th>
|
||||
<th scope="col">사용</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if (!empty($template_list_data)):
|
||||
foreach ($template_list_data as $row):
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_num"><?= $row['id'] ?></td>
|
||||
<td class="td_left"><?= htmlspecialchars($row['code']) ?></td>
|
||||
<td class="td_left"><?= htmlspecialchars($row['title']) ?></td>
|
||||
<td>
|
||||
<!-- [개선] 헤더, 본문, 푸터를 합친 전체 내용을 미리보기 하도록 수정합니다. -->
|
||||
<?php $full_content = stripslashes(htmlspecialchars_decode($row['header_html'] ?? '') . ($row['content'] ?? '') . ($row['footer_html'] ?? '')); ?>
|
||||
<button type="button" class="btn btn_03 preview-btn" data-content="<?php echo base64_encode($full_content); ?>">미리보기</button>
|
||||
</td>
|
||||
<td class="td_num"><?= $row['is_use'] ? '<strong class="txt_true">사용</strong>' : '미사용' ?></td>
|
||||
<td class="td_mng td_mng_m">
|
||||
<a href="./template.php?action=edit_form&id=<?= $row['id'] ?>" class="btn btn_03">수정</a>
|
||||
<!-- 💡 [개선] 삭제 링크에서 token을 직접 생성하지 않고, delete_confirm() 함수가 CSRF 토큰을 자동으로 처리하도록 합니다. -->
|
||||
<a href="./template.php?action=delete&id=<?= $row['id'] ?>" onclick="return delete_confirm(this);" class="btn btn_02">삭제</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
else:
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="6" class="empty_table">등록된 템플릿이 없습니다.</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// [개선] GnuBoard의 자바스크립트 로드 방식을 따라 add_javascript() 함수를 사용합니다.
|
||||
add_javascript('<script src="'.G5_ADMIN_URL.'/mail_manage/assets/js/template_list.js"></script>', 1);
|
||||
?>
|
||||
|
||||
<noscript>
|
||||
<p>
|
||||
귀하께서 사용하시는 브라우저는 현재 <strong>자바스크립트를 사용하지 않음</strong>으로 설정되어 있습니다.<br>
|
||||
<strong>자바스크립트를 사용하지 않음</strong>으로 설정하신 경우는 수정이나 삭제시 별도의 경고창이 나오지 않으므로 이점 주의하시기 바랍니다.
|
||||
</p>
|
||||
</noscript>
|
||||
Reference in New Issue
Block a user