Ejemplo n.º 1
0
/**	Funtion to add the user's signature with the content passed
 *	$contents -- where we want to add the signature
 *	$fromname -- which user's signature will be added to the contents
 */
function addSignature($contents, $fromname)
{
    $adb = PearDatabase::getInstance();
    $adb->println("Inside the function addSignature");
    $sign = VTCacheUtils::getUserSignature($fromname);
    if ($sign === null) {
        $result = $adb->pquery("select signature, first_name, last_name from vtiger_users where user_name=?", array($fromname));
        $sign = $adb->query_result($result, 0, "signature");
        VTCacheUtils::setUserSignature($fromname, $sign);
        VTCacheUtils::setUserFullName($fromname, $adb->query_result($result, 0, "first_name") . ' ' . $adb->query_result($result, 0, "last_name"));
    }
    $sign = nl2br($sign);
    if ($sign != '') {
        $contents .= '<br><br>' . $sign;
        $adb->println("Signature is added with the body => '." . $sign . "'");
    } else {
        $adb->println("Signature is empty for the user => '" . $fromname . "'");
    }
    return $contents;
}