예제 #1
0
 function save($id = FALSE)
 {
     if ($_POST) {
         $information = new Information($id);
         $_POST['title'] = lang_encode($_POST['title']);
         $_POST['intro'] = lang_encode($_POST['intro']);
         $_POST['detail'] = lang_encode($_POST['detail']);
         if (!$id) {
             $_POST['user_id'] = $this->session->userdata('id');
         }
         if ($_FILES['image']['name']) {
             if ($id) {
                 $information->delete_file('uploads/information/thumbnail', 'image');
             }
             $information->image = $information->upload($_FILES['image'], 'uploads/information/thumbnail', 77, 64);
         }
         $information->from_array($_POST);
         $information->save();
         set_notify('success', lang('save_data_complete'));
     }
     redirect($_POST['referer']);
 }
예제 #2
0
 function save($id = false)
 {
     if ($_POST) {
         $rs = new Information($id);
         if ($_FILES['image']['name']) {
             if ($rs->id) {
                 $rs->delete_file($rs->id, 'uploads/talks', 'image');
             }
             $_POST['image'] = $rs->upload($_FILES['image'], 'uploads/talks/', 139, 96);
         }
         // if(!$id)$_POST['user_id'] = $this->session->userdata('id');
         $_POST['title'] = lang_encode($_POST['title']);
         $_POST['detail'] = lang_encode($_POST['detail']);
         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']);
 }