From 00fdc2d08f0776ae9c94f31cd997695a31af804d Mon Sep 17 00:00:00 2001 From: xiaomlove <1939737565@qq.com> Date: Wed, 15 Apr 2026 03:27:30 +0700 Subject: [PATCH] support pg --- app/Models/Faq.php | 9 +++++++ app/Models/RegImage.php | 13 ++++++++++ app/Models/Torrent.php | 24 ++++++++++++++++++- app/Repositories/DashboardRepository.php | 3 ++- .../Captcha/Drivers/ImageCaptchaDriver.php | 16 +++++-------- include/functions.php | 13 +++++++--- nexus/Database/NexusDB.php | 24 +++++++++++++++++-- nexus/Field/Field.php | 9 ++++++- nexus/Install/Install.php | 18 +------------- public/faq.php | 10 ++++---- public/forums.php | 2 +- public/staff.php | 2 +- public/takeupload.php | 2 +- public/topten.php | 21 ++++++++++------ public/userdetails.php | 16 +++++++------ resources/lang/en/dashboard.php | 2 +- resources/lang/zh_CN/dashboard.php | 2 +- resources/lang/zh_TW/dashboard.php | 2 +- 18 files changed, 129 insertions(+), 59 deletions(-) create mode 100644 app/Models/Faq.php create mode 100644 app/Models/RegImage.php diff --git a/app/Models/Faq.php b/app/Models/Faq.php new file mode 100644 index 00000000..ab23aad8 --- /dev/null +++ b/app/Models/Faq.php @@ -0,0 +1,9 @@ + ['text' => 'Windows-vy'], ]; + public function scopeWhereInfoHash($query, string $binaryHash) + { + if (NexusDB::isPgsql()) { + return $query->whereRaw( + "info_hash = decode(?, 'hex')", + [bin2hex($binaryHash)] + ); + } elseif (NexusDB::isMysql()) { + return $query->where('info_hash', $binaryHash); + } + throw new \RuntimeException("Not supported database"); + } + public function getPickInfoAttribute() { $info = self::$pickTypes[$this->picktype] ?? null; @@ -521,8 +535,16 @@ class Torrent extends NexusModel public function tags(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { + $idsString = TagRepository::getOrderByFieldIdString(); + if (NexusDB::isPgsql()) { + $orderByRaw = "array_position(ARRAY[$idsString]::int[], tags.id)"; + } else if (NexusDB::isMysql()) { + $orderByRaw = "FIELD(tags.id, $idsString)"; + } else { + throw new \RuntimeException("Unsupported database"); + } return $this->belongsToMany(Tag::class, 'torrent_tags', 'torrent_id', 'tag_id') - ->orderByRaw(sprintf("field(`tags`.`id`,%s)", TagRepository::getOrderByFieldIdString())); + ->orderByRaw($orderByRaw); } public function reward_logs(): \Illuminate\Database\Eloquent\Relations\HasMany diff --git a/app/Repositories/DashboardRepository.php b/app/Repositories/DashboardRepository.php index af69e9b6..3fbaa60b 100644 --- a/app/Repositories/DashboardRepository.php +++ b/app/Repositories/DashboardRepository.php @@ -47,10 +47,11 @@ class DashboardRepository extends BaseRepository 'value' => PHP_VERSION, ]; $name = 'mysql_version'; + $databaseInfo = NexusDB::getDatabaseVersionInfo(); $result[$name] = [ 'name' => $name, 'text' => nexus_trans("dashboard.system_info.$name"), - 'value' => NexusDB::select('select version() as info')[0]['info'], + 'value' => sprintf("%s: %s", $databaseInfo['dbType'], $databaseInfo['version']), ]; // $name = 'os'; // $result[$name] = [ diff --git a/app/Services/Captcha/Drivers/ImageCaptchaDriver.php b/app/Services/Captcha/Drivers/ImageCaptchaDriver.php index 05adf6bb..127544be 100644 --- a/app/Services/Captcha/Drivers/ImageCaptchaDriver.php +++ b/app/Services/Captcha/Drivers/ImageCaptchaDriver.php @@ -2,6 +2,7 @@ namespace App\Services\Captcha\Drivers; +use App\Models\RegImage; use App\Services\Captcha\CaptchaDriverInterface; use App\Services\Captcha\Exceptions\CaptchaValidationException; @@ -67,16 +68,11 @@ class ImageCaptchaDriver implements CaptchaDriverInterface $random = random_str(); $imagehash = md5($random); $dateline = time(); - - $sql = sprintf( - "INSERT INTO `regimages` (`imagehash`, `imagestring`, `dateline`) VALUES ('%s', '%s', '%s')", - mysql_real_escape_string($imagehash), - mysql_real_escape_string($random), - mysql_real_escape_string((string) $dateline) - ); - - sql_query($sql); - + RegImage::query()->insert([ + 'imagehash' => $imagehash, + 'dateline' => $dateline, + 'imagestring' => $random, + ]); return $imagehash; } diff --git a/include/functions.php b/include/functions.php index 9623956d..c6680524 100644 --- a/include/functions.php +++ b/include/functions.php @@ -3303,7 +3303,7 @@ function pager($rpp, $count, $href, $opts = array(), $pagename = "page") { $start = $page * $rpp; $add_key_shortcut = key_shortcut($page,$pages-1); - return array($pagertop, $pagerbottom, "LIMIT $start,$rpp", $start, $rpp, $page); + return array($pagertop, $pagerbottom, "limit $rpp offset $start", $start, $rpp, $page); } function commenttable($rows, $type, $parent_id, $review = false) @@ -6146,7 +6146,7 @@ function calculate_seed_bonus($uid, $torrentIdArr = null): array $idStr = implode(',', \Illuminate\Support\Arr::wrap($torrentIdArr)); $sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, 'NO_PEER_ID' as peerID, '' as last_action, '' as ip from torrents WHERE id in ($idStr) and size >= $minSize"; } else { - $sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, peers.id as peerID, peers.last_action, peers.ip from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' and torrents.size > $minSize group by peers.torrent, peers.peer_id"; + $sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, peers.id as peerID, peers.last_action, peers.ip from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' and torrents.size > $minSize group by torrents.id, peers.id"; } $tagGrouped = []; $torrentResult = \Nexus\Database\NexusDB::select($sql); @@ -6161,7 +6161,14 @@ function calculate_seed_bonus($uid, $torrentIdArr = null): array $officialAdditionalFactor = \App\Models\Setting::get('bonus.official_addition'); $zeroBonusTag = \App\Models\Setting::get('bonus.zero_bonus_tag'); $zeroBonusFactor = \App\Models\Setting::get('bonus.zero_bonus_factor'); - $userMedalResult = \Nexus\Database\NexusDB::select("select round(sum(bonus_addition_factor), 5) as factor from medals where id in (select medal_id from user_medals where uid = $uid and (expire_at is null or expire_at > '$nowStr') and (bonus_addition_expire_at is null or bonus_addition_expire_at > '$nowStr'))"); + if (\Nexus\Database\NexusDB::isMysql()) { + $factorField = "round(sum(bonus_addition_factor), 5)"; + } elseif (\Nexus\Database\NexusDB::isPgsql()) { + $factorField = "round(sum(bonus_addition_factor)::numeric, 5)"; + } else { + throw new \RuntimeException("Not supported database"); + } + $userMedalResult = \Nexus\Database\NexusDB::select("select $factorField as factor from medals where id in (select medal_id from user_medals where uid = $uid and (expire_at is null or expire_at > '$nowStr') and (bonus_addition_expire_at is null or bonus_addition_expire_at > '$nowStr'))"); $medalAdditionalFactor = floatval($userMedalResult[0]['factor'] ?? 0); do_log("$logPrefix, sql: $sql, count: " . count($torrentResult) . ", officialTag: $officialTag, officialAdditionalFactor: $officialAdditionalFactor, zeroBonusTag: $zeroBonusTag, zeroBonusFactor: $zeroBonusFactor, medalAdditionalFactor: $medalAdditionalFactor"); $last_action = ""; diff --git a/nexus/Database/NexusDB.php b/nexus/Database/NexusDB.php index 3f23df0d..86f38930 100644 --- a/nexus/Database/NexusDB.php +++ b/nexus/Database/NexusDB.php @@ -164,9 +164,9 @@ class NexusDB if (!IN_NEXUS) { return DB::table($table)->insertGetId($data); } - $fields = array_map(function ($value) {return "`$value`";}, array_keys($data)); + $fields = array_map(function ($value) {return "$value";}, array_keys($data)); $values = array_map(function ($value) {return sqlesc($value);}, array_values($data)); - $sql = sprintf("insert into `%s` (%s) values (%s)", $table, implode(', ', $fields), implode(', ', $values)); + $sql = sprintf("insert into %s (%s) values (%s)", $table, implode(', ', $fields), implode(', ', $values)); sql_query($sql); return mysql_insert_id(); } @@ -486,4 +486,24 @@ class NexusDB return $indexesNames; } + public static function getDatabaseVersionInfo(): array + { + if (self::isMysql()) { + $sql = 'select version() as v'; + $result = NexusDB::select($sql); + $version = $result[0]['v']; + $minVersion = '5.7.8'; + } else if (self::isPgsql()) { + $sql = 'SHOW server_version;'; + $result = NexusDB::select($sql); + $version = $result[0]['server_version']; + $minVersion = '16.0'; + } else { + throw new \RuntimeException('Not supported database.'); + } + $dbType = self::getConnectionName(); + $match = version_compare($version, $minVersion, '>='); + return compact('version', 'match', 'minVersion', 'dbType'); + } + } diff --git a/nexus/Field/Field.php b/nexus/Field/Field.php index fbf83555..1752713d 100644 --- a/nexus/Field/Field.php +++ b/nexus/Field/Field.php @@ -384,7 +384,14 @@ JS; $torrentIdArr = [$torrentId]; } $torrentIdStr = implode(',', $torrentIdArr); - $res = sql_query("select f.*, v.custom_field_value, v.torrent_id from torrents_custom_field_values v inner join torrents_custom_fields f on v.custom_field_id = f.id inner join searchbox box on box.id = $searchBoxId and find_in_set(f.id, box.custom_fields) where torrent_id in ($torrentIdStr) order by f.priority desc"); + if (NexusDB::isMysql()) { + $customFieldStr = "find_in_set(f.id, box.custom_fields)"; + } elseif (NexusDB::isPgsql()) { + $customFieldStr = "f.id = ANY(string_to_array(box.custom_fields, ',')::int[])"; + } else { + throw new \RuntimeException("Not supported database"); + } + $res = sql_query("select f.*, v.custom_field_value, v.torrent_id from torrents_custom_field_values v inner join torrents_custom_fields f on v.custom_field_id = f.id inner join searchbox box on box.id = $searchBoxId and $customFieldStr where torrent_id in ($torrentIdStr) order by f.priority desc"); $values = []; $result = []; while ($row = mysql_fetch_assoc($res)) { diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 1ce04c54..680e8cea 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -733,23 +733,7 @@ class Install public function getDatabaseVersionInfo(): array { - if (NexusDB::isMysql()) { - $sql = 'select version() as v'; - $result = NexusDB::select($sql); - $version = $result[0]['v']; - $minVersion = '5.7.8'; - $dbType = "mysql"; - } else if (NexusDB::isPgsql()) { - $sql = 'SHOW server_version;'; - $result = NexusDB::select($sql); - $version = $result[0]['server_version']; - $minVersion = '16.0'; - $dbType = "pgsql"; - } else { - throw new \RuntimeException('Not supported database.'); - } - $match = version_compare($version, $minVersion, '>='); - return compact('version', 'match', 'minVersion', 'dbType'); + return NexusDB::getDatabaseVersionInfo(); } public function getRedisVersionInfo(): array diff --git a/public/faq.php b/public/faq.php index b39459ff..0846d28b 100644 --- a/public/faq.php +++ b/public/faq.php @@ -22,15 +22,17 @@ $is_rulelang = get_single_value("language","rule_lang","WHERE id = ".sqlesc($lan if (!$is_rulelang){ $lang_id = 6; //English } -$res = sql_query("SELECT `id`, `link_id`, `question`, `flag` FROM `faq` WHERE `type`='categ' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC"); -while ($arr = mysql_fetch_array($res)) { +//$res = sql_query("SELECT id, link_id, question, flag FROM faq WHERE type='categ' AND lang_id = ".sqlesc($lang_id)." ORDER BY order ASC"); +$res = \App\Models\Faq::query()->where('type', 'categ')->where('lang_id', $lang_id)->orderBy('order')->get()->toArray(); + foreach ($res as $arr) { $faq_categ[$arr['link_id']]['title'] = $arr['question']; $faq_categ[$arr['link_id']]['flag'] = $arr['flag']; $faq_categ[$arr['link_id']]['link_id'] = $arr['link_id']; } -$res = sql_query("SELECT `id`, `link_id`, `question`, `answer`, `flag`, `categ` FROM `faq` WHERE `type`='item' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC"); -while ($arr = mysql_fetch_array($res)) { +//$res = sql_query("SELECT id, link_id, question, answer, flag, categ FROM faq WHERE type='item' AND lang_id = ".sqlesc($lang_id)." ORDER BY order ASC"); +$res = \App\Models\Faq::query()->where('type', 'item')->where('lang_id', $lang_id)->get()->toArray(); +foreach ($res as $arr) { $faq_categ[$arr['categ']]['items'][$arr['id']]['question'] = $arr['question']; $faq_categ[$arr['categ']]['items'][$arr['id']]['answer'] = $arr['answer']; $faq_categ[$arr['categ']]['items'][$arr['id']]['flag'] = $arr['flag']; diff --git a/public/forums.php b/public/forums.php index 8b501002..33cb885c 100644 --- a/public/forums.php +++ b/public/forums.php @@ -671,7 +671,7 @@ if ($action == "viewtopic") $pagerbottom = "

".$pagerstr."
".$pager."

\n"; //------ Get posts - $res = sql_query("SELECT * FROM posts $where ORDER BY id LIMIT $offset,$perpage") or sqlerr(__FILE__, __LINE__); + $res = sql_query("SELECT * FROM posts $where ORDER BY id LIMIT $perpage offset $offset") or sqlerr(__FILE__, __LINE__); stdhead($lang_forums['head_view_topic']." \"".$orgsubject."\""); begin_main_frame("",true); diff --git a/public/staff.php b/public/staff.php index 3b1211dd..7f6144a0 100644 --- a/public/staff.php +++ b/public/staff.php @@ -91,7 +91,7 @@ end_frame(); //--------------------- forum moderators section ---------------------------// $ppl = ''; -$res = sql_query("SELECT forummods.userid AS userid, users.last_access, users.country FROM forummods LEFT JOIN users ON forummods.userid = users.id GROUP BY userid ORDER BY forummods.forumid, forummods.userid") or sqlerr(); +$res = sql_query("SELECT forummods.userid AS userid, users.last_access, users.country FROM forummods LEFT JOIN users ON forummods.userid = users.id GROUP BY userid,users.last_access, users.country,forummods.forumid, forummods.userid ORDER BY forummods.forumid, forummods.userid") or sqlerr(); while ($arr = mysql_fetch_assoc($res)) { $countryrow = get_country_row($arr['country']); diff --git a/public/takeupload.php b/public/takeupload.php index 7c612402..ffce0729 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -139,7 +139,7 @@ if ($piecesCount > $maxPieceCount && $idealPiecesCount < $maxPieceCount) { bark('Too many pieces'); } $infohash = $dict->getInfoHashV1ForAnnounce(); -$exists = \App\Models\Torrent::query()->where('info_hash', $infohash)->first(['id']); +$exists = \App\Models\Torrent::query()->whereInfoHash($infohash)->first(['id']); if ($exists) { // bark($lang_takeupload['std_torrent_existed']); nexus_redirect(sprintf("details.php?id=%d&existed=1", $exists['id'])); diff --git a/public/topten.php b/public/topten.php index ae5b5960..b81a5851 100644 --- a/public/topten.php +++ b/public/topten.php @@ -484,7 +484,14 @@ $Cache->add_whole_row(); if ($type == 1) { - $mainquery = "SELECT id as userid, username, added, uploaded, downloaded, uploaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS upspeed, downloaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS downspeed FROM users WHERE enabled = 'yes'"; + if (\Nexus\Database\NexusDB::isMysql()) { + $speedStr = "uploaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS upspeed, downloaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS downspeed"; + } else if (\Nexus\Database\NexusDB::isPgsql()) { + $speedStr = "uploaded::numeric / (EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM added)) AS upspeed"; + } else { + throw new \RuntimeException('Not supported database.'); + } + $mainquery = "SELECT id as userid, username, added, uploaded, downloaded, $speedStr FROM users WHERE enabled = 'yes'"; if ($limit == 10 || $subtype == "ul") @@ -581,7 +588,7 @@ elseif ($type == 3) { if ($limit == 10 || $subtype == "us") { - $r = sql_query("SELECT name, flagpic, COUNT(users.country) as num FROM countries LEFT JOIN users ON users.country = countries.id GROUP BY name ORDER BY num DESC LIMIT $limit") or sqlerr(); + $r = sql_query("SELECT name, flagpic, COUNT(users.country) as num FROM countries LEFT JOIN users ON users.country = countries.id GROUP BY name,flagpic ORDER BY num DESC LIMIT $limit") or sqlerr(); countriestable($r, $lang_topten['text_top']."$limit ".$lang_topten['text_countries_users']. ($limit == 10 ? " - [Top 25]" : ""),$lang_topten['col_users']); } @@ -630,13 +637,13 @@ elseif ($type == 5) { if ($limit == 10 || $subtype == "mtop") { - $r = sql_query( "SELECT users_topics.userid, users_topics.usertopics, COUNT(posts.id) as userposts FROM (SELECT users.id as userid, COUNT(topics.id) as usertopics from users LEFT JOIN topics ON users.id = topics.userid GROUP BY users.id) as users_topics LEFT JOIN posts ON users_topics.userid = posts.userid GROUP BY users_topics.userid ORDER BY usertopics DESC LIMIT $limit") or sqlerr(); + $r = sql_query( "SELECT users_topics.userid, users_topics.usertopics, COUNT(posts.id) as userposts FROM (SELECT users.id as userid, COUNT(topics.id) as usertopics from users LEFT JOIN topics ON users.id = topics.userid GROUP BY users.id) as users_topics LEFT JOIN posts ON users_topics.userid = posts.userid GROUP BY users_topics.userid, users_topics.usertopics ORDER BY usertopics DESC LIMIT $limit") or sqlerr(); postable($r, $lang_topten['text_top']."$limit ".$lang_topten['text_most_topic'] . ($limit == 10 ? " - [".$lang_topten['text_one_hundred']."] - [".$lang_topten['text_top_250']."]" : "")); } if ($limit == 10 || $subtype == "mpos") { - $r = sql_query( "SELECT users_topics.userid, users_topics.usertopics, COUNT(posts.id) as userposts FROM (SELECT users.id as userid, COUNT(topics.id) as usertopics from users LEFT JOIN topics ON users.id = topics.userid GROUP BY users.id) as users_topics LEFT JOIN posts ON users_topics.userid = posts.userid GROUP BY users_topics.userid ORDER BY userposts DESC LIMIT $limit") or sqlerr(); + $r = sql_query( "SELECT users_topics.userid, users_topics.usertopics, COUNT(posts.id) as userposts FROM (SELECT users.id as userid, COUNT(topics.id) as usertopics from users LEFT JOIN topics ON users.id = topics.userid GROUP BY users.id) as users_topics LEFT JOIN posts ON users_topics.userid = posts.userid GROUP BY users_topics.userid, users_topics.usertopics ORDER BY userposts DESC LIMIT $limit") or sqlerr(); postable($r, $lang_topten['text_top']."$limit ".$lang_topten['text_most_post'] . ($limit == 10 ? " - [".$lang_topten['text_one_hundred']."] - [".$lang_topten['text_top_250']."]" : "")); } @@ -704,17 +711,17 @@ if ($enabledonation == 'yes'){ if ($limit == 10 || $subtype == "mcli") { - $r = sql_query( "SELECT agent_allowed_family.family as client_name, COUNT(users.id) as client_num from users RIGHT JOIN agent_allowed_family ON agent_allowed_family.id = users.clientselect GROUP BY clientselect ORDER BY client_num DESC LIMIT $limit") or sqlerr(); + $r = sql_query( "SELECT agent_allowed_family.family as client_name, COUNT(users.id) as client_num from users RIGHT JOIN agent_allowed_family ON agent_allowed_family.id = users.clientselect GROUP BY clientselect, client_name ORDER BY client_num DESC LIMIT $limit") or sqlerr(); clienttable($r, $lang_topten['text_top']."$limit ".$lang_topten['text_most_client'] . ($limit == 10 ? " - [".$lang_topten['text_one_hundred']."] - [".$lang_topten['text_top_250']."]" : "")); } if ($limit == 10 || $subtype == "ss") { - $r = sql_query( "SELECT stylesheets.name as stylesheet_name, COUNT(users.id) as stylesheet_num from users JOIN stylesheets ON stylesheets.id = users.stylesheet GROUP BY stylesheet ORDER BY stylesheet_num DESC LIMIT $limit") or sqlerr(); + $r = sql_query( "SELECT stylesheets.name as stylesheet_name, COUNT(users.id) as stylesheet_num from users JOIN stylesheets ON stylesheets.id = users.stylesheet GROUP BY stylesheet, stylesheet_name ORDER BY stylesheet_num DESC LIMIT $limit") or sqlerr(); stylesheettable($r, $lang_topten['text_top']."$limit ".$lang_topten['text_most_stylesheet'] . ($limit == 10 ? " - [Top 25] - [Top 50]" : "")); } if ($limit == 10 || $subtype == "lang") { - $r = sql_query( "SELECT language.lang_name as lang_name, COUNT(users.id) as lang_num from users JOIN language ON language.id = users.lang WHERE site_lang=1 GROUP BY lang ORDER BY lang_num DESC LIMIT $limit") or sqlerr(); + $r = sql_query( "SELECT language.lang_name as lang_name, COUNT(users.id) as lang_num from users JOIN language ON language.id = users.lang WHERE site_lang=1 GROUP BY lang, lang_name ORDER BY lang_num DESC LIMIT $limit") or sqlerr(); languagetable($r, $lang_topten['text_top']."$limit ".$lang_topten['text_most_language'] . ($limit == 10 ? " - [Top 25]" : "")); } } diff --git a/public/userdetails.php b/public/userdetails.php index 5137d5a8..2d1bab84 100644 --- a/public/userdetails.php +++ b/public/userdetails.php @@ -40,12 +40,14 @@ else { $lastseen .= " (" . gettime($lastseen, true, false, true).")"; } -$res = sql_query("SELECT COUNT(*) FROM comments WHERE user=" . $user['id']) or sqlerr(); -$arr3 = mysql_fetch_row($res); -$torrentcomments = $arr3[0]; -$res = sql_query("SELECT COUNT(*) FROM posts WHERE userid=" . $user['id']) or sqlerr(); -$arr3 = mysql_fetch_row($res); -$forumposts = $arr3[0]; +//$res = sql_query("SELECT COUNT(*) FROM comments WHERE user=" . $user['id']) or sqlerr(); +//$arr3 = mysql_fetch_row($res); +//$torrentcomments = $arr3[0]; +$torrentcomments = \App\Models\Comment::query()->where('user', $user['id'])->count(); +//$res = sql_query("SELECT COUNT(*) FROM posts WHERE userid=" . $user['id']) or sqlerr(); +//$arr3 = mysql_fetch_row($res); +//$forumposts = $arr3[0]; +$forumposts = \App\Models\Post::query()->where('userid', $user['id'])->count(); $arr = get_country_row($user['country']); $country = "\"".$arr['name']."\""; @@ -240,7 +242,7 @@ if (user_can('userprofile') || $user["id"] == $CURUSER["id"]) tr_small($lang_userdetails['row_ip_address'], hide_text($ip.$locationinfo.$seedBoxIcon), 1); } $clientselect = ''; -$res = sql_query("SELECT peer_id, agent, ipv4, ipv6, port FROM peers WHERE userid = {$user['id']} GROUP BY agent, ipv4, ipv6, port") or sqlerr(); +$res = sql_query("SELECT peer_id, agent, ipv4, ipv6, port FROM peers WHERE userid = {$user['id']} GROUP BY peer_id, agent, ipv4, ipv6, port") or sqlerr(); if (mysql_num_rows($res) > 0) { $clientselect .= ""; diff --git a/resources/lang/en/dashboard.php b/resources/lang/en/dashboard.php index d4306c20..d522b1fd 100644 --- a/resources/lang/en/dashboard.php +++ b/resources/lang/en/dashboard.php @@ -42,7 +42,7 @@ return [ 'nexus_release_date' => 'NexusPHP release date', 'laravel_version' => 'Laravel version', 'php_version' => 'PHP version', - 'mysql_version' => 'Mysql version', + 'mysql_version' => 'Database version', 'os' => 'OS', 'server_software' => 'Web software', 'load_average' => 'Server load average', diff --git a/resources/lang/zh_CN/dashboard.php b/resources/lang/zh_CN/dashboard.php index 3772731e..6151b64e 100644 --- a/resources/lang/zh_CN/dashboard.php +++ b/resources/lang/zh_CN/dashboard.php @@ -42,7 +42,7 @@ return [ 'nexus_release_date' => 'NexusPHP 发布日期', 'laravel_version' => 'Laravel 版本', 'php_version' => 'PHP 版本', - 'mysql_version' => 'Mysql 版本', + 'mysql_version' => 'Database 版本', 'os' => '操作系统', 'server_software' => 'Web 软件', 'load_average' => '服务器平均负载', diff --git a/resources/lang/zh_TW/dashboard.php b/resources/lang/zh_TW/dashboard.php index fb128dcf..ed062e6b 100644 --- a/resources/lang/zh_TW/dashboard.php +++ b/resources/lang/zh_TW/dashboard.php @@ -42,7 +42,7 @@ return [ 'nexus_release_date' => 'NexusPHP 發布日期', 'laravel_version' => 'Laravel 版本', 'php_version' => 'PHP 版本', - 'mysql_version' => 'Mysql 版本', + 'mysql_version' => 'Database 版本', 'os' => '操作系統', 'server_software' => 'Web 軟件', 'load_average' => '服務器平均負載',
AgentIPV4IPV6Port