mirror of
https://github.com/friendica/friendica
synced 2025-04-21 18:30:11 +00:00
Centralize owner data fetch
This commit is contained in:
parent
e37cf8fea2
commit
df02238659
3 changed files with 36 additions and 31 deletions
|
@ -33,6 +33,37 @@ require_once 'include/text.php';
|
|||
*/
|
||||
class User
|
||||
{
|
||||
/**
|
||||
* @brief Get owner data by user id
|
||||
*
|
||||
* @param int $uid
|
||||
* @return boolean|array
|
||||
*/
|
||||
public static function getOwnerDataById($uid) {
|
||||
$r = dba::p("SELECT
|
||||
`contact`.*,
|
||||
`user`.`prvkey` AS `uprvkey`,
|
||||
`user`.`timezone`,
|
||||
`user`.`nickname`,
|
||||
`user`.`sprvkey`,
|
||||
`user`.`spubkey`,
|
||||
`user`.`page-flags`,
|
||||
`user`.`account-type`,
|
||||
`user`.`prvnets`
|
||||
FROM `contact`
|
||||
INNER JOIN `user`
|
||||
ON `user`.`uid` = `contact`.`uid`
|
||||
WHERE `contact`.`uid` = ?
|
||||
AND `contact`.`self` = 1
|
||||
LIMIT 1",
|
||||
$uid
|
||||
);
|
||||
if (!DBM::is_result($r)) {
|
||||
return false;
|
||||
}
|
||||
return $r[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the default group for a given user and network
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue