From a97b09210e977d52a5bda1dee2b1eddc19afc013 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 1 Aug 2017 18:05:04 -0700 Subject: auto preview when inserting a media item or embed into a post. Since this unanticipated action could be alarming (some might think the post was actually submitted), also provide a visible preview indicator within the previewed content. Remove the css for the old striped background image which hasn't been available for previewed content for a year or two. --- include/conversation.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 1c1a4479d..460c97efb 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -467,6 +467,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $preview = (($page_mode === 'preview') ? true : false); $previewing = (($preview) ? ' preview ' : ''); + $preview_lbl = t('This is an unsaved preview'); if ($mode === 'network') { @@ -684,6 +685,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa 'mode' => $mode, 'approve' => t('Approve'), 'delete' => t('Delete'), + 'preview_lbl' => $preview_lbl, 'id' => (($preview) ? 'P0' : $item['item_id']), 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_url), 'profile_url' => $profile_link, -- cgit v1.2.3 From 68b32cd8f414fc3df1279a3458082b2d8dfc3430 Mon Sep 17 00:00:00 2001 From: git-marijus Date: Sun, 6 Aug 2017 21:40:39 +0200 Subject: consolidate disable_discover_tab config if it was not yet set to either 1 or 0 in DB --- include/conversation.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 460c97efb..13ae571d6 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1624,11 +1624,9 @@ function network_tabs() { // tabs $tabs = array(); - $d = get_config('system','disable_discover_tab'); - if($d === false) - $d = 1; + $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false; - if(! $d) { + if(! $disable_discover_tab) { $tabs[] = array( 'label' => t('Discover'), 'url' => z_root() . '/' . $cmd . '?f=&fh=1' , -- cgit v1.2.3 From 6531cbd1d286738acb9448b141bf4d7d5f97ccf3 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 9 Aug 2017 17:35:03 -0700 Subject: libxml errors --- include/conversation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 13ae571d6..f15077e76 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -538,7 +538,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa } elseif ($mode === 'photos') { - $profile_onwer = App::$profile['profile_uid']; + $profile_owner = App::$profile['profile_uid']; $page_writeable = ($profile_owner == local_channel()); $live_update_div = '
' . "\r\n"; // for photos we've already formatted the top-level item (the photo) -- cgit v1.2.3 From 1408e3da3bcb818134b76db338fb913ae0b54aa1 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 10 Aug 2017 21:08:07 -0700 Subject: prevent uploads to comments if the channel has a default private ACL. --- include/conversation.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index f15077e76..30ba4d812 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -550,6 +550,19 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa if (! feature_enabled($profile_owner,'multi_delete')) $page_dropping = false; + $uploading = true; + + if($profile_owner > 0) { + $owner_channel = channelx_by_n($profile_owner); + if($owner_channel['channel_allow_cid'] || $owner_channel['channel_allow_gid'] + || $owner_channel['channel_deny_cid'] || $owner_channel['channel_deny_gid']) { + $uploading = false; + } + } + else { + $uploading = false; + } + $channel = App::get_channel(); $observer = App::get_observer(); @@ -753,7 +766,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa // Normal View // logger('conv: items: ' . print_r($items,true)); - $conv = new Zotlabs\Lib\ThreadStream($mode, $preview, $prepared_item); + $conv = new Zotlabs\Lib\ThreadStream($mode, $preview, $uploading, $prepared_item); // In the display mode we don't have a profile owner. -- cgit v1.2.3 From 8a5c23fd50d26fb44d3d1d0f11d3bbd23872d060 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 20 Aug 2017 17:45:08 -0700 Subject: issue with oembed of a shared item, which wraps in another share. --- include/conversation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 30ba4d812..3b8ec19d3 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -295,7 +295,7 @@ function localize_item(&$item){ } $plink = '[zrl=' . $obj['plink'] . ']' . $post_type . '[/zrl]'; - $parsedobj = parse_xml_string($xmlhead.$item['obj']); +// $parsedobj = parse_xml_string($xmlhead.$item['obj']); $tag = sprintf('#[zrl=%s]%s[/zrl]', $parsedobj->id, $parsedobj->content); $item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag ); @@ -312,7 +312,7 @@ function localize_item(&$item){ $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; - $obj = parse_xml_string($xmlhead.$item['obj']); +// $obj = parse_xml_string($xmlhead.$item['obj']); if(strlen($obj->id)) { $r = q("select * from item where mid = '%s' and uid = %d limit 1", dbesc($obj->id), -- 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 --- include/conversation.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 3b8ec19d3..c9142ac30 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1835,7 +1835,8 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ require_once('include/menu.php'); $has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK); - if ($is_owner && $has_bookmarks) { + + if($is_owner && $has_bookmarks) { $tabs[] = array( 'label' => t('Bookmarks'), 'url' => z_root() . '/bookmarks', @@ -1846,6 +1847,17 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ ); } + if(feature_enabled($uid,'cards')) { + $tabs[] = array( + 'label' => t('Cards'), + 'url' => z_root() . '/cards/' . $nickname, + 'sel' => ((argv(0) == 'cards') ? 'active' : ''), + 'title' => t('View Cards'), + 'id' => 'cards-tab', + 'icon' => 'list' + ); + } + if($has_webpages && feature_enabled($uid,'webpages')) { $tabs[] = array( 'label' => t('Webpages'), @@ -1856,7 +1868,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ 'icon' => 'newspaper-o' ); } - + if ($p['view_wiki']) { if(feature_enabled($uid,'wiki') && (get_account_techlevel($account_id) > 3)) { -- 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 --- include/conversation.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index c9142ac30..e0de6fdce 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1305,6 +1305,11 @@ function status_editor($a, $x, $popup = false) { if(! $cipher) $cipher = 'aes256'; + if(array_key_exists('catsenabled',$x)) + $catsenabled = $x['catsenabled']; + else + $catsenabled = ((feature_enabled($x['profile_uid'], 'categories') && (! $webpage)) ? 'categories' : ''); + // avoid illegal offset errors if(! array_key_exists('permissions',$x)) $x['permissions'] = [ 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ]; @@ -1349,7 +1354,7 @@ function status_editor($a, $x, $popup = false) { '$clearloc' => $clearloc, '$title' => ((x($x, 'title')) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''), '$placeholdertitle' => ((x($x, 'placeholdertitle')) ? $x['placeholdertitle'] : t('Title (optional)')), - '$catsenabled' => ((feature_enabled($x['profile_uid'], 'categories') && (! $webpage)) ? 'categories' : ''), + '$catsenabled' => $catsenabled, '$category' => ((x($x, 'category')) ? $x['category'] : ''), '$placeholdercategory' => t('Categories (optional, comma-separated list)'), '$permset' => t('Permission settings'), -- 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 --- include/conversation.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index e0de6fdce..2448775af 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1461,6 +1461,8 @@ function conv_sort($arr, $order) { usort($parents,'sort_thr_created'); elseif(stristr($order,'commented')) usort($parents,'sort_thr_commented'); + elseif(stristr($order,'updated')) + usort($parents,'sort_thr_updated'); elseif(stristr($order,'ascending')) usort($parents,'sort_thr_created_rev'); @@ -1502,6 +1504,10 @@ function sort_thr_commented($a,$b) { return strcmp($b['commented'],$a['commented']); } +function sort_thr_updated($a,$b) { + return strcmp($b['updated'],$a['updated']); +} + function find_thread_parent_index($arr,$x) { foreach($arr as $k => $v) if($v['id'] == $x['parent']) -- cgit v1.2.3 From e7788156052bcb3676fe761f89769c2d72dc4bca Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 23 Aug 2017 20:12:40 -0700 Subject: use two keys for the updated sort --- include/conversation.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 2448775af..7e0394058 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1505,7 +1505,9 @@ function sort_thr_commented($a,$b) { } function sort_thr_updated($a,$b) { - return strcmp($b['updated'],$a['updated']); + $indexa = (($a['changed'] > $a['edited']) ? $a['changed'] : $a['edited']); + $indexb = (($b['changed'] > $b['edited']) ? $b['changed'] : $b['edited']); + return strcmp($indexb,$indexa); } function find_thread_parent_index($arr,$x) { -- 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 --- include/conversation.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 7e0394058..0d2dd2224 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -517,6 +517,15 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa } } + elseif ($mode === 'cards') { + $profile_owner = App::$profile['profile_uid']; + $page_writeable = ($profile_owner == local_channel()); + $live_update_div = '
' . "\r\n" + . "\r\n"; + } + + elseif ($mode === 'display') { $profile_owner = local_channel(); $page_writeable = false; -- 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 --- include/conversation.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 0d2dd2224..2d5ccb5b1 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -464,6 +464,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $profile_owner = 0; $page_writeable = false; $live_update_div = ''; + $jsreload = ''; $preview = (($page_mode === 'preview') ? true : false); $previewing = (($preview) ? ' preview ' : ''); @@ -523,6 +524,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $live_update_div = '
' . "\r\n" . "\r\n"; + $jsreload = $_SESSION['return_url']; } @@ -817,6 +819,10 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $item_object->set_template('conv_list.tpl'); $item_object->set_display_mode('list'); } + if($page_mode === 'cards') { + $item_object->set_reload($jsreload); + } + } } -- cgit v1.2.3 From 2d5768b71c0fa588524849749cfb0b6ffe6300b7 Mon Sep 17 00:00:00 2001 From: git-marijus Date: Thu, 24 Aug 2017 21:47:01 +0200 Subject: ditch discover tab in favour of the public stream app --- include/conversation.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 2d5ccb5b1..78d90a6fc 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1616,7 +1616,6 @@ function network_tabs() { $conv_active = ''; $spam_active = ''; $postord_active = ''; - $public_active = ''; if(x($_GET,'new')) { $new_active = 'active'; @@ -1638,16 +1637,11 @@ function network_tabs() { $spam_active = 'active'; } - if(x($_GET,'fh')) { - $public_active = 'active'; - } - if (($new_active == '') && ($starred_active == '') && ($conv_active == '') && ($search_active == '') - && ($spam_active == '') - && ($public_active == '')) { + && ($spam_active == '')) { $no_active = 'active'; } @@ -1665,17 +1659,6 @@ function network_tabs() { // tabs $tabs = array(); - $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false; - - if(! $disable_discover_tab) { - $tabs[] = array( - 'label' => t('Discover'), - 'url' => z_root() . '/' . $cmd . '?f=&fh=1' , - 'sel' => $public_active, - 'title' => t('Imported public streams'), - ); - } - $tabs[] = array( 'label' => t('Commented Order'), 'url'=>z_root() . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), -- cgit v1.2.3 From 341386a95ba68227f60964ab50f9b20989ac6802 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 24 Aug 2017 18:15:19 -0700 Subject: make cards searchable --- include/conversation.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 2d5ccb5b1..5cb85c3f9 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -703,6 +703,9 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) $is_new = true; + $conv_link = (($item['item_type'] == ITEM_TYPE_CARD) ? $item['plink'] : z_root() . '/display/' . gen_link_id($item['mid'])); + + $tmp_item = array( 'template' => $tpl, 'toplevel' => 'toplevel_item', @@ -757,7 +760,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa 'like' => '', 'dislike' => '', 'comment' => '', - 'conv' => (($preview) ? '' : array('href'=> z_root() . '/display/' . gen_link_id($item['mid']), 'title'=> t('View in context'))), + 'conv' => (($preview) ? '' : array('href'=> $conv_link, 'title'=> t('View in context'))), 'previewing' => $previewing, 'wait' => t('Please wait'), 'thread_level' => 1, -- cgit v1.2.3 From 5c92337821834853dc03eecbc8af9e59b16b70a1 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 24 Aug 2017 18:34:12 -0700 Subject: cards - change placeholdertext, separate from button text --- include/conversation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 5cb85c3f9..9a48a83d2 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1340,10 +1340,14 @@ function status_editor($a, $x, $popup = false) { call_hooks('jot_networks', $jotnets); } + $sharebutton = (x($x,'button') ? $x['button'] : t('Share')); + $placeholdtext = (x($x,'content_label') ? $x['content_label'] : $sharebutton); + $o .= replace_macros($tpl, array( '$return_path' => ((x($x, 'return_path')) ? $x['return_path'] : App::$query_string), '$action' => z_root() . '/item', - '$share' => (x($x,'button') ? $x['button'] : t('Share')), + '$share' => $sharebutton, + '$placeholdtext' => $placeholdtext, '$webpage' => $webpage, '$placeholdpagetitle' => ((x($x,'ptlabel')) ? $x['ptlabel'] : t('Page link name')), '$pagetitle' => (x($x,'pagetitle') ? $x['pagetitle'] : ''), -- cgit v1.2.3 From 45eb61bcf079557094fed8714afc994f1120e6db Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 5 Sep 2017 18:32:37 -0700 Subject: provide sharing of cards --- include/conversation.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index ec445ba4c..c034e8a65 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -709,6 +709,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $tmp_item = array( 'template' => $tpl, 'toplevel' => 'toplevel_item', + 'item_type' => intval($item['item_type']), 'mode' => $mode, 'approve' => t('Approve'), 'delete' => t('Delete'), -- cgit v1.2.3 From f3c374b6fff5122ad8a8a62446a65171ce0fb555 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 19 Oct 2017 11:20:09 +0200 Subject: redirect to be moderated items to /moderate and change the conv link to partent mid in /modrate --- include/conversation.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index c034e8a65..f395b2cbe 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -703,7 +703,9 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) $is_new = true; - $conv_link = (($item['item_type'] == ITEM_TYPE_CARD) ? $item['plink'] : z_root() . '/display/' . gen_link_id($item['mid'])); + $conv_link_mid = (($mode == 'moderate') ? $item['parent_mid'] : $item['mid']); + + $conv_link = (($item['item_type'] == ITEM_TYPE_CARD) ? $item['plink'] : z_root() . '/display/' . gen_link_id($conv_link_mid)); $tmp_item = array( -- cgit v1.2.3