]> git.mxchange.org Git - friendica.git/commitdiff
Remove include/group.php
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 9 Dec 2017 18:45:54 +0000 (13:45 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 9 Dec 2017 18:45:54 +0000 (13:45 -0500)
19 files changed:
include/api.php
include/follow.php
include/group.php [deleted file]
include/items.php
mod/contactgroup.php
mod/contacts.php
mod/dfrn_confirm.php
mod/dfrn_request.php
mod/group.php
mod/network.php
mod/nogroup.php
mod/ping.php
mod/settings.php
mod/update_display.php
mod/update_network.php
src/Model/User.php
src/Protocol/Diaspora.php
src/Worker/Delivery.php
src/Worker/Notifier.php

index 70e11416da55f802ad6f13c1f5133fbbe05a568f..8a29c82dd8a4174f4a60da9ae786320b23b57847 100644 (file)
@@ -42,7 +42,6 @@ require_once 'include/html2bbcode.php';
 require_once 'mod/wall_upload.php';
 require_once 'mod/proxy.php';
 require_once 'include/message.php';
-require_once 'include/group.php';
 require_once 'include/like.php';
 require_once 'include/plaintext.php';
 
index 539768b74ce0b65c365f0b80d7b98b05fbfff63c..c9e81f7b37a169e54b4fd6deea5151af15fd38fd 100644 (file)
@@ -16,8 +16,6 @@ use Friendica\Protocol\OStatus;
 use Friendica\Protocol\PortableContact;
 use Friendica\Protocol\Salmon;
 
-require_once 'include/group.php';
-
 function update_contact($id) {
        /*
        Warning: Never ever fetch the public key via Probe::uri and write it into the contacts.
diff --git a/include/group.php b/include/group.php
deleted file mode 100644 (file)
index 6e7348c..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-<?php
-
-use Friendica\Core\PConfig;
-use Friendica\Database\DBM;
-
-function group_add($uid,$name) {
-
-       $ret = false;
-       if (x($uid) && x($name)) {
-               $r = group_byname($uid,$name); // check for dups
-               if ($r !== 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.
-
-                       $z = q("SELECT * FROM `group` WHERE `id` = %d LIMIT 1",
-                               intval($r)
-                       );
-                       if (count($z) && $z[0]['deleted']) {
-                               $r = q("UPDATE `group` SET `deleted` = 0 WHERE `uid` = %d AND `name` = '%s'",
-                                       intval($uid),
-                                       dbesc($name)
-                               );
-                               notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
-                       }
-                       return true;
-               }
-               $r = dba::insert('group', array('uid' => $uid, 'name' => $name));
-               $ret = $r;
-       }
-       return $ret;
-}
-
-
-function group_rmv($uid,$name) {
-       $ret = false;
-       if (x($uid) && x($name)) {
-               $r = q("SELECT id FROM `group` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
-                       intval($uid),
-                       dbesc($name)
-               );
-               if (DBM::is_result($r))
-                       $group_id = $r[0]['id'];
-               if (! $group_id)
-                       return false;
-
-               // remove group from default posting lists
-               $r = q("SELECT def_gid, allow_gid, deny_gid FROM user WHERE uid = %d LIMIT 1",
-                      intval($uid)
-               );
-               if ($r) {
-                       $user_info = $r[0];
-                       $change = false;
-
-                       if ($user_info['def_gid'] == $group_id) {
-                               $user_info['def_gid'] = 0;
-                               $change = true;
-                       }
-                       if (strpos($user_info['allow_gid'], '<' . $group_id . '>') !== false) {
-                               $user_info['allow_gid'] = str_replace('<' . $group_id . '>', '', $user_info['allow_gid']);
-                               $change = true;
-                       }
-                       if (strpos($user_info['deny_gid'], '<' . $group_id . '>') !== false) {
-                               $user_info['deny_gid'] = str_replace('<' . $group_id . '>', '', $user_info['deny_gid']);
-                               $change = true;
-                       }
-
-                       if ($change) {
-                               q("UPDATE user SET def_gid = %d, allow_gid = '%s', deny_gid = '%s' WHERE uid = %d",
-                                 intval($user_info['def_gid']),
-                                 dbesc($user_info['allow_gid']),
-                                 dbesc($user_info['deny_gid']),
-                                 intval($uid)
-                               );
-                       }
-               }
-
-               // remove all members
-               dba::delete('group_member', array('uid' => $uid, 'pid' => $group_id));
-
-               // remove group
-               $r = q("UPDATE `group` SET `deleted` = 1 WHERE `uid` = %d AND `name` = '%s'",
-                       intval($uid),
-                       dbesc($name)
-               );
-
-               $ret = $r;
-
-       }
-
-       return $ret;
-}
-
-function group_byname($uid,$name) {
-       if ((! $uid) || (! strlen($name)))
-               return false;
-       $r = q("SELECT * FROM `group` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
-               intval($uid),
-               dbesc($name)
-       );
-       if (DBM::is_result($r))
-               return $r[0]['id'];
-       return false;
-}
-
-function group_rmv_member($uid, $name, $member) {
-       $gid = group_byname($uid, $name);
-
-       if (!$gid) {
-               return false;
-       }
-
-       if (!($uid && $gid && $member)) {
-               return false;
-       }
-
-       $r = dba::delete('group_member', array('uid' => $uid, 'gid' => $gid, 'contact-id' => $member));
-       return $r;
-}
-
-
-function group_add_member($uid,$name,$member,$gid = 0) {
-       if (! $gid)
-               $gid = group_byname($uid,$name);
-       if ((! $gid) || (! $uid) || (! $member))
-               return false;
-
-       $r = q("SELECT * FROM `group_member` WHERE `uid` = %d AND `gid` = %d AND `contact-id` = %d LIMIT 1",
-               intval($uid),
-               intval($gid),
-               intval($member)
-       );
-       if (DBM::is_result($r))
-               return true;    // You might question this, but
-                               // we indicate success because the group member was in fact created
-                               // -- It was just created at another time
-       if (! DBM::is_result($r)) {
-               $r = dba::insert('group_member', array('uid' => $uid, 'gid' => $gid, 'contact-id' => $member));
-       }
-       return $r;
-}
-
-function group_get_members($gid) {
-       $ret = array();
-       if (intval($gid)) {
-               $r = q("SELECT `group_member`.`contact-id`, `contact`.* FROM `group_member`
-                       INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id`
-                       WHERE `gid` = %d AND `group_member`.`uid` = %d AND
-                               NOT `contact`.`self` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
-                               ORDER BY `contact`.`name` ASC ",
-                       intval($gid),
-                       intval(local_user())
-               );
-               if (DBM::is_result($r))
-                       $ret = $r;
-       }
-       return $ret;
-}
-
-function group_public_members($gid) {
-       $ret = 0;
-       if (intval($gid)) {
-               $r = q("SELECT `contact`.`id` AS `contact-id` FROM `group_member`
-                       INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id`
-                       WHERE `gid` = %d AND `group_member`.`uid` = %d
-                       AND  `contact`.`network` = '%s' AND `contact`.`notify` != '' ",
-                       intval($gid),
-                       intval(local_user()),
-                       dbesc(NETWORK_OSTATUS)
-               );
-               if (DBM::is_result($r))
-                       $ret = count($r);
-       }
-       return $ret;
-}
-
-
-function mini_group_select($uid,$gid = 0, $label = "") {
-
-       $grps = array();
-       $o = '';
-
-       $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
-               intval($uid)
-       );
-       $grps[] = array('name' => '', 'id' => '0', 'selected' => '');
-       if (DBM::is_result($r)) {
-               foreach ($r as $rr) {
-                       $grps[] = array('name' => $rr['name'], 'id' => $rr['id'], 'selected' => (($gid == $rr['id']) ? 'true' : ''));
-               }
-
-       }
-       logger('groups: ' . print_r($grps,true));
-
-       if ($label == "")
-               $label = t('Default privacy group for new contacts');
-
-       $o = replace_macros(get_markup_template('group_selection.tpl'), array(
-               '$label' => $label,
-               '$groups' => $grps
-       ));
-       return $o;
-}
-
-
-/**
- * @brief 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 int $group_id
- * @param int $cid
- * @return string
- */
-function group_side($every="contacts",$each="group",$editmode = "standard", $group_id = 0, $cid = 0) {
-
-       $o = '';
-
-       if (! local_user())
-               return '';
-
-       $groups = array();
-
-       $groups[] = array(
-               'text'  => t('Everybody'),
-               'id' => 0,
-               'selected' => (($group_id == 0) ? 'group-selected' : ''),
-               'href'  => $every,
-       );
-
-
-
-       $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
-               intval($_SESSION['uid'])
-       );
-       $member_of = array();
-       if ($cid) {
-               $member_of = groups_containing(local_user(),$cid);
-       }
-
-       if (DBM::is_result($r)) {
-               foreach ($r as $rr) {
-                       $selected = (($group_id == $rr['id']) ? ' group-selected' : '');
-
-                       if ($editmode == "full") {
-                               $groupedit = array(
-                                       'href' => "group/".$rr['id'],
-                                       'title' => t('edit'),
-                               );
-                       } else {
-                               $groupedit = null;
-                       }
-
-                       $groups[] = array(
-                               'id'            => $rr['id'],
-                               'cid'           => $cid,
-                               'text'          => $rr['name'],
-                               'selected'      => $selected,
-                               'href'          => $each."/".$rr['id'],
-                               'edit'          => $groupedit,
-                               'ismember'      => in_array($rr['id'],$member_of),
-                       );
-               }
-       }
-
-
-       $tpl = get_markup_template("group_side.tpl");
-       $o = replace_macros($tpl, array(
-               '$title'        => t('Groups'),
-               'newgroup'      => (($editmode == "extended") || ($editmode == "full") ? 1 : ''),
-               '$editgroupstext' => t('Edit groups'),
-               'grouppage'     => "group/",
-               '$edittext'     => t('Edit group'),
-               '$createtext'   => t('Create a new group'),
-               '$creategroup'  => t('Group Name: '),
-               '$form_security_token' => get_form_security_token("group_edit"),
-               '$ungrouped'    => (($every === 'contacts') ? t('Contacts not in any group') : ''),
-               '$groups'       => $groups,
-               '$add'          => t('add'),
-       ));
-
-
-       return $o;
-}
-
-function expand_groups($a,$check_dead = false, $use_gcontact = false) {
-       if (! (is_array($a) && count($a)))
-               return array();
-       $groups = implode(',', $a);
-       $groups = dbesc($groups);
-
-       if ($use_gcontact)
-               $r = q("SELECT `gcontact`.`id` AS `contact-id` FROM `group_member`
-                               INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id`
-                               INNER JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
-                       WHERE `gid` IN ($groups)");
-       else
-               $r = q("SELECT `contact-id` FROM `group_member` WHERE `gid` IN ( $groups )");
-
-
-       $ret = array();
-       if (DBM::is_result($r))
-               foreach ($r as $rr)
-                       $ret[] = $rr['contact-id'];
-       if ($check_dead && !$use_gcontact) {
-               require_once('include/acl_selectors.php');
-               $ret = prune_deadguys($ret);
-       }
-       return $ret;
-}
-
-
-function member_of($c) {
-
-       $r = q("SELECT `group`.`name`, `group`.`id` FROM `group` INNER JOIN `group_member` ON `group_member`.`gid` = `group`.`id` WHERE `group_member`.`contact-id` = %d AND `group`.`deleted` = 0 ORDER BY `group`.`name`  ASC ",
-               intval($c)
-       );
-
-       return $r;
-
-}
-
-function groups_containing($uid,$c) {
-
-       $r = q("SELECT `gid` FROM `group_member` WHERE `uid` = %d AND `group_member`.`contact-id` = %d ",
-               intval($uid),
-               intval($c)
-       );
-
-       $ret = array();
-       if (DBM::is_result($r)) {
-               foreach ($r as $rr) {
-                       $ret[] = $rr['gid'];
-               }
-       }
-
-       return $ret;
-}
-/**
- * @brief count unread group items
- *
- * Count unread items of each groups
- *
- * @return array
- *     'id' => group id
- *     'name' => group name
- *     'count' => counted unseen group items
- *
- */
-function groups_count_unseen() {
-
-       $r = q("SELECT `group`.`id`, `group`.`name`,
-                       (SELECT COUNT(*) FROM `item` FORCE INDEX (`uid_unseen_contactid`)
-                               WHERE `uid` = %d AND `unseen` AND
-                                       `contact-id` IN (SELECT `contact-id` FROM `group_member`
-                                                               WHERE `group_member`.`gid` = `group`.`id` AND `group_member`.`uid` = %d)) AS `count`
-                       FROM `group` WHERE `group`.`uid` = %d;",
-               intval(local_user()),
-               intval(local_user()),
-               intval(local_user())
-       );
-
-       return $r;
-}
-
-/**
- * @brief Returns the default group for a given user and network
- *
- * @param int $uid User id
- * @param string $network network name
- *
- * @return int group id
- */
-function get_default_group($uid, $network = "") {
-
-       $default_group = 0;
-
-       if ($network == NETWORK_OSTATUS)
-               $default_group = PConfig::get($uid, "ostatus", "default_group");
-
-       if ($default_group != 0)
-               return $default_group;
-
-       $g = q("SELECT `def_gid` FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid));
-       if ($g && intval($g[0]["def_gid"]))
-               $default_group = $g[0]["def_gid"];
-
-       return $default_group;
-}
index 834cf888a1d1fa8562a96636320c93429163954f..9f3f4ab30e503b19f8f99433c085149e4d3ab7ca 100644 (file)
@@ -29,7 +29,6 @@ require_once 'include/plaintext.php';
 require_once 'include/feed.php';
 require_once 'mod/share.php';
 require_once 'include/enotify.php';
-require_once 'include/group.php';
 
 function construct_verb($item) {
        if ($item['verb']) {
index 887cf4dbaade8adc6e5b99a318b53e6d4f4d7dc3..96b65fd4032522dcbc90a26de02e59e4d540ea61 100644 (file)
@@ -2,8 +2,6 @@
 
 use Friendica\App;
 use Friendica\Database\DBM;
-
-require_once('include/group.php');
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
 
index 3bb7b4f82c993862a9b8d3417e9deba1a988d15b..fd1d6776cc367a1dc2ab2610370b00fc786765f5 100644 (file)
@@ -32,7 +32,6 @@ function contacts_init(App $a) {
                }
        }
 
-       require_once 'include/group.php';
        require_once 'include/contact_widgets.php';
 
        if ($_GET['nets'] == "all") {
index f4d5c1b8679491eb36faf10d7f5a1ce499820bea..112ee34ab3195bd906e0bd97cbfd5ff22a4f1b37 100644 (file)
@@ -31,7 +31,6 @@ use Friendica\Network\Probe;
 use Friendica\Protocol\Diaspora;
 
 require_once 'include/enotify.php';
-require_once 'include/group.php';
 
 function dfrn_confirm_post(App $a, $handsfree = null) {
 
index eef2deb133b86d099ede75dffbc4f8bbf396ddf3..ec675865617b49d2d35f7fa8e0021117a478c16f 100644 (file)
@@ -21,7 +21,6 @@ use Friendica\Model\User;
 use Friendica\Network\Probe;
 
 require_once 'include/enotify.php';
-require_once 'include/group.php';
 
 function dfrn_request_init(App $a)
 {
index 545ccea2c7fd36dd3c3f7430d4045f28566bf57d..ba7c24c56a375aa35a05d51d0e975013fad8531a 100644 (file)
@@ -15,7 +15,6 @@ use Friendica\Model\Group;
 
 function group_init(App $a) {
        if (local_user()) {
-               require_once 'include/group.php';
                $a->page['aside'] = Group::sidebarWidget('contacts', 'group', 'extended', (($a->argc > 1) ? intval($a->argv[1]) : 0));
        }
 }
index e1e98a2d2d83579eeceb302ac3455f6871486ffb..552625c2afc6dc7e6e4c2b665b49d04f99f1351d 100644 (file)
@@ -13,7 +13,6 @@ use Friendica\Model\Contact;
 use Friendica\Model\Group;
 
 require_once 'include/conversation.php';
-require_once 'include/group.php';
 require_once 'include/contact_widgets.php';
 require_once 'include/items.php';
 require_once 'include/acl_selectors.php';
index 72cf0373046957da0e504b25757b6cafe63e13a2..d80b6d3dbd3a9584681d4bf15da81a7e0e110579 100644 (file)
@@ -15,7 +15,6 @@ function nogroup_init(App $a)
                return;
        }
 
-       require_once 'include/group.php';
        require_once 'include/contact_widgets.php';
 
        if (! x($a->page, 'aside')) {
index 59f6589eb23989b9350ad7be19e2517f94fb6050..930ed54ff9de977e046755044fd71f127bb7828e 100644 (file)
@@ -15,7 +15,6 @@ use Friendica\Util\XML;
 
 require_once 'include/datetime.php';
 require_once 'include/bbcode.php';
-require_once 'include/group.php';
 require_once 'mod/proxy.php';
 require_once 'include/enotify.php';
 
index 764356b4c445e3cb044dbe23e06333039deddbed..e3d650e089de6d10fa0f54d2dbca23353b9a2cbf 100644 (file)
@@ -14,8 +14,6 @@ use Friendica\Model\Group;
 use Friendica\Model\User;
 use Friendica\Protocol\Email;
 
-require_once 'include/group.php';
-
 function get_theme_config_file($theme) {
        $a = get_app();
        $base_theme = $a->theme_info['extends'];
index b9294d755898bbe3cece89f4228fa8c8e3c237e7..00109202ed7a9547048ea27dbbc2a9e8f5940698 100644 (file)
@@ -5,7 +5,6 @@
 use Friendica\App;
 use Friendica\Core\PConfig;
 
-require_once("include/group.php");
 require_once "mod/display.php";
 
 function update_display_content(App $a)
index 25b87bc2ae7fc194fb1c2ee8edfb0695a0bf4031..3a5741f6ac0629bdd91b38800aab3470b471e9f5 100644 (file)
@@ -5,7 +5,6 @@
 use Friendica\App;
 use Friendica\Core\PConfig;
 
-require_once("include/group.php");
 require_once "mod/network.php";
 
 function update_network_content(App $a)
index 5a3200b024064918318fee2c13405f3ab2226f22..25aa2401e7f9d067c1e00dc4d2778926c1f31340 100644 (file)
@@ -21,7 +21,6 @@ use dba;
 require_once 'boot.php';
 require_once 'include/crypto.php';
 require_once 'include/enotify.php';
-require_once 'include/group.php';
 require_once 'include/network.php';
 require_once 'library/openid.php';
 require_once 'include/pgettext.php';
index 3ef55443c2580900080d2fdaafa0d95a3c36544f..b56f59dad65d8d492ba979b9b60e5cf5da745bdc 100644 (file)
@@ -29,7 +29,6 @@ use SimpleXMLElement;
 
 require_once 'include/items.php';
 require_once 'include/bb2diaspora.php';
-require_once 'include/group.php';
 require_once 'include/datetime.php';
 require_once 'include/queue_fn.php';
 
index c20bb8d8f83cefd13f12e50c4f3c16fb87a13b2c..9ed9a06c17b8a06987fff2bb2df5dfe9f61f200e 100644 (file)
@@ -159,8 +159,6 @@ class Delivery {
                $public_message = true;
 
                if (!($mail || $fsuggest || $relocate)) {
-                       require_once 'include/group.php';
-
                        $parent = $items[0];
 
                        // This is IMPORTANT!!!!
index fb806be954715f36bc86355594c661eccf33843d..749478044410a337d18455b44e2154cd2f905de5 100644 (file)
@@ -208,8 +208,6 @@ class Notifier {
 
                        $slap = OStatus::salmon($target_item, $owner);
 
-                       require_once 'include/group.php';
-
                        $parent = $items[0];
 
                        $thr_parent = q("SELECT `network`, `author-link`, `owner-link` FROM `item` WHERE `uri` = '%s' AND `uid` = %d",