├── Plugin └── V2raySocks │ ├── config.php │ ├── templates │ ├── error.tpl │ ├── static │ │ ├── js │ │ │ ├── clipboard.min.js │ │ │ ├── html5-qrcode.js │ │ │ ├── script.js │ │ │ ├── layui.js │ │ │ └── qrcode.js │ │ ├── skin │ │ │ └── default │ │ │ │ ├── icon.png │ │ │ │ ├── icon-ext.png │ │ │ │ ├── loading-0.gif │ │ │ │ ├── loading-1.gif │ │ │ │ ├── loading-2.gif │ │ │ │ └── layer.css │ │ ├── css │ │ │ ├── layer.css │ │ │ ├── style.css │ │ │ └── layui.css │ │ ├── mobile │ │ │ ├── layer.js │ │ │ └── need │ │ │ │ └── layer.css │ │ ├── layer.css │ │ └── layer.js │ └── details.tpl │ ├── lib │ └── functions.php │ ├── osubscribe.php │ ├── subscribe.php │ ├── lang │ ├── chinese.php │ └── english.php │ ├── api.php │ ├── hooks.php │ └── V2raySocks.php ├── Sql └── MyV2Ray.sql └── README.md /Plugin/V2raySocks/config.php: -------------------------------------------------------------------------------- 1 | 2 |

{$usefulErrorHelper}

3 | -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/js/clipboard.min.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JerryChii/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/js/clipboard.min.js -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JerryChii/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/icon.png -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JerryChii/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/icon-ext.png -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JerryChii/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/loading-0.gif -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JerryChii/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/loading-1.gif -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JerryChii/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/loading-2.gif -------------------------------------------------------------------------------- /Plugin/V2raySocks/lib/functions.php: -------------------------------------------------------------------------------- 1 | mysql_real_escape_string($_SESSION[$field]))); 30 | if($data = mysql_fetch_row($sqlresult)){ 31 | return reset($data); 32 | } 33 | return false; 34 | }catch(Exception $e){ 35 | logModuleCall('V2raySocks', 'V2raySocks_MultiLanguageSupport', $field, $e->getMessage(), $e->getTraceAsString()); 36 | return false; 37 | } 38 | } 39 | 40 | function V2raySocks_get_lang($var){ 41 | global $_VLANG; 42 | return isset($_VLANG[$var]) ? $_VLANG[$var] : $var . '(Missing Language)' ; 43 | } 44 | -------------------------------------------------------------------------------- /Plugin/V2raySocks/osubscribe.php: -------------------------------------------------------------------------------- 1 | where('id', $sid)->where('username', $token)->first(); 8 | if (empty($service)){ 9 | die('Unisset or Uncorrect Token'); 10 | } 11 | if ($service->domainstatus != 'Active' ) { 12 | die('Not Active'); 13 | } 14 | $package = Capsule::table('tblproducts')->where('id', $service->packageid)->first(); 15 | $server = Capsule::table('tblservers')->where('id', $service->server)->first(); 16 | 17 | $dbhost = $server->ipaddress ? $server->ipaddress : 'localhost'; 18 | $dbname = $package->configoption1; 19 | $dbuser = $server->username; 20 | $dbpass = decrypt($server->password); 21 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 22 | $usage = $db->prepare('SELECT * FROM `user` WHERE `sid` = :sid'); 23 | $usage->bindValue(':sid', $sid); 24 | $usage->execute(); 25 | $usage = $usage->fetch(); 26 | $servers = $package->configoption4; 27 | $noder = explode("\n",$servers); 28 | $results = ""; 29 | foreach($noder as $nodee){ 30 | $nodee = explode('|', $nodee); 31 | $results .= make_vmess($nodee,$usage['uuid']) . PHP_EOL; 32 | } 33 | echo(str_replace('=','',base64_encode($results))); 34 | }else{ 35 | die('Invaild'); 36 | } 37 | 38 | function make_vmess($nodee,$uuid){ 39 | $atr1 = array( 40 | "add" => $nodee[1], 41 | "host"=> $nodee[5], 42 | "id" => $uuid, 43 | "net" => $nodee[7], 44 | "path"=> $nodee[6], 45 | "port"=> $nodee[2], 46 | "ps" => $nodee[0], 47 | "tls" => $nodee[4], 48 | "v" => 2 49 | ); 50 | if ($nodee[9]){ 51 | $atr1['aid'] = intval($nodee[9]); 52 | }else{ 53 | $atr1['aid'] = 64; 54 | } 55 | if($nodee[3]){ 56 | $atr1['type'] = $nodee[3]; 57 | }else{ 58 | $atr1['type'] = "none"; 59 | } 60 | return "vmess://".base64_encode(json_encode($atr1)); 61 | } -------------------------------------------------------------------------------- /Plugin/V2raySocks/subscribe.php: -------------------------------------------------------------------------------- 1 | where('id', $sid)->where('username', $token)->first(); 8 | if (empty($service)){ 9 | die('Unisset or Uncorrect Token'); 10 | } 11 | if ($service->domainstatus != 'Active' ) { 12 | die('Not Active'); 13 | } 14 | $package = Capsule::table('tblproducts')->where('id', $service->packageid)->first(); 15 | $server = Capsule::table('tblservers')->where('id', $service->server)->first(); 16 | 17 | $dbhost = $server->ipaddress ? $server->ipaddress : 'localhost'; 18 | $dbname = $package->configoption1; 19 | $dbuser = $server->username; 20 | $dbpass = decrypt($server->password); 21 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 22 | $usage = $db->prepare('SELECT * FROM `user` WHERE `sid` = :sid'); 23 | $usage->bindValue(':sid', $sid); 24 | $usage->execute(); 25 | $usage = $usage->fetch(); 26 | $servers = $package->configoption4; 27 | $noder = explode("\n",$servers); 28 | $results = ""; 29 | foreach($noder as $nodee){ 30 | $nodee = explode('|', $nodee); 31 | $results .= make_vmess($nodee,$usage['uuid']) . PHP_EOL; 32 | } 33 | echo(str_replace('=','',base64_encode($results))); 34 | }else{ 35 | die('Invaild'); 36 | } 37 | 38 | function make_vmess($nodee,$uuid){ 39 | $atr2 = array( 40 | "add" => $nodee[1], 41 | "file"=> $nodee[5], 42 | "id" => $uuid, 43 | "net" => $nodee[7], 44 | "host"=> $nodee[6], 45 | "port"=> $nodee[2], 46 | "ps" => $nodee[0], 47 | "tls" => $nodee[4], 48 | "v" => 2 49 | ); 50 | if ($nodee[9]){ 51 | $atr2['aid'] = intval($nodee[9]); 52 | }else{ 53 | $atr2['aid'] = 64; 54 | } 55 | if($nodee[3]){ 56 | $atr2['type'] = $nodee[3]; 57 | }else{ 58 | $atr2['type'] = "none"; 59 | } 60 | return "vmess://".base64_encode(json_encode($atr2)); 61 | } -------------------------------------------------------------------------------- /Sql/MyV2Ray.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.4.15.6 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: 2018-05-22 14:14:35 7 | -- 服务器版本: 5.5.56-log 8 | -- PHP Version: 7.0.19 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET time_zone = "+00:00"; 12 | 13 | 14 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 15 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 16 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 17 | /*!40101 SET NAMES utf8mb4 */; 18 | 19 | -- 20 | -- Database: `MyV2Ray` 21 | -- 22 | 23 | -- -------------------------------------------------------- 24 | 25 | -- 26 | -- 表的结构 `user` 27 | -- 28 | 29 | CREATE TABLE IF NOT EXISTS `user` ( 30 | `id` int(11) NOT NULL, 31 | `uuid` varchar(36) NOT NULL, 32 | `t` int(11) NOT NULL DEFAULT '0', 33 | `u` bigint(20) NOT NULL, 34 | `d` bigint(20) NOT NULL, 35 | `transfer_enable` bigint(20) NOT NULL, 36 | `enable` tinyint(4) NOT NULL DEFAULT '1', 37 | `created_at` int(10) NOT NULL, 38 | `updated_at` int(10) NOT NULL, 39 | `need_reset` tinyint(1) NOT NULL DEFAULT '1', 40 | `sid` int(11) NOT NULL 41 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 42 | 43 | -- -------------------------------------------------------- 44 | 45 | -- 46 | -- 表的结构 `user_usage` 47 | -- 48 | 49 | CREATE TABLE IF NOT EXISTS `user_usage` ( 50 | `sid` int(11) NOT NULL, 51 | `date` int(11) NOT NULL, 52 | `upload` text NOT NULL, 53 | `download` text NOT NULL, 54 | `tupload` text NOT NULL, 55 | `tdownload` text NOT NULL 56 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; 57 | 58 | -- 59 | -- Indexes for dumped tables 60 | -- 61 | 62 | -- 63 | -- Indexes for table `user` 64 | -- 65 | ALTER TABLE `user` 66 | ADD PRIMARY KEY (`id`); 67 | 68 | -- 69 | -- AUTO_INCREMENT for dumped tables 70 | -- 71 | 72 | -- 73 | -- AUTO_INCREMENT for table `user` 74 | -- 75 | ALTER TABLE `user` 76 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; 77 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 78 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 79 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # V2RaySocks 2 | ## 一个售卖v2Ray的whmcs插件 3 | * 当前版本 0.8.2 4 | 5 | ## 支持的功能: 6 | * 流量图表(已修复自动任务过于频繁导致记录过多的问题(目前记录频率:3小时一次(已经改为跟随WHMCS系统的自动任务进行,不需要手动设置))) 7 | * 流量重置(每月开始,每月底,由结算日计算(已经改为跟随WHMCS系统的自动任务进行,不需要手动设置)) 8 | * 公告信息(已修复HTML问题) 9 | * VMESS 二维码(已更新多端兼容) 10 | * VMESS URL复制功能 11 | * VMESS 订阅功能 12 | * 随机UUID,重置UUID,复制UUID 13 | * tls,伪装类型,Host,传输协议,路径,流量倍率,额外ID可在服务器设置中设置(不支持则留空) 14 | * 线路列表格式修改,请还是注意修正!!!! 15 | * 添加了API支持(V0.2) 16 | * 修正了部分情况下API异常 17 | * 优化了流量图表的显示(Tab显示) 18 | 19 | ## API 20 | * API的校验密码可在api.php中修改 21 | * API返回数据格式: 22 | ``` 23 | { 24 | "result" : "success", 25 | "email" : "123@123.moe", 26 | "name" : "1234", 27 | "package": [ 28 | "0" : [ 29 | "package": "40g套餐", 30 | "uuid" : "09FD9959-5F82-41F7-967F-87AFDF31AFF6", 31 | "usage" : "1000", 32 | "traffic": "40960000000", 33 | "nodes" : [ 34 | "0" : "hk1|127.0.0.1|8300|none|tls|233.233.com|/233|ws|1", 35 | "1" : "hk2|127.0.0.1|8300|none|tls|233.233.com|/233|ws|1" 36 | ] 37 | ], 38 | "1" : [ 39 | "package": "100g套餐", 40 | "uuid" : "41DA057F-A3E6-424F-BEEC-38E0D58A6536", 41 | "usage" : "10000", 42 | "traffic": "1099511627776", 43 | "nodes" : [ 44 | "0" : "hk1|127.0.0.1|8300|none|tls|233.233.com|/233|ws|1" 45 | ] 46 | ] 47 | } 48 | ``` 49 | 50 | ## 注意事项 51 | * 已更新自动流量更新功能以及自动重置流量功能。请注意刷新hook以保证模块正常运行! 52 | * 需要更多支持,请开issue或者给我发邮件 53 | 54 | ## 当前适配的Manager版本以及支持的功能 55 | * 版本 Gold - 1.1.2.3 56 | * 拉取V2raySocks的数据库 57 | * 通过数据库信息添加用户 58 | * 通过数据库信息删除用户 59 | * 上传流量至数据库 60 | * 自动关闭超出流量的用户 61 | * 支持流量倍率功能 62 | * UUID重置自动更新 63 | * 支持命令行参数启动 64 | * 支持后台运行 65 | * 支持日志保存 66 | * 检测V2Ray进程并自动重启V2Ray 67 | * 开启时检测V2Ray更新 68 | * 自动检测并安装V2ray 69 | * 获取系统内存状态 70 | * 进程超时状态检测 71 | * 远程状态监控 72 | 73 | ## Manager远程状态监控返回示例 74 | * 访问 127.0.0.1:8888/status 75 | ``` 76 | { 77 | "LoadMin1":"0.00", 78 | "LoadMin5":"0.00", 79 | "LoadMin15":"0.00", 80 | "M2Version":"Gold - V1.1.2.3", 81 | "RX":"7332", 82 | "SelfMemoryUsed":"2", 83 | "Status":"Success", 84 | "SystemMemoryAll":"996", 85 | "SystemMemoryUsed":"684", 86 | "TX":"7444", 87 | "Timestamp":"1531112247", 88 | "Uptime":"93", 89 | "V2RayUsers":"7" 90 | } 91 | ``` 92 | 93 | ## 捐赠 94 | ETH钱包 0xaD8ABb15e4B8B58f5FbEE9CAb42096c1d640C234 95 | 链克钱包 0x4cfa7215324f2cc521beeb35c8a85c9afdbcda7e -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/js/html5-qrcode.js: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------- 2 | // JavaScript-HTML5 QRCode Generator 3 | // 4 | // Copyright (c) 2011 Amanuel Tewolde 5 | // 6 | // Licensed under the MIT license: 7 | // http://www.opensource.org/licenses/mit-license.php 8 | // 9 | //--------------------------------------------------------------------- 10 | 11 | // Generates a QRCode of text provided. 12 | // First QRCode is rendered to a canvas. 13 | // The canvas is then turned to an image PNG 14 | // before being returned as an tag. 15 | function showQRCode(text) { 16 | 17 | 18 | var dotsize = 3; // size of box drawn on canvas 19 | var padding = 10; // (white area around your QRCode) 20 | var black = "rgb(0,0,0)"; 21 | var white = "rgb(255,255,255)"; 22 | var QRCodeVersion = 15; // 1-40 see http://www.denso-wave.com/qrcode/qrgene2-e.html 23 | 24 | var canvas=document.createElement('canvas'); 25 | var qrCanvasContext = canvas.getContext('2d'); 26 | try { 27 | // QR Code Error Correction Capability 28 | // Higher levels improves error correction capability while decreasing the amount of data QR Code size. 29 | // QRErrorCorrectLevel.L (5%) QRErrorCorrectLevel.M (15%) QRErrorCorrectLevel.Q (25%) QRErrorCorrectLevel.H (30%) 30 | // eg. L can survive approx 5% damage...etc. 31 | var qr = new QRCode(QRCodeVersion, QRErrorCorrectLevel.L); 32 | qr.addData(text); 33 | qr.make(); 34 | } 35 | catch(err) { 36 | var errorChild = document.createElement("p"); 37 | var errorMSG = document.createTextNode("QR Code FAIL! " + err); 38 | errorChild.appendChild(errorMSG); 39 | return errorChild; 40 | } 41 | 42 | var qrsize = qr.getModuleCount(); 43 | canvas.setAttribute('height',(qrsize * dotsize) + padding); 44 | canvas.setAttribute('width',(qrsize * dotsize) + padding); 45 | var shiftForPadding = padding/2; 46 | if (canvas.getContext){ 47 | for (var r = 0; r < qrsize; r++) { 48 | for (var c = 0; c < qrsize; c++) { 49 | if (qr.isDark(r, c)) 50 | qrCanvasContext.fillStyle = black; 51 | else 52 | qrCanvasContext.fillStyle = white; 53 | qrCanvasContext.fillRect ((c*dotsize) +shiftForPadding,(r*dotsize) + shiftForPadding,dotsize,dotsize); // x, y, w, h 54 | } 55 | } 56 | } 57 | 58 | var imgElement = document.createElement("img"); 59 | imgElement.src = canvas.toDataURL("image/png"); 60 | 61 | return imgElement; 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/js/script.js: -------------------------------------------------------------------------------- 1 | var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 2 | function base64encode(str) { 3 | var out, i, len; 4 | var c1, c2, c3; 5 | len = str.length; 6 | i = 0; 7 | out = ""; 8 | while (i < len) { 9 | c1 = str.charCodeAt(i++) & 0xff; 10 | if (i == len) { 11 | out += base64EncodeChars.charAt(c1 >> 2); 12 | out += base64EncodeChars.charAt((c1 & 0x3) << 4); 13 | out += "=="; 14 | break; 15 | } 16 | c2 = str.charCodeAt(i++); 17 | if (i == len) { 18 | out += base64EncodeChars.charAt(c1 >> 2); 19 | out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); 20 | out += base64EncodeChars.charAt((c2 & 0xF) << 2); 21 | out += "="; 22 | break; 23 | } 24 | c3 = str.charCodeAt(i++); 25 | out += base64EncodeChars.charAt(c1 >> 2); 26 | out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); 27 | out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6)); 28 | out += base64EncodeChars.charAt(c3 & 0x3F); 29 | } 30 | return out; 31 | } 32 | $(document).ready(function() { 33 | jQuery(document).ready(function($) { 34 | $("button[name='qrcode']").on('click',function() { 35 | str = $(this).attr('data-params'); 36 | var tcontent = '
'; 37 | tcontent += ''; 46 | layer.open({ 47 | type: 1, 48 | title: $(this).attr('data-type'), 49 | offset: 'auto', 50 | closeBtn: 1, 51 | shadeClose: true, 52 | content: tcontent 53 | }); 54 | }); 55 | $("button[name='url']").on('click',function() { 56 | str = $(this).attr('data-params'); 57 | bty = $(this).attr('data-unit'); 58 | done = $(this).attr('data-done'); 59 | var clipboard = new Clipboard( bty , { 60 | text: function() { 61 | return str; 62 | } 63 | }); 64 | clipboard.on('success', function(e) { 65 | layer.alert(done); 66 | }); 67 | }); 68 | }); 69 | }); 70 | -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/css/layer.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #FFFFFF; 3 | } 4 | /* font */ 5 | .plugin { 6 | font-family: "Microsoft Yahei",Arial; 7 | font-size: 14px; 8 | } 9 | .plugin .alt.gray-bg { 10 | background: #474751; 11 | } 12 | .plugin .profile-nav .user-heading { 13 | color: #fff; 14 | border-radius: 4px 4px 0 0; 15 | -webkit-border-radius: 4px 4px 0 0; 16 | padding: 30px; 17 | text-align: center; 18 | } 19 | .plugin .profile-nav ul > li > a { 20 | border-radius: 0; 21 | -webkit-border-radius: 0; 22 | color: #89817f; 23 | } 24 | .plugin .profile-nav .user-heading a img { 25 | width: 112px; 26 | height: 112px; 27 | border-radius: 50%; 28 | -webkit-border-radius: 50%; 29 | } 30 | .plugin .user-heading.alt a img { 31 | width: 85px; 32 | height: 85px; 33 | border-radius: 50%; 34 | -webkit-border-radius: 50%; 35 | } 36 | .plugin .user-heading.alt a { 37 | float: left; 38 | margin-right: 15px; 39 | margin-left: -10px; 40 | display: inline-block; 41 | border: 5px solid rgba(255,255,255,0.3); 42 | border-radius: 50%; 43 | -webkit-border-radius: 50%; 44 | } 45 | .plugin .profile-nav .user-heading h1 { 46 | font-size: 20px; 47 | font-weight: 300; 48 | margin-bottom: 5px; 49 | } 50 | .plugin .profile-nav .user-heading p { 51 | font-size: 16px; 52 | color: #8b8b8b; 53 | line-height: 25px; 54 | } 55 | .plugin .user-heading.alt { 56 | display: inline-block; 57 | width: 100%; 58 | text-align: left; 59 | } 60 | .plugin .panel-heading { 61 | border-color: #eff2f7; 62 | font-size: 14px; 63 | font-weight: 400; 64 | background: #fafafa; 65 | text-transform: uppercase; 66 | padding: 15px; 67 | } 68 | .plugin .progress-sm,.plugin .progress-xs { 69 | height: 10px; 70 | } 71 | .plugin .progress { 72 | border-radius: 50px; 73 | -webkit-border-radius: 50px; 74 | box-shadow: none; 75 | } 76 | .plugin .table thead > tr > th, .table tbody > tr > th, .table tfoot > tr > th, .table thead > tr > td, .table tbody > tr > td, .table tfoot > tr > td { 77 | padding: 10px; 78 | } 79 | .plugin .btn-primary { 80 | background-color: #1fb5ad; 81 | border-color: #1fb5ad; 82 | color: #FFFFFF; 83 | } 84 | .plugin .badge-primary { 85 | background-color: #1fb5ad; 86 | color: #FFFFFF; 87 | } 88 | .plugin .badge-danger { 89 | background-color: #F24A4A; 90 | color: #FFFFFF; 91 | } 92 | .plugin #qrcode { 93 | display: none; 94 | width: 300px; 95 | position: fixed; 96 | top: calc(50% - 300px); 97 | left: 50%; 98 | 99 | } 100 | .plugin #qrcode img { 101 | width: 100%; 102 | } 103 | .plugin a { 104 | color: #89817f; 105 | } 106 | .table>tbody>tr>td { 107 | padding-left: 15px !important; 108 | } -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ededed; 3 | } 4 | /* font */ 5 | .plugin { 6 | font-family: "Microsoft Yahei",Arial; 7 | font-size: 14px; 8 | } 9 | .plugin .alt.gray-bg { 10 | background: #ffffff; 11 | } 12 | .plugin .profile-nav .user-heading { 13 | color: #fff; 14 | border-radius: 4px 4px 0 0; 15 | -webkit-border-radius: 4px 4px 0 0; 16 | padding: 30px; 17 | text-align: center; 18 | } 19 | .plugin .profile-nav ul > li > a { 20 | border-radius: 0; 21 | -webkit-border-radius: 0; 22 | color: #89817f; 23 | } 24 | .plugin .profile-nav .user-heading a img { 25 | width: 112px; 26 | height: 112px; 27 | border-radius: 50%; 28 | -webkit-border-radius: 50%; 29 | } 30 | .plugin .user-heading.alt a img { 31 | width: 85px; 32 | height: 85px; 33 | border-radius: 50%; 34 | -webkit-border-radius: 50%; 35 | } 36 | .plugin .user-heading.alt a { 37 | float: left; 38 | margin-right: 15px; 39 | margin-left: -10px; 40 | display: inline-block; 41 | border: 5px solid rgba(255,255,255,0.3); 42 | border-radius: 50%; 43 | -webkit-border-radius: 50%; 44 | } 45 | .plugin .profile-nav .user-heading h1 { 46 | font-size: 20px; 47 | font-weight: 300; 48 | margin-bottom: 5px; 49 | } 50 | .plugin .profile-nav .user-heading p { 51 | font-size: 16px; 52 | color: #8b8b8b; 53 | line-height: 25px; 54 | } 55 | .plugin .user-heading.alt { 56 | display: inline-block; 57 | width: 100%; 58 | text-align: left; 59 | } 60 | .plugin .panel-heading { 61 | border-color: #eff2f7; 62 | font-size: 14px; 63 | font-weight: 400; 64 | background: #fafafa; 65 | text-transform: uppercase; 66 | padding: 15px; 67 | } 68 | .plugin .progress-sm,.plugin .progress-xs { 69 | height: 10px; 70 | } 71 | .plugin .progress { 72 | border-radius: 50px; 73 | -webkit-border-radius: 50px; 74 | box-shadow: none; 75 | } 76 | .plugin .table thead > tr > th, .table tbody > tr > th, .table tfoot > tr > th, .table thead > tr > td, .table tbody > tr > td, .table tfoot > tr > td { 77 | padding: 10px; 78 | } 79 | .plugin .btn-primary { 80 | background-color: #1fb5ad; 81 | border-color: #1fb5ad; 82 | color: #FFFFFF; 83 | } 84 | .plugin .badge-primary { 85 | background-color: #1fb5ad; 86 | color: #FFFFFF; 87 | } 88 | .plugin .badge-danger { 89 | background-color: #F24A4A; 90 | color: #FFFFFF; 91 | } 92 | .plugin #qrcode { 93 | display: none; 94 | width: 300px; 95 | position: fixed; 96 | top: calc(50% - 300px); 97 | left: 50%; 98 | 99 | } 100 | .plugin #qrcode img { 101 | width: 100%; 102 | } 103 | .plugin a { 104 | color: #89817f; 105 | } 106 | .table>tbody>tr>td { 107 | padding-left: 15px !important; 108 | } -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/mobile/layer.js: -------------------------------------------------------------------------------- 1 | /*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */ 2 | ;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'

'+(e?n.title[0]:n.title)+"

":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e=''+n.btn[0]+"",2===t&&(e=''+n.btn[1]+""+e),'
'+e+"
"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='

'+(n.content||"")+"

"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"
':"")+'
"+l+'
'+n.content+"
"+c+"
",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;odiv{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/js/layui.js: -------------------------------------------------------------------------------- 1 | /** layui-v1.0.9_rls MIT License By http://www.layui.com */ 2 | ;!function(e){"use strict";var t=function(){this.v="1.0.9_rls"};t.fn=t.prototype;var n=document,o=t.fn.cache={},i=function(){var e=n.scripts,t=e[e.length-1].src;return t.substring(0,t.lastIndexOf("/")+1)}(),r=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},l="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),a={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",tree:"modules/tree",table:"modules/table",element:"modules/element",util:"modules/util",flow:"modules/flow",carousel:"modules/carousel",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"dest/layui.all"};o.modules={},o.status={},o.timeout=10,o.event={},t.fn.define=function(e,t){var n=this,i="function"==typeof e,r=function(){return"function"==typeof t&&t(function(e,t){layui[e]=t,o.status[e]=!0}),this};return i&&(t=e,e=[]),layui["layui.all"]||!layui["layui.all"]&&layui["layui.mobile"]?r.call(n):(n.use(e,r),n)},t.fn.use=function(e,t,u){function s(e,t){var n="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||n.test((e.currentTarget||e.srcElement).readyState))&&(o.modules[m]=t,y.removeChild(p),function i(){return++v>1e3*o.timeout/4?r(m+" is not a valid module"):void(o.status[m]?c():setTimeout(i,4))}())}function c(){u.push(layui[m]),e.length>1?f.use(e.slice(1),t,u):"function"==typeof t&&t.apply(layui,u)}var f=this,d=o.dir=o.dir?o.dir:i,y=n.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(f.each(e,function(t,n){"jquery"===n&&e.splice(t,1)}),layui.jquery=jQuery);var m=e[0],v=0;if(u=u||[],o.host=o.host||(d.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&a[m]||!layui["layui.all"]&&layui["layui.mobile"]&&a[m])return c(),f;var p=n.createElement("script"),h=(a[m]?d+"lay/":o.base||"")+(f.modules[m]||m)+".js";return p.async=!0,p.charset="utf-8",p.src=h+function(){var e=o.version===!0?o.v||(new Date).getTime():o.version||"";return e?"?v="+e:""}(),o.modules[m]?!function g(){return++v>1e3*o.timeout/4?r(m+" is not a valid module"):void("string"==typeof o.modules[m]&&o.status[m]?c():setTimeout(g,4))}():(y.appendChild(p),!p.attachEvent||p.attachEvent.toString&&p.attachEvent.toString().indexOf("[native code")<0||l?p.addEventListener("load",function(e){s(e,h)},!1):p.attachEvent("onreadystatechange",function(e){s(e,h)})),o.modules[m]=h,f},t.fn.getStyle=function(t,n){var o=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return o[o.getPropertyValue?"getPropertyValue":"getAttribute"](n)},t.fn.link=function(e,t,i){var l=this,a=n.createElement("link"),u=n.getElementsByTagName("head")[0];"string"==typeof t&&(i=t);var s=(i||e).replace(/\.|\//g,""),c=a.id="layuicss-"+s,f=0;a.rel="stylesheet",a.href=e+(o.debug?"?v="+(new Date).getTime():""),a.media="all",n.getElementById(c)||u.appendChild(a),"function"==typeof t&&!function d(){return++f>1e3*o.timeout/100?r(e+" timeout"):void(1989===parseInt(l.getStyle(n.getElementById(c),"width"))?function(){t()}():setTimeout(d,100))}()},t.fn.addcss=function(e,t,n){layui.link(o.dir+"css/"+e,t,n)},t.fn.img=function(e,t,n){var o=new Image;return o.src=e,o.complete?t(o):(o.onload=function(){o.onload=null,t(o)},void(o.onerror=function(e){o.onerror=null,n(e)}))},t.fn.config=function(e){e=e||{};for(var t in e)o[t]=e[t];return this},t.fn.modules=function(){var e={};for(var t in a)e[t]=a[t];return e}(),t.fn.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?r("模块名 "+n+" 已被占用"):t.modules[n]=e[n];return t},t.fn.router=function(e){for(var t,n=(e||location.hash).replace(/^#/,"").split("/")||[],o={dir:[]},i=0;i "error", "message" => "Unknown Error" ); 6 | $input = false; 7 | if($_GET['data']){ 8 | $data = str_replace(" ", "+", $_GET['data']); 9 | $input = json_decode(V2RaySocks_API_ucAuthcode($data, "DECODE", $uckey),true); 10 | } 11 | if(is_array($input) && !empty($input) && V2RaySocks_API_checkInput($input)){ 12 | $email = $input['email']; 13 | $password = $input['password']; 14 | $password = WHMCS\Input\Sanitize::decode($password); 15 | $authentication = new WHMCS\Authentication\Client($email, $password); 16 | if($authentication->verifyFirstFactor()){ 17 | $user = $authentication->getUser(); 18 | $apiresults = array( "result" => "success", "name" => $user->firstname, "email" => $user->email, "package" => array()); 19 | $query = V2RaySocks_API_queryToArray(\WHMCS\Database\Capsule::table('tblhosting')->where('userid', $user->id)->get()); 20 | $products = V2RaySocks_API_RebuildProductArray(V2RaySocks_API_queryToArray(\WHMCS\Database\Capsule::table('tblproducts')->where('servertype', 'V2raySocks')->get())); 21 | $servers = V2RaySocks_API_queryToArray(\WHMCS\Database\Capsule::table('tblservers')->where('type', 'V2raySocks')->get()); 22 | if(!empty($query)){ 23 | $serverid = array(); 24 | foreach($servers as $ser){ 25 | $mysql = new mysqli($ser['ipaddress'], $ser['username'], decrypt($ser['password'])); 26 | $servername = 'mysqlserver'.$ser['id']; 27 | $$servername = $mysql; 28 | $serverid[$ser['id']] = array(); 29 | } 30 | foreach ($query as $queryq) { 31 | if(isset($serverid[$queryq['server']]) && isset($products[$queryq['packageid']])){ 32 | $sid = $queryq['server']; 33 | $mysql = 'mysqlserver'.$sid; 34 | $sql = $$mysql; 35 | $sql->select_db($products[$queryq['packageid']]['configoption1']); 36 | $resultsql = "SELECT * FROM `user` where `sid` = ". $queryq['id']; 37 | $result = mysqli_fetch_array($sql->query($resultsql),MYSQLI_ASSOC); 38 | $node = explode("\n",$products[$queryq['packageid']]['configoption4']); 39 | $apiresults['package'][] = array( 40 | "package" => $products[$queryq['packageid']]['name'], 41 | "uuid" => $result['uuid'], 42 | "usage" => $result['u'] + $result['d'], 43 | "traffic" => $result['transfer_enable'], 44 | "nodes" => $node 45 | ); 46 | } 47 | } 48 | } 49 | }else{ 50 | $apiresults = array( "result" => "error", "message" => "Email or Password Invalid" ); 51 | } 52 | }else{ 53 | $apiresults = array( "result" => "error", "message" => "Illegal Data" ); 54 | } 55 | echo(V2RaySocks_API_LicenseEncodePart(V2RaySocks_API_ucAuthcode(json_encode($apiresults), 'ENCODE', $uckey), $key)); 56 | 57 | function V2RaySocks_API_RebuildProductArray($query){ 58 | $products = array(); 59 | foreach ($query as $product) { 60 | $products[$product['id']] = $product; 61 | } 62 | return $products; 63 | } 64 | 65 | function V2RaySocks_API_queryToArray($query){ 66 | $products = array(); 67 | foreach ($query as $product) { 68 | $producta = array(); 69 | foreach($product as $k => $produc){ 70 | $producta[$k] = $produc; 71 | } 72 | $products[] = $producta; 73 | } 74 | return $products; 75 | } 76 | 77 | function V2RaySocks_API_checkInput($input){ 78 | if(isset($input['email']) && isset($input['password'])){ 79 | return true; 80 | } 81 | return false; 82 | } 83 | 84 | function V2RaySocks_API_ucAuthcode($str, $operation = "DECODE", $key = "", $expiry = 0){ 85 | $ckey_length = 4; 86 | $key = md5($key); 87 | $keya = md5(substr($key, 0, 16)); 88 | $keyb = md5(substr($key, 16, 16)); 89 | $keyc = ($ckey_length ? ($operation == "DECODE" ? substr($str, 0, $ckey_length) : substr(md5(microtime()), 0 - $ckey_length)) : ""); 90 | $cryptkey = $keya . md5($keya . $keyc); 91 | $key_length = strlen($cryptkey); 92 | $str = ($operation == "DECODE" ? base64_decode(substr($str, $ckey_length)) : sprintf("%010d", ($expiry ? $expiry + time() : 0)) . substr(md5($str . $keyb), 0, 16) . $str); 93 | $str_length = strlen($str); 94 | $result = ""; 95 | $box = range(0, 255); 96 | $rndkey = array( ); 97 | for( $i = 0; $i <= 255; $i++ ) 98 | { 99 | $rndkey[$i] = ord($cryptkey[$i % $key_length]); 100 | } 101 | for( $j = $i = 0; $i < 256; $i++ ) 102 | { 103 | $j = ($j + $box[$i] + $rndkey[$i]) % 256; 104 | $tmp = $box[$i]; 105 | $box[$i] = $box[$j]; 106 | $box[$j] = $tmp; 107 | } 108 | for( $a = $j = $i = 0; $i < $str_length; $i++ ) 109 | { 110 | $a = ($a + 1) % 256; 111 | $j = ($j + $box[$a]) % 256; 112 | $tmp = $box[$a]; 113 | $box[$a] = $box[$j]; 114 | $box[$j] = $tmp; 115 | $result .= chr(ord($str[$i]) ^ $box[($box[$a] + $box[$j]) % 256]); 116 | } 117 | if( $operation == "DECODE" ) 118 | { 119 | if( (substr($result, 0, 10) == 0 || 0 < substr($result, 0, 10) - time()) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16) ) 120 | { 121 | return substr($result, 26); 122 | } 123 | 124 | return ""; 125 | } 126 | 127 | return $keyc . str_replace("=", "", base64_encode($result)); 128 | } 129 | 130 | function V2RaySocks_API_licenseDecodePart($string, $key){ 131 | $key = sha1($key); 132 | $strLen = strlen($string); 133 | $keyLen = strlen($key); 134 | $i = 0; 135 | while( $i < $strLen ) 136 | { 137 | $ordStr = hexdec(base_convert(strrev(substr($string, $i, 2)), 36, 16)); 138 | if( $j == $keyLen ) 139 | { 140 | $j = 0; 141 | } 142 | 143 | $ordKey = ord(substr($key, $j, 1)); 144 | $j++; 145 | $hash .= chr($ordStr - $ordKey); 146 | $i += 2; 147 | } 148 | return $hash; 149 | } 150 | 151 | function V2RaySocks_API_LicenseEncodePart($string, $key){ 152 | $key = sha1($key); 153 | $strLen = strlen($string); 154 | $keyLen = strlen($key); 155 | $i = 0; 156 | $j = 0; 157 | $hash = ''; 158 | while( $i < $strLen ) 159 | { 160 | $ordStr = ord(substr($string, $i, 1)); 161 | 162 | if( $j == $keyLen ) 163 | { 164 | $j = 0; 165 | } 166 | 167 | $ordKey = ord(substr($key, $j, 1)); 168 | $j++; 169 | 170 | $hash .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36)); 171 | 172 | $i += 1; 173 | } 174 | return $hash; 175 | } -------------------------------------------------------------------------------- /Plugin/V2raySocks/hooks.php: -------------------------------------------------------------------------------- 1 | where('servertype', 'V2raySocks')->get(); 6 | $query2 = \WHMCS\Database\Capsule::table('tblhosting')->get(); 7 | $query3 = \WHMCS\Database\Capsule::table('tblservers')->where('type', 'V2raySocks')->get(); 8 | $products = V2RaySocks_QueryToArray($query); 9 | $clients = V2RaySocks_QueryToArray($query2); 10 | $servers = V2RaySocks_QueryToArray($query3); 11 | $pids = V2RaySocks_prase_pid($products); 12 | $pro = V2RaySocks_get_client_products_with_pids($clients,$pids,array('Active','Suspended')); 13 | $pro = V2RaySocks_update_network($pro,$servers,V2RaySocks_prase_product_DB($products),$products); 14 | }catch (Exception $e){ 15 | } 16 | }); 17 | 18 | add_hook('AfterCronJob', 1, function() { 19 | try { 20 | $query = \WHMCS\Database\Capsule::table('tblproducts')->where('servertype', 'V2raySocks')->get(); 21 | $query2 = \WHMCS\Database\Capsule::table('tblhosting')->get(); 22 | $query3 = \WHMCS\Database\Capsule::table('tblservers')->where('type', 'V2raySocks')->get(); 23 | $products = V2RaySocks_QueryToArray($query); 24 | $clients = V2RaySocks_QueryToArray($query2); 25 | $servers = V2RaySocks_QueryToArray($query3); 26 | $pids = V2RaySocks_prase_pid($products); 27 | $pro = V2RaySocks_get_client_products_with_pids($clients,$pids,array('Active','Suspended')); 28 | $rproducts = V2RaySocks_RebuildProductArray($products); 29 | $pro = V2RaySocks_CalcBandReset($pro,$rproducts,$servers); 30 | }catch (Exception $e){ 31 | } 32 | }); 33 | 34 | function V2RaySocks_QueryToArray($query){ 35 | $products = array(); 36 | foreach ($query as $product) { 37 | $producta = array(); 38 | foreach($product as $k => $produc){ 39 | $producta[$k] = $produc; 40 | } 41 | $products[] = $producta; 42 | } 43 | return $products; 44 | } 45 | 46 | function V2RaySocks_RebuildProductArray($query){ 47 | $products = array(); 48 | foreach ($query as $product) { 49 | $products[$product['id']] = $product; 50 | } 51 | return $products; 52 | } 53 | 54 | function V2RaySocks_prase_pid($products,$module = 'V2raySocks'){ 55 | $product = array(); 56 | foreach($products as $pro){ 57 | if($pro['servertype'] == $module){ 58 | $product[] = $pro['id']; 59 | } 60 | } 61 | return $product; 62 | } 63 | 64 | function V2RaySocks_get_client_products_with_pids($products,$pids,$status = array('Active')){ 65 | $product = array(); 66 | foreach($products as $pro){ 67 | if(in_array($pro['packageid'],$pids) && in_array($pro['domainstatus'],$status)){ 68 | $product[] = $pro; 69 | } 70 | } 71 | return $product; 72 | } 73 | 74 | function V2RaySocks_update_network($products,$server,$whproduct,$oldproducts){ 75 | foreach($server as $ser){ 76 | $mysql = new mysqli($ser['ipaddress'], $ser['username'], decrypt($ser['password'])); 77 | $servername = 'mysqlserver'.$ser['id']; 78 | $$servername = $mysql; 79 | } 80 | $product = array(); 81 | foreach($products as $pro){ 82 | $sid = $pro['server']; 83 | $mysql = 'mysqlserver'.$sid; 84 | $sql = $$mysql; 85 | $sql->select_db($whproduct[$pro['packageid']]); 86 | $sqlq = "SELECT * FROM `user` WHERE sid = " . $pro['id']; 87 | $ssacc = mysqli_fetch_array($sql->query($sqlq),MYSQLI_ASSOC); 88 | $uasql = "SELECT * FROM `user_usage` WHERE sid = " . $pro['id'] ." ORDER BY `date` DESC LIMIT 1"; 89 | $usagee = mysqli_fetch_array($sql->query($uasql),MYSQLI_ASSOC); 90 | $writeable = false; 91 | if(empty($usagee)){ 92 | $writeable = true; 93 | $dataa = $ssacc['u'].",".$ssacc['d'].",".$ssacc['u'].",".$ssacc['d'].",".time().",".$pro['id']; 94 | }else{ 95 | $writeable = false; 96 | if(time() - $usagee['date'] >= 60 * 60 * 3){ 97 | $writeable = true; 98 | $dataa = ($ssacc['u'] - $usagee['tupload']).",".($ssacc['d'] - $usagee['tdownload']).",".$ssacc['u'].",".$ssacc['d'].",".time().",".$pro['id']; 99 | } 100 | } 101 | if($writeable){ 102 | $upmysql = "INSERT INTO `user_usage` (`upload`,`download`,`tupload`,`tdownload`,`date`,`sid`) VALUES(".$dataa.")"; 103 | $sql->query($upmysql); 104 | } 105 | } 106 | return $product; 107 | } 108 | 109 | function V2RaySocks_prase_product_DB($products,$module = 'V2raySocks'){ 110 | $product = array(); 111 | foreach($products as $pro){ 112 | if($pro['servertype'] == $module){ 113 | $product[$pro['id']] = $pro['configoption1']; 114 | } 115 | } 116 | return $product; 117 | } 118 | 119 | function V2RaySocks_CalcBandReset($pro,$products,$server){ 120 | foreach($server as $ser){ 121 | $mysql = new mysqli($ser['ipaddress'], $ser['username'], decrypt($ser['password'])); 122 | $servername = 'mysqlserver'.$ser['id']; 123 | $$servername = $mysql; 124 | } 125 | $product = array(); 126 | foreach($pro as $por){ 127 | $sid = $por['server']; 128 | $mysql = 'mysqlserver'.$sid; 129 | $sql = $$mysql; 130 | $sql->select_db($products[$por['packageid']]['configoption1']); 131 | $days = V2RaySocks_daysInmonth(date('y'),date('m')); 132 | V2RaySocks_calcreset($por,$products[$por['packageid']],$days,$sql); 133 | } 134 | } 135 | 136 | function V2RaySocks_resetband($id,$sqlserver){ 137 | $sqlserver->query("UPDATE `user` SET `u` = '0', `d` = '0', `updated_at` = '" . time() . "' where `sid` = ".$id); 138 | $sqlserver->query("DELETE from `user_usage` WHERE `sid` = ".$id); 139 | echo("ID:".$id." Has been reset
"); 140 | } 141 | 142 | function V2RaySocks_daysInmonth($year='',$month=''){ 143 | if(empty($year)) $year = date('Y'); 144 | if(empty($month)) $month = date('m'); 145 | if (in_array($month, array(1, 3, 5, 7, 8, '01', '03', '05', '07', '08', 10, 12))) { 146 | $text = '31'; //月大 147 | }elseif ($month == 2 || $month == '02'){ 148 | if ( ($year % 400 == 0) || ( ($year % 4 == 0) && ($year % 100 !== 0) ) ) { //判断是否是闰年 149 | $text = '29'; //闰年2月 150 | } else { 151 | $text = '28'; //平年2月 152 | } 153 | } else { 154 | $text = '30'; //月小 155 | } 156 | 157 | return $text; 158 | } 159 | 160 | function V2RaySocks_calcreset($product,$whmcs,$day,$sqlserver){ 161 | $sqlq = "SELECT * FROM `user` WHERE sid = " . $product['id']; 162 | $ssacc = mysqli_fetch_array($sqlserver->query($sqlq),MYSQLI_ASSOC); 163 | echo('Calcing '.$product['id'] .' ,days: '. $day . ' , duedate: ' . $product['nextduedate'] . ' , LastReset: ' . date("Y-m-d", $ssacc['updated_at']) . '
'); 164 | switch($whmcs['configoption2']){ 165 | case 0: 166 | break; 167 | case 1: 168 | if(date("Y-m-d", $ssacc['updated_at']) !== date("Y-m-d", time())){ 169 | if(date("d", strtotime($product['nextduedate'])) == date('d')){ 170 | V2RaySocks_resetband($product['id'],$sqlserver); 171 | } 172 | if(date('d') == $day){ 173 | if(date("d", strtotime($product['nextduedate'])) > $day){ 174 | V2RaySocks_resetband($product['id'],$sqlserver); 175 | } 176 | } 177 | }else{ 178 | echo('Skip '.$product['id'] .'
'); 179 | } 180 | break; 181 | case 2: 182 | if(date('d') == 1){ 183 | V2RaySocks_resetband($product['id'],$sqlserver); 184 | } 185 | break; 186 | case 3: 187 | if(date('d') == $day){ 188 | V2RaySocks_resetband($product['id'],$sqlserver); 189 | } 190 | break; 191 | } 192 | } 193 | ?> -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/layer.css: -------------------------------------------------------------------------------- 1 | .layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap}*html{background-image:url(about:blank);background-attachment:fixed}html #layuicss-skinlayercss{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch;top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;box-shadow:1px 1px 50px rgba(0,0,0,.3)}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #B2B2B2;border:1px solid rgba(0,0,0,.1);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-load{background:url(loading-1.gif) center center no-repeat #eee}.layui-layer-ico{background:url(icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;width:100%;height:100%;cursor:move;opacity:0;filter:alpha(opacity=0);background-color:#fff;z-index:2147483647}.layui-layer-resize{position:absolute;width:15px;height:15px;right:0;bottom:0;cursor:se-resize}.layui-layer{border-radius:2px;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}@-webkit-keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim{-webkit-animation-name:layer-bounceIn;animation-name:layer-bounceIn}@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-layer-title{padding:0 80px 0 20px;height:42px;line-height:42px;border-bottom:1px solid #eee;font-size:14px;color:#333;overflow:hidden;background-color:#F8F8F8;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:15px;font-size:0;line-height:initial}.layui-layer-setwin a{position:relative;width:16px;height:16px;margin-left:10px;font-size:12px;_overflow:hidden}.layui-layer-setwin .layui-layer-min cite{position:absolute;width:14px;height:2px;left:0;top:50%;margin-top:-1px;background-color:#2E2D3C;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA}.layui-layer-setwin .layui-layer-max{background-position:-32px -40px}.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px}.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px}.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px}.layui-layer-setwin .layui-layer-close1{background-position:1px -40px;cursor:pointer}.layui-layer-setwin .layui-layer-close1:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;width:30px;height:30px;margin-left:0;background-position:-149px -31px;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{background-position:-180px -31px}.layui-layer-btn{text-align:right;padding:0 10px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:28px;line-height:28px;margin:6px 6px 0;padding:0 15px;border:1px solid #dedede;background-color:#f1f1f1;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:#4898d5;background-color:#2e8ded;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:260px}.layui-layer-dialog .layui-layer-content{position:relative;padding:20px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute;top:16px;left:15px;_left:-40px;width:30px;height:30px}.layui-layer-ico1{background-position:-30px 0}.layui-layer-ico2{background-position:-60px 0}.layui-layer-ico3{background-position:-90px 0}.layui-layer-ico4{background-position:-120px 0}.layui-layer-ico5{background-position:-150px 0}.layui-layer-ico6{background-position:-180px 0}.layui-layer-rim{border:6px solid #8D8D8D;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #D3D4D3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-content{padding:12px 25px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:20px 20px 20px 55px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:60px;height:24px;background:url(loading-0.gif) no-repeat}.layui-layer-loading .layui-layer-loading1{width:37px;height:37px;background:url(loading-1.gif) no-repeat}.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:5px 10px;font-size:12px;_float:left;border-radius:2px;box-shadow:1px 1px 3px rgba(0,0,0,.2);background-color:#000;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#000}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:1px;border-bottom-style:solid;border-bottom-color:#000}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan[type=dialog]{min-width:280px}.layui-layer-lan .layui-layer-title{background:#4476A7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:5px 10px 10px;text-align:right;border-top:1px solid #E9E7E7}.layui-layer-lan .layui-layer-btn a{background:#BBB5B5;border:none}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1}.layui-layer-iconext{background:url(icon-ext.png) no-repeat}.layui-layer-prompt .layui-layer-input{display:block;width:220px;height:30px;margin:0 auto;line-height:30px;padding:0 5px;border:1px solid #ccc;box-shadow:1px 1px 5px rgba(0,0,0,.1) inset;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px}.layui-layer-prompt .layui-layer-content{padding:20px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;border-bottom:1px solid #ccc;background-color:#eee;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;cursor:default;overflow:hidden}.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px;border-left:1px solid #ccc;border-right:1px solid #ccc;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer{display:block}.xubox_tabclose{position:absolute;right:10px;top:5px;cursor:pointer}.layui-layer-photos{-webkit-animation-duration:.8s;animation-duration:.8s}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal}@-webkit-keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:layer-bounceOut;animation-name:layer-bounceOut;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/layer.css: -------------------------------------------------------------------------------- 1 | .layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap}*html{background-image:url(about:blank);background-attachment:fixed}html #layuicss-skinlayercss{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch;top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;box-shadow:1px 1px 50px rgba(0,0,0,.3)}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #B2B2B2;border:1px solid rgba(0,0,0,.1);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-load{background:url(loading-1.gif) center center no-repeat #eee}.layui-layer-ico{background:url(icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;width:100%;height:100%;cursor:move;opacity:0;filter:alpha(opacity=0);background-color:#fff;z-index:2147483647}.layui-layer-resize{position:absolute;width:15px;height:15px;right:0;bottom:0;cursor:se-resize}.layui-layer{border-radius:2px;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}@-webkit-keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim{-webkit-animation-name:layer-bounceIn;animation-name:layer-bounceIn}@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-layer-title{padding:0 80px 0 20px;height:42px;line-height:42px;border-bottom:1px solid #eee;font-size:14px;color:#333;overflow:hidden;background-color:#F8F8F8;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:15px;font-size:0;line-height:initial}.layui-layer-setwin a{position:relative;width:16px;height:16px;margin-left:10px;font-size:12px;_overflow:hidden}.layui-layer-setwin .layui-layer-min cite{position:absolute;width:14px;height:2px;left:0;top:50%;margin-top:-1px;background-color:#2E2D3C;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA}.layui-layer-setwin .layui-layer-max{background-position:-32px -40px}.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px}.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px}.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px}.layui-layer-setwin .layui-layer-close1{background-position:1px -40px;cursor:pointer}.layui-layer-setwin .layui-layer-close1:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;width:30px;height:30px;margin-left:0;background-position:-149px -31px;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{background-position:-180px -31px}.layui-layer-btn{text-align:right;padding:0 10px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:28px;line-height:28px;margin:6px 6px 0;padding:0 15px;border:1px solid #dedede;background-color:#f1f1f1;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:#4898d5;background-color:#2e8ded;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:260px}.layui-layer-dialog .layui-layer-content{position:relative;padding:20px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute;top:16px;left:15px;_left:-40px;width:30px;height:30px}.layui-layer-ico1{background-position:-30px 0}.layui-layer-ico2{background-position:-60px 0}.layui-layer-ico3{background-position:-90px 0}.layui-layer-ico4{background-position:-120px 0}.layui-layer-ico5{background-position:-150px 0}.layui-layer-ico6{background-position:-180px 0}.layui-layer-rim{border:6px solid #8D8D8D;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #D3D4D3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-content{padding:12px 25px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:20px 20px 20px 55px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:60px;height:24px;background:url(loading-0.gif) no-repeat}.layui-layer-loading .layui-layer-loading1{width:37px;height:37px;background:url(loading-1.gif) no-repeat}.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:5px 10px;font-size:12px;_float:left;border-radius:2px;box-shadow:1px 1px 3px rgba(0,0,0,.2);background-color:#000;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#000}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:1px;border-bottom-style:solid;border-bottom-color:#000}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan[type=dialog]{min-width:280px}.layui-layer-lan .layui-layer-title{background:#4476A7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:5px 10px 10px;text-align:right;border-top:1px solid #E9E7E7}.layui-layer-lan .layui-layer-btn a{background:#BBB5B5;border:none}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1}.layui-layer-iconext{background:url(icon-ext.png) no-repeat}.layui-layer-prompt .layui-layer-input{display:block;width:220px;height:30px;margin:0 auto;line-height:30px;padding:0 5px;border:1px solid #ccc;box-shadow:1px 1px 5px rgba(0,0,0,.1) inset;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px}.layui-layer-prompt .layui-layer-content{padding:20px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;border-bottom:1px solid #ccc;background-color:#eee;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;cursor:default;overflow:hidden}.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px;border-left:1px solid #ccc;border-right:1px solid #ccc;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer{display:block}.xubox_tabclose{position:absolute;right:10px;top:5px;cursor:pointer}.layui-layer-photos{-webkit-animation-duration:.8s;animation-duration:.8s}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal}@-webkit-keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:layer-bounceOut;animation-name:layer-bounceOut;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/details.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 41 | 79 | {if ($infos)} 80 |
81 |

{$infos|unescape:"html"}

82 |
83 | {/if} 84 |
85 |
86 |
87 | 99 |
100 |
101 | {V2raySocks_get_lang('user_info')} 102 |
103 |
104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 121 | 122 | 123 | 136 | 137 | 138 |
{V2raySocks_get_lang('uuid')}
{$usage.uuid} 116 | 120 |
139 | {if $enable_subscribe == 1} 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 157 | 159 | 160 | 161 | 162 | 168 | 170 | 171 | 172 | 183 |
{V2raySocks_get_lang('subscribe')}
IOS 152 | 156 |
Android/Win 163 | 167 |
184 | {/if} 185 |
186 |
187 | 188 |
189 |
190 | {V2raySocks_get_lang('usage_chart')} ({V2raySocks_get_lang('bandwidth')}:{$usage.tr_MB_GB}) 191 |
192 |
193 |

{V2raySocks_get_lang('used')} ({$usage.s_MB_GB})

194 |
195 |
196 | {($usage.sum/$usage.transfer_enable)*100}% Complete 197 |
198 |
199 |

{V2raySocks_get_lang('upload')} ({$usage.u_MB_GB})

200 |
201 |
202 | {($usage.u/$usage.transfer_enable)*100}% Complete (warning) 203 |
204 |
205 |

{V2raySocks_get_lang('download')} ({$usage.d_MB_GB})

206 |
207 |
208 | {($usage.d/$usage.transfer_enable)*100}% Complete (danger) 209 |
210 |
211 |
212 |
213 | 214 |
215 |
216 | {V2raySocks_get_lang('routelist')} 217 |
218 |
219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | {$yy = 0} 237 | {foreach $nodes as $node } 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 264 | 265 | {/foreach} 266 | 267 |
{V2raySocks_get_lang('name')}{V2raySocks_get_lang('action')}
{$node[0]} 250 | 254 | 258 | 262 | {$yy = $yy + 1} 263 |
268 |
269 |
270 | 274 | 275 | {if ($script)} 276 |
277 |
278 | {V2raySocks_get_lang('traffic_chart')} ({$datadays} {V2raySocks_get_lang('days')}) 279 |
280 |
281 |
282 | 293 |
294 |

295 | 296 |
297 |
298 |

299 | 300 |
301 |
302 |

303 | 304 |
305 |
306 | 307 | 312 |
313 |
314 | {/if} 315 | 316 |
317 |
318 |
319 | 320 | 321 | 322 | -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/layer.js: -------------------------------------------------------------------------------- 1 | /*! layer-v3.0.3 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */ 2 | ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.scripts,t=e[e.length-1],i=t.src;if(!t.getAttribute("merge"))return i.substring(0,i.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"]},r={v:"3.0.3",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):r.link("skin/"+e.extend),this):this},link:function(t,n,a){if(r.path){var o=i("head")[0],s=document.createElement("link");"string"==typeof n&&(a=n);var l=(a||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,i("#"+f)[0]||o.appendChild(s),"function"==typeof n&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(i("#"+f).css("width"))?n():setTimeout(u,100))}()}},ready:function(e){var t="skinlayercss",i="303";return a?layui.addcss("modules/layer/default/layer.css?v="+r.v+i,e,t):r.link("skin/default/layer.css?v="+r.v+i,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
'+(f?r.title[0]:r.title)+"
":"";return r.zIndex=s,t([r.shade?'
':"",'
'+(e&&2!=r.type?"":u)+'
'+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
'+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
'+e+"
"}():"")+(r.resize?'':"")+"
"],u,i('
')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content,"auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]&&e.layero.addClass(l.anim[t.anim]),t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){function t(e){e=s.find(e),e.height(f[1]-c-u-2*(0|parseFloat(e.css("padding-top"))))}var a=this,o=a.config,s=i("#"+l[0]+e);""===o.area[0]&&o.maxWidth>0&&(r.ie&&r.ie<8&&o.btn&&s.width(s.innerWidth()),s.outerWidth()>o.maxWidth&&s.width(o.maxWidth));var f=[s.innerWidth(),s.innerHeight()],c=s.find(l[1]).outerHeight()||0,u=s.find("."+l[6]).outerHeight()||0;switch(o.type){case 2:t("iframe");break;default:""===o.area[1]?o.fixed&&f[1]>=n.height()&&(f[1]=n.height(),t("."+l[5])):t("."+l[5])}return a},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass(a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,n="";if(e>0)for(n=''+t[0].title+"";i"+t[i].title+"";return n}(),content:'
    '+function(){var e=t.length,i=1,n="";if(e>0)for(n='
  • '+(t[0].content||"no content")+"
  • ";i'+(t[i].content||"no content")+"";return n}()+"
",success:function(t){var a=t.find(".layui-layer-title").children(),o=t.find(".layui-layer-tabmain").children();a.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var n=i(this),a=n.index();n.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),o.eq(a).show().siblings().hide(),"function"==typeof e.change&&e.change(a)}),"function"==typeof n&&n(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
'+(u.length>1?'':"")+'
'+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.jquery),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); -------------------------------------------------------------------------------- /Plugin/V2raySocks/V2raySocks.php: -------------------------------------------------------------------------------- 1 | = '.$date.' ORDER BY `date` DESC'; 28 | }else{ 29 | $query['RESET'] = 'UPDATE `user` SET `u`=0,`d`=0 WHERE `sid` = :sid'; 30 | $query['CHARTINFO'] = 'SELECT * FROM `user_usage` WHERE `sid` = :sid ORDER BY `date` DESC'; 31 | } 32 | return $query; 33 | } 34 | 35 | function V2raySocks_MetaData(){ 36 | return array( 37 | 'DisplayName' => 'V2raySocks', 38 | 'APIVersion' => '1.0', 39 | 'RequiresServer' => true 40 | ); 41 | } 42 | 43 | function V2raySocks_ConfigOptions(){ 44 | return array( 45 | V2raySocks_get_lang('database') => array('Type' => 'text', 'Size' => '25'), 46 | V2raySocks_get_lang('resetbandwidth') => array( 47 | 'Type' => 'dropdown', 48 | 'Options' => array('3'=> V2raySocks_get_lang('end_of_month'), '2'=> V2raySocks_get_lang('start_of_month'), '1' => V2raySocks_get_lang('by_duedate_day'), '0' => V2raySocks_get_lang('neednot_reset')), 49 | 'Description' => V2raySocks_get_lang('resetbandwidth_description') 50 | ), 51 | V2raySocks_get_lang('bandwidth') => array('Type' => 'text', 'Size' => '25', 'Description' => V2raySocks_get_lang('bandwidth_description')), 52 | V2raySocks_get_lang('routelist') => array('Type' => 'textarea', 'Rows' => '3', 'Cols' => '50', 'Description' => V2raySocks_get_lang('routelist_description')), 53 | V2raySocks_get_lang('announcements') => array('Type' => 'textarea', 'Rows' => '3', 'Cols' => '50', 'Description' => V2raySocks_get_lang('announcements_description')), 54 | V2raySocks_get_lang('subscribe') => array( 55 | 'Type' => 'dropdown', 56 | 'Options' => array('1'=> V2raySocks_get_lang('enable'), '0' => V2raySocks_get_lang('disable')), 57 | 'Description' => V2raySocks_get_lang('subscribe_description') 58 | ) 59 | ); 60 | } 61 | 62 | function V2raySocks_TestConnection(array $params){ 63 | try { 64 | $dbhost = $params['serverip']; 65 | $dbuser = $params['serverusername']; 66 | $dbpass = $params['serverpassword']; 67 | $db = new PDO('mysql:host=' . $dbhost, $dbuser, $dbpass); 68 | $success = true; 69 | $errorMsg = ''; 70 | } 71 | catch (Exception $e) { 72 | logModuleCall('V2raySocks', 'V2raySocks_TestConnection', $params, $e->getMessage(), $e->getTraceAsString()); 73 | $success = false; 74 | $errorMsg = $e->getMessage(); 75 | } 76 | return array('success' => $success, 'error' => $errorMsg); 77 | } 78 | 79 | function V2raySocks_CreateAccount(array $params){ 80 | $query = V2raySocks_initialize($params); 81 | try { 82 | $db = V2raySocks_getDBFromParams($params); 83 | $already = $db->prepare($query['ALREADY_EXISTS']); 84 | $already->bindValue(':sid', $params['serviceid']); 85 | $already->execute(); 86 | if ($already->fetchColumn()) { 87 | return V2raySocks_get_lang('User_already_exists'); 88 | } 89 | $bandwidth = (!empty($params['configoption3']) ? V2raySocks_Convert($params['configoption3'], 'mb', 'bytes') : (!empty($params['configoptions']['traffic']) ? V2raySocks_Convert($params['configoptions']['traffic'], 'gb', 'bytes') : '1099511627776')); 90 | 91 | $create = $db->prepare($query['CREATE_ACCOUNT']); 92 | $create->bindValue(':uuid', V2raySocks_GenerateUuid()); 93 | $create->bindValue(':transfer_enable', $bandwidth); 94 | $create->bindValue(':need_reset', $params['configoption2']); 95 | $create->bindValue(':sid', $params['serviceid']); 96 | $create = $create->execute(); 97 | 98 | if ($create) { 99 | return 'success'; 100 | }else { 101 | $error = $db->errorInfo(); 102 | return $error; 103 | } 104 | } 105 | catch (Exception $e) { 106 | logModuleCall('V2raySocks', 'V2raySocks_CreateAccount', $params, $e->getMessage(), $e->getTraceAsString()); 107 | return V2raySocks_get_lang('Model_error').$e->getMessage(); 108 | } 109 | } 110 | 111 | function V2raySocks_SuspendAccount(array $params){ 112 | $query = V2raySocks_initialize($params); 113 | try { 114 | $db = V2raySocks_getDBFromParams($params); 115 | $enable = $db->prepare($query['ENABLE']); 116 | $enable->bindValue(':enable', '0'); 117 | $enable->bindValue(':sid', $params['serviceid']); 118 | 119 | $todo = $enable->execute(); 120 | if (!$todo) { 121 | $error = $db->errorInfo(); 122 | return $error; 123 | } 124 | return 'success'; 125 | } 126 | catch (Exception $e) { 127 | logModuleCall('V2raySocks', 'V2raySocks_SuspendAccount', $params, $e->getMessage(), $e->getTraceAsString()); 128 | return $e->getMessage(); 129 | } 130 | } 131 | 132 | function V2raySocks_UnsuspendAccount(array $params){ 133 | $query = V2raySocks_initialize($params,time()); 134 | try { 135 | $db = V2raySocks_getDBFromParams($params); 136 | $enable = $db->prepare($query['ENABLE']); 137 | $enable->bindValue(':enable', '1'); 138 | $enable->bindValue(':sid', $params['serviceid']); 139 | 140 | $todo = $enable->execute(); 141 | if (!$todo) { 142 | $error = $db->errorInfo(); 143 | return $error; 144 | } 145 | $enable = $db->prepare($query['RESET']); 146 | $enable->bindValue(':sid', $params['serviceid']); 147 | $todo = $enable->execute(); 148 | $resetchart = $db->prepare($query['RESETUSERCHART']); 149 | $resetchart->bindValue(':sid', $params['serviceid']); 150 | $resetchart->execute(); 151 | if (!$todo) { 152 | $error = $db->errorInfo(); 153 | return $error; 154 | } 155 | return 'success'; 156 | } 157 | catch (Exception $e) { 158 | logModuleCall('V2raySocks', 'V2raySocks_UnsuspendAccount', $params, $e->getMessage(), $e->getTraceAsString()); 159 | return $e->getMessage(); 160 | } 161 | } 162 | 163 | function V2raySocks_TerminateAccount(array $params){ 164 | $query = V2raySocks_initialize($params); 165 | try { 166 | $db = V2raySocks_getDBFromParams($params); 167 | $enable = $db->prepare($query['DELETE_ACCOUNT']); 168 | $enable->bindValue(':sid', $params['serviceid']); 169 | 170 | $todo = $enable->execute(); 171 | if (!$todo) { 172 | $error = $db->errorInfo(); 173 | return $error; 174 | } 175 | return 'success'; 176 | } 177 | catch (Exception $e) { 178 | logModuleCall('V2raySocks', 'V2raySocks_TerminateAccount', $params, $e->getMessage(), $e->getTraceAsString()); 179 | return $e->getMessage(); 180 | } 181 | } 182 | 183 | function V2raySocks_ChangePackage(array $params){ 184 | $query = V2raySocks_initialize($params); 185 | try { 186 | $db = V2raySocks_getDBFromParams($params); 187 | $bandwidth = (!empty($params['configoption3']) ? V2raySocks_Convert($params['configoption3'], 'mb', 'bytes') : (!empty($params['configoptions']['traffic']) ? V2raySocks_Convert($params['configoptions']['traffic'], 'gb', 'bytes') : '1099511627776')); 188 | $enable = $db->prepare($query['CHANGE_PACKAGE']); 189 | $enable->bindValue(':transfer_enable', $bandwidth); 190 | $enable->bindValue(':sid', $params['serviceid']); 191 | $todo = $enable->execute(); 192 | if (!$todo) { 193 | $error = $db->errorInfo(); 194 | return $error; 195 | } 196 | return 'success'; 197 | } 198 | catch (Exception $e) { 199 | logModuleCall('V2raySocks', 'V2raySocks_ChangePackage', $params, $e->getMessage(), $e->getTraceAsString()); 200 | return $e->getMessage(); 201 | } 202 | } 203 | 204 | function V2raySocks_AdminCustomButtonArray(){ 205 | return array(V2raySocks_get_lang('resetbandwidth') => 'ResetBandwidth', 206 | V2raySocks_get_lang('resetUUID') => 'ResetUUID'); 207 | } 208 | 209 | function V2raySocks_ResetBandwidth(array $params){ 210 | $query = V2raySocks_initialize($params,time()); 211 | try { 212 | $db = V2raySocks_getDBFromParams($params); 213 | $enable = $db->prepare($query['RESET']); 214 | $enable->bindValue(':sid', $params['serviceid']); 215 | $todo = $enable->execute(); 216 | $resetchart = $db->prepare($query['RESETUSERCHART']); 217 | $resetchart->bindValue(':sid', $params['serviceid']); 218 | $resetchart->execute(); 219 | if (!$todo) { 220 | $error = $db->errorInfo(); 221 | return $error; 222 | } 223 | return 'success'; 224 | } 225 | catch (Exception $e) { 226 | logModuleCall('V2raySocks', 'V2raySocks_ResetBandwidth', $params, $e->getMessage(), $e->getTraceAsString()); 227 | return $e->getMessage(); 228 | } 229 | } 230 | 231 | function V2raySocks_ResetUUID(array $params){ 232 | $query = V2raySocks_initialize($params,time()); 233 | try { 234 | $db = V2raySocks_getDBFromParams($params); 235 | $enable = $db->prepare($query['RESETUUID']); 236 | $enable->bindValue(':sid', $params['serviceid']); 237 | $enable->bindValue(':uuid', V2raySocks_GenerateUuid()); 238 | $todo = $enable->execute(); 239 | if (!$todo) { 240 | $error = $db->errorInfo(); 241 | return $error; 242 | } 243 | return 'success'; 244 | } 245 | catch (Exception $e) { 246 | logModuleCall('V2raySocks', 'V2raySocks_ResetUUID', $params, $e->getMessage(), $e->getTraceAsString()); 247 | return $e->getMessage(); 248 | } 249 | } 250 | 251 | function V2raySocks_ResetToken($uid,$sid,$password = null){ 252 | $query = \WHMCS\Database\Capsule::table('tblhosting')->where('id', $sid)->first(); 253 | if(empty($query->userid) || $uid != $query->userid){ 254 | die('Service Unisset or Unexpected Error'); 255 | }else{ 256 | $result = \WHMCS\Database\Capsule::table('tblhosting')->where('id', $sid)->update(['username' => $password]); 257 | if(empty($result)){ 258 | die('Reset Failed'); 259 | }else{ 260 | die('Success'); 261 | } 262 | } 263 | } 264 | 265 | function V2raySocks_ClientArea($params) { 266 | if(isset($_GET['V2raySocksAction']) && $_GET['V2raySocksAction'] == "ResetUUID"){ 267 | if($_GET['Serviceid'] == $params['serviceid']){ 268 | V2raySocks_ResetUUID($params); 269 | } 270 | }elseif(isset($_GET['V2raySocksAction']) && $_GET['V2raySocksAction'] == "ResetToken"){ 271 | if($_GET['Serviceid'] == $params['serviceid']){ 272 | V2raySocks_ResetToken($params['userid'],$_GET['Serviceid'],V2raySocks_RandomPass(12)); 273 | } 274 | } 275 | if($params['status'] == 'Active'){ 276 | require_once 'lib/Mobile_Detect.php'; 277 | $detect = new Mobile_Detect; 278 | if($detect->isMobile()){ 279 | $date = time() - 60*60*24; 280 | $datadays = 1; 281 | }else{ 282 | $date = time() - 60*60*24*3; 283 | $datadays = 3; 284 | } 285 | $query = V2raySocks_initialize($params,$date); 286 | try { 287 | $db = V2raySocks_getDBFromParams($params); 288 | $usage = $db->prepare($query['USERINFO']); 289 | $usage->bindValue(':sid', $params['serviceid']); 290 | $usage->execute(); 291 | $usage = $usage->fetch(); 292 | 293 | $chartinfo = $db->prepare($query['CHARTINFO']); 294 | $chartinfo->bindValue(':sid', $params['serviceid']); 295 | $chartinfo->execute(); 296 | if($chartinfo){ 297 | $exa = array(); 298 | foreach($chartinfo as $chart){ 299 | $exa[] = $chart; 300 | } 301 | $label = ""; 302 | $total = ""; 303 | $upload = ""; 304 | $download = ""; 305 | $chartinfo = array_reverse($exa,true); 306 | foreach($chartinfo as $chart){ 307 | $label .= "'',"; 308 | //$label .= "'".date('m/d H:i',$chart['date'])."',"; 309 | $upload .= number_format(V2raySocks_convert($chart['upload'], 'bytes', 'mb'), 2, '.', '').","; 310 | $download .= number_format(V2raySocks_convert($chart['download'], 'bytes', 'mb'), 2, '.', '').","; 311 | $total .= number_format(V2raySocks_convert($chart['upload']+$chart['download'], 'bytes', 'mb'), 2, '.', '').","; 312 | } 313 | $label = substr($label,0,strlen($label)-1); 314 | $total = substr($total,0,strlen($total)-1); 315 | $upload = substr($upload,0,strlen($upload)-1); 316 | $download = substr($download,0,strlen($download)-1); 317 | $script = V2raySocks_make_script("totalc",$label,$total); 318 | $script .= V2raySocks_make_script("uploadc",$label,$upload); 319 | $script .= V2raySocks_make_script("downloadc",$label,$download); 320 | } 321 | 322 | $nodes = $params['configoption4']; 323 | if($nodes == ""){ 324 | $servers = \WHMCS\Database\Capsule::table('tblservers')->where('id', $params['serverid'])->get(); 325 | $servers = V2raySocks_P_QueryToArray($servers); 326 | $nodes = $servers[0]['assignedips']; 327 | } 328 | $z = 0; 329 | $results = array(); 330 | 331 | $noder = explode("\n",$nodes); 332 | $x = 0; 333 | foreach($noder as $nodee){ 334 | $nodee = explode('|', $nodee); 335 | $atr1 = array( 336 | "add" => $nodee[1], 337 | "host"=> $nodee[5], 338 | "id" => $usage['uuid'], 339 | "net" => $nodee[7], 340 | "path"=> $nodee[6], 341 | "port"=> $nodee[2], 342 | "ps" => $nodee[0], 343 | "tls" => $nodee[4], 344 | "v" => 2 345 | ); 346 | $atr2 = array( 347 | "add" => $nodee[1], 348 | "file"=> $nodee[5], 349 | "id" => $usage['uuid'], 350 | "net" => $nodee[7], 351 | "host"=> $nodee[6], 352 | "port"=> $nodee[2], 353 | "ps" => $nodee[0], 354 | "tls" => $nodee[4], 355 | "v" => 2 356 | ); 357 | if ($nodee[9]){ 358 | $atr1['aid'] = intval($nodee[9]); 359 | $atr2['aid'] = intval($nodee[9]); 360 | }else{ 361 | $atr1['aid'] = 64; 362 | $atr2['aid'] = 64; 363 | } 364 | if($nodee[3]){ 365 | $atr1['type'] = $nodee[3]; 366 | $atr2['type'] = $nodee[3]; 367 | }else{ 368 | $atr1['type'] = "none"; 369 | $atr2['type'] = "none"; 370 | } 371 | $nodee['url']['ios'] = "vmess://".base64_encode(json_encode($atr2)); 372 | $nodee['url']['win'] = "vmess://".base64_encode(json_encode($atr1)); 373 | $results[$x] = $nodee; 374 | $x++; 375 | } 376 | $infos = $params['configoption5'] ? $params['configoption5'] : false; 377 | $user = array('uuid' => $usage['uuid'], 378 | 'u' => $usage['u'], 379 | 'd' => $usage['d'], 380 | 't' => $usage['t'], 381 | 'sum' => $usage['u'] + $usage['d'], 382 | 'transfer_enable' => $usage['transfer_enable'], 383 | 'created_at' => $usage['created_at'], 384 | 'updated_at' => $usage['updated_at'], 385 | 'tr_MB_GB' => V2raySocks_MBGB($usage['transfer_enable']/1048576), 386 | 's_MB_GB' => V2raySocks_MBGB(round(($usage['u'] + $usage['d'])/1048576,2)), 387 | 'u_MB_GB' => V2raySocks_MBGB(round($usage['u']/1048576,2)), 388 | 'd_MB_GB' => V2raySocks_MBGB(round($usage['d']/1048576,2))); 389 | if($params['configoption6'] == 1){ 390 | if($params['username'] == ""){ 391 | $newpsusern = V2raySocks_RandomPass(12); 392 | $result = Capsule::table('tblhosting')->where('id', $params['serviceid'])->update(['username' => $newpsusern]); 393 | }else{ 394 | $newpsusern = $params['username']; 395 | } 396 | } 397 | if ($usage && $usage['enable']) { 398 | return array( 399 | 'tabOverviewReplacementTemplate' => 'details.tpl', 400 | 'templateVariables' => array( 401 | 'usage' => $user, 402 | 'params' => $params, 403 | 'nodes' => $results, 404 | 'script' => $script, 405 | 'datadays' => $datadays, 406 | 'nowdate' => date('m/d H:i',time()), 407 | 'infos' => $infos, 408 | 'subscribe_token' => $newpsusern, 409 | 'enable_subscribe' => $params['configoption6'], 410 | 'HTTP_HOST' => $_SERVER['HTTP_HOST']) 411 | ); 412 | } 413 | return array( 414 | 'tabOverviewReplacementTemplate' => 'error.tpl', 415 | 'templateVariables' => array('usefulErrorHelper' => V2raySocks_get_lang('error_Service_Disable')) 416 | ); 417 | } 418 | catch (Exception $e) { 419 | logModuleCall('V2raySocks', 'V2raySocks_ClientArea', $params, $e->getMessage(), $e->getTraceAsString()); 420 | return array( 421 | 'tabOverviewReplacementTemplate' => 'error.tpl', 422 | 'templateVariables' => array('usefulErrorHelper' => V2raySocks_get_lang('Model_error').$e->getMessage()) 423 | ); 424 | } 425 | }else{ 426 | return array( 427 | 'tabOverviewReplacementTemplate' => 'error.tpl', 428 | 'templateVariables' => array('usefulErrorHelper' => V2raySocks_get_lang('error_Service_Disable')) 429 | ); 430 | } 431 | } 432 | 433 | function V2raySocks_RandomPass($length = 8){ 434 | $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 435 | $password = ''; 436 | for ( $i = 0; $i < $length; $i++ ) 437 | { 438 | $password .= $chars[ mt_rand(0, strlen($chars) - 1) ]; 439 | } 440 | return $password; 441 | } 442 | 443 | function V2raySocks_AdminServicesTabFields(array $params){ 444 | $query = V2raySocks_initialize($params); 445 | try { 446 | $db = V2raySocks_getDBFromParams($params); 447 | $userinfo = $db->prepare($query['USERINFO']); 448 | $userinfo->bindValue(':sid', $params['serviceid']); 449 | $userinfo->execute(); 450 | $userinfo = $userinfo->fetch(); 451 | if ($userinfo) { 452 | return array(V2raySocks_get_lang('uuid') => $userinfo['uuid'], V2raySocks_get_lang('bandwidth') => V2raySocks_convert($userinfo['transfer_enable'], 'bytes', 'mb') . 'MB', V2raySocks_get_lang('upload') => round(V2raySocks_convert($userinfo['u'], 'bytes', 'mb')) . 'MB', V2raySocks_get_lang('download') => round(V2raySocks_convert($userinfo['d'], 'bytes', 'mb')) . 'MB', V2raySocks_get_lang('used') => round(V2raySocks_convert($userinfo['d'] + $userinfo['u'], 'bytes', 'mb')) . 'MB', V2raySocks_get_lang('last_use_time') => date('Y-m-d H:i:s', $userinfo['t']), V2raySocks_get_lang('last_reset_time') => date('Y-m-d H:i:s', $userinfo['updated_at'])); 453 | } 454 | } 455 | catch (Exception $e) { 456 | logModuleCall('V2raySocks', 'V2raySocks_AdminServicesTabFields', $params, $e->getMessage(), $e->getTraceAsString()); 457 | return $e->getTraceAsString(); 458 | } 459 | } 460 | 461 | function V2raySocks_getDBFromParams($params){ 462 | $dbhost = $params['serverip']; 463 | $dbname = $params['configoption1']; 464 | $dbuser = $params['serverusername']; 465 | $dbpass = $params['serverpassword']; 466 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 467 | return $db; 468 | } 469 | 470 | function V2raySocks_make_script($name,$label,$data){ 471 | if($name and $label and $data){ 472 | $script = " 473 | var canvas=document.getElementById('".$name."'); 474 | var data = { 475 | labels : [".$label."], 476 | datasets : [ 477 | { 478 | fillColor : 'rgba(220,220,220,0.5)', 479 | strokeColor : 'rgba(220,220,220,1)', 480 | pointColor : 'rgba(220,220,220,1)', 481 | pointStrokeColor : '#fff', 482 | data : [".$data."] 483 | }, 484 | ] 485 | } 486 | var ctx = canvas.getContext('2d'); 487 | var myLine = new Chart(ctx).Line(data,{ 488 | responsive: true, 489 | scaleLabel: '<%=value%>MB'});"; 490 | return $script; 491 | } 492 | } 493 | 494 | function V2raySocks_MBGB($tra){ 495 | if($tra >= 1024){ 496 | $tra = round($tra / 1024,2); 497 | $tra .= 'GB'; 498 | }else{ 499 | $tra .= 'MB'; 500 | } 501 | return $tra; 502 | } 503 | 504 | function V2raySocks_GenerateUuid(){ 505 | $chars = md5(uniqid(mt_rand(), true)); 506 | $uuid = substr($chars,0,8) . '-'; 507 | $uuid .= substr($chars,8,4) . '-'; 508 | $uuid .= substr($chars,12,4) . '-'; 509 | $uuid .= substr($chars,16,4) . '-'; 510 | $uuid .= substr($chars,20,12); 511 | return strtoupper($uuid); 512 | } 513 | 514 | function V2raySocks_Convert($number, $from, $to){ 515 | $to = strtolower($to); 516 | $from = strtolower($from); 517 | switch ($from) { 518 | case 'gb': 519 | switch ($to) { 520 | case 'mb': 521 | return $number * 1024; 522 | case 'bytes': 523 | return $number * 1073741824; 524 | default: 525 | } 526 | return $number; 527 | break; 528 | case 'mb': 529 | switch ($to) { 530 | case 'gb': 531 | return $number / 1024; 532 | case 'bytes': 533 | return $number * 1048576; 534 | default: 535 | } 536 | return $number; 537 | break; 538 | case 'bytes': 539 | switch ($to) { 540 | case 'gb': 541 | return $number / 1073741824; 542 | case 'mb': 543 | return $number / 1048576; 544 | default: 545 | } 546 | return $number; 547 | break; 548 | default: 549 | } 550 | return $number; 551 | } 552 | 553 | function V2raySocks_P_QueryToArray($query){ 554 | $products = array(); 555 | foreach ($query as $product) { 556 | $producta = array(); 557 | foreach($product as $k => $produc){ 558 | $producta[$k] = $produc; 559 | } 560 | $products[] = $producta; 561 | } 562 | return $products; 563 | } -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/css/layui.css: -------------------------------------------------------------------------------- 1 | /** layui-v1.0.9_rls MIT License By http://www.layui.com */ 2 | .layui-laypage a,a{text-decoration:none}.layui-btn,.layui-inline,img{vertical-align:middle}.layui-btn,.layui-unselect{-webkit-user-select:none;-ms-user-select:none;-moz-user-select:none}.layui-btn,.layui-tree li i,.layui-unselect{-moz-user-select:none}blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}a:active,a:hover{outline:0}img{display:inline-block;border:none}li{list-style:none}table{border-collapse:collapse;border-spacing:0}h1,h2,h3{font-size:14px;font-weight:400}h4,h5,h6{font-size:100%;font-weight:400}button,input,optgroup,option,select,textarea{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;outline:0}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-button:vertical{display:none}::-webkit-scrollbar-corner,::-webkit-scrollbar-track{background-color:#e2e2e2}::-webkit-scrollbar-thumb{border-radius:0;background-color:rgba(0,0,0,.3)}::-webkit-scrollbar-thumb:vertical:hover{background-color:rgba(0,0,0,.35)}::-webkit-scrollbar-thumb:vertical:active{background-color:rgba(0,0,0,.38)}@font-face{font-family:layui-icon;src:url(../font/iconfont.eot?v=1.0.9);src:url(../font/iconfont.eot?v=1.0.9#iefix) format('embedded-opentype'),url(../font/iconfont.svg?v=1.0.9#iconfont) format('svg'),url(../font/iconfont.woff?v=1.0.9) format('woff'),url(../font/iconfont.ttf?v=1.0.9) format('truetype')}.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{line-height:24px;font:14px Helvetica Neue,Helvetica,PingFang SC,\5FAE\8F6F\96C5\9ED1,Tahoma,Arial,sans-serif}hr{height:1px;margin:10px 0;border:0;background-color:#e2e2e2;clear:both}a{color:#333}a:hover{color:#777}a cite{font-style:normal;*cursor:pointer}.layui-box,.layui-box *{-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important;box-sizing:content-box!important}.layui-border-box,.layui-border-box *{-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important}.layui-clear{clear:both;*zoom:1}.layui-clear:after{content:'\20';clear:both;*zoom:1;display:block;height:0}.layui-inline{position:relative;display:inline-block;*display:inline;*zoom:1}.layui-edge{position:absolute;width:0;height:0;border-style:dashed;border-color:transparent;overflow:hidden}.layui-elip{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-disabled,.layui-disabled:hover{color:#d2d2d2!important;cursor:not-allowed!important}.layui-circle{border-radius:100%}.layui-show{display:block!important}.layui-hide{display:none!important}.layui-main{position:relative;width:1140px;margin:0 auto}.layui-header{position:relative;z-index:1000;height:60px}.layui-header a:hover{transition:all .5s;-webkit-transition:all .5s}.layui-side{position:fixed;top:0;bottom:0;z-index:999;width:200px;overflow-x:hidden}.layui-side-scroll{width:220px;height:100%;overflow-x:hidden}.layui-body{position:absolute;left:200px;right:0;top:0;bottom:0;z-index:998;width:auto;overflow:hidden;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.layui-layout-admin .layui-header{background-color:#23262E}.layui-layout-admin .layui-side{top:60px;width:200px;overflow-x:hidden}.layui-layout-admin .layui-body{top:60px;bottom:44px}.layui-layout-admin .layui-main{width:auto;margin:0 15px}.layui-layout-admin .layui-footer{position:fixed;left:200px;right:0;bottom:0;height:44px;background-color:#eee}.layui-btn,.layui-input,.layui-select,.layui-textarea,.layui-upload-button{outline:0;-webkit-transition:border-color .3s cubic-bezier(.65,.05,.35,.5);transition:border-color .3s cubic-bezier(.65,.05,.35,.5);-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important}.layui-elem-quote{margin-bottom:10px;padding:15px;line-height:22px;border-left:5px solid #009688;border-radius:0 2px 2px 0;background-color:#f2f2f2}.layui-quote-nm{border-color:#e2e2e2;border-style:solid;border-width:1px 1px 1px 5px;background:0 0}.layui-elem-field{margin-bottom:10px;padding:0;border:1px solid #e2e2e2}.layui-elem-field legend{margin-left:20px;padding:0 10px;font-size:20px;font-weight:300}.layui-field-title{margin:10px 0 20px;border:none;border-top:1px solid #e2e2e2}.layui-field-box{padding:10px 15px}.layui-field-title .layui-field-box{padding:10px 0}.layui-progress{position:relative;height:6px;border-radius:20px;background-color:#e2e2e2}.layui-progress-bar{position:absolute;width:0;max-width:100%;height:6px;border-radius:20px;text-align:right;background-color:#5FB878;transition:all .3s;-webkit-transition:all .3s}.layui-progress-big,.layui-progress-big .layui-progress-bar{height:18px;line-height:18px}.layui-progress-text{position:relative;top:-18px;line-height:18px;font-size:12px;color:#666}.layui-progress-big .layui-progress-text{position:static;padding:0 10px;color:#fff}.layui-collapse{border:1px solid #e2e2e2;border-radius:2px}.layui-colla-item{border-top:1px solid #e2e2e2}.layui-colla-item:first-child{border-top:none}.layui-colla-title{position:relative;height:42px;line-height:42px;padding:0 15px 0 35px;color:#333;background-color:#f2f2f2;cursor:pointer}.layui-colla-content{display:none;padding:10px 15px;line-height:22px;border-top:1px solid #e2e2e2;color:#666}.layui-colla-icon{position:absolute;left:15px;top:0;font-size:14px}.layui-bg-red{background-color:#FF5722}.layui-bg-orange{background-color:#F7B824}.layui-bg-green{background-color:#009688}.layui-bg-cyan{background-color:#2F4056}.layui-bg-blue{background-color:#1E9FFF}.layui-bg-black{background-color:#393D49}.layui-bg-gray{background-color:#eee}.layui-word-aux{font-size:12px;color:#999;padding:0 5px}.layui-btn{display:inline-block;height:38px;line-height:38px;padding:0 18px;background-color:#009688;color:#fff;white-space:nowrap;text-align:center;font-size:14px;border:none;border-radius:2px;cursor:pointer;opacity:.9;filter:alpha(opacity=90)}.layui-btn:hover{opacity:.8;filter:alpha(opacity=80);color:#fff}.layui-btn:active{opacity:1;filter:alpha(opacity=100)}.layui-btn+.layui-btn{margin-left:10px}.layui-btn-radius{border-radius:100px}.layui-btn .layui-icon{font-size:18px;vertical-align:bottom}.layui-btn-primary{border:1px solid #C9C9C9;background-color:#fff;color:#555}.layui-btn-primary:hover{border-color:#009688;color:#333}.layui-btn-normal{background-color:#1E9FFF}.layui-btn-warm{background-color:#F7B824}.layui-btn-danger{background-color:#FF5722}.layui-btn-disabled,.layui-btn-disabled:active,.layui-btn-disabled:hover{border:1px solid #e6e6e6;background-color:#FBFBFB;color:#C9C9C9;cursor:not-allowed;opacity:1}.layui-btn-big{height:44px;line-height:44px;padding:0 25px;font-size:16px}.layui-btn-small{height:30px;line-height:30px;padding:0 10px;font-size:12px}.layui-btn-small i{font-size:16px!important}.layui-btn-mini{height:22px;line-height:22px;padding:0 5px;font-size:12px}.layui-btn-mini i{font-size:14px!important}.layui-btn-group{display:inline-block;vertical-align:middle;font-size:0}.layui-btn-group .layui-btn{margin-left:0!important;margin-right:0!important;border-left:1px solid rgba(255,255,255,.5);border-radius:0}.layui-btn-group .layui-btn-primary{border-left:none}.layui-btn-group .layui-btn-primary:hover{border-color:#C9C9C9;color:#009688}.layui-btn-group .layui-btn:first-child{border-left:none;border-radius:2px 0 0 2px}.layui-btn-group .layui-btn-primary:first-child{border-left:1px solid #c9c9c9}.layui-btn-group .layui-btn:last-child{border-radius:0 2px 2px 0}.layui-btn-group .layui-btn+.layui-btn{margin-left:0}.layui-btn-group+.layui-btn-group{margin-left:10px}.layui-input,.layui-select,.layui-textarea{height:38px;line-height:38px;line-height:36px\9;border:1px solid #e6e6e6;background-color:#fff;border-radius:2px}.layui-form-label,.layui-form-mid,.layui-textarea{line-height:20px;position:relative}.layui-input,.layui-textarea{display:block;width:100%;padding-left:10px}.layui-input:hover,.layui-textarea:hover{border-color:#D2D2D2!important}.layui-input:focus,.layui-textarea:focus{border-color:#C9C9C9!important}.layui-textarea{min-height:100px;height:auto;padding:6px 10px;resize:vertical}.layui-select{padding:0 10px}.layui-form input[type=checkbox],.layui-form input[type=radio],.layui-form select{display:none}.layui-form-item{margin-bottom:15px;clear:both;*zoom:1}.layui-form-item:after{content:'\20';clear:both;*zoom:1;display:block;height:0}.layui-form-label{float:left;display:block;padding:9px 15px;width:80px;font-weight:400;text-align:right}.layui-form-item .layui-inline{margin-bottom:5px;margin-right:10px}.layui-input-block,.layui-input-inline{position:relative}.layui-input-block{margin-left:110px;min-height:36px}.layui-input-inline{display:inline-block;vertical-align:middle}.layui-form-item .layui-input-inline{float:left;width:190px;margin-right:10px}.layui-form-text .layui-input-inline{width:auto}.layui-form-mid{float:left;display:block;padding:8px 0;margin-right:10px}.layui-form-danger+.layui-form-select .layui-input,.layui-form-danger:focus{border:1px solid #FF5722!important}.layui-form-select{position:relative}.layui-form-select .layui-input{padding-right:30px;cursor:pointer}.layui-form-select .layui-edge{position:absolute;right:10px;top:50%;margin-top:-3px;cursor:pointer;border-width:6px;border-top-color:#c2c2c2;border-top-style:solid;transition:all .3s;-webkit-transition:all .3s}.layui-form-select dl{display:none;position:absolute;left:0;top:42px;padding:5px 0;z-index:999;min-width:100%;border:1px solid #d2d2d2;max-height:300px;overflow-y:auto;background-color:#fff;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12);box-sizing:border-box}.layui-form-select dl dd,.layui-form-select dl dt{padding:0 10px;line-height:36px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-form-select dl dt{font-size:12px;color:#999}.layui-form-select dl dd{cursor:pointer}.layui-form-select dl dd:hover{background-color:#f2f2f2}.layui-form-select .layui-select-group dd{padding-left:20px}.layui-form-select dl dd.layui-this{background-color:#5FB878;color:#fff}.layui-form-checkbox,.layui-form-select dl dd.layui-disabled{background-color:#fff}.layui-form-selected dl{display:block}.layui-form-checkbox,.layui-form-checkbox *,.layui-form-radio,.layui-form-radio *,.layui-form-switch{display:inline-block;vertical-align:middle}.layui-form-selected .layui-edge{margin-top:-9px;-webkit-transform:rotate(180deg);transform:rotate(180deg);margin-top:-3px\9}:root .layui-form-selected .layui-edge{margin-top:-9px\0/IE9}.layui-select-none{margin:5px 0;text-align:center;color:#999}.layui-select-disabled .layui-disabled{border-color:#eee!important}.layui-select-disabled .layui-edge{border-top-color:#d2d2d2}.layui-form-checkbox{position:relative;height:30px;line-height:28px;margin-right:10px;padding-right:30px;border:1px solid #d2d2d2;cursor:pointer;font-size:0;border-radius:2px;-webkit-transition:.1s linear;transition:.1s linear;box-sizing:border-box!important}.layui-form-checkbox:hover{border:1px solid #c2c2c2}.layui-form-checkbox span{padding:0 10px;height:100%;font-size:14px;background-color:#d2d2d2;color:#fff;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.layui-form-checkbox:hover span{background-color:#c2c2c2}.layui-form-checkbox i{position:absolute;right:0;width:30px;color:#fff;font-size:20px;text-align:center}.layui-form-checkbox:hover i{color:#c2c2c2}.layui-form-checked,.layui-form-checked:hover{border-color:#5FB878}.layui-form-checked span,.layui-form-checked:hover span{background-color:#5FB878}.layui-form-checked i,.layui-form-checked:hover i{color:#5FB878}.layui-form-item .layui-form-checkbox{margin-top:4px}.layui-form-checkbox[lay-skin=primary]{height:auto!important;line-height:normal!important;border:none!important;margin-right:0;padding-right:0;background:0 0}.layui-form-checkbox[lay-skin=primary] span{float:right;padding-right:15px;line-height:18px;background:0 0;color:#666}.layui-form-checkbox[lay-skin=primary] i{position:relative;top:0;width:16px;line-height:16px;border:1px solid #d2d2d2;font-size:12px;border-radius:2px;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-checkbox[lay-skin=primary]:hover i{border-color:#5FB878;color:#fff}.layui-form-checked[lay-skin=primary] i{border-color:#5FB878;background-color:#5FB878;color:#fff}.layui-checkbox-disbaled[lay-skin=primary] span{background:0 0!important}.layui-checkbox-disbaled[lay-skin=primary]:hover i{border-color:#d2d2d2}.layui-form-item .layui-form-checkbox[lay-skin=primary]{margin-top:10px}.layui-form-switch{position:relative;height:22px;line-height:22px;width:42px;padding:0 5px;margin-top:8px;border:1px solid #d2d2d2;border-radius:20px;cursor:pointer;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-switch i{position:absolute;left:5px;top:3px;width:16px;height:16px;border-radius:20px;background-color:#d2d2d2;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-switch em{position:absolute;right:5px;top:0;width:25px;padding:0!important;text-align:center!important;color:#999!important;font-style:normal!important;font-size:12px}.layui-form-onswitch{border-color:#5FB878;background-color:#5FB878}.layui-form-onswitch i{left:32px;background-color:#fff}.layui-form-onswitch em{left:5px;right:auto;color:#fff!important}.layui-checkbox-disbaled{border-color:#e2e2e2!important}.layui-checkbox-disbaled span{background-color:#e2e2e2!important}.layui-checkbox-disbaled:hover i{color:#fff!important}.layui-form-radio{line-height:28px;margin:6px 10px 0 0;padding-right:10px;cursor:pointer;font-size:0}.layui-form-radio i{margin-right:8px;font-size:22px;color:#c2c2c2}.layui-form-radio span{font-size:14px}.layui-form-radio i:hover,.layui-form-radioed i{color:#5FB878}.layui-radio-disbaled i{color:#e2e2e2!important}.layui-form-pane .layui-form-label{width:110px;padding:8px 15px;height:38px;line-height:20px;border:1px solid #e6e6e6;border-radius:2px 0 0 2px;text-align:center;background-color:#FBFBFB;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important}.layui-form-pane .layui-input-inline{margin-left:-1px}.layui-form-pane .layui-input-block{margin-left:110px;left:-1px}.layui-form-pane .layui-input{border-radius:0 2px 2px 0}.layui-form-pane .layui-form-text .layui-form-label{float:none;width:100%;border-right:1px solid #e6e6e6;border-radius:2px;-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important;text-align:left}.layui-laypage button,.layui-laypage input,.layui-nav{-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important}.layui-form-pane .layui-form-text .layui-input-inline{display:block;margin:0;top:-1px;clear:both}.layui-form-pane .layui-form-text .layui-input-block{margin:0;left:0;top:-1px}.layui-form-pane .layui-form-text .layui-textarea{min-height:100px;border-radius:0 0 2px 2px}.layui-form-pane .layui-form-checkbox{margin:4px 0 4px 10px}.layui-form-pane .layui-form-radio,.layui-form-pane .layui-form-switch{margin-top:6px;margin-left:10px}.layui-form-pane .layui-form-item[pane]{position:relative;border:1px solid #e6e6e6}.layui-form-pane .layui-form-item[pane] .layui-form-label{position:absolute;left:0;top:0;height:100%;border-width:0 1px 0 0}.layui-form-pane .layui-form-item[pane] .layui-input-inline{margin-left:110px}.layui-layedit{border:1px solid #d2d2d2;border-radius:2px}.layui-layedit-tool{padding:3px 5px;border-bottom:1px solid #e2e2e2;font-size:0}.layedit-tool-fixed{position:fixed;top:0;border-top:1px solid #e2e2e2}.layui-layedit-tool .layedit-tool-mid,.layui-layedit-tool .layui-icon{display:inline-block;vertical-align:middle;text-align:center;font-size:14px}.layui-layedit-tool .layui-icon{position:relative;width:32px;height:30px;line-height:30px;margin:3px 5px;color:#777;cursor:pointer;border-radius:2px}.layui-layedit-tool .layui-icon:hover{color:#393D49}.layui-layedit-tool .layui-icon:active{color:#000}.layui-layedit-tool .layedit-tool-active{background-color:#e2e2e2;color:#000}.layui-layedit-tool .layui-disabled,.layui-layedit-tool .layui-disabled:hover{color:#d2d2d2;cursor:not-allowed}.layui-layedit-tool .layedit-tool-mid{width:1px;height:18px;margin:0 10px;background-color:#d2d2d2}.layedit-tool-html{width:50px!important;font-size:30px!important}.layedit-tool-b,.layedit-tool-code,.layedit-tool-help{font-size:16px!important}.layedit-tool-d,.layedit-tool-face,.layedit-tool-image,.layedit-tool-unlink{font-size:18px!important}.layedit-tool-image input{position:absolute;font-size:0;left:0;top:0;width:100%;height:100%;opacity:.01;filter:Alpha(opacity=1);cursor:pointer}.layui-layedit-iframe iframe{display:block;width:100%}#LAY_layedit_code{overflow:hidden}.layui-table{width:100%;margin:10px 0;background-color:#fff}.layui-table tr{transition:all .3s;-webkit-transition:all .3s}.layui-table thead tr{background-color:#f2f2f2}.layui-table th{text-align:left}.layui-table td,.layui-table th{padding:9px 15px;min-height:20px;line-height:20px;border:1px solid #e2e2e2;font-size:14px}.layui-table tr:hover,.layui-table[lay-even] tr:nth-child(even){background-color:#f8f8f8}.layui-table[lay-skin=line],.layui-table[lay-skin=row]{border:1px solid #e2e2e2}.layui-table[lay-skin=line] td,.layui-table[lay-skin=line] th{border:none;border-bottom:1px solid #e2e2e2}.layui-table[lay-skin=row] td,.layui-table[lay-skin=row] th{border:none;border-right:1px solid #e2e2e2}.layui-table[lay-skin=nob] td,.layui-table[lay-skin=nob] th{border:none}.layui-upload-button{position:relative;display:inline-block;vertical-align:middle;min-width:60px;height:38px;line-height:38px;border:1px solid #DFDFDF;border-radius:2px;overflow:hidden;background-color:#fff;color:#666}.layui-upload-button:hover{border:1px solid #aaa;color:#333}.layui-upload-button:active{border:1px solid #4CAF50;color:#000}.layui-upload-button input,.layui-upload-file{opacity:.01;filter:Alpha(opacity=1);cursor:pointer}.layui-upload-button input{position:absolute;left:0;top:0;z-index:10;font-size:100px;width:100%;height:100%}.layui-upload-icon{display:block;margin:0 15px;text-align:center}.layui-upload-icon i{margin-right:5px;vertical-align:top;font-size:20px;color:#5FB878}.layui-upload-iframe{position:absolute;width:0;height:0;border:0;visibility:hidden}.layui-upload-enter{border:1px solid #009E94;background-color:#009E94;color:#fff;-webkit-transform:scale(1.1);transform:scale(1.1)}.layui-upload-enter .layui-upload-icon,.layui-upload-enter .layui-upload-icon i{color:#fff}.layui-flow-more{margin:10px 0;text-align:center;color:#999;font-size:14px}.layui-flow-more a{height:32px;line-height:32px}.layui-flow-more a *{display:inline-block;vertical-align:top}.layui-flow-more a cite{padding:0 20px;border-radius:3px;background-color:#eee;color:#333;font-style:normal}.layui-flow-more a cite:hover{opacity:.8}.layui-flow-more a i{font-size:30px;color:#737383}.layui-laypage{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;margin:10px 0;font-size:0}.layui-laypage>:first-child,.layui-laypage>:first-child em{border-radius:2px 0 0 2px}.layui-laypage>:last-child,.layui-laypage>:last-child em{border-radius:0 2px 2px 0}.layui-laypage a,.layui-laypage span{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;padding:0 15px;border:1px solid #e2e2e2;height:28px;line-height:28px;margin:0 -1px 5px 0;background-color:#fff;color:#333;font-size:12px}.layui-laypage em{font-style:normal}.layui-laypage span{color:#999;font-weight:700}.layui-laypage .layui-laypage-curr{position:relative}.layui-laypage .layui-laypage-curr em{position:relative;color:#fff;font-weight:400}.layui-laypage .layui-laypage-curr .layui-laypage-em{position:absolute;left:-1px;top:-1px;padding:1px;width:100%;height:100%;background-color:#009688}.layui-laypage-em{border-radius:2px}.layui-laypage-next em,.layui-laypage-prev em{font-family:Sim sun;font-size:16px}.layui-laypage .layui-laypage-total{height:30px;line-height:30px;margin-left:1px;border:none;font-weight:400}.layui-laypage button,.layui-laypage input{height:30px;line-height:30px;border:1px solid #e2e2e2;border-radius:2px;vertical-align:top;background-color:#fff;box-sizing:border-box!important}.layui-laypage input{width:50px;margin:0 5px;text-align:center}.layui-laypage button{margin-left:5px;padding:0 15px;cursor:pointer}.layui-code{position:relative;margin:10px 0;padding:15px;line-height:20px;border:1px solid #ddd;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New;font-size:12px}.layui-tree{line-height:26px}.layui-tree li{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-tree li .layui-tree-spread,.layui-tree li a{display:inline-block;vertical-align:top;height:26px;*display:inline;*zoom:1;cursor:pointer}.layui-tree li a{font-size:0}.layui-tree li a i{font-size:16px}.layui-tree li a cite{padding:0 6px;font-size:14px;font-style:normal}.layui-tree li i{padding-left:6px;color:#333}.layui-tree li .layui-tree-check{font-size:13px}.layui-tree li .layui-tree-check:hover{color:#009E94}.layui-tree li ul{display:none;margin-left:20px}.layui-tree li .layui-tree-enter{line-height:24px;border:1px dotted #000}.layui-tree-drag{display:none;position:absolute;left:-666px;top:-666px;background-color:#f2f2f2;padding:5px 10px;border:1px dotted #000;white-space:nowrap}.layui-tree-drag i{padding-right:5px}.layui-nav{position:relative;padding:0 20px;background-color:#393D49;color:#c2c2c2;border-radius:2px;font-size:0;box-sizing:border-box!important}.layui-nav *{font-size:14px}.layui-nav .layui-nav-item{position:relative;display:inline-block;*display:inline;*zoom:1;vertical-align:middle;line-height:60px}.layui-nav .layui-nav-item a{display:block;padding:0 20px;color:#c2c2c2;transition:all .3s;-webkit-transition:all .3s}.layui-nav .layui-this:after,.layui-nav-bar,.layui-nav-tree .layui-nav-itemed:after{position:absolute;left:0;top:0;width:0;height:5px;background-color:#5FB878;transition:all .2s;-webkit-transition:all .2s}.layui-nav-bar{z-index:1000}.layui-nav .layui-nav-item a:hover,.layui-nav .layui-this a{color:#fff}.layui-nav .layui-this:after{content:'';top:auto;bottom:0;width:100%}.layui-nav .layui-nav-more{content:'';width:0;height:0;border-style:solid dashed dashed;border-color:#c2c2c2 transparent transparent;overflow:hidden;cursor:pointer;transition:all .2s;-webkit-transition:all .2s;position:absolute;top:28px;right:3px;border-width:6px}.layui-nav .layui-nav-mored,.layui-nav-itemed .layui-nav-more{top:22px;border-style:dashed dashed solid;border-color:transparent transparent #c2c2c2}.layui-nav-child{display:none;position:absolute;left:0;top:65px;min-width:100%;line-height:36px;padding:5px 0;box-shadow:0 2px 4px rgba(0,0,0,.12);border:1px solid #d2d2d2;background-color:#fff;z-index:100;border-radius:2px;white-space:nowrap}.layui-nav .layui-nav-child a{color:#333}.layui-nav .layui-nav-child a:hover{background-color:#f2f2f2;color:#333}.layui-nav-child dd{position:relative}.layui-nav-child dd.layui-this{background-color:#5FB878;color:#fff}.layui-nav-child dd.layui-this a{color:#fff}.layui-nav-child dd.layui-this:after{display:none}.layui-nav-tree{width:200px;padding:0}.layui-nav-tree .layui-nav-item{display:block;width:100%;line-height:45px}.layui-nav-tree .layui-nav-item a{height:45px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-nav-tree .layui-nav-item a:hover{background-color:#4E5465}.layui-nav-tree .layui-nav-child dd.layui-this,.layui-nav-tree .layui-this,.layui-nav-tree .layui-this>a,.layui-nav-tree .layui-this>a:hover{background-color:#009688;color:#fff}.layui-nav-tree .layui-this:after{display:none}.layui-nav-itemed>a,.layui-nav-tree .layui-nav-title a,.layui-nav-tree .layui-nav-title a:hover{background-color:#2B2E37!important;color:#fff!important}.layui-nav-tree .layui-nav-bar{width:5px;height:0;background-color:#009688}.layui-nav-tree .layui-nav-child{position:relative;z-index:0;top:0;border:none;box-shadow:none}.layui-nav-tree .layui-nav-child a{height:40px;line-height:40px;color:#c2c2c2}.layui-nav-tree .layui-nav-child,.layui-nav-tree .layui-nav-child a:hover{background:0 0;color:#fff}.layui-nav-tree .layui-nav-more{top:20px;right:10px}.layui-nav-itemed .layui-nav-more{top:14px}.layui-nav-itemed .layui-nav-child{display:block;padding:0}.layui-nav-side{position:fixed;top:0;bottom:0;left:0;overflow-x:hidden;z-index:999}.layui-breadcrumb{visibility:hidden;font-size:0}.layui-breadcrumb a{padding-right:8px;line-height:22px;font-size:14px;color:#333!important}.layui-breadcrumb a:hover{color:#01AAED!important}.layui-breadcrumb a cite,.layui-breadcrumb a span{color:#666;cursor:text;font-style:normal}.layui-breadcrumb a span{padding-left:8px;font-family:Sim sun}.layui-tab{margin:10px 0;text-align:left!important}.layui-fixbar li,.layui-tab-bar,.layui-tab-title li,.layui-util-face ul li{cursor:pointer;text-align:center}.layui-tab[overflow]>.layui-tab-title{overflow:hidden}.layui-tab-title{position:relative;left:0;height:40px;white-space:nowrap;font-size:0;border-bottom:1px solid #e2e2e2;transition:all .2s;-webkit-transition:all .2s}.layui-tab-title li{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;font-size:14px;transition:all .2s;-webkit-transition:all .2s;position:relative;line-height:40px;min-width:65px;padding:0 10px}.layui-tab-title li a{display:block}.layui-tab-title .layui-this{color:#000}.layui-tab-title .layui-this:after{position:absolute;left:0;top:0;content:'';width:100%;height:41px;border:1px solid #e2e2e2;border-bottom-color:#fff;border-radius:2px 2px 0 0;-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important;pointer-events:none}.layui-tab-bar{position:absolute;right:0;top:0;z-index:10;width:30px;height:39px;line-height:39px;border:1px solid #e2e2e2;border-radius:2px;background-color:#fff}.layui-tab-bar .layui-icon{position:relative;display:inline-block;top:3px;transition:all .3s;-webkit-transition:all .3s}.layui-tab-item,.layui-util-face .layui-layer-TipsG{display:none}.layui-tab-more{padding-right:30px;height:auto;white-space:normal}.layui-tab-more li.layui-this:after{border-bottom-color:#e2e2e2;border-radius:2px}.layui-tab-more .layui-tab-bar .layui-icon{top:-2px;top:3px\9;-webkit-transform:rotate(180deg);transform:rotate(180deg)}:root .layui-tab-more .layui-tab-bar .layui-icon{top:-2px\0/IE9}.layui-tab-content{padding:10px}.layui-tab-title li .layui-tab-close{position:relative;margin-left:8px;top:1px;color:#c2c2c2;transition:all .2s;-webkit-transition:all .2s}.layui-tab-title li .layui-tab-close:hover{border-radius:2px;background-color:#FF5722;color:#fff}.layui-tab-brief>.layui-tab-title .layui-this{color:#009688}.layui-tab-brief>.layui-tab-more li.layui-this:after,.layui-tab-brief>.layui-tab-title .layui-this:after{border:none;border-radius:0;border-bottom:3px solid #5FB878}.layui-tab-brief[overflow]>.layui-tab-title .layui-this:after{top:-1px}.layui-tab-card{border:1px solid #e2e2e2;border-radius:2px;box-shadow:0 2px 5px 0 rgba(0,0,0,.1)}.layui-tab-card>.layui-tab-title{background-color:#f2f2f2}.layui-tab-card>.layui-tab-title li{margin-right:-1px;margin-left:-1px}.layui-tab-card>.layui-tab-title .layui-this{background-color:#fff}.layui-tab-card>.layui-tab-title .layui-this:after{border-top:none;border-width:1px;border-bottom-color:#fff}.layui-tab-card>.layui-tab-title .layui-tab-bar{height:40px;line-height:40px;border-radius:0;border-top:none;border-right:none}.layui-tab-card>.layui-tab-more .layui-this{background:0 0;color:#5FB878}.layui-tab-card>.layui-tab-more .layui-this:after{border:none}.layui-fixbar{position:fixed;right:15px;bottom:15px;z-index:9999}.layui-fixbar li{width:50px;height:50px;line-height:50px;margin-bottom:1px;font-size:30px;background-color:#9F9F9F;color:#fff;border-radius:2px;opacity:.95}.layui-fixbar li:hover{opacity:.85}.layui-fixbar li:active{opacity:1}.layui-fixbar .layui-fixbar-top{display:none;font-size:40px}body .layui-util-face{border:none;background:0 0}body .layui-util-face .layui-layer-content{padding:0;background-color:#fff;color:#666;box-shadow:none}.layui-util-face ul{position:relative;width:372px;padding:10px;border:1px solid #D9D9D9;background-color:#fff;box-shadow:0 0 20px rgba(0,0,0,.2)}.layui-util-face ul li{float:left;border:1px solid #e8e8e8;height:22px;width:26px;overflow:hidden;margin:-1px 0 0 -1px;padding:4px 2px}.layui-util-face ul li:hover{position:relative;z-index:2;border:1px solid #eb7350;background:#fff9ec}.layui-anim{-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-anim-loop{-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}@-webkit-keyframes layui-rotate{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(360deg)}}@keyframes layui-rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}.layui-anim-rotate{-webkit-animation-name:layui-rotate;animation-name:layui-rotate;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes layui-up{from{-webkit-transform:translate3d(0,100%,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes layui-up{from{transform:translate3d(0,100%,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-anim-up{-webkit-animation-name:layui-up;animation-name:layui-up}@-webkit-keyframes layui-upbit{from{-webkit-transform:translate3d(0,30px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes layui-upbit{from{transform:translate3d(0,30px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-anim-upbit{-webkit-animation-name:layui-upbit;animation-name:layui-upbit}@-webkit-keyframes layui-scale{0%{opacity:.3;-webkit-transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1)}}@keyframes layui-scale{0%{opacity:.3;-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-ms-transform:scale(1);transform:scale(1)}}.layui-anim-scale{-webkit-animation-name:layui-scale;animation-name:layui-scale}@-webkit-keyframes layui-scale-spring{0%{opacity:.5;-webkit-transform:scale(.5)}80%{opacity:.8;-webkit-transform:scale(1.1)}100%{opacity:1;-webkit-transform:scale(1)}}@keyframes layui-scale-spring{0%{opacity:.5;-ms-transform:scale(.5);transform:scale(.5)}80%{opacity:.8;-ms-transform:scale(1.1);transform:scale(1.1)}100%{opacity:1;-ms-transform:scale(1);transform:scale(1)}}.layui-anim-scaleSpring{-webkit-animation-name:layui-scale-spring;animation-name:layui-scale-spring}@media screen and (max-width:450px){.layui-form-item .layui-form-label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-form-item .layui-inline{display:block;margin-right:0;margin-bottom:20px;clear:both}.layui-form-item .layui-inline:after{content:'\20';clear:both;display:block;height:0}.layui-form-item .layui-input-inline{display:block;float:none;left:-3px;width:auto;margin:0 0 10px 112px}.layui-form-item .layui-input-inline+.layui-form-mid{margin-left:110px;top:-5px;padding:0}.layui-form-item .layui-form-checkbox{margin-right:5px;margin-bottom:5px}} -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/js/qrcode.js: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------- 2 | // QRCode for JavaScript 3 | // 4 | // Copyright (c) 2009 Kazuhiko Arase 5 | // 6 | // URL: http://www.d-project.com/ 7 | // 8 | // Licensed under the MIT license: 9 | // http://www.opensource.org/licenses/mit-license.php 10 | // 11 | // The word "QR Code" is registered trademark of 12 | // DENSO WAVE INCORPORATED 13 | // http://www.denso-wave.com/qrcode/faqpatent-e.html 14 | // 15 | //--------------------------------------------------------------------- 16 | 17 | //--------------------------------------------------------------------- 18 | // QR8bitByte 19 | //--------------------------------------------------------------------- 20 | 21 | function QR8bitByte(data) { 22 | this.mode = QRMode.MODE_8BIT_BYTE; 23 | this.data = data; 24 | } 25 | 26 | QR8bitByte.prototype = { 27 | 28 | getLength : function(buffer) { 29 | return this.data.length; 30 | }, 31 | 32 | write : function(buffer) { 33 | for (var i = 0; i < this.data.length; i++) { 34 | // not JIS ... 35 | buffer.put(this.data.charCodeAt(i), 8); 36 | } 37 | } 38 | }; 39 | 40 | //--------------------------------------------------------------------- 41 | // QRCode 42 | //--------------------------------------------------------------------- 43 | 44 | function QRCode(typeNumber, errorCorrectLevel) { 45 | this.typeNumber = typeNumber; 46 | this.errorCorrectLevel = errorCorrectLevel; 47 | this.modules = null; 48 | this.moduleCount = 0; 49 | this.dataCache = null; 50 | this.dataList = new Array(); 51 | } 52 | 53 | QRCode.prototype = { 54 | 55 | addData : function(data) { 56 | var newData = new QR8bitByte(data); 57 | this.dataList.push(newData); 58 | this.dataCache = null; 59 | }, 60 | 61 | isDark : function(row, col) { 62 | if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { 63 | throw new Error(row + "," + col); 64 | } 65 | return this.modules[row][col]; 66 | }, 67 | 68 | getModuleCount : function() { 69 | return this.moduleCount; 70 | }, 71 | 72 | make : function() { 73 | this.makeImpl(false, this.getBestMaskPattern() ); 74 | }, 75 | 76 | makeImpl : function(test, maskPattern) { 77 | 78 | this.moduleCount = this.typeNumber * 4 + 17; 79 | this.modules = new Array(this.moduleCount); 80 | 81 | for (var row = 0; row < this.moduleCount; row++) { 82 | 83 | this.modules[row] = new Array(this.moduleCount); 84 | 85 | for (var col = 0; col < this.moduleCount; col++) { 86 | this.modules[row][col] = null;//(col + row) % 3; 87 | } 88 | } 89 | 90 | this.setupPositionProbePattern(0, 0); 91 | this.setupPositionProbePattern(this.moduleCount - 7, 0); 92 | this.setupPositionProbePattern(0, this.moduleCount - 7); 93 | this.setupPositionAdjustPattern(); 94 | this.setupTimingPattern(); 95 | this.setupTypeInfo(test, maskPattern); 96 | 97 | if (this.typeNumber >= 7) { 98 | this.setupTypeNumber(test); 99 | } 100 | 101 | if (this.dataCache == null) { 102 | this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); 103 | } 104 | 105 | this.mapData(this.dataCache, maskPattern); 106 | }, 107 | 108 | setupPositionProbePattern : function(row, col) { 109 | 110 | for (var r = -1; r <= 7; r++) { 111 | 112 | if (row + r <= -1 || this.moduleCount <= row + r) continue; 113 | 114 | for (var c = -1; c <= 7; c++) { 115 | 116 | if (col + c <= -1 || this.moduleCount <= col + c) continue; 117 | 118 | if ( (0 <= r && r <= 6 && (c == 0 || c == 6) ) 119 | || (0 <= c && c <= 6 && (r == 0 || r == 6) ) 120 | || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) { 121 | this.modules[row + r][col + c] = true; 122 | } else { 123 | this.modules[row + r][col + c] = false; 124 | } 125 | } 126 | } 127 | }, 128 | 129 | getBestMaskPattern : function() { 130 | 131 | var minLostPoint = 0; 132 | var pattern = 0; 133 | 134 | for (var i = 0; i < 8; i++) { 135 | 136 | this.makeImpl(true, i); 137 | 138 | var lostPoint = QRUtil.getLostPoint(this); 139 | 140 | if (i == 0 || minLostPoint > lostPoint) { 141 | minLostPoint = lostPoint; 142 | pattern = i; 143 | } 144 | } 145 | 146 | return pattern; 147 | }, 148 | 149 | createMovieClip : function(target_mc, instance_name, depth) { 150 | 151 | var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); 152 | var cs = 1; 153 | 154 | this.make(); 155 | 156 | for (var row = 0; row < this.modules.length; row++) { 157 | 158 | var y = row * cs; 159 | 160 | for (var col = 0; col < this.modules[row].length; col++) { 161 | 162 | var x = col * cs; 163 | var dark = this.modules[row][col]; 164 | 165 | if (dark) { 166 | qr_mc.beginFill(0, 100); 167 | qr_mc.moveTo(x, y); 168 | qr_mc.lineTo(x + cs, y); 169 | qr_mc.lineTo(x + cs, y + cs); 170 | qr_mc.lineTo(x, y + cs); 171 | qr_mc.endFill(); 172 | } 173 | } 174 | } 175 | 176 | return qr_mc; 177 | }, 178 | 179 | setupTimingPattern : function() { 180 | 181 | for (var r = 8; r < this.moduleCount - 8; r++) { 182 | if (this.modules[r][6] != null) { 183 | continue; 184 | } 185 | this.modules[r][6] = (r % 2 == 0); 186 | } 187 | 188 | for (var c = 8; c < this.moduleCount - 8; c++) { 189 | if (this.modules[6][c] != null) { 190 | continue; 191 | } 192 | this.modules[6][c] = (c % 2 == 0); 193 | } 194 | }, 195 | 196 | setupPositionAdjustPattern : function() { 197 | 198 | var pos = QRUtil.getPatternPosition(this.typeNumber); 199 | 200 | for (var i = 0; i < pos.length; i++) { 201 | 202 | for (var j = 0; j < pos.length; j++) { 203 | 204 | var row = pos[i]; 205 | var col = pos[j]; 206 | 207 | if (this.modules[row][col] != null) { 208 | continue; 209 | } 210 | 211 | for (var r = -2; r <= 2; r++) { 212 | 213 | for (var c = -2; c <= 2; c++) { 214 | 215 | if (r == -2 || r == 2 || c == -2 || c == 2 216 | || (r == 0 && c == 0) ) { 217 | this.modules[row + r][col + c] = true; 218 | } else { 219 | this.modules[row + r][col + c] = false; 220 | } 221 | } 222 | } 223 | } 224 | } 225 | }, 226 | 227 | setupTypeNumber : function(test) { 228 | 229 | var bits = QRUtil.getBCHTypeNumber(this.typeNumber); 230 | 231 | for (var i = 0; i < 18; i++) { 232 | var mod = (!test && ( (bits >> i) & 1) == 1); 233 | this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; 234 | } 235 | 236 | for (var i = 0; i < 18; i++) { 237 | var mod = (!test && ( (bits >> i) & 1) == 1); 238 | this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; 239 | } 240 | }, 241 | 242 | setupTypeInfo : function(test, maskPattern) { 243 | 244 | var data = (this.errorCorrectLevel << 3) | maskPattern; 245 | var bits = QRUtil.getBCHTypeInfo(data); 246 | 247 | // vertical 248 | for (var i = 0; i < 15; i++) { 249 | 250 | var mod = (!test && ( (bits >> i) & 1) == 1); 251 | 252 | if (i < 6) { 253 | this.modules[i][8] = mod; 254 | } else if (i < 8) { 255 | this.modules[i + 1][8] = mod; 256 | } else { 257 | this.modules[this.moduleCount - 15 + i][8] = mod; 258 | } 259 | } 260 | 261 | // horizontal 262 | for (var i = 0; i < 15; i++) { 263 | 264 | var mod = (!test && ( (bits >> i) & 1) == 1); 265 | 266 | if (i < 8) { 267 | this.modules[8][this.moduleCount - i - 1] = mod; 268 | } else if (i < 9) { 269 | this.modules[8][15 - i - 1 + 1] = mod; 270 | } else { 271 | this.modules[8][15 - i - 1] = mod; 272 | } 273 | } 274 | 275 | // fixed module 276 | this.modules[this.moduleCount - 8][8] = (!test); 277 | 278 | }, 279 | 280 | mapData : function(data, maskPattern) { 281 | 282 | var inc = -1; 283 | var row = this.moduleCount - 1; 284 | var bitIndex = 7; 285 | var byteIndex = 0; 286 | 287 | for (var col = this.moduleCount - 1; col > 0; col -= 2) { 288 | 289 | if (col == 6) col--; 290 | 291 | while (true) { 292 | 293 | for (var c = 0; c < 2; c++) { 294 | 295 | if (this.modules[row][col - c] == null) { 296 | 297 | var dark = false; 298 | 299 | if (byteIndex < data.length) { 300 | dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1); 301 | } 302 | 303 | var mask = QRUtil.getMask(maskPattern, row, col - c); 304 | 305 | if (mask) { 306 | dark = !dark; 307 | } 308 | 309 | this.modules[row][col - c] = dark; 310 | bitIndex--; 311 | 312 | if (bitIndex == -1) { 313 | byteIndex++; 314 | bitIndex = 7; 315 | } 316 | } 317 | } 318 | 319 | row += inc; 320 | 321 | if (row < 0 || this.moduleCount <= row) { 322 | row -= inc; 323 | inc = -inc; 324 | break; 325 | } 326 | } 327 | } 328 | 329 | } 330 | 331 | }; 332 | 333 | QRCode.PAD0 = 0xEC; 334 | QRCode.PAD1 = 0x11; 335 | 336 | QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) { 337 | 338 | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); 339 | 340 | var buffer = new QRBitBuffer(); 341 | 342 | for (var i = 0; i < dataList.length; i++) { 343 | var data = dataList[i]; 344 | buffer.put(data.mode, 4); 345 | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); 346 | data.write(buffer); 347 | } 348 | 349 | // calc num max data. 350 | var totalDataCount = 0; 351 | for (var i = 0; i < rsBlocks.length; i++) { 352 | totalDataCount += rsBlocks[i].dataCount; 353 | } 354 | 355 | if (buffer.getLengthInBits() > totalDataCount * 8) { 356 | throw new Error("code length overflow. (" 357 | + buffer.getLengthInBits() 358 | + ">" 359 | + totalDataCount * 8 360 | + ")"); 361 | } 362 | 363 | // end code 364 | if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { 365 | buffer.put(0, 4); 366 | } 367 | 368 | // padding 369 | while (buffer.getLengthInBits() % 8 != 0) { 370 | buffer.putBit(false); 371 | } 372 | 373 | // padding 374 | while (true) { 375 | 376 | if (buffer.getLengthInBits() >= totalDataCount * 8) { 377 | break; 378 | } 379 | buffer.put(QRCode.PAD0, 8); 380 | 381 | if (buffer.getLengthInBits() >= totalDataCount * 8) { 382 | break; 383 | } 384 | buffer.put(QRCode.PAD1, 8); 385 | } 386 | 387 | return QRCode.createBytes(buffer, rsBlocks); 388 | } 389 | 390 | QRCode.createBytes = function(buffer, rsBlocks) { 391 | 392 | var offset = 0; 393 | 394 | var maxDcCount = 0; 395 | var maxEcCount = 0; 396 | 397 | var dcdata = new Array(rsBlocks.length); 398 | var ecdata = new Array(rsBlocks.length); 399 | 400 | for (var r = 0; r < rsBlocks.length; r++) { 401 | 402 | var dcCount = rsBlocks[r].dataCount; 403 | var ecCount = rsBlocks[r].totalCount - dcCount; 404 | 405 | maxDcCount = Math.max(maxDcCount, dcCount); 406 | maxEcCount = Math.max(maxEcCount, ecCount); 407 | 408 | dcdata[r] = new Array(dcCount); 409 | 410 | for (var i = 0; i < dcdata[r].length; i++) { 411 | dcdata[r][i] = 0xff & buffer.buffer[i + offset]; 412 | } 413 | offset += dcCount; 414 | 415 | var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); 416 | var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); 417 | 418 | var modPoly = rawPoly.mod(rsPoly); 419 | ecdata[r] = new Array(rsPoly.getLength() - 1); 420 | for (var i = 0; i < ecdata[r].length; i++) { 421 | var modIndex = i + modPoly.getLength() - ecdata[r].length; 422 | ecdata[r][i] = (modIndex >= 0)? modPoly.get(modIndex) : 0; 423 | } 424 | 425 | } 426 | 427 | var totalCodeCount = 0; 428 | for (var i = 0; i < rsBlocks.length; i++) { 429 | totalCodeCount += rsBlocks[i].totalCount; 430 | } 431 | 432 | var data = new Array(totalCodeCount); 433 | var index = 0; 434 | 435 | for (var i = 0; i < maxDcCount; i++) { 436 | for (var r = 0; r < rsBlocks.length; r++) { 437 | if (i < dcdata[r].length) { 438 | data[index++] = dcdata[r][i]; 439 | } 440 | } 441 | } 442 | 443 | for (var i = 0; i < maxEcCount; i++) { 444 | for (var r = 0; r < rsBlocks.length; r++) { 445 | if (i < ecdata[r].length) { 446 | data[index++] = ecdata[r][i]; 447 | } 448 | } 449 | } 450 | 451 | return data; 452 | 453 | } 454 | 455 | //--------------------------------------------------------------------- 456 | // QRMode 457 | //--------------------------------------------------------------------- 458 | 459 | var QRMode = { 460 | MODE_NUMBER : 1 << 0, 461 | MODE_ALPHA_NUM : 1 << 1, 462 | MODE_8BIT_BYTE : 1 << 2, 463 | MODE_KANJI : 1 << 3 464 | }; 465 | 466 | //--------------------------------------------------------------------- 467 | // QRErrorCorrectLevel 468 | //--------------------------------------------------------------------- 469 | 470 | var QRErrorCorrectLevel = { 471 | L : 1, 472 | M : 0, 473 | Q : 3, 474 | H : 2 475 | }; 476 | 477 | //--------------------------------------------------------------------- 478 | // QRMaskPattern 479 | //--------------------------------------------------------------------- 480 | 481 | var QRMaskPattern = { 482 | PATTERN000 : 0, 483 | PATTERN001 : 1, 484 | PATTERN010 : 2, 485 | PATTERN011 : 3, 486 | PATTERN100 : 4, 487 | PATTERN101 : 5, 488 | PATTERN110 : 6, 489 | PATTERN111 : 7 490 | }; 491 | 492 | //--------------------------------------------------------------------- 493 | // QRUtil 494 | //--------------------------------------------------------------------- 495 | 496 | var QRUtil = { 497 | 498 | PATTERN_POSITION_TABLE : [ 499 | [], 500 | [6, 18], 501 | [6, 22], 502 | [6, 26], 503 | [6, 30], 504 | [6, 34], 505 | [6, 22, 38], 506 | [6, 24, 42], 507 | [6, 26, 46], 508 | [6, 28, 50], 509 | [6, 30, 54], 510 | [6, 32, 58], 511 | [6, 34, 62], 512 | [6, 26, 46, 66], 513 | [6, 26, 48, 70], 514 | [6, 26, 50, 74], 515 | [6, 30, 54, 78], 516 | [6, 30, 56, 82], 517 | [6, 30, 58, 86], 518 | [6, 34, 62, 90], 519 | [6, 28, 50, 72, 94], 520 | [6, 26, 50, 74, 98], 521 | [6, 30, 54, 78, 102], 522 | [6, 28, 54, 80, 106], 523 | [6, 32, 58, 84, 110], 524 | [6, 30, 58, 86, 114], 525 | [6, 34, 62, 90, 118], 526 | [6, 26, 50, 74, 98, 122], 527 | [6, 30, 54, 78, 102, 126], 528 | [6, 26, 52, 78, 104, 130], 529 | [6, 30, 56, 82, 108, 134], 530 | [6, 34, 60, 86, 112, 138], 531 | [6, 30, 58, 86, 114, 142], 532 | [6, 34, 62, 90, 118, 146], 533 | [6, 30, 54, 78, 102, 126, 150], 534 | [6, 24, 50, 76, 102, 128, 154], 535 | [6, 28, 54, 80, 106, 132, 158], 536 | [6, 32, 58, 84, 110, 136, 162], 537 | [6, 26, 54, 82, 110, 138, 166], 538 | [6, 30, 58, 86, 114, 142, 170] 539 | ], 540 | 541 | G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), 542 | G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), 543 | G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), 544 | 545 | getBCHTypeInfo : function(data) { 546 | var d = data << 10; 547 | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { 548 | d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) ); 549 | } 550 | return ( (data << 10) | d) ^ QRUtil.G15_MASK; 551 | }, 552 | 553 | getBCHTypeNumber : function(data) { 554 | var d = data << 12; 555 | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { 556 | d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) ); 557 | } 558 | return (data << 12) | d; 559 | }, 560 | 561 | getBCHDigit : function(data) { 562 | 563 | var digit = 0; 564 | 565 | while (data != 0) { 566 | digit++; 567 | data >>>= 1; 568 | } 569 | 570 | return digit; 571 | }, 572 | 573 | getPatternPosition : function(typeNumber) { 574 | return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; 575 | }, 576 | 577 | getMask : function(maskPattern, i, j) { 578 | 579 | switch (maskPattern) { 580 | 581 | case QRMaskPattern.PATTERN000 : return (i + j) % 2 == 0; 582 | case QRMaskPattern.PATTERN001 : return i % 2 == 0; 583 | case QRMaskPattern.PATTERN010 : return j % 3 == 0; 584 | case QRMaskPattern.PATTERN011 : return (i + j) % 3 == 0; 585 | case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; 586 | case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 == 0; 587 | case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; 588 | case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; 589 | 590 | default : 591 | throw new Error("bad maskPattern:" + maskPattern); 592 | } 593 | }, 594 | 595 | getErrorCorrectPolynomial : function(errorCorrectLength) { 596 | 597 | var a = new QRPolynomial([1], 0); 598 | 599 | for (var i = 0; i < errorCorrectLength; i++) { 600 | a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0) ); 601 | } 602 | 603 | return a; 604 | }, 605 | 606 | getLengthInBits : function(mode, type) { 607 | 608 | if (1 <= type && type < 10) { 609 | 610 | // 1 - 9 611 | 612 | switch(mode) { 613 | case QRMode.MODE_NUMBER : return 10; 614 | case QRMode.MODE_ALPHA_NUM : return 9; 615 | case QRMode.MODE_8BIT_BYTE : return 8; 616 | case QRMode.MODE_KANJI : return 8; 617 | default : 618 | throw new Error("mode:" + mode); 619 | } 620 | 621 | } else if (type < 27) { 622 | 623 | // 10 - 26 624 | 625 | switch(mode) { 626 | case QRMode.MODE_NUMBER : return 12; 627 | case QRMode.MODE_ALPHA_NUM : return 11; 628 | case QRMode.MODE_8BIT_BYTE : return 16; 629 | case QRMode.MODE_KANJI : return 10; 630 | default : 631 | throw new Error("mode:" + mode); 632 | } 633 | 634 | } else if (type < 41) { 635 | 636 | // 27 - 40 637 | 638 | switch(mode) { 639 | case QRMode.MODE_NUMBER : return 14; 640 | case QRMode.MODE_ALPHA_NUM : return 13; 641 | case QRMode.MODE_8BIT_BYTE : return 16; 642 | case QRMode.MODE_KANJI : return 12; 643 | default : 644 | throw new Error("mode:" + mode); 645 | } 646 | 647 | } else { 648 | throw new Error("type:" + type); 649 | } 650 | }, 651 | 652 | getLostPoint : function(qrCode) { 653 | 654 | var moduleCount = qrCode.getModuleCount(); 655 | 656 | var lostPoint = 0; 657 | 658 | // LEVEL1 659 | 660 | for (var row = 0; row < moduleCount; row++) { 661 | 662 | for (var col = 0; col < moduleCount; col++) { 663 | 664 | var sameCount = 0; 665 | var dark = qrCode.isDark(row, col); 666 | 667 | for (var r = -1; r <= 1; r++) { 668 | 669 | if (row + r < 0 || moduleCount <= row + r) { 670 | continue; 671 | } 672 | 673 | for (var c = -1; c <= 1; c++) { 674 | 675 | if (col + c < 0 || moduleCount <= col + c) { 676 | continue; 677 | } 678 | 679 | if (r == 0 && c == 0) { 680 | continue; 681 | } 682 | 683 | if (dark == qrCode.isDark(row + r, col + c) ) { 684 | sameCount++; 685 | } 686 | } 687 | } 688 | 689 | if (sameCount > 5) { 690 | lostPoint += (3 + sameCount - 5); 691 | } 692 | } 693 | } 694 | 695 | // LEVEL2 696 | 697 | for (var row = 0; row < moduleCount - 1; row++) { 698 | for (var col = 0; col < moduleCount - 1; col++) { 699 | var count = 0; 700 | if (qrCode.isDark(row, col ) ) count++; 701 | if (qrCode.isDark(row + 1, col ) ) count++; 702 | if (qrCode.isDark(row, col + 1) ) count++; 703 | if (qrCode.isDark(row + 1, col + 1) ) count++; 704 | if (count == 0 || count == 4) { 705 | lostPoint += 3; 706 | } 707 | } 708 | } 709 | 710 | // LEVEL3 711 | 712 | for (var row = 0; row < moduleCount; row++) { 713 | for (var col = 0; col < moduleCount - 6; col++) { 714 | if (qrCode.isDark(row, col) 715 | && !qrCode.isDark(row, col + 1) 716 | && qrCode.isDark(row, col + 2) 717 | && qrCode.isDark(row, col + 3) 718 | && qrCode.isDark(row, col + 4) 719 | && !qrCode.isDark(row, col + 5) 720 | && qrCode.isDark(row, col + 6) ) { 721 | lostPoint += 40; 722 | } 723 | } 724 | } 725 | 726 | for (var col = 0; col < moduleCount; col++) { 727 | for (var row = 0; row < moduleCount - 6; row++) { 728 | if (qrCode.isDark(row, col) 729 | && !qrCode.isDark(row + 1, col) 730 | && qrCode.isDark(row + 2, col) 731 | && qrCode.isDark(row + 3, col) 732 | && qrCode.isDark(row + 4, col) 733 | && !qrCode.isDark(row + 5, col) 734 | && qrCode.isDark(row + 6, col) ) { 735 | lostPoint += 40; 736 | } 737 | } 738 | } 739 | 740 | // LEVEL4 741 | 742 | var darkCount = 0; 743 | 744 | for (var col = 0; col < moduleCount; col++) { 745 | for (var row = 0; row < moduleCount; row++) { 746 | if (qrCode.isDark(row, col) ) { 747 | darkCount++; 748 | } 749 | } 750 | } 751 | 752 | var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; 753 | lostPoint += ratio * 10; 754 | 755 | return lostPoint; 756 | } 757 | 758 | }; 759 | 760 | 761 | //--------------------------------------------------------------------- 762 | // QRMath 763 | //--------------------------------------------------------------------- 764 | 765 | var QRMath = { 766 | 767 | glog : function(n) { 768 | 769 | if (n < 1) { 770 | throw new Error("glog(" + n + ")"); 771 | } 772 | 773 | return QRMath.LOG_TABLE[n]; 774 | }, 775 | 776 | gexp : function(n) { 777 | 778 | while (n < 0) { 779 | n += 255; 780 | } 781 | 782 | while (n >= 256) { 783 | n -= 255; 784 | } 785 | 786 | return QRMath.EXP_TABLE[n]; 787 | }, 788 | 789 | EXP_TABLE : new Array(256), 790 | 791 | LOG_TABLE : new Array(256) 792 | 793 | }; 794 | 795 | for (var i = 0; i < 8; i++) { 796 | QRMath.EXP_TABLE[i] = 1 << i; 797 | } 798 | for (var i = 8; i < 256; i++) { 799 | QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] 800 | ^ QRMath.EXP_TABLE[i - 5] 801 | ^ QRMath.EXP_TABLE[i - 6] 802 | ^ QRMath.EXP_TABLE[i - 8]; 803 | } 804 | for (var i = 0; i < 255; i++) { 805 | QRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i; 806 | } 807 | 808 | //--------------------------------------------------------------------- 809 | // QRPolynomial 810 | //--------------------------------------------------------------------- 811 | 812 | function QRPolynomial(num, shift) { 813 | 814 | if (num.length == undefined) { 815 | throw new Error(num.length + "/" + shift); 816 | } 817 | 818 | var offset = 0; 819 | 820 | while (offset < num.length && num[offset] == 0) { 821 | offset++; 822 | } 823 | 824 | this.num = new Array(num.length - offset + shift); 825 | for (var i = 0; i < num.length - offset; i++) { 826 | this.num[i] = num[i + offset]; 827 | } 828 | } 829 | 830 | QRPolynomial.prototype = { 831 | 832 | get : function(index) { 833 | return this.num[index]; 834 | }, 835 | 836 | getLength : function() { 837 | return this.num.length; 838 | }, 839 | 840 | multiply : function(e) { 841 | 842 | var num = new Array(this.getLength() + e.getLength() - 1); 843 | 844 | for (var i = 0; i < this.getLength(); i++) { 845 | for (var j = 0; j < e.getLength(); j++) { 846 | num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i) ) + QRMath.glog(e.get(j) ) ); 847 | } 848 | } 849 | 850 | return new QRPolynomial(num, 0); 851 | }, 852 | 853 | mod : function(e) { 854 | 855 | if (this.getLength() - e.getLength() < 0) { 856 | return this; 857 | } 858 | 859 | var ratio = QRMath.glog(this.get(0) ) - QRMath.glog(e.get(0) ); 860 | 861 | var num = new Array(this.getLength() ); 862 | 863 | for (var i = 0; i < this.getLength(); i++) { 864 | num[i] = this.get(i); 865 | } 866 | 867 | for (var i = 0; i < e.getLength(); i++) { 868 | num[i] ^= QRMath.gexp(QRMath.glog(e.get(i) ) + ratio); 869 | } 870 | 871 | // recursive call 872 | return new QRPolynomial(num, 0).mod(e); 873 | } 874 | }; 875 | 876 | //--------------------------------------------------------------------- 877 | // QRRSBlock 878 | //--------------------------------------------------------------------- 879 | 880 | function QRRSBlock(totalCount, dataCount) { 881 | this.totalCount = totalCount; 882 | this.dataCount = dataCount; 883 | } 884 | 885 | QRRSBlock.RS_BLOCK_TABLE = [ 886 | 887 | // L 888 | // M 889 | // Q 890 | // H 891 | 892 | // 1 893 | [1, 26, 19], 894 | [1, 26, 16], 895 | [1, 26, 13], 896 | [1, 26, 9], 897 | 898 | // 2 899 | [1, 44, 34], 900 | [1, 44, 28], 901 | [1, 44, 22], 902 | [1, 44, 16], 903 | 904 | // 3 905 | [1, 70, 55], 906 | [1, 70, 44], 907 | [2, 35, 17], 908 | [2, 35, 13], 909 | 910 | // 4 911 | [1, 100, 80], 912 | [2, 50, 32], 913 | [2, 50, 24], 914 | [4, 25, 9], 915 | 916 | // 5 917 | [1, 134, 108], 918 | [2, 67, 43], 919 | [2, 33, 15, 2, 34, 16], 920 | [2, 33, 11, 2, 34, 12], 921 | 922 | // 6 923 | [2, 86, 68], 924 | [4, 43, 27], 925 | [4, 43, 19], 926 | [4, 43, 15], 927 | 928 | // 7 929 | [2, 98, 78], 930 | [4, 49, 31], 931 | [2, 32, 14, 4, 33, 15], 932 | [4, 39, 13, 1, 40, 14], 933 | 934 | // 8 935 | [2, 121, 97], 936 | [2, 60, 38, 2, 61, 39], 937 | [4, 40, 18, 2, 41, 19], 938 | [4, 40, 14, 2, 41, 15], 939 | 940 | // 9 941 | [2, 146, 116], 942 | [3, 58, 36, 2, 59, 37], 943 | [4, 36, 16, 4, 37, 17], 944 | [4, 36, 12, 4, 37, 13], 945 | 946 | // 10 947 | [2, 86, 68, 2, 87, 69], 948 | [4, 69, 43, 1, 70, 44], 949 | [6, 43, 19, 2, 44, 20], 950 | [6, 43, 15, 2, 44, 16], 951 | 952 | // 11 953 | [4, 101, 81], 954 | [1, 80, 50, 4, 81, 51], 955 | [4, 50, 22, 4, 51, 23], 956 | [3, 36, 12, 8, 37, 13], 957 | 958 | // 12 959 | [2, 116, 92, 2, 117, 93], 960 | [6, 58, 36, 2, 59, 37], 961 | [4, 46, 20, 6, 47, 21], 962 | [7, 42, 14, 4, 43, 15], 963 | 964 | // 13 965 | [4, 133, 107], 966 | [8, 59, 37, 1, 60, 38], 967 | [8, 44, 20, 4, 45, 21], 968 | [12, 33, 11, 4, 34, 12], 969 | 970 | // 14 971 | [3, 145, 115, 1, 146, 116], 972 | [4, 64, 40, 5, 65, 41], 973 | [11, 36, 16, 5, 37, 17], 974 | [11, 36, 12, 5, 37, 13], 975 | 976 | // 15 977 | [5, 109, 87, 1, 110, 88], 978 | [5, 65, 41, 5, 66, 42], 979 | [5, 54, 24, 7, 55, 25], 980 | [11, 36, 12], 981 | 982 | // 16 983 | [5, 122, 98, 1, 123, 99], 984 | [7, 73, 45, 3, 74, 46], 985 | [15, 43, 19, 2, 44, 20], 986 | [3, 45, 15, 13, 46, 16], 987 | 988 | // 17 989 | [1, 135, 107, 5, 136, 108], 990 | [10, 74, 46, 1, 75, 47], 991 | [1, 50, 22, 15, 51, 23], 992 | [2, 42, 14, 17, 43, 15], 993 | 994 | // 18 995 | [5, 150, 120, 1, 151, 121], 996 | [9, 69, 43, 4, 70, 44], 997 | [17, 50, 22, 1, 51, 23], 998 | [2, 42, 14, 19, 43, 15], 999 | 1000 | // 19 1001 | [3, 141, 113, 4, 142, 114], 1002 | [3, 70, 44, 11, 71, 45], 1003 | [17, 47, 21, 4, 48, 22], 1004 | [9, 39, 13, 16, 40, 14], 1005 | 1006 | // 20 1007 | [3, 135, 107, 5, 136, 108], 1008 | [3, 67, 41, 13, 68, 42], 1009 | [15, 54, 24, 5, 55, 25], 1010 | [15, 43, 15, 10, 44, 16], 1011 | 1012 | // 21 1013 | [4, 144, 116, 4, 145, 117], 1014 | [17, 68, 42], 1015 | [17, 50, 22, 6, 51, 23], 1016 | [19, 46, 16, 6, 47, 17], 1017 | 1018 | // 22 1019 | [2, 139, 111, 7, 140, 112], 1020 | [17, 74, 46], 1021 | [7, 54, 24, 16, 55, 25], 1022 | [34, 37, 13], 1023 | 1024 | // 23 1025 | [4, 151, 121, 5, 152, 122], 1026 | [4, 75, 47, 14, 76, 48], 1027 | [11, 54, 24, 14, 55, 25], 1028 | [16, 45, 15, 14, 46, 16], 1029 | 1030 | // 24 1031 | [6, 147, 117, 4, 148, 118], 1032 | [6, 73, 45, 14, 74, 46], 1033 | [11, 54, 24, 16, 55, 25], 1034 | [30, 46, 16, 2, 47, 17], 1035 | 1036 | // 25 1037 | [8, 132, 106, 4, 133, 107], 1038 | [8, 75, 47, 13, 76, 48], 1039 | [7, 54, 24, 22, 55, 25], 1040 | [22, 45, 15, 13, 46, 16], 1041 | 1042 | // 26 1043 | [10, 142, 114, 2, 143, 115], 1044 | [19, 74, 46, 4, 75, 47], 1045 | [28, 50, 22, 6, 51, 23], 1046 | [33, 46, 16, 4, 47, 17], 1047 | 1048 | // 27 1049 | [8, 152, 122, 4, 153, 123], 1050 | [22, 73, 45, 3, 74, 46], 1051 | [8, 53, 23, 26, 54, 24], 1052 | [12, 45, 15, 28, 46, 16], 1053 | 1054 | // 28 1055 | [3, 147, 117, 10, 148, 118], 1056 | [3, 73, 45, 23, 74, 46], 1057 | [4, 54, 24, 31, 55, 25], 1058 | [11, 45, 15, 31, 46, 16], 1059 | 1060 | // 29 1061 | [7, 146, 116, 7, 147, 117], 1062 | [21, 73, 45, 7, 74, 46], 1063 | [1, 53, 23, 37, 54, 24], 1064 | [19, 45, 15, 26, 46, 16], 1065 | 1066 | // 30 1067 | [5, 145, 115, 10, 146, 116], 1068 | [19, 75, 47, 10, 76, 48], 1069 | [15, 54, 24, 25, 55, 25], 1070 | [23, 45, 15, 25, 46, 16], 1071 | 1072 | // 31 1073 | [13, 145, 115, 3, 146, 116], 1074 | [2, 74, 46, 29, 75, 47], 1075 | [42, 54, 24, 1, 55, 25], 1076 | [23, 45, 15, 28, 46, 16], 1077 | 1078 | // 32 1079 | [17, 145, 115], 1080 | [10, 74, 46, 23, 75, 47], 1081 | [10, 54, 24, 35, 55, 25], 1082 | [19, 45, 15, 35, 46, 16], 1083 | 1084 | // 33 1085 | [17, 145, 115, 1, 146, 116], 1086 | [14, 74, 46, 21, 75, 47], 1087 | [29, 54, 24, 19, 55, 25], 1088 | [11, 45, 15, 46, 46, 16], 1089 | 1090 | // 34 1091 | [13, 145, 115, 6, 146, 116], 1092 | [14, 74, 46, 23, 75, 47], 1093 | [44, 54, 24, 7, 55, 25], 1094 | [59, 46, 16, 1, 47, 17], 1095 | 1096 | // 35 1097 | [12, 151, 121, 7, 152, 122], 1098 | [12, 75, 47, 26, 76, 48], 1099 | [39, 54, 24, 14, 55, 25], 1100 | [22, 45, 15, 41, 46, 16], 1101 | 1102 | // 36 1103 | [6, 151, 121, 14, 152, 122], 1104 | [6, 75, 47, 34, 76, 48], 1105 | [46, 54, 24, 10, 55, 25], 1106 | [2, 45, 15, 64, 46, 16], 1107 | 1108 | // 37 1109 | [17, 152, 122, 4, 153, 123], 1110 | [29, 74, 46, 14, 75, 47], 1111 | [49, 54, 24, 10, 55, 25], 1112 | [24, 45, 15, 46, 46, 16], 1113 | 1114 | // 38 1115 | [4, 152, 122, 18, 153, 123], 1116 | [13, 74, 46, 32, 75, 47], 1117 | [48, 54, 24, 14, 55, 25], 1118 | [42, 45, 15, 32, 46, 16], 1119 | 1120 | // 39 1121 | [20, 147, 117, 4, 148, 118], 1122 | [40, 75, 47, 7, 76, 48], 1123 | [43, 54, 24, 22, 55, 25], 1124 | [10, 45, 15, 67, 46, 16], 1125 | 1126 | // 40 1127 | [19, 148, 118, 6, 149, 119], 1128 | [18, 75, 47, 31, 76, 48], 1129 | [34, 54, 24, 34, 55, 25], 1130 | [20, 45, 15, 61, 46, 16] 1131 | 1132 | ]; 1133 | 1134 | QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) { 1135 | 1136 | var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); 1137 | 1138 | if (rsBlock == undefined) { 1139 | throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); 1140 | } 1141 | 1142 | var length = rsBlock.length / 3; 1143 | 1144 | var list = new Array(); 1145 | 1146 | for (var i = 0; i < length; i++) { 1147 | 1148 | var count = rsBlock[i * 3 + 0]; 1149 | var totalCount = rsBlock[i * 3 + 1]; 1150 | var dataCount = rsBlock[i * 3 + 2]; 1151 | 1152 | for (var j = 0; j < count; j++) { 1153 | list.push(new QRRSBlock(totalCount, dataCount) ); 1154 | } 1155 | } 1156 | 1157 | return list; 1158 | } 1159 | 1160 | QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) { 1161 | 1162 | switch(errorCorrectLevel) { 1163 | case QRErrorCorrectLevel.L : 1164 | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; 1165 | case QRErrorCorrectLevel.M : 1166 | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; 1167 | case QRErrorCorrectLevel.Q : 1168 | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; 1169 | case QRErrorCorrectLevel.H : 1170 | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; 1171 | default : 1172 | return undefined; 1173 | } 1174 | } 1175 | 1176 | //--------------------------------------------------------------------- 1177 | // QRBitBuffer 1178 | //--------------------------------------------------------------------- 1179 | 1180 | function QRBitBuffer() { 1181 | this.buffer = new Array(); 1182 | this.length = 0; 1183 | } 1184 | 1185 | QRBitBuffer.prototype = { 1186 | 1187 | get : function(index) { 1188 | var bufIndex = Math.floor(index / 8); 1189 | return ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1; 1190 | }, 1191 | 1192 | put : function(num, length) { 1193 | for (var i = 0; i < length; i++) { 1194 | this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1); 1195 | } 1196 | }, 1197 | 1198 | getLengthInBits : function() { 1199 | return this.length; 1200 | }, 1201 | 1202 | putBit : function(bit) { 1203 | 1204 | var bufIndex = Math.floor(this.length / 8); 1205 | if (this.buffer.length <= bufIndex) { 1206 | this.buffer.push(0); 1207 | } 1208 | 1209 | if (bit) { 1210 | this.buffer[bufIndex] |= (0x80 >>> (this.length % 8) ); 1211 | } 1212 | 1213 | this.length++; 1214 | } 1215 | }; 1216 | --------------------------------------------------------------------------------