diff --git a/.env b/.env index 762a345..6e62d89 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ -APP_DEBUG = false -SYSTEM_SALT= YAdmin +APP_DEBUG = true +SYSTEM_SALT= admin [APP] DEFAULT_TIMEZONE = Asia/Chongqing @@ -7,7 +7,7 @@ DEFAULT_TIMEZONE = Asia/Chongqing [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 -DATABASE = www_dj_com +DATABASE = www_abc_com USERNAME = 123456 PASSWORD = 123456 HOSTPORT = 3306 diff --git a/.gitignore b/.gitignore index 19d1575..c0aa785 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /.svn /.vscode runtime +nginx.htaccess +.env \ No newline at end of file diff --git a/.htaccess b/.htaccess index 0519ecb..e69de29 100644 --- a/.htaccess +++ b/.htaccess @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/README.md b/README.md index f816fee..57ab810 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,18 @@ 如有任何问题或建议,欢迎交流探讨! 😊 +> **声明**:本项目由 Trae AI 辅助编写。由于本人时间有限,仅在空闲时维护。如遇使用问题,请优先自行排查,感谢理解! + ## 更新日志 +### v3.0 + +- 新增 项目安装向导,简化部署流程 +- 新增 多网盘转存导入功能,支持夸克、阿里、百度、UC +- 优化 解决部分数据导致的路由报错 +- 优化 AI重构转存功能,提升稳定性与效率 + + ### v2.1 - 增加网页全网搜功能 @@ -20,7 +30,6 @@ - 后台增加批量删除功能 - 优化表格导入功能 -注:如何更新见文件夹updateLog/24.11.4 ### v2 @@ -33,53 +42,10 @@ - 支持多网盘导入功能(目前仅夸克支持转存分享) - 增加资源分类功能 -注:鉴于数据库改动大,最快升级方式:1、重新搭建新项目;2、旧项目后台导出资源表格;3、新项目导入这个表格 +## 搭建教程 -## 后台安装教程 +[教程](https://tcn6g7hyxvir.feishu.cn/wiki/WYT4wZtrjijeswkI0RSc4ofTnah) -0、PHP(选择7.2,其它版本不兼容) - -1、上传源码到服务器 - -2、设置网站运行目录public - -3、设置thinkphp伪静态 - -4、导入数据库文件 - -5、修改.env文件数据库参数 - -后台地址:https://你的域名/qfadmin -账号密码:admin 123456 - -## 常见问题 - -0、系统不再支持全部转存及每日更新,有能力者可自行修改使用 - -1、全部转存执行1分钟~5分钟后中断问题,修改超时限制 -该操作用时很长,请设置最大值86400 设置后需重启下服务 -宝塔设置教程 https://www.kancloud.cn/loveouu/bthelp/1541867 - -2、非7.2版本导致的报错,请自行解决,不要再问!!!不会就百度或者老老实实用7.2 - -3、nginx 404 Not Found 伪静态设置 -```shell -location ~* (runtime|application)/{ - return 403; -} -location / { - if (!-e $request_filename){ - rewrite ^(.*)$ /index.php?s=$1 last; break; - } -} -``` - -4、网站经常打不开,出现500的情况,未具体找到原因,可能是因为服务器配置太低,分词功能占用内存过高导致的 -升级服务器配置或后台修改搜索模式改为“精准搜索”; - - -5、全网搜的内容为临时分享资源,需要配置计划任务 每5分钟执行一次 即可 -https://XXXXX/api/other/delete_search ## 前台截图 @@ -96,13 +62,6 @@ https://XXXXX/api/other/delete_search ![image](github/2.png) -## 如何获取夸克网盘Cookie - -登录夸克网盘后,按下F12,刷新页面 - -![image](github/cookie.jpg) - - # 免费交流社群 可以进交流群,一起交流学习,添加时请备注来源(如果项目对你有所帮助,也可以请我喝杯咖啡 ☕️ ~) diff --git a/app/admin/controller/Source.php b/app/admin/controller/Source.php index 639691f..36ed4f9 100644 --- a/app/admin/controller/Source.php +++ b/app/admin/controller/Source.php @@ -342,7 +342,6 @@ class Source extends QfShop $this->excelField = $excelField; $this->exportExcelData($dataList); - print_r(12); } /** @@ -362,50 +361,7 @@ class Source extends QfShop $source_category_id = input('source_category_id')??0; - $urls = input("urls"); - - $urls = explode("\n", $urls); - - // 去掉数组元素中的空白字符 - $urls = array_map('trim', $urls); - - // 过滤掉空值的数组元素 - $urls = array_filter($urls); - - $allData = array_values(array_filter(array_map(function ($item) { - // 提取 URL - if (!preg_match('/https?:\/\/[^\s]+/', $item, $matches)) { - return null; // 没有匹配到 URL,直接丢弃 - } - - $url = trim($matches[0]); - $code = ''; - - // 提取提取码(?pwd= 或 , 分割) - if (preg_match('/\?pwd=([^,\s]+)/', $item, $pwdMatch)) { - $code = trim($pwdMatch[1]); - } elseif (preg_match('/,(.+)$/', $item, $commaMatch)) { - $code = trim($commaMatch[1]); - } - - // 返回结果时,确保 title 保持为空字符串 - return [ - 'url' => $url, - 'title' => '', - 'code' => $code - ]; - }, $urls))); - - - // 去重,使用 'url' 字段来去重 - $uniqueUrls = []; - $allData = array_filter($allData, function($item) use (&$uniqueUrls) { - if (!in_array($item['url'], $uniqueUrls)) { - $uniqueUrls[] = $item['url']; // 添加到已处理的 URL 列表 - return true; // 保留此项目 - } - return false; // 去掉重复的项目 - }); + $allData = parsePanLinks(input("urls")); $quarkPlugin = new QuarkPlugin(); if(input("type")==2){ @@ -416,7 +372,7 @@ class Source extends QfShop $res = $quarkPlugin->import($allData,$source_category_id); } - return jok('已提交任务,稍后查看结果2',$res); + return jok('已提交任务,稍后查看结果2',$allData); } /** @@ -449,10 +405,13 @@ class Source extends QfShop if ($error) { return $error; } - $quarkPlugin = new QuarkPlugin(); - $result = $quarkPlugin->getFiles(Config('qfshop.quark_cookie')); - return jok('获取成功',$result); + $result = $quarkPlugin->getFiles(input('type')??0,input('pdir_fid')??0); + + if($result['code'] != 200){ + return jerr($result['message']); + } + return jok('获取成功',$result['data']); } } diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index 8d13ec3..64af936 100644 --- a/app/api/controller/Index.php +++ b/app/api/controller/Index.php @@ -12,8 +12,246 @@ class Index extends QfShop { public function index() { - return jok("Hello World!"); + // return jok("Hello World!"); + + $cookie = 'csrfToken=gKesaboeWtJkukG4VNGh5Ljk; BAIDUID=757FBF0C282638B49A59DC7E37C7702B:FG=1; BAIDUID_BFESS=757FBF0C282638B49A59DC7E37C7702B:FG=1; Hm_lvt_7a3960b6f067eb0085b7f96ff5e660b0=1742787964; RT="z=1&dm=baidu.com&si=86a18d7d-4537-4b9b-ac36-06a756df3179&ss=m8mj80dn&sl=0&tt=0&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf&ul=261&hd=26a"; Hm_lpvt_7a3960b6f067eb0085b7f96ff5e660b0=1742794455; newlogin=1; ppfuid=FOCoIC3q5fKa8fgJnwzbE67EJ49BGJeplOzf+4l4EOvDuu2RXBRv6R3A1AZMa49I27C0gDDLrJyxcIIeAeEhD8JYsoLTpBiaCXhLqvzbzmvy3SeAW17tKgNq/Xx+RgOdb8TWCFe62MVrDTY6lMf2GrfqL8c87KLF2qFER3obJGmxOaJD7Qr04D9rET96PX99GEimjy3MrXEpSuItnI4KD2P5vWa8VVdqKPLBckQ0WyruzFB5pZ7L1GIDHy291nRZSc37WI7hn7N5DEkitWgHVHqxGUGRl1qke9+4QxQVI1jGgLbz7OSojK1zRbqBESR5Pdk2R9IA3lxxOVzA+Iw1TWLSgWjlFVG9Xmh1+20oPSbrzvDjYtVPmZ+9/6evcXmhcO1Y58MgLozKnaQIaLfWRIM4pp9u1B7t2Y8SxQH/XnrgZXt2Kg4R5SS0He7SlWGt42bJBOW2wZKr1YF6Z6VWTM5FjnYxYstXg/9EfB3EVmLB2thKqX6G/zUWgdr9REaklV1Uhhp5FAe6gNJIUptp7EMAaXYKm11G+JVPszQFdp9AJLcm4YSsYUXkaPI2Tl66J246cmjWQDTahAOINR5rXR5r/7VVI1RMZ8gb40q7az7vCK56XLooKT5a+rsFrf5Zu0yyCiiagElhrTEOtNdBJJq8eHwEHuFBni9ahSwpC7lbKkUwaKH69tf0DFV7hJROiLETSFloIVkHdy3+I2JUr1LsplAz0hMkWt/tE4tXVUV7QcTDTZWS/2mCoS/GV3N9awQ6iM6hs/BWjlgnEa1+5hYkkYOBBLZqDwzG9FQyZZJmSCAynpprqnVbhrjcNYdk5FKazXcZ/j40FJv+iLGBn3nkkgHlne61I8I7KhtQgInXjsNS9+mteGCT/vj/pEvkm+ZitcePbf21QMldRrlvw4uFnWmLU84Th29MqUuVR0ujl0ys3zTnxv/D47Q2VFyeFv12nptBFm2PISy0WmJ/Sy3ktTWpm7mcOABi5Gey1FBzkrq/nzqRQID/LRsJJW24e+1N4wlJzhNmFXMQ0YiYVdq7aHN89Oybut+xsc38J6I4Wd2rVi5xrH8hGqvd77OJuzH8X+tb0PV+Xnu3NL1fmqLIh+XcF6fnyPFPUxteQtbtLyi+gq5zowg1oFj8O/L9oVsoK22a9qUmM/HrJMRsLi1+J9aSd42+X78fDIZgkPh3epzLLvwRmnAbs5z/V+jl3P3gVnlwm9bfwhaFtnhFN2dHYAw7i4QhrXdzc77isXhbvkM5DsEwz5RTVSb4C+N+kIl81Iase/C16XVPKOj9XA==; BDUSS=jYwbDRJZG0yTi1VbDgtMWF6M1BGZ0k0ZG96dm9iOHJGczFMOUYtMFhwYlJmd2hvRVFBQUFBJCQAAAAAAAAAAAEAAAA63UdY2K~Yr8Dksru5~cjL0MQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANHy4GfR8uBnT; BDUSS_BFESS=jYwbDRJZG0yTi1VbDgtMWF6M1BGZ0k0ZG96dm9iOHJGczFMOUYtMFhwYlJmd2hvRVFBQUFBJCQAAAAAAAAAAAEAAAA63UdY2K~Yr8Dksru5~cjL0MQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANHy4GfR8uBnT; STOKEN=608a270497995724e6ed69015178372081331f404747f0a8492ee31de1184c41; PANPSC=6332961014215215224%3AAuI6D6iGxsvXU%2FMlrspYA1cS2d9ns3O5g0mIZdLHpdQGbqupDlB1gtH1%2BL8BUDk1coDRJu%2FbTp%2FiLaLUl0KD5De4ZdaW7CoOlL98c8Ccr9ch6uZoP3DwQ9YfJggg9xZJa6gjWHNi7jj6tFSlPcYsyyZWmuM7JILl4szUrnVKA5MNNiO7%2B4TS%2B1QskbZnP5EyWagh%2FyTVtumv9EBTj3cIccvsqRsDSpjMTItbmssa8FDJel1POICqciYu0WtaRbrkbSBvzd4TSG3wk8UVEJrJjetuQFScyIV%2FkrFWWqsgPEw%3D; Hm_lvt_182d6d59474cf78db37e0b2248640ea5=1742788120; ndut_fmt=6F438330EB0B4C594C515F276A3E73E3F2D3A8BB5A3C26DD1E721E98B58ED17B; Hm_lpvt_182d6d59474cf78db37e0b2248640ea5=1742795476; ab_sr=1.0.1_YTI3MjJmMjkwY2Y5MTJhMjc4MGJhNWU2ZGMwNTFiZWZiNmZhMTZkMWRlNWYyMzAxNTA1OTU2YTU4ZjU5M2ZiNWI5NDY2YjYwZWY3Yjc4YTY3MmNiMWVlNWNkNzE2ZGI2YzJmYTY1YTgwM2M1ZDJlYTk1YjAxZTcyMmNkNWRkNzliM2RiOGMzYzUxYmMwZTU4OTJiZmRmNjhiMDIzZDc1OWRhMGIyNGNkMDJhOTMzZjllYmQxMDUzY2ZjYzU4MjVk'; + // $cookie = ''; + $network = new \netdisk\pan\BaiduWork($cookie); + $bdstoken = $network->getBdstoken(); + $network->setBdstoken($bdstoken); + + // 验证提取码 + // $linkUrl = "https://pan.baidu.com/s/11ioAjAwdwzI3BEvP5c62bw"; // 分享链接 + // $passCode = "him8"; // 4位提取码 + + $linkUrl = "https://pan.baidu.com/s/1HU99KPtdJEpKnYnYLnQ37Q"; // 分享链接 + $passCode = "ruwf"; // 4位提取码 + + // $linkUrl = "https://pan.baidu.com/s/1f03pM6dvtZPGA1bA0DH9AQ"; // 分享链接 + // $passCode = "a9oa"; // 4位提取码 + + // 先判断是否有提取码 + if (!empty($passCode)) { + // 验证提取码 + $randsk = $network->verifyPassCode($linkUrl, $passCode); + if (is_numeric($randsk)) { + return jerr($network->getErrorMessage($randsk)); + } + // 验证成功,更新 cookie + $network->updateBdclnd($randsk); + } + + // 获取转存参数 + $transferParams = $network->getTransferParams($linkUrl); + if (is_numeric($transferParams)) { + return jerr($network->getErrorMessage($transferParams)); + } + // 解析返回的参数 + list($shareId, $userId, $fsIds, $fileNames, $isDirs) = $transferParams; + + $folderName = ''; // 自定义保存目录名 + // 检查目录名是否包含非法字符 + $invalidChars = ['<', '>', '|', '*', '?', '\\', ':']; + foreach ($invalidChars as $char) { + if (strpos($folderName, $char) !== false) { + return jerr('转存目录名有非法字符,不能包含:< > | * ? \\ :'); + } + } + + // 先检查目录是否存在,不存在再创建 + $dirList = $network->getDirList('/' . $folderName); + // 如果返回的是错误码,说明目录不存在,需要创建 + if (is_numeric($dirList)) { + $createResult = $network->createDir($folderName); + if ($createResult !== 0) { + return jerr($network->getErrorMessage($createResult)); + } + } + + // 执行文件转存 + $transferResult = $network->transferFile([$shareId, $userId, $fsIds], $folderName); + if ($transferResult !== 0) { + return jerr($network->getErrorMessage($transferResult)); + } + + // 转存成功后,获取目录中的文件列表 + $dirList = $network->getDirList('/' . $folderName); + if (is_numeric($dirList)) { + return jerr($network->getErrorMessage($dirList)); + } + + // 找到刚刚转存的所有文件 + $targetFiles = []; + $fsIdList = []; + $filePaths = []; + $adFilePaths = []; // 用于存储包含广告的文件路径 + $allFilesAreAds = true; // 假设所有文件都是广告 + + foreach ($dirList as $file) { + if (in_array($file['server_filename'], $fileNames)) { + $targetFiles[] = $file; + $fsIdList[] = $file['fs_id']; + $filePath = '/' . $folderName . '/' . $file['server_filename']; + $filePaths[] = $filePath; + + // 检查文件名是否包含广告内容 + $containsAd = $this->containsAdKeywords($file['server_filename']); + + // 如果是目录,需要检查目录内的文件 + if ($file['isdir'] == 1) { + // 获取子目录内容 + $subDirList = $network->getDirList($filePath); + if (!is_numeric($subDirList)) { + foreach ($subDirList as $subFile) { + // 检查子文件是否包含广告关键词 + if ($this->containsAdKeywords($subFile['server_filename'])) { + // 将包含广告的子文件添加到待删除列表 + $adFilePaths[] = $filePath . '/' . $subFile['server_filename']; + } else { + // 只要有一个文件不是广告,就将标志设为false + $allFilesAreAds = false; + } + } + } + } else { + // 如果是文件,直接判断 + if ($containsAd) { + $adFilePaths[] = $filePath; + } else { + $allFilesAreAds = false; + } + } + } + } + + if (empty($targetFiles)) { + return jerr('找不到刚转存的文件'); + } + + // 如果所有文件都是广告,删除整个转存的内容 + if ($allFilesAreAds && !empty($targetFiles)) { + // 删除所有转存的文件 + $deleteResult = $network->batchDeleteFiles($filePaths); + if ($deleteResult['errno'] === 0) { + return jok('所有转存的文件都包含广告内容,已全部删除', [ + 'deletedCount' => $deleteResult['deletedCount'], + 'paths' => $deleteResult['paths'] + ]); + } else { + return jerr('删除广告文件失败: ' . $deleteResult['message']); + } + } + + // 如果只有部分文件是广告,只删除广告文件 + if (!empty($adFilePaths)) { + $deleteResult = $network->batchDeleteFiles($adFilePaths); + // 删除后更新文件列表 + if ($deleteResult['errno'] === 0) { + // 从fsIdList和filePaths中移除已删除的广告文件 + foreach ($adFilePaths as $adPath) { + $key = array_search($adPath, $filePaths); + if ($key !== false) { + unset($filePaths[$key]); + unset($fsIdList[$key]); + } + } + // 重新索引数组 + $filePaths = array_values($filePaths); + $fsIdList = array_values($fsIdList); + } + } + + // 如果删除广告后没有文件了,返回提示 + if (empty($fsIdList)) { + return jok('所有有效文件都包含广告内容,已全部删除'); + } + + // 创建分享 + $expiry = 0; // 0为永久 + $password = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 4); // 随机4位提取码 + $shareLink = $network->createShare(implode(',', $fsIdList), $expiry, $password); + + if (is_numeric($shareLink)) { + return jerr($network->getErrorMessage($shareLink)); + } + + // 转存成功 + return jok("文件转存成功", [ + 'fileNames' => $fileNames, + 'fileCount' => count($fsIdList), + 'folderName' => $folderName, + 'shareLink' => $shareLink, + 'password' => $password, + 'filePaths' => $filePaths, + 'removedAdFiles' => $adFilePaths + ]); } + + /** + * 检查文件名是否包含广告关键词 + * @param string $filename 文件名 + * @return bool 是否包含广告关键词 + */ + private function containsAdKeywords($filename) + { + $banned = Config('qfshop.quark_banned') ?? ''; // 如果出现这些字样就删除 + + // 广告关键词列表 + $adKeywords = []; + if (!empty($banned)) { + $adKeywords = array_map('trim', explode(',', $banned)); + } + + // 转为小写进行比较 + $lowercaseFilename = mb_strtolower($filename); + + foreach ($adKeywords as $keyword) { + if (mb_strpos($lowercaseFilename, mb_strtolower($keyword)) !== false) { + return true; + } + } + + return false; + } + + public function getFiles() + { + $cookie = 'csrfToken=gKesaboeWtJkukG4VNGh5Ljk; BAIDUID=757FBF0C282638B49A59DC7E37C7702B:FG=1; BAIDUID_BFESS=757FBF0C282638B49A59DC7E37C7702B:FG=1; Hm_lvt_7a3960b6f067eb0085b7f96ff5e660b0=1742787964; RT="z=1&dm=baidu.com&si=86a18d7d-4537-4b9b-ac36-06a756df3179&ss=m8mj80dn&sl=0&tt=0&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf&ul=261&hd=26a"; Hm_lpvt_7a3960b6f067eb0085b7f96ff5e660b0=1742794455; newlogin=1; ppfuid=FOCoIC3q5fKa8fgJnwzbE67EJ49BGJeplOzf+4l4EOvDuu2RXBRv6R3A1AZMa49I27C0gDDLrJyxcIIeAeEhD8JYsoLTpBiaCXhLqvzbzmvy3SeAW17tKgNq/Xx+RgOdb8TWCFe62MVrDTY6lMf2GrfqL8c87KLF2qFER3obJGmxOaJD7Qr04D9rET96PX99GEimjy3MrXEpSuItnI4KD2P5vWa8VVdqKPLBckQ0WyruzFB5pZ7L1GIDHy291nRZSc37WI7hn7N5DEkitWgHVHqxGUGRl1qke9+4QxQVI1jGgLbz7OSojK1zRbqBESR5Pdk2R9IA3lxxOVzA+Iw1TWLSgWjlFVG9Xmh1+20oPSbrzvDjYtVPmZ+9/6evcXmhcO1Y58MgLozKnaQIaLfWRIM4pp9u1B7t2Y8SxQH/XnrgZXt2Kg4R5SS0He7SlWGt42bJBOW2wZKr1YF6Z6VWTM5FjnYxYstXg/9EfB3EVmLB2thKqX6G/zUWgdr9REaklV1Uhhp5FAe6gNJIUptp7EMAaXYKm11G+JVPszQFdp9AJLcm4YSsYUXkaPI2Tl66J246cmjWQDTahAOINR5rXR5r/7VVI1RMZ8gb40q7az7vCK56XLooKT5a+rsFrf5Zu0yyCiiagElhrTEOtNdBJJq8eHwEHuFBni9ahSwpC7lbKkUwaKH69tf0DFV7hJROiLETSFloIVkHdy3+I2JUr1LsplAz0hMkWt/tE4tXVUV7QcTDTZWS/2mCoS/GV3N9awQ6iM6hs/BWjlgnEa1+5hYkkYOBBLZqDwzG9FQyZZJmSCAynpprqnVbhrjcNYdk5FKazXcZ/j40FJv+iLGBn3nkkgHlne61I8I7KhtQgInXjsNS9+mteGCT/vj/pEvkm+ZitcePbf21QMldRrlvw4uFnWmLU84Th29MqUuVR0ujl0ys3zTnxv/D47Q2VFyeFv12nptBFm2PISy0WmJ/Sy3ktTWpm7mcOABi5Gey1FBzkrq/nzqRQID/LRsJJW24e+1N4wlJzhNmFXMQ0YiYVdq7aHN89Oybut+xsc38J6I4Wd2rVi5xrH8hGqvd77OJuzH8X+tb0PV+Xnu3NL1fmqLIh+XcF6fnyPFPUxteQtbtLyi+gq5zowg1oFj8O/L9oVsoK22a9qUmM/HrJMRsLi1+J9aSd42+X78fDIZgkPh3epzLLvwRmnAbs5z/V+jl3P3gVnlwm9bfwhaFtnhFN2dHYAw7i4QhrXdzc77isXhbvkM5DsEwz5RTVSb4C+N+kIl81Iase/C16XVPKOj9XA==; BDUSS=jYwbDRJZG0yTi1VbDgtMWF6M1BGZ0k0ZG96dm9iOHJGczFMOUYtMFhwYlJmd2hvRVFBQUFBJCQAAAAAAAAAAAEAAAA63UdY2K~Yr8Dksru5~cjL0MQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANHy4GfR8uBnT; BDUSS_BFESS=jYwbDRJZG0yTi1VbDgtMWF6M1BGZ0k0ZG96dm9iOHJGczFMOUYtMFhwYlJmd2hvRVFBQUFBJCQAAAAAAAAAAAEAAAA63UdY2K~Yr8Dksru5~cjL0MQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANHy4GfR8uBnT; STOKEN=608a270497995724e6ed69015178372081331f404747f0a8492ee31de1184c41; PANPSC=6332961014215215224%3AAuI6D6iGxsvXU%2FMlrspYA1cS2d9ns3O5g0mIZdLHpdQGbqupDlB1gtH1%2BL8BUDk1coDRJu%2FbTp%2FiLaLUl0KD5De4ZdaW7CoOlL98c8Ccr9ch6uZoP3DwQ9YfJggg9xZJa6gjWHNi7jj6tFSlPcYsyyZWmuM7JILl4szUrnVKA5MNNiO7%2B4TS%2B1QskbZnP5EyWagh%2FyTVtumv9EBTj3cIccvsqRsDSpjMTItbmssa8FDJel1POICqciYu0WtaRbrkbSBvzd4TSG3wk8UVEJrJjetuQFScyIV%2FkrFWWqsgPEw%3D; Hm_lvt_182d6d59474cf78db37e0b2248640ea5=1742788120; ndut_fmt=6F438330EB0B4C594C515F276A3E73E3F2D3A8BB5A3C26DD1E721E98B58ED17B; Hm_lpvt_182d6d59474cf78db37e0b2248640ea5=1742795476; ab_sr=1.0.1_YTI3MjJmMjkwY2Y5MTJhMjc4MGJhNWU2ZGMwNTFiZWZiNmZhMTZkMWRlNWYyMzAxNTA1OTU2YTU4ZjU5M2ZiNWI5NDY2YjYwZWY3Yjc4YTY3MmNiMWVlNWNkNzE2ZGI2YzJmYTY1YTgwM2M1ZDJlYTk1YjAxZTcyMmNkNWRkNzliM2RiOGMzYzUxYmMwZTU4OTJiZmRmNjhiMDIzZDc1OWRhMGIyNGNkMDJhOTMzZjllYmQxMDUzY2ZjYzU4MjVk'; + // $cookie = ''; + $network = new \netdisk\pan\BaiduWork($cookie); + + $res = $network->getDirList('/'); + + return jok('获取成功',$res); + } + + public function delete() + { + $cookie = 'csrfToken=gKesaboeWtJkukG4VNGh5Ljk; BAIDUID=757FBF0C282638B49A59DC7E37C7702B:FG=1; BAIDUID_BFESS=757FBF0C282638B49A59DC7E37C7702B:FG=1; Hm_lvt_7a3960b6f067eb0085b7f96ff5e660b0=1742787964; RT="z=1&dm=baidu.com&si=86a18d7d-4537-4b9b-ac36-06a756df3179&ss=m8mj80dn&sl=0&tt=0&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf&ul=261&hd=26a"; Hm_lpvt_7a3960b6f067eb0085b7f96ff5e660b0=1742794455; newlogin=1; ppfuid=FOCoIC3q5fKa8fgJnwzbE67EJ49BGJeplOzf+4l4EOvDuu2RXBRv6R3A1AZMa49I27C0gDDLrJyxcIIeAeEhD8JYsoLTpBiaCXhLqvzbzmvy3SeAW17tKgNq/Xx+RgOdb8TWCFe62MVrDTY6lMf2GrfqL8c87KLF2qFER3obJGmxOaJD7Qr04D9rET96PX99GEimjy3MrXEpSuItnI4KD2P5vWa8VVdqKPLBckQ0WyruzFB5pZ7L1GIDHy291nRZSc37WI7hn7N5DEkitWgHVHqxGUGRl1qke9+4QxQVI1jGgLbz7OSojK1zRbqBESR5Pdk2R9IA3lxxOVzA+Iw1TWLSgWjlFVG9Xmh1+20oPSbrzvDjYtVPmZ+9/6evcXmhcO1Y58MgLozKnaQIaLfWRIM4pp9u1B7t2Y8SxQH/XnrgZXt2Kg4R5SS0He7SlWGt42bJBOW2wZKr1YF6Z6VWTM5FjnYxYstXg/9EfB3EVmLB2thKqX6G/zUWgdr9REaklV1Uhhp5FAe6gNJIUptp7EMAaXYKm11G+JVPszQFdp9AJLcm4YSsYUXkaPI2Tl66J246cmjWQDTahAOINR5rXR5r/7VVI1RMZ8gb40q7az7vCK56XLooKT5a+rsFrf5Zu0yyCiiagElhrTEOtNdBJJq8eHwEHuFBni9ahSwpC7lbKkUwaKH69tf0DFV7hJROiLETSFloIVkHdy3+I2JUr1LsplAz0hMkWt/tE4tXVUV7QcTDTZWS/2mCoS/GV3N9awQ6iM6hs/BWjlgnEa1+5hYkkYOBBLZqDwzG9FQyZZJmSCAynpprqnVbhrjcNYdk5FKazXcZ/j40FJv+iLGBn3nkkgHlne61I8I7KhtQgInXjsNS9+mteGCT/vj/pEvkm+ZitcePbf21QMldRrlvw4uFnWmLU84Th29MqUuVR0ujl0ys3zTnxv/D47Q2VFyeFv12nptBFm2PISy0WmJ/Sy3ktTWpm7mcOABi5Gey1FBzkrq/nzqRQID/LRsJJW24e+1N4wlJzhNmFXMQ0YiYVdq7aHN89Oybut+xsc38J6I4Wd2rVi5xrH8hGqvd77OJuzH8X+tb0PV+Xnu3NL1fmqLIh+XcF6fnyPFPUxteQtbtLyi+gq5zowg1oFj8O/L9oVsoK22a9qUmM/HrJMRsLi1+J9aSd42+X78fDIZgkPh3epzLLvwRmnAbs5z/V+jl3P3gVnlwm9bfwhaFtnhFN2dHYAw7i4QhrXdzc77isXhbvkM5DsEwz5RTVSb4C+N+kIl81Iase/C16XVPKOj9XA==; BDUSS=jYwbDRJZG0yTi1VbDgtMWF6M1BGZ0k0ZG96dm9iOHJGczFMOUYtMFhwYlJmd2hvRVFBQUFBJCQAAAAAAAAAAAEAAAA63UdY2K~Yr8Dksru5~cjL0MQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANHy4GfR8uBnT; BDUSS_BFESS=jYwbDRJZG0yTi1VbDgtMWF6M1BGZ0k0ZG96dm9iOHJGczFMOUYtMFhwYlJmd2hvRVFBQUFBJCQAAAAAAAAAAAEAAAA63UdY2K~Yr8Dksru5~cjL0MQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANHy4GfR8uBnT; STOKEN=608a270497995724e6ed69015178372081331f404747f0a8492ee31de1184c41; PANPSC=6332961014215215224%3AAuI6D6iGxsvXU%2FMlrspYA1cS2d9ns3O5g0mIZdLHpdQGbqupDlB1gtH1%2BL8BUDk1coDRJu%2FbTp%2FiLaLUl0KD5De4ZdaW7CoOlL98c8Ccr9ch6uZoP3DwQ9YfJggg9xZJa6gjWHNi7jj6tFSlPcYsyyZWmuM7JILl4szUrnVKA5MNNiO7%2B4TS%2B1QskbZnP5EyWagh%2FyTVtumv9EBTj3cIccvsqRsDSpjMTItbmssa8FDJel1POICqciYu0WtaRbrkbSBvzd4TSG3wk8UVEJrJjetuQFScyIV%2FkrFWWqsgPEw%3D; Hm_lvt_182d6d59474cf78db37e0b2248640ea5=1742788120; ndut_fmt=6F438330EB0B4C594C515F276A3E73E3F2D3A8BB5A3C26DD1E721E98B58ED17B; Hm_lpvt_182d6d59474cf78db37e0b2248640ea5=1742795476; ab_sr=1.0.1_YTI3MjJmMjkwY2Y5MTJhMjc4MGJhNWU2ZGMwNTFiZWZiNmZhMTZkMWRlNWYyMzAxNTA1OTU2YTU4ZjU5M2ZiNWI5NDY2YjYwZWY3Yjc4YTY3MmNiMWVlNWNkNzE2ZGI2YzJmYTY1YTgwM2M1ZDJlYTk1YjAxZTcyMmNkNWRkNzliM2RiOGMzYzUxYmMwZTU4OTJiZmRmNjhiMDIzZDc1OWRhMGIyNGNkMDJhOTMzZjllYmQxMDUzY2ZjYzU4MjVk'; + // $cookie = ''; + $network = new \netdisk\pan\BaiduWork($cookie); + $bdstoken = $network->getBdstoken(); + $network->setBdstoken($bdstoken); + + // 使用固定的文件路径数组 + $filePaths = [ + "//1", + "//2" + ]; + + // 调用批量删除方法 + $result = $network->batchDeleteFiles($filePaths); + + if ($result['errno'] === 0) { + return jok('文件删除成功', [ + 'deletedCount' => $result['deletedCount'], + 'paths' => $result['paths'] + ]); + } else { + return jerr($result['message']); + } + } + public function search() { $fc = new VicWord(); $keywords = input('keywords'); diff --git a/app/api/controller/Open.php b/app/api/controller/Open.php index c207730..02d2d4c 100644 --- a/app/api/controller/Open.php +++ b/app/api/controller/Open.php @@ -5,703 +5,48 @@ namespace app\api\controller; use think\App; use think\facade\Cache; use app\api\QfShop; +use app\model\Source as SourceModel; class Open extends QfShop { - public function __construct(App $app) - { - parent::__construct($app); - $this->url = ""; - $this->is_type = 0; - $this->cookie = ""; //夸克登录凭证 - $this->Authorization = ""; //阿里登录凭证 - $this->expired_type = 1; //1分享永久 2临时 - $this->to_pdir_fid = ""; //存入目标文件 - $this->ad_fid = ""; - $this->code = ""; //提取码 - $this->isType = 0; //等于1时仅校验是否有效并提取资源信息 - $this->urlHeader = array( - 'Accept: application/json, text/plain, */*', - 'Accept-Language: zh-CN,zh;q=0.9', - 'content-type: application/json;charset=UTF-8', - 'sec-ch-ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"', - 'sec-ch-ua-mobile: ?0', - 'sec-ch-ua-platform: "Windows"', - 'sec-fetch-dest: empty', - 'sec-fetch-mode: cors', - 'sec-fetch-site: same-site', - 'Referer: https://pan.quark.cn/', - 'Referrer-Policy: strict-origin-when-cross-origin', - 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', - ); - } /** - * - * - * @return void - */ - public function index() - { - return jok('Hello World'); - } - - /** - * 获取夸克网盘文件夹 - * - * @return void - */ - public function getFiles() - { - $this->cookie = input('cookie')??''; - $urlData = []; - $queryParams = [ - 'pr' => 'ucpro', - 'fr' => 'pc', - 'uc_param_str' => '', - 'pdir_fid' => 0, - '_page' => 1, - '_size' => 50, - '_fetch_total' => 1, - '_fetch_sub_dirs' => 0, - '_sort' => 'file_type:asc,updated_at:desc', - ]; - - $this->urlHeader[] = 'cookie: ' . $this->cookie; - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/file/sort", "GET", json_encode($urlData), $this->urlHeader,$queryParams)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ - return jerr($res['message']=='require login [guest]'?'夸克未登录,请检查cookie':$res['message']); - } - - return jok('获取成功',$res['data']['list']); - } - - /** - * 一键转存并分享资源 - * - * type 0 夸克 1阿里 - * * @return void */ public function transfer() { - $url = input("url"); - $this->code = input('code')??''; - $this->isType = input('isType')??0; - - if($this->isType != 1){ //直接入口就不用cookie 防止账号异常 - $this->cookie = input('cookie')??''; - $this->Authorization = input('Authorization')??''; - } - - $this->expired_type = input('expired_type')??1; - $this->to_pdir_fid = input('to_pdir_fid')??""; - $this->ad_fid = input('ad_fid')??""; - - if (strpos($url, '?entry=') !== false) { - $entry = preg_match('/\?entry=([^&]+)/', $url, $matches) ? $matches[1] : ''; - $url = preg_match('/.*(?=\?entry=)/', $url, $matches) ? $matches[0] : ''; - } - - $substring = strstr($url, 's/'); - if ($substring !== false) { - $pwd_id = substr($substring, 2); // 去除 's/' 部分 - } else { - return jerr("资源地址格式有误"); - } - - $this->urlHeader[] = 'cookie: ' . $this->cookie; - - $patterns = [ - 'pan.quark.cn' => 0, - 'www.alipan.com' => 1, - 'www.aliyundrive.com' => 1, - // 'pan.baidu.com' => 2, - 'drive.uc.cn' => 3, - // 'pan.xunlei.com' => 4, + $urlData = [ + 'expired_type' => input('expired_type')??1, // 1正式资源 2临时资源 + 'url' => input("url")?? '', + 'code' => input('code')??'', + 'isType' => input('isType')??0, ]; - - $url_type = -1; // 默认值为 -1 - foreach ($patterns as $pattern => $type) { - if (strpos($url, $pattern) !== false) { - $url_type = $type; - break; // 一旦匹配成功,退出循环 - } - } - - $this->url = $url; - - if ($url_type == 0) { - //夸克 - if(empty($this->cookie) && $this->isType==0){ - jerr("参数有误"); - } - $this->transferQuark(strtok($pwd_id, '#')); - } else if($url_type == 1){ - //阿里 - $this->transferAlipan($pwd_id); - } else if($url_type == 3){ - //UC - $this->transferUc($pwd_id); - } else { - return jerr("资源地址格式有误"); - } - } - - /** - * 夸克 - 一键转存并分享资源 - * - * @return void - */ - public function transferQuark($pwd_id){ - //获取要转存夸克资源的stoken - $infoData = $this->getStoken($pwd_id); - - if($this->isType == 1){ - $urls['title'] = $infoData['title']; - $urls['share_url'] = $this->url; - return jok('检验成功', $urls); - } - - - $stoken = $infoData['stoken']; - - - //获取要转存夸克资源的详细内容 - $detail = $this->getShare($pwd_id,$stoken); - - $fid_list = []; - $fid_token_list = []; - $title = $detail['share']['title']; //资源名称 - foreach ($detail['list'] as $key => $value) { - $fid_list[] = $value['fid']; - $fid_token_list[] = $value['share_fid_token']; + if(empty($urlData['url'])){ + return jerr('资源地址不能为空'); } - //转存资源到指定文件夹 - $task_id = $this->getShareSave($pwd_id,$stoken,$fid_list,$fid_token_list); + $transfer = new \netdisk\Transfer(); + $res = $transfer->transfer($urlData); - //转存后根据task_id获取转存到自己网盘后的信息 - $retry_index = 0; - $myData = ''; - while ($myData=='' || $myData['status'] != 2) { - $myData = $this->getShareTask($task_id, $retry_index); - $retry_index++; - // 可以添加一个最大重试次数的限制,防止无限循环 - if ($retry_index > 50) { - break; - } - } - - - try { - //删除转存后可能有的广告 - $banned = Config('qfshop.quark_banned')??''; //如果出现这些字样就删除 - if(!empty($banned)){ - $bannedList = explode(',', $banned); - $pdir_fid = $myData['save_as']['save_as_top_fids'][0]; - $dellist = []; - $plist = $this->getPdirFid($pdir_fid); - if(!empty($plist)){ - foreach ($plist as $key => $value) { - // 检查$value['file_name']是否包含$bannedList中的任何一项 - $contains = false; - foreach ($bannedList as $item) { - if (strpos($value['file_name'], $item) !== false) { - $contains = true; - break; - } - } - if ($contains) { - $dellist[] = $value['fid']; - } - } - if(count($plist) === count($dellist)){ - //要删除的资源数如果和原数据资源数一样 就全部删除并终止下面的分享 - $this->deletepdirFid([$pdir_fid]); - return jerr("资源内容为空"); - }else{ - if (!empty($dellist)) { - $this->deletepdirFid($dellist); - } - } - - } - } - } catch (Exception $e) { - } - - $shareFid = $myData['save_as']['save_as_top_fids']; - //分享资源并拿到更新后的task_id - $task_id = $this->getShareBtn($myData['save_as']['save_as_top_fids'],$title); - - //根据task_id拿到share_id - $retry_index = 0; - $myData = ''; - while ($myData=='' || $myData['status'] != 2) { - $myData = $this->getShareTask($task_id, $retry_index); - $retry_index++; - // 可以添加一个最大重试次数的限制,防止无限循环 - if ($retry_index > 50) { - break; - } - } - - - //根据share_id 获取到分享链接 - $share = $this->getSharePassword($myData['share_id']); - // $share['fid'] = $share['first_file']['fid']; - $share['fid'] = (is_array($shareFid) && count($shareFid) > 1) ? $shareFid : $share['first_file']['fid']; - - return jok('转存成功', $share); - } - - /** - * 阿里 - 一键转存并分享资源 - * - * @return void - */ - public function transferAlipan($share_id) - { - $data = []; - $infos = $this->getAlipan1($share_id); - - if($this->isType == 1){ - $urls['title'] = $infos['share_name']; - $urls['share_url'] = $this->url; - return jok('检验成功', $urls); - }else{ - return jerr('阿里暂不支持转存'); - } - - - //通过分享id获取file_id - $file_infos = $infos['file_infos']; - - //通过分享id获取X-Share-Token - $share_token = $this->getAlipan2($share_id); - - $data3['requests'] = []; - $data3['resource'] = 'file'; - - foreach ($file_infos as $key=>$value) { - $data3['requests'][$key]['body']['auto_rename'] = true; - $data3['requests'][$key]['body']['file_id'] = $value['file_id']; - $data3['requests'][$key]['body']['share_id'] = $share_id; - $data3['requests'][$key]['body']['to_drive_id'] = '2008425230'; - $data3['requests'][$key]['body']['to_parent_file_id'] = '66a20824c3846d890f6542c6aac2c79822d2a64f'; - $data3['requests'][$key]['headers']['Content-Type'] = 'application/json'; - $data3['requests'][$key]['id'] = $key.''; - $data3['requests'][$key]['method'] = 'POST'; - $data3['requests'][$key]['url'] = '/file/copy'; - } - - //保存 - $responses = $this->getAlipan3($data3,$share_token); - $data4['drive_id'] = '2008425230'; - $data4['expiration'] = ''; - $data4['share_pwd'] = ''; - $data4['file_id_list'] = []; - - foreach ($responses as $key=>$value){ - $data4['file_id_list'][] = $value['body']['file_id']; - } - - //分享 - $share = $this->getAlipan4($data4); - - $data['share_url'] = $share['share_url']; - $data['title'] = $share['share_title']; - - return jok('转存成功', $data); - } - - /** - * UC- 一键转存并分享资源 - * - * @return void - */ - public function transferUc($pwd_id){ - $infoData = $this->getStokenUc($pwd_id); - - if($this->isType == 1){ - $urls['title'] = $infoData['title']; - $urls['share_url'] = $this->url; - return jok('检验成功', $urls); - }else{ - return jerr('UC暂不支持转存'); - } - } - - - /** - * 获取要转存资源的stoken - * - * @return void - */ - public function getStoken($pwd_id) - { - $urlData = array( - 'passcode' => '', - 'pwd_id' => $pwd_id, - ); - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/share/sharepage/token?pr=ucpro&fr=pc&uc_param_str=", "POST",json_encode($urlData), $this->urlHeader)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ + if($res['code'] !== 200){ return jerr($res['message']); } - $data = $res['data']; - return $data; + + $isSave = input('isSave')??0; + if($isSave == 1){ + $data = [ + "title" => $res['data']['title'], + "url" => $res['data']['share_url'], + "is_type" => determineIsType($res['data']['share_url']), + "code" => $res['data']['code'] ?? $urlData['code'] ?? '', + "is_time" => $urlData['expired_type']==2 ? 1 : 0, + "update_time" => time(), + "create_time" => time(), + "fid" => is_array($res['data']['fid'] ?? '') ? json_encode($res['data']['fid']) : ($res['data']['fid'] ?? '') + ]; + $SourceModel = new SourceModel(); + $SourceModel->insertGetId($data); + } + return jok("获取成功",$res['data']); } - - /** - * 获取要转存资源的详细内容 - * - * @return void - */ - public function getShare($pwd_id,$stoken) - { - $urlData = array(); - $queryParams = [ - "pr" => "ucpro", - "fr" => "pc", - "uc_param_str" => "", - "pwd_id" => $pwd_id, - "stoken" => $stoken, - "pdir_fid" => "0", - "force" => "0", - "_page" => "1", - "_size" => "100", - "_fetch_banner" => "1", - "_fetch_share" => "1", - "_fetch_total" => "1", - "_sort" => "file_type:asc,updated_at:desc" - ]; - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/share/sharepage/detail", "GET", json_encode($urlData), $this->urlHeader,$queryParams)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ - return jerr($res['message']); - } - return $res['data']; - } - - - /** - * 转存资源到指定文件夹 - * - * @return void - */ - public function getShareSave($pwd_id,$stoken,$fid_list,$fid_token_list) - { - $to_pdir_fid = $this->to_pdir_fid??""; - $urlData = array( - 'fid_list' => $fid_list, - 'fid_token_list' => $fid_token_list, - 'to_pdir_fid' => $to_pdir_fid, - 'pwd_id' => $pwd_id, - 'stoken' => $stoken, - 'pdir_fid' => "0", - 'scene' => "link", - ); - $queryParams = [ - "entry" => "update_share", - "pr" => "ucpro", - "fr" => "pc", - "uc_param_str" => "" - ]; - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/share/sharepage/save", "POST", json_encode($urlData), $this->urlHeader,$queryParams)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ - return jerr($res['message']=='require login [guest]'?'夸克未登录,请检查cookie':$res['message']); - } - return $res['data']['task_id']; - } - - /** - * 分享资源拿到task_id - * - * @return void - */ - public function getShareBtn($fid_list,$title) - { - if(!empty($this->ad_fid)){ - $fid_list[] = $this->ad_fid; - } - $urlData = array( - 'fid_list' => $fid_list, - 'expired_type' => $this->expired_type, - 'title' => $title, - 'url_type' => 1, - ); - $queryParams = [ - "pr" => "ucpro", - "fr" => "pc", - "uc_param_str" => "" - ]; - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/share", "POST", json_encode($urlData), $this->urlHeader,$queryParams)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ - return jerr($res['message']); - } - return $res['data']['task_id']; - } - - - /** - * 根据task_id拿到自己的资源信息 - * - * @return void - */ - public function getShareTask($task_id,$retry_index) - { - $urlData = array(); - $queryParams = [ - "pr" => "ucpro", - "fr" => "pc", - "uc_param_str" => "", - "task_id" => $task_id, - "retry_index" => $retry_index - ]; - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/task", "GET", json_encode($urlData), $this->urlHeader, $queryParams)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ - return jerr($res['message']); - } - return $res['data']; - } - - /** - * 根据share_id 获取到分享链接 - * - * @return void - */ - public function getSharePassword($share_id) - { - $urlData = array( - 'share_id' => $share_id, - ); - $queryParams = [ - "pr" => "ucpro", - "fr" => "pc", - "uc_param_str" => "" - ]; - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/share/password", "POST", json_encode($urlData), $this->urlHeader,$queryParams)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ - return jerr($res['message']); - } - return $res['data']; - } - - - /** - * 删除指定资源 - * - * @return void - */ - public function deletepdirFid($filelist) - { - $urlData = array( - 'action_type' => 2, - 'exclude_fids' => [], - 'filelist' => $filelist, - ); - $queryParams = [ - "pr" => "ucpro", - "fr" => "pc", - "uc_param_str" => "" - ]; - curlHelper("https://drive-pc.quark.cn/1/clouddrive/file/delete", "POST", json_encode($urlData), $this->urlHeader,$queryParams)['body']; - } - - /** - * 获取夸克网盘指定文件夹内容 - * - * @return void - */ - public function getPdirFid($pdir_fid) - { - $urlData = []; - $queryParams = [ - 'pr' => 'ucpro', - 'fr' => 'pc', - 'uc_param_str' => '', - 'pdir_fid' => $pdir_fid, - '_page' => 1, - '_size' => 200, - '_fetch_total' => 1, - '_fetch_sub_dirs' => 0, - '_sort' => 'file_type:asc,updated_at:desc', - ]; - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/file/sort", "GET", json_encode($urlData), $this->urlHeader,$queryParams)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ - return []; - } - return $res['data']['list']; - } - - - - /** - * 阿里-0-通过分享id获取file_id - * - * @return void - */ - public function getAlipan1($share_id) - { - $urlData = [ - 'share_id' => $share_id, - ]; - $urlHeader = array( - 'Content-Type: application/json', - ); - $res = curlHelper("https://api.aliyundrive.com/adrive/v3/share_link/get_share_by_anonymous", "POST", json_encode($urlData),$urlHeader)['body']; - $res = json_decode($res, true); - if(!isset($res['file_infos'])){ - return jerr($res['message']??'转存失败1'); - } - return $res; - } - - /** - * 阿里-0-通过分享id获取X-Share-Token - * - * @return void - */ - public function getAlipan2($share_id) - { - $urlData = array( - 'share_id' => $share_id, - ); - $urlHeader = array( - 'Accept: application/json, text/plain, */*', - 'Accept-Encoding: gzip, deflate, br, zstd', - 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', - 'Authorization: '.$this->Authorization, - 'Content-Type: application/json', - 'Origin: https://www.alipan.com', - 'Priority: u=1, i', - 'Referer: https://www.alipan.com/', - 'Sec-Ch-Ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"', - 'Sec-Ch-Ua-Mobile: ?0', - 'Sec-Ch-Ua-Platform: "Windows"', - 'Sec-Fetch-Dest: empty', - 'Sec-Fetch-Mode: cors', - 'Sec-Fetch-Site: same-site', - 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0', - 'X-Canary: client=web,app=share,version=v2.3.1' - ); - $res = curlHelper("https://api.aliyundrive.com/v2/share_link/get_share_token", "POST", json_encode($urlData), $urlHeader)['body']; - $res = json_decode($res, true); - if(!isset($res['share_token'])){ - return jerr($res['message']??'转存失败2'); - } - return $res['share_token']; - } - - /** - * 阿里-1-保存 - * - * @return void - */ - public function getAlipan3($urlData,$share_token) - { - $urlHeader = array( - 'Accept: application/json, text/plain, */*', - 'Accept-Encoding: gzip, deflate, br, zstd', - 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', - 'Authorization: '.$this->Authorization, - 'Content-Type: application/json', - 'Origin: https://www.alipan.com', - 'Priority: u=1, i', - 'Referer: https://www.alipan.com/', - 'Sec-Ch-Ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"', - 'Sec-Ch-Ua-Mobile: ?0', - 'Sec-Ch-Ua-Platform: "Windows"', - 'Sec-Fetch-Dest: empty', - 'Sec-Fetch-Mode: cors', - 'Sec-Fetch-Site: same-site', - 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0', - 'X-Canary: client=web,app=share,version=v2.3.1', - 'X-Share-Token: '.$share_token - ); - $res = curlHelper("https://api.aliyundrive.com/adrive/v4/batch", "POST", json_encode($urlData), $urlHeader)['body']; - $res = json_decode($res, true); - if(!isset($res['responses'])){ - return jerr($res['message']??'转存失败3'); - } - return $res['responses']; - } - - /** - * 阿里-2-分享 - * - * @return void - */ - public function getAlipan4($urlData) - { - $urlHeader = array( - 'Accept: application/json, text/plain, */*', - 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', - 'Authorization: '.$this->Authorization, - 'Content-Type: application/json', - 'Origin: https://www.alipan.com', - 'Priority: u=1, i', - 'Referer: https://www.alipan.com/', - 'Sec-Ch-Ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"', - 'Sec-Ch-Ua-Mobile: ?0', - 'Sec-Ch-Ua-Platform: "Windows"', - 'Sec-Fetch-Dest: empty', - 'Sec-Fetch-Mode: cors', - 'Sec-Fetch-Site: same-site', - 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0', - 'X-Canary: client=web,app=share,version=v2.3.1' - ); - $res = curlHelper("https://api.aliyundrive.com/adrive/v2/share_link/create", "POST", json_encode($urlData), $urlHeader)['body']; - $res = json_decode($res, true); - return jerr($res); - if(!isset($res['share_url'])){ - return jerr($res['message']??'转存失败4'); - } - return $res; - } - - - /** - * UC 00000 - * - * @return void - */ - public function getStokenUc($pwd_id) - { - $urlData = array( - 'passcode' => '', - 'pwd_id' => $pwd_id, - ); - $urlHeader = array( - 'Accept: application/json, text/plain, */*', - 'Accept-Language: zh-CN,zh;q=0.9', - 'content-type: application/json;charset=UTF-8', - 'sec-ch-ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"', - 'sec-ch-ua-mobile: ?0', - 'sec-ch-ua-platform: "Windows"', - 'sec-fetch-dest: empty', - 'sec-fetch-mode: cors', - 'sec-fetch-site: same-site', - 'Referer: https://drive.uc.cn/', - 'Referrer-Policy: strict-origin-when-cross-origin', - 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', - ); - - $res = curlHelper("https://pc-api.uc.cn/1/clouddrive/share/sharepage/token?pr=UCBrowser&fr=pc", "POST",json_encode($urlData),$urlHeader)['body']; - $res = json_decode($res, true); - if($res['status'] !== 200){ - return jerr($res['message']); - } - $data = $res['data']; - return $data; - } - } diff --git a/app/api/controller/Other.php b/app/api/controller/Other.php index 5dea9d9..24b1746 100644 --- a/app/api/controller/Other.php +++ b/app/api/controller/Other.php @@ -15,7 +15,6 @@ class Other extends QfShop { parent::__construct($app); $this->model = new SourceModel(); - $this->cookie = Config('qfshop.quark_cookie'); } /** @@ -25,14 +24,9 @@ class Other extends QfShop */ public function all_search($param='') { - if(empty($param)){ - $searchdata = input('post.'); - if (empty($searchdata['title'])) { - return jerr("请输入要看的内容"); - } - $title = $searchdata['title']; - }else{ - $title = $param; + $title = $param ?: input('post.title', ''); + if (empty($title)) { + return jerr("请输入要看的内容"); } $map[] = ['status', '=', 1]; @@ -42,29 +36,17 @@ class Other extends QfShop $urls = $this->model->where($map)->field('source_id as id, title, url,is_time')->order('update_time', 'desc')->limit(5)->select()->toArray(); if (!empty($urls)) { - - // 获取所有需要更新的ID - $ids = []; - foreach ($urls as $item) { - $ids[] = $item['id']; - } - - // 更新数据库中的 update_time 字段 - if (!empty($ids)) { - $this->model->whereIn('source_id', $ids)->update(['update_time' => time()]); - } - + $ids = array_column($urls, 'id'); + $this->model->whereIn('source_id', $ids)->update(['update_time' => time()]); return !empty($param) ? $urls : jok('临时资源获取成功', $urls); } - - //同一个搜索内容锁机 - if (Cache::has($title)) { + //同一个搜索内容锁机 + if (Cache::has($title)) { // 检查缓存中是否已有结果 return !empty($param) ? Cache::get($title) : jok('临时资源获取成功', Cache::get($title)); } - // 检查是否有正在处理的请求 if (Cache::has($title . '_processing')) { // 如果当前正在处理相同关键词的请求,等待结果 @@ -89,41 +71,19 @@ class Other extends QfShop $num_total = 2; //最多想要几条结果 $num_success = 0; - // 处理第2个源 - foreach (source2($title) as $value) { + // 定义源的顺序 + $sources = ['source2', 'source4', 'source5', 'source3', 'source1']; + + foreach ($sources as $source) { if ($num_success >= $num_total) { - break; // 有效结果数量已达到,则跳出循环 + break; } - // 如果 URL 不存在则新增 $value - if (!$this->urlExists($searchList, $value['url'])) { - $searchList[] = $value; - $this->processUrl($value, $num_success, $datas); - } - } - - - - // 处理第4个源 - if ($num_success < $num_total) { - foreach (source4($title) as $value) { + + foreach ($source($title) as $value) { if ($num_success >= $num_total) { - break; // 有效结果数量已达到,则跳出循环 + break; } - // 如果 URL 不存在则新增 $value - if (!$this->urlExists($searchList, $value['url'])) { - $searchList[] = $value; - $this->processUrl($value, $num_success, $datas); - } - } - } - - // 处理第5个源 - if ($num_success < $num_total) { - foreach (source5($title) as $value) { - if ($num_success >= $num_total) { - break; // 有效结果数量已达到,则跳出循环 - } - // 如果 URL 不存在则新增 $value + if (!$this->urlExists($searchList, $value['url'])) { $searchList[] = $value; $this->processUrl($value, $num_success, $datas); @@ -131,36 +91,6 @@ class Other extends QfShop } } - - // 处理第3个源 - if ($num_success < $num_total) { - foreach (source3($title) as $value) { - if ($num_success >= $num_total) { - break; // 有效结果数量已达到,则跳出循环 - } - // 如果 URL 不存在则新增 $value - if (!$this->urlExists($searchList, $value['url'])) { - $searchList[] = $value; - $this->processUrl($value, $num_success, $datas); - } - } - } - - - // 处理第1个源 第一个源放最后 - if ($num_success < $num_total) { - foreach (source1($title) as $value) { - if ($num_success >= $num_total) { - break; // 有效结果数量已达到,则跳出循环 - } - // 如果 URL 不存在则新增 $value - if (!$this->urlExists($searchList, $value['url'])) { - $searchList[] = $value; - $this->processUrl($value, $num_success, $datas); - } - } - } - Cache::set($title, $datas, 60); // 缓存结果60秒 Cache::delete($title . '_processing'); // 解锁 @@ -201,15 +131,14 @@ class Other extends QfShop $pwd_id = substr($substring, 2); // 去除 's/' 部分 $urlData = array( - 'cookie' => $this->cookie, 'url' => $value['url'], 'expired_type' => 2, - 'to_pdir_fid' => '', //存入目标文件 'ad_fid' => '', //分享时带上这个文件 ); - $res = curlHelper(Request::domain()."/api/open/transfer", "POST", $urlData)['body']; - $res = json_decode($res, true); - + + $transfer = new \netdisk\Transfer(); + $res = $transfer->transfer($urlData); + if($res['code'] !== 200){ return; // 模拟 continue 行为 } @@ -247,40 +176,15 @@ class Other extends QfShop $this->model->where($map)->chunk(100, function ($order) { foreach ($order as $value) { $deles = $value->toArray(); - // $filelist = []; - // $filelist[] = $deles['fid']; $fid = $deles['fid']; // 尝试解码,如果是有效的 JSON 数组则使用,否则转为单元素数组 $filelist = (is_string($fid) && ($decodedFid = json_decode($fid, true)) && is_array($decodedFid)) ? $decodedFid : (array)$fid; - - - $urlData = array( - 'action_type' => 2, - 'exclude_fids' => [], - 'filelist' => $filelist, - ); - $urlHeader = array( - 'Accept: application/json, text/plain, */*', - 'Accept-Language: zh-CN,zh;q=0.9', - 'content-type: application/json;charset=UTF-8', - 'sec-ch-ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"', - 'sec-ch-ua-mobile: ?0', - 'sec-ch-ua-platform: "Windows"', - 'sec-fetch-dest: empty', - 'sec-fetch-mode: cors', - 'sec-fetch-site: same-site', - 'Referer: https://pan.quark.cn/', - 'Referrer-Policy: strict-origin-when-cross-origin', - 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', - 'cookie: '.$this->cookie, - ); - $res = curlHelper("https://drive-pc.quark.cn/1/clouddrive/file/delete?pr=ucpro&fr=pc&uc_param_str=", "POST", json_encode($urlData), $urlHeader)['body']; - $res = json_decode($res, true); - if($res['status'] == 200){ - $this->model->where('fid', $deles['fid'])->delete(); - } + + $this->model->where('fid', $deles['fid'])->delete(); + $transfer = new \netdisk\Transfer(); + $transfer->deletepdirFid($deles['is_type'],$filelist); } }); diff --git a/app/common.php b/app/common.php index 43e25b3..7b0919a 100644 --- a/app/common.php +++ b/app/common.php @@ -17,6 +17,14 @@ function jok($message = 'success', $data = null) } die; } +function jok2($message = 'success', $data = null) +{ + if ($data) { + return ["code" => 200, "message" => $message, 'data' => $data]; + } else { + return ["code" => 200, "message" => $message, 'data' => $data??'']; + } +} /** * 输出错误JSON * @@ -30,6 +38,10 @@ function jerr($message = 'error', $code = 500) echo json_encode(["code" => $code, "message" => $message]); die; } +function jerr2($message = 'error', $code = 500) +{ + return ["code" => $code, "message" => $message]; +} /** * 密码+盐 加密 * @@ -789,6 +801,85 @@ function determineIsType($url) { } } +/** + * 解析网盘分享链接 + * + * @param string $input 输入的链接文本,可以是多行 + * @return array 解析后的链接数组,每个元素包含url、title和code + */ +function parsePanLinks($input) +{ + // 分割多行输入 + $links = explode("\n", $input); + + // 去掉数组元素中的空白字符 + $links = array_map('trim', $links); + + // 过滤掉空值的数组元素 + $links = array_filter($links); + + $parsedLinks = array_values(array_filter(array_map(function ($item) { + // 统一处理百度网盘分享格式,同时匹配两种格式 + if (preg_match('/链接:?\s*(https?:\/\/[^\s]+)\s*提取码:?\s*([a-zA-Z0-9]{4})/i', $item, $matches)) { + $url = trim($matches[1]); + $code = trim($matches[2]); + // 确保URL中包含提取码 + if (!empty($code) && strpos($url, '?pwd=') === false) { + $url .= (strpos($url, '?') === false ? '?' : '&') . 'pwd=' . $code; + } + return [ + 'url' => $url, + 'title' => '', + 'code' => $code + ]; + } + + // 提取 URL + if (!preg_match('/https?:\/\/[^\s]+/', $item, $matches)) { + return null; // 没有匹配到 URL,直接丢弃 + } + + $url = trim($matches[0]); + $code = ''; + + // 提取提取码(?pwd= 或 , 分割) + if (preg_match('/\?pwd=([^,\s&]+)/', $item, $pwdMatch)) { + $code = trim($pwdMatch[1]); + } elseif (preg_match('/,\s*([a-zA-Z0-9]{4})\s*$/', $item, $commaMatch)) { + $code = trim($commaMatch[1]); + // 添加提取码到URL + if (!empty($code)) { + $url .= (strpos($url, '?') === false ? '?' : '&') . 'pwd=' . $code; + } + } elseif (preg_match('/提取码:?\s*([a-zA-Z0-9]{4})/i', $item, $codeMatch)) { + $code = trim($codeMatch[1]); + // 添加提取码到URL + if (!empty($code)) { + $url .= (strpos($url, '?') === false ? '?' : '&') . 'pwd=' . $code; + } + } + + // 返回结果时,确保 title 保持为空字符串 + return [ + 'url' => $url, + 'title' => '', + 'code' => $code + ]; + }, $links))); + + // 去重,使用 'url' 字段来去重 + $uniqueUrls = []; + $result = array_filter($parsedLinks, function($item) use (&$uniqueUrls) { + if (!in_array($item['url'], $uniqueUrls)) { + $uniqueUrls[] = $item['url']; // 添加到已处理的 URL 列表 + return true; // 保留此项目 + } + return false; // 去掉重复的项目 + }); + + return array_values($result); +} + /** * 网络资源搜索源一 diff --git a/app/model/Source.php b/app/model/Source.php index e935f46..f78d5da 100644 --- a/app/model/Source.php +++ b/app/model/Source.php @@ -60,6 +60,9 @@ class Source extends QfShop */ public function getDetail(array $data) { + if(empty($data['id'])){ + return jerr('参数错误'); + } $map[] = ['status', '=', 1]; $map[] = ['is_delete', '=', 0]; $map[] = ['source_id', '=', $data['id']]; diff --git a/app/qfadmin/view/common/menu.html b/app/qfadmin/view/common/menu.html index 4602037..13593e3 100644 --- a/app/qfadmin/view/common/menu.html +++ b/app/qfadmin/view/common/menu.html @@ -34,7 +34,7 @@ {/volist}
-
资源管理系统
Version 1.0.0
+
资源管理系统
Version 3.0.0
{else}
diff --git a/app/qfadmin/view/source/deposit.html b/app/qfadmin/view/source/deposit.html index 0382180..0395d90 100644 --- a/app/qfadmin/view/source/deposit.html +++ b/app/qfadmin/view/source/deposit.html @@ -10,27 +10,181 @@ {include file="common/header"/} -
- 目前仅支持夸克 -
-
- -
- 设置夸克cookie -
-
- - - - - - 保存 - - -

Tips:夸克云盘网页版的cookie,不懂如何获取请百度;填写并保存后才能使用下面功能

-
-
-
+ + + +
+ 夸克网盘 +
+
+ + + + 账号检测 + + cookie修改后,请保存后再选择转存目录和检测 + + + +
+

请选择

+ +
+
+
+ + +
+

请选择

+ +
+
+
+ + 保存 + +
+
+
+
+ + +
+ 阿里云盘 +
+
+ + + + 账号检测 + + token修改后,请保存后再选择转存目录和检测 + + + +
+

请选择

+ +
+
+
+ + +
+

请选择

+ +
+
+
+ + 保存 + +
+

Tips:转存目录不能为空,为空将无法转存; 阿里网盘禁止香港及海外服务器调用分享接口

+
+
+
+ + +
+ 百度网盘 +
+
+ + + + 账号检测 + + cookie修改后,请保存后再选择转存目录和检测 + + + +
+

请选择

+ +
+
+
+ + +
+

请选择

+ +
+
+
+ + 保存 + +
+
+
+
+ + +
+ UC网盘 +
+
+ + + + 账号检测 + + cookie修改后,请保存后再选择转存目录和检测 + + + +
+

请选择

+ +
+
+
+ + +
+

请选择

+ +
+
+
+ + 保存 + +
+
+
+
+ + +
+ 迅雷云盘 +
+
+

Tips:迅雷云盘暂不支持

+ + + + + cookie修改后,请保存后再选择转存目录和检测 + + + + + + + + + + + 保存 + + +
+
+
+
{include file="common/footer"/} ', 0, 1, NULL, 9, 1, 995, 1, 1725325341, 1725411486); INSERT INTO `qf_conf` VALUES (43, 'app_icon', '', '网站icon', '', 0, 4, NULL, 0, 1, 92, 1, 1725326071, 1725326071); INSERT INTO `qf_conf` VALUES (44, 'app_demand', '0', '提交需求', '前台是否开启此功能 ; 默认开启', 0, 2, '开启=>0\n关闭=>1', 3, 1, 81, 1, 1725326640, 1725326707); -INSERT INTO `qf_conf` VALUES (45, 'app_links', '更多资源', '顶部其他外链', '一行一个外链(a标签):更多资源', 0, 1, NULL, 3, 1, 80, 1, 1725326838, 1725326838); +INSERT INTO `qf_conf` VALUES (45, 'app_links', '', '顶部其他外链', '一行一个外链(a标签):更多资源', 0, 1, NULL, 3, 1, 80, 1, 1725326838, 1725326838); INSERT INTO `qf_conf` VALUES (46, 'app_name_hide', '0', '隐藏网站名称', '默认显示:logo包含文字的可以隐藏网站名称', 0, 2, '显示=>0\n隐藏=>1', 0, 1, 98, 1, 1725411632, 1725411763); INSERT INTO `qf_conf` VALUES (47, 'ranking_m_num', '6', '移动端限制数量', '释:移动端最多显示数量', 0, 0, NULL, 3, 1, 77, 1, 1725412329, 1725412329); INSERT INTO `qf_conf` VALUES (48, 'search_tips', '', '未搜索提示词', '为空时默认:未找到,可换个关键词尝试哦~', 0, 0, NULL, 1, 1, 0, 1, 1726108804, 1726108804); @@ -165,6 +155,20 @@ INSERT INTO `qf_conf` VALUES (49, 'search_bg', '', '未搜索提示图', '', 0, INSERT INTO `qf_conf` VALUES (50, 'home_new', '1', '最新列表', '仅无图模式有效', 0, 2, '开启=>0\n关闭=>1', 3, 1, 79, 1, 1726299605, 1726299605); INSERT INTO `qf_conf` VALUES (51, 'home_new_img', '', '最新图标', '', 0, 4, NULL, 3, 1, 79, 1, 1726302688, 1726302688); INSERT INTO `qf_conf` VALUES (52, 'is_quan', '0', '全网搜', '', 0, 2, '关闭=>0\n开启=>1', 1, 1, 1, 1, 1729928547, 1729928547); +INSERT INTO `qf_conf` VALUES ('53', 'baidu_cookie', '', '百度Cookie', '', '0', '0', NULL, '4', '1', '89', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('54', 'quark_file', '', '夸克默认转存目录', '', '0', '0', NULL, '4', '1', '98', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('55', 'quark_file_time', '', '夸克临时资源目录', '', '0', '0', NULL, '4', '1', '97', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('56', 'baidu_file', '', '百度默认转存目录', '', '0', '0', NULL, '4', '1', '88', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('57', 'baidu_file_time', '', '百度临时资源目录', '', '0', '0', NULL, '4', '1', '87', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('58', 'ali_file', '', '阿里默认转存目录', '', '0', '0', NULL, '4', '1', '78', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('59', 'ali_file_time', '', '阿里临时资源目录', '', '0', '0', NULL, '4', '1', '77', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('60', 'uc_cookie', '', 'UcCookie', '', '0', '0', NULL, '4', '1', '69', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('61', 'uc_file', '', 'UC默认转存目录', '', '0', '0', NULL, '4', '1', '68', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('62', 'uc_file_time', '', 'UC临时资源目录', '', '0', '0', NULL, '4', '1', '67', '1', '1743145595', '1743145595'); +INSERT INTO `qf_conf` VALUES ('63', 'xunlei_cookie', '', '迅雷Cookie', '', '0', '0', NULL, '4', '1', '59', '1', '1743149794', '1743149794'); +INSERT INTO `qf_conf` VALUES ('64', 'xunlei_file', '', '迅雷默认转存目录', '', '0', '0', NULL, '4', '1', '58', '1', '1743149819', '1743149819'); +INSERT INTO `qf_conf` VALUES ('65', 'xunlei_file_time', '', '迅雷临时资源目录', '', '0', '0', NULL, '4', '1', '57', '1', '1743149860', '1743149860'); + -- ---------------------------- diff --git a/public/install/index.php b/public/install/index.php new file mode 100644 index 0000000..5a3d7b3 --- /dev/null +++ b/public/install/index.php @@ -0,0 +1,381 @@ + '安装许可协议', + '2' => '运行环境检测', + '3' => '安装参数设置', + '4' => '安装详细过程', + '5' => '安装完成', +); +$step = isset($_GET['step']) ? $_GET['step'] : 1; +//当前安装步骤 +$step_html = ''; +foreach ($steps as $key => $value) { + $current = $key == $step? 'current':''; + $step_html .= '
  • '.$key.''.$value.'
  • '; +} +//安装页面 +switch ($step) { + //安装许可协议 + case '1': + $license = file_get_contents('./license.txt'); + include ("./templates/1.php"); + break; + //运行环境检测 + case '2': + $server = array( + //操作系统 + 'os' => php_uname(), + //PHP版本 + 'php' => $phpversion, + ); + $error = 0; + //php版本 + if ($phpversion>=$config['php']) { + $server['php'] = ' 支持'; + } else { + $server['php'] = ' '.$phpversion; + $error++; + } + //上传限制 + if (ini_get('file_uploads')) { + $server['uploadSize'] = ' ' . ini_get('upload_max_filesize'); + } else { + $server['uploadSize'] = '禁止上传'; + } + //session + if (function_exists('session_start')) { + $server['session'] = ' 支持'; + } else { + $server['session'] = ' 不支持'; + $error++; + } + + + //需要读写权限的目录 + $folder = $config['dirAccess']; + $install_path = str_replace('\\','/',getcwd()).'/'; + $site_path = str_replace('Install/', '', $install_path); + include ("./templates/2.php"); + $_SESSION['INSTALLSTATUS'] = $error == 0?'SUCCESS':$error; + break; + //安装参数设置 + case '3': + verify(3); + //测试数据库链接 + if (isset($_GET['testdbpwd'])) { + empty($_POST['dbhost'])?alert(0,'数据库服务器地址不能为空!','dbhost'):''; + empty($_POST['dbuser'])?alert(0,'数据库用户名不能为空!','dbuser'):''; + empty($_POST['dbname'])?alert(0,'数据库名不能为空!','dbname'):''; + empty($_POST['dbport'])?alert(0,'数据库端口不能为空!','dbport'):''; + $dbHost = $_POST['dbhost'] . ':' . $_POST['dbport']; + $mysqli = new mysqli($dbHost, $_POST['dbuser'], $_POST['dbpw']); + if(!$mysqli->server_info) { + alert(0,'数据库链接失败!','dbpw'); + }else{ + alert(1,'数据库链接成功!','dbpw'); + } + $mysqli->close(); + } + //域名+路径 + $domain = empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; + if ((int) $_SERVER['SERVER_PORT'] != 80) { + $domain .= ":" . $_SERVER['SERVER_PORT']; + } + $scriptName = !empty($_SERVER["REQUEST_URI"]) ? $scriptName = $_SERVER["REQUEST_URI"] : $scriptName = $_SERVER["PHP_SELF"]; + $rootpath = preg_replace("/\/(I|i)nstall\/index\.php(.*)$/", "", $scriptName); + $domain = $domain . $rootpath; + include ("./templates/3.php"); + break; + //安装详细过程 + case '4': + if (!isset($_GET['install'])){ + switch (INSTALLTYPE){ + case 'SAE': + // 服务器地址 + $_POST['dbhost'] = SAE_MYSQL_HOST_M; + // 端口 + $_POST['dbport'] = SAE_MYSQL_PORT; + // 数据库名 + $_POST['dbname'] = SAE_MYSQL_DB; + // 用户名 + $_POST['dbuser'] = SAE_MYSQL_USER; + // 密码 + $_POST['dbpw'] = SAE_MYSQL_PASS; + break; + case 'BAE': + // 服务器地址 + $_POST['dbhost'] = HTTP_BAE_ENV_ADDR_SQL_IP; + // 端口 + $_POST['dbport'] = HTTP_BAE_ENV_ADDR_SQL_PORT; + // 用户名 + $_POST['dbuser'] = HTTP_BAE_ENV_SK; + // 密码 + $_POST['dbpw'] = SAE_MYSQL_PASS; + break; + } + } + verify(4); + if (intval($_GET['install'])) { + dataVerify(); + //关闭特殊字符提交处理到数据库 + //设置时区 + date_default_timezone_set('PRC'); + //当前进行的数据库操作 + $n = intval($_GET['n']); + $arr = array(); + //数据库服务器地址 + $dbHost = trim($_POST['dbhost']); + //数据库端口 + $dbPort = trim($_POST['dbport']); + //数据库名 + $dbName = trim($_POST['dbname']); + $dbHost = empty($dbPort) || $dbPort == 3306 ? $dbHost : $dbHost . ':' . $dbPort; + //数据库用户名 + $dbUser = trim($_POST['dbuser']); + //数据库密码 + $dbPwd = trim($_POST['dbpw']); + //表前缀 + $dbPrefix = empty($_POST['dbprefix']) ? 'db_' : trim($_POST['dbprefix']); + //链接数据库 + $mysqli = new mysqli($dbHost, $dbUser, $dbPwd); + //导入政采商品 + $sitegoods = trim($_POST['sitegoods']); + // 获取错误信息 + $error=$mysqli->connect_error; + if (!is_null($error)) { + alert(0,'数据库链接失败!'); + } + // 设置字符集 + $mysqli->query("SET NAMES 'utf8'"); + if ($mysqli->server_info < 5.0) { + alert(0,'请将您的mysql升级到5.0以上'); + } + // 创建数据库并选中 + if(!$mysqli->select_db($dbName)){ + $create_sql='CREATE DATABASE IF NOT EXISTS '.$dbName.' DEFAULT CHARACTER SET utf8;'; + $mysqli->query($create_sql) or alert(0,'创建数据库失败'); + $mysqli->select_db($dbName); + } + + // 导入sql数据并创建表 + $sqldata = file_get_contents('./'.$config['sqlFileName']); + if(empty($sqldata)){ + alert(0,'数据库文件不能为空!'); + } + $sql_array=preg_split("/;[\r\n]+/", str_replace($config['dbPrefix'],$dbPrefix,$sqldata)); + + $counts = count($sql_array); + + for ($i = $n; $i < $counts; $i++) { + $sql = trim($sql_array[$i]); + if (strstr($sql, 'CREATE TABLE')) { + preg_match('/CREATE TABLE `([^ ]*)`/', $sql, $matches); + $mysqli->query($sql_array[$i]); + $info = '
  • 创建数据表' . $matches[1] . ',完成!'.date('Y-m-d H:i:s').'
  • '; + $i++; + alert(1,$info,$i); + }else{ + if(!empty($sql)){ + $mysqli->query($sql); + } + } + } + + //处理 + $data = include './'.$config['handleFile']; + $_SESSION['INSTALLOK'] = $data['status']?1:0; + alert($data['status'],$data['info']); + } + include ("./templates/4.php"); + break; + //安装完成 + case '5': + verify(5); + include ("./templates/5.php"); + //安装完成,生成.lock文件 + if(isset($_SESSION['INSTALLOK']) && $_SESSION['INSTALLOK'] == 1){ + filewrite($config['installFile']); + } + unset($_SESSION); + break; +} + +/** + * 错误提示html + */ +function get_tip_html($info){ + return '
    '.$info.'
    '; +} +//返回提示信息 +function alert($status,$info,$type = 0){ + exit(json_encode(array('status'=>$status,'info'=>$info,'type'=>$type))); +} +function verify($step = 3){ + if($step >= 3){ + //未运行环境检测,跳转到安装许可协议页面 + if(!isset($_SESSION['INSTALLSTATUS'])){ + header('location:./index.php'); + exit(); + } + //运行环境检测存在错误,返回运行环境检测 + if($_SESSION['INSTALLSTATUS'] != 'SUCCESS'){ + header('location:./index.php?step=2'); + exit(); + } + } + if($step == 4){ + //未提交数据 + if(empty($_POST)){ + header('location:./index.php?step=3'); + exit(); + } + } + if($step >= 5){ + //数据库未写入完成 + if(!isset($_SESSION['INSTALLOK'])){ + header('location:./index.php?step=4'); + exit(); + } + } +} +function dataVerify(){ + empty($_POST['dbhost'])?alert(0,'数据库服务器不能为空!'):''; + empty($_POST['dbport'])?alert(0,'数据库端口不能为空!'):''; + empty($_POST['dbuser'])?alert(0,'数据库用户名不能为空!'):''; + empty($_POST['dbname'])?alert(0,'数据库名不能为空!'):''; + empty($_POST['dbprefix'])?alert(0,'数据库表前缀不能为空!'):''; + empty($_POST['manager'])?alert(0,'管理员帐号不能为空!'):''; + empty($_POST['manager_pwd'])?alert(0,'管理员密码不能为空!'):''; +} +/** + * 判断目录是否可写 + */ +function testwrite($d) { + $tfile = "_test.txt"; + $fp = fopen($d . "/" . $tfile, "w"); + if (!$fp) { + return false; + } + fclose($fp); + $rs = unlink($d . "/" . $tfile); + if ($rs) { + return true; + } + return false; +} +/** + * 创建目录 + */ +function dir_create($path, $mode = 0777) { + if (is_dir($path)) { + return TRUE; + } + mkdir($path, $mode, true); + chmod($path, $mode); +} +/** + * 数据库语句解析 + * @param $sql 数据库 + * @param $newTablePre 新的前缀 + * @param $oldTablePre 旧的前缀 + */ +function sql_split($sql, $newTablePre, $oldTablePre) { + //前缀替换 + if ($newTablePre != $oldTablePre){ + $sql = str_replace($oldTablePre, $newTablePre, $sql); + } + $sql = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "ENGINE=\\1 DEFAULT CHARSET=utf8", $sql); + + $sql = str_replace("\r", "\n", $sql); + $ret = array(); + $queriesarray = explode(";\n", trim($sql)); + unset($sql); + foreach ($queriesarray as $k=>$query) { + $ret[$k] = ''; + $queries = explode("\n", trim($query)); + $queries = array_filter($queries); + foreach ($queries as $query) { + $str1 = substr($query, 0, 1); + if ($str1 != '#' && $str1 != '-') + $ret[$k] .= $query; + } + } + return $ret; +} +/** + * 产生随机字符串 +* 产生一个指定长度的随机字符串,并返回给用户 +* @access public +* @param int $len 产生字符串的位数 +* @return string +*/ +function genRandomString($len = 6) { + $chars = array( + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", + "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", + "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", + "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", + "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", + "3", "4", "5", "6", "7", "8", "9", '!', '@', '#', '$', + '%', '^', '&', '*', '(', ')' + ); + $charsLen = count($chars) - 1; + shuffle($chars); // 将数组打乱 + $output = ""; + for ($i = 0; $i < $len; $i++) { + $output .= $chars[mt_rand(0, $charsLen)]; + } + return $output; +} +/** + * 获取客户端IP地址 + * @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字 + * @return mixed + */ + function get_client_ip($type = 0) { + $type = $type ? 1 : 0; + static $ip = NULL; + if ($ip !== NULL) return $ip[$type]; + if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); + $pos = array_search('unknown',$arr); + if(false !== $pos) unset($arr[$pos]); + $ip = trim($arr[0]); + }elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { + $ip = $_SERVER['HTTP_CLIENT_IP']; + }elseif (isset($_SERVER['REMOTE_ADDR'])) { + $ip = $_SERVER['REMOTE_ADDR']; + } + // IP地址合法验证 + $long = sprintf("%u",ip2long($ip)); + $ip = $long ? array($ip, $long) : array('0.0.0.0', 0); + return $ip[$type]; + } diff --git a/public/install/install.lock b/public/install/install.lock new file mode 100644 index 0000000..e69de29 diff --git a/public/install/license.txt b/public/install/license.txt new file mode 100644 index 0000000..489149c --- /dev/null +++ b/public/install/license.txt @@ -0,0 +1,14 @@ +请您在使用前仔细阅读如下条款。包括免除或者限制作者责任的免责条款及对用户的权利限制。您的安装使用行为将视为对本《用户许可协议》的接受,并同意接受本《用户许可协议》各项条款的约束。 + +一、安装和使用: +您必须保证在不进行非法活动,不违反国家相关政策法规的前提下使用本软件。 + +二:郑重声明: +1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息。 + +三、免责声明: +本软件并无附带任何形式的明示的或暗示的保证,包括任何关于本软件的适用性, 无侵犯知识产权或适合作某一特定用途的保证。 +在任何情况下,对于因使用本软件或无法使用本软件而导致的任何损害赔偿,作者均无须承担法律责任。作者不保证本软件所包含的资料,文字、图形、链接或其它事项的准确性或完整性。 +所有由用户自己制作、下载、使用的第三方信息数据和插件所引起的一切版权问题或纠纷,本软件概不承担任何责任。 + +版权所有 (c) 2024-2025,系统保留所有权利。 \ No newline at end of file diff --git a/public/install/localhost.php b/public/install/localhost.php new file mode 100644 index 0000000..22c757a --- /dev/null +++ b/public/install/localhost.php @@ -0,0 +1,10 @@ +query("UPDATE `{$dbPrefix}conf` SET `conf_value` = '$site_name' WHERE conf_key='app_name'"); + +if(INSTALLTYPE == 'HOST'){ + $db_str=<<query($url); + +$mysqli->close(); +return array('status'=>2,'info'=>'成功添加管理员
    成功写入配置文件
    安装完成...'); diff --git a/public/install/sae.php b/public/install/sae.php new file mode 100644 index 0000000..cae27e5 --- /dev/null +++ b/public/install/sae.php @@ -0,0 +1,118 @@ +0Storage设置'; + include './templates/0.php'; + exit; + } else { + $_SESSION['STORAGEDOMAIN'] = $_POST['storagedomain']; + if(!empty($_SESSION['STORAGEDOMAIN'])){ + header('location:./index.php?step=1'); + exit(); + } + } +} +if(!isset($_SESSION['STORAGEDOMAIN']) || empty($_SESSION['STORAGEDOMAIN'])){ + header('location:./index.php?step=0'); + exit; +} +$config['uploaddir'] = $_SESSION['STORAGEDOMAIN']; +//测试该该storage是否有效! +if(!filewrite($config['uploaddir'].'/install_file.lock')){ + exit(get_tip_html('该storage无效!')); +} else{ + file_delete($config['uploaddir'].'/install_file.lock'); +} + +define('SAESTOR_INSTALL_NAME', $config['uploaddir'].'/saestor_'. $_SERVER['HTTP_APPVERSION'] . '_install.lock'); +$config['alreadySaeInstallInfo'] = "版本" . $_SERVER['HTTP_APPVERSION'] . "已完成安装!请删除网站根目录下的install目录!
    如果需要重新安装,请先删除storage内的 saestor_" . $_SERVER['HTTP_APPVERSION'] . "_install.lock 文件"; +if(fileExists(SAESTOR_INSTALL_NAME)){ + exit(get_tip_html($config['alreadySaeInstallInfo'])); +} +if(!is_storage){ + exit(get_tip_html('请开启storage服务!')); +} +if(!is_mc){ + exit(get_tip_html('请开启memcahce服务!')); +} +if(!is_mysql){ + exit(get_tip_html('请开启mysql服务!')); +} +if(!is_kv){ + exit(get_tip_html('请开启KV数据库服务!')); +} + +//SaeStorage +function SaeStorage(){ + static $SaeStorage = array(); + if(!isset($SaeStorage['SaeStorage'])){ + $SaeStorage['SaeStorage'] = new SaeStorage(); + } + return $SaeStorage['SaeStorage']; +} +//domain 路径 +function file_getdomainfilepath($filename){ + $arr=explode('/',ltrim($filename,'./')); + if($arr[count($arr)-1] == ''){ + unset($arr[count($arr)-1]); + } + $domain=array_shift($arr); + $filePath=implode('/',$arr); + return array('domain'=>$domain,'filepath'=>$filePath); +} +//检查文件是否存在 +function fileExists($filename){ + $arr=file_getdomainfilepath($filename); + return SaeStorage()->fileExists($arr['domain'], $arr['filepath']); +} +//写入文件 +function filewrite($file = ''){ + $file = empty($file) ? SAESTOR_INSTALL_NAME:$file; + $arr=file_getdomainfilepath($file); + SaeStorage()->write($arr['domain'], $arr['filepath'],'1'); +} +//删除文件 +function file_delete($filename){ + $arr=file_getdomainfilepath($filename); + return SaeStorage()->delete($arr['domain'], $arr['filepath']); +} + +//判断是否开启storage +function is_storage() { + $s = new SaeStorage(); + if (!$s->write(SAESTOR_NAME, 'is_storage', '1')) { + return FALSE; + } else { + return TRUE; + } +} +//判断是否开启memcahce +function is_mc() { + $mmc = @memcache_init(); + if ($mmc) { + return TRUE; + } else { + return FALSE; + } +} +//判断是否开启mysql +function is_mysql() { + $mysql = @new SaeMysql(); + $sql = "select database()"; + $data = @$mysql->getData($sql); + if ($data) { + return TRUE; + } else { + return FALSE; + } +} +//判断是否开启KV数据库 +function is_kv(){ + $kv=new SaeKV(); + if($kv->init()){ + return TRUE; + } else { + return FALSE; + } +} \ No newline at end of file diff --git a/public/install/templates/.DS_Store b/public/install/templates/.DS_Store new file mode 100644 index 0000000..2d001ff Binary files /dev/null and b/public/install/templates/.DS_Store differ diff --git a/public/install/templates/1.php b/public/install/templates/1.php new file mode 100644 index 0000000..526ccdb --- /dev/null +++ b/public/install/templates/1.php @@ -0,0 +1,10 @@ + +
    +
    +
    +
    +
    +
    + 接 受 +
    + \ No newline at end of file diff --git a/public/install/templates/2.php b/public/install/templates/2.php new file mode 100644 index 0000000..e8ba421 --- /dev/null +++ b/public/install/templates/2.php @@ -0,0 +1,78 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    环境检测推荐配置当前状态最低要求
    操作系统类UNIX 不限制
    PHP版本
    附件上传>2M不限制
    session开启开启
    + + + + + + + + √可写 '; + }else{ + $w = '不可写 '; + $error++; + } + if(is_readable($Testdir)){ + $r = '可读' ; + }else{ + $r = '不可读'; + $error++; + } + ?> + + + + + + +
    目录、文件权限检查写入读取
    + +
    +
    +
    + 重新检测 + + 下一步 + + + +
    + \ No newline at end of file diff --git a/public/install/templates/3.php b/public/install/templates/3.php new file mode 100644 index 0000000..145c4de --- /dev/null +++ b/public/install/templates/3.php @@ -0,0 +1,264 @@ + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    数据库信息  
    数据库服务器:
    数据库服务器地址,一般为localhost
    数据库端口:
    数据库服务器端口,一般为3306
    数据库用户名:
    数据库密码:
    数据库名:
    数据库表前缀:
    建议使用默认
    测试数据库连接: 
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    网站信息  
    网站名称:
    管理员帐号:
    密码:
    重复密码:
    + +
    +
    +
    + 上一步 + +
    +
    + + + + \ No newline at end of file diff --git a/public/install/templates/4.php b/public/install/templates/4.php new file mode 100644 index 0000000..3c6c367 --- /dev/null +++ b/public/install/templates/4.php @@ -0,0 +1,48 @@ + +
    +
    +
      +
      +
      + + + + \ No newline at end of file diff --git a/public/install/templates/5.php b/public/install/templates/5.php new file mode 100644 index 0000000..003138b --- /dev/null +++ b/public/install/templates/5.php @@ -0,0 +1,20 @@ + +
      +
      + +
      +
      + + \ No newline at end of file diff --git a/public/install/templates/css/install.css b/public/install/templates/css/install.css new file mode 100644 index 0000000..79c84f6 --- /dev/null +++ b/public/install/templates/css/install.css @@ -0,0 +1,219 @@ +/* 初始化 */ +html{-webkit-text-size-adjust:none;overflow-y:scroll;} +body,input,button,select,textarea{font:12px/1.5 Microsoft YaHei,Tahoma,Helvetica,'SimSun',sans-serif;color:#444;} +html,body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,th,td{margin:0;padding:0;border:none} +body{background:url(../images/bg.png);} +td,th,div {word-break:break-all;word-wrap:break-word;} +address,cite,dfn,em,var{font-style:normal;font-weight:normal} +table{empty-cells:show;border-spacing:0;} +ul,ol,li{list-style:none} +ul li,ol li{list-style:none;} +img{border:none;} +label{cursor:pointer;} +a{text-decoration:none;} +a:hover{text-decoration:underline;} +button,input,select,textarea{font-size:100%;} +hr{display:block;clear:both;*margin-top:-8px !important;*margin-bottom:-8px !important;} +/* input select textarea */ +input[type="checkbox"]{vertical-align:middle; margin-top:0;} +input,textarea{padding:6px;border-radius: 4px;font-size: 100%;line-height: 16px\9;*line-height: 18px;*vertical-align: -2px;background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s;margin-right: 3px;} +textarea{resize:none;min-height:60px;line-height: 15px;} +textarea:focus,input:focus,select:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6)} +select{height: 30px;line-height: 30px;background-color: #fff;border: 1px solid #ccc;display: inline-block;padding: 6px;color: #555;margin-top: -2px;padding-top: 4px;*margin-top: -8px;vertical-align: middle;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;font-size: 100%;} + +/* 基础样式 */ +.clearfix {_zoom: 1;} +.clearfix:after {content: ".";display: block;visibility: hidden;clear: both;height: 0px;} + +.wrap{margin:90px auto 0;box-shadow:0 0 20px #3F3F3F;width:980px;background-color:#fff;border-radius: 6px;overflow: hidden;} +/* 头部样式 */ +.header{height:80px;padding: 0 5px;box-shadow:0 3px 3px #ddd;position:relative;color:#fff;background:#133ab3;} +.header-title{float:left;font-size: 40px;line-height: 80px;} +.header-install{float: left;margin-top: 26px;font-size: 20px; padding-left: 20px;} +.header-version{float: right;margin-top: 50px;} + +/* 步骤 */ +.step{border-bottom:1px solid #dce1e5;height:60px;} +.step li{float:left;height:59px;line-height:60px;width:20%;text-align:center;font-size:14px;color:#6f7885;font-weight:700;} +.step li em{width:32px;height:32px;text-align:center;line-height:32px;display:inline-block;background:#999999;border-radius: 50%;font-size:20px;color:#fff;font-family:Microsoft Yahei;margin-right:10px;vertical-align:-1px} +.step li.current{background-position:right -106px;background-repeat:no-repeat;color:#246ea5;} +.step li.current em{background:#133ab3} +.step li.on{background-position:0 -176px;} +.step li.on em{background-position:-70px -70px;} + +.pact {box-shadow: 5px 5px 5px #f7f7f7 inset;height: 350px;padding: 20px 20px; white-space: pre-wrap; overflow: hidden;display: block;overflow-y: scroll;margin: 0 auto;font-size: 12px;line-height: 1.5;outline: none;} +/* 服务器检测/信息输入 */ +.server{padding:20px 20px 0 65px;} +.server table{margin-bottom:20px;} +.server td{padding:3px 5px;} +.server .td1{color:#417b9d;font-weight:700;} +.server .input{border:1px solid;border-color:#e3e9ef;padding:3px;width:200px;} +.server .input:hover, +.server .input:focus{border:1px solid #0e85d5;outline:none;} +.gray{color:#bbb;} +.server tr:hover .gray{color:#333;} + +/* 正确错误 */ +.correct_span, +.error_span{display:block;float:left;width:20px;height:16px;text-indent:-2000em;margin-top: 2px;overflow:hidden;background:url(../images/icon.png) no-repeat;margin-right:5px;} +.error_span{background-position:0 -23px;} +/* 成功提示 */ +.success_tip{background:#fff url(../images/complete.png) 210px center no-repeat;font-size: 14px;padding:50px 80px 50px 300px;line-height:2;} +.success_tip a{color:#0166a5;text-decoration:none;font-size: 20px;font-weight: 700;} +.success_tip a:hover{text-decoration:underline;} + +/* +=================== +操作提示 +>> tips 普通 +>> tips_error 错误 +>> tips_success 正确 +>> tips_loading 加载中 +使用方法 + 可独立样式使用,亦可与tips组装,例: +
      错误内容
      + + 可在外出包裹 tips_block 对错误提示进行块级效果展示 +=================== +*/ +.tips,.tips_block span{line-height:25px;padding:0 6px;} +.tips{border:1px solid #faebd2;background:#ffffe9;color:#666;} +.tips_error,.tips_success{color:#cc3333;padding-left:16px;background:url(../images/tips_system.png) -20px 2px no-repeat;display:inline-block;line-height:18px;} +.tips_success{color:#008800;background-position:0 -19px;} +.tips_loading{color:#cc3333;color:#333333;display:inline-block;line-height:20px;} +/* 数据表写入 */ +.install{ box-shadow:5px 5px 5px #f7f7f7 inset;border:1px solid #bdbcbc;width:900px;height:350px;padding:10px;overflow:hidden;display:block;overflow-y:scroll;margin:25px auto;font-size:12px;margin-bottom:22px;outline:none} +.install ul{line-height:1.8;} +/* loading */ +.loading{border-radius: 16px;width: 100px;height: 30px;line-height: 30px;text-align: center;background:#000;background-color: rgba(0, 0, 0, 0.5);color: white;position: fixed;_position:absolute;left: 50%;margin-left: -50px;top: 50%;margin-top:-15px;} +.loading span{background:url(../images/pop_loading.gif) 0 center no-repeat;padding-left:24px;} +/* 按钮 */ +.btn-box{padding: 10px;text-align: center;border-top: 1px solid #ccc;} +.btn,.btn_old{display:inline-block;width:100px;height:30px;background:#133ab3;font:bold 14px/30px Arial,"Microsoft Yahei",Simsun;text-decoration:none;color:#fff;margin:0 5px;border:0 none;cursor:pointer;vertical-align:top;} +.btn:hover{background-position:0 -30px;text-decoration:none;} +.btn.error{background-position: 0 -60px;color: #DF0000;} +.btn_old,.btn_old:hover{background-position:0 -60px;color:#999 !important;cursor:default;text-decoration:none;} +/* 底部 */ +.footer{text-align:center;padding:15px 0 50px;color:#999999;} +.footer a{color:#999;text-decoration:none;} + +body { + background: #f5f6fa; +} + +.wrap { + margin: 50px auto 0; + box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1); + width: 1000px; + background-color: #fff; + border-radius: 8px; + overflow: hidden; +} + +.header { + height: 90px; + padding: 0 30px; + box-shadow: 0 2px 10px rgba(19, 58, 179, 0.1); + position: relative; + color: #fff; + background: linear-gradient(135deg, #133ab3, #1e56ff); +} + +.header-title { + float: left; + font-size: 42px; + line-height: 90px; + font-weight: 300; +} + +.header-install { + float: left; + margin-top: 30px; + font-size: 22px; + padding-left: 25px; +} + +.step { + border-bottom: 1px solid #eef0f5; + height: 70px; + background: #fff; +} + +.step li { + float: left; + height: 69px; + line-height: 70px; + width: 20%; + text-align: center; + font-size: 15px; + color: #6f7885; + font-weight: 600; + position: relative; + transition: all 0.3s ease; +} + +.step li em { + width: 36px; + height: 36px; + text-align: center; + line-height: 36px; + display: inline-block; + background: #e0e6ed; + border-radius: 50%; + font-size: 18px; + color: #fff; + margin-right: 12px; + transition: all 0.3s ease; +} + +.step li.current { + color: #133ab3; +} + +.step li.current em { + background: #133ab3; + box-shadow: 0 2px 10px rgba(19, 58, 179, 0.2); +} + +/* 按钮样式优化 */ +.btn { + display: inline-block; + width: 120px; + height: 40px; + background: #133ab3; + font: 600 15px/40px "Microsoft Yahei"; + text-decoration: none; + color: #fff; + margin: 0 8px; + border: 0 none; + cursor: pointer; + border-radius: 4px; + transition: all 0.3s ease; +} + +.btn:hover { + background: #1e56ff; + transform: translateY(-1px); + box-shadow: 0 2px 10px rgba(19, 58, 179, 0.2); +} + +/* 输入框样式优化 */ +input, textarea { + padding: 8px 12px; + border-radius: 4px; + font-size: 14px; + line-height: 1.5; + background-color: #fff; + border: 1px solid #dce1e5; + transition: all 0.3s ease; +} + +input:focus, textarea:focus { + border-color: #133ab3; + box-shadow: 0 0 0 2px rgba(19, 58, 179, 0.1); +} + +.btn.error{ + color: #999999; + background: #eeeeee; +} \ No newline at end of file diff --git a/public/install/templates/footer.php b/public/install/templates/footer.php new file mode 100644 index 0000000..4a29309 --- /dev/null +++ b/public/install/templates/footer.php @@ -0,0 +1,4 @@ +
      + + + \ No newline at end of file diff --git a/public/install/templates/header.php b/public/install/templates/header.php new file mode 100644 index 0000000..a790b31 --- /dev/null +++ b/public/install/templates/header.php @@ -0,0 +1,18 @@ + + + + + <?php echo $config['name'].' '.$config['version']; ?> - <?php echo $config['powered']; ?> + + + +
      +
      +
      -安装向导
      +
      版本:
      +
      +
      + +
      \ No newline at end of file diff --git a/public/install/templates/images/bg.png b/public/install/templates/images/bg.png new file mode 100644 index 0000000..53c9aea Binary files /dev/null and b/public/install/templates/images/bg.png differ diff --git a/public/install/templates/images/btn.png b/public/install/templates/images/btn.png new file mode 100644 index 0000000..2df58a0 Binary files /dev/null and b/public/install/templates/images/btn.png differ diff --git a/public/install/templates/images/complete.png b/public/install/templates/images/complete.png new file mode 100644 index 0000000..eb0d6d5 Binary files /dev/null and b/public/install/templates/images/complete.png differ diff --git a/public/install/templates/images/header.png b/public/install/templates/images/header.png new file mode 100644 index 0000000..3b940af Binary files /dev/null and b/public/install/templates/images/header.png differ diff --git a/public/install/templates/images/icon.png b/public/install/templates/images/icon.png new file mode 100644 index 0000000..c375143 Binary files /dev/null and b/public/install/templates/images/icon.png differ diff --git a/public/install/templates/images/ignore.png b/public/install/templates/images/ignore.png new file mode 100644 index 0000000..fcfd764 Binary files /dev/null and b/public/install/templates/images/ignore.png differ diff --git a/public/install/templates/images/loading.gif b/public/install/templates/images/loading.gif new file mode 100644 index 0000000..d160238 Binary files /dev/null and b/public/install/templates/images/loading.gif differ diff --git a/public/install/templates/images/pop_loading.gif b/public/install/templates/images/pop_loading.gif new file mode 100644 index 0000000..d401a40 Binary files /dev/null and b/public/install/templates/images/pop_loading.gif differ diff --git a/public/install/templates/images/step.png b/public/install/templates/images/step.png new file mode 100644 index 0000000..55f38a2 Binary files /dev/null and b/public/install/templates/images/step.png differ diff --git a/public/install/templates/images/tips_system.png b/public/install/templates/images/tips_system.png new file mode 100644 index 0000000..feaf23d Binary files /dev/null and b/public/install/templates/images/tips_system.png differ diff --git a/public/install/templates/js/jquery.js b/public/install/templates/js/jquery.js new file mode 100644 index 0000000..6334d0d --- /dev/null +++ b/public/install/templates/js/jquery.js @@ -0,0 +1,2 @@ +/*! jQuery v@1.8.0 jquery.com | jquery.org/license */ +(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write(""),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bR[a]=c,c}function ch(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||cd.test(a)?d(a,e):ch(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ch(a+"["+e+"]",b[e],c,d);else d(a,b)}function cy(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b
      a",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="
      t
      ",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="
      ",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/^(?:\{.*\}|\[.*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.shift(),e=p._queueHooks(a,b),f=function(){p.dequeue(a,b)};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;jq&&u.push({elem:this,matches:o.slice(q)});for(d=0;d0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bd(a,b,c,d){var e=0,f=b.length;for(;e0?h(g,c,f):[]}function bf(a,c,d,e,f){var g,h,i,j,k,l,m,n,p=0,q=f.length,s=L.POS,t=new RegExp("^"+s.source+"(?!"+r+")","i"),u=function(){var a=1,c=arguments.length-2;for(;ai){m=a.slice(i,g.index),i=n,l=[c],B.test(m)&&(k&&(l=k),k=e);if(h=H.test(m))m=m.slice(0,-5).replace(B,"$&*");g.length>1&&g[0].replace(t,u),k=be(m,g[1],g[2],l,k,h)}}k?(j=j.concat(k),(m=a.slice(i))&&m!==")"?B.test(m)?bd(m,j,d,e):Z(m,c,d,e?e.concat(k):k):o.apply(d,j)):Z(a,c,d,e)}return q===1?d:Z.uniqueSort(d)}function bg(a,b,c){var d,e,f,g=[],i=0,j=D.exec(a),k=!j.pop()&&!j.pop(),l=k&&a.match(C)||[""],m=$.preFilter,n=$.filter,o=!c&&b!==h;for(;(e=l[i])!=null&&k;i++){g.push(d=[]),o&&(e=" "+e);while(e){k=!1;if(j=B.exec(e))e=e.slice(j[0].length),k=d.push({part:j.pop().replace(A," "),captures:j});for(f in n)(j=L[f].exec(e))&&(!m[f]||(j=m[f](j,b,c)))&&(e=e.slice(j.shift().length),k=d.push({part:f,captures:j}));if(!k)break}}return k||Z.error(a),g}function bh(a,b,e){var f=b.dir,g=m++;return a||(a=function(a){return a===e}),b.first?function(b,c){while(b=b[f])if(b.nodeType===1)return a(b,c)&&b}:function(b,e){var h,i=g+"."+d,j=i+"."+c;while(b=b[f])if(b.nodeType===1){if((h=b[q])===j)return b.sizset;if(typeof h=="string"&&h.indexOf(i)===0){if(b.sizset)return b}else{b[q]=j;if(a(b,e))return b.sizset=!0,b;b.sizset=!1}}}}function bi(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function bj(a,b,c){var d,e,f=0;for(;d=a[f];f++)$.relative[d.part]?e=bh(e,$.relative[d.part],b):(d.captures.push(b,c),e=bi(e,$.filter[d.part].apply(null,d.captures)));return e}function bk(a){return function(b,c){var d,e=0;for(;d=a[e];e++)if(d(b,c))return!0;return!1}}var c,d,e,f,g,h=a.document,i=h.documentElement,j="undefined",k=!1,l=!0,m=0,n=[].slice,o=[].push,q=("sizcache"+Math.random()).replace(".",""),r="[\\x20\\t\\r\\n\\f]",s="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",t=s.replace("w","w#"),u="([*^$|!~]?=)",v="\\["+r+"*("+s+")"+r+"*(?:"+u+r+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+t+")|)|)"+r+"*\\]",w=":("+s+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",x=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",y=r+"*([\\x20\\t\\r\\n\\f>+~])"+r+"*",z="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+v+"|"+w.replace(2,7)+"|[^\\\\(),])+",A=new RegExp("^"+r+"+|((?:^|[^\\\\])(?:\\\\.)*)"+r+"+$","g"),B=new RegExp("^"+y),C=new RegExp(z+"?(?="+r+"*,|$)","g"),D=new RegExp("^(?:(?!,)(?:(?:^|,)"+r+"*"+z+")*?|"+r+"*(.*?))(\\)|$)"),E=new RegExp(z.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+y,"g"),F=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,G=/[\x20\t\r\n\f]*[+~]/,H=/:not\($/,I=/h\d/i,J=/input|select|textarea|button/i,K=/\\(?!\\)/g,L={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),NAME:new RegExp("^\\[name=['\"]?("+s+")['\"]?\\]"),TAG:new RegExp("^("+s.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+v),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+r+"*(even|odd|(([+-]|)(\\d*)n|)"+r+"*(?:([+-]|)"+r+"*(\\d+)|))"+r+"*\\)|)","i"),POS:new RegExp(x,"ig"),needsContext:new RegExp("^"+r+"*[>+~]|"+x,"i")},M={},N=[],O={},P=[],Q=function(a){return a.sizzleFilter=!0,a},R=function(a){return function(b){return b.nodeName.toLowerCase()==="input"&&b.type===a}},S=function(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}},T=function(a){var b=!1,c=h.createElement("div");try{b=a(c)}catch(d){}return c=null,b},U=T(function(a){a.innerHTML="";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),V=T(function(a){a.id=q+0,a.innerHTML="
      ",i.insertBefore(a,i.firstChild);var b=h.getElementsByName&&h.getElementsByName(q).length===2+h.getElementsByName(q+0).length;return g=!h.getElementById(q),i.removeChild(a),b}),W=T(function(a){return a.appendChild(h.createComment("")),a.getElementsByTagName("*").length===0}),X=T(function(a){return a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!==j&&a.firstChild.getAttribute("href")==="#"}),Y=T(function(a){return a.innerHTML="",!a.getElementsByClassName||a.getElementsByClassName("e").length===0?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length!==1)}),Z=function(a,b,c,d){c=c||[],b=b||h;var e,f,g,i,j=b.nodeType;if(j!==1&&j!==9)return[];if(!a||typeof a!="string")return c;g=ba(b);if(!g&&!d)if(e=F.exec(a))if(i=e[1]){if(j===9){f=b.getElementById(i);if(!f||!f.parentNode)return c;if(f.id===i)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(i))&&bb(b,f)&&f.id===i)return c.push(f),c}else{if(e[2])return o.apply(c,n.call(b.getElementsByTagName(a),0)),c;if((i=e[3])&&Y&&b.getElementsByClassName)return o.apply(c,n.call(b.getElementsByClassName(i),0)),c}return bm(a,b,c,d,g)},$=Z.selectors={cacheLength:50,match:L,order:["ID","TAG"],attrHandle:{},createPseudo:Q,find:{ID:g?function(a,b,c){if(typeof b.getElementById!==j&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==j&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==j&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:W?function(a,b){if(typeof b.getElementsByTagName!==j)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(K,""),a[3]=(a[4]||a[5]||"").replace(K,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||Z.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&Z.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return L.CHILD.test(a[0])?null:(c&&(b=D.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:g?function(a){return a=a.replace(K,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(K,""),function(b){var c=typeof b.getAttributeNode!==j&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(K,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=M[a];return b||(b=M[a]=new RegExp("(^|"+r+")"+a+"("+r+"|$)"),N.push(a),N.length>$.cacheLength&&delete M[N.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==j&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=Z.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return Z.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=m++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[q]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[q]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=$.pseudos[a]||$.pseudos[a.toLowerCase()];return e||Z.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:Q(function(a,b,c){var d=bl(a.replace(A,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!$.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:Q(function(a){return function(b){return(b.textContent||b.innerText||bc(b)).indexOf(a)>-1}}),has:Q(function(a){return function(b){return Z(a,b).length>0}}),header:function(a){return I.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:R("radio"),checkbox:R("checkbox"),file:R("file"),password:R("password"),image:R("image"),submit:S("submit"),reset:S("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return J.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e$.cacheLength&&delete O[P.shift()],g};Z.matches=function(a,b){return Z(a,null,null,b)},Z.matchesSelector=function(a,b){return Z(b,null,null,[a]).length>0};var bm=function(a,b,e,f,g){a=a.replace(A,"$1");var h,i,j,k,l,m,p,q,r,s=a.match(C),t=a.match(E),u=b.nodeType;if(L.POS.test(a))return bf(a,b,e,f,s);if(f)h=n.call(f,0);else if(s&&s.length===1){if(t.length>1&&u===9&&!g&&(s=L.ID.exec(t[0]))){b=$.find.ID(s[1],b,g)[0];if(!b)return e;a=a.slice(t.shift().length)}q=(s=G.exec(t[0]))&&!s.index&&b.parentNode||b,r=t.pop(),m=r.split(":not")[0];for(j=0,k=$.order.length;j",a.querySelectorAll("[selected]").length||e.push("\\["+r+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="

      ",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+r+"*(?:\"\"|'')"),a.innerHTML="",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bm=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return o.apply(f,n.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d.getAttribute("id"),k=j||q,l=G.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return o.apply(f,n.call(l.querySelectorAll(a.replace(C,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push($.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),Z.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!ba(b)&&!f.test(c)&&(!e||!e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&b.document.nodeType!==11)return h}catch(i){}return Z(c,null,null,[b]).length>0})}(),Z.attr=p.attr,p.find=Z,p.expr=Z.selectors,p.expr[":"]=p.expr.pseudos,p.unique=Z.uniqueSort,p.text=Z.getText,p.isXMLDoc=Z.isXML,p.contains=Z.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b0)for(e=d;e=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*\s*$/g,bz={option:[1,""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X
      ","
      "]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1>");try{for(;d1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=0,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(g=b===e&&bA;(h=a[s])!=null;s++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{g=g||bk(b),l=l||g.appendChild(b.createElement("div")),h=h.replace(bo,"<$1>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]===""&&!m?l.childNodes:[];for(f=n.length-1;f>=0;--f)p.nodeName(n[f],"tbody")&&!n[f].childNodes.length&&n[f].parentNode.removeChild(n[f])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l=g.lastChild}h.nodeType?t.push(h):t=p.merge(t,h)}l&&(g.removeChild(l),h=l=g=null);if(!p.support.appendChecked)for(s=0;(h=t[s])!=null;s++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(s=0;(h=t[s])!=null;s++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[s+1,0].concat(r)),s+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^margin/,bO=new RegExp("^("+q+")(.*)$","i"),bP=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bQ=new RegExp("^([-+])=("+q+")","i"),bR={},bS={position:"absolute",visibility:"hidden",display:"block"},bT={letterSpacing:0,fontWeight:400,lineHeight:1},bU=["Top","Right","Bottom","Left"],bV=["Webkit","O","Moz","ms"],bW=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return bZ(this,!0)},hide:function(){return bZ(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bW.apply(this,arguments):this.each(function(){(c?a:bY(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bX(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bQ.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bX(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bT&&(f=bT[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],c===""&&!p.contains(a.ownerDocument.documentElement,a)&&(c=p.style(a,b)),bP.test(c)&&bN.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bP.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0||bH(a,"display")!=="none"?ca(a,b,d):p.swap(a,bS,function(){return ca(a,b,d)})},set:function(a,c,d){return b$(a,c,d?b_(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bP.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bU[d]+b]=e[d]||e[d-2]||e[0];return f}},bN.test(a)||(p.cssHooks[a+b].set=b$)});var cc=/%20/g,cd=/\[\]$/,ce=/\r?\n/g,cf=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,cg=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||cg.test(this.nodeName)||cf.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(ce,"\r\n")}}):{name:b.name,value:c.replace(ce,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ch(d,a[d],c,f);return e.join("&").replace(cc,"+")};var ci,cj,ck=/#.*$/,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cm=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,cn=/^(?:GET|HEAD)$/,co=/^\/\//,cp=/\?/,cq=/)<[^<]*)*<\/script>/gi,cr=/([?&])_=[^&]*/,cs=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ct=p.fn.load,cu={},cv={},cw=["*/"]+["*"];try{ci=f.href}catch(cx){ci=e.createElement("a"),ci.href="",ci=ci.href}cj=cs.exec(ci.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&ct)return ct.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("
      ").append(a.replace(cq,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cA(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cA(a,b),a},ajaxSettings:{url:ci,isLocal:cm.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cw},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cy(cu),ajaxTransport:cy(cv),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cB(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cC(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cl.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(ck,"").replace(co,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=cs.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==cj[1]&&i[2]==cj[2]&&(i[3]||(i[1]==="http:"?80:443))==(cj[3]||(cj[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cz(cu,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!cn.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cp.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cr,"$1_="+z);l.url=A+(A===l.url?(cp.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cw+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cz(cv,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cD=[],cE=/\?/,cF=/(=)\?(?=&|$)|\?\?/,cG=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cD.pop()||p.expando+"_"+cG++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cF.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cF.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cF,"$1"+f):m?c.data=i.replace(cF,"$1"+f):k&&(c.url+=(cE.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cD.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cH,cI=a.ActiveXObject?function(){for(var a in cH)cH[a](0,1)}:!1,cJ=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cK()||cL()}:cK,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cI&&delete cH[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cJ,cI&&(cH||(cH={},p(a).unload(cI)),cH[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cM,cN,cO=/^(?:toggle|show|hide)$/,cP=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cQ=/queueHooks$/,cR=[cX],cS={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cP.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cV,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c$.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c$.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=c_(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window); \ No newline at end of file diff --git a/public/install/templates/js/validate.js b/public/install/templates/js/validate.js new file mode 100644 index 0000000..95f5960 --- /dev/null +++ b/public/install/templates/js/validate.js @@ -0,0 +1,1246 @@ +/** + * jQuery Validation Plugin @VERSION + * + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ + * http://docs.jquery.com/Plugins/Validation + * + * Copyright (c) 2006 - 2011 Jörn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * @Modify : linhao87@gmail.com + * @Descript : remote ajax验证,判断response的state标头,提示内容在response.message[0];remote验证时的startRequest方法下移;验证码错误&刷新;param.ignoreRepeat 登录安全问题答案 + * $Id: validate.js 15186 2012-08-01 08:57:18Z hao.lin $ + */ + +(function($) { + +$.extend($.fn, { + // http://docs.jquery.com/Plugins/Validation/validate + validate: function( options ) { + + // if nothing is selected, return nothing; can't chain anyway + if (!this.length) { + options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" ); + return; + } + + // check if a validator for this form was already created + var validator = $.data(this[0], 'validator'); + if ( validator ) { + return validator; + } + + validator = new $.validator( options, this[0] ); + $.data(this[0], 'validator', validator); + + if ( validator.settings.onsubmit ) { + + // allow suppresing validation by adding a cancel class to the submit button + this.find("input, button").filter(".cancel").click(function() { + validator.cancelSubmit = true; + }); + + // when a submitHandler is used, capture the submitting button + if (validator.settings.submitHandler) { + this.find("input, button").filter(":submit").click(function() { + validator.submitButton = this; + }); + } + + // validate the form on submit + this.submit( function( event ) { + if ( validator.settings.debug ) + // prevent form submit to be able to see console output + event.preventDefault(); + + function handle() { + if ( validator.settings.submitHandler ) { + if (validator.submitButton) { + // insert a hidden input as a replacement for the missing submit button + var hidden = $("").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); + } + validator.settings.submitHandler.call( validator, validator.currentForm ); + if (validator.submitButton) { + // and clean up afterwards; thanks to no-block-scope, hidden can be referenced + hidden.remove(); + } + return false; + } + return true; + } + + // prevent submit for invalid forms or custom submit handlers + if ( validator.cancelSubmit ) { + validator.cancelSubmit = false; + return handle(); + } + + if ( validator.form() ) {//console.log(validator.pendingRequest); + if ( validator.pendingRequest ) { + validator.formSubmitted = true; + return false; + } + return handle(); + } else { + validator.focusInvalid(); + return false; + } + }); + } + + return validator; + }, + // http://docs.jquery.com/Plugins/Validation/valid + valid: function() { + if ( $(this[0]).is('form')) { + return this.validate().form(); + } else { + var valid = true; + var validator = $(this[0].form).validate(); + this.each(function() { + valid &= validator.element(this); + }); + return valid; + } + }, + // attributes: space seperated list of attributes to retrieve and remove + removeAttrs: function(attributes) { + var result = {}, + $element = this; + $.each(attributes.split(/\s/), function(index, value) { + result[value] = $element.attr(value); + $element.removeAttr(value); + }); + return result; + }, + // http://docs.jquery.com/Plugins/Validation/rules + rules: function(command, argument) { + var element = this[0]; + + if (command) { + var settings = $.data(element.form, 'validator').settings; + var staticRules = settings.rules; + var existingRules = $.validator.staticRules(element); + switch(command) { + case "add": + $.extend(existingRules, $.validator.normalizeRule(argument)); + staticRules[element.name] = existingRules; + if (argument.messages) + settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); + break; + case "remove": + if (!argument) { + delete staticRules[element.name]; + return existingRules; + } + var filtered = {}; + $.each(argument.split(/\s/), function(index, method) { + filtered[method] = existingRules[method]; + delete existingRules[method]; + }); + return filtered; + } + } + + var data = $.validator.normalizeRules( + $.extend( + {}, + $.validator.metadataRules(element), + $.validator.classRules(element), + $.validator.attributeRules(element), + $.validator.staticRules(element) + ), element); + + // make sure required is at front + if (data.required) { + var param = data.required; + delete data.required; + data = $.extend({required: param}, data); + } + + return data; + } +}); + +// Custom selectors +$.extend($.expr[":"], { + // http://docs.jquery.com/Plugins/Validation/blank + blank: function(a) {return !$.trim("" + a.value);}, + // http://docs.jquery.com/Plugins/Validation/filled + filled: function(a) {return !!$.trim("" + a.value);}, + // http://docs.jquery.com/Plugins/Validation/unchecked + unchecked: function(a) {return !a.checked;} +}); + +// constructor for validator +$.validator = function( options, form ) { + this.settings = $.extend( true, {}, $.validator.defaults, options ); + this.currentForm = form; + this.init(); +}; + +$.validator.format = function(source, params) { + if ( arguments.length == 1 ) + return function() { + var args = $.makeArray(arguments); + args.unshift(source); + return $.validator.format.apply( this, args ); + }; + if ( arguments.length > 2 && params.constructor != Array ) { + params = $.makeArray(arguments).slice(1); + } + if ( params.constructor != Array ) { + params = [ params ]; + } + $.each(params, function(i, n) { + source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n); + }); + return source; +}; + +$.extend($.validator, { + + defaults: { + messages: {}, + groups: {}, + rules: {}, + errorClass: "error", + validClass: "valid", + errorElement: "label", + focusInvalid: true, + errorContainer: $( [] ), + errorLabelContainer: $( [] ), + onsubmit: true, + ignore: [], + ignoreTitle: false, + onfocusin: function(element) { + this.lastActive = element; + + // hide error label and remove error class on focus if enabled + if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { + this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); + this.addWrapper(this.errorsFor(element)).hide(); + } + }, + onfocusout: function(element) { + if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { + this.element(element); + } + }, + onkeyup: function(element) { + if ( element.name in this.submitted || element == this.lastElement ) { + this.element(element); + } + }, + onclick: function(element) { + // click on selects, radiobuttons and checkboxes + if ( element.name in this.submitted ) + this.element(element); + // or option elements, check parent select in that case + else if (element.parentNode.name in this.submitted) + this.element(element.parentNode); + }, + highlight: function(element, errorClass, validClass) { + if (element.type === 'radio') { + this.findByName(element.name).addClass(errorClass).removeClass(validClass); + } else { + $(element).addClass(errorClass).removeClass(validClass); + } + }, + unhighlight: function(element, errorClass, validClass) { + if (element.type === 'radio') { + this.findByName(element.name).removeClass(errorClass).addClass(validClass); + } else { + $(element).removeClass(errorClass).addClass(validClass); + } + } + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults + setDefaults: function(settings) { + $.extend( $.validator.defaults, settings ); + }, + + messages: { + required: "This field is required.", + remote: "Please fix this field.", + email: "Please enter a valid email address.", + url: "Please enter a valid URL.", + date: "Please enter a valid date.", + dateISO: "Please enter a valid date (ISO).", + number: "Please enter a valid number.", + digits: "Please enter only digits.", + creditcard: "Please enter a valid credit card number.", + equalTo: "Please enter the same value again.", + accept: "Please enter a value with a valid extension.", + maxlength: $.validator.format("Please enter no more than {0} characters."), + minlength: $.validator.format("Please enter at least {0} characters."), + rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), + range: $.validator.format("Please enter a value between {0} and {1}."), + max: $.validator.format("Please enter a value less than or equal to {0}."), + min: $.validator.format("Please enter a value greater than or equal to {0}.") + }, + + autoCreateRanges: false, + + prototype: { + + init: function() { + this.labelContainer = $(this.settings.errorLabelContainer); + this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); + this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); + this.submitted = {}; + this.valueCache = {}; + this.pendingRequest = 0; + this.pending = {}; + this.invalid = {}; + this.reset(); + + var groups = (this.groups = {}); + $.each(this.settings.groups, function(key, value) { + $.each(value.split(/\s/), function(index, name) { + groups[name] = key; + }); + }); + var rules = this.settings.rules; + $.each(rules, function(key, value) { + rules[key] = $.validator.normalizeRule(value); + }); + + function delegate(event) { + var validator = $.data(this[0].form, "validator"), + eventType = "on" + event.type.replace(/^validate/, ""); + validator.settings[eventType] && validator.settings[eventType].call(validator, this[0] ); + } + $(this.currentForm) + .validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate) + .validateDelegate(":radio, :checkbox, select, option", "click", delegate); + + if (this.settings.invalidHandler) + $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/form + form: function() { + this.checkForm(); + $.extend(this.submitted, this.errorMap); + this.invalid = $.extend({}, this.errorMap); + if (!this.valid()) + $(this.currentForm).triggerHandler("invalid-form", [this]); + this.showErrors(); + return this.valid(); + }, + + checkForm: function() { + this.prepareForm(); + for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { + this.check( elements[i] ); + } + return this.valid(); + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/element + element: function( element ) { + element = this.clean( element ); + this.lastElement = element; + this.prepareElement( element ); + this.currentElements = $(element); + var result = this.check( element ); + if ( result ) { + delete this.invalid[element.name]; + } else { + this.invalid[element.name] = true; + } + if ( !this.numberOfInvalids() ) { + // Hide error containers on last error + this.toHide = this.toHide.add( this.containers ); + } + this.showErrors(); + return result; + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/showErrors + showErrors: function(errors) { + if(errors) { + // add items to error list and map + $.extend( this.errorMap, errors ); + this.errorList = []; + for ( var name in errors ) { + this.errorList.push({ + message: errors[name], + element: this.findByName(name)[0] + }); + } + // remove items from success list + this.successList = $.grep( this.successList, function(element) { + return !(element.name in errors); + }); + } + this.settings.showErrors + ? this.settings.showErrors.call( this, this.errorMap, this.errorList ) + : this.defaultShowErrors(); + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/resetForm + resetForm: function() { + if ( $.fn.resetForm ) + $( this.currentForm ).resetForm(); + this.submitted = {}; + this.prepareForm(); + this.hideErrors(); + this.elements().removeClass( this.settings.errorClass ); + }, + + numberOfInvalids: function() { + return this.objectLength(this.invalid); + }, + + objectLength: function( obj ) { + var count = 0; + for ( var i in obj ) + count++; + return count; + }, + + hideErrors: function() { + this.addWrapper( this.toHide ).hide(); + }, + + valid: function() { + return this.size() == 0; + }, + + size: function() { + return this.errorList.length; + }, + + focusInvalid: function() { + if( this.settings.focusInvalid ) { + try { + $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) + .filter(":visible") + .focus() + // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find + .trigger("focusin"); + + //验证码错误&刷新 + $.each(this.invalidElements(), function(i, o){ + if($(this).data('id') === 'code') { + $('#J_code_img').click(); + } + }); + } catch(e) { + // ignore IE throwing errors when focusing hidden elements + } + } + }, + + findLastActive: function() { + var lastActive = this.lastActive; + return lastActive && $.grep(this.errorList, function(n) { + return n.element.name == lastActive.name; + }).length == 1 && lastActive; + }, + + elements: function() { + var validator = this, + rulesCache = {}; + + // select all valid inputs inside the form (no submit or reset buttons) + return $(this.currentForm) + .find("input, select, textarea") + .not(":submit, :reset, :image, [disabled]") + .not( this.settings.ignore ) + .filter(function() { + !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this); + + // select only the first element for each name, and only those with rules specified + if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) + return false; + + rulesCache[this.name] = true; + return true; + }); + }, + + clean: function( selector ) { + return $( selector )[0]; + }, + + errors: function() { + return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext ); + }, + + reset: function() { + this.successList = []; + this.errorList = []; + this.errorMap = {}; + this.toShow = $([]); + this.toHide = $([]); + this.currentElements = $([]); + }, + + prepareForm: function() { + this.reset(); + this.toHide = this.errors().add( this.containers ); + }, + + prepareElement: function( element ) { + this.reset(); + this.toHide = this.errorsFor(element); + }, + + check: function( element ) { + element = this.clean( element ); + + // if radio/checkbox, validate first element in group instead + if (this.checkable(element)) { + element = this.findByName( element.name ).not(this.settings.ignore)[0]; + } + + var rules = $(element).rules(); + var dependencyMismatch = false; + for (var method in rules ) { + var rule = { method: method, parameters: rules[method] }; + try { + var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters ); + + // if a method indicates that the field is optional and therefore valid, + // don't mark it as valid when there are no other rules + if ( result == "dependency-mismatch" ) { + dependencyMismatch = true; + continue; + } + dependencyMismatch = false; + + if ( result == "pending" ) { + this.toHide = this.toHide.not( this.errorsFor(element) ); + return; + } + + if( !result ) { + this.formatAndAdd( element, rule ); + return false; + } + } catch(e) { + this.settings.debug && window.console && console.log("exception occured when checking element " + element.id + + ", check the '" + rule.method + "' method", e); + throw e; + } + } + if (dependencyMismatch) + return; + if ( this.objectLength(rules) ) + this.successList.push(element); + return true; + }, + + // return the custom message for the given element and validation method + // specified in the element's "messages" metadata + customMetaMessage: function(element, method) { + if (!$.metadata) + return; + + var meta = this.settings.meta + ? $(element).metadata()[this.settings.meta] + : $(element).metadata(); + + return meta && meta.messages && meta.messages[method]; + }, + + // return the custom message for the given element name and validation method + customMessage: function( name, method ) { + var m = this.settings.messages[name]; + return m && (m.constructor == String + ? m + : m[method]); + }, + + // return the first defined argument, allowing empty strings + findDefined: function() { + for(var i = 0; i < arguments.length; i++) { + if (arguments[i] !== undefined) + return arguments[i]; + } + return undefined; + }, + + defaultMessage: function( element, method) { + return this.findDefined( + this.customMessage( element.name, method ), + this.customMetaMessage( element, method ), + // title is never undefined, so handle empty string as undefined + !this.settings.ignoreTitle && element.title || undefined, + $.validator.messages[method], + "Warning: No message defined for " + element.name + "" + ); + }, + + formatAndAdd: function( element, rule ) { + var message = this.defaultMessage( element, rule.method ), + theregex = /\$?\{(\d+)\}/g; + if ( typeof message == "function" ) { + message = message.call(this, rule.parameters, element); + } else if (theregex.test(message)) { + message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters); + } + this.errorList.push({ + message: message, + element: element + }); + + this.errorMap[element.name] = message; + this.submitted[element.name] = message; + }, + + addWrapper: function(toToggle) { + if ( this.settings.wrapper ) + toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); + return toToggle; + }, + + defaultShowErrors: function() { + for ( var i = 0; this.errorList[i]; i++ ) { + var error = this.errorList[i]; + this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); + this.showLabel( error.element, error.message ); + } + if( this.errorList.length ) { + this.toShow = this.toShow.add( this.containers ); + } + if (this.settings.success) { + for ( var i = 0; this.successList[i]; i++ ) { + this.showLabel( this.successList[i] ); + } + } + if (this.settings.unhighlight) { + for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) { + this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); + } + } + this.toHide = this.toHide.not( this.toShow ); + this.hideErrors(); + this.addWrapper( this.toShow ).show(); + }, + + validElements: function() { + return this.currentElements.not(this.invalidElements()); + }, + + invalidElements: function() { + return $(this.errorList).map(function() { + return this.element; + }); + }, + + showLabel: function(element, message) { + var label = this.errorsFor( element ); + if ( label.length ) { + // refresh error/success class + label.removeClass().addClass( this.settings.errorClass ); + + // check if we have a generated label, replace the message then + label.attr("generated") && label.html(message); + } else { + // create label + label = $("<" + this.settings.errorElement + "/>") + .attr({"for": this.idOrName(element), generated: true}) + .addClass(this.settings.errorClass) + .html(message || ""); + if ( this.settings.wrapper ) { + // make sure the element is visible, even in IE + // actually showing the wrapped element is handled elsewhere + label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); + } + if ( !this.labelContainer.append(label).length ) + this.settings.errorPlacement + ? this.settings.errorPlacement(label, $(element) ) + : label.insertAfter(element); + } + if ( !message && this.settings.success ) { + label.text(""); + typeof this.settings.success == "string" + ? label.addClass( this.settings.success ) + : this.settings.success( label ); + } + this.toShow = this.toShow.add(label); + }, + + errorsFor: function(element) { + var name = this.idOrName(element); + return this.errors().filter(function() { + return $(this).attr('for') == name; + }); + }, + + idOrName: function(element) { + return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); + }, + + checkable: function( element ) { + return /radio|checkbox/i.test(element.type); + }, + + findByName: function( name ) { + // select by name and filter by form for performance over form.find("[name=...]") + var form = this.currentForm; + return $(document.getElementsByName(name)).map(function(index, element) { + return element.form == form && element.name == name && element || null; + }); + }, + + getLength: function(value, element) { + switch( element.nodeName.toLowerCase() ) { + case 'select': + return $("option:selected", element).length; + case 'input': + if( this.checkable( element) ) + return this.findByName(element.name).filter(':checked').length; + } + return value.length; + }, + + depend: function(param, element) { + return this.dependTypes[typeof param] + ? this.dependTypes[typeof param](param, element) + : true; + }, + + dependTypes: { + "boolean": function(param, element) { + return param; + }, + "string": function(param, element) { + return !!$(param, element.form).length; + }, + "function": function(param, element) { + return param(element); + } + }, + + optional: function(element) { + return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch"; + }, + + startRequest: function(element) { + if (!this.pending[element.name]) { + this.pendingRequest++; + this.pending[element.name] = true; + } + }, + + stopRequest: function(element, valid) { + this.pendingRequest--; + + // sometimes synchronization fails, make sure pendingRequest is never < 0 + if (this.pendingRequest < 0) + this.pendingRequest = 0; + delete this.pending[element.name]; + if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) { + + + $(this.currentForm).submit(); + this.formSubmitted = false; + } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) { + $(this.currentForm).triggerHandler("invalid-form", [this]); + this.formSubmitted = false; + } + }, + + previousValue: function(element) { + return $.data(element, "previousValue") || $.data(element, "previousValue", { + old: null, + valid: true, + message: this.defaultMessage( element, "remote" ) + }); + } + + }, + + classRuleSettings: { + required: {required: true}, + email: {email: true}, + url: {url: true}, + date: {date: true}, + dateISO: {dateISO: true}, + dateDE: {dateDE: true}, + number: {number: true}, + numberDE: {numberDE: true}, + digits: {digits: true}, + creditcard: {creditcard: true} + }, + + addClassRules: function(className, rules) { + className.constructor == String ? + this.classRuleSettings[className] = rules : + $.extend(this.classRuleSettings, className); + }, + + classRules: function(element) { + var rules = {}; + var classes = $(element).attr('class'); + classes && $.each(classes.split(' '), function() { + if (this in $.validator.classRuleSettings) { + $.extend(rules, $.validator.classRuleSettings[this]); + } + }); + return rules; + }, + + attributeRules: function(element) { + var rules = {}; + var $element = $(element); + + for (var method in $.validator.methods) { + var value = $element.attr(method); + if (value) { + rules[method] = value; + } + } + + // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs + if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) { + delete rules.maxlength; + } + + return rules; + }, + + metadataRules: function(element) { + if (!$.metadata) return {}; + + var meta = $.data(element.form, 'validator').settings.meta; + return meta ? + $(element).metadata()[meta] : + $(element).metadata(); + }, + + staticRules: function(element) { + var rules = {}; + var validator = $.data(element.form, 'validator'); + if (validator.settings.rules) { + rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; + } + return rules; + }, + + normalizeRules: function(rules, element) { + // handle dependency check + $.each(rules, function(prop, val) { + // ignore rule when param is explicitly false, eg. required:false + if (val === false) { + delete rules[prop]; + return; + } + if (val.param || val.depends) { + var keepRule = true; + switch (typeof val.depends) { + case "string": + keepRule = !!$(val.depends, element.form).length; + break; + case "function": + keepRule = val.depends.call(element, element); + break; + } + if (keepRule) { + rules[prop] = val.param !== undefined ? val.param : true; + } else { + delete rules[prop]; + } + } + }); + + // evaluate parameters + $.each(rules, function(rule, parameter) { + rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; + }); + + // clean number parameters + $.each(['minlength', 'maxlength', 'min', 'max'], function() { + if (rules[this]) { + rules[this] = Number(rules[this]); + } + }); + $.each(['rangelength', 'range'], function() { + if (rules[this]) { + rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; + } + }); + + if ($.validator.autoCreateRanges) { + // auto-create ranges + if (rules.min && rules.max) { + rules.range = [rules.min, rules.max]; + delete rules.min; + delete rules.max; + } + if (rules.minlength && rules.maxlength) { + rules.rangelength = [rules.minlength, rules.maxlength]; + delete rules.minlength; + delete rules.maxlength; + } + } + + // To support custom messages in metadata ignore rule methods titled "messages" + if (rules.messages) { + delete rules.messages; + } + + return rules; + }, + + // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} + normalizeRule: function(data) { + if( typeof data == "string" ) { + var transformed = {}; + $.each(data.split(/\s/), function() { + transformed[this] = true; + }); + data = transformed; + } + return data; + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/addMethod + addMethod: function(name, method, message) { + $.validator.methods[name] = method; + $.validator.messages[name] = message != undefined ? message : $.validator.messages[name]; + if (method.length < 3) { + $.validator.addClassRules(name, $.validator.normalizeRule(name)); + } + }, + + methods: { + + // http://docs.jquery.com/Plugins/Validation/Methods/required + required: function(value, element, param) { + // check if dependency is met + if ( !this.depend(param, element) ) + return "dependency-mismatch"; + switch( element.nodeName.toLowerCase() ) { + case 'select': + // could be an array for select-multiple or a string, both are fine this way + var val = $(element).val(); + return val && val.length > 0; + case 'input': + if ( this.checkable(element) ) + return this.getLength(value, element) > 0; + default: + return $.trim(value).length > 0; + } + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/remote + remote: function(value, element, param) { + + if ( this.optional(element) ) + return "dependency-mismatch"; + + var previous = this.previousValue(element); + if (!this.settings.messages[element.name] ) + this.settings.messages[element.name] = {}; + previous.originalMessage = this.settings.messages[element.name].remote; + this.settings.messages[element.name].remote = previous.message; + + param = typeof param == "string" && {url:param} || param; + + if ( this.pending[element.name] ) { + return "pending"; + } + if ( previous.old === value || param.ignoreRepeat) { + //if ( previous.old === value) { + return previous.valid; + } + + previous.old = value; + var validator = this; + + var data = {}; + data[element.name] = value; + $.ajax($.extend(true, { + url: param, + beforeSend : function() { + validator.startRequest(element); //“请求统计”下移到此处,防止自定义ajax验证无法调用stopRequest; + }, + mode: "abort", + port: "validate" + element.name, + dataType: "json", + data: data, + success: function(response) { + validator.settings.messages[element.name].remote = previous.originalMessage; + var valid = (response.state === 'success' ? true : false); //修改ajax成功标识 by linhao origin: var valid = response === true + if ( valid ) { + var submitted = validator.formSubmitted; + validator.prepareElement(element); + validator.formSubmitted = submitted; + validator.successList.push(element); + validator.showErrors(); + } else { + var errors = {}; + var message = response.message[0] || validator.defaultMessage( element, "remote" ); //修改ajax提示内容 by linhao 'response.message' origin: 'response' + errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; + validator.showErrors(errors); + } + previous.valid = valid; + validator.stopRequest(element, valid); + + + } + }, param)); + return "pending"; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/minlength + minlength: function(value, element, param) { + return this.optional(element) || this.getLength($.trim(value), element) >= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/maxlength + maxlength: function(value, element, param) { + return this.optional(element) || this.getLength($.trim(value), element) <= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/rangelength + rangelength: function(value, element, param) { + var length = this.getLength($.trim(value), element); + return this.optional(element) || ( length >= param[0] && length <= param[1] ); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/min + min: function( value, element, param ) { + return this.optional(element) || value >= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/max + max: function( value, element, param ) { + return this.optional(element) || value <= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/range + range: function( value, element, param ) { + return this.optional(element) || ( value >= param[0] && value <= param[1] ); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/email + email: function(value, element) { + // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ + return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/url + url: function(value, element) { + // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ + return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/date + date: function(value, element) { + return this.optional(element) || !/Invalid|NaN/.test(new Date(value)); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/dateISO + dateISO: function(value, element) { + return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/number + number: function(value, element) { + return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/digits + digits: function(value, element) { + return this.optional(element) || /^\d+$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/creditcard + // based on http://en.wikipedia.org/wiki/Luhn + creditcard: function(value, element) { + if ( this.optional(element) ) + return "dependency-mismatch"; + // accept only digits and dashes + if (/[^0-9-]+/.test(value)) + return false; + var nCheck = 0, + nDigit = 0, + bEven = false; + + value = value.replace(/\D/g, ""); + + for (var n = value.length - 1; n >= 0; n--) { + var cDigit = value.charAt(n); + var nDigit = parseInt(cDigit, 10); + if (bEven) { + if ((nDigit *= 2) > 9) + nDigit -= 9; + } + nCheck += nDigit; + bEven = !bEven; + } + + return (nCheck % 10) == 0; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/accept + accept: function(value, element, param) { + param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif"; + return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i")); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/equalTo + equalTo: function(value, element, param) { + // bind to the blur event of the target in order to revalidate whenever the target field is updated + // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead + var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { + $(element).valid(); + }); + return value == target.val(); + } + + } + +}); + +// deprecated, use $.validator.format instead +$.format = $.validator.format; + +})(jQuery); + +// ajax mode: abort +// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); +// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() +;(function($) { + var pendingRequests = {}; + // Use a prefilter if available (1.5+) + if ( $.ajaxPrefilter ) { + $.ajaxPrefilter(function(settings, _, xhr) { + var port = settings.port; + if (settings.mode == "abort") { + if ( pendingRequests[port] ) { + pendingRequests[port].abort(); + } + pendingRequests[port] = xhr; + } + }); + } else { + // Proxy ajax + var ajax = $.ajax; + $.ajax = function(settings) { + var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, + port = ( "port" in settings ? settings : $.ajaxSettings ).port; + if (mode == "abort") { + if ( pendingRequests[port] ) { + pendingRequests[port].abort(); + } + return (pendingRequests[port] = ajax.apply(this, arguments)); + } + return ajax.apply(this, arguments); + }; + } +})(jQuery); + +// provides cross-browser focusin and focusout events +// IE has native support, in other browsers, use event caputuring (neither bubbles) + +// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation +// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target +;(function($) { + // only implement if not provided by jQuery core (since 1.4) + // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs + if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) { + $.each({ + focus: 'focusin', + blur: 'focusout' + }, function( original, fix ){ + $.event.special[fix] = { + setup:function() { + this.addEventListener( original, handler, true ); + }, + teardown:function() { + this.removeEventListener( original, handler, true ); + }, + handler: function(e) { + arguments[0] = $.event.fix(e); + arguments[0].type = fix; + return $.event.handle.apply(this, arguments); + } + }; + function handler(e) { + e = $.event.fix(e); + e.type = fix; + return $.event.handle.call(this, e); + } + }); + }; + $.extend($.fn, { + validateDelegate: function(delegate, type, handler) { + return this.bind(type, function(event) { + var target = $(event.target); + if (target.is(delegate)) { + return handler.apply(target, arguments); + } + }); + } + }); +})(jQuery); + + + +//自定义validate扩展 +jQuery.extend(jQuery.validator.messages, { + required: "必选字段", + remote: "请修正该字段", + email: "请输入正确格式的电子邮件", + url: "请输入合法的网址", + date: "请输入合法的日期", + dateISO: "请输入合法的日期 (ISO).", + number: "请输入合法的数字", + digits: "只能输入整数", + creditcard: "请输入合法的信用卡号", + equalTo: "请再次输入相同的值", + accept: "请输入拥有合法后缀名的字符串", + maxlength: jQuery.validator.format("请输入一个长度最多是 {0} 的字符串"), + minlength: jQuery.validator.format("请输入一个长度最少是 {0} 的字符串"), + rangelength: jQuery.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"), + range: jQuery.validator.format("请输入一个介于 {0} 和 {1} 之间的值"), + max: jQuery.validator.format("请输入一个最大为 {0} 的值"), + min: jQuery.validator.format("请输入一个最小为 {0} 的值") +}); + +jQuery.validator.addMethod("regularExpression", function(value, element, param) { + if (element) { + var reg=new RegExp(param); + return reg.test(value); + } + else { + return false; + } +}, ""); + +jQuery.validator.addMethod("byteRangeLength", function(value, element, param) { +var length = value.length; + for (var i = 0; i < value.length; i++) { + if (value.charCodeAt(i) > 127) { + length++; + } + } + return this.optional(element) || (length >= param[0] && length <= param[1]); +}, "请确保输入的值在个字节之间(一个中文字算2个字节)"); + +jQuery.validator.addMethod("isMobile", function(value, element) { + var length = value.length; + return this.optional(element) || (length == 11 && /^(13[0-9]|15[0-9]|18[0-9])\d{8}$/.test(value)); +}, "请正确填写您的手机号码"); + +jQuery.validator.addMethod("telphone", function(value, element) { + var length = value.length; + return this.optional(element) || ( /^[\d|-]+$/.test(value)); +}, '格式错误,仅支持数字和符号“-”'); + +jQuery.validator.addMethod("zipcode", function(value, element) { + var length = value.length; + return this.optional(element) || ( /^[0-9]{6}$/.test(value)); +}, '格式错误,仅支持6位数字'); \ No newline at end of file diff --git a/updateLog/24.11.4 b/updateLog/24.11.4 deleted file mode 100644 index 9faf321..0000000 --- a/updateLog/24.11.4 +++ /dev/null @@ -1,8 +0,0 @@ -更新方式 -1、app文件夹整包上传覆盖 -2、替换 public\static\index\css\app.css和public\static\index\css\m.css -3、执行sql语句 -INSERT INTO `qf_conf` VALUES (52, 'is_quan', '0', '全网搜', '', 0, 2, '关闭=>0\n开启=>1', 1, 1, 1, 1, 1729928547, 1729928547); - -如何对接微信对话功能 -详情见 app\api\controller\Chatbot.php \ No newline at end of file