Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.5.0
- * @ Author : DeZender
- * @ Release on : 09.06.2012
- * @ Official site : http://DeZender.Net
- *
- */
- class hanEmail {
- var $emailer = null;
- var $header = null;
- var $footer = null;
- var $from = null;
- var $to = null;
- var $bcc = array( );
- var $subject = null;
- var $message = null;
- var $html_email = FALSE;
- protected $_words = null;
- protected $temp_headers = array( );
- protected $_attachments = array( );
- private $registry = null;
- private $DB = null;
- private $settings = null;
- private $request = null;
- private $lang = null;
- private $member = null;
- private $memberData = null;
- function __construct($registry) {
- $this->registry = $registry;
- $this->DB = $this->registry->DB( );
- $this->settings = &$this->registry->fetchSettings( );
- $this->request = &$this->registry->fetchRequest( );
- $this->lang = $this->registry->getClass( 'class_localization' );
- $this->member = $this->registry->member( );
- $this->memberData = &$this->registry->member( )->fetchMemberData( );
- }
- function init() {
- $this->header = ($this->settings['email_header'] ? $this->settings['email_header'] : '');
- $this->footer = ($this->settings['email_footer'] ? $this->settings['email_footer'] : '');
- $classToLoad = IPSLib::loadlibrary( IPS_KERNEL_PATH . 'classEmail.php', 'classEmail' );
- $this->emailer = new $classToLoad( array( 'debug' => ($this->settings['fake_mail'] ? $this->settings['fake_mail'] : '0'), 'debug_path' => DOC_IPS_ROOT_PATH . '_mail', 'smtp_host' => ($this->settings['smtp_host'] ? $this->settings['smtp_host'] : 'localhost'), 'smtp_port' => (intval( $this->settings['smtp_port'] ) ? intval( $this->settings['smtp_port'] ) : 25), 'smtp_user' => $this->settings['smtp_user'], 'smtp_pass' => $this->settings['smtp_pass'], 'smtp_helo' => $this->settings['smtp_helo'], 'method' => $this->settings['mail_method'], 'wrap_brackets' => $this->settings['mail_wrap_brackets'], 'extra_opts' => $this->settings['php_mail_extra'], 'charset' => IPS_DOC_CHAR_SET, 'html' => $this->html_email ) );
- }
- function clearHeaders() {
- $this->temp_headers = array( );
- }
- function setHeader($key, $value) {
- $this->temp_headers[$key] = $value;
- }
- function sendMail() {
- $this->init( );
- if (count( $this->_attachments )) {
- foreach ($this->_attachments as $a) {
- $this->emailer->addAttachment( $a[0], $a[1], $a[2] );
- }
- }
- $this->settings['board_name'] = $this->cleanMessage( $this->settings['board_name'] );
- $this->emailer->setFrom( ($this->from ? $this->from : $this->settings['email_out']), $this->settings['board_name'] );
- $this->emailer->setTo( $this->to );
- foreach ($this->bcc as $bcc) {
- $this->emailer->addBCC( $bcc );
- }
- if (count( $this->temp_headers )) {
- foreach ($this->temp_headers as $k => $v) {
- $this->emailer->setHeader( $k, $v );
- }
- }
- $this->emailer->setSubject( $this->_cleanSubject( $this->subject ) );
- $this->emailer->setBody( $this->message );
- $this->emailer->sendMail( );
- $this->html_email = FALSE;
- if ($this->emailer->error) {
- return $this->fatalError( $this->emailer->error_msg, $this->emailer->error_help );
- }
- return true;
- }
- function getTemplate($name, $language = '', $lang_file = 'public_email_content', $app = 'core') {
- if ($name == '') {
- $this->error++;
- $this->fatalError( 'A valid email template ID was not passed to the email library during template parsing', '' );
- }
- if (!$language) {
- $language = IPSLib::getdefaultlanguage( );
- }
- $this->registry->class_localization->loadLanguageFile( array( $lang_file ), $app, $language, TRUE );
- if (!isset( $this->lang->words[$name] )) {
- if ($language == IPSLib::getdefaultlanguage( )) {
- $this->fatalError( '' . 'Could not find an email template with an ID of \'' . $name . '\'', '' );
- } else {
- $this->registry->class_localization->loadLanguageFile( array( $lang_file ), $app, IPSLib::getdefaultlanguage( ) );
- if (!isset( $this->lang->words[$name] )) {
- $this->fatalError( '' . 'Could not find an email template with an ID of \'' . $name . '\'', '' );
- }
- }
- }
- if (isset( $this->lang->words['subject__' . $name] )) {
- $this->subject = stripslashes( $this->lang->words['subject__' . $name] );
- }
- $this->template = stripslashes( $this->lang->words['email_header'] ) . stripslashes( $this->lang->words[$name] ) . stripslashes( $this->lang->words['email_footer'] );
- }
- ............................................................
- ..................................
- ...............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement