public function upload() { $this->set_title('Upload'); $this->deleted_posts = FlaggedPostDetail::new_deleted_posts(current_user()); # if $this->params()->url # $this->post = Post.find(:first, 'conditions' => ["source = ?", $this->params()->url]) # end $this->default_rating = CONFIG()->default_rating_upload ?: "q"; if (empty($this->post)) { $this->post = new Post(); } }
public function set_flag_detail($reason, $creator_id) { if ($this->flag_detail) { $this->flag_detail->updateAttributes(array('reason' => $reason, 'user_id' => $creator_id, 'created_at' => date('Y-m-d H:i:s'))); } else { FlaggedPostDetail::create(array('post_id' => $this->id, 'reason' => $reason, 'user_id' => $creator_id, 'is_resolved' => false)); } }