diff --git a/_db/dbstructure_v1.6.sql b/_db/dbstructure_v1.6.sql index b3111550..c58ab3e9 100644 --- a/_db/dbstructure_v1.6.sql +++ b/_db/dbstructure_v1.6.sql @@ -68,7 +68,7 @@ CREATE TABLE `adminpanel` ( LOCK TABLES `adminpanel` WRITE; /*!40000 ALTER TABLE `adminpanel` DISABLE KEYS */; -INSERT INTO `adminpanel` VALUES (1,'Add user','adduser.php','Create new user account'),(3,'Reset Users Password','reset.php','Rest lost Passwords'),(4,'Mass PM','staffmess.php','Send PM to all users'),(6,'Poll overview','polloverview.php','View poll votes'),(7,'Warned users','warned.php','See all warned users on tracker'),(8,'FreeLeech','freeleech.php','Set ALL Torrents At Special State.'),(9,'FAQ Management','faqmanage.php','Edit/Add/Delete FAQ Page'),(10,'Rules Management','modrules.php','Edit/Add/Delete RULES Page'),(11,'Category Manage','catmanage.php','Manage torrents categories at your site'); +INSERT INTO `adminpanel` VALUES (1,'Add user','adduser.php','Create new user account'),(3,'Reset Users Password','reset.php','Rest lost Passwords'),(4,'Mass PM','staffmess.php','Send PM to all users'),(6,'Poll overview','polloverview.php','View poll votes'),(7,'Warned users','warned.php','See all warned users on tracker'),(8,'FreeLeech','freeleech.php','Set ALL Torrents At Special State.'),(9,'FAQ Management','faqmanage.php','Edit/Add/Delete FAQ Page'),(10,'Rules Management','modrules.php','Edit/Add/Delete RULES Page'),(11,'Category Manage','catmanage.php','Manage torrents categories at your site'),(12,'Custom Field Manage','fields.php','Manage custom fields'); /*!40000 ALTER TABLE `adminpanel` ENABLE KEYS */; UNLOCK TABLES; @@ -236,9 +236,9 @@ DROP TABLE IF EXISTS `attendance`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `attendance` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `uid` int(10) unsigned NOT NULL, + `uid` int(10) unsigned NOT NULL DEFAULT '0', `added` datetime NOT NULL, - `points` int(10) unsigned NOT NULL, + `points` int(10) unsigned NOT NULL DEFAULT '0', `days` int(10) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`id`), KEY `idx_uid` (`uid`) @@ -1589,8 +1589,8 @@ CREATE TABLE `requests` ( `torrentid` int(10) unsigned NOT NULL DEFAULT '0', `finish` enum('yes','no') CHARACTER SET gbk NOT NULL DEFAULT 'no', `amount` int(10) NOT NULL DEFAULT '0', - `ori_descr` varchar(255) CHARACTER SET gbk NOT NULL, - `ori_amount` int(10) NOT NULL, + `ori_descr` varchar(255) NOT NULL DEFAULT '', + `ori_amount` int(10) NOT NULL DEFAULT '0', `added` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `userid` (`userid`), @@ -1616,8 +1616,8 @@ DROP TABLE IF EXISTS `resreq`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `resreq` ( `id` int(10) NOT NULL AUTO_INCREMENT, - `reqid` int(10) NOT NULL, - `torrentid` int(10) NOT NULL, + `reqid` int(10) NOT NULL DEFAULT '0', + `torrentid` int(10) NOT NULL DEFAULT '0', `chosen` enum('yes','no') NOT NULL DEFAULT 'no', PRIMARY KEY (`id`), KEY `reqid` (`reqid`) @@ -1716,7 +1716,7 @@ CREATE TABLE `searchbox` ( LOCK TABLES `searchbox` WRITE; /*!40000 ALTER TABLE `searchbox` DISABLE KEYS */; -INSERT INTO `searchbox` VALUES (4,'chd',1,0,1,1,1,0,1,0,10,7,'','','0'); +INSERT INTO `searchbox` VALUES (4,'chd',1,0,1,1,1,0,1,0,10,7,'','',''); /*!40000 ALTER TABLE `searchbox` ENABLE KEYS */; UNLOCK TABLES; @@ -1972,7 +1972,7 @@ CREATE TABLE `stylesheets` ( LOCK TABLES `stylesheets` WRITE; /*!40000 ALTER TABLE `stylesheets` DISABLE KEYS */; -INSERT INTO `stylesheets` VALUES (2,'styles/BlueGene/','Blue Gene','','Zantetsu','HDBits clone'),(3,'styles/BlasphemyOrange/','Blasphemy Orange','','Zantetsu','Bit-HDTV clone'),(4,'styles/Classic/','Classic','','Zantetsu','TBSource original mod'),(6,'styles/DarkPassion/','Dark Passion','','Zantetsu',''),(7,'styles/BambooGreen/','Bamboo Green','','Xia Zuojie','Baidu Hi clone'),(8,'ultrahd-styles/Blue/','Blue',NULL,'',''),(9,'ultrahd-styles/Dark/','Dark',NULL,'',''),(10,'ultrahd-styles/Green/','Green',NULL,'',''),(11,'ultrahd-styles/White/','White',NULL,'',''); +INSERT INTO `stylesheets` VALUES (2,'styles/BlueGene/','Blue Gene','','Zantetsu','HDBits clone'),(3,'styles/BlasphemyOrange/','Blasphemy Orange','','Zantetsu','Bit-HDTV clone'),(4,'styles/Classic/','Classic','','Zantetsu','TBSource original mod'),(6,'styles/DarkPassion/','Dark Passion','','Zantetsu',''),(7,'styles/BambooGreen/','Bamboo Green','','Xia Zuojie','Baidu Hi clone'); /*!40000 ALTER TABLE `stylesheets` ENABLE KEYS */; UNLOCK TABLES; @@ -2484,4 +2484,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-03-17 18:23:28 +-- Dump completed on 2021-03-18 20:25:39 diff --git a/include/functions.php b/include/functions.php index 5a435a5d..96ec236f 100644 --- a/include/functions.php +++ b/include/functions.php @@ -3032,11 +3032,8 @@ function torrenttable($rows, $variant = "torrent") { $setting = get_setting('main'); $enablePtGen = $setting['enable_pt_gen_system'] == 'yes'; $enableImdb = $setting['showimdbinfo'] == 'yes'; - if ($enablePtGen) { - $ptGen = new Nexus\PTGen\PTGen(); - } elseif ($enableImdb) { - $imdb = new Nexus\Imdb\Imdb(); - } + $ptGen = new Nexus\PTGen\PTGen(); + $imdb = new Nexus\Imdb\Imdb(); $torrent = new Nexus\Torrent\Torrent(); $torrentSeedingLeechingStatus = $torrent->listLeechingSeedingStatus($CURUSER['id'], array_column($rows, 'id')); @@ -3234,9 +3231,10 @@ foreach ($rows as $row) { $dissmall_descr=mb_substr($dissmall_descr, 0, $max_lenght_of_small_descr-2,"UTF-8") . ".."; } - print($dissmall_descr == "" ? "" : "
".$tags.htmlspecialchars($dissmall_descr)); + $dissmall_descr = $tags . htmlspecialchars($dissmall_descr); + print($dissmall_descr == "" ? "" : "
".$dissmall_descr); } else { - print("
$tags"); + print($tags ? "
$tags" : ""); } //progress bar if (isset($torrentSeedingLeechingStatus[$row['id']])) { diff --git a/lang/chs/lang_fields.php b/lang/chs/lang_fields.php index 0d135467..167f349c 100644 --- a/lang/chs/lang_fields.php +++ b/lang/chs/lang_fields.php @@ -1,7 +1,7 @@ '字段管理', + 'field_management' => '自定义字段管理', 'text_manage' => '管理', 'text_add' => '添加', 'text_field' => '字段', diff --git a/lang/chs/lang_staffpanel.php b/lang/chs/lang_staffpanel.php index a42b9a26..03118d03 100644 --- a/lang/chs/lang_staffpanel.php +++ b/lang/chs/lang_staffpanel.php @@ -68,5 +68,7 @@ $lang_staffpanel = [ 'Add Bonus Points' => '增加魔力', 'Add Bonus Points to one or All Users.' => '为某个或全部用户增加魔力', 'Clear cache' => '清除缓存', - 'Clear cache of memcached' => '清除缓存的数据' + 'Clear cache of memcached' => '清除缓存的数据', + 'Custom Field Manage' => '自定义字段管理', + 'Manage custom fields' => '管理自定义的字段', ]; \ No newline at end of file diff --git a/lang/chs/lang_upload.php b/lang/chs/lang_upload.php index e45c71e9..b47883b1 100644 --- a/lang/chs/lang_upload.php +++ b/lang/chs/lang_upload.php @@ -10,9 +10,9 @@ $lang_upload = array 'text_tracker_url' => "Tracker服务器的URL是", 'row_torrent_file' => "种子文件", 'row_torrent_name' => "标题", - 'text_torrent_name_note' => "(若不填将使用种子文件名。要求规范填写,如银翼杀手 Blade Runner 1982 Final Cut 720p HDDVD DTS x264-ESiR)\n", + 'text_torrent_name_note' => "(若不填将使用种子文件名。要求规范填写,如Blade Runner 1982 Final Cut 720p HDDVD DTS x264-ESiR)\n", 'row_small_description' => "副标题", - 'text_small_description_note' => "(将在种子页面种子标题下显示。如720p @ 4615 kbps - DTS 5.1 @ 1536 kbps)", + 'text_small_description_note' => "(将在种子页面种子标题下显示。如银翼杀手 720p @ 4615 kbps - DTS 5.1 @ 1536 kbps)", 'row_nfo_file' => "NFO文件", 'text_only_viewed_by' => "(不允许", 'text_or_above' => "以下用户查看。请上传.nfo文件)\n", diff --git a/lang/cht/lang_staffpanel.php b/lang/cht/lang_staffpanel.php index 59454673..467e8ffb 100644 --- a/lang/cht/lang_staffpanel.php +++ b/lang/cht/lang_staffpanel.php @@ -68,5 +68,7 @@ $lang_staffpanel = [ 'Add Bonus Points' => '增加魔力', 'Add Bonus Points to one or All Users.' => '為某個或全部用戶增加魔力', 'Clear cache' => '清除緩存', - 'Clear cache of memcached' => '清除緩存的數據' + 'Clear cache of memcached' => '清除緩存的數據', + 'Custom Field Manage' => '自定義字段管理', + 'Manage custom fields' => '管理自定義的字段', ]; \ No newline at end of file diff --git a/lang/cht/lang_upload.php b/lang/cht/lang_upload.php index b7926b70..691a522b 100644 --- a/lang/cht/lang_upload.php +++ b/lang/cht/lang_upload.php @@ -10,9 +10,9 @@ $lang_upload = array 'text_tracker_url' => "Tracker伺服器的URL是", 'row_torrent_file' => "種子文件", 'row_torrent_name' => "標題", - 'text_torrent_name_note' => "(若不填將使用種子檔案名。要求規範填寫,如銀翼殺手 Blade Runner 1982 Final Cut 720p HDDVD DTS x264-ESiR)\n", + 'text_torrent_name_note' => "(若不填將使用種子檔案名。要求規範填寫,如Blade Runner 1982 Final Cut 720p HDDVD DTS x264-ESiR)\n", 'row_small_description' => "副標題", - 'text_small_description_note' => "(將在種子頁面種子標題下顯示。如720p @ 4615 kbps - DTS 5.1 @ 1536 kbps)", + 'text_small_description_note' => "(將在種子頁面種子標題下顯示。如銀翼殺手 720p @ 4615 kbps - DTS 5.1 @ 1536 kbps)", 'row_nfo_file' => "NFO文件", 'text_only_viewed_by' => "(不允許", 'text_or_above' => "以下用戶查看。請上傳.nfo文件)\n", diff --git a/nexus/Field/Field.php b/nexus/Field/Field.php index 13fb89ea..8d61b060 100644 --- a/nexus/Field/Field.php +++ b/nexus/Field/Field.php @@ -399,7 +399,7 @@ JS; $field['custom_field_value'] = $values[$tid][$field['id']]; } } - return $isArray ? $result : $result[$torrentId]; + return $isArray ? $result : ($result[$torrentId] ?? []); } public function renderOnTorrentDetailsPage($torrentId) @@ -408,6 +408,7 @@ JS; $displayName = get_searchbox_value($browsecatmode, 'custom_fields_display_name'); $display = get_searchbox_value($browsecatmode, 'custom_fields_display'); $customFields = $this->listTorrentCustomField($torrentId); +// dd($displayName, $display, $customFields); $mixedRowContent = nl2br($display); $rowByRowHtml = ''; foreach ($customFields as $field) { diff --git a/nexus/Torrent/TechnicalInformation.php b/nexus/Torrent/TechnicalInformation.php index 2d8353d1..a89e1cf1 100644 --- a/nexus/Torrent/TechnicalInformation.php +++ b/nexus/Torrent/TechnicalInformation.php @@ -8,10 +8,10 @@ class TechnicalInformation private $mediaInfoArr; - public function __construct($mediaInfo) + public function __construct(string $mediaInfo) { - $this->mediaInfo = (string)$mediaInfo; - $this->mediaInfoArr = $this->getMediaInfoArr((string)$mediaInfo); + $this->mediaInfo = $mediaInfo; + $this->mediaInfoArr = $this->getMediaInfoArr($mediaInfo); } public function getMediaInfoArr(string $mediaInfo) @@ -49,7 +49,10 @@ class TechnicalInformation $width = $this->mediaInfoArr['Video']['Width'] ?? ''; $height = $this->mediaInfoArr['Video']['Height'] ?? ''; $ratio = $this->mediaInfoArr['Video']['Display aspect ratio'] ?? ''; - $result = $width . 'x' . $height; + $result = ''; + if ($width && $height) { + $result .= $width . ' x ' . $height; + } if ($ratio) { $result .= "($ratio)"; } @@ -88,7 +91,7 @@ class TechnicalInformation { $result = []; foreach ($this->mediaInfoArr as $parentKey => $values) { - if (strpos($parentKey, 'Audio') == false) { + if (strpos($parentKey, 'Audio') === false) { continue; } $audioInfoArr = []; @@ -115,7 +118,7 @@ class TechnicalInformation { $result = []; foreach ($this->mediaInfoArr as $parentKey => $values) { - if (strpos($parentKey, 'Text') == false) { + if (strpos($parentKey, 'Text') === false) { continue; } $audioInfoArr = []; @@ -135,18 +138,59 @@ class TechnicalInformation public function renderOnDetailsPage() { global $lang_functions; - $runtime = $this->getRuntime(); - $resolution = $this->getResolution(); - $bitrate = $this->getBitrate(); - $profile = $this->getProfile(); - $framerate = $this->getFramerate(); - $refFrame = $this->getRefFrame(); + $videos = [ + 'Runtime' => $this->getRuntime(), + 'Resolution' => $this->getResolution(), + 'Bitrate' => $this->getBitrate(), + 'Framerate' => $this->getFramerate(), + 'Profile' => $this->getProfile(), + 'Ref.Frames' => $this->getRefFrame(), + ]; + $videos = array_filter($videos); $audios = $this->getAudios(); $subtitles = $this->getSubtitles(); - $html = ''; - if (!empty($runtime)) { - +// dd($this->mediaInfoArr, $videos, $audios, $subtitles); + //video part + $videoTable = '
'; + foreach (array_chunk($videos, 2, true) as $row) { + $videoTable .= ''; + foreach ($row as $key => $value) { + $videoTable .= sprintf('', $key, $value); + } + $videoTable .= ''; } + $videoTable .= '
%s: %s
'; + $audioTable = ''; + $audioTable .= ''; + foreach ($audios as $key => $value) { + $audioTable .= sprintf('', $key, $value); + } + $audioTable .= ''; + $audioTable .= '
%s: %s
'; + + $subtitleTable = ''; + $subtitleTable .= ''; + foreach ($subtitles as $key => $value) { + $subtitleTable .= sprintf('', $key, $value); + } + $subtitleTable .= ''; + $subtitleTable .= '
%s: %s
'; + + if (empty($videos) && empty($audios) && empty($subtitles)) { + return ''; + } + $result = ''; + if (!empty($videos)) { + $result .= sprintf('', $videoTable); + } + if (!empty($audios)) { + $result .= sprintf('', $audioTable); + } + if (!empty($subtitles)) { + $result .= sprintf('', $subtitleTable); + } + $result .= '
%s%s%s
'; + return $result; } } \ No newline at end of file diff --git a/public/details.php b/public/details.php index 44b505b9..01db41b1 100644 --- a/public/details.php +++ b/public/details.php @@ -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, categories.name AS cat_name, 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 LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id LEFT JOIN teams ON torrents.team = teams.id LEFT JOIN audiocodecs ON torrents.audiocodec = audiocodecs.id WHERE torrents.id = $id LIMIT 1") +$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, categories.name AS cat_name, 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 LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id LEFT JOIN teams ON torrents.team = teams.id LEFT JOIN audiocodecs ON torrents.audiocodec = audiocodecs.id WHERE torrents.id = $id LIMIT 1") or sqlerr(); $row = mysql_fetch_array($res); if (get_user_class() >= $torrentmanage_class || $CURUSER["id"] == $row["owner"]) @@ -161,17 +161,20 @@ else { /**************end custom fields****************/ + //technical info + if ($settingMain['enable_technical_info'] == 'yes') { + $technicalInfo = new \Nexus\Torrent\TechnicalInformation($row['technical_info'] ?? ''); + $technicalInfoResult = $technicalInfo->renderOnDetailsPage(); + if (!empty($technicalInfoResult)) { + tr($lang_functions['text_technical_info'], $technicalInfoResult, 1); + } + } + if ($CURUSER['showdescription'] != 'no' && !empty($row["descr"])){ $torrentdetailad=$Advertisement->get_ad('torrentdetail'); tr("\"Show/Hide\" ".$lang_details['row_description']."", "
".($Advertisement->enable_ad() && $torrentdetailad ? "
".$torrentdetailad[0]."
" : "").format_comment($row["descr"])."
", 1); } - //technical info - if ($settingMain['enable_technical_info'] == 'yes') { - $technicalInfo = new \Nexus\Torrent\TechnicalInformation($row['technical_info']); - - } - if (get_user_class() >= $viewnfo_class && $CURUSER['shownfo'] != 'no' && $row["nfosz"] > 0){ if (!$nfo = $Cache->get_value('nfo_block_torrent_id_'.$id)){ $nfo = code($row["nfo"], $view == "magic"); diff --git a/public/edit.php b/public/edit.php index 3760ff69..852c154d 100644 --- a/public/edit.php +++ b/public/edit.php @@ -74,6 +74,11 @@ else { print("".$lang_edit['row_description']."*"); textbbcode("edittorrent","descr",($row["descr"]), false); print(""); + + if ($settingMain['enable_technical_info'] == 'yes') { + tr($lang_functions['text_technical_info'], '
' . $lang_functions['text_technical_info_help_text'], 1); + } + $s = "