diff --git a/modules/advanced_mailer/advanced_mailer.admin.controller.php b/modules/advanced_mailer/advanced_mailer.admin.controller.php index 70e69d07e..5019ba688 100644 --- a/modules/advanced_mailer/advanced_mailer.admin.controller.php +++ b/modules/advanced_mailer/advanced_mailer.admin.controller.php @@ -20,6 +20,8 @@ class Advanced_MailerAdminController extends Advanced_Mailer $config = $this->getConfig(); $config->log_sent_mail = toBool($vars->log_sent_mail); $config->log_errors = toBool($vars->log_errors); + $config->log_sent_sms = toBool($vars->log_sent_sms); + $config->log_sms_errors = toBool($vars->log_sms_errors); $output = getController('module')->insertModuleConfig('advanced_mailer', $config); if ($output->toBool()) { @@ -147,7 +149,7 @@ class Advanced_MailerAdminController extends Advanced_Mailer } /** - * Clear old sending log. + * Clear old mail sending log. */ public function procAdvanced_mailerAdminClearSentMail() { @@ -165,22 +167,53 @@ class Advanced_MailerAdminController extends Advanced_Mailer $obj = new stdClass(); $obj->status = $status; $obj->regdate = date('YmdHis', time() - ($clear_before_days * 86400) + zgap()); - $output = executeQuery('advanced_mailer.deleteLogs', $obj); + $output = executeQuery('advanced_mailer.deleteMailLogs', $obj); if ($status === 'success') { - $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSentMail')); + $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminMailLog')); } else { - $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminErrors')); + $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminMailErrors')); } } /** - * Send a test email using a temporary configuration. + * Clear old SMS sending log. */ - public function procAdvanced_MailerAdminTestSend() + public function procAdvanced_mailerAdminClearSentSMS() + { + $status = Context::get('status'); + $clear_before_days = intval(Context::get('clear_before_days')); + if (!in_array($status, array('success', 'error'))) + { + return new Object(-1, 'msg_invalid_request'); + } + if ($clear_before_days < 0) + { + return new Object(-1, 'msg_invalid_request'); + } + + $obj = new stdClass(); + $obj->status = $status; + $obj->regdate = date('YmdHis', time() - ($clear_before_days * 86400) + zgap()); + $output = executeQuery('advanced_mailer.deleteSMSLogs', $obj); + + if ($status === 'success') + { + $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSMSLog')); + } + else + { + $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSMSErrors')); + } + } + + /** + * Send a test mail. + */ + public function procAdvanced_MailerAdminTestSendMail() { $advanced_mailer_config = $this->getConfig(); $recipient_config = Context::gets('recipient_name', 'recipient_email'); @@ -217,23 +250,23 @@ class Advanced_MailerAdminController extends Advanced_Mailer if (!$result) { - if (count($oMail->errors)) + if (count($oMail->getErrors())) { if (config('mail.type') === 'smtp') { - if (strpos(config('mail.smtp.smtp_host'), 'gmail.com') !== false && strpos(implode("\n", $oMail->errors), 'code "535"') !== false) + if (strpos(config('mail.smtp.smtp_host'), 'gmail.com') !== false && strpos(implode("\n", $oMail->getErrors()), 'code "535"') !== false) { $this->add('test_result', Context::getLang('msg_advanced_mailer_google_account_security')); return; } - if (strpos(config('mail.smtp.smtp_host'), 'naver.com') !== false && strpos(implode("\n", $oMail->errors), 'Failed to authenticate') !== false) + if (strpos(config('mail.smtp.smtp_host'), 'naver.com') !== false && strpos(implode("\n", $oMail->getErrors()), 'Failed to authenticate') !== false) { $this->add('test_result', Context::getLang('msg_advanced_mailer_naver_smtp_disabled')); return; } } - $this->add('test_result', nl2br(htmlspecialchars(implode("\n", $oMail->errors)))); + $this->add('test_result', nl2br(htmlspecialchars(implode("\n", $oMail->getErrors())))); return; } else @@ -252,4 +285,56 @@ class Advanced_MailerAdminController extends Advanced_Mailer $this->add('test_result', Context::getLang('msg_advanced_mailer_test_success')); return; } + + /** + * Send a test SMS. + */ + public function procAdvanced_MailerAdminTestSendSMS() + { + $advanced_mailer_config = $this->getConfig(); + $recipient_number = Context::get('recipient_number'); + $country_code = intval(Context::get('country_code')); + $content = trim(Context::get('content')); + + if (!$recipient_number) + { + $this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_recipient_number_is_empty')); + return; + } + if (!$content) + { + $this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_content_is_empty')); + return; + } + + try + { + $oSMS = new Rhymix\Framework\SMS(); + $oSMS->addTo($recipient_number, $country_code); + $oSMS->setBody($content); + $result = $oSMS->send(); + + if (!$result) + { + if (count($oSMS->getErrors())) + { + $this->add('test_result', nl2br(htmlspecialchars(implode("\n", $oSMS->getErrors())))); + return; + } + else + { + $this->add('test_result', Context::getLang('msg_advanced_mailer_unknown_error')); + return; + } + } + } + catch (Exception $e) + { + $this->add('test_result', nl2br(htmlspecialchars($e->getMessage()))); + return; + } + + $this->add('test_result', Context::getLang('msg_advanced_mailer_test_success_sms')); + return; + } } diff --git a/modules/advanced_mailer/advanced_mailer.admin.view.php b/modules/advanced_mailer/advanced_mailer.admin.view.php index 4b6129bff..385c1a508 100644 --- a/modules/advanced_mailer/advanced_mailer.admin.view.php +++ b/modules/advanced_mailer/advanced_mailer.admin.view.php @@ -110,9 +110,9 @@ class Advanced_MailerAdminView extends Advanced_Mailer } /** - * Display the test send form. + * Display the mail test form. */ - public function dispAdvanced_MailerAdminTestConfig() + public function dispAdvanced_MailerAdminMailTest() { $advanced_mailer_config = $this->getConfig(); $sending_methods = Rhymix\Framework\Mail::getSupportedDrivers(); @@ -122,23 +122,23 @@ class Advanced_MailerAdminView extends Advanced_Mailer Context::set('sending_method', config('mail.type')); $this->setTemplatePath($this->module_path.'tpl'); - $this->setTemplateFile('test'); + $this->setTemplateFile('mail_test'); } /** - * Display the sent mail log. + * Display the mail log. */ - public function dispAdvanced_MailerAdminSentMail() + public function dispAdvanced_MailerAdminMailLog() { $obj = new stdClass(); $obj->status = 'success'; $obj->page = $page = Context::get('page') ?: 1; - $maillog = executeQuery('advanced_mailer.getLogByType', $obj); + $maillog = executeQueryArray('advanced_mailer.getMailLogByType', $obj); $maillog = $maillog->toBool() ? $this->procMailLog($maillog->data) : array(); Context::set('advanced_mailer_log', $maillog); Context::set('advanced_mailer_status', 'success'); - $paging = $this->procPaging('success', $page); + $paging = $this->procPaging('success', 'mail', $page); Context::set('total_count', $paging->total_count); Context::set('total_page', $paging->total_page); Context::set('page', $paging->page); @@ -148,23 +148,23 @@ class Advanced_MailerAdminView extends Advanced_Mailer Context::set('sending_methods', $sending_methods); $this->setTemplatePath($this->module_path.'tpl'); - $this->setTemplateFile('view_log'); + $this->setTemplateFile('mail_log'); } /** - * Display the error log. + * Display the mail error log. */ - public function dispAdvanced_MailerAdminErrors() + public function dispAdvanced_MailerAdminMailErrors() { $obj = new stdClass(); $obj->status = 'error'; $obj->page = $page = Context::get('page') ?: 1; - $maillog = executeQuery('advanced_mailer.getLogByType', $obj); + $maillog = executeQueryArray('advanced_mailer.getMailLogByType', $obj); $maillog = $maillog->toBool() ? $this->procMailLog($maillog->data) : array(); Context::set('advanced_mailer_log', $maillog); Context::set('advanced_mailer_status', 'error'); - $paging = $this->procPaging('error', $page); + $paging = $this->procPaging('error', 'mail', $page); Context::set('total_count', $paging->total_count); Context::set('total_page', $paging->total_page); Context::set('page', $paging->page); @@ -174,7 +174,75 @@ class Advanced_MailerAdminView extends Advanced_Mailer Context::set('sending_methods', $sending_methods); $this->setTemplatePath($this->module_path.'tpl'); - $this->setTemplateFile('view_log'); + $this->setTemplateFile('mail_log'); + } + + /** + * Display the SMS test form. + */ + public function dispAdvanced_MailerAdminSMSTest() + { + $advanced_mailer_config = $this->getConfig(); + $sending_methods = Rhymix\Framework\Mail::getSupportedDrivers(); + + Context::set('advanced_mailer_config', $advanced_mailer_config); + Context::set('sending_methods', $sending_methods); + Context::set('sending_method', config('mail.type')); + + $this->setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile('sms_test'); + } + + /** + * Display the SMS log. + */ + public function dispAdvanced_MailerAdminSMSLog() + { + $obj = new stdClass(); + $obj->status = 'success'; + $obj->page = $page = Context::get('page') ?: 1; + $smslog = executeQueryArray('advanced_mailer.getSMSLogByType', $obj); + $smslog = $smslog->toBool() ? $smslog->data : array(); + Context::set('advanced_mailer_log', $smslog); + Context::set('advanced_mailer_status', 'success'); + + $paging = $this->procPaging('success', 'sms', $page); + Context::set('total_count', $paging->total_count); + Context::set('total_page', $paging->total_page); + Context::set('page', $paging->page); + Context::set('page_navigation', $paging->page_navigation); + + $sending_methods = Rhymix\Framework\SMS::getSupportedDrivers(); + Context::set('sending_methods', $sending_methods); + + $this->setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile('sms_log'); + } + + /** + * Display the SMS error log. + */ + public function dispAdvanced_MailerAdminSMSErrors() + { + $obj = new stdClass(); + $obj->status = 'error'; + $obj->page = $page = Context::get('page') ?: 1; + $smslog = executeQueryArray('advanced_mailer.getSMSLogByType', $obj); + $smslog = $smslog->toBool() ? $smslog->data : array(); + Context::set('advanced_mailer_log', $smslog); + Context::set('advanced_mailer_status', 'error'); + + $paging = $this->procPaging('error', 'sms', $page); + Context::set('total_count', $paging->total_count); + Context::set('total_page', $paging->total_page); + Context::set('page', $paging->page); + Context::set('page_navigation', $paging->page_navigation); + + $sending_methods = Rhymix\Framework\SMS::getSupportedDrivers(); + Context::set('sending_methods', $sending_methods); + + $this->setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile('sms_log'); } /** @@ -219,11 +287,18 @@ class Advanced_MailerAdminView extends Advanced_Mailer /** * Process paging. */ - public function procPaging($status, $page = 1) + public function procPaging($status, $type, $page = 1) { $args = new stdClass; $args->status = $status; - $count = executeQuery('advanced_mailer.countLogByType', $args); + if ($type === 'mail') + { + $count = executeQuery('advanced_mailer.countMailLogByType', $args); + } + else + { + $count = executeQuery('advanced_mailer.countSMSLogByType', $args); + } $total_count = $count->data->count; $total_page = max(1, ceil($total_count / 20)); diff --git a/modules/advanced_mailer/advanced_mailer.class.php b/modules/advanced_mailer/advanced_mailer.class.php index ec2afe6d6..2d25a82ae 100644 --- a/modules/advanced_mailer/advanced_mailer.class.php +++ b/modules/advanced_mailer/advanced_mailer.class.php @@ -196,6 +196,10 @@ class Advanced_Mailer extends ModuleObject { $oModuleController->insertTrigger('mail.send', 'advanced_mailer', 'controller', 'triggerAfterMailSend', 'after'); } + if (!$oModuleModel->getTrigger('sms.send', 'advanced_mailer', 'controller', 'triggerAfterSMSSend', 'after')) + { + $oModuleController->insertTrigger('sms.send', 'advanced_mailer', 'controller', 'triggerAfterSMSSend', 'after'); + } } /** @@ -225,6 +229,10 @@ class Advanced_Mailer extends ModuleObject { return true; } + if (!$oModuleModel->getTrigger('sms.send', 'advanced_mailer', 'controller', 'triggerAfterSMSSend', 'after')) + { + return true; + } return false; } diff --git a/modules/advanced_mailer/advanced_mailer.controller.php b/modules/advanced_mailer/advanced_mailer.controller.php index 5a07ae045..78bc8d219 100644 --- a/modules/advanced_mailer/advanced_mailer.controller.php +++ b/modules/advanced_mailer/advanced_mailer.controller.php @@ -58,7 +58,6 @@ class Advanced_MailerController extends Advanced_Mailer if (toBool($config->log_sent_mail) || (toBool($config->log_errors) && count($mail->errors))) { $obj = new \stdClass(); - $obj->mail_srl = getNextSequence(); $obj->mail_from = ''; $obj->mail_to = ''; @@ -99,9 +98,9 @@ class Advanced_MailerController extends Advanced_Mailer $obj->subject = $mail->message->getSubject(); $obj->calling_script = $mail->getCaller(); $obj->sending_method = strtolower(class_basename($mail->driver)); - $obj->status = !count($mail->errors) ? 'success' : 'error'; - $obj->errors = count($mail->errors) ? implode("\n", $mail->errors) : null; - $output = executeQuery('advanced_mailer.insertLog', $obj); + $obj->status = !count($mail->getErrors()) ? 'success' : 'error'; + $obj->errors = count($mail->getErrors()) ? implode("\n", $mail->getErrors()) : null; + $output = executeQuery('advanced_mailer.insertMailLog', $obj); if (!$output->toBool()) { return $output; @@ -145,4 +144,41 @@ class Advanced_MailerController extends Advanced_Mailer return null; } + + /** + * After SMS send trigger. + */ + public function triggerAfterSMSSend($sms) + { + $config = $this->getConfig(); + + if (toBool($config->log_sent_sms) || (toBool($config->log_sms_errors) && count($sms->errors))) + { + $obj = new \stdClass(); + $obj->sms_from = $sms->getFrom(); + $obj->sms_to = array(); + foreach ($sms->getRecipientsWithCountry() as $to) + { + if ($to->country) + { + $obj->sms_to[] = '+' . $to->country . '.' . $to->number; + } + else + { + $obj->sms_to[] = $to->number; + } + } + $obj->sms_to = implode(', ', $obj->sms_to); + $obj->content = trim($sms->getSubject() . "\n" . $sms->getBody()); + $obj->calling_script = $sms->getCaller(); + $obj->sending_method = strtolower(class_basename($sms->driver)); + $obj->status = !count($sms->getErrors()) ? 'success' : 'error'; + $obj->errors = count($sms->getErrors()) ? implode("\n", $sms->getErrors()) : null; + $output = executeQuery('advanced_mailer.insertSMSLog', $obj); + if (!$output->toBool()) + { + return $output; + } + } + } } diff --git a/modules/advanced_mailer/conf/info.xml b/modules/advanced_mailer/conf/info.xml index 59ae3da9f..15cfd096e 100644 --- a/modules/advanced_mailer/conf/info.xml +++ b/modules/advanced_mailer/conf/info.xml @@ -1,17 +1,17 @@ - 고급 메일 발송 모듈 - Advanced Mailer + 고급 메일 발송 모듈 (메일 및 SMS 관리) + Advanced Mailer (with SMS) - 외부 SMTP 서버 또는 API를 사용하여 메일을 발송합니다. + 라이믹스에서 발송하는 메일과 SMS를 기록하고 테스트하는 기능을 제공합니다. - Send mail using an external SMTP server or API service. + Log and test e-mails and SMS sent from Rhymix. - 2.0.0 - 2016-05-22 - - Kijin Sung - Kijin Sung + 2.1.0 + 2016-12-14 + + 포에시스 + POESIS diff --git a/modules/advanced_mailer/conf/module.xml b/modules/advanced_mailer/conf/module.xml index 0a16f0ca2..2b341a7a8 100644 --- a/modules/advanced_mailer/conf/module.xml +++ b/modules/advanced_mailer/conf/module.xml @@ -6,14 +6,19 @@ - - - + + + + + + - + + + diff --git a/modules/advanced_mailer/lang/en.php b/modules/advanced_mailer/lang/en.php index 746a22217..168a52cd6 100644 --- a/modules/advanced_mailer/lang/en.php +++ b/modules/advanced_mailer/lang/en.php @@ -1,12 +1,14 @@ cmd_advanced_mailer = 'Advanced Mailer'; +$lang->cmd_advanced_mailer = 'Advanced Mailer (with SMS)'; $lang->cmd_advanced_mailer_general_config = 'General settings'; $lang->cmd_advanced_mailer_is_enabled = 'Enable module'; $lang->cmd_advanced_mailer_is_enabled_yes = 'Enabled'; $lang->cmd_advanced_mailer_is_enabled_no = 'Disabled'; $lang->cmd_advanced_mailer_logging = 'Logging'; -$lang->cmd_advanced_mailer_log_sent_mail = 'Log Sent Mail'; -$lang->cmd_advanced_mailer_log_errors = 'Log Errors'; +$lang->cmd_advanced_mailer_log_mail = 'Log Mail'; +$lang->cmd_advanced_mailer_log_mail_errors = 'Log Mail Errors'; +$lang->cmd_advanced_mailer_log_sms = 'Log SMS'; +$lang->cmd_advanced_mailer_log_sms_errors = 'Log SMS Errors'; $lang->cmd_advanced_mailer_log_yes = 'Yes'; $lang->cmd_advanced_mailer_log_no = 'No'; $lang->cmd_advanced_mailer_sending_method_config = 'Default Sending Method'; @@ -62,7 +64,7 @@ $lang->cmd_advanced_mailer_other_info_mailgun_dkim = 'The DKIM hostname may be d $lang->cmd_advanced_mailer_other_info_postmark_dkim = 'Please see the Sender Signatures page of your Postmark account for the exact DKIm hostname to use.'; $lang->cmd_advanced_mailer_other_info_woorimail_dkim = 'Please log into Woorimail to see your DKIM settings.'; $lang->cmd_advanced_mailer_ellipsis = '(see API for full value)'; -$lang->cmd_advanced_mailer_test = 'Mail Test'; +$lang->cmd_advanced_mailer_mail_test = 'Mail Test'; $lang->cmd_advanced_mailer_recipient_name = 'Recipient\'s name'; $lang->cmd_advanced_mailer_recipient_email = 'Recipient\'s email'; $lang->cmd_advanced_mailer_send = 'Send'; @@ -105,6 +107,7 @@ $lang->msg_advanced_mailer_log_is_empty = 'There are no entries to display.'; $lang->cmd_advanced_mailer_status_sender = 'Sender'; $lang->cmd_advanced_mailer_status_recipient = 'Recipient'; $lang->cmd_advanced_mailer_status_subject = 'Subject'; +$lang->cmd_advanced_mailer_status_content = 'Content'; $lang->cmd_advanced_mailer_status_sending_method = 'Method'; $lang->cmd_advanced_mailer_status_time = 'Time'; $lang->cmd_advanced_mailer_status = 'Status'; @@ -115,3 +118,11 @@ $lang->cmd_advanced_mailer_status_calling_script = 'Called from'; $lang->cmd_advanced_mailer_clear_log_condition_all = 'Everything'; $lang->cmd_advanced_mailer_clear_log_condition = 'Over %d days'; $lang->cmd_advanced_mailer_clear_log_button = 'Clear old logs'; +$lang->cmd_advanced_mailer_sms_test = 'SMS Test'; +$lang->cmd_advanced_mailer_recipient_number = 'Recipient\'s number'; +$lang->cmd_advanced_mailer_country_code = 'Country code'; +$lang->cmd_advanced_mailer_country_code_help = 'Please leave the country code empty if you are sending to a domestic number.'; +$lang->cmd_advanced_mailer_test_content = 'This is an SMS test from Rhymix.'; +$lang->msg_advanced_mailer_recipient_number_is_empty = 'Please enter a phone number for the recipient.'; +$lang->msg_advanced_mailer_content_is_empty = 'Please enter the content for your test SMS.'; +$lang->msg_advanced_mailer_test_success_sms = 'The test was successful. Please check your SMS.'; \ No newline at end of file diff --git a/modules/advanced_mailer/lang/ko.php b/modules/advanced_mailer/lang/ko.php index fe80343ac..db607462e 100644 --- a/modules/advanced_mailer/lang/ko.php +++ b/modules/advanced_mailer/lang/ko.php @@ -1,12 +1,14 @@ cmd_advanced_mailer = '고급 메일 발송 모듈'; +$lang->cmd_advanced_mailer = '고급 메일 발송 모듈 (메일 및 SMS 관리)'; $lang->cmd_advanced_mailer_general_config = '기본 설정'; $lang->cmd_advanced_mailer_is_enabled = '모듈 사용'; $lang->cmd_advanced_mailer_is_enabled_yes = '사용'; $lang->cmd_advanced_mailer_is_enabled_no = '사용하지 않음'; $lang->cmd_advanced_mailer_logging = '발송 내역 기록'; -$lang->cmd_advanced_mailer_log_sent_mail = '발송 내역'; -$lang->cmd_advanced_mailer_log_errors = '에러 내역'; +$lang->cmd_advanced_mailer_log_mail = '메일 발송 내역'; +$lang->cmd_advanced_mailer_log_mail_errors = '메일 에러 내역'; +$lang->cmd_advanced_mailer_log_sms = 'SMS 발송 내역'; +$lang->cmd_advanced_mailer_log_sms_errors = 'SMS 에러 내역'; $lang->cmd_advanced_mailer_log_yes = '기록'; $lang->cmd_advanced_mailer_log_no = '기록하지 않음'; $lang->cmd_advanced_mailer_sending_method_config = '기본 발송 방법 설정'; @@ -62,7 +64,7 @@ $lang->cmd_advanced_mailer_other_info_mailgun_dkim = 'DKIM 호스트명은 달 $lang->cmd_advanced_mailer_other_info_postmark_dkim = '정확한 DKIM 호스트명은 Postmark 계정의 Sender Signatures 페이지를 참고하시기 바랍니다.'; $lang->cmd_advanced_mailer_other_info_woorimail_dkim = 'DKIM 설정은 우리메일에 로그인하여 확인하십시오.'; $lang->cmd_advanced_mailer_ellipsis = '(중략)'; -$lang->cmd_advanced_mailer_test = '발송 테스트'; +$lang->cmd_advanced_mailer_mail_test = '메일 테스트'; $lang->cmd_advanced_mailer_recipient_name = '받는이 이름'; $lang->cmd_advanced_mailer_recipient_email = '받는이 메일 주소'; $lang->cmd_advanced_mailer_send = '발송'; @@ -105,6 +107,7 @@ $lang->msg_advanced_mailer_log_is_empty = '표시할 항목이 없습니다.'; $lang->cmd_advanced_mailer_status_sender = '보낸이'; $lang->cmd_advanced_mailer_status_recipient = '받는이'; $lang->cmd_advanced_mailer_status_subject = '제목'; +$lang->cmd_advanced_mailer_status_content = '내용'; $lang->cmd_advanced_mailer_status_sending_method = '발송 방법'; $lang->cmd_advanced_mailer_status_time = '발송 시간'; $lang->cmd_advanced_mailer_status = '상태'; @@ -115,3 +118,11 @@ $lang->cmd_advanced_mailer_status_calling_script = '호출 위치'; $lang->cmd_advanced_mailer_clear_log_condition_all = '모두'; $lang->cmd_advanced_mailer_clear_log_condition = '%d일 이상'; $lang->cmd_advanced_mailer_clear_log_button = '오래된 기록 삭제'; +$lang->cmd_advanced_mailer_sms_test = 'SMS 테스트'; +$lang->cmd_advanced_mailer_recipient_number = '받는이 전화번호'; +$lang->cmd_advanced_mailer_country_code = '국가코드'; +$lang->cmd_advanced_mailer_country_code_help = '국내 번호로 발송하실 경우 국가코드는 비워 두시기 바랍니다.'; +$lang->cmd_advanced_mailer_test_content = '라이믹스 SMS 발송 테스트입니다.'; +$lang->msg_advanced_mailer_recipient_number_is_empty = '받는이 전화번호를 입력해 주십시오.'; +$lang->msg_advanced_mailer_content_is_empty = 'SMS 내용을 입력해 주십시오.'; +$lang->msg_advanced_mailer_test_success_sms = '테스트에 성공하였습니다. SMS를 확인해 보시기 바랍니다.'; \ No newline at end of file diff --git a/modules/advanced_mailer/queries/countLogByType.xml b/modules/advanced_mailer/queries/countMailLogByType.xml similarity index 84% rename from modules/advanced_mailer/queries/countLogByType.xml rename to modules/advanced_mailer/queries/countMailLogByType.xml index 652275ffc..40e17bdbb 100644 --- a/modules/advanced_mailer/queries/countLogByType.xml +++ b/modules/advanced_mailer/queries/countMailLogByType.xml @@ -1,4 +1,4 @@ - + diff --git a/modules/advanced_mailer/queries/countSMSLogByType.xml b/modules/advanced_mailer/queries/countSMSLogByType.xml new file mode 100644 index 000000000..9a0ece76e --- /dev/null +++ b/modules/advanced_mailer/queries/countSMSLogByType.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/advanced_mailer/queries/deleteLogs.xml b/modules/advanced_mailer/queries/deleteMailLogs.xml similarity index 85% rename from modules/advanced_mailer/queries/deleteLogs.xml rename to modules/advanced_mailer/queries/deleteMailLogs.xml index 690e64ed8..d76928fff 100644 --- a/modules/advanced_mailer/queries/deleteLogs.xml +++ b/modules/advanced_mailer/queries/deleteMailLogs.xml @@ -1,4 +1,4 @@ - +
diff --git a/modules/advanced_mailer/queries/deleteSMSLogs.xml b/modules/advanced_mailer/queries/deleteSMSLogs.xml new file mode 100644 index 000000000..21676d22b --- /dev/null +++ b/modules/advanced_mailer/queries/deleteSMSLogs.xml @@ -0,0 +1,9 @@ + + +
+ + + + + + diff --git a/modules/advanced_mailer/queries/getLogByType.xml b/modules/advanced_mailer/queries/getMailLogByType.xml similarity index 91% rename from modules/advanced_mailer/queries/getLogByType.xml rename to modules/advanced_mailer/queries/getMailLogByType.xml index 655b85e30..60285b793 100644 --- a/modules/advanced_mailer/queries/getLogByType.xml +++ b/modules/advanced_mailer/queries/getMailLogByType.xml @@ -1,4 +1,4 @@ - +
diff --git a/modules/advanced_mailer/queries/getSMSLogByType.xml b/modules/advanced_mailer/queries/getSMSLogByType.xml new file mode 100644 index 000000000..d7c4e36e7 --- /dev/null +++ b/modules/advanced_mailer/queries/getSMSLogByType.xml @@ -0,0 +1,17 @@ + + +
+ + + + + + + + + + + + + + diff --git a/modules/advanced_mailer/queries/insertLog.xml b/modules/advanced_mailer/queries/insertMailLog.xml similarity index 94% rename from modules/advanced_mailer/queries/insertLog.xml rename to modules/advanced_mailer/queries/insertMailLog.xml index 2f2580c34..006fbf166 100644 --- a/modules/advanced_mailer/queries/insertLog.xml +++ b/modules/advanced_mailer/queries/insertMailLog.xml @@ -1,4 +1,4 @@ - +
diff --git a/modules/advanced_mailer/queries/insertSMSLog.xml b/modules/advanced_mailer/queries/insertSMSLog.xml new file mode 100644 index 000000000..f1bb6460d --- /dev/null +++ b/modules/advanced_mailer/queries/insertSMSLog.xml @@ -0,0 +1,15 @@ + + +
+ + + + + + + + + + + + diff --git a/modules/advanced_mailer/schemas/advanced_mailer_sms_log.xml b/modules/advanced_mailer/schemas/advanced_mailer_sms_log.xml new file mode 100644 index 000000000..1a17fa3d3 --- /dev/null +++ b/modules/advanced_mailer/schemas/advanced_mailer_sms_log.xml @@ -0,0 +1,11 @@ +
+ + + + + + + + + +
diff --git a/modules/advanced_mailer/tpl/common.html b/modules/advanced_mailer/tpl/common.html index e254222ec..29ecbd984 100644 --- a/modules/advanced_mailer/tpl/common.html +++ b/modules/advanced_mailer/tpl/common.html @@ -7,7 +7,10 @@
  • {$lang->cmd_advanced_mailer_general_config}
  • {$lang->cmd_advanced_mailer_exception_domains}
  • {$lang->cmd_advanced_mailer_spf_dkim_setting}
  • -
  • {$lang->cmd_advanced_mailer_test}
  • -
  • {$lang->cmd_advanced_mailer_log_sent_mail}
  • -
  • {$lang->cmd_advanced_mailer_log_errors}
  • +
  • {$lang->cmd_advanced_mailer_mail_test}
  • +
  • {$lang->cmd_advanced_mailer_log_mail}
  • +
  • {$lang->cmd_advanced_mailer_log_mail_errors}
  • +
  • {$lang->cmd_advanced_mailer_sms_test}
  • +
  • {$lang->cmd_advanced_mailer_log_sms}
  • +
  • {$lang->cmd_advanced_mailer_log_sms_errors}
  • diff --git a/modules/advanced_mailer/tpl/config.html b/modules/advanced_mailer/tpl/config.html index 6265cd867..852f118fa 100644 --- a/modules/advanced_mailer/tpl/config.html +++ b/modules/advanced_mailer/tpl/config.html @@ -36,7 +36,7 @@

    {$lang->cmd_advanced_mailer_logging}

    - +
    @@ -55,6 +55,26 @@
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    diff --git a/modules/advanced_mailer/tpl/js/config.js b/modules/advanced_mailer/tpl/js/config.js index 43bb459e4..15ef43849 100644 --- a/modules/advanced_mailer/tpl/js/config.js +++ b/modules/advanced_mailer/tpl/js/config.js @@ -3,16 +3,38 @@ $(function() { - $("#advanced_mailer_test_send").click(function(event) { + $("#advanced_mailer_test_send_mail").click(function(event) { event.preventDefault(); $("#advanced_mailer_test_result").text(""); $(this).attr("disabled", "disabled"); var ajax_data = { recipient_name: $("#advanced_mailer_recipient_name").val(), - recipient_email: $("#advanced_mailer_recipient_email").val(), + recipient_email: $("#advanced_mailer_recipient_email").val() }; $.exec_json( - "advanced_mailer.procAdvanced_mailerAdminTestSend", ajax_data, + "advanced_mailer.procAdvanced_mailerAdminTestSendMail", ajax_data, + function(response) { + $("#advanced_mailer_test_result").html(response.test_result); + $("#advanced_mailer_test_send").removeAttr("disabled"); + }, + function(response) { + $("#advanced_mailer_test_result").text("AJAX Error"); + $("#advanced_mailer_test_send").removeAttr("disabled"); + } + ); + }); + + $("#advanced_mailer_test_send_sms").click(function(event) { + event.preventDefault(); + $("#advanced_mailer_test_result").text(""); + $(this).attr("disabled", "disabled"); + var ajax_data = { + recipient_number: $("#advanced_mailer_recipient_number").val(), + country_code: $("#advanced_mailer_country_code").val(), + content: $("#advanced_mailer_content").val() + }; + $.exec_json( + "advanced_mailer.procAdvanced_mailerAdminTestSendSMS", ajax_data, function(response) { $("#advanced_mailer_test_result").html(response.test_result); $("#advanced_mailer_test_send").removeAttr("disabled"); diff --git a/modules/advanced_mailer/tpl/view_log.html b/modules/advanced_mailer/tpl/mail_log.html similarity index 100% rename from modules/advanced_mailer/tpl/view_log.html rename to modules/advanced_mailer/tpl/mail_log.html diff --git a/modules/advanced_mailer/tpl/test.html b/modules/advanced_mailer/tpl/mail_test.html similarity index 87% rename from modules/advanced_mailer/tpl/test.html rename to modules/advanced_mailer/tpl/mail_test.html index 07c3517ec..4234b9956 100644 --- a/modules/advanced_mailer/tpl/test.html +++ b/modules/advanced_mailer/tpl/mail_test.html @@ -4,7 +4,7 @@
    - +
    @@ -13,7 +13,7 @@
    -

    {$lang->cmd_advanced_mailer_test}

    +

    {$lang->cmd_advanced_mailer_mail_test}

    @@ -39,7 +39,7 @@
    - +
    diff --git a/modules/advanced_mailer/tpl/sms_log.html b/modules/advanced_mailer/tpl/sms_log.html new file mode 100644 index 000000000..964ee1093 --- /dev/null +++ b/modules/advanced_mailer/tpl/sms_log.html @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Total: {number_format($total_count)}, Page: {number_format($page)}/{number_format($total_page)} +
    {$lang->cmd_advanced_mailer_status_sender}{$lang->cmd_advanced_mailer_status_recipient}{$lang->cmd_advanced_mailer_status_content}{$lang->cmd_advanced_mailer_status_sending_method}{$lang->cmd_advanced_mailer_status_time}{$lang->cmd_advanced_mailer_status}
    + {htmlspecialchars($val->sms_from)} + + {htmlspecialchars($val->sms_to)} + {nl2br(htmlspecialchars($val->content))} + {@ if($val->sending_method === 'mail') $val->sending_method = 'mailfunction'} + {strval(isset($sending_methods[$val->sending_method]['name']) ? $sending_methods[$val->sending_method]['name'] : $val->sending_method)} + {(zdate($val->regdate, "Y-m-d\nH:i:s"))} + + {$lang->cmd_advanced_mailer_status_success} + + {$lang->cmd_advanced_mailer_status_error} +
    + {$lang->cmd_advanced_mailer_status_error_msg}:
    + {nl2br(htmlspecialchars(trim($val->errors)))}

    + {$lang->cmd_advanced_mailer_status_calling_script}:
    + {htmlspecialchars($val->calling_script)} +
    + +
    {$lang->msg_advanced_mailer_log_is_empty}
    + +
    +
    + + +
    +
    + + + + + +
    +
    diff --git a/modules/advanced_mailer/tpl/sms_test.html b/modules/advanced_mailer/tpl/sms_test.html new file mode 100644 index 000000000..8819a3dba --- /dev/null +++ b/modules/advanced_mailer/tpl/sms_test.html @@ -0,0 +1,48 @@ + + + + +
    + + + + +
    +

    {$XE_VALIDATOR_MESSAGE}

    +
    + +
    + +

    {$lang->cmd_advanced_mailer_sms_test}

    + +
    + +
    + +  {$lang->cmd_advanced_mailer_country_code}  + +

    {$lang->cmd_advanced_mailer_country_code_help}

    +
    +
    + +
    + +
    + +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    + +
    + +