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


PHP JMailHelper::cleanAddress方法代码示例

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


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

示例1: Process

 public function Process()
 {
     // Newsletter component disabled or not found. Aborting.
     if (!$this->enabled) {
         return true;
     }
     $config = acymailing_config();
     // Build subscriber object
     $subscriber = new stdClass();
     // Name field may be absent. AcyMailing will guess the user's name from his email address
     $subscriber->name = isset($this->FieldsBuilder->Fields['sender0']) ? $this->FieldsBuilder->Fields['sender0']['Value'] : "";
     // AcyMailing refuses to save the user (return false) if the email address is empty, so we don't care to check it
     $subscriber->email = empty($this->FieldsBuilder->Fields['sender1']['Value']) ? NULL : JMailHelper::cleanAddress($this->FieldsBuilder->Fields['sender1']['Value']);
     // It seems that $subscriber->confirmed defaults to unconfirmed if unset, so we need to read and pass the actual value from the configuration
     //ADRIEN : not necessary, you should keep the user as unconfirmed, Acy will take care of that
     //$subscriber->confirmed = !(bool)$config->get('require_confirmation');
     $userClass = acymailing_get('class.subscriber');
     $userClass->checkVisitor = false;
     // Add or update the user
     $sub_id = $userClass->save($subscriber);
     if (empty($sub_id)) {
         // User save failed. Probably email address is empty or invalid
         $this->logger->Write(get_class($this) . " Process(): User save failed");
         return true;
     }
     // Lists
     $cumulative = JRequest::getVar("acymailing_subscribe_cumulative", NULL, "POST");
     $checkboxes = array(FAcyMailing::subscribe => JRequest::getVar("acymailing_subscribe", array(), "POST"));
     $lists = $cumulative ? $checkboxes : array();
     // Subscription
     //$listsubClass = acymailing_get('class.listsub');
     //$listsubClass->addSubscription($sub_id, $lists);
     // ADRIEN : we use an other function so Acy will check the subscription and only subscribe the user if he was not already subscribed to that list.
     /*
     $newSubscription = array();
     if(!empty($lists)){
     foreach($lists[FAcyMailing::subscribe] as $listId){
     $newList = array();
     $newList['status'] = FAcyMailing::subscribe;
     $newSubscription[$listId] = $newList;
     }
     $userClass->saveSubscription($sub_id, $newSubscription);
     }
     */
     // When in mode "one checkbox for each list" and no lists selected the code above produce an SQL error because passes an empty array to saveSubscription()
     $newSubscription = array();
     foreach ($lists[FAcyMailing::subscribe] as $listId) {
         $newList = array();
         $newList['status'] = FAcyMailing::subscribe;
         $newSubscription[$listId] = $newList;
     }
     if (!empty($newSubscription)) {
         $userClass->saveSubscription($sub_id, $newSubscription);
     }
     // implode() doesn't accept NULL values :(
     @$lists[FAcyMailing::subscribe] or $lists[FAcyMailing::subscribe] = array();
     // Log
     $this->logger->Write(get_class($this) . " Process(): subscribed " . $this->FieldsBuilder->Fields['sender0']['Value'] . " (" . $this->FieldsBuilder->Fields['sender1']['Value'] . ") to lists " . implode(",", $lists[FAcyMailing::subscribe]));
     return true;
 }
开发者ID:jehanryan,项目名称:Flotech,代码行数:60,代码来源:acymailing.php

示例2: testCleanAddress

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

示例3: submitteraddress

 protected function submitteraddress()
 {
     // Bug: http://www.fox.ra.it/forum/3-bugs/2399-error-when-email-is-optional-and-field-is-left-empty.html
     // $from = isset($this->FieldsBuilder->Fields['sender1']['Value']) ? $this->FieldsBuilder->Fields['sender1']['Value'] : $this->Application->getCfg("mailfrom");
     // If submitter address is present and not empty, we can use it
     // otherwise system global address will be used
     $addr = isset($this->FieldsBuilder->Fields['sender1']['Value']) && !empty($this->FieldsBuilder->Fields['sender1']['Value']) ? $this->FieldsBuilder->Fields['sender1']['Value'] : $this->Application->getCfg("mailfrom");
     return JMailHelper::cleanAddress($addr);
 }
开发者ID:xenten,项目名称:swift-kanban,代码行数:9,代码来源:fdispatcher.php

示例4: Process

 public function Process()
 {
     // Newsletter component disabled or not found. Aborting.
     if (!$this->enabled) {
         return true;
     }
     $config = new jNews_Config();
     // Build subscriber object
     $subscriber = new stdClass();
     // Lists
     $cumulative = $this->JInput->post->get("jnews_subscribe_cumulative", NULL, "int");
     $checkboxes = $this->JInput->post->get("jnews_subscribe", array(), "array");
     $subscriber->list_id = $cumulative ? $checkboxes : array();
     // No lists selected. Skip here to avoid annoying the user with email confirmation. It is useless to confirm a subscription to no lists.
     if (empty($subscriber->list_id)) {
         return true;
     }
     // Name field may be absent. JNews will assign an empty name to the user.
     $subscriber->name = isset($this->FieldsBuilder->Fields['sender0']) ? $this->FieldsBuilder->Fields['sender0']['Value'] : "";
     $subscriber->email = empty($this->FieldsBuilder->Fields['sender1']['Value']) ? NULL : JMailHelper::cleanAddress($this->FieldsBuilder->Fields['sender1']['Value']);
     // JNews saves users with empty email address, so we have to check it
     if (empty($subscriber->email)) {
         $this->logger->Write(get_class($this) . " Process(): Email address empty. User save aborted.");
         return true;
     }
     // It seems that $subscriber->confirmed defaults to unconfirmed if unset, so we need to read and pass the actual value from the configuration
     $subscriber->confirmed = !(bool) $config->get('require_confirmation');
     $subscriber->receive_html = 1;
     // Avoid Notice: Undefined property while JNews libraries access undefined properties
     $subscriber->ip = jNews_Subscribers::getIP();
     $subscriber->subscribe_date = jnews::getNow();
     $subscriber->language_iso = "eng";
     $subscriber->timezone = "00:00:00";
     $subscriber->blacklist = 0;
     $subscriber->user_id = JFactory::getUser()->id;
     // Subscription
     $sub_id = null;
     jNews_Subscribers::saveSubscriber($subscriber, $sub_id, true);
     if (empty($sub_id)) {
         // User save failed. Probably email address is empty or invalid
         $this->logger->Write(get_class($this) . " Process(): User save failed");
         return true;
     }
     // Subscribe $subscriber to $subscriber->list_id
     //$subscriber->id = $sub_id;
     // jNews_ListsSubs::saveToListSubscribers() doesn't work well. When only one list is passed to, it reads the value $listids[0],
     // but the element 0 is not always the first element of the array. In our case is $listids[1]
     //jNews_ListsSubs::saveToListSubscribers($subscriber);
     $this->SaveSubscription($subscriber);
     // Log
     $this->logger->Write(get_class($this) . " Process(): subscribed " . $this->FieldsBuilder->Fields['sender0']['Value'] . " (" . $this->FieldsBuilder->Fields['sender1']['Value'] . ") to lists " . implode(",", $subscriber->list_id));
     return true;
 }
开发者ID:HPReflectoR,项目名称:GlavExpert,代码行数:53,代码来源:jnews.php

示例5: Process

 public function Process()
 {
     // Newsletter component disabled or not found. Aborting.
     if (!$this->enabled) {
         return true;
     }
     //$config = acymailing_config();
     // Lists
     $cumulative = $this->JInput->post->get("acymailing_subscribe_cumulative", NULL, "int");
     $checkboxes = array(FAcyMailing::subscribe => $this->JInput->post->get("acymailing_subscribe", array(), "array"));
     $lists = $cumulative ? $checkboxes : array();
     // When subscription requires confirmation (double opt-in) AcyMailing sends a confirmation request to the user as soon as the user himself is saved. $userClass->save($subscriber)
     // Even in case of no list selected the user will be annoyed with a confirmation email
     // The confirmation status doesn't depend on the lists, which will be passed to AcyMailing only a few lines later. $userClass->saveSubscription($sub_id, $newSubscription)
     if (empty($lists[FAcyMailing::subscribe])) {
         return true;
     }
     // Build subscriber object
     $subscriber = new stdClass();
     // Name field may be absent. AcyMailing will guess the user's name from his email address
     $subscriber->name = isset($this->FieldsBuilder->Fields['sender0']) ? $this->FieldsBuilder->Fields['sender0']['Value'] : "";
     // AcyMailing refuses to save the user (return false) if the email address is empty, so we don't care to check it
     $subscriber->email = empty($this->FieldsBuilder->Fields['sender1']['Value']) ? NULL : JMailHelper::cleanAddress($this->FieldsBuilder->Fields['sender1']['Value']);
     $userClass = acymailing_get('class.subscriber');
     $userClass->checkVisitor = false;
     // Add or update the user
     $sub_id = $userClass->save($subscriber);
     if (empty($sub_id)) {
         // User save failed. Probably email address is empty or invalid
         $this->logger->Write(get_class($this) . " Process(): User save failed");
         return true;
     }
     // When in mode "one checkbox for each list" and no lists selected the code above produce an SQL error because passes an empty array to saveSubscription()
     $newSubscription = array();
     foreach ($lists[FAcyMailing::subscribe] as $listId) {
         $newList = array();
         $newList['status'] = FAcyMailing::subscribe;
         $newSubscription[$listId] = $newList;
     }
     if (!empty($newSubscription)) {
         $userClass->saveSubscription($sub_id, $newSubscription);
     }
     // implode() doesn't accept NULL values :(
     @$lists[FAcyMailing::subscribe] or $lists[FAcyMailing::subscribe] = array();
     // Log
     $this->logger->Write(get_class($this) . " Process(): subscribed " . $this->FieldsBuilder->Fields['sender0']['Value'] . " (" . $this->FieldsBuilder->Fields['sender1']['Value'] . ") to lists " . implode(",", $lists[FAcyMailing::subscribe]));
     return true;
 }
开发者ID:HPReflectoR,项目名称:GlavExpert,代码行数:48,代码来源:acymailing.php

示例6: send

 /**
  * @param  JMail  $mail
  * @param  array  $receivers
  *
  * @return boolean
  */
 public static function send(JMail $mail, array $receivers)
 {
     $config = KunenaFactory::getConfig();
     if (!empty($config->email_recipient_count)) {
         $email_recipient_count = $config->email_recipient_count;
     } else {
         $email_recipient_count = 1;
     }
     $email_recipient_privacy = $config->get('email_recipient_privacy', 'bcc');
     // If we hide email addresses from other users, we need to add TO address to prevent email from becoming spam.
     if ($email_recipient_count > 1 && $email_recipient_privacy == 'bcc' && JMailHelper::isEmailAddress($config->get('email_visible_address'))) {
         $mail->AddAddress($config->email_visible_address, JMailHelper::cleanAddress($config->board_title));
         // Also make sure that email receiver limits are not violated (TO + CC + BCC = limit).
         if ($email_recipient_count > 9) {
             $email_recipient_count--;
         }
     }
     $chunks = array_chunk($receivers, $email_recipient_count);
     $success = true;
     foreach ($chunks as $emails) {
         if ($email_recipient_count == 1 || $email_recipient_privacy == 'to') {
             echo 'TO ';
             $mail->ClearAddresses();
             $mail->addRecipient($emails);
         } elseif ($email_recipient_privacy == 'cc') {
             echo 'CC ';
             $mail->ClearCCs();
             $mail->addCC($emails);
         } else {
             echo 'BCC ';
             $mail->ClearBCCs();
             $mail->addBCC($emails);
         }
         try {
             $mail->Send();
         } catch (Exception $e) {
             $success = false;
             JLog::add($e->getMessage(), JLog::ERROR, 'kunena');
         }
     }
     return $success;
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:48,代码来源:email.php

示例7: _sendOrderConfirmationMail

 /**
  * @param EventgalleryLibraryOrder $order
  *
  * @return mixed|string
  */
 protected function _sendOrderConfirmationMail($order)
 {
     $config = JFactory::getConfig();
     $params = JComponentHelper::getParams('com_eventgallery');
     $sitename = $config->get('sitename');
     $view = $this->getView('Mail', 'html', 'EventgalleryView', array('layout' => 'confirm'));
     $view->set('order', $order);
     $view->set('params', $params);
     $body = $view->loadTemplate();
     $mailer = JFactory::getMailer();
     $config = JFactory::getConfig();
     $subject = JText::sprintf('COM_EVENTGALLERY_CART_CHECKOUT_ORDER_MAIL_CONFIRMATION_SUBJECT', $order->getBillingAddress()->getFirstName() . ' ' . $order->getBillingAddress()->getLastName(), $order->getLineItemsTotalCount(), $order->getLineItemsCount());
     $mailer->setSubject("{$sitename} - " . $subject);
     $mailer->isHTML(true);
     $mailer->Encoding = 'base64';
     $mailer->setBody($body);
     // Customer Mail
     $sender = array($config->get('mailfrom'), $config->get('fromname'));
     $mailer->setSender($sender);
     $mailer->addRecipient($order->getEMail(), $order->getBillingAddress()->getFirstName() . ' ' . $order->getBillingAddress()->getLastName());
     $send = $mailer->Send();
     if ($send !== true) {
         return $mailer->ErrorInfo;
     }
     // Admin Mail
     $mailer->ClearAllRecipients();
     $sender = array($order->getEMail(), $order->getBillingAddress()->getFirstName() . ' ' . $order->getBillingAddress()->getLastName());
     $mailer->setSender($sender);
     $userids = JAccess::getUsersByGroup($params->get('admin_usergroup'));
     foreach ($userids as $userid) {
         $user = JUser::getInstance($userid);
         if ($user->sendEmail == 1) {
             $mailadresses = JMailHelper::cleanAddress($user->email);
             $mailer->addRecipient($mailadresses);
         }
     }
     $send = $mailer->Send();
     if ($send !== true) {
         return $mailer->ErrorInfo;
     }
     return $send;
 }
开发者ID:sansandeep143,项目名称:av,代码行数:47,代码来源:Checkout.php

示例8: submitteraddress

 protected function submitteraddress()
 {
     $addr = isset($this->FieldsBuilder->senderEmail->b2jFieldValue) && !empty($this->FieldsBuilder->senderEmail->b2jFieldValue) ? $this->FieldsBuilder->senderEmail->b2jFieldValue : $this->Application->getCfg("mailfrom");
     return JMailHelper::cleanAddress($addr);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:5,代码来源:b2jdispatcher.php

示例9: sendReply

 function sendReply()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // read the data from the form
     $postData = JRequest::get('post');
     $postData = $this->securityCheck($postData);
     // clear body and subject
     jimport('joomla.mail.helper');
     // make sure the data is valid
     $isOk = true;
     if (!JMailHelper::isEmailAddress($postData['reply_email_address'])) {
         $this->_app->_session->set('isOK:' . $this->_sTask, false);
         $this->_app->_session->set('errorMsg:' . $this->_sTask, JText::_('COM_AICONTACTSAFE_PLEASE_ENTER_A_VALID_EMAIL_ADDRESS'));
     } else {
         if (strlen(trim($postData['reply_subject'])) == 0) {
             $this->_app->_session->set('isOK:' . $this->_sTask, false);
             $this->_app->_session->set('errorMsg:' . $this->_sTask, JText::_('COM_AICONTACTSAFE_PLEASE_SPECIFY_A_SUBJECT'));
         } else {
             if (strlen(trim($postData['reply_message'])) == 0) {
                 $this->_app->_session->set('isOK:' . $this->_sTask, false);
                 $this->_app->_session->set('errorMsg:' . $this->_sTask, JText::_('COM_AICONTACTSAFE_PLEASE_SPECIFY_A_MESSAGE'));
             }
         }
     }
     $isOk = $this->_app->_session->get('isOK:' . $this->_sTask);
     if ($isOk) {
         $from = $this->_app->getCfg('mailfrom');
         $fromname = $this->_app->getCfg('fromname');
         $email_recipient = JMailHelper::cleanAddress($postData['reply_email_address']);
         $subject = JMailHelper::cleanSubject($postData['reply_subject']);
         if (array_key_exists('send_plain_text', $postData) && $postData['send_plain_text']) {
             $mode = false;
             $body = JMailHelper::cleanBody($postData['reply_message']);
         } else {
             $mode = true;
             $body = JMailHelper::cleanBody(str_replace("\n", '<br />', $postData['reply_message']));
         }
         $cc = null;
         $bcc = null;
         $replyto = $from;
         $replytoname = $fromname;
         $file_attachments = null;
         $isOK = JUtility::sendMail($from, $fromname, $email_recipient, $subject, $body, $mode, $cc, $bcc, $file_attachments, $replyto, $replytoname);
     }
     if ($isOk) {
         // initialize the database
         $db = JFactory::getDBO();
         // update the reply
         $query = 'UPDATE #__aicontactsafe_messages SET email_reply = \'' . $this->replace_specialchars($email_recipient) . '\', subject_reply = \'' . $this->replace_specialchars($subject) . '\' , message_reply = \'' . $this->replace_specialchars($body) . '\' WHERE id = ' . (int) $postData['id'];
         $db->setQuery($query);
         $db->query();
         // modify the status of the message accordingly
         $this->changeStatusToReplied((int) $postData['id']);
     }
     return $isOk;
 }
开发者ID:pawelos076232,项目名称:com_aicontactsafe_j30_unofficial,代码行数:57,代码来源:messages.php

示例10: set_to

 private function set_to(&$mail)
 {
     //$addr = $this->FieldsBuilder->Fields['sender1']['Value'];
     $addr = $this->FieldsBuilder->senderEmail->b2jFieldValue;
     $mail->addRecipient(JMailHelper::cleanAddress($addr));
 }
开发者ID:grlf,项目名称:eyedock,代码行数:6,代码来源:b2jsubmittermailer.php

示例11: sendEmail

 protected function sendEmail($mail, $receivers)
 {
     if (empty($receivers)) {
         return;
     }
     $email_recipient_count = !empty($this->_config->email_recipient_count) ? $this->_config->email_recipient_count : 1;
     $email_recipient_privacy = !empty($this->_config->email_recipient_privacy) ? $this->_config->email_recipient_privacy : 'bcc';
     // If we hide email addresses from other users, we need to add TO address to prevent email from becoming spam
     if ($email_recipient_count > 1 && $email_recipient_privacy == 'bcc' && !empty($this->_config->email_visible_address) && JMailHelper::isEmailAddress($this->_config->email_visible_address)) {
         $mail->AddAddress($this->_config->email_visible_address, JMailHelper::cleanAddress($this->_config->board_title));
         // Also make sure that email receiver limits are not violated (TO + CC + BCC = limit)
         if ($email_recipient_count > 9) {
             $email_recipient_count--;
         }
     }
     $chunks = array_chunk($receivers, $email_recipient_count);
     foreach ($chunks as $emails) {
         if ($email_recipient_count == 1 || $email_recipient_privacy == 'to') {
             $mail->ClearAddresses();
             $mail->addRecipient($emails);
         } elseif ($email_recipient_privacy == 'cc') {
             $mail->ClearCCs();
             $mail->addCC($emails);
         } else {
             $mail->ClearBCCs();
             $mail->addBCC($emails);
         }
         $mail->Send();
     }
 }
开发者ID:redigy,项目名称:Kunena-1.6,代码行数:30,代码来源:kunena.posting.class.php

示例12: 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

示例13: _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

示例14: process

 /**
  * Do the plug-in action
  *
  * @param   object  $params  plugin parameters
  * @param   object  &$model  list model
  * @param   array   $opts    custom options
  *
  * @return  bool
  */
 public function process($params, &$model, $opts = array())
 {
     $db = $model->getDb();
     $user = JFactory::getUser();
     $update = json_decode($params->get('update_col_updates'));
     if (!$update) {
         return false;
     }
     // $$$ rob moved here from bottom of func see http://fabrikar.com/forums/showthread.php?t=15920&page=7
     $dateCol = $params->get('update_date_element');
     $userCol = $params->get('update_user_element');
     $item = $model->getTable();
     // Array_unique for left joined table data
     $ids = array_unique(JRequest::getVar('ids', array(), 'method', 'array'));
     JArrayHelper::toInteger($ids);
     $this->_row_count = count($ids);
     $ids = implode(',', $ids);
     $model->reset();
     $model->_pluginQueryWhere[] = $item->db_primary_key . ' IN ( ' . $ids . ')';
     $data = $model->getData();
     // $$$servantek reordered the update process in case the email routine wants to kill the updates
     $emailColID = $params->get('update_email_element', '');
     if (!empty($emailColID)) {
         $w = new FabrikWorker();
         jimport('joomla.mail.helper');
         $message = $params->get('update_email_msg');
         $subject = $params->get('update_email_subject');
         $eval = $params->get('eval', 0);
         $config = JFactory::getConfig();
         $from = $config->getValue('mailfrom');
         $fromname = $config->getValue('fromname');
         $elementModel = FabrikWorker::getPluginManager()->getElementPlugin($emailColID);
         $emailElement = $elementModel->getElement(true);
         $emailField = $elementModel->getFullName(false, true, false);
         $emailColumn = $elementModel->getFullName(false, false, false);
         $emailFieldRaw = $emailField . '_raw';
         $emailWhich = $emailElement->plugin == 'user' ? 'user' : 'field';
         $tbl = array_shift(explode('.', $emailColumn));
         $db = JFactory::getDBO();
         $aids = explode(',', $ids);
         // If using a user element, build a lookup list of emails from #__users,
         // so we're only doing one query to grab all involved emails.
         if ($emailWhich == 'user') {
             $userids_emails = array();
             $query = $db->getQuery();
             $query->select('#__users.id AS id, #__users.email AS email')->from('#__users')->join('LEFT', $tbl . ' ON #__users.id = ' . $emailColumn)->where(_primary_key . ' IN (' . $ids . ')');
             $db->setQuery($query);
             $results = $db->loadObjectList();
             foreach ($results as $result) {
                 $userids_emails[(int) $result->id] = $result->email;
             }
         }
         foreach ($aids as $id) {
             $row = $model->getRow($id);
             if ($emailWhich == 'user') {
                 $userid = (int) $row->{$emailFieldRaw};
                 $to = JArrayHelper::getValue($userids_emails, $userid);
             } else {
                 $to = $row->{$emailField};
             }
             if (JMailHelper::cleanAddress($to) && JMailHelper::isEmailAddress($to)) {
                 // $tofull = '"' . JMailHelper::cleanLine($toname) . '" <' . $to . '>';
                 // $$$servantek added an eval option and rearranged placeholder call
                 $thissubject = $w->parseMessageForPlaceholder($subject, $row);
                 $thismessage = $w->parseMessageForPlaceholder($message, $row);
                 if ($eval) {
                     $thismessage = @eval($thismessage);
                     FabrikWorker::logEval($thismessage, 'Caught exception on eval in updatecol::process() : %s');
                 }
                 $res = JUtility::sendMail($from, $fromname, $to, $thissubject, $thismessage, true);
                 if ($res) {
                     $this->_sent++;
                 } else {
                     ${$this}->_notsent++;
                 }
             } else {
                 $this->_notsent++;
             }
         }
     }
     // $$$servantek reordered the update process in case the email routine wants to kill the updates
     if (!empty($dateCol)) {
         $date = JFactory::getDate();
         $this->_process($model, $dateCol, $date->toSql());
     }
     if (!empty($userCol)) {
         $this->_process($model, $userCol, (int) $user->get('id'));
     }
     foreach ($update->coltoupdate as $i => $col) {
         $this->_process($model, $col, $update->update_value[$i]);
     }
//.........这里部分代码省略.........
开发者ID:rogeriocc,项目名称:fabrik,代码行数:101,代码来源:update_col.php

示例15: download


//.........这里部分代码省略.........
                    }
                }
                // Send to item owner
                $send_to_current_item_owner = $fields_conf[$field_id]->get('send_to_current_item_owner');
                if ($send_to_current_item_owner) {
                    $email_recipients[$file->item_owner_email][] = $file;
                }
                // Send to email assigned to email field in same content item
                $send_to_email_field = (int) $fields_conf[$field_id]->get('send_to_email_field');
                if ($send_to_email_field) {
                    $q = 'SELECT value ' . ' FROM #__flexicontent_fields_item_relations ' . ' WHERE field_id = ' . $send_to_email_field . ' AND item_id=' . $content_id;
                    $db->setQuery($q);
                    $email_values = $db->loadColumn();
                    foreach ($email_values as $i => $email_value) {
                        if (@unserialize($email_value) !== false || $email_value === 'b:0;') {
                            $email_values[$i] = unserialize($email_value);
                        } else {
                            $email_values[$i] = array('addr' => $email_value, 'text' => '');
                        }
                        $addr = @$email_values[$i]['addr'];
                        if ($addr) {
                            $email_recipients[$addr][] = $file;
                        }
                    }
                }
            }
        }
        //echo "<pre>". print_r($valid_files, true) ."</pre>";
        //echo "<pre>". print_r($email_recipients, true) ."</pre>";
        //sjexit();
        if (!empty($email_recipients)) {
            ob_start();
            $sendermail = $app->getCfg('mailfrom');
            $sendermail = JMailHelper::cleanAddress($sendermail);
            $sendername = $app->getCfg('sitename');
            $subject = JText::_('FLEXI_FDN_FILE_DOWNLOAD_REPORT');
            $message_header = JText::_('FLEXI_FDN_FILE_DOWNLOAD_REPORT_BY') . ': ' . $user->name . ' [' . $user->username . ']';
            // ****************************************************
            // Send email notifications about file being downloaded
            // ****************************************************
            // Personalized email per subscribers
            foreach ($email_recipients as $email_addr => $files_arr) {
                $to = JMailHelper::cleanAddress($email_addr);
                $_message = $message_header;
                foreach ($files_arr as $filedata) {
                    $_mssg_file = $filedata->notification_tmpl;
                    $_mssg_file = str_ireplace('__file_id__', $filedata->id, $_mssg_file);
                    $_mssg_file = str_ireplace('__file_title__', $filedata->__file_title__, $_mssg_file);
                    $_mssg_file = str_ireplace('__item_title__', $filedata->item_title, $_mssg_file);
                    //$_mssg_file = str_ireplace('__item_title_linked__', $filedata->password, $_mssg_file);
                    $_mssg_file = str_ireplace('__item_url__', $filedata->__item_url__, $_mssg_file);
                    $count = 0;
                    $_mssg_file = str_ireplace('__file_hits__', $filedata->hits, $_mssg_file, $count);
                    if ($count == 0) {
                        $_mssg_file = JText::_('FLEXI_HITS') . ": " . $file->hits . "\n" . $_mssg_file;
                    }
                    $_message .= "\n\n" . $_mssg_file;
                }
                //echo "<pre>". $_message ."</pre>";
                $from = $sendermail;
                $fromname = $sendername;
                $recipient = array($to);
                $html_mode = false;
                $cc = null;
                $bcc = null;
                $attachment = null;
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:67,代码来源:controller.php


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