refactor: 优化网盘类型判断逻辑并修复模板语法

- 在 `Transfer.php` 中添加 `fast.uc.cn` 域名支持
- 将 `3.php` 中的 `<?` 短标签替换为 `<?php` 以提高兼容性
- 重构 `determineIsType` 函数,使用数组映射简化网盘类型判断逻辑
This commit is contained in:
admin
2025-04-01 10:31:27 +08:00
parent d214fbad99
commit 1550eed2c5
3 changed files with 19 additions and 15 deletions
+17 -14
View File
@@ -783,22 +783,25 @@ function highlightKeywords($title, $searchTitle)
/**
* 判断是哪个网盘
* @return array
*/
* @return int 网盘类型
*/
function determineIsType($url) {
// 判断 $url 中包含的域名并返回对应的 is_type
if (strpos($url, 'alipan.com') !== false) {
return 1;
} elseif (strpos($url, 'baidu.com') !== false) {
return 2;
} elseif (strpos($url, 'uc.cn') !== false) {
return 3;
} elseif (strpos($url, 'xunlei.com') !== false) {
return 4;
} else {
// 默认值是夸克网盘,返回 0
return 0;
$domains = [
'alipan.com' => 1,
'aliyundrive.com' => 1,
'baidu.com' => 2,
'uc.cn' => 3,
'xunlei.com' => 4
];
foreach ($domains as $domain => $type) {
if (strpos($url, $domain) !== false) {
return $type;
}
}
// 默认值是夸克网盘,返回 0
return 0;
}
/**
+1
View File
@@ -64,6 +64,7 @@ class Transfer
'www.aliyundrive.com' => 1,
'pan.baidu.com' => 2,
'drive.uc.cn' => 3,
'fast.uc.cn' => 3,
// 'pan.xunlei.com' => 4,
];
+1 -1
View File
@@ -30,7 +30,7 @@
<td><div id="J_install_tip_dbpw"></div></td>
</tr>
<?php }?>
<? if(INSTALLTYPE == 'HOST' || INSTALLTYPE == 'BAE'){ ?>
<?php if(INSTALLTYPE == 'HOST' || INSTALLTYPE == 'BAE'){ ?>
<tr>
<td class="tar">数据库名:</td>
<td><input type="text" name="dbname" id="dbname" value="<?php echo $config['dbName'] ?>" class="input"></td>