diff options
author | Mario <mario@mariovavti.com> | 2023-01-13 20:01:05 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-01-13 20:01:05 +0000 |
commit | 2805520d1bcb2640fc079d54f5f230f7b87d1f84 (patch) | |
tree | 43b3e5bb7c71522d04560015478765a7b763a5fe /include | |
parent | f6d940606350eb8685c278af6d87f3a0b8c0f5e5 (diff) | |
parent | fb7ca18820e7618325dded78a3c3a464dd01b391 (diff) | |
download | volse-hubzilla-8.0.tar.gz volse-hubzilla-8.0.tar.bz2 volse-hubzilla-8.0.zip |
Merge remote-tracking branch 'origin/8.0RC'8.0
Diffstat (limited to 'include')
-rw-r--r-- | include/api_auth.php | 4 | ||||
-rw-r--r-- | include/attach.php | 18 | ||||
-rw-r--r-- | include/auth.php | 3 | ||||
-rw-r--r-- | include/conversation.php | 25 | ||||
-rw-r--r-- | include/feedutils.php | 6 | ||||
-rw-r--r-- | include/html2bbcode.php | 1 | ||||
-rw-r--r-- | include/hubloc.php | 12 | ||||
-rw-r--r-- | include/items.php | 71 | ||||
-rw-r--r-- | include/nav.php | 4 | ||||
-rw-r--r-- | include/network.php | 23 | ||||
-rw-r--r-- | include/photos.php | 4 | ||||
-rw-r--r-- | include/plugin.php | 19 | ||||
-rw-r--r-- | include/taxonomy.php | 92 | ||||
-rw-r--r-- | include/text.php | 5 | ||||
-rw-r--r-- | include/xchan.php | 6 |
15 files changed, 169 insertions, 124 deletions
diff --git a/include/api_auth.php b/include/api_auth.php index 0395dae7a..be886fbb2 100644 --- a/include/api_auth.php +++ b/include/api_auth.php @@ -102,13 +102,13 @@ function api_login(&$a) { if ($sigblock) { $keyId = str_replace('acct:', '', $sigblock['keyId']); if ($keyId) { - $r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s'", + $r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s' order by hubloc_id desc", dbesc($keyId), dbesc($keyId) ); if (!$r) { HTTPSig::get_zotfinger_key($keyId); - $r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s'", + $r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s' order by hubloc_id desc", dbesc($keyId), dbesc($keyId) ); diff --git a/include/attach.php b/include/attach.php index fd418103d..fc146d008 100644 --- a/include/attach.php +++ b/include/attach.php @@ -2105,8 +2105,22 @@ function attach_store_item($channel, $observer, $file) { $arr['verb'] = ACTIVITY_CREATE; $arr['obj_type'] = $type; $arr['title'] = $file['filename']; - $body_str = sprintf(t('%s shared a %s with you'), '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]', '[zrl=' . $path . ']' . t('file') . '[/zrl]'); - $arr['body'] = $body_str; + + if ($type === 'Image') { + $arr['body'] = '[zrl=' . $path . '][zmg=' . $path . ']' . $file['display_path'] . '[/zmg][/zrl]'; + } + else { + $arr['attach'][] = [ + 'href' => z_root() . '/attach/' . $resource_id, + 'length' => $file['filesize'], + 'type' => $file['filetype'], + 'title' => urlencode($file['filename']), + 'revision' => $file['revision'] + ]; + } + + $body_str = sprintf((($type === 'Image') ? t('%s shared an %s with you') : t('%s shared a %s with you')), '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]', '[zrl=' . $path . ']' . (($type === 'Image') ? t('image') : t('file')) . '[/zrl]'); + $arr['body'] .= $body_str; $meta = [ 'name' => $file['filename'], diff --git a/include/auth.php b/include/auth.php index 4f4d26a6c..125aedffd 100644 --- a/include/auth.php +++ b/include/auth.php @@ -94,7 +94,7 @@ function account_verify_password($login, $pass) { $where = " where account_email = '" . dbesc($login) . "' "; } - $a = q("select * from account $where"); + $a = dbq("select * from account $where"); if(! $a) { return null; } @@ -112,6 +112,7 @@ function account_verify_password($login, $pass) { } if($channel) { + // Try the authentication plugin again since weve determined we are using the channel login instead of account login $addon_auth = [ 'username' => $account['account_email'], diff --git a/include/conversation.php b/include/conversation.php index 46621a243..caad5bb0e 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -675,7 +675,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa if($items) { - if(in_array($mode, [ 'network-new', 'search', 'community', 'moderate' ])) { + if(is_unthreaded($mode)) { // "New Item View" on network page or search page results // - just loop through the items and format them minimally for display @@ -772,14 +772,17 @@ 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_mid = (($mode == 'moderate') ? $item['parent_mid'] : $item['mid']); + $conv_link_mid = (($mode == 'moderate') ? gen_link_id($item['parent_mid']) : gen_link_id($item['mid'])); + + $conv_link = z_root() . '/display/' . $conv_link_mid; - $conv_link_module = 'display'; if(local_channel()) { - $conv_link_module = 'hq'; + $conv_link = z_root() . '/hq/' . $conv_link_mid; } - $conv_link = z_root() . '/' . $conv_link_module . '/' . gen_link_id($conv_link_mid); + if ($mode === 'pubstream-new') { + $conv_link = z_root() . '/pubstream?mid=' . $conv_link_mid; + } $contact = []; @@ -996,7 +999,7 @@ function thread_action_menu($item,$mode = '') { 'href' => '#' ]; - if(! in_array($mode, [ 'network-new', 'search', 'community'])) { + if(!is_unthreaded($mode)) { if($item['parent'] == $item['id'] && (get_observer_hash() != $item['author_xchan'])) { $menu[] = [ 'menu' => 'follow_thread', @@ -1784,3 +1787,13 @@ function get_response_button_text($v,$count) { break; } } + +function is_unthreaded($mode) { + return in_array($mode, [ + 'network-new', + 'pubstream-new', + 'search', + 'community', + 'moderate' + ]); +} diff --git a/include/feedutils.php b/include/feedutils.php index eea908fe8..43b95b966 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -2007,9 +2007,9 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ if($enclosures) { foreach($enclosures as $enc) { $o .= '<link rel="enclosure" ' - . (($enc['href']) ? 'href="' . $enc['href'] . '" ' : '') - . (($enc['length']) ? 'length="' . $enc['length'] . '" ' : '') - . (($enc['type']) ? 'type="' . $enc['type'] . '" ' : '') + . ((isset($enc['href']) && $enc['href']) ? 'href="' . $enc['href'] . '" ' : '') + . ((isset($enc['length']) && $enc['length']) ? 'length="' . $enc['length'] . '" ' : '') + . ((isset($enc['type']) && $enc['type']) ? 'type="' . $enc['type'] . '" ' : '') . ' />' . "\r\n"; } } diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 0aa067371..c928b91b1 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -171,6 +171,7 @@ function html2bbcode($message) node2bbcode($doc, 'i', array(), '[i]', '[/i]'); node2bbcode($doc, 'u', array(), '[u]', '[/u]'); node2bbcode($doc, 's', array(), '[s]', '[/s]'); + node2bbcode($doc, 'mark', array(), '[mark]', '[/mark]'); node2bbcode($doc, 'big', array(), "[size=large]", "[/size]"); node2bbcode($doc, 'small', array(), "[size=small]", "[/size]"); diff --git a/include/hubloc.php b/include/hubloc.php index bf5d8f120..0236e4ae7 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -79,9 +79,10 @@ function prune_hub_reinstalls() { $r = q("select site_url from site where site_type = %d", intval(SITE_TYPE_ZOT) ); + if($r) { foreach($r as $rr) { - $x = q("select count(*) as t, hubloc_sitekey, max(hubloc_connected) as c from hubloc where hubloc_url = '%s' group by hubloc_sitekey order by c", + $x = q("select count(*) as t, hubloc_sitekey, max(hubloc_connected) as c from hubloc where hubloc_url = '%s' and hubloc_network = 'zot6' group by hubloc_sitekey order by c", dbesc($rr['site_url']) ); @@ -155,8 +156,7 @@ function remove_obsolete_hublocs() { logger('remove_obsolete_hublocs: removing ' . count($r) . ' hublocs.'); - $interval = ((get_config('system', 'delivery_interval') !== false) - ? intval(get_config('system', 'delivery_interval')) : 2 ); + $interval = get_config('queueworker', 'queue_interval', 500000); foreach($r as $rr) { q("update hubloc set hubloc_deleted = 1 where hubloc_id = %d", @@ -168,8 +168,10 @@ function remove_obsolete_hublocs() { ); if($x) { Master::Summon(array('Notifier', 'refresh_all', $x[0]['channel_id'])); - if($interval) - @time_sleep_until(microtime(true) + (float) $interval); + + if($interval) { + usleep($interval); + } } } } diff --git a/include/items.php b/include/items.php index 4e4869aa8..900ffe2fa 100644 --- a/include/items.php +++ b/include/items.php @@ -97,7 +97,6 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { $private_envelope = false; require_once('include/channel.php'); - //$sys = get_sys_channel(); if(array_key_exists('public_policy',$item) && $item['public_policy'] !== 'self') { @@ -114,7 +113,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { $r = $hookinfo['recipients']; } else { $r = q("select abook_xchan, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 ", - intval($item['uid']) + intval($item['uid']) ); } @@ -141,18 +140,19 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { } } } -// we probably want to check that discovery channel delivery is allowed before uncommenting this. -// if($policy === 'pub') -// $recipients[] = $sys['xchan_hash']; } - // Forward to thread listeners, *unless* there is even a remote hint that the item - // might have some privacy attached. This could be (for instance) an ActivityPub DM + // Forward to thread listeners and pubstream (sys channel), *unless* there is even + // a remote hint that the item might have some privacy attached. + // This could be (for instance) an ActivityPub DM // in the middle of a public thread. Unless we can guarantee beyond all doubt that // this is public, don't allow it to go to thread listeners. if(! intval($item['item_private'])) { + $sys = get_sys_channel(); + $recipients[] = $sys['xchan_hash']; + $r = ThreadListener::fetch_by_target($item['parent_mid']); if($r) { foreach($r as $rv) { @@ -1834,7 +1834,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) { $arr['item_private'] = 0; if(in_array($arr['obj_type'], ['Note','Answer']) && $r[0]['obj_type'] === 'Question' && intval($r[0]['item_wall'])) { - Activity::update_poll($r[0],$arr); + Activity::update_poll($r[0]['id'], $arr); } } @@ -1848,21 +1848,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) { if($parent_deleted) $arr['item_deleted'] = 1; - if($arr['uuid']) { - $r = q("SELECT id FROM item WHERE uuid = '%s' AND uid = %d and revision = %d LIMIT 1", - dbesc($arr['uuid']), - intval($arr['uid']), - intval($arr['revision']) - ); - } - else { - $r = q("SELECT id FROM item WHERE (mid = '%s' OR mid = '%s') AND uid = %d and revision = %d LIMIT 1", - dbesc($arr['mid']), - dbesc(basename(rawurldecode($arr['mid']))), // de-duplicate relayed comments from hubzilla < 4.0 - intval($arr['uid']), - intval($arr['revision']) - ); - } + $r = q("SELECT id FROM item WHERE uuid = '%s' AND uid = %d and revision = %d LIMIT 1", + dbesc($arr['uuid']), + intval($arr['uid']), + intval($arr['revision']) + ); if($r) { logger('duplicate item ignored. ' . print_r($arr,true)); @@ -2659,9 +2649,10 @@ function tag_deliver($uid, $item_id) { if ($is_group && intval($x[0]['item_wall'])) { // don't let the forked delivery chain recurse - if ($item['verb'] === 'Announce' && $item['author_xchan'] === $u['channel_hash']) { + if ($item['verb'] === 'Announce' && $item['author_xchan'] === $u[0]['channel_hash']) { return; } + // don't announce moderated content until it has been approved if (intval($item['item_blocked']) === ITEM_MODERATED) { return; @@ -2678,7 +2669,7 @@ function tag_deliver($uid, $item_id) { } elseif (intval($x[0]['item_uplink'])) { - start_delivery_chain($u,$item,$item_id,$x[0]); + start_delivery_chain($u[0], $item, $item_id, $x[0]); } } @@ -4133,21 +4124,24 @@ function posted_dates($uid,$wall) { */ function fetch_post_tags($items, $link = false) { - $tag_finder = array(); - if($items) { - foreach($items as $item) { - if(is_array($item)) { - if(array_key_exists('item_id',$item)) { - if(! in_array($item['item_id'],$tag_finder)) - $tag_finder[] = $item['item_id']; - } - else { - if(! in_array($item['id'],$tag_finder)) - $tag_finder[] = $item['id']; - } + if (!is_array($items) || !$items) { + return $items; + } + + $tag_finder = []; + foreach($items as $item) { + if(is_array($item)) { + if(array_key_exists('item_id',$item)) { + if(! in_array($item['item_id'],$tag_finder)) + $tag_finder[] = $item['item_id']; + } + else { + if(! in_array($item['id'],$tag_finder)) + $tag_finder[] = $item['id']; } } } + $tag_finder_str = implode(', ', $tag_finder); if(strlen($tag_finder_str)) { @@ -4608,10 +4602,11 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $items = array(); } + /** @FIXME finish mark unseen sql if ($parents_str && (isset($arr['mark_seen']) && $arr['mark_seen'])) { $update_unseen = ' AND parent IN ( ' . dbesc($parents_str) . ' )'; - /** @FIXME finish mark unseen sql */ } + */ } return $items; diff --git a/include/nav.php b/include/nav.php index 29d99aaee..2cdf7d42b 100644 --- a/include/nav.php +++ b/include/nav.php @@ -17,6 +17,7 @@ function nav($template = 'default') { App::$page['nav'] = App::$page['nav'] ?? ''; App::$page['htmlhead'] = App::$page['htmlhead'] ?? ''; App::$page['htmlhead'] .= '<script>$(document).ready(function() { $("#nav-search-text").search_autocomplete(\'' . z_root() . '/acl' . '\');});</script>'; + $is_owner = (((local_channel()) && ((App::$profile_uid == local_channel()) || (App::$profile_uid == 0))) ? true : false); $observer = App::get_observer(); $chans = []; @@ -166,7 +167,8 @@ function nav($template = 'default') { $nav['register'] = ['register', t('Register'), "", t('Create an account'), 'register_nav_btn']; } - if (!get_config('system', 'hide_help')) { + // TODO: update help content for various modules + if (false /* !get_config('system', 'hide_help') */) { $help_url = z_root() . '/help?f=&cmd=' . App::$cmd; $context_help = ''; $enable_context_help = ((intval(get_config('system', 'enable_context_help')) === 1 || get_config('system', 'enable_context_help') === false) ? true : false); diff --git a/include/network.php b/include/network.php index 36859bc2f..f0642d8f7 100644 --- a/include/network.php +++ b/include/network.php @@ -1467,7 +1467,7 @@ function do_delivery($deliveries, $force = false) { if(! (is_array($deliveries) && count($deliveries))) return; - + /* $x = q("select count(outq_hash) as total from outq where outq_delivered = 0"); if(intval($x[0]['total']) > intval(get_config('system','force_queue_threshold',3000)) && (! $force)) { logger('immediate delivery deferred.', LOGGER_DEBUG, LOG_INFO); @@ -1476,10 +1476,10 @@ function do_delivery($deliveries, $force = false) { } return; } + */ - $interval = ((get_config('system','delivery_interval') !== false) - ? intval(get_config('system','delivery_interval')) : 2 ); + $interval = get_config('queueworker', 'queue_interval', 500000); $deliveries_per_process = intval(get_config('system','delivery_batch_count')); @@ -1487,7 +1487,7 @@ function do_delivery($deliveries, $force = false) { $deliveries_per_process = 1; - $deliver = array(); + $deliver = []; foreach($deliveries as $d) { if(! $d) @@ -1496,17 +1496,20 @@ function do_delivery($deliveries, $force = false) { $deliver[] = $d; if(count($deliver) >= $deliveries_per_process) { - Zotlabs\Daemon\Master::Summon(array('Deliver',$deliver)); - $deliver = array(); - if($interval) - @time_sleep_until(microtime(true) + (float) $interval); + Zotlabs\Daemon\Master::Summon(['Deliver', $deliver]); + $deliver = []; + + if($interval) { + usleep($interval); + } } } // catch any stragglers - if($deliver) - Zotlabs\Daemon\Master::Summon(array('Deliver',$deliver)); + if($deliver) { + Zotlabs\Daemon\Master::Summon(['Deliver', $deliver]); + } } diff --git a/include/photos.php b/include/photos.php index de9cc6b13..6e00ffbf0 100644 --- a/include/photos.php +++ b/include/photos.php @@ -64,7 +64,7 @@ function photo_upload($channel, $observer, $args) { } $ac = $acl->get(); - +hz_syslog(print_r($ac,true)); $width = $height = 0; if ($args['getimagesize']) { @@ -405,7 +405,7 @@ function photo_upload($channel, $observer, $args) { } } - $attribution = (($visitor) ? $visitor['xchan_url'] : $channel['xchan_url']); + $attribution = (($visitor) ? $visitor : $channel['xchan_url']); //// Create item object $object = [ diff --git a/include/plugin.php b/include/plugin.php index ff5014c8b..ae73a847c 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -189,7 +189,7 @@ function plugin_is_installed($name) { function reload_plugins() { $plugins = get_config('system', 'addon'); if(strlen($plugins)) { - $r = q("SELECT * FROM addon WHERE installed = 1"); + $r = dbq("SELECT * FROM addon WHERE installed = 1"); if(count($r)) $installed = $r; else @@ -243,7 +243,7 @@ function reload_plugins() { function plugins_installed_list() { - $r = q("select * from addon where installed = 1 order by aname asc"); + $r = dbq("select * from addon where installed = 1 order by aname asc"); return(($r) ? ids_to_array($r,'aname') : []); } @@ -313,7 +313,7 @@ function plugins_sync() { */ function visible_plugin_list() { - $r = q("select * from addon where hidden = 0 order by aname asc"); + $r = dbq("select * from addon where hidden = 0 order by aname asc"); $x = (($r) ? ids_to_array($r,'aname') : array()); $y = []; if($x) { @@ -392,7 +392,7 @@ function load_hooks() { App::$hooks = []; - $r = q("SELECT * FROM hook WHERE true ORDER BY priority DESC"); + $r = dbq("SELECT * FROM hook WHERE true ORDER BY priority DESC"); if($r) { foreach($r as $rv) { @@ -613,6 +613,17 @@ function get_widget_info($widget){ "addon/$widget.php" ]; + $addons = plugins_installed_list(); + + if ($addons) { + foreach ($addons as $name) { + $path = 'addon/' . $name . '/Widget/' . $ucwidget . '.php'; + if (is_file($path)) { + $checkpaths[] = $path ; + } + } + } + $widget_found = false; foreach ($checkpaths as $path) { diff --git a/include/taxonomy.php b/include/taxonomy.php index 1eded055a..671f96c2e 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -322,7 +322,7 @@ function pubtagblock($net,$site,$limit,$recent = 0,$safemode = 1, $type = TERM_H if($r) { $o = '<div class="tagblock widget"><h3>' . (($recent) ? t('Trending') : t('Tags')) . '</h3><div class="tags" align="center">'; foreach($r as $rr) { - $o .= '<span class="tag'.$rr[2].'">#</span><a href="'.$link .'/' . '?f=&tag=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ' . "\r\n"; + $o .= '<span class="tag'.$rr[2].'">#</span><a href="'.$link . '?tag=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ' . "\r\n"; } $o .= '</div></div>'; } @@ -335,53 +335,55 @@ function pub_tagadelic($net, $site, $limit, $recent, $safemode, $type) { $item_normal = item_normal(); $count = intval($limit); - $sql_extra = ""; - if($site) - $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 "; - else { - $sys = get_sys_channel(); - $uids = " and item.uid = " . intval($sys['channel_id']) . " "; - $sql_extra = " and item_private = 0 "; - } - - if($recent) - $sql_extra .= " and item.created > NOW() - INTERVAL " . db_quoteinterval(intval($recent) . ' DAY') . " "; - - - if($safemode) { - $unsafetags = get_config('system','unsafepubtags', [ 'boobs', 'bot', 'rss', 'girl','girls', 'nsfw', 'sexy', 'nude' ]); - if($unsafetags) { - $sql_extra .= " and not term.term in ( " . stringify_array($unsafetags,true) . ") "; - } - } - - $key = __FUNCTION__ . "-" . md5($site . $recent . $safemode . $limit . $type); - - $content = Cache::get($key, '5 MINUTE'); - if(! $content) { - - $content = Cache::get($key, '1 MONTH'); - $arr = [ - "SELECT term, count(term) AS total FROM term LEFT JOIN item ON term.oid = item.id - WHERE term.ttype = %d - AND otype = %d - AND item_type = %d - $sql_extra $uids $item_normal - GROUP BY term ORDER BY total DESC %s", - intval($type), - intval(TERM_OBJ_POST), - intval(ITEM_TYPE_POST), - (intval($count) ? "LIMIT $count" : '') - ]; - - \Zotlabs\Daemon\Master::Summon([ 'Cache_query', $key, base64_encode(json_encode($arr)) ]); + $sys = get_sys_channel(); + $uids = " and item.uid = " . intval($sys['channel_id']) . " "; + $sql_extra = item_permissions_sql($sys['channel_id']); + + $site_firehose_sql = ''; + + if ($site) { + $site_firehose_sql = " and owner_xchan in (select channel_hash from channel where channel_system = 0 and channel_removed = 0) "; + } + + if($recent) { + $sql_extra .= " and item.created > NOW() - INTERVAL " . db_quoteinterval(intval($recent) . ' DAY') . " "; + } + + if($safemode) { + $unsafetags = get_config('system','unsafepubtags', [ 'boobs', 'bot', 'rss', 'girl','girls', 'nsfw', 'sexy', 'nude' ]); + if($unsafetags) { + $sql_extra .= " and not term.term in ( " . stringify_array($unsafetags,true) . ") "; } + } + + $key = __FUNCTION__ . "-" . md5($site . $recent . $safemode . $limit . $type); - $r = unserialize($content); - if(! $r) - return []; + $content = Cache::get($key, '5 MINUTE'); + if(! $content) { - return Zotlabs\Text\Tagadelic::calc($r); + $content = Cache::get($key, '1 MONTH'); + $arr = [ + "SELECT term, count(term) AS total FROM term LEFT JOIN item ON term.oid = item.id + WHERE term.ttype = %d + AND otype = %d + AND item_type = %d + AND item_private = 0 + $uids $item_normal $site_firehose_sql $sql_extra + GROUP BY term ORDER BY total DESC %s", + intval($type), + intval(TERM_OBJ_POST), + intval(ITEM_TYPE_POST), + (intval($count) ? "LIMIT $count" : '') + ]; + + \Zotlabs\Daemon\Master::Summon([ 'Cache_query', $key, base64_encode(json_encode($arr)) ]); + } + + $r = unserialize($content); + if(! $r) + return []; + + return Zotlabs\Text\Tagadelic::calc($r); } diff --git a/include/text.php b/include/text.php index cc480aacf..35ce465d6 100644 --- a/include/text.php +++ b/include/text.php @@ -303,6 +303,7 @@ function purify_html($s, $allow_position = false) { $def->addElement('footer', 'Block', 'Flow', 'Common'); //Inline $def->addElement('button', 'Inline', 'Inline', 'Common'); + $def->addElement('mark', 'Inline', 'Inline', 'Common'); if($allow_position) { @@ -2969,7 +2970,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) $newname = substr($name,1); $newname = substr($newname,0,-1); - $r = q("SELECT * FROM xchan WHERE ( xchan_addr = '%s' OR xchan_url = '%s' ) AND xchan_deleted = 0 AND NOT xchan_network IN ('rss', 'anon', 'unknown')", + $r = q("SELECT * FROM xchan LEFT JOIN hubloc ON hubloc_hash = xchan_hash WHERE ( xchan_addr = '%s' OR xchan_url = '%s' ) AND xchan_deleted = 0 AND NOT xchan_network IN ('rss', 'anon', 'unknown') ORDER BY hubloc_id DESC", dbesc($newname), dbesc($newname) ); @@ -3004,7 +3005,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) if((! $r) && strpos($newname,'@')) { $r = q("SELECT * FROM xchan LEFT JOIN hubloc ON xchan_hash = hubloc_hash - WHERE hubloc_addr = '%s' AND xchan_deleted = 0 AND NOT xchan_network IN ('rss', 'anon', 'unknown')", + WHERE hubloc_addr = '%s' AND xchan_deleted = 0 AND NOT xchan_network IN ('rss', 'anon', 'unknown') ORDER BY hubloc_id DESC", dbesc($newname) ); } diff --git a/include/xchan.php b/include/xchan.php index a32064303..4a2d389c0 100644 --- a/include/xchan.php +++ b/include/xchan.php @@ -148,15 +148,15 @@ function xchan_store($arr) { function xchan_fetch($arr) { $key = ''; - if($arr['hash']) { + if(isset($arr['hash']) && $arr['hash']) { $key = 'xchan_hash'; $v = $arr['hash']; } - elseif($arr['guid']) { + elseif(isset($arr['guid']) && $arr['guid']) { $key = 'xchan_guid'; $v = $arr['guid']; } - elseif($arr['address']) { + elseif(isset($arr['address']) && $arr['address']) { $key = 'xchan_addr'; $v = $arr['address']; } |