From 035449e4a3f243dcaa43c34259d489c31d9c7ebf Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 17 Aug 2017 23:43:54 -0700 Subject: util/dcp "(DAV-copy) copy file from local system to Hubzilla/red DAV" --- util/dcp | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 util/dcp diff --git a/util/dcp b/util/dcp new file mode 100755 index 000000000..86c25259f --- /dev/null +++ b/util/dcp @@ -0,0 +1,73 @@ +#!/usr/bin/env php +' . PHP_EOL; + exit(1); +} + +require_once('include/cli_startup.php'); +require_once('include/attach.php'); + +cli_startup(); + +$srcfile = $argv[1]; +$dstfile = $argv[2]; + +if($argc != 3) { + echo "Usage: " . $argv[0] . ' source destination' . "\n"; + echo 'Always run from the toplevel web directory.' . "\n"; + echo 'destination should begin with store/$nickname/desired/path/filename or $nickname/desired/path/filename' . "\n"; + echo 'destination must end with the destination filename (not a directory name).' . "\n"; + echo 'Example: util/dcp /etc/motd store/joe/etc/motd' . "\n"; + exit; +} + + + + if(strpos($dstfile,'store/') === 0) + $dstfile = substr($dstfile,6); + + $nick = substr($dstfile,0,strpos($dstfile,'/')); + + $dstfile = substr($dstfile,strlen($nick)+1); + + $channel = channelx_by_nick($nick); + if(! $channel) + return; + + + $arr = [ + 'pathname' => dirname($dstfile), + 'allow_cid' => $channel['channel_allow_cid'], + 'allow_gid' => $channel['channel_allow_gid'], + 'deny_cid' => $channel['channel_deny_cid'], + 'deny_gid' => $channel['channel_deny_gid'], + ]; + + $folder = ''; + if(dirname($dstfile)) { + $x = attach_mkdirp($channel,$channel['channel_hash'],$arr); + if($x['success']) + $folder = $x['data']['hash']; + } + + $arr = [ + 'src' => $srcfile, + 'filename' => basename($srcfile), + 'hash' => random_string(), + 'allow_cid' => $channel['channel_allow_cid'], + 'allow_gid' => $channel['channel_allow_gid'], + 'deny_cid' => $channel['channel_deny_cid'], + 'deny_gid' => $channel['channel_deny_gid'], + 'preserve_original' => true, + ]; + + if($folder) + $arr['folder'] = $folder; + + attach_store($channel,$channel['channel_hash'],'import',$arr); + + -- cgit v1.2.3 From 4111ba8dee5562bb3314e72e05ba01de152cecc2 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 18 Aug 2017 03:04:15 -0700 Subject: php warnings --- include/network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/network.php b/include/network.php index 4ea619bf5..96cea4b6f 100644 --- a/include/network.php +++ b/include/network.php @@ -1291,7 +1291,7 @@ function fetch_xrd_links($url) { return array(); $h = parse_xml_string($xml); - if(! $h) + if($h === false) return array(); $arr = convert_xml_element_to_array($h); -- cgit v1.2.3 From 944cd883bbdb8d87d941238eef63d7f15922f2ab Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 19 Aug 2017 01:08:24 -0700 Subject: script html tags in js file --- view/js/mod_display.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/view/js/mod_display.js b/view/js/mod_display.js index 60a1cdaa8..7e24a7f86 100644 --- a/view/js/mod_display.js +++ b/view/js/mod_display.js @@ -1,7 +1,5 @@ - -- cgit v1.2.3 From b4880343524aab6b4583c6815d94a5dfe61dd042 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 19 Aug 2017 01:37:22 -0700 Subject: better error reporting on mod_display --- Zotlabs/Module/Display.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 81c72adb3..b054d9edf 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -324,12 +324,8 @@ class Display extends \Zotlabs\Web\Controller { } $o .= '
'; - - return $o; - - - /* - elseif((! $update) && (! { + + if((! $update) && (! $items)) { $r = q("SELECT id, item_flags FROM item WHERE id = '%s' OR mid = '%s' LIMIT 1", dbesc($item_hash), @@ -348,7 +344,9 @@ class Display extends \Zotlabs\Web\Controller { } } - */ + + return $o; + } -- cgit v1.2.3