This commit is contained in:
xiaomlove
2021-12-14 16:22:03 +08:00
parent 19d7e048df
commit 3fa8fd19c0
29 changed files with 319 additions and 45 deletions
@@ -0,0 +1,73 @@
<?php
namespace App\Http\Controllers;
use App\Http\Resources\TorrentResource;
use App\Models\Torrent;
use App\Repositories\BookmarkRepository;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class BookmarkController extends Controller
{
private $repository;
public function __construct(BookmarkRepository $repository)
{
$this->repository = $repository;
}
public function index(Request $request)
{
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'torrent_id' => 'required|integer',
]);
$result = $this->repository->add(Auth::user(), $request->torrent_id);
return $this->success($result->toArray(), nexus_trans('bookmark.actions.store_success'));
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$result = $this->repository->remove(Auth::user(), $id);
return $this->success($result, nexus_trans('bookmark.actions.delete_success'));
}
}
@@ -6,6 +6,7 @@ use App\Http\Resources\TorrentResource;
use App\Models\Torrent;
use App\Repositories\TorrentRepository;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class TorrentController extends Controller
{
@@ -52,10 +53,13 @@ class TorrentController extends Controller
$result = Torrent::query()->with($with)->withCount(['peers', 'thank_users'])->visible()->findOrFail($id);
$isBookmarked = Auth::user()->bookmarks()->where('torrentid', $id)->exists();
$resource = new TorrentResource($result);
$resource->additional([
'page_title' => nexus_trans('torrent.show.page_title'),
'field_labels' => Torrent::getFieldLabels(),
'is_bookmarked' => (int)$isBookmarked,
]);
return $this->success($resource);
+1
View File
@@ -4,6 +4,7 @@ namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Validation\UnauthorizedException;
class Platform
{
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace App\Models;
class Bookmark extends NexusModel
{
protected $table = 'bookmarks';
protected $fillable = ['userid', 'torrentid'];
}
+1 -1
View File
@@ -40,7 +40,7 @@ class Exam extends NexusModel
self::INDEX_UPLOADED => ['name' => 'Uploaded', 'unit' => 'GB', 'source_user_field' => 'uploaded'],
self::INDEX_SEED_TIME_AVERAGE => ['name' => 'Seed time average', 'unit' => 'Hour', 'source_user_field' => 'seedtime'],
self::INDEX_DOWNLOADED => ['name' => 'Downloaded', 'unit' => 'GB', 'source_user_field' => 'downloaded'],
self::INDEX_SEED_BONUS => ['name' => 'Seed bonus', 'unit' => '', 'source_user_field' => 'seedbonus'],
self::INDEX_SEED_BONUS => ['name' => 'Seed bonus', 'unit' => '', 'source_user_field' => 'seed_points'],
];
const FILTER_USER_CLASS = 'classes';
+1 -1
View File
@@ -86,7 +86,7 @@ class Torrent extends NexusModel
public static function getFieldLabels(): array
{
$fields = ['comments', 'times_completed', 'peers_count', 'thank_users_count', 'numfiles'];
$fields = ['comments', 'times_completed', 'peers_count', 'thank_users_count', 'numfiles', 'bookmark_yes', 'bookmark_no'];
$result = [];
foreach($fields as $field) {
$result[$field] = nexus_trans("torrent.show.{$field}_label");
+29 -9
View File
@@ -3,6 +3,7 @@
namespace App\Models;
use App\Http\Middleware\Locale;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
@@ -41,15 +42,15 @@ class User extends Authenticatable
public static $classes = [
self::CLASS_PEASANT => ['text' => 'Peasant'],
self::CLASS_USER => ['text' => 'User'],
self::CLASS_POWER_USER => ['text' => 'Power User'],
self::CLASS_ELITE_USER => ['text' => 'Elite User'],
self::CLASS_CRAZY_USER => ['text' => 'Crazy User'],
self::CLASS_INSANE_USER => ['text' => 'Insane User'],
self::CLASS_VETERAN_USER => ['text' => 'Veteran User'],
self::CLASS_EXTREME_USER => ['text' => 'Extreme User'],
self::CLASS_ULTIMATE_USER => ['text' => 'Ultimate User'],
self::CLASS_NEXUS_MASTER => ['text' => 'Nexus Master'],
self::CLASS_USER => ['text' => 'User', 'min_seed_points' => 0],
self::CLASS_POWER_USER => ['text' => 'Power User', 'min_seed_points' => 40000],
self::CLASS_ELITE_USER => ['text' => 'Elite User', 'min_seed_points' => 80000],
self::CLASS_CRAZY_USER => ['text' => 'Crazy User', 'min_seed_points' => 150000],
self::CLASS_INSANE_USER => ['text' => 'Insane User', 'min_seed_points' => 250000],
self::CLASS_VETERAN_USER => ['text' => 'Veteran User', 'min_seed_points' => 400000],
self::CLASS_EXTREME_USER => ['text' => 'Extreme User', 'min_seed_points' => 600000],
self::CLASS_ULTIMATE_USER => ['text' => 'Ultimate User', 'min_seed_points' => 800000],
self::CLASS_NEXUS_MASTER => ['text' => 'Nexus Master', 'min_seed_points' => 1000000],
self::CLASS_VIP => ['text' => 'Vip'],
self::CLASS_RETIREE => ['text' => 'Retiree'],
self::CLASS_UPLOADER => ['text' => 'Uploader'],
@@ -161,6 +162,20 @@ class User extends Authenticatable
return 'en';
}
public static function getMinSeedPoints($class)
{
$setting = Setting::get("account.{$class}_min_seed_points");
if (is_numeric($setting)) {
return $setting;
}
return self::$classes[$class]['min_seed_points'] ?? false;
}
public function scopeNormal(Builder $query): Builder
{
return $query->where('status', self::STATUS_CONFIRMED)->where('enabled', self::ENABLED_YES);
}
public function exams()
{
@@ -215,6 +230,11 @@ class User extends Authenticatable
return $this->hasMany(Torrent::class, 'owner');
}
public function bookmarks(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(Bookmark::class, 'userid');
}
public function peers_torrents()
{
+1 -1
View File
@@ -16,7 +16,7 @@ class AuthenticateRepository extends BaseRepository
if (!$user || md5($user->secret . $password . $user->secret) != $user->passhash) {
throw new \InvalidArgumentException('Username or password invalid.');
}
if (!$user->canAccessAdmin()) {
if (IS_PLATFORM_ADMIN && !$user->canAccessAdmin()) {
throw new UnauthorizedException('Unauthorized!');
}
$tokenName = __METHOD__ . __LINE__;
+23
View File
@@ -6,7 +6,9 @@ use App\Models\HitAndRun;
use App\Models\Setting;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\Facades\DB;
use Nexus\Database\NexusDB;
class BonusRepository extends BaseRepository
@@ -65,4 +67,25 @@ class BonusRepository extends BaseRepository
return $result;
}
public function initSeedPoints(): int
{
$size = 10000;
$tableName = (new User())->getTable();
$result = 0;
do {
$affectedRows = DB::table($tableName)
->whereNull('seed_points')
->limit($size)
->update([
'seed_points' => DB::raw('seed_points = seedbonus')
]);
$result += $affectedRows;
do_log("affectedRows: $affectedRows, query: " . last_query());
} while ($affectedRows > 0);
return $result;
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Repositories;
use App\Exceptions\NexusException;
use App\Models\Torrent;
use App\Models\User;
class BookmarkRepository extends BaseRepository
{
public function add(User $user, $torrentId)
{
$torrent = Torrent::query()->findOrFail($torrentId);
$torrent->checkIsNormal();
$exists = $user->bookmarks()->where('torrentid', $torrentId)->exists();
if ($exists) {
throw new NexusException("torrent: $torrentId already bookmarked.");
}
$result = $user->bookmarks()->create(['torrentid' => $torrentId]);
return $result;
}
public function remove(User $user, $torrentId)
{
$torrent = Torrent::query()->findOrFail($torrentId);
$exists = $user->bookmarks()->where('torrentid', $torrentId)->exists();
if (!$exists) {
throw new NexusException("torrent: $torrentId has not been bookmarked.");
}
$result = $user->bookmarks()->where('torrentid', $torrentId)->delete();
return $result;
}
}
+8 -1
View File
@@ -247,7 +247,7 @@ class TorrentRepository extends BaseRepository
->paginate();
foreach ($snatches as &$snatch) {
$snatch->upload_text = sprintf('%s@%s', mksize($snatch->uploaded), $this->getSnatchUploadSpeed($snatch));
$snatch->download_text = sprintf('%s@%s', mksize($snatch->uploaded), $this->getSnatchDownloadSpeed($snatch));
$snatch->download_text = sprintf('%s@%s', mksize($snatch->downloaded), $this->getSnatchDownloadSpeed($snatch));
$snatch->share_ratio = $this->getShareRatio($snatch);
$snatch->seed_time = mkprettytime($snatch->seedtime);
$snatch->leech_time = mkprettytime($snatch->leechtime);
@@ -379,5 +379,12 @@ class TorrentRepository extends BaseRepository
}
public function getStickyStatus($torrent)
{
if (!$torrent instanceof Torrent) {
$torrent = Torrent::query()->findOrFail((int)$torrent, ['id', 'pos_state']);
}
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSeedPointsToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->decimal('seed_points', 20, 1)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('seed_points');
});
}
}
+12 -4
View File
@@ -96,7 +96,11 @@ function promotion($class, $down_floor_gb, $minratio, $time_week, $addinvite = 0
if ($down_floor_gb){
$limit = $down_floor_gb*1024*1024*1024;
$maxdt = date("Y-m-d H:i:s",(TIMENOW - 86400*7*$time_week));
$sql = "SELECT id, max_class_once FROM users WHERE class = $oriclass AND downloaded >= $limit AND uploaded / downloaded >= $minratio AND added < ".sqlesc($maxdt);
$minSeedPoints = \App\Models\User::getMinSeedPoints($class);
if ($minSeedPoints === false) {
throw new \RuntimeException("class: $class can't get min seed points.");
}
$sql = "SELECT id, max_class_once FROM users WHERE class = $oriclass AND downloaded >= $limit AND seed_points >= $minSeedPoints AND uploaded / downloaded >= $minratio AND added < ".sqlesc($maxdt);
$res = sql_query($sql) or sqlerr(__FILE__, __LINE__);
$matchUserCount = mysql_num_rows($res);
do_log("sql: $sql, match user count: $matchUserCount");
@@ -122,9 +126,12 @@ function promotion($class, $down_floor_gb, $minratio, $time_week, $addinvite = 0
function demotion($class,$deratio){
global $lang_cleanup_target;
$newclass = $class - 1;
$res = sql_query("SELECT id FROM users WHERE class = $class AND uploaded / downloaded < $deratio") or sqlerr(__FILE__, __LINE__);
$minSeedPoints = \App\Models\User::getMinSeedPoints($class);
if ($minSeedPoints === false) {
throw new \RuntimeException("class: $class can't get min seed points.");
}
$res = sql_query("SELECT id FROM users WHERE class = $class AND seed_points < $minSeedPoints AND uploaded / downloaded < $deratio") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
$dt = sqlesc(date("Y-m-d H:i:s"));
@@ -280,11 +287,12 @@ function docleanup($forceAll = 0, $printProgress = false) {
}
if ($count > $maxseeding_bonus)
$count = $maxseeding_bonus;
$all_bonus = ($valuetwo * atan($A / $l_bonus) + ($perseeding_bonus * $count)) / (3600 / $autoclean_interval_one);
$all_bonus = $seedPoints = ($valuetwo * atan($A / $l_bonus) + ($perseeding_bonus * $count)) / (3600 / $autoclean_interval_one);
$is_donor = get_single_value("users","donor","WHERE id=".$arr['userid']);
if ($is_donor == 'yes' && $donortimes_bonus > 0)
$all_bonus = $all_bonus * $donortimes_bonus;
KPS("+",$all_bonus,$arr["userid"]);
\App\Models\User::query()->where('id', $arr["userid"])->update(['seed_points' => new \Illuminate\Database\Query\Expression("seed_points + $seedPoints")]);
}
}
$log = 'calculate seeding bonus';
+3 -1
View File
@@ -2476,14 +2476,16 @@ else {
<?php if (get_user_class() >= UC_SYSOP) { ?> [<a href="settings.php"><?php echo $lang_functions['text_site_settings'] ?></a>]<?php } ?>
[<a href="torrents.php?inclbookmarked=1&amp;allsec=1&amp;incldead=0"><?php echo $lang_functions['text_bookmarks'] ?></a>]
<font class = 'color_bonus'><?php echo $lang_functions['text_bonus'] ?></font>[<a href="mybonus.php"><?php echo $lang_functions['text_use'] ?></a>]: <?php echo number_format($CURUSER['seedbonus'], 1)?>
<font class = 'color_bonus'><?php echo $lang_functions['text_seed_points'] ?></font>: <?php echo number_format($CURUSER['seed_points'], 1)?>
<?php if($attendance){ printf('&nbsp;'.$lang_functions['text_attended'], $attendance['points']); }else{ printf(' <a href="attendance.php" class="faqlink">%s</a>', $lang_functions['text_attendance']);}?>
<font class = 'color_invite'><?php echo $lang_functions['text_invite'] ?></font>[<a href="invite.php?id=<?php echo $CURUSER['id']?>"><?php echo $lang_functions['text_send'] ?></a>]: <?php echo $CURUSER['invites']?>
<?php if(get_setting('hr.mode') != \App\Models\HitAndRun::MODE_DISABLED) { ?><font class='color_bonus'>H&R: </font> <?php echo sprintf('[<a href="myhr.php">%s/%s</a>]', get_row_count('hit_and_runs', "where uid = {$CURUSER['id']} and status = 3"), get_setting('hr.ban_user_when_counts_reach'))?><?php }?><br />
<br />
<font class="color_ratio"><?php echo $lang_functions['text_ratio'] ?></font> <?php echo $ratio?>
<font class='color_uploaded'><?php echo $lang_functions['text_uploaded'] ?></font> <?php echo mksize($CURUSER['uploaded'])?>
<font class='color_downloaded'> <?php echo $lang_functions['text_downloaded'] ?></font> <?php echo mksize($CURUSER['downloaded'])?>
<font class='color_active'><?php echo $lang_functions['text_active_torrents'] ?></font> <img class="arrowup" alt="Torrents seeding" title="<?php echo $lang_functions['title_torrents_seeding'] ?>" src="pic/trans.gif" /><?php echo $activeseed?> <img class="arrowdown" alt="Torrents leeching" title="<?php echo $lang_functions['title_torrents_leeching'] ?>" src="pic/trans.gif" /><?php echo $activeleech?>&nbsp;&nbsp;
<font class='color_connectable'><?php echo $lang_functions['text_connectable'] ?></font><?php echo $connectable?> <?php echo maxslots();?>
<?php if(get_setting('hr.mode') != \App\Models\HitAndRun::MODE_DISABLED) { ?><font class='color_bonus'>H&R: </font> <?php echo sprintf('[<a href="myhr.php">%s/%s</a>]', get_row_count('hit_and_runs', "where uid = {$CURUSER['id']} and status = 3"), get_setting('hr.ban_user_when_counts_reach'))?><?php }?>
<?php if(get_user_class() >= UC_SYSOP) { ?> [<a href="/admin" target="_blank"><?php echo $lang_functions['text_management_system'] ?></a>]<?php }?>
</span>
</td>
+1
View File
@@ -319,6 +319,7 @@ $lang_functions = array
'text_technical_info' => '技术信息',
'text_technical_info_help_text' => '文件技术信息来自软件 <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>,用该软件打开文件,点击菜单视图(View)->文件(Text),在框中右键->全选,再右键->复制,粘贴到这里来。',
'text_management_system' => '管理系统',
'text_seed_points' => '做种积分',
);
?>
+2 -1
View File
@@ -305,7 +305,8 @@ $lang_settings = array
'row_promote_to_two' => "",
'text_member_longer_than' => "注册时间大于",
'text_downloaded_more_than' => "周,下载量大于",
'text_with_ratio_above' => " GB且分享率大于",
'text_with_ratio_above' => " 且分享率大于",
'text_seed_points_more_than' => 'GB,做种积分大于',
'text_be_promoted_to' => "的用户,将升级为",
'text_promote_to_default_one' => "。默认",
'text_promote_to_default_two' => ",他将被降级。默认",
+1
View File
@@ -320,6 +320,7 @@ $lang_functions = array
'text_technical_info' => '技術信息',
'text_technical_info_help_text' => '文件技術信息來自軟件 <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>,用該軟件打開文件,點擊菜單視圖(View)->文件(Text),在框中右鍵->全選,再右鍵->復制,粘貼到這裏來。',
'text_management_system' => '管理系統',
'text_seed_points' => '做種積分',
);
?>
+1
View File
@@ -321,6 +321,7 @@ $lang_functions = array
'text_technical_info' => 'Technical Info',
'text_technical_info_help_text' => 'Technical Information comes from software <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>open file, click the view menu > text > right click in the box > select all > copy > past into this box.',
'text_management_system' => 'Management system',
'text_seed_points' => 'Seed points',
);
?>
+1 -1
View File
@@ -11,7 +11,7 @@ int_check($id);
if (!isset($id) || !$id)
die();
$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, torrents.technical_info, torrents.hr,
$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, torrents.technical_info, torrents.hr, torrents.promotion_until, torrents.promotion_time_type,
categories.name AS cat_name, categories.mode as search_box_id, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name
FROM torrents LEFT JOIN categories ON torrents.category = categories.id
LEFT JOIN sources ON torrents.source = sources.id
+6 -6
View File
@@ -245,11 +245,11 @@ switch ($type)
}
}
if ($total_size){
echo "<br /><b>" . $count . "</b>" . $lang_getusertorrentlistajax ['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . "<br /><br />" . $torrentlist;
}elseif ($count){
echo "<br /><b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count)."<br /><br />".$torrentlist;
}else{
echo $lang_getusertorrentlistajax['text_no_record'];
if (isset($total_size) && $total_size){
echo "<br /><b>" . $count . "</b>" . $lang_getusertorrentlistajax ['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . "<br /><br />" . $torrentlist;
} elseif ($count){
echo "<br /><b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count)."<br /><br />".$torrentlist;
} else {
echo $lang_getusertorrentlistajax['text_no_record'];
}
?>
+33 -11
View File
@@ -114,7 +114,19 @@ elseif ($action == 'savesettings_account') // save account
{
stdhead($lang_settings['head_save_account_settings']);
$validConfig = array('neverdelete', 'neverdeletepacked', 'deletepacked', 'deleteunpacked', 'deletenotransfer', 'deletenotransfertwo', 'deletepeasant', 'psdlone', 'psratioone', 'psdltwo', 'psratiotwo', 'psdlthree', 'psratiothree', 'psdlfour', 'psratiofour', 'psdlfive', 'psratiofive', 'putime', 'pudl', 'puprratio', 'puderatio', 'eutime', 'eudl', 'euprratio', 'euderatio', 'cutime', 'cudl', 'cuprratio', 'cuderatio', 'iutime', 'iudl', 'iuprratio', 'iuderatio', 'vutime', 'vudl', 'vuprratio', 'vuderatio', 'exutime', 'exudl', 'exuprratio', 'exuderatio', 'uutime', 'uudl', 'uuprratio', 'uuderatio', 'nmtime', 'nmdl', 'nmprratio', 'nmderatio', 'getInvitesByPromotion');
$validConfig = array(
'neverdelete', 'neverdeletepacked', 'deletepacked', 'deleteunpacked', 'deletenotransfer', 'deletenotransfertwo', 'deletepeasant',
'psdlone', 'psratioone', 'psdltwo', 'psratiotwo', 'psdlthree', 'psratiothree', 'psdlfour', 'psratiofour', 'psdlfive', 'psratiofive',
'putime', 'pudl', \App\Models\User::CLASS_POWER_USER . '_min_seed_points', 'puprratio', 'puderatio',
'eutime', 'eudl', \App\Models\User::CLASS_ELITE_USER . '_min_seed_points', 'euprratio', 'euderatio',
'cutime', 'cudl', \App\Models\User::CLASS_CRAZY_USER . '_min_seed_points', 'cuprratio', 'cuderatio',
'iutime', 'iudl', \App\Models\User::CLASS_INSANE_USER . '_min_seed_points', 'iuprratio', 'iuderatio',
'vutime', 'vudl', \App\Models\User::CLASS_VETERAN_USER . '_min_seed_points', 'vuprratio', 'vuderatio',
'exutime', 'exudl', \App\Models\User::CLASS_EXTREME_USER . '_min_seed_points', 'exuprratio', 'exuderatio',
'uutime', 'uudl', \App\Models\User::CLASS_ULTIMATE_USER . '_min_seed_points', 'uuprratio', 'uuderatio',
'nmtime', 'nmdl', \App\Models\User::CLASS_NEXUS_MASTER . '_min_seed_points', 'nmprratio', 'nmderatio',
'getInvitesByPromotion'
);
GetVar($validConfig);
$ACCOUNT = [];
foreach($validConfig as $config) {
@@ -567,25 +579,35 @@ elseif ($action == 'accountsettings'){
<li>".$lang_settings['text_downloaded_amount_larger_than']."<input type='text' style=\"width: 50px\" name=psdlfour value='".(isset($ACCOUNT["psdlfour"]) ? $ACCOUNT["psdlfour"] : 400 )."'>".$lang_settings['text_and_ratio_below']."<input type='text' style=\"width: 50px\" name=psratiofour value='".(isset($ACCOUNT["psratiofour"]) ? $ACCOUNT["psratiofour"] : 0.7 )."'>".$lang_settings['text_demote_peasant_default_four']."</li>
<li>".$lang_settings['text_downloaded_amount_larger_than']."<input type='text' style=\"width: 50px\" name=psdlfive value='".(isset($ACCOUNT["psdlfive"]) ? $ACCOUNT["psdlfive"] : 800 )."'>".$lang_settings['text_and_ratio_below']."<input type='text' style=\"width: 50px\" name=psratiofive value='".(isset($ACCOUNT["psratiofive"]) ? $ACCOUNT["psratiofive"] : 0.8 )."'>".$lang_settings['text_demote_peasant_default_five']."</li>
</ul><br />".$lang_settings['text_demote_peasant_note'], 1);
function promotion_criteria($class, $input, $time, $dl, $prratio, $deratio, $defaultInvites=0){
function promotion_criteria($class, $input, $time, $dl, $prratio, $deratio, $defaultInvites=0, $defaultSeedPoints = 0){
global $lang_settings;
global $ACCOUNT;
$inputtime = $input."time";
$inputdl = $input."dl";
$inputprratio = $input."prratio";
$inputderatio = $input."deratio";
$inputSeedPoints = $class . "_min_seed_points";
if (!isset($class))
return;
tr($lang_settings['row_promote_to_one'].get_user_class_name($class,false,false,true).$lang_settings['row_promote_to_two'], $lang_settings['text_member_longer_than']."<input type='text' style=\"width: 50px\" name='".$inputtime."' value='".(isset($ACCOUNT[$inputtime]) ? $ACCOUNT[$inputtime] : $time )."'>".$lang_settings['text_downloaded_more_than']."<input type='text' style=\"width: 50px\" name='".$inputdl."' value='".(isset($ACCOUNT[$inputdl]) ? $ACCOUNT[$inputdl] : $dl )."'>".$lang_settings['text_with_ratio_above']."<input type='text' style=\"width: 50px\" name='".$inputprratio."' value='".(isset($ACCOUNT[$inputprratio]) ? $ACCOUNT[$inputprratio] : $prratio )."'>".$lang_settings['text_be_promoted_to'].get_user_class_name($class,false,true,true).$lang_settings['text_promote_to_default_one']."'".$time."', '".$dl."', '".$prratio."'.<br />".$lang_settings['text_demote_with_ratio_below']."<input type='text' style=\"width: 50px\" name='".$inputderatio."' value='".(isset($ACCOUNT[$inputderatio]) ? $ACCOUNT[$inputderatio] : $deratio )."'>".$lang_settings['text_promote_to_default_two']."'".$deratio."'.<br />".$lang_settings['text_users_get']."<input type='text' style=\"width: 50px\" name='getInvitesByPromotion[".$class."]' value='".(isset($ACCOUNT['getInvitesByPromotion'][$class]) ? $ACCOUNT['getInvitesByPromotion'][$class] : $defaultInvites )."'>".$lang_settings['text_invitations_default']."'".$defaultInvites."'.", 1);
$x = $lang_settings['row_promote_to_one'].get_user_class_name($class,false,false,true).$lang_settings['row_promote_to_two'];
$y = $lang_settings['text_member_longer_than']."<input type='text' style=\"width: 50px\" name='".$inputtime."' value='".(isset($ACCOUNT[$inputtime]) ? $ACCOUNT[$inputtime] : $time )."'>"
.$lang_settings['text_downloaded_more_than']."<input type='text' style=\"width: 50px\" name='".$inputdl."' value='".(isset($ACCOUNT[$inputdl]) ? $ACCOUNT[$inputdl] : $dl )."'>"
.$lang_settings['text_seed_points_more_than']."<input type='text' style=\"width: 60px\" name='".$inputSeedPoints."' value='".(isset($ACCOUNT[$inputSeedPoints]) ? $ACCOUNT[$inputSeedPoints] : $defaultSeedPoints )."'>"
.$lang_settings['text_with_ratio_above']."<input type='text' style=\"width: 50px\" name='".$inputprratio."' value='".(isset($ACCOUNT[$inputprratio]) ? $ACCOUNT[$inputprratio] : $prratio )."'>"
.$lang_settings['text_be_promoted_to'].get_user_class_name($class,false,true,true).$lang_settings['text_promote_to_default_one']."'".$time."', '".$dl."', '".$defaultSeedPoints."', '".$prratio."'.<br />"
.$lang_settings['text_demote_with_ratio_below']."<input type='text' style=\"width: 50px\" name='".$inputderatio."' value='".(isset($ACCOUNT[$inputderatio]) ? $ACCOUNT[$inputderatio] : $deratio )."'>".$lang_settings['text_promote_to_default_two']."'".$deratio."'.<br />"
.$lang_settings['text_users_get']."<input type='text' style=\"width: 50px\" name='getInvitesByPromotion[".$class."]' value='".(isset($ACCOUNT['getInvitesByPromotion'][$class]) ? $ACCOUNT['getInvitesByPromotion'][$class] : $defaultInvites )."'>".$lang_settings['text_invitations_default']."'".$defaultInvites."'.";
tr($x, $y, 1);
}
promotion_criteria(UC_POWER_USER, "pu", 4, 50, 1.05, 0.95, 1);
promotion_criteria(UC_ELITE_USER, "eu", 8, 120, 1.55, 1.45, 0);
promotion_criteria(UC_CRAZY_USER, "cu", 15, 300, 2.05, 1.95, 2);
promotion_criteria(UC_INSANE_USER, "iu", 25, 500, 2.55, 2.45, 0);
promotion_criteria(UC_VETERAN_USER, "vu", 40, 750, 3.05, 2.95, 3);
promotion_criteria(UC_EXTREME_USER, "exu", 60, 1024, 3.55, 3.45, 0);
promotion_criteria(UC_ULTIMATE_USER, "uu", 80, 1536, 4.05, 3.95, 5);
promotion_criteria(UC_NEXUS_MASTER, "nm", 100, 3072, 4.55, 4.45, 10);
promotion_criteria(UC_POWER_USER, "pu", 4, 50, 1.05, 0.95, 1, \App\Models\User::$classes[UC_POWER_USER]['min_seed_points']);
promotion_criteria(UC_ELITE_USER, "eu", 8, 120, 1.55, 1.45, 0, \App\Models\User::$classes[UC_ELITE_USER]['min_seed_points']);
promotion_criteria(UC_CRAZY_USER, "cu", 15, 300, 2.05, 1.95, 2, \App\Models\User::$classes[UC_CRAZY_USER]['min_seed_points']);
promotion_criteria(UC_INSANE_USER, "iu", 25, 500, 2.55, 2.45, 0, \App\Models\User::$classes[UC_INSANE_USER]['min_seed_points']);
promotion_criteria(UC_VETERAN_USER, "vu", 40, 750, 3.05, 2.95, 3, \App\Models\User::$classes[UC_VETERAN_USER]['min_seed_points']);
promotion_criteria(UC_EXTREME_USER, "exu", 60, 1024, 3.55, 3.45, 0, \App\Models\User::$classes[UC_EXTREME_USER]['min_seed_points']);
promotion_criteria(UC_ULTIMATE_USER, "uu", 80, 1536, 4.05, 3.95, 5, \App\Models\User::$classes[UC_ULTIMATE_USER]['min_seed_points']);
promotion_criteria(UC_NEXUS_MASTER, "nm", 100, 3072, 4.55, 4.45, 10, \App\Models\User::$classes[UC_NEXUS_MASTER]['min_seed_points']);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
+8 -5
View File
@@ -236,14 +236,14 @@ if(mysql_num_rows($rs_true_trans) > 0)
$row_true_trans = mysql_fetch_assoc($rs_true_trans);
$true_upload = $row_true_trans['SUM(uploaded)'];
$true_download = $row_true_trans['SUM(downloaded)'];
}
if ($user["downloaded"] > 0 || $true_download > 0)
if ($user["downloaded"] > 0 && $true_download > 0)
{
$sr = floor($user["uploaded"] / $user["downloaded"] * 1000) / 1000;
$true_ratio = floor($true_upload / $true_download * 1000) / 1000;
$sr = "<tr><td class=\"embedded\"><strong>" . $lang_userdetails['row_share_ratio'] . "</strong>: <font color=\"" . get_ratio_color($sr) . "\">" . number_format($sr, 3) . "</font><strong>".$lang_userdetails['row_real_share_ratio']."</strong>".number_format($true_ratio, 3)."</td><td class=\"embedded\">&nbsp;&nbsp;" . get_ratio_img($sr) . "</td></tr>";
}
//end
@@ -283,8 +283,11 @@ tr_small($lang_userdetails['row_torrent_comment'], ($torrentcomments && ($user["
tr_small($lang_userdetails['row_forum_posts'], ($forumposts && ($user["id"] == $CURUSER["id"] || get_user_class() >= $viewhistory_class) ? "<a href=\"userhistory.php?action=viewposts&amp;id=".$id."\" title=\"".$lang_userdetails['link_view_posts']."\">".$forumposts."</a>" : $forumposts), 1);
if ($user["id"] == $CURUSER["id"] || get_user_class() >= $viewhistory_class)
tr_small($lang_userdetails['row_karma_points'], htmlspecialchars($user['seedbonus']), 1);
if ($user["id"] == $CURUSER["id"] || get_user_class() >= $viewhistory_class) {
tr_small($lang_userdetails['row_karma_points'], htmlspecialchars($user['seedbonus']), 1);
tr_small($lang_functions['text_seed_points'], htmlspecialchars($user['seed_points']), 1);
}
if ($user["ip"] && (get_user_class() >= $torrenthistory_class || $user["id"] == $CURUSER["id"])){
+8
View File
@@ -0,0 +1,8 @@
<?php
return [
'actions' => [
'store_success' => 'Add to bookmark success!',
'delete_success' => 'Cancel bookmark success!',
]
];
+5 -3
View File
@@ -19,9 +19,11 @@ return [
'basic_team' => 'Team',
'size' => 'Size',
'comments_label' => 'Comments',
'times_completed_label' => 'Times completed',
'times_completed_label' => 'Snatched',
'peers_count_label' => 'Peers',
'thank_users_count_label' => 'Thank user counts',
'numfiles_label' => 'Files counts',
'thank_users_count_label' => 'Thanks',
'numfiles_label' => 'Files',
'bookmark_yes_label' => 'Bookmarked',
'bookmark_no_label' => 'Add to bookmark',
]
];
+8
View File
@@ -0,0 +1,8 @@
<?php
return [
'actions' => [
'store_success' => '添加收藏成功!',
'delete_success' => '取消收藏成功!',
]
];
+2
View File
@@ -23,5 +23,7 @@ return [
'peers_count_label' => '同伴',
'thank_users_count_label' => '谢谢',
'numfiles_label' => '文件',
'bookmark_yes_label' => '已收藏',
'bookmark_no_label' => '加入收藏',
]
];
+8
View File
@@ -0,0 +1,8 @@
<?php
return [
'actions' => [
'store_success' => '添加收藏成功!',
'delete_success' => '取消收藏成功!',
]
];
+2
View File
@@ -23,5 +23,7 @@ return [
'peers_count_label' => '同伴',
'thank_users_count_label' => '謝謝',
'numfiles_label' => '文件',
'bookmark_yes_label' => '已收藏',
'bookmark_no_label' => '加入收藏',
]
];
+1
View File
@@ -31,6 +31,7 @@ Route::group(['middleware' => ['auth:sanctum', 'locale']], function () {
Route::resource('files', \App\Http\Controllers\FileController::class);
Route::resource('thanks', \App\Http\Controllers\ThankController::class);
Route::resource('snatches', \App\Http\Controllers\SnatchController::class);
Route::resource('bookmarks', \App\Http\Controllers\BookmarkController::class);
Route::get('search-box', [\App\Http\Controllers\TorrentController::class, 'searchBox']);
Route::group(['middleware' => ['admin']], function () {