function sendMessage($sUser, $sPwd, $sRecipient, $sSubj, $sText, $sSendTo) { $aRet = array(); if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) { return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct")); } bx_import('BxTemplMailBox'); $sRecipient = process_db_input($sRecipient, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION); $aRecipient = db_arr("SELECT * FROM `Profiles` WHERE `NickName` = '{$sRecipient}'"); if (!$aRecipient) { return new xmlrpcval(BX_MAILBOX_SEND_UNKNOWN_RECIPIENT); } $aMailBoxSettings = array('member_id' => $iId); $oMailBox = new BxTemplMailBox('mail_page_compose', $aMailBoxSettings); $aComposeSettings = array('send_copy' => 'recipient' == $sSendTo || 'both' == $sSendTo ? true : false, 'notification' => false, 'send_copy_to_me' => 'me' == $sSendTo || 'both' == $sSendTo ? true : false); $oMailBox->sendMessage($sSubj, nl2br($sText), $aRecipient['ID'], $aComposeSettings); return new xmlrpcval($oMailBox->iSendMessageStatusCode); }
$sOutputHtml = $oMailBox->genReplayMessage($vRecipientID, $iMessageID); } break; case 'compose_mail': $sErrorMessage = ''; //check message's options if (!$sMessageSubject) { $sErrorMessage = '_Mailbox title empty'; } if (!$sMessageBody) { $sErrorMessage = '_Mailbox description empty'; } if (!$vRecipientID) { $sErrorMessage = '_Mailbox recipient empty'; } $sOutputHtml = !$sErrorMessage ? $oMailBox->sendMessage($sMessageSubject, $sMessageBody, $vRecipientID, $aComposeSettings) : _t_err($sErrorMessage); break; case 'auto_complete': if ($sAutoCompleteQ) { $sOutputHtml = $oMailBox->getAutoCompleteList($sAutoCompleteQ); } break; case 'get_thumbnail': $iRecipientID = getId($vRecipientID); if ($iRecipientID) { $sOutputHtml = get_member_thumbnail($iRecipientID, 'none'); } break; } // try to define the callback function name ; if (isset($_GET['callback_function']) and in_array($_GET['callback_function'], $aCallbackFunctions)) {
// will return all the arhive's message list ; // will return all the arhive's message list ; case 'archives_paginate': $sOutputHtml = $oMailBox->genArchiveMessages(); break; // will return message's replay window; // will return message's replay window; case 'reply_message': if ($iMessageID and $vRecipientID) { $vRecipientID = (int) $vRecipientID; $sOutputHtml = $oMailBox->genReplayMessage($vRecipientID, $iMessageID); } break; case 'compose_mail': if ($sMessageSubject and $sMessageBody and $vRecipientID) { $sOutputHtml = $oMailBox->sendMessage($sMessageSubject, $sMessageBody, $vRecipientID, $aComposeSettings); } else { $sOutputHtml = _t_err('_please_fill_next_fields_first'); } break; case 'auto_complete': if ($sAutoCompleteQ) { $sOutputHtml = $oMailBox->getAutoCompleteList($sAutoCompleteQ); } break; case 'get_thumbnail': $iRecipientID = getId($vRecipientID); if ($iRecipientID) { $sOutputHtml = get_member_thumbnail($iRecipientID, 'none'); } break;