Postpone remote folder import until filesystem mirroring matures.

This commit is contained in:
Andrew Manning
2016-07-16 19:25:44 -04:00
parent 0edf248cd1
commit ff2f599142
3 changed files with 55 additions and 6 deletions

View File

@@ -211,7 +211,7 @@ class Webpages extends \Zotlabs\Web\Controller {
function post() {
if(($_FILES) && array_key_exists('zip_file',$_FILES)) {
if(($_FILES) && array_key_exists('zip_file',$_FILES) && isset($_POST['w_upload'])) {
$source = $_FILES["zip_file"]["tmp_name"];
$type = $_FILES["zip_file"]["type"];
$okay = false;
@@ -256,7 +256,41 @@ class Webpages extends \Zotlabs\Web\Controller {
if($elements) {
rrmdir($website); // Delete the temporary decompressed files
}
}
}
return null;
}
if (($_POST) && array_key_exists('url',$_POST) && isset($_POST['remotesubmit'])) {
$ret = [];
// Warning: Do not edit the following line. The first symbol is UTF-8 @
$url = str_replace('@','@',notags(trim($_REQUEST['url'])));
if(! allowed_url($url)) {
$ret['message'] = t('Channel is blocked on this site.');
return null;
}
$h = @parse_url($url);
if(! $h || !x($h, 'host') || !x($h, 'path')) {
return null;
}
if(substr($h['path'],-1,1) === '/') {
$h['path'] = substr($h['path'],0,-1);
}
if(substr($h['path'],0,1) === '/') {
$h['path'] = substr($h['path'],1);
}
$folders = explode('/', $h['path']);
if(!(array_shift($folders) === 'cloud')) {
return null;
}
$nick = array_shift($folders);
if(!$nick) {
return null;
}
return null;
}
}