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


PHP VTCacheUtils::setUserFullName方法代码示例

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


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

示例1: setMailerProperties

/**	Function to set all the Mailer properties
  *	$mail 		-- reference of the mail object
  *	$subject	-- subject of the email you want to send
  *	$contents	-- body of the email you want to send
  *	$from_email	-- from email id which will be displayed in the mail
  *	$from_name	-- from name which will be displayed in the mail
  *	$to_email 	-- to email address  -- This can be an email in a single string, a comma separated
  *			   list of emails or an array of email addresses
  *	$attachment	-- whether we want to attach the currently selected file or all vtiger_files.
  				[values = current,all] - optional
  *	$emailid	-- id of the email object which will be used to get the vtiger_attachments - optional
  */
function setMailerProperties($mail, $subject, $contents, $from_email, $from_name, $to_email, $attachment = '', $emailid = '', $module = '', $logo = '')
{
    $adb = PearDatabase::getInstance();
    $adb->println("Inside the function setMailerProperties");
    $CompanyDetails = getCompanyDetails();
    $logourl = 'storage/Logo/' . $CompanyDetails['logoname'];
    if ($logo == 1) {
        $image = getimagesize($logourl);
        $mail->AddEmbeddedImage($logourl, 'logo', $CompanyDetails['logoname'], "base64", $image['mime']);
    }
    $mail->Subject = $subject;
    //Added back as we have changed php mailer library, older library was using html_entity_decode before sending mail
    $mail->Body = decode_html($contents);
    //$mail->Body = html_entity_decode(nl2br($contents));	//if we get html tags in mail then we will use this line
    $mail->AltBody = strip_tags(preg_replace(array("/<p>/i", "/<br>/i", "/<br \\/>/i"), array("\n", "\n", "\n"), $contents));
    $mail->IsSMTP();
    //set mailer to use SMTP
    //$mail->Host = "smtp1.example.com;smtp2.example.com";  // specify main and backup server
    setMailServerProperties($mail);
    //Handle the from name and email for HelpDesk
    $mail->From = $from_email;
    $userFullName = trim(VTCacheUtils::getUserFullName($from_name));
    if (empty($userFullName)) {
        $rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name));
        $num_rows = $adb->num_rows($rs);
        if ($num_rows > 0) {
            $fullName = getFullNameFromQResult($rs, 0, 'Users');
            VTCacheUtils::setUserFullName($from_name, $fullName);
        }
    } else {
        $from_name = $userFullName;
    }
    $mail->FromName = decode_html($from_name);
    if ($to_email != '') {
        if (is_array($to_email)) {
            for ($j = 0, $num = count($to_email); $j < $num; $j++) {
                $mail->addAddress($to_email[$j]);
            }
        } else {
            $_tmp = explode(",", $to_email);
            for ($j = 0, $num = count($_tmp); $j < $num; $j++) {
                $mail->addAddress($_tmp[$j]);
            }
        }
    }
    //commented so that it does not add from_email in reply to
    //$mail->AddReplyTo($from_email);
    $mail->WordWrap = 50;
    //If we want to add the currently selected file only then we will use the following function
    if ($attachment == 'current' && $emailid != '') {
        if (isset($_REQUEST['filename_hidden'])) {
            $file_name = $_REQUEST['filename_hidden'];
        } else {
            $file_name = $_FILES['filename']['name'];
        }
        addAttachment($mail, $file_name, $emailid);
    }
    //This will add all the vtiger_files which are related to this record or email
    if ($attachment == 'all' && $emailid != '') {
        addAllAttachments($mail, $emailid);
    }
    $mail->IsHTML(true);
    // set email format to HTML
    return;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:77,代码来源:mail.php

示例2: setMailerProperties

/**	Function to set all the Mailer properties
  *	$mail 		-- reference of the mail object
  *	$subject	-- subject of the email you want to send
  *	$contents	-- body of the email you want to send
  *	$from_email	-- from email id which will be displayed in the mail
  *	$from_name	-- from name which will be displayed in the mail
  *	$to_email 	-- to email address  -- This can be an email in a single string, a comma separated
  *			   list of emails or an array of email addresses
  *	$attachment	-- whether we want to attach the currently selected file or all vtiger_files.
  				[values = current,all] - optional
  *	$emailid	-- id of the email object which will be used to get the vtiger_attachments - optional
  */
function setMailerProperties($mail, $subject, $contents, $from_email, $from_name, $to_email, $attachment = '', $emailid = '', $module = '', $logo = '')
{
    global $adb;
    $adb->println("Inside the function setMailerProperties");
    if ($module == "Support" || $logo == 1) {
        $mail->AddEmbeddedImage('layouts/vlayout/skins/images/logo_mail.jpg', 'logo', 'logo.jpg', "base64", "image/jpg");
    }
    // SalesPlatform.ru begin
    $mail->Timeout = 20;
    // SalesPlatform.ru end
    $mail->Subject = $subject;
    //Added back as we have changed php mailer library, older library was using html_entity_decode before sending mail
    $mail->Body = decode_html($contents);
    //$mail->Body = html_entity_decode(nl2br($contents));	//if we get html tags in mail then we will use this line
    $mail->AltBody = strip_tags(preg_replace(array("/<p>/i", "/<br>/i", "/<br \\/>/i"), array("\n", "\n", "\n"), $contents));
    // SalesPlatform.ru begin
    $query = "select * from vtiger_systems where server_type=?";
    $params = array('email');
    $result = $adb->pquery($query, $params);
    if (isset($_REQUEST['use_sendmail'])) {
        $use_sendmail = $_REQUEST['use_sendmail'];
        if ($use_sendmail == 'on') {
            $use_sendmail = 'true';
        }
    } else {
        if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'Settings' && !isset($_REQUEST['use_sendmail'])) {
            //added to avoid issue while editing the values in the outgoing mail server.
            $use_sendmail = 'false';
        } else {
            $use_sendmail = $adb->query_result($result, 0, 'use_sendmail');
        }
    }
    if ($use_sendmail == "true" || $use_sendmail == "on") {
        $mail->IsSendmail();
    } else {
        $mail->IsSMTP();
    }
    //	$mail->IsSMTP();		//set mailer to use SMTP
    // SalesPlatform.ru end
    //$mail->Host = "smtp1.example.com;smtp2.example.com";  // specify main and backup server
    setMailServerProperties($mail);
    // SalesPlatform.ru begin
    $idn = new idna_convert();
    // SalesPlatform.ru end
    //Handle the from name and email for HelpDesk
    // SalesPlatform.ru begin
    $mail->From = $idn->encode($from_email);
    $from_name_db = $adb->query_result($result, 0, 'from_name');
    if (isset($from_name_db) && $from_name_db != '') {
        //setting from _email to the defined email address in the outgoing server configuration
        $from_name = $from_name_db;
    } else {
        $rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name));
        $num_rows = $adb->num_rows($rs);
        if ($num_rows > 0) {
            $from_name = getFullNameFromQResult($rs, 0, 'Users');
        }
    }
    // SalesPlatform.ru end
    $mail->From = $from_email;
    $userFullName = trim(VTCacheUtils::getUserFullName($from_name));
    if (empty($userFullName)) {
        $rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name));
        $num_rows = $adb->num_rows($rs);
        if ($num_rows > 0) {
            $fullName = getFullNameFromQResult($rs, 0, 'Users');
            VTCacheUtils::setUserFullName($from_name, $fullName);
        }
    } else {
        $from_name = $userFullName;
    }
    $mail->FromName = decode_html($from_name);
    if ($to_email != '') {
        if (is_array($to_email)) {
            for ($j = 0, $num = count($to_email); $j < $num; $j++) {
                // SalesPlatform.ru begin
                $mail->addAddress($idn->encode($to_email[$j]));
                //				$mail->addAddress($to_email[$j]);
                // SalesPlatform.ru end
            }
        } else {
            $_tmp = explode(",", $to_email);
            for ($j = 0, $num = count($_tmp); $j < $num; $j++) {
                // SalesPlatform.ru begin
                $mail->addAddress($idn->encode($_tmp[$j]));
                //				$mail->addAddress($_tmp[$j]);
                // SalesPlatform.ru end
            }
//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:101,代码来源:mail.php


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