private function sanitize() { if (false === ($this->pm = GWF_PM::getByID(Common::getGet('pmid')))) { return $this->module->error('err_pm'); } if ($this->pm->isRead()) { return $this->module->error('err_pm_read'); } if (false === $this->pm->canEdit(GWF_Session::getUser())) { return $this->module->error('err_perm_write'); } return false; }
private function getButtons(GWF_PM $pm) { $transid = 'pm_trans_' . $pm->getID(); $u = GWF_Session::getUser(); $buttons = ''; if (false !== ($prevs = $pm->getReplyToPrev())) { foreach ($prevs as $prev) { $buttons .= GWF_Button::prev($prev->getDisplayHREF(), $this->module->lang('btn_prev')); } } if (!$pm->hasDeleted($u)) { $buttons .= GWF_Button::delete($pm->getDeleteHREF($u->getID()), $this->module->lang('btn_delete')); } else { $buttons .= GWF_Button::restore($pm->getRestoreHREF(), $this->module->lang('btn_restore')); } if ($pm->canEdit($u)) { $buttons .= GWF_Button::edit($pm->getEditHREF(), $this->module->lang('btn_edit')); } $buttons .= GWF_Button::options($pm->getAutoFolderHREF(), $this->module->lang('btn_autofolder')); if (!$pm->isGuestPM()) { $buttons .= GWF_Button::reply($pm->getReplyHREF(), $this->module->lang('btn_reply')) . PHP_EOL . GWF_Button::quote($pm->getQuoteHREF(), $this->module->lang('btn_quote')); } $u2 = $pm->getOtherUser($u); $buttons .= GWF_Button::ignore($pm->getIgnoreHREF($pm->getOtherUser($u)), $this->module->lang('btn_ignore', array($u2->display('user_name')))); $buttons .= GWF_Button::translate($pm->getTranslateHREF(), $this->module->lang('btn_translate'), '', 'gwfGoogleTrans(\'' . $transid . '\'); return false;'); if (false !== ($nexts = $pm->getReplyToNext())) { foreach ($nexts as $next) { $buttons .= GWF_Button::next($next->getDisplayHREF(), $this->module->lang('btn_next')); } } return $buttons; }