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; }
private function getFormMessage() { if ($this->pm === false) { return ''; } elseif (Common::getGet('quote') !== false) { return sprintf("[quote from=%s date=%s]\n%s\n[/quote]", $this->pm->getSender()->display('user_name'), $this->pm->getVar('pm_date'), $this->pm->getVar('pm_message')); } else { return ''; // return $this->pm->display('pm_message'); } }
private function templatePreview(GWF_Form $form) { $tVars = array('pm' => GWF_PM::fakePM($this->pm->getSender()->getID(), $this->pm->getReceiver()->getID(), $form->getVar('title'), $form->getVar('message')), 'actions' => false, 'title' => $this->module->lang('ft_preview'), 'unread' => array()); return $this->module->templatePHP('show.php', $tVars); }