Ejemplo n.º 1
0
 function new_pay_mail($order_id)
 {
     $mainframe = JFactory::getApplication();
     require_once JPATH_SITE . DS . "components" . DS . "com_socialads" . DS . "helper.php";
     // require when we call from backend
     $socialadshelper = new socialadshelper();
     $db = JFactory::getDBO();
     $query = "SELECT p.payee_id,u.username, u.email,p.status FROM #__ad_payment_info as p, #__users as u\n\t\t\t\t\t\t\tWHERE p.payee_id=u.id\n\t\t\t\t\t\t\tAND p.id=" . $order_id;
     $db->setQuery($query);
     $result = $db->loadObject();
     $body = JText::_('PAY_PAYMENT_BODY');
     $find = array('[SEND_TO_NAME]', '[ORDERID]', '[SITENAME]', '[STATUS]');
     if ($result->status == 'P') {
         $orderstatus = JText::_('ADS_INVOICE_STATUS_PENDING');
     } else {
         if ($result->status == 'RF') {
             $orderstatus = JText::_('SA_REFUNDED');
         } else {
             $orderstatus = JText::_('ADS_INVOICE_AMOUNT_CANCELLED');
         }
     }
     $recipient = $result->email;
     $siteName = $mainframe->getCfg('sitename');
     $displayOrderid = sprintf("%05s", $order_id);
     $replace = array($result->username, $displayOrderid, $siteName, $orderstatus);
     $body = str_replace($find, $replace, $body);
     $subject = JText::sprintf("SA_STATUS_CHANGED_MAIL_SUBJECT", $displayOrderid);
     $status = $socialadshelper->sendmail($recipient, $subject, $body, '', 0, "");
 }
Ejemplo n.º 2
0
    function adminAdApprovalEmail($ad_id)
    {
        $db = JFactory::getDBO();
        $query = 'SELECT a.`ad_id`,a.`ad_image`,a.`ad_title`,a.`ad_body`,a.`ad_url2` FROM `#__ad_data` as a
				WHERE a.ad_id=' . $ad_id;
        //. '  AND a.ad_approved=1';
        $db->setQuery($query);
        $oldAd = $db->loadObject();
        jimport('joomla.utilities.utility');
        $user = JFactory::getUser();
        global $mainframe;
        $mainframe = JFactory::getApplication();
        $sitelink = JUri::root();
        $socialadshelper = new socialadshelper();
        $manageAdLink = "<a href='" . $sitelink . "administrator" . DS . "index.php?option=com_socialads&view=approveads' targe='_blank'>" . JText::_("COM_SOCIALADS_EMAIL_THIS_LINK") . "</a>";
        // GET config details
        $frommail = $mainframe->getCfg('mailfrom');
        $fromname = $mainframe->getCfg('fromname');
        $adUserName = $user->username;
        $adTitle = $oldAd->ad_title;
        $siteName = $mainframe->getCfg('sitename');
        $today = date('Y-m-d H:i:s');
        //DEFINE SEARCH
        $find = array('[SEND_TO_NAME]', '[ADVERTISER_NAME]', '[SITENAME]', '[SITELINK]', '[ADTITLE]', '[CONTENT]', '[TIMESTAMP]');
        // SEND ADMIN MAIL
        $recipient = $frommail;
        $subject = JText::_("COM_SOCIALADS_APPRVE_MAIL_TO_ADMIN_SUBJECT");
        $adminEmailBody = JText::sprintf("COM_SOCIALADS_EMAIL_HELLO") . JText::sprintf('COM_SOCIALADS_APPRVE_MAIL_TO_ADMIN_CONTENT', $manageAdLink) . JText::sprintf("COM_SOCIALADS_EMAIL_SITENAME_TEAM");
        // NOW REPLACE TAG
        $replace = array($fromname, $adUserName, $siteName, $sitelink, $adTitle, $content, $today);
        $adminEmailBody = str_replace($find, $replace, $adminEmailBody);
        $status = $socialadshelper->sendmail($recipient, $subject, $adminEmailBody, $bcc_string = '', $singlemail = 0, $attachmentPath = "");
        // SEND TO ADVERTISER MAIL
        $advertiserEmail = $user->email;
        $subject = JText::_("COM_SOCIALADS_APPRVE_MAIL_TO_ADVERTISER_SUBJECT");
        $advertiserEmailBody = JText::sprintf("COM_SOCIALADS_EMAIL_HELLO") . JText::sprintf('COM_SOCIALADS_APPRVE_MAIL_TO_ADVERTISR_CONTENT') . JText::sprintf("COM_SOCIALADS_EMAIL_SITENAME_TEAM");
        // NOW REPLACE TAG
        $replace = array($adUserName, $adUserName, $siteName, $sitelink, $adTitle, $content, $today);
        $advertiserEmailBody = str_replace($find, $replace, $advertiserEmailBody);
        $status = $socialadshelper->sendmail($advertiserEmail, $subject, $advertiserEmailBody, $bcc_string = '', $singlemail = 0, $attachmentPath = "");
    }