]> git.mxchange.org Git - friendica.git/commitdiff
Removed and replaced deprecated functionalities
authorMichael <heluecht@pirati.ca>
Sun, 7 Nov 2021 14:00:47 +0000 (14:00 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 7 Nov 2021 14:00:47 +0000 (14:00 +0000)
12 files changed:
include/api.php
mod/item.php
mod/settings.php
src/Content/Text/HTML.php
src/Core/Addon.php
src/Model/Contact.php
src/Model/FileTag.php
src/Model/Group.php
src/Model/Notification/Type.php
src/Model/User.php
src/Object/Image.php
src/Protocol/OStatus.php

index 2495f5d192be9faf16feeb178b303f109eb02e19..062865d4398eba43ed1a4fbf29692e4de387f86a 100644 (file)
@@ -237,9 +237,13 @@ function api_login(App $a)
        if ($addon_auth['authenticated'] && !empty($addon_auth['user_record'])) {
                $record = $addon_auth['user_record'];
        } else {
-               $user_id = User::authenticate(trim($user), trim($password), true);
-               if ($user_id !== false) {
-                       $record = DBA::selectFirst('user', [], ['uid' => $user_id]);
+               try {
+                       $user_id = User::getIdFromPasswordAuthentication(trim($user), trim($password), true);
+                       if ($user_id !== false) {
+                               $record = DBA::selectFirst('user', [], ['uid' => $user_id]);
+                       }
+                       } catch (Exception $ex) {
+                               $record = [];
                }
        }
 
@@ -5137,7 +5141,13 @@ function api_friendica_group_delete($type)
        }
 
        // delete group
-       $ret = Group::removeByName($uid, $name);
+       $gid = Group::getIdByName($uid, $name);
+       if (empty($gid)) {
+               throw new BadRequestException('other API error');
+       }
+
+       $ret = Group::remove($gid);
+
        if ($ret) {
                // return success
                $success = ['success' => $ret, 'gid' => $gid, 'name' => $name, 'status' => 'deleted', 'wrong users' => []];
@@ -5372,7 +5382,8 @@ function api_friendica_group_update($type)
                        $found = ($user['cid'] == $cid ? true : false);
                }
                if (!isset($found) || !$found) {
-                       Group::removeMemberByName($uid, $name, $cid);
+                       $gid = Group::getIdByName($uid, $name);
+                       Group::removeMember($gid, $cid);
                }
        }
 
index 1309dce47e451e010ed0355a9030525f491de13c..da3eb16c3087b9e0982a6dc238865de3b60bc3df 100644 (file)
@@ -352,7 +352,8 @@ function item_post(App $a) {
                $filedas = FileTag::fileToArray($categories);
        }
 
-       $categories = FileTag::listToFile(trim($_REQUEST['category'] ?? ''), 'category');
+       $list_array = explode(',', trim($_REQUEST['category'] ?? ''));
+       $categories = FileTag::arrayToFile($list_array, 'category');
 
        if (!empty($filedas) && is_array($filedas)) {
                // append the fileas stuff to the new categories list
index b1b8abd94e630a6f9c1ff44293dcfc1ffd4bee3f..e42760358cd8ac76c8d3e16f8fb8f272fcc59a18 100644 (file)
@@ -308,7 +308,13 @@ function settings_post(App $a)
 
        if ($email != $user['email']) {
                //  check for the correct password
-               if (!User::authenticate(intval(local_user()), $_POST['mpassword'])) {
+               try {
+                       $authenticated = User::getIdFromPasswordAuthentication(intval(local_user()), $_POST['mpassword']);
+               } catch (Exception $ex) {
+                       $authenticated = false;
+               }
+
+               if (!$authenticated) {
                        $err .= DI::l10n()->t('Wrong Password.');
                        $email = $user['email'];
                }
index e1caca48ae04c399ae7809052fa3d775dfbb0dad..f4462199ea4ef1c0564f8f4284a8ec8ee58dd99d 100644 (file)
@@ -784,16 +784,6 @@ class HTML
                return $text;
        }
 
-       /**
-        * return div element with class 'clear'
-        * @return string
-        * @deprecated
-        */
-       public static function clearDiv()
-       {
-               return '<div class="clear"></div>';
-       }
-
        /**
         * Loader for infinite scrolling
         *
index 7b3c86a656c923c079caffa5175abc89993dd4f1..357c02bcb6bd1b34734240c42a508b8c35004053 100644 (file)
@@ -320,51 +320,4 @@ class Addon
 
                return $visible_addons;
        }
-
-       /**
-        * Shim of Hook::register left for backward compatibility purpose.
-        *
-        * @see        Hook::register
-        * @deprecated since version 2018.12
-        * @param string $hook     the name of the hook
-        * @param string $file     the name of the file that hooks into
-        * @param string $function the name of the function that the hook will call
-        * @param int    $priority A priority (defaults to 0)
-        * @return mixed|bool
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
-        */
-       public static function registerHook($hook, $file, $function, $priority = 0)
-       {
-               return Hook::register($hook, $file, $function, $priority);
-       }
-
-       /**
-        * Shim of Hook::unregister left for backward compatibility purpose.
-        *
-        * @see        Hook::unregister
-        * @deprecated since version 2018.12
-        * @param string $hook     the name of the hook
-        * @param string $file     the name of the file that hooks into
-        * @param string $function the name of the function that the hook called
-        * @return boolean
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
-        */
-       public static function unregisterHook($hook, $file, $function)
-       {
-               return Hook::unregister($hook, $file, $function);
-       }
-
-       /**
-        * Shim of Hook::callAll left for backward-compatibility purpose.
-        *
-        * @see        Hook::callAll
-        * @deprecated since version 2018.12
-        * @param string        $name of the hook to call
-        * @param string|array &$data to transmit to the callback handler
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
-        */
-       public static function callHooks($name, &$data = null)
-       {
-               Hook::callAll($name, $data);
-       }
 }
index 03cd09fc5af7f97a620b529a45e1b6643410d799..8d7799f636eb60a6d9f665f2237af835e3ffe879 100644 (file)
@@ -57,36 +57,6 @@ class Contact
        const DEFAULT_AVATAR_THUMB = '/images/person-80.jpg';
        const DEFAULT_AVATAR_MICRO = '/images/person-48.jpg';
 
-       /**
-        * @deprecated since version 2019.03
-        * @see User::PAGE_FLAGS_NORMAL
-        */
-       const PAGE_NORMAL    = User::PAGE_FLAGS_NORMAL;
-       /**
-        * @deprecated since version 2019.03
-        * @see User::PAGE_FLAGS_SOAPBOX
-        */
-       const PAGE_SOAPBOX   = User::PAGE_FLAGS_SOAPBOX;
-       /**
-        * @deprecated since version 2019.03
-        * @see User::PAGE_FLAGS_COMMUNITY
-        */
-       const PAGE_COMMUNITY = User::PAGE_FLAGS_COMMUNITY;
-       /**
-        * @deprecated since version 2019.03
-        * @see User::PAGE_FLAGS_FREELOVE
-        */
-       const PAGE_FREELOVE  = User::PAGE_FLAGS_FREELOVE;
-       /**
-        * @deprecated since version 2019.03
-        * @see User::PAGE_FLAGS_BLOG
-        */
-       const PAGE_BLOG      = User::PAGE_FLAGS_BLOG;
-       /**
-        * @deprecated since version 2019.03
-        * @see User::PAGE_FLAGS_PRVGROUP
-        */
-       const PAGE_PRVGROUP  = User::PAGE_FLAGS_PRVGROUP;
        /**
         * @}
         */
index 324a78fa6ffa48c9ba28b9ad0d8ca34f64bc640d..d459237e757355684e6043172c3c99d76c57c8e2 100644 (file)
@@ -114,21 +114,4 @@ class FileTag
 
                return $return;
        }
-
-       /**
-        * Get file tags from list
-        *
-        * ex. given music,video return <music><video> or [music][video]
-        * @param string $list A comma delimited list of tags.
-        * @param string $type Optional file type.
-        *
-        * @return string       A list of file tags.
-        * @deprecated since 2019.06 use arrayToFile() instead
-        */
-       public static function listToFile(string $list, string $type = 'file')
-       {
-               $list_array = explode(',', $list);
-
-               return self::arrayToFile($list_array, $type);
-       }
 }
index 889f8269d1a2646820c2d5c32d03f2ce904a2330..8e7f807cfeb8cdc4f92c4f7d23f1f04bd584fb10 100644 (file)
@@ -251,28 +251,6 @@ class Group
                return $return;
        }
 
-       /**
-        * Mark a group as deleted based on its name
-        *
-        * @param int    $uid
-        * @param string $name
-        * @return bool
-        * @throws \Exception
-        * @deprecated Use Group::remove instead
-        *
-        */
-       public static function removeByName($uid, $name)
-       {
-               $return = false;
-               if (!empty($uid) && !empty($name)) {
-                       $gid = self::getIdByName($uid, $name);
-
-                       $return = self::remove($gid);
-               }
-
-               return $return;
-       }
-
        /**
         * Adds a contact to a group
         *
@@ -317,26 +295,6 @@ class Group
                return $return;
        }
 
-       /**
-        * Removes a contact from a group based on its name
-        *
-        * @param int    $uid
-        * @param string $name
-        * @param int    $cid
-        * @return boolean
-        * @throws \Exception
-        * @deprecated Use Group::removeMember instead
-        *
-        */
-       public static function removeMemberByName($uid, $name, $cid)
-       {
-               $gid = self::getIdByName($uid, $name);
-
-               $return = self::removeMember($gid, $cid);
-
-               return $return;
-       }
-
        /**
         * Returns the combined list of contact ids from a group id list
         *
index 4d669f4f9dc5499f21d88201b3b2bc1a22077090..88172a23f6e6c2db14e468fcd6f19195d21e0e86 100644 (file)
@@ -38,16 +38,8 @@ class Type
        const MAIL = 16;
        /** @var int Notification about a friend suggestion */
        const SUGGEST = 32;
-       /** @var int Unknown Notification
-        * @deprecated
-        */
-       const PROFILE = 64;
        /** @var int Notification about being tagged in a post */
        const TAG_SELF = 128;
-       /** @var int Notification about being tagged
-        * @deprecated
-        */
-       const TAG_SHARE = 256;
        /** @var int Notification about getting poked/prodded/etc. */
        const POKE = 512;
        /** @var int Notification about either a contact had posted something directly or the contact is a mentioned forum */
index 57d5560a47cec7d4ad7e68c64f01b829c3309da7..c43209b22552afcd494a223d4740ff6214a256d7 100644 (file)
@@ -499,26 +499,6 @@ class User
                return $default_group;
        }
 
-
-       /**
-        * Authenticate a user with a clear text password
-        *
-        * @param mixed  $user_info
-        * @param string $password
-        * @param bool   $third_party
-        * @return int|boolean
-        * @deprecated since version 3.6
-        * @see        User::getIdFromPasswordAuthentication()
-        */
-       public static function authenticate($user_info, $password, $third_party = false)
-       {
-               try {
-                       return self::getIdFromPasswordAuthentication($user_info, $password, $third_party);
-               } catch (Exception $ex) {
-                       return false;
-               }
-       }
-
        /**
         * Authenticate a user with a clear text password
         *
index 4551db248c8513a05fa2aef4908b499e823add08..608f64e97c057741445b142d799f3f20ba98237e 100644 (file)
@@ -685,49 +685,4 @@ class Image
 
                return $string;
        }
-
-       /**
-        * supported mimetypes and corresponding file extensions
-        *
-        * @return array
-        * @deprecated in version 2019.12 please use Util\Images::supportedTypes() instead.
-        */
-       public static function supportedTypes()
-       {
-               return Images::supportedTypes();
-       }
-
-       /**
-        * Maps Mime types to Imagick formats
-        *
-        * @return array With with image formats (mime type as key)
-        * @deprecated in version 2019.12 please use Util\Images::getFormatsMap() instead.
-        */
-       public static function getFormatsMap()
-       {
-               return Images::getFormatsMap();
-       }
-
-       /**
-        * @param string $url url
-        * @return array
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
-        * @deprecated in version 2019.12 please use Util\Images::getInfoFromURLCached() instead.
-        */
-       public static function getInfoFromURL($url)
-       {
-               return Images::getInfoFromURLCached($url);
-       }
-
-       /**
-        * @param integer $width  width
-        * @param integer $height height
-        * @param integer $max    max
-        * @return array
-        * @deprecated in version 2019.12 please use Util\Images::getScalingDimensions() instead.
-        */
-       public static function getScalingDimensions($width, $height, $max)
-       {
-               return Images::getScalingDimensions($width, $height, $max);
-       }
 }
index ca8a76b6b4d5b1a3e29d67ab44024c547ff573a7..9988a4009bb1dadc780224d067d37533cc0b3c24 100644 (file)
@@ -865,8 +865,8 @@ class OStatus
        private static function fetchSelf($self, array &$item)
        {
                $condition = ['item-uri' => $self, 'protocol' => [Conversation::PARCEL_DFRN,
-                       Conversation::PARCEL_DIASPORA_DFRN, Conversation::PARCEL_LEGACY_DFRN,
-                       Conversation::PARCEL_LOCAL_DFRN, Conversation::PARCEL_DIRECT, Conversation::PARCEL_SALMON]];
+                       Conversation::PARCEL_DIASPORA_DFRN, Conversation::PARCEL_LOCAL_DFRN,
+                       Conversation::PARCEL_DIRECT, Conversation::PARCEL_SALMON]];
                if (DBA::exists('conversation', $condition)) {
                        Logger::info('Conversation '.$item['uri'].' is already stored.');
                        return;
@@ -905,8 +905,8 @@ class OStatus
        private static function fetchRelated($related, $related_uri, $importer)
        {
                $condition = ['item-uri' => $related_uri, 'protocol' => [Conversation::PARCEL_DFRN,
-                       Conversation::PARCEL_DIASPORA_DFRN, Conversation::PARCEL_LEGACY_DFRN,
-                       Conversation::PARCEL_LOCAL_DFRN, Conversation::PARCEL_DIRECT, Conversation::PARCEL_SALMON]];
+                       Conversation::PARCEL_DIASPORA_DFRN, Conversation::PARCEL_LOCAL_DFRN,
+                       Conversation::PARCEL_DIRECT, Conversation::PARCEL_SALMON]];
                $conversation = DBA::selectFirst('conversation', ['source', 'protocol'], $condition);
                if (DBA::isResult($conversation)) {
                        $stored = true;