$max || !$validMail ) { vmWarn('COM_VIRTUEMART_COMMENT_NOT_VALID_JS'); $this->setRedirect(JRoute::_ ( 'index.php?option=com_virtuemart&view=vendor&task=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id , FALSE)); return ; } $user = JFactory::getUser(); if(!$this->checkCaptcha( 'index.php?option=com_virtuemart&view=vendor&layout=contact&virtuemart_vendor_id=1' ) ){ return ; } $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(vmText::_($string)); // Display it all $view = $this->getView('vendor', 'html'); $view->setLayout('mail_confirmed'); $view->display(); } /** * * @author Stan of RuposTel * */ function checkCaptcha($retUrl){ $msg = shopFunctionsF::checkCaptcha('ask_captcha'); if($msg !== TRUE){ vmWarn('PLG_RECAPTCHA_ERROR_INCORRECT_CAPTCHA_SOL'); $this->setRedirect (JRoute::_ ($retUrl . '&captcha=1', FALSE) ); return FALSE; } return TRUE; } } // No closing tag