mail.ajax.php 998 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../global.inc.php';
  4. api_protect_admin_script();
  5. $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
  6. switch ($action) {
  7. case 'select_option':
  8. $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
  9. if (!empty($id)) {
  10. $mail = new MailTemplateManager();
  11. $item = $mail->get($id);
  12. echo $item['template'];
  13. } else {
  14. $templateName = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : null;
  15. if (!empty($templateName)) {
  16. $templatePath = api_get_path(SYS_CODE_PATH).'template/default/mail/';
  17. if (Security::check_abs_path($templatePath.$templateName, $templatePath)) {
  18. if (file_exists($templatePath.$templateName)) {
  19. echo file_get_contents($templatePath.$templateName);
  20. }
  21. }
  22. }
  23. }
  24. break;
  25. }