]> git.mxchange.org Git - friendica.git/commitdiff
Fix undefined variable/wrong parameter count/unknown functions
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 17 Dec 2017 20:31:37 +0000 (15:31 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 17 Dec 2017 20:33:45 +0000 (15:33 -0500)
16 files changed:
src/Content/ForumManager.php
src/Core/Cache.php
src/Core/NotificationsManager.php
src/Core/PConfig.php
src/Model/Group.php
src/Network/FKOAuthDataStore.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/Feed.php
src/Protocol/PortableContact.php
src/Util/Lock.php
src/Util/XML.php
src/Worker/CronHooks.php
src/Worker/Expire.php
src/Worker/OnePoll.php
src/Worker/Queue.php

index d800a0bd8b4050504644713fa881b7b0bce93b4c..3a564e328df228e99537728436d676952d03b5ab 100644 (file)
@@ -160,7 +160,7 @@ class ForumManager
                $contacts = self::getList($uid, $lastitem, false, false);
 
                $total_shown = 0;
-
+               $forumlist = '';
                foreach ($contacts as $contact) {
                        $forumlist .= micropro($contact, false, 'forumlist-profile-advanced');
                        $total_shown ++;
index 4da097ce2a0c490433686ecff7df3efa5a237050..e2673595c1e100e3fb41f2d68cdaab72d1211a49 100644 (file)
@@ -107,7 +107,7 @@ class Cache
                }
 
                // Frequently clear cache
-               self::clear($duration);
+               self::clear();
 
                $r = dba::select('cache', array('v'), array('k' => $key), array('limit' => 1));
 
index 7b9dba8963f92b52c3a3a23809eca025068e2081..9839f7147c975d27db5606232df75f920a9641b5 100644 (file)
@@ -767,7 +767,7 @@ class NotificationsManager
        public function introNotifs($all = false, $start = 0, $limit = 80)
        {
                $ident = 'introductions';
-               $total = $this->introTotal($seen);
+               $total = $this->introTotal($all);
                $notifs = array();
                $sql_extra = "";
 
index bf84a4b8f77b417ef3f28208292d1b4d00ee08a7..4bc7193a0ab06c1f679778efd64ad741bab26f01 100644 (file)
@@ -140,7 +140,7 @@ class PConfig
                // manage array value
                $dbvalue = (is_array($value) ? serialize($value) : $dbvalue);
 
-               dba::update('pconfig', array('v' => $dbvalue), array('uid' => $uid, 'cat' => $family, 'k' => $key), true);
+               $ret = dba::update('pconfig', array('v' => $dbvalue), array('uid' => $uid, 'cat' => $family, 'k' => $key), true);
 
                if ($ret) {
                        self::$in_db[$uid][$family][$key] = true;
index 410f78b1564216ffb2dbd1ecd599ffccb3970492..a23b417cc933dd5ff9004d654f3e1c1c95c20b79 100644 (file)
@@ -139,8 +139,13 @@ class Group extends BaseObject
                        return false;
                }
 
+               $group = dba::select('group', ['uid'], ['gid' => $gid], ['limit' => 1]);
+               if (!DBM::is_result($group)) {
+                       return false;
+               }
+
                // remove group from default posting lists
-               $user = dba::select('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $uid], ['limit' => 1]);
+               $user = dba::select('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']], ['limit' => 1]);
                if (DBM::is_result($user)) {
                        $change = false;
 
@@ -158,7 +163,7 @@ class Group extends BaseObject
                        }
 
                        if ($change) {
-                               dba::update('user', $user, ['uid' => $uid]);
+                               dba::update('user', $user, ['uid' => $group['uid']]);
                        }
                }
 
index e8f580c58a2d508ec284dbc70ac5c40ee6a483f8..27aa46d99f2e0d27c24f9c00c12caf9122f244e5 100644 (file)
@@ -44,7 +44,7 @@ class FKOAuthDataStore extends OAuthDataStore
                logger(__function__.":".$consumer_key);
                
                $s = dba::select('clients', array('client_id', 'pw', 'redirect_uri'), array('client_id' => $consumer_key));
-               $r = dba::inArray($r);
+               $r = dba::inArray($s);
 
                if (DBM::is_result($r)) {
                        return new \OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
@@ -119,7 +119,7 @@ class FKOAuthDataStore extends OAuthDataStore
                                'secret' => $sec,
                                'client_id' => $k,
                                'scope' => 'request',
-                               'expires' => UNIX_TIMESTAMP() + REQUEST_TOKEN_DURATION)
+                               'expires' => time() + REQUEST_TOKEN_DURATION)
                );
 
                if (!$r) {
@@ -160,7 +160,7 @@ class FKOAuthDataStore extends OAuthDataStore
                                        'secret' => $sec,
                                        'client_id' => $consumer->key,
                                        'scope' => 'access',
-                                       'expires' => UNIX_TIMESTAMP() + ACCESS_TOKEN_DURATION,
+                                       'expires' => time() + ACCESS_TOKEN_DURATION,
                                        'uid' => $uverifier)
                        );
 
index ee5e76cb4e57ba9a54cb59d77c277f55bdeaf10d..fd37a810c3d134f8256156f9162e0e81d03bfaff 100644 (file)
@@ -2500,6 +2500,7 @@ class DFRN
 
                /// @todo Do we really need this check for HTML elements? (It was copied from the old function)
                if ((strpos($item['body'], '<') !== false) && (strpos($item['body'], '>') !== false)) {
+                       $base_url = get_app()->get_baseurl();
                        $item['body'] = reltoabs($item['body'], $base_url);
 
                        $item['body'] = html2bb_video($item['body']);
@@ -3014,7 +3015,7 @@ class DFRN
 
                // The account type is new since 3.5.1
                if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) {
-                       $accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()", $context)->item(0)->nodeValue);
+                       $accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()")->item(0)->nodeValue);
 
                        if ($accounttype != $importer["contact-type"]) {
                                dba::update('contact', array('contact-type' => $accounttype), array('id' => $importer["id"]));
@@ -3023,7 +3024,7 @@ class DFRN
 
                // is it a public forum? Private forums aren't supported with this method
                // This is deprecated since 3.5.1
-               $forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()", $context)->item(0)->nodeValue);
+               $forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()")->item(0)->nodeValue);
 
                if ($forum != $importer["forum"]) {
                        $condition = array('`forum` != ? AND `id` = ?', $forum, $importer["id"]);
index 321df6d28cd4f1f35eecba09b1c08387b3cae23f..a56b1fe87759de314ca3ca32199a9833b65ec9cd 100644 (file)
@@ -665,7 +665,6 @@ class Diaspora
                        } elseif (!in_array($fieldname, array("author_signature", "parent_author_signature", "target_author_signature"))) {
                                if ($signed_data != "") {
                                        $signed_data .= ";";
-                                       $signed_data_parent .= ";";
                                }
 
                                $signed_data .= $entry;
@@ -2311,16 +2310,16 @@ class Diaspora
                                $A = "[url=".$self[0]["url"]."]".$self[0]["name"]."[/url]";
                                $B = "[url=".$contact["url"]."]".$contact["name"]."[/url]";
                                $BPhoto = "[url=".$contact["url"]."][img]".$contact["thumb"]."[/img][/url]";
-                               $arr["body"] = sprintf(t("%1$s is now friends with %2$s"), $A, $B)."\n\n\n".$Bphoto;
+                               $arr["body"] = sprintf(t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto;
 
                                $arr["object"] = self::constructNewFriendObject($contact);
 
                                $arr["last-child"] = 1;
 
-                               $arr["allow_cid"] = $user[0]["allow_cid"];
-                               $arr["allow_gid"] = $user[0]["allow_gid"];
-                               $arr["deny_cid"]  = $user[0]["deny_cid"];
-                               $arr["deny_gid"]  = $user[0]["deny_gid"];
+                               $arr["allow_cid"] = $self[0]["allow_cid"];
+                               $arr["allow_gid"] = $self[0]["allow_gid"];
+                               $arr["deny_cid"]  = $self[0]["deny_cid"];
+                               $arr["deny_gid"]  = $self[0]["deny_gid"];
 
                                $i = item_store($arr);
                                if ($i) {
@@ -3209,7 +3208,7 @@ class Diaspora
                        $return_code = self::transmit($owner, $contact, $envelope, $public_batch, false, $guid);
                }
 
-               logger("guid: ".$item["guid"]." result ".$return_code, LOGGER_DEBUG);
+               logger("guid: ".$guid." result ".$return_code, LOGGER_DEBUG);
 
                return $return_code;
        }
index 63706dcd68db202f31a0f037d16d1136f3d3023b..b12b5c93293a31fb8081ebd6aff0eed4086df42e 100644 (file)
@@ -127,7 +127,7 @@ class Feed {
                                if ($value != "") {
                                        $author["author-nick"] = $value;
                                }
-                               $value = $xpath->evaluate('atom:author/poco:address/poco:formatted/text()', $context)->item(0)->nodeValue;
+                               $value = $xpath->evaluate('atom:author/poco:address/poco:formatted/text()')->item(0)->nodeValue;
                                if ($value != "") {
                                        $author["author-location"] = $value;
                                }
@@ -299,9 +299,6 @@ class Feed {
                        if ($creator != "") {
                                $item["author-name"] = $creator;
                        }
-                       if ($pubDate != "") {
-                               $item["edited"] = $item["created"] = $pubDate;
-                       }
                        $creator = $xpath->query('dc:creator/text()', $entry)->item(0)->nodeValue;
 
                        if ($creator != "") {
index 727cce4e1e2a1661aa74dfa0df078606446364ee..0fcf6f57436ef7e3f59511505e937d124c6607a4 100644 (file)
@@ -816,7 +816,7 @@ class PortableContact
                        return false;
                }
 
-               $server["site_name"] = $xpath->evaluate($element."//head/title/text()", $context)->item(0)->nodeValue;
+               $server["site_name"] = $xpath->evaluate($element."//head/title/text()")->item(0)->nodeValue;
                return $server;
        }
 
index 69b906d03c205cfc977344998ac124b1c249ebe0..87590c295b3d35097cab147ace3b2570429b5dfb 100644 (file)
@@ -64,7 +64,7 @@ class Lock
                $file = $temp.'/'.$fn_name.'.sem';
 
                if (!file_exists($file)) {
-                       file_put_contents($file, $function);
+                       file_put_contents($file, $fn_name);
                }
 
                return ftok($file, 'f');
index bfd1b8bf5966ffb919e121c7e7484e1230b6dcc6..70af4cad53d42a963b33a8f1636a4a28ee528c1c 100644 (file)
@@ -292,11 +292,11 @@ class XML
                // Go through the tags.
                $repeated_tag_index = array(); // Multiple tags with same name will be turned into an array
                foreach ($xml_values as $data) {
-                       unset($attributes, $value); // Remove existing values, or there will be trouble
-
-                       // This command will extract these variables into the foreach scope
-                       // tag(string), type(string), level(int), attributes(array).
-                       extract($data); // We could use the array by itself, but this cooler.
+                       $tag        = $data['tag'];
+                       $type       = $data['type'];
+                       $level      = $data['level'];
+                       $attributes = isset($data['attributes']) ? $data['attributes'] : null;
+                       $value      = isset($data['value']) ? $data['value'] : null;
 
                        $result = array();
                        $attributes_data = array();
index 22109931feb75703215573ed36b6c5dd6f94fc26..fed65b2291e757d484dd8a963456a981c1a14eb6 100644 (file)
@@ -18,7 +18,7 @@ Class CronHooks {
                        foreach ($a->hooks["cron"] as $single_hook) {
                                if ($single_hook[1] == $hook) {
                                        logger("Calling cron hook '" . $hook . "'", LOGGER_DEBUG);
-                                       call_single_hook($a, $name, $single_hook, $data);
+                                       call_single_hook($a, $hook, $single_hook);
                                }
                        }
                        return;
index 5a512e9b8e64fded7228c72fa429fc2bddb3952b..e963d6d3519d43ae6e278ae26de6b0793ac3fe7c 100644 (file)
@@ -50,7 +50,7 @@ class Expire {
                        foreach ($a->hooks["expire"] as $hook) {
                                if ($hook[1] == $hook_name) {
                                        logger("Calling expire hook '" . $hook[1] . "'", LOGGER_DEBUG);
-                                       call_single_hook($a, $name, $hook, $data);
+                                       call_single_hook($a, $hook_name, $hook, $data);
                                }
                        }
                        return;
index eaf0058f19ffeb7d5ac2d140101905fd140f28af..fc819751bc8521a1057601f6579b2686c4d4a01f 100644 (file)
@@ -631,6 +631,7 @@ Class OnePoll
                        dba::update('gcontact', array('last_failure' => $updated), array('nurl' => $contact['nurl']));
                        Contact::markForArchival($contact);
                } else {
+                       $updated = datetime_convert();
                        dba::update('contact', array('last-update' => $updated), array('id' => $contact['id']));
                }
 
index 8b741b78615ce700463c4235ff9066a853ddcbbf..179e37c0770bc7bd501a0866adc281f21e98b0f8 100644 (file)
@@ -55,7 +55,7 @@ class Queue
                         */
                        $r = q("SELECT `id` FROM `queue` WHERE ((`created` > UTC_TIMESTAMP() - INTERVAL 12 HOUR AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE) OR (`last` < UTC_TIMESTAMP() - INTERVAL 1 HOUR)) ORDER BY `cid`, `created`");
 
-                       call_hooks('queue_predeliver', $a, $r);
+                       call_hooks('queue_predeliver', $r);
 
                        if (DBM::is_result($r)) {
                                foreach ($r as $q_item) {
@@ -166,7 +166,7 @@ class Queue
 
                        default:
                                $params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
-                               call_hooks('queue_deliver', $a, $params);
+                               call_hooks('queue_deliver', $params);
 
                                if ($params['result']) {
                                        remove_queue_item($q_item['id']);