Changeset 20284 for extensions/Piwecard/include/piwecard.class.php
- Timestamp:
- Jan 20, 2013, 3:17:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Piwecard/include/piwecard.class.php
r20254 r20284 415 415 //Send an email 416 416 function mail($email_infos) { 417 global $ conf, $page, $lang_info;417 global $lang_info; 418 418 $template_mail = new Template(PIWECARD_MAIL_PATH.'template'); 419 419 $smarty = $template_mail->smarty; 420 420 421 $from = $email_infos['from_name']." <".$email_infos['from_email'].">";421 $from = '"'.$email_infos['from_name'].'" <'.$email_infos['from_email'].'>'; 422 422 $subject = encode_mime_header(trim(preg_replace('#[\n\r]+#s', '', $email_infos['subject']))); 423 423 $boundary = '_----------='.md5(uniqid(mt_rand())); … … 436 436 437 437 if (empty($email_infos['message']['html'])) { //Text plain email 438 $headers .= 'Content-Type: text/plain; charset="'.get_pwg_charset().'"'."\n"; 438 439 $headers .= 'Content-Transfer-Encoding: 8bit'."\n"; 439 $message .= $email_infos['message']['text']; 440 $smarty->assign(array( 441 'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'], 442 'GALLERY_URL' => get_absolute_root_url(), 443 'MAIL' => get_webmaster_mail_address(), 444 ) 445 ); 446 $message .= $smarty->fetch('mail_text.tpl'); 447 $message = utf8_decode($message); 440 $message = $this->get_text_message($email_infos['message']['text'], $smarty); 448 441 } else { 449 442 $headers .= 'MIME-Version: 1.0'."\n"; … … 453 446 $message .= 'Content-Type: text/plain; charset="'.get_pwg_charset().'"'."\n"; 454 447 $message .= 'Content-Transfer-Encoding: binary'."\n\n"; 455 $message .= $email_infos['message']['text']."\n\n"; 448 $message .= $this->get_text_message($email_infos['message']['text'], $smarty); 449 $message .= "\n\n"; 456 450 $message .= '--'.$boundary."\n"; 457 451 $message .= 'Content-Type: text/html; charset="'.get_pwg_charset().'"'."\n"; 458 452 $message .= 'Content-Transfer-Encoding: binary;'."\n\n"; 459 $smarty->assign(array( 460 'CONTENT_ENCODING' => get_pwg_charset(), 461 'GALLERY_URL' => get_absolute_root_url(), 462 'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'], 463 'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '', 464 'MAIL' => get_webmaster_mail_address(), 465 'MESSAGE_HTML' => $email_infos['message']['html'], 466 ) 467 ); 468 $message .= $smarty->fetch('mail_html.tpl'); 453 $message .= $this->get_html_message($email_infos['message']['html'], $smarty); 469 454 $message .= "\n\n"; 470 455 $message .= '--'.$boundary."--\n"; … … 473 458 mail($email_infos['to'], $subject, $message, $headers); 474 459 } 460 461 function get_text_message($message_text, $smarty) { 462 global $page, $conf; 463 464 $message = $message_text; 465 $smarty->assign(array( 466 'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'], 467 'GALLERY_URL' => get_absolute_root_url(), 468 'MAIL' => get_webmaster_mail_address(), 469 ) 470 ); 471 $message .= $smarty->fetch('mail_text.tpl'); 472 473 return $message; 474 } 475 476 function get_html_message($message_html, $smarty) { 477 global $page, $conf; 478 479 $smarty->assign(array( 480 'CONTENT_ENCODING' => get_pwg_charset(), 481 'GALLERY_URL' => get_absolute_root_url(), 482 'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'], 483 'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '', 484 'MAIL' => get_webmaster_mail_address(), 485 'MESSAGE_HTML' => $message_html, 486 ) 487 ); 488 $message = $smarty->fetch('mail_html.tpl'); 489 490 return $message; 491 } 475 492 } 476 493 ?>
Note: See TracChangeset
for help on using the changeset viewer.