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) { function determineIsType($url) {
// 判断 $url 中包含的域名并返回对应的 is_type $domains = [
if (strpos($url, 'alipan.com') !== false) { 'alipan.com' => 1,
return 1; 'aliyundrive.com' => 1,
} elseif (strpos($url, 'baidu.com') !== false) { 'baidu.com' => 2,
return 2; 'uc.cn' => 3,
} elseif (strpos($url, 'uc.cn') !== false) { 'xunlei.com' => 4
return 3; ];
} elseif (strpos($url, 'xunlei.com') !== false) {
return 4; foreach ($domains as $domain => $type) {
} else { if (strpos($url, $domain) !== false) {
// 默认值是夸克网盘,返回 0 return $type;
return 0; }
} }
// 默认值是夸克网盘,返回 0
return 0;
} }
/** /**
+1
View File
@@ -64,6 +64,7 @@ class Transfer
'www.aliyundrive.com' => 1, 'www.aliyundrive.com' => 1,
'pan.baidu.com' => 2, 'pan.baidu.com' => 2,
'drive.uc.cn' => 3, 'drive.uc.cn' => 3,
'fast.uc.cn' => 3,
// 'pan.xunlei.com' => 4, // 'pan.xunlei.com' => 4,
]; ];
+1 -1
View File
@@ -30,7 +30,7 @@
<td><div id="J_install_tip_dbpw"></div></td> <td><div id="J_install_tip_dbpw"></div></td>
</tr> </tr>
<?php }?> <?php }?>
<? if(INSTALLTYPE == 'HOST' || INSTALLTYPE == 'BAE'){ ?> <?php if(INSTALLTYPE == 'HOST' || INSTALLTYPE == 'BAE'){ ?>
<tr> <tr>
<td class="tar">数据库名:</td> <td class="tar">数据库名:</td>
<td><input type="text" name="dbname" id="dbname" value="<?php echo $config['dbName'] ?>" class="input"></td> <td><input type="text" name="dbname" id="dbname" value="<?php echo $config['dbName'] ?>" class="input"></td>