mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-05 07:20:58 +08:00
Tracker URl
This commit is contained in:
116
app/Filament/Resources/System/TrackerUrlResource.php
Normal file
116
app/Filament/Resources/System/TrackerUrlResource.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\Resources\System\TrackerUrlResource\Pages;
|
||||
use App\Filament\Resources\System\TrackerUrlResource\RelationManagers;
|
||||
use App\Models\TrackerUrl;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class TrackerUrlResource extends Resource
|
||||
{
|
||||
use OptionsTrait;
|
||||
|
||||
protected static ?string $model = TrackerUrl::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 10;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('admin.sidebar.tracker_url');
|
||||
}
|
||||
|
||||
public static function getBreadcrumb(): string
|
||||
{
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('url')->required(),
|
||||
Forms\Components\Radio::make('is_default')
|
||||
->label(__('label.is_default'))
|
||||
->options(self::getYesNoOptions())
|
||||
->required(true)
|
||||
->inline()
|
||||
,
|
||||
Forms\Components\Radio::make('enabled')
|
||||
->label(__('label.enabled'))
|
||||
->options(self::getEnableDisableOptions(1, 0))
|
||||
->required(true)
|
||||
->inline()
|
||||
,
|
||||
Forms\Components\TextInput::make('priority')
|
||||
->label(__('label.priority'))->numeric()
|
||||
->default(0)
|
||||
->helperText(__('label.priority_help'))
|
||||
,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return TrackerUrl::query()
|
||||
->orderBy('is_default', 'desc')
|
||||
->orderBy('priority', 'desc')
|
||||
->orderBy('id', 'desc')
|
||||
;
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
,
|
||||
Tables\Columns\TextColumn::make('url')
|
||||
,
|
||||
Tables\Columns\IconColumn::make('is_default')
|
||||
->label(__('label.is_default'))
|
||||
->boolean()
|
||||
,
|
||||
Tables\Columns\IconColumn::make('enabled')
|
||||
->label(__('label.enabled'))
|
||||
->boolean()
|
||||
,
|
||||
Tables\Columns\TextColumn::make('priority')
|
||||
->label(__('label.priority'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label(__('label.updated_at'))
|
||||
,
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageTrackerUrls::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System\TrackerUrlResource\Pages;
|
||||
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\System\TrackerUrlResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageTrackerUrls extends PageListSingle
|
||||
{
|
||||
protected static string $resource = TrackerUrlResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ class PluginStore extends Model
|
||||
{
|
||||
$log = "listAll, withoutCache: $withoutCache";
|
||||
$cacheKey = "nexus_plugin_store_all";
|
||||
$cacheTime = 86400*100;
|
||||
$cacheTime = 86400;
|
||||
if (is_null(self::$rows)) {
|
||||
$log .= ", is_null";
|
||||
if ($withoutCache) {
|
||||
|
||||
67
app/Models/TrackerUrl.php
Normal file
67
app/Models/TrackerUrl.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class TrackerUrl extends NexusModel
|
||||
{
|
||||
protected $fillable = ['url', 'enabled', 'is_default', 'priority'];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
const TRACKER_URL_CACHE_KEY = "TRACKER_URL";
|
||||
const TRACKER_URL_DEFAULT_CACHE_KEY = "TRACKER_URL_DEFAULT";
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saved(function (TrackerUrl $model) {
|
||||
if ($model->is_default == 1) {
|
||||
self::query()->where("id", "!=", $model->id)->update(["is_default" => 0]);
|
||||
}
|
||||
//添加 id 与 URL 映射
|
||||
$redis = NexusDB::redis();
|
||||
$redis->del(self::TRACKER_URL_CACHE_KEY);
|
||||
$list = self::listAll();
|
||||
$first = $list->first();
|
||||
$hasDefault = false;
|
||||
foreach ($list as $item) {
|
||||
$redis->hset(self::TRACKER_URL_CACHE_KEY, $item->id, $item->url);
|
||||
if ($item->is_default == 1) {
|
||||
$hasDefault = true;
|
||||
$redis->set(self::TRACKER_URL_DEFAULT_CACHE_KEY, $item->url);
|
||||
}
|
||||
}
|
||||
if (!$hasDefault && $first) {
|
||||
$redis->set(self::TRACKER_URL_DEFAULT_CACHE_KEY, $first->url);
|
||||
}
|
||||
});
|
||||
static::saving(function (TrackerUrl $model) {
|
||||
if ($model->is_default == 1) {
|
||||
$model->enabled = 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static function listAll()
|
||||
{
|
||||
return self::query()
|
||||
->where("enabled", 1)
|
||||
->orderBy("is_default", "desc")
|
||||
->orderBy("priority", "desc")
|
||||
->get();
|
||||
}
|
||||
|
||||
public static function getById(int $trackerUrlId)
|
||||
{
|
||||
$redis = NexusDB::redis();
|
||||
if ($trackerUrlId == 0) {
|
||||
return $redis->get(self::TRACKER_URL_DEFAULT_CACHE_KEY);
|
||||
}
|
||||
$result = $redis->hget(self::TRACKER_URL_CACHE_KEY, $trackerUrlId);
|
||||
if (!$result) {
|
||||
$result = $redis->get(self::TRACKER_URL_DEFAULT_CACHE_KEY);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tracker_urls', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('url');
|
||||
$table->tinyInteger('enabled')->default(1);
|
||||
$table->tinyInteger('is_default')->default(0);
|
||||
$table->integer('priority')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tracker_urls');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->integer('tracker_url_id')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('tracker_url_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.9.5');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-06-19');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-06-20');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -672,6 +672,7 @@ function command_exists($command): bool
|
||||
|
||||
function get_tracker_schema_and_host($combine = false): array|string
|
||||
{
|
||||
/*
|
||||
global $https_announce_urls, $announce_urls;
|
||||
$httpsAnnounceUrls = array_filter($https_announce_urls);
|
||||
$log = "cookie: " . json_encode($_COOKIE) . ", https_announce_urls: " . json_encode($httpsAnnounceUrls);
|
||||
@@ -704,6 +705,16 @@ function get_tracker_schema_and_host($combine = false): array|string
|
||||
if ($combine) {
|
||||
return $ssl_torrent . $base_announce_url;
|
||||
}
|
||||
*/
|
||||
$url = \App\Models\TrackerUrl::getById(0);
|
||||
if (empty($url)) {
|
||||
return $combine ? "" : [];
|
||||
}
|
||||
$ssl_torrent = parse_url($url, PHP_URL_SCHEME) . "://" ;
|
||||
$base_announce_url = parse_url($url, PHP_URL_HOST);
|
||||
if ($combine) {
|
||||
return $ssl_torrent . $base_announce_url;
|
||||
}
|
||||
return compact('ssl_torrent', 'base_announce_url');
|
||||
}
|
||||
|
||||
|
||||
@@ -256,6 +256,8 @@ $lang_usercp = array
|
||||
'add_seed_box_btn' => '登记',
|
||||
'checkbox_pm_on_topic_reply' => '论坛帖子有新回复时通知我',
|
||||
'checkbox_pm_on_hr_reached' => 'H&R 达标时通知我',
|
||||
'row_tracker_url' => 'Tracker URL',
|
||||
'row_tracker_url_help' => '<b>注意:</b>选择后只能向选中的链接汇报。默认只能向列表中的第 1 个默认链接汇报。',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -254,6 +254,8 @@ $lang_usercp = array
|
||||
'add_seed_box_btn' => '登記',
|
||||
'checkbox_pm_on_topic_reply' => '論壇帖子有新回復時通知我',
|
||||
'checkbox_pm_on_hr_reached' => 'H&R 達標時通知我',
|
||||
'row_tracker_url' => 'Tracker URL',
|
||||
'row_tracker_url_help' => '<b>注意:</b>選擇後只能向選中的鏈接匯報。默認只能向列表中的第 1 個默認鏈接匯報。',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -256,6 +256,8 @@ $lang_usercp = array
|
||||
'add_seed_box_btn' => 'Register',
|
||||
'checkbox_pm_on_topic_reply' => 'Notify me when there are new replies to forum posts',
|
||||
'checkbox_pm_on_hr_reached' => 'Notify me when H&R reaches target',
|
||||
'row_tracker_url' => 'Tracker URL',
|
||||
'row_tracker_url_help' => '<b>Note:</b> Once selected, announce can only be sent to the selected link. By default, announce can only be sent to the first default link in the list.',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -15,6 +15,7 @@ use App\Models\Setting;
|
||||
use App\Models\Tag;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\TorrentTag;
|
||||
use App\Models\TrackerUrl;
|
||||
use App\Models\User;
|
||||
use App\Models\UserBanLog;
|
||||
use App\Repositories\AttendanceRepository;
|
||||
@@ -361,6 +362,19 @@ class Update extends Install
|
||||
Artisan::call("upgrade:migrate_snatched_hr_id");
|
||||
Artisan::call("upgrade:migrate_snatched_buy_log_id");
|
||||
}
|
||||
if (!Schema::hasTable("tracker_urls")) {
|
||||
$this->runMigrate("database/migrations/2025_06_19_194137_create_tracker_urls_table.php");
|
||||
$announceUrl = get_setting("security.https_announce_url");
|
||||
if (empty($announceUrl)) {
|
||||
$announceUrl = get_setting("basic.announce_url");
|
||||
}
|
||||
TrackerUrl::query()->create([
|
||||
"url" => $announceUrl,
|
||||
"enabled" => 1,
|
||||
"is_default" => 1,
|
||||
]);
|
||||
NexusDB::cache_del("nexus_plugin_store_all");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ $seeder = ($left == 0) ? "yes" : "no";
|
||||
|
||||
// check passkey
|
||||
if (!$az = $Cache->get_value('user_passkey_'.$passkey.'_content')){
|
||||
$res = sql_query("SELECT id, username, downloadpos, enabled, uploaded, downloaded, class, parked, clientselect, showclienterror, passkey, donor, donoruntil, seedbonus FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||
$res = sql_query("SELECT id, username, downloadpos, enabled, uploaded, downloaded, class, parked, clientselect, showclienterror, passkey, donor, donoruntil, seedbonus, tracker_url_id FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||
$az = mysql_fetch_array($res);
|
||||
do_log("[check passkey], currentUser: " . nexus_json_encode($az));
|
||||
$Cache->cache_value('user_passkey_'.$passkey.'_content', $az, 3600);
|
||||
@@ -133,6 +133,13 @@ $CURUSER = $GLOBALS["CURUSER"] = $az;
|
||||
$isDonor = is_donor($az);
|
||||
$az['__is_donor'] = $isDonor;
|
||||
$log = "user: $userid, isDonor: $isDonor, seeder: $seeder, ip: $ip, ipv4: $ipv4, ipv6: $ipv6";
|
||||
//check tracker url
|
||||
$trackerUrl = \App\Models\TrackerUrl::getById($az['tracker_url_id']);
|
||||
$currentUrl = getSchemeAndHttpHost();
|
||||
if (!str_contains($trackerUrl, $currentUrl)) {
|
||||
do_log("announce check tracker url, trackerUrl: $trackerUrl does not contains: $currentUrl");
|
||||
warn("you should announce to: $trackerUrl");
|
||||
}
|
||||
|
||||
//3. CHECK IF CLIENT IS ALLOWED
|
||||
//$clicheck_res = check_client($peer_id,$agent,$client_familyid);
|
||||
|
||||
@@ -84,9 +84,9 @@ if ($CURUSER['downloadpos']=="no") {
|
||||
denyDownload();
|
||||
}
|
||||
|
||||
$trackerSchemaAndHost = get_tracker_schema_and_host();
|
||||
$ssl_torrent = $trackerSchemaAndHost['ssl_torrent'];
|
||||
$base_announce_url = $trackerSchemaAndHost['base_announce_url'];
|
||||
//$trackerSchemaAndHost = get_tracker_schema_and_host();
|
||||
//$ssl_torrent = $trackerSchemaAndHost['ssl_torrent'];
|
||||
//$base_announce_url = $trackerSchemaAndHost['base_announce_url'];
|
||||
|
||||
$res = sql_query("SELECT torrents.name, torrents.filename, torrents.save_as, torrents.size, torrents.owner, torrents.banned, torrents.approval_status, torrents.price, categories.mode as search_box_id FROM torrents left join categories on torrents.category = categories.id WHERE torrents.id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||
$row = mysql_fetch_assoc($res);
|
||||
@@ -140,7 +140,7 @@ if (strlen($CURUSER['passkey']) != 32) {
|
||||
sql_query("UPDATE users SET passkey=".sqlesc($CURUSER['passkey'])." WHERE id=".sqlesc($CURUSER['id']));
|
||||
}
|
||||
$dict = \Rhilip\Bencode\Bencode::load($fn);
|
||||
$dict['announce'] = $ssl_torrent . $base_announce_url . "?passkey=" . $CURUSER['passkey'];
|
||||
$dict['announce'] = \App\Models\TrackerUrl::getById($CURUSER['tracker_url_id']) . "?passkey=" . $CURUSER['passkey'];
|
||||
$dict['comment'] = getSchemeAndHttpHost(true) . "/details.php?id=" . $id;
|
||||
do_log(sprintf("[ANNOUNCE_URL], user: %s, torrent: %s, url: %s", $CURUSER['id'] ?? '', $id, $dict['announce']));
|
||||
/**
|
||||
|
||||
@@ -369,7 +369,7 @@ elseif ($action == 'securitysettings') //security settings
|
||||
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."' name='securitysettings_form'><input type='hidden' name='action' value='savesettings_security'>");
|
||||
tr($lang_settings['row_enable_ssl'],"<input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "yes" ? " checked" : "") . " value='yes'> ".$lang_settings['text_yes']. " <input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "no" ? " checked" : "") . " value='no'> ".$lang_settings['text_no']. " <input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "op" ? " checked" : "") . " value='op'> ".$lang_settings['text_optional']."<br />".$lang_settings['text_ssl_note'], 1);
|
||||
tr($lang_settings['row_enable_ssl_tracker'],"<input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "yes" ? " checked" : "") . " value='yes'> ".$lang_settings['text_yes']. " <input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "no" ? " checked" : "") . " value='no'> ".$lang_settings['text_no']. " <input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "op" ? " checked" : "") . " value='op'> ".$lang_settings['text_optional']."<br />".$lang_settings['text_ssl_note'], 1);
|
||||
tr($lang_settings['row_https_announce_url'],"<input type='text' style=\"width: 300px\" name=https_announce_url value='".($SECURITY["https_announce_url"] ? $SECURITY["https_announce_url"] : "")."'> ".$lang_settings['text_https_announce_url_note'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
|
||||
// tr($lang_settings['row_https_announce_url'],"<input type='text' style=\"width: 300px\" name=https_announce_url value='".($SECURITY["https_announce_url"] ? $SECURITY["https_announce_url"] : "")."'> ".$lang_settings['text_https_announce_url_note'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
|
||||
yesorno($lang_settings['row_enable_image_verification'], 'iv', $SECURITY["iv"], $lang_settings['text_image_verification_note']);
|
||||
yesorno($lang_settings['row_allow_email_change'], 'changeemail', $SECURITY["changeemail"], $lang_settings['text_email_change_note']);
|
||||
tr($lang_settings['row_cheater_detection_level'],"<select name='cheaterdet'><option value=0 " . ($SECURITY["cheaterdet"] == 0 ? " selected" : "") . "> ".$lang_settings['select_none']." </option><option value=1 " . ($SECURITY["cheaterdet"] == 1 ? " selected" : "") . "> ".$lang_settings['select_conservative']." </option><option value=2 " . ($SECURITY["cheaterdet"] == 2 ? " selected" : "") . "> ".$lang_settings['select_normal']." </option><option value=3 " . ($SECURITY["cheaterdet"] == 3 ? " selected" : "") . "> ".$lang_settings['select_strict']." </option><option value=4 " . ($SECURITY["cheaterdet"] == 4 ? " selected" : "") . "> ".$lang_settings['select_paranoid']." </option></select> ".$lang_settings['text_cheater_detection_level_note']."<br />".$lang_settings['text_never_suspect'].classlist('nodetect',$AUTHORITY['staffmem'],$SECURITY['nodetect']).$lang_settings['text_or_above'].get_user_class_name(UC_UPLOADER,false,true,true).".", 1);
|
||||
@@ -507,7 +507,7 @@ elseif ($action == 'basicsettings') // basic settings
|
||||
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_basic'>");
|
||||
tr($lang_settings['row_site_name'],"<input type='text' style=\"width: 300px\" name=SITENAME value='".($config["SITENAME"] ? $config["SITENAME"]: "Nexus")."'> ".$lang_settings['text_site_name_note'], 1);
|
||||
tr($lang_settings['row_base_url'],"<input type='text' style=\"width: 300px\" name=BASEURL value='".($config["BASEURL"] ? $config["BASEURL"] : $_SERVER["HTTP_HOST"])."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"] . $lang_settings['text_base_url_note'], 1);
|
||||
tr($lang_settings['row_announce_url'],"<input type='text' style=\"width: 300px\" name=announce_url value='".($config["announce_url"] ? $config["announce_url"] : $_SERVER["HTTP_HOST"].DEFAULT_TRACKER_URI)."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"].DEFAULT_TRACKER_URI, 1);
|
||||
// tr($lang_settings['row_announce_url'],"<input type='text' style=\"width: 300px\" name=announce_url value='".($config["announce_url"] ? $config["announce_url"] : $_SERVER["HTTP_HOST"].DEFAULT_TRACKER_URI)."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"].DEFAULT_TRACKER_URI, 1);
|
||||
// tr($lang_settings['row_mysql_host'],"<input type='text' style=\"width: 300px\" name=mysql_host value='".($config["mysql_host"] ? $config["mysql_host"] : "localhost")."'> ".$lang_settings['text_mysql_host_note'], 1);
|
||||
// tr($lang_settings['row_mysql_user'],"<input type='text' style=\"width: 300px\" name=mysql_user value='".($config["mysql_user"] ? $config["mysql_user"] : "root")."'> ".$lang_settings['text_mysql_user_note'], 1);
|
||||
// tr($lang_settings['row_mysql_password'],"<input type='password' style=\"width: 300px\" name=mysql_pass value=''> ".$lang_settings['text_mysql_password_note'], 1);
|
||||
|
||||
@@ -129,6 +129,7 @@ if ($action){
|
||||
// $updateset[] = "tzoffset = " . sqlesc($tzoffset);
|
||||
|
||||
$updateset[] = "info = " . sqlesc($info);
|
||||
$updateset[] = "tracker_url_id = " . sqlesc($_POST["tracker_url_id"]);
|
||||
|
||||
//notifs
|
||||
if (!empty($_POST['notifs'])) {
|
||||
@@ -145,10 +146,12 @@ if ($action){
|
||||
}
|
||||
$query = "UPDATE users SET " . implode(",", $updateset) . " WHERE id = ".sqlesc($CURUSER["id"]);
|
||||
$result = sql_query($query);
|
||||
if (!$result)
|
||||
sqlerr(__FILE__,__LINE__);
|
||||
else
|
||||
header("Location: usercp.php?action=personal&type=saved");
|
||||
if (!$result) {
|
||||
sqlerr(__FILE__,__LINE__);
|
||||
} else {
|
||||
clear_user_cache($CURUSER["id"], $CURUSER['passkey']);
|
||||
header("Location: usercp.php?action=personal&type=saved");
|
||||
}
|
||||
}
|
||||
stdhead($lang_usercp['head_control_panel'].$lang_usercp['head_personal_settings'],true);
|
||||
|
||||
@@ -156,11 +159,18 @@ if ($action){
|
||||
$ct_r = sql_query("SELECT id,name FROM countries ORDER BY name") or die;
|
||||
while ($ct_a = mysql_fetch_array($ct_r))
|
||||
$countries .= "<option value=".htmlspecialchars($ct_a['id'])."" . (htmlspecialchars($CURUSER["country"]) == htmlspecialchars($ct_a['id']) ? " selected" : "") . ">".htmlspecialchars($ct_a['name'])."</option>\n";
|
||||
$isplist = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
|
||||
$trackerUrls = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
$trackerUrlList = \App\Models\TrackerUrl::listAll();
|
||||
foreach ($trackerUrlList as $item) {
|
||||
$trackerUrls .= "<option value=".htmlspecialchars($item->id)."" . (htmlspecialchars($CURUSER["tracker_url_id"]) == htmlspecialchars($item->id) ? " selected" : "") . ">".htmlspecialchars($item->url)."</option>\n";
|
||||
}
|
||||
$isplist = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
$isp_r = sql_query("SELECT id,name FROM isp ORDER BY id ASC") or die;
|
||||
while ($isp_a = mysql_fetch_array($isp_r))
|
||||
$isplist .= "<option value=".htmlspecialchars($isp_a['id'])."" . (htmlspecialchars($CURUSER["isp"]) == htmlspecialchars($isp_a['id']) ? " selected" : "") . ">".htmlspecialchars($isp_a['name'])."</option>\n";
|
||||
$downloadspeed = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
|
||||
$downloadspeed = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
$ds_a = sql_query("SELECT id,name FROM downloadspeed ORDER BY id") or die;
|
||||
while ($ds_b = mysql_fetch_array($ds_a))
|
||||
$downloadspeed .= "<option value=".htmlspecialchars($ds_b['id'])."" . (htmlspecialchars($CURUSER["download"]) == htmlspecialchars($ds_b['id']) ? " selected" : "") . ">".htmlspecialchars($ds_b['name'])."</option>\n";
|
||||
@@ -199,7 +209,8 @@ if ($action){
|
||||
tr_small($lang_usercp['row_gender'],
|
||||
"<input type=radio name=gender" . ($CURUSER["gender"] == "N/A" ? " checked" : "") . " value=N/A>".$lang_usercp['radio_not_available']."
|
||||
<input type=radio name=gender" . ($CURUSER["gender"] == "Male" ? " checked" : "") . " value=Male>".$lang_usercp['radio_male']."<input type=radio name=gender" . ($CURUSER["gender"] == "Female" ? " checked" : "") . " value=Female>".$lang_usercp['radio_female'],1);
|
||||
tr_small($lang_usercp['row_country'], "<select name=country>\n$countries\n</select>",1);
|
||||
tr_small($lang_usercp['row_tracker_url'], "<select name=tracker_url_id>\n$trackerUrls\n</select>" . "<br /><font class=small size=1>".$lang_usercp['row_tracker_url_help']."</font>",1);
|
||||
tr_small($lang_usercp['row_country'], "<select name=country>\n$countries\n</select>",1);
|
||||
//School select
|
||||
if ($showschool == 'yes'){
|
||||
$schools = "<option value=35>---- ".$lang_usercp['select_none_selected']." ----</option>n";
|
||||
|
||||
@@ -47,6 +47,7 @@ return [
|
||||
'queue_monitor' => 'Queue monitor',
|
||||
'user_modify_logs' => 'User modify logs',
|
||||
'message_templates' => 'Message templates',
|
||||
'tracker_url' => 'Tracker URL',
|
||||
],
|
||||
'resources' => [
|
||||
'agent_allow' => [
|
||||
|
||||
@@ -48,6 +48,7 @@ return [
|
||||
'text_code' => "CODE",
|
||||
'language' => 'Language',
|
||||
'content' => 'Content',
|
||||
'is_default' => 'Is default',
|
||||
'setting' => [
|
||||
'nav_text' => 'Setting',
|
||||
'backup' => [
|
||||
|
||||
@@ -45,6 +45,7 @@ return [
|
||||
'queue_monitor' => '队列监控',
|
||||
'user_modify_logs' => '修改记录',
|
||||
'message_templates' => '消息模板',
|
||||
'tracker_url' => 'Tracker URL',
|
||||
],
|
||||
'resources' => [
|
||||
'agent_allow' => [
|
||||
|
||||
@@ -48,6 +48,7 @@ return [
|
||||
'text_code' => "代码",
|
||||
'language' => '语言',
|
||||
'content' => '内容',
|
||||
'is_default' => '是否默认',
|
||||
'setting' => [
|
||||
'nav_text' => '设置',
|
||||
'backup' => [
|
||||
|
||||
@@ -47,6 +47,7 @@ return [
|
||||
'queue_monitor' => '隊列監控',
|
||||
'user_modify_logs' => '修改記錄',
|
||||
'message_templates' => '消息模板',
|
||||
'tracker_url' => 'Tracker URL',
|
||||
],
|
||||
'resources' => [
|
||||
'agent_allow' => [
|
||||
|
||||
@@ -48,6 +48,7 @@ return [
|
||||
'text_code' => "代碼",
|
||||
'language' => '語言',
|
||||
'content' => '內容',
|
||||
'is_default' => '是否默認',
|
||||
'setting' => [
|
||||
'nav_text' => '設置',
|
||||
'backup' => [
|
||||
|
||||
Reference in New Issue
Block a user