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


PHP htmlMimeMail::setFrom方法代码示例

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


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

示例1: template

 function m_sendMail()
 {
     $libFunc = new c_libFunctions();
     $this->ObTpl = new template();
     $this->ObTpl->set_file("TPL_VAR_CMS", MODULES_PATH . "default/templates/main/contactmail.tpl.htm");
     $this->ObTpl->set_var("TPL_VAR_NAME", $this->libFunc->m_displayContent($this->request['sName']));
     $this->ObTpl->set_var("TPL_VAR_ADDRESS1", $this->libFunc->m_displayContent($this->request['sAddress1']));
     $this->ObTpl->set_var("TPL_VAR_ADDRESS2", $this->libFunc->m_displayContent($this->request['sAddress2']));
     $this->ObTpl->set_var("TPL_VAR_PHONE", $this->libFunc->m_displayContent($this->request['sWorkPhone']));
     $this->ObTpl->set_var("TPL_VAR_COUNTRY", $this->libFunc->m_displayContent($this->request['sCountry']));
     $this->ObTpl->set_var("TPL_VAR_COMMENTS", nl2br($this->libFunc->m_displayContent($this->request['sComments'])));
     $message = "========================================<br />";
     $message .= "Contact request from " . SITE_NAME . "<br />";
     $message .= "========================================<br />";
     $message .= $this->ObTpl->parse("return", "TPL_VAR_CMS");
     $this->request['sName'] . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">";
     $obMail = new htmlMimeMail();
     $obMail->setReturnPath(ADMIN_EMAIL);
     $this->libFunc->m_displayContent($this->request['sName']) . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">";
     $obMail->setFrom($this->libFunc->m_displayContent1("\"" . $this->request['sName'] . "\"") . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">");
     $obMail->setSubject("Contact request from " . SITE_NAME);
     $obMail->setCrlf("\n");
     //to handle mails in Outlook Express
     $htmlcontent = $message;
     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
     $obMail->setHtml($htmlcontent, $txtcontent);
     $obMail->buildMessage();
     $result = $obMail->send(array(ENQUIRY_EMAIL));
 }
开发者ID:penkoh,项目名称:TradingEye-V7.1.1,代码行数:29,代码来源:cmsContent_db.php

示例2: EmailSuppliers

 function EmailSuppliers()
 {
     $EmailText = _('This email has been automatically generated by KwaMoja') . "\n";
     $EmailText .= _('You are invited to Tender for the following products to be delivered to') . ' ' . $_SESSION['CompanyRecord']['coyname'] . "\n";
     $EmailText .= _('Tender number') . ': ' . $this->TenderId . "\n";
     $EmailText .= _(' Quantity ') . ' ' . _(' Unit ') . ' ' . _(' Item Description') . "\n";
     foreach ($this->LineItems as $LineItem) {
         $EmailText .= $LineItem->Quantity . ' ' . $LineItem->Units . ' ' . $LineItem->ItemDescription . "\n";
     }
     $Subject = _('Tender received from') . ' ' . $_SESSION['CompanyRecord']['coyname'];
     $Headers = 'From: ' . $_SESSION['PurchasingManagerEmail'] . "\r\n" . 'Reply-To: ' . $_SESSION['PurchasingManagerEmail'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
     if ($_SESSION['SmtpSetting'] == 1) {
         include 'includes/htmlMimeMail.php';
         $mail = new htmlMimeMail();
         $mail->setText($EmailText);
         $mail->setSubject($Subject);
         $mail->setFrom($_SESSION['PurchasingManagerEmail']);
         $mail->setHeader('Reply-To', $_SESSION['PurchasingManagerEmail']);
         $mail->setCc($_SESSION['PurchasingManagerEmail']);
         //Set this as a copy for filing purpose
     }
     foreach ($this->Suppliers as $Supplier) {
         $result = mail($Supplier->EmailAddress, $Subject, $EmailText, $Headers);
         if ($_SESSION['SmtpSetting'] == 0) {
             $result = mail($Supplier->EmailAddress, $Subject, $EmailText, $Headers);
         } else {
             $result = SendmailBySmtp($mail, array($Supplier->EmailAddress, $_SESSION['PurchasingManagerEmail']));
         }
     }
 }
开发者ID:rrsc,项目名称:KwaMoja,代码行数:30,代码来源:DefineTenderClass.php

示例3: sendHTMLMail

function sendHTMLMail($from, $to, $subject, $body)
{
    $mail = new htmlMimeMail();
    $mail->setFrom($from);
    $mail->setSubject($subject);
    $mail->setHTML($body);
    if (is_array($to)) {
        $result = $mail->send($to);
    } else {
        $result = $mail->send(array($to));
    }
    return $result;
}
开发者ID:dpecos,项目名称:npshop,代码行数:13,代码来源:NPLib_Net.php

示例4: time

 function m_reviewAdd()
 {
     $this->request['display'] = $this->libFunc->ifSet($this->request, "display");
     $timestamp = time();
     $this->obDb->query = "SELECT iProdid_PK FROM " . PRODUCTS . " WHERE iProdid_PK='" . $this->request['productid'] . "'";
     $rs = $this->obDb->fetchQuery();
     if ($this->obDb->record_count > 0) {
         #inserting to departments
         $this->obDb->query = "SELECT iCustRevid_PK FROM " . REVIEWS . " WHERE iCustomerid_FK='" . $_SESSION['userid'] . "' AND iItemid_FK='" . $this->request['productid'] . "'";
         $rs = $this->obDb->fetchQuery();
         $rsCnt = $this->obDb->record_count;
         if ($rsCnt == 0) {
             $this->obDb->query = "INSERT INTO " . REVIEWS . "\n\t\t\t\t\t\t\t\t\t\t(vTitle,vComment,vRank,iDisplay,iItemid_FK,tmDateAdd,iCustomerid_FK,iState) \n\t\t\t\t\t\t\t\t\t\t\tvalues('" . $this->libFunc->m_addToDB($this->request['title']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['comment']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['rank']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->request['display'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->request['productid'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'{$timestamp}','" . $_SESSION['userid'] . "',1)";
             $this->obDb->updateQuery();
         } else {
             $this->obDb->query = "UPDATE " . REVIEWS . " SET vTitle='" . $this->libFunc->m_addToDB($this->request['title']) . "',\n\t\t\t\t\t\t\t\t\t\tvComment='" . $this->libFunc->m_addToDB($this->request['comment']) . "',\n\t\t\t\t\t\t\t\t\t\tvRank='" . $this->libFunc->m_addToDB($this->request['rank']) . "',\n\t\t\t\t\t\t\t\t\t\tiDisplay='" . $this->request['display'] . "',\n\t\t\t\t\t\t\t\t\t\tiItemid_FK='" . $this->request['productid'] . "',\n\t\t\t\t\t\t\t\t\t\ttmDateAdd='{$timestamp}' WHERE iCustRevid_PK='" . $rs[0]->iCustRevid_PK . "'";
             $this->obDb->updateQuery();
         }
         # additional functionality to e-mail admin on new submission of new product review - MCB, 26/09/2008
         $this->obDb->query = "SELECT vFirstName, vLastName FROM " . CUSTOMERS . " WHERE iCustmerid_PK=" . $_SESSION['userid'];
         $name_row = $this->obDb->fetchQuery();
         $customername = $name_row[0]->vFirstName . " " . $name_row[0]->vLastName;
         $obMail = new htmlMimeMail();
         $obMail->setReturnPath(ADMIN_EMAIL);
         $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
         $obMail->setSubject("New product review");
         $obMail->setCrlf("\n");
         //to handle mails in Outlook Express
         $message = "Somebody has posted a new product review on your on-line store.<br>Details of this review are listed below.<br><br>";
         $message .= $customername . " submitted the following at " . date('g:ia') . " on " . date('l, d F Y') . ":<br><br>";
         $message .= $this->libFunc->m_displayContent($this->request['comment']) . "<br><br>";
         $message .= "To view this comment, please visit the following URL:<br>";
         $message .= "<a href=\"" . SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['mode'] . "\">" . SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['mode'] . "</a>";
         $htmlcontent = $message;
         $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
         $obMail->setHtml($htmlcontent, $txtcontent);
         $obMail->buildMessage();
         if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", ADMIN_EMAIL)) {
             $result = $obMail->send(array(ADMIN_EMAIL));
         }
     }
     # redirect on posting and e-mailing of comment ...
     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['seotitle']);
     $this->libFunc->m_mosRedirect($retUrl);
     exit;
 }
开发者ID:penkoh,项目名称:TradingEye-V7.1.1,代码行数:46,代码来源:shop_db.php

示例5: send

 public static function send($from, $to, $subject, $body, array $attachments = null, array $headers = null)
 {
     if (empty($to)) {
         Logger::trace("mail not sent: no recipients: {$subject}");
         return;
     }
     $config = Context::last()->config;
     if (empty($from)) {
         if (!($from = $config->get('modules/mail/from'))) {
             $from = "Molinos.CMS <no-reply@" . MCMS_HOST_NAME . ">";
         }
     }
     if (strstr($body, '<html>') === false) {
         $body = '<html><head><title>' . html::plain($subject) . '</title></head><body>' . $body . '</body></html>';
     }
     if (!is_array($to)) {
         $to = preg_split('/, */', $to, -1, PREG_SPLIT_NO_EMPTY);
     }
     Logger::log(sprintf('to=%s, subject=%s', join(',', $to), $subject), 'mail');
     $mail = new htmlMimeMail();
     if ('smtp' == ($transport = ($server = $config->get('modules/mail/server')) ? 'smtp' : 'mail')) {
         $mail->setSMTPParams($server);
     }
     $mail->setFrom($from);
     $mail->setSubject($subject);
     $mail->setHtml(self::fixhtml($body));
     $mail->setTextCharset('UTF-8');
     $mail->setTextEncoding('base64');
     $mail->setHTMLCharset('UTF-8');
     $mail->setHTMLEncoding('UTF-8');
     $mail->setHeadCharset('UTF-8');
     foreach ((array) $attachments as $file) {
         $mail->addAttachment($file['data'], $file['name'], $file['type']);
     }
     foreach ((array) $headers as $k => $v) {
         if (!empty($v)) {
             $mail->setHeader($k, $v);
         }
     }
     return $mail->send($to, $transport);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:41,代码来源:class.bebopmimemail.php

示例6: htmlMimeMail

}

			$mail = new htmlMimeMail();



			$mail->setHtml($body, $body_notags);

			

			$mail->setReturnPath('info@erieit.edu');



			$mail->setFrom('contact_us@erieit.edu');



			$mail->setSubject($messageSubject);



			$mail->setHeader('X-Mailer', 'HTML Mime mail class (http://www.phpguru.org)');

			

			//SEND TO BELOW /

			
开发者ID:jackmolnar,项目名称:glit_website_new,代码行数:27,代码来源:welding_page.php

示例7: date

        /*Then set up a new page */
        $PageNumber++;
        include 'includes/PDFChequeListingPageHeader.inc';
    }
    /*end of new page header  */
}
/* end of while there are customer receipts in the batch to print */
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 60, $FontSize, locale_money_format($TotalCheques, $Currency), 'right');
$LeftOvers = $pdf->addTextWrap($Left_Margin + 65, $YPos, 300, $FontSize, _('TOTAL') . ' ' . $Currency . ' ' . _('CHEQUES'), 'left');
$ReportFileName = $_SESSION['DatabaseName'] . '_ChequeListing_' . date('Y-m-d') . '.pdf';
$pdf->OutputD($ReportFileName);
//UldisN
$pdf->__destruct();
//UldisN
if ($_POST['Email'] == 'Yes') {
    if (file_exists($_SESSION['reports_dir'] . '/' . $ReportFileName)) {
        unlink($_SESSION['reports_dir'] . '/' . $ReportFileName);
    }
    $fp = fopen($_SESSION['reports_dir'] . '/' . $ReportFileName, 'wb');
    fwrite($fp, $pdfcode);
    fclose($fp);
    include 'includes/htmlMimeMail.php';
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/' . $ReportFileName);
    $mail->setText(_('Please find herewith payments listing from') . ' ' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate']);
    $mail->addAttachment($attachment, 'PaymentListing.pdf', 'application/pdf');
    $mail->setFrom(array('"' . $_SESSION['CompanyRecord']['coyname'] . '" <' . $_SESSION['CompanyRecord']['email'] . '>'));
    /* $ChkListingRecipients defined in config.php */
    $result = $mail->send($ChkListingRecipients);
}
开发者ID:sunilburli,项目名称:webERP-Medical,代码行数:31,代码来源:PDFChequeListing.php

示例8: htmlMimeMail

 function mail_send($email_from, $subject, $sendto_email, $html_body, $plain_body, $randpath, $randfile)
 {
     $file = $html_mime_mail = new htmlMimeMail();
     $html_mime_mail->setFrom($email_from);
     $html_mime_mail->setSubject($subject);
     $html_mime_mail->setHtml($html_body, $plain_body);
     if ($randpath != '' && $randfile != '') {
         $html_mime_mail->addAttachment($html_mime_mail->getFile($randpath . $randfile), $randfile);
     }
     $success = $html_mime_mail->send(array($sendto_email), 'smtp');
     return $success;
 }
开发者ID:trungjc,项目名称:collegeprospectnetwork,代码行数:12,代码来源:common_functions.php

示例9: header

if ($_REQUEST["locSection"] == 'compose') {
    $current = $webmaillib->get_current_webmail_account($user);
    if (!$current) {
        header("location: tiki-webmail.php?locSection=settings");
        die;
    }
    // Send a message
    if (isset($_REQUEST["reply"]) || isset($_REQUEST["replyall"])) {
        check_ticket('webmail');
        $webmaillib->set_mail_flag($current["accountId"], $user, $_REQUEST["realmsgid"], 'isReplied', 'y');
    }
    $smarty->assign('sent', 'n');
    $smarty->assign('attaching', 'n');
    if (isset($_REQUEST["send"])) {
        $mail = new htmlMimeMail();
        $mail->setFrom($current["account"]);
        $mail->setCc($_REQUEST["cc"]);
        $mail->setBcc($_REQUEST["bcc"]);
        $mail->setSubject($_REQUEST["subject"]);
        if ($_REQUEST["attach1"]) {
            check_ticket('webmail');
            $a1 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach1file"]);
            $mail->addAttachment($a1, $_REQUEST["attach1"], $_REQUEST["attach1type"]);
            @unlink('temp/mail_attachs/' . $_REQUEST["attach1file"]);
        }
        if ($_REQUEST["attach2"]) {
            check_ticket('webmail');
            $a2 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach2file"]);
            $mail->addAttachment($a2, $_REQUEST["attach2"], $_REQUEST["attach2type"]);
            @unlink('temp/mail_attachs/' . $_REQUEST["attach2file"]);
        }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:tiki-webmail.php

示例10: htmlMimeMail

 		exit;
 	}*/
 if (isset($_GET['Email'])) {
     //email the invoice to address supplied
     include 'includes/header.inc';
     include 'includes/htmlMimeMail.php';
     $mail = new htmlMimeMail();
     $filename = $_SESSION['reports_dir'] . '/Invoice.pdf';
     $fp = fopen($_SESSION['reports_dir'] . '/Invoice.pdf', 'wb');
     fwrite($fp, $pdfcode);
     fclose($fp);
     $attachment = $mail->getFile($filename);
     $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo']);
     $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']);
     $mail->addAttachment($attachment, $filename, 'application/pdf');
     $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
     $result = $mail->send(array($_GET['Email']));
     unlink($filename);
     //delete the temporary file
     $title = _('Emailing') . ' ' . $InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo;
     include 'includes/header.inc';
     echo "<p>{$InvOrCredit} " . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('has been emailed to') . ' ' . $_GET['Email'];
     include 'includes/footer.inc';
     exit;
 } else {
     header('Content-type: application/pdf');
     header('Content-Length: ' . $len);
     header('Content-Disposition: inline; filename=Customer_trans.pdf');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Pragma: public');
开发者ID:bodi000,项目名称:weberp-cvs,代码行数:31,代码来源:PrintCustTrans.php

示例11: SendHtmlEmail

function SendHtmlEmail($plantilla, $variables, $subject, $destino, $origen = "presupuestos@pachecoforja.com", $imagenes = NULL, $imgdir = "img", $html = NULL)
{
    require_once 'mail.php';
    if (!$html) {
        $smarty = SmartyInit();
        $smarty->assign("variables", $variables);
        $body = $smarty->fetch($plantilla);
    } else {
        $body = $html;
    }
    $mail = new htmlMimeMail();
    // Definimos el html
    $mail->setHtml($body);
    // Comprobamos si hay imagenes embebidas en el correo
    if ($imagenes != NULL) {
        // Leemos todos los ficheros y los aadimos al correo
        foreach ($imagenes as $imagen) {
            $len = strlen($imagen);
            $extension = substr($imagen, $len - 3, 3);
            if ($extension == "gif") {
                $tipo = "image/gif";
            }
            if ($extension == "jpg") {
                $tipo = "image/jpg";
            }
            $fichero = $imgdir . "/" . $imagen;
            $temp = $mail->getFile($fichero);
            $mail->addHtmlImage($temp, $imagen, $tipo);
        }
    }
    // Definimos las cabeceras de los mensajes
    $mail->setReturnPath($origen);
    $mail->setFrom($origen);
    $mail->setSubject($subject);
    $mail->setHeader('X-Mailer', 'Correo enviado por pachecoforja.com');
    // Enviamos el correo
    $result = $mail->send(array($destino), 'smtp');
    if (!$result) {
        return $mail->errors;
    } else {
        return true;
    }
}
开发者ID:BackupTheBerlios,项目名称:facturaphp,代码行数:43,代码来源:tools.php

示例12: explode

chdir($kwamoja_home);
// get me the report name from the command line
$_GET['ReportID'] = $reportnumber;
$Recipients = explode(";", $emailaddresses);
//wrap in angles so that mail can accept it
for ($i = 0; $i < count($Recipients); $i++) {
    $Recipient[$i] = "<" . $Recipient[$i] . ">";
}
$AllowAnyone = true;
include 'includes/session.inc';
include 'includes/ConstructSQLForUserDefinedSalesReport.inc';
include 'includes/PDFSalesAnalysis.inc';
include 'includes/htmlMimeMail.php';
$mail = new htmlMimeMail();
if ($Counter > 0) {
    /* the number of lines of the sales report is more than 0  ie there is a report to send! */
    $pdfcode = $pdf->output();
    $fp = fopen($_SESSION['reports_dir'] . "/" . $reportname, "wb");
    fwrite($fp, $pdfcode);
    fclose($fp);
    $attachment = $mail->getFile($_SESSION['reports_dir'] . "/" . $reportname);
    $mail->setText($mailtext . "\nPlease find herewith " . $reportname . "  report");
    $mail->setSubject($reportname . " Report");
    $mail->addAttachment($attachment, $reportname, 'application/pdf');
    $mail->setFrom("");
    $result = $mail->send($Recipients);
} else {
    $mail->setText("Error running automated sales report number {$ReportID}");
    $mail->setFrom("Do_not_reply_" . $_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">");
    $result = $mail->send($Recipients);
}
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:report_runner.php

示例13: htmlMimeMail

*
* Create the mail object.
*/
$mail = new htmlMimeMail();
/**
* Read the file test.zip into $attachment.
*/
$attachment = $mail->getFile('example.zip');
/**
* Since we're sending a plain text email,
* we only need to read in the text file.
*/
$text = $mail->getFile('example.txt');
/**
* To set the text body of the email, we
* are using the setText() function. This
* is an alternative to the setHtml() function
* which would obviously be inappropriate here.
*/
$mail->setText($text);
/**
* This is used to add an attachment to
* the email.
*/
$mail->addAttachment($attachment, 'example.zip', 'application/zip');
/**
* Sends the message.
*/
$mail->setFrom('Joe <joe@example.com>');
$result = $mail->send(array('"Richard" <postmaster@localhost>'));
echo $result ? 'Mail sent!' : 'Failed to send mail';
开发者ID:4v4t4r,项目名称:CTF-LCC,代码行数:31,代码来源:example.3.php

示例14: EmailOffer

 function EmailOffer()
 {
     $Subject = _('Offer received from') . ' ' . $this->GetSupplierName();
     $Message = _('This email is automatically generated by webERP') . "\n" . _('You have received the following offer from') . ' ' . $this->GetSupplierName() . "\n\n" . $this->OfferMailText;
     $Headers = 'From: ' . $this->GetSupplierEmail() . "\r\n" . 'Reply-To: ' . $this->GetSupplierEmail() . "\r\n" . 'X-Mailer: PHP/' . phpversion();
     if ($_SESSION['SmtpSetting'] == 1) {
         include 'includes/htmlMimeMail.php';
         $mail = new htmlMimeMail();
         $mail->setText($Message);
         $mail->setSubject($Subject);
         $mail->setFrom($this->GetSupplierEmail());
         $mail->setHeader('Reply-To', $this->GetSupplierEmail());
         $mail->setCc($this->GetSupplierEmail());
     }
     if ($_SESSION['SmtpSetting'] == 0) {
         $result = mail($_SESSION['PurchasingManagerEmail'], $Subject, $Message, $Headers);
     } else {
         $result = SendmailBySmtp($mail, array($Supplier->EmailAddress, $_SESSION['PurchasingManagerEmail']));
     }
     return $result;
 }
开发者ID:strollClouds,项目名称:snkStudy,代码行数:21,代码来源:DefineOfferClass.php

示例15: errorMsg

/**
 * Find the specified error message, and return the first found with the following precedence:
 * 1. Current language(s) set by setMsgLangage()
 * 2. English message
 * 3. Debug message
 * 4. Generic error
 * Each language can be found through ['lnk'] if needed
 * Tags (%1..%n) in the message are replaced by mixed arguments specified after $errNum.
 * Ex: errorMsg(55, $domainName)
 * if 'dbg' is found in ['add'] or $DisplayDbg is true, the 'dbg' version is appended to the found version.
 */
function errorMsg($errNum = GENERIC_ERROR_NUM)
{
    // Find specified message using precedence rules
    global $MsgLanguages;
    $precedence = array(array($errNum, $MsgLanguages == 'all' ? array('en', 'fr', 'de') : $MsgLanguages), array($errNum, array('en')), array($errNum, array('dbg')), array(GENERIC_ERROR_NUM, $MsgLanguages), array(GENERIC_ERROR_NUM, array('en')));
    global $ErrMsgs;
    $args = func_get_args();
    $msg = '';
    foreach ($precedence as $rule) {
        // Find message
        list($actualErrNum, $languages) = $rule;
        foreach ($languages as $lg) {
            if (isset($ErrMsgs[$actualErrNum][$lg]) && $ErrMsgs[$actualErrNum][$lg] != 'TODO') {
                appendToMsg($msg, $errNum, $ErrMsgs[$actualErrNum][$lg], $args);
            } else {
                if (isset($ErrMsgs[$actualErrNum]['lnk']) && isset($ErrMsgs[$actualErrNum]['lnk'][$lg]) && $ErrMsgs[$actualErrNum]['lnk'][$lg] != 'TODO') {
                    appendToMsg($msg, $errNum, $ErrMsgs[$actualErrNum]['lnk'][$lg], $args);
                }
            }
        }
        // Try next rule only if not found
        if (!empty($msg)) {
            break;
        }
    }
    // Add debug version if needed
    global $DisplayDbg;
    $msgHasDebug = in_array('dbg', $languages);
    $logExtMsg = '';
    if (!$msgHasDebug && isset($ErrMsgs[$actualErrNum]['dbg'])) {
        if ($DisplayDbg || isset($ErrMsgs[$actualErrNum]['add']) && $ErrMsgs[$actualErrNum]['add'] == 'dbg') {
            $msg .= '[' . $ErrMsgs[$actualErrNum]['dbg'] . "]\n";
        } else {
            $logExtMsg .= '[' . $ErrMsgs[$actualErrNum]['dbg'] . ']';
        }
        // to log message
    }
    // Get mail data if specified
    $mailData = isset($ErrMsgs[$actualErrNum]['mail']) ? $ErrMsgs[$actualErrNum]['mail'] : (isset($ErrMsgs[$actualErrNum]['lnk']['mail']) ? $ErrMsgs[$actualErrNum]['lnk']['mail'] : array());
    // Apply params if applicable
    $numArgs = func_num_args();
    if ($numArgs > 1) {
        for ($i = 0; $i != $numArgs; ++$i) {
            $msg = str_replace("%{$i}", $args[$i], $msg);
            $logExtMsg = str_replace("%{$i}", $args[$i], $logExtMsg);
            $mIdx = 0;
            foreach ($mailData as $field) {
                $mailData[$mIdx] = str_replace("%{$i}", $args[$i], $field);
                ++$mIdx;
            }
        }
    }
    // Log technical errors if possible
    $logMode = isset($ErrMsgs[$actualErrNum]['log']) ? $ErrMsgs[$actualErrNum]['log'] : (isset($ErrMsgs[$actualErrNum]['lnk']['log']) ? $ErrMsgs[$actualErrNum]['lnk']['log'] : true);
    if ($logMode && class_exists('CWwwLog')) {
        $logFile = new CWwwLog();
        $logFile->logStr($logExtMsg);
        // message is already logged by ob_callback_r2login()
    }
    // Send email if specified
    if (!empty($mailData) && count($mailData) >= 3) {
        include_once 'email/htmlMimeMail.php';
        $mail = new htmlMimeMail();
        $mail->setFrom('noreply@ryzom.com');
        $mail->setSubject($mailData[1]);
        $mail->setText('Application: ' . $_GET['clientApplication'] . ' - Login: ' . $_GET['login'] . "\n" . $mailData[2]);
        $result = $mail->send(array($mailData[0]));
    }
    return $msg;
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:81,代码来源:login_translations.php


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