aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-07-16 19:25:44 -0400
committerAndrew Manning <tamanning@zoho.com>2016-07-16 19:25:44 -0400
commitff2f599142348162b6459a02aa014c7dbca84f76 (patch)
tree2a83c061a614e7af65cb8120489b62df5e75e63c
parent0edf248cd1f49cb7e4b44744629355e9e165ce64 (diff)
downloadvolse-hubzilla-ff2f599142348162b6459a02aa014c7dbca84f76.tar.gz
volse-hubzilla-ff2f599142348162b6459a02aa014c7dbca84f76.tar.bz2
volse-hubzilla-ff2f599142348162b6459a02aa014c7dbca84f76.zip
Postpone remote folder import until filesystem mirroring matures.
-rw-r--r--Zotlabs/Module/Webpages.php38
-rw-r--r--include/text.php6
-rw-r--r--view/tpl/website_import_tools.tpl17
3 files changed, 55 insertions, 6 deletions
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php
index 766b4fc09..16ecb5386 100644
--- a/Zotlabs/Module/Webpages.php
+++ b/Zotlabs/Module/Webpages.php
@@ -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 &#65312;
+ $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;
+
}
}
diff --git a/include/text.php b/include/text.php
index 096c8a5aa..a0f0ed7ae 100644
--- a/include/text.php
+++ b/include/text.php
@@ -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'),
));
}
diff --git a/view/tpl/website_import_tools.tpl b/view/tpl/website_import_tools.tpl
index ca9cc8b33..d4360f634 100644
--- a/view/tpl/website_import_tools.tpl
+++ b/view/tpl/website_import_tools.tpl
@@ -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">