function save($id = false) { if ($_POST) { $rs = new Talk($id); if ($_FILES['image']['name']) { if ($rs->id) { $rs->delete_file($rs->id, 'uploads/talks', 'image'); } $_POST['image'] = $rs->upload($_FILES['image'], 'uploads/talks/'); } // if(!$id)$_POST['user_id'] = $this->session->userdata('id'); $_POST['title'] = lang_encode($_POST['title']); $_POST['detail'] = lang_encode($_POST['detail']); $_POST['alt'] = lang_encode($_POST['alt']); // $_POST['meta_keyword'] = lang_encode($_POST['meta_keyword']); // $_POST['meta_description'] = lang_encode($_POST['meta_description']); if (!$id) { $_POST['status'] = "approve"; } $_POST['slug'] = clean_url($_POST['title']); $rs->from_array($_POST); $rs->save(); set_notify('success', lang('save_data_complete')); } redirect($_POST['referer']); }