diff --git a/classes/class_cache_redis.php b/classes/class_cache_redis.php
index 7170e53c..c972991b 100644
--- a/classes/class_cache_redis.php
+++ b/classes/class_cache_redis.php
@@ -331,4 +331,18 @@ class RedisCache {
{
return is_numeric($value) ? $value : unserialize($value);
}
+
+ /**
+ * get the redis client
+ *
+ * @date 2021/1/15
+ * @return Redis
+ */
+ public function getRedis()
+ {
+ if ($this->getIsEnabled()) {
+ return $this->redis;
+ }
+ return null;
+ }
}
diff --git a/composer.json b/composer.json
index d73d75ea..14767b76 100644
--- a/composer.json
+++ b/composer.json
@@ -17,6 +17,6 @@
"require": {
"php": "^7.2|^8",
"swiftmailer/swiftmailer": "^6.2",
- "guzzlehttp/guzzle": "^7.2"
+ "guzzlehttp/guzzle": "~6.0"
}
}
diff --git a/composer.lock b/composer.lock
index 760eedb8..3f9bd563 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "1f39d5c11cefe6eb838c17586c056ce7",
+ "content-hash": "5e27df0bf1d474656f062b3f264353ee",
"packages": [
{
"name": "doctrine/lexer",
@@ -72,6 +72,20 @@
"parser",
"php"
],
+ "funding": [
+ {
+ "url": "https://www.doctrine-project.org/sponsorship.html",
+ "type": "custom"
+ },
+ {
+ "url": "https://www.patreon.com/phpdoctrine",
+ "type": "patreon"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer",
+ "type": "tidelift"
+ }
+ ],
"time": "2020-05-25T17:44:05+00:00"
},
{
@@ -136,20 +150,26 @@
"validation",
"validator"
],
+ "funding": [
+ {
+ "url": "https://github.com/egulias",
+ "type": "github"
+ }
+ ],
"time": "2020-12-29T14:50:06+00:00"
},
{
"name": "guzzlehttp/guzzle",
- "version": "7.2.0",
+ "version": "6.5.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
- "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79"
+ "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79",
- "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
+ "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"shasum": "",
"mirrors": [
{
@@ -160,29 +180,23 @@
},
"require": {
"ext-json": "*",
- "guzzlehttp/promises": "^1.4",
- "guzzlehttp/psr7": "^1.7",
- "php": "^7.2.5 || ^8.0",
- "psr/http-client": "^1.0"
- },
- "provide": {
- "psr/http-client-implementation": "1.0"
+ "guzzlehttp/promises": "^1.0",
+ "guzzlehttp/psr7": "^1.6.1",
+ "php": ">=5.5",
+ "symfony/polyfill-intl-idn": "^1.17.0"
},
"require-dev": {
"ext-curl": "*",
- "php-http/client-integration-tests": "^3.0",
- "phpunit/phpunit": "^8.5.5 || ^9.3.5",
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
"psr/log": "^1.1"
},
"suggest": {
- "ext-curl": "Required for CURL handler support",
- "ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "7.1-dev"
+ "dev-master": "6.5-dev"
}
},
"autoload": {
@@ -202,11 +216,6 @@
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
- },
- {
- "name": "Márk Sági-Kazár",
- "email": "mark.sagikazar@gmail.com",
- "homepage": "https://sagikazarmark.hu"
}
],
"description": "Guzzle is a PHP HTTP client library",
@@ -217,12 +226,10 @@
"framework",
"http",
"http client",
- "psr-18",
- "psr-7",
"rest",
"web service"
],
- "time": "2020-10-10T11:47:56+00:00"
+ "time": "2020-06-16T21:01:06+00:00"
},
{
"name": "guzzlehttp/promises",
@@ -358,61 +365,6 @@
],
"time": "2020-09-30T07:37:11+00:00"
},
- {
- "name": "psr/http-client",
- "version": "1.0.1",
- "source": {
- "type": "git",
- "url": "https://github.com/php-fig/http-client.git",
- "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
- "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
- "shasum": "",
- "mirrors": [
- {
- "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
- "preferred": true
- }
- ]
- },
- "require": {
- "php": "^7.0 || ^8.0",
- "psr/http-message": "^1.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Psr\\Http\\Client\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "PHP-FIG",
- "homepage": "http://www.php-fig.org/"
- }
- ],
- "description": "Common interface for HTTP clients",
- "homepage": "https://github.com/php-fig/http-client",
- "keywords": [
- "http",
- "http-client",
- "psr",
- "psr-18"
- ],
- "time": "2020-06-29T06:28:15+00:00"
- },
{
"name": "psr/http-message",
"version": "1.0.1",
@@ -580,6 +532,16 @@
"mail",
"mailer"
],
+ "funding": [
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/swiftmailer/swiftmailer",
+ "type": "tidelift"
+ }
+ ],
"time": "2021-01-12T09:35:59+00:00"
},
{
@@ -649,6 +611,20 @@
"portable",
"shim"
],
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
"time": "2021-01-07T16:49:33+00:00"
},
{
@@ -725,6 +701,20 @@
"portable",
"shim"
],
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
"time": "2021-01-07T16:49:33+00:00"
},
{
@@ -798,6 +788,20 @@
"portable",
"shim"
],
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
"time": "2021-01-07T17:09:11+00:00"
},
{
@@ -867,6 +871,20 @@
"portable",
"shim"
],
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
"time": "2021-01-07T16:49:33+00:00"
},
{
@@ -932,6 +950,20 @@
"portable",
"shim"
],
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
"time": "2021-01-07T16:49:33+00:00"
}
],
@@ -944,5 +976,6 @@
"platform": {
"php": "^7.2|^8"
},
- "platform-dev": []
+ "platform-dev": [],
+ "plugin-api-version": "1.1.0"
}
diff --git a/include/functions.php b/include/functions.php
index c6905651..f436563a 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -2594,7 +2594,7 @@ function stdfoot() {
if ($enablesqldebug_tweak == 'yes' && get_user_class() >= $sqldebug_tweak) {
print("
SQL query list:
");
foreach($query_name as $query) {
- print(sprintf('- %s [%s ms]
', htmlspecialchars($query['query']), $query['time'] * 1000));
+ print(sprintf('- %s [%s]
', htmlspecialchars($query['query']), $query['time']));
}
print("
");
print("Redis key read:
");
diff --git a/include/globalfunctions.php b/include/globalfunctions.php
index 79ee335f..91691405 100644
--- a/include/globalfunctions.php
+++ b/include/globalfunctions.php
@@ -70,9 +70,10 @@ function sql_query($query)
$begin = microtime(true);
global $query_name;
$result = mysql_query($query);
+ $end = microtime(true);
$query_name[] = [
'query' => $query,
- 'time' => microtime(true) - $begin,
+ 'time' => sprintf('%.3f ms', ($end - $begin) * 1000),
];
return $result;
}
diff --git a/lang/chs/lang_functions.php b/lang/chs/lang_functions.php
index e7c6fc39..b14a425d 100644
--- a/lang/chs/lang_functions.php
+++ b/lang/chs/lang_functions.php
@@ -288,6 +288,12 @@ $lang_functions = array
'text_thirty_percent_down' => "30%",
'text_please_download_something_within' => "请在",
'text_inactive_account_be_deleted' => "内做些下载。没有流量的用户会被删除账号。",
+ 'row_pt_gen_douban_url' => "PT-Gen douban 链接",
+ 'text_pt_gen_douban_url_note' => "(来自 douban 的链接。如电影 Transformers 的链接是 https://movie.douban.com/subject/1794171/)",
+ 'row_pt_gen_imdb_url' => "PT-Gen imdb 链接",
+ 'text_pt_gen_imdb_url_note' => "(来自 imdb 的链接。如电影 Transformers 的链接是 https://www.imdb.com/title/tt0418279/)",
+ 'row_pt_gen_bangumi_url' => "PT-Gen bangumi 链接",
+ 'text_pt_gen_bangumi_url_note' => "(来自 bangumi 的链接。如动画 星际牛仔 的链接是 https://bangumi.tv/subject/253/)",
);
?>
diff --git a/lang/chs/lang_settings.php b/lang/chs/lang_settings.php
index ee288806..78aebc20 100644
--- a/lang/chs/lang_settings.php
+++ b/lang/chs/lang_settings.php
@@ -393,6 +393,8 @@ $lang_settings = array
'text_show_classic_note' => "默认'否'。在首页显示经典资源。只有指定的总版主或以上等级能够挑选热门资源。",
'row_enable_imdb_system' => "开启IMDb系统",
'text_imdb_system_note' => "默认'是'。全局IMDb系统设定。",
+ 'row_enable_pt_gen_system' => '开启 PT-Gen 系统',
+ 'text_enable_pt_gen_system_note' => "默认'是'。全局 PT-Gen 系统设定。",
'row_enable_school_system' => "开启学校系统",
'text_school_system_note' => "默认'否'。如果对这项功能不清楚,不要开启它。",
'row_restrict_email_domain' => "限制邮箱域",
diff --git a/lang/cht/lang_functions.php b/lang/cht/lang_functions.php
index a57172a7..28bccdad 100644
--- a/lang/cht/lang_functions.php
+++ b/lang/cht/lang_functions.php
@@ -288,6 +288,11 @@ $lang_functions = array
'text_thirty_percent_down' => "30%",
'text_please_download_something_within' => "請在",
'text_inactive_account_be_deleted' => "內做些下載。沒有流量的用戶會被移除賬號。",
+ 'text_pt_gen_douban_url_note' => "(來自 douban 的鏈接。如電影 Transformers 的鏈接是 https://movie.douban.com/subject/1794171/)",
+ 'row_pt_gen_imdb_url' => "PT-Gen imdb 鏈接",
+ 'text_pt_gen_imdb_url_note' => "(來自 imdb 的鏈接。如電影 Transformers 的鏈接是 https://www.imdb.com/title/tt0418279/)",
+ 'row_pt_gen_bangumi_url' => "PT-Gen bangumi 鏈接",
+ 'text_pt_gen_bangumi_url_note' => "(來自 bangumi 的鏈接。如動畫 星際牛仔 的鏈接是 https://bangumi.tv/subject/253/)",
);
?>
diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php
index 1d11bcf9..e33ebef9 100644
--- a/lang/cht/lang_settings.php
+++ b/lang/cht/lang_settings.php
@@ -393,7 +393,9 @@ $lang_settings = array
'row_show_classic' => "察看經典資源",
'text_show_classic_note' => "預設'否'。在首頁察看經典資源。只有指定的總版主或以上等級能夠挑揀熱門資源。",
'row_enable_imdb_system' => "開啟IMDb系統",
- 'text_imdb_system_note' => "預設'是'。全域IMDb系統設定。",
+ 'text_enable_pt_gen_system_note' => "預設'是'。全域IMDb系統設定。",
+ 'row_enable_pt_gen_system' => '開啟 PT-Gen 系統',
+ 'text_enable_pt_gen_note' => "默認'是'。全局 PT-Gen 系統設定。",
'row_enable_school_system' => "開啟學校系統",
'text_school_system_note' => "預設'否'。如果對這項功能不清楚,不要開啟它。",
'row_restrict_email_domain' => "限制郵箱域",
diff --git a/lang/en/lang_functions.php b/lang/en/lang_functions.php
index a478cf41..fba7efab 100644
--- a/lang/en/lang_functions.php
+++ b/lang/en/lang_functions.php
@@ -288,6 +288,12 @@ $lang_functions = array
'text_thirty_percent_down' => "30%",
'text_please_download_something_within' => "Please download something within ",
'text_inactive_account_be_deleted' => ". Inactive accounts (with no transfer amount) will be deleted.",
+ 'row_pt_gen_douban_url' => "PT-Gen douban link",
+ 'text_pt_gen_douban_url_note' => "(URL taken from douban. e.g. for movie Transformers the URL is https://movie.douban.com/subject/1794171//)",
+ 'row_pt_gen_imdb_url' => "PT-Gen imdb link",
+ 'text_pt_gen_imdb_url_note' => "(URL taken from imdb. e.g. for movie Transformers the URL is https://www.imdb.com/title/tt0418279/)",
+ 'row_pt_gen_bangumi_url' => "PT-Gen bangumi link",
+ 'text_pt_gen_bangumi_url_note' => "(URL taken from bangumi. e.g. for animation Cowboy Bebop the URL is https://bangumi.tv/subject/253/)",
);
?>
diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php
index 58911033..8e9cab5b 100644
--- a/lang/en/lang_settings.php
+++ b/lang/en/lang_settings.php
@@ -393,6 +393,8 @@ $lang_settings = array
'text_show_classic_note' => "Default 'no'. Show classic resources on main page. Only designated moderators or above can pick classic resources.",
'row_enable_imdb_system' => "Enable IMDb system",
'text_imdb_system_note' => "Default 'yes'. System-wide IMDb info setting.",
+ 'text_enable_pt_gen_system_note' => 'Enable PT-Gen system',
+ 'text_enable_pt_gen_note' => "Default 'yes'. System-wide PT-Gen info setting.",
'row_enable_school_system' => "Enable school system",
'text_school_system_note' => "Default 'no'. DO NOT enable this unless you know what you are doing!",
'row_restrict_email_domain' => "Restrict Email Domain",
diff --git a/nexus/PTGen/PTGen.php b/nexus/PTGen/PTGen.php
index dc1b399a..6aa2c3eb 100644
--- a/nexus/PTGen/PTGen.php
+++ b/nexus/PTGen/PTGen.php
@@ -14,19 +14,30 @@ class PTGen
{
private $apiPoint;
+ const FORMAT_HTML = 1;
+ const FORMAT_JSON = 2;
+
+ private static $formatText = [
+ self::FORMAT_HTML => 'HTML',
+ self::FORMAT_JSON => 'json',
+ ];
+
const SITE_DOUBAN = 'douban';
const SITE_IMDB = 'imdb';
const SITE_BANGUMI = 'bangumi';
private static $validSites = [
- self::SITE_DOUBAN => [
- 'url_pattern' => '/(?:https?:\/\/)?(?:(?:movie|www)\.)?douban\.com\/(?:subject|movie)\/(\d+)\/?/',
- ],
self::SITE_IMDB => [
'url_pattern' => '/(?:https?:\/\/)?(?:www\.)?imdb\.com\/title\/(tt\d+)\/?/',
+ 'home_page' => 'https://www.imdb.com/',
+ ],
+ self::SITE_DOUBAN => [
+ 'url_pattern' => '/(?:https?:\/\/)?(?:(?:movie|www)\.)?douban\.com\/(?:subject|movie)\/(\d+)\/?/',
+ 'home_page' => 'https://www.douban.com/',
],
self::SITE_BANGUMI => [
'url_pattern' => '/(?:https?:\/\/)?(?:bgm\.tv|bangumi\.tv|chii\.in)\/subject\/(\d+)\/?/',
+ 'home_page' => 'https://bangumi.tv/',
],
];
@@ -46,27 +57,61 @@ class PTGen
$this->apiPoint = $apiPoint;
}
- public function generateDouban(string $url): string
+ public function generate(string $url): array
{
- return $this->request($url, self::SITE_DOUBAN);
+ foreach (self::$validSites as $site => $info) {
+ if (preg_match($info['url_pattern'], $url, $matches)) {
+ $targetUrl = sprintf('%s/?site=%s&sid=%s', trim($this->apiPoint, '/'), $site , $matches[1]);
+ return $this->request($targetUrl);
+ }
+ }
+ throw new PTGenException("invalid url: $url");
}
- public function generateImdb(string $url): string
+ private function buildDetailsPageTableRow($ptGenArr, $site)
{
- return $this->request($url, self::SITE_IMDB);
+ global $lang_details;
+ $ptGenFormatted = $ptGenArr['format'];
+ $prefix = sprintf("[img]%s[/img]\n", $ptGenArr['poster']);
+ $ptGenFormatted = mb_substr($ptGenFormatted, mb_strlen($prefix, 'utf-8') + 1);
+ $ptGenFormatted = format_comment($ptGenFormatted);
+ $titleShowOrHide = $lang_details['title_show_or_hide'] ?? '';
+ $id = 'pt-gen-' . $site;
+ $html = <<
+
+
+
+
+ PT-Gen-{$site}
+
+
+
+ 
+
+ |
+
+
+ {$ptGenFormatted}
+
+ |
+
+HTML;
+ return $html;
}
- public function generateBangumi(string $url): string
+ private function request(string $url): array
{
- return $this->request($url, self::SITE_BANGUMI);
- }
-
- private function request(string $url, string $site): string
- {
- $url = $this->buildUrl($url, $site);
+ global $Cache;
$logPrefix = "url: $url";
+ $cacheKey = __METHOD__ . ":$url";
+ $cache = $Cache->get_value($cacheKey);
+ if ($cache) {
+ do_log("$logPrefix, from cache");
+ return $cache;
+ }
$http = new Client();
- $response = $http->get($url, ['timeout' => 5]);
+ $response = $http->get($url, ['timeout' => 10]);
$statusCode = $response->getStatusCode();
if ($statusCode != 200) {
$msg = "api point response http status code: $statusCode";
@@ -90,20 +135,53 @@ class PTGen
do_log("$logPrefix, response: $bodyString");
throw new PTGenException($msg);
}
-
- return $bodyString;
+ $Cache->cache_value($cacheKey, $bodyArr, 24 * 3600);
+ return $bodyArr;
}
- private function buildUrl(string $url, string $site): string
+ public function renderUploadPageFormInput($ptGen = '')
{
- if (!isset(self::$validSites[$site])) {
- throw new PTGenException("not support site: $site, only support: " . implode(", ", array_keys(self::$validSites)));
+ global $lang_functions;
+ $html = '';
+ $ptGen = (array)json_decode($ptGen, true);
+ foreach (self::$validSites as $site => $info) {
+ $value = $ptGen[$site]['link'] ?? '';
+ $x = $lang_functions["row_pt_gen_{$site}_url"];
+ $y = "
".$lang_functions["text_pt_gen_{$site}_url_note"]."";
+ $html .= tr($x, $y, 1);
}
- $siteInfo = self::$validSites[$site];
- $isUrlValid = preg_match($siteInfo['url_pattern'], $url, $matches);
- if (!$isUrlValid) {
- throw new PTGenException("invalid url: $url");
+ return $html;
+ }
+
+ public function renderDetailsPageDescription(array $torrentPtGenArr): array
+ {
+ $html = '';
+ $jsonArr = [];
+ $update = false;
+ foreach (self::$validSites as $site => $info) {
+ if (empty($torrentPtGenArr[$site]['link'])) {
+ continue;
+ }
+ $link = $torrentPtGenArr[$site]['link'];
+ $data = $torrentPtGenArr[$site]['data'] ?? [];
+ if (!empty($data)) {
+ $jsonArr[$site] = [
+ 'link' => $link,
+ 'data' => $data,
+ ];
+ $html .= $this->buildDetailsPageTableRow($data, $site);
+ } else {
+ $ptGenArr = $this->generate($torrentPtGenArr[$site]['link']);
+ $jsonArr[$site] = [
+ 'link' => $link,
+ 'data' => $ptGenArr,
+ ];
+ $html .= $this->buildDetailsPageTableRow($ptGenArr, $site);
+ if (!$update) {
+ $update = true;
+ }
+ }
}
- return sprintf('%s/?site=%s&sid=%s', trim($this->apiPoint, '/'), $site , $matches[1]);
+ return ['json_arr' => $jsonArr, 'html' => $html, 'update' => $update];
}
}
\ No newline at end of file
diff --git a/public/bitbucket-upload.php b/public/bitbucket-upload.php
index a2b5ec91..bd06660e 100644
--- a/public/bitbucket-upload.php
+++ b/public/bitbucket-upload.php
@@ -71,7 +71,7 @@ stdhead($lang_bitbucketupload['head_avatar_upload']);
| ".$lang_bitbucketupload['text_upload_directory_unwritable']." | ");
print("| ".$lang_bitbucketupload['text_disclaimer']."$scaleh".$lang_bitbucketupload['text_disclaimer_two']."$scalew".$lang_bitbucketupload['text_disclaimer_three'].number_format($maxfilesize).$lang_bitbucketupload['text_disclaimer_four']);
?>
diff --git a/public/details.php b/public/details.php
index bb0f3221..cfb5804f 100644
--- a/public/details.php
+++ b/public/details.php
@@ -13,7 +13,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, 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, 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);
@@ -394,6 +394,14 @@ else {
}
}
+ if (!empty($row['pt_gen'])) {
+ $ptGen = new \Nexus\PTGen\PTGen();
+ $ptGenResult = $ptGen->renderDetailsPageDescription(json_decode($row['pt_gen'], true));
+ if ($ptGenResult['update']) {
+ //@todo do some update
+ }
+ echo $ptGenResult['html'];
+ }
if ($imdb_id)
{
$where_area = " url = " . sqlesc((int)$imdb_id) ." AND torrents.id != ".sqlesc($id);
diff --git a/public/edit.php b/public/edit.php
index f21b2307..e4fd8f13 100644
--- a/public/edit.php
+++ b/public/edit.php
@@ -35,7 +35,7 @@ $showstandard = (get_searchbox_value($sectionmode, 'showstandard') || ($allowmov
$showprocessing = (get_searchbox_value($sectionmode, 'showprocessing') || ($allowmove && get_searchbox_value($othermode, 'showprocessing'))); //whether show processings or not
$showteam = (get_searchbox_value($sectionmode, 'showteam') || ($allowmove && get_searchbox_value($othermode, 'showteam'))); //whether show teams or not
$showaudiocodec = (get_searchbox_value($sectionmode, 'showaudiocodec') || ($allowmove && get_searchbox_value($othermode, 'showaudiocodec'))); //whether show audio codecs or not
-
+$settingMain = get_setting('main');
stdhead($lang_edit['head_edit_torrent'] . "\"". $row["name"] . "\"");
if (!isset($CURUSER) || ($CURUSER["id"] != $row["owner"] && get_user_class() < $torrentmanage_class)) {
@@ -54,6 +54,10 @@ else {
tr($lang_edit['row_small_description'], "", 1);
get_external_tr($row["url"]);
+ if ($settingMain['enable_pt_gen_system'] == 'yes') {
+ $ptGen = new \Nexus\PTGen\PTGen();
+ echo $ptGen->renderUploadPageFormInput($row['pt_gen']);
+ }
if ($enablenfo_main=='yes')
tr($lang_edit['row_nfo_file'], "".$lang_edit['radio_keep_current'].
diff --git a/public/settings.php b/public/settings.php
index ccb14549..3932b14e 100644
--- a/public/settings.php
+++ b/public/settings.php
@@ -49,7 +49,17 @@ $notice = " |