コード例 #1
1
	/**
	 * Send the Recommend to a friend email.
	 *
	 * @author Kohl Patrick,
	 */
	public function mailRecommend () {

		JRequest::checkToken () or jexit ('Invalid Token');
		// Display it all
		$view = $this->getView ('recommend', 'html');

		if(!VmConfig::get('show_emailfriend',false)){
			$view->display ();
		}
		if (!class_exists ('shopFunctionsF')) {
			require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
		}
		if(!class_exists('ShopFunctions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'shopfunctions.php');

		$mainframe = JFactory::getApplication ();
		$vars = array();

		$virtuemart_product_idArray = JRequest::getInt ('virtuemart_product_id', 0);
		if (is_array ($virtuemart_product_idArray)) {
			$virtuemart_product_id = (int)$virtuemart_product_idArray[0];
		} else {
			$virtuemart_product_id = (int)$virtuemart_product_idArray;
		}
		$productModel = VmModel::getModel ('product');

		$vars['product'] = $productModel->getProduct ($virtuemart_product_id);

		$user = JFactory::getUser ();
		$vars['user'] = array('name' => $user->name, 'email' =>  $user->email);

		$vars['vendorEmail'] = $user->email;
		$vendorModel = VmModel::getModel ('vendor');
		$vendor = $vendorModel->getVendor ($vars['product']->virtuemart_vendor_id);
		$vendorModel->addImages ($vars['vendor']);
		$vendor->vendorFields = $vendorModel->getVendorAddressFields();
		$vars['vendor'] = $vendor;
		$vars['vendorAddress']= shopFunctions::renderVendorAddress($vars['product']->virtuemart_vendor_id);

		$vars['vendorEmail']=  $user->email;
		$vars['vendor']->vendor_name =$user->name;


		$toMail = JRequest::getVar ('email'); //is sanitized then
		$toMail = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $toMail);

		if (shopFunctionsF::renderMail ('recommend', $toMail, $vars, 'productdetails', TRUE)) {
			$string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
		} else {
			$string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
		}
		$mainframe->enqueueMessage (JText::_ ($string));

// 		vmdebug('my email vars ',$vars,$TOMail);


		$view->setLayout ('mail_confirmed');
		$view->display ();
	}
コード例 #2
0
ファイル: waitinglist.php プロジェクト: joselapria/virtuemart
 /**
  * Notify customers product is back in stock
  * @author RolandD
  * @author Christopher Rouseel
  * @todo Add Itemid &Itemid='.$sess->getShopItemid()
  * @todo Do something if the mail cannot be send
  * @todo Update mail from
  * @todo Get the from name/email from the vendor
  */
 public function notifyList($virtuemart_product_id)
 {
     if (!$virtuemart_product_id) {
         return false;
     }
     //sanitize id
     $virtuemart_product_id = (int) $virtuemart_product_id;
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $vars = array();
     $db = JFactory::getDBO();
     $q = "SELECT * FROM #__virtuemart_waitingusers ";
     $q .= "WHERE notified = '0' AND virtuemart_product_id = " . $virtuemart_product_id;
     $db->setQuery($q);
     $waiting_users = $db->loadObjectList();
     /* Load the product details */
     $q = "SELECT product_name FROM `#__virtuemart_products_" . VMLANG . "` WHERE virtuemart_product_id = " . $virtuemart_product_id;
     $db->setQuery($q);
     $vars['productName'] = $db->loadResult();
     /*TODO old URL here Now get the url information */
     $vars['url'] = JURI::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $virtuemart_product_id;
     foreach ($waiting_users as $key => $waiting_user) {
         $vars['user'] = $waiting_user;
         if (shopFunctionsF::renderMail('productdetails', $waiting_user->notify_email, $vars)) {
             $db->setQuery('UPDATE #__virtuemart_waitingusers SET notified=1 WHERE virtuemart_waitinguser_id=' . $waiting_user->virtuemart_waitinguser_id);
             $db->query();
         }
     }
     return true;
 }
コード例 #3
0
ファイル: vendor.php プロジェクト: cuongnd/etravelservice
 /**
  * Send the ask question email.
  * @author Kohl Patrick, Christopher Roussel
  */
 public function mailAskquestion()
 {
     vRequest::vmCheckToken();
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $model = tmsModel::getModel('vendor');
     $mainframe = JFactory::getApplication();
     $vars = array();
     $min = tsmConfig::get('asks_minimum_comment_length', 50) + 1;
     $max = tsmConfig::get('asks_maximum_comment_length', 2000) - 1;
     $commentSize = vRequest::getString('comment');
     if (function_exists('mb_strlen')) {
         $commentSize = mb_strlen($commentSize);
     } else {
         $commentSize = strlen($commentSize);
     }
     $validMail = filter_var(vRequest::getVar('email'), FILTER_VALIDATE_EMAIL);
     $virtuemart_vendor_id = vRequest::getInt('virtuemart_vendor_id', 1);
     if (!class_exists('VirtueMartModelVendor')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
     }
     $userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id);
     //$vendorUser = JFactory::getUser($userId);
     if ($commentSize < $min || $commentSize > $max || !$validMail) {
         $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=vendor&task=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE), tsmText::_('COM_VIRTUEMART_COMMENT_NOT_VALID_JS'));
         return;
     }
     $user = JFactory::getUser();
     $fromMail = vRequest::getVar('email');
     //is sanitized then
     $fromName = vRequest::getVar('name', '');
     //is sanitized then
     $fromMail = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromMail);
     $fromName = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromName);
     if (!empty($user->id)) {
         if (empty($fromMail)) {
             $fromMail = $user->email;
         }
         if (empty($fromName)) {
             $fromName = $user->name;
         }
     }
     $vars['user'] = array('name' => $fromName, 'email' => $fromMail);
     $VendorEmail = $model->getVendorEmail($virtuemart_vendor_id);
     $vars['vendor'] = array('vendor_store_name' => $fromName);
     if (shopFunctionsF::renderMail('vendor', $VendorEmail, $vars, 'vendor')) {
         $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
     } else {
         $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
     }
     $mainframe->enqueueMessage(tsmText::_($string));
     // Display it all
     $view = $this->getView('vendor', 'html');
     $view->setLayout('mail_confirmed');
     $view->display();
 }
コード例 #4
0
ファイル: waitinglist.php プロジェクト: Gskflute/joomla25
 /**
  * Notify customers product is back in stock
  *
  * @author RolandD
  * @author Christopher Rouseel
  * @todo Add Itemid
  * @todo Do something if the mail cannot be send
  * @todo Update mail from
  * @todo Get the from name/email from the vendor
  */
 public function notifyList($virtuemart_product_id, $subject = '', $mailbody = '', $max_number = 0)
 {
     if (!$virtuemart_product_id) {
         return FALSE;
     }
     //sanitize id
     $virtuemart_product_id = (int) $virtuemart_product_id;
     $max_number = (int) $max_number;
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $vars = array();
     $waitinglistModel = VmModel::getModel('waitinglist');
     $waiting_users = $waitinglistModel->getWaitingusers($virtuemart_product_id);
     /* Load the product details */
     $db = JFactory::getDbo();
     $q = "SELECT l.product_name,product_in_stock FROM `#__virtuemart_products_" . VMLANG . "` l\r\n\t\t\t\tJOIN `#__virtuemart_products` p ON p.virtuemart_product_id=l.virtuemart_product_id\r\n\t\t\t   WHERE p.virtuemart_product_id = " . $virtuemart_product_id;
     $db->setQuery($q);
     $item = $db->loadObject();
     $vars['productName'] = $item->product_name;
     /*
     if ($item->product_in_stock <= 0) {
     	return FALSE;
     }
     */
     $url = JURI::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $virtuemart_product_id;
     $vars['link'] = '<a href="' . $url . '">' . $item->product_name . '</a>';
     if (empty($subject)) {
         $subject = JText::sprintf('COM_VIRTUEMART_PRODUCT_WAITING_LIST_EMAIL_SUBJECT', $item->product_name);
     }
     $vars['subject'] = $subject;
     $vars['mailbody'] = $mailbody;
     $virtuemart_vendor_id = 1;
     $vendorModel = VmModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $vendorModel->addImages($vendor);
     $vars['vendor'] = $vendor;
     $vars['vendorAddress'] = shopFunctions::renderVendorAddress($virtuemart_vendor_id);
     $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id);
     $vars['vendorEmail'] = $vendorEmail;
     $i = 0;
     foreach ($waiting_users as $waiting_user) {
         $vars['user'] = $waiting_user->name;
         if (shopFunctionsF::renderMail('productdetails', $waiting_user->notify_email, $vars, 'productdetails')) {
             $db->setQuery('UPDATE #__virtuemart_waitingusers SET notified=1 WHERE virtuemart_waitinguser_id=' . $waiting_user->virtuemart_waitinguser_id);
             $db->query();
             $i++;
         }
         if (!empty($max_number) && $i >= $max_number) {
             break;
         }
     }
     return TRUE;
 }
コード例 #5
0
ファイル: user.php プロジェクト: lenard112/cms
 /**
  * This uses the shopFunctionsF::renderAndSendVmMail function, which uses a controller and task to render the content
  * and sents it then.
  *
  *
  * @author Oscar van Eijk
  * @author Max Milbers
  * @author Christopher Roussel
  * @author Valérie Isaksen
  */
 private function sendRegistrationEmail($user, $password, $doUserActivation)
 {
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $vars = array('user' => $user);
     // Send registration confirmation mail
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     $vars['password'] = $password;
     if ($doUserActivation) {
         jimport('joomla.user.helper');
         $activationLink = 'index.php?option=com_users&task=registration.activate&token=' . $user->get('activation');
         $vars['activationLink'] = $activationLink;
     }
     $vars['doVendor'] = true;
     // public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = null)
     shopFunctionsF::renderMail('user', $user->get('email'), $vars);
     //get all super administrator
     //if(!defined('JVM_VERSION') or JVM_VERSION < 3){
     $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail = 1';
     /*} else {
     			$query = 'SELECT `name`, `email`, `sendEmail` ' .
     				' FROM #__users as us '.
     				' INNER JOIN #__user_usergroup_map as um ON us.id = um.user_id ' .
     				' INNER JOIN #__usergroups as ug ON um.group_id = ug.id ' .
     				' WHERE ug.id = "8" ';
     		}*/
     $db = JFactory::getDBO();
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $vars['doVendor'] = false;
     // get superadministrators id
     foreach ($rows as $row) {
         if ($row->sendEmail) {
             //$message2 = sprintf ( vmText::_( 'COM_VIRTUEMART_SEND_MSG_ADMIN' ), $row->name, $sitename, $name, $email, $username);
             //$message2 = html_entity_decode($message2, ENT_QUOTES);
             //JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
             //shopFunctionsF::renderMail('user', $row->email, $vars);
         }
     }
 }
コード例 #6
0
ファイル: orders.php プロジェクト: alesconti/FF_2015
 /**
  * Notifies the customer that the Order Status has been changed
  *
  * @author RolandD, Christopher Roussel, Valérie Isaksen, Max Milbers
  *
  */
 private function notifyCustomer($virtuemart_order_id, $newOrderData = 0)
 {
     // 		vmdebug('notifyCustomer', $newOrderData);
     if (isset($newOrderData['customer_notified']) && $newOrderData['customer_notified'] == 0) {
         return true;
     }
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     //Important, the data of the order update mails, payments and invoice should
     //always be in the database, so using getOrder is the right method
     $orderModel = VmModel::getModel('orders');
     $order = $orderModel->getOrder($virtuemart_order_id);
     $payment_name = $shipment_name = '';
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     JPluginHelper::importPlugin('vmshipment');
     JPluginHelper::importPlugin('vmpayment');
     $dispatcher = JDispatcher::getInstance();
     $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_shipmentmethod_id, &$shipment_name));
     $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_paymentmethod_id, &$payment_name));
     $order['shipmentName'] = $shipment_name;
     $order['paymentName'] = $payment_name;
     if ($newOrderData != 0) {
         //We do not really need that
         $vars['newOrderData'] = (array) $newOrderData;
     }
     $vars['orderDetails'] = $order;
     //$vars['includeComments'] = JRequest::getVar('customer_notified', array());
     //I think this is misleading, I think it should always ask for example $vars['newOrderData']['doVendor'] directly
     //Using this function garantue us that it is always there. If the vendor should be informed should be done by the plugins
     //We may add later something to the method, defining this better
     $vars['url'] = 'url';
     if (!isset($vars['doVendor'])) {
         if (!isset($newOrderData['doVendor'])) {
             $vars['doVendor'] = false;
         } else {
             $vars['doVendor'] = $newOrderData['doVendor'];
         }
     }
     $virtuemart_vendor_id = 1;
     $vendorModel = VmModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $vars['vendor'] = $vendor;
     $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id);
     $vars['vendorEmail'] = $vendorEmail;
     /*
     		$path = VmConfig::get('forSale_path',0);
     		$orderstatusForInvoice = VmConfig::get('inv_os','C');
     		$pdfInvoice = VmConfig::get('pdf_invoice', 1); // backwards compatible
     */
     // florian : added if pdf invoice are enabled
     //if  ($this->getInvoiceNumber( $order['details']['BT']->virtuemart_order_id ) ){
     $invoiceNumberDate = array();
     if ($orderModel->createInvoiceNumber($order['details']['BT'], $invoiceNumberDate)) {
         $orderstatusForInvoice = VmConfig::get('inv_os', array());
         if (!is_array($orderstatusForInvoice)) {
             $orderstatusForInvoice = array($orderstatusForInvoice);
         }
         // for backward compatibility 2.0.8e
         $pdfInvoice = (int) VmConfig::get('pdf_invoice', 0);
         // backwards compatible
         $force_create_invoice = JRequest::getInt('create_invoice', 0);
         //TODO we need an array of orderstatus
         if (in_array($order['details']['BT']->order_status, $orderstatusForInvoice) or $pdfInvoice == 1 or $force_create_invoice == 1) {
             if (!shopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) {
                 if (!class_exists('VirtueMartControllerInvoice')) {
                     require_once JPATH_VM_SITE . DS . 'controllers' . DS . 'invoice.php';
                 }
                 $controller = new VirtueMartControllerInvoice(array('model_path' => JPATH_VM_SITE . DS . 'models', 'view_path' => JPATH_VM_SITE . DS . 'views'));
                 $vars['mediaToSend'][] = $controller->checkStoreInvoice($order);
             }
         }
     }
     // Send the email
     if (shopFunctionsF::renderMail('invoice', $order['details']['BT']->email, $vars, null, $vars['doVendor'])) {
         $string = 'COM_VIRTUEMART_NOTIFY_CUSTOMER_SEND_MSG';
     } else {
         $string = 'COM_VIRTUEMART_NOTIFY_CUSTOMER_ERR_SEND';
     }
     vmInfo(JText::_($string, false) . ' ' . $order['details']['BT']->first_name . ' ' . $order['details']['BT']->last_name . ', ' . $order['details']['BT']->email);
     return true;
 }
コード例 #7
0
ファイル: user.php プロジェクト: cuongnd/etravelservice
 /**
  * This uses the shopFunctionsF::renderAndSendVmMail function, which uses a controller and task to render the content
  * and sents it then.
  *
  *
  * @author Oscar van Eijk
  * @author Max Milbers
  * @author Christopher Roussel
  * @author Valérie Isaksen
  */
 private function sendRegistrationEmail($user, $password, $doUserActivation)
 {
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $vars = array('user' => $user);
     // Send registration confirmation mail
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     $vars['password'] = $password;
     if ($doUserActivation) {
         jimport('joomla.user.helper');
         $activationLink = 'index.php?option=com_users&task=registration.activate&token=' . $user->get('activation');
         $vars['activationLink'] = $activationLink;
     }
     $vars['doVendor'] = true;
     // public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = null)
     shopFunctionsF::renderMail('user', $user->get('email'), $vars);
 }
コード例 #8
0
 /**
  * Send the Recommend to a friend email.
  *
  * @author Kohl Patrick
  * @author Max Milbers
  */
 public function mailRecommend()
 {
     JSession::checkToken() or jexit('Invalid Token');
     $app = JFactory::getApplication();
     if (!VmConfig::get('show_emailfriend', false)) {
         $app->redirect(JRoute::_('index.php?option=com_virtuemart&tmpl=component&view=productdetails&task=askquestion&virtuemart_product_id=' . vRequest::getInt('virtuemart_product_id', 0)), 'Function disabled');
     }
     if (JFactory::getUser()->guest == 1 and VmConfig::get('ask_captcha')) {
         $recaptcha = vRequest::getVar('recaptcha_response_field');
         JPluginHelper::importPlugin('captcha');
         $dispatcher = JDispatcher::getInstance();
         $res = $dispatcher->trigger('onCheckAnswer', $recaptcha);
         $session = JFactory::getSession();
         if (!$res[0]) {
             $mailrecommend = array('email' => vRequest::getVar('email'), 'comment' => vRequest::getString('comment'));
             $session->set('mailrecommend', $mailrecommend, 'vm');
             $errmsg = vmText::_('PLG_RECAPTCHA_ERROR_INCORRECT_CAPTCHA_SOL');
             $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&tmpl=component&view=productdetails&task=recommend&virtuemart_product_id=' . vRequest::getInt('virtuemart_product_id', 0)), $errmsg);
             return;
         } else {
             $session->set('mailrecommend', 0, 'vm');
         }
     }
     $vars = array();
     $toMail = vRequest::getVar('email');
     //is sanitized then
     $toMail = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $toMail);
     if (shopFunctionsF::renderMail('recommend', $toMail, $vars, 'productdetails', TRUE)) {
         $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
     } else {
         $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
     }
     $app->enqueueMessage(vmText::_($string));
     $view = $this->getView('recommend', 'html');
     $view->setLayout('mail_confirmed');
     $view->display();
 }
コード例 #9
0
ファイル: product.php プロジェクト: aldegtyarev/stelsvelo
 function sentProductEmailToShoppers()
 {
     jimport('joomla.utilities.arrayhelper');
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $product_id = JRequest::getVar('virtuemart_product_id', '');
     vmdebug('sentProductEmailToShoppers product id', $product_id);
     $vars = array();
     $vars['subject'] = JRequest::getVar('subject');
     $vars['mailbody'] = JRequest::getVar('mailbody');
     $order_states = JRequest::getVar('statut', array(), '', 'ARRAY');
     $productShoppers = $this->getProductShoppersByStatus($product_id, $order_states);
     vmdebug('productShoppers ', $productShoppers);
     $productModel = VmModel::getModel('product');
     $product = $productModel->getProduct($product_id);
     $vendorModel = VmModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($product->virtuemart_vendor_id);
     $vendorModel->addImages($vendor);
     $vars['vendor'] = $vendor;
     $vars['vendorEmail'] = $vendorModel->getVendorEmail($product->virtuemart_vendor_id);
     $vars['vendorAddress'] = shopFunctions::renderVendorAddress($product->virtuemart_vendor_id);
     $orderModel = VmModel::getModel('orders');
     foreach ($productShoppers as $productShopper) {
         $vars['user'] = $productShopper['name'];
         if (shopFunctionsF::renderMail('productdetails', $productShopper['email'], $vars, 'productdetails', TRUE)) {
             $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
         } else {
             $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
         }
         /* Update the order history  for each order */
         foreach ($productShopper['order_info'] as $order_info) {
             $orderModel->_updateOrderHist($order_info['order_id'], $order_info['order_status'], 1, $vars['subject'] . ' ' . $vars['mailbody']);
         }
         // todo: when there is an error while sending emails
         //vmInfo (JText::sprintf ($string, $productShopper['email']));
     }
 }
コード例 #10
0
ファイル: user.php プロジェクト: aldegtyarev/stelsvelo
 /**
  * This uses the shopFunctionsF::renderAndSendVmMail function, which uses a controller and task to render the content
  * and sents it then.
  *
  *
  * @author Oscar van Eijk
  * @author Max Milbers
  * @author Christopher Roussel
  * @author Valérie Isaksen
  */
 private static function sendRegistrationEmail($user, $password, $doUserActivation, $data)
 {
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $vars = array('user' => $user);
     // Send registration confirmation mail
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     $vars['password'] = $password;
     //if (empty($vars['name'])) $vars['name'] = ' ';
     if ($doUserActivation) {
         jimport('joomla.user.helper');
         if (JVM_VERSION >= 2) {
             $com_users = 'com_users';
             $activationLink = 'index.php?option=' . $com_users . '&task=registration.activate&token=' . $user->get('activation');
         } else {
             $com_users = 'com_user';
             $activationLink = 'index.php?option=' . $com_users . '&task=activate&activation=' . $user->get('activation');
         }
         $vars['activationLink'] = $activationLink;
     }
     $vars['doVendor'] = true;
     $vars['isMail'] = true;
     if (method_exists('VmConfig', 'loadJLang')) {
         VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
         VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     }
     $usermodel = VmModel::getModel('user');
     $usermodel->_data = null;
     if (empty($usermodel->_id)) {
         if (!empty($GLOBALS['opc_new_user'])) {
             $usermodel->_id = $GLOBALS['opc_new_user'];
         }
     }
     $vmuser = $usermodel->getUser();
     $userInfo = reset($vmuser->userInfo);
     $user->userInfo = $userInfo;
     $vars['user'] = $user;
     // stAn, to get rid of the notices:
     /*
      $orderDetails = array(); 
      $orderDetails['details'] = array(); 
      $orderDetails['details']['BT'] = new stdClass(); 
      
      if (empty($data['order_language']))
      $orderDetails['details']['BT']->order_language = JFactory::getLanguage()->getTag(); 
      else
      $orderDetails['details']['BT']->order_language = $data['order_language']; 
      
      $orderDetails['details']['BT']->first_name = $data['first_name']; 
      $orderDetails['details']['BT']->last_name = $data['last_name']; 
      
     
     $es = VmConfig::get('email_os_v',array('U','C','R','X'));
     $es1 = reset($es); 
     
     
     $vars['newOrderData'] = array(); 
     $vars['newOrderData']['customer_notified'] = 1; 
             $orderDetails['details']['BT']->order_status = $es1; 
     $orderDetails['details']['BT']->email = $user->get('email');
     
     $vars['orderDetails'] = $orderDetails; 
     */
     // public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = null)
     //
     // a custom code to trigger user registration email without notices:
     //shopFunctionsF::renderMail('user', $user->get('email'), $vars, 'user', false, false);
     shopFunctionsF::renderMail('user', $user->get('email'), $vars);
 }
コード例 #11
0
 function sendRatingEmailToVendor($data)
 {
     $vars = array();
     $productModel = VmModel::getModel('product');
     $product = $productModel->getProduct($data['virtuemart_product_id']);
     $vars['subject'] = vmText::sprintf('COM_VIRTUEMART_RATING_EMAIL_SUBJECT', $product->product_name);
     $vars['mailbody'] = vmText::sprintf('COM_VIRTUEMART_RATING_EMAIL_BODY', $product->product_name);
     $vendorModel = VmModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($product->virtuemart_vendor_id);
     $vendorModel->addImages($vendor);
     $vars['vendor'] = $vendor;
     $vars['vendorEmail'] = $vendorModel->getVendorEmail($product->virtuemart_vendor_id);
     $vars['vendorAddress'] = shopFunctionsF::renderVendorAddress($product->virtuemart_vendor_id);
     shopFunctionsF::renderMail('productdetails', $vars['vendorEmail'], $vars, 'productdetails', TRUE);
 }
コード例 #12
0
ファイル: user.php プロジェクト: joselapria/virtuemart
 /**
  * This uses the shopfunctionsF::renderAndSendVmMail function, which uses a controller and task to render the content
  * and sents it then.
  *
  *
  * @author Oscar van Eijk
  * @author Max Milbers
  * @author Christopher Roussel
  * @author Valérie Isaksen
  */
 private function sendRegistrationEmail($user, $password, $doUserActivation)
 {
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $vars = array('user' => $user);
     // Send registration confirmation mail
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     $vars['password'] = $password;
     if ($doUserActivation) {
         jimport('joomla.user.helper');
         if (JVM_VERSION === 2) {
             $com_users = 'com_users';
             $activationLink = 'index.php?option=' . $com_users . '&task=registration.activate&token=' . $user->get('activation');
         } else {
             $com_users = 'com_user';
             $activationLink = 'index.php?option=' . $com_users . '&task=activate&activation=' . $user->get('activation');
         }
         $vars['activationLink'] = $activationLink;
     }
     $vars['doVendor'] = true;
     // public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = null)
     shopFunctionsF::renderMail('user', $user->get('email'), $vars);
     //get all super administrator
     $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"';
     $this->_db->setQuery($query);
     $rows = $this->_db->loadObjectList();
     $vars['doVendor'] = false;
     // get superadministrators id
     foreach ($rows as $row) {
         if ($row->sendEmail) {
             //$message2 = sprintf ( JText::_( 'COM_VIRTUEMART_SEND_MSG_ADMIN' ), $row->name, $sitename, $name, $email, $username);
             //$message2 = html_entity_decode($message2, ENT_QUOTES);
             //JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
             //shopFunctionsF::renderMail('user', $row->email, $vars);
         }
     }
 }
コード例 #13
0
ファイル: product.php プロジェクト: joselapria/virtuemart
 function sentProductEmailToShoppers()
 {
     $cids = JRequest::getVar('virtuemart_product_id', JRequest::getVar('virtuemart_product_id', array(), '', 'ARRAY'), '', 'ARRAY');
     jimport('joomla.utilities.arrayhelper');
     JArrayHelper::toInteger($cids);
     vmdebug('sentProductEmailToShoppers product id', $cids);
     $modelOrder = VmModel::getModel('orders');
     $app = JFactory::getApplication();
     foreach ($cids as $cid) {
         $orders = $this->getOrdersbyProductId($cid);
         vmdebug('$orders ', $orders);
         $vars = array();
         $productModel = VmModel::getModel('product');
         $vars['product'] = $productModel->getProduct($cid);
         $vendorModel = VmModel::getModel('vendor');
         $VendorEmail = $vendorModel->getVendorEmail($vars['product']->virtuemart_vendor_id);
         $virtuemart_vendor_id = 1;
         $vendor = $vendorModel->getVendorAdressBT($virtuemart_vendor_id);
         $vendorModel->addImages($vendor);
         $vars['vendor'] = array('vendor_store_name' => $fromName);
         foreach ($orders as $order) {
             $vars['user'] = array('name' => $fromName, 'email' => $VendorEmail);
             if (shopFunctionsF::renderMail('productemailshoppers', $order->email, $vars, 'productdetails', false)) {
                 $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
             } else {
                 $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
             }
             /* Update the product history */
             $modelOrder->_updateOrderHist($order->virtuemart_order_id, $order->order_status_code, 1, $input['comments']);
             $app->enqueueMessage(JText::sprintf($string, $order->email));
         }
     }
 }
コード例 #14
0
ファイル: orders.php プロジェクト: cuongnd/etravelservice
 /**
  * Notifies the customer that the Order Status has been changed
  *
  * @author Christopher Roussel, Valérie Isaksen, Max Milbers
  *
  */
 public function notifyCustomer($tsmart_order_id, $newOrderData = 0)
 {
     if (isset($newOrderData['customer_notified']) && $newOrderData['customer_notified'] == 0) {
         return true;
     }
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     //Important, the data of the order update mails, payments and invoice should
     //always be in the database, so using getOrder is the right method
     $orderModel = tmsModel::getModel('orders');
     $order = $orderModel->getOrder($tsmart_order_id);
     $payment_name = $shipment_name = '';
     if (!class_exists('vmPSPlugin')) {
         require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php';
     }
     JPluginHelper::importPlugin('vmshipment');
     JPluginHelper::importPlugin('vmpayment');
     $dispatcher = JDispatcher::getInstance();
     $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($order['details']['BT']->tsmart_order_id, $order['details']['BT']->tsmart_shipmentmethod_id, &$shipment_name));
     $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($order['details']['BT']->tsmart_order_id, $order['details']['BT']->tsmart_paymentmethod_id, &$payment_name));
     $order['shipmentName'] = $shipment_name;
     $order['paymentName'] = $payment_name;
     if ($newOrderData != 0) {
         //We do not really need that
         $vars['newOrderData'] = (array) $newOrderData;
     }
     $vars['orderDetails'] = $order;
     //$vars['includeComments'] = vRequest::getVar('customer_notified', array());
     //I think this is misleading, I think it should always ask for example $vars['newOrderData']['doVendor'] directly
     //Using this function garantue us that it is always there. If the vendor should be informed should be done by the plugins
     //We may add later something to the method, defining this better
     $vars['url'] = 'url';
     if (!isset($newOrderData['doVendor'])) {
         $vars['doVendor'] = false;
     } else {
         $vars['doVendor'] = $newOrderData['doVendor'];
     }
     $tsmart_vendor_id = $order['details']['BT']->tsmart_vendor_id;
     $vendorModel = tmsModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($tsmart_vendor_id);
     $vars['vendor'] = $vendor;
     $vendorEmail = $vendorModel->getVendorEmail($tsmart_vendor_id);
     $vars['vendorEmail'] = $vendorEmail;
     // florian : added if pdf invoice are enabled
     $invoiceNumberDate = array();
     if ($orderModel->createInvoiceNumber($order['details']['BT'], $invoiceNumberDate)) {
         $orderstatusForInvoice = tsmConfig::get('inv_os', array('C'));
         if (!is_array($orderstatusForInvoice)) {
             $orderstatusForInvoice = array($orderstatusForInvoice);
         }
         // for backward compatibility 2.0.8e
         $pdfInvoice = (int) tsmConfig::get('pdf_invoice', 0);
         // backwards compatible
         $force_create_invoice = vRequest::getInt('create_invoice', -1);
         //TODO we need an array of orderstatus
         if (in_array($order['details']['BT']->order_status, $orderstatusForInvoice) or $pdfInvoice == 1 or $force_create_invoice == 1) {
             if (!shopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) {
                 if (!class_exists('tsmartControllerInvoice')) {
                     require VMPATH_SITE . DS . 'controllers' . DS . 'invoice.php';
                 }
                 $controller = new tsmartControllerInvoice(array('model_path' => VMPATH_SITE . DS . 'models', 'view_path' => VMPATH_SITE . DS . 'views'));
                 $vars['mediaToSend'][] = $controller->getInvoicePDF($order);
             }
         }
     }
     // Send the email
     $res = shopFunctionsF::renderMail('invoice', $order['details']['BT']->email, $vars, null, $vars['doVendor'], $this->useDefaultEmailOrderStatus);
     if (is_object($res) or !$res) {
         $string = 'com_tsmart_NOTIFY_CUSTOMER_ERR_SEND';
         vmdebug('notifyCustomer function shopFunctionsF::renderMail throws JException');
         $res = 0;
     } else {
         if ($res and $res != -1) {
             $string = 'com_tsmart_NOTIFY_CUSTOMER_SEND_MSG';
         }
     }
     if ($res != -1) {
         vmInfo(tsmText::_($string, false) . ' ' . $order['details']['BT']->first_name . ' ' . $order['details']['BT']->last_name . ', ' . $order['details']['BT']->email);
     }
     //quicknDirty to prevent that an email is sent twice
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         if (!class_exists('tsmartCart')) {
             require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
         }
         $cart = tsmartCart::getCart();
         $cart->customer_notified = true;
     }
     return true;
 }
コード例 #15
0
 function sendRatingEmailToVendor($data)
 {
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $vars = array();
     $productModel = VmModel::getModel('product');
     $product = $productModel->getProduct($data['virtuemart_product_id']);
     $vars['subject'] = JText::sprintf('COM_VIRTUEMART_RATING_EMAIL_SUBJECT', $product->product_name);
     $vars['mailbody'] = JText::sprintf('COM_VIRTUEMART_RATING_EMAIL_BODY', $product->product_name);
     $vendorModel = VmModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($product->virtuemart_vendor_id);
     $vendorModel->addImages($vendor);
     $vars['vendor'] = $vendor;
     $vars['vendorEmail'] = $vendorModel->getVendorEmail($product->virtuemart_vendor_id);
     if (!class_exists('shopFunctions')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $vars['vendorAddress'] = shopFunctions::renderVendorAddress($product->virtuemart_vendor_id);
     //$orderModel = VmModel::getModel ('orders');
     shopFunctionsF::renderMail('productdetails', $vars['vendorEmail'], $vars, 'productdetails', TRUE);
 }