Merge remote-tracking branch 'upstream/develop' into photo-guid
This commit is contained in:
commit
43a17b6129
5 changed files with 25 additions and 14 deletions
|
@ -549,12 +549,14 @@ class Database
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($args as $param => $value) {
|
foreach (array_keys($args) as $param) {
|
||||||
|
$data_type = PDO::PARAM_STR;
|
||||||
if (is_int($args[$param])) {
|
if (is_int($args[$param])) {
|
||||||
$data_type = PDO::PARAM_INT;
|
$data_type = PDO::PARAM_INT;
|
||||||
} else {
|
} elseif ($args[$param] !== null) {
|
||||||
$data_type = PDO::PARAM_STR;
|
$args[$param] = (string)$args[$param];
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->bindParam($param, $args[$param], $data_type);
|
$stmt->bindParam($param, $args[$param], $data_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,13 +607,16 @@ class Database
|
||||||
|
|
||||||
$param_types = '';
|
$param_types = '';
|
||||||
$values = [];
|
$values = [];
|
||||||
foreach ($args as $param => $value) {
|
foreach (array_keys($args) as $param) {
|
||||||
if (is_int($args[$param])) {
|
if (is_int($args[$param])) {
|
||||||
$param_types .= 'i';
|
$param_types .= 'i';
|
||||||
} elseif (is_float($args[$param])) {
|
} elseif (is_float($args[$param])) {
|
||||||
$param_types .= 'd';
|
$param_types .= 'd';
|
||||||
} elseif (is_string($args[$param])) {
|
} elseif (is_string($args[$param])) {
|
||||||
$param_types .= 's';
|
$param_types .= 's';
|
||||||
|
} elseif (is_object($args[$param]) && method_exists($args[$param], '__toString')) {
|
||||||
|
$param_types .= 's';
|
||||||
|
$args[$param] = (string)$args[$param];
|
||||||
} else {
|
} else {
|
||||||
$param_types .= 'b';
|
$param_types .= 'b';
|
||||||
}
|
}
|
||||||
|
@ -969,7 +974,7 @@ class Database
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a row into a table
|
* Insert a row into a table. Field value objects will be cast as string.
|
||||||
*
|
*
|
||||||
* @param string|array $table Table name or array [schema => table]
|
* @param string|array $table Table name or array [schema => table]
|
||||||
* @param array $param parameter array
|
* @param array $param parameter array
|
||||||
|
@ -1244,9 +1249,9 @@ class Database
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates rows
|
* Updates rows in the database. Field value objects will be cast as string.
|
||||||
*
|
*
|
||||||
* Updates rows in the database. When $old_fields is set to an array,
|
* When $old_fields is set to an array,
|
||||||
* the system will only do an update if the fields in that array changed.
|
* the system will only do an update if the fields in that array changed.
|
||||||
*
|
*
|
||||||
* Attention:
|
* Attention:
|
||||||
|
@ -1561,9 +1566,9 @@ class Database
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the error number of the last query
|
* Returns the error number of the last query
|
||||||
*
|
*
|
||||||
|
|
|
@ -850,6 +850,10 @@ class User
|
||||||
*/
|
*/
|
||||||
public static function getAvatarUrl(array $user, string $size = ''):string
|
public static function getAvatarUrl(array $user, string $size = ''):string
|
||||||
{
|
{
|
||||||
|
if (empty($user['nickname'])) {
|
||||||
|
DI::logger()->warning('Missing user nickname key', ['trace' => System::callstack(20)]);
|
||||||
|
}
|
||||||
|
|
||||||
$url = DI::baseUrl() . '/photo/';
|
$url = DI::baseUrl() . '/photo/';
|
||||||
|
|
||||||
switch ($size) {
|
switch ($size) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ class Photo extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please refactor this for the love of everything that's good
|
// Please refactor this for the love of everything that's good
|
||||||
if (!empty($parameters['id'])) {
|
if (isset($parameters['id'])) {
|
||||||
$id = $parameters['id'];
|
$id = $parameters['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,11 +104,11 @@ class Notify extends BaseDepository
|
||||||
$fields = [
|
$fields = [
|
||||||
'type' => $Notify->type,
|
'type' => $Notify->type,
|
||||||
'name' => $Notify->name,
|
'name' => $Notify->name,
|
||||||
'url' => (string)$Notify->url,
|
'url' => $Notify->url,
|
||||||
'photo' => (string)$Notify->photo,
|
'photo' => $Notify->photo,
|
||||||
'msg' => $Notify->msg,
|
'msg' => $Notify->msg,
|
||||||
'uid' => $Notify->uid,
|
'uid' => $Notify->uid,
|
||||||
'link' => (string)$Notify->link,
|
'link' => $Notify->link,
|
||||||
'iid' => $Notify->itemId,
|
'iid' => $Notify->itemId,
|
||||||
'parent' => $Notify->parent,
|
'parent' => $Notify->parent,
|
||||||
'seen' => $Notify->seen,
|
'seen' => $Notify->seen,
|
||||||
|
|
|
@ -69,6 +69,8 @@ class Feed
|
||||||
Logger::info("Import Atom/RSS feed '" . $contact["name"] . "' (Contact " . $contact["id"] . ") for user " . $importer["uid"]);
|
Logger::info("Import Atom/RSS feed '" . $contact["name"] . "' (Contact " . $contact["id"] . ") for user " . $importer["uid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$xml = trim($xml);
|
||||||
|
|
||||||
if (empty($xml)) {
|
if (empty($xml)) {
|
||||||
Logger::info('XML is empty.');
|
Logger::info('XML is empty.');
|
||||||
return [];
|
return [];
|
||||||
|
@ -83,7 +85,7 @@ class Feed
|
||||||
}
|
}
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadXML(trim($xml));
|
@$doc->loadXML($xml);
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
$xpath->registerNamespace('atom', ActivityNamespace::ATOM1);
|
$xpath->registerNamespace('atom', ActivityNamespace::ATOM1);
|
||||||
$xpath->registerNamespace('dc', "http://purl.org/dc/elements/1.1/");
|
$xpath->registerNamespace('dc', "http://purl.org/dc/elements/1.1/");
|
||||||
|
|
Loading…
Reference in a new issue