public function filedepot::deleteSubmission in filedepot 6
Same name and namespace in other branches
- 7 filedepot.class.php \filedepot::deleteSubmission()
File
- ./
filedepot.class.php, line 737 - filedepot.class.php Main class for the Filedepot module
Class
- filedepot
- @file filedepot.class.php Main class for the Filedepot module
Code
public function deleteSubmission($id) {
$query = db_query("SELECT cid,cckfid,tempname,fname,notify FROM {filedepot_filesubmissions} WHERE id=%d", $id);
list($cid, $cckfid, $tempname, $fname, $notify) = array_values(db_fetch_array($query));
if (!empty($tempname) and file_exists("{$this->root_storage_path}{$cid}/submissions/{$tempname}")) {
@unlink("{$this->root_storage_path}{$cid}/submissions/{$tempname}");
// Send out notification of submission being deleted to user - before we delete the record as it's needed to create notification message
if ($notify == 1) {
filedepot_sendNotification($id, FILEDEPOT_NOTIFY_REJECT);
}
db_query("DELETE FROM {filedepot_filesubmissions} WHERE id=%d", $id);
// Remove the CCK records for this attachment (file)
$this
->deleteNodeCCKField($cid, $cckfid);
return TRUE;
}
else {
return FALSE;
}
}