Example #1
0
 public function action_view()
 {
     $mail_id = $this->request->param('id');
     $mail = Model_Mail::find_by_id($mail_id);
     if (!$mail) {
         throw new Exception_Page(__('common.mail_not_found'));
     }
     // 检查权限
     if ($mail->is_owner($this->current_user) or $this->current_user->is_admin()) {
         if ($mail->is_receiver($this->current_user)) {
             $mail->mark_as_read();
         }
         $this->template_data['title'] = $mail->title;
         $this->template_data['mail'] = $mail;
     } else {
         $this->redirect('/mail');
     }
 }