From 34b42566b6e2e413f7280ea73a415c9829d4ded1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 20 Mar 2016 02:25:59 +0100 Subject: add fixme --- mod/acl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/acl.php b/mod/acl.php index aaf056b60..d48a9b19c 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -47,7 +47,7 @@ function acl_init(&$a){ $contacts = array(); if ($type=='' || $type=='g'){ - + $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`, %s as uids FROM `groups`,`group_member` @@ -71,6 +71,8 @@ function acl_init(&$a){ "name" => $g['name'], "id" => $g['id'], "xid" => $g['hash'], + //FIXME: db_concat aka GROUP_CONCAT has a defoult setting of group_concat_max_len = 1024 in mysql. + // This value is quickly exceeded here. As a result $g['uids'] only contains a part of the complete xchan set. "uids" => explode(",",$g['uids']), "link" => '' ); -- cgit v1.2.3 From 9fcd470acacf3dc283c91c52f591f5aaa3983ba4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 20 Mar 2016 20:26:55 +0100 Subject: fix #328 by using a seperate query instead of group_concat --- mod/acl.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'mod') diff --git a/mod/acl.php b/mod/acl.php index d48a9b19c..6eeca8af0 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -2,6 +2,7 @@ /* ACL selector json backend */ require_once("include/acl_selectors.php"); +require_once("include/group.php"); function acl_init(&$a){ @@ -48,32 +49,28 @@ function acl_init(&$a){ if ($type=='' || $type=='g'){ - $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`, - %s as uids + $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name` FROM `groups`,`group_member` WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d - AND `group_member`.`gid`=`groups`.`id` - $sql_extra + AND `group_member`.`gid`=`groups`.`id` + $sql_extra GROUP BY `groups`.`id` ORDER BY `groups`.`name` LIMIT %d OFFSET %d", - db_concat('group_member.xchan', ','), intval(local_channel()), intval($count), intval($start) ); foreach($r as $g){ -// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']); +// logger('acl: group: ' . $g['name'] . ' members: ' . group_get_members_xchan($g['id'])); $groups[] = array( "type" => "g", "photo" => "images/twopeople.png", "name" => $g['name'], "id" => $g['id'], "xid" => $g['hash'], - //FIXME: db_concat aka GROUP_CONCAT has a defoult setting of group_concat_max_len = 1024 in mysql. - // This value is quickly exceeded here. As a result $g['uids'] only contains a part of the complete xchan set. - "uids" => explode(",",$g['uids']), + "uids" => group_get_members_xchan($g['id']), "link" => '' ); } -- cgit v1.2.3 From eb68b66c58fb0fb0511827a51d39ef0b6aff6d33 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 20 Mar 2016 15:27:26 -0700 Subject: issue #330 - permit archived connections in ACLs. If they are to be blocked for delivery (or some other purpose) this should probably happen in the delivery mechanism (or other related sub-system) rather than the permissions mechanism, although currently we still attempt direct delivery to archived connections. Technically "archived" means merely that we won't 'poll' the connection according to the current definition. --- mod/acl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/acl.php b/mod/acl.php index aaf056b60..d3e006e87 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -94,7 +94,7 @@ function acl_init(&$a){ $r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags, abook_self FROM abook left join xchan on abook_xchan = xchan_hash - WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and abook_archived = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , + WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , intval(local_channel()) ); @@ -118,7 +118,7 @@ function acl_init(&$a){ $r2 = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags, abook_self FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_channel IN ($extra_channels_sql) $known_hashes_sql AND abook_blocked = 0 and abook_pending = 0 and abook_archived = 0 and abook_hidden = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc"); + WHERE abook_channel IN ($extra_channels_sql) $known_hashes_sql AND abook_blocked = 0 and abook_pending = 0 and abook_hidden = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc"); if($r2) $r = array_merge($r,$r2); -- cgit v1.2.3 From fea532af4da522001c71eb79df5fc49c83833da9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 20 Mar 2016 19:55:53 -0700 Subject: rework salmon - important, update addons also if you have enabled gnusoc addon --- mod/oep.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/oep.php b/mod/oep.php index 42535c069..36741a752 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -106,7 +106,7 @@ function oep_display_reply($args) { $w = (($maxwidth) ? $maxwidth : 640); $h = (($maxheight) ? $maxheight : $w * 2 / 3); - $ret['html'] = '
' . $o . '
'; + $ret['html'] = '
' . $o . '
'; $ret['width'] = $w; $ret['height'] = $h; @@ -165,7 +165,7 @@ function oep_mid_reply($args) { $w = (($maxwidth) ? $maxwidth : 640); $h = (($maxheight) ? $maxheight : $w * 2 / 3); - $ret['html'] = '
' . $o . '
'; + $ret['html'] = '
' . $o . '
'; $ret['width'] = $w; $ret['height'] = $h; -- cgit v1.2.3 From 97e1a6dfde7d8d8e23d463ab22f24011cbce0d8c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 22 Mar 2016 02:06:19 +0100 Subject: whip mod manage into shape --- mod/manage.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/manage.php b/mod/manage.php index 671003efd..1f7c26cd8 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -134,9 +134,7 @@ function manage_content(&$a) { } } - $links = array( - array( 'new_channel', t('Create a new channel'), t('Create a new channel')) - ); + $create = array( 'new_channel', t('Create a new channel'), t('Create New')); $delegates = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and (abook_their_perms & %d) > 0", @@ -156,8 +154,6 @@ function manage_content(&$a) { $delegates = null; } - - $o = replace_macros(get_markup_template('channels.tpl'), array( '$header' => t('Channel Manager'), '$msg_selected' => t('Current Channel'), @@ -165,17 +161,16 @@ function manage_content(&$a) { '$desc' => t('Switch to one of your channels by selecting it.'), '$msg_default' => t('Default Channel'), '$msg_make_default' => t('Make Default'), - '$links' => $links, + '$create' => $create, '$all_channels' => $channels, '$mail_format' => t('%d new messages'), '$intros_format' => t('%d new introductions'), '$channel_usage_message' => $channel_usage_message, - '$delegate_header' => t('Delegated Channels'), + '$delegated_desc' => t('Delegated Channel'), '$delegates' => $delegates, )); - return $o; } -- cgit v1.2.3 From c6b89b99b9a98a5a25087190eeeee15365c7a853 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 22 Mar 2016 10:29:17 +0100 Subject: Add a link to /locs to channel manager --- mod/manage.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/manage.php b/mod/manage.php index 1f7c26cd8..cb845befe 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -168,6 +168,7 @@ function manage_content(&$a) { '$channel_usage_message' => $channel_usage_message, '$delegated_desc' => t('Delegated Channel'), '$delegates' => $delegates, + '$locs' => t('Manage locations') )); -- cgit v1.2.3 From 6f2ba0c6193a229b3f371de2cae7b314927d4cbb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 22 Mar 2016 19:58:59 -0700 Subject: rewrite the webfinger discovery logic --- mod/xrd.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/xrd.php b/mod/xrd.php index da4ab51a4..ed8e1eabe 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -7,8 +7,12 @@ function xrd_init(&$a) { $uri = urldecode(notags(trim($_GET['uri']))); logger('xrd: ' . $uri,LOGGER_DEBUG); - if(substr($uri,0,4) === 'http') + $resource = $uri; + + if(substr($uri,0,4) === 'http') { + $uri = str_replace('~','',$uri); $name = basename($uri); + } else { $local = str_replace('acct:', '', $uri); if(substr($local,0,2) == '//') @@ -35,9 +39,18 @@ function xrd_init(&$a) { header("Content-type: application/xrd+xml"); + $aliases = array('acct:' . $r[0]['channel_address'] . '@' . $a->get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']); + + for($x = 0; $x < count($aliases); $x ++) { + if($aliases[$x] === $resource) + unset($aliases[$x]); + } + + $o = replace_macros(get_markup_template('xrd_person.tpl'), array( '$nick' => $r[0]['channel_address'], - '$accturi' => $uri, + '$accturi' => $resource, + '$aliases' => $aliases, '$profile_url' => $a->get_baseurl() . '/channel/' . $r[0]['channel_address'], '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['channel_address'], '$atom' => $a->get_baseurl() . '/feed/' . $r[0]['channel_address'], -- cgit v1.2.3