aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Notifier.php2
-rw-r--r--Zotlabs/Lib/ThreadStream.php4
-rw-r--r--Zotlabs/Module/File_upload.php48
-rw-r--r--Zotlabs/Module/Filestorage.php5
-rw-r--r--Zotlabs/Module/Hq.php72
-rw-r--r--Zotlabs/Module/Ping.php2
-rw-r--r--Zotlabs/Module/Profile.php2
-rw-r--r--Zotlabs/Module/Settings/Channel.php9
-rw-r--r--Zotlabs/Module/Update_hq.php31
-rw-r--r--Zotlabs/Module/Wall_attach.php10
-rw-r--r--Zotlabs/Widget/Cdav.php5
-rw-r--r--Zotlabs/Widget/Hq_controls.php26
-rw-r--r--include/bbcode.php8
-rw-r--r--include/channel.php2
-rw-r--r--include/contact_widgets.php61
-rw-r--r--include/conversation.php6
-rw-r--r--include/follow.php3
-rwxr-xr-xinclude/items.php16
-rw-r--r--include/markdown.php2
-rw-r--r--include/taxonomy.php10
-rw-r--r--include/text.php4
-rw-r--r--include/zot.php2
-rw-r--r--view/js/main.js1
-rw-r--r--view/js/mod_hq.js12
-rw-r--r--view/pdl/mod_hq.pdl3
-rw-r--r--view/tpl/cdav_widget_calendar.tpl4
-rwxr-xr-xview/tpl/hq_controls.tpl8
-rw-r--r--view/tpl/notifications_widget.tpl2
-rwxr-xr-xview/tpl/settings.tpl4
29 files changed, 281 insertions, 83 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index d0175549b..3f07d4ce0 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -309,7 +309,7 @@ class Notifier {
if($s)
$channel = $s[0];
- if($channel['channel_hash'] !== $target_item['author_xchan'] && $channel['channel_hash'] !== $target_item['owner_xchan']) {
+ if($channel['channel_hash'] !== $target_item['author_xchan'] && $channel['channel_hash'] !== $target_item['owner_xchan'] && ( ! intval($channel['channel_system']))) {
logger("notifier: Sending channel {$channel['channel_hash']} is not owner {$target_item['owner_xchan']} or author {$target_item['author_xchan']}", LOGGER_NORMAL, LOG_WARNING);
return;
}
diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php
index 9eebb929c..bdd2e9657 100644
--- a/Zotlabs/Lib/ThreadStream.php
+++ b/Zotlabs/Lib/ThreadStream.php
@@ -54,6 +54,10 @@ class ThreadStream {
$this->profile_owner = local_channel();
$this->writable = true;
break;
+ case 'hq':
+ $this->profile_owner = local_channel();
+ $this->writable = true;
+ break;
case 'channel':
$this->profile_owner = \App::$profile['profile_uid'];
$this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments');
diff --git a/Zotlabs/Module/File_upload.php b/Zotlabs/Module/File_upload.php
index 5c4b9a502..296dab708 100644
--- a/Zotlabs/Module/File_upload.php
+++ b/Zotlabs/Module/File_upload.php
@@ -30,8 +30,8 @@ class File_upload extends \Zotlabs\Web\Controller {
$_REQUEST['allow_cid'] = perms2str($_REQUEST['contact_allow']);
$_REQUEST['allow_gid'] = perms2str($_REQUEST['group_allow']);
- $_REQUEST['deny_cid'] = perms2str($_REQUEST['contact_deny']);
- $_REQUEST['deny_gid'] = perms2str($_REQUEST['group_deny']);
+ $_REQUEST['deny_cid'] = perms2str($_REQUEST['contact_deny']);
+ $_REQUEST['deny_gid'] = perms2str($_REQUEST['group_deny']);
if($_REQUEST['filename']) {
$r = attach_mkdir($channel, get_observer_hash(), $_REQUEST);
@@ -47,6 +47,50 @@ class File_upload extends \Zotlabs\Web\Controller {
}
}
else {
+
+ $matches = [];
+ $partial = false;
+
+
+
+ if(array_key_exists('HTTP_CONTENT_RANGE',$_SERVER)) {
+ $pm = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
+ if($pm) {
+ // logger('Content-Range: ' . print_r($matches,true));
+ $partial = true;
+ }
+ }
+
+ if($partial) {
+ $x = save_chunk($channel,$matches[1],$matches[2],$matches[3]);
+ if($x['partial']) {
+ header('Range: bytes=0-' . (($x['length']) ? $x['length'] - 1 : 0));
+ json_return_and_die($result);
+ }
+ else {
+ header('Range: bytes=0-' . (($x['size']) ? $x['size'] - 1 : 0));
+
+ $_FILES['userfile'] = [
+ 'name' => $x['name'],
+ 'type' => $x['type'],
+ 'tmp_name' => $x['tmp_name'],
+ 'error' => $x['error'],
+ 'size' => $x['size']
+ ];
+ }
+ }
+ else {
+ if(! array_key_exists('userfile',$_FILES)) {
+ $_FILES['userfile'] = [
+ 'name' => $_FILES['files']['name'],
+ 'type' => $_FILES['files']['type'],
+ 'tmp_name' => $_FILES['files']['tmp_name'],
+ 'error' => $_FILES['files']['error'],
+ 'size' => $_FILES['files']['size']
+ ];
+ }
+ }
+
$r = attach_store($channel, get_observer_hash(), '', $_REQUEST);
if($r['success']) {
$sync = attach_export_data($channel,$r['data']['hash']);
diff --git a/Zotlabs/Module/Filestorage.php b/Zotlabs/Module/Filestorage.php
index 55713027a..5c8557e5a 100644
--- a/Zotlabs/Module/Filestorage.php
+++ b/Zotlabs/Module/Filestorage.php
@@ -103,6 +103,11 @@ class Filestorage extends \Zotlabs\Web\Controller {
attach_delete($owner, $f['hash']);
+ $sync = attach_export_data($channel, $f['hash'], true);
+ if($sync) {
+ build_sync_packet($channel['channel_id'], array('file' => array($sync)));
+ }
+
goaway(dirname($url));
}
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 78087c0f9..c5b3ced3e 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -43,10 +43,9 @@ class Hq extends \Zotlabs\Web\Controller {
$item_normal_update = item_normal_update();
if(! $item_hash) {
-
$r = q("SELECT mid FROM item
WHERE uid = %d
- AND item_thread_top = 1
+ AND mid = parent_mid
ORDER BY created DESC
limit 1",
intval(local_channel())
@@ -61,15 +60,16 @@ class Hq extends \Zotlabs\Web\Controller {
$item_hash = 'b64.' . base64url_encode($r[0]['mid']);
}
+
if(strpos($item_hash,'b64.') === 0)
$decoded = @base64url_decode(substr($item_hash,4));
+
if($decoded)
$item_hash = $decoded;
$updateable = false;
if(! $update) {
-
$channel = \App::get_channel();
$channel_acl = [
@@ -91,7 +91,7 @@ class Hq extends \Zotlabs\Web\Controller {
'bang' => '',
'visitor' => true,
'profile_uid' => local_channel(),
- 'return_path' => 'channel/' . $channel['channel_address'],
+ 'return_path' => 'hq',
'expanded' => true,
'editor_autocomplete' => true,
'bbco_autocomplete' => 'bbcode',
@@ -125,32 +125,34 @@ class Hq extends \Zotlabs\Web\Controller {
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']) . "' ) ";
- if($load)
- $simple_update = '';
if($static && $simple_update)
$simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
+
+ $sys = get_sys_channel();
+ $sql_extra = item_permissions_sql($sys['channel_id']);
if(! $update && ! $load) {
+ nav_set_selected('HQ');
+
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
// if the target item is not a post (eg a like) we want to address its thread parent
-
$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
// if we got a decoded hash we must encode it again before handing to javascript
if($decoded)
$mid = 'b64.' . base64url_encode($mid);
- $o .= '<div id="live-display"></div>' . "\r\n";
+ $o .= '<div id="live-hq"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . local_channel()
. "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] . "; </script>\r\n";
\App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),[
'$baseurl' => z_root(),
- '$pgtype' => 'display',
- '$uid' => '0',
+ '$pgtype' => 'hq',
+ '$uid' => local_channel(),
'$gid' => '0',
'$cid' => '0',
'$cmin' => '0',
@@ -177,45 +179,65 @@ class Hq extends \Zotlabs\Web\Controller {
'$net' => '',
'$mid' => $mid
]);
-
}
if($load) {
$r = null;
- $r = q("SELECT item.id as item_id from item
+ $r = q("SELECT item.id AS item_id FROM item
WHERE uid = %d
- and mid = '%s'
+ AND mid = '%s'
$item_normal
- limit 1",
+ LIMIT 1",
intval(local_channel()),
dbesc($target_item['parent_mid'])
);
+
if($r) {
$updateable = true;
}
+ if(!$r) {
+ $r = q("SELECT item.id AS item_id FROM item
+ LEFT JOIN abook ON item.author_xchan = abook.abook_xchan
+ WHERE mid = '%s' AND item.uid = %d $item_normal
+ AND (abook.abook_blocked = 0 or abook.abook_flags is null)
+ $sql_extra LIMIT 1",
+ dbesc($target_item['parent_mid']),
+ intval($sys['channel_id'])
+ );
+ }
}
-
elseif($update) {
$r = null;
- $r = q("SELECT item.parent AS item_id from item
+ $r = q("SELECT item.parent AS item_id FROM item
WHERE uid = %d
- and parent_mid = '%s'
+ AND parent_mid = '%s'
$item_normal_update
$simple_update
- limit 1",
+ LIMIT 1",
intval(local_channel()),
dbesc($target_item['parent_mid'])
);
+
if($r) {
$updateable = true;
}
+ if(!$r) {
+ $r = q("SELECT item.parent AS item_id FROM item
+ LEFT JOIN abook ON item.author_xchan = abook.abook_xchan
+ WHERE mid = '%s' AND item.uid = %d $item_normal_update $simple_update
+ AND (abook.abook_blocked = 0 or abook.abook_flags is null)
+ $sql_extra LIMIT 1",
+ dbesc($target_item['parent_mid']),
+ intval($sys['channel_id'])
+ );
+ }
+
$_SESSION['loadtime'] = datetime_convert();
}
-
else {
$r = [];
}
@@ -225,11 +247,11 @@ class Hq extends \Zotlabs\Web\Controller {
if($parents_str) {
$items = q("SELECT item.*, item.id AS item_id
FROM item
- WHERE parent in ( %s ) $item_normal ",
+ WHERE parent IN ( %s ) $item_normal ",
dbesc($parents_str)
);
- xchan_query($items);
+ xchan_query($items,true,local_channel());
$items = fetch_post_tags($items,true);
$items = conv_sort($items,'created');
}
@@ -238,10 +260,10 @@ class Hq extends \Zotlabs\Web\Controller {
$items = [];
}
- $o .= conversation($items, 'display', $update, 'client');
+ $o .= conversation($items, 'hq', $update, 'client');
if($updateable) {
- $x = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d and parent = %d ",
+ $x = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d AND parent = %d ",
intval(local_channel()),
intval($r[0]['item_id'])
);
@@ -249,10 +271,6 @@ class Hq extends \Zotlabs\Web\Controller {
$o .= '<div id="content-complete"></div>';
- if(($update && $load) && (! $items)) {
- notice( t('Something went wrong.') . EOL );
- }
-
return $o;
}
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index 406e554d1..84f9d2a21 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -496,7 +496,7 @@ class Ping extends \Zotlabs\Web\Controller {
$r = q("SELECT id, item_wall FROM item
WHERE item_unseen = 1 and uid = %d
$item_normal
- AND author_xchan != '%s' $sql_extra ",
+ AND author_xchan != '%s'",
intval(local_channel()),
dbesc($ob_hash)
);
diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php
index 43106e3af..4235f0b97 100644
--- a/Zotlabs/Module/Profile.php
+++ b/Zotlabs/Module/Profile.php
@@ -109,7 +109,7 @@ class Profile extends \Zotlabs\Web\Controller {
'title' => 'oembed'
]);
- $o .= advanced_profile($a);
+ $o .= advanced_profile();
call_hooks('profile_advanced',$o);
return $o;
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index 63370a141..db0f79060 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Module\Settings;
+require_once('include/selectors.php');
+
class Channel {
@@ -148,7 +150,8 @@ class Channel {
$defpermcat = ((x($_POST,'defpermcat')) ? notags(trim($_POST['defpermcat'])) : 'default');
$cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0);
- $mailhost = ((array_key_exists('mailhost',$_POST)) ? notags(trim($_POST['mailhost'])) : '');
+ $mailhost = ((array_key_exists('mailhost',$_POST)) ? notags(trim($_POST['mailhost'])) : '');
+ $profile_assign = ((x($_POST,'profile_assign')) ? notags(trim($_POST['profile_assign'])) : '');
$pageflags = $channel['channel_pageflags'];
@@ -242,6 +245,7 @@ class Channel {
set_pconfig(local_channel(),'system','cal_first_day',$cal_first_day);
set_pconfig(local_channel(),'system','default_permcat',$defpermcat);
set_pconfig(local_channel(),'system','email_notify_host',$mailhost);
+ set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
dbesc($username),
@@ -515,6 +519,9 @@ class Channel {
'$permissions' => t('Default Privacy Group'),
'$permdesc' => t("\x28click to open/close\x29"),
'$aclselect' => populate_acl($perm_defaults, false, \Zotlabs\Lib\PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))),
+ '$profseltxt' => t('Profile to assign new connections'),
+ '$profselect' => ((feature_enabled(local_channel(),'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign','')) : ''),
+
'$allow_cid' => acl2json($perm_defaults['allow_cid']),
'$allow_gid' => acl2json($perm_defaults['allow_gid']),
'$deny_cid' => acl2json($perm_defaults['deny_cid']),
diff --git a/Zotlabs/Module/Update_hq.php b/Zotlabs/Module/Update_hq.php
new file mode 100644
index 000000000..bb1495c64
--- /dev/null
+++ b/Zotlabs/Module/Update_hq.php
@@ -0,0 +1,31 @@
+<?php
+namespace Zotlabs\Module;
+
+// See update_profile.php for documentation
+
+require_once('include/group.php');
+
+
+class Update_hq extends \Zotlabs\Web\Controller {
+
+ function get() {
+
+ $profile_uid = intval($_GET['p']);
+
+ $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
+ header("Content-type: text/html");
+ echo "<!DOCTYPE html><html><body>\r\n";
+ echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
+
+ $mod = new Hq();
+ $text = $mod->get($profile_uid, $load);
+
+ echo str_replace("\t",' ',$text);
+ echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
+ echo "</body></html>\r\n";
+
+ killme();
+
+ }
+
+}
diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php
index e001ad929..2250e6e44 100644
--- a/Zotlabs/Module/Wall_attach.php
+++ b/Zotlabs/Module/Wall_attach.php
@@ -41,10 +41,12 @@ class Wall_attach extends \Zotlabs\Web\Controller {
$matches = [];
$partial = false;
- $x = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
- if($x) {
- // logger('Content-Range: ' . print_r($matches,true));
- $partial = true;
+ if(array_key_exists('HTTP_CONTENT_RANGE',$_SERVER)) {
+ $pm = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
+ if($pm) {
+ // logger('Content-Range: ' . print_r($matches,true));
+ $partial = true;
+ }
}
if($partial) {
diff --git a/Zotlabs/Widget/Cdav.php b/Zotlabs/Widget/Cdav.php
index 60a860f93..589f915c5 100644
--- a/Zotlabs/Widget/Cdav.php
+++ b/Zotlabs/Widget/Cdav.php
@@ -63,9 +63,10 @@ class Cdav {
$sharees = [];
$share_displayname = [];
+
foreach($invites as $invite) {
if(strpos($invite->href, 'mailto:') !== false) {
- $sharee = channelx_by_hash(substr($invite->href, 7));
+ $sharee = channelx_by_nick(substr($invite->principal, 11));
$sharees[] = [
'name' => $sharee['channel_name'],
'access' => (($invite->access == 3) ? ' (RW)' : ' (R)'),
@@ -173,4 +174,4 @@ class Cdav {
}
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php
new file mode 100644
index 000000000..0caa54a1a
--- /dev/null
+++ b/Zotlabs/Widget/Hq_controls.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Hq_controls {
+
+ function widget($arr) {
+
+ if (! local_channel())
+ return;
+
+ return replace_macros(get_markup_template('hq_controls.tpl'),
+ [
+ '$title' => t('HQ Control Panel'),
+ '$menu' => [
+ 'create' => [
+ 'label' => t('Create a new post'),
+ 'id' => 'jot-toggle',
+ 'href' => '#',
+ 'class' => ''
+ ]
+ ]
+ ]
+ );
+ }
+}
diff --git a/include/bbcode.php b/include/bbcode.php
index 7ebc8d37c..fd476766e 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -707,10 +707,12 @@ function parseIdentityAwareHTML($Text) {
return $Text;
}
- // BBcode 2 HTML was written by WAY2WEB.net
- // extended to work with Mistpark/Friendica/Redmatrix/Hubzilla - Mike Macgirvin
-function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) {
+function bbcode($Text, $options = []) {
+
+ $preserve_nl = ((array_key_exists('preserve_nl',$options)) ? $options['preserve_nl'] : false);
+ $tryoembed = ((array_key_exists('tryomebed',$options)) ? $options['tryoembed'] : true);
+ $cache = ((array_key_exists('cache',$options)) ? $options['cache'] : false);
call_hooks('bbcode_filter', $Text);
diff --git a/include/channel.php b/include/channel.php
index 708e74176..16afd8209 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1490,7 +1490,7 @@ function gender_icon($gender) {
}
-function advanced_profile(&$a) {
+function advanced_profile() {
require_once('include/text.php');
if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_profile'))
return '';
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index b36471924..a105bca19 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -72,21 +72,22 @@ function categories_widget($baseurl,$selected = '') {
$item_normal = item_normal();
$terms = array();
- $r = q("select distinct(term.term)
- from term join item on term.oid = item.id
- where item.uid = %d
- and term.uid = item.uid
- and term.ttype = %d
- and term.otype = %d
- and item.owner_xchan = '%s'
- and item.item_wall = 1
- $item_normal
- $sql_extra
- order by term.term asc",
+ $r = q("select distinct(term.term) from term join item on term.oid = item.id
+ where item.uid = %d
+ and term.uid = item.uid
+ and term.ttype = %d
+ and term.otype = %d
+ and item.owner_xchan = '%s'
+ and item.item_wall = 1
+ and item.verb != '%s'
+ $item_normal
+ $sql_extra
+ order by term.term asc",
intval(App::$profile['profile_uid']),
- intval(TERM_CATEGORY),
- intval(TERM_OBJ_POST),
- dbesc(App::$profile['channel_hash'])
+ intval(TERM_CATEGORY),
+ intval(TERM_OBJ_POST),
+ dbesc(App::$profile['channel_hash']),
+ dbesc(ACTIVITY_UPDATE)
);
if($r && count($r)) {
foreach($r as $rr)
@@ -118,19 +119,19 @@ function cardcategories_widget($baseurl,$selected = '') {
$terms = array();
$r = q("select distinct(term.term)
- from term join item on term.oid = item.id
- where item.uid = %d
- and term.uid = item.uid
- and term.ttype = %d
+ from term join item on term.oid = item.id
+ where item.uid = %d
+ and term.uid = item.uid
+ and term.ttype = %d
and term.otype = %d
- and item.owner_xchan = '%s'
+ and item.owner_xchan = '%s'
$item_normal
$sql_extra
- order by term.term asc",
+ order by term.term asc",
intval(App::$profile['profile_uid']),
- intval(TERM_CATEGORY),
+ intval(TERM_CATEGORY),
intval(TERM_OBJ_POST),
- dbesc(App::$profile['channel_hash'])
+ dbesc(App::$profile['channel_hash'])
);
if($r && count($r)) {
foreach($r as $rr)
@@ -163,19 +164,19 @@ function articlecategories_widget($baseurl,$selected = '') {
$terms = array();
$r = q("select distinct(term.term)
- from term join item on term.oid = item.id
- where item.uid = %d
- and term.uid = item.uid
- and term.ttype = %d
+ from term join item on term.oid = item.id
+ where item.uid = %d
+ and term.uid = item.uid
+ and term.ttype = %d
and term.otype = %d
- and item.owner_xchan = '%s'
+ and item.owner_xchan = '%s'
$item_normal
$sql_extra
- order by term.term asc",
+ order by term.term asc",
intval(App::$profile['profile_uid']),
- intval(TERM_CATEGORY),
+ intval(TERM_CATEGORY),
intval(TERM_OBJ_POST),
- dbesc(App::$profile['channel_hash'])
+ dbesc(App::$profile['channel_hash'])
);
if($r && count($r)) {
foreach($r as $rr)
diff --git a/include/conversation.php b/include/conversation.php
index 63d503177..70a38ee8e 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -513,6 +513,12 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
}
}
+ elseif ($mode === 'hq') {
+ $profile_owner = local_channel();
+ $page_writeable = true;
+ $live_update_div = '<div id="live-hq"></div>' . "\r\n";
+ }
+
elseif ($mode === 'channel') {
$profile_owner = App::$profile['profile_uid'];
$page_writeable = ($profile_owner == local_channel());
diff --git a/include/follow.php b/include/follow.php
index 56d8294c5..0843802c5 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -226,6 +226,8 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
}
+ $profile_assign = get_pconfig($uid,'system','profile_assign','');
+
$r = q("select abook_id, abook_xchan, abook_pending, abook_instance from abook
where abook_xchan = '%s' and abook_channel = %d limit 1",
@@ -265,6 +267,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
'abook_channel' => intval($uid),
'abook_closeness' => intval($closeness),
'abook_xchan' => $xchan_hash,
+ 'abook_profile' => $profile_assign,
'abook_feed' => intval(($xchan['xchan_network'] === 'rss') ? 1 : 0),
'abook_created' => datetime_convert(),
'abook_updated' => datetime_convert(),
diff --git a/include/items.php b/include/items.php
index 654cc5de3..042deed1b 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1749,6 +1749,22 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
intval($arr['uid'])
);
+ // perhaps the system channel owns the post and it's a pubstream item
+
+ if(! $r) {
+ $s = q("select channel_id from channel where channel_system = 1 limit 1");
+ if($s) {
+ $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d ORDER BY id ASC LIMIT 1",
+ dbesc($arr['parent_mid']),
+ intval($s[0]['channel_id'])
+ );
+ }
+ if($r) {
+ $arr['uid'] = $r[0]['uid'];
+ $arr['aid'] = 0;
+ }
+ }
+
if($r) {
// in case item_store was killed before the parent's parent attribute got set,
diff --git a/include/markdown.php b/include/markdown.php
index f398d279e..e4a35e3c3 100644
--- a/include/markdown.php
+++ b/include/markdown.php
@@ -204,7 +204,7 @@ function bb_to_markdown($Text, $options = []) {
$Text = $x['bbcode'];
// Convert it to HTML - don't try oembed
- $Text = bbcode($Text, $preserve_nl, false);
+ $Text = bbcode($Text, [ 'tryoembed' => false ]);
// Markdownify does not preserve previously escaped html entities such as <> and &.
$Text = str_replace(array('&lt;','&gt;','&amp;'),array('&_lt_;','&_gt_;','&_amp_;'),$Text);
diff --git a/include/taxonomy.php b/include/taxonomy.php
index fbd2a18db..a13a9cf77 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -55,18 +55,20 @@ function term_item_parent_query($uid,$table,$s,$type = TERM_UNKNOWN, $type2 = ''
$s = str_replace('*','%',$s);
if($type2) {
- $r = q("select parent from item left join term on term.oid = item.id where term.ttype in (%d, %d) and term.term like '%s' and term.uid = %d and term.otype = 1",
+ $r = q("select parent from item left join term on term.oid = item.id where term.ttype in (%d, %d) and term.term like '%s' and term.uid = %d and term.otype = 1 and item.verb != '%s'",
intval($type),
intval($type2),
dbesc($s),
- intval($uid)
+ intval($uid),
+ dbesc(ACTIVITY_UPDATE)
);
}
else {
- $r = q("select parent from item left join term on term.oid = item.id where term.ttype = %d and term.term like '%s' and term.uid = %d and term.otype = 1",
+ $r = q("select parent from item left join term on term.oid = item.id where term.ttype = %d and term.term like '%s' and term.uid = %d and term.otype = 1 and item.verb != '%s'",
intval($type),
dbesc($s),
- intval($uid)
+ intval($uid),
+ dbesc(ACTIVITY_UPDATE)
);
}
diff --git a/include/text.php b/include/text.php
index 343e3f00b..f3d522e04 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1679,9 +1679,9 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
require_once('include/bbcode.php');
if(stristr($text,'[nosmile]'))
- $s = bbcode($text,false,true,$cache);
+ $s = bbcode($text, [ 'cache' => $cache ]);
else
- $s = smilies(bbcode($text,false,true,$cache));
+ $s = smilies(bbcode($text, [ 'cache' => $cache ]));
$s = zidify_links($s);
diff --git a/include/zot.php b/include/zot.php
index 40e303bf1..d60494d94 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -394,6 +394,7 @@ function zot_refresh($them, $channel = null, $force = false) {
$next_birthday = NULL_DATE;
}
+ $profile_assign = get_pconfig($channel['channel_id'],'system','profile_assign','');
// Keep original perms to check if we need to notify them
$previous_perms = get_all_perms($channel['channel_id'],$x['hash']);
@@ -455,6 +456,7 @@ function zot_refresh($them, $channel = null, $force = false) {
'abook_channel' => intval($channel['channel_id']),
'abook_closeness' => intval($closeness),
'abook_xchan' => $x['hash'],
+ 'abook_profile' => $profile_assign,
'abook_created' => datetime_convert(),
'abook_updated' => datetime_convert(),
'abook_dob' => $next_birthday,
diff --git a/view/js/main.js b/view/js/main.js
index c39d6c84c..1738ca7e9 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -437,6 +437,7 @@ function NavUpdate() {
if($('#live-channel').length) { src = 'channel'; liveUpdate(); }
if($('#live-pubstream').length) { src = 'pubstream'; liveUpdate(); }
if($('#live-display').length) { src = 'display'; liveUpdate(); }
+ if($('#live-hq').length) { src = 'hq'; liveUpdate(); }
if($('#live-search').length) { src = 'search'; liveUpdate(); }
// if($('#live-cards').length) { src = 'cards'; liveUpdate(); }
// if($('#live-articles').length) { src = 'articles'; liveUpdate(); }
diff --git a/view/js/mod_hq.js b/view/js/mod_hq.js
index 8bbd5e3ad..3ce5f1ca6 100644
--- a/view/js/mod_hq.js
+++ b/view/js/mod_hq.js
@@ -1,3 +1,15 @@
+$(document).on('click', '#jot-toggle', function(e) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ $(this).toggleClass('active');
+ $(window).scrollTop(0);
+ $('#jot-popup').toggle();
+ $('#profile-jot-text').focus();
+
+});
+
+
function hqLiveUpdate(notify_id) {
if(typeof profile_uid === 'undefined') profile_uid = false; /* Should probably be unified with channelId defined in head.tpl */
diff --git a/view/pdl/mod_hq.pdl b/view/pdl/mod_hq.pdl
index e657fa88b..450fcb9a7 100644
--- a/view/pdl/mod_hq.pdl
+++ b/view/pdl/mod_hq.pdl
@@ -1,3 +1,6 @@
+[region=aside]
+[widget=hq_controls][/widget]
+[/region]
[region=right_aside]
[widget=notifications][/widget]
[/region]
diff --git a/view/tpl/cdav_widget_calendar.tpl b/view/tpl/cdav_widget_calendar.tpl
index ec2257a19..8d6414ec6 100644
--- a/view/tpl/cdav_widget_calendar.tpl
+++ b/view/tpl/cdav_widget_calendar.tpl
@@ -14,10 +14,10 @@
<div id="share-calendar-{{$calendar.calendarid}}" class="sub-menu" style="display: none; border-color: {{$calendar.color}};">
{{if $calendar.sharees}}
{{foreach $calendar.sharees as $sharee}}
- <div id="sharee-{{$calendar.calendarid}}" class="form-group">
+ <div id="sharee-{{$calendar.calendarid}}-{{$sharee@iteration}}" class="form-group">
<i class="fa fa-share generic-icons"></i>{{$sharee.name}}&nbsp;{{$sharee.access}}
<div class="pull-right">
- <a href="#" onclick="dropItem('/cdav/calendar/dropsharee/{{$calendar.calendarid}}/{{$calendar.instanceid}}/{{$sharee.hash}}', '#sharee-{{$calendar.calendarid}}'); return false;"><i class="fa fa-trash-o drop-icons"></i></a>
+ <a href="#" onclick="dropItem('/cdav/calendar/dropsharee/{{$calendar.calendarid}}/{{$calendar.instanceid}}/{{$sharee.hash}}', '#sharee-{{$calendar.calendarid}}-{{$sharee@iteration}}'); return false;"><i class="fa fa-trash-o drop-icons"></i></a>
</div>
</div>
{{/foreach}}
diff --git a/view/tpl/hq_controls.tpl b/view/tpl/hq_controls.tpl
new file mode 100755
index 000000000..d7f6d436f
--- /dev/null
+++ b/view/tpl/hq_controls.tpl
@@ -0,0 +1,8 @@
+<div class="widget">
+ <h3>{{$title}}</h3>
+ <ul class="nav nav-pills flex-column">
+ {{foreach $menu as $m}}
+ <li class="nav-item"><a href="{{$m.href}}" id="{{$m.id}}" class="nav-link{{if $m.class}} {{$m.class}}{{/if}}">{{$m.label}}</a></li>
+ {{/foreach}}
+ </ul>
+</div>
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index 8ab9a79a0..eeb2011cd 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -36,7 +36,7 @@
{{/if}}
{{if $module == 'hq'}}
- if(b64mid !== 'undefined' && path !== 'pubstre') {
+ if(b64mid !== 'undefined') {
{{else}}
if(path === 'display' && b64mid) {
{{/if}}
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index 33e0aa925..0f42a6e8a 100755
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -167,6 +167,10 @@
</div>
<div id="miscellaneous-settings-collapse" class="collapse" role="tabpanel" aria-labelledby="miscellaneous-settings">
<div class="section-content-tools-wrapper">
+ {{if $profselect}}
+ <label for="contact-profile-selector">{{$profseltxt}}</label>
+ {{$profselect}}
+ {{/if}}
{{if $menus}}
<div class="form-group channel-menu">
<label for="channel_menu">{{$menu_desc}}</label>