Ejemplo n.º 1
0
 public static function deliver(Module_PM $module, GWF_PM $pm)
 {
     if (false === ($pmo = GWF_PMOptions::getPMOptions($pm->getReceiver()))) {
         return 0;
     }
     if (!$pmo->isOptionEnabled(GWF_PMOptions::EMAIL_ON_PM)) {
         return 0;
     }
     $sender = $pm->getSender();
     $receiver = $pm->getReceiver();
     if ('' === ($rec = $receiver->getValidMail())) {
         return 0;
     }
     $sendername = $sender->getID() !== '0' ? $sender->display('user_name') : GWF_HTML::langUser($receiver, 'guest');
     $email = new GWF_Mail();
     $email->setSender($module->cfgEmailSender());
     $email->setReceiver($rec);
     $email->setSubject($module->langUser($receiver, 'mail_subj', array($sendername)));
     $autofolder = sprintf('index.php?mo=PM&me=AutoFolder&pmid=%s&uid=%s&token=%s', $pm->getID(), $receiver->getID(), $pm->getHashcode());
     $autofolder = Common::getAbsoluteURL($autofolder);
     $autofolder = GWF_HTML::anchor($autofolder, $autofolder);
     $delete = sprintf('index.php?mo=PM&me=Delete&pmid=%s&uid=%s&token=%s', $pm->getID(), $receiver->getID(), $pm->getHashcode());
     $delete = Common::getAbsoluteURL($delete);
     $delete = GWF_HTML::anchor($delete, $delete);
     $email->setBody($module->langUser($receiver, 'mail_body', array($receiver->displayUsername(), $sendername, $pm->display('pm_title'), $pm->display('pm_message'), $autofolder, $delete)));
     if (false === $email->sendToUser($receiver)) {
         return -4;
     }
     return 1;
 }
Ejemplo n.º 2
0
 private function templateShow($translate)
 {
     $pm = $this->pm;
     $pm->markRead(GWF_Session::getUser());
     $sender = $this->module->lang('th_pm_from') . ' ' . $pm->getSender()->displayProfileLink();
     $receiver = $this->module->lang('th_pm_to') . ' ' . $pm->getReceiver()->displayProfileLink();
     if ('' === ($translated = $this->getTranslated($translate))) {
         $translated = $pm->displayMessage();
     }
     $tVars = array('pm' => $this->pm, 'actions' => true, 'title' => $this->pm->display('pm_title'), 'unread' => GWF_PM::getUnreadPMs($this->module, GWF_Session::getUserID()), 'translated' => $translated, 'sender' => $sender, 'receiver' => $receiver, 'sendrec' => $pm->isRecipient() ? $sender : $receiver, 'transid' => 'pm_trans_' . $pm->getID(), 'buttons' => $this->getButtons($this->pm));
     return $this->module->template('show.tpl', $tVars);
 }
Ejemplo n.º 3
0
 private function templatePM(GWF_PM $pm)
 {
     $tVars = array('pm' => $pm, 'actions' => false, 'title' => $pm->display('pm_title'), 'unread' => array(), 'translated' => '');
     return $this->module->templatePHP('show.php', $tVars);
 }