mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-19 00:01:00 +08:00
improve get_user_row()
This commit is contained in:
@@ -705,22 +705,25 @@ function get_user_row($id)
|
||||
{
|
||||
global $Cache, $CURUSER;
|
||||
static $curuserRowUpdated = false;
|
||||
static $neededColumns = array('id', 'noad', 'class', 'enabled', 'privacy', 'avatar', 'signature', 'uploaded', 'downloaded', 'last_access', 'username', 'donor', 'donoruntil', 'leechwarn', 'warned', 'title');
|
||||
static $neededColumns = array(
|
||||
'id', 'noad', 'class', 'enabled', 'privacy', 'avatar', 'signature', 'uploaded', 'downloaded', 'last_access', 'username', 'donor',
|
||||
'donoruntil', 'leechwarn', 'warned', 'title', 'downloadpos', 'parked', 'clientselect', 'showclienterror',
|
||||
);
|
||||
$cacheKey = 'user_'.$id.'_content';
|
||||
$row = \Nexus\Database\NexusDB::remember($cacheKey, 900, function () use ($id, $neededColumns) {
|
||||
$user = \App\Models\User::query()->with(['wearing_medals'])->find($id, $neededColumns);
|
||||
if ($user) {
|
||||
$userRep = new \App\Repositories\UserRepository();
|
||||
$metas = $userRep->listMetas($id, \App\Models\UserMeta::META_KEY_PERSONALIZED_USERNAME);
|
||||
$arr = $user->toArray();
|
||||
if ($metas->isNotEmpty()) {
|
||||
$arr['__is_rainbow'] = 1;
|
||||
} else {
|
||||
$arr['__is_rainbow'] = 0;
|
||||
}
|
||||
return $arr;
|
||||
if (!$user) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
$arr = $user->toArray();
|
||||
$userRep = new \App\Repositories\UserRepository();
|
||||
$metas = $userRep->listMetas($id, \App\Models\UserMeta::META_KEY_PERSONALIZED_USERNAME);
|
||||
if ($metas->isNotEmpty()) {
|
||||
$arr['__is_rainbow'] = 1;
|
||||
} else {
|
||||
$arr['__is_rainbow'] = 0;
|
||||
}
|
||||
return $arr;
|
||||
});
|
||||
|
||||
// if ($CURUSER && $id == $CURUSER['id']) {
|
||||
|
||||
@@ -172,7 +172,9 @@ if (!$torrent) {
|
||||
do_log("[TORRENT NOT EXISTS] infoHashUrlEncode: $infoHashUrlEncode", 'error');
|
||||
|
||||
err("torrent not registered with this tracker");
|
||||
} elseif (!user_can('seebanned', false, $userid)) {
|
||||
}
|
||||
//Do not use user_can(), some func user_can() used is not available IN_TRACKER
|
||||
if ($az['class'] < $seebanned_class) {
|
||||
if ($torrent['banned'] == 'yes') {
|
||||
err("torrent banned");
|
||||
} elseif ($torrent['approval_status'] != \App\Models\Torrent::APPROVAL_STATUS_ALLOW && get_setting('torrent.approval_status_none_visible') == 'no') {
|
||||
|
||||
Reference in New Issue
Block a user