Merge branch 'dev'

This commit is contained in:
zotlabs
2018-10-04 19:20:10 -07:00
144 changed files with 1362 additions and 910 deletions

View File

@@ -124,7 +124,7 @@ function account_store_lowlevel($arr) {
'account_expires' => ((array_key_exists('account_expires',$arr)) ? $arr['account_expires'] : '0001-01-01 00:00:00'),
'account_expire_notified' => ((array_key_exists('account_expire_notified',$arr)) ? $arr['account_expire_notified'] : '0001-01-01 00:00:00'),
'account_service_class' => ((array_key_exists('account_service_class',$arr)) ? $arr['account_service_class'] : ''),
'account_level' => ((array_key_exists('account_level',$arr)) ? $arr['account_level'] : '0'),
'account_level' => '5',
'account_password_changed' => ((array_key_exists('account_password_changed',$arr)) ? $arr['account_password_changed'] : '0001-01-01 00:00:00')
];
@@ -215,7 +215,7 @@ function create_account($arr) {
'account_created' => datetime_convert(),
'account_flags' => intval($flags),
'account_roles' => intval($roles),
'account_level' => intval($techlevel),
'account_level' => 5,
'account_expires' => $expires,
'account_service_class' => $default_service_class
]
@@ -821,13 +821,6 @@ function upgrade_bool_message($bbcode = false) {
function get_account_techlevel($account_id = 0) {
if(! $account_id) {
$x = \App::get_account();
}
else {
$x = get_account_by_id($account_id);
}
return (($x) ? intval($x['account_level']) : 0);
return (5);
}

View File

@@ -89,7 +89,7 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
}
}
$r = q("SELECT id, hash, gname FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
$r = q("SELECT id, hash, gname FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval(local_channel())
);

View File

@@ -350,20 +350,20 @@
$r = null;
if($_REQUEST['group_id']) {
$r = q("select * from groups where uid = %d and id = %d limit 1",
$r = q("select * from pgrp where uid = %d and id = %d limit 1",
intval(api_user()),
intval($_REQUEST['group_id'])
);
}
elseif($_REQUEST['group_name']) {
$r = q("select * from groups where uid = %d and gname = '%s' limit 1",
$r = q("select * from pgrp where uid = %d and gname = '%s' limit 1",
intval(api_user()),
dbesc($_REQUEST['group_name'])
);
}
if($r) {
$x = q("select * from group_member left join abook on abook_xchan = xchan and abook_channel = group_member.uid left join xchan on group_member.xchan = xchan.xchan_hash
$x = q("select * from pgrp_member left join abook on abook_xchan = xchan and abook_channel = pgrp_member.uid left join xchan on pgrp_member.xchan = xchan.xchan_hash
where gid = %d",
intval($r[0]['id'])
);
@@ -376,7 +376,7 @@
if(api_user() === false)
return false;
$r = q("select * from groups where uid = %d",
$r = q("select * from pgrp where uid = %d",
intval(api_user())
);
json_return_and_die($r);

View File

@@ -968,9 +968,6 @@ function bbcode($Text, $options = []) {
$Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
}
if (get_account_techlevel() < 2)
$Text = str_replace('<span class="bookmark-identifier">#^</span>', '', $Text);
// Perform MAIL Search
if (strpos($Text,'[/mail]') !== false) {
$Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);

View File

@@ -447,7 +447,7 @@ function create_identity($arr) {
// if our role_permissions indicate that we're using a default collection ACL, add it.
if(is_array($role_permissions) && $role_permissions['default_collection']) {
$r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
$r = q("select hash from pgrp where uid = %d and gname = '%s' limit 1",
intval($newuid),
dbesc( t('Friends') )
);
@@ -837,14 +837,14 @@ function identity_basic_export($channel_id, $sections = null) {
$ret['hubloc'] = $r;
}
$r = q("select * from groups where uid = %d ",
$r = q("select * from pgrp where uid = %d ",
intval($channel_id)
);
if($r)
$ret['group'] = $r;
$r = q("select * from group_member where uid = %d ",
$r = q("select * from pgrp_member where uid = %d ",
intval($channel_id)
);
if($r)
@@ -2579,8 +2579,8 @@ function channel_remove($channel_id, $local = true, $unset_session = false) {
q("DELETE FROM chatroom WHERE cr_uid = %d", intval($channel_id));
q("DELETE FROM conv WHERE uid = %d", intval($channel_id));
q("DELETE FROM groups WHERE uid = %d", intval($channel_id));
q("DELETE FROM group_member WHERE uid = %d", intval($channel_id));
q("DELETE FROM pgrp WHERE uid = %d", intval($channel_id));
q("DELETE FROM pgrp_member WHERE uid = %d", intval($channel_id));
q("DELETE FROM event WHERE uid = %d", intval($channel_id));
q("DELETE FROM mail WHERE channel_id = %d", intval($channel_id));
q("DELETE FROM menu WHERE menu_channel_id = %d", intval($channel_id));

View File

@@ -296,7 +296,7 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) {
$r = q("delete from event where event_xchan = '%s'",
dbesc($xchan)
);
$r = q("delete from group_member where xchan = '%s'",
$r = q("delete from pgrp_member where xchan = '%s'",
dbesc($xchan)
);
$r = q("delete from mail where ( from_xchan = '%s' or to_xchan = '%s' )",
@@ -402,7 +402,7 @@ function contact_remove($channel_id, $abook_id) {
intval($channel_id)
);
$r = q("delete from group_member where xchan = '%s' and uid = %d",
$r = q("delete from pgrp_member where xchan = '%s' and uid = %d",
dbesc($abook['abook_xchan']),
intval($channel_id)
);

View File

@@ -888,6 +888,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
'$user' => App::$user,
'$threads' => $threads,
'$wait' => t('Loading...'),
'$conversation_tools' => t('Conversation Tools'),
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
));
@@ -1231,13 +1232,27 @@ function format_like($cnt, $arr, $type, $id) {
return $o;
}
/**
* Wrapper to allow addons to replace the status editor if desired.
*/
function status_editor($a, $x, $popup = false, $module='') {
$hook_info = ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module];
call_hooks('status_editor',$hook_info);
if ($hook_info['editor_html'] == '') {
return hz_status_editor($a, $x, $popup);
} else {
return $hook_info['editor_html'];
}
}
/**
* This is our general purpose content editor.
* It was once nicknamed "jot" and you may see references to "jot" littered throughout the code.
* They are referring to the content editor or components thereof.
*/
function status_editor($a, $x, $popup = false) {
function hz_status_editor($a, $x, $popup = false) {
$o = '';
@@ -1447,7 +1462,8 @@ function status_editor($a, $x, $popup = false) {
'$expanded' => ((x($x, 'expanded')) ? $x['expanded'] : false),
'$bbcode' => ((x($x, 'bbcode')) ? $x['bbcode'] : false),
'$parent' => ((array_key_exists('parent',$x) && $x['parent']) ? $x['parent'] : 0),
'$reset' => $reset
'$reset' => $reset,
'$is_owner' => ((local_channel() && (local_channel() == $x['profile_uid'])) ? true : false)
));
if ($popup === true) {

View File

@@ -47,7 +47,15 @@ function feature_level($feature,$def) {
function process_module_features_get($uid, $features) {
unset($features[0]);
foreach($features as $f) {
$arr[] = array('feature_' . $f[0],$f[1],((intval(feature_enabled($uid, $f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
$arr[] = [
'feature_' . $f[0],
$f[1],
((intval(feature_enabled($uid, $f[0]))) ? "1" : ''),
$f[2],
[t('Off'),t('On')],
(($f[4] === false) ? '' : 'disabled'),
$f[5]
];
}
return $arr;
}
@@ -61,8 +69,6 @@ function process_module_features_post($uid, $features, $post_arr) {
else
set_pconfig($uid,'feature', $k, '');
}
if($post_arr['rpath'])
goaway($post_arr['rpath']);
}
function get_features($filtered = true, $level = (-1)) {
@@ -71,191 +77,6 @@ function get_features($filtered = true, $level = (-1)) {
$arr = [
// General
'general' => [
t('General Features'),
[
'start_menu',
t('New Member Links'),
t('Display new member quick links menu'),
(($account['account_created'] > datetime_convert('','','now - 60 days')) ? true : false),
get_config('feature_lock','start_menu'),
feature_level('start_menu',1),
],
/*
[
'hide_rating',
t('Hide Rating'),
t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),
false,
get_config('feature_lock','hide_rating'),
feature_level('hide_rating',3),
],
*/
[
'private_notes',
t('Private Notes'),
t('Enables a tool to store notes and reminders (note: not encrypted)'),
false,
get_config('feature_lock','private_notes'),
feature_level('private_notes',1),
],
[
'premium_channel',
t('Premium Channel'),
t('Allows you to set restrictions and terms on those that connect with your channel'),
false,
get_config('feature_lock','premium_channel'),
feature_level('premium_channel',4),
],
[
'advanced_dirsearch',
t('Advanced Directory Search'),
t('Allows creation of complex directory search queries'),
false,
get_config('feature_lock','advanced_dirsearch'),
feature_level('advanced_dirsearch',4),
],
[
'advanced_theming',
t('Advanced Theme and Layout Settings'),
t('Allows fine tuning of themes and page layouts'),
false,
get_config('feature_lock','advanced_theming'),
feature_level('advanced_theming',4),
],
],
'access_control' => [
t('Access Control and Permissions'),
[
'groups',
t('Privacy Groups'),
t('Enable management and selection of privacy groups'),
true,
get_config('feature_lock','groups'),
feature_level('groups',0),
],
[
'permcats',
t('Permission Categories'),
t('Create custom connection permission limits'),
false,
get_config('feature_lock','permcats'),
feature_level('permcats',2),
],
[
'oauth_clients',
t('OAuth1 Clients'),
t('Manage OAuth1 authenticatication tokens for mobile and remote apps.'),
false,
get_config('feature_lock','oauth_clients'),
feature_level('oauth_clients',1),
],
[
'oauth2_clients',
t('OAuth2 Clients'),
t('Manage OAuth2 authenticatication tokens for mobile and remote apps.'),
false,
get_config('feature_lock','oauth2_clients'),
feature_level('oauth2_clients',1),
],
[
'access_tokens',
t('Access Tokens'),
t('Create access tokens so that non-members can access private content.'),
false,
get_config('feature_lock','access_tokens'),
feature_level('access_tokens',2),
],
],
// Item tools
'tools' => [
t('Post/Comment Tools'),
[
'commtag',
t('Community Tagging'),
t('Ability to tag existing posts'),
false,
get_config('feature_lock','commtag'),
feature_level('commtag',1),
],
[
'categories',
t('Post Categories'),
t('Add categories to your posts'),
false,
get_config('feature_lock','categories'),
feature_level('categories',1),
],
[
'emojis',
t('Emoji Reactions'),
t('Add emoji reaction ability to posts'),
true,
get_config('feature_lock','emojis'),
feature_level('emojis',1),
],
[
'filing',
t('Saved Folders'),
t('Ability to file posts under folders'),
false,
get_config('feature_lock','filing'),
feature_level('filing',2),
],
[
'dislike',
t('Dislike Posts'),
t('Ability to dislike posts/comments'),
false,
get_config('feature_lock','dislike'),
feature_level('dislike',1),
],
[
'star_posts',
t('Star Posts'),
t('Ability to mark special posts with a star indicator'),
false,
get_config('feature_lock','star_posts'),
feature_level('star_posts',1),
],
[
'tagadelic',
t('Tag Cloud'),
t('Provide a personal tag cloud on your channel page'),
false,
get_config('feature_lock','tagadelic'),
feature_level('tagadelic',2),
],
],
############################################
############################################
'calendar' => [
t('CalDAV'),
@@ -270,6 +91,35 @@ function get_features($filtered = true, $level = (-1)) {
],
'channel_home' => [
t('Channel Home'),
[
'archives',
t('Search by Date'),
t('Ability to select posts by date ranges'),
false,
get_config('feature_lock','archives')
],
[
'tagadelic',
t('Tag Cloud'),
t('Provide a personal tag cloud on your channel page'),
false,
get_config('feature_lock','tagadelic'),
],
[
'channel_list_mode',
t('Use blog/list mode'),
t('Comments will be displayed separately'),
false,
get_config('feature_lock','channel_list_mode'),
]
],
'connections' => [
t('Connections'),
@@ -283,10 +133,71 @@ function get_features($filtered = true, $level = (-1)) {
]
],
'conversation' => [
t('Conversation'),
[
'commtag',
t('Community Tagging'),
t('Ability to tag existing posts'),
false,
get_config('feature_lock','commtag'),
],
[
'emojis',
t('Emoji Reactions'),
t('Add emoji reaction ability to posts'),
true,
get_config('feature_lock','emojis'),
],
[
'dislike',
t('Dislike Posts'),
t('Ability to dislike posts/comments'),
false,
get_config('feature_lock','dislike'),
],
[
'star_posts',
t('Star Posts'),
t('Ability to mark special posts with a star indicator'),
false,
get_config('feature_lock','star_posts'),
]
],
'directory' => [
t('Directory'),
[
'advanced_dirsearch',
t('Advanced Directory Search'),
t('Allows creation of complex directory search queries'),
false,
get_config('feature_lock','advanced_dirsearch'),
]
],
'editor' => [
t('Editor'),
[
'categories',
t('Post Categories'),
t('Add categories to your posts'),
false,
get_config('feature_lock','categories'),
feature_level('categories',1),
],
[
'large_photos',
t('Large Photos'),
@@ -391,7 +302,7 @@ function get_features($filtered = true, $level = (-1)) {
'nav_channel_select',
t('Navigation Channel Select'),
t('Change channels directly from within the navigation dropdown menu'),
true,
false,
get_config('feature_lock','nav_channel_select'),
]
@@ -401,14 +312,6 @@ function get_features($filtered = true, $level = (-1)) {
t('Network'),
[
'archives',
t('Search by Date'),
t('Ability to select posts by date ranges'),
false,
get_config('feature_lock','archives')
],
[
'savedsearch',
t('Saved Searches'),
@@ -417,6 +320,14 @@ function get_features($filtered = true, $level = (-1)) {
get_config('feature_lock','savedsearch')
],
[
'filing',
t('Saved Folders'),
t('Ability to file posts under folders'),
false,
get_config('feature_lock','filing'),
],
[
'order_tab',
t('Alternate Stream Order'),
@@ -463,6 +374,14 @@ function get_features($filtered = true, $level = (-1)) {
t('Show friend and connection suggestions'),
false,
get_config('feature_lock','suggest')
],
[
'network_list_mode',
t('Use blog/list mode'),
t('Comments will be displayed separately'),
false,
get_config('feature_lock','network_list_mode'),
]
],
@@ -519,8 +438,6 @@ function get_features($filtered = true, $level = (-1)) {
$arr = $x['features'];
$techlevel = (($level >= 0) ? $level : get_account_techlevel());
// removed any locked features and remove the entire category if this makes it empty
if($filtered) {
@@ -531,9 +448,6 @@ function get_features($filtered = true, $level = (-1)) {
for($y = 0; $y < count($arr[$k]); $y ++) {
$disabled = false;
if(is_array($arr[$k][$y])) {
if($arr[$k][$y][5] > $techlevel) {
$disabled = true;
}
if($arr[$k][$y][4] !== false) {
$disabled = true;
}

View File

@@ -14,11 +14,11 @@ function group_add($uid,$name,$public = 0) {
// access lists. What we're doing here is reviving the dead group, but old content which
// was restricted to this group may now be seen by the new group members.
$z = q("SELECT * FROM groups WHERE id = %d LIMIT 1",
$z = q("SELECT * FROM pgrp WHERE id = %d LIMIT 1",
intval($r)
);
if(($z) && $z[0]['deleted']) {
q('UPDATE groups SET deleted = 0 WHERE id = %d', intval($z[0]['id']));
q('UPDATE pgrp SET deleted = 0 WHERE id = %d', intval($z[0]['id']));
notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
}
return true;
@@ -28,13 +28,13 @@ function group_add($uid,$name,$public = 0) {
$dups = false;
$hash = random_string() . $name;
$r = q("SELECT id FROM groups WHERE hash = '%s' LIMIT 1", dbesc($hash));
$r = q("SELECT id FROM pgrp WHERE hash = '%s' LIMIT 1", dbesc($hash));
if($r)
$dups = true;
} while($dups == true);
$r = q("INSERT INTO groups ( hash, uid, visible, gname )
$r = q("INSERT INTO pgrp ( hash, uid, visible, gname )
VALUES( '%s', %d, %d, '%s' ) ",
dbesc($hash),
intval($uid),
@@ -53,7 +53,7 @@ function group_add($uid,$name,$public = 0) {
function group_rmv($uid,$name) {
$ret = false;
if(x($uid) && x($name)) {
$r = q("SELECT id, hash FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1",
$r = q("SELECT id, hash FROM pgrp WHERE uid = %d AND gname = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -98,13 +98,13 @@ function group_rmv($uid,$name) {
}
// remove all members
$r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d ",
$r = q("DELETE FROM pgrp_member WHERE uid = %d AND gid = %d ",
intval($uid),
intval($group_id)
);
// remove group
$r = q("UPDATE groups SET deleted = 1 WHERE uid = %d AND gname = '%s'",
$r = q("UPDATE pgrp SET deleted = 1 WHERE uid = %d AND gname = '%s'",
intval($uid),
dbesc($name)
);
@@ -121,7 +121,7 @@ function group_rmv($uid,$name) {
function group_byname($uid,$name) {
if((! $uid) || (! strlen($name)))
return false;
$r = q("SELECT * FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE uid = %d AND gname = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -134,7 +134,7 @@ function group_byname($uid,$name) {
function group_rec_byhash($uid,$hash) {
if((! $uid) || (! strlen($hash)))
return false;
$r = q("SELECT * FROM groups WHERE uid = %d AND hash = '%s' LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE uid = %d AND hash = '%s' LIMIT 1",
intval($uid),
dbesc($hash)
);
@@ -149,7 +149,7 @@ function group_rmv_member($uid,$name,$member) {
return false;
if(! ( $uid && $gid && $member))
return false;
$r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' ",
$r = q("DELETE FROM pgrp_member WHERE uid = %d AND gid = %d AND xchan = '%s' ",
intval($uid),
intval($gid),
dbesc($member)
@@ -169,7 +169,7 @@ function group_add_member($uid,$name,$member,$gid = 0) {
if((! $gid) || (! $uid) || (! $member))
return false;
$r = q("SELECT * FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1",
$r = q("SELECT * FROM pgrp_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1",
intval($uid),
intval($gid),
dbesc($member)
@@ -179,7 +179,7 @@ function group_add_member($uid,$name,$member,$gid = 0) {
// we indicate success because the group member was in fact created
// -- It was just created at another time
if(! $r)
$r = q("INSERT INTO group_member (uid, gid, xchan)
$r = q("INSERT INTO pgrp_member (uid, gid, xchan)
VALUES( %d, %d, '%s' ) ",
intval($uid),
intval($gid),
@@ -194,9 +194,9 @@ function group_add_member($uid,$name,$member,$gid = 0) {
function group_get_members($gid) {
$ret = array();
if(intval($gid)) {
$r = q("SELECT * FROM group_member
LEFT JOIN abook ON abook_xchan = group_member.xchan left join xchan on xchan_hash = abook_xchan
WHERE gid = %d AND abook_channel = %d and group_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ",
$r = q("SELECT * FROM pgrp_member
LEFT JOIN abook ON abook_xchan = pgrp_member.xchan left join xchan on xchan_hash = abook_xchan
WHERE gid = %d AND abook_channel = %d and pgrp_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ",
intval($gid),
intval(local_channel()),
intval(local_channel())
@@ -210,7 +210,7 @@ function group_get_members($gid) {
function group_get_members_xchan($gid) {
$ret = array();
if(intval($gid)) {
$r = q("SELECT xchan FROM group_member WHERE gid = %d AND uid = %d",
$r = q("SELECT xchan FROM pgrp_member WHERE gid = %d AND uid = %d",
intval($gid),
intval(local_channel())
);
@@ -248,7 +248,7 @@ function mini_group_select($uid,$group = '') {
$grps = array();
$o = '';
$r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
$r = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval($uid)
);
$grps[] = array('name' => '', 'hash' => '0', 'selected' => '');
@@ -274,13 +274,13 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
$o = '';
if(! (local_channel() && feature_enabled(local_channel(),'groups'))) {
if(! (local_channel() && \Zotlabs\Lib\Apps::system_app_installed(local_channel(), 'Privacy Groups'))) {
return '';
}
$groups = array();
$r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
$r = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval($_SESSION['uid'])
);
$member_of = array();
@@ -361,7 +361,7 @@ function expand_groups($g) {
stringify_array_elms($x,true);
$groups = implode(',', $x);
if($groups) {
$r = q("SELECT xchan FROM group_member WHERE gid IN ( select id from groups where hash in ( $groups ))");
$r = q("SELECT xchan FROM pgrp_member WHERE gid IN ( select id from pgrp where hash in ( $groups ))");
if($r) {
foreach($r as $rr) {
$ret[] = $rr['xchan'];
@@ -375,7 +375,7 @@ function expand_groups($g) {
function member_of($c) {
$r = q("SELECT groups.gname, groups.id FROM groups LEFT JOIN group_member ON group_member.gid = groups.id WHERE group_member.xchan = '%s' AND groups.deleted = 0 ORDER BY groups.gname ASC ",
$r = q("SELECT pgrp.gname, pgrp.id FROM pgrp LEFT JOIN pgrp_member ON pgrp_member.gid = pgrp.id WHERE pgrp_member.xchan = '%s' AND pgrp.deleted = 0 ORDER BY pgrp.gname ASC ",
dbesc($c)
);
@@ -385,7 +385,7 @@ function member_of($c) {
function groups_containing($uid,$c) {
$r = q("SELECT gid FROM group_member WHERE uid = %d AND group_member.xchan = '%s' ",
$r = q("SELECT gid FROM pgrp_member WHERE uid = %d AND pgrp_member.xchan = '%s' ",
intval($uid),
dbesc($c)
);

View File

@@ -4159,7 +4159,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_extra .= protect_sprintf(term_query('item', $arr['cat'], TERM_CATEGORY));
if($arr['gid'] && $uid) {
$r = q("SELECT * FROM groups WHERE id = %d AND uid = %d LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1",
intval($arr['group']),
intval($uid)
);

View File

@@ -60,8 +60,6 @@ function nav($template = 'default') {
//we could additionally use this to display important system notifications e.g. for updates
));
$techlevel = get_account_techlevel();
// nav links: array of array('href', 'text', 'extra css classes', 'title')
$nav = [];
@@ -93,7 +91,7 @@ function nav($template = 'default') {
if(! $_SESSION['delegate']) {
$nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage your channels'),'manage_nav_btn');
}
if(feature_enabled(local_channel(),'groups'))
if(Apps::system_app_installed(local_channel(), 'Privacy Groups'))
$nav['group'] = array('group', t('Privacy Groups'),"", t('Manage your privacy groups'),'group_nav_btn');
$nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn');

View File

@@ -577,7 +577,7 @@ function init_groups_visitor($contact_id) {
// physical groups this channel is a member of
$r = q("SELECT hash FROM groups left join group_member on groups.id = group_member.gid WHERE xchan = '%s' ",
$r = q("SELECT hash FROM pgrp left join pgrp_member on pgrp.id = pgrp_member.gid WHERE xchan = '%s' ",
dbesc($contact_id)
);
if($r) {

View File

@@ -41,7 +41,7 @@ function replace_macros($s, $r) {
try {
$output = $t->replace_macros($arr['template'], $arr['params']);
} catch (Exception $e) {
logger("Unable to render template: ",$e->getMessage());
logger("Unable to render template: ".$e->getMessage());
$output = "<h3>ERROR: there was an error creating the output.</h3>";
}
@@ -2737,7 +2737,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $i
$grp = group_byname($profile_uid,$name);
if($grp) {
$g = q("select hash from groups where id = %d and visible = 1 limit 1",
$g = q("select hash from pgrp where id = %d and visible = 1 limit 1",
intval($grp)
);
if($g && $exclusive) {

View File

@@ -176,7 +176,7 @@ function xchan_change_key($oldx,$newx,$data) {
$tables = [
'abook' => 'abook_xchan',
'abconfig' => 'xchan',
'group_member' => 'xchan',
'pgrp_member' => 'xchan',
'chat' => 'chat_xchan',
'chatpresence' => 'cp_xchan',
'event' => 'event_xchan',

View File

@@ -3320,13 +3320,13 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
}
if($groups_changed) {
$r = q("select hash as collection, visible, deleted, gname as name from groups where uid = %d",
$r = q("select hash as collection, visible, deleted, gname as name from pgrp where uid = %d",
intval($uid)
);
if($r)
$info['collections'] = $r;
$r = q("select groups.hash as collection, group_member.xchan as member from groups left join group_member on groups.id = group_member.gid where group_member.uid = %d",
$r = q("select pgrp.hash as collection, pgrp_member.xchan as member from pgrp left join pgrp_member on pgrp.id = pgrp_member.gid where pgrp_member.uid = %d",
intval($uid)
);
if($r)
@@ -3734,7 +3734,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
// sync collections (privacy groups) oh joy...
if(array_key_exists('collections',$arr) && is_array($arr['collections']) && count($arr['collections'])) {
$x = q("select * from groups where uid = %d",
$x = q("select * from pgrp where uid = %d",
intval($channel['channel_id'])
);
foreach($arr['collections'] as $cl) {
@@ -3750,7 +3750,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(($y['gname'] != $cl['name'])
|| ($y['visible'] != $cl['visible'])
|| ($y['deleted'] != $cl['deleted'])) {
q("update groups set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d",
q("update pgrp set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d",
dbesc($cl['name']),
intval($cl['visible']),
intval($cl['deleted']),
@@ -3759,14 +3759,14 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
);
}
if(intval($cl['deleted']) && (! intval($y['deleted']))) {
q("delete from group_member where gid = %d",
q("delete from pgrp_member where gid = %d",
intval($y['id'])
);
}
}
}
if(! $found) {
$r = q("INSERT INTO groups ( hash, uid, visible, deleted, gname )
$r = q("INSERT INTO pgrp ( hash, uid, visible, deleted, gname )
VALUES( '%s', %d, %d, %d, '%s' ) ",
dbesc($cl['collection']),
intval($channel['channel_id']),
@@ -3790,10 +3790,10 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
}
if(! $found_local) {
q("delete from group_member where gid = %d",
q("delete from pgrp_member where gid = %d",
intval($y['id'])
);
q("update groups set deleted = 1 where id = %d and uid = %d",
q("update pgrp set deleted = 1 where id = %d and uid = %d",
intval($y['id']),
intval($channel['channel_id'])
);
@@ -3803,7 +3803,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
// reload the group list with any updates
$x = q("select * from groups where uid = %d",
$x = q("select * from pgrp where uid = %d",
intval($channel['channel_id'])
);
@@ -3830,7 +3830,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(isset($y['hash']) && isset($members[$y['hash']])) {
foreach($members[$y['hash']] as $member) {
$found = false;
$z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1",
$z = q("select xchan from pgrp_member where gid = %d and uid = %d and xchan = '%s' limit 1",
intval($y['id']),
intval($channel['channel_id']),
dbesc($member)
@@ -3841,7 +3841,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
// if somebody is in the group that wasn't before - add them
if(! $found) {
q("INSERT INTO group_member (uid, gid, xchan)
q("INSERT INTO pgrp_member (uid, gid, xchan)
VALUES( %d, %d, '%s' ) ",
intval($channel['channel_id']),
intval($y['id']),
@@ -3852,7 +3852,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
// now retrieve a list of members we have on this site
$m = q("select xchan from group_member where gid = %d and uid = %d",
$m = q("select xchan from pgrp_member where gid = %d and uid = %d",
intval($y['id']),
intval($channel['channel_id'])
);
@@ -3860,7 +3860,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
foreach($m as $mm) {
// if the local existing member isn't in the list we just received - remove them
if(! in_array($mm['xchan'],$members[$y['hash']])) {
q("delete from group_member where xchan = '%s' and gid = %d and uid = %d",
q("delete from pgrp_member where xchan = '%s' and gid = %d and uid = %d",
dbesc($mm['xchan']),
intval($y['id']),
intval($channel['channel_id'])