Advertisement
Guest User

Untitled

a guest
Nov 26th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.5.0
  8. * @ Author : DeZender
  9. * @ Release on : 09.06.2012
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class hanEmail {
  15. var $emailer = null;
  16. var $header = null;
  17. var $footer = null;
  18. var $from = null;
  19. var $to = null;
  20. var $bcc = array( );
  21. var $subject = null;
  22. var $message = null;
  23. var $html_email = FALSE;
  24. protected $_words = null;
  25. protected $temp_headers = array( );
  26. protected $_attachments = array( );
  27. private $registry = null;
  28. private $DB = null;
  29. private $settings = null;
  30. private $request = null;
  31. private $lang = null;
  32. private $member = null;
  33. private $memberData = null;
  34.  
  35. function __construct($registry) {
  36. $this->registry = $registry;
  37. $this->DB = $this->registry->DB( );
  38. $this->settings = &$this->registry->fetchSettings( );
  39. $this->request = &$this->registry->fetchRequest( );
  40.  
  41. $this->lang = $this->registry->getClass( 'class_localization' );
  42. $this->member = $this->registry->member( );
  43. $this->memberData = &$this->registry->member( )->fetchMemberData( );
  44.  
  45. }
  46.  
  47. function init() {
  48. $this->header = ($this->settings['email_header'] ? $this->settings['email_header'] : '');
  49. $this->footer = ($this->settings['email_footer'] ? $this->settings['email_footer'] : '');
  50. $classToLoad = IPSLib::loadlibrary( IPS_KERNEL_PATH . 'classEmail.php', 'classEmail' );
  51. $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 ) );
  52. }
  53.  
  54. function clearHeaders() {
  55. $this->temp_headers = array( );
  56. }
  57.  
  58. function setHeader($key, $value) {
  59. $this->temp_headers[$key] = $value;
  60. }
  61.  
  62. function sendMail() {
  63. $this->init( );
  64.  
  65. if (count( $this->_attachments )) {
  66. foreach ($this->_attachments as $a) {
  67. $this->emailer->addAttachment( $a[0], $a[1], $a[2] );
  68. }
  69. }
  70.  
  71. $this->settings['board_name'] = $this->cleanMessage( $this->settings['board_name'] );
  72. $this->emailer->setFrom( ($this->from ? $this->from : $this->settings['email_out']), $this->settings['board_name'] );
  73. $this->emailer->setTo( $this->to );
  74. foreach ($this->bcc as $bcc) {
  75. $this->emailer->addBCC( $bcc );
  76. }
  77.  
  78.  
  79. if (count( $this->temp_headers )) {
  80. foreach ($this->temp_headers as $k => $v) {
  81. $this->emailer->setHeader( $k, $v );
  82. }
  83. }
  84.  
  85. $this->emailer->setSubject( $this->_cleanSubject( $this->subject ) );
  86. $this->emailer->setBody( $this->message );
  87. $this->emailer->sendMail( );
  88. $this->html_email = FALSE;
  89.  
  90. if ($this->emailer->error) {
  91. return $this->fatalError( $this->emailer->error_msg, $this->emailer->error_help );
  92. }
  93.  
  94. return true;
  95. }
  96.  
  97. function getTemplate($name, $language = '', $lang_file = 'public_email_content', $app = 'core') {
  98. if ($name == '') {
  99. $this->error++;
  100. $this->fatalError( 'A valid email template ID was not passed to the email library during template parsing', '' );
  101. }
  102.  
  103.  
  104. if (!$language) {
  105. $language = IPSLib::getdefaultlanguage( );
  106. }
  107.  
  108. $this->registry->class_localization->loadLanguageFile( array( $lang_file ), $app, $language, TRUE );
  109.  
  110. if (!isset( $this->lang->words[$name] )) {
  111. if ($language == IPSLib::getdefaultlanguage( )) {
  112. $this->fatalError( '' . 'Could not find an email template with an ID of \'' . $name . '\'', '' );
  113. } else {
  114. $this->registry->class_localization->loadLanguageFile( array( $lang_file ), $app, IPSLib::getdefaultlanguage( ) );
  115.  
  116. if (!isset( $this->lang->words[$name] )) {
  117. $this->fatalError( '' . 'Could not find an email template with an ID of \'' . $name . '\'', '' );
  118. }
  119. }
  120. }
  121.  
  122.  
  123. if (isset( $this->lang->words['subject__' . $name] )) {
  124. $this->subject = stripslashes( $this->lang->words['subject__' . $name] );
  125. }
  126.  
  127. $this->template = stripslashes( $this->lang->words['email_header'] ) . stripslashes( $this->lang->words[$name] ) . stripslashes( $this->lang->words['email_footer'] );
  128. }
  129. ............................................................
  130. ..................................
  131. ...............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement