public function action_delete() { $id = (int) $this->request->param('id', 0); $type = Arr::get($_GET, 'type', 'slider'); $token = Arr::get($_POST, 'token', false); if ($this->request->method() == Request::POST && Security::token() === $token) { $slider = ORM::factory('Slider', $id); $loger = new Loger('delete', $slider->link_ru); $loger->log($slider); $slider->delete(); $this->redirect('manage/sliders/?type=' . $type); } else { $this->set('token', Security::token(true))->set('r', Url::media('manage/sliders?type=' . $type)); } }
public function action_delete() { $id = (int) $this->request->param('id', 0); $infograph = ORM::factory('Infograph', $id); if (!$infograph->loaded()) { throw new HTTP_Exception_404(); } $token = Arr::get($_POST, 'token', false); if ($this->request->method() == Request::POST && Security::token() === $token) { $loger = new Loger('delete', $infograph->title); $loger->log($infograph); $infograph->delete(); Message::success('Запись удалена'); $this->redirect('manage/infographs'); } else { $this->set('record', $infograph)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/infographs')); } }
public function action_addedit() { $id = $this->request->param('id', 0); $params = explode('-', $id); array_walk($params, 'intval'); $ent_id = $params[0]; if (isset($params[1])) { $quest_id = $params[1]; $quest = ORM::factory('Qv', $quest_id); } else { $quest = ORM::factory('Qv'); } $kt = ORM::factory('kt', $ent_id); $this->set('quest', $quest); if (!$kt->loaded()) { throw new HTTP_Exception_404(); } $this->set('kt', $kt); if ($id) { $vk = ORM::factory('Vk', $id); $this->set('vk', $vk); } else { } if ($this->request->method() == 'POST') { $title = Security::xss_clean(Arr::get($_POST, 'title', '')); try { $vk = ORM::factory('vk', $id); $vk->id_kt = $ent_id; $vk->title = $title; $vk->published = 1; $vk->date = date("Y-m-d H:i:s"); $vk->save(); $event = $id ? 'edit' : 'create'; $loger = new Loger($event, $vk->title); $loger->log($vk); $this->redirect('manage/tests/addvar/' . $ent_id); } catch (ORM_Validation_Exception $e) { $errors = $e->errors($e->alias()); $this->set('errors', $errors); } } }
public function action_delete() { $id = (int) $this->request->param('id', 0); $book = ORM::factory('Book', $id); if (!$book->loaded()) { throw new HTTP_Exception_404(); } $token = Arr::get($_POST, 'token', false); if ($this->request->method() == Request::POST && Security::token() === $token) { $loger = new Loger('delete', $book->title); $loger->log($book); $book->delete(); Message::success(I18n::get('Record deleted')); $this->redirect('manage/library'); } else { $this->set('record', $book)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/library')); } }
public function action_delete() { $id = (int) $this->request->param('id', 0); $video = ORM::factory('Video', $id); if (!$video->loaded()) { throw new HTTP_Exception_404(); } $category = 0; if ($video->category_id) { $category = $video->category; } $token = Arr::get($_POST, 'token', false); if ($this->request->method() == Request::POST && Security::token() === $token) { $loger = new Loger('delete', $video->title); $loger->log($video); $video->delete(); Message::success('Запись удалена'); $this->redirect('manage/video/category/' . $category); } else { $this->set('record', $video)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/video/category/' . $category))->set('category', $category); } }
public function action_edit() { $id = (int) $this->request->param('id', 0); if ($id) { $ent = ORM::factory('Test_variant', $id); $this->set('ent', $ent); } else { } if ($this->request->method() == 'POST') { $title = Security::xss_clean(Arr::get($_POST, 'title', '')); try { $ent = ORM::factory('Test_variant', $id); $ent->title = $title; $ent->date = date("Y-m-d H:i:s"); $ent->save(); $event = $id ? 'edit' : 'create'; $loger = new Loger($event, $ent->title); $loger->log($ent); $this->redirect('manage/tests/'); } catch (ORM_Validation_Exception $e) { $errors = $e->errors($e->alias()); $this->set('errors', $errors); } } }
public function action_delete() { $id = (int) $this->request->param('id', 0); $photoset = ORM::factory('Photoset', $id); if (!$photoset->loaded()) { throw new HTTP_Exception_404(); } $token = Arr::get($_POST, 'token', false); if ($this->request->method() == Request::POST && Security::token() === $token) { $attachments = $photoset->attach->find_all(); foreach ($attachments as $attach) { ORM::factory('Photosets_Attachment', $attach->id)->delete(); } $loger = new Loger('delete', $photoset->name ? $photoset->name : 'без навания'); $loger->log($photoset); $photoset->delete(); Message::success('Фотоальбом удален'); $this->redirect('manage/photosets'); } else { $this->set('record', $photoset)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/photosets')); } }