1
0
Fork 0

Fix undefined variable/wrong parameter count/unknown functions

This commit is contained in:
Hypolite Petovan 2017-12-17 15:31:37 -05:00
parent 4b5894817e
commit 2978b1eef0
16 changed files with 36 additions and 33 deletions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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