"post", "only" => array("create", "update", "destroy"), "redirect_to" => ADMIN_ROOT_URL, ), ); static $filter_parameter_logging = array("preview_text"); public function destroy() { $this->episode = Episode::find_by_episode($this->params["id"]); $this->episode->delete(); $this->add_flash_success("Successfully deleted episode " . h($this->episode->episode)); return $this->redirect_to(ADMIN_ROOT_URL); } public function index() { $this->episodes = Episode::find("all", array("order" => "episode DESC")); } public function build() { $this->episode = new Episode; $this->episode->episode = Episode::next_episode(); $this->episode->is_pending = true; $this->episode->air_date = new DateTime(date("Y-m-d 20:00:00")); $this->page_title = "Create New Episode"; } public function create() { $this->episode = new Episode($this->params["episode"]); if ($_FILES["episode"]["name"]["new_mp3"]) $this->episode->take_new_mp3($_FILES["episode"]["tmp_name"]["new_mp3"]); if ($this->episode->save()) { $this->add_flash_success("Successfully created episode " . $this->episode->episode); return $this->redirect_to(ADMIN_ROOT_URL); } else { return $this->render(array("action" => "build")); } } public function edit() { $this->episode = Episode::find_by_episode($this->params["id"]); } public function preview() { $this->episode = Episode::find_by_episode($this->params["id"]); if (!$this->episode) throw new \ActiveRecord\RecordNotFound("can't find episode " . $this->params["id"]); $this->next_episode = Episode::find_by_episode_and_is_pending( $this->episode->episode + 1, false); if ($this->episode->episode > 0) $this->prev_episode = Episode::find_by_episode( $this->episode->episode - 1); $this->page_title = $this->episode->episode . ": " . $this->episode->title; return $this->render(array("html" => "