Postpone remote folder import until filesystem mirroring matures.
This commit is contained in:
parent
0edf248cd1
commit
ff2f599142
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2270,7 +2270,11 @@ function website_import_tools() {
|
||||
'$import_label' => t('Import website...'),
|
||||
'$import_placeholder' => t('Select folder to import'),
|
||||
'$file_upload_text' => t('Import from a zipped folder:'),
|
||||
'$file_import_text' => t('Import from cloud files:')
|
||||
'$file_import_text' => t('Import from cloud files:'),
|
||||
'$file_remote_text' => t('Import from another channel'),
|
||||
'$desc' => t('https://example.com/cloud/peter/sharedfolder'),
|
||||
'$hint' => t('https://example.com/cloud/peter/sharedfolder'),
|
||||
'$follow' => t('Import'),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,24 @@
|
||||
<a href="#" onclick="openClose('import-form'); return false;"><i class="fa fa-cloud-upload generic-icons"></i> {{$import_label}}</a>
|
||||
</li>
|
||||
<form id="import-form" enctype="multipart/form-data" method="post" action="" style="display: none;" class="sub-menu">
|
||||
<p class="descriptive-text">{{$file_import_text}}</p>
|
||||
<div class="form-group">
|
||||
<!--
|
||||
<p class="descriptive-text">{{$file_import_text}}</p>
|
||||
<div class="form-group">
|
||||
<select id="import" name="target" class="form-control">
|
||||
<option value="">{{$import_placeholder}}</option>
|
||||
<!-- Loop through folders here -->
|
||||
</select>
|
||||
</div>
|
||||
-->
|
||||
<!-- Or download from another channel cloud files -->
|
||||
<p class="descriptive-text">{{$file_remote_text}}</p>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input class="widget-input" type="text" name="url" title="{{$hint}}" placeholder="{{$desc}}" />
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default btn-sm" type="submit" name="remotesubmit" value="{{$follow}}"><i class="fa fa-cloud-download generic-icons"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Or upload a zipped file containing the website -->
|
||||
<p class="descriptive-text">{{$file_upload_text}}</p>
|
||||
<div class="form-group">
|
||||
|
Reference in New Issue
Block a user