示例#1
0
 /**
  * @throws Kohana_Exception
  *
  * delete news
  */
 public function action_del()
 {
     $id = $this->request->param('id');
     $id = Security::encode_php_tags(HTML::chars($id));
     $news = new Model_New();
     $news->delNew($id);
     HTTP::redirect($_SERVER['HTTP_REFERER']);
 }
示例#2
0
 /**
  * @throws HTTP_Exception_404
  *
  * view new item
  */
 public function action_view()
 {
     $id = $this->request->param('id');
     $id = Security::encode_php_tags(HTML::chars($id));
     $news = new Model_New();
     $data = $news->getNew($id);
     if ($data) {
         $content = View::factory($this->itemNewsView);
         $content->bind('data', $data);
         $this->template->content = $content;
     } else {
         throw new HTTP_Exception_404('File not found!');
     }
 }
 public function set(Model_New $new)
 {
     $this->filename->getValidator('UploadExists')->setToken($new->filename);
     $this->setDefaults($new->toArray());
 }