当前位置: 首页>>代码示例>>PHP>>正文


PHP JMailHelper::cleanSubject方法代码示例

本文整理汇总了PHP中JMailHelper::cleanSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP JMailHelper::cleanSubject方法的具体用法?PHP JMailHelper::cleanSubject怎么用?PHP JMailHelper::cleanSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JMailHelper的用法示例。


在下文中一共展示了JMailHelper::cleanSubject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Process

 public function Process()
 {
     $copy_to_submitter = (bool) JRequest::getVar($this->SafeName("copy_to_submitter" . $this->GetId()), NULL, 'POST') || $this->Params->get("copy_to_submitter", NULL) == 1;
     // always send a copy parameter
     if (!$copy_to_submitter || !isset($this->FieldsBuilder->Fields['sender1']) || empty($this->FieldsBuilder->Fields['sender1']['Value'])) {
         $this->FSession->Clear('filelist');
         //JLog::add("Copy email for the submitter skipped.", JLog::INFO, get_class($this));
         return true;
     }
     $mail = JFactory::getMailer();
     $this->set_from($mail);
     $this->set_to($mail);
     $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
     // Body
     $body = $this->Params->get("email_copy_text", "") . PHP_EOL;
     // a blank line
     $body .= PHP_EOL;
     if ($this->Params->get("email_copy_summary", NULL)) {
         $body .= $this->body();
         $body .= $this->attachments();
         $body .= PHP_EOL;
     }
     // A null body will raise a mail error, so always add at least a signature.
     $body .= "------" . PHP_EOL . $this->Application->getCfg("sitename") . PHP_EOL;
     $body = JMailHelper::cleanBody($body);
     $mail->setBody($body);
     // Clear file list for the next submission of the same users
     $this->FSession->Clear('filelist');
     $this->send($mail);
     return true;
 }
开发者ID:jehanryan,项目名称:Flotech,代码行数:31,代码来源:fsubmittermailer.php

示例2: testCleanSubject

	/**
	 * @group	framework.mail
	 * @dataProvider	getCleanSubjectData
	 */
	public function testCleanSubject( $input, $expected )
	{
		$this->assertThat(
			JMailHelper::cleanSubject( $input ),
			$this->equalTo( $expected )
		);
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:11,代码来源:JMailHelperTest.php

示例3: Process

 public function Process()
 {
     $copy_to_submitter = (bool) JRequest::getVar($this->SafeName("copy_to_submitter" . $this->GetId()), NULL, 'POST') || $this->Params->get("copy_to_submitter", NULL) == 1;
     if (!$copy_to_submitter || !isset($this->FieldsBuilder->senderEmail->b2jFieldValue) || empty($this->FieldsBuilder->senderEmail->b2jFieldValue)) {
         $this->B2JSession->Clear('filelist');
         return true;
     }
     $mail = JFactory::getMailer();
     $mail->isHTML(true);
     $this->set_from($mail);
     $this->set_to($mail);
     $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
     $body = $this->Params->get("email_copy_text", "") . PHP_EOL;
     $body .= PHP_EOL;
     if ($this->Params->get("email_copy_summary", NULL)) {
         $body .= $this->body();
         $body .= PHP_EOL;
         $body .= $this->attachments();
         $body .= PHP_EOL;
     }
     $body .= "------" . PHP_EOL . $this->Application->getCfg("sitename") . PHP_EOL;
     $body = JMailHelper::cleanBody($body);
     $mail->setBody($body);
     $this->B2JSession->Clear('filelist');
     $this->send($mail);
     return true;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:27,代码来源:b2jsubmittermailer.php

示例4: sendNotificationOnUpdateRank

 private function sendNotificationOnUpdateRank($userinfo, $result)
 {
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     jimport('joomla.mail.helper');
     require_once JPATH_ROOT . '/components/com_alphauserpoints/helper.php';
     // get params definitions
     $params = JComponentHelper::getParams('com_alphauserpoints');
     $jsNotification = $params->get('jsNotification', 0);
     $jsNotificationAdmin = $params->get('fromIdUddeim', 0);
     $SiteName = $app->getCfg('sitename');
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $sef = $app->getCfg('sef');
     $email = $userinfo->email;
     $subject = $result->emailsubject;
     $body = $result->emailbody;
     $formatMail = $result->emailformat;
     $bcc2admin = $result->bcc2admin;
     $subject = str_replace('{username}', $userinfo->username, $subject);
     $subject = str_replace('{points}', AlphaUserPointsHelper::getFPoints($userinfo->points), $subject);
     $body = str_replace('{username}', $userinfo->username, $body);
     $body = str_replace('{points}', AlphaUserPointsHelper::getFPoints($userinfo->points), $body);
     $subject = JMailHelper::cleanSubject($subject);
     if (!$jsNotification) {
         $mailer = JFactory::getMailer();
         $mailer->setSender(array($MailFrom, $FromName));
         $mailer->setSubject($subject);
         $mailer->isHTML((bool) $formatMail);
         $mailer->CharSet = "utf-8";
         $mailer->setBody($body);
         $mailer->addRecipient($email);
         if ($bcc2admin) {
             // get all users allowed to receive e-mail system
             $query = "SELECT email" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
             $db->setQuery($query);
             $rowsAdmins = $db->loadObjectList();
             foreach ($rowsAdmins as $rowsAdmin) {
                 $mailer->addBCC($rowsAdmin->email);
             }
         }
         $send = $mailer->Send();
     } else {
         require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
         $params = new CParameter('');
         CNotificationLibrary::add('system_messaging', $jsNotificationAdmin, $userinfo->id, $subject, $body, '', $params);
         if ($bcc2admin) {
             // get all users allowed to receive e-mail system
             $query = "SELECT id" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
             $db->setQuery($query);
             $rowsAdmins = $db->loadObjectList();
             foreach ($rowsAdmins as $rowsAdmin) {
                 $mailer->addBCC($rowsAdmin->id);
                 CNotificationLibrary::add('system_messaging', $userinfo->id, $rowsAdmin->id, $subject, $body, '', $params);
             }
         }
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:59,代码来源:notification_rank_medal.php

示例5: Process

 public function Process()
 {
     $mail = JFactory::getMailer();
     $this->set_from($mail);
     $this->set_to($mail, "to_address", "addRecipient");
     $this->set_to($mail, "cc_address", "addCC");
     $this->set_to($mail, "bcc_address", "addBCC");
     $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_subject", "")));
     $body = $this->body();
     $body .= $this->attachments($mail);
     $body .= PHP_EOL;
     $body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
     $body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
     $body = JMailHelper::cleanBody($body);
     $mail->setBody($body);
     $this->Logger->Write("---------------------------------------------------" . PHP_EOL . $body);
     return $this->send($mail);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:18,代码来源:b2jadminmailer.php

示例6: Process

 public function Process()
 {
     $application = JFactory::getApplication();
     $copy_to_submitter = $application->input->post->get($this->SafeName("copy_to_submitter" . $this->GetId()), false, "bool") || $this->Params->get("copy_to_submitter", null) == 1;
     // always send a copy parameter
     if (!$copy_to_submitter || !isset($this->FieldsBuilder->Fields['sender1']) || empty($this->FieldsBuilder->Fields['sender1']['Value'])) {
         $this->session->clear("filelist", $this->namespace);
         //JLog::add("Copy email for the submitter skipped.", JLog::INFO, get_class($this));
         return true;
     }
     $mail = JFactory::getMailer();
     $this->set_from($mail);
     $this->set_to($mail);
     $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
     // Body
     $body = $this->Params->get("email_copy_text", "") . PHP_EOL;
     // a blank line
     $body .= PHP_EOL;
     if ($this->Params->get("email_copy_summary", null)) {
         $body .= $this->body();
         $body .= $this->attachments();
         $body .= PHP_EOL;
     }
     // A null body will raise a mail error, so always add at least a signature.
     $body .= "------" . PHP_EOL . JFactory::getConfig()->get("sitename") . PHP_EOL;
     $body = JMailHelper::cleanBody($body);
     $mail->setBody($body);
     // Clear file list for the next submission of the same users
     $this->session->clear("filelist", $this->namespace);
     $sent = $this->send($mail);
     if ($sent) {
         // Notify email send success
         $this->Logger->Write("Copy email sent.");
     }
     return $sent;
 }
开发者ID:HPReflectoR,项目名称:GlavExpert,代码行数:36,代码来源:fsubmittermailer.php

示例7: _sendReportToMail

 protected function _sendReportToMail($message, $subject, $emailToList)
 {
     jimport('joomla.mail.helper');
     $sender = JMailHelper::cleanAddress($this->config->board_title . ' ' . JText::_('COM_KUNENA_GEN_FORUM') . ': ' . $this->_getSenderName());
     $subject = JMailHelper::cleanSubject($subject);
     $message = JMailHelper::cleanBody($message);
     foreach ($emailToList as $emailTo) {
         if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
             continue;
         }
         JUtility::sendMail($this->config->email, $sender, $emailTo->email, $subject, $message);
     }
     $this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_SUCCESS'));
     while (@ob_end_clean()) {
     }
     $this->app->redirect(CKunenaLink::GetThreadPageURL('view', $this->catid, $this->id, NULL, NULL, $this->id, false));
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:17,代码来源:kunena.report.class.php

示例8: sendEmailToModeratorsPostWFM

 function sendEmailToModeratorsPostWFM()
 {
     // get settings from com_discussions parameters
     $params = JComponentHelper::getParams('com_discussions');
     $SiteName = $params->get('emailSiteName', '');
     $from = $params->get('emailFrom', '');
     $sender = $params->get('emailSender', '');
     $link = $params->get('emailLink', '');
     $subject = $params->get('emailWFMSubject', '');
     $msgparam = $params->get('emailWFMMessage', '');
     jimport('joomla.mail.helper');
     $db =& JFactory::getDBO();
     // get all moderators with email notifications set
     $sql = "SELECT u.username, u.email FROM " . $db->nameQuote('#__users') . " u, " . $db->nameQuote('#__discussions_users') . " d" . " WHERE u.id = d.id AND d.moderator = 1 AND d.email_notification = 1";
     $db->setQuery($sql);
     $_moderator_list = $db->loadAssocList();
     reset($_moderator_list);
     while (list($key, $val) = each($_moderator_list)) {
         $username = $_moderator_list[$key]['username'];
         $email = $_moderator_list[$key]['email'];
         if (JMailHelper::isEmailAddress($email)) {
             // construct email
             $msg = $username . ", \n\n" . $msgparam;
             $body = sprintf($msg, $SiteName, $sender, $from, $link);
             // Clean the email data
             $subject = JMailHelper::cleanSubject($subject);
             $body = JMailHelper::cleanBody($body);
             $sender = JMailHelper::cleanAddress($sender);
             JUtility::sendMail($from, $sender, $email, $subject, $body);
         }
     }
     return 0;
 }
开发者ID:rbista,项目名称:Discussions-J1.6,代码行数:33,代码来源:helper.php

示例9: share_file_email


//.........这里部分代码省略.........
     $query = 'SELECT f.id, f.filename, f.altname, f.secure, f.url,' . ' i.title as item_title, i.introtext as item_introtext, i.fulltext as item_fulltext, u.email as item_owner_email, ' . ' CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as itemslug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug' . ' FROM #__flexicontent_fields_item_relations AS rel' . ' LEFT JOIN #__flexicontent_files AS f ON f.id = rel.value' . ' LEFT JOIN #__flexicontent_fields AS fi ON fi.id = rel.field_id' . ' LEFT JOIN #__content AS i ON i.id = rel.item_id' . ' LEFT JOIN #__categories AS c ON c.id = i.catid' . ' LEFT JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . ' LEFT JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id' . ' LEFT JOIN #__users AS u ON u.id = i.created_by' . $access_clauses['join'] . ' WHERE rel.item_id = ' . $content_id . ' AND rel.field_id = ' . $field_id . ' AND f.id = ' . $file_id . ' AND f.published= 1' . $access_clauses['and'];
     $db->setQuery($query);
     $file = $db->loadObject();
     if ($db->getErrorNum()) {
         jexit(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()));
     }
     if (empty($file)) {
         // this is normally not reachable because the share link should not have been displayed for the user, but it is reachable if e.g. user session has expired
         jexit(JText::_('FLEXI_ALERTNOTAUTH') . "File data not found OR no access for file #: " . $file_id . " of content #: " . $content_id . " in field #: " . $field_id);
     }
     $coupon_vars = '';
     if ($field_params->get('enable_coupons', 0)) {
         // Insert new download coupon into the DB, in the case the file is sent to a user with no ACCESS
         $coupon_token = uniqid();
         // create coupon token
         $query = ' INSERT #__flexicontent_download_coupons ' . 'SET user_id = ' . (int) $user->id . ', file_id = ' . $file_id . ', token = ' . $db->Quote($coupon_token) . ', hits = 0' . ', hits_limit = ' . (int) $field_params->get('coupon_hits_limit', 3) . ', expire_on = NOW() + INTERVAL ' . (int) $field_params->get('coupon_expiration_days', 15) . ' DAY';
         $db->setQuery($query);
         $db->execute();
         $coupon_id = $db->insertid();
         // get id of newly created coupon
         $coupon_vars = '&conid=' . $coupon_id . '&contok=' . $coupon_token;
     }
     $uri = JURI::getInstance();
     $base = $uri->toString(array('scheme', 'host', 'port'));
     $vars = '&id=' . $file_id . '&cid=' . $content_id . '&fid=' . $field_id . $coupon_vars;
     $link = $base . JRoute::_('index.php?option=com_flexicontent&task=download' . $vars, false);
     // Verify that this is a local link
     if (!$link || !JURI::isInternal($link)) {
         //Non-local url...
         JError::raiseNotice(500, JText::_('FLEXI_FIELD_FILE_EMAIL_NOT_SENT'));
         return $this->share_file_form();
     }
     // An array of email headers we do not want to allow as input
     $headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
     // An array of the input fields to scan for injected headers
     $fields = array('mailto', 'sender', 'from', 'subject');
     /*
      * Here is the meat and potatoes of the header injection test.  We
      * iterate over the array of form input and check for header strings.
      * If we find one, send an unauthorized header and die.
      */
     foreach ($fields as $field) {
         foreach ($headers as $header) {
             if (strpos($_POST[$field], $header) !== false) {
                 JError::raiseError(403, '');
             }
         }
     }
     /*
      * Free up memory
      */
     unset($headers, $fields);
     $email = JRequest::getString('mailto', '', 'post');
     echo "<br>";
     $sender = JRequest::getString('sender', '', 'post');
     echo "<br>";
     $from = JRequest::getString('from', '', 'post');
     echo "<br>";
     $_subject = JText::sprintf('FLEXI_FIELD_FILE_SENT_BY', $sender);
     echo "<br>";
     $subject = JRequest::getString('subject', $_subject, 'post');
     echo "<br>";
     $desc = JRequest::getString('desc', '', 'post');
     echo "<br>";
     // Check for a valid to address
     $error = false;
     if (!$email || !JMailHelper::isEmailAddress($email)) {
         $error = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_INVALID', $email);
         JError::raiseWarning(0, $error);
     }
     // Check for a valid from address
     if (!$from || !JMailHelper::isEmailAddress($from)) {
         $error = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_INVALID', $from);
         JError::raiseWarning(0, $error);
     }
     if ($error) {
         return $this->share_file_form();
     }
     // Build the message to send
     $body = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_MSG', $SiteName, $sender, $from, $link);
     $body .= "\n\n" . JText::_('FLEXI_FIELD_FILE_EMAIL_SENDER_NOTES') . ":\n\n" . $desc;
     // Clean the email data
     $subject = JMailHelper::cleanSubject($subject);
     $body = JMailHelper::cleanBody($body);
     $sender = JMailHelper::cleanAddress($sender);
     $html_mode = false;
     $cc = null;
     $bcc = null;
     $attachment = null;
     $replyto = null;
     $replytoname = null;
     // Send the email
     $send_result = JFactory::getMailer()->sendMail($from, $sender, $email, $subject, $body, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
     if ($send_result !== true) {
         JError::raiseNotice(500, JText::_('FLEXI_FIELD_FILE_EMAIL_NOT_SENT'));
         return $this->share_file_form();
     }
     $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css', FLEXI_VHASH);
     include 'file' . DS . 'share_result.php';
 }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:101,代码来源:file.php

示例10: sprintf

 if ($list_email_administrator == '') {
     $list_email_administrator = $MailFrom;
 }
 $emails = @explode(',', $list_email_administrator);
 $subject = JText::_('AC_REPORT_THIS_LISTING') . " (" . $SiteName . ")";
 // Build the message to send
 $msg = JText::_('AUP_EMAIL_MSG_INVITE');
 $body = sprintf($msg, $SiteName, $sender, $link) . " \n" . $report;
 $body = JText::_('AC_USER_REPORTED_ARTICLE') . " \n";
 $body .= JText::_('AC_NAME') . ": " . $reportname . " \n";
 $body .= JText::_('AC_EMAIL') . ": " . $reportemail . " \n";
 $body .= JText::_('AC_REPORT') . ": " . $report . " \n";
 $body .= JText::_('AC_COMPONENT') . ": " . $type . " \n";
 $body .= JText::_('AC_ID') . ": " . $id . " \n";
 // Clean the email data
 $subject = JMailHelper::cleanSubject($subject);
 $body = JMailHelper::cleanBody($body);
 foreach ($emails as $email) {
     if (JMailHelper::isEmailAddress($email)) {
         $mailer =& JFactory::getMailer();
         $mailer->setSender(array($MailFrom, $FromName));
         $mailer->setSubject($subject);
         $mailer->setBody($body);
         $mailer->addRecipient($email);
         if ($mailer->Send() === true) {
             $success = true;
         }
     }
 }
 if ($success) {
     echo JText::_('AC_THANKS4UREPORT');
开发者ID:jtresca,项目名称:nysurveyor,代码行数:31,代码来源:default_report.php

示例11: send

 /**
  * Send the message and display a notice
  *
  * @access public
  * @since 1.5
  */
 function send()
 {
     // Check for request forgeries
     Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
     $timeout = Session::get('com_mailto.formtime', 0);
     if ($timeout == 0 || time() - $timeout < 20) {
         throw new Exception(Lang::txt('COM_MAILTO_EMAIL_NOT_SENT'), 500);
         return $this->mailto();
     }
     $SiteName = Config::get('sitename');
     $MailFrom = Config::get('mailfrom');
     $FromName = Config::get('fromname');
     $link = MailtoHelper::validateHash(Request::getCMD('link', '', 'post'));
     // Verify that this is a local link
     if (!$link || !JURI::isInternal($link)) {
         //Non-local url...
         throw new Exception(Lang::txt('COM_MAILTO_EMAIL_NOT_SENT'), 500);
         return $this->mailto();
     }
     // An array of email headers we do not want to allow as input
     $headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
     // An array of the input fields to scan for injected headers
     $fields = array('mailto', 'sender', 'from', 'subject');
     /*
      * Here is the meat and potatoes of the header injection test.  We
      * iterate over the array of form input and check for header strings.
      * If we find one, send an unauthorized header and die.
      */
     foreach ($fields as $field) {
         foreach ($headers as $header) {
             if (strpos($_POST[$field], $header) !== false) {
                 App::abort(403, '');
             }
         }
     }
     // Free up memory
     unset($headers, $fields);
     $email = Request::getString('mailto', '', 'post');
     $sender = Request::getString('sender', '', 'post');
     $from = Request::getString('from', '', 'post');
     $subject_default = Lang::txt('COM_MAILTO_SENT_BY', $sender);
     $subject = Request::getString('subject', $subject_default, 'post');
     // Check for a valid to address
     $error = false;
     if (!$email || !JMailHelper::isEmailAddress($email)) {
         $error = Lang::txt('COM_MAILTO_EMAIL_INVALID', $email);
         Notify::warning($error);
     }
     // Check for a valid from address
     if (!$from || !JMailHelper::isEmailAddress($from)) {
         $error = Lang::txt('COM_MAILTO_EMAIL_INVALID', $from);
         Notify::warning($error);
     }
     if ($error) {
         return $this->mailto();
     }
     // Build the message to send
     $msg = Lang::txt('COM_MAILTO_EMAIL_MSG');
     $body = sprintf($msg, $SiteName, $sender, $from, $link);
     // Clean the email data
     $subject = JMailHelper::cleanSubject($subject);
     $body = JMailHelper::cleanBody($body);
     $sender = JMailHelper::cleanAddress($sender);
     // Send the email
     if (JFactory::getMailer()->sendMail($from, $sender, $email, $subject, $body) !== true) {
         throw new Exception(Lang::txt('COM_MAILTO_EMAIL_NOT_SENT'), 500);
         return $this->mailto();
     }
     Request::setVar('view', 'sent');
     $this->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:77,代码来源:controller.php

示例12: mail_notification

function mail_notification($subscription)
{
    if (in_array(15, $subscription->courses)) {
        jimport('joomla.mail.helper');
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $SiteName = $JLMS_CONFIG->get('sitename');
        $MailFrom = $JLMS_CONFIG->get('mailfrom');
        $FromName = $JLMS_CONFIG->get('fromname');
        JLoader::import('autoresponder_spu', JPATH_SITE, '');
        $subject = AutoResponder::getSubject();
        $body = AutoResponder::getBody();
        $body = sprintf($body);
        $subject = JMailHelper::cleanSubject($subject);
        $body = JMailHelper::cleanBody($body);
        $from = $SiteName . ' ' . $FromName;
        $sender = JMailHelper::cleanAddress($MailFrom);
        $email = JMailHelper::cleanAddress(JRequest::getVar('x_email', ''));
        $user =& JFactory::getUser();
        $name = explode(' ', $user->name);
        $firstname = isset($name[0]) && $name[0] ? $name[0] : $user->name;
        $body = str_replace('{firstname}', $firstname, $body);
        if (JUtility::sendMail($from, $sender, $email, $subject, $body, true) !== true) {
            JError::raiseNotice(500, JText::_('EMAIL_NOT_SENT'));
        }
    }
}
开发者ID:parkmi,项目名称:dolschool14,代码行数:26,代码来源:authorize_aim.php

示例13: sendNotification

 /**
  * Send email notifications from the message.
  *
  * @param null|string $url
  *
  * @return bool|null
  */
 public function sendNotification($url = null)
 {
     $config = KunenaFactory::getConfig();
     if (!$config->get('send_emails')) {
         return null;
     }
     if ($this->hold > 1) {
         return null;
     } elseif ($this->hold == 1) {
         $mailsubs = 0;
         $mailmods = $config->mailmod >= 0;
         $mailadmins = $config->mailadmin >= 0;
     } else {
         $mailsubs = (bool) $config->allowsubscriptions;
         $mailmods = $config->mailmod >= 1;
         $mailadmins = $config->mailadmin >= 1;
     }
     $once = false;
     if ($mailsubs) {
         if (!$this->parent) {
             // New topic: Send email only to category subscribers
             $mailsubs = $config->category_subscriptions != 'disabled' ? KunenaAccess::CATEGORY_SUBSCRIPTION : 0;
             $once = $config->category_subscriptions == 'topic';
         } elseif ($config->category_subscriptions != 'post') {
             // Existing topic: Send email only to topic subscribers
             $mailsubs = $config->topic_subscriptions != 'disabled' ? KunenaAccess::TOPIC_SUBSCRIPTION : 0;
             $once = $config->topic_subscriptions == 'first';
         } else {
             // Existing topic: Send email to both category and topic subscribers
             $mailsubs = $config->topic_subscriptions == 'disabled' ? KunenaAccess::CATEGORY_SUBSCRIPTION : KunenaAccess::CATEGORY_SUBSCRIPTION | KunenaAccess::TOPIC_SUBSCRIPTION;
             // FIXME: category subscription can override topic
             $once = $config->topic_subscriptions == 'first';
         }
     }
     if (!$url) {
         $url = JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $this->getPermaUrl();
     }
     // Get all subscribers, moderators and admins who should get the email.
     $emailToList = KunenaAccess::getInstance()->getSubscribers($this->catid, $this->thread, $mailsubs, $mailmods, $mailadmins, KunenaUserHelper::getMyself()->userid);
     if ($emailToList) {
         if (!$config->getEmail()) {
             KunenaError::warning(JText::_('COM_KUNENA_EMAIL_DISABLED'));
             return false;
         } elseif (!JMailHelper::isEmailAddress($config->getEmail())) {
             KunenaError::warning(JText::_('COM_KUNENA_EMAIL_INVALID'));
             return false;
         }
         $topic = $this->getTopic();
         // Make a list from all receivers; split the receivers into two distinct groups.
         $sentusers = array();
         $receivers = array(0 => array(), 1 => array());
         foreach ($emailToList as $emailTo) {
             if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
                 continue;
             }
             $receivers[$emailTo->subscription][] = $emailTo->email;
             $sentusers[] = $emailTo->id;
         }
         $mailsender = JMailHelper::cleanAddress($config->board_title);
         $mailsubject = JMailHelper::cleanSubject($config->board_title . ' ' . $topic->subject . " (" . $this->getCategory()->name . ")");
         $subject = $this->subject ? $this->subject : $topic->subject;
         // Create email.
         $mail = JFactory::getMailer();
         $mail->setSubject($mailsubject);
         $mail->setSender(array($config->getEmail(), $mailsender));
         // Send email to all subscribers.
         if (!empty($receivers[1])) {
             $this->attachEmailBody($mail, 1, $subject, $url, $once);
             KunenaEmail::send($mail, $receivers[1]);
         }
         // Send email to all moderators.
         if (!empty($receivers[0])) {
             $this->attachEmailBody($mail, 0, $subject, $url, $once);
             KunenaEmail::send($mail, $receivers[0]);
         }
         // Update subscriptions.
         if ($once && $sentusers) {
             $sentusers = implode(',', $sentusers);
             $db = JFactory::getDbo();
             $query = $db->getQuery(true)->update('#__kunena_user_topics')->set('subscribed=2')->where("topic_id={$this->thread}")->where("user_id IN ({$sentusers})")->where('subscribed=1');
             $db->setQuery($query);
             $db->execute();
             KunenaError::checkDatabaseError();
         }
     }
     return true;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:94,代码来源:message.php

示例14: sendNotification

	public function sendNotification($url=null) {
		$config = KunenaFactory::getConfig();
		if ($this->hold > 1) {
			return;
		} elseif ($this->hold == 1) {
			$mailsubs = 0;
			$mailmods = (bool) $config->mailmod;
			$mailadmins = (bool) $config->mailadmin;
		} else {
			$mailsubs = (bool) $config->allowsubscriptions;
			$mailmods = 0;
			$mailadmins = 0;
		}

		$once = false;
		if ($mailsubs) {
			if (!$this->parent) {
				// New topic: Send email only to category subscribers
				$mailsubs = $config->category_subscriptions != 'disabled' ? 3 : 0;
				$once = $config->category_subscriptions == 'topic';
			} elseif ($config->category_subscriptions != 'post') {
				// Existing topic: Send email only to topic subscribers
				$mailsubs = $config->topic_subscriptions != 'disabled' ? 2 : 0;
				$once = $config->topic_subscriptions == 'first';
			} else {
				// Existing topic: Send email to both category and topic subscribers
				$mailsubs = $config->topic_subscriptions == 'disabled' ? 3 : 1;
				// FIXME: category subcription can override topic
				$once = $config->topic_subscriptions == 'first';
			}
		}

		if (!$url) {
			$url = JURI::root().trim($this->getPermaUrl(null, true), '/');
		}
		//get all subscribers, moderators and admins who will get the email
		$me = KunenaUserHelper::get();
		$acl = KunenaFactory::getAccessControl();
		$emailToList = $acl->getSubscribers($this->catid, $this->thread, $mailsubs, $mailmods, $mailadmins, $me->userid);

		$topic = $this->getTopic();
		if (count ( $emailToList )) {
			jimport('joomla.mail.helper');
			if (! $config->email ) {
				KunenaError::warning ( JText::_ ( 'COM_KUNENA_EMAIL_DISABLED' ) );
				return false;
			} elseif ( ! JMailHelper::isEmailAddress ( $config->email ) ) {
				KunenaError::warning ( JText::_ ( 'COM_KUNENA_EMAIL_INVALID' ) );
				return false;
			}
			// clean up the message for review
			$message = KunenaHtmlParser::plainBBCode ( $this->message );

			$mailsender = JMailHelper::cleanAddress ( $config->board_title );
			$mailsubject = JMailHelper::cleanSubject ( "[" . $config->board_title . "] " . $topic->subject . " (" . $this->getCategory()->name . ")" );
			$subject = $this->subject ? $this->subject : $topic->subject;

			// Make a list from all receivers
			$sentusers = array();
			$receivers = array(0=>array(), 1=>array());
			foreach ( $emailToList as $emailTo ) {
				if (! $emailTo->email || ! JMailHelper::isEmailAddress ( $emailTo->email )) {
					continue;
				}
				$receivers[$emailTo->subscription][] = $emailTo->email;
				$sentusers[] = $emailTo->id;
			}

			// Create email
			$mail = JFactory::getMailer();
			$mail->setSubject($mailsubject);
			$mail->setSender(array($this->_config->email, $mailsender));

			// Send email to all subscribers
			if (!empty($receivers[1])) {
				$mail->setBody($this->createEmailBody(1, $subject, $url, $message, $once));
				$this->sendEmail($mail, $receivers[1]);
			}

			// Send email to all moderators
			if (!empty($receivers[0])) {
				$mail->setBody($this->createEmailBody(0, $subject, $url, $message, $once));
				$this->sendEmail($mail, $receivers[0]);
			}

			// Update subscriptions
			if ($once && $sentusers) {
				$sentusers = implode (',', $sentusers);
				$db = JFactory::getDBO();
				$query = "UPDATE #__kunena_user_topics SET subscribed=2 WHERE topic_id={$this->thread} AND user_id IN ({$sentusers}) AND subscribed=1";
				$db->setQuery ($query);
				$db->query ();
				KunenaError::checkDatabaseError();
			}
		}
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:96,代码来源:message.php

示例15: doemail

 function doemail()
 {
     jimport('joomla.mail.helper');
     jimport('joomla.filesystem.file');
     jimport('joomla.client.helper');
     global $mainframe;
     JClientHelper::setCredentialsFromRequest('ftp');
     $config =& JFactory::getConfig();
     $folder = '';
     $filepaths = array();
     $attached = 0;
     $notattached = 0;
     foreach (JRequest::get('FILES') as $elname => $file) {
         if ($file['name'] != '') {
             if ($folder == '') {
                 $folder = $config->getValue('config.tmp_path') . DS . uniqid('com_fabrik.plg.table.emailtableplus.');
                 if (!JFolder::create($folder)) {
                     JError::raiseWarning(E_NOTICE, JText::_('Could not upload files'));
                     break;
                 }
             }
             $filepath = $folder . DS . JFile::makeSafe($file['name']);
             if (JFile::upload($file['tmp_name'], $filepath)) {
                 $filepaths[count($filepaths)] = $filepath;
                 $attached++;
             } else {
                 JError::raiseWarning(E_NOTICE, JText::sprintf('Could not upload file %s', $file['name']));
             }
         }
     }
     $renderOrder = JRequest::getInt('renderOrder', 0);
     $subject = JMailHelper::cleanSubject(JRequest::getVar('subject'));
     $message = JMailHelper::cleanBody(JRequest::getVar('message'));
     $recordids = explode(',', JRequest::getVar('recordids'));
     $tableModel =& $this->getModel('Table');
     $tableModel->setId(JRequest::getVar('id', 0));
     $formModel =& $tableModel->getForm();
     $this->formModel =& $formModel;
     $params =& $tableModel->getParams();
     $elementModel =& JModel::getInstance('element', 'FabrikModel');
     $field_name = $params->get('emailtableplus_field_name');
     if (is_array($field_name)) {
         $field_name = $field_name[$renderOrder];
     }
     $elementModel->setId($field_name);
     $element =& $elementModel->getElement(true);
     $tonamefield = $elementModel->getFullName(false, true, false);
     $field_email = $params->get('emailtableplus_field_email');
     if (is_array($field_email)) {
         $field_email = $field_email[$renderOrder];
     }
     $elementModel->setId($field_email);
     $element =& $elementModel->getElement(true);
     $tofield = $elementModel->getFullName(false, true, false);
     $fromUser = $params->get('emailtableplus_from_user');
     if (is_array($fromUser)) {
         $fromUser = $fromUser[$renderOrder];
     }
     if ($fromUser[0]) {
         $my =& JFactory::getUser();
         $from = $my->get('email');
         $fromname = $my->get('name');
     } else {
         $config =& JFactory::getConfig();
         $from = $config->getValue('mailfrom');
         $fromname = $config->getValue('fromname');
     }
     $ubcc = $params->get('emailtableplus_use_BCC');
     if (is_array($ubcc)) {
         $ubcc = $ubcc[$renderOrder];
     }
     $useBCC = $ubcc && count($recordids) > 0 && !preg_match('/{[^}]*}/', $subject) && !preg_match('/{[^}]*}/', $message);
     /*
     $include_rowdata = $params->get('emailtableplus_include_rowdata');
     if (is_array($include_rowdata)) {
     	$include_rowdata = $include_rowdata[$renderOrder];
     }
     */
     $sent = 0;
     $notsent = 0;
     if ($useBCC) {
         $bcc = array();
         foreach ($recordids as $id) {
             $row = $tableModel->getRow($id);
             //$message .= $this->_getTextEmail( JArrayHelper::fromObject($row));
             $to = $row->{$tofield};
             $toname = $row->{$tonamefield};
             if (JMailHelper::cleanAddress($to) && JMailHelper::isEmailAddress($to)) {
                 $tofull = '"' . JMailHelper::cleanLine($toname) . '" <' . $to . '>';
                 $bcc[$sent] = $tofull;
                 $sent++;
             } else {
                 $notsent++;
             }
         }
         // $$$ hugh - working round bug in the SMTP mailer method:
         // http://forum.joomla.org/viewtopic.php?f=199&t=530189&p=2190233#p2190233
         // ... which basically means if using the SMTP method, we MUST specify a To addrees,
         // so if mailer is smtp, we'll set the To address to the same as From address
         if ($config->getValue('mailer') == 'smtp') {
//.........这里部分代码省略.........
开发者ID:nikshade,项目名称:fabrik21,代码行数:101,代码来源:emailtableplus.php


注:本文中的JMailHelper::cleanSubject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。