diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/chanman.php | 29 | ||||
-rw-r--r-- | mod/filestorage.php | 70 | ||||
-rw-r--r-- | mod/import.php | 4 |
3 files changed, 103 insertions, 0 deletions
diff --git a/mod/chanman.php b/mod/chanman.php new file mode 100644 index 000000000..2657e7be9 --- /dev/null +++ b/mod/chanman.php @@ -0,0 +1,29 @@ +<?php /** @file */ + + +/** + Placeholder file at present. This is going to involve a bit of work. + + This file will deal with the deletion of channels and management of hublocs. + + We need to provide the following functionality: + + - Delete my account and all channels from the entire network + + - Delete my account and all channels from this server + + - Delete a channel from the entire network + + - Delete a channel from this server + + - List all hub locations for this channel + + - Remove this/some hub location from this channel + + - promote this/some hub location to primary + + - Remove hub location 'xyz' from this channel, (this should possibly only be allowed if that hub has been down for a period of time) + + - Some of these actions should probably require email verification + +*/ diff --git a/mod/filestorage.php b/mod/filestorage.php new file mode 100644 index 000000000..41055f98e --- /dev/null +++ b/mod/filestorage.php @@ -0,0 +1,70 @@ +<?php + +function filestorage_content(&$a) { + + if(argc() > 1) + $which = argv(1); + else { + notice( t('Requested profile is not available.') . EOL ); + $a->error = 404; + return; + } + + $r = q("select channel_id from channel where channel_address = '%s'", + dbesc($which) + ); + if($r) { + $owner = intval($r[0]['channel_id']); + } + + $is_owner = (((local_user()) && ($owner == local_user())) ? true : false); + if (! $is_owner) { + info( t('Permission Denied.') . EOL ); + return; + } + if ((argc() > 3 && argv(3) === 'delete') ? true : false);{ + $file = argv(2); + $r = q("delete from attach where id = '%s' and uid = '%s' limit 1", + dbesc($file), + intval($owner) + ); + + + } + + +$r = q("select * from attach where uid = %d order by filename asc", + intval($owner) +); + + $files = null; + + if($r) { + $files = array(); + foreach($r as $rr) { + $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) + ); + $used = $r[0]['total']; + + $url = z_root() . "/filestorage/" . $which; + return $o . replace_macros(get_markup_template("filestorage.tpl"), array( + '$baseurl' => $url, + '$download' => t('Download'), + '$files' => $files, + '$channel' => $which, + '$delete' => t('Delete'), + '$used' => $used, + '$usedlabel' => t('Used: '), + '$limit' => $limit, + '$limitlabel' => t('Limit: '), + )); + + +} diff --git a/mod/import.php b/mod/import.php index 08311013a..e2e54c0cd 100644 --- a/mod/import.php +++ b/mod/import.php @@ -347,6 +347,10 @@ function import_post(&$a) { } + // This will indirectly perform a refresh_all *and* update the directory + + proc_run('php', 'include/directory.php', $channel['channel_id']); + // send out refresh requests notice( t('Import completed.') . EOL); |