cleanup mod/filestorage before embarking on further changes to it
This commit is contained in:
parent
323fc1f9a5
commit
e20fef3903
@ -28,7 +28,7 @@ function filestorage_content(&$a) {
|
||||
}
|
||||
|
||||
// Since we have ACL'd files in the wild, but don't have ACL here yet, we
|
||||
// need to return for anoyne other than the owner, despite the perms check for now.
|
||||
// need to return for anyone other than the owner, despite the perms check for now.
|
||||
|
||||
$is_owner = (((local_user()) && ($owner == local_user())) ? true : false);
|
||||
if(! $is_owner) {
|
||||
@ -37,23 +37,23 @@ function filestorage_content(&$a) {
|
||||
}
|
||||
|
||||
// TODO This will also need to check for files on disk and delete them from there as well as the DB.
|
||||
if ((argc() > 3 && argv(3) === 'delete') ? true : false);{
|
||||
|
||||
if(argc() > 3 && argv(3) === 'delete') {
|
||||
if(! $perms['write_storage']) {
|
||||
notice( t('Permission denied. VS.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$file = argv(2);
|
||||
$r = q("delete from attach where id = '%s' and uid = '%s' limit 1",
|
||||
$file = intval(argv(2));
|
||||
$r = q("delete from attach where id = %d and uid = %d limit 1",
|
||||
dbesc($file),
|
||||
intval($owner)
|
||||
);
|
||||
|
||||
|
||||
goaway(z_root() . '/filestorage' . $which);
|
||||
}
|
||||
|
||||
|
||||
$r = q("select * from attach where uid = %d order by filename asc",
|
||||
$r = q("select * from attach where uid = %d order by edited desc",
|
||||
intval($owner)
|
||||
);
|
||||
|
||||
@ -62,11 +62,15 @@ $r = q("select * from attach where uid = %d order by filename asc",
|
||||
if($r) {
|
||||
$files = array();
|
||||
foreach($r as $rr) {
|
||||
$files[$rr['id']][] = array('id' => $rr['id'],'download' => $rr['hash'], 'title' => $rr['filename'], 'size' => $rr['filesize']);
|
||||
$files[$rr['id']][] = array(
|
||||
'id' => $rr['id'],
|
||||
'download' => $rr['hash'],
|
||||
'title' => $rr['filename'],
|
||||
'size' => $rr['filesize']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$limit = service_class_fetch ($owner,'attach_upload_limit');
|
||||
$r = q("select sum(filesize) as total from attach where uid = %d ",
|
||||
intval($owner)
|
||||
@ -86,5 +90,4 @@ $r = q("select * from attach where uid = %d order by filename asc",
|
||||
'$limitlabel' => t('Limit: '),
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user