function comment_upload_save in Comment Upload 6
Save the changes made to attachments.
Parameters
array $comment:
1 call to comment_upload_save()
- comment_upload_comment in ./
comment_upload.module - Implementation of hook_comment().
File
- ./
comment_upload.module, line 409 - Provides file attachment functionality for comments.
Code
function comment_upload_save($comment) {
if (!user_access('upload files to comments')) {
return;
}
if (!isset($comment['files']) || !is_array($comment['files'])) {
return;
}
foreach ($comment['files'] as $fid => $file) {
if (!empty($file['remove'])) {
comment_upload_delete_file($file);
}
if (!empty($file['new'])) {
db_query("INSERT INTO {comment_upload} (fid, cid, nid, list, description, weight) VALUES (%d, %d, %d, %d, '%s', %d)", $fid, $comment['cid'], $comment['nid'], $file['list'], $file['description'], $file['weight']);
$file = (object) $file;
file_set_status($file, FILE_STATUS_PERMANENT);
}
else {
db_query("UPDATE {comment_upload} SET list = %d, description = '%s', weight = %d WHERE fid = %d", $file['list'], $file['description'], $file['weight'], $fid);
}
}
}