示例#1
0
 /**
  *  Sends a message from the current member to the member given as argument
  */
 function sendMessage()
 {
     global $CONF, $member;
     $error = $this->validateMessage();
     if ($error != '') {
         return array('message' => $error);
     }
     if (!$member->isLoggedIn()) {
         $fromMail = postVar('frommail');
         $fromName = _MMAIL_FROMANON;
     } else {
         $fromMail = $member->getEmail();
         $fromName = $member->getDisplayName();
     }
     $tomem = new MEMBER();
     $tomem->readFromId(postVar('memberid'));
     $message = _MMAIL_MSG . ' ' . $fromName . "\n" . '(' . _MMAIL_FROMNUC . ' ' . $CONF['IndexURL'] . ") \n\n" . _MMAIL_MAIL . " \n\n" . postVar('message');
     $message .= getMailFooter();
     $title = _MMAIL_TITLE . ' ' . $fromName;
     mb_language('ja');
     mb_internal_encoding(_CHARSET);
     @mb_send_mail($tomem->getEmail(), $title, $message, "From: " . $fromMail);
     if (postVar('url')) {
         redirect(postVar('url'));
     } else {
         $CONF['MemberURL'] = $CONF['IndexURL'];
         if ($CONF['URLMode'] == 'pathinfo') {
             $url = createLink('member', array('memberid' => $tomem->getID(), 'name' => $tomem->getDisplayName()));
         } else {
             $url = $CONF['IndexURL'] . createMemberLink($tomem->getID());
         }
         redirect($url);
     }
     exit;
 }