From 894f0156afdb605883af4c3419ead4aec09617da Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 21 Aug 2017 15:00:45 -0700 Subject: more work on oembed from /display --- Zotlabs/Module/Display.php | 8 +++++--- Zotlabs/Module/Linkinfo.php | 2 +- Zotlabs/Module/Oep.php | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index d82ff2a55..5e03f91a9 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -174,6 +174,8 @@ class Display extends \Zotlabs\Web\Controller { '$verb' => '', '$mid' => $item_hash )); + + \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; } @@ -218,13 +220,13 @@ class Display extends \Zotlabs\Web\Controller { if(! perm_is_allowed($sysid,$observer_hash,'view_stream')) $sysid = 0; - +dbg(1); $r = q("SELECT item.id as item_id from item WHERE mid = '%s' AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item_private = 0 ) - and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) + and uid in ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) OR uid = %d ) $sql_extra ) $item_normal @@ -232,7 +234,7 @@ class Display extends \Zotlabs\Web\Controller { dbesc($target_item['parent_mid']), intval($sysid) ); - +dbg(0); } } } diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index 8f8231c49..78c34583e 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -95,7 +95,7 @@ class Linkinfo extends \Zotlabs\Web\Controller { echo $arr['text']; killme(); } - + if($process_oembed) { $x = oembed_process($url); if($x) { diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php index a3453ff31..6469a7007 100644 --- a/Zotlabs/Module/Oep.php +++ b/Zotlabs/Module/Oep.php @@ -66,9 +66,9 @@ class Oep extends \Zotlabs\Web\Controller { $url = $args['url']; $maxwidth = intval($args['maxwidth']); $maxheight = intval($args['maxheight']); - - if(preg_match('#//display/(.*?)(&|\?|$)#',$url,$matches)) { - $res = $matches[1]; + logger('processing display'); + if(preg_match('#//(.*?)/display/(.*?)(&|\?|$)#',$url,$matches)) { + $res = $matches[2]; } if(strpos($res,'b64.') === 0) { @@ -78,7 +78,7 @@ class Oep extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $p = q("select * from item where mid like '%s' limit 1", - dbesc($res . '%'), + dbesc($res . '%') ); if(! $p) -- cgit v1.2.3 From 33528c616ae976891df7a778ce9360ceb56571f4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 21 Aug 2017 18:52:22 -0700 Subject: remove debugging --- Zotlabs/Module/Display.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 5e03f91a9..1077cbdb9 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -39,7 +39,7 @@ class Display extends \Zotlabs\Web\Controller { $observer_is_owner = false; $updateable = false; - + if(local_channel() && (! $update)) { $channel = \App::get_channel(); @@ -216,11 +216,11 @@ class Display extends \Zotlabs\Web\Controller { if($r === null) { // in case somebody turned off public access to sys channel content using permissions - // make that content unsearchable by ensuring the owner_xchan can't match + // make that content unsearchable by ensuring the owner uid can't match if(! perm_is_allowed($sysid,$observer_hash,'view_stream')) $sysid = 0; -dbg(1); + $r = q("SELECT item.id as item_id from item WHERE mid = '%s' @@ -234,7 +234,7 @@ dbg(1); dbesc($target_item['parent_mid']), intval($sysid) ); -dbg(0); + } } } -- cgit v1.2.3 From 9f37dbc6dc1798b9b56a683ed1975adc318ff931 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 22 Aug 2017 18:29:51 -0700 Subject: util/dcp - support recursion and folders full of photos by importing files singly in separate processes - not yet tested --- Zotlabs/Daemon/Importfile.php | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Zotlabs/Daemon/Importfile.php (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Importfile.php b/Zotlabs/Daemon/Importfile.php new file mode 100644 index 000000000..5f15b811d --- /dev/null +++ b/Zotlabs/Daemon/Importfile.php @@ -0,0 +1,45 @@ + 3) ? $argv[3] : ''); + $dstname = (($argc > 4) ? $argv[4] : ''); + + $hash = random_string(); + + $arr = [ + 'src' => $srcfile, + 'filename' => (($dstname) ? $dstname : basename($srcfile)), + 'hash' => $hash, + '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, + 'replace' => true + ]; + + if($folder) + $arr['folder'] = $folder; + + attach_store($channel,$channel['channel_hash'],'import',$arr); + + $sync = attach_export_data($channel,$hash); + if($sync) + build_sync_packet($channel['channel_id'],array('file' => array($sync))); + + return; + } +} -- cgit v1.2.3 From 182f94a9ac8cfcd414d6f5899fbeb7a8e65284da Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 22 Aug 2017 19:41:16 -0700 Subject: allow cards to federate --- Zotlabs/Daemon/Notifier.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 6763e0ef4..33dcbbf20 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -276,7 +276,7 @@ class Notifier { $deleted_item = true; } - if(intval($target_item['item_type']) != ITEM_TYPE_POST) { + if(! in_array(intval($target_item['item_type']), [ ITEM_TYPE_POST, ITEM_TYPE_CARD ] )) { logger('notifier: target item not forwardable: type ' . $target_item['item_type'], LOGGER_DEBUG); return; } -- cgit v1.2.3 From 41ff8fdd375fcf395b547dd02f3bdcbb198ec0c1 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 22 Aug 2017 20:32:02 -0700 Subject: test recursive dav copy --- Zotlabs/Daemon/Importfile.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Importfile.php b/Zotlabs/Daemon/Importfile.php index 5f15b811d..c68ed21cf 100644 --- a/Zotlabs/Daemon/Importfile.php +++ b/Zotlabs/Daemon/Importfile.php @@ -6,6 +6,8 @@ class Importfile { static public function run($argc,$argv){ + logger('Importfile: ' . print_r($argv,true)); + if($argc < 3) return; -- cgit v1.2.3 From e084b776eee9f1fc66e3f4a37b92ec70ccc49286 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 00:01:02 -0700 Subject: cards feature --- Zotlabs/Daemon/Notifier.php | 2 +- Zotlabs/Lib/Apps.php | 1 + Zotlabs/Module/Cards.php | 189 ++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Widget/Categories.php | 13 ++- 4 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 Zotlabs/Module/Cards.php (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 33dcbbf20..e8cd4dac8 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -276,7 +276,7 @@ class Notifier { $deleted_item = true; } - if(! in_array(intval($target_item['item_type']), [ ITEM_TYPE_POST, ITEM_TYPE_CARD ] )) { + if(! in_array(intval($target_item['item_type']), [ ITEM_TYPE_POST ] )) { logger('notifier: target item not forwardable: type ' . $target_item['item_type'], LOGGER_DEBUG); return; } diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 3730f3a23..37cbf9497 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -221,6 +221,7 @@ class Apps { static public function translate_system_apps(&$arr) { $apps = array( 'Apps' => t('Apps'), + 'Cards' => t('Cards'), 'Site Admin' => t('Site Admin'), 'Report Bug' => t('Report Bug'), 'View Bookmarks' => t('View Bookmarks'), diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php new file mode 100644 index 000000000..1fdd3b63f --- /dev/null +++ b/Zotlabs/Module/Cards.php @@ -0,0 +1,189 @@ + 1) + $which = argv(1); + else + return; + + profile_load($which); + + } + + + function get() { + + if(observer_prohibited(true)) { + return login(); + } + + if(! \App::$profile) { + notice( t('Requested profile is not available.') . EOL ); + \App::$error = 404; + return; + } + + if(! feature_enabled(\App::$profile_uid,'cards')) { + return; + } + + nav_set_selected(t('Cards')); + + $category = (($_REQUEST['cat']) ? escape_tags(trim($_REQUEST['cat'])) : ''); + + if($category) { + $sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'],'item', $category, TERM_CATEGORY)); + } + + + $which = argv(1); + + $_SESSION['return_url'] = \App::$query_string; + + $uid = \App::$profile_uid; + $owner = 0; + $observer = \App::get_observer(); + + $channel = \App::$profile; + + if(! $owner) { + // Figure out who the page owner is. + $r = q("select channel_id from channel where channel_address = '%s'", + dbesc($which) + ); + if($r) { + $owner = intval($r[0]['channel_id']); + } + } + + $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); + + if(! perm_is_allowed($owner,$ob_hash,'view_pages')) { + notice( t('Permission denied.') . EOL); + return; + } + + $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype')); + + $layout = (($_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout')); + + // Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages + // Nickname is set to the observers xchan, and profile_uid to the owner's. + // This lets you post pages at other people's channels. + + if((! $channel) && ($uid) && ($uid == \App::$profile_uid)) { + $channel = \App::get_channel(); + } + if($channel) { + $channel_acl = array( + 'allow_cid' => $channel['channel_allow_cid'], + 'allow_gid' => $channel['channel_allow_gid'], + 'deny_cid' => $channel['channel_deny_cid'], + 'deny_gid' => $channel['channel_deny_gid'] + ); + } + else { + $channel_acl = [ 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ]; + } + + + $is_owner = ($uid && $uid == $owner); + + if(perm_is_allowed($owner,$ob_hash,'write_pages')) { + + $x = array( + 'webpage' => ITEM_TYPE_CARD, + 'is_owner' => true, + 'nickname' => \App::$profile['channel_address'], + 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'acl' => (($is_owner) ? populate_acl($channel_acl,false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''), + 'permissions' => $channel_acl, + 'showacl' => (($is_owner) ? true : false), + 'visitor' => true, + 'hide_location' => true, + 'hide_voting' => true, + 'profile_uid' => intval($owner), + 'mimetype' => $mimetype, + 'mimeselect' => false, + 'layoutselect' => false, + 'expanded' => false, + 'novoting'=> true, + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true + ); + } + else { + $x = ''; + } + + if($_REQUEST['title']) + $x['title'] = $_REQUEST['title']; + if($_REQUEST['body']) + $x['body'] = $_REQUEST['body']; + + // Get a list of webpages. We can't display all them because endless scroll makes that unusable, + // so just list titles and an edit link. + + + $sql_extra = item_permissions_sql($owner); + + $r = q("select * from item + where item.uid = %d and item_type = %d + $sql_extra order by item.created desc", + intval($owner), + intval(ITEM_TYPE_CARD) + ); + + $item_normal = " and item.item_hidden = 0 and item.item_type in (0,6) and item.item_deleted = 0 + and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 + and item.item_blocked = 0 "; + + + if($x) + $editor = status_editor($a,$x); + + if($r) { + + $parents_str = ids_to_querystr($r,'id'); + + $items = q("SELECT item.*, item.id AS item_id + FROM item + WHERE item.uid = %d $item_normal + AND item.parent IN ( %s ) + $sql_extra $sql_extra2 ", + intval(\App::$profile['profile_uid']), + dbesc($parents_str) + ); + if($items) { + xchan_query($items); + $items = fetch_post_tags($items, true); + $items = conv_sort($items,'created'); + } + else + $items = []; + } + + $mode = 'channel'; + + $content = conversation($items,$mode,false,'traditional'); + + $o = replace_macros(get_markup_template('cards.tpl'), [ + '$title' => t('Cards'), + '$editor' => $editor, + '$content' => $content, + '$pager' => alt_pager($a,count($items)) + ]); + + return $o; + } + +} diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php index d1dcfda93..a11b3d919 100644 --- a/Zotlabs/Widget/Categories.php +++ b/Zotlabs/Widget/Categories.php @@ -8,8 +8,13 @@ class Categories { function widget($arr) { + $cards = ((array_key_exists('cards',$arr) && $arr['cards']) ? true : false); + + if(($cards) && (! feature_enabled(\App::$profile['profile_uid'],'cards')) + return ''; + if((! \App::$profile['profile_uid']) - || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),'view_stream'))) { + || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),(($cards) ? 'view_pages' : 'view_stream')))) { return ''; } @@ -18,6 +23,10 @@ class Categories { $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); - return categories_widget($srchurl, $cat); + if($cards) + return cardcategories_widget($srchurl, $cat); + else + return categories_widget($srchurl, $cat); + } } -- cgit v1.2.3 From 9518dc0e4ee40c9672e533afbb1a506c3a85c598 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 02:03:39 -0700 Subject: typo --- Zotlabs/Widget/Categories.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php index a11b3d919..84deb03d6 100644 --- a/Zotlabs/Widget/Categories.php +++ b/Zotlabs/Widget/Categories.php @@ -10,7 +10,7 @@ class Categories { $cards = ((array_key_exists('cards',$arr) && $arr['cards']) ? true : false); - if(($cards) && (! feature_enabled(\App::$profile['profile_uid'],'cards')) + if(($cards) && (! feature_enabled(\App::$profile['profile_uid'],'cards'))) return ''; if((! \App::$profile['profile_uid']) -- cgit v1.2.3 From 3b68df1be6173cbcc50386efc0161ece2015112d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 17:46:20 -0700 Subject: several card enhancements --- Zotlabs/Lib/ThreadItem.php | 5 +- Zotlabs/Module/Card_edit.php | 135 +++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Module/Cards.php | 54 +++++++---------- 3 files changed, 161 insertions(+), 33 deletions(-) create mode 100644 Zotlabs/Module/Card_edit.php (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index ad944203c..526169e1b 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -101,10 +101,13 @@ class ThreadItem { if($item['author']['xchan_network'] === 'rss') $shareable = true; + $mode = $conv->get_mode(); + $edlink = (($item['item_type'] == ITEM_TYPE_CARD) ? 'card_edit' : 'editpost'); + if(local_channel() && $observer['xchan_hash'] === $item['author_xchan']) - $edpost = array(z_root()."/editpost/".$item['id'], t("Edit")); + $edpost = array(z_root() . '/' . $edlink . '/' . $item['id'], t('Edit')); else $edpost = false; diff --git a/Zotlabs/Module/Card_edit.php b/Zotlabs/Module/Card_edit.php new file mode 100644 index 000000000..216d2cf63 --- /dev/null +++ b/Zotlabs/Module/Card_edit.php @@ -0,0 +1,135 @@ + 1) ? intval(argv(1)) : 0); + + if(! $post_id) { + notice( t('Item not found') . EOL); + return; + } + + $itm = q("SELECT * FROM item WHERE id = %d and item_type = %d LIMIT 1", + intval($post_id), + intval(ITEM_TYPE_CARD) + ); + if($itm) { + $item_id = q("select * from iconfig where cat = 'system' and k = 'CARD' and iid = %d limit 1", + intval($itm[0]['id']) + ); + if($item_id) + $card_title = $item_id[0]['v']; + } + else { + notice( t('Item not found') . EOL); + return; + } + + $owner = $itm[0]['uid']; + $uid = local_channel(); + + $observer = \App::get_observer(); + + $channel = channelx_by_n($owner); + if(! $channel) { + notice( t('Channel not found.') . EOL); + return; + } + + $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); + + if(! perm_is_allowed($owner,$ob_hash,'write_pages')) { + notice( t('Permission denied.') . EOL); + return; + } + + $is_owner = (($uid && $uid == $owner) ? true : false); + + $o = ''; + + + + $category = ''; + $catsenabled = ((feature_enabled($owner,'categories')) ? 'categories' : ''); + + if ($catsenabled){ + $itm = fetch_post_tags($itm); + + $cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY); + + foreach ($cats as $cat) { + if (strlen($category)) + $category .= ', '; + $category .= $cat['term']; + } + } + + if($itm[0]['attach']) { + $j = json_decode($itm[0]['attach'],true); + if($j) { + foreach($j as $jj) { + $itm[0]['body'] .= "\n" . '[attachment]' . basename($jj['href']) . ',' . $jj['revision'] . '[/attachment]' . "\n"; + } + } + } + + + $mimetype = $itm[0]['mimetype']; + + $content = $itm[0]['body']; + + + + $rp = 'cards/' . $channel['channel_address']; + + $x = array( + 'nickname' => $channel['channel_address'], + 'bbco_autocomplete'=> 'bbcode', + 'return_path' => $rp, + 'webpage' => ITEM_TYPE_CARD, + 'button' => t('Edit'), + 'writefiles' => perm_is_allowed($owner, get_observer_hash(), 'write_pages'), + 'weblink' => t('Insert web link'), + 'hide_voting' => false, + 'hide_future' => false, + 'hide_location' => false, + 'hide_expire' => false, + 'showacl' => true, + 'ptyp' => $itm[0]['type'], + 'mimeselect' => false, + 'mimetype' => $itm[0]['mimetype'], + 'body' => undo_post_tagging($content), + 'post_id' => $post_id, + 'visitor' => true, + 'title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'), + 'placeholdertitle' => t('Title (optional)'), + 'pagetitle' => $card_title, + 'profile_uid' => (intval($channel['channel_id'])), + 'catsenabled' => $catsenabled, + 'category' => $category, + 'bbcode' => (($mimetype == 'text/bbcode') ? true : false) + ); + + $editor = status_editor($a, $x); + + $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( + '$title' => t('Edit Block'), + '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), + '$id' => $itm[0]['id'], + '$editor' => $editor + )); + + return $o; + + } + +} diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 1fdd3b63f..1c37ca13d 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -47,24 +47,14 @@ class Cards extends \Zotlabs\Web\Controller { $which = argv(1); + $selected_card = ((argc() > 2) ? argv(2) : ''); + $_SESSION['return_url'] = \App::$query_string; - $uid = \App::$profile_uid; - $owner = 0; + $uid = local_channel(); + $owner = \App::$profile_uid; $observer = \App::get_observer(); - $channel = \App::$profile; - - if(! $owner) { - // Figure out who the page owner is. - $r = q("select channel_id from channel where channel_address = '%s'", - dbesc($which) - ); - if($r) { - $owner = intval($r[0]['channel_id']); - } - } - $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); if(! perm_is_allowed($owner,$ob_hash,'view_pages')) { @@ -76,13 +66,10 @@ class Cards extends \Zotlabs\Web\Controller { $layout = (($_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout')); - // Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages - // Nickname is set to the observers xchan, and profile_uid to the owner's. - // This lets you post pages at other people's channels. + $is_owner = ($uid && $uid == $owner); - if((! $channel) && ($uid) && ($uid == \App::$profile_uid)) { - $channel = \App::get_channel(); - } + $channel = channelx_by_n($owner); + if($channel) { $channel_acl = array( 'allow_cid' => $channel['channel_allow_cid'], @@ -95,28 +82,25 @@ class Cards extends \Zotlabs\Web\Controller { $channel_acl = [ 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ]; } - - $is_owner = ($uid && $uid == $owner); - if(perm_is_allowed($owner,$ob_hash,'write_pages')) { $x = array( 'webpage' => ITEM_TYPE_CARD, 'is_owner' => true, - 'nickname' => \App::$profile['channel_address'], + 'nickname' => $channel['channel_address'], 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'acl' => (($is_owner) ? populate_acl($channel_acl,false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''), 'permissions' => $channel_acl, 'showacl' => (($is_owner) ? true : false), 'visitor' => true, - 'hide_location' => true, - 'hide_voting' => true, + 'hide_location' => false, + 'hide_voting' => false, 'profile_uid' => intval($owner), 'mimetype' => $mimetype, 'mimeselect' => false, 'layoutselect' => false, 'expanded' => false, - 'novoting'=> true, + 'novoting'=> false, 'bbco_autocomplete' => 'bbcode', 'bbcode' => true ); @@ -130,12 +114,18 @@ class Cards extends \Zotlabs\Web\Controller { if($_REQUEST['body']) $x['body'] = $_REQUEST['body']; - // Get a list of webpages. We can't display all them because endless scroll makes that unusable, - // so just list titles and an edit link. - - + $sql_extra = item_permissions_sql($owner); - + + if($selected_card) { + $r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.v = '%s' limit 1", + dbesc($selected_card) + ); + if($r) { + $sql_extra .= "and item.id = " . intval($r[0]['iid']) . " "; + } + } + $r = q("select * from item where item.uid = %d and item_type = %d $sql_extra order by item.created desc", -- cgit v1.2.3 From ecfc7b8f4cc6fbc646e58a2445398341fae5e642 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 18:15:31 -0700 Subject: add category support to main page --- Zotlabs/Module/Cards.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 1c37ca13d..c542cd6ff 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -82,6 +82,8 @@ class Cards extends \Zotlabs\Web\Controller { $channel_acl = [ 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ]; } + + if(perm_is_allowed($owner,$ob_hash,'write_pages')) { $x = array( @@ -101,6 +103,7 @@ class Cards extends \Zotlabs\Web\Controller { 'layoutselect' => false, 'expanded' => false, 'novoting'=> false, + 'catsenabled' => feature_enabled($owner,'categories'), 'bbco_autocomplete' => 'bbcode', 'bbcode' => true ); -- cgit v1.2.3 From 89df4551aa22aa4c9a30221d4b13ae715673d567 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 18:20:12 -0700 Subject: cards: acl support --- Zotlabs/Module/Card_edit.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Card_edit.php b/Zotlabs/Module/Card_edit.php index 216d2cf63..b5b44c567 100644 --- a/Zotlabs/Module/Card_edit.php +++ b/Zotlabs/Module/Card_edit.php @@ -104,6 +104,7 @@ class Card_edit extends \Zotlabs\Web\Controller { 'hide_location' => false, 'hide_expire' => false, 'showacl' => true, + 'acl' => populate_acl($itm[0],false,\Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')), 'ptyp' => $itm[0]['type'], 'mimeselect' => false, 'mimetype' => $itm[0]['mimetype'], -- cgit v1.2.3 From 8873fbfee9a8c0437fa1acdf1588aeb3fd3e7681 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 19:18:44 -0700 Subject: fix permalink for cards --- Zotlabs/Module/Item.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 5e7a3fbc0..797b46f93 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -735,6 +735,10 @@ class Item extends \Zotlabs\Web\Controller { if($parent_item) $parent_mid = $parent_item['mid']; + if($webpage == ITEM_TYPE_CARD && $pagetitle) { + $plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . $pagetitle; + } + // Fallback so that we alway have a thr_parent if(!$thr_parent) -- cgit v1.2.3 From f2e802229acb871e0b50afb729445cdef8586951 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 20:02:28 -0700 Subject: add new conv_sort option --- Zotlabs/Module/Cards.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index c542cd6ff..33688cba0 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -159,7 +159,7 @@ class Cards extends \Zotlabs\Web\Controller { if($items) { xchan_query($items); $items = fetch_post_tags($items, true); - $items = conv_sort($items,'created'); + $items = conv_sort($items,'updated'); } else $items = []; -- cgit v1.2.3 From 66b032823b4fd941f613b0194bb8412b216cc748 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 20:47:08 -0700 Subject: oembed provider cleanup, add oembed to cards --- Zotlabs/Module/Cards.php | 8 ++++ Zotlabs/Module/Channel.php | 7 ++- Zotlabs/Module/Display.php | 9 ++-- Zotlabs/Module/Oep.php | 106 ++++++++++++++++++++++++++++++++++++++++++++- Zotlabs/Module/Photos.php | 9 +++- Zotlabs/Module/Profile.php | 14 +++--- 6 files changed, 139 insertions(+), 14 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 33688cba0..f354544d5 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -38,6 +38,14 @@ class Cards extends \Zotlabs\Web\Controller { nav_set_selected(t('Cards')); + head_add_link([ + 'rel' => 'alternate', + 'type' => 'application/json+oembed', + 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string), + 'title' => 'oembed' + ]); + + $category = (($_REQUEST['cat']) ? escape_tags(trim($_REQUEST['cat'])) : ''); if($category) { diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index c006d65d4..5e7db79d9 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -180,7 +180,12 @@ class Channel extends \Zotlabs\Web\Controller { $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; + head_add_link([ + 'rel' => 'alternate', + 'type' => 'application/json+oembed', + 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string), + 'title' => 'oembed' + ]); if($update && $_SESSION['loadtime']) $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 1077cbdb9..b698513ba 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -175,9 +175,12 @@ class Display extends \Zotlabs\Web\Controller { '$mid' => $item_hash )); - \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; - - + head_add_link([ + 'rel' => 'alternate', + 'type' => 'application/json+oembed', + 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string), + 'title' => 'oembed' + ]); } $observer_hash = get_observer_hash(); diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php index 6469a7007..02aa4aba9 100644 --- a/Zotlabs/Module/Oep.php +++ b/Zotlabs/Module/Oep.php @@ -41,6 +41,8 @@ class Oep extends \Zotlabs\Web\Controller { $arr = $this->oep_profile_reply($_REQUEST); elseif(fnmatch('*/profile/*',$url)) $arr = $this->oep_profile_reply($_REQUEST); + elseif(fnmatch('*/cards/*',$url)) + $arr = $this->oep_cards_reply($_REQUEST); if($arr) { if($html) { @@ -89,7 +91,10 @@ class Oep extends \Zotlabs\Web\Controller { if(! ($c && $res)) return; - + + if(! perm_is_allowed($c[0]['channel_id'],get_observer_hash(),'view_stream')) + return; + $sql_extra = item_permissions_sql($c['channel_id']); $p = q("select * from item where mid like '%s' and uid = %d $sql_extra $item_normal limit 1", @@ -140,6 +145,91 @@ class Oep extends \Zotlabs\Web\Controller { return $ret; } + + + function oep_cards_reply($args) { + + $ret = []; + $url = $args['url']; + $maxwidth = intval($args['maxwidth']); + $maxheight = intval($args['maxheight']); + + if(preg_match('#//(.*?)/cards/(.*?)/(.*?)(&|\?|$)#',$url,$matches)) { + $nick = $matches[2]; + $res = $matches[3]; + } + if(! ($nick && $res)) + return $ret; + + $channel = channelx_by_nick($nick); + + if(! $channel) + return $ret; + + + if(! perm_is_allowed($channel['channel_id'],get_observer_hash(),'view_pages')) + return $ret; + + $sql_extra = items_permissions_sql($channel['channel_id'],get_observer_hash()); + + $r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.v = '%s' limit 1", + dbesc($res) + ); + if($r) { + $sql_extra = "and item.id = " . intval($r[0]['iid']) . " "; + } + else { + return $ret; + } + + $r = q("select * from item + where item.uid = %d and item_type = %d + $sql_extra order by item.created desc", + intval($channel['channel_id']), + intval(ITEM_TYPE_CARD) + ); + + $item_normal = " and item.item_hidden = 0 and item.item_type in (0,6) and item.item_deleted = 0 + and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 + and item.item_blocked = 0 "; + + if($r) { + xchan_query($r); + $p = fetch_post_tags($r, true); + } + + $x = '2eGriplW^*Jmf4'; + + + $o = "[share author='".urlencode($p[0]['author']['xchan_name']). + "' profile='".$p[0]['author']['xchan_url'] . + "' avatar='".$p[0]['author']['xchan_photo_s']. + "' link='".$p[0]['plink']. + "' posted='".$p[0]['created']. + "' message_id='".$p[0]['mid']."']"; + if($p[0]['title']) + $o .= '[b]'.$p[0]['title'].'[/b]'."\r\n"; + + $o .= $x; + $o .= "[/share]"; + $o = bbcode($o); + + $o = str_replace($x,bbcode($p[0]['body']),$o); + + $ret['type'] = 'rich'; + + $w = (($maxwidth) ? $maxwidth : 640); + $h = (($maxheight) ? $maxheight : intval($w * 2 / 3)); + + $ret['html'] = '
' . $o . '
'; + + $ret['width'] = $w; + $ret['height'] = $h; + + return $ret; + + } + function oep_mid_reply($args) { @@ -161,6 +251,9 @@ class Oep extends \Zotlabs\Web\Controller { if(! $c) return; + + if(! perm_is_allowed($c[0]['channel_id'],get_observer_hash(),'view_stream')) + return; $sql_extra = item_permissions_sql($c[0]['channel_id']); @@ -279,6 +372,9 @@ class Oep extends \Zotlabs\Web\Controller { if(! $c) return; + if(! perm_is_allowed($c[0]['channel_id'],get_observer_hash(),'view_files')) + return; + $sql_extra = permissions_sql($c[0]['channel_id']); $p = q("select resource_id from photo where album = '%s' and uid = %d and imgscale = 0 $sql_extra order by created desc limit 1", @@ -340,6 +436,9 @@ class Oep extends \Zotlabs\Web\Controller { if(! $c) return; + if(! perm_is_allowed($c[0]['channel_id'],get_observer_hash(),'view_files')) + return; + $sql_extra = permissions_sql($c[0]['channel_id']); $p = q("select resource_id from photo where uid = %d and imgscale = 0 $sql_extra order by created desc limit 1", @@ -400,7 +499,10 @@ class Oep extends \Zotlabs\Web\Controller { if(! $c) return; - + + if(! perm_is_allowed($c[0]['channel_id'],get_observer_hash(),'view_files')) + return; + $sql_extra = permissions_sql($c[0]['channel_id']); diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 0f80f46a5..bb7079a6a 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -671,8 +671,13 @@ class Photos extends \Zotlabs\Web\Controller { */ if($datatype === 'album') { - - \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; + + head_add_link([ + 'rel' => 'alternate', + 'type' => 'application/json+oembed', + 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string), + 'title' => 'oembed' + ]); if($x = photos_album_exists($owner_uid, get_observer_hash(), $datum)) { \App::set_pager_itemspage(60); diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php index 6930d50ca..43106e3af 100644 --- a/Zotlabs/Module/Profile.php +++ b/Zotlabs/Module/Profile.php @@ -94,7 +94,6 @@ class Profile extends \Zotlabs\Web\Controller { echo \App::$profile['profile_vcard']; killme(); } - $is_owner = ((local_channel()) && (local_channel() == \App::$profile['profile_uid']) ? true : false); @@ -102,11 +101,14 @@ class Profile extends \Zotlabs\Web\Controller { notice( t('Permission denied.') . EOL); return; } - - //$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); - - \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; - + + head_add_link([ + 'rel' => 'alternate', + 'type' => 'application/json+oembed', + 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string), + 'title' => 'oembed' + ]); + $o .= advanced_profile($a); call_hooks('profile_advanced',$o); return $o; -- cgit v1.2.3 From 4450170790de3999dc9c6f8876074e76edee8241 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 21:26:09 -0700 Subject: partial support (unfinished) for ajax loading cards with liveupdate; page still functions even though this isn't finished --- Zotlabs/Module/Cards.php | 5 ++--- Zotlabs/Module/Update_cards.php | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 Zotlabs/Module/Update_cards.php (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index f354544d5..19932769f 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -19,8 +19,7 @@ class Cards extends \Zotlabs\Web\Controller { } - - function get() { + function get($update = 0, $load = false) { if(observer_prohibited(true)) { return login(); @@ -173,7 +172,7 @@ class Cards extends \Zotlabs\Web\Controller { $items = []; } - $mode = 'channel'; + $mode = 'cards'; $content = conversation($items,$mode,false,'traditional'); diff --git a/Zotlabs/Module/Update_cards.php b/Zotlabs/Module/Update_cards.php new file mode 100644 index 000000000..bb87357e8 --- /dev/null +++ b/Zotlabs/Module/Update_cards.php @@ -0,0 +1,39 @@ + 1) && (argv(1) == 'load')) ? 1 : 0); + + header("Content-type: text/html"); + echo "
\r\n"; + + killme(); + + + $mod = new Cards(); + + $text = $mod->get($profile_uid,$load); + + /** + * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well + */ + + echo str_replace("\t",' ',$text); + echo (($_GET['msie'] == 1) ? '' : ''); + echo "\r\n"; + killme(); + +} +} -- cgit v1.2.3 From e157e3bec8722c04ed8dc2d215cd2efd0ce3ce79 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 22:06:42 -0700 Subject: cards: make page load after comment post --- Zotlabs/Lib/ThreadItem.php | 11 ++++++- Zotlabs/Lib/ThreadStream.php | 6 ++++ Zotlabs/Module/Cards.php | 70 +++++++++++++++++++++----------------------- 3 files changed, 49 insertions(+), 38 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 526169e1b..313001cc7 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -29,6 +29,7 @@ class ThreadItem { private $visiting = false; private $channel = null; private $display_mode = 'normal'; + private $reload = ''; public function __construct($data) { @@ -483,6 +484,14 @@ class ThreadItem { return $this->threaded; } + public function set_reload($val) { + $this->reload = $val; + } + + public function get_reload() { + return $this->reload; + } + public function set_commentable($val) { $this->commentable = $val; foreach($this->get_children() as $child) @@ -719,7 +728,7 @@ class ThreadItem { $comment_box = replace_macros($template,array( '$return_path' => '', '$threaded' => $this->is_threaded(), - '$jsreload' => '', //(($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''), + '$jsreload' => $conv->reload, '$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'), '$id' => $this->get_id(), '$parent' => $this->get_id(), diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php index 0465b20ef..d7a898704 100644 --- a/Zotlabs/Lib/ThreadStream.php +++ b/Zotlabs/Lib/ThreadStream.php @@ -22,6 +22,7 @@ class ThreadStream { private $profile_owner = 0; private $preview = false; private $prepared_item = ''; + public $reload = ''; private $cipher = 'aes256'; // $prepared_item is for use by alternate conversation structures such as photos @@ -57,6 +58,11 @@ class ThreadStream { $this->profile_owner = \App::$profile['profile_uid']; $this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments'); break; + case 'cards': + $this->profile_owner = \App::$profile['profile_uid']; + $this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments'); + $this->reload = $_SESSION['return_url']; + break; case 'display': // in this mode we set profile_owner after initialisation (from conversation()) and then // pull some trickery which allows us to re-invoke this function afterward diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 19932769f..9114e3b89 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -58,8 +58,8 @@ class Cards extends \Zotlabs\Web\Controller { $_SESSION['return_url'] = \App::$query_string; - $uid = local_channel(); - $owner = \App::$profile_uid; + $uid = local_channel(); + $owner = \App::$profile_uid; $observer = \App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); @@ -68,11 +68,7 @@ class Cards extends \Zotlabs\Web\Controller { notice( t('Permission denied.') . EOL); return; } - - $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype')); - - $layout = (($_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout')); - + $is_owner = ($uid && $uid == $owner); $channel = channelx_by_n($owner); @@ -93,38 +89,42 @@ class Cards extends \Zotlabs\Web\Controller { if(perm_is_allowed($owner,$ob_hash,'write_pages')) { - $x = array( - 'webpage' => ITEM_TYPE_CARD, - 'is_owner' => true, - 'nickname' => $channel['channel_address'], - 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl,false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''), - 'permissions' => $channel_acl, - 'showacl' => (($is_owner) ? true : false), - 'visitor' => true, - 'hide_location' => false, - 'hide_voting' => false, - 'profile_uid' => intval($owner), - 'mimetype' => $mimetype, - 'mimeselect' => false, - 'layoutselect' => false, - 'expanded' => false, - 'novoting'=> false, - 'catsenabled' => feature_enabled($owner,'categories'), + $x = [ + 'webpage' => ITEM_TYPE_CARD, + 'is_owner' => true, + 'nickname' => $channel['channel_address'], + 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] + || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'acl' => (($is_owner) ? populate_acl($channel_acl, false, + \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''), + 'permissions' => $channel_acl, + 'showacl' => (($is_owner) ? true : false), + 'visitor' => true, + 'hide_location' => false, + 'hide_voting' => false, + 'profile_uid' => intval($owner), + 'mimetype' => 'text/bbcode', + 'mimeselect' => false, + 'layoutselect' => false, + 'expanded' => false, + 'novoting' => false, + 'catsenabled' => feature_enabled($owner,'categories'), 'bbco_autocomplete' => 'bbcode', - 'bbcode' => true - ); + 'bbcode' => true + ]; + + if($_REQUEST['title']) + $x['title'] = $_REQUEST['title']; + if($_REQUEST['body']) + $x['body'] = $_REQUEST['body']; + $editor = status_editor($a,$x); + } else { - $x = ''; + $editor = ''; } - if($_REQUEST['title']) - $x['title'] = $_REQUEST['title']; - if($_REQUEST['body']) - $x['body'] = $_REQUEST['body']; - $sql_extra = item_permissions_sql($owner); if($selected_card) { @@ -147,10 +147,6 @@ class Cards extends \Zotlabs\Web\Controller { and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 and item.item_blocked = 0 "; - - if($x) - $editor = status_editor($a,$x); - if($r) { $parents_str = ids_to_querystr($r,'id'); -- cgit v1.2.3 From 85f24c292f071b9a83aea0aa122231afd57e7f73 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 23:59:05 -0700 Subject: last remaining task in tasklist was not removed from view when 'completed' --- Zotlabs/Module/Tasks.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Tasks.php b/Zotlabs/Module/Tasks.php index c8deb11bf..0709f31f6 100644 --- a/Zotlabs/Module/Tasks.php +++ b/Zotlabs/Module/Tasks.php @@ -19,8 +19,8 @@ class Tasks extends \Zotlabs\Web\Controller { $arr['all'] = 1; $x = tasks_fetch($arr); + $x['html'] = ''; if($x['tasks']) { - $x['html'] = ''; foreach($x['tasks'] as $y) { $x['html'] .= '
' . $y['summary'] . '
'; } @@ -69,6 +69,7 @@ class Tasks extends \Zotlabs\Web\Controller { if($x) $ret['success'] = true; } + json_return_and_die($ret); } -- cgit v1.2.3