mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-05-04 19:47:22 +08:00
support pg
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
class Faq extends NexusModel
|
||||
{
|
||||
protected $table = 'faq';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
use App\Models\Traits\NexusActivityLogTrait;
|
||||
|
||||
class RegImage extends NexusModel
|
||||
{
|
||||
protected $table = 'regimages';
|
||||
|
||||
protected $fillable = ['imagehash', 'imagestring', 'dateline'];
|
||||
}
|
||||
+23
-1
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use App\Repositories\TagRepository;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class Torrent extends NexusModel
|
||||
{
|
||||
@@ -186,6 +187,19 @@ class Torrent extends NexusModel
|
||||
self::NFO_VIEW_STYLE_WINDOWS => ['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
|
||||
|
||||
@@ -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] = [
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -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 = "";
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
+6
-4
@@ -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'];
|
||||
|
||||
+1
-1
@@ -671,7 +671,7 @@ if ($action == "viewtopic")
|
||||
$pagerbottom = "<p align=\"center\">".$pagerstr."<br />".$pager."</p>\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);
|
||||
|
||||
+1
-1
@@ -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']);
|
||||
|
||||
@@ -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']));
|
||||
|
||||
+14
-7
@@ -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 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=25&subtype=us\">Top 25</a>]</font>" : ""),$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 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=100&subtype=mtop\">".$lang_topten['text_one_hundred']."</a>] - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=250&subtype=mtop\">".$lang_topten['text_top_250']."</a>]</font>" : ""));
|
||||
}
|
||||
|
||||
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 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=100&subtype=mpos\">".$lang_topten['text_one_hundred']."</a>] - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=250&subtype=mpos\">".$lang_topten['text_top_250']."</a>]</font>" : ""));
|
||||
}
|
||||
|
||||
@@ -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 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=100&subtype=mcli\">".$lang_topten['text_one_hundred']."</a>] - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=250&subtype=mcli\">".$lang_topten['text_top_250']."</a>]</font>" : ""));
|
||||
}
|
||||
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 ? "<font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=25&subtype=ss\">Top 25</a>] - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=50&subtype=ss\">Top 50</a>]</font>" : ""));
|
||||
}
|
||||
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 ? "<font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type=$type&lim=25&subtype=lang\">Top 25</a>]</font>" : ""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 = "<img src=\"pic/flag/".$arr['flagpic']."\" alt=\"".$arr['name']."\" style='margin-left: 8pt' />";
|
||||
@@ -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 .= "<table border='1' cellspacing='0' cellpadding='5'><tr><td class='colhead'>Agent</td><td class='colhead'>IPV4</td><td class='colhead'>IPV6</td><td class='colhead'>Port</td></tr>";
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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' => '服务器平均负载',
|
||||
|
||||
@@ -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' => '服務器平均負載',
|
||||
|
||||
Reference in New Issue
Block a user