Example #1
0
 function sendPM(User $FromUser, $message)
 {
     $message = htmlentities($message, ENT_NOQUOTES, 'UTF-8');
     require_once l_r('lib/message.php');
     $message = message::linkify($message);
     if ($FromUser->isSilenced()) {
         notice::send($FromUser->id, $this->id, 'PM', 'No', 'Yes', l_t('Could not deliver message, you are currently silenced.') . '(' . $FromUser->getActiveSilence()->reason . ')', l_t('To:') . ' ' . $this->username, $this->id);
         return false;
     } else {
         if ($this->isUserMuted($FromUser->id)) {
             notice::send($FromUser->id, $this->id, 'PM', 'No', 'Yes', l_t('Could not deliver message, user has muted you.'), l_t('To:') . ' ' . $this->username, $this->id);
             return false;
         } else {
             notice::send($this->id, $FromUser->id, 'PM', 'Yes', 'Yes', $message, $FromUser->username, $FromUser->id);
             $this->setNotification('PrivateMessage');
             notice::send($FromUser->id, $this->id, 'PM', 'No', 'Yes', l_t('You sent:') . ' <em>' . $message . '</em>', l_t('To:') . ' ' . $this->username, $this->id);
             return true;
         }
     }
 }