### Friendica Screenshots
-| ![Frio theme in mobile browser](images/screenshots/friendica-frio-mobile-profile-1.png?raw=true "Frio theme in mobile browser") ![Frio theme in mobile browser](images/screenshots/friendica-frio-mobile-profile-2.png?raw=true "Frio theme in mobile browser")
-|:--:|
-|*Frio theme, mobile browser. Timeline and composer view.*|
-|![Frio theme in desktop browser](images/screenshots/friendica-frio-green-profile-1.png?raw=true "Frio theme in desktop browser")
-|*Frio theme, desktop browser. Timeline view, contact info popped up, control menu open.*|
-|![Frio theme in desktop browser](images/screenshots/friendica-frio-green-profile-2.png?raw=true "Frio theme in desktop browser")
-|*Frio theme, desktop browser. Menu open for controlling individual posts.*|
-|![Frio theme in desktop browser](images/screenshots/friendica-frio-red-profile-3.png?raw=true "Frio theme in desktop browser")
-|*Frio theme, desktop browser. Profile view, notification menu open.*|
-|![Frio theme in desktop browser](images/screenshots/friendica-frio-red-profile-2.png?raw=true "Frio theme in desktop browser")
-|*Number of new posts, in total and by group.*|
-|![Frio theme in desktop browser](images/screenshots/friendica-frio-red-profile-1.png?raw=true "Frio theme in desktop browser")
-|*Calender with popup of event.*|
-|![Frio theme default colour in standard browser on tablet](images/screenshots/friendica-frio-default-profile-1.png?raw=true "Frio theme default colour in standard browser on tablet")
-|*Notifications menu and private messages counter, standard browser on tablet.*|
-|![Frio theme in desktop browser](images/screenshots/friendica-frio-brown-profile-2.png?raw=true "Frio theme in desktop browser")
-|*Number of visible contacts, standard browser.*|
-|![Frio theme in desktop browser](images/screenshots/friendica-frio-brown-profile-1.png?raw=true "Frio theme in desktop browser")
-|*Network posts chronologically ordered, standard browser.*|
-|![Vier theme in desktop browser](images/screenshots/friendica-vier-profile.png?raw=true "Vier theme in desktop browser")
-|*Vier theme, desktop browser. Public timeline view.*|
-|![Vier theme in desktop browser](images/screenshots/friendica-vier-community.png?raw=true "Vier theme in desktop browser")
-|*Vier theme, desktop browser. Community post displayed.*|
+| ![Frio theme in mobile browser](images/screenshots/friendica-frio-mobile-profile-1.png?raw=true "Frio theme in mobile browser") ![Frio theme in mobile browser](images/screenshots/friendica-frio-mobile-profile-2.png?raw=true "Frio theme in mobile browser") |
+|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
+| *Frio theme, mobile browser. Timeline and composer view.* |
+| ![Frio theme in desktop browser](images/screenshots/friendica-frio-green-profile-1.png?raw=true "Frio theme in desktop browser") |
+| *Frio theme, desktop browser. Timeline view, contact info popped up, control menu open.* |
+| ![Frio theme in desktop browser](images/screenshots/friendica-frio-green-profile-2.png?raw=true "Frio theme in desktop browser") |
+| *Frio theme, desktop browser. Menu open for controlling individual posts.* |
+| ![Frio theme in desktop browser](images/screenshots/friendica-frio-red-profile-3.png?raw=true "Frio theme in desktop browser") |
+| *Frio theme, desktop browser. Profile view, notification menu open.* |
+| ![Frio theme in desktop browser](images/screenshots/friendica-frio-red-profile-2.png?raw=true "Frio theme in desktop browser") |
+| *Number of new posts, in total and by circle.* |
+| ![Frio theme in desktop browser](images/screenshots/friendica-frio-red-profile-1.png?raw=true "Frio theme in desktop browser") |
+| *Calendar with popup of event.* |
+| ![Frio theme default colour in standard browser on tablet](images/screenshots/friendica-frio-default-profile-1.png?raw=true "Frio theme default colour in standard browser on tablet") |
+| *Notifications menu and private messages counter, standard browser on tablet.* |
+| ![Frio theme in desktop browser](images/screenshots/friendica-frio-brown-profile-2.png?raw=true "Frio theme in desktop browser") |
+| *Number of visible contacts, standard browser.* |
+| ![Frio theme in desktop browser](images/screenshots/friendica-frio-brown-profile-1.png?raw=true "Frio theme in desktop browser") |
+| *Network posts chronologically ordered, standard browser.* |
+| ![Vier theme in desktop browser](images/screenshots/friendica-vier-profile.png?raw=true "Vier theme in desktop browser") |
+| *Vier theme, desktop browser. Public timeline view.* |
+| ![Vier theme in desktop browser](images/screenshots/friendica-vier-community.png?raw=true "Vier theme in desktop browser") |
+| *Vier theme, desktop browser. Community post displayed.* |
## Endorsements
IMAGES=add.png edit.png gear.png info.png menu.png \
- notify_off.png star.png delete.png feed.png group.png \
+ notify_off.png star.png delete.png feed.png circle.png \
lock.png notice.png notify_on.png user.png link.png \
play.png plugin.png unlock.png zip.png audio.png video.png \
image.png text.png
$(addprefix 16/, $(IMAGES)) \
$(addprefix 22/, $(IMAGES)) \
$(addprefix 48/, $(IMAGES))
-
+
all: $(DESTS)
%/:
10/%.png: %.png
convert $< -resize 10x10 $@
-
+
16/%.png: %.png
convert $< -resize 16x16 $@
$aclFormatter = DI::aclFormatter();
$str_contact_allow = isset($_REQUEST['contact_allow']) ? $aclFormatter->toString($_REQUEST['contact_allow']) : $owner_record['allow_cid'] ?? '';
- $str_group_allow = isset($_REQUEST['group_allow']) ? $aclFormatter->toString($_REQUEST['group_allow']) : $owner_record['allow_gid'] ?? '';
+ $str_circle_allow = isset($_REQUEST['circle_allow']) ? $aclFormatter->toString($_REQUEST['circle_allow']) : $owner_record['allow_gid'] ?? '';
$str_contact_deny = isset($_REQUEST['contact_deny']) ? $aclFormatter->toString($_REQUEST['contact_deny']) : $owner_record['deny_cid'] ?? '';
- $str_group_deny = isset($_REQUEST['group_deny']) ? $aclFormatter->toString($_REQUEST['group_deny']) : $owner_record['deny_gid'] ?? '';
+ $str_circle_deny = isset($_REQUEST['circle_deny']) ? $aclFormatter->toString($_REQUEST['circle_deny']) : $owner_record['deny_gid'] ?? '';
$visibility = $_REQUEST['visibility'] ?? '';
if ($visibility === 'public') {
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
- $str_contact_allow = $str_group_allow = $str_contact_deny = $str_group_deny = '';
+ $str_contact_allow = $str_circle_allow = $str_contact_deny = $str_circle_deny = '';
} else if ($visibility === 'custom') {
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
// case that would make it public. So we always append the author's contact id to the allowed contacts.
$photo = $photos[0];
$ext = $phototypes[$photo['type']];
Photo::update(
- ['desc' => $desc, 'album' => $albname, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow, 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny],
+ ['desc' => $desc, 'album' => $albname, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_circle_allow, 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_circle_deny],
['resource-id' => $resource_id, 'uid' => $page_owner_uid]
);
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
use Friendica\Model\FileTag;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Item as ItemModel;
use Friendica\Model\Photo;
use Friendica\Model\Tag;
if ($private_forum) {
$item['allow_cid'] = '<' . $private_id . '>';
- $item['allow_gid'] = '<' . Group::getIdForForum($forum_contact['id']) . '>';
+ $item['allow_gid'] = '<' . Circle::getIdForForum($forum_contact['id']) . '>';
} else {
$item['allow_cid'] = '';
$item['allow_gid'] = '';
}
$post['allow_cid'] = isset($request['contact_allow']) ? $this->aclFormatter->toString($request['contact_allow']) : $user['allow_cid'] ?? '';
- $post['allow_gid'] = isset($request['group_allow']) ? $this->aclFormatter->toString($request['group_allow']) : $user['allow_gid'] ?? '';
+ $post['allow_gid'] = isset($request['circle_allow']) ? $this->aclFormatter->toString($request['circle_allow']) : $user['allow_gid'] ?? '';
$post['deny_cid'] = isset($request['contact_deny']) ? $this->aclFormatter->toString($request['contact_deny']) : $user['deny_cid'] ?? '';
- $post['deny_gid'] = isset($request['group_deny']) ? $this->aclFormatter->toString($request['group_deny']) : $user['deny_gid'] ?? '';
+ $post['deny_gid'] = isset($request['circle_deny']) ? $this->aclFormatter->toString($request['circle_deny']) : $user['deny_gid'] ?? '';
$visibility = $request['visibility'] ?? '';
if ($visibility === 'public') {
$ignore = false;
// A list of some links that should be ignored
- $list = ["/user/", "/tag/", "/group/", "/profile/", "/search?search=", "/search?tag=", "mailto:", "/u/", "/node/",
+ $list = ["/user/", "/tag/", "/group/", "/circle/", "/profile/", "/search?search=", "/search?tag=", "mailto:", "/u/", "/node/",
"//plus.google.com/", "//twitter.com/"];
foreach ($list as $listitem) {
if (strpos($treffer[1], $listitem) !== false) {
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\Profile;
}
/**
- * Return group membership widget
+ * Return circle membership widget
*
* @param string $baseurl
* @param string $selected
* @return string
* @throws \Exception
*/
- public static function groups(string $baseurl, string $selected = ''): string
+ public static function circles(string $baseurl, string $selected = ''): string
{
if (!DI::userSession()->getLocalUserId()) {
return '';
}
- $options = array_map(function ($group) {
+ $options = array_map(function ($circle) {
return [
- 'ref' => $group['id'],
- 'name' => $group['name']
+ 'ref' => $circle['id'],
+ 'name' => $circle['name']
];
- }, Group::getByUserId(DI::userSession()->getLocalUserId()));
+ }, Circle::getByUserId(DI::userSession()->getLocalUserId()));
return self::filter(
- 'group',
- DI::l10n()->t('Groups'),
+ 'circle',
+ DI::l10n()->t('Circles'),
'',
DI::l10n()->t('Everyone'),
$baseurl,
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\User;
/**
}
/**
- * Returns the ACL list of groups (including meta-groups) for a given user id
+ * Returns the ACL list of circles (including meta-circles) for a given user id
*
* @param int $user_id
* @return array
*/
- public static function getGroupListByUserId(int $user_id)
+ public static function getCircleListByUserId(int $user_id)
{
- $acl_groups = [
+ $acl_circles = [
[
- 'id' => Group::FOLLOWERS,
+ 'id' => Circle::FOLLOWERS,
'name' => DI::l10n()->t('Followers'),
'addr' => '',
'micro' => 'images/twopeople.png',
- 'type' => 'group',
+ 'type' => 'circle',
],
[
- 'id' => Group::MUTUALS,
+ 'id' => Circle::MUTUALS,
'name' => DI::l10n()->t('Mutuals'),
'addr' => '',
'micro' => 'images/twopeople.png',
- 'type' => 'group',
+ 'type' => 'circle',
]
];
- foreach (Group::getByUserId($user_id) as $group) {
- $acl_groups[] = [
- 'id' => $group['id'],
- 'name' => $group['name'],
+ foreach (Circle::getByUserId($user_id) as $circle) {
+ $acl_circles[] = [
+ 'id' => $circle['id'],
+ 'name' => $circle['name'],
'addr' => '',
'micro' => 'images/twopeople.png',
- 'type' => 'group',
+ 'type' => 'circle',
];
}
- return $acl_groups;
+ return $acl_circles;
}
/**
} else {
$visibility = 'public';
// Default permission display for custom panel
- $default_permissions['allow_gid'] = [Group::FOLLOWERS];
+ $default_permissions['allow_gid'] = [Circle::FOLLOWERS];
}
$jotnets_fields = [];
$acl_contacts = self::getContactListByUserId($user['uid'], $condition);
- $acl_groups = self::getGroupListByUserId($user['uid']);
+ $acl_circles = self::getCircleListByUserId($user['uid']);
- $acl_list = array_merge($acl_groups, $acl_contacts);
+ $acl_list = array_merge($acl_circles, $acl_contacts);
$input_names = [
'visibility' => $form_prefix ? $form_prefix . '[visibility]' : 'visibility',
- 'group_allow' => $form_prefix ? $form_prefix . '[group_allow]' : 'group_allow',
+ 'circle_allow' => $form_prefix ? $form_prefix . '[circle_allow]' : 'circle_allow',
'contact_allow' => $form_prefix ? $form_prefix . '[contact_allow]' : 'contact_allow',
- 'group_deny' => $form_prefix ? $form_prefix . '[group_deny]' : 'group_deny',
+ 'circle_deny' => $form_prefix ? $form_prefix . '[circle_deny]' : 'circle_deny',
'contact_deny' => $form_prefix ? $form_prefix . '[contact_deny]' : 'contact_deny',
'emailcc' => $form_prefix ? $form_prefix . '[emailcc]' : 'emailcc',
];
'$public_title' => DI::l10n()->t('Public'),
'$public_desc' => DI::l10n()->t('This content will be shown to all your followers and can be seen in the community pages and by anyone with its link.'),
'$custom_title' => DI::l10n()->t('Limited/Private'),
- '$custom_desc' => DI::l10n()->t('This content will be shown only to the people in the first box, to the exception of the people mentioned in the second box. It won\'t appear anywhere public.') . DI::l10n()->t('Start typing the name of a contact or a group to show a filtered list. You can also mention the special groups "Followers" and "Mutuals".'),
+ '$custom_desc' => DI::l10n()->t('This content will be shown only to the people in the first box, to the exception of the people mentioned in the second box. It won\'t appear anywhere public.') . DI::l10n()->t('Start typing the name of a contact or a circle to show a filtered list. You can also mention the special circles "Followers" and "Mutuals".'),
'$allow_label' => DI::l10n()->t('Show to:'),
'$deny_label' => DI::l10n()->t('Except to:'),
'$emailcc' => DI::l10n()->t('CC: email addresses'),
'$jotnets_summary' => DI::l10n()->t('Connectors'),
'$visibility' => $visibility,
'$acl_contacts' => json_encode($acl_contacts),
- '$acl_groups' => json_encode($acl_groups),
+ '$acl_circles' => json_encode($acl_circles),
'$acl_list' => json_encode($acl_list),
'$contact_allow' => implode(',', $default_permissions['allow_cid']),
- '$group_allow' => implode(',', $default_permissions['allow_gid']),
+ '$circle_allow' => implode(',', $default_permissions['allow_gid']),
'$contact_deny' => implode(',', $default_permissions['deny_cid']),
- '$group_deny' => implode(',', $default_permissions['deny_gid']),
+ '$circle_deny' => implode(',', $default_permissions['deny_gid']),
'$for_federation' => $for_federation,
'$jotnets_fields' => $jotnets_fields,
'$input_names' => $input_names,
* @return bool
* @throws Exception
*/
- public static function isValidGroup($acl_string, $uid)
+ public static function isValidCircle($acl_string, $uid)
{
if (empty($acl_string)) {
return true;
$gid_array = $array[0];
foreach ($gid_array as $gid) {
$gid = str_replace(['<', '>'], ['', ''], $gid);
- if (!DBA::exists('group', ['id' => $gid, 'uid' => $uid, 'deleted' => false])) {
+ if (!DBA::exists('circle', ['id' => $gid, 'uid' => $uid, 'deleted' => false])) {
return false;
}
}
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Factory\Api\Friendica;
+
+use Friendica\BaseFactory;
+use Friendica\Database\Database;
+use Friendica\Network\HTTPException;
+use Psr\Log\LoggerInterface;
+use Friendica\Factory\Api\Twitter\User as TwitterUser;
+
+class Circle extends BaseFactory
+{
+ /** @var twitterUser entity */
+ private $twitterUser;
+ /** @var Database */
+ private $dba;
+
+ public function __construct(LoggerInterface $logger, TwitterUser $twitteruser, Database $dba)
+ {
+ parent::__construct($logger);
+
+ $this->twitterUser = $twitteruser;
+ $this->dba = $dba;
+ }
+
+ /**
+ * @param int $id id of the circle
+ * @return array
+ * @throws HTTPException\InternalServerErrorException
+ */
+ public function createFromId(int $id): array
+ {
+ $circle = $this->dba->selectFirst('group', [], ['id' => $id, 'deleted' => false]);
+ if (empty($circle)) {
+ return [];
+ }
+
+ $user = $this->twitterUser->createFromUserId($circle['uid'])->toArray();
+ $object = new \Friendica\Object\Api\Friendica\Circle($circle, $user);
+
+ return $object->toArray();
+ }
+}
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Factory\Api\Friendica;
-
-use Friendica\BaseFactory;
-use Friendica\Database\Database;
-use Friendica\Network\HTTPException;
-use Psr\Log\LoggerInterface;
-use Friendica\Factory\Api\Twitter\User as TwitterUser;
-
-class Group extends BaseFactory
-{
- /** @var twitterUser entity */
- private $twitterUser;
- /** @var Database */
- private $dba;
-
- public function __construct(LoggerInterface $logger, TwitterUser $twitteruser, Database $dba)
- {
- parent::__construct($logger);
-
- $this->twitterUser = $twitteruser;
- $this->dba = $dba;
- }
-
- /**
- * @param int $id id of the group
- * @return array
- * @throws HTTPException\InternalServerErrorException
- */
- public function createFromId(int $id): array
- {
- $group = $this->dba->selectFirst('group', [], ['id' => $id, 'deleted' => false]);
- if (empty($group)) {
- return [];
- }
-
- $user = $this->twitterUser->createFromUserId($group['uid'])->toArray();
- $object = new \Friendica\Object\Api\Friendica\Group($group, $user);
-
- return $object->toArray();
- }
-}
/**
* @throws InternalServerErrorException
*/
- public function createFromGroupId(int $id): \Friendica\Object\Api\Mastodon\ListEntity
+ public function createFromCircleId(int $id): \Friendica\Object\Api\Mastodon\ListEntity
{
- $group = $this->dba->selectFirst('group', ['name'], ['id' => $id, 'deleted' => false]);
- return new \Friendica\Object\Api\Mastodon\ListEntity($id, $group['name'] ?? '', 'list');
+ $circle = $this->dba->selectFirst('group', ['name'], ['id' => $id, 'deleted' => false]);
+ return new \Friendica\Object\Api\Mastodon\ListEntity($id, $circle['name'] ?? '', 'list');
}
}
* @param string $filetype Mimetype. optional, default = ''
* @param integer $filesize File size in bytes. optional, default = null
* @param string $allow_cid Permissions, allowed contacts. optional, default = ''
- * @param string $allow_gid Permissions, allowed groups. optional, default = ''
- * @param string $deny_cid Permissions, denied contacts.optional, default = ''
- * @param string $deny_gid Permissions, denied group.optional, default = ''
+ * @param string $allow_gid Permissions, allowed circles. optional, default = ''
+ * @param string $deny_cid Permissions, denied contacts. optional, default = ''
+ * @param string $deny_gid Permissions, denied circle. optional, default = ''
*
* @return boolean|integer Row id on success, False on errors
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Model;
+
+use Friendica\BaseModule;
+use Friendica\Core\Logger;
+use Friendica\Core\Protocol;
+use Friendica\Core\Renderer;
+use Friendica\Database\Database;
+use Friendica\Database\DBA;
+use Friendica\DI;
+use Friendica\Network\HTTPException;
+use Friendica\Protocol\ActivityPub;
+
+/**
+ * functions for interacting with the group database table
+ */
+class Circle
+{
+ const FOLLOWERS = '~';
+ const MUTUALS = '&';
+
+ /**
+ * Fetches circle record by user id and maybe includes deleted circles as well
+ *
+ * @param int $uid User id to fetch circle(s) for
+ * @param bool $includesDeleted Whether deleted circles should be included
+ * @return array|bool Array on success, bool on error
+ */
+ public static function getByUserId(int $uid, bool $includesDeleted = false)
+ {
+ $conditions = ['uid' => $uid, 'cid' => null];
+
+ if (!$includesDeleted) {
+ $conditions['deleted'] = false;
+ }
+
+ return DBA::selectToArray('group', [], $conditions);
+ }
+
+ /**
+ * Checks whether given circle id is found in database
+ *
+ * @param int $circle_id Circle id
+ * @param int $uid Optional user id
+ * @return bool
+ * @throws \Exception
+ */
+ public static function exists(int $circle_id, int $uid = null): bool
+ {
+ $condition = ['id' => $circle_id, 'deleted' => false];
+
+ if (!is_null($uid)) {
+ $condition = [
+ 'uid' => $uid
+ ];
+ }
+
+ return DBA::exists('group', $condition);
+ }
+
+ /**
+ * Create a new contact circle
+ *
+ * Note: If we found a deleted circle with the same name, we restore it
+ *
+ * @param int $uid User id to create circle for
+ * @param string $name Name of circle
+ * @return int|boolean Id of newly created circle or false on error
+ * @throws \Exception
+ */
+ public static function create(int $uid, string $name)
+ {
+ $return = false;
+ if (!empty($uid) && !empty($name)) {
+ $gid = self::getIdByName($uid, $name); // check for dupes
+ if ($gid !== false) {
+ // This could be a problem.
+ // Let's assume we've just created a circle which we once deleted
+ // all the old members are gone, but the circle remains, so we don't break any security
+ // access lists. What we're doing here is reviving the dead circle, but old content which
+ // was restricted to this circle may now be seen by the new circle members.
+ $circle = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
+ if (DBA::isResult($circle) && $circle['deleted']) {
+ DBA::update('group', ['deleted' => 0], ['id' => $gid]);
+ DI::sysmsg()->addNotice(DI::l10n()->t('A deleted circle with this name was revived. Existing item permissions <strong>may</strong> apply to this circle and any future members. If this is not what you intended, please create another circle with a different name.'));
+ }
+ return true;
+ }
+
+ $return = DBA::insert('group', ['uid' => $uid, 'name' => $name]);
+ if ($return) {
+ $return = DBA::lastInsertId();
+ }
+ }
+ return $return;
+ }
+
+ /**
+ * Update circle information.
+ *
+ * @param int $id Circle ID
+ * @param string $name Circle name
+ *
+ * @return bool Was the update successful?
+ * @throws \Exception
+ */
+ public static function update(int $id, string $name): bool
+ {
+ return DBA::update('group', ['name' => $name], ['id' => $id]);
+ }
+
+ /**
+ * Get a list of circle ids a contact belongs to
+ *
+ * @param int $cid Contact id
+ * @return array Circle ids
+ * @throws \Exception
+ */
+ public static function getIdsByContactId(int $cid): array
+ {
+ $contact = Contact::getById($cid, ['rel']);
+ if (!$contact) {
+ return [];
+ }
+
+ $circleIds = [];
+
+ $stmt = DBA::select('group_member', ['gid'], ['contact-id' => $cid]);
+ while ($circle = DBA::fetch($stmt)) {
+ $circleIds[] = $circle['gid'];
+ }
+ DBA::close($stmt);
+
+ // Meta-circles
+ if ($contact['rel'] == Contact::FOLLOWER || $contact['rel'] == Contact::FRIEND) {
+ $circleIds[] = self::FOLLOWERS;
+ }
+
+ if ($contact['rel'] == Contact::FRIEND) {
+ $circleIds[] = self::MUTUALS;
+ }
+
+ return $circleIds;
+ }
+
+ /**
+ * count unread circle items
+ *
+ * Count unread items of each circle of the local user
+ *
+ * @return array
+ * 'id' => circle id
+ * 'name' => circle name
+ * 'count' => counted unseen circle items
+ * @throws \Exception
+ */
+ public static function countUnseen()
+ {
+ $stmt = DBA::p("SELECT `circle`.`id`, `circle`.`name`,
+ (SELECT COUNT(*) FROM `post-user`
+ WHERE `uid` = ?
+ AND `unseen`
+ AND `contact-id` IN
+ (SELECT `contact-id`
+ FROM `group_member` AS `circle_member`
+ WHERE `circle_member`.`gid` = `circle`.`id`)
+ ) AS `count`
+ FROM `group` AS `circle`
+ WHERE `circle`.`uid` = ?;",
+ DI::userSession()->getLocalUserId(),
+ DI::userSession()->getLocalUserId()
+ );
+
+ return DBA::toArray($stmt);
+ }
+
+ /**
+ * Get the circle id for a user/name couple
+ *
+ * Returns false if no circle has been found.
+ *
+ * @param int $uid User id
+ * @param string $name Circle name
+ * @return int|boolean Circle's id number or false on error
+ * @throws \Exception
+ */
+ public static function getIdByName(int $uid, string $name)
+ {
+ if (!$uid || !strlen($name)) {
+ return false;
+ }
+
+ $circle = DBA::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
+ if (DBA::isResult($circle)) {
+ return $circle['id'];
+ }
+
+ return false;
+ }
+
+ /**
+ * Mark a circle as deleted
+ *
+ * @param int $gid
+ * @return boolean
+ * @throws \Exception
+ */
+ public static function remove(int $gid): bool
+ {
+ if (!$gid) {
+ return false;
+ }
+
+ $circle = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
+ if (!DBA::isResult($circle)) {
+ return false;
+ }
+
+ // remove circle from default posting lists
+ $user = DBA::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $circle['uid']]);
+ if (DBA::isResult($user)) {
+ $change = false;
+
+ if ($user['def_gid'] == $gid) {
+ $user['def_gid'] = 0;
+ $change = true;
+ }
+ if (strpos($user['allow_gid'], '<' . $gid . '>') !== false) {
+ $user['allow_gid'] = str_replace('<' . $gid . '>', '', $user['allow_gid']);
+ $change = true;
+ }
+ if (strpos($user['deny_gid'], '<' . $gid . '>') !== false) {
+ $user['deny_gid'] = str_replace('<' . $gid . '>', '', $user['deny_gid']);
+ $change = true;
+ }
+
+ if ($change) {
+ DBA::update('user', $user, ['uid' => $circle['uid']]);
+ }
+ }
+
+ // remove all members
+ DBA::delete('group_member', ['gid' => $gid]);
+
+ // remove circle
+ $return = DBA::update('group', ['deleted' => 1], ['id' => $gid]);
+
+ return $return;
+ }
+
+ /**
+ * Adds a contact to a circle
+ *
+ * @param int $gid
+ * @param int $cid
+ * @return boolean
+ * @throws \Exception
+ */
+ public static function addMember(int $gid, int $cid): bool
+ {
+ if (!$gid || !$cid) {
+ return false;
+ }
+
+ // @TODO Backward compatibility with user contacts, remove by version 2022.03
+ $circle = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
+ if (empty($circle)) {
+ throw new HTTPException\NotFoundException('Circle not found.');
+ }
+
+ $cdata = Contact::getPublicAndUserContactID($cid, $circle['uid']);
+ if (empty($cdata['user'])) {
+ throw new HTTPException\NotFoundException('Invalid contact.');
+ }
+
+ return DBA::insert('group_member', ['gid' => $gid, 'contact-id' => $cdata['user']], Database::INSERT_IGNORE);
+ }
+
+ /**
+ * Removes a contact from a circle
+ *
+ * @param int $gid
+ * @param int $cid
+ * @return boolean
+ * @throws \Exception
+ */
+ public static function removeMember(int $gid, int $cid): bool
+ {
+ if (!$gid || !$cid) {
+ return false;
+ }
+
+ // @TODO Backward compatibility with user contacts, remove by version 2022.03
+ $circle = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
+ if (empty($circle)) {
+ throw new HTTPException\NotFoundException('Circle not found.');
+ }
+
+ $cdata = Contact::getPublicAndUserContactID($cid, $circle['uid']);
+ if (empty($cdata['user'])) {
+ throw new HTTPException\NotFoundException('Invalid contact.');
+ }
+
+ return DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $cid]);
+ }
+
+ /**
+ * Adds contacts to a circle
+ *
+ * @param int $gid
+ * @param array $contacts Array with contact ids
+ * @return void
+ * @throws \Exception
+ */
+ public static function addMembers(int $gid, array $contacts)
+ {
+ if (!$gid || !$contacts) {
+ return;
+ }
+
+ // @TODO Backward compatibility with user contacts, remove by version 2022.03
+ $circle = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
+ if (empty($circle)) {
+ throw new HTTPException\NotFoundException('Circle not found.');
+ }
+
+ foreach ($contacts as $cid) {
+ $cdata = Contact::getPublicAndUserContactID($cid, $circle['uid']);
+ if (empty($cdata['user'])) {
+ throw new HTTPException\NotFoundException('Invalid contact.');
+ }
+
+ DBA::insert('group_member', ['gid' => $gid, 'contact-id' => $cdata['user']], Database::INSERT_IGNORE);
+ }
+ }
+
+ /**
+ * Removes contacts from a circle
+ *
+ * @param int $gid Circle id
+ * @param array $contacts Contact ids
+ * @return bool
+ * @throws \Exception
+ */
+ public static function removeMembers(int $gid, array $contacts)
+ {
+ if (!$gid || !$contacts) {
+ return false;
+ }
+
+ // @TODO Backward compatibility with user contacts, remove by version 2022.03
+ $circle = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
+ if (empty($circle)) {
+ throw new HTTPException\NotFoundException('Circle not found.');
+ }
+
+ $contactIds = [];
+
+ foreach ($contacts as $cid) {
+ $cdata = Contact::getPublicAndUserContactID($cid, $circle['uid']);
+ if (empty($cdata['user'])) {
+ throw new HTTPException\NotFoundException('Invalid contact.');
+ }
+
+ $contactIds[] = $cdata['user'];
+ }
+
+ // Return status of deletion
+ return DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $contactIds]);
+ }
+
+ /**
+ * Returns the combined list of contact ids from a circle id list
+ *
+ * @param int $uid User id
+ * @param array $circle_ids Circles ids
+ * @param boolean $check_dead Whether check "dead" records (?)
+ * @param boolean $expand_followers Expand the list of followers
+ * @return array
+ * @throws \Exception
+ */
+ public static function expand(int $uid, array $circle_ids, bool $check_dead = false, bool $expand_followers = true): array
+ {
+ if (!is_array($circle_ids) || !count($circle_ids)) {
+ return [];
+ }
+
+ $return = [];
+ $pubmail = false;
+ $followers_collection = false;
+ $networks = Protocol::SUPPORT_PRIVATE;
+
+ $mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', $uid]);
+ if (DBA::isResult($mailacct)) {
+ $pubmail = $mailacct['pubmail'];
+ }
+
+ if (!$pubmail) {
+ $networks = array_diff($networks, [Protocol::MAIL]);
+ }
+
+ $key = array_search(self::FOLLOWERS, $circle_ids);
+ if ($key !== false) {
+ if ($expand_followers) {
+ $followers = Contact::selectToArray(['id'], [
+ 'uid' => $uid,
+ 'rel' => [Contact::FOLLOWER, Contact::FRIEND],
+ 'network' => $networks,
+ 'contact-type' => [Contact::TYPE_UNKNOWN, Contact::TYPE_PERSON],
+ 'archive' => false,
+ 'pending' => false,
+ 'blocked' => false,
+ ]);
+
+ foreach ($followers as $follower) {
+ $return[] = $follower['id'];
+ }
+ } else {
+ $followers_collection = true;
+ }
+ unset($circle_ids[$key]);
+ }
+
+ $key = array_search(self::MUTUALS, $circle_ids);
+ if ($key !== false) {
+ $mutuals = Contact::selectToArray(['id'], [
+ 'uid' => $uid,
+ 'rel' => [Contact::FRIEND],
+ 'network' => $networks,
+ 'contact-type' => [Contact::TYPE_UNKNOWN, Contact::TYPE_PERSON],
+ 'archive' => false,
+ 'pending' => false,
+ 'blocked' => false,
+ ]);
+
+ foreach ($mutuals as $mutual) {
+ $return[] = $mutual['id'];
+ }
+
+ unset($circle_ids[$key]);
+ }
+
+ $stmt = DBA::select('group_member', ['contact-id'], ['gid' => $circle_ids]);
+ while ($circle_member = DBA::fetch($stmt)) {
+ $return[] = $circle_member['contact-id'];
+ }
+ DBA::close($stmt);
+
+ if ($check_dead) {
+ $return = Contact::pruneUnavailable($return);
+ }
+
+ if ($followers_collection) {
+ $return[] = -1;
+ }
+
+ return $return;
+ }
+
+ /**
+ * Returns a templated circle selection list
+ *
+ * @param int $uid User id
+ * @param int $gid An optional pre-selected circle
+ * @param string $label An optional label of the list
+ * @return string
+ * @throws \Exception
+ */
+ public static function getSelectorHTML(int $uid, int $gid = 0, string $label = ''): string
+ {
+ $display_circles = [
+ [
+ 'name' => '',
+ 'id' => '0',
+ 'selected' => ''
+ ]
+ ];
+
+ $stmt = DBA::select('group', [], ['deleted' => false, 'uid' => $uid, 'cid' => null], ['order' => ['name']]);
+ while ($circle = DBA::fetch($stmt)) {
+ $display_circles[] = [
+ 'name' => $circle['name'],
+ 'id' => $circle['id'],
+ 'selected' => $gid == $circle['id'] ? 'true' : ''
+ ];
+ }
+ DBA::close($stmt);
+
+ Logger::info('Got circles', $display_circles);
+
+ if ($label == '') {
+ $label = DI::l10n()->t('Default privacy circle for new contacts');
+ }
+
+ $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('circle_selection.tpl'), [
+ '$label' => $label,
+ '$circles' => $display_circles
+ ]);
+ return $o;
+ }
+
+ /**
+ * Create circle sidebar widget
+ *
+ * @param string $every
+ * @param string $each
+ * @param string $editmode
+ * 'standard' => include link 'Edit circles'
+ * 'extended' => include link 'Create new circle'
+ * 'full' => include link 'Create new circle' and provide for each circle a link to edit this circle
+ * @param string|int $circle_id Distinct circle id or 'everyone'
+ * @param int $cid Contact id
+ * @return string Sidebar widget HTML code
+ * @throws \Exception
+ */
+ public static function sidebarWidget(string $every = 'contact', string $each = 'circle', string $editmode = 'standard', $circle_id = '', int $cid = 0)
+ {
+ if (!DI::userSession()->getLocalUserId()) {
+ return '';
+ }
+
+ $display_circles = [
+ [
+ 'text' => DI::l10n()->t('Everybody'),
+ 'id' => 0,
+ 'selected' => (($circle_id === 'everyone') ? 'circle-selected' : ''),
+ 'href' => $every,
+ ]
+ ];
+
+ $member_of = [];
+ if ($cid) {
+ $member_of = self::getIdsByContactId($cid);
+ }
+
+ $stmt = DBA::select('group', [], ['deleted' => false, 'uid' => DI::userSession()->getLocalUserId(), 'cid' => null], ['order' => ['name']]);
+ while ($circle = DBA::fetch($stmt)) {
+ $selected = (($circle_id == $circle['id']) ? ' circle-selected' : '');
+
+ if ($editmode == 'full') {
+ $circleedit = [
+ 'href' => 'circle/' . $circle['id'],
+ 'title' => DI::l10n()->t('edit'),
+ ];
+ } else {
+ $circleedit = null;
+ }
+
+ if ($each == 'circle') {
+ $count = DBA::count('group_member', ['gid' => $circle['id']]);
+ $circle_name = sprintf('%s (%d)', $circle['name'], $count);
+ } else {
+ $circle_name = $circle['name'];
+ }
+
+ $display_circles[] = [
+ 'id' => $circle['id'],
+ 'cid' => $cid,
+ 'text' => $circle_name,
+ 'href' => $each . '/' . $circle['id'],
+ 'edit' => $circleedit,
+ 'selected' => $selected,
+ 'ismember' => in_array($circle['id'], $member_of),
+ ];
+ }
+ DBA::close($stmt);
+
+ // Don't show the circles on the network page when there is only one
+ if ((count($display_circles) <= 2) && ($each == 'network')) {
+ return '';
+ }
+
+ $tpl = Renderer::getMarkupTemplate('circle_side.tpl');
+ $o = Renderer::replaceMacros($tpl, [
+ '$add' => DI::l10n()->t('add'),
+ '$title' => DI::l10n()->t('Circles'),
+ '$circles' => $display_circles,
+ '$new_circle' => $editmode == 'extended' || $editmode == 'full' ? 1 : '',
+ '$circle_page' => 'circle/',
+ '$edittext' => DI::l10n()->t('Edit circle'),
+ '$uncircled' => $every === 'contact' ? DI::l10n()->t('Contacts not in any circle') : '',
+ '$uncircled_selected' => (($circle_id === 'none') ? 'circle-selected' : ''),
+ '$createtext' => DI::l10n()->t('Create a new circle'),
+ '$create_circle' => DI::l10n()->t('Circle Name: '),
+ '$edit_circles_text' => DI::l10n()->t('Edit circles'),
+ '$form_security_token' => BaseModule::getFormSecurityToken('circle_edit'),
+ ]);
+
+ return $o;
+ }
+
+ /**
+ * Fetch the circle id for the given contact id
+ *
+ * @param integer $id Contact ID
+ * @return integer Circle ID
+ */
+ public static function getIdForForum(int $id): int
+ {
+ Logger::info('Get id for forum id', ['id' => $id]);
+ $contact = Contact::getById($id, ['uid', 'name', 'contact-type', 'manually-approve']);
+ if (empty($contact) || ($contact['contact-type'] != Contact::TYPE_COMMUNITY) || !$contact['manually-approve']) {
+ return 0;
+ }
+
+ $circle = DBA::selectFirst('group', ['id'], ['uid' => $contact['uid'], 'cid' => $id]);
+ if (empty($circle)) {
+ $fields = [
+ 'uid' => $contact['uid'],
+ 'name' => $contact['name'],
+ 'cid' => $id,
+ ];
+ DBA::insert('group', $fields);
+ $gid = DBA::lastInsertId();
+ } else {
+ $gid = $circle['id'];
+ }
+
+ return $gid;
+ }
+
+ /**
+ * Fetch the followers of a given contact id and store them as circle members
+ *
+ * @param integer $id Contact ID
+ * @return void
+ */
+ public static function updateMembersForForum(int $id)
+ {
+ Logger::info('Update forum members', ['id' => $id]);
+
+ $contact = Contact::getById($id, ['uid', 'url']);
+ if (empty($contact)) {
+ return;
+ }
+
+ $apcontact = APContact::getByURL($contact['url']);
+ if (empty($apcontact['followers'])) {
+ return;
+ }
+
+ $gid = self::getIdForForum($id);
+ if (empty($gid)) {
+ return;
+ }
+
+ $circle_members = DBA::selectToArray('group_member', ['contact-id'], ['gid' => $gid]);
+ if (!empty($circle_members)) {
+ $current = array_unique(array_column($circle_members, 'contact-id'));
+ } else {
+ $current = [];
+ }
+
+ foreach (ActivityPub::fetchItems($apcontact['followers'], $contact['uid']) as $follower) {
+ $id = Contact::getIdForURL($follower);
+ if (!in_array($id, $current)) {
+ DBA::insert('group_member', ['gid' => $gid, 'contact-id' => $id]);
+ } else {
+ $key = array_search($id, $current);
+ unset($current[$key]);
+ }
+ }
+
+ DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $current]);
+ Logger::info('Updated forum members', ['id' => $id, 'count' => DBA::count('group_member', ['gid' => $gid])]);
+ }
+}
$contact_id = $contact['id'];
$result['cid'] = $contact_id;
- Group::addMember(User::getDefaultGroup($uid), $contact_id);
+ Circle::addMember(User::getDefaultCircle($uid), $contact_id);
// Update the avatar
self::updateAvatar($contact_id, $ret['photo']);
DI::intro()->save($intro);
}
- Group::addMember(User::getDefaultGroup($importer['uid']), $contact_record['id']);
+ Circle::addMember(User::getDefaultCircle($importer['uid']), $contact_record['id']);
if (($user['notify-flags'] & Notification\Type::INTRO) && $user['page-flags'] == User::PAGE_FLAGS_NORMAL) {
DI::notify()->createFromArray([
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Model\Contact;
+
+use Friendica\Database\DBA;
+use Friendica\DI;
+use Friendica\Model\Contact;
+
+/**
+ * This class provides information about contact circles based on the "group_member" table.
+ */
+class Circle
+{
+ /**
+ * Returns a list of contacts belonging in a circle
+ *
+ * @param int $gid
+ * @return array
+ * @throws \Exception
+ */
+ public static function getById(int $gid): array
+ {
+ $return = [];
+
+ if (intval($gid)) {
+ $stmt = DBA::p('SELECT `circle_member`.`contact-id`, `contact`.*
+ FROM `contact`
+ INNER JOIN `group_member` AS `circle_member`
+ ON `contact`.`id` = `circle_member`.`contact-id`
+ WHERE `gid` = ?
+ AND `contact`.`uid` = ?
+ AND NOT `contact`.`self`
+ AND NOT `contact`.`deleted`
+ AND NOT `contact`.`blocked`
+ AND NOT `contact`.`pending`
+ ORDER BY `contact`.`name` ASC',
+ $gid,
+ DI::userSession()->getLocalUserId()
+ );
+
+ if (DBA::isResult($stmt)) {
+ $return = DBA::toArray($stmt);
+ }
+ }
+
+ return $return;
+ }
+
+ /**
+ * Returns uncircled contact count or list for user
+ *
+ * Returns either the total number of uncircled contacts for the given user
+ * id or a paginated list of uncircled contacts.
+ *
+ * @param int $uid uid
+ * @return array
+ * @throws \Exception
+ */
+ public static function listUncircled(int $uid)
+ {
+ return Contact::selectToArray([], ["`uid` = ? AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `failed`
+ AND `id` NOT IN (SELECT DISTINCT(`contact-id`) FROM `group_member` AS `circle_member` INNER JOIN `group` AS `circle` ON `circle`.`id` = `circle_member`.`gid`
+ WHERE `circle`.`uid` = ? AND `contact-id` = `contact`.`id`)", $uid, $uid]);
+ }
+
+ /**
+ * Remove a contact from all circles
+ *
+ * @param integer $contact_id
+ *
+ * @return boolean Success
+ */
+ public static function removeContact(int $contact_id)
+ {
+ return DBA::delete('group_member', ['contact-id' => $contact_id]);
+ }
+}
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Model\Contact;
-
-use Friendica\Database\DBA;
-use Friendica\DI;
-use Friendica\Model\Contact;
-
-/**
- * This class provides information about contact groups based on the "group_member" table.
- */
-class Group
-{
- /**
- * Returns a list of contacts belonging in a group
- *
- * @param int $gid
- * @return array
- * @throws \Exception
- */
- public static function getById(int $gid): array
- {
- $return = [];
-
- if (intval($gid)) {
- $stmt = DBA::p('SELECT `group_member`.`contact-id`, `contact`.*
- FROM `contact`
- INNER JOIN `group_member`
- ON `contact`.`id` = `group_member`.`contact-id`
- WHERE `gid` = ?
- AND `contact`.`uid` = ?
- AND NOT `contact`.`self`
- AND NOT `contact`.`deleted`
- AND NOT `contact`.`blocked`
- AND NOT `contact`.`pending`
- ORDER BY `contact`.`name` ASC',
- $gid,
- DI::userSession()->getLocalUserId()
- );
-
- if (DBA::isResult($stmt)) {
- $return = DBA::toArray($stmt);
- }
- }
-
- return $return;
- }
-
- /**
- * Returns ungrouped contact count or list for user
- *
- * Returns either the total number of ungrouped contacts for the given user
- * id or a paginated list of ungrouped contacts.
- *
- * @param int $uid uid
- * @return array
- * @throws \Exception
- */
- public static function listUngrouped(int $uid)
- {
- return Contact::selectToArray([], ["`uid` = ? AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `failed`
- AND `id` NOT IN (SELECT DISTINCT(`contact-id`) FROM `group_member` INNER JOIN `group` ON `group`.`id` = `group_member`.`gid`
- WHERE `group`.`uid` = ? AND `contact-id` = `contact`.`id`)", $uid, $uid]);
- }
-
- /**
- * Remove a contact from all groups
- *
- * @param integer $contact_id
- *
- * @return boolean Success
- */
- public static function removeContact(int $contact_id)
- {
- return DBA::delete('group_member', ['contact-id' => $contact_id]);
- }
-}
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Model;
-
-use Friendica\BaseModule;
-use Friendica\Core\Logger;
-use Friendica\Core\Protocol;
-use Friendica\Core\Renderer;
-use Friendica\Database\Database;
-use Friendica\Database\DBA;
-use Friendica\DI;
-use Friendica\Network\HTTPException;
-use Friendica\Protocol\ActivityPub;
-
-/**
- * functions for interacting with the group database table
- */
-class Group
-{
- const FOLLOWERS = '~';
- const MUTUALS = '&';
-
- /**
- * Fetches group record by user id and maybe includes deleted groups as well
- *
- * @param int $uid User id to fetch group(s) for
- * @param bool $includesDeleted Whether deleted groups should be included
- * @return array|bool Array on success, bool on error
- */
- public static function getByUserId(int $uid, bool $includesDeleted = false)
- {
- $conditions = ['uid' => $uid, 'cid' => null];
-
- if (!$includesDeleted) {
- $conditions['deleted'] = false;
- }
-
- return DBA::selectToArray('group', [], $conditions);
- }
-
- /**
- * Checks whether given group id is found in database
- *
- * @param int $group_id Group id
- * @param int $uid Optional user id
- * @return bool
- * @throws \Exception
- */
- public static function exists(int $group_id, int $uid = null): bool
- {
- $condition = ['id' => $group_id, 'deleted' => false];
-
- if (!is_null($uid)) {
- $condition = [
- 'uid' => $uid
- ];
- }
-
- return DBA::exists('group', $condition);
- }
-
- /**
- * Create a new contact group
- *
- * Note: If we found a deleted group with the same name, we restore it
- *
- * @param int $uid User id to create group for
- * @param string $name Name of group
- * @return int|boolean Id of newly created group or false on error
- * @throws \Exception
- */
- public static function create(int $uid, string $name)
- {
- $return = false;
- if (!empty($uid) && !empty($name)) {
- $gid = self::getIdByName($uid, $name); // check for dupes
- if ($gid !== false) {
- // This could be a problem.
- // Let's assume we've just created a group which we once deleted
- // all the old members are gone, but the group remains so we don't break any security
- // 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.
- $group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
- if (DBA::isResult($group) && $group['deleted']) {
- DBA::update('group', ['deleted' => 0], ['id' => $gid]);
- DI::sysmsg()->addNotice(DI::l10n()->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.'));
- }
- return true;
- }
-
- $return = DBA::insert('group', ['uid' => $uid, 'name' => $name]);
- if ($return) {
- $return = DBA::lastInsertId();
- }
- }
- return $return;
- }
-
- /**
- * Update group information.
- *
- * @param int $id Group ID
- * @param string $name Group name
- *
- * @return bool Was the update successful?
- * @throws \Exception
- */
- public static function update(int $id, string $name): bool
- {
- return DBA::update('group', ['name' => $name], ['id' => $id]);
- }
-
- /**
- * Get a list of group ids a contact belongs to
- *
- * @param int $cid Contact id
- * @return array Group ids
- * @throws \Exception
- */
- public static function getIdsByContactId(int $cid): array
- {
- $contact = Contact::getById($cid, ['rel']);
- if (!$contact) {
- return [];
- }
-
- $groupIds = [];
-
- $stmt = DBA::select('group_member', ['gid'], ['contact-id' => $cid]);
- while ($group = DBA::fetch($stmt)) {
- $groupIds[] = $group['gid'];
- }
- DBA::close($stmt);
-
- // Meta-groups
- if ($contact['rel'] == Contact::FOLLOWER || $contact['rel'] == Contact::FRIEND) {
- $groupIds[] = self::FOLLOWERS;
- }
-
- if ($contact['rel'] == Contact::FRIEND) {
- $groupIds[] = self::MUTUALS;
- }
-
- return $groupIds;
- }
-
- /**
- * count unread group items
- *
- * Count unread items of each groups of the local user
- *
- * @return array
- * 'id' => group id
- * 'name' => group name
- * 'count' => counted unseen group items
- * @throws \Exception
- */
- public static function countUnseen()
- {
- $stmt = DBA::p("SELECT `group`.`id`, `group`.`name`,
- (SELECT COUNT(*) FROM `post-user`
- WHERE `uid` = ?
- AND `unseen`
- AND `contact-id` IN
- (SELECT `contact-id`
- FROM `group_member`
- WHERE `group_member`.`gid` = `group`.`id`)
- ) AS `count`
- FROM `group`
- WHERE `group`.`uid` = ?;",
- DI::userSession()->getLocalUserId(),
- DI::userSession()->getLocalUserId()
- );
-
- return DBA::toArray($stmt);
- }
-
- /**
- * Get the group id for a user/name couple
- *
- * Returns false if no group has been found.
- *
- * @param int $uid User id
- * @param string $name Group name
- * @return int|boolean Groups' id number or false on error
- * @throws \Exception
- */
- public static function getIdByName(int $uid, string $name)
- {
- if (!$uid || !strlen($name)) {
- return false;
- }
-
- $group = DBA::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
- if (DBA::isResult($group)) {
- return $group['id'];
- }
-
- return false;
- }
-
- /**
- * Mark a group as deleted
- *
- * @param int $gid
- * @return boolean
- * @throws \Exception
- */
- public static function remove(int $gid): bool
- {
- if (!$gid) {
- return false;
- }
-
- $group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
- if (!DBA::isResult($group)) {
- return false;
- }
-
- // remove group from default posting lists
- $user = DBA::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
- if (DBA::isResult($user)) {
- $change = false;
-
- if ($user['def_gid'] == $gid) {
- $user['def_gid'] = 0;
- $change = true;
- }
- if (strpos($user['allow_gid'], '<' . $gid . '>') !== false) {
- $user['allow_gid'] = str_replace('<' . $gid . '>', '', $user['allow_gid']);
- $change = true;
- }
- if (strpos($user['deny_gid'], '<' . $gid . '>') !== false) {
- $user['deny_gid'] = str_replace('<' . $gid . '>', '', $user['deny_gid']);
- $change = true;
- }
-
- if ($change) {
- DBA::update('user', $user, ['uid' => $group['uid']]);
- }
- }
-
- // remove all members
- DBA::delete('group_member', ['gid' => $gid]);
-
- // remove group
- $return = DBA::update('group', ['deleted' => 1], ['id' => $gid]);
-
- return $return;
- }
-
- /**
- * Adds a contact to a group
- *
- * @param int $gid
- * @param int $cid
- * @return boolean
- * @throws \Exception
- */
- public static function addMember(int $gid, int $cid): bool
- {
- if (!$gid || !$cid) {
- return false;
- }
-
- // @TODO Backward compatibility with user contacts, remove by version 2022.03
- $group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
- if (empty($group)) {
- throw new HTTPException\NotFoundException('Group not found.');
- }
-
- $cdata = Contact::getPublicAndUserContactID($cid, $group['uid']);
- if (empty($cdata['user'])) {
- throw new HTTPException\NotFoundException('Invalid contact.');
- }
-
- return DBA::insert('group_member', ['gid' => $gid, 'contact-id' => $cdata['user']], Database::INSERT_IGNORE);
- }
-
- /**
- * Removes a contact from a group
- *
- * @param int $gid
- * @param int $cid
- * @return boolean
- * @throws \Exception
- */
- public static function removeMember(int $gid, int $cid): bool
- {
- if (!$gid || !$cid) {
- return false;
- }
-
- // @TODO Backward compatibility with user contacts, remove by version 2022.03
- $group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
- if (empty($group)) {
- throw new HTTPException\NotFoundException('Group not found.');
- }
-
- $cdata = Contact::getPublicAndUserContactID($cid, $group['uid']);
- if (empty($cdata['user'])) {
- throw new HTTPException\NotFoundException('Invalid contact.');
- }
-
- return DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $cid]);
- }
-
- /**
- * Adds contacts to a group
- *
- * @param int $gid
- * @param array $contacts Array with contact ids
- * @return void
- * @throws \Exception
- */
- public static function addMembers(int $gid, array $contacts)
- {
- if (!$gid || !$contacts) {
- return;
- }
-
- // @TODO Backward compatibility with user contacts, remove by version 2022.03
- $group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
- if (empty($group)) {
- throw new HTTPException\NotFoundException('Group not found.');
- }
-
- foreach ($contacts as $cid) {
- $cdata = Contact::getPublicAndUserContactID($cid, $group['uid']);
- if (empty($cdata['user'])) {
- throw new HTTPException\NotFoundException('Invalid contact.');
- }
-
- DBA::insert('group_member', ['gid' => $gid, 'contact-id' => $cdata['user']], Database::INSERT_IGNORE);
- }
- }
-
- /**
- * Removes contacts from a group
- *
- * @param int $gid Group id
- * @param array $contacts Contact ids
- * @return bool
- * @throws \Exception
- */
- public static function removeMembers(int $gid, array $contacts)
- {
- if (!$gid || !$contacts) {
- return false;
- }
-
- // @TODO Backward compatibility with user contacts, remove by version 2022.03
- $group = DBA::selectFirst('group', ['uid'], ['id' => $gid]);
- if (empty($group)) {
- throw new HTTPException\NotFoundException('Group not found.');
- }
-
- $contactIds = [];
-
- foreach ($contacts as $cid) {
- $cdata = Contact::getPublicAndUserContactID($cid, $group['uid']);
- if (empty($cdata['user'])) {
- throw new HTTPException\NotFoundException('Invalid contact.');
- }
-
- $contactIds[] = $cdata['user'];
- }
-
- // Return status of deletion
- return DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $contactIds]);
- }
-
- /**
- * Returns the combined list of contact ids from a group id list
- *
- * @param int $uid User id
- * @param array $group_ids Groups ids
- * @param boolean $check_dead Whether check "dead" records (?)
- * @param boolean $expand_followers Expand the list of followers
- * @return array
- * @throws \Exception
- */
- public static function expand(int $uid, array $group_ids, bool $check_dead = false, bool $expand_followers = true): array
- {
- if (!is_array($group_ids) || !count($group_ids)) {
- return [];
- }
-
- $return = [];
- $pubmail = false;
- $followers_collection = false;
- $networks = Protocol::SUPPORT_PRIVATE;
-
- $mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', $uid]);
- if (DBA::isResult($mailacct)) {
- $pubmail = $mailacct['pubmail'];
- }
-
- if (!$pubmail) {
- $networks = array_diff($networks, [Protocol::MAIL]);
- }
-
- $key = array_search(self::FOLLOWERS, $group_ids);
- if ($key !== false) {
- if ($expand_followers) {
- $followers = Contact::selectToArray(['id'], [
- 'uid' => $uid,
- 'rel' => [Contact::FOLLOWER, Contact::FRIEND],
- 'network' => $networks,
- 'contact-type' => [Contact::TYPE_UNKNOWN, Contact::TYPE_PERSON],
- 'archive' => false,
- 'pending' => false,
- 'blocked' => false,
- ]);
-
- foreach ($followers as $follower) {
- $return[] = $follower['id'];
- }
- } else {
- $followers_collection = true;
- }
- unset($group_ids[$key]);
- }
-
- $key = array_search(self::MUTUALS, $group_ids);
- if ($key !== false) {
- $mutuals = Contact::selectToArray(['id'], [
- 'uid' => $uid,
- 'rel' => [Contact::FRIEND],
- 'network' => $networks,
- 'contact-type' => [Contact::TYPE_UNKNOWN, Contact::TYPE_PERSON],
- 'archive' => false,
- 'pending' => false,
- 'blocked' => false,
- ]);
-
- foreach ($mutuals as $mutual) {
- $return[] = $mutual['id'];
- }
-
- unset($group_ids[$key]);
- }
-
- $stmt = DBA::select('group_member', ['contact-id'], ['gid' => $group_ids]);
- while ($group_member = DBA::fetch($stmt)) {
- $return[] = $group_member['contact-id'];
- }
- DBA::close($stmt);
-
- if ($check_dead) {
- $return = Contact::pruneUnavailable($return);
- }
-
- if ($followers_collection) {
- $return[] = -1;
- }
-
- return $return;
- }
-
- /**
- * Returns a templated group selection list
- *
- * @param int $uid User id
- * @param int $gid An optional pre-selected group
- * @param string $label An optional label of the list
- * @return string
- * @throws \Exception
- */
- public static function displayGroupSelection(int $uid, int $gid = 0, string $label = ''): string
- {
- $display_groups = [
- [
- 'name' => '',
- 'id' => '0',
- 'selected' => ''
- ]
- ];
-
- $stmt = DBA::select('group', [], ['deleted' => false, 'uid' => $uid, 'cid' => null], ['order' => ['name']]);
- while ($group = DBA::fetch($stmt)) {
- $display_groups[] = [
- 'name' => $group['name'],
- 'id' => $group['id'],
- 'selected' => $gid == $group['id'] ? 'true' : ''
- ];
- }
- DBA::close($stmt);
-
- Logger::info('Got groups', $display_groups);
-
- if ($label == '') {
- $label = DI::l10n()->t('Default privacy group for new contacts');
- }
-
- $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('group_selection.tpl'), [
- '$label' => $label,
- '$groups' => $display_groups
- ]);
- return $o;
- }
-
- /**
- * Create group sidebar widget
- *
- * @param string $every
- * @param string $each
- * @param string $editmode
- * 'standard' => include link 'Edit groups'
- * 'extended' => include link 'Create new group'
- * 'full' => include link 'Create new group' and provide for each group a link to edit this group
- * @param string|int $group_id Distinct group id or 'everyone'
- * @param int $cid Contact id
- * @return string Sidebar widget HTML code
- * @throws \Exception
- */
- public static function sidebarWidget(string $every = 'contact', string $each = 'group', string $editmode = 'standard', $group_id = '', int $cid = 0)
- {
- if (!DI::userSession()->getLocalUserId()) {
- return '';
- }
-
- $display_groups = [
- [
- 'text' => DI::l10n()->t('Everybody'),
- 'id' => 0,
- 'selected' => (($group_id === 'everyone') ? 'group-selected' : ''),
- 'href' => $every,
- ]
- ];
-
- $member_of = [];
- if ($cid) {
- $member_of = self::getIdsByContactId($cid);
- }
-
- $stmt = DBA::select('group', [], ['deleted' => false, 'uid' => DI::userSession()->getLocalUserId(), 'cid' => null], ['order' => ['name']]);
- while ($group = DBA::fetch($stmt)) {
- $selected = (($group_id == $group['id']) ? ' group-selected' : '');
-
- if ($editmode == 'full') {
- $groupedit = [
- 'href' => 'group/' . $group['id'],
- 'title' => DI::l10n()->t('edit'),
- ];
- } else {
- $groupedit = null;
- }
-
- if ($each == 'group') {
- $count = DBA::count('group_member', ['gid' => $group['id']]);
- $group_name = sprintf('%s (%d)', $group['name'], $count);
- } else {
- $group_name = $group['name'];
- }
-
- $display_groups[] = [
- 'id' => $group['id'],
- 'cid' => $cid,
- 'text' => $group_name,
- 'href' => $each . '/' . $group['id'],
- 'edit' => $groupedit,
- 'selected' => $selected,
- 'ismember' => in_array($group['id'], $member_of),
- ];
- }
- DBA::close($stmt);
-
- // Don't show the groups on the network page when there is only one
- if ((count($display_groups) <= 2) && ($each == 'network')) {
- return '';
- }
-
- $tpl = Renderer::getMarkupTemplate('group_side.tpl');
- $o = Renderer::replaceMacros($tpl, [
- '$add' => DI::l10n()->t('add'),
- '$title' => DI::l10n()->t('Groups'),
- '$groups' => $display_groups,
- 'newgroup' => $editmode == 'extended' || $editmode == 'full' ? 1 : '',
- 'grouppage' => 'group/',
- '$edittext' => DI::l10n()->t('Edit group'),
- '$ungrouped' => $every === 'contact' ? DI::l10n()->t('Contacts not in any group') : '',
- '$ungrouped_selected' => (($group_id === 'none') ? 'group-selected' : ''),
- '$createtext' => DI::l10n()->t('Create a new group'),
- '$creategroup' => DI::l10n()->t('Group Name: '),
- '$editgroupstext' => DI::l10n()->t('Edit groups'),
- '$form_security_token' => BaseModule::getFormSecurityToken('group_edit'),
- ]);
-
- return $o;
- }
-
- /**
- * Fetch the group id for the given contact id
- *
- * @param integer $id Contact ID
- * @return integer Group IO
- */
- public static function getIdForForum(int $id): int
- {
- Logger::info('Get id for forum id', ['id' => $id]);
- $contact = Contact::getById($id, ['uid', 'name', 'contact-type', 'manually-approve']);
- if (empty($contact) || ($contact['contact-type'] != Contact::TYPE_COMMUNITY) || !$contact['manually-approve']) {
- return 0;
- }
-
- $group = DBA::selectFirst('group', ['id'], ['uid' => $contact['uid'], 'cid' => $id]);
- if (empty($group)) {
- $fields = [
- 'uid' => $contact['uid'],
- 'name' => $contact['name'],
- 'cid' => $id,
- ];
- DBA::insert('group', $fields);
- $gid = DBA::lastInsertId();
- } else {
- $gid = $group['id'];
- }
-
- return $gid;
- }
-
- /**
- * Fetch the followers of a given contact id and store them as group members
- *
- * @param integer $id Contact ID
- * @return void
- */
- public static function updateMembersForForum(int $id)
- {
- Logger::info('Update forum members', ['id' => $id]);
-
- $contact = Contact::getById($id, ['uid', 'url']);
- if (empty($contact)) {
- return;
- }
-
- $apcontact = APContact::getByURL($contact['url']);
- if (empty($apcontact['followers'])) {
- return;
- }
-
- $gid = self::getIdForForum($id);
- if (empty($gid)) {
- return;
- }
-
- $group_members = DBA::selectToArray('group_member', ['contact-id'], ['gid' => $gid]);
- if (!empty($group_members)) {
- $current = array_unique(array_column($group_members, 'contact-id'));
- } else {
- $current = [];
- }
-
- foreach (ActivityPub::fetchItems($apcontact['followers'], $contact['uid']) as $follower) {
- $id = Contact::getIdForURL($follower);
- if (!in_array($id, $current)) {
- DBA::insert('group_member', ['gid' => $gid, 'contact-id' => $id]);
- } else {
- $key = array_search($id, $current);
- unset($current[$key]);
- }
- }
-
- DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $current]);
- Logger::info('Updated forum members', ['id' => $id, 'count' => DBA::count('group_member', ['gid' => $gid])]);
- }
-}
if ($owner['page-flags'] == User::PAGE_FLAGS_PRVGROUP) {
$allow_cid = '';
- $allow_gid = '<' . Group::FOLLOWERS . '>';
+ $allow_gid = '<' . Circle::FOLLOWERS . '>';
$deny_cid = '';
$deny_gid = '';
self::performActivity($item['id'], 'announce', $uid, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
$expand_followers = true;
}
- $allow_people = $aclFormatter->expand($obj['allow_cid']);
- $allow_groups = Group::expand($obj['uid'], $aclFormatter->expand($obj['allow_gid']), $check_dead, $expand_followers);
- $deny_people = $aclFormatter->expand($obj['deny_cid']);
- $deny_groups = Group::expand($obj['uid'], $aclFormatter->expand($obj['deny_gid']), $check_dead);
- $recipients = array_unique(array_merge($allow_people, $allow_groups));
- $deny = array_unique(array_merge($deny_people, $deny_groups));
- $recipients = array_diff($recipients, $deny);
+ $allow_people = $aclFormatter->expand($obj['allow_cid']);
+ $allow_circles = Circle::expand($obj['uid'], $aclFormatter->expand($obj['allow_gid']), $check_dead, $expand_followers);
+ $deny_people = $aclFormatter->expand($obj['deny_cid']);
+ $deny_circles = Circle::expand($obj['uid'], $aclFormatter->expand($obj['deny_gid']), $check_dead);
+ $recipients = array_unique(array_merge($allow_people, $allow_circles));
+ $deny = array_unique(array_merge($deny_people, $deny_circles));
+ $recipients = array_diff($recipients, $deny);
return $recipients;
}
/*
* Authenticated visitor. Unless pre-verified,
* check that the contact belongs to this $owner_id
- * and load the groups the visitor belongs to.
+ * and load the circles the visitor belongs to.
* If pre-verified, the caller is expected to have already
- * done this and passed the groups into this function.
+ * done this and passed the circles into this function.
*/
$permissionSets = DI::permissionSet()->selectByContactId($remote_user, $owner_id);
* @param integer $scale Scale
* @param integer $type Photo type, optional, default: Photo::DEFAULT
* @param string $allow_cid Permissions, allowed contacts. optional, default = ""
- * @param string $allow_gid Permissions, allowed groups. optional, default = ""
- * @param string $deny_cid Permissions, denied contacts.optional, default = ""
- * @param string $deny_gid Permissions, denied group.optional, default = ""
+ * @param string $allow_gid Permissions, allowed circles. optional, default = ""
+ * @param string $deny_cid Permissions, denied contacts. optional, default = ""
+ * @param string $deny_gid Permissions, denied circle. optional, default = ""
* @param string $desc Photo caption. optional, default = ""
*
* @return boolean True on success
* @return string
* @throws \Exception
*/
- public static function setPermissionFromBody($body, $uid, $original_contact_id, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny)
+ public static function setPermissionFromBody($body, $uid, $original_contact_id, $str_contact_allow, $str_circle_allow, $str_contact_deny, $str_circle_deny)
{
// Simplify image codes
$img_body = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $body);
* Then set the permissions to public.
*/
- self::setPermissionForResource($image_rid, $uid, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
+ self::setPermissionForResource($image_rid, $uid, $str_contact_allow, $str_circle_allow, $str_contact_deny, $str_circle_deny);
}
return true;
* @param string $image_rid
* @param integer $uid
* @param string $str_contact_allow
- * @param string $str_group_allow
+ * @param string $str_circle_allow
* @param string $str_contact_deny
- * @param string $str_group_deny
+ * @param string $str_circle_deny
* @return void
*/
- public static function setPermissionForResource(string $image_rid, int $uid, string $str_contact_allow, string $str_group_allow, string $str_contact_deny, string $str_group_deny)
+ public static function setPermissionForResource(string $image_rid, int $uid, string $str_contact_allow, string $str_circle_allow, string $str_contact_deny, string $str_circle_deny)
{
- $fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
- 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny,
+ $fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_circle_allow,
+ 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_circle_deny,
'accessible' => DI::pConfig()->get($uid, 'system', 'accessible-photos', false)];
$condition = ['resource-id' => $image_rid, 'uid' => $uid];
* @param string $album Album name
* @param string $description Photo caption
* @param string $allow_cid Permissions, allowed contacts
- * @param string $allow_gid Permissions, allowed groups
+ * @param string $allow_gid Permissions, allowed circles
* @param string $deny_cid Permissions, denied contacts
- * @param string $deny_gid Permissions, denied group
+ * @param string $deny_gid Permissions, denied circles
*
* @return integer preview photo size
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
}
/**
- * Returns the default group for a given user and network
+ * Returns the default circle for a given user and network
*
* @param int $uid User id
*
- * @return int group id
+ * @return int circle id
* @throws Exception
*/
- public static function getDefaultGroup(int $uid): int
+ public static function getDefaultCircle(int $uid): int
{
$user = DBA::selectFirst('user', ['def_gid'], ['uid' => $uid]);
if (DBA::isResult($user)) {
- $default_group = $user["def_gid"];
+ $default_circle = $user['def_gid'];
} else {
- $default_group = 0;
+ $default_circle = 0;
}
- return $default_group;
+ return $default_circle;
}
/**
throw new Exception(DI::l10n()->t('An error occurred creating your self contact. Please try again.'));
}
- // Create a group with no members. This allows somebody to use it
- // right away as a default group for new contacts.
- $def_gid = Group::create($uid, DI::l10n()->t('Friends'));
+ // Create a circle with no members. This allows somebody to use it
+ // right away as a default circle for new contacts.
+ $def_gid = Circle::create($uid, DI::l10n()->t('Friends'));
if (!$def_gid) {
DBA::delete('user', ['uid' => $uid]);
- throw new Exception(DI::l10n()->t('An error occurred creating your default contact group. Please try again.'));
+ throw new Exception(DI::l10n()->t('An error occurred creating your default contact circle. Please try again.'));
}
$fields = ['def_gid' => $def_gid];
$temppath = (!empty($_POST['temppath']) ? trim($_POST['temppath']) : '');
$singleuser = (!empty($_POST['singleuser']) ? trim($_POST['singleuser']) : '');
$only_tag_search = !empty($_POST['only_tag_search']);
- $compute_group_counts = !empty($_POST['compute_group_counts']);
+ $compute_circle_counts = !empty($_POST['compute_circle_counts']);
$check_new_version_url = (!empty($_POST['check_new_version_url']) ? trim($_POST['check_new_version_url']) : 'none');
$worker_queues = (!empty($_POST['worker_queues']) ? intval($_POST['worker_queues']) : 10);
$transactionConfig->set('system', 'temppath', $temppath);
$transactionConfig->set('system', 'only_tag_search' , $only_tag_search);
- $transactionConfig->set('system', 'compute_group_counts', $compute_group_counts);
+ $transactionConfig->set('system', 'compute_circle_counts', $compute_circle_counts);
$transactionConfig->set('system', 'worker_queues' , $worker_queues);
$transactionConfig->set('system', 'worker_fastlane' , $worker_fastlane);
'$block_public' => ['block_public', DI::l10n()->t('Block public'), DI::config()->get('system', 'block_public'), DI::l10n()->t('Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.')],
'$force_publish' => ['publish_all', DI::l10n()->t('Force publish'), DI::config()->get('system', 'publish_all'), DI::l10n()->t('Check to force all profiles on this site to be listed in the site directory.') . '<strong>' . DI::l10n()->t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
'$global_directory' => ['directory', DI::l10n()->t('Global directory URL'), DI::config()->get('system', 'directory'), DI::l10n()->t('URL to the global directory. If this is not set, the global directory is completely unavailable to the application.')],
- '$newuser_private' => ['newuser_private', DI::l10n()->t('Private posts by default for new users'), DI::config()->get('system', 'newuser_private'), DI::l10n()->t('Set default post permissions for all new members to the default privacy group rather than public.')],
+ '$newuser_private' => ['newuser_private', DI::l10n()->t('Private posts by default for new users'), DI::config()->get('system', 'newuser_private'), DI::l10n()->t('Set default post permissions for all new members to the default privacy circle rather than public.')],
'$enotify_no_content' => ['enotify_no_content', DI::l10n()->t('Don\'t include post content in email notifications'), DI::config()->get('system', 'enotify_no_content'), DI::l10n()->t('Don\'t include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.')],
'$private_addons' => ['private_addons', DI::l10n()->t('Disallow public access to addons listed in the apps menu.'), DI::config()->get('config', 'private_addons'), DI::l10n()->t('Checking this box will restrict addons listed in the apps menu to members only.')],
'$disable_embedded' => ['disable_embedded', DI::l10n()->t('Don\'t embed private images in posts'), DI::config()->get('system', 'disable_embedded'), DI::l10n()->t('Don\'t replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.')],
'$max_display_comments' => ['max_display_comments', DI::l10n()->t('Maximum numbers of comments per post on the display page'), DI::config()->get('system', 'max_display_comments'), DI::l10n()->t('How many comments should be shown on the single view for each post? Default value is 1000.')],
'$temppath' => ['temppath', DI::l10n()->t('Temp path'), DI::config()->get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')],
'$only_tag_search' => ['only_tag_search', DI::l10n()->t('Only search in tags'), DI::config()->get('system', 'only_tag_search'), DI::l10n()->t('On large systems the text search can slow down the system extremely.')],
- '$compute_group_counts' => ['compute_group_counts', DI::l10n()->t('Generate counts per contact group when calculating network count'), DI::config()->get('system', 'compute_group_counts'), DI::l10n()->t('On systems with users that heavily use contact groups the query can be very expensive.')],
+ '$compute_circle_counts' => ['compute_circle_counts', DI::l10n()->t('Generate counts per contact circle when calculating network count'), DI::config()->get('system', 'compute_group_counts') ?? DI::config()->get('system', 'compute_circle_counts'), DI::l10n()->t('On systems with users that heavily use contact circles the query can be very expensive.')],
'$worker_queues' => ['worker_queues', DI::l10n()->t('Maximum number of parallel workers'), DI::config()->get('system', 'worker_queues'), DI::l10n()->t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)],
'$worker_fastlane' => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Module\Api\Friendica\Circle;
+
+use Friendica\Database\DBA;
+use Friendica\Model\Circle;
+use Friendica\Module\BaseApi;
+use Friendica\Network\HTTPException;
+
+/**
+ * API endpoint: /api/friendica/circle_create
+ * API endpoint: /api/friendica/group_create
+ */
+class Create extends BaseApi
+{
+ protected function post(array $request = [])
+ {
+ BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
+ $uid = BaseApi::getCurrentUserID();
+
+ // params
+ $name = $this->getRequestValue($request, 'name', '');
+ $json = json_decode($request['json'], true);
+ $users = $json['user'];
+
+ // error if no name specified
+ if ($name == '') {
+ throw new HTTPException\BadRequestException('circle name not specified');
+ }
+
+ // error message if specified circle name already exists
+ if (DBA::exists('group', ['uid' => $uid, 'name' => $name, 'deleted' => false])) {
+ throw new HTTPException\BadRequestException('circle name already exists');
+ }
+
+ // Check if the circle needs to be reactivated
+ if (DBA::exists('group', ['uid' => $uid, 'name' => $name, 'deleted' => true])) {
+ $reactivate_circle = true;
+ }
+
+ $ret = Circle::create($uid, $name);
+ if ($ret) {
+ $gid = Circle::getIdByName($uid, $name);
+ } else {
+ throw new HTTPException\BadRequestException('other API error');
+ }
+
+ // add members
+ $erroraddinguser = false;
+ $errorusers = [];
+ foreach ($users as $user) {
+ $cid = $user['cid'];
+ if (DBA::exists('contact', ['id' => $cid, 'uid' => $uid])) {
+ Circle::addMember($gid, $cid);
+ } else {
+ $erroraddinguser = true;
+ $errorusers[] = $cid;
+ }
+ }
+
+ // return success message incl. missing users in array
+ $status = ($erroraddinguser ? 'missing user' : (!empty($reactivate_circle) ? 'reactivated' : 'ok'));
+
+ $result = ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers];
+
+ $this->response->exit('group_create', ['$result' => $result], $this->parameters['extension'] ?? null);
+ }
+}
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Module\Api\Friendica\Circle;
+
+use Friendica\Database\DBA;
+use Friendica\Model\Circle;
+use Friendica\Module\BaseApi;
+use Friendica\Network\HTTPException\BadRequestException;
+
+/**
+ * API endpoint: /api/friendica/group/delete
+ * API endpoint: /api/friendica/circle/delete
+ */
+class Delete extends BaseApi
+{
+ protected function post(array $request = [])
+ {
+ self::checkAllowedScope(self::SCOPE_WRITE);
+ $uid = self::getCurrentUserID();
+
+ $request = $this->getRequest([
+ 'gid' => 0,
+ 'name' => ''
+ ], $request);
+
+ // params
+
+ // error if no gid specified
+ if ($request['gid'] == 0 || $request['name'] == '') {
+ throw new BadRequestException('gid or name not specified');
+ }
+
+ // error message if specified gid is not in database
+ if (!DBA::exists('group', ['uid' => $uid, 'id' => $request['gid']])) {
+ throw new BadRequestException('gid not available');
+ }
+
+ // error message if specified gid is not in database
+ if (!DBA::exists('group', ['uid' => $uid, 'id' => $request['gid'], 'name' => $request['name']])) {
+ throw new BadRequestException('wrong circle name');
+ }
+
+ // delete circle
+ $gid = Circle::getIdByName($uid, $request['name']);
+ if (empty($request['gid'])) {
+ throw new BadRequestException('other API error');
+ }
+
+ $ret = Circle::remove($gid);
+
+ if ($ret) {
+ // return success
+ $success = ['success' => $ret, 'gid' => $request['gid'], 'name' => $request['name'], 'status' => 'deleted', 'wrong users' => []];
+ $this->response->exit('group_delete', ['$result' => $success], $this->parameters['extension'] ?? null);
+ } else {
+ throw new BadRequestException('other API error');
+ }
+ }
+}
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Module\Api\Friendica\Circle;
+
+use Friendica\Database\DBA;
+use Friendica\DI;
+use Friendica\Model\Contact;
+use Friendica\Module\BaseApi;
+use Friendica\Network\HTTPException;
+
+/**
+ * API endpoint: /api/friendica/circle_show
+ * API endpoint: /api/friendica/group_show
+ */
+class Show extends BaseApi
+{
+ protected function rawContent(array $request = [])
+ {
+ BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
+ $uid = BaseApi::getCurrentUserID();
+ $type = $this->getRequestValue($this->parameters, 'extension', 'json');
+
+ // params
+ $gid = $this->getRequestValue($request, 'gid', 0);
+
+ // get data of the specified circle id or all circles if not specified
+ if ($gid != 0) {
+ $circles = DBA::selectToArray('group', [], ['deleted' => false, 'uid' => $uid, 'id' => $gid]);
+
+ // error message if specified gid is not in database
+ if (!DBA::isResult($circles)) {
+ throw new HTTPException\BadRequestException('gid not available');
+ }
+ } else {
+ $circles = DBA::selectToArray('group', [], ['deleted' => false, 'uid' => $uid]);
+ }
+
+ // loop through all circles and retrieve all members for adding data in the user array
+ $grps = [];
+ foreach ($circles as $circle) {
+ $members = Contact\Circle::getById($circle['id']);
+ $users = [];
+
+ if ($type == 'xml') {
+ $user_element = 'users';
+ $k = 0;
+ foreach ($members as $member) {
+ $users[$k++.':user'] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
+ }
+ } else {
+ $user_element = 'user';
+ foreach ($members as $member) {
+ $users[] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
+ }
+ }
+ $grps[] = ['name' => $circle['name'], 'gid' => $circle['id'], $user_element => $users];
+ }
+
+ $this->response->exit('group_update', ['group' => $grps], $this->parameters['extension'] ?? null);
+ }
+}
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Module\Api\Friendica\Circle;
+
+use Friendica\Database\DBA;
+use Friendica\Model\Contact;
+use Friendica\Model\Circle;
+use Friendica\Module\BaseApi;
+use Friendica\Network\HTTPException\BadRequestException;
+
+/**
+ * API endpoint: /api/friendica/circle_update
+ * API endpoint: /api/friendica/group_update
+ */
+class Update extends BaseApi
+{
+ protected function post(array $request = [])
+ {
+ BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
+ $uid = BaseApi::getCurrentUserID();
+
+ // params
+ $gid = $this->getRequestValue($request, 'gid', 0);
+ $name = $this->getRequestValue($request, 'name', '');
+ $json = json_decode($request['json'], true);
+ $users = $json['user'];
+
+ // error if no name specified
+ if (!$name) {
+ throw new BadRequestException('circle name not specified');
+ }
+
+ // error if no gid specified
+ if (!$gid) {
+ throw new BadRequestException('gid not specified');
+ }
+
+ // remove members
+ $members = Contact\Circle::getById($gid);
+ foreach ($members as $member) {
+ $cid = $member['id'];
+ foreach ($users as $user) {
+ $found = $user['cid'] == $cid;
+ }
+ if (!isset($found) || !$found) {
+ $gid = Circle::getIdByName($uid, $name);
+ Circle::removeMember($gid, $cid);
+ }
+ }
+
+ // add members
+ $erroraddinguser = false;
+ $errorusers = [];
+ foreach ($users as $user) {
+ $cid = $user['cid'];
+
+ if (DBA::exists('contact', ['id' => $cid, 'uid' => $uid])) {
+ Circle::addMember($gid, $cid);
+ } else {
+ $erroraddinguser = true;
+ $errorusers[] = $cid;
+ }
+ }
+
+ // return success message incl. missing users in array
+ $status = ($erroraddinguser ? 'missing user' : 'ok');
+ $success = ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers];
+ $this->response->exit('group_update', ['$result' => $success], $this->parameters['extension'] ?? null);
+ }
+}
'place' => '', //location of the event
'publish' => 0, //publish message
'allow_cid' => '', //array of allowed person, if access restricted
- 'allow_gid' => '', //array of allowed groups, if access restricted
+ 'allow_gid' => '', //array of allowed circles, if access restricted
'deny_cid' => '', //array of denied person, if access restricted
- 'deny_gid' => '', //array of denied groups, if access restricted
+ 'deny_gid' => '', //array of denied circles, if access restricted
], $request);
// error if no name specified
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Module\Api\Friendica\Group;
-
-use Friendica\Database\DBA;
-use Friendica\Model\Group;
-use Friendica\Module\BaseApi;
-use Friendica\Network\HTTPException;
-
-/**
- * API endpoint: /api/friendica/group_create
- */
-class Create extends BaseApi
-{
- protected function post(array $request = [])
- {
- BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
- $uid = BaseApi::getCurrentUserID();
-
- // params
- $name = $this->getRequestValue($request, 'name', '');
- $json = json_decode($request['json'], true);
- $users = $json['user'];
-
- // error if no name specified
- if ($name == '') {
- throw new HTTPException\BadRequestException('group name not specified');
- }
-
- // error message if specified group name already exists
- if (DBA::exists('group', ['uid' => $uid, 'name' => $name, 'deleted' => false])) {
- throw new HTTPException\BadRequestException('group name already exists');
- }
-
- // Check if the group needs to be reactivated
- if (DBA::exists('group', ['uid' => $uid, 'name' => $name, 'deleted' => true])) {
- $reactivate_group = true;
- }
-
- // create group
- $ret = Group::create($uid, $name);
- if ($ret) {
- $gid = Group::getIdByName($uid, $name);
- } else {
- throw new HTTPException\BadRequestException('other API error');
- }
-
- // add members
- $erroraddinguser = false;
- $errorusers = [];
- foreach ($users as $user) {
- $cid = $user['cid'];
- if (DBA::exists('contact', ['id' => $cid, 'uid' => $uid])) {
- Group::addMember($gid, $cid);
- } else {
- $erroraddinguser = true;
- $errorusers[] = $cid;
- }
- }
-
- // return success message incl. missing users in array
- $status = ($erroraddinguser ? 'missing user' : ((isset($reactivate_group) && $reactivate_group) ? 'reactivated' : 'ok'));
-
- $result = ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers];
-
- $this->response->exit('group_create', ['$result' => $result], $this->parameters['extension'] ?? null);
- }
-}
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Module\Api\Friendica\Group;
-
-use Friendica\Database\DBA;
-use Friendica\Model\Group;
-use Friendica\Module\BaseApi;
-use Friendica\Network\HTTPException\BadRequestException;
-
-/**
- * API endpoint: /api/friendica/group/delete
- */
-class Delete extends BaseApi
-{
- protected function post(array $request = [])
- {
- self::checkAllowedScope(self::SCOPE_WRITE);
- $uid = self::getCurrentUserID();
-
- $request = $this->getRequest([
- 'gid' => 0,
- 'name' => ''
- ], $request);
-
- // params
-
- // error if no gid specified
- if ($request['gid'] == 0 || $request['name'] == '') {
- throw new BadRequestException('gid or name not specified');
- }
-
- // error message if specified gid is not in database
- if (!DBA::exists('group', ['uid' => $uid, 'id' => $request['gid']])) {
- throw new BadRequestException('gid not available');
- }
-
- // error message if specified gid is not in database
- if (!DBA::exists('group', ['uid' => $uid, 'id' => $request['gid'], 'name' => $request['name']])) {
- throw new BadRequestException('wrong group name');
- }
-
- // delete group
- $gid = Group::getIdByName($uid, $request['name']);
- if (empty($request['gid'])) {
- throw new BadRequestException('other API error');
- }
-
- $ret = Group::remove($gid);
-
- if ($ret) {
- // return success
- $success = ['success' => $ret, 'gid' => $request['gid'], 'name' => $request['name'], 'status' => 'deleted', 'wrong users' => []];
- $this->response->exit('group_delete', ['$result' => $success], $this->parameters['extension'] ?? null);
- } else {
- throw new BadRequestException('other API error');
- }
- }
-}
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Module\Api\Friendica\Group;
-
-use Friendica\Database\DBA;
-use Friendica\DI;
-use Friendica\Model\Contact;
-use Friendica\Module\BaseApi;
-use Friendica\Network\HTTPException;
-
-/**
- * API endpoint: /api/friendica/group_show
- */
-class Show extends BaseApi
-{
- protected function rawContent(array $request = [])
- {
- BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
- $uid = BaseApi::getCurrentUserID();
- $type = $this->getRequestValue($this->parameters, 'extension', 'json');
-
- // params
- $gid = $this->getRequestValue($request, 'gid', 0);
-
- // get data of the specified group id or all groups if not specified
- if ($gid != 0) {
- $groups = DBA::selectToArray('group', [], ['deleted' => false, 'uid' => $uid, 'id' => $gid]);
-
- // error message if specified gid is not in database
- if (!DBA::isResult($groups)) {
- throw new HTTPException\BadRequestException('gid not available');
- }
- } else {
- $groups = DBA::selectToArray('group', [], ['deleted' => false, 'uid' => $uid]);
- }
-
- // loop through all groups and retrieve all members for adding data in the user array
- $grps = [];
- foreach ($groups as $rr) {
- $members = Contact\Group::getById($rr['id']);
- $users = [];
-
- if ($type == 'xml') {
- $user_element = 'users';
- $k = 0;
- foreach ($members as $member) {
- $users[$k++.':user'] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
- }
- } else {
- $user_element = 'user';
- foreach ($members as $member) {
- $users[] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
- }
- }
- $grps[] = ['name' => $rr['name'], 'gid' => $rr['id'], $user_element => $users];
- }
-
- $this->response->exit('group_update', ['group' => $grps], $this->parameters['extension'] ?? null);
- }
-}
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Module\Api\Friendica\Group;
-
-use Friendica\Database\DBA;
-use Friendica\Model\Contact;
-use Friendica\Model\Group;
-use Friendica\Module\BaseApi;
-use Friendica\Network\HTTPException\BadRequestException;
-
-/**
- * API endpoint: /api/friendica/group_update
- */
-class Update extends BaseApi
-{
- protected function post(array $request = [])
- {
- BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
- $uid = BaseApi::getCurrentUserID();
-
- // params
- $gid = $this->getRequestValue($request, 'gid', 0);
- $name = $this->getRequestValue($request, 'name', '');
- $json = json_decode($request['json'], true);
- $users = $json['user'];
-
- // error if no name specified
- if (!$name) {
- throw new BadRequestException('group name not specified');
- }
-
- // error if no gid specified
- if (!$gid) {
- throw new BadRequestException('gid not specified');
- }
-
- // remove members
- $members = Contact\Group::getById($gid);
- foreach ($members as $member) {
- $cid = $member['id'];
- foreach ($users as $user) {
- $found = $user['cid'] == $cid;
- }
- if (!isset($found) || !$found) {
- $gid = Group::getIdByName($uid, $name);
- Group::removeMember($gid, $cid);
- }
- }
-
- // add members
- $erroraddinguser = false;
- $errorusers = [];
- foreach ($users as $user) {
- $cid = $user['cid'];
-
- if (DBA::exists('contact', ['id' => $cid, 'uid' => $uid])) {
- Group::addMember($gid, $cid);
- } else {
- $erroraddinguser = true;
- $errorusers[] = $cid;
- }
- }
-
- // return success message incl. missing users in array
- $status = ($erroraddinguser ? 'missing user' : 'ok');
- $success = ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers];
- $this->response->exit('group_update', ['$result' => $success], $this->parameters['extension'] ?? null);
- }
-}
$acl_input_error = false;
$acl_input_error |= !ACL::isValidContact($allow_cid, $uid);
$acl_input_error |= !ACL::isValidContact($deny_cid, $uid);
- $acl_input_error |= !ACL::isValidGroup($allow_gid, $uid);
- $acl_input_error |= !ACL::isValidGroup($deny_gid, $uid);
+ $acl_input_error |= !ACL::isValidCircle($allow_gid, $uid);
+ $acl_input_error |= !ACL::isValidCircle($deny_gid, $uid);
if ($acl_input_error) {
throw new HTTPException\BadRequestException('acl data invalid');
}
$acl_input_error = false;
$acl_input_error |= !ACL::isValidContact($allow_cid, $uid);
$acl_input_error |= !ACL::isValidContact($deny_cid, $uid);
- $acl_input_error |= !ACL::isValidGroup($allow_gid, $uid);
- $acl_input_error |= !ACL::isValidGroup($deny_gid, $uid);
+ $acl_input_error |= !ACL::isValidCircle($allow_gid, $uid);
+ $acl_input_error |= !ACL::isValidCircle($deny_gid, $uid);
if ($acl_input_error) {
throw new HTTPException\BadRequestException('acl data invalid');
}
$cdata = Contact::getPublicAndUserContactID($id, $uid);
if (!empty($cdata['user'])) {
- $groups = DBA::select('group_member', ['gid'], ['contact-id' => $cdata['user']]);
- while ($group = DBA::fetch($groups)) {
- $lists[] = DI::mstdnList()->createFromGroupId($group['gid']);
+ $circles = DBA::select('group_member', ['gid'], ['contact-id' => $cdata['user']]);
+ while ($circle = DBA::fetch($circles)) {
+ $lists[] = DI::mstdnList()->createFromCircleId($circle['gid']);
}
- DBA::close($groups);
+ DBA::close($circles);
}
System::jsonExit($lists);
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Module\BaseApi;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
/**
* @see https://docs.joinmastodon.org/methods/timelines/lists/
DI::mstdnError()->UnprocessableEntity();
}
- if (!Group::exists($this->parameters['id'], $uid)) {
+ if (!Circle::exists($this->parameters['id'], $uid)) {
DI::mstdnError()->RecordNotFound();
}
- if (!Group::remove($this->parameters['id'])) {
+ if (!Circle::remove($this->parameters['id'])) {
DI::mstdnError()->InternalError();
}
DI::mstdnError()->UnprocessableEntity();
}
- Group::create($uid, $request['title']);
+ Circle::create($uid, $request['title']);
- $id = Group::getIdByName($uid, $request['title']);
+ $id = Circle::getIdByName($uid, $request['title']);
if (!$id) {
DI::mstdnError()->InternalError();
}
- System::jsonExit(DI::mstdnList()->createFromGroupId($id));
+ System::jsonExit(DI::mstdnList()->createFromCircleId($id));
}
public function put(array $request = [])
DI::mstdnError()->UnprocessableEntity();
}
- Group::update($this->parameters['id'], $request['title']);
+ Circle::update($this->parameters['id'], $request['title']);
}
/**
if (empty($this->parameters['id'])) {
$lists = [];
- $groups = Group::getByUserId($uid);
-
- foreach ($groups as $group) {
- $lists[] = DI::mstdnList()->createFromGroupId($group['id']);
+ foreach (Circle::getByUserId($uid) as $circle) {
+ $lists[] = DI::mstdnList()->createFromCircleId($circle['id']);
}
} else {
$id = $this->parameters['id'];
- if (!Group::exists($id, $uid)) {
+ if (!Circle::exists($id, $uid)) {
DI::mstdnError()->RecordNotFound();
}
- $lists = DI::mstdnList()->createFromGroupId($id);
+ $lists = DI::mstdnList()->createFromCircleId($id);
}
System::jsonExit($lists);
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Module\BaseApi;
/**
DI::mstdnError()->UnprocessableEntity();
}
- return Group::removeMembers($this->parameters['id'], $request['account_ids']);
+ return Circle::removeMembers($this->parameters['id'], $request['account_ids']);
}
protected function post(array $request = [])
DI::mstdnError()->UnprocessableEntity();
}
- Group::addMembers($this->parameters['id'], $request['account_ids']);
+ Circle::addMembers($this->parameters['id'], $request['account_ids']);
}
/**
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Post;
$item['deny_gid'] = $owner['deny_gid'];
} else {
$item['allow_cid'] = '';
- $item['allow_gid'] = '<' . Group::FOLLOWERS . '>';
+ $item['allow_gid'] = '<' . Circle::FOLLOWERS . '>';
$item['deny_cid'] = '';
$item['deny_gid'] = '';
}
// The permissions are assigned in "expandTags"
break;
default:
- if (is_numeric($request['visibility']) && Group::exists($request['visibility'], $uid)) {
+ if (is_numeric($request['visibility']) && Circle::exists($request['visibility'], $uid)) {
$item['allow_cid'] = '';
$item['allow_gid'] = '<' . $request['visibility'] . '>';
$item['deny_cid'] = '';
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\Database;
-use Friendica\Factory\Api\Friendica\Group as FriendicaGroup;
+use Friendica\Factory\Api\Friendica\Circle as FriendicaCircle;
use Friendica\Module\BaseApi;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Module\Api\ApiResponse;
use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
- * Update information about a group.
+ * Update information about a circle.
*
* @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update
*/
class Create extends BaseApi
{
- /** @var friendicaGroup */
- private $friendicaGroup;
+ /** @var FriendicaCircle */
+ private $friendicaCircle;
/** @var Database */
private $dba;
- public function __construct(Database $dba, FriendicaGroup $friendicaGroup, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, array $server, array $parameters = [])
+ public function __construct(Database $dba, FriendicaCircle $friendicaCircle, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, array $server, array $parameters = [])
{
parent::__construct($app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->dba = $dba;
- $this->friendicaGroup = $friendicaGroup;
+ $this->dba = $dba;
+ $this->friendicaCircle = $friendicaCircle;
}
protected function rawContent(array $request = [])
$name = $this->getRequestValue($request, 'name', '');
if ($name == '') {
- throw new HTTPException\BadRequestException('group name not specified');
+ throw new HTTPException\BadRequestException('circle name not specified');
}
- // error message if specified group name already exists
+ // error message if specified circle name already exists
if ($this->dba->exists('group', ['uid' => $uid, 'name' => $name, 'deleted' => false])) {
- throw new HTTPException\BadRequestException('group name already exists');
+ throw new HTTPException\BadRequestException('circle name already exists');
}
- $ret = Group::create($uid, $name);
+ $ret = Circle::create($uid, $name);
if ($ret) {
- $gid = Group::getIdByName($uid, $name);
+ $gid = Circle::getIdByName($uid, $name);
} else {
throw new HTTPException\BadRequestException('other API error');
}
- $grp = $this->friendicaGroup->createFromId($gid);
+ $grp = $this->friendicaCircle->createFromId($gid);
$this->response->exit('statuses', ['lists' => ['lists' => $grp]], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\Database;
-use Friendica\Factory\Api\Friendica\Group as FriendicaGroup;
+use Friendica\Factory\Api\Friendica\Circle as FriendicaCirle;
use Friendica\Module\BaseApi;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Module\Api\ApiResponse;
use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
- * Delete a group.
+ * Delete a circle.
*
* @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy
*/
class Destroy extends BaseApi
{
- /** @var friendicaGroup */
- private $friendicaGroup;
+ /** @var FriendicaCirle */
+ private $friendicaCircle;
/** @var Database */
private $dba;
- public function __construct(Database $dba, FriendicaGroup $friendicaGroup, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, array $server, array $parameters = [])
+ public function __construct(Database $dba, FriendicaCirle $friendicaCircle, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, array $server, array $parameters = [])
{
parent::__construct($app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->dba = $dba;
- $this->friendicaGroup = $friendicaGroup;
+ $this->dba = $dba;
+ $this->friendicaCircle = $friendicaCircle;
}
protected function rawContent(array $request = [])
throw new HTTPException\BadRequestException('gid not specified');
}
- // get data of the specified group id
- $group = $this->dba->selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
+ // get data of the specified circle id
+ $circle = $this->dba->selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
// error message if specified gid is not in database
- if (!$group) {
+ if (!$circle) {
throw new HTTPException\BadRequestException('gid not available');
}
- $list = $this->friendicaGroup->createFromId($gid);
+ $list = $this->friendicaCircle->createFromId($gid);
- if (Group::remove($gid)) {
+ if (Circle::remove($gid)) {
$this->response->exit('statuses', ['lists' => ['lists' => $list]], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\Database;
-use Friendica\Factory\Api\Friendica\Group as FriendicaGroup;
+use Friendica\Factory\Api\Friendica\Circle as FriendicaCircle;
use Friendica\Module\BaseApi;
use Friendica\Model\Contact;
use Friendica\Module\Api\ApiResponse;
use Psr\Log\LoggerInterface;
/**
- * Returns all groups the user owns.
+ * Returns all circles the user owns.
*
* @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships
*/
class Ownership extends BaseApi
{
- /** @var friendicaGroup */
- private $friendicaGroup;
+ /** @var FriendicaCircle */
+ private $friendicaCircle;
/** @var Database */
private $dba;
- public function __construct(Database $dba, FriendicaGroup $friendicaGroup, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, array $server, array $parameters = [])
+ public function __construct(Database $dba, FriendicaCircle $friendicaCircle, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, array $server, array $parameters = [])
{
parent::__construct($app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->dba = $dba;
- $this->friendicaGroup = $friendicaGroup;
+ $this->dba = $dba;
+ $this->friendicaCircle = $friendicaCircle;
}
protected function rawContent(array $request = [])
{
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
$uid = BaseApi::getCurrentUserID();
- $groups = $this->dba->select('group', [], ['deleted' => false, 'uid' => $uid, 'cid' => null]);
+ $circles = $this->dba->select('group', [], ['deleted' => false, 'uid' => $uid, 'cid' => null]);
- // loop through all groups
+ // loop through all circles
$lists = [];
- foreach ($groups as $group) {
- $lists[] = $this->friendicaGroup->createFromId($group['id']);
+ foreach ($circles as $circle) {
+ $lists[] = $this->friendicaCircle->createFromId($circle['id']);
}
$this->response->exit('statuses', ['lists' => ['lists' => $lists]], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
use Psr\Log\LoggerInterface;
/**
- * Returns recent statuses from users in the specified group.
+ * Returns recent statuses from users in the specified circle.
*
* @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships
*/
$start = max(0, ($page - 1) * $count);
- $groups = $this->dba->selectToArray('group_member', ['contact-id'], ['gid' => $request['list_id']]);
- $gids = array_column($groups, 'contact-id');
- $condition = ['uid' => $uid, 'gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT], 'contact-id' => $gids];
+ $members = $this->dba->selectToArray('group_member', ['contact-id'], ['gid' => $request['list_id']]);
+ $cids = array_column($members, 'contact-id');
+ $condition = ['uid' => $uid, 'gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT], 'contact-id' => $cids];
$condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $since_id]);
if ($max_id > 0) {
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\Database;
-use Friendica\Factory\Api\Friendica\Group as FriendicaGroup;
+use Friendica\Factory\Api\Friendica\Circle as FriendicaCircle;
use Friendica\Module\BaseApi;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Module\Api\ApiResponse;
use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
- * Update information about a group.
+ * Update information about a circle.
*
* @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update
*/
class Update extends BaseApi
{
- /** @var friendicaGroup */
- private $friendicaGroup;
+ /** @var FriendicaCircle */
+ private $friendicaCircle;
/** @var Database */
private $dba;
- public function __construct(Database $dba, FriendicaGroup $friendicaGroup, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, array $server, array $parameters = [])
+ public function __construct(Database $dba, FriendicaCircle $friendicaCircle, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, array $server, array $parameters = [])
{
parent::__construct($app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->dba = $dba;
- $this->friendicaGroup = $friendicaGroup;
+ $this->dba = $dba;
+ $this->friendicaCircle = $friendicaCircle;
}
protected function rawContent(array $request = [])
throw new HTTPException\BadRequestException('gid not specified');
}
- // get data of the specified group id
- $group = $this->dba->selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
+ // get data of the specified circle id
+ $circle = $this->dba->selectFirst('group', [], ['uid' => $uid, 'id' => $gid]);
// error message if specified gid is not in database
- if (!$group) {
+ if (!$circle) {
throw new HTTPException\BadRequestException('gid not available');
}
- if (Group::update($gid, $name)) {
- $list = $this->friendicaGroup->createFromId($gid);
+ if (Circle::update($gid, $name)) {
+ $list = $this->friendicaCircle->createFromId($gid);
$this->response->exit('statuses', ['lists' => ['lists' => $list]], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
'source' => '',
'include_entities' => false,
'contact_allow' => $owner['allow_cid'],
- 'group_allow' => $owner['allow_gid'],
+ 'circle_allow' => $owner['allow_gid'],
'contact_deny' => $owner['deny_cid'],
- 'group_deny' => $owner['deny_gid'],
+ 'circle_deny' => $owner['deny_gid'],
], $request);
if (!empty($request['htmlstatus'])) {
$aclFormatter = DI::aclFormatter();
$item['allow_cid'] = $aclFormatter->toString($request['contact_allow']);
- $item['allow_gid'] = $aclFormatter->toString($request['group_allow']);
+ $item['allow_gid'] = $aclFormatter->toString($request['circle_allow']);
$item['deny_cid'] = $aclFormatter->toString($request['contact_deny']);
- $item['deny_gid'] = $aclFormatter->toString($request['group_deny']);
+ $item['deny_gid'] = $aclFormatter->toString($request['circle_deny']);
if (!empty($item['allow_cid'] . $item['allow_gid'] . $item['deny_cid'] . $item['deny_gid'])) {
$item['private'] = Item::PRIVATE;
}
$strAclContactAllow = isset($request['contact_allow']) ? $aclFormatter->toString($request['contact_allow']) : $user['allow_cid'] ?? '';
- $strAclGroupAllow = isset($request['group_allow']) ? $aclFormatter->toString($request['group_allow']) : $user['allow_gid'] ?? '';
- $strContactDeny = isset($request['contact_deny']) ? $aclFormatter->toString($request['contact_deny']) : $user['deny_cid'] ?? '';
- $strGroupDeny = isset($request['group_deny']) ? $aclFormatter->toString($request['group_deny']) : $user['deny_gid'] ?? '';
+ $strAclCircleAllow = isset($request['circle_allow']) ? $aclFormatter->toString($request['circle_allow']) : $user['allow_gid'] ?? '';
+ $strContactDeny = isset($request['contact_deny']) ? $aclFormatter->toString($request['contact_deny']) : $user['deny_cid'] ?? '';
+ $strCircleDeny = isset($request['circle_deny']) ? $aclFormatter->toString($request['circle_deny']) : $user['deny_gid'] ?? '';
$visibility = $request['visibility'] ?? '';
if ($visibility === 'public') {
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
- $strAclContactAllow = $strAclGroupAllow = $strContactDeny = $strGroupDeny = '';
+ $strAclContactAllow = $strAclCircleAllow = $strContactDeny = $strCircleDeny = '';
} elseif ($visibility === 'custom') {
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
// case that would make it public. So we always append the author's contact id to the allowed contacts.
}
} else {
$strAclContactAllow = $aclFormatter->toString($self);
- $strAclGroupAllow = '';
+ $strAclCircleAllow = '';
$strContactDeny = '';
- $strGroupDeny = '';
+ $strCircleDeny = '';
}
$datarray = [
'uid' => $uid,
'cid' => $cid,
'allow_cid' => $strAclContactAllow,
- 'allow_gid' => $strAclGroupAllow,
+ 'allow_gid' => $strAclCircleAllow,
'deny_cid' => $strContactDeny,
- 'deny_gid' => $strGroupDeny,
+ 'deny_gid' => $strCircleDeny,
'id' => $eventId,
];
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Module;
+
+use Friendica\BaseModule;
+use Friendica\Core\Renderer;
+use Friendica\Core\System;
+use Friendica\Database\DBA;
+use Friendica\DI;
+use Friendica\Model;
+
+class Circle extends BaseModule
+{
+ protected function post(array $request = [])
+ {
+ if (DI::mode()->isAjax()) {
+ $this->ajaxPost();
+ }
+
+ if (!DI::userSession()->getLocalUserId()) {
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
+ DI::baseUrl()->redirect();
+ }
+
+ // @TODO: Replace with parameter from router
+ if ((DI::args()->getArgc() == 2) && (DI::args()->getArgv()[1] === 'new')) {
+ BaseModule::checkFormSecurityTokenRedirectOnError('/circle/new', 'circle_edit');
+
+ $name = trim($request['circle_name']);
+ $r = Model\Circle::create(DI::userSession()->getLocalUserId(), $name);
+ if ($r) {
+ $r = Model\Circle::getIdByName(DI::userSession()->getLocalUserId(), $name);
+ if ($r) {
+ DI::baseUrl()->redirect('circle/' . $r);
+ }
+ } else {
+ DI::sysmsg()->addNotice(DI::l10n()->t('Could not create circle.'));
+ }
+ DI::baseUrl()->redirect('circle');
+ }
+
+ // @TODO: Replace with parameter from router
+ if ((DI::args()->getArgc() == 2) && intval(DI::args()->getArgv()[1])) {
+ BaseModule::checkFormSecurityTokenRedirectOnError('/circle', 'circle_edit');
+
+ $circle = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => DI::userSession()->getLocalUserId()]);
+ if (!DBA::isResult($circle)) {
+ DI::sysmsg()->addNotice(DI::l10n()->t('Circle not found.'));
+ DI::baseUrl()->redirect('contact');
+ }
+ $circlename = trim($_POST['circle_name']);
+ if (strlen($circlename) && ($circlename != $circle['name'])) {
+ if (!Model\Circle::update($circle['id'], $circlename)) {
+ DI::sysmsg()->addNotice(DI::l10n()->t('Circle name was not changed.'));
+ }
+ }
+ }
+ }
+
+ public function ajaxPost()
+ {
+ try {
+ if (!DI::userSession()->getLocalUserId()) {
+ throw new \Exception(DI::l10n()->t('Permission denied.'), 403);
+ }
+
+ if (isset($this->parameters['command'])) {
+ $circle_id = $this->parameters['circle'];
+ $contact_id = $this->parameters['contact'];
+
+ if (!Model\Circle::exists($circle_id, DI::userSession()->getLocalUserId())) {
+ throw new \Exception(DI::l10n()->t('Unknown circle.'), 404);
+ }
+
+ // @TODO Backward compatibility with user contacts, remove by version 2022.03
+ $cdata = Model\Contact::getPublicAndUserContactID($contact_id, DI::userSession()->getLocalUserId());
+ if (empty($cdata['public'])) {
+ throw new \Exception(DI::l10n()->t('Contact not found.'), 404);
+ }
+
+ if (empty($cdata['user'])) {
+ throw new \Exception(DI::l10n()->t('Invalid contact.'), 404);
+ }
+
+ $contact = Model\Contact::getById($cdata['user'], ['deleted']);
+ if (!DBA::isResult($contact)) {
+ throw new \Exception(DI::l10n()->t('Contact not found.'), 404);
+ }
+
+ if ($contact['deleted']) {
+ throw new \Exception(DI::l10n()->t('Contact is deleted.'), 410);
+ }
+
+ switch($this->parameters['command']) {
+ case 'add':
+ if (!Model\Circle::addMember($circle_id, $cdata['user'])) {
+ throw new \Exception(DI::l10n()->t('Unable to add the contact to the circle.'), 500);
+ }
+
+ $message = DI::l10n()->t('Contact successfully added to circle.');
+ break;
+ case 'remove':
+ if (!Model\Circle::removeMember($circle_id, $cdata['user'])) {
+ throw new \Exception(DI::l10n()->t('Unable to remove the contact from the circle.'), 500);
+ }
+
+ $message = DI::l10n()->t('Contact successfully removed from circle.');
+ break;
+ }
+ } else {
+ throw new \Exception(DI::l10n()->t('Bad request.'), 400);
+ }
+
+ DI::sysmsg()->addInfo($message);
+ System::jsonExit(['status' => 'OK', 'message' => $message]);
+ } catch (\Exception $e) {
+ DI::sysmsg()->addNotice($e->getMessage());
+ System::jsonError($e->getCode(), ['status' => 'error', 'message' => $e->getMessage()]);
+ }
+ }
+
+ protected function content(array $request = []): string
+ {
+ $change = false;
+
+ if (!DI::userSession()->getLocalUserId()) {
+ throw new \Friendica\Network\HTTPException\ForbiddenException();
+ }
+
+ $a = DI::app();
+
+ DI::page()['aside'] = Model\Circle::sidebarWidget('contact', 'circle', 'extended', ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : 'everyone'));
+
+ // With no circle number provided we jump to the unassigned contacts as a starting point
+ // @TODO: Replace with parameter from router
+ if (DI::args()->getArgc() == 1) {
+ DI::baseUrl()->redirect('circle/none');
+ }
+
+ // Switch to text mode interface if we have more than 'n' contacts or circle members
+ $switchtotext = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'circle_edit_image_limit') ??
+ DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'groupedit_image_limit');
+ if (is_null($switchtotext)) {
+ $switchtotext = DI::config()->get('system', 'groupedit_image_limit') ??
+ DI::config()->get('system', 'circle_edit_image_limit');
+ }
+
+ $tpl = Renderer::getMarkupTemplate('circle_edit.tpl');
+
+
+ $context = [
+ '$submit' => DI::l10n()->t('Save Circle'),
+ '$submit_filter' => DI::l10n()->t('Filter'),
+ ];
+
+ // @TODO: Replace with parameter from router
+ if ((DI::args()->getArgc() == 2) && (DI::args()->getArgv()[1] === 'new')) {
+ return Renderer::replaceMacros($tpl, $context + [
+ '$title' => DI::l10n()->t('Create a circle of contacts/friends.'),
+ '$gname' => ['circle_name', DI::l10n()->t('Circle Name: '), '', ''],
+ '$gid' => 'new',
+ '$form_security_token' => BaseModule::getFormSecurityToken('circle_edit'),
+ ]);
+ }
+
+ $nocircle = false;
+
+ // @TODO: Replace with parameter from router
+ if ((DI::args()->getArgc() == 2) && (DI::args()->getArgv()[1] === 'none') ||
+ (DI::args()->getArgc() == 1) && (DI::args()->getArgv()[0] === 'nocircle')) {
+ $id = -1;
+ $nocircle = true;
+ $circle = [
+ 'id' => $id,
+ 'name' => DI::l10n()->t('Contacts not in any circle'),
+ ];
+
+ $members = [];
+ $preselected = [];
+
+ $context = $context + [
+ '$title' => $circle['name'],
+ '$gname' => ['circle_name', DI::l10n()->t('Circle Name: '), $circle['name'], ''],
+ '$gid' => $id,
+ '$editable' => 0,
+ ];
+ }
+
+ // @TODO: Replace with parameter from router
+ if ((DI::args()->getArgc() == 3) && (DI::args()->getArgv()[1] === 'drop')) {
+ BaseModule::checkFormSecurityTokenRedirectOnError('/circle', 'circle_drop', 't');
+
+ // @TODO: Replace with parameter from router
+ if (intval(DI::args()->getArgv()[2])) {
+ if (!Model\Circle::exists(DI::args()->getArgv()[2], DI::userSession()->getLocalUserId())) {
+ DI::sysmsg()->addNotice(DI::l10n()->t('Circle not found.'));
+ DI::baseUrl()->redirect('contact');
+ }
+
+ if (!Model\Circle::remove(DI::args()->getArgv()[2])) {
+ DI::sysmsg()->addNotice(DI::l10n()->t('Unable to remove circle.'));
+ }
+ }
+ DI::baseUrl()->redirect('circle');
+ }
+
+ // @TODO: Replace with parameter from router
+ if ((DI::args()->getArgc() > 2) && intval(DI::args()->getArgv()[1]) && intval(DI::args()->getArgv()[2])) {
+ BaseModule::checkFormSecurityTokenForbiddenOnError('circle_member_change', 't');
+
+ if (DBA::exists('contact', ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId(), 'self' => false, 'pending' => false, 'blocked' => false])) {
+ $change = intval(DI::args()->getArgv()[2]);
+ }
+ }
+
+ // @TODO: Replace with parameter from router
+ if ((DI::args()->getArgc() > 1) && intval(DI::args()->getArgv()[1])) {
+ $circle = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => DI::userSession()->getLocalUserId(), 'deleted' => false]);
+ if (!DBA::isResult($circle)) {
+ DI::sysmsg()->addNotice(DI::l10n()->t('Circle not found.'));
+ DI::baseUrl()->redirect('contact');
+ }
+
+ $members = Model\Contact\Circle::getById($circle['id']);
+ $preselected = [];
+
+ if (count($members)) {
+ foreach ($members as $member) {
+ $preselected[] = $member['id'];
+ }
+ }
+
+ if ($change) {
+ if (in_array($change, $preselected)) {
+ Model\Circle::removeMember($circle['id'], $change);
+ } else {
+ Model\Circle::addMember($circle['id'], $change);
+ }
+
+ $members = Model\Contact\Circle::getById($circle['id']);
+ $preselected = [];
+ if (count($members)) {
+ foreach ($members as $member) {
+ $preselected[] = $member['id'];
+ }
+ }
+ }
+
+ $drop_tpl = Renderer::getMarkupTemplate('circle_drop.tpl');
+ $drop_txt = Renderer::replaceMacros($drop_tpl, [
+ '$id' => $circle['id'],
+ '$delete' => DI::l10n()->t('Delete Circle'),
+ '$form_security_token' => BaseModule::getFormSecurityToken('circle_drop'),
+ ]);
+
+ $context = $context + [
+ '$title' => $circle['name'],
+ '$gname' => ['circle_name', DI::l10n()->t('Circle Name: '), $circle['name'], ''],
+ '$gid' => $circle['id'],
+ '$drop' => $drop_txt,
+ '$form_security_token' => BaseModule::getFormSecurityToken('circle_edit'),
+ '$edit_name' => DI::l10n()->t('Edit Circle Name'),
+ '$editable' => 1,
+ ];
+ }
+
+ if (!isset($circle)) {
+ throw new \Friendica\Network\HTTPException\BadRequestException();
+ }
+
+ $circle_editor = [
+ 'label_members' => DI::l10n()->t('Members'),
+ 'members' => [],
+ 'label_contacts' => DI::l10n()->t('All Contacts'),
+ 'circle_is_empty' => DI::l10n()->t('Circle is empty'),
+ 'contacts' => [],
+ ];
+
+ $sec_token = addslashes(BaseModule::getFormSecurityToken('circle_member_change'));
+
+ // Format the data of the circle members
+ foreach ($members as $member) {
+ if ($member['url']) {
+ $entry = Contact::getContactTemplateVars($member);
+ $entry['label'] = 'members';
+ $entry['photo_menu'] = '';
+ $entry['change_member'] = [
+ 'title' => DI::l10n()->t('Remove contact from circle'),
+ 'gid' => $circle['id'],
+ 'cid' => $member['id'],
+ 'sec_token' => $sec_token
+ ];
+
+ $circle_editor['members'][] = $entry;
+ } else {
+ Model\Circle::removeMember($circle['id'], $member['id']);
+ }
+ }
+
+ if ($nocircle) {
+ $contacts = Model\Contact\Circle::listUncircled(DI::userSession()->getLocalUserId());
+ } else {
+ $contacts_stmt = DBA::select('contact', [],
+ ['rel' => [Model\Contact::FOLLOWER, Model\Contact::FRIEND, Model\Contact::SHARING],
+ 'uid' => DI::userSession()->getLocalUserId(), 'pending' => false, 'blocked' => false, 'failed' => false, 'self' => false],
+ ['order' => ['name']]
+ );
+ $contacts = DBA::toArray($contacts_stmt);
+ $context['$desc'] = DI::l10n()->t('Click on a contact to add or remove.');
+ }
+
+ if (DBA::isResult($contacts)) {
+ // Format the data of the contacts who aren't in the contact circle
+ foreach ($contacts as $member) {
+ if (!in_array($member['id'], $preselected)) {
+ $entry = Contact::getContactTemplateVars($member);
+ $entry['label'] = 'contacts';
+ if (!$nocircle)
+ $entry['photo_menu'] = [];
+
+ if (!$nocircle) {
+ $entry['change_member'] = [
+ 'title' => DI::l10n()->t('Add contact to circle'),
+ 'gid' => $circle['id'],
+ 'cid' => $member['id'],
+ 'sec_token' => $sec_token
+ ];
+ }
+
+ $circle_editor['contacts'][] = $entry;
+ }
+ }
+ }
+
+ $context['$circle_editor'] = $circle_editor;
+
+ // If there are to many contacts we could provide an alternative view mode
+ $total = count($circle_editor['members']) + count($circle_editor['contacts']);
+ $context['$shortmode'] = (($switchtotext && ($total > $switchtotext)) ? true : false);
+
+ if ($change) {
+ $tpl = Renderer::getMarkupTemplate('circle_editor.tpl');
+ echo Renderer::replaceMacros($tpl, $context);
+ System::exit();
+ }
+
+ return Renderer::replaceMacros($tpl, $context);
+ }
+}
$search = trim($_GET['search'] ?? '');
$nets = trim($_GET['nets'] ?? '');
$rel = trim($_GET['rel'] ?? '');
- $group = trim($_GET['group'] ?? '');
+ $circle = trim($_GET['circle'] ?? '');
$accounttype = $_GET['accounttype'] ?? '';
$accounttypeid = User::getAccountTypeByString($accounttype);
$follow_widget = Widget::follow();
}
- $account_widget = Widget::accountTypes($_SERVER['REQUEST_URI'], $accounttype);
+ $account_widget = Widget::accountTypes($_SERVER['REQUEST_URI'], $accounttype);
$networks_widget = Widget::networks($_SERVER['REQUEST_URI'], $nets);
- $rel_widget = Widget::contactRels($_SERVER['REQUEST_URI'], $rel);
- $groups_widget = Widget::groups($_SERVER['REQUEST_URI'], $group);
+ $rel_widget = Widget::contactRels($_SERVER['REQUEST_URI'], $rel);
+ $circles_widget = Widget::circles($_SERVER['REQUEST_URI'], $circle);
- DI::page()['aside'] .= $vcard_widget . $findpeople_widget . $follow_widget . $rel_widget . $groups_widget . $networks_widget . $account_widget;
+ DI::page()['aside'] .= $vcard_widget . $findpeople_widget . $follow_widget . $rel_widget . $circles_widget . $networks_widget . $account_widget;
$tpl = Renderer::getMarkupTemplate('contacts-head.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
break;
}
- if ($group) {
+ if ($circle) {
$sql_extra .= " AND `id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)";
- $sql_values[] = $group;
+ $sql_values[] = $circle;
}
$networks = Widget::unavailableNetworks();
'accesskey' => 'h',
],
[
- 'label' => DI::l10n()->t('Groups'),
- 'url' => 'group',
+ 'label' => DI::l10n()->t('Circles'),
+ 'url' => 'circle',
'sel' => '',
- 'title' => DI::l10n()->t('Organize your contact groups'),
- 'id' => 'contactgroups-tab',
+ 'title' => DI::l10n()->t('Organize your contact circles'),
+ 'id' => 'contactcircles-tab',
'accesskey' => 'e',
],
];
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Module;
use Friendica\Module\Response;
use Friendica\Network\HTTPException;
}
$vcard_widget = Widget\VCard::getHTML($contact);
- $groups_widget = '';
+ $circles_widget = '';
if (!in_array($localRelationship->rel, [Contact::NOTHING, Contact::SELF])) {
- $groups_widget = Group::sidebarWidget('contact', 'group', 'full', 'everyone', $data['user']);
+ $circles_widget = Circle::sidebarWidget('contact', 'circle', 'full', 'everyone', $data['user']);
}
- $this->page['aside'] .= $vcard_widget . $groups_widget;
+ $this->page['aside'] .= $vcard_widget . $circles_widget;
$o = '';
Nav::setSelected('contact');
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\Profile;
class Network extends BaseModule
{
/** @var int */
- private static $groupId;
+ private static $circleId;
/** @var int */
private static $forumContactId;
/** @var string */
$module = 'network';
DI::page()['aside'] .= Widget::accountTypes($module, self::$accountTypeString);
- DI::page()['aside'] .= Group::sidebarWidget($module, $module . '/group', 'standard', self::$groupId);
+ DI::page()['aside'] .= Circle::sidebarWidget($module, $module . '/circle', 'standard', self::$circleId);
DI::page()['aside'] .= ForumManager::widget($module . '/forum', DI::userSession()->getLocalUserId(), self::$forumContactId);
DI::page()['aside'] .= Widget::postedByYear($module . '/archive', DI::userSession()->getLocalUserId(), false);
DI::page()['aside'] .= Widget::networks($module, !self::$forumContactId ? self::$network : '');
$a = DI::app();
$default_permissions = [];
- if (self::$groupId) {
- $default_permissions['allow_gid'] = [self::$groupId];
+ if (self::$circleId) {
+ $default_permissions['allow_gid'] = [self::$circleId];
}
$allowedCids = [];
}
$x = [
- 'lockstate' => self::$groupId || self::$forumContactId || self::$network || ACL::getLockstateForUserId($a->getLoggedInUserId()) ? 'lock' : 'unlock',
+ 'lockstate' => self::$circleId || self::$forumContactId || self::$network || ACL::getLockstateForUserId($a->getLoggedInUserId()) ? 'lock' : 'unlock',
'acl' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), true, $default_permissions),
- 'bang' => ((self::$groupId || self::$forumContactId || self::$network) ? '!' : ''),
+ 'bang' => ((self::$circleId || self::$forumContactId || self::$network) ? '!' : ''),
'content' => $content,
];
$o .= DI::conversation()->statusEditor($x);
}
- if (self::$groupId) {
- $group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => DI::userSession()->getLocalUserId()]);
- if (!DBA::isResult($group)) {
- DI::sysmsg()->addNotice(DI::l10n()->t('No such group'));
+ if (self::$circleId) {
+ $circle = DBA::selectFirst('group', ['name'], ['id' => self::$circleId, 'uid' => DI::userSession()->getLocalUserId()]);
+ if (!DBA::isResult($circle)) {
+ DI::sysmsg()->addNotice(DI::l10n()->t('No such circle'));
}
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
- '$title' => DI::l10n()->t('Group: %s', $group['name'])
+ '$title' => DI::l10n()->t('Circle: %s', $circle['name'])
]) . $o;
} elseif (self::$forumContactId) {
$contact = Contact::getById(self::$forumContactId);
protected function parseRequest(array $get)
{
- self::$groupId = $this->parameters['group_id'] ?? 0;
+ self::$circleId = $this->parameters['circle_id'] ?? 0;
self::$forumContactId = $this->parameters['contact_id'] ?? 0;
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` >= ? ", DateTimeFormat::convert(self::$dateTo, 'UTC', DI::app()->getTimeZone())]);
}
- if (self::$groupId) {
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)", self::$groupId]);
+ if (self::$circleId) {
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)", self::$circleId]);
} elseif (self::$forumContactId) {
$conditionStrings = DBA::mergeConditions($conditionStrings,
["((`contact-id` = ?) OR `uri-id` IN (SELECT `parent-uri-id` FROM `post-user-view` WHERE (`contact-id` = ? AND `gravity` = ? AND `vid` = ? AND `uid` = ?)))",
$parents = [];
}
- // We aren't going to try and figure out at the item, group, and page
+ // We aren't going to try and figure out at the item, circle, and page
// level which items you've seen and which you haven't. If you're looking
// at the top level network page just mark everything seen.
- if (!self::$groupId && !self::$forumContactId && !self::$star && !self::$mention) {
+ if (!self::$circleId && !self::$forumContactId && !self::$star && !self::$mention) {
$condition = ['unseen' => true, 'uid' => DI::userSession()->getLocalUserId()];
self::setItemsSeenByCondition($condition);
} elseif (!empty($parents)) {
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Module;
-
-use Friendica\BaseModule;
-use Friendica\Core\Renderer;
-use Friendica\Core\System;
-use Friendica\Database\DBA;
-use Friendica\DI;
-use Friendica\Model;
-
-class Group extends BaseModule
-{
- protected function post(array $request = [])
- {
- if (DI::mode()->isAjax()) {
- $this->ajaxPost();
- }
-
- if (!DI::userSession()->getLocalUserId()) {
- DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
- DI::baseUrl()->redirect();
- }
-
- // @TODO: Replace with parameter from router
- if ((DI::args()->getArgc() == 2) && (DI::args()->getArgv()[1] === 'new')) {
- BaseModule::checkFormSecurityTokenRedirectOnError('/group/new', 'group_edit');
-
- $name = trim($request['groupname']);
- $r = Model\Group::create(DI::userSession()->getLocalUserId(), $name);
- if ($r) {
- $r = Model\Group::getIdByName(DI::userSession()->getLocalUserId(), $name);
- if ($r) {
- DI::baseUrl()->redirect('group/' . $r);
- }
- } else {
- DI::sysmsg()->addNotice(DI::l10n()->t('Could not create group.'));
- }
- DI::baseUrl()->redirect('group');
- }
-
- // @TODO: Replace with parameter from router
- if ((DI::args()->getArgc() == 2) && intval(DI::args()->getArgv()[1])) {
- BaseModule::checkFormSecurityTokenRedirectOnError('/group', 'group_edit');
-
- $group = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => DI::userSession()->getLocalUserId()]);
- if (!DBA::isResult($group)) {
- DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
- DI::baseUrl()->redirect('contact');
- }
- $groupname = trim($_POST['groupname']);
- if (strlen($groupname) && ($groupname != $group['name'])) {
- if (!Model\Group::update($group['id'], $groupname)) {
- DI::sysmsg()->addNotice(DI::l10n()->t('Group name was not changed.'));
- }
- }
- }
- }
-
- public function ajaxPost()
- {
- try {
- if (!DI::userSession()->getLocalUserId()) {
- throw new \Exception(DI::l10n()->t('Permission denied.'), 403);
- }
-
- if (isset($this->parameters['command'])) {
- $group_id = $this->parameters['group'];
- $contact_id = $this->parameters['contact'];
-
- if (!Model\Group::exists($group_id, DI::userSession()->getLocalUserId())) {
- throw new \Exception(DI::l10n()->t('Unknown group.'), 404);
- }
-
- // @TODO Backward compatibility with user contacts, remove by version 2022.03
- $cdata = Model\Contact::getPublicAndUserContactID($contact_id, DI::userSession()->getLocalUserId());
- if (empty($cdata['public'])) {
- throw new \Exception(DI::l10n()->t('Contact not found.'), 404);
- }
-
- if (empty($cdata['user'])) {
- throw new \Exception(DI::l10n()->t('Invalid contact.'), 404);
- }
-
- $contact = Model\Contact::getById($cdata['user'], ['deleted']);
- if (!DBA::isResult($contact)) {
- throw new \Exception(DI::l10n()->t('Contact not found.'), 404);
- }
-
- if ($contact['deleted']) {
- throw new \Exception(DI::l10n()->t('Contact is deleted.'), 410);
- }
-
- switch($this->parameters['command']) {
- case 'add':
- if (!Model\Group::addMember($group_id, $cdata['user'])) {
- throw new \Exception(DI::l10n()->t('Unable to add the contact to the group.'), 500);
- }
-
- $message = DI::l10n()->t('Contact successfully added to group.');
- break;
- case 'remove':
- if (!Model\Group::removeMember($group_id, $cdata['user'])) {
- throw new \Exception(DI::l10n()->t('Unable to remove the contact from the group.'), 500);
- }
-
- $message = DI::l10n()->t('Contact successfully removed from group.');
- break;
- }
- } else {
- throw new \Exception(DI::l10n()->t('Bad request.'), 400);
- }
-
- DI::sysmsg()->addInfo($message);
- System::jsonExit(['status' => 'OK', 'message' => $message]);
- } catch (\Exception $e) {
- DI::sysmsg()->addNotice($e->getMessage());
- System::jsonError($e->getCode(), ['status' => 'error', 'message' => $e->getMessage()]);
- }
- }
-
- protected function content(array $request = []): string
- {
- $change = false;
-
- if (!DI::userSession()->getLocalUserId()) {
- throw new \Friendica\Network\HTTPException\ForbiddenException();
- }
-
- $a = DI::app();
-
- DI::page()['aside'] = Model\Group::sidebarWidget('contact', 'group', 'extended', ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : 'everyone'));
-
- // With no group number provided we jump to the unassigned contacts as a starting point
- // @TODO: Replace with parameter from router
- if (DI::args()->getArgc() == 1) {
- DI::baseUrl()->redirect('group/none');
- }
-
- // Switch to text mode interface if we have more than 'n' contacts or group members
- $switchtotext = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'groupedit_image_limit');
- if (is_null($switchtotext)) {
- $switchtotext = DI::config()->get('system', 'groupedit_image_limit', 200);
- }
-
- $tpl = Renderer::getMarkupTemplate('group_edit.tpl');
-
-
- $context = [
- '$submit' => DI::l10n()->t('Save Group'),
- '$submit_filter' => DI::l10n()->t('Filter'),
- ];
-
- // @TODO: Replace with parameter from router
- if ((DI::args()->getArgc() == 2) && (DI::args()->getArgv()[1] === 'new')) {
- return Renderer::replaceMacros($tpl, $context + [
- '$title' => DI::l10n()->t('Create a group of contacts/friends.'),
- '$gname' => ['groupname', DI::l10n()->t('Group Name: '), '', ''],
- '$gid' => 'new',
- '$form_security_token' => BaseModule::getFormSecurityToken("group_edit"),
- ]);
- }
-
- $nogroup = false;
-
- // @TODO: Replace with parameter from router
- if ((DI::args()->getArgc() == 2) && (DI::args()->getArgv()[1] === 'none') ||
- (DI::args()->getArgc() == 1) && (DI::args()->getArgv()[0] === 'nogroup')) {
- $id = -1;
- $nogroup = true;
- $group = [
- 'id' => $id,
- 'name' => DI::l10n()->t('Contacts not in any group'),
- ];
-
- $members = [];
- $preselected = [];
-
- $context = $context + [
- '$title' => $group['name'],
- '$gname' => ['groupname', DI::l10n()->t('Group Name: '), $group['name'], ''],
- '$gid' => $id,
- '$editable' => 0,
- ];
- }
-
- // @TODO: Replace with parameter from router
- if ((DI::args()->getArgc() == 3) && (DI::args()->getArgv()[1] === 'drop')) {
- BaseModule::checkFormSecurityTokenRedirectOnError('/group', 'group_drop', 't');
-
- // @TODO: Replace with parameter from router
- if (intval(DI::args()->getArgv()[2])) {
- if (!Model\Group::exists(DI::args()->getArgv()[2], DI::userSession()->getLocalUserId())) {
- DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
- DI::baseUrl()->redirect('contact');
- }
-
- if (!Model\Group::remove(DI::args()->getArgv()[2])) {
- DI::sysmsg()->addNotice(DI::l10n()->t('Unable to remove group.'));
- }
- }
- DI::baseUrl()->redirect('group');
- }
-
- // @TODO: Replace with parameter from router
- if ((DI::args()->getArgc() > 2) && intval(DI::args()->getArgv()[1]) && intval(DI::args()->getArgv()[2])) {
- BaseModule::checkFormSecurityTokenForbiddenOnError('group_member_change', 't');
-
- if (DBA::exists('contact', ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId(), 'self' => false, 'pending' => false, 'blocked' => false])) {
- $change = intval(DI::args()->getArgv()[2]);
- }
- }
-
- // @TODO: Replace with parameter from router
- if ((DI::args()->getArgc() > 1) && intval(DI::args()->getArgv()[1])) {
- $group = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => DI::userSession()->getLocalUserId(), 'deleted' => false]);
- if (!DBA::isResult($group)) {
- DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
- DI::baseUrl()->redirect('contact');
- }
-
- $members = Model\Contact\Group::getById($group['id']);
- $preselected = [];
-
- if (count($members)) {
- foreach ($members as $member) {
- $preselected[] = $member['id'];
- }
- }
-
- if ($change) {
- if (in_array($change, $preselected)) {
- Model\Group::removeMember($group['id'], $change);
- } else {
- Model\Group::addMember($group['id'], $change);
- }
-
- $members = Model\Contact\Group::getById($group['id']);
- $preselected = [];
- if (count($members)) {
- foreach ($members as $member) {
- $preselected[] = $member['id'];
- }
- }
- }
-
- $drop_tpl = Renderer::getMarkupTemplate('group_drop.tpl');
- $drop_txt = Renderer::replaceMacros($drop_tpl, [
- '$id' => $group['id'],
- '$delete' => DI::l10n()->t('Delete Group'),
- '$form_security_token' => BaseModule::getFormSecurityToken("group_drop"),
- ]);
-
- $context = $context + [
- '$title' => $group['name'],
- '$gname' => ['groupname', DI::l10n()->t('Group Name: '), $group['name'], ''],
- '$gid' => $group['id'],
- '$drop' => $drop_txt,
- '$form_security_token' => BaseModule::getFormSecurityToken('group_edit'),
- '$edit_name' => DI::l10n()->t('Edit Group Name'),
- '$editable' => 1,
- ];
- }
-
- if (!isset($group)) {
- throw new \Friendica\Network\HTTPException\BadRequestException();
- }
-
- $groupeditor = [
- 'label_members' => DI::l10n()->t('Members'),
- 'members' => [],
- 'label_contacts' => DI::l10n()->t('All Contacts'),
- 'group_is_empty' => DI::l10n()->t('Group is empty'),
- 'contacts' => [],
- ];
-
- $sec_token = addslashes(BaseModule::getFormSecurityToken('group_member_change'));
-
- // Format the data of the group members
- foreach ($members as $member) {
- if ($member['url']) {
- $entry = Contact::getContactTemplateVars($member);
- $entry['label'] = 'members';
- $entry['photo_menu'] = '';
- $entry['change_member'] = [
- 'title' => DI::l10n()->t("Remove contact from group"),
- 'gid' => $group['id'],
- 'cid' => $member['id'],
- 'sec_token' => $sec_token
- ];
-
- $groupeditor['members'][] = $entry;
- } else {
- Model\Group::removeMember($group['id'], $member['id']);
- }
- }
-
- if ($nogroup) {
- $contacts = Model\Contact\Group::listUngrouped(DI::userSession()->getLocalUserId());
- } else {
- $contacts_stmt = DBA::select('contact', [],
- ['rel' => [Model\Contact::FOLLOWER, Model\Contact::FRIEND, Model\Contact::SHARING],
- 'uid' => DI::userSession()->getLocalUserId(), 'pending' => false, 'blocked' => false, 'failed' => false, 'self' => false],
- ['order' => ['name']]
- );
- $contacts = DBA::toArray($contacts_stmt);
- $context['$desc'] = DI::l10n()->t('Click on a contact to add or remove.');
- }
-
- if (DBA::isResult($contacts)) {
- // Format the data of the contacts who aren't in the contact group
- foreach ($contacts as $member) {
- if (!in_array($member['id'], $preselected)) {
- $entry = Contact::getContactTemplateVars($member);
- $entry['label'] = 'contacts';
- if (!$nogroup)
- $entry['photo_menu'] = [];
-
- if (!$nogroup) {
- $entry['change_member'] = [
- 'title' => DI::l10n()->t("Add contact to group"),
- 'gid' => $group['id'],
- 'cid' => $member['id'],
- 'sec_token' => $sec_token
- ];
- }
-
- $groupeditor['contacts'][] = $entry;
- }
- }
- }
-
- $context['$groupeditor'] = $groupeditor;
-
- // If there are to many contacts we could provide an alternative view mode
- $total = count($groupeditor['members']) + count($groupeditor['contacts']);
- $context['$shortmode'] = (($switchtotext && ($total > $switchtotext)) ? true : false);
-
- if ($change) {
- $tpl = Renderer::getMarkupTemplate('groupeditor.tpl');
- echo Renderer::replaceMacros($tpl, $context);
- System::exit();
- }
-
- return Renderer::replaceMacros($tpl, $context);
- }
-}
\ No newline at end of file
$user = User::getById(DI::userSession()->getLocalUserId(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'default-location']);
$contact_allow_list = $this->ACLFormatter->expand($user['allow_cid']);
- $group_allow_list = $this->ACLFormatter->expand($user['allow_gid']);
+ $circle_allow_list = $this->ACLFormatter->expand($user['allow_gid']);
$contact_deny_list = $this->ACLFormatter->expand($user['deny_cid']);
- $group_deny_list = $this->ACLFormatter->expand($user['deny_gid']);
+ $circle_deny_list = $this->ACLFormatter->expand($user['deny_gid']);
switch ($posttype) {
case Item::PT_PERSONAL_NOTE:
$type = 'note';
$doesFederate = false;
$contact_allow_list = [$a->getContactId()];
- $group_allow_list = [];
+ $circle_allow_list = [];
$contact_deny_list = [];
- $group_deny_list = [];
+ $circle_deny_list = [];
break;
default:
$compose_title = $this->l10n->t('Compose new post');
$doesFederate = true;
$contact_allow = $_REQUEST['contact_allow'] ?? '';
- $group_allow = $_REQUEST['group_allow'] ?? '';
+ $circle_allow = $_REQUEST['circle_allow'] ?? '';
$contact_deny = $_REQUEST['contact_deny'] ?? '';
- $group_deny = $_REQUEST['group_deny'] ?? '';
+ $circle_deny = $_REQUEST['circle_deny'] ?? '';
if ($contact_allow
- . $group_allow
+ . $circle_allow
. $contact_deny
- . $group_deny)
+ . $circle_deny)
{
$contact_allow_list = $contact_allow ? explode(',', $contact_allow) : [];
- $group_allow_list = $group_allow ? explode(',', $group_allow) : [];
+ $circle_allow_list = $circle_allow ? explode(',', $circle_allow) : [];
$contact_deny_list = $contact_deny ? explode(',', $contact_deny) : [];
- $group_deny_list = $group_deny ? explode(',', $group_deny) : [];
+ $circle_deny_list = $circle_deny ? explode(',', $circle_deny) : [];
}
break;
'$body' => $body,
'$location' => $location,
- '$contact_allow'=> implode(',', $contact_allow_list),
- '$group_allow' => implode(',', $group_allow_list),
- '$contact_deny' => implode(',', $contact_deny_list),
- '$group_deny' => implode(',', $group_deny_list),
+ '$contact_allow' => implode(',', $contact_allow_list),
+ '$circle_allow' => implode(',', $circle_allow_list),
+ '$contact_deny' => implode(',', $contact_deny_list),
+ '$circle_deny' => implode(',', $circle_deny_list),
'$jotplugins' => $jotplugins,
'$rand_num' => Crypto::randomDigits(12),
'$acl_selector' => ACL::getFullSelectorHTML($this->page, $a->getLoggedInUserId(), $doesFederate, [
'allow_cid' => $contact_allow_list,
- 'allow_gid' => $group_allow_list,
+ 'allow_gid' => $circle_allow_list,
'deny_cid' => $contact_deny_list,
- 'deny_gid' => $group_deny_list,
+ 'deny_gid' => $circle_deny_list,
]),
]);
}
use Friendica\Core\System;
use Friendica\Database\Database;
use Friendica\Database\DBA;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Post;
use Friendica\Model\User;
use Friendica\Model\Verb;
$network_count = 0;
$register_count = 0;
$sysnotify_count = 0;
- $groups_unseen = [];
+ $circles_unseen = [];
$forums_unseen = [];
$event_count = 0;
}
}
- $compute_group_counts = $this->config->get('system','compute_group_counts');
- if ($network_count && $compute_group_counts) {
- // Find out how unseen network posts are spread across groups
- foreach (Group::countUnseen() as $group_count) {
- if ($group_count['count'] > 0) {
- $groups_unseen[] = $group_count;
+ $compute_circle_counts = $this->config->get('system','compute_group_counts') ?? $this->config->get('system','compute_circle_counts');
+ if ($network_count && $compute_circle_counts) {
+ // Find out how unseen network posts are spread across circles
+ foreach (Circle::countUnseen() as $circle_count) {
+ if ($circle_count['count'] > 0) {
+ $circles_unseen[] = $circle_count;
}
}
$data['events-today'] = $today_event_count;
$data['birthdays'] = $birthday_count;
$data['birthdays-today'] = $today_birthday_count;
- $data['groups'] = $groups_unseen;
+ $data['circles'] = $circles_unseen;
$data['forums'] = $forums_unseen;
$data['notification'] = ($notification_count < 50) ? $notification_count : '49+';
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\APContact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\Tag;
exit;
}
- $allowed_users = $model['allow_cid'];
- $allowed_groups = $model['allow_gid'];
- $deny_users = $model['deny_cid'];
- $deny_groups = $model['deny_gid'];
+ $allowed_users = $model['allow_cid'];
+ $allowed_circles = $model['allow_gid'];
+ $deny_users = $model['deny_cid'];
+ $deny_circles = $model['deny_gid'];
$o = DI::l10n()->t('Visible to:') . '<br />';
$l = [];
- if (count($allowed_groups)) {
- $key = array_search(Group::FOLLOWERS, $allowed_groups);
+ if (count($allowed_circles)) {
+ $key = array_search(Circle::FOLLOWERS, $allowed_circles);
if ($key !== false) {
$l[] = '<b>' . DI::l10n()->t('Followers') . '</b>';
- unset($allowed_groups[$key]);
+ unset($allowed_circles[$key]);
}
- $key = array_search(Group::MUTUALS, $allowed_groups);
+ $key = array_search(Circle::MUTUALS, $allowed_circles);
if ($key !== false) {
$l[] = '<b>' . DI::l10n()->t('Mutuals') . '</b>';
- unset($allowed_groups[$key]);
+ unset($allowed_circles[$key]);
}
- foreach (DI::dba()->selectToArray('group', ['name'], ['id' => $allowed_groups]) as $group) {
- $l[] = '<b>' . $group['name'] . '</b>';
+ foreach (DI::dba()->selectToArray('group', ['name'], ['id' => $allowed_circles]) as $circle) {
+ $l[] = '<b>' . $circle['name'] . '</b>';
}
}
$l[] = $contact['name'];
}
- if (count($deny_groups)) {
- $key = array_search(Group::FOLLOWERS, $deny_groups);
+ if (count($deny_circles)) {
+ $key = array_search(Circle::FOLLOWERS, $deny_circles);
if ($key !== false) {
$l[] = '<b><strike>' . DI::l10n()->t('Followers') . '</strike></b>';
- unset($deny_groups[$key]);
+ unset($deny_circles[$key]);
}
- $key = array_search(Group::MUTUALS, $deny_groups);
+ $key = array_search(Circle::MUTUALS, $deny_circles);
if ($key !== false) {
$l[] = '<b><strike>' . DI::l10n()->t('Mutuals') . '</strike></b>';
- unset($deny_groups[$key]);
+ unset($deny_circles[$key]);
}
- foreach (DI::dba()->selectToArray('group', ['name'], ['id' => $allowed_groups]) as $group) {
- $l[] = '<b><strike>' . $group['name'] . '</strike></b>';
+ foreach (DI::dba()->selectToArray('group', ['name'], ['id' => $allowed_circles]) as $circle) {
+ $l[] = '<b><strike>' . $circle['name'] . '</strike></b>';
}
}
$o .= $this->conversation->statusEditor($x);
}
- // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
+ // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched their circles
$condition = Item::getPermissionsConditionArrayByUserId($profile['uid']);
$last_updated_array = $this->session->get('last_updated', []);
}
$str_contact_allow = isset($request['contact_allow']) ? $this->aclFormatter->toString($request['contact_allow']) : $this->owner['allow_cid'] ?? '';
- $str_group_allow = isset($request['group_allow']) ? $this->aclFormatter->toString($request['group_allow']) : $this->owner['allow_gid'] ?? '';
+ $str_circle_allow = isset($request['circle_allow']) ? $this->aclFormatter->toString($request['circle_allow']) : $this->owner['allow_gid'] ?? '';
$str_contact_deny = isset($request['contact_deny']) ? $this->aclFormatter->toString($request['contact_deny']) : $this->owner['deny_cid'] ?? '';
- $str_group_deny = isset($request['group_deny']) ? $this->aclFormatter->toString($request['group_deny']) : $this->owner['deny_gid'] ?? '';
+ $str_circle_deny = isset($request['circle_deny']) ? $this->aclFormatter->toString($request['circle_deny']) : $this->owner['deny_gid'] ?? '';
$visibility = $request['visibility'] ?? '';
if ($visibility === 'public') {
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
- $str_contact_allow = $str_group_allow = $str_contact_deny = $str_group_deny = '';
+ $str_contact_allow = $str_circle_allow = $str_contact_deny = $str_circle_deny = '';
} else if ($visibility === 'custom') {
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
// case that would make it public. So we always append the author's contact id to the allowed contacts.
$resource_id = Photo::newResource();
- $preview = Photo::storeWithPreview($image, $this->owner['uid'], $resource_id, $filename, $filesize, $album, '', $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
+ $preview = Photo::storeWithPreview($image, $this->owner['uid'], $resource_id, $filename, $filesize, $album, '', $str_contact_allow, $str_circle_allow, $str_contact_deny, $str_circle_deny);
if ($preview < 0) {
$this->logger->warning('image store failed');
$this->systemMessages->addNotice($this->t('Image upload failed.'));
$arr['author-avatar'] = $this->owner['thumb'];
$arr['title'] = '';
$arr['allow_cid'] = $str_contact_allow;
- $arr['allow_gid'] = $str_group_allow;
+ $arr['allow_gid'] = $str_circle_allow;
$arr['deny_cid'] = $str_contact_deny;
- $arr['deny_gid'] = $str_group_deny;
+ $arr['deny_gid'] = $str_circle_deny;
$arr['visible'] = $visible;
$arr['origin'] = 1;
*/
class Acl extends BaseModule
{
- const TYPE_GLOBAL_CONTACT = 'x';
- const TYPE_MENTION_CONTACT = 'c';
- const TYPE_MENTION_GROUP = 'g';
- const TYPE_MENTION_CONTACT_GROUP = '';
- const TYPE_MENTION_FORUM = 'f';
- const TYPE_PRIVATE_MESSAGE = 'm';
- const TYPE_ANY_CONTACT = 'a';
+ const TYPE_GLOBAL_CONTACT = 'x';
+ const TYPE_MENTION_CONTACT = 'c';
+ const TYPE_MENTION_CIRCLE = 'g';
+ const TYPE_MENTION_CONTACT_CIRCLE = '';
+ const TYPE_MENTION_FORUM = 'f';
+ const TYPE_PRIVATE_MESSAGE = 'm';
+ const TYPE_ANY_CONTACT = 'a';
/** @var IHandleUserSessions */
private $session;
throw new HTTPException\UnauthorizedException($this->t('You must be logged in to use this module.'));
}
- $type = $request['type'] ?? self::TYPE_MENTION_CONTACT_GROUP;
+ $type = $request['type'] ?? self::TYPE_MENTION_CONTACT_CIRCLE;
if ($type === self::TYPE_GLOBAL_CONTACT) {
$o = $this->globalContactSearch($request);
} else {
$this->logger->info('ACL {action} - {subaction} - start', ['module' => 'acl', 'action' => 'content', 'subaction' => 'search', 'search' => $search, 'type' => $type, 'conversation' => $conv_id]);
- $sql_extra = '';
- $condition = ["`uid` = ? AND NOT `deleted` AND NOT `pending` AND NOT `archive`", $this->session->getLocalUserId()];
- $condition_group = ["`uid` = ? AND NOT `deleted`", $this->session->getLocalUserId()];
+ $sql_extra = '';
+ $condition = ["`uid` = ? AND NOT `deleted` AND NOT `pending` AND NOT `archive`", $this->session->getLocalUserId()];
+ $condition_circle = ["`uid` = ? AND NOT `deleted`", $this->session->getLocalUserId()];
if ($search != '') {
- $sql_extra = "AND `name` LIKE '%%" . $this->database->escape($search) . "%%'";
- $condition = DBA::mergeConditions($condition, ["(`attag` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)",
+ $sql_extra = "AND `name` LIKE '%%" . $this->database->escape($search) . "%%'";
+ $condition = DBA::mergeConditions($condition, ["(`attag` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)",
'%' . $search . '%', '%' . $search . '%', '%' . $search . '%']);
- $condition_group = DBA::mergeConditions($condition_group, ["`name` LIKE ?", '%' . $search . '%']);
+ $condition_circle = DBA::mergeConditions($condition_circle, ["`name` LIKE ?", '%' . $search . '%']);
}
- // count groups and contacts
- $group_count = 0;
- if ($type == self::TYPE_MENTION_CONTACT_GROUP || $type == self::TYPE_MENTION_GROUP) {
- $group_count = $this->database->count('group', $condition_group);
+ // count circles and contacts
+ $circle_count = 0;
+ if ($type == self::TYPE_MENTION_CONTACT_CIRCLE || $type == self::TYPE_MENTION_CIRCLE) {
+ $circle_count = $this->database->count('group', $condition_circle);
}
$networks = Widget::unavailableNetworks();
$condition = DBA::mergeConditions($condition, array_merge(["NOT `network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")"], $networks));
switch ($type) {
- case self::TYPE_MENTION_CONTACT_GROUP:
+ case self::TYPE_MENTION_CONTACT_CIRCLE:
$condition = DBA::mergeConditions($condition,
["NOT `self` AND NOT `blocked` AND `notify` != ? AND `network` != ?", '', Protocol::OSTATUS
]);
$contact_count = $this->database->count('contact', $condition);
- $resultTotal = $group_count + $contact_count;
+ $resultTotal = $circle_count + $contact_count;
- $resultGroups = [];
+ $resultCircles = [];
$resultContacts = [];
- if ($type == self::TYPE_MENTION_CONTACT_GROUP || $type == self::TYPE_MENTION_GROUP) {
+ if ($type == self::TYPE_MENTION_CONTACT_CIRCLE || $type == self::TYPE_MENTION_CIRCLE) {
/// @todo We should cache this query.
// This can be done when we can delete cache entries via wildcard
- $groups = $this->database->toArray($this->database->p("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
- FROM `group`
- INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id`
- WHERE NOT `group`.`deleted` AND `group`.`uid` = ?
+ $circles = $this->database->toArray($this->database->p("SELECT `circle`.`id`, `circle`.`name`, GROUP_CONCAT(DISTINCT `circle_member`.`contact-id` SEPARATOR ',') AS uids
+ FROM `group` AS `circle`
+ INNER JOIN `group_member` AS `circle_member` ON `circle_member`.`gid` = `circle`.`id`
+ WHERE NOT `circle`.`deleted` AND `circle`.`uid` = ?
$sql_extra
- GROUP BY `group`.`name`, `group`.`id`
- ORDER BY `group`.`name`
+ GROUP BY `circle`.`name`, `circle`.`id`
+ ORDER BY `circle`.`name`
LIMIT ?, ?",
$this->session->getLocalUserId(),
$start,
$count
));
- foreach ($groups as $group) {
- $resultGroups[] = [
- 'type' => 'g',
+ foreach ($circles as $circle) {
+ $resultCircles[] = [
+ 'type' => self::TYPE_MENTION_CIRCLE,
'photo' => 'images/twopeople.png',
- 'name' => htmlspecialchars($group['name']),
- 'id' => intval($group['id']),
- 'uids' => array_map('intval', explode(',', $group['uids'])),
+ 'name' => htmlspecialchars($circle['name']),
+ 'id' => intval($circle['id']),
+ 'uids' => array_map('intval', explode(',', $circle['uids'])),
'link' => '',
'forum' => '0'
];
}
- if ((count($resultGroups) > 0) && ($search == '')) {
- $resultGroups[] = ['separator' => true];
+ if ((count($resultCircles) > 0) && ($search == '')) {
+ $resultCircles[] = ['separator' => true];
}
}
$contacts = [];
- if ($type != self::TYPE_MENTION_GROUP) {
+ if ($type != self::TYPE_MENTION_CIRCLE) {
$contacts = Contact::selectToArray([], $condition, ['order' => ['name']]);
}
$forums = [];
foreach ($contacts as $contact) {
$entry = [
- 'type' => 'c',
+ 'type' => self::TYPE_MENTION_CONTACT,
'photo' => Contact::getMicro($contact, true),
'name' => htmlspecialchars($contact['name']),
'id' => intval($contact['id']),
$resultContacts = array_merge($forums, $resultContacts);
}
- $resultItems = array_merge($resultGroups, $resultContacts);
+ $resultItems = array_merge($resultCircles, $resultContacts);
if ($conv_id) {
// In multithreaded posts the conv_id is not the parent of the whole thread
$contact = Contact::getByURL($author, false, ['micro', 'name', 'id', 'network', 'nick', 'addr', 'url', 'forum', 'avatar']);
if ($contact) {
$unknown_contacts[] = [
- 'type' => 'c',
+ 'type' => self::TYPE_MENTION_CONTACT,
'photo' => Contact::getMicro($contact, true),
'name' => htmlspecialchars($contact['name']),
'id' => intval($contact['id']),
'tot' => $resultTotal,
'start' => $start,
'count' => $count,
- 'groups' => $resultGroups,
+ 'circles' => $resultCircles,
'contacts' => $resultContacts,
'items' => $resultItems,
'type' => $type,
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Notification;
use Friendica\Model\Post\UserNotification;
use Friendica\Model\Profile;
$blocktags = empty($request['blocktags']); // this setting is inverted!
$unkmail = !empty($request['unkmail']);
$cntunkmail = intval($request['cntunkmail'] ?? 0);
- $def_gid = intval($request['group-selection'] ?? 0);
+ $def_gid = intval($request['circle-selection'] ?? 0);
$aclFormatter = DI::aclFormatter();
- $str_group_allow = !empty($request['group_allow']) ? $aclFormatter->toString($request['group_allow']) : '';
$str_contact_allow = !empty($request['contact_allow']) ? $aclFormatter->toString($request['contact_allow']) : '';
- $str_group_deny = !empty($request['group_deny']) ? $aclFormatter->toString($request['group_deny']) : '';
- $str_contact_deny = !empty($request['contact_deny']) ? $aclFormatter->toString($request['contact_deny']) : '';
+ $str_circle_allow = !empty($request['circle_allow']) ? $aclFormatter->toString($request['circle_allow']) : '';
+ $str_contact_deny = !empty($request['contact_deny']) ? $aclFormatter->toString($request['contact_deny']) : '';
+ $str_circle_deny = !empty($request['circle_deny']) ? $aclFormatter->toString($request['circle_deny']) : '';
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'unlisted', !empty($request['unlisted']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'accessible-photos', !empty($request['accessible-photos']));
$fields = [
'allow_cid' => $str_contact_allow,
- 'allow_gid' => $str_group_allow,
+ 'allow_gid' => $str_circle_allow,
'deny_cid' => $str_contact_deny,
- 'deny_gid' => $str_group_deny,
+ 'deny_gid' => $str_circle_deny,
'maxreq' => $maxreq,
'def_gid' => $def_gid,
'blockwall' => $blockwall,
$fields = [
'allow_cid' => '',
'allow_gid' => $page_flags == User::PAGE_FLAGS_PRVGROUP ?
- '<' . Group::FOLLOWERS . '>'
+ '<' . Circle::FOLLOWERS . '>'
: '',
'deny_cid' => '',
'deny_gid' => '',
'$blocktags' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.')],
'$unkmail' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.')],
'$cntunkmail' => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail, DI::l10n()->t("(to prevent spam abuse)")],
- '$group_select' => Group::displayGroupSelection(DI::userSession()->getLocalUserId(), $user['def_gid']),
+ '$circle_select' => Circle::getSelectorHTML(DI::userSession()->getLocalUserId(), $user['def_gid']),
'$permissions' => DI::l10n()->t('Default Post Permissions'),
'$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId()),
<p>You can use BBCodes in the field values.</p>
<p>Reorder by dragging the field title.</p>
<p>Empty the label field to remove a custom field.</p>
- <p>Non-public fields can only be seen by the selected Friendica contacts or the Friendica contacts in the selected groups.</p>",
+ <p>Non-public fields can only be seen by the selected Friendica contacts or the Friendica contacts in the selected circles.</p>",
'profile/' . $profile['nickname'] . '/profile'
),
'$custom_fields' => $custom_fields,
$permissionSet = DI::permissionSet()->selectOrCreate(DI::permissionSetFactory()->createFromString(
$uid,
DI::aclFormatter()->toString($profileFieldInputs['new']['contact_allow'] ?? ''),
- DI::aclFormatter()->toString($profileFieldInputs['new']['group_allow'] ?? ''),
+ DI::aclFormatter()->toString($profileFieldInputs['new']['circle_allow'] ?? ''),
DI::aclFormatter()->toString($profileFieldInputs['new']['contact_deny'] ?? ''),
- DI::aclFormatter()->toString($profileFieldInputs['new']['group_deny'] ?? '')
+ DI::aclFormatter()->toString($profileFieldInputs['new']['circle_deny'] ?? '')
));
$profileFields->append(DI::profileFieldFactory()->createFromValues(
$permissionSet = DI::permissionSet()->selectOrCreate(DI::permissionSetFactory()->createFromString(
$uid,
DI::aclFormatter()->toString($profileFieldInput['contact_allow'] ?? ''),
- DI::aclFormatter()->toString($profileFieldInput['group_allow'] ?? ''),
+ DI::aclFormatter()->toString($profileFieldInput['circle_allow'] ?? ''),
DI::aclFormatter()->toString($profileFieldInput['contact_deny'] ?? ''),
- DI::aclFormatter()->toString($profileFieldInput['group_deny'] ?? '')
+ DI::aclFormatter()->toString($profileFieldInput['circle_deny'] ?? '')
));
$profileFields->append(DI::profileFieldFactory()->createFromValues(
sprintf("SELECT * FROM `pconfig` WHERE uid = %d", $user_id)
);
- $group = $this->exportMultiRow(
+ $circle = $this->exportMultiRow(
sprintf("SELECT * FROM `group` WHERE uid = %d", $user_id)
);
- $group_member = $this->exportMultiRow(
- sprintf("SELECT `group_member`.`gid`, `group_member`.`contact-id` FROM `group_member` INNER JOIN `group` ON `group`.`id` = `group_member`.`gid` WHERE `group`.`uid` = %d", $user_id)
+ $circle_member = $this->exportMultiRow(
+ sprintf("SELECT `circle_member`.`gid`, `circle_member`.`contact-id` FROM `group_member` AS `circle_member` INNER JOIN `group` AS `circle` ON `circle`.`id` = `circle_member`.`gid` WHERE `circle`.`uid` = %d", $user_id)
);
$output = [
'profile_fields' => $profile_fields,
'photo' => $photo,
'pconfig' => $pconfig,
- 'group' => $group,
- 'group_member' => $group_member,
+ 'circle' => $circle,
+ 'circle_member' => $circle_member,
];
echo json_encode($output, JSON_PARTIAL_OUTPUT_ON_ERROR);
System::htmlUpdateExit($o);
}
- // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
+ // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched their circles
$sql_extra = Item::getPermissionsSQLByUserId($a->getProfileOwner());
$last_updated_array = DI::session()->get('last_updated', []);
return;
}
+ // Backward compatibility
+ $account['circle'] = $account['circle'] ?? $account['group'];
+ $account['circle_member'] = $account['circle_member'] ?? $account['group_member'];
+
$oldBaseUrl = $account['baseurl'];
$newBaseUrl = (string)$this->baseUrl;
$this->systemMessages->addNotice($this->tt('%d contact not imported', '%d contacts not imported', $errorCount));
}
- array_walk($account['group'], function (&$group) use ($newUid) {
- $group['uid'] = $newUid;
- if ($this->dbImportAssoc('group', $group) === false) {
- $this->logger->warning('Error inserting group', ['name' => $group['name'], 'error' => $this->database->errorMessage()]);
+ array_walk($account['circle'], function (&$circle) use ($newUid) {
+ $circle['uid'] = $newUid;
+ if ($this->dbImportAssoc('group', $circle) === false) {
+ $this->logger->warning('Error inserting circle', ['name' => $circle['name'], 'error' => $this->database->errorMessage()]);
} else {
- $group['newid'] = $this->lastInsertId();
+ $circle['newid'] = $this->lastInsertId();
}
});
- foreach ($account['group_member'] as $group_member) {
+ foreach ($account['circle_member'] as $circle_member) {
$import = 0;
- foreach ($account['group'] as $group) {
- if ($group['id'] == $group_member['gid'] && isset($group['newid'])) {
- $group_member['gid'] = $group['newid'];
+ foreach ($account['circle'] as $circle) {
+ if ($circle['id'] == $circle_member['gid'] && isset($circle['newid'])) {
+ $circle_member['gid'] = $circle['newid'];
$import++;
break;
}
}
foreach ($account['contact'] as $contact) {
- if ($contact['id'] == $group_member['contact-id'] && isset($contact['newid'])) {
- $group_member['contact-id'] = $contact['newid'];
+ if ($contact['id'] == $circle_member['contact-id'] && isset($contact['newid'])) {
+ $circle_member['contact-id'] = $contact['newid'];
$import++;
break;
}
}
- if ($import == 2 && $this->dbImportAssoc('group_member', $group_member) === false) {
- $this->logger->warning('Error inserting group member', ['gid' => $group_member['id'], 'error' => $this->database->errorMessage()]);
+ if ($import == 2 && $this->dbImportAssoc('group_member', $circle_member) === false) {
+ $this->logger->warning('Error inserting circle member', ['gid' => $circle_member['id'], 'error' => $this->database->errorMessage()]);
}
}
'$finding_link' => DI::l10n()->t('Finding New People'),
'$finding_txt' => DI::l10n()->t('On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.'),
- '$groups' => DI::l10n()->t('Groups'),
- '$group_contact_link' => DI::l10n()->t('Group Your Contacts'),
- '$group_contact_txt' => DI::l10n()->t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.'),
+ '$circles' => DI::l10n()->t('Circles'),
+ '$circle_contact_link' => DI::l10n()->t('Add Your Contacts To Circle'),
+ '$circle_contact_txt' => DI::l10n()->t('Once you have made some friends, organize them into private conversation circles from the sidebar of your Contacts page and then you can interact with each circle privately on your Network page.'),
'$newuser_private' => $newuser_private,
'$private_link' => DI::l10n()->t('Why Aren\'t My Posts Public?'),
'$private_txt' => DI::l10n()->t('Friendica respects your privacy. By default, your posts will only show up to people you\'ve added as friends. For more information, see the help section from the link above.'),
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Object\Api\Friendica;
+
+use Friendica\BaseDataTransferObject;
+
+class Circle extends BaseDataTransferObject
+{
+ /** @var string */
+ protected $name;
+ /** @var int */
+ protected $id;
+ /** @var string */
+ protected $id_str;
+ /** @var array */
+ protected $user;
+ /** @var string */
+ protected $mode;
+
+ /**
+ * @param array $circle Circle row array
+ * @param array $user
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ */
+ public function __construct(array $circle, array $user)
+ {
+ $this->name = $circle['name'];
+ $this->id = $circle['id'];
+ $this->id_str = (string)$circle['id'];
+ $this->user = $user;
+ $this->mode = $circle['visible'] ? 'public' : 'private';
+ }
+}
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Object\Api\Friendica;
-
-use Friendica\BaseDataTransferObject;
-
-/**
- * Class Group
- *
- *
- */
-class Group extends BaseDataTransferObject
-{
- /** @var string */
- protected $name;
- /** @var int */
- protected $id;
- /** @var string */
- protected $id_str;
- /** @var array */
- protected $user;
- /** @var string */
- protected $mode;
-
- /**
- * Creates an Group entity array
- *
- * @param array $group
- * @param array $user
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- */
- public function __construct(array $group, array $user)
- {
- $this->name = $group['name'];
- $this->id = $group['id'];
- $this->id_str = (string)$group['id'];
- $this->user = $user;
- $this->mode = $group['visible'] ? 'public' : 'private';
- }
-}
use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\User;
$item['private'] = Item::UNLISTED;
} elseif (!empty($object_data['target'][Receiver::TARGET_FOLLOWER])) {
$item['allow_cid'] = '';
- $item['allow_gid'] = '<' . Group::FOLLOWERS . '>';
+ $item['allow_gid'] = '<' . Circle::FOLLOWERS . '>';
$item['deny_cid'] = '';
$item['deny_gid'] = '';
$item['private'] = Item::PRIVATE;
if (!empty($actor)) {
$profile = APContact::getByURL($actor);
$followers = $profile['followers'] ?? '';
- $is_forum = ($actor['type'] ?? '') == 'Group';
+ $is_forum = ($profile['type'] ?? '') == 'Group';
if ($push) {
Contact::updateByUrlIfNeeded($actor);
}
use Friendica\BaseRepository;
use Friendica\Database\Database;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Security\PermissionSet\Exception\PermissionSetNotFoundException;
use Friendica\Security\PermissionSet\Exception\PermissionSetPersistenceException;
$user_contact_str = '';
}
- $groups = [];
+ $circle_ids = [];
if (!empty($user_contact_str) && $this->db->exists('contact', [
'id' => $cid,
'uid' => $uid,
'blocked' => false
])) {
- $groups = Group::getIdsByContactId($cid);
+ $circle_ids = Circle::getIdsByContactId($cid);
}
- $group_str = '<<>>'; // should be impossible to match
- foreach ($groups as $group_id) {
- $group_str .= '|<' . preg_quote($group_id) . '>';
+ $circle_str = '<<>>'; // should be impossible to match
+ foreach ($circle_ids as $circle_id) {
+ $circle_str .= '|<' . preg_quote($circle_id) . '>';
}
if (!empty($user_contact_str)) {
$condition = ["`uid` = ? AND (NOT (LOCATE(?, `deny_cid`) OR LOCATE(?, `deny_cid`) OR deny_gid REGEXP ?)
AND (LOCATE(?, allow_cid) OR LOCATE(?, allow_cid) OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
- $uid, $user_contact_str, $public_contact_str, $group_str,
- $user_contact_str, $public_contact_str, $group_str];
+ $uid, $user_contact_str, $public_contact_str, $circle_str,
+ $user_contact_str, $public_contact_str, $circle_str];
} else {
$condition = ["`uid` = ? AND (NOT (LOCATE(?, `deny_cid`) OR deny_gid REGEXP ?)
AND (LOCATE(?, allow_cid) OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
- $uid, $public_contact_str, $group_str, $public_contact_str, $group_str];
+ $uid, $public_contact_str, $circle_str, $public_contact_str, $circle_str];
}
return $this->select($condition);
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\User;
/**
if ($local_user && $local_user == $owner_id) {
$sql = '';
/*
- * Authenticated visitor. Load the groups the visitor belongs to.
+ * Authenticated visitor. Load the circles the visitor belongs to.
*/
} elseif ($remote_contact) {
- $gs = '<<>>'; // should be impossible to match
+ $circleIds = '<<>>'; // should be impossible to match
- $groups = Group::getIdsByContactId($remote_contact);
-
- if (is_array($groups)) {
- foreach ($groups as $g) {
- $gs .= '|<' . intval($g) . '>';
- }
+ foreach (Circle::getIdsByContactId($remote_contact) as $circleId) {
+ $circleIds .= '|<' . intval($circleId) . '>';
}
$sql = sprintf(
AND (allow_cid REGEXP '<%d>' OR allow_gid REGEXP '%s'
OR (allow_cid = '' AND allow_gid = ''))" . $acc_sql . ") ",
intval($remote_contact),
- DBA::escape($gs),
+ DBA::escape($circleIds),
intval($remote_contact),
- DBA::escape($gs)
+ DBA::escape($circleIds)
);
}
return $sql;
namespace Friendica\Util;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
/**
* Util class for ACL formatting
final class ACLFormatter
{
/**
- * Turn user/group ACLs stored as angle bracketed text into arrays
+ * Turn user/circle ACLs stored as angle bracketed text into arrays
*
* @param string|null $acl_string A angle-bracketed list of IDs
*
// turn string array of angle-bracketed elements into numeric array
// e.g. "<1><2><3>" => array(1,2,3);
- preg_match_all('/<(' . Group::FOLLOWERS . '|'. Group::MUTUALS . '|[0-9]+)>/', $acl_string, $matches, PREG_PATTERN_ORDER);
+ preg_match_all('/<(' . Circle::FOLLOWERS . '|'. Circle::MUTUALS . '|[0-9]+)>/', $acl_string, $matches, PREG_PATTERN_ORDER);
return $matches[1];
}
if (intval($item)) {
$item = '<' . intval($item) . '>';
// The item is a allowed ACL character
- } elseif (in_array($item, [Group::FOLLOWERS, Group::MUTUALS])) {
+ } elseif (in_array($item, [Circle::FOLLOWERS, Circle::MUTUALS])) {
$item = '<' . $item . '>';
// The item is already a ACL string
} elseif (preg_match('/<\d+?>/', $item)) {
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\GServer;
use Friendica\Model\Item;
use Friendica\Model\Post;
$aclFormatter = DI::aclFormatter();
$allow_people = $aclFormatter->expand($parent['allow_cid']);
- $allow_groups = Group::expand($uid, $aclFormatter->expand($parent['allow_gid']),true);
+ $allow_circles = Circle::expand($uid, $aclFormatter->expand($parent['allow_gid']),true);
$deny_people = $aclFormatter->expand($parent['deny_cid']);
- $deny_groups = Group::expand($uid, $aclFormatter->expand($parent['deny_gid']));
+ $deny_circles = Circle::expand($uid, $aclFormatter->expand($parent['deny_gid']));
foreach ($items as $item) {
$recipients[] = $item['contact-id'];
Logger::notice('Deliver', ['target' => $target_id, 'guid' => $target_item['guid'], 'recipients' => $url_recipients]);
}
- $recipients = array_unique(array_merge($recipients, $allow_people, $allow_groups));
- $deny = array_unique(array_merge($deny_people, $deny_groups));
+ $recipients = array_unique(array_merge($recipients, $allow_people, $allow_circles));
+ $deny = array_unique(array_merge($deny_people, $deny_circles));
$recipients = array_diff($recipients, $deny);
// If this is a public message and pubmail is set on the parent, include all your email contacts
foreach (Tag::getByURIId($target_item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION]) as $tag) {
$target_contact = Contact::getByURL(Strings::normaliseLink($tag['url']), null, [], $uid);
if ($target_contact && $target_contact['contact-type'] == Contact::TYPE_COMMUNITY && $target_contact['manually-approve']) {
- Group::updateMembersForForum($target_contact['id']);
+ Circle::updateMembersForForum($target_contact['id']);
}
}
}
Logger::info('Remote item will be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]);
- $check_signature = ($target_item['gravity'] == Item::GRAVITY_ACTIVITY);
+ $check_signature = ($target_item['gravity'] == Item::GRAVITY_ACTIVITY);
} else {
Logger::info('Remote activity will not be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]);
return ['count' => 0, 'contacts' => []];
// Number of "free" searches when system => permit_crawling is enabled.
'free_crawls' => 10,
- // groupedit_image_limit (Integer)
- // Number of contacts at which the group editor should switch from display the profile pictures of the contacts to only display the names.
+ // circle_edit_image_limit (Integer)
+ // Number of contacts at which the circle editor should switch from display the profile pictures of the contacts to only display the names.
// This can alternatively be set on a per-account basis in the pconfig table.
- 'groupedit_image_limit' => 400,
+ 'circle_edit_image_limit' => 400,
// gserver_update_limit (Integer)
// How many servers should be checked at a time?
'/direct_messages_setseen[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\DirectMessages\Setseen::class, [ R::POST]],
'/direct_messages_search[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\DirectMessages\Search ::class, [R::GET ]],
'/events[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Events\Index::class, [R::GET ]],
- '/event_create[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Events\Create::class, [ R::POST]],
- '/event_delete[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Events\Delete::class, [ R::POST]],
- '/group_show[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Group\Show::class, [R::GET ]],
- '/group_create[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Group\Create::class, [ R::POST]],
- '/group_delete[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Group\Delete::class, [ R::POST]],
- '/group_update[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Group\Update::class, [ R::POST]],
+ '/event_create[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Events\Create::class, [ R::POST]],
+ '/event_delete[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Events\Delete::class, [ R::POST]],
+ '/circle_show[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Circle\Show::class, [R::GET ]],
+ '/circle_create[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Circle\Create::class, [ R::POST]],
+ '/circle_delete[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Circle\Delete::class, [ R::POST]],
+ '/circle_update[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Circle\Update::class, [ R::POST]],
+
+ // Backward compatibility
+ // @deprecated
+ '/group_show[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Circle\Show::class, [R::GET ]],
+ '/group_create[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Circle\Create::class, [ R::POST]],
+ '/group_delete[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Circle\Delete::class, [ R::POST]],
+ '/group_update[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Circle\Update::class, [ R::POST]],
+
'/profile/show[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Profile\Show::class, [R::GET ]],
'/photoalbums[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Photoalbum\Index::class, [R::GET ]],
'/photoalbum[.{extension:json|xml|rss|atom}]' => [Module\Api\Friendica\Photoalbum\Show::class, [R::GET ]],
'/fsuggest/{contact:\d+}' => [Module\FriendSuggest::class, [R::GET, R::POST]],
- '/group' => [
- '[/]' => [Module\Group::class, [R::GET, R::POST]],
- '/{group:\d+}' => [Module\Group::class, [R::GET, R::POST]],
- '/none' => [Module\Group::class, [R::GET, R::POST]],
- '/new' => [Module\Group::class, [R::GET, R::POST]],
- '/drop/{group:\d+}' => [Module\Group::class, [R::GET, R::POST]],
- '/{group:\d+}/{contact:\d+}' => [Module\Group::class, [R::GET, R::POST]],
- '/{group:\d+}/{command:add|remove}/{contact:\d+}' => [Module\Group::class, [R::GET, R::POST]],
+ '/circle' => [
+ '[/]' => [Module\Circle::class, [R::GET, R::POST]],
+ '/{circle:\d+}' => [Module\Circle::class, [R::GET, R::POST]],
+ '/none' => [Module\Circle::class, [R::GET, R::POST]],
+ '/new' => [Module\Circle::class, [R::GET, R::POST]],
+ '/drop/{circle:\d+}' => [Module\Circle::class, [R::GET, R::POST]],
+ '/{circle:\d+}/{contact:\d+}' => [Module\Circle::class, [R::GET, R::POST]],
+ '/{circle:\d+}/{command:add|remove}/{contact:\d+}' => [Module\Circle::class, [R::GET, R::POST]],
],
'/hashtag' => [Module\Hashtag::class, [R::GET]],
'/help[/{doc:.+}]' => [Module\Help::class, [R::GET]],
'/newmember' => [Module\Welcome::class, [R::GET]],
'/nodeinfo/1.0' => [Module\NodeInfo110::class, [R::GET]],
'/nodeinfo/2.0' => [Module\NodeInfo120::class, [R::GET]],
- '/nogroup' => [Module\Group::class, [R::GET]],
+ '/nocircle' => [Module\Circle::class, [R::GET]],
'/noscrape' => [
'/{nick}' => [Module\NoScrape::class, [R::GET]],
'[/]' => [Module\Conversation\Network::class, [R::GET]],
'/archive/{from:\d\d\d\d-\d\d-\d\d}[/{to:\d\d\d\d-\d\d-\d\d}]' => [Module\Conversation\Network::class, [R::GET]],
'/forum/{contact_id:\d+}' => [Module\Conversation\Network::class, [R::GET]],
- '/group/{group_id:\d+}' => [Module\Conversation\Network::class, [R::GET]],
+ '/circle/{circle_id:\d+}' => [Module\Conversation\Network::class, [R::GET]],
],
'/randprof' => [Module\RandomProfile::class, [R::GET]],
'[/]' => [Module\Update\Network::class, [R::GET]],
'/archive/{from:\d\d\d\d-\d\d-\d\d}[/{to:\d\d\d\d-\d\d-\d\d}]' => [Module\Update\Network::class, [R::GET]],
'/forum/{contact_id:\d+}' => [Module\Update\Network::class, [R::GET]],
- '/group/{group_id:\d+}' => [Module\Update\Network::class, [R::GET]],
+ '/circle/{circle_id:\d+}' => [Module\Update\Network::class, [R::GET]],
],
'/update_profile' => [Module\Update\Profile::class, [R::GET]],
// Default value comprises classic role names from RFC 2142.
'forbidden_nicknames' => 'info, marketing, sales, support, abuse, noc, security, postmaster, hostmaster, usenet, news, webmaster, www, uucp, ftp, root, sysop',
- // compute_group_counts (Boolean)
- // Compute contact group level when counting unseen network posts.
- 'compute_group_counts' => true,
+ // compute_circle_counts (Boolean)
+ // Compute contact circle level when counting unseen network posts.
+ 'compute_circle_counts' => true,
// jpeg_quality (Integer)
// Sets the ImageMagick quality level for JPEG images. Values ranges from 50 (awful) to 100 (near perfect).
namespace Friendica\Test\src\Util;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Util\ACLFormatter;
use PHPUnit\Framework\TestCase;
{
return [
'normal' => [
- 'input' => '<1><2><3><' . Group::FOLLOWERS . '><' . Group::MUTUALS . '>',
- 'assert' => ['1', '2', '3', Group::FOLLOWERS, Group::MUTUALS],
+ 'input' => '<1><2><3><' . Circle::FOLLOWERS . '><' . Circle::MUTUALS . '>',
+ 'assert' => ['1', '2', '3', Circle::FOLLOWERS, Circle::MUTUALS],
],
'nigNumber' => [
'input' => '<1><' . PHP_INT_MAX . '><15>',
$aclFormatter = new ACLFormatter();
$allow_people = $aclFormatter->expand();
- $allow_groups = $aclFormatter->expand();
+ $allow_circles = $aclFormatter->expand();
self::assertEmpty($aclFormatter->expand(null));
self::assertEmpty($aclFormatter->expand());
- $recipients = array_unique(array_merge($allow_people, $allow_groups));
+ $recipients = array_unique(array_merge($allow_people, $allow_circles));
self::assertEmpty($recipients);
}
'input' => ["<40195>"],
'assert' => "<40195>",
],
- Group::FOLLOWERS => [
- 'input' => [Group::FOLLOWERS, 1],
- 'assert' => '<' . Group::FOLLOWERS . '><1>',
+ Circle::FOLLOWERS => [
+ 'input' => [Circle::FOLLOWERS, 1],
+ 'assert' => '<' . Circle::FOLLOWERS . '><1>',
],
- Group::MUTUALS => [
- 'input' => [Group::MUTUALS, 1],
- 'assert' => '<' . Group::MUTUALS . '><1>',
+ Circle::MUTUALS => [
+ 'input' => [Circle::MUTUALS, 1],
+ 'assert' => '<' . Circle::MUTUALS . '><1>',
],
'wrong-angle-brackets' => [
'input' => ["<asd>","<123>"],
for(var t in contact_search.cache[bt]) {
if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results
// Filter old results locally
- var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one
+ var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because circles don't have one
matching.unshift({forum:false, text: term, replace: term});
setTimeout(function() { callback(matching); } , 1); // Use "pseudo-thread" to avoid some problems
return;
$('#mail-update-li').html(mail);
- $(".sidebar-group-li .notify").removeClass("show");
- $(data.groups).each(function(key, group) {
- var gid = group.id;
- var gcount = group.count;
- $(".group-"+gid+" .notify").addClass("show").text(gcount);
+ $(".sidebar-circle-li .notify").removeClass("show");
+ $(data.circles).each(function(key, circle) {
+ var gid = circle.id;
+ var gcount = circle.count;
+ $(".circle-"+gid+" .notify").addClass("show").text(gcount);
});
$(".forum-widget-entry .notify").removeClass("show");
return a.join('');
}
-function groupChangeMember(gid, cid, sec_token) {
+function circleChangeMember(gid, cid, sec_token) {
$('body .fakelink').css('cursor', 'wait');
- $.get('group/' + gid + '/' + cid + "?t=" + sec_token, function(data) {
- $('#group-update-wrapper').html(data);
+ $.get('circle/' + gid + '/' + cid + "?t=" + sec_token, function(data) {
+ $('#circle-update-wrapper').html(data);
$('body .fakelink').css('cursor', 'auto');
});
}
-function contactgroupChangeMember(checkbox, gid, cid) {
+function contactCircleChangeMember(checkbox, gid, cid) {
let url;
// checkbox.checked is the checkbox state after the click
if (checkbox.checked) {
- url = 'group/' + gid + '/add/' + cid;
+ url = 'circle/' + gid + '/add/' + cid;
} else {
- url = 'group/' + gid + '/remove/' + cid;
+ url = 'circle/' + gid + '/remove/' + cid;
}
$('body').css('cursor', 'wait');
$.post(url)
<i class="fa fa-lock"></i> {{$custom_title}}
</label>
<fieldset id="visibility-custom-panel-{{$input_group_id}}" class="panel-collapse collapse{{if $visibility == 'custom'}} in{{/if}}" role="tabpanel" aria-labelledby="visibility-custom-heading-{{$input_group_id}}" {{if $visibility != 'custom'}}disabled{{/if}}>
- <input type="hidden" name="{{$input_names.group_allow}}" value="{{$group_allow}}"/>
+ <input type="hidden" name="{{$input_names.circle_allow}}" value="{{$circle_allow}}"/>
<input type="hidden" name="{{$input_names.contact_allow}}" value="{{$contact_allow}}"/>
- <input type="hidden" name="{{$input_names.group_deny}}" value="{{$group_deny}}"/>
+ <input type="hidden" name="{{$input_names.circle_deny}}" value="{{$circle_deny}}"/>
<input type="hidden" name="{{$input_names.contact_deny}}" value="{{$contact_deny}}"/>
<div class="panel-body">
<p>{{$custom_desc}}</p>
$(function() {
let $acl_allow_input = $('#acl_allow-{{$input_group_id}}');
let $contact_allow_input = $('[name="{{$input_names.contact_allow}}"]');
- let $group_allow_input = $('[name="{{$input_names.group_allow}}"]');
+ let $circle_allow_input = $('[name="{{$input_names.circle_allow}}"]');
let $acl_deny_input = $('#acl_deny-{{$input_group_id}}');
let $contact_deny_input = $('[name="{{$input_names.contact_deny}}"]');
- let $group_deny_input = $('[name="{{$input_names.group_deny}}"]');
+ let $circle_deny_input = $('[name="{{$input_names.circle_deny}}"]');
let $visibility_public_panel = $('#visibility-public-panel-{{$input_group_id}}');
let $visibility_custom_panel = $('#visibility-custom-panel-{{$input_group_id}}');
let $visibility_public_radio = $('#visibility-public-{{$input_group_id}}');
});
// Custom visibility tags inputs
- let acl_groups = new Bloodhound({
- local: {{$acl_groups nofilter}},
+ let acl_circles = new Bloodhound({
+ local: {{$acl_circles nofilter}},
identify: function(obj) { return obj.type + '-' + obj.id.toString(); },
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name']),
queryTokenizer: Bloodhound.tokenizers.whitespace,
freeInput: false,
tagClass: function(item) {
switch (item.type) {
- case 'group' : return 'label label-primary';
+ case 'circle' : return 'label label-primary';
case 'contact' :
default:
return 'label label-info';
freeInput: false,
tagClass: function(item) {
switch (item.type) {
- case 'group' : return 'label label-primary';
+ case 'circle' : return 'label label-primary';
case 'contact' :
default:
return 'label label-info';
// Import existing ACL into the tags input fields.
- $group_allow_input.val().split(',').forEach(function (group_id) {
- $acl_allow_input.tagsinput('add', acl_groups.get('group-' + group_id)[0]);
+ $circle_allow_input.val().split(',').forEach(function (circle_id) {
+ $acl_allow_input.tagsinput('add', acl_circles.get('circle-' + circle_id)[0]);
});
$contact_allow_input.val().split(',').forEach(function (contact_id) {
$acl_allow_input.tagsinput('add', acl_contacts.get('contact-' + contact_id)[0]);
});
- $group_deny_input.val().split(',').forEach(function (group_id) {
- $acl_deny_input.tagsinput('add', acl_groups.get('group-' + group_id)[0]);
+ $circle_deny_input.val().split(',').forEach(function (circle_id) {
+ $acl_deny_input.tagsinput('add', acl_circles.get('circle-' + circle_id)[0]);
});
$contact_deny_input.val().split(',').forEach(function (contact_id) {
$acl_deny_input.tagsinput('add', acl_contacts.get('contact-' + contact_id)[0]);
}
// Update the real acl field
- $group_allow_input.val('');
+ $circle_allow_input.val('');
$contact_allow_input.val('');
[].forEach.call($acl_allow_input.tagsinput('items'), function (item) {
- if (item.type === 'group') {
- $group_allow_input.val($group_allow_input.val() + ',' + item.id);
+ if (item.type === 'circle') {
+ $circle_allow_input.val($circle_allow_input.val() + ',' + item.id);
} else {
$contact_allow_input.val($contact_allow_input.val() + ',' + item.id);
}
}
// Update the real acl field
- $group_deny_input.val('');
+ $circle_deny_input.val('');
$contact_deny_input.val('');
[].forEach.call($acl_deny_input.tagsinput('items'), function (item) {
- if (item.type === 'group') {
- $group_deny_input.val($group_deny_input.val() + ',' + item.id);
+ if (item.type === 'circle') {
+ $circle_deny_input.val($circle_deny_input.val() + ',' + item.id);
} else {
$contact_deny_input.val($contact_deny_input.val() + ',' + item.id);
}
<input type="hidden" name="contact_allow" value="{{$selfPublicContactId}}">
-<input type="hidden" name="group_allow" value="">
+<input type="hidden" name="circle_allow" value="">
<input type="hidden" name="contact_deny" value="">
-<input type="hidden" name="group_deny" value="">
-<div class="alert alert-info" role="alert"><p>{{$explanation}}</p></div>
\ No newline at end of file
+<input type="hidden" name="circle_deny" value="">
+<div class="alert alert-info" role="alert"><p>{{$explanation}}</p></div>
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}"/></div>
<h2>{{$performance}}</h2>
- {{include file="field_checkbox.tpl" field=$compute_group_counts}}
+ {{include file="field_checkbox.tpl" field=$compute_circle_counts}}
{{include file="field_checkbox.tpl" field=$only_tag_search}}
{{include file="field_input.tpl" field=$max_comments}}
{{include file="field_input.tpl" field=$max_display_comments}}
}
}).trigger('change');
- $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
+ $('#contact_allow, #contact_deny, #circle_allow, #circle_deny').change(function() {
let selstr;
- $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
+ $('#contact_allow option:selected, #contact_deny option:selected, #circle_allow option:selected, #circle_deny option:selected').each( function() {
selstr = $(this).html();
$('#jot-public').hide();
});
--- /dev/null
+
+<div class="circle-delete-wrapper button" id="circle-delete-wrapper-{{$id}}">
+ <a href="circle/drop/{{$id}}?t={{$form_security_token}}"
+ onclick="return confirmDelete();"
+ id="circle-delete-icon-{{$id}}"
+ class="icon drophide circle-delete-icon"
+ onmouseover="imgbright(this);"
+ onmouseout="imgdull(this);"
+ title="{{$delete}}">
+ </a>
+</div>
+<div class="circle-delete-end"></div>
--- /dev/null
+
+<h2>{{$title}}</h2>
+
+
+{{if $editable == 1}}
+<div id="circle-edit-wrapper">
+ <form action="circle/{{$gid}}" id="circle-edit-form" method="post">
+ <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+
+ {{include file="field_input.tpl" field=$gname}}
+ {{if $drop}}{{$drop nofilter}}{{/if}}
+ <div id="circle-edit-submit-wrapper">
+ <input type="submit" name="submit" value="{{$submit}}">
+ </div>
+ <div id="circle-edit-select-end"></div>
+ </form>
+</div>
+{{/if}}
+
+
+{{if $circle_editor}}
+ <div id="circle-update-wrapper">
+ {{include file="circle_editor.tpl"}}
+ </div>
+{{/if}}
+{{if $desc}}<div class="clear" id="circle-edit-desc">{{$desc nofilter}}</div>{{/if}}
--- /dev/null
+
+{{* Template for the contact circle list *}}
+
+{{if $editable == 1}}
+{{* The contacts who are already members of the contact circle *}}
+<div id="circle">
+ <h3>{{$circle_editor.label_members}}</h3>
+ <div id="circle-members" class="contact_list">
+
+ {{if $circle_editor.members }}
+
+ {{foreach $circle_editor.members as $c}}
+ {{* If there are too many contacts we use another view mode *}}
+ {{if $shortmode}}
+ <div class="contact-block-textdiv mpcircle">
+ <a class="contact-block-link mpcircle fakelink" target="redir" onclick="circleChangeMember({{$c.change_member.gid}},{{$c.change_member.cid}},'{{$c.change_member.sec_token}}'); return true;" title="{{$c.name}} [{{$c.itemurl}}]" alt="{{$c.name}}">
+ {{$c.name}}"
+ </a>
+ </div>
+ {{else}}
+ {{* The normal view mode *}}
+ <div class="contact-block-div mpcircle">
+ <a class="contact-block-link mpcircle fakelink" target="redir" onclick="circleChangeMember({{$c.change_member.gid}},{{$c.change_member.cid}},'{{$c.change_member.sec_token}}'); return true;">
+ <img class="contact-block-img mpcircle" src="{{$c.thumb}}" title="{{$c.name}} [{{$c.itemurl}}]" alt="{{$c.name}}">
+ </a>
+ </div>
+ {{/if}}
+ {{/foreach}}
+
+ {{else}}
+ {{$circle_editor.circle_is_empty}}
+ {{/if}}
+ </div>
+
+ <div id="circle-members-end"></div>
+ <hr id="circle-separator" />
+</div>
+{{/if}}
+
+{{* The contacts who are not members of the contact circle *}}
+<div id="contacts">
+ <h3>{{$circle_editor.label_contacts}}</h3>
+ <div id="circle-all-contacts" class="contact_list">
+ {{foreach $circle_editor.contacts as $m}}
+ <div class="contact-block-textdiv mpall">
+ {{if $editable == 1}}
+ <a class="contact-block-link mpall fakelink" target="redir" onclick="circleChangeMember({{$m.change_member.gid}},{{$m.change_member.cid}},'{{$m.change_member.sec_token}}'); return true;" title="{{$m.name}} [{{$m.itemurl}}]" alt="{{$m.name}}">
+ {{else}}
+ <a class="contact-block-link mpall" href="{{$m.url}}" title="{{$m.name}} [{{$m.itemurl}}]" alt="{{$m.name}}">
+ {{/if}}
+ {{* If there are too many contacts we use another view mode *}}
+ {{if $shortmode}}
+ {{$m.name}}
+ {{else}}
+ <img class="contact-block-img mpall " src="{{$m.thumb}}" title="{{$m.name}} [{{$m.itemurl}}]" alt="{{$m.name}}">
+ {{/if}}
+ </a>
+ </div>
+ {{/foreach}}
+ </div>
+ <div id="circle-all-contacts-end"></div>
+</div>
--- /dev/null
+
+<div class="field custom">
+<label for="circle-selection" id="circle-selection-lbl">{{$label}}</label>
+<select name="circle-selection" id="circle-selection">
+{{foreach $circles as $circle}}
+<option value="{{$circle.id}}"{{if $circle.selected}} selected="selected"{{/if}}>{{$circle.name}}</option>
+{{/foreach}}
+</select>
+</div>
--- /dev/null
+<span id="circle-sidebar-inflated" class="widget fakelink" onclick="openCloseWidget('circle-sidebar', 'circle-sidebar-inflated');">
+ <h3>{{$title}}</h3>
+</span>
+<div class="widget" id="circle-sidebar">
+ <span class="fakelink" onclick="openCloseWidget('circle-sidebar', 'circle-sidebar-inflated');">
+ <h3>{{$title}}</h3>
+ </span>
+
+ <div id="sidebar-circle-list">
+ <ul role="menu" id="sidebar-circle-ul">
+ {{foreach $circles as $circle}}
+ <li role="menuitem" class="sidebar-circle-li circle-{{$circle.id}}">
+ {{if ! $new_circle}}<span class="notify badge pull-right"></span>{{/if}}
+ {{if $circle.cid}}
+ <input type="checkbox"
+ class="{{if $circle.selected}}ticked{{else}}unticked {{/if}} action"
+ onclick="return contactCircleChangeMember(this, '{{$circle.id}}','{{$circle.cid}}');"
+ {{if $circle.ismember}}checked="checked"{{/if}}
+ />
+ {{/if}}
+ {{if $circle.edit}}
+ <a class="circlesideedit" href="{{$circle.edit.href}}" title="{{$edittext}}">
+ <span id="edit-sidebar-circle-element-{{$circle.id}}" class="circle-edit-icon iconspacer small-pencil"><span class="sr-only">{{$edittext}}</span></span>
+ </a>
+ {{/if}}
+ <a id="sidebar-circle-element-{{$circle.id}}" class="sidebar-circle-element {{if $circle.selected}}circle-selected{{/if}}" href="{{$circle.href}}">{{$circle.text}}</a>
+ </li>
+ {{/foreach}}
+ </ul>
+ </div>
+
+ {{if $new_circle}}
+ <div id="sidebar-new-circle">
+ <a onclick="javascript:$('#circle-new-form').fadeIn('fast');return false;">{{$createtext}}</a>
+ <form id="circle-new-form" action="circle/new" method="post" style="display:none;">
+ <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+ <input name="circle_name" id="id_circle_name" placeholder="{{$create_circle}}">
+ </form>
+ </div>
+ {{else}}
+ <div id="sidebar-edit-circles"><a href="{{$circle_page}}">{{$edit_circles_text}}</a></div>
+ {{/if}}
+
+ {{if $uncircled}}<div id="sidebar-uncircled"><a class="{{if $uncircled_selected}}circle-selected{{/if}}" href="nocircle">{{$uncircled}}</a></div>{{/if}}
+</div>
+<script>
+initWidget('circle-sidebar', 'circle-sidebar-inflated');
+</script>
+++ /dev/null
-
-<div class="group-delete-wrapper button" id="group-delete-wrapper-{{$id}}">
- <a href="group/drop/{{$id}}?t={{$form_security_token}}"
- onclick="return confirmDelete();"
- id="group-delete-icon-{{$id}}"
- class="icon drophide group-delete-icon"
- onmouseover="imgbright(this);"
- onmouseout="imgdull(this);"
- title="{{$delete}}">
- </a>
-</div>
-<div class="group-delete-end"></div>
+++ /dev/null
-
-<h2>{{$title}}</h2>
-
-
-{{if $editable == 1}}
-<div id="group-edit-wrapper">
- <form action="group/{{$gid}}" id="group-edit-form" method="post">
- <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-
- {{include file="field_input.tpl" field=$gname}}
- {{if $drop}}{{$drop nofilter}}{{/if}}
- <div id="group-edit-submit-wrapper">
- <input type="submit" name="submit" value="{{$submit}}">
- </div>
- <div id="group-edit-select-end"></div>
- </form>
-</div>
-{{/if}}
-
-
-{{if $groupeditor}}
- <div id="group-update-wrapper">
- {{include file="groupeditor.tpl"}}
- </div>
-{{/if}}
-{{if $desc}}<div class="clear" id="group-edit-desc">{{$desc nofilter}}</div>{{/if}}
+++ /dev/null
-
-<div class="field custom">
-<label for="group-selection" id="group-selection-lbl">{{$label}}</label>
-<select name="group-selection" id="group-selection">
-{{foreach $groups as $group}}
-<option value="{{$group.id}}"{{if $group.selected}} selected="selected"{{/if}}>{{$group.name}}</option>
-{{/foreach}}
-</select>
-</div>
+++ /dev/null
-<span id="group-sidebar-inflated" class="widget fakelink" onclick="openCloseWidget('group-sidebar', 'group-sidebar-inflated');">
- <h3>{{$title}}</h3>
-</span>
-<div class="widget" id="group-sidebar">
- <span class="fakelink" onclick="openCloseWidget('group-sidebar', 'group-sidebar-inflated');">
- <h3>{{$title}}</h3>
- </span>
-
- <div id="sidebar-group-list">
- <ul role="menu" id="sidebar-group-ul">
- {{foreach $groups as $group}}
- <li role="menuitem" class="sidebar-group-li group-{{$group.id}}">
- {{if ! $newgroup}}<span class="notify badge pull-right"></span>{{/if}}
- {{if $group.cid}}
- <input type="checkbox"
- class="{{if $group.selected}}ticked{{else}}unticked {{/if}} action"
- onclick="return contactgroupChangeMember(this, '{{$group.id}}','{{$group.cid}}');"
- {{if $group.ismember}}checked="checked"{{/if}}
- />
- {{/if}}
- {{if $group.edit}}
- <a class="groupsideedit" href="{{$group.edit.href}}" title="{{$edittext}}">
- <span id="edit-sidebar-group-element-{{$group.id}}" class="group-edit-icon iconspacer small-pencil"><span class="sr-only">{{$edittext}}</span></span>
- </a>
- {{/if}}
- <a id="sidebar-group-element-{{$group.id}}" class="sidebar-group-element {{if $group.selected}}group-selected{{/if}}" href="{{$group.href}}">{{$group.text}}</a>
- </li>
- {{/foreach}}
- </ul>
- </div>
-
- {{if $newgroup}}
- <div id="sidebar-new-group">
- <a onclick="javascript:$('#group-new-form').fadeIn('fast');return false;">{{$createtext}}</a>
- <form id="group-new-form" action="group/new" method="post" style="display:none;">
- <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
- <input name="groupname" id="id_groupname" placeholder="{{$creategroup}}">
- </form>
- </div>
- {{else}}
- <div id="sidebar-edit-groups"><a href="{{$grouppage}}">{{$editgroupstext}}</a></div>
- {{/if}}
-
- {{if $ungrouped}}<div id="sidebar-ungrouped"><a class="{{if $ungrouped_selected}}group-selected{{/if}}" href="nogroup">{{$ungrouped}}</a></div>{{/if}}
-</div>
-<script>
-initWidget('group-sidebar', 'group-sidebar-inflated');
-</script>
+++ /dev/null
-
-{{* Template for the contact group list *}}
-
-{{if $editable == 1}}
-{{* The contacts who are already members of the contact group *}}
-<div id="group">
- <h3>{{$groupeditor.label_members}}</h3>
- <div id="group-members" class="contact_list">
-
- {{if $groupeditor.members }}
-
- {{foreach $groupeditor.members as $c}}
- {{* If there are too many contacts we use another view mode *}}
- {{if $shortmode}}
- <div class="contact-block-textdiv mpgroup">
- <a class="contact-block-link mpgroup fakelink" target="redir" onclick="groupChangeMember({{$c.change_member.gid}},{{$c.change_member.cid}},'{{$c.change_member.sec_token}}'); return true;" title="{{$c.name}} [{{$c.itemurl}}]" alt="{{$c.name}}">
- {{$c.name}}"
- </a>
- </div>
- {{else}}
- {{* The normal view mode *}}
- <div class="contact-block-div mpgroup">
- <a class="contact-block-link mpgroup fakelink" target="redir" onclick="groupChangeMember({{$c.change_member.gid}},{{$c.change_member.cid}},'{{$c.change_member.sec_token}}'); return true;">
- <img class="contact-block-img mpgroup " src="{{$c.thumb}}" title="{{$c.name}} [{{$c.itemurl}}]" alt="{{$c.name}}">
- </a>
- </div>
- {{/if}}
- {{/foreach}}
-
- {{else}}
- {{$groupeditor.group_is_empty}}
- {{/if}}
- </div>
-
- <div id="group-members-end"></div>
- <hr id="group-separator" />
-</div>
-{{/if}}
-
-{{* The contacts who are not members of the contact group *}}
-<div id="contacts">
- <h3>{{$groupeditor.label_contacts}}</h3>
- <div id="group-all-contacts" class="contact_list">
- {{foreach $groupeditor.contacts as $m}}
- <div class="contact-block-textdiv mpall">
- {{if $editable == 1}}
- <a class="contact-block-link mpall fakelink" target="redir" onclick="groupChangeMember({{$m.change_member.gid}},{{$m.change_member.cid}},'{{$m.change_member.sec_token}}'); return true;" title="{{$m.name}} [{{$m.itemurl}}]" alt="{{$m.name}}">
- {{else}}
- <a class="contact-block-link mpall" href="{{$m.url}}" title="{{$m.name}} [{{$m.itemurl}}]" alt="{{$m.name}}">
- {{/if}}
- {{* If there are too many contacts we use another view mode *}}
- {{if $shortmode}}
- {{$m.name}}
- {{else}}
- <img class="contact-block-img mpall " src="{{$m.thumb}}" title="{{$m.name}} [{{$m.itemurl}}]" alt="{{$m.name}}">
- {{/if}}
- </a>
- </div>
- {{/foreach}}
- </div>
- <div id="group-all-contacts-end"></div>
-</div>
{{if $scheduled_at}}{{$scheduled_at nofilter}}{{/if}}
{{if $created_at}}{{$created_at nofilter}}{{/if}}
{{else}}
- <input type="hidden" name="group_allow" value="{{$group_allow}}"/>
+ <input type="hidden" name="circle_allow" value="{{$circle_allow}}"/>
<input type="hidden" name="contact_allow" value="{{$contact_allow}}"/>
- <input type="hidden" name="group_deny" value="{{$group_deny}}"/>
+ <input type="hidden" name="circle_deny" value="{{$circle_deny}}"/>
<input type="hidden" name="contact_deny" value="{{$contact_deny}}"/>
{{/if}}
</form>
</div>
</div>
<script>
- dzFactory.setupDropzone('#dropzone-{{$id}}', 'comment-edit-text-{{$id}}');
-</script>
\ No newline at end of file
+ dzFactory.setupDropzone('#dropzone-{{$id}}', 'comment-edit-text-{{$id}}');
+</script>
$(document).ready(function() {
- $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
+ $('#contact_allow, #contact_deny, #circle_allow, #circle_deny').change(function() {
var selstr;
- $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
+ $('#contact_allow option:selected, #contact_deny option:selected, #circle_allow option:selected, #circle_deny option:selected').each( function() {
selstr = $(this).html();
$('#jot-perms-icon').removeClass('unlock').addClass('lock');
$('#jot-public').hide();
});
- if(selstr == null) {
+ if(selstr == null) {
$('#jot-perms-icon').removeClass('lock').addClass('unlock');
$('#jot-public').show();
}
{{include file="field_checkbox.tpl" field=$unkmail}}
{{include file="field_input.tpl" field=$cntunkmail}}
- {{$group_select nofilter}}
+ {{$circle_select nofilter}}
{{if not $is_community}}
<h3>{{$permissions}}</h3>
<input type="submit" name="relocate-submit" class="settings-submit" value="{{$relocate_button}}"/>
</div>
</form>
-</div>
\ No newline at end of file
+</div>
$(document).ready(function() {
- $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
+ $('#contact_allow, #contact_deny, #circle_allow, #circle_deny').change(function() {
var selstr;
- $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
+ $('#contact_allow option:selected, #contact_deny option:selected, #circle_allow option:selected, #circle_deny option:selected').each( function() {
selstr = $(this).html();
$('#jot-perms-icon').removeClass('unlock').addClass('lock');
$('#jot-public').hide();
});
- if(selstr == null) {
+ if(selstr == null) {
$('#jot-perms-icon').removeClass('lock').addClass('unlock');
$('#jot-public').show();
}
}).trigger('change');
-
+
$('.settings-content-block').hide();
$('.settings-heading').click(function(){
$('.settings-content-block').hide();
{{$finding_txt nofilter}}
</li>
</ul>
- <h4>{{$groups nofilter}}</h4>
+ <h4>{{$circles nofilter}}</h4>
<ul>
<li>
- <a target="newmember" href="contact">{{$group_contact_link}}</a><br />
- {{$group_contact_txt nofilter}}
+ <a target="newmember" href="contact">{{$circle_contact_link}}</a><br />
+ {{$circle_contact_txt nofilter}}
</li>
{{if $newuser_private}}
<li>
- <a target="newmember" href="help/Groups-and-Privacy">{{$private_link}}</a><br />
+ <a target="newmember" href="help/Circles-and-Privacy">{{$private_link}}</a><br />
{{$private_txt nofilter}}
</li>
{{/if}}
/* Contact-Header for the Network Stream */
#viewcontact_wrapper-network {background-image: url('imgdarkzero/head.jpg');}
-.wall-item-content-wrapper {
- border: 1px solid #444444;
- background: #444444;
+.wall-item-content-wrapper {
+ border: 1px solid #444444;
+ background: #444444;
}
.wall-item-outside-wrapper.threaded > .wall-item-content-wrapper {
-moz-border-radius: 3px 3px 0px;
- border-radius: 3px 3px 0px;
+ border-radius: 3px 3px 0px;
}
.wall-item-tools { background-color: #444444; background-image: none;}
.comment-wwedit-wrapper{
border: solid #444444;
border-width: 0px 3px 3px;
-moz-border-radius: 0px 0px 3px 3px;
- border-radius: 0px 0px 3px 3px;
+ border-radius: 0px 0px 3px 3px;
}
.editicon {
background-color: #333;
background-image: url('imgdarkzero/sectionend.jpg');
background-position: top left;
background-repeat: repeat-x;
- height: 25px;
+ height: 25px;
}
#jot-title:-moz-placeholder{color: #555555!important;}
#jot-category::-webkit-input-placeholder{ color: #555555!important;}
#jot-category:-moz-placeholder{color: #555555!important;}
-
-
+
+
#jot-title:hover,
#jot-title:focus,
#jot-category:hover,
#jot-category:focus {
- border: 1px solid #cccccc;
+ border: 1px solid #cccccc;
}
#profile-jot-email-label, div#jot-preview-content, div.profile-jot-net {
background:#2e2f2e;
}
-.widget .selected, .group-selected {
+.widget .selected, .circle-selected {
background:#2e2f2e;
}
}
-.contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo, .profile-jot-text, .group-selected, .widget .selected, #profile-jot-submit {
+.contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo, .profile-jot-text, .circle-selected, .widget .selected, #profile-jot-submit {
border-radius: 3px;
-moz-border-radius: 3px;
box-shadow: 4px 4px 3px 0 #444444;
cursor: pointer;
}
-#group-sidebar {
+#circle-sidebar {
margin-bottom: 10px;
}
-.widget .selected, .group-selected, .forum-selected {
+.widget .selected, .circle-selected, .forum-selected {
padding: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
overflow: auto;
}
-#group-new-submit-wrapper {
+#circle-new-submit-wrapper {
margin-top: 30px;
}
-#group-edit-name-label {
+#circle-edit-name-label {
float: left;
width: 175px;
margin-top: 20px;
margin-bottom: 20px;
}
-#group-edit-name {
+#circle-edit-name {
float: left;
width: 225px;
margin-top: 20px;
margin-bottom: 20px;
}
-#group-edit-name-wrapper {
+#circle-edit-name-wrapper {
}
-#group_members_select_label {
+#circle_members_select_label {
display: block;
float: left;
width: 175px;
}
-.group_members_select {
+.circle_members_select {
float: left;
width: 230px;
overflow: auto;
}
-#group_members_select_end {
+#circle_members_select_end {
clear: both;
}
-#group-edit-name-end {
+#circle-edit-name-end {
clear: both;
}
clear: both;
}
-#sidebar-group-list ul {
+#sidebar-circle-list ul {
list-style-type: none;
}
-.sidebar-group-li .notify, .forum-widget-entry .notify {
+.sidebar-circle-li .notify, .forum-widget-entry .notify {
display: none;
font-size: 9px;
border: 1px solid rgb(221, 221, 221);
float: right;
background-color: #BABDB6;
}
-.sidebar-group-li .notify.show, .forum-widget-entry .notify.show {
+.sidebar-circle-li .notify.show, .forum-widget-entry .notify.show {
display: block;
}
-#sidebar-group-list .icon, #sidebar-group-list .iconspacer {
+#sidebar-circle-list .icon, #sidebar-circle-list .iconspacer {
display: inline-block;
height: 12px;
width: 12px;
}
-#sidebar-group-list li {
+#sidebar-circle-list li {
margin-top: 10px;
}
#search-save {
margin-left: 5px;
}
-.groupsideedit {
+.circlesideedit {
margin-right: 10px;
}
#saved-search-ul {
margin-left: 200px;
}
-.group-delete-wrapper {
+.circle-delete-wrapper {
float: right;
margin-right: 50px;
}
margin-bottom: 15px;
}
-#group-members {
+#circle-members {
margin-top: 20px;
padding: 10px;
height: 250px;
border: 1px solid #ddd;
}
-#group-members-end {
+#circle-members-end {
clear: both;
}
-#group-separator {
+#circle-separator {
margin-top: 10px;
margin-bottom: 10px;
}
-#group-all-contacts {
+#circle-all-contacts {
padding: 10px;
height: 450px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-all-contacts-end {
+#circle-all-contacts-end {
clear: both;
margin-bottom: 10px;
}
-#group-edit-desc {
+#circle-edit-desc {
margin-top: 15px;
}
$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
- $('.group-edit-icon').hover(
+ $('.circle-edit-icon').hover(
function() {
$(this).addClass('icon'); $(this).removeClass('iconspacer');},
function() {
$(this).removeClass('icon'); $(this).addClass('iconspacer');}
);
- $('.sidebar-group-element').hover(
+ $('.sidebar-circle-element').hover(
function() {
id = $(this).attr('id');
$('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
opacity: 0.7;
}
.forum-widget-entry .badge,
-.sidebar-group-li .badge {
+.sidebar-circle-li .badge {
margin-top: 6px;
}
padding: 2px 8px;
}
-div#sidebar-group-header h3 {
+div#sidebar-circle-header h3 {
float: left;
}
-div#sidebar-group-list {
+div#sidebar-circle-list {
clear: both;
}
-.group-new-form {
+.circle-new-form {
clear: both;
}
-.group-edit-tool {
+.circle-edit-tool {
padding-top: 0;
color: $font_color_darker;
}
-.sidebar-widget-header .group-edit-tool {
+.sidebar-widget-header .circle-edit-tool {
margin-top: -5px;
}
aside .widget-action {
padding: 5px 10px;
}
-aside #group-sidebar .sidebar-group-li .group-edit-tool.faded-icon:hover,
+aside #circle-sidebar .sidebar-circle-li .circle-edit-tool.faded-icon:hover,
aside #saved-search-list .saved-search-li .savedsearchdrop.faded-icon:hover,
aside .widget.widget-action.faded-icon:hover {
opacity: 0.8;
transition: all 0.25s ease-in-out;
}
-aside #group-sidebar .sidebar-group-li .group-edit-tool.faded-icon:hover,
+aside #circle-sidebar .sidebar-circle-li .circle-edit-tool.faded-icon:hover,
aside #saved-search-list .saved-search-li .savedsearchdrop.faded-icon:hover,
aside .widget .widget-action.faded-icon:hover {
opacity: 1;
}
-aside #group-sidebar li .group-checkbox {
+aside #circle-sidebar li .circle-checkbox {
margin: 6px 0 0;
}
-aside #group-sidebar li .group-edit-tool {
+aside #circle-sidebar li .circle-edit-tool {
padding-right: 10px;
}
-aside #group-sidebar li .group-edit-tool:first-child {
+aside #circle-sidebar li .circle-edit-tool:first-child {
padding-right: 0px;
}
.dfrn_request-content-wrapper,
.friendica-content-wrapper,
.credits-content-wrapper,
-.nogroup-content-wrapper,
+.nocircle-content-wrapper,
.profperm-content-wrapper,
.invite-content-wrapper,
.tos-content-wrapper,
padding-top: 10px;
}
-/* group edit page */
-.group-actions {
+/* circle edit page */
+.circle-actions {
margin-top: 4px;
margin-bottom: 10px;
font-size: 30px;
}
-.group-actions button,
-.group-actions a {
+.circle-actions button,
+.circle-actions a {
font-size: 18px;
}
-.contact-group-actions .fa-times-circle {
+.contact-circle-actions .fa-times-circle {
color: #d00000;
}
-.contact-group-actions .fa-plus-circle {
+.contact-circle-actions .fa-plus-circle {
color: #008000;
}
-#group-edit-wrapper {
+#circle-edit-wrapper {
margin-top: 14px;
display: none;
}
-#group-edit-header {
+#circle-edit-header {
display: block;
}
-#group-update-wrapper .contact-photo-overlay {
+#circle-update-wrapper .contact-photo-overlay {
display: none;
}
-#group-update-wrapper .viewcontact_wrapper .contact-group-actions {
+#circle-update-wrapper .viewcontact_wrapper .contact-circle-actions {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
-#group-update-wrapper .viewcontact_wrapper .contact-group-link {
+#circle-update-wrapper .viewcontact_wrapper .contact-circle-link {
opacity: 0.8;
font-size: 20px;
}
-#group-update-wrapper .viewcontact_wrapper .contact-action-link:hover {
+#circle-update-wrapper .viewcontact_wrapper .contact-action-link:hover {
opacity: 1;
}
-#group-update-wrapper .shortmode {
+#circle-update-wrapper .shortmode {
height: 53px;
overflow: hidden;
}
-#group-update-wrapper .shortmode .contact-photo {
+#circle-update-wrapper .shortmode .contact-photo {
height: 32px;
width: 32px;
}
-#group-update-wrapper .shortmode .media {
+#circle-update-wrapper .shortmode .media {
overflow: hidden;
}
-#group-update-wrapper .shortmode .contact-entry-desc {
+#circle-update-wrapper .shortmode .contact-entry-desc {
font-size: 12px !important;
}
-#group-update-wrapper .shortmode .contact-entry-desc h4.media-heading {
+#circle-update-wrapper .shortmode .contact-entry-desc h4.media-heading {
margin: 0;
}
-#group-update-wrapper .shortmode .contact-entry-desc h4.media-heading a {
+#circle-update-wrapper .shortmode .contact-entry-desc h4.media-heading a {
font-size: 13px !important;
white-space: nowrap;
}
-#group-update-wrapper .shortmode .contact-entry-desc .contact-entry-rel,
-#group-update-wrapper .shortmode .contact-entry-desc .contact-entry-network {
+#circle-update-wrapper .shortmode .contact-entry-desc .contact-entry-rel,
+#circle-update-wrapper .shortmode .contact-entry-desc .contact-entry-network {
display: none;
}
content: "\f0da"; /* Right Plain Pointer */
}
.widget > .fakelink > h3:before,
-#sidebar-group-header > .fakelink > h3:before {
+#sidebar-circle-header > .fakelink > h3:before {
font-family: ForkAwesome;
content: "\f0d7"; /* Bottom Plain Pointer */
}
.dfrn_request-content-wrapper,
.friendica-content-wrapper,
.credits-content-wrapper,
- .nogroup-content-wrapper,
+ .nocircle-content-wrapper,
.profperm-content-wrapper,
.invite-content-wrapper,
.tos-content-wrapper,
--- /dev/null
+// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
+
+/**
+ * @file view/theme/frio/js/mod_circle.js
+ * The javascript for the circle module
+ */
+
+$(document).ready(function () {
+ // Add an event listeners on buttons for switching the contact list view
+ $("body").on("click", ".circle-list-switcher", function () {
+ switchCircleViewMode(this);
+ });
+});
+
+/**
+ * Change the circle membership of the contacts and fetch the new grup list
+ * as html
+ *
+ * @param {int} gid The circle ID
+ * @param {int} cid The contact ID
+ * @param {string} sec_token The security token
+ *
+ * @returns {undefined}
+ */
+function circleChangeMember(gid, cid, sec_token) {
+ $("#contact-entry-wrapper-" + cid).fadeTo("fast", 0.33);
+ $(".tooltip").tooltip("hide");
+ $("body").css("cursor", "wait");
+
+ $.get("circle/" + gid + "/" + cid + "?t=" + sec_token, function (data) {
+ // Insert the new circle member list
+ $("#circle-update-wrapper").html(data);
+
+ // Apply the actual circle list view mode to the new
+ // circle list html
+ var activeMode = $(".circle-list-switcher.active");
+ switchCircleViewMode(activeMode[0]);
+
+ $("body").css("cursor", "auto");
+ });
+}
+
+/**
+ * Change the circle list view mode
+ *
+ * @param {object} elm The button element of the view mode switcher
+ * @returns {undefined}
+ */
+function switchCircleViewMode(elm) {
+ // Remove the active class from circle list switcher buttons
+ $(".circle-list-switcher").removeClass("active");
+ // And add it to the active button element
+ $(elm).addClass("active");
+
+ // Add or remove the css classes for the circle list with regard to the active view mode
+ if (elm.id === "circle-list-small") {
+ $("#contact-circle-list > li").addClass("shortmode col-lg-6 col-md-6 col-sm-6 col-xs-12");
+ } else {
+ $("#contact-circle-list > li").removeClass("shortmode col-lg-6 col-md-6 col-sm-6 col-xs-12");
+ }
+}
+
+/**
+ * Filter the circle member list for contacts
+ *
+ * @returns {undefined}
+ */
+function filterList() {
+ // Declare variables
+ var input, filter, ul, li, a, i;
+ input = document.getElementById("contacts-search");
+ filter = input.value.toUpperCase();
+ li = document.querySelectorAll("#contact-circle-list>li");
+
+ // Loop through all list items, and hide those who don't match the search query
+ for (i = 0; i < li.length; i++) {
+ // Get the heading element
+ var mh = li[i].getElementsByClassName("media-heading")[0];
+ // The first child of the heading element should contain
+ // the text which we want to filter
+ a = mh.firstChild;
+ if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
+ li[i].style.display = "";
+ } else {
+ li[i].style.display = "none";
+ }
+ }
+}
+// @license-end
.trigger("change");
// JS for the permission section.
- $("#contact_allow, #contact_deny, #group_allow, #group_deny")
+ $("#contact_allow, #contact_deny, #circle_allow, #circle_deny")
.change(function () {
var selstr;
$(
- "#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected",
+ "#contact_allow option:selected, #contact_deny option:selected, #circle_allow option:selected, #circle_deny option:selected",
).each(function () {
selstr = $(this).html();
$("#jot-public").hide();
+++ /dev/null
-// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
-
-/**
- * @file view/theme/frio/js/mod_group.js
- * The javascript for the group module
- */
-
-$(document).ready(function () {
- // Add an event listeners on buttons for switching the contact list view
- $("body").on("click", ".group-list-switcher", function () {
- switchGroupViewMode(this);
- });
-});
-
-/**
- * Change the group membership of the contacts and fetch the new grup list
- * as html
- *
- * @param {int} gid The group ID
- * @param {int} cid The contact ID
- * @param {string} sec_token The security token
- *
- * @returns {undefined}
- */
-function groupChangeMember(gid, cid, sec_token) {
- $("#contact-entry-wrapper-" + cid).fadeTo("fast", 0.33);
- $(".tooltip").tooltip("hide");
- $("body").css("cursor", "wait");
-
- $.get("group/" + gid + "/" + cid + "?t=" + sec_token, function (data) {
- // Insert the new group member list
- $("#group-update-wrapper").html(data);
-
- // Apply the actual group list view mode to the new
- // group list html
- var activeMode = $(".group-list-switcher.active");
- switchGroupViewMode(activeMode[0]);
-
- $("body").css("cursor", "auto");
- });
-}
-
-/**
- * Change the group list view mode
- *
- * @param {object} elm The button element of the view mode switcher
- * @returns {undefined}
- */
-function switchGroupViewMode(elm) {
- // Remove the active class from group list switcher buttons
- $(".group-list-switcher").removeClass("active");
- // And add it to the active button element
- $(elm).addClass("active");
-
- // Add or remove the css classes for the group list with regard to the active view mode
- if (elm.id === "group-list-small") {
- $("#contact-group-list > li").addClass("shortmode col-lg-6 col-md-6 col-sm-6 col-xs-12");
- } else {
- $("#contact-group-list > li").removeClass("shortmode col-lg-6 col-md-6 col-sm-6 col-xs-12");
- }
-}
-
-/**
- * Filter the group member list for contacts
- *
- * @returns {undefined}
- */
-function filterList() {
- // Declare variables
- var input, filter, ul, li, a, i;
- input = document.getElementById("contacts-search");
- filter = input.value.toUpperCase();
- li = document.querySelectorAll("#contact-group-list>li");
-
- // Loop through all list items, and hide those who don't match the search query
- for (i = 0; i < li.length; i++) {
- // Get the heading element
- var mh = li[i].getElementsByClassName("media-heading")[0];
- // The first child of the heading element should contain
- // the text which we want to filter
- a = mh.firstChild;
- if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
- li[i].style.display = "";
- } else {
- li[i].style.display = "none";
- }
- }
-}
-// @license-end
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
$(document).ready(function () {
- $("#contact_allow, #contact_deny, #group_allow, #group_deny")
+ $("#contact_allow, #contact_deny, #circle_allow, #circle_deny")
.change(function () {
var selstr;
$(
- "#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected",
+ "#contact_allow option:selected, #contact_deny option:selected, #circle_allow option:selected, #circle_deny option:selected",
).each(function () {
selstr = $(this).html();
$("#jot-perms-icon").removeClass("unlock").addClass("lock");
return false;
});
- // add the class "selected" to group widgets li if li > a does have the class group-selected
- if ($("#sidebar-group-ul li a").hasClass("group-selected")) {
- $("#sidebar-group-ul li a.group-selected").parent("li").addClass("selected");
+ // add the class "selected" to circle widgets li if li > a does have the class circle-selected
+ if ($("#sidebar-circle-ul li a").hasClass("circle-selected")) {
+ $("#sidebar-circle-ul li a.circle-selected").parent("li").addClass("selected");
}
// add the class "selected" to forums widgets li if li > a does have the class forum-selected
.dfrn_request-content-wrapper,
.friendica-content-wrapper,
.credits-content-wrapper,
-.nogroup-content-wrapper,
+.nocircle-content-wrapper,
.profperm-content-wrapper,
.invite-content-wrapper,
.tos-content-wrapper,
</div>
<div id="admin-settings-performance-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-performance">
<div class="panel-body">
- {{include file="field_checkbox.tpl" field=$compute_group_counts}}
+ {{include file="field_checkbox.tpl" field=$compute_circle_counts}}
{{include file="field_checkbox.tpl" field=$only_tag_search}}
{{include file="field_input.tpl" field=$max_comments}}
{{include file="field_input.tpl" field=$max_display_comments}}
--- /dev/null
+
+{{* Link for deleting contact circles *}}
+<a href="circle/drop/{{$id}}?t={{$form_security_token}}" onclick="return confirmDelete();" id="circle-delete-icon-{{$id}}" class="btn btn-clear" title="{{$delete}}" data-toggle="tooltip">
+ <i class="fa fa-trash" aria-hidden="true"></i>
+</a>
--- /dev/null
+{{* This template is for the "circle" module. It provides the user the possibility to
+ modify a specific contact circle (remove contact circle, edit contact circle name,
+ add or remove contacts to the contact circle.
+*}}
+
+<script type="text/javascript" src="view/theme/frio/js/mod_circle.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
+
+<div class="generic-page-wrapper">
+ {{if $editable == 1}}
+ {{* The buttons for editing the contact circle (edit name / remove contact circle) *}}
+ <div class="circle-actions pull-right">
+ <button type="button" id="circle-rename" class="btn btn-clear" onclick="showHide('circle-edit-wrapper'); showHide('circle-edit-header'); return false;" title="{{$edit_name}}" data-toggle="tooltip">
+ <i class="fa fa-pencil" aria-hidden="true"></i>
+ </button>
+ {{if $drop}}{{$drop nofilter}}{{/if}}
+ </div>
+ {{/if}}
+
+ <div class="section-title-wrapper">
+ <div id="circle-edit-header">
+ <h2>{{$title}}</h2>
+ </div>
+
+ {{* Edit the name of the circle *}}
+ <div id="circle-edit-wrapper">
+
+ <form action="circle/{{$gid}}" id="circle-edit-form" method="post">
+ <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+
+ <div class="pull-left">
+ {{include file="field_input.tpl" field=$gname label=false}}
+ </div>
+ <div id="circle-edit-submit-wrapper" class="form-group pull-right">
+ <button class="btn btn-primary btn-small" type="submit" name="submit" value="{{$submit}}">
+ {{$submit}}
+ </button>
+ </div>
+ </form>
+ </div>
+
+ <div class="clear"></div>
+ </div>
+
+ {{* The search input field to search for contacts *}}
+ <div id="contacts-search-wrapper">
+ <form id="contacts-search-form" class="navbar-form" role="search" method="get">
+ <div class="row">
+ <div class="form-group form-group-search">
+ <input type="text" name="search" id="contacts-search" class="search-input form-control form-search" onfocus="this.select();" onkeyup="filterList(); return false;" />
+ <button class="btn btn-default btn-sm form-button-search" onclick="filterList(); return false;">{{$submit_filter}}</button>
+ </div>
+ </div>
+ </form>
+ </div>
+
+ <div id="contacts-search-end"></div>
+
+ {{if $circle_editor}}
+ {{* The buttons to switch between the different view modes *}}
+ <div id="circle-list-view-switcher" class="btn-group btn-group-sm pull-right">
+ <button type="button" id="circle-list-big" class="active circle-list-switcher btn btn-default">
+ <i class="fa fa-align-justify" aria-hidden="true"></i>
+ </button>
+ <button type="button" id="circle-list-small" class="btn btn-default circle-list-switcher">
+ <i class="fa fa-th-large" aria-hidden="true"></i>
+ </button>
+ </div>
+ <div class="clear"></div>
+
+ {{* The contact circle list *}}
+ <div id="circle-update-wrapper">
+ {{include file="circle_editor.tpl"}}
+ </div>
+ {{/if}}
+</div>
--- /dev/null
+
+{{* Template for the contact circle list *}}
+<div id="circle" class="contact_list">
+
+ <ul id="contact-circle-list" class="viewcontact_wrapper media-list">
+
+ {{* The contacts who are already members of the contact circle *}}
+ {{foreach $circle_editor.members as $contact}}
+ <li class="members active">{{include file="contact/entry.tpl"}}</li>
+ {{/foreach}}
+
+ {{* The contacts who are not members of the contact circle *}}
+ {{foreach $circle_editor.contacts as $contact}}
+ <li class="contacts">{{include file="contact/entry.tpl"}}</li>
+ {{/foreach}}
+
+ </ul>
+ <div class="clear"></div>
+</div>
--- /dev/null
+<span id="circle-sidebar-inflated" class="widget fakelink" onclick="openCloseWidget('circle-sidebar', 'circle-sidebar-inflated');">
+ <h3>{{$title}}</h3>
+</span>
+<div class="widget" id="circle-sidebar">
+ <div id="sidebar-circle-header" class="sidebar-widget-header">
+ <span class="fakelink" onclick="openCloseWidget('circle-sidebar', 'circle-sidebar-inflated');">
+ <h3>{{$title}}</h3>
+ </span>
+ {{if ! $new_circle}}
+ <a class="circle-edit-tool pull-right widget-action faded-icon" id="sidebar-edit-circle" href="{{$circle_page}}" data-toggle="tooltip" title="{{$edit_circles_text}}">
+ <i class="fa fa-pencil" aria-hidden="true"></i>
+ </a>
+ {{else}}
+ <a class="circle-edit-tool pull-right widget-action faded-icon" id="sidebar-new-circle" onclick="javascript:$('#circle-new-form').fadeIn('fast');" data-toggle="tooltip" title="{{$createtext}}">
+ <i class="fa fa-plus" aria-hidden="true"></i>
+ </a>
+ <form id="circle-new-form" action="circle/new" method="post" style="display:none;">
+ <div class="form-group">
+ <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+ <input name="circle_name" id="id_circle_name" class="form-control input-sm" placeholder="{{$create_circle}}">
+ </div>
+ </form>
+ {{/if}}
+ </div>
+ <div id="sidebar-circle-list" class="sidebar-widget-list">
+ {{* The list of available circles *}}
+ <ul role="menu" id="sidebar-circle-ul">
+ {{foreach $circles as $circle}}
+ <li role="menuitem" class="sidebar-circle-li circle-{{$circle.id}} {{if $circle.selected}}selected{{/if}}">
+ {{if ! $new_circle}}<span class="notify badge pull-right"></span>{{/if}}
+ {{if $circle.cid}}
+ <div class="checkbox pull-right circle-checkbox ">
+ <input type="checkbox"
+ id="sidebar-circle-checkbox-{{$circle.id}}"
+ class="{{if $circle.selected}}ticked{{else}}unticked {{/if}} action"
+ onclick="return contactCircleChangeMember(this, '{{$circle.id}}','{{$circle.cid}}');"
+ {{if $circle.ismember}}checked="checked"{{/if}}
+ aria-checked="{{if $circle.ismember}}true{{else}}false{{/if}}"
+ />
+ <label for="sidebar-circle-checkbox-{{$circle.id}}"></label>
+ <div class="clearfix"></div>
+ </div>
+ {{/if}}
+ {{if $circle.edit}}
+ {{* if the circle is editable show a little pencil for editing *}}
+ <a id="edit-sidebar-circle-element-{{$circle.id}}" class="circle-edit-tool pull-right faded-icon" href="{{$circle.edit.href}}" data-toggle="tooltip" title="{{$edittext}}">
+ <i class="fa fa-pencil" aria-hidden="true"></i>
+ </a>
+ {{/if}}
+ <a id="sidebar-circle-element-{{$circle.id}}" class="sidebar-circle-element" href="{{$circle.href}}">{{$circle.text}}</a>
+ </li>
+ {{/foreach}}
+
+ {{if $uncircled}}<li class="{{if $uncircled_selected}}selected{{/if}} sidebar-circle-li" id="sidebar-uncircled"><a href="nocircle">{{$uncircled}}</a></li>{{/if}}
+ </ul>
+ </div>
+</div>
+<script>
+initWidget('circle-sidebar', 'circle-sidebar-inflated');
+</script>
{{* The button to add or remove contacts from a contact group - group edit page *}}
{{if $contact.change_member}}
<div class="contact-group-actions pull-right nav-pills preferences">
- <button type="button" class="contact-action-link btn contact-group-link btn-default" onclick="groupChangeMember({{$contact.change_member.gid}},{{$contact.change_member.cid}},'{{$contact.change_member.sec_token}}'); return true;" data-toggle="tooltip" title="{{$contact.change_member.title}}">
+ <button type="button" class="contact-action-link btn contact-group-link btn-default" onclick="circleChangeMember({{$contact.change_member.gid}},{{$contact.change_member.cid}},'{{$contact.change_member.sec_token}}'); return true;" data-toggle="tooltip" title="{{$contact.change_member.title}}">
{{if $contact.label == "members"}}
<i class="fa fa-times-circle" aria-hidden="true"></i>
{{elseif $contact.label == "contacts"}}
+++ /dev/null
-
-{{* Link for deleting contact groups *}}
-<a href="group/drop/{{$id}}?t={{$form_security_token}}" onclick="return confirmDelete();" id="group-delete-icon-{{$id}}" class="btn btn-clear" title="{{$delete}}" data-toggle="tooltip">
- <i class="fa fa-trash" aria-hidden="true"></i>
-</a>
+++ /dev/null
-{{* This template is for the "group" module. It provides the user the possibility to
- modify a specific contact group (remove contact group, edit contact group name,
- add or remove contacts to the contact group.
-*}}
-
-<script type="text/javascript" src="view/theme/frio/js/mod_group.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
-
-<div class="generic-page-wrapper">
- {{if $editable == 1}}
- {{* The buttons for editing the contact group (edit name / remove contact group) *}}
- <div class="group-actions pull-right">
- <button type="button" id="group-rename" class="btn btn-clear" onclick="showHide('group-edit-wrapper'); showHide('group-edit-header'); return false;" title="{{$edit_name}}" data-toggle="tooltip">
- <i class="fa fa-pencil" aria-hidden="true"></i>
- </button>
- {{if $drop}}{{$drop nofilter}}{{/if}}
- </div>
- {{/if}}
-
- <div class="section-title-wrapper">
- <div id="group-edit-header">
- <h2>{{$title}}</h2>
- </div>
-
- {{* Edit the name of the group *}}
- <div id="group-edit-wrapper">
-
- <form action="group/{{$gid}}" id="group-edit-form" method="post">
- <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
-
- <div class="pull-left">
- {{include file="field_input.tpl" field=$gname label=false}}
- </div>
- <div id="group-edit-submit-wrapper" class="form-group pull-right">
- <button class="btn btn-primary btn-small" type="submit" name="submit" value="{{$submit}}">
- {{$submit}}
- </button>
- </div>
- </form>
- </div>
-
- <div class="clear"></div>
- </div>
-
- {{* The search input field to search for contacts *}}
- <div id="contacts-search-wrapper">
- <form id="contacts-search-form" class="navbar-form" role="search" method="get">
- <div class="row">
- <div class="form-group form-group-search">
- <input type="text" name="search" id="contacts-search" class="search-input form-control form-search" onfocus="this.select();" onkeyup="filterList(); return false;" />
- <button class="btn btn-default btn-sm form-button-search" onclick="filterList(); return false;">{{$submit_filter}}</button>
- </div>
- </div>
- </form>
- </div>
-
- <div id="contacts-search-end"></div>
-
- {{if $groupeditor}}
- {{* The buttons to switch between the different view modes *}}
- <div id="group-list-view-switcher" class="btn-group btn-group-sm pull-right">
- <button type="button" id="group-list-big" class="active group-list-switcher btn btn-default">
- <i class="fa fa-align-justify" aria-hidden="true"></i>
- </button>
- <button type="button" id="group-list-small" class="btn btn-default group-list-switcher">
- <i class="fa fa-th-large" aria-hidden="true"></i>
- </button>
- </div>
- <div class="clear"></div>
-
- {{* The contact group list *}}
- <div id="group-update-wrapper">
- {{include file="groupeditor.tpl"}}
- </div>
- {{/if}}
-</div>
+++ /dev/null
-<span id="group-sidebar-inflated" class="widget fakelink" onclick="openCloseWidget('group-sidebar', 'group-sidebar-inflated');">
- <h3>{{$title}}</h3>
-</span>
-<div class="widget" id="group-sidebar">
- <div id="sidebar-group-header" class="sidebar-widget-header">
- <span class="fakelink" onclick="openCloseWidget('group-sidebar', 'group-sidebar-inflated');">
- <h3>{{$title}}</h3>
- </span>
- {{if ! $newgroup}}
- <a class="group-edit-tool pull-right widget-action faded-icon" id="sidebar-edit-group" href="{{$grouppage}}" data-toggle="tooltip" title="{{$editgroupstext}}">
- <i class="fa fa-pencil" aria-hidden="true"></i>
- </a>
- {{else}}
- <a class="group-edit-tool pull-right widget-action faded-icon" id="sidebar-new-group" onclick="javascript:$('#group-new-form').fadeIn('fast');" data-toggle="tooltip" title="{{$createtext}}">
- <i class="fa fa-plus" aria-hidden="true"></i>
- </a>
- <form id="group-new-form" action="group/new" method="post" style="display:none;">
- <div class="form-group">
- <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
- <input name="groupname" id="id_groupname" class="form-control input-sm" placeholder="{{$creategroup}}">
- </div>
- </form>
- {{/if}}
- </div>
- <div id="sidebar-group-list" class="sidebar-widget-list">
- {{* The list of available groups *}}
- <ul role="menu" id="sidebar-group-ul">
- {{foreach $groups as $group}}
- <li role="menuitem" class="sidebar-group-li group-{{$group.id}} {{if $group.selected}}selected{{/if}}">
- {{if ! $newgroup}}<span class="notify badge pull-right"></span>{{/if}}
- {{if $group.cid}}
- <div class="checkbox pull-right group-checkbox ">
- <input type="checkbox"
- id="sidebar-group-checkbox-{{$group.id}}"
- class="{{if $group.selected}}ticked{{else}}unticked {{/if}} action"
- onclick="return contactgroupChangeMember(this, '{{$group.id}}','{{$group.cid}}');"
- {{if $group.ismember}}checked="checked"{{/if}}
- aria-checked="{{if $group.ismember}}true{{else}}false{{/if}}"
- />
- <label for="sidebar-group-checkbox-{{$group.id}}"></label>
- <div class="clearfix"></div>
- </div>
- {{/if}}
- {{if $group.edit}}
- {{* if the group is editable show a little pencil for editing *}}
- <a id="edit-sidebar-group-element-{{$group.id}}" class="group-edit-tool pull-right faded-icon" href="{{$group.edit.href}}" data-toggle="tooltip" title="{{$edittext}}">
- <i class="fa fa-pencil" aria-hidden="true"></i>
- </a>
- {{/if}}
- <a id="sidebar-group-element-{{$group.id}}" class="sidebar-group-element" href="{{$group.href}}">{{$group.text}}</a>
- </li>
- {{/foreach}}
-
- {{if $ungrouped}}<li class="{{if $ungrouped_selected}}selected{{/if}} sidebar-group-li" id="sidebar-ungrouped"><a href="nogroup">{{$ungrouped}}</a></li>{{/if}}
- </ul>
- </div>
-</div>
-<script>
-initWidget('group-sidebar', 'group-sidebar-inflated');
-</script>
+++ /dev/null
-
-{{* Template for the contact group list *}}
-<div id="group" class="contact_list">
-
- <ul id="contact-group-list" class="viewcontact_wrapper media-list">
-
- {{* The contacts who are already members of the contact group *}}
- {{foreach $groupeditor.members as $contact}}
- <li class="members active">{{include file="contact/entry.tpl"}}</li>
- {{/foreach}}
-
- {{* The contacts who are not members of the contact group *}}
- {{foreach $groupeditor.contacts as $contact}}
- <li class="contacts">{{include file="contact/entry.tpl"}}</li>
- {{/foreach}}
-
- </ul>
- <div class="clear"></div>
-</div>
{{include file="field_checkbox.tpl" field=$unkmail}}
{{include file="field_input.tpl" field=$cntunkmail}}
- {{$group_select nofilter}}
+ {{$circle_select nofilter}}
{{if not $is_community}}
<h3>{{$permissions}}</h3>
width: 48px;
height: 48px;
}
-/* group member */
+/* circle member */
#contact-edit-drop-link,
.mail-list-delete-wrapper,
-.group-delete-wrapper {
+.circle-delete-wrapper {
float: right;
margin-right: 50px;
}
#contact-edit-drop-link .drophide,
.mail-list-delete-wrapper .drophide,
-.group-delete-wrapper .drophide {
+.circle-delete-wrapper .drophide {
background-image: url('../../../images/icons/22/delete.png');
display: block;
width: 22px;
}
#contact-edit-drop-link .drop,
.mail-list-delete-wrapper .drop,
-.group-delete-wrapper .drop {
+.circle-delete-wrapper .drop {
background-image: url('../../../images/icons/22/delete.png');
display: block;
width: 22px;
top: -50px;
}
/*
-#group-members {
+#circle-members {
margin-top: 20px;
padding: 10px;
height: 250px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-members-end {
+#circle-members-end {
clear: both;
}
-#group-all-contacts {
+#circle-all-contacts {
padding: 10px;
height: 450px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-all-contacts-end {
+#circle-all-contacts-end {
clear: both;
margin-bottom: 10px;
}
ul.tabs li .active {
border-bottom: 1px solid #005c94;
}
-/** group editor **/
-#group-edit-desc {
+/** circle editor **/
+#circle-edit-desc {
margin-top: 1em;
color: #999999;
}
-#group-update-wrapper {
+#circle-update-wrapper {
height: auto;
overflow: auto;
}
-#group-update-wrapper #group {
+#circle-update-wrapper #circle {
width: 300px;
float: left;
margin-right: 20px;
}
-#group-update-wrapper #contacts {
+#circle-update-wrapper #contacts {
width: 300px;
float: left;
}
-#group-update-wrapper #group-separator {
+#circle-update-wrapper #circle-separator {
display: none;
}
-#group-update-wrapper .contact_list {
+#circle-update-wrapper .contact_list {
height: 300px;
border: 1px solid #364e59;
overflow: auto;
}
-#group-update-wrapper .contact_list .contact-block-div {
+#circle-update-wrapper .contact_list .contact-block-div {
width: 50px;
height: 50px;
float: left;
width: 48px;
height: 48px;
}
-/* group member */
+/* circle member */
#contact-edit-drop-link,
.mail-list-delete-wrapper,
-.group-delete-wrapper {
+.circle-delete-wrapper {
float: right;
margin-right: 50px;
}
#contact-edit-drop-link .drophide,
.mail-list-delete-wrapper .drophide,
-.group-delete-wrapper .drophide {
+.circle-delete-wrapper .drophide {
background-image: url('../../../images/icons/22/delete.png');
display: block;
width: 22px;
}
#contact-edit-drop-link .drop,
.mail-list-delete-wrapper .drop,
-.group-delete-wrapper .drop {
+.circle-delete-wrapper .drop {
background-image: url('../../../images/icons/22/delete.png');
display: block;
width: 22px;
top: -50px;
}
/*
-#group-members {
+#circle-members {
margin-top: 20px;
padding: 10px;
height: 250px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-members-end {
+#circle-members-end {
clear: both;
}
-#group-all-contacts {
+#circle-all-contacts {
padding: 10px;
height: 450px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-all-contacts-end {
+#circle-all-contacts-end {
clear: both;
margin-bottom: 10px;
}
ul.tabs li .active {
border-bottom: 1px solid #009100;
}
-/** group editor **/
-#group-edit-desc {
+/** circle editor **/
+#circle-edit-desc {
margin-top: 1em;
color: #999999;
}
-#group-update-wrapper {
+#circle-update-wrapper {
height: auto;
overflow: auto;
}
-#group-update-wrapper #group {
+#circle-update-wrapper #circle {
width: 300px;
float: left;
margin-right: 20px;
}
-#group-update-wrapper #contacts {
+#circle-update-wrapper #contacts {
width: 300px;
float: left;
}
-#group-update-wrapper #group-separator {
+#circle-update-wrapper #circle-separator {
display: none;
}
-#group-update-wrapper .contact_list {
+#circle-update-wrapper .contact_list {
height: 300px;
border: 1px solid #364e59;
overflow: auto;
}
-#group-update-wrapper .contact_list .contact-block-div {
+#circle-update-wrapper .contact_list .contact-block-div {
width: 50px;
height: 50px;
float: left;
var mail = parseInt($(data).find('mail').text());
$(".tool .notify").removeClass("on");
- $(data).find("group").each(function() {
+ $(data).find("circle").each(function() {
var gid = this.id;
var gcount = this.innerHTML;
- $(".group-"+gid+" .notify").addClass("on").text(gcount);
+ $(".circle-"+gid+" .notify").addClass("on").text(gcount);
});
$(".forum-widget-entry .notify").removeClass("on");
$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
- $('.group-edit-icon').hover(
+ $('.circle-edit-icon').hover(
function() {
$(this).addClass('icon'); $(this).removeClass('iconspacer');},
function() {
$(this).removeClass('icon'); $(this).addClass('iconspacer');}
);
- $('.sidebar-group-element').hover(
+ $('.sidebar-circle-element').hover(
function() {
id = $(this).attr('id');
$('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
width: 48px;
height: 48px;
}
-/* group member */
+/* circle member */
#contact-edit-drop-link,
.mail-list-delete-wrapper,
-.group-delete-wrapper {
+.circle-delete-wrapper {
float: right;
margin-right: 50px;
}
#contact-edit-drop-link .drophide,
.mail-list-delete-wrapper .drophide,
-.group-delete-wrapper .drophide {
+.circle-delete-wrapper .drophide {
background-image: url('../../../images/icons/22/delete.png');
display: block;
width: 22px;
}
#contact-edit-drop-link .drop,
.mail-list-delete-wrapper .drop,
-.group-delete-wrapper .drop {
+.circle-delete-wrapper .drop {
background-image: url('../../../images/icons/22/delete.png');
display: block;
width: 22px;
top: -50px;
}
/*
-#group-members {
+#circle-members {
margin-top: 20px;
padding: 10px;
height: 250px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-members-end {
+#circle-members-end {
clear: both;
}
-#group-all-contacts {
+#circle-all-contacts {
padding: 10px;
height: 450px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-all-contacts-end {
+#circle-all-contacts-end {
clear: both;
margin-bottom: 10px;
}
ul.tabs li .active {
border-bottom: 1px solid #86608e;
}
-/** group editor **/
-#group-edit-desc {
+/** circle editor **/
+#circle-edit-desc {
margin-top: 1em;
color: #999999;
}
-#group-update-wrapper {
+#circle-update-wrapper {
height: auto;
overflow: auto;
}
-#group-update-wrapper #group {
+#circle-update-wrapper #circle {
width: 300px;
float: left;
margin-right: 20px;
}
-#group-update-wrapper #contacts {
+#circle-update-wrapper #contacts {
width: 300px;
float: left;
}
-#group-update-wrapper #group-separator {
+#circle-update-wrapper #circle-separator {
display: none;
}
-#group-update-wrapper .contact_list {
+#circle-update-wrapper .contact_list {
height: 300px;
border: 1px solid #364e59;
overflow: auto;
}
-#group-update-wrapper .contact_list .contact-block-div {
+#circle-update-wrapper .contact_list .contact-block-div {
width: 50px;
height: 50px;
float: left;
}
}
-/* group member */
+/* circle member */
#contact-edit-drop-link,
.mail-list-delete-wrapper,
-.group-delete-wrapper {
+.circle-delete-wrapper {
float: right;
margin-right: 50px;
.drophide {
}
}
/*
-#group-members {
+#circle-members {
margin-top: 20px;
padding: 10px;
height: 250px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-members-end {
+#circle-members-end {
clear: both;
}
-#group-all-contacts {
+#circle-all-contacts {
padding: 10px;
height: 450px;
overflow: auto;
border: 1px solid #ddd;
}
-#group-all-contacts-end {
+#circle-all-contacts-end {
clear: both;
margin-bottom: 10px;
}
}
-/** group editor **/
-#group-edit-desc { margin-top: 1em; color: @FieldHelpColor; }
-#group-update-wrapper{
+/** circle editor **/
+#circle-edit-desc { margin-top: 1em; color: @FieldHelpColor; }
+#circle-update-wrapper{
height: auto; overflow: auto;
- #group {
+ #circle {
width:300px;
float:left;
margin-right:20px;
width:300px;
float:left;
}
- #group-separator { display: none; }
+ #circle-separator { display: none; }
.contact_list {
height: 300px;
border: 1px solid @MenuBorder;
--- /dev/null
+<div id="circle-sidebar" class="widget">
+ <div class="title tool">
+ <h3 class="label">{{$title}}</h3>
+ <a href="circle/new" title="{{$createtext}}" class="action"><span class="icon text s16 add"> {{$add}}</span></a>
+ </div>
+
+ <div id="sidebar-circle-list">
+ <ul>
+ {{foreach $circles as $circle}}
+ <li class="tool {{if $circle.selected}}selected{{/if}} circle-{{$circle.id}}">
+ <a href="{{$circle.href}}" class="label">
+ {{$circle.text}}
+ </a>
+ {{if $circle.edit}}
+ <a href="{{$circle.edit.href}}" class="action"><span class="icon text s10 edit">{{$circle.edit.title}}</span></a>
+ {{/if}}
+ {{if $circle.cid}}
+ <input type="checkbox"
+ class="{{if $circle.selected}}ticked{{else}}unticked {{/if}} action"
+ onclick="return contactCircleChangeMember(this, '{{$circle.id}}','{{$circle.cid}}');"
+ {{if $circle.ismember}}checked="checked"{{/if}}
+ />
+ {{/if}}
+ <span class="notify"></span>
+ </li>
+ {{/foreach}}
+ </ul>
+ </div>
+</div>
+
+++ /dev/null
-<div id="group-sidebar" class="widget">
- <div class="title tool">
- <h3 class="label">{{$title}}</h3>
- <a href="group/new" title="{{$createtext}}" class="action"><span class="icon text s16 add"> {{$add}}</span></a>
- </div>
-
- <div id="sidebar-group-list">
- <ul>
- {{foreach $groups as $group}}
- <li class="tool {{if $group.selected}}selected{{/if}} group-{{$group.id}}">
- <a href="{{$group.href}}" class="label">
- {{$group.text}}
- </a>
- {{if $group.edit}}
- <a href="{{$group.edit.href}}" class="action"><span class="icon text s10 edit">{{$group.edit.title}}</span></a>
- {{/if}}
- {{if $group.cid}}
- <input type="checkbox"
- class="{{if $group.selected}}ticked{{else}}unticked {{/if}} action"
- onclick="return contactgroupChangeMember(this, '{{$group.id}}','{{$group.cid}}');"
- {{if $group.ismember}}checked="checked"{{/if}}
- />
- {{/if}}
- <span class="notify"></span>
- </li>
- {{/foreach}}
- </ul>
- </div>
-</div>
-
-moz-border-radius: 5px;
}
-#group-sidebar {
+#circle-sidebar {
vertical-align: middle;
margin: auto;
margin-top: 20px;
margin-left: 10px;
}
-#sidebar-group-list {
+#sidebar-circle-list {
margin-left: 0px;
margin-right: 30px;
}
-#sidebar-ungrouped {
+#sidebar-uncircled {
margin: 10px;
}
-#sidebar-group-list a {
+#sidebar-circle-list a {
}
-#sidebar-group-list .icon,
-#sidebar-group-list .iconspacer {
+#sidebar-circle-list .icon,
+#sidebar-circle-list .iconspacer {
display: inline-block;
height: 12px;
width: 12px;
padding: 3px 24px;
}
-#sidebar-new-group,
-#sidebar-edit-groups {
+#sidebar-new-circle,
+#sidebar-edit-circles {
padding: 7px;
width: 165px;
margin: auto;
}
-#sidebar-new-group:hover {
+#sidebar-new-circle:hover {
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1873a2), color-stop(1, #6da6c4) );
background: -moz-linear-gradient( center top, #1873a2 5%, #6da6c4 100% );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1873a2', endColorstr='#6da6c4');
-webkit-border-radius: 5px;
}
-#sidebar-new-group:active {
+#sidebar-new-circle:active {
position: relative;
top: 1px;
}
.widget .selected,
-.group-selected {
+.circle-selected {
padding-bottom: 0px;
padding-left: 2px;
padding-right: 2px;
font-weight: bold;
}
-#sidebar-new-group a {
+#sidebar-new-circle a {
color: #efefef;
font-size: 14px;
text-align: center;
margin: auto;
}
-ul .sidebar-group-li {
+ul .sidebar-circle-li {
list-style: disc;
font-size: 1.0em;
}
-ul .sidebar-group-li .icon {
+ul .sidebar-circle-li .icon {
display: inline-block;
height: 12px;
width: 12px;
margin-left: 10px;
}
-#group-sidebar h3:before {
- content: url("images/groups.png");
+#circle-sidebar h3:before {
+ content: url("images/circles.png");
padding-right: 10px;
vertical-align: middle;
}
#profile-nolocation-wrapper {
}
-#group_allow_wrapper,
-#group_deny_wrapper,
+#circle_allow_wrapper,
+#circle_deny_wrapper,
#acl-permit-outer-wrapper {
width: 47%;
float: left;
/* = Contacts Selector = */
/* ===================== */
-#group-edit-wrapper {
+#circle-edit-wrapper {
margin-bottom: 10px;
}
-#group-edit-name-wrapper {
+#circle-edit-name-wrapper {
margin-bottom: 0px;
display: inline;
}
-#group-edit-submit-wrapper {
+#circle-edit-submit-wrapper {
margin-bottom: 10px;
margin-right: 400px;
float: right;
display: inline;
}
-.group-delete-wrapper {
+.circle-delete-wrapper {
width: 90px;
display: inline;
padding: 5px;
-webkit-border-radius: 5px;
}
-.group-delete-wrapper:hover {
+.circle-delete-wrapper:hover {
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1873a2), color-stop(1, #6da6c4) );
background: -moz-linear-gradient( center top, #1873a2 5%, #6da6c4 100% );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1873a2', endColorstr='#6da6c4');
background-color: #1873a2;
}
-.group-delete-wrapper:active {
+.circle-delete-wrapper:active {
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1873a2), color-stop(1, #6da6c4) );
background: -moz-linear-gradient( center top, #1873a2 5%, #6da6c4 100% );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1873a2', endColorstr='#6da6c4');
background-color: #1873a2;
}
-.group-delete-wrapper a {
+.circle-delete-wrapper a {
color: #efefef;
font-size: 0.9em;
}
-#group-edit-desc {
+#circle-edit-desc {
margin: 10px 0xp;
}
-#group-new-text {
+#circle-new-text {
font-size: 1.1em;
}
-#group-members,
+#circle-members,
#prof-members {
width: 83%;
height: 200px;
padding: 10px;
}
-#group-all-contacts,
+#circle-all-contacts,
#prof-all-contacts {
width: 83%;
height: 200px;
padding: 10px;
}
-#group-members h3,
-#group-all-contacts h3,
+#circle-members h3,
+#circle-all-contacts h3,
#prof-members h3,
#prof-all-contacts h3 {
color: #555753;
padding: 5px;
}
-#group-separator,
+#circle-separator,
#prof-separator {
display: none;
}
}
}
);
- $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
+ $('#contact_allow, #contact_deny, #circle_allow, #circle_deny').change(function() {
var selstr;
- $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
+ $('#contact_allow option:selected, #contact_deny option:selected, #circle_allow option:selected, #circle_deny option:selected').each( function() {
selstr = $(this).html();
$('#jot-perms-icon').removeClass('unlock').addClass('lock');
$('#jot-public').hide();
$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
- $('.group-edit-icon').hover(
+ $('.circle-edit-icon').hover(
function() {
$(this).addClass('icon'); $(this).removeClass('iconspacer');},
function() {
$(this).removeClass('icon'); $(this).addClass('iconspacer');}
);
- $('.sidebar-group-element').hover(
+ $('.sidebar-circle-element').hover(
function() {
id = $(this).attr('id');
$('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
}
#saved-search-ul .tool:hover,
#nets-sidebar .tool:hover,
-#sidebar-group-list .tool:hover {
+#sidebar-circle-list .tool:hover {
background: #EEE;
}
-/*#sidebar-group-list .notify {
+/*#sidebar-circle-list .notify {
min-width: 10px;
text-align: center;
color: #FFF;
border-radius: 10px;
display: none;
}*/
-#sidebar-group-list .notify {
+#sidebar-circle-list .notify {
display: none;
}
-#sidebar-group-list .notify.show {
+#sidebar-circle-list .notify.show {
display: inline-block;
}
.tool .label {
color: black;
}
-.groupsideedit, .savedsearchdrop {
+.circlesideedit, .savedsearchdrop {
float: right;
opacity: 0.3;
}
-.groupsideedit:hover, .savedsearchdrop:hover {
+.circlesideedit:hover, .savedsearchdrop:hover {
opacity: 1;
}
-.sidebar-group-li:hover, #sidebar-new-group:hover, #sidebar-edit-groups:hover,#forum-widget-collapse:hover,
-#sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forumlist-sidebar li:hover, #forumlist-sidebar-right li:hover,
+.sidebar-circle-li:hover, #sidebar-new-circle:hover, #sidebar-edit-circles:hover,#forum-widget-collapse:hover,
+#sidebar-uncircled:hover, .side-link:hover, .nets-ul li:hover, #forumlist-sidebar li:hover, #forumlist-sidebar-right li:hover,
.nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover,
#sidebar-photos-albums li:hover, .photos-upload-link:hover, .textcomplete-item.active {
/* background-color: #ddd; */
color: black;
}
-.sidebar-group-element {
+.sidebar-circle-element {
/* color: #000; */
}
font-weight: bold;
}
-#forum-widget-showmore, #sidebar-new-group, #sidebar-edit-groups, #forum-widget-collapse, #forumlist-rsidebar-right, #sidebar-ungrouped,
+#forum-widget-showmore, #sidebar-new-circle, #sidebar-edit-circles, #forum-widget-collapse, #forumlist-rsidebar-right, #sidebar-uncircled,
.side-link, #peoplefind-desc, #connect-desc, .nets-all, .admin.link, #message-new {
padding-left: 10px;
padding-top: 3px;
display: inline-block;
}
-a.nets-link, .side-link a, #sidebar-new-group a, #sidebar-edit-groups a, a.savedsearchterm,a.fileas-link, aside h4 a, right_aside h4 a {
+a.nets-link, .side-link a, #sidebar-new-circle a, #sidebar-edit-circles a, a.savedsearchterm,a.fileas-link, aside h4 a, right_aside h4 a {
display: block;
color: #737373;
}
-a.sidebar-group-element {
+a.sidebar-circle-element {
color: #737373;
}
padding: 0;
margin-left: 10px;
}
-#sidebar-ungrouped, .side-link {
+#sidebar-uncircled, .side-link {
padding-top: 5px;
}
-#sidebar-ungrouped a {
+#sidebar-uncircled a {
color: black;
}
width: 48px;
height: 48px;
}
-.group_selected {
+.circle_selected {
background: url("../../../view/theme/diabook/icons/selected.png") no-repeat left center;
float: left;
height: 22px;
width: 22px;
}
-.group_unselected {
+.circle_unselected {
background: url("../../../view/theme/diabook/icons/unselected.png") no-repeat left center;
float: left;
height: 22px;
.contact-block-textdiv {width: 150px; height: 34px; float: left; }
#contact-block-end {clear: both; }
-#group-edit-wrapper {
+#circle-edit-wrapper {
margin-bottom: 10px;
}
-#group-members-end {
+#circle-members-end {
clear: both;
}
/*
-#group-separator,
+#circle-separator,
#prof-separator {display: none;}
*/