本文整理汇总了PHP中JMailHelper类的典型用法代码示例。如果您正苦于以下问题:PHP JMailHelper类的具体用法?PHP JMailHelper怎么用?PHP JMailHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JMailHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: prepareDisplayedData
/**
*
* Get data
* @param Array $pk
*/
public function prepareDisplayedData($pk)
{
$data = null;
$params = $this->getState('params');
// Get some data from the models
$state = $this->getState();
$items = $this->getItems();
$pagination = $this->getPagination();
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$temp = new JRegistry();
$temp->loadString($item->params);
$item->params = clone $params;
$item->params->merge($temp);
if ($item->params->get('show_email', 0) == 1) {
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
$item->email_to = $item->email_to;
} else {
$item->email_to = '';
}
}
}
$JSNConfig = JSNFactory::getConfig();
$JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact');
$JSNConfig->megreGlobalParams('com_contact', $params, true);
$maxLevel = $params->get('maxLevel', -1);
$data->maxLevel = $maxLevel;
$data->state = $state;
$data->items = $items;
$data->params = $params;
$data->pagination = $pagination;
return $data;
}
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:40,代码来源:featured.php
示例3: Process
public function Process()
{
$uid = $this->Params->get("jmessenger_user", NULL);
// No user selected for Joomla messenger
if (!$uid) {
//JLog::add("No recipient selected in Joomla Messenger dispatcher. Private message was not send.", JLog::INFO, get_class($this));
// It's not a problem. Maybe it's even wanted. Return succesful.
return true;
}
$body = $this->body();
$body .= $this->attachments();
$body .= PHP_EOL;
// Info about url
$body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
// Info about client
$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->insert($db->quoteName("#__messages"));
$query->set($db->quoteName("user_id_from") . "=" . $db->quote($uid));
$query->set($db->quoteName("user_id_to") . "=" . $db->quote($uid));
$query->set($db->quoteName("date_time") . "=" . $db->quote(JFactory::getDate()->toSql()));
$query->set($db->quoteName("subject") . "=" . $db->quote($this->submittername() . " (" . $this->submitteraddress() . ")"));
$query->set($db->quoteName("message") . "=" . $db->quote(JMailHelper::cleanBody($body)));
$db->setQuery((string) $query);
if (!$db->query()) {
//JLog::add($msg, JLog::ERROR, get_class($this));
$this->MessageBoard->Add(JText::_($GLOBALS["COM_NAME"] . "_ERR_SENDING_MESSAGE"), FoxMessageBoard::error);
// Database problems. Return error.
return false;
}
//JLog::add("Private message sent to Joomla messenger.", JLog::INFO, get_class($this));
return true;
}
开发者ID:jehanryan,项目名称:Flotech,代码行数:34,代码来源:fjmessenger.php
示例4: validate_email_list
static function validate_email_list(&$email_list, $allow_blank = true)
{
$email_list = str_replace(' ', '', $email_list);
// remove spaces
$email_list = trim($email_list, ',');
// trim off any spare commas
if ($email_list == '') {
if ($allow_blank) {
$ret = '';
return $ret;
} else {
$ret = JText::_('COM_FLEXICONTACT_REQUIRED');
return $ret;
}
}
$email_list = strtolower($email_list);
// make all lower case for array_unique() call
$email_addresses = explode(',', $email_list);
// make it an array
$email_addresses = array_unique($email_addresses);
// remove any duplicates
$email_list = implode(',', $email_addresses);
// recreate the original email list to return
jimport('joomla.mail.helper');
foreach ($email_addresses as $address) {
if (!JMailHelper::isEmailAddress($address)) {
return '(' . $address . ')';
}
}
return '';
}
开发者ID:vstorm83,项目名称:propertease,代码行数:31,代码来源:flexi_admin_helper.php
示例5: requestReset
/**
* Verifies the validity of a username/e-mail address
* combination and creates a token to verify the request
* was initiated by the account owner. The token is
* sent to the account owner by e-mail
*
* @since 1.5
* @param string Username string
* @param string E-mail address
* @return bool True on success/false on failure
*/
function requestReset($email)
{
jimport('joomla.mail.helper');
jimport('joomla.user.helper');
$db =& JFactory::getDBO();
// Make sure the e-mail address is valid
if (!JMailHelper::isEmailAddress($email)) {
$this->setError(JText::_('INVALID_EMAIL_ADDRESS'));
return false;
}
// Build a query to find the user
$query = 'SELECT id FROM #__users' . ' WHERE email = ' . $db->Quote($email) . ' AND block = 0';
$db->setQuery($query);
// Check the results
if (!($id = $db->loadResult())) {
$this->setError(JText::_('COULD_NOT_FIND_USER'));
return false;
}
// Generate a new token
$token = JUtility::getHash(JUserHelper::genRandomPassword());
$salt = JUserHelper::getSalt('crypt-md5');
$hashedToken = md5($token . $salt) . ':' . $salt;
$query = 'UPDATE #__users' . ' SET activation = ' . $db->Quote($hashedToken) . ' WHERE id = ' . (int) $id . ' AND block = 0';
$db->setQuery($query);
// Save the token
if (!$db->query()) {
$this->setError(JText::_('DATABASE_ERROR'));
return false;
}
// Send the token to the user via e-mail
if (!$this->_sendConfirmationMail($email, $token)) {
return false;
}
return true;
}
开发者ID:Isabella570,项目名称:Hotel-Management-Selena-,代码行数:46,代码来源:reset.php
示例6: validateUser
public function validateUser()
{
try {
$email = JRequest::getVar('email', '', 'post', 'string');
if (!JMailHelper::isEmailAddress($email)) {
throw new Exception(JText::_('COM_AAWS_EMAIL_BAD_FORMAT'));
}
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Se valida unicamente mediante el correo, y se retorna el nombre de usuario para hacer el login
$query->select('id, name, username')->from('#__users')->where('email = ' . $db->Quote($email));
$db->setQuery($query);
$result = $db->loadObject();
if ($result != null && $result->id != 0) {
$answer = array('message' => JText::sprintf('COM_AAWS_USER_IDENTIFIED', $result->name), 'username' => $result->username, 'type' => 'info');
} else {
$answer = array('message' => '', 'type' => 'info');
}
echo json_encode($answer);
} catch (Exception $e) {
echo json_encode(array('message' => $e->getMessage(), 'type' => 'error'));
}
$app = JFactory::getApplication();
$app->close();
}
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:25,代码来源:ajax.php
示例7: remindUsername
/**
* Takes a user supplied e-mail address, looks
* it up in the database to find the username
* and then e-mails the username to the e-mail
* address given.
*
* @since 1.5
* @param string E-mail address
* @return bool True on success/false on failure
*/
function remindUsername($email)
{
jimport('joomla.mail.helper');
global $mainframe;
// Validate the e-mail address
if (!JMailHelper::isEmailAddress($email)) {
$message = JText::_('INVALID_EMAIL_ADDRESS');
$this->setError($message);
UserHelper::showMessage(ERROR, $message);
return false;
}
$db =& JFactory::getDBO();
$db->setQuery('SELECT username FROM #__users WHERE email = ' . $db->Quote($email), 0, 1);
// Get the username
if (!($username = $db->loadResult())) {
$message = JText::_('COULD_NOT_FIND_EMAIL');
$this->setError($message);
UserHelper::showMessage(ERROR, $message);
return false;
}
// Push the email address into the session
$mainframe->setUserState($this->_namespace . 'email', $email);
// Send the reminder email
if (!$this->_sendReminderMail($email, $username)) {
return false;
}
return true;
}
开发者ID:BGCX261,项目名称:zonales-svn-to-git,代码行数:38,代码来源:remind.php
示例8: 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($this->subject());
$body = $this->body();
$body .= $this->attachments($mail);
$body .= PHP_EOL;
// Info about url
$body .= JFactory::getConfig()->get("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
// Info about client
$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
$body = JMailHelper::cleanBody($body);
$mail->setBody($body);
$sent = $this->send($mail);
if ($sent) {
// Notify email send success
$this->MessageBoard->Add($this->Params->get("email_sent_text"), FoxMessageBoard::success);
$this->Logger->Write("Notification email sent.");
}
return $sent;
}
开发者ID:HPReflectoR,项目名称:GlavExpert,代码行数:25,代码来源:fadminmailer.php
示例9: Process
public function Process()
{
$uid = $this->Params->get("jmessenger_user", NULL);
// No user selected for Joomla messenger
if (!$uid) {
//JLog::add("No recipient selected in Joomla Messenger dispatcher. Private message was not send.", JLog::INFO, get_class($this));
// It's not a problem. Maybe it's even wanted. Return succesful.
return true;
}
$body = $this->body();
$body .= $this->attachments();
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->insert("#__messages");
$query->columns(array($db->quoteName('user_id_from'), $db->quoteName('user_id_to'), $db->quoteName('date_time'), $db->quoteName('subject'), $db->quoteName('message')));
$query->values($uid . ", " . $uid . ", " . $db->Quote(JFactory::getDate()->toSql()) . ", " . $db->Quote($this->submittername() . " (" . $this->submitteraddress() . ")") . ', ' . $db->Quote(JMailHelper::cleanBody($body)));
$db->setQuery((string) $query);
if (!$db->query()) {
$msg = JText::_($GLOBALS["COM_NAME"] . "_ERR_SENDING_MESSAGE");
//JLog::add($msg, JLog::ERROR, get_class($this));
$this->Messages[] = $msg;
// Database problems. Return error.
return false;
}
//JLog::add("Private message sent to Joomla messenger.", JLog::INFO, get_class($this));
return true;
}
开发者ID:xenten,项目名称:swift-kanban,代码行数:27,代码来源:fjmessenger.php
示例10: changeEmail
function changeEmail()
{
// Initialise the App variables
$app = JFactory::getApplication();
if ($app->isAdmin()) {
$json = array();
$model = $this->getThisModel();
// Assign the get Id to the Variable
$email_id = $app->input->getString('email');
$new_email = $app->input->getString('new_email');
if (empty($new_email) && !JMailHelper::isEmailAddress($new_email)) {
$json = array('msg' => JText::_('Invalid Email Address'), 'msgType' => 'warning');
} else {
//incase an account already exists ?
if ($app->input->getString('task') == 'changeEmail') {
$json = array('msg' => JText::_('J2STORE_EMAIL_UPDATE_NO_WARNING'), 'msgType' => 'message');
$json = $this->validateEmailexists($new_email);
} elseif ($app->input->getString('task') == 'confirmchangeEmail') {
$json = array('redirect' => JUri::base() . 'index.php?option=com_j2store&view=customer&task=viewOrder&email_id=' . $new_email, 'msg' => JText::_('J2STORE_SUCCESS_SAVING_EMAIL'), 'msgType' => 'message');
if (!$model->savenewEmail()) {
$json = array('msg' => JText::_('J2STORE_ERROR_SAVING_EMAIL'), 'msgType' => 'warning');
}
}
}
echo json_encode($json);
$app->close();
}
}
开发者ID:davetheapple,项目名称:oakencraft,代码行数:28,代码来源:customers.php
示例11: Process
public function Process()
{
$uid = $this->Params->get("jmessenger_user", NULL);
if (!$uid) {
return true;
}
$body = $this->body();
$body .= $this->attachments();
$body .= PHP_EOL;
$body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
$body = nl2br($body);
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->insert($db->quoteName("#__messages"));
$query->set($db->quoteName("user_id_from") . "=" . $db->quote($uid));
$query->set($db->quoteName("user_id_to") . "=" . $db->quote($uid));
$query->set($db->quoteName("date_time") . "=" . $db->quote(JFactory::getDate()->toSql()));
$query->set($db->quoteName("subject") . "=" . $db->quote($this->submittername() . " (" . $this->submitteraddress() . ")"));
$query->set($db->quoteName("message") . "=" . $db->quote(JMailHelper::cleanBody($body)));
$db->setQuery((string) $query);
if (!$db->query()) {
$this->MessageBoard->Add(JText::_($GLOBALS["COM_NAME"] . "_ERR_SENDING_MESSAGE"), B2JMessageBoard::error);
return false;
}
return true;
}
开发者ID:grlf,项目名称:eyedock,代码行数:27,代码来源:b2jjmessenger.php
示例12: 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
示例13: validemail
function validemail($emailid)
{
if (!JMailHelper::isEmailAddress($emailid)) {
return false;
} else {
return true;
}
}
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:8,代码来源:matrimonial.php
示例14: display
/**
* Display the view
*
* @return mixed False on error, null otherwise.
*/
function display($tpl = null)
{
$comName = JRequest::getCmd('option');
$document =& JFactory::getDocument();
$app = JFactory::getApplication();
$params = $app->getParams();
//Check whether category access level allows access.
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
//Load resources
$document->addStyleSheet($this->baseurl . "/media/{$comName}/css/styles.css");
//Get some data from the models
$state = $this->get('State');
$items = $this->get('Items');
$category = $this->get('Category');
$children = $this->get('Children');
$parent = $this->get('Parent');
$pagination = $this->get('Pagination');
//Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
//Prepare the data
//Compute the contact slug
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$temp = new JRegistry();
$temp->loadJSON($item->params);
$item->params = clone $params;
$item->params->merge($temp);
if ($item->params->get('show_email', 0) == 1) {
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
$item->email_to = JHtml::_('email.cloak', $item->email_to);
} else {
$item->email_to = '';
}
}
}
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$maxLevel = $params->get('maxLevel', -1);
$this->assignRef('maxLevel', $maxLevel);
$this->assignRef('state', $state);
$this->assignRef('items', $items);
$this->assignRef('category', $category);
$this->assignRef('children', $children);
$this->assignRef('params', $params);
$this->assignRef('parent', $parent);
$this->assignRef('pagination', $pagination);
//define some few document params
$this->_prepareDocument();
//Display the view
parent::display($tpl);
}
开发者ID:rvsjoen,项目名称:com_generic,代码行数:62,代码来源:view.html.php
示例15: 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
示例16: prepareDisplayedData
/**
*
* Get data
*
* @param Array $pk
*/
public function prepareDisplayedData($pk)
{
$data = null;
jimport('joomla.application.categories');
$this->setState('category.id', $pk['id']);
$params = $this->getState('params');
// Get some data from the models
$state = $this->getState();
$items = $this->getItems();
$category = $this->getCategory();
$children = $this->getChildren();
$parent = $this->getParent();
$pagination = $this->getPagination();
// Check for errors.
if ($category == false) {
echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
}
if ($parent == false) {
echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
}
// Prepare the data.
// Compute the contact slug.
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$temp = new JRegistry();
$temp->loadString($item->params);
$item->params = clone $params;
$item->params->merge($temp);
if ($item->params->get('show_email', 0) == 1) {
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
$item->email_to = JHtml::_('email.cloak', $item->email_to);
} else {
$item->email_to = '';
}
}
}
// Setup the category parameters.
$cparams = $category->getParams();
$category->params = clone $params;
$category->params->merge($cparams);
$JSNConfig = JSNFactory::getConfig();
$JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact');
$JSNConfig->megreGlobalParams('com_contact', $params, true);
$children = array($category->id => $children);
$maxLevel = $params->get('maxLevel', -1);
$data->maxLevel = $maxLevel;
$data->state = $state;
$data->items = $items;
$data->category = $category;
$data->children = $children;
$data->params = $params;
$data->parent = $parent;
$data->pagination = $pagination;
return $data;
}
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:63,代码来源:category.php
示例17: process
/**
* do the plugin action
* @return number of records updated
*/
function process(&$data)
{
$app = JFactory::getApplication();
jimport('joomla.mail.helper');
$params = $this->getParams();
$msg = $params->get('message');
$to = $params->get('to');
$w = new FabrikWorker();
$MailFrom = $app->getCfg('mailfrom');
$FromName = $app->getCfg('fromname');
$subject = $params->get('subject', 'Fabrik cron job');
$eval = $params->get('cronemail-eval');
$condition = $params->get('cronemail_condition', '');
$updates = array();
foreach ($data as $group) {
if (is_array($group)) {
foreach ($group as $row) {
if (!empty($condition)) {
$this_condition = $w->parseMessageForPlaceHolder($condition, $row);
if (eval($this_condition === false)) {
continue;
}
}
$row = JArrayHelper::fromObject($row);
$thisto = $w->parseMessageForPlaceHolder($to, $row);
if (JMailHelper::isEmailAddress($thisto)) {
$thismsg = $w->parseMessageForPlaceHolder($msg, $row);
if ($eval) {
$thismsg = eval($thismsg);
}
$thissubject = $w->parseMessageForPlaceHolder($subject, $row);
$res = JUTility::sendMail( $MailFrom, $FromName, $thisto, $thissubject, $thismsg, true);
}
$updates[] = $row['__pk_val'];
}
}
}
$field = $params->get('cronemail-updatefield');
if (!empty( $updates) && trim($field ) != '') {
//do any update found
$listModel = JModel::getInstance('list', 'FabrikFEModel');
$listModel->setId($params->get('table'));
$table = $listModel->getTable();
$connection = $params->get('connection');
$field = $params->get('cronemail-updatefield');
$value = $params->get('cronemail-updatefield-value');
$field = str_replace("___", ".", $field);
$query = "UPDATE $table->db_table_name set $field = " . $fabrikDb->Quote($value) . " WHERE $table->db_primary_key IN (" . implode(',', $updates) . ")";
$fabrikDb = $listModel->getDb();
$fabrikDb->setQuery($query);
$fabrikDb->query();
}
return count($updates);
}
开发者ID:Jobar87,项目名称:fabrik,代码行数:62,代码来源:email.php
示例18: send
/**
* Sends a new share to a user.
*
* @since 1.0
* @access public
*/
public function send()
{
FD::checkToken();
$token = JRequest::getString('token', '');
$recipients = JRequest::getVar('recipients', array());
$content = JRequest::getVar('content', '');
// Get the current view.
$view = $this->getCurrentView();
// Cleaning
if (is_string($recipients)) {
$recipients = explode(',', FD::string()->escape($recipients));
}
if (is_array($recipients)) {
foreach ($recipients as &$recipient) {
$recipient = FD::string()->escape($recipient);
if (!JMailHelper::isEmailAddress($recipient)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_RECIPIENT'));
}
}
}
$content = FD::string()->escape($content);
// Check for valid data
if (empty($recipients)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_NO_RECIPIENTS'));
}
if (empty($token)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_TOKEN'));
}
$session = JFactory::getSession();
$config = FD::config();
$limit = $config->get('sharing.email.limit', 0);
$now = FD::date()->toUnix();
$time = $session->get('easysocial.sharing.email.time');
$count = $session->get('easysocial.sharing.email.count');
if (is_null($time)) {
$session->set('easysocial.sharing.email.time', $now);
$time = $now;
}
if (is_null($count)) {
$session->set('easysocial.sharing.email.count', 0);
}
$diff = $now - $time;
if ($diff <= 3600) {
if ($limit > 0 && $count >= $limit) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_SHARING_LIMIT_MAXED'));
}
$count++;
$session->set('easysocial.sharing.email.count', $count);
} else {
$session->set('easysocial.sharing.email.time', $now);
$session->set('easysocial.sharing.email.count', 1);
}
$library = FD::get('Sharing');
$library->sendLink($recipients, $token, $content);
$view->call(__FUNCTION__, true);
}
开发者ID:ppantilla,项目名称:bbninja,代码行数:62,代码来源:sharing.php
示例19: validateData
/**
* @see plugins/tienda/payment_paypalpro/library/plgTiendaPayment_Paypalpro_Processor#validateData()
*/
function validateData()
{
/*
* perform initial checks
*/
if (!count($this->_data)) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_NO_DATA_IS_PROVIDED'));
return false;
}
if (!JRequest::checkToken()) {
$this->setError(JText::_('COM_TIENDA_INVALID_TOKEN'));
return false;
}
// if (!$this->getSubscrTypeObj()) {
// $this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_INVALID_ITEM_TYPE'));
// return false;
// }
if (!$this->_getParam('api_username') || !$this->_getParam('api_password') || !$this->_getParam('api_signature')) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_MERCHANT_CREDENTIALS_ARE_INVALID'));
return false;
}
/*
* do form verification to make sure information is both present and valid
*/
// check required fields
foreach ($this->_required as $required_field) {
if (empty($this->_data[$required_field])) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_FILL_IN_REQUIRED_FIELDS'));
return false;
}
}
// check some specific fields
if (JString::strlen($this->_data['state']) != 2) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_STATE_INVALID'));
return false;
}
$user = JFactory::getUser();
if (!$user->id) {
// require email address for guest users
jimport('joomla.mail.helper');
if (empty($this->_data['email']) || !JMailHelper::isEmailAddress($this->_data['email'])) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_EMAIL_ADDRESS_REQUIRED'));
return false;
}
if (TiendaHelperUser::emailExists($this->_data['email'])) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_EMAIL_EXISTS'));
return false;
}
}
if (JString::strlen($this->_data['cardexp_month']) != 2 || JString::strlen($this->_data['cardexp_year']) != 4) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_EXPIRATION_DATE_INVALID='));
return false;
}
return true;
}
开发者ID:annggeel,项目名称:tienda,代码行数:58,代码来源:directpayment.php
示例20: 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;
}
< |
请发表评论