/** * send email to submitter on payment received */ function _notifySubmitter() { $mainframe =& JFactory::getApplication(); $mailer =& JFactory::getMailer(); $mailer->From = $mainframe->getCfg('mailfrom'); $mailer->FromName = $mainframe->getCfg('sitename'); $mailer->AddReplyTo(array($mainframe->getCfg('mailfrom'), $mainframe->getCfg('sitename'))); $mailer->IsHTML(true); $form = $this->getForm(); // set the email subject $subject = empty($form->submitterpaymentnotificationsubject) ? JText::_('COM_REDFORM_PAYMENT_SUBMITTER_NOTIFICATION_EMAIL_SUBJECT_DEFAULT') : $form->submitterpaymentnotificationsubject; $body = empty($form->submitterpaymentnotificationbody) ? JText::_('COM_REDFORM_PAYMENT_SUBMITTER_NOTIFICATION_EMAIL_SUBJECT_DEFAULT') : $form->submitterpaymentnotificationbody; $mailer->setSubject(JText::sprintf($subject, $form->formname)); $link = JRoute::_(JURI::root() . 'administrator/index.php?option=com_redform&view=submitters&form_id=' . $form->id); $mailer->setBody(JText::sprintf($body, $form->formname, $link)); $core = new RedFormCore(); $emails = $core->getSubmissionContactEmail($this->_submit_key); if (!$emails) { return false; } foreach ((array) $emails as $sid) { foreach ((array) $sid as $email) { $mailer->addRecipient($email['email']); } } if (!$mailer->send()) { return false; } return true; }
/** * Confirms the users request */ function activate() { $mainframe =& JFactory::getApplication(); $msgtype = 'message'; /* Get the confirm ID */ $confirmid = JRequest::getVar('confirmid', '', 'get'); /* Get the details out of the confirmid */ list($uip, $xref, $uid, $register_id, $submit_key) = explode("x", $confirmid); /* Confirm sign up via mail */ $model = $this->getModel('Registration', 'RedEventModel'); $model->setXref($xref); $eventdata = $model->getSessionDetails(); /* This loads the tags replacer */ JRequest::setVar('xref', $xref); require_once JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'tags.php'; $tags = new redEVENT_tags(); $tags->setXref($xref); $tags->setSubmitkey($submit_key); /* Check the db if this entry exists */ $db = JFactory::getDBO(); $q = ' SELECT r.confirmed ' . ' FROM #__redevent_register r ' . ' WHERE r.uid = ' . $db->Quote($uid) . ' AND r.submit_key = ' . $db->Quote($submit_key) . ' AND r.xref = ' . $db->Quote($xref) . ' AND r.id = ' . $db->Quote($register_id); $db->setQuery($q); $regdata = $db->loadObject(); if ($regdata && $regdata->confirmed == 0) { $model->confirm($register_id); // send activation confirmation email if activated if ($eventdata->enable_activation_confirmation) { $this->_Mailer(); $rfcore = new RedFormCore(); $addresses = $rfcore->getSubmissionContactEmail($submit_key); /* Check if there are any addresses to be mailed */ if (count($addresses) > 0) { /* Start mailing */ foreach ($addresses as $key => $sid) { foreach ($sid as $email) { /* Send a off mailinglist mail to the submitter if set */ /* Add the email address */ $this->mailer->AddAddress($email['email']); /* Mail submitter */ $htmlmsg = '<html><head><title></title></title></head><body>' . $tags->ReplaceTags($eventdata->notify_confirm_body) . '</body></html>'; // convert urls $htmlmsg = REOutput::ImgRelAbs($htmlmsg); $this->mailer->setBody($htmlmsg); $this->mailer->setSubject($tags->ReplaceTags($eventdata->notify_confirm_subject)); /* Send the mail */ if (!$this->mailer->Send()) { $mainframe->enqueueMessage(JText::_('COM_REDEVENT_THERE_WAS_A_PROBLEM_SENDING_MAIL')); RedeventHelperLog::simpleLog('Error sending confirm email' . ': ' . $this->mailer->error); } /* Clear the mail details */ $this->mailer->ClearAddresses(); } } } } $msg = JText::_('COM_REDEVENT_REGISTRATION_ACTIVATION_SUCCESSFULL'); } else { if ($regdata && $regdata->confirmed == 1) { $msg = JText::_('COM_REDEVENT_YOUR_SUBMISSION_HAS_ALREADY_BEEN_CONFIRMED'); $msgtype = 'error'; } else { $msg = JText::_('COM_REDEVENT_YOUR_SUBMISSION_CANNOT_BE_CONFIRMED'); $msgtype = 'error'; } } $this->setRedirect(JRoute::_(RedeventHelperRoute::getDetailsRoute($eventdata->did, $xref)), $msg, $msgtype); }