addBreadCrumb(['link' => ADMIN.'email.php'.fusion_get_aidlink(), 'title' => $locale['MAIL_000']]); if (isset($_POST['save_template'])) { $data = [ 'template_id' => form_sanitizer($_POST['template_id'], '', 'template_id'), 'template_key' => form_sanitizer($_POST['template_key'], '', 'template_key'), 'template_format' => form_sanitizer($_POST['template_format'], '', 'template_format'), 'template_subject' => form_sanitizer($_POST['template_subject'], '', 'template_subject'), 'template_content' => form_sanitizer($_POST['template_content'], '', 'template_content'), 'template_active' => form_sanitizer($_POST['template_active'], '', 'template_active'), 'template_sender_name' => form_sanitizer($_POST['template_sender_name'], '', 'template_sender_name'), 'template_sender_email' => form_sanitizer($_POST['template_sender_email'], '', 'template_sender_email'), ]; if (\defender::safe()) { dbquery_insert(DB_EMAIL_TEMPLATES, $data, "update"); addNotice('success', $locale['MAIL_001']); redirect(FUSION_SELF.fusion_get_aidlink()."&template_id=".$data['template_id']); } } else if (isset($_POST['test_template'])) { $data = [ 'template_id' => form_sanitizer($_POST['template_id'], '', 'template_id'), 'template_key' => form_sanitizer($_POST['template_key'], '', 'template_key'), 'template_format' => form_sanitizer($_POST['template_format'], '', 'template_format'), 'template_subject' => form_sanitizer($_POST['template_subject'], '', 'template_subject'), 'template_content' => form_sanitizer($_POST['template_content'], '', 'template_content'), 'template_active' => form_sanitizer($_POST['template_active'], '', 'template_active'), 'template_sender_name' => form_sanitizer($_POST['template_sender_name'], '', 'template_sender_name'), 'template_sender_email' => form_sanitizer($_POST['template_sender_email'], '', 'template_sender_email'), ]; if (\defender::safe()) { require_once INCLUDES."sendmail_include.php"; dbquery_insert(DB_EMAIL_TEMPLATES, $data, 'update'); sendemail_template($data['template_key'], $locale['MAIL_002'], $locale['MAIL_003'], $locale['MAIL_004'], $locale['MAIL_005'], $locale['MAIL_006'], fusion_get_userdata('user_email'), $data['template_sender_name'], $data['template_sender_email']); addNotice('success', sprintf($locale['MAIL_007'], fusion_get_userdata('user_email'))); redirect(FUSION_SELF.fusion_get_aidlink()."&template_id=".$data['template_id']); } } $result = dbquery("SELECT template_id, template_key, template_name, template_language FROM ".DB_EMAIL_TEMPLATES." ".(multilang_table("ET") ? "WHERE template_language='".LANGUAGE."'" : "")." ORDER BY template_id ASC"); $template = []; if (dbrows($result) != 0) { while ($data = dbarray($result)) { $template[$data['template_id']] = $data['template_name']; } } $tab_title = []; foreach ($template as $id => $tname) { $tab_title['title'][$id] = $tname; $tab_title['id'][$id] = $id; $tab_title['icon'][$id] = ''; } $tab_values = array_values($tab_title['id']); $_GET['section'] = isset($_GET['section']) && isnum($_GET['section']) && in_array($_GET['section'], $tab_values) ? $_GET['section'] : $tab_values[0]; opentable($locale['MAIL_000']); echo opentab($tab_title, $_GET['section'], "email-templates-tab", TRUE); echo opentabbody($tab_title['title'][$_GET['section']], $tab_title['id'][$_GET['section']], $_GET['section'], TRUE); $result = dbquery("SELECT * FROM ".DB_EMAIL_TEMPLATES." WHERE template_id=:templateid LIMIT 1", [':templateid' => $_GET['section']]); $html_text = ""; $html_helper = ""; $text_helper = ""; if (dbrows($result)) { $data = dbarray($result); if ($data['template_active']) { if ($data['template_format'] == "html") { $text_helper = "class='display-none'"; $html_text = $locale['MAIL_008']; } else { $html_helper = "class='display-none'"; $html_text = $locale['MAIL_009']; } } else { if ($data['template_format'] == "html") { $html_helper = "class='display-none'"; $html_text = $locale['MAIL_008']; } else { $html_text = $locale['MAIL_009']; } } } echo openform('emailtemplateform', 'post', FUSION_SELF.fusion_get_aidlink(), ['class' => 'm-t-20']); echo form_hidden('template_id', '', $data['template_id']); echo form_hidden('template_key', '', $data['template_key']); echo "
".$locale['MAIL_032']." | \n"; echo "".$locale['MAIL_033']." | \n"; echo "
---|---|
[SITENAME] | \n"; echo "".fusion_get_settings('sitename')." | \n"; echo "
[SITEURL] | \n"; echo "".fusion_get_settings('siteurl')." | \n"; echo "
[SUBJECT] | \n"; echo "".$locale['MAIL_034']." | \n"; echo "
[MESSAGE] | \n"; echo "".$locale['MAIL_035']." | \n"; echo "
[USER] | \n"; echo "".$locale['MAIL_036']." | \n"; echo "
[SENDER] | \n"; echo "".$locale['MAIL_037']." | \n"; echo "
[RECEIVER] | \n"; echo "".$locale['MAIL_038']." | \n"; echo "
[THREAD_URL] | \n"; echo "".$locale['MAIL_039']." | \n"; echo "