Browse Source

Fix undefined variable/wrong parameter count/unknown functions

pull/4095/head
Hypolite Petovan 4 years ago
parent
commit
2978b1eef0
  1. 2
      src/Content/ForumManager.php
  2. 2
      src/Core/Cache.php
  3. 2
      src/Core/NotificationsManager.php
  4. 2
      src/Core/PConfig.php
  5. 9
      src/Model/Group.php
  6. 6
      src/Network/FKOAuthDataStore.php
  7. 5
      src/Protocol/DFRN.php
  8. 13
      src/Protocol/Diaspora.php
  9. 5
      src/Protocol/Feed.php
  10. 2
      src/Protocol/PortableContact.php
  11. 2
      src/Util/Lock.php
  12. 10
      src/Util/XML.php
  13. 2
      src/Worker/CronHooks.php
  14. 2
      src/Worker/Expire.php
  15. 1
      src/Worker/OnePoll.php
  16. 4
      src/Worker/Queue.php

2
src/Content/ForumManager.php

@ -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 ++;

2
src/Core/Cache.php

@ -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));

2
src/Core/NotificationsManager.php

@ -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 = "";

2
src/Core/PConfig.php

@ -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;

9
src/Model/Group.php

@ -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']]);
}
}

6
src/Network/FKOAuthDataStore.php

@ -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)
);

5
src/Protocol/DFRN.php

@ -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"]);

13
src/Protocol/Diaspora.php

@ -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;
}

5
src/Protocol/Feed.php

@ -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 != "") {

2
src/Protocol/PortableContact.php

@ -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;
}

2
src/Util/Lock.php

@ -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');

10
src/Util/XML.php

@ -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();

2
src/Worker/CronHooks.php

@ -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;

2
src/Worker/Expire.php

@ -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;

1
src/Worker/OnePoll.php

@ -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']));
}

4
src/Worker/Queue.php

@ -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']);

Loading…
Cancel
Save