]> git.mxchange.org Git - friendica.git/commitdiff
Remove unused code
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 7 Jan 2019 17:09:10 +0000 (12:09 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Jan 2019 15:48:40 +0000 (10:48 -0500)
- Remove commented code
- Remove unused/immediately overwritten variables
- Remove extraneous parameters
- Remove unreachable code
- Remove duplicate array keys

42 files changed:
src/Content/OEmbed.php
src/Content/Text/BBCode.php
src/Core/Config/JITConfigAdapter.php
src/Core/Console.php
src/Core/Console/PoToPhp.php
src/Core/Console/Storage.php
src/Core/Installer.php
src/Core/NotificationsManager.php
src/Core/PConfig.php
src/Core/System.php
src/Database/DBA.php
src/Model/Contact.php
src/Model/Event.php
src/Model/GContact.php
src/Model/Group.php
src/Model/Item.php
src/Model/Photo.php
src/Model/Profile.php
src/Model/Storage/Filesystem.php
src/Model/User.php
src/Module/Contact.php
src/Module/Proxy.php
src/Network/Probe.php
src/Object/Image.php
src/Object/Post.php
src/Object/Thread.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Receiver.php
src/Protocol/ActivityPub/Transmitter.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/Email.php
src/Protocol/Feed.php
src/Protocol/OStatus.php
src/Protocol/PortableContact.php
src/Util/Network.php
src/Util/ParseUrl.php
src/Util/XML.php
src/Worker/Cron.php
src/Worker/DBClean.php
src/Worker/OnePoll.php
src/Worker/PubSubPublish.php

index 144ac4ca53f4a365cdfc55109e478137f51ce249..0093ba11af38a8e948ab6cca40d5b0c59be0cf40 100644 (file)
@@ -370,8 +370,6 @@ class OEmbed
         */
        private static function iframe($src, $width, $height)
        {
-               $a = \get_app();
-
                if (!$height || strstr($height, '%')) {
                        $height = '200';
                }
index 357dc89d9a6cd5af40a55dffed9aee1c961a69a6..78f252b92477bb84366a33dad79b294076f7a9a8 100644 (file)
@@ -1683,7 +1683,7 @@ class BBCode extends BaseObject
 
                // Replace non graphical smilies for external posts
                if ($simple_html) {
-                       $text = Smilies::replace($text, false, true);
+                       $text = Smilies::replace($text);
                }
 
                // Unhide all [noparse] contained bbtags unspacefying them
index ed5f1a3f673ed0b623af7182972335143181c0e7..ce1c13b2cae8b82b8e9e776064ac3027756dfece 100644 (file)
@@ -84,8 +84,6 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
 
        public function set($cat, $k, $value)
        {
-               $a = self::getApp();
-
                // We store our setting values in a string variable.
                // So we have to do the conversion here so that the compare below works.
                // The exception are array values.
index 2cca4f15bb790d914b6ca6f6d26663a8444e48c5..32e12fa1f032ef38e735fa03c6a88ff11f1d52f8 100644 (file)
@@ -73,7 +73,6 @@ HELP;
                        $this->out('Options: ' . var_export($this->options, true));
                }
 
-               $showHelp = false;
                $subHelp = false;
                $command = null;
 
@@ -83,7 +82,6 @@ HELP;
                        return 0;
                } elseif ((count($this->options) === 0 || $this->getOption($this->customHelpOptions) === true || $this->getOption($this->customHelpOptions) === 1) && count($this->args) === 0
                ) {
-                       $showHelp = true;
                } elseif (count($this->args) >= 2 && $this->getArgument(0) == 'help') {
                        $command = $this->getArgument(1);
                        $subHelp = true;
index c492f7424c0d8711e8868d69e602131c1db705a9..d539eae5b6a3f221317fbe5cb58ccff1f5664889 100644 (file)
@@ -47,8 +47,6 @@ HELP;
                        throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
                }
 
-               $a = \get_app();
-
                $pofile = realpath($this->getArgument(0));
 
                if (!file_exists($pofile)) {
@@ -106,7 +104,6 @@ HELP;
                                }
 
                                if ($inv) {
-                                       $inv = false;
                                        $out .= '"' . $v . '"';
                                }
 
@@ -179,7 +176,6 @@ HELP;
                }
 
                if ($inv) {
-                       $inv = false;
                        $out .= '"' . $v . '"';
                }
 
index f9674c4d1981b80e87cefbaefaf1b7d09511fbeb..e0083598c319ec07b93b7c64f7bd533fff945e44 100644 (file)
@@ -37,8 +37,6 @@ HELP;
 
        protected function doExecute()
        {
-               $a = \Friendica\BaseObject::getApp();
-
                if ($this->getOption('v')) {
                        $this->out('Executable: ' . $this->executable);
                        $this->out('Class: ' . __CLASS__);
index cf5dd9ffc2e5db713e03cec05ef7c5241e7934b9..a487aec78b34ee24053c53c58d2b6e46c7999f80 100644 (file)
@@ -224,8 +224,6 @@ class Installer
         */
        public function checkPHP($phppath = null, $required = false)
        {
-               $passed = false;
-               $passed2 = false;
                $passed3 = false;
 
                if (!isset($phppath)) {
@@ -394,7 +392,7 @@ class Installer
                $help = '';
                $status = true;
                try {
-                       $xml = new DOMDocument();
+                       new DOMDocument();
                } catch (Exception $e) {
                        $help = L10n::t('Error, XML PHP module required but not installed.');
                        $status = false;
index 566b701748919525e18c4a450bb3669f58e06d63..98de4fa178ecfdac71e40eda65fbc9ae0789899c 100644 (file)
@@ -229,7 +229,6 @@ class NotificationsManager extends BaseObject
         */
        private function formatNotifs(array $notifs, $ident = "")
        {
-               $notif = [];
                $arr = [];
 
                if (DBA::isResult($notifs)) {
index ebe693edf660875221c19cd8e492953c00ab5960..584318adbc65a4c0efa1368940d1d1961f15e649 100644 (file)
@@ -37,7 +37,7 @@ class PConfig extends BaseObject
                if ($a->getConfigValue('system', 'config_adapter') == 'preload') {
                        self::$adapter = new Config\PreloadPConfigAdapter($uid);
                } else {
-                       self::$adapter = new Config\JITPConfigAdapter($uid);
+                       self::$adapter = new Config\JITPConfigAdapter();
                }
        }
 
index 81c537169e2125f015dd9861ae25af0e5afb32b1..ba3d03e6229f283e3d0d7250366869f144e8caeb 100644 (file)
@@ -59,7 +59,6 @@ class System extends BaseObject
                array_shift($trace);
 
                $callstack = [];
-               $counter = 0;
                $previous = ['class' => '', 'function' => ''];
 
                // The ignore list contains all functions that are only wrapper functions
index 7838a99ef5ddd477176b13a703a57a4e57f868cd..e14d94ce04fc8cb5acb7e8fae7fb6965a66ece8d 100644 (file)
@@ -1105,7 +1105,7 @@ class DBA
                        if ((count($conditions) == 1) && ($field == array_keys($conditions)[0])) {
                                foreach ($rel_def AS $rel_table => $rel_fields) {
                                        foreach ($rel_fields AS $rel_field) {
-                                               $retval = self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, $callstack);
+                                               self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, $callstack);
                                        }
                                }
                                // We quit when this key already exists in the callstack.
@@ -1579,8 +1579,6 @@ class DBA
                $ret = self::p("SHOW PROCESSLIST");
                $data = self::toArray($ret);
 
-               $s = [];
-
                $processes = 0;
                $states = [];
                foreach ($data as $process) {
index 4a8a8cdabaf3acd3291c8ae73aa974c13d320e5f..f3448569b6fdba0845f4145d8566a7a420e1375f 100644 (file)
@@ -885,8 +885,6 @@ class Contact extends BaseObject
         */
        public static function getDetailsByAddr($addr, $uid = -1)
        {
-               static $cache = [];
-
                if ($addr == '') {
                        return [];
                }
@@ -942,14 +940,9 @@ class Contact extends BaseObject
         */
        public static function photoMenu(array $contact, $uid = 0)
        {
-               // @todo Unused, to be removed
-               $a = \get_app();
-
-               $contact_url = '';
                $pm_url = '';
                $status_link = '';
                $photos_link = '';
-               $posts_link = '';
                $contact_drop_link = '';
                $poke_link = '';
 
@@ -1219,7 +1212,6 @@ class Contact extends BaseObject
                        $contact_id = self::getIdForURL($data["alias"], $uid, true, $default, true);
                }
 
-               $url = $data["url"];
                if (!$contact_id) {
                        $fields = [
                                'uid'       => $uid,
index 8b7c7e706c15deebd3522d9df8a43ef4478d72f2..576f47ba832d6fa95b94beea42cf798fefe78af8 100644 (file)
@@ -239,8 +239,6 @@ class Event extends BaseObject
         */
        public static function store($arr)
        {
-               $a = self::getApp();
-
                $event = [];
                $event['id']        = intval(defaults($arr, 'id'       , 0));
                $event['uid']       = intval(defaults($arr, 'uid'      , 0));
@@ -418,7 +416,6 @@ class Event extends BaseObject
                        "February"  => L10n::t("February"),
                        "March"     => L10n::t("March"),
                        "April"     => L10n::t("April"),
-                       "May"       => L10n::t("May"),
                        "June"      => L10n::t("June"),
                        "July"      => L10n::t("July"),
                        "August"    => L10n::t("August"),
@@ -643,7 +640,7 @@ class Event extends BaseObject
         *
         * @todo  Implement timezone support
         */
-       private static function formatListForExport(array $events, $format, $timezone)
+       private static function formatListForExport(array $events, $format)
        {
                if (!count($events)) {
                        return '';
@@ -795,19 +792,14 @@ class Event extends BaseObject
        {
                $process = false;
 
-               $user = DBA::selectFirst('user', ['timezone'], ['uid' => $uid]);
-               if (DBA::isResult($user)) {
-                       $timezone = $user['timezone'];
-               }
-
                // Get all events which are owned by a uid (respects permissions).
                $events = self::getListByUserId($uid);
 
                // We have the events that are available for the requestor.
                // Now format the output according to the requested format.
-               $res = self::formatListForExport($events, $format, $timezone);
+               $res = self::formatListForExport($events, $format);
 
-               // If there are results the precess was successfull.
+               // If there are results the precess was successful.
                if (!empty($res)) {
                        $process = true;
                }
index c077aa6b4a37a2546ff6dc4fe33a4e75f1df74ce..43375b9afb6692bc82d32f01ef837123aca701e1 100644 (file)
@@ -528,8 +528,6 @@ class GContact
         */
        public static function updateSuggestions()
        {
-               $a = \get_app();
-
                $done = [];
 
                /// @TODO Check if it is really neccessary to poll the own server
index 606e379f0545fd2384a65ee7414e1e777ca0d349..0af10995b4a70e698105993a58ad8b9678930834 100644 (file)
@@ -316,8 +316,6 @@ class Group extends BaseObject
         */
        public static function displayGroupSelection($uid, $gid = 0, $label = '')
        {
-               $o = '';
-
                $stmt = DBA::select('group', [], ['deleted' => 0, 'uid' => $uid], ['order' => ['name']]);
 
                $display_groups = [
index 7207958c2f70eec7f78f09e1f16b4dbd7acc0fe3..f18ca088f97778641ce0321bf311d4def44d98c6 100644 (file)
@@ -1236,12 +1236,16 @@ class Item extends BaseObject
        // This function will finally cover most of the preparation functionality in mod/item.php
        public static function prepare(&$item)
        {
+               /*
+                * @TODO: Unused code triggering inspection errors
+                *
                $data = BBCode::getAttachmentData($item['body']);
                if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $item['body'], $match, PREG_SET_ORDER) || isset($data["type"]))
                        && ($posttype != Item::PT_PERSONAL_NOTE)) {
                        $posttype = Item::PT_PAGE;
                        $objecttype = ACTIVITY_OBJ_BOOKMARK;
                }
+                */
        }
 
        public static function insert($item, $force_parent = false, $notify = false, $dontcache = false)
@@ -3040,7 +3044,6 @@ class Item extends BaseObject
                // Contact-id is the uid-dependant author contact
                if (local_user() == $uid) {
                        $item_contact_id = $owner_self_contact['id'];
-                       $item_contact = $owner_self_contact;
                } else {
                        $item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
                        $item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
@@ -3167,8 +3170,6 @@ class Item extends BaseObject
                        $item["mention"] = 1;
                }
 
-               $sql = "";
-
                $fields = [];
 
                foreach ($item as $field => $data) {
index 6f2bbd0039dab4e04ac86d5e2fb1726b63889f10..67ab217cd4782fac9262f96444ccc432beed9686 100644 (file)
@@ -172,7 +172,6 @@ class Photo extends BaseObject
         */
        public static function getImageForPhoto(array $photo)
        {
-               $data = "";
                if ($photo["backend-class"] == "") {
                        // legacy data storage in "data" column
                        $i = self::selectFirst(["data"], ["id" => $photo["id"]]);
@@ -268,7 +267,6 @@ class Photo extends BaseObject
                // if is an existing photo, reuse same backend
                $data = "";
                $backend_ref = "";
-               $backend_class = "";
 
                if (DBA::isResult($existing_photo)) {
                        $backend_ref = (string)$existing_photo["backend-ref"];
@@ -276,6 +274,7 @@ class Photo extends BaseObject
                } else {
                        $backend_class = StorageManager::getBackend();
                }
+
                if ($backend_class === "") {
                        $data = $Image->asString();
                } else {
index 27bb12a3c8473b9647d53a28cbd2b919e7b8af71..b5e54474b819e3c9daca9d7c8f9f178052a80d7b 100644 (file)
@@ -745,14 +745,8 @@ class Profile
 
        public static function getAdvanced(App $a)
        {
-               $o = '';
                $uid = $a->profile['uid'];
 
-               $o .= Renderer::replaceMacros(
-                       Renderer::getMarkupTemplate('section_title.tpl'),
-                       ['$title' => L10n::t('Profile')]
-               );
-
                if ($a->profile['name']) {
                        $tpl = Renderer::getMarkupTemplate('profile_advanced.tpl');
 
index b5bc883b4b6ef98b9987947218c2387e2dd5aba7..bb68731cd04510168367e988968cd08f774b517b 100644 (file)
@@ -60,7 +60,6 @@ class Filesystem implements IStorage
                        if (!mkdir($path, 0770, true)) {
                                Logger::log('Failed to create dirs ' . $path);
                                throw new StorageException(L10n::t('Filesystem storage failed to create "%s". Check you write permissions.', $path));
-                               killme();
                        }
                }
 
@@ -100,7 +99,6 @@ class Filesystem implements IStorage
                if ($r === FALSE) {
                        Logger::log('Failed to write data to ' . $file);
                        throw new StorageException(L10n::t('Filesystem storage failed to save data to "%s". Check your write permissions', $file));
-                       killme();
                }
                return $ref;
        }
index 3627333780883a88bbbddc7299292b4ab3aab9e0..80cae7b0d2561feb94b07b7e785115344990e97e 100644 (file)
@@ -438,7 +438,6 @@ class User
                $return = ['user' => null, 'password' => ''];
 
                $using_invites = Config::get('system', 'invitation_only');
-               $num_invites   = Config::get('system', 'number_invites');
 
                $invite_id  = !empty($data['invite_id'])  ? Strings::escapeTags(trim($data['invite_id']))  : '';
                $username   = !empty($data['username'])   ? Strings::escapeTags(trim($data['username']))   : '';
@@ -501,8 +500,6 @@ class User
                        $openid_url = '';
                }
 
-               $err = '';
-
                // collapse multiple spaces in name
                $username = preg_replace('/ +/', ' ', $username);
 
@@ -826,8 +823,6 @@ class User
                        return false;
                }
 
-               $a = \get_app();
-
                Logger::log('Removing user: ' . $uid);
 
                $user = DBA::selectFirst('user', [], ['uid' => $uid]);
index a9413e1de51676597270c0e27e03344627f47210..8beffb483c17a69d3619047eb6b684a6b95b2b13 100644 (file)
@@ -310,7 +310,7 @@ class Contact extends BaseModule
                        return;
                }
 
-               $r = DBA::update('contact', $fields, ['id' => $contact_id, 'uid' => local_user()]);
+               DBA::update('contact', $fields, ['id' => $contact_id, 'uid' => local_user()]);
 
                // Update the entry in the contact table
                Model\Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
@@ -470,7 +470,6 @@ class Contact extends BaseModule
                $_SESSION['return_path'] = $a->query_string;
 
                if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
-                       $contact_id = $a->data['contact']['id'];
                        $contact = $a->data['contact'];
 
                        $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
@@ -632,7 +631,6 @@ class Contact extends BaseModule
                                '$hidden'         => ['hidden', L10n::t('Hide this contact from others'), ($contact['hidden'] == 1), L10n::t('Replies/likes to your public posts <strong>may</strong> still be visible')],
                                '$notify'         => ['notify', L10n::t('Notification for new posts'), ($contact['notify_new_posts'] == 1), L10n::t('Send a notification of every new post of this contact')],
                                '$fetch_further_information' => $fetch_further_information,
-                               '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
                                '$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], L10n::t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
                                '$photo'          => $contact['photo'],
                                '$name'           => $contact['name'],
index 6ca383f59b344a3100e19f425aadae627217ec58..221ce8d08164c25f0def5c958068d17859324345 100644 (file)
@@ -101,13 +101,13 @@ class Proxy extends BaseModule
 
                // If there is an error then return a blank image
                if ((substr($fetchResult->getReturnCode(), 0, 1) == '4') || (!$img_str)) {
-                       self::responseError($request);
+                       self::responseError();
                        // stop.
                }
 
                $image = new Image($img_str, $mime);
                if (!$image->isValid()) {
-                       self::responseError($request);
+                       self::responseError();
                        // stop.
                }
                
@@ -157,7 +157,6 @@ class Proxy extends BaseModule
        private static function getRequestInfo()
        {
                $a = self::getApp();
-               $url = '';
                $size = 1024;
                $sizetype = '';
                
index 49822c725a58b2d86025656e9682e7a80addc816..9515db728a6f2a8ac2ed20e4c7aafbb8db47acd2 100644 (file)
@@ -1302,7 +1302,6 @@ class Probe
                        $data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
                }
 
-               $pubkey = "";
                if (is_array($webfinger["links"])) {
                        // The array is reversed to take into account the order of preference for same-rel links
                        // See: https://tools.ietf.org/html/rfc7033#section-4.4.4
index 70344dc7c4a520100a744a118537350b1c8a086f..ae360f376d505c43308d6e888ab0b74b667430c9 100644 (file)
@@ -298,8 +298,6 @@ class Image
                $width = $this->getWidth();
                $height = $this->getHeight();
 
-               $dest_width = $dest_height = 0;
-
                if ((! $width)|| (! $height)) {
                        return false;
                }
@@ -502,8 +500,6 @@ class Image
                $width = $this->getWidth();
                $height = $this->getHeight();
 
-               $dest_width = $dest_height = 0;
-
                if ((!$width)|| (!$height)) {
                        return false;
                }
@@ -693,8 +689,6 @@ class Image
                        return $string;
                }
 
-               $quality = false;
-
                ob_start();
 
                // Enable interlacing
@@ -736,7 +730,6 @@ class Image
                Logger::log('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), Logger::DEBUG);
                $type = null;
                if ($fromcurl) {
-                       $a = \get_app();
                        $headers=[];
                        $h = explode("\n", $header);
                        foreach ($h as $l) {
@@ -835,8 +828,6 @@ class Image
         */
        public static function getScalingDimensions($width, $height, $max)
        {
-               $dest_width = $dest_height = 0;
-
                if ((!$width) || (!$height)) {
                        return false;
                }
@@ -967,8 +958,6 @@ class Image
 
                $hash = Photo::newResource();
 
-               $smallest = 0;
-
                // Pictures are always public by now
                //$defperm = '<'.$default_cid.'>';
                $defperm = "";
index b0307fd964f6647ad9199145958b2489d4b37e86..2d52f4244a6c5fbe19b10af406c5b78b8907fa13 100644 (file)
@@ -789,7 +789,7 @@ class Post extends BaseObject
                }
 
                if ($conv->isWritable() && $this->isWritable()) {
-                       $qc = $qcomment = null;
+                       $qcomment = null;
 
                        /*
                         * Hmmm, code depending on the presence of a particular addon?
index c36aa8ea6e9390301896f7b6f402a88e4a32ff80..c5795819a42e0d5a0f020d8bab3dc7a6714ea348 100644 (file)
@@ -178,9 +178,7 @@ class Thread extends BaseObject
         */
        public function getTemplateData($conv_responses)
        {
-               $a = self::getApp();
                $result = [];
-               $i = 0;
 
                foreach ($this->parents as $item) {
                        if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
index 5c9628d9ce75e9db508faea7dbc6bc0826536256..ea4d5ba411c1123eae0d4c199c972d2839c694ee 100644 (file)
@@ -477,8 +477,6 @@ class Processor
                        return;
                }
 
-               $owner = User::getOwnerDataById($uid);
-
                $cid = Contact::getIdForURL($activity['actor'], $uid);
                if (empty($cid)) {
                        Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
@@ -513,8 +511,6 @@ class Processor
                        return;
                }
 
-               $owner = User::getOwnerDataById($uid);
-
                $cid = Contact::getIdForURL($activity['actor'], $uid);
                if (empty($cid)) {
                        Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
index 9949577a715846172e7ae7bf7ab77742367a4ad7..7f67bab7f58194c9497bc688d0792ff8a8554c0d 100644 (file)
@@ -379,15 +379,15 @@ class Receiver
                                if (in_array($object_data['object_type'], self::CONTENT_TYPES)) {
                                        ActivityPub\Processor::updateItem($object_data);
                                } elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
-                                       ActivityPub\Processor::updatePerson($object_data, $body);
+                                       ActivityPub\Processor::updatePerson($object_data);
                                }
                                break;
 
                        case 'as:Delete':
                                if ($object_data['object_type'] == 'as:Tombstone') {
-                                       ActivityPub\Processor::deleteItem($object_data, $body);
+                                       ActivityPub\Processor::deleteItem($object_data);
                                } elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
-                                       ActivityPub\Processor::deletePerson($object_data, $body);
+                                       ActivityPub\Processor::deletePerson($object_data);
                                }
                                break;
 
index bfaa1a8955c13fb9e2d3e5c73c1133101ee08b04..499337acb1cbc1395d2b0d33a7df701afb5a1002 100644 (file)
@@ -354,8 +354,6 @@ class Transmitter
                } else {
                        $receiver_list = Item::enumeratePermissions($item);
 
-                       $mentioned = [];
-
                        foreach ($terms as $term) {
                                $cid = Contact::getIdForURL($term['url'], $item['uid']);
                                if (!empty($cid) && in_array($cid, $receiver_list)) {
index 4786f8d62092926895fd469bffdec63c3104c003..e4269f38ec1782799354cd25118ec6cc9d1a8063 100644 (file)
@@ -181,24 +181,19 @@ class DFRN
 
                $owner = $r[0];
                $owner_id = $owner['uid'];
-               $owner_nick = $owner['nickname'];
 
                $sql_post_table = "";
 
                if (! $public_feed) {
-                       $sql_extra = '';
                        switch ($direction) {
                                case (-1):
                                        $sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id));
-                                       $my_id = $dfrn_id;
                                        break;
                                case 0:
                                        $sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
-                                       $my_id = '1:' . $dfrn_id;
                                        break;
                                case 1:
                                        $sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
-                                       $my_id = '0:' . $dfrn_id;
                                        break;
                                default:
                                        return false;
@@ -244,7 +239,6 @@ class DFRN
                                intval(TERM_CATEGORY),
                                intval($owner_id)
                        );
-                       //$sql_extra .= FileTag::fileQuery('item',$category,'category');
                }
 
                if ($public_feed && ! $converse) {
@@ -1179,8 +1173,6 @@ class DFRN
         */
        public static function deliver($owner, $contact, $atom, $dissolve = false, $legacy_transport = false)
        {
-               $a = \get_app();
-
                // At first try the Diaspora transport layer
                if (!$dissolve && !$legacy_transport) {
                        $curlResult = self::transmit($owner, $contact, $atom);
@@ -1205,7 +1197,6 @@ class DFRN
                Logger::log("Local rino version: ". $rino, Logger::DEBUG);
 
                $ssl_val = intval(Config::get('system', 'ssl_policy'));
-               $ssl_policy = '';
 
                switch ($ssl_val) {
                        case SSL_POLICY_FULL:
@@ -1442,8 +1433,6 @@ class DFRN
         */
        public static function transmit($owner, $contact, $atom, $public_batch = false)
        {
-               $a = \get_app();
-
                if (!$public_batch) {
                        if (empty($contact['addr'])) {
                                Logger::log('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
@@ -1708,7 +1697,6 @@ class DFRN
 
                                if (strtotime($value) < time()) {
                                        $value = str_replace($bdyear, $bdyear + 1, $value);
-                                       $bdyear = $bdyear + 1;
                                }
 
                                $poco["bd"] = $value;
@@ -1920,8 +1908,6 @@ class DFRN
         */
        private static function processSuggestion($xpath, $suggestion, $importer)
        {
-               $a = \get_app();
-
                Logger::log("Processing suggestions");
 
                /// @TODO Rewrite this to one statement
@@ -1995,7 +1981,7 @@ class DFRN
 
                $hash = Strings::getRandomHex();
 
-               $r = q(
+               q(
                        "INSERT INTO `intro` (`uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked`)
                        VALUES(%d, %d, %d, '%s', '%s', '%s', %d)",
                        intval($suggest["uid"]),
@@ -2408,8 +2394,6 @@ class DFRN
                                                $item["plink"] = $href;
                                                break;
                                        case "enclosure":
-                                               $enclosure = $href;
-
                                                if (!empty($item["attach"])) {
                                                        $item["attach"] .= ",";
                                                } else {
@@ -2596,8 +2580,6 @@ class DFRN
                        }
                }
 
-               $enclosure = "";
-
                $links = $xpath->query("atom:link", $entry);
                if ($links) {
                        self::parseLinks($links, $item);
@@ -2713,8 +2695,6 @@ class DFRN
 
                if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
                        $posted_id = Item::insert($item);
-                       $parent = 0;
-
                        if ($posted_id) {
                                Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, Logger::DEBUG);
 
index 0087ced4b1644317dad3b4a4a1bcd8e2661beb23..fadf337a6ac1a2ac67f471fed77c863ef266f042 100644 (file)
@@ -748,8 +748,6 @@ class Diaspora
                                Logger::log("Unknown message type ".$type);
                                return false;
                }
-
-               return true;
        }
 
        /**
@@ -2354,8 +2352,6 @@ class Diaspora
         */
        private static function receiveRequestMakeFriend(array $importer, array $contact)
        {
-               $a = \get_app();
-
                if ($contact["rel"] == Contact::SHARING) {
                        DBA::update(
                                'contact',
@@ -2415,7 +2411,7 @@ class Diaspora
                                        $user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
                                        if (DBA::isResult($user)) {
                                                Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], Logger::DEBUG);
-                                               $ret = self::sendShare($user, $contact);
+                                               self::sendShare($user, $contact);
                                        }
                                }
                                return true;
@@ -2449,7 +2445,7 @@ class Diaspora
 
                $batch = (($ret["batch"]) ? $ret["batch"] : implode("/", array_slice(explode("/", $ret["url"]), 0, 3))."/receive/public");
 
-               $r = q(
+               q(
                        "INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`nurl`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`)
                        VALUES (%d, '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d)",
                        intval($importer["uid"]),
@@ -2489,7 +2485,7 @@ class Diaspora
 
                        $hash = Strings::getRandomHex().(string)time();   // Generate a confirm_key
 
-                       $ret = q(
+                       q(
                                "INSERT INTO `intro` (`uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
                                VALUES (%d, %d, %d, %d, '%s', '%s', '%s')",
                                intval($importer["uid"]),
@@ -2520,7 +2516,7 @@ class Diaspora
                                $new_relation = Contact::FOLLOWER;
                        }
 
-                       $r = q(
+                       q(
                                "UPDATE `contact` SET `rel` = %d,
                                `name-date` = '%s',
                                `uri-date` = '%s',
@@ -2538,7 +2534,7 @@ class Diaspora
                        $user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
                        if (DBA::isResult($user)) {
                                Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], Logger::DEBUG);
-                               $ret = self::sendShare($user, $contact_record);
+                               self::sendShare($user, $contact_record);
 
                                // Send the profile data, maybe it weren't transmitted before
                                self::sendProfile($importer["uid"], [$contact_record]);
@@ -3127,8 +3123,6 @@ class Diaspora
         */
        public static function transmit(array $owner, array $contact, $envelope, $public_batch, $queue_run = false, $guid = "", $no_queue = false)
        {
-               $a = \get_app();
-
                $enabled = intval(Config::get("system", "diaspora_enabled"));
                if (!$enabled) {
                        return 200;
@@ -3871,15 +3865,14 @@ class Diaspora
                        // Remove the handle
                        $handle = array_pop($signed_parts);
 
-                       // Glue the parts together
-                       $text = implode(";", $signed_parts);
-
-                       $message = ["author" => $handle,
-                                       "guid" => $guid,
-                                       "parent_guid" => $parent_guid,
-                                       "text" => implode(";", $signed_parts),
-                                       "author_signature" => $item['signature'],
-                                       "parent_author_signature" => ""];
+                       $message = [
+                               "author" => $handle,
+                               "guid" => $guid,
+                               "parent_guid" => $parent_guid,
+                               "text" => implode(";", $signed_parts),
+                               "author_signature" => $item['signature'],
+                               "parent_author_signature" => ""
+                       ];
                }
                return $message;
        }
@@ -3996,14 +3989,6 @@ class Diaspora
                        return;
                }
 
-               $conv = [
-                       "author" => $cnv["creator"],
-                       "guid" => $cnv["guid"],
-                       "subject" => $cnv["subject"],
-                       "created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
-                       "participants" => $cnv["recips"]
-               ];
-
                $body = BBCode::toMarkdown($item["body"]);
                $created = DateTimeFormat::utc($item["created"], DateTimeFormat::ATOM);
 
@@ -4020,12 +4005,13 @@ class Diaspora
                        $type = "message";
                } else {
                        $message = [
-                                       "author" => $cnv["creator"],
-                                       "guid" => $cnv["guid"],
-                                       "subject" => $cnv["subject"],
-                                       "created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
-                                       "participants" => $cnv["recips"],
-                                       "message" => $msg];
+                               "author" => $cnv["creator"],
+                               "guid" => $cnv["guid"],
+                               "subject" => $cnv["subject"],
+                               "created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
+                               "participants" => $cnv["recips"],
+                               "message" => $msg
+                       ];
 
                        $type = "conversation";
                }
index dd9230fbd3b76997e71012dc1fed8a21c2ffc364..05d59a1525fd04ef395fd86635faa59aec128c32 100644 (file)
@@ -178,8 +178,6 @@ class Email
                // $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
                global $htmlmsg,$plainmsg,$charset,$attachments;
 
-               //echo $partno."\n";
-
                // DECODE DATA
                $data = ($partno)
                        ? @imap_fetchbody($mbox, $uid, $partno, FT_UID|FT_PEEK)
@@ -247,9 +245,6 @@ class Email
                        $x = "";
                        foreach ($p->parts as $partno0 => $p2) {
                                $x .=  self::messageGetPart($mbox, $uid, $p2, $partno . '.' . ($partno0+1), $subtype);  // 1.2, 1.2.1, etc.
-                               //if ($x) {
-                               //      return $x;
-                               //}
                        }
                        return $x;
                }
@@ -559,26 +554,6 @@ class Email
                                $nextline = ltrim(substr($nextline, 1));
                        }
 
-                       $firstword = strpos($nextline.' ', ' ');
-
-                       $specialchars = ((substr(trim($nextline), 0, 1) == '-') ||
-                                       (substr(trim($nextline), 0, 1) == '=') ||
-                                       (substr(trim($nextline), 0, 1) == '*') ||
-                                       (substr(trim($nextline), 0, 1) == '·') ||
-                                       (substr(trim($nextline), 0, 4) == '[url') ||
-                                       (substr(trim($nextline), 0, 5) == '[size') ||
-                                       (substr(trim($nextline), 0, 7) == 'http://') ||
-                                       (substr(trim($nextline), 0, 8) == 'https://'));
-
-                       if (!$specialchars) {
-                               $specialchars = ((substr(rtrim($line), -1) == '-') ||
-                                               (substr(rtrim($line), -1) == '=') ||
-                                               (substr(rtrim($line), -1) == '*') ||
-                                               (substr(rtrim($line), -1) == '·') ||
-                                               (substr(rtrim($line), -6) == '[/url]') ||
-                                               (substr(rtrim($line), -7) == '[/size]'));
-                       }
-
                        if (!empty($lines[$lineno])) {
                                if (substr($lines[$lineno], -1) != ' ') {
                                        $lines[$lineno] .= ' ';
@@ -625,13 +600,11 @@ class Email
                }
 
                $quotelevel = 0;
-               $previousquote = 0;
                $arrbodyquoted = [];
 
                for ($i = 0; $i < count($arrbody); $i++) {
                        $previousquote = $quotelevel;
                        $quotelevel = $arrlevel[$i];
-                       $currline = $arrbody[$i];
 
                        while ($previousquote < $quotelevel) {
                                $quote = "[quote]";
index 86e831c705e6f9e310cf7b7b9a91a8a42e5135cb..3981a8860cbf4c3f949885634bf9b703015c01a0 100644 (file)
@@ -318,7 +318,6 @@ class Feed {
                                $href = "";
                                $length = "";
                                $type = "";
-                               $title = "";
 
                                foreach ($enclosure->attributes AS $attribute) {
                                        if (in_array($attribute->name, ["url", "href"])) {
index 84a97c20a3f641b7f932db720cffaa73f157ca8c..a62e1266295adc87c78073c9d27136bdb253bce0 100644 (file)
@@ -398,8 +398,6 @@ class OStatus
                $authordata = $xpath->query('//author')->item(0);
                $author = self::fetchAuthor($xpath, $authordata, $importer, $contact, $stored);
 
-               $entry = $xpath->query('/atom:entry');
-
                // Reverse the order of the entries
                $entrylist = [];
 
@@ -528,7 +526,6 @@ class OStatus
 
                                if ($valid) {
                                        $default_contact = 0;
-                                       $key = count(self::$itemlist);
                                        for ($key = count(self::$itemlist) - 1; $key >= 0; $key--) {
                                                if (empty(self::$itemlist[$key]['contact-id'])) {
                                                        self::$itemlist[$key]['contact-id'] = $default_contact;
@@ -1191,7 +1188,6 @@ class OStatus
                } else {
                        return "http://".$server[0]."/notice/".$conversation[1];
                }
-               return $href;
        }
 
        /**
@@ -1287,8 +1283,6 @@ class OStatus
         */
        private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false)
        {
-               $a = \get_app();
-
                $root = $doc->createElementNS(NAMESPACE_ATOM1, 'feed');
                $doc->appendChild($root);
 
@@ -1699,7 +1693,7 @@ class OStatus
                        Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
                }
 
-               $title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
+               self::entryHeader($doc, $entry, $owner, $item, $toplevel);
 
                $condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
                        'network' => [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]];
@@ -1764,7 +1758,7 @@ class OStatus
                        Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
                }
 
-               $title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
+               self::entryHeader($doc, $entry, $owner, $item, $toplevel);
 
                $verb = NAMESPACE_ACTIVITY_SCHEMA."favorite";
                self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false);
index da42a057edcc4b1951e9b49e8d4fa2c53198c77d..4b8b6fff63f1446bb12cd818e9c53b07dddbc4bd 100644 (file)
@@ -63,8 +63,6 @@ class PortableContact
         */
        public static function load($cid, $uid, $zcid, $url)
        {
-               $a = \get_app();
-
                if ($cid) {
                        if (!$url || !$uid) {
                                $contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
@@ -230,7 +228,6 @@ class PortableContact
                        $friendica = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$1$2", $profile);
                        if ($friendica != $profile) {
                                $server_url = $friendica;
-                               $network = Protocol::DFRN;
                        }
                }
 
@@ -238,7 +235,6 @@ class PortableContact
                        $diaspora = preg_replace("=(https?://)(.*)/u/(.*)=ism", "$1$2", $profile);
                        if ($diaspora != $profile) {
                                $server_url = $diaspora;
-                               $network = Protocol::DIASPORA;
                        }
                }
 
@@ -246,7 +242,6 @@ class PortableContact
                        $red = preg_replace("=(https?://)(.*)/channel/(.*)=ism", "$1$2", $profile);
                        if ($red != $profile) {
                                $server_url = $red;
-                               $network = Protocol::DIASPORA;
                        }
                }
 
@@ -255,7 +250,6 @@ class PortableContact
                        $mastodon = preg_replace("=(https?://)(.*)/users/(.*)=ism", "$1$2", $profile);
                        if ($mastodon != $profile) {
                                $server_url = $mastodon;
-                               $network = Protocol::OSTATUS;
                        }
                }
 
@@ -264,7 +258,6 @@ class PortableContact
                        $ostatus = preg_replace("=(https?://)(.*)/user/(.*)=ism", "$1$2", $profile);
                        if ($ostatus != $profile) {
                                $server_url = $ostatus;
-                               $network = Protocol::OSTATUS;
                        }
                }
 
@@ -273,7 +266,6 @@ class PortableContact
                        $base = preg_replace("=(https?://)(.*?)/(.*)=ism", "$1$2", $profile);
                        if ($base != $profile) {
                                $server_url = $base;
-                               $network = Protocol::PHANTOM;
                        }
                }
 
@@ -609,8 +601,6 @@ class PortableContact
         */
        private static function detectPocoData(array $data)
        {
-               $server = false;
-
                if (!isset($data['entry'])) {
                        return false;
                }
index 4e4d329d3dee41515e3202fc67f56993babddff4..c7e7c3c5ea68bf4af44b4acd27b66fc16762b981 100644 (file)
@@ -92,8 +92,6 @@ class Network
         */
        public static function curl($url, $binary = false, &$redirects = 0, $opts = [])
        {
-               $ret = ['return_code' => 0, 'success' => false, 'header' => '', 'info' => '', 'body' => ''];
-
                $stamp1 = microtime(true);
 
                $a = \get_app();
@@ -322,7 +320,6 @@ class Network
 
                $s = @curl_exec($ch);
 
-               $base = $s;
                $curl_info = curl_getinfo($ch);
 
                $curlResponse = new CurlResult($url, $s, $curl_info, curl_errno($ch), curl_error($ch));
index e2bd1e4e5bbb6f2549a00a62404ca37cc3cb8a89..9a3de88cf2ac789d5866edf28d41e35bdf6c412e 100644 (file)
@@ -113,8 +113,6 @@ class ParseUrl
         */
        public static function getSiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1)
        {
-               $a = \get_app();
-
                $siteinfo = [];
 
                // Check if the URL does contain a scheme
index 09072610c142fccbbd3e461432e0c853b29b3b82..d56b2311f3b746d8aac24fffcae7894c45461977 100644 (file)
@@ -287,9 +287,6 @@ class XML
 
                //Initializations
                $xml_array = [];
-               $parents = [];
-               $opened_tags = [];
-               $arr = [];
 
                $current = &$xml_array; // Reference
 
index 1db7d916d14aaba6a0f071259ca8b0bd987401a8..b9a8c0f2ecf34258bb828a834ea662caeb733477 100644 (file)
@@ -143,13 +143,11 @@ class Cron
                $manual_id  = 0;
                $generation = 0;
                $force      = false;
-               $restart    = false;
 
                if ($parameter == 'force') {
                        $force = true;
                }
                if ($parameter == 'restart') {
-                       $restart = true;
                        $generation = intval($generation);
                        if (!$generation) {
                                exit();
@@ -167,8 +165,6 @@ class Cron
 
                Addon::reload();
 
-               $d = DateTimeFormat::utcNow();
-
                // Only poll from those with suitable relationships,
                // and which have a polling address and ignore Diaspora since
                // we are unable to match those posts with a Diaspora GUID and prevent duplicates.
index f123b2dd89d957cfa65346edafae84687f204d16..6d253e0ceafc9f62d707d6b76cd1cfcf6e0b9017 100644 (file)
@@ -60,8 +60,6 @@ class DBClean {
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
        private static function removeOrphans($stage) {
-               $count = 0;
-
                // We split the deletion in many small tasks
                $limit = Config::get('system', 'dbclean-expire-limit', 1000);
 
index 112c79c8cd3c60b1f87db4fbd42700568e8d3340..2d36ee8f47c49efdb91b42e6545b1dc470f0b868 100644 (file)
@@ -30,11 +30,7 @@ class OnePoll
 
                Logger::log('Start for contact ' . $contact_id);
 
-               $manual_id  = 0;
-               $generation = 0;
-               $hub_update = false;
                $force      = false;
-               $restart    = false;
 
                if ($command == "force") {
                        $force = true;
@@ -45,7 +41,6 @@ class OnePoll
                        return;
                }
 
-               $d = DateTimeFormat::utcNow();
 
                $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
                if (!DBA::isResult($contact)) {
@@ -580,7 +575,7 @@ class OnePoll
                                                                $datarray['allow_cid'] = '<' . $contact['id'] . '>';
                                                        }
 
-                                                       $stored_item = Item::insert($datarray);
+                                                       Item::insert($datarray);
 
                                                        switch ($mailconf['action']) {
                                                                case 0:
index 9f5fcdcc5fed056de4f709d5cb6437faf4214445..1fb19693104e6f423a5352b01c0ec2268824ab64 100644 (file)
@@ -26,8 +26,6 @@ class PubSubPublish
 
        private static function publish($id)
        {
-               $a = BaseObject::getApp();
-
                $subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
                if (!DBA::isResult($subscriber)) {
                        return;
@@ -58,8 +56,6 @@ class PubSubPublish
                $postResult = Network::post($subscriber['callback_url'], $params, $headers);
                $ret = $postResult->getReturnCode();
 
-               $condition = ['id' => $subscriber['id']];
-
                if ($ret >= 200 && $ret <= 299) {
                        Logger::log('Successfully pushed to ' . $subscriber['callback_url']);