├── Plugin └── V2raySocks │ ├── config.php │ ├── templates │ ├── error.tpl │ ├── static │ │ ├── skin │ │ │ └── default │ │ │ │ ├── icon.png │ │ │ │ ├── icon-ext.png │ │ │ │ ├── loading-0.gif │ │ │ │ ├── loading-1.gif │ │ │ │ ├── loading-2.gif │ │ │ │ └── layer.css │ │ ├── js │ │ │ ├── html5-qrcode.js │ │ │ ├── SSRscript.js │ │ │ ├── layui.js │ │ │ └── qrcode.js │ │ ├── css │ │ │ ├── layer.css │ │ │ ├── style.css │ │ │ └── layui.css │ │ ├── mobile │ │ │ ├── layer.js │ │ │ └── need │ │ │ │ └── layer.css │ │ ├── layer.css │ │ └── layer.js │ └── details.tpl │ ├── lib │ └── functions.php │ ├── lang │ ├── chinese.php │ └── english.php │ └── V2raySocks.php ├── Crons ├── ReadMe.md ├── ChartInfo.php └── MysqlBandReset.php ├── README.md ├── Sql └── MyV2Ray.sql └── LICENSE /Plugin/V2raySocks/config.php: -------------------------------------------------------------------------------- 1 | 2 |

{$usefulErrorHelper}

3 | -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinrishuofa/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/icon.png -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinrishuofa/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/icon-ext.png -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinrishuofa/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/loading-0.gif -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinrishuofa/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/loading-1.gif -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/skin/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinrishuofa/V2raySocks/HEAD/Plugin/V2raySocks/templates/static/skin/default/loading-2.gif -------------------------------------------------------------------------------- /Crons/ReadMe.md: -------------------------------------------------------------------------------- 1 | # 用法 2 | * MysqlBandReset.php是用来根据到期时间的日(day)来重置流量的 3 | * ChartInfo.php是用来记录使用流量的,可不配置。 4 | 5 | ## 建议用法 6 | 0 0 * * * php -q /home/wwwroot/MysqlBandReset.php 7 | 1 */3 * * * php -q /home/wwwroot/ChartInfo.php -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # V2raySocks 2 | ## 一个售卖v2ray的whmcs插件 3 | * 当前版本 0.0.1Beta1 4 | 5 | ## 支持的功能: 6 | * 流量图表 7 | * 流量重置(每月开始,每月底,由结算日计算) 8 | * 公告信息 9 | * VMESS二维码 10 | * 随机UUID 11 | 12 | ## 注意事项 13 | * 如果要使用MysqlBandReset,你必须在MysqlBandReset.php中配置数据库信息 14 | * 需要更多支持,请开issue或者给我发邮件 15 | 16 | ## 如果感觉插件好用,嘘寒问暖不如打笔巨款~ 17 | * Paypal捐赠 zzm317@outlook.com 18 | * 支付宝捐赠 admin@loli.ren -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Sql/MyV2Ray.sql: -------------------------------------------------------------------------------- 1 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 2 | SET time_zone = "+00:00"; 3 | 4 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 5 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 6 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 7 | /*!40101 SET NAMES utf8mb4 */; 8 | 9 | CREATE DATABASE IF NOT EXISTS `MyV2Ray` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; 10 | USE `MyV2Ray`; 11 | 12 | DROP TABLE IF EXISTS `user`; 13 | CREATE TABLE IF NOT EXISTS `user` ( 14 | `id` int(11) NOT NULL, 15 | `uuid` varchar(36) NOT NULL, 16 | `t` int(11) NOT NULL DEFAULT '0', 17 | `u` bigint(20) NOT NULL, 18 | `d` bigint(20) NOT NULL, 19 | `transfer_enable` bigint(20) NOT NULL, 20 | `enable` tinyint(4) NOT NULL DEFAULT '1', 21 | `created_at` int(10) NOT NULL, 22 | `updated_at` int(10) NOT NULL, 23 | `need_reset` tinyint(1) NOT NULL DEFAULT '1', 24 | `sid` int(11) NOT NULL 25 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 26 | 27 | DROP TABLE IF EXISTS `user_usage`; 28 | CREATE TABLE IF NOT EXISTS `user_usage` ( 29 | `sid` int(11) NOT NULL, 30 | `date` int(11) NOT NULL, 31 | `upload` text NOT NULL, 32 | `download` text NOT NULL, 33 | `tupload` text NOT NULL, 34 | `tdownload` text NOT NULL 35 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; 36 | 37 | 38 | ALTER TABLE `user` 39 | ADD PRIMARY KEY (`id`); 40 | 41 | 42 | ALTER TABLE `user` 43 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; 44 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 45 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 46 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 47 | -------------------------------------------------------------------------------- /Crons/ChartInfo.php: -------------------------------------------------------------------------------- 1 | query($sql); 13 | $uasql = "Select * FROM `user_usage` ORDER BY `date`"; 14 | $old_user_usage = $mysql->query($uasql); 15 | $ua = array(); 16 | if($old_user_usage){ 17 | foreach($old_user_usage as $oua){ 18 | $add = false; 19 | if($ua[$oua['sid']]){ 20 | if($ua[$oua['sid']]['date'] <= $oua['date']){ 21 | $add = true; 22 | } 23 | }else{ 24 | $add = true; 25 | } 26 | if($add){ 27 | $ua[$oua['sid']] = array( 28 | 'u' => $oua['tupload'], 29 | 'd' => $oua['tdownload'], 30 | 'date' => $oua['date'] 31 | ); 32 | } 33 | } 34 | }else{ 35 | $ua = false; 36 | } 37 | $nua = array(); 38 | if($users){ 39 | foreach($users as $user){ 40 | if($user['enable'] = 1){ 41 | if($ua[$user['sid']]){ 42 | $nua[$user['sid']] = array( 43 | 'u' => $user['u'] - $ua[$user['sid']]['u'], 44 | 'd' => $user['d'] - $ua[$user['sid']]['d'], 45 | 'tu' => $user['u'], 46 | 'td' => $user['d'], 47 | 'date' => time(), 48 | 'sid' => $user['sid'] 49 | ); 50 | }else{ 51 | $nua[$user['sid']] = array( 52 | 'u' => $user['u'], 53 | 'd' => $user['d'], 54 | 'tu' => $user['u'], 55 | 'td' => $user['d'], 56 | 'date' => time(), 57 | 'sid' => $user['sid'] 58 | ); 59 | } 60 | } 61 | } 62 | }else{ 63 | echo("Mysql无数据"); 64 | $nua = false; 65 | } 66 | if($nua){ 67 | foreach($nua as $up){ 68 | $dataa = $up['u'].",".$up['d'].",".$up['tu'].",".$up['td'].",".$up['date'].",".$up['sid']; 69 | $upmysql = "INSERT INTO `user_usage` (`upload`,`download`,`tupload`,`tdownload`,`date`,`sid`) VALUES(".$dataa.")"; 70 | $mysql->query($upmysql); 71 | } 72 | echo("操作完成,时间".date('Y-m-d H:i:s',time())."
"); 73 | $datee = time(); 74 | $oldatee = $datee - 3600*24*6; 75 | $dlsql = "delete from `user_usage` where `date` <= ".$oldatee; 76 | $mysql->query($dlsql); 77 | echo(date('Y-m-d H:i:s',$oldatee)."前的数据已删除"); 78 | } 79 | } 80 | 81 | ?> -------------------------------------------------------------------------------- /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/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/lang/chinese.php: -------------------------------------------------------------------------------- 1 | )"; 56 | 57 | //其他 58 | $_VLANG['User_does_not_exists'] = "模块错误:用户不存在"; 59 | $_VLANG['Model_error'] = "模块错误"; 60 | $_VLANG['User_already_exists'] = "模块错误:用户已存在"; 61 | 62 | //后台 63 | $_VLANG['no_client_product_isset'] = "暂无用户产品"; 64 | $_VLANG['no_products'] = "暂无产品/服务"; 65 | $_VLANG['no_info'] = "暂无信息"; 66 | $_VLANG['no_routes'] = "暂无线路"; 67 | $_VLANG['version'] = "版本"; 68 | 69 | //问题 70 | $_VLANG['are_you_sure_to_reset'] = "你确定要重置产品流量"; 71 | $_VLANG['are_you_sure_to_suspend'] = "你确定要暂停产品"; 72 | $_VLANG['are_you_sure_to_unsuspend'] = "你确定要取消暂停产品"; 73 | $_VLANG['are_you_sure_to_reset_p'] = "你确定要重置"; 74 | $_VLANG['are_you_really_sure_to_reset_p'] = "你真的确定要重置"; 75 | $_VLANG['suspendacc'] = "暂停"; 76 | $_VLANG['unsuspendacc'] = "取消暂停"; 77 | 78 | //状态 79 | $_VLANG['edit'] = "修改"; 80 | $_VLANG['submit'] = "提交"; 81 | $_VLANG['active'] = "激活"; 82 | $_VLANG['hidden'] = "隐藏"; -------------------------------------------------------------------------------- /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;oquery("UPDATE `user` SET `u` = '0', `d` = '0' where `sid` = ".$id); 18 | $ssmysql->query("delete from `user_usage` WHERE `sid` = ".$id); 19 | echo("ID:".$id." Has been reset
"); 20 | } 21 | } 22 | 23 | function daysInmonth($year='',$month=''){ 24 | if(empty($year)) $year = date('Y'); 25 | if(empty($month)) $month = date('m'); 26 | if (in_array($month, array(1, 3, 5, 7, 8, '01', '03', '05', '07', '08', 10, 12))) { 27 | $text = '31'; //月大 28 | }elseif ($month == 2 || $month == '02'){ 29 | if ( ($year % 400 == 0) || ( ($year % 4 == 0) && ($year % 100 !== 0) ) ) { //判断是否是闰年 30 | $text = '29'; //闰年2月 31 | } else { 32 | $text = '28'; //平年2月 33 | } 34 | } else { 35 | $text = '30'; //月小 36 | } 37 | 38 | return $text; 39 | } 40 | 41 | function calcreset($product,$whmcs,$day){ 42 | switch($product['need_reset']){ 43 | case 0: 44 | break; 45 | case 1: 46 | if(date("d", strtotime($whmcs['nextduedate'])) == date('d')){ 47 | resetband($product['sid']); 48 | } 49 | if(date('d') == $day){ 50 | if(date("d", strtotime($whmcs['nextduedate'])) > $day){ 51 | resetband($product['sid']); 52 | } 53 | } 54 | break; 55 | case 2: 56 | if(date('d') == 1){ 57 | resetband($product['sid']); 58 | } 59 | break; 60 | case 3: 61 | if(date('d') == $day){ 62 | resetband($product['sid']); 63 | } 64 | break; 65 | } 66 | } 67 | 68 | $mysql = new mysqli(WHMCS_DB_HOST, WHMCS_DB_USER, WHMCS_DB_PASS , WHMCS_DB_NAME); 69 | if(!$mysql) { 70 | die("Can't connect to WHMCS Database"); 71 | }else{ 72 | $produ = array(); 73 | $sql = "SELECT * FROM `tblhosting` WHERE `domainstatus` = 'Active'"; 74 | $whmcspro = mysqli_fetch_all($mysql->query($sql),MYSQLI_ASSOC); 75 | $mysql->close(); 76 | if($whmcspro){ 77 | foreach($whmcspro as $whmcs){ 78 | $produ[$whmcs['id']] = $whmcs; 79 | } 80 | }else{ 81 | die("Nothing Active In tblhosting in WHMCS Database"); 82 | } 83 | $ssmysql = new mysqli(DB_HOST, DB_USER, DB_PASS , DB_NAME); 84 | $sql = "SELECT * FROM `user` WHERE `enable` = 1 order by `sid`"; 85 | $ssacc = mysqli_fetch_all($ssmysql->query($sql),MYSQLI_ASSOC); 86 | $ssmysql->close(); 87 | $days = daysInmonth(date('y'),date('m')); 88 | if($ssacc){ 89 | foreach($ssacc as $ssa){ 90 | $pro = $produ[$ssa['sid']]; 91 | calcreset($ssa,$pro,$days); 92 | } 93 | }else{ 94 | die("Nothing isset in V2ray's User Table(users)"); 95 | } 96 | echo("Reset Done"); 97 | } 98 | -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/js/SSRscript.js: -------------------------------------------------------------------------------- 1 | var Ping = function(opt) { 2 | this.opt = opt || {}; 3 | this.favicon = this.opt.favicon || "/favicon.ico"; 4 | this.timeout = this.opt.timeout || 0; 5 | }; 6 | Ping.prototype.ping = function(source, callback) { 7 | this.img = new Image(); 8 | var timer; 9 | 10 | 11 | this.img.onload = pingCheck; 12 | this.img.onerror = pingCheck; 13 | if (this.timeout) { timer = setTimeout(pingCheck, this.timeout); } 14 | var start = new Date(); 15 | function pingCheck(e) { 16 | if (timer) { clearTimeout(timer); } 17 | var pong = new Date() - start; 18 | 19 | if (typeof callback === "function") { 20 | if (e.type === "error") { 21 | console.error("error loading resource"); 22 | return callback("error", pong); 23 | } 24 | return callback(null, pong); 25 | } 26 | } 27 | 28 | this.img.src = source + this.favicon + "?" + (+new Date()); // Trigger image load with cache buster 29 | }; 30 | var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 31 | function base64encode(str) { 32 | var out, i, len; 33 | var c1, c2, c3; 34 | len = str.length; 35 | i = 0; 36 | out = ""; 37 | while (i < len) { 38 | c1 = str.charCodeAt(i++) & 0xff; 39 | if (i == len) { 40 | out += base64EncodeChars.charAt(c1 >> 2); 41 | out += base64EncodeChars.charAt((c1 & 0x3) << 4); 42 | out += "=="; 43 | break; 44 | } 45 | c2 = str.charCodeAt(i++); 46 | if (i == len) { 47 | out += base64EncodeChars.charAt(c1 >> 2); 48 | out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); 49 | out += base64EncodeChars.charAt((c2 & 0xF) << 2); 50 | out += "="; 51 | break; 52 | } 53 | c3 = str.charCodeAt(i++); 54 | out += base64EncodeChars.charAt(c1 >> 2); 55 | out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); 56 | out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6)); 57 | out += base64EncodeChars.charAt(c3 & 0x3F); 58 | } 59 | return out; 60 | } 61 | $(document).ready(function() { 62 | $('button[name="ping"]').on('click',function() { 63 | var ping = new Ping(); 64 | var address = $(this).attr('data-host'); 65 | var timeout = 1000; 66 | var _this = $(this); 67 | ping.ping('http://' + address,function(err,data) { 68 | if (err) { 69 | data = data + " " + err; 70 | _this.parents('td').html('' + data + ''); 71 | }else{ 72 | _this.parents('td').html('' + data + ''); 73 | } 74 | }); 75 | }); 76 | jQuery(document).ready(function($) { 77 | $("button[name='qrcode']").on('click',function() { 78 | str = $(this).attr('data-params'); 79 | var tcontent = '
'; 80 | tcontent += ''; 89 | layer.open({ 90 | type: 1, 91 | title: $(this).attr('data-type'), 92 | offset: 'auto', 93 | closeBtn: 1, 94 | shadeClose: true, 95 | content: tcontent 96 | }); 97 | }); 98 | $("button[name='url']").on('click',function() { 99 | str = $(this).attr('data-params'); 100 | layer.alert(str); 101 | }); 102 | }); 103 | }); 104 | -------------------------------------------------------------------------------- /Plugin/V2raySocks/templates/static/mobile/need/layer.css: -------------------------------------------------------------------------------- 1 | .layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{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 2 | 3 | 4 | 5 | 6 | 41 | 79 | {if ($infos)} 80 |
81 |

{$infos}

82 |
83 | {/if} 84 |
85 |
86 |
87 | 99 | {if $subscribe_enable == 1} 100 |
101 |
102 | {V2raySocks_get_lang('subscribe_info')} 103 |
104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 130 | 131 | 132 |
{V2raySocks_get_lang('subscribe_url')}
{$HTTP_HOST}/modules/servers/UnlimitedSocks/subscribe.php?sid={$serviceid}&token={$subscribe_token}
133 |
134 |
135 | {/if} 136 |
137 |
138 | {V2raySocks_get_lang('user_info')} 139 |
140 |
141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 |
{V2raySocks_get_lang('uuid')}
{$usage.uuid}
157 |
158 |
159 | 160 |
161 |
162 | {V2raySocks_get_lang('usage_chart')} ({V2raySocks_get_lang('bandwidth')}:{$usage.tr_MB_GB}) 163 |
164 |
165 |

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

166 |
167 |
168 | {($usage.sum/$usage.transfer_enable)*100}% Complete 169 |
170 |
171 |

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

172 |
173 |
174 | {($usage.u/$usage.transfer_enable)*100}% Complete (warning) 175 |
176 |
177 |

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

178 |
179 |
180 | {($usage.d/$usage.transfer_enable)*100}% Complete (danger) 181 |
182 |
183 |
184 |
185 | 186 |
187 |
188 | {V2raySocks_get_lang('routelist')} 189 |
190 |
191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | {$yy = 0} 203 | {foreach $nodes as $node } 204 | 205 | 206 | 207 | 208 | 209 | 220 | 221 | {/foreach} 222 | 223 |
{V2raySocks_get_lang('name')}{V2raySocks_get_lang('action')}
{$node[0]} 210 | 214 | 218 | {$yy = $yy + 1} 219 |
224 |
225 |
226 | 227 | {if ($usingcards)} 228 |
229 |
230 | {V2raySocks_get_lang('card_info')} 231 |
232 |
233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | {foreach $usingcards as $usedcard} 243 | 244 | 245 | 246 | 247 | 248 | {/foreach} 249 | 250 |
{V2raySocks_get_lang('bandwidth')}{V2raySocks_get_lang('duedate')}
{$usedcard['traffic']}{$usedcard['duedate']}
251 |
252 |
253 | {/if} 254 | 255 | {if ($usedcards)} 256 |
257 |
258 | {V2raySocks_get_lang('used_card_info')} 259 |
260 |
261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | {foreach $usedcards as $usedcard} 271 | 272 | 273 | 274 | 275 | 276 | {/foreach} 277 | 278 |
{V2raySocks_get_lang('bandwidth')}{V2raySocks_get_lang('duedate')}
{$usedcard['traffic']}{$usedcard['duedate']}
279 |
280 |
281 | {/if} 282 | 283 | {if ($script)} 284 |
285 |
286 | {V2raySocks_get_lang('traffic_chart')} ({$datadays} {V2raySocks_get_lang('days')}) 287 |
288 |
289 | 290 |
291 |
292 |

{V2raySocks_get_lang('all_traffic_chart')}

293 | 294 |
295 |
296 |

{V2raySocks_get_lang('upload_traffic_chart')}

297 | 298 |
299 |
300 |

{V2raySocks_get_lang('download_traffic_chart')}

301 | 302 |
303 |
304 | 305 | 306 | 307 | 310 |
311 |
312 | {/if} 313 | 314 |
315 |
316 |
317 | 318 | 319 | -------------------------------------------------------------------------------- /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'; 27 | }else{ 28 | $query['RESET'] = 'UPDATE `user` SET `u`=0,`d`=0 WHERE `sid` = :sid'; 29 | $query['CHARTINFO'] = 'SELECT * FROM `user_usage` WHERE `sid` = :sid ORDER BY `date` DESC'; 30 | } 31 | return $query; 32 | } 33 | 34 | function V2raySocks_MetaData() 35 | { 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 | ); 55 | } 56 | 57 | function V2raySocks_TestConnection(array $params){ 58 | try { 59 | $dbhost = $params['serverip']; 60 | $dbuser = $params['serverusername']; 61 | $dbpass = $params['serverpassword']; 62 | $db = new PDO('mysql:host=' . $dbhost, $dbuser, $dbpass); 63 | $success = true; 64 | $errorMsg = ''; 65 | } 66 | catch (Exception $e) { 67 | logModuleCall('V2raySocks', 'V2raySocks_TestConnection', $params, $e->getMessage(), $e->getTraceAsString()); 68 | $success = false; 69 | $errorMsg = $e->getMessage(); 70 | } 71 | return array('success' => $success, 'error' => $errorMsg); 72 | } 73 | 74 | function V2raySocks_CreateAccount(array $params){ 75 | $query = V2raySocks_initialize($params); 76 | try { 77 | $dbhost = $params['serverip']; 78 | $dbname = $params['configoption1']; 79 | $dbuser = $params['serverusername']; 80 | $dbpass = $params['serverpassword']; 81 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 82 | $already = $db->prepare($query['ALREADY_EXISTS']); 83 | $already->bindValue(':sid', $params['serviceid']); 84 | $already->execute(); 85 | if ($already->fetchColumn()) { 86 | return V2raySocks_get_lang('User_already_exists'); 87 | } 88 | $bandwidth = (!empty($params['configoption3']) ? V2raySocks_Convert($params['configoption3'], 'mb', 'bytes') : (!empty($params['configoptions']['traffic']) ? V2raySocks_Convert($params['configoptions']['traffic'], 'gb', 'bytes') : '1099511627776')); 89 | 90 | $create = $db->prepare($query['CREATE_ACCOUNT']); 91 | $create->bindValue(':uuid', V2raySocks_GenerateUuid()); 92 | $create->bindValue(':transfer_enable', $bandwidth); 93 | $create->bindValue(':need_reset', $params['configoption2']); 94 | $create->bindValue(':sid', $params['serviceid']); 95 | $create = $create->execute(); 96 | 97 | if ($create) { 98 | return 'success'; 99 | }else { 100 | $error = $db->errorInfo(); 101 | return $error; 102 | } 103 | } 104 | catch (Exception $e) { 105 | logModuleCall('V2raySocks', 'V2raySocks_CreateAccount', $params, $e->getMessage(), $e->getTraceAsString()); 106 | return V2raySocks_get_lang('Model_error').$e->getMessage(); 107 | } 108 | } 109 | 110 | function V2raySocks_SuspendAccount(array $params){ 111 | $query = V2raySocks_initialize($params); 112 | try { 113 | $dbhost = $params['serverip']; 114 | $dbname = $params['configoption1']; 115 | $dbuser = $params['serverusername']; 116 | $dbpass = $params['serverpassword']; 117 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 118 | $enable = $db->prepare($query['ENABLE']); 119 | $enable->bindValue(':enable', '0'); 120 | $enable->bindValue(':sid', $params['serviceid']); 121 | 122 | $todo = $enable->execute(); 123 | if (!$todo) { 124 | $error = $db->errorInfo(); 125 | return $error; 126 | } 127 | return 'success'; 128 | } 129 | catch (Exception $e) { 130 | logModuleCall('V2raySocks', 'V2raySocks_SuspendAccount', $params, $e->getMessage(), $e->getTraceAsString()); 131 | return $e->getMessage(); 132 | } 133 | } 134 | 135 | function V2raySocks_UnsuspendAccount(array $params){ 136 | $query = V2raySocks_initialize($params,time()); 137 | try { 138 | $dbhost = $params['serverip']; 139 | $dbname = $params['configoption1']; 140 | $dbuser = $params['serverusername']; 141 | $dbpass = $params['serverpassword']; 142 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 143 | $enable = $db->prepare($query['ENABLE']); 144 | $enable->bindValue(':enable', '1'); 145 | $enable->bindValue(':sid', $params['serviceid']); 146 | 147 | $todo = $enable->execute(); 148 | if (!$todo) { 149 | $error = $db->errorInfo(); 150 | return $error; 151 | } 152 | $enable = $db->prepare($query['RESET']); 153 | $enable->bindValue(':sid', $params['serviceid']); 154 | $todo = $enable->execute(); 155 | $resetchart = $db->prepare($query['RESETUSERCHART']); 156 | $resetchart->bindValue(':sid', $params['serviceid']); 157 | $resetchart->execute(); 158 | if (!$todo) { 159 | $error = $db->errorInfo(); 160 | return $error; 161 | } 162 | return 'success'; 163 | } 164 | catch (Exception $e) { 165 | logModuleCall('V2raySocks', 'V2raySocks_UnsuspendAccount', $params, $e->getMessage(), $e->getTraceAsString()); 166 | return $e->getMessage(); 167 | } 168 | } 169 | 170 | function V2raySocks_TerminateAccount(array $params){ 171 | $query = V2raySocks_initialize($params); 172 | try { 173 | $dbhost = $params['serverip']; 174 | $dbname = $params['configoption1']; 175 | $dbuser = $params['serverusername']; 176 | $dbpass = $params['serverpassword']; 177 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 178 | $enable = $db->prepare($query['DELETE_ACCOUNT']); 179 | $enable->bindValue(':sid', $params['serviceid']); 180 | 181 | $todo = $enable->execute(); 182 | if (!$todo) { 183 | $error = $db->errorInfo(); 184 | return $error; 185 | } 186 | return 'success'; 187 | } 188 | catch (Exception $e) { 189 | logModuleCall('V2raySocks', 'V2raySocks_TerminateAccount', $params, $e->getMessage(), $e->getTraceAsString()); 190 | return $e->getMessage(); 191 | } 192 | } 193 | 194 | function V2raySocks_ChangePackage(array $params){ 195 | $query = V2raySocks_initialize($params); 196 | try { 197 | $dbhost = $params['serverip']; 198 | $dbname = $params['configoption1']; 199 | $dbuser = $params['serverusername']; 200 | $dbpass = $params['serverpassword']; 201 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 202 | $bandwidth = (!empty($params['configoption3']) ? convert($params['configoption3'], 'mb', 'bytes') : (!empty($params['configoptions']['traffic']) ? convert($params['configoptions']['traffic'], 'gb', 'bytes') : '1099511627776')); 203 | $enable = $db->prepare($query['CHANGE_PACKAGE']); 204 | $enable->bindValue(':transfer_enable', $bandwidth); 205 | $enable->bindValue(':sid', $params['serviceid']); 206 | $todo = $enable->execute(); 207 | if (!$todo) { 208 | $error = $db->errorInfo(); 209 | return $error; 210 | } 211 | return 'success'; 212 | } 213 | catch (Exception $e) { 214 | logModuleCall('V2raySocks', 'V2raySocks_ChangePackage', $params, $e->getMessage(), $e->getTraceAsString()); 215 | return $e->getMessage(); 216 | } 217 | } 218 | 219 | function V2raySocks_AdminCustomButtonArray(){ 220 | return array(V2raySocks_get_lang('resetbandwidth') => 'ResetBandwidth'); 221 | } 222 | 223 | function V2raySocks_ResetBandwidth(array $params){ 224 | $query = V2raySocks_initialize($params,time()); 225 | try { 226 | $dbhost = ($params['serverip']); 227 | $dbname = ($params['configoption1']); 228 | $dbuser = ($params['serverusername']); 229 | $dbpass = ($params['serverpassword']); 230 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 231 | $enable = $db->prepare($query['RESET']); 232 | $enable->bindValue(':sid', $params['serviceid']); 233 | $todo = $enable->execute(); 234 | $resetchart = $db->prepare($query['RESETUSERCHART']); 235 | $resetchart->bindValue(':sid', $params['serviceid']); 236 | $resetchart->execute(); 237 | if (!$todo) { 238 | $error = $db->errorInfo(); 239 | return $error; 240 | } 241 | return 'success'; 242 | } 243 | catch (Exception $e) { 244 | logModuleCall('V2raySocks', 'V2raySocks_ResetBandwidth', $params, $e->getMessage(), $e->getTraceAsString()); 245 | return $e->getMessage(); 246 | } 247 | } 248 | 249 | function V2raySocks_ClientArea($params) { 250 | if($params['status'] == 'Active'){ 251 | require_once 'lib/Mobile_Detect.php'; 252 | $detect = new Mobile_Detect; 253 | if($detect->isMobile()){ 254 | $date = time() - 60*60*24; 255 | $datadays = 1; 256 | }else{ 257 | $date = time() - 60*60*24*3; 258 | $datadays = 3; 259 | } 260 | $query = V2raySocks_initialize($params,$date); 261 | try { 262 | $dbhost = $params['serverip']; 263 | $dbname = $params['configoption1']; 264 | $dbuser = $params['serverusername']; 265 | $dbpass = $params['serverpassword']; 266 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 267 | $usage = $db->prepare($query['USERINFO']); 268 | $usage->bindValue(':sid', $params['serviceid']); 269 | $usage->execute(); 270 | $usage = $usage->fetch(); 271 | 272 | $chartinfo = $db->prepare($query['CHARTINFO']); 273 | $chartinfo->bindValue(':sid', $params['serviceid']); 274 | $chartinfo->execute(); 275 | if($chartinfo){ 276 | $exa = array(); 277 | foreach($chartinfo as $chart){ 278 | $exa[] = $chart; 279 | } 280 | $label = ""; 281 | $total = ""; 282 | $upload = ""; 283 | $download = ""; 284 | $chartinfo = array_reverse($exa,true); 285 | foreach($chartinfo as $chart){ 286 | $label .= "'',"; 287 | //$label .= "'".date('m/d H:i',$chart['date'])."',"; 288 | $upload .= number_format(V2raySocks_convert($chart['upload'], 'bytes', 'mb'), 2, '.', '').","; 289 | $download .= number_format(V2raySocks_convert($chart['download'], 'bytes', 'mb'), 2, '.', '').","; 290 | $total .= number_format(V2raySocks_convert($chart['upload']+$chart['download'], 'bytes', 'mb'), 2, '.', '').","; 291 | } 292 | $label = substr($label,0,strlen($label)-1); 293 | $total = substr($total,0,strlen($total)-1); 294 | $upload = substr($upload,0,strlen($upload)-1); 295 | $download = substr($download,0,strlen($download)-1); 296 | $script = V2raySocks_make_script("totalc",$label,$total); 297 | $script .= V2raySocks_make_script("uploadc",$label,$upload); 298 | $script .= V2raySocks_make_script("downloadc",$label,$download); 299 | } 300 | 301 | $nodes = $params['configoption4']; 302 | $z = 0; 303 | $results = array(); 304 | 305 | $noder = explode("\n",$nodes); 306 | $x = 0; 307 | foreach($noder as $nodee){ 308 | $nodee = explode('|', $nodee); 309 | $str = base64_encode($nodee[3] . ":" . $usage['uuid'] . "@" . $nodee[1] . ":" . $nodee[2]); 310 | $str = str_replace('=','',$str); 311 | $str = "vmess://" . $str . "?remarks=" . $nodee[0] . "&obfs=none"; 312 | $nodee[4] = $str; 313 | $results[$x] = $nodee; 314 | $x++; 315 | } 316 | $infos = $params['configoption5'] ? $params['configoption5'] : false; 317 | $user = array('uuid' => $usage['uuid'], 318 | 'u' => $usage['u'], 319 | 'd' => $usage['d'], 320 | 't' => $usage['t'], 321 | 'sum' => $usage['u'] + $usage['d'], 322 | 'transfer_enable' => $usage['transfer_enable'], 323 | 'created_at' => $usage['created_at'], 324 | 'updated_at' => $usage['updated_at'], 325 | 'tr_MB_GB' => V2raySocks_MBGB($usage['transfer_enable']/1048576), 326 | 's_MB_GB' => V2raySocks_MBGB(round(($usage['u'] + $usage['d'])/1048576,2)), 327 | 'u_MB_GB' => V2raySocks_MBGB(round($usage['u']/1048576,2)), 328 | 'd_MB_GB' => V2raySocks_MBGB(round($usage['d']/1048576,2))); 329 | if ($usage && $usage['enable']) { 330 | return array( 331 | 'tabOverviewReplacementTemplate' => 'details.tpl', 332 | 'templateVariables' => array( 333 | 'usage' => $user, 334 | 'params' => $params, 335 | 'nodes' => $results, 336 | 'script' => $script, 337 | 'datadays' => $datadays, 338 | 'nowdate' => date('m/d H:i',time()), 339 | 'infos' => $infos, 340 | 'HTTP_HOST' => $_SERVER['HTTP_HOST']) 341 | ); 342 | } 343 | return array( 344 | 'tabOverviewReplacementTemplate' => 'error.tpl', 345 | 'templateVariables' => array('usefulErrorHelper' => V2raySocks_get_lang('error_Service_Disable')) 346 | ); 347 | } 348 | catch (Exception $e) { 349 | logModuleCall('V2raySocks', 'V2raySocks_ClientArea', $params, $e->getMessage(), $e->getTraceAsString()); 350 | return array( 351 | 'tabOverviewReplacementTemplate' => 'error.tpl', 352 | 'templateVariables' => array('usefulErrorHelper' => V2raySocks_get_lang('Model_error').$e->getMessage()) 353 | ); 354 | } 355 | }else{ 356 | return array( 357 | 'tabOverviewReplacementTemplate' => 'error.tpl', 358 | 'templateVariables' => array('usefulErrorHelper' => V2raySocks_get_lang('error_Service_Disable')) 359 | ); 360 | } 361 | } 362 | 363 | function V2raySocks_AdminServicesTabFields(array $params){ 364 | $query = V2raySocks_initialize($params); 365 | try { 366 | $dbhost = $params['serverip']; 367 | $dbname = $params['configoption1']; 368 | $dbuser = $params['serverusername']; 369 | $dbpass = $params['serverpassword']; 370 | $db = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); 371 | $userinfo = $db->prepare($query['USERINFO']); 372 | $userinfo->bindValue(':sid', $params['serviceid']); 373 | $userinfo->execute(); 374 | $userinfo = $userinfo->fetch(); 375 | if ($userinfo) { 376 | 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'])); 377 | } 378 | } 379 | catch (Exception $e) { 380 | logModuleCall('V2raySocks', 'V2raySocks_AdminServicesTabFields', $params, $e->getMessage(), $e->getTraceAsString()); 381 | return $e->getTraceAsString(); 382 | } 383 | } 384 | 385 | function V2raySocks_make_script($name,$label,$data){ 386 | if($name and $label and $data){ 387 | $script = " 388 | var canvas=document.getElementById('".$name."'); 389 | var data = { 390 | labels : [".$label."], 391 | datasets : [ 392 | { 393 | fillColor : 'rgba(220,220,220,0.5)', 394 | strokeColor : 'rgba(220,220,220,1)', 395 | pointColor : 'rgba(220,220,220,1)', 396 | pointStrokeColor : '#fff', 397 | data : [".$data."] 398 | }, 399 | ] 400 | } 401 | var ctx = canvas.getContext('2d'); 402 | var myLine = new Chart(ctx).Line(data,{ 403 | responsive: true, 404 | scaleLabel: '<%=value%>MB'});"; 405 | return $script; 406 | } 407 | } 408 | 409 | function V2raySocks_MBGB($tra){ 410 | if($tra >= 1024){ 411 | $tra = round($tra / 1024,2); 412 | $tra .= 'GB'; 413 | }else{ 414 | $tra .= 'MB'; 415 | } 416 | return $tra; 417 | } 418 | 419 | function V2raySocks_GenerateUuid(){ 420 | $chars = md5(uniqid(mt_rand(), true)); 421 | $uuid = substr($chars,0,8) . '-'; 422 | $uuid .= substr($chars,8,4) . '-'; 423 | $uuid .= substr($chars,12,4) . '-'; 424 | $uuid .= substr($chars,16,4) . '-'; 425 | $uuid .= substr($chars,20,12); 426 | return strtoupper($uuid); 427 | } 428 | 429 | function V2raySocks_Convert($number, $from, $to){ 430 | $to = strtolower($to); 431 | $from = strtolower($from); 432 | switch ($from) { 433 | case 'gb': 434 | switch ($to) { 435 | case 'mb': 436 | return $number * 1024; 437 | case 'bytes': 438 | return $number * 1073741824; 439 | default: 440 | } 441 | return $number; 442 | break; 443 | case 'mb': 444 | switch ($to) { 445 | case 'gb': 446 | return $number / 1024; 447 | case 'bytes': 448 | return $number * 1048576; 449 | default: 450 | } 451 | return $number; 452 | break; 453 | case 'bytes': 454 | switch ($to) { 455 | case 'gb': 456 | return $number / 1073741824; 457 | case 'mb': 458 | return $number / 1048576; 459 | default: 460 | } 461 | return $number; 462 | break; 463 | default: 464 | } 465 | return $number; 466 | } 467 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------