From 0683c2ae4e32d96f482be428d7d026beb02ad97b Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Wed, 9 Mar 2022 21:42:37 +0800 Subject: [PATCH] torrent add&update ignore tags and install&update add timezone --- _db/README-EN.md | 2 +- app/Console/Commands/Test.php | 7 ++++-- nexus/Install/Install.php | 43 +++++++++++++++++++++++++++++------ public/takeedit.php | 1 - public/takeupload.php | 4 ++-- 5 files changed, 44 insertions(+), 13 deletions(-) diff --git a/_db/README-EN.md b/_db/README-EN.md index 7cccdd1c..9114703c 100644 --- a/_db/README-EN.md +++ b/_db/README-EN.md @@ -1 +1 @@ -From v1.6 onwards there is no need to create tables, it is created automatically by the migration file during installation. This directory file is reserved only for. +**From v1.6 onwards there is no need to create tables, it is created automatically by the migration file during installation. This directory file is reserved only for.** diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 1431e548..766d5ecd 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -62,8 +62,11 @@ class Test extends Command */ public function handle() { - $r = urldecode('%E8%8E%B7%E5%8F%96%E7%A8%8B%E5%BA%8F'); - echo $r; + $tzlist = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL); + foreach($tzlist as $value) + { + echo $value ."\n"; + } } } diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 95580b5d..cabfedc4 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -21,7 +21,7 @@ class Install 'searchbox', 'secondicons', 'sources', 'standards', 'stylesheets', 'sysoppanel', 'teams', 'torrents_state', 'uploadspeed', ]; - protected $envNames = ['DB_HOST', 'DB_PORT', 'DB_USERNAME', 'DB_PASSWORD', 'DB_DATABASE', 'REDIS_HOST', 'REDIS_PORT', 'REDIS_DB']; + protected $envNames = ['TIMEZONE', 'DB_HOST', 'DB_PORT', 'DB_USERNAME', 'DB_PASSWORD', 'DB_DATABASE', 'REDIS_HOST', 'REDIS_PORT', 'REDIS_DB']; public function __construct() { @@ -310,10 +310,24 @@ class Install foreach ($formControls as $value) { $form .= '
'; $form .= sprintf('
%s
', $labelWidth, $value['label']); - $form .= sprintf( - '
', - $valueWidth, $value['name'], $value['value'] ?? '' - ); + $form .= sprintf('
', $valueWidth); + if (isset($value['type']) && $value['type'] == 'select') { + $form .= sprintf(''; + } else { + $form .= sprintf( + '', + $value['name'], $value['value'] ?? '' + ); + } + $form .= '
'; $form .= '
'; } $form .= ''; @@ -351,11 +365,18 @@ class Install if (isset($_POST[$name])) { $value = $_POST[$name]; } - $formControls[] = [ + $item = [ + 'type' => 'text', + 'options' => [], 'label' => $name, 'name' => $name, - 'value' => $value, + 'value' => $value ]; + if ($name == 'TIMEZONE') { + $item['type'] = 'select'; + $item['options'] = $this->listTimeZone(); + } + $formControls[] = $item; } return $formControls; @@ -588,4 +609,12 @@ class Install } } + public function listTimeZone() + { + $results = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL); + $utc = array_pop($results); + array_unshift($results, $utc); + return $results; + } + } diff --git a/public/takeedit.php b/public/takeedit.php index 91266d21..ecdf81cc 100644 --- a/public/takeedit.php +++ b/public/takeedit.php @@ -55,7 +55,6 @@ if (!empty($_POST['pt_gen'])) { $updateset[] = "pt_gen = ''"; } -$updateset[] = "tags = " . array_sum($_POST['tags'] ?? []); $updateset[] = "technical_info = " . sqlesc($_POST['technical_info'] ?? ''); /** diff --git a/public/takeupload.php b/public/takeupload.php index 5f45d4c6..ad92a17d 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -306,8 +306,8 @@ if (empty($url) && !empty($ptGenImdbLink)) { $url = str_replace('tt', '', $ptGenImdbInfo['id']); } -$ret = sql_query("INSERT INTO torrents (filename, owner, visible, anonymous, name, size, numfiles, type, url, small_descr, descr, ori_descr, category, source, medium, codec, audiocodec, standard, processing, team, save_as, sp_state, added, last_action, nfo, info_hash, pt_gen, tags, technical_info) VALUES (".sqlesc($fname).", ".sqlesc($CURUSER["id"]).", 'yes', ".sqlesc($anonymous).", ".sqlesc($torrent).", ".sqlesc($totallen).", ".count($filelist).", ".sqlesc($type).", ".sqlesc($url).", ".sqlesc($small_descr).", ".sqlesc($descr).", ".sqlesc($descr).", ".sqlesc($catid).", ".sqlesc($sourceid).", ".sqlesc($mediumid).", ".sqlesc($codecid).", ".sqlesc($audiocodecid).", ".sqlesc($standardid).", ".sqlesc($processingid).", ".sqlesc($teamid).", ".sqlesc($dname).", ".sqlesc($sp_state) . -", " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc(date("Y-m-d H:i:s")) . ", ".sqlesc($nfo).", " . sqlesc($infohash). ", " . sqlesc(json_encode($postPtGen)) . ", " . array_sum($_POST['tags'] ?? []) . ", " . sqlesc($_POST['technical_info'] ?? '') . ")"); +$ret = sql_query("INSERT INTO torrents (filename, owner, visible, anonymous, name, size, numfiles, type, url, small_descr, descr, ori_descr, category, source, medium, codec, audiocodec, standard, processing, team, save_as, sp_state, added, last_action, nfo, info_hash, pt_gen, technical_info) VALUES (".sqlesc($fname).", ".sqlesc($CURUSER["id"]).", 'yes', ".sqlesc($anonymous).", ".sqlesc($torrent).", ".sqlesc($totallen).", ".count($filelist).", ".sqlesc($type).", ".sqlesc($url).", ".sqlesc($small_descr).", ".sqlesc($descr).", ".sqlesc($descr).", ".sqlesc($catid).", ".sqlesc($sourceid).", ".sqlesc($mediumid).", ".sqlesc($codecid).", ".sqlesc($audiocodecid).", ".sqlesc($standardid).", ".sqlesc($processingid).", ".sqlesc($teamid).", ".sqlesc($dname).", ".sqlesc($sp_state) . +", " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc(date("Y-m-d H:i:s")) . ", ".sqlesc($nfo).", " . sqlesc($infohash). ", " . sqlesc(json_encode($postPtGen)) . ", " . sqlesc($_POST['technical_info'] ?? '') . ")"); if (!$ret) { if (mysql_errno() == 1062) bark($lang_takeupload['std_torrent_existed']);