public function delete_file($do, $fileid = 0) { $data = $this->data; $child_name = 'postfile'; //管理分類類別名稱 if (!empty($fileid)) { $FileObj = new FileObj(['fileid_Num' => $fileid]); $FileObj->delete(); return TRUE; } else { return FALSE; } }
public function set_recovery_post() { $FileList = new ObjList(['db_where_Arr' => ['status' => -1], 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'FileObj', 'limitstart_Num' => 0, 'limitcount_Num' => 100]); foreach ($FileList->obj_Arr as $key => $value_file) { $FileObj = new FileObj(['fileid_Num' => $value_file->fileid_Num]); $FileObj->recovery(); } if (!empty($FileList->obj_Arr)) { $this->load->model('Message'); $this->Message->show(array('message' => '復原成功', 'url' => 'admin/base/file/set/set')); } else { $this->load->model('Message'); $this->Message->show(array('message' => '已無可復原的項目', 'url' => 'admin/base/file/set/set')); } }
public function delete() { $hash_Str = $this->input->get('hash'); $fileid_Num = $this->input->get('fileid'); $fileid_Arr = $this->input->post('fileid_Arr[]'); if (empty($fileid_Arr) && empty($fileid_Num)) { $this->load->model('Message'); $this->Message->show(array('message' => '未選擇要刪除的檔案', 'url' => 'admin/base/file/file/tablelist')); } //CSRF過濾 if ($hash_Str == $this->security->get_csrf_hash()) { if (!empty($fileid_Num)) { $FileObj = new FileObj(['fileid_Num' => $fileid_Num]); $FileObj->delete(); } if (!empty($fileid_Arr)) { foreach ($fileid_Arr as $key => $value_file) { $FileObj = new FileObj(['fileid_Num' => $value_file]); $FileObj->delete(); } } $this->load->model('Message'); $this->Message->show(array('message' => '刪除成功', 'url' => 'admin/base/file/file/tablelist')); } else { $this->load->model('Message'); $this->Message->show(array('message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/base/file/file/tablelist')); } }