Exemplo n.º 1
0
 public function issue($short, $tags, $text, $level = 2, $params = null, $force_notify = 0, $force_email = 0)
 {
     global $aecConfig;
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     // Event, Notice, Warning, Error
     $legal_levels = array(2, 8, 32, 128);
     if (!in_array((int) $level, $legal_levels)) {
         $level = $legal_levels[0];
     }
     $this->datetime = date('Y-m-d H:i:s', (int) gmdate('U'));
     $this->short = $short;
     $this->tags = $tags;
     $this->event = $text;
     $this->level = (int) $level;
     // Create a notification link if this matches the desired level
     if ($this->level >= $aecConfig->cfg['error_notification_level']) {
         $this->notify = 1;
     } else {
         $this->notify = $force_notify ? 1 : 0;
     }
     // Mail out notification to all admins if this matches the desired level
     if ($this->level >= $aecConfig->cfg['email_notification_level'] || $force_email) {
         // check if Global Config `mailfrom` and `fromname` values exist
         if ($app->getCfg('mailfrom') != '' && $app->getCfg('fromname') != '') {
             $adminName2 = $app->getCfg('fromname');
             $adminEmail2 = $app->getCfg('mailfrom');
         } else {
             $rows = xJACLhandler::getSuperAdmins();
             $adminName2 = $rows[0]->name;
             $adminEmail2 = $rows[0]->email;
         }
         if (!$lang->hasKey("AEC_NOTICE_NUMBER_" . $this->level)) {
             $lang = JFactory::getLanguage();
             $lang->load('com_acctexp.admin', JPATH_ADMINISTRATOR);
         }
         // Send notification to all administrators
         $subject2 = sprintf(JText::_('AEC_ASEND_NOTICE'), JText::_("AEC_NOTICE_NUMBER_" . $this->level), $this->short, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('AEC_ASEND_NOTICE_MSG'), $this->event);
         $subject2 = html_entity_decode($subject2, ENT_QUOTES, 'UTF-8');
         $message2 = html_entity_decode($message2, ENT_QUOTES, 'UTF-8');
         // get email addresses of all admins and superadmins set to recieve system emails
         $admins = AECToolbox::getAdminEmailList();
         foreach ($admins as $adminemail) {
             if (!empty($adminemail)) {
                 xJ::sendMail($adminEmail2, $adminEmail2, $adminemail, $subject2, $message2);
             }
         }
     }
     if (!empty($params) && is_array($params)) {
         $this->params = $params;
     }
     $this->check();
     $this->store();
 }
Exemplo n.º 2
0
 public function invoiceCreationAction($objInvoice)
 {
     if ($this->settings['email_info']) {
         $metaUser = new metaUser($objInvoice->userid);
         $request = new stdClass();
         $request->metaUser =& $metaUser;
         $request->invoice =& $objInvoice;
         $request->plan =& $objInvoice->getObjUsage();
         $message = AECToolbox::rewriteEngineRQ($this->settings['text'], $request);
         $subject = AECToolbox::rewriteEngineRQ($this->settings['subject'], $request);
         if (!empty($message)) {
             $recipients = AECToolbox::rewriteEngineRQ($this->settings['recipient'], $request);
             $recips = explode(',', $recipients);
             $recipients2 = array();
             foreach ($recips as $k => $email) {
                 $recipients2[$k] = trim($email);
             }
             $recipients = $recipients2;
             $bccipients = AECToolbox::rewriteEngineRQ($this->settings['bcc'], $request);
             $bccips = explode(',', $bccipients);
             $bccipients2 = array();
             foreach ($bccips as $k => $email) {
                 $bccipients2[$k] = trim($email);
             }
             $bccipients = $bccipients2;
             if (!empty($bccipients2)) {
                 $bcc = $bccipients;
             } else {
                 $bcc = null;
             }
             xJ::sendMail($this->settings['sender'], $this->settings['sender_name'], $recipients, $subject, $message, $this->settings['text_html'], null, $bcc);
         }
     }
     if ($this->settings['waitingplan']) {
         $db = JFactory::getDBO();
         $metaUser = new metaUser($objInvoice->userid);
         if (!$metaUser->hasSubscription || in_array($metaUser->objSubscription->status, array('Expired', 'Closed'))) {
             if (!$metaUser->hasSubscription) {
                 $payment_plan = new SubscriptionPlan();
                 $payment_plan->load($this->settings['waitingplan']);
                 $metaUser->establishFocus($payment_plan, 'offline_payment3', false);
             }
             $metaUser->objSubscription->applyUsage($this->settings['waitingplan'], 'none', 0);
             $short = 'waiting plan';
             $event = 'Offline Payment waiting plan assigned for ' . $objInvoice->invoice_number;
             $tags = 'processor,waitingplan';
             $params = array('invoice_number' => $objInvoice->invoice_number);
             $eventlog = new eventLog();
             $eventlog->issue($short, $tags, $event, 2, $params);
         }
     }
 }
Exemplo n.º 3
0
 public function relayAction($request)
 {
     if ($request->action == 'action') {
         if (!empty($this->settings['text_first'])) {
             if (empty($request->metaUser->objSubscription->previous_plan)) {
                 $request->area = '_first';
             }
         }
     }
     if (!isset($this->settings['text' . $request->area]) || !isset($this->settings['subject' . $request->area])) {
         return null;
     }
     $message = AECToolbox::rewriteEngineRQ($this->settings['text' . $request->area], $request);
     $subject = AECToolbox::rewriteEngineRQ($this->settings['subject' . $request->area], $request);
     if (empty($message)) {
         return null;
     }
     $recipient = $cc = $bcc = null;
     $rec_groups = array("recipient", "cc", "bcc");
     foreach ($rec_groups as $setting) {
         if (empty($this->settings[$setting])) {
             continue;
         }
         $list = AECToolbox::rewriteEngineRQ($this->settings[$setting], $request);
         $recipient_array = explode(',', $list);
         if (!empty($recipient_array)) {
             ${$setting} = array();
             foreach ($recipient_array as $k => $email) {
                 if (!empty($email)) {
                     ${$setting}[] = trim($email);
                 }
             }
         }
     }
     xJ::sendMail($this->settings['sender'], $this->settings['sender_name'], $recipient, $subject, $message, $this->settings['text' . $request->area . '_html'], $cc, $bcc);
     return true;
 }
Exemplo n.º 4
0
 public function mailOut($request, $newcodes)
 {
     $codelist = "";
     if ($this->settings['text_html']) {
         foreach ($newcodes as $code) {
             $codelist .= "<p>" . $code . "</p>";
         }
     } else {
         $codelist = implode("\n", $newcodes);
     }
     $message = sprintf($this->settings['text'], $codelist);
     $message = AECToolbox::rewriteEngineRQ($message, $request);
     $subject = AECToolbox::rewriteEngineRQ($this->settings['subject'], $request);
     if (empty($message)) {
         return false;
     }
     $recipients = explode(',', $this->settings['recipient']);
     foreach ($recipients as $current => $email) {
         $recipients[$current] = AECToolbox::rewriteEngineRQ(trim($email), $request);
     }
     xJ::sendMail($this->settings['sender'], $this->settings['sender_name'], $recipients, $subject, $message, $this->settings['text_html']);
     return true;
 }
Exemplo n.º 5
0
 static function saveUserRegistration($var, $internal = false, $overrideActivation = false, $overrideEmails = false, $overrideJS = false)
 {
     $db = JFactory::getDBO();
     global $task, $aecConfig;
     $app = JFactory::getApplication();
     ob_start();
     // Let CB/JUSER think that everything is going fine
     if (aecComponentHelper::detect_component('anyCB')) {
         if (aecComponentHelper::detect_component('CBE') || $overrideActivation) {
             global $ueConfig;
         }
         $savetask = $task;
         $_REQUEST['task'] = 'done';
         include_once JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $task = $savetask;
         if ($overrideActivation) {
             $ueConfig['reg_confirmation'] = 0;
         }
         if ($overrideEmails) {
             $ueConfig['reg_welcome_sub'] = '';
             // Only disable "Pending Approval / Confirmation" emails if it makes sense
             if (!$ueConfig['reg_confirmation'] || !$ueConfig['reg_admin_approval']) {
                 $ueConfig['reg_pend_appr_sub'] = '';
             }
         }
     } elseif (aecComponentHelper::detect_component('JUSER')) {
         $savetask = $task;
         $task = 'blind';
         include_once JPATH_SITE . '/components/com_juser/juser.php';
         include_once JPATH_SITE . '/administrator/components/com_juser/juser.class.php';
         $task = $savetask;
     } elseif (aecComponentHelper::detect_component('JOMSOCIAL')) {
     }
     // For joomla and CB, we must filter out some internal variables before handing over the POST data
     $badbadvars = array('userid', 'method_name', 'usage', 'processor', 'recurring', 'currency', 'amount', 'invoice', 'id', 'gid');
     foreach ($badbadvars as $badvar) {
         if (isset($var[$badvar])) {
             unset($var[$badvar]);
         }
     }
     if (empty($var['name']) && !empty($var['jform'])) {
         // Must be K2
         $var['name'] = aecEscape($var['jform']['name'], array('string', 'clear_nonalnum'));
         unset($var['jform']);
     }
     $_POST = $var;
     $var['username'] = aecEscape($var['username'], array('string', 'badchars'));
     $savepwd = aecEscape($var['password'], array('string', 'badchars'));
     if (aecComponentHelper::detect_component('anyCB')) {
         // This is a CB registration, borrowing their code to save the user
         if ($internal && !aecComponentHelper::detect_component('CBE')) {
             include_once JPATH_SITE . '/components/com_acctexp/lib/codeofshame/cbregister.php';
             if (empty($_POST['firstname']) && !empty($_POST['name'])) {
                 $name = metaUser::_explodeName($_POST['name']);
                 $_POST['firstname'] = $name['first'];
                 if (empty($name['last'])) {
                     $_POST['lastname'] = $name['first'];
                 } else {
                     $_POST['lastname'] = $name['last'];
                 }
             }
             $_POST['password__verify'] = $_POST['password2'];
             unset($_POST['password2']);
             @saveRegistrationNOCHECKSLOL('com_acctexp');
         } else {
             @saveRegistration('com_acctexp');
             $cbreply = ob_get_contents();
             $indicator = '<script type="text/javascript">alert(\'';
             $alertstart = strpos($cbreply, $indicator);
             // Emergency fallback
             if ($alertstart !== false) {
                 ob_clean();
                 $alertend = strpos($cbreply, '\'); </script>', $alertstart);
                 $alert = substr($cbreply, $alertstart + strlen($indicator), $alertend - $alertstart - strlen($indicator));
                 if ($aecConfig->cfg['plans_first']) {
                     aecErrorAlert($alert, $action = 'window.history.go(-2);');
                 } else {
                     aecErrorAlert($alert, $action = 'window.history.go(-3);');
                 }
             }
         }
     } elseif (aecComponentHelper::detect_component('JUSER')) {
         // This is a JUSER registration, borrowing their code to save the user
         saveRegistration('com_acctexp');
         $query = 'SELECT `id`' . ' FROM #__users' . ' WHERE `username` = \'' . $var['username'] . '\'';
         $db->setQuery($query);
         $uid = $db->loadResult();
         JUser::saveUser_ext($uid);
         //synchronize dublicate user data
         $query = 'SELECT `id`' . ' FROM #__juser_integration' . ' WHERE `published` = \'1\'' . ' AND `export_status` = \'1\'';
         $db->setQuery($query);
         $components = $db->loadObjectList();
         if (!empty($components)) {
             foreach ($components as $component) {
                 $synchronize = require_integration($component->id);
                 $synchronize->synchronizeFrom($uid);
             }
         }
     } elseif (aecComponentHelper::detect_component('JOMSOCIAL') && !$overrideJS) {
     } else {
         $data = array('username' => $var['username'], 'password' => $var['password'], 'password2' => $var['password2'], 'email' => $var['email'], 'name' => $var['name']);
         if (isset($var['jform']['profile'])) {
             $data['profile'] = $var['jform']['profile'];
         }
         if (defined('JPATH_MANIFESTS')) {
             $params = JComponentHelper::getParams('com_users');
             // Initialise the table with JUser.
             JUser::getTable('User', 'JTable');
             $user = new JUser();
             // Prepare the data for the user object.
             $useractivation = $params->get('useractivation');
             // Check if the user needs to activate their account.
             if (($useractivation == 1 || $useractivation == 2) && !$overrideActivation) {
                 jimport('joomla.user.helper');
                 $data['activation'] = xJ::getHash();
                 $data['block'] = 1;
             }
             $usersConfig = JComponentHelper::getParams('com_users');
             $system = $usersConfig->get('new_usertype', 2);
             $data['groups'][] = $system;
             // Bind the data.
             if (!$user->bind($data)) {
                 JError::raiseWarning(500, JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
                 return false;
             }
             // Load the users plugin group.
             JPluginHelper::importPlugin('users');
             // Store the data.
             if (!$user->save()) {
                 JError::raiseWarning(500, JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
                 return false;
             }
         } else {
             // This is a joomla registration, borrowing their code to save the user
             // Check for request forgeries
             if (!$internal) {
                 JRequest::checkToken() or die('Invalid Token');
             }
             // Get required system objects
             $user = clone JFactory::getUser();
             //$pathway 	=& $app->getPathway();
             $config = JFactory::getConfig();
             $authorize = JFactory::getACL();
             $document = JFactory::getDocument();
             // If user registration is not allowed, show 403 not authorized.
             $usersConfig = JComponentHelper::getParams('com_users');
             if ($usersConfig->get('allowUserRegistration') == '0') {
                 JError::raiseError(403, JText::_('Access Forbidden'));
                 return;
             }
             // Initialize new usertype setting
             $newUsertype = $usersConfig->get('new_usertype');
             if (!$newUsertype) {
                 $newUsertype = 'Registered';
             }
             // Bind the post array to the user object
             if (!$user->bind($data)) {
                 JError::raiseError(500, $user->getError());
                 unset($_POST);
                 subscribe('com_acctexp');
                 return false;
             }
             // Set some initial user values
             $user->set('id', 0);
             $user->set('usertype', '');
             $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
             $user->set('sendEmail', 0);
             $user->set('registerDate', date('Y-m-d H:i:s', (int) gmdate('U')));
             // If user activation is turned on, we need to set the activation information
             $useractivation = $usersConfig->get('useractivation');
             if ($useractivation == '1' && !$overrideActivation) {
                 jimport('joomla.user.helper');
                 $user->set('activation', md5(JUserHelper::genRandomPassword()));
                 $user->set('block', '1');
             }
             // If there was an error with registration, set the message and display form
             if (!$user->save()) {
                 JError::raiseWarning('', JText::_($user->getError()));
                 echo JText::_($user->getError());
                 return false;
             }
         }
         $row = $user;
         $name = $row->name;
         $email = $row->email;
         $username = $row->username;
         $subject = sprintf(JText::_('AEC_SEND_SUB'), $name, $app->getCfg('sitename'));
         $subject = html_entity_decode($subject, ENT_QUOTES, 'UTF-8');
         $usersConfig = JComponentHelper::getParams('com_users');
         $activation = $usersConfig->get('useractivation');
         if ($activation > 0 && !$overrideActivation) {
             $atext = JText::_('AEC_USEND_MSG_ACTIVATE');
             if (defined('JPATH_MANIFESTS')) {
                 $activation_link = JURI::root() . 'index.php?option=com_users&amp;task=registration.activate&amp;token=' . $row->activation;
                 if ($activation == 2) {
                     $atext = JText::_('COM_USERS_MSG_ADMIN_ACTIVATE');
                 }
             } else {
                 $activation_link = JURI::root() . 'index.php?option=com_user&amp;task=activate&amp;activation=' . $row->activation;
             }
             $message = sprintf($atext, $name, $app->getCfg('sitename'), $activation_link, JURI::root(), $username, $savepwd);
         } else {
             $message = sprintf(JText::_('AEC_USEND_MSG'), $name, $app->getCfg('sitename'), JURI::root());
         }
         $message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
         // check if Global Config `mailfrom` and `fromname` values exist
         if ($app->getCfg('mailfrom') != '' && $app->getCfg('fromname') != '') {
             $adminName2 = $app->getCfg('fromname');
             $adminEmail2 = $app->getCfg('mailfrom');
         } else {
             // use email address and name of first superadmin for use in email sent to user
             $rows = xJACLhandler::getSuperAdmins();
             $row2 = $rows[0];
             $adminName2 = $row2->name;
             $adminEmail2 = $row2->email;
         }
         // Send email to user
         if (!($aecConfig->cfg['nojoomlaregemails'] || $overrideEmails)) {
             xJ::sendMail($adminEmail2, $adminEmail2, $email, $subject, $message);
         }
         // Send notification to all administrators
         $aecUser = AECToolbox::aecIP();
         $subject2 = sprintf(JText::_('AEC_SEND_SUB'), $name, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('AEC_ASEND_MSG_NEW_REG'), $adminName2, $app->getCfg('sitename'), $row->name, $email, $username, $aecUser['ip'], $aecUser['isp']);
         $subject2 = html_entity_decode($subject2, ENT_QUOTES, 'UTF-8');
         $message2 = html_entity_decode($message2, ENT_QUOTES, 'UTF-8');
         // get email addresses of all admins and superadmins set to recieve system emails
         $admins = AECToolbox::getAdminEmailList();
         foreach ($admins as $adminemail) {
             if (!empty($adminemail)) {
                 xJ::sendMail($adminEmail2, $adminEmail2, $adminemail, $subject2, $message2);
             }
         }
     }
     ob_clean();
     // We need the new userid, so we're fetching it from the newly created entry here
     $query = 'SELECT `id`' . ' FROM #__users' . ' WHERE `username` = \'' . $var['username'] . '\'';
     $db->setQuery($query);
     return $db->loadResult();
 }
Exemplo n.º 6
0
 public function sendEmailRegistered($renew, $adminonly = false, $invoice = null)
 {
     global $aecConfig;
     $app = JFactory::getApplication();
     $free = strcmp(strtolower($this->type), 'none') == 0 || strcmp(strtolower($this->type), 'free') == 0;
     $urow = new cmsUser();
     $urow->load($this->userid);
     $plan = new SubscriptionPlan();
     $plan->load($this->plan);
     $name = $urow->name;
     $email = $urow->email;
     $username = $urow->username;
     $pwd = $urow->password;
     $activationcode = $urow->activation;
     $message = sprintf(JText::_('ACCTEXP_MAILPARTICLE_GREETING'), $name);
     // Assemble E-Mail Subject & Message
     if ($renew) {
         $subject = sprintf(JText::_('ACCTEXP_SEND_MSG_RENEW'), $name, $app->getCfg('sitename'));
         $message .= sprintf(JText::_('ACCTEXP_MAILPARTICLE_THANKSREN'), $app->getCfg('sitename'));
         if ($plan->email_desc) {
             $message .= "\n\n" . $plan->email_desc . "\n\n";
         } else {
             $message .= " ";
         }
         if ($free) {
             $message .= sprintf(JText::_('ACCTEXP_MAILPARTICLE_LOGIN'), JURI::root());
         } else {
             $message .= JText::_('ACCTEXP_MAILPARTICLE_PAYREC') . " " . sprintf(JText::_('ACCTEXP_MAILPARTICLE_LOGIN'), JURI::root());
         }
     } else {
         $subject = sprintf(JText::_('ACCTEXP_SEND_MSG'), $name, $app->getCfg('sitename'));
         $message .= sprintf(JText::_('ACCTEXP_MAILPARTICLE_THANKSREG'), $app->getCfg('sitename'));
         if ($plan->email_desc) {
             $message .= "\n\n" . $plan->email_desc . "\n\n";
         } else {
             $message .= " ";
         }
         if ($free) {
             $message .= sprintf(JText::_('ACCTEXP_MAILPARTICLE_LOGIN'), JURI::root());
         } else {
             $message .= JText::_('ACCTEXP_MAILPARTICLE_PAYREC') . " " . sprintf(JText::_('ACCTEXP_MAILPARTICLE_LOGIN'), JURI::root());
         }
     }
     $message .= JText::_('ACCTEXP_MAILPARTICLE_FOOTER');
     $subject = html_entity_decode($subject, ENT_QUOTES, 'UTF-8');
     $message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
     // Send email to user
     if ($app->getCfg('mailfrom') != '' && $app->getCfg('fromname') != '') {
         $adminName2 = $app->getCfg('fromname');
         $adminEmail2 = $app->getCfg('mailfrom');
     } else {
         $rows = xJACLhandler::getSuperAdmins();
         $row2 = $rows[0];
         $adminName2 = $row2->name;
         $adminEmail2 = $row2->email;
     }
     if (!$adminonly) {
         xJ::sendMail($adminEmail2, $adminEmail2, $email, $subject, $message);
     }
     $aecUser = array();
     if (is_object($invoice)) {
         if (!empty($invoice->params['creator_ip'])) {
             $aecUser['ip'] = $invoice->params['creator_ip'];
             // user Hostname (if not deactivated)
             if ($aecConfig->cfg['gethostbyaddr']) {
                 $aecUser['isp'] = gethostbyaddr($invoice->params['creator_ip']);
             } else {
                 $aecUser['isp'] = 'deactivated';
             }
         }
     }
     if (empty($aecUser)) {
         $aecUser = AECToolbox::aecIP();
     }
     // Send notification to all administrators
     if ($renew) {
         $subject2 = sprintf(JText::_('ACCTEXP_SEND_MSG_RENEW'), $name, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('ACCTEXP_ASEND_MSG_RENEW'), $adminName2, $app->getCfg('sitename'), $name, $email, $username, $plan->id, $plan->name, $aecUser['ip'], $aecUser['isp']);
     } else {
         $subject2 = sprintf(JText::_('ACCTEXP_SEND_MSG'), $name, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('ACCTEXP_ASEND_MSG'), $adminName2, $app->getCfg('sitename'), $name, $email, $username, $plan->id, $plan->name, $aecUser['ip'], $aecUser['isp']);
     }
     $subject2 = html_entity_decode($subject2, ENT_QUOTES, 'UTF-8');
     $message2 = html_entity_decode($message2, ENT_QUOTES, 'UTF-8');
     $admins = AECToolbox::getAdminEmailList();
     foreach ($admins as $adminemail) {
         if (!empty($adminemail)) {
             xJ::sendMail($adminEmail2, $adminEmail2, $adminemail, $subject2, $message2);
         }
     }
 }
Exemplo n.º 7
0
    public function relayAction($request)
    {
        if ($request->action != 'action') {
            return null;
        }
        if (empty($request->invoice->id)) {
            return null;
        }
        if (empty($this->settings['subject'])) {
            return null;
        }
        if (isset($request->invoice->params['mi_aecinvoiceprintemail'])) {
            if ((int) gmdate('U') - $request->invoice->params['mi_aecinvoiceprintemail'] < 10) {
                // Seems like we have a card processing, skip
                return null;
            }
        }
        $subject = AECToolbox::rewriteEngineRQ($this->settings['subject' . $request->area], $request);
        if (!empty($this->settings['customcss'])) {
            $css = $this->settings['customcss'];
        } else {
            $cssfile = JPATH_SITE . '/media/com_acctexp/css/invoice.css';
            if (file_exists($cssfile)) {
                $css = file_get_contents($cssfile);
            } else {
                $css = "";
            }
        }
        $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>' . $subject . '</title>
	<meta http-equiv="Content-Type" content="text/html;" />
	<style type="text/css">' . $css . '</style>
</head>
<body style="padding:0;margin:0;background-color:#fff;" >';
        $message .= $this->getInvoice($request->invoice) . '</body></html>';
        if (empty($message)) {
            return null;
        }
        $attachment = null;
        $html_mode = true;
        if (!empty($this->settings['make_pdf'])) {
            $app = JFactory::getApplication();
            require_once JPATH_SITE . '/components/com_acctexp/lib/tcpdf/config/lang/eng.php';
            require_once JPATH_SITE . '/components/com_acctexp/lib/tcpdf/tcpdf.php';
            $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
            $pdf->AddPage();
            $pdf->writeHTML($message, true, false, true, false, '');
            if (!empty($request->invoice->invoice_number_format)) {
                $name = $request->invoice->invoice_number_format;
            } else {
                $name = $request->invoice->invoice_number;
            }
            $fname = preg_replace("/[^a-z0-9@._+-]/i", '', $name) . '.pdf';
            $content = $pdf->Output($fname, 'S');
            $attachment = $app->getCfg('tmp_path') . '/' . $fname;
            $fp = fopen($attachment, 'w');
            fwrite($fp, $content);
            fclose($fp);
            $message = $this->settings['text'];
            $html_mode = $this->settings['text_html'];
        }
        $recipient = $cc = $bcc = null;
        $rec_groups = array("recipient", "cc", "bcc");
        foreach ($rec_groups as $setting) {
            $list = AECToolbox::rewriteEngineRQ($this->settings[$setting], $request);
            $recipient_array = explode(',', $list);
            if (!empty($recipient_array)) {
                ${$setting} = array();
                foreach ($recipient_array as $k => $email) {
                    if (!empty($email)) {
                        ${$setting}[] = trim($email);
                    }
                }
            }
        }
        xJ::sendMail($this->settings['sender'], $this->settings['sender_name'], $recipient, $subject, $message, $html_mode, $cc, $bcc, $attachment);
        if (!empty($attachment)) {
            unlink($attachment);
        }
        $request->invoice->params['mi_aecinvoiceprintemail'] = (int) gmdate('U');
        $request->invoice->storeload();
        return true;
    }