****************************************
创建请求
****************************************
163508
function createAjax(settings) {

    // 创建请求方法
    function ajax(options, callback) {
        let { promise, resolve, reject } = defer(),
            xhr;

        // 生成配置
        options = createOptions({ ...settings, ...options });

        // 创建请求
        xhr = request(options, (err, response, body) => {

            // 解析数据
            if (!err) {
                try {
                    response.result = JSON.parse(body);
                } catch (err) {
                    // do nothings;
                }

                // 解析返回
                return resolve(response);
            }

            // 抛出错误
            reject(err);
        });

        // 执行就绪回调
        callback && callback(xhr);

        // 返回结果
        return promise;
    }

    // 【GET】请求
    ajax.get = (url, params) => ajax({ url, qs: params });

    // 【POST】请求
    ajax.post = (url, data) => ajax({
        url,
        json: data,
        headers: { 'Content-type': 'application/json' }
    });

    // 创建实例
    ajax.create = options => {
        return createAjax({ ...settings, ...options });
    };

    // 返回方法
    return ajax;
}
1374720
function ieRgbaHack(decl, i) {
  //十六进制不足两位自动补 0
  function pad(str) {
    return str.length == 1 ? '0' + str : '' + str
  }
  if (
    (decl.prop == 'background' || decl.prop == 'background-color') &&
    decl.value.match(reRGBA)
  ) {
    // rgba 转换为 AARRGGBB
    var colorR = pad(parseInt(RegExp.$1).toString(16))
    var colorG = pad(parseInt(RegExp.$2).toString(16))
    var colorB = pad(parseInt(RegExp.$3).toString(16))
    var colorA = pad(parseInt(RegExp.$4 * 255).toString(16))
    var ARGB = "'" + '#' + colorA + colorR + colorG + colorB + "'"

    // 插入IE半透明滤镜
    var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1')
    insertDecl(decl, i, {
      raws: {
        before: reBefore
      },
      prop: 'filter',
      value:
        'progid:DXImageTransform.Microsoft.gradient(startColorstr=' +
        ARGB +
        ', endColorstr=' +
        ARGB +
        ')'
    })

    // IE9 rgba 和滤镜都支持，插入 :root hack 去掉滤镜
    var newSelector = ':root ' + decl.parent.selector

    var nextrule = postcss.rule({
      selector: newSelector
    })
    decl.parent.parent.insertAfter(decl.parent, nextrule)
    nextrule.append({
      prop: 'filter',
      value: 'none\\9'
    })
  }
}
1195781
public function init() {
		//触发应用开始事件
		$this->eventDispatcher->dispatchEvent(new \Fasim\Event\Event(\Fasim\Event\Event::$APP_START));

		//初始化配置
		$this->registerFacdes();

		//设置时区
		$timezone = $this->make('config')->get('timezone', 'Asia/Shanghai');
		date_default_timezone_set($timezone);

		//设置调试模式
		$debugMode = $this->make('config')->get('debug') === true;
		$this->setDebugMode($debugMode);
		$this->eventDispatcher->dispatchEvent(new \Fasim\Event\Event(\Fasim\Event\Event::$APP_READY));
	}
14469
function UserInfo() {
	//使用者帳號(索引用)
	this.strAccount = "";
	//電子信箱
	this.strEmail = "";
	//信箱通知勾選
	this.bEmailNotify = false;
	//電話資料
	this.strPhone = "";
	//簡訊通知勾選
	this.bSMSNotify = false;
	//使用者名稱(暱稱?)
	this.strUserName = "";
	//語系控制
	this.strLanguages = "";
	//系統保護
	this.bSystemAegis = false;
	//登入次數
	this.iLoginCount = 0;
	//登入時間
	this.iLogin = 0;
	//最後登出時間
	this.iLastLogout = 0;
}
1249164
public static function init()
    {
        // 如果没设置$pidFile，则生成默认值
        if (empty(self::$pidFile))
        {
            $backtrace = debug_backtrace();
            self::$_startFile = $backtrace[count($backtrace) - 1]['file'];
            self::$pidFile = sys_get_temp_dir() . "/workerman." . str_replace('/', '_', self::$_startFile) . ".pid";
        }
        // 没有设置日志文件，则生成一个默认值
        if (empty(self::$logFile))
        {
            self::$logFile = __DIR__ . '/../server.log';
        }
        // 标记状态为启动中
        self::$_status = self::STATUS_STARTING;

        // 启动时间戳
        self::$_globalStatistics['start_timestamp'] = time();
        Base::getLog()->debug(__METHOD__ . ' worker start timestamp', [
            'time' => self::$_globalStatistics['start_timestamp'],
        ]);

        // 设置status文件位置
        self::$statusFile = sys_get_temp_dir() . '/workerman.status';
        Base::getLog()->debug(__METHOD__ . ' set status file', [
            'file' => self::$statusFile,
        ]);

        // 尝试设置进程名称（需要php>=5.5或者安装了proctitle扩展）
        self::setProcessTitle('WorkerMan: master process  start_file=' . self::$_startFile);

        // 初始化ID
        self::initId();

        // 初始化定时器
        Timer::init();
    }
918006
public function handle()
    {
        /** @var Request $request */
        $request =& $this->flow->contexts['request'];

        // 如果当前请求是初始请求，那么对其进行额外处理
        // 如果当前请求是CLI，那么直接当做为初始化请求
        if (PHP_SAPI == 'cli' || $request->isInitial())
        {
            if (
                ( ! empty($_SERVER['HTTPS']) && filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
                || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'])
                && in_array($_SERVER['REMOTE_ADDR'], Request::$trustedProxies)
            )
            {
                $request->secure = true;
            }

            if (isset($_SERVER['REQUEST_METHOD']))
            {
                $method = $_SERVER['REQUEST_METHOD'];
            }
            else
            {
                $method = Http::GET;
            }

            if (isset($_SERVER['HTTP_REFERER']))
            {
                $referrer = $_SERVER['HTTP_REFERER'];
            }

            if (isset($_SERVER['HTTP_USER_AGENT']))
            {
                Request::$userAgent = $_SERVER['HTTP_USER_AGENT'];
            }

            if (isset($_SERVER['HTTP_X_REQUESTED_WITH']))
            {
                $requestedWith = $_SERVER['HTTP_X_REQUESTED_WITH'];
            }

            Request::$clientIp = Request::getClientIP();

            if ($method !== Http::GET)
            {
                $body = file_get_contents('php://input');
            }

            $cookies = [];
            if (($cookieKeys = array_keys($_COOKIE)))
            {
                foreach ($cookieKeys as $key)
                {
                    $cookies[$key] = Cookie::get($key);
                }
            }

            if (isset($_SERVER['SERVER_PROTOCOL']))
            {
                $request->protocol = $_SERVER['SERVER_PROTOCOL'];
            }

            $request
                ->query($_GET)
                ->post($_POST);

            if (isset($method))
            {
                $request->method = $method;
            }
            if (isset($referrer))
            {
                $request->referrer = $referrer;
            }
            if (isset($requestedWith))
            {
                $request->requestedWith = $requestedWith;
            }
            if (isset($body))
            {
                $request->body = $body;
            }
            if (isset($cookies))
            {
                $request->cookie($cookies);
            }
        }
    }
633114
private void foreign(Term[] terms) {
        List<Term> list = new ArrayList<>();

        Term term = null;
        Term temp = null;

        boolean mid = false;

        for (int i = 0; i < terms.length; i++) {
            term = terms[i];
            if (term == null) {
                continue;
            }

            if (DATDictionary.foreign(term)) {
                mid = "·".equals(term.getName());

                if (mid && list.size() == 0) { // mid 不能出现在名字首位
                    mid = false;
                    continue;
                }

                list.add(term);
                continue;
            }

            if (mid) {
                list = list.subList(0, list.size() - 1);
                mid = false;
            }

            if (list.size() == 0) {
                continue;
            }

            if (list.size() == 1) { //只有一个就别识别了
                list.clear();
                continue;
            }

            TermUtil.insertTerm(terms, list, TermNatures.NRF);

            list.clear();

        }

    }
1015541
function EventSystem() {
	//索引要用甚麼?
	this.iEventInx = "";
	//事件名稱
	this.strEventName = "";
	//事件等級 1:一般 2:警告 3:急迫
	this.iEventLevel = 1;
	//事件開關(就開跟關)
	this.bSwitch = false;
	//觸發群組
	this.groupID = "";
	//信箱通知勾選
	this.bEmail = false;
	//簡訊通知
	this.bSMS = false;
	//觸發快照
	this.bSnapshot = false;
	//電子郵件通知管理者
	this.bEmailAdmin = false;
	//簡訊通知管理者
	this.bSMSAdmin = false;
	//畫面外框閃爍紅色線框
	this.bScreenFlash = false;
	//報警提示
	this.bCallPolice = false;
	//畫面彈跳
	this.bScreenBounce = false;
	//回播跳出
	this.bPlaybackJump = false;
	//FTP上傳
	this.bFTP = false;
	//可設定一首MP3上傳檔案(每個事件獨立音檔)。
	this.strMp3 = "";
	//可讓使用者設定播放秒數(開始)
	this.iMp3PlayBin = 0;
	//可讓使用者設定播放秒數(結束)
	this.iMp3PlayEnd = 0;
	//Loop
	this.bLoop = false;
}
176505
function s(s) {
        /**
         * 该函数运行在View上
         * @param target View实例
         * @param decoratedPropertyName 属性名
         */
        return function (target, decoratedPropertyName) {
            var targetType = target.constructor;
            // 目标view的名称
            var name = target.constructor.toString().match(/^function\s*([^\s(]+)/)[1];
            if (!targetType.hasOwnProperty("__inject__")) {
                targetType["__inject__"] = {};
            }
            if (!targetType["__inject__"][name]) {
                targetType["__inject__"][name] = {
                    constructor: target.constructor
                };
            }
            if (!targetType["__inject__"][name]["services"]) {
                targetType["__inject__"][name]["services"] = [];
            }
            var temp = new view_5.serviceInjectModel();
            temp.creator = s;
            temp.propertyName = decoratedPropertyName;
            targetType["__inject__"][name]["services"].push(temp);
        };
    }
122775
public function init()
    {

        parent::init();

        //注册资源文件
        $asset = UeditorAsset::register($this->getView());

        //设置UEditor实例的名字
        if (! $this->name) {
            $this->name = $this->hasModel() ? $this->model->formName() . '_' . $this->attribute : 'ueditor_' . $this->id;
        }

        //常用配置项
        if (empty($this->config['UEDITOR_HOME_URL'])) {
            $this->config['UEDITOR_HOME_URL'] = $asset->baseUrl . '/';
        }

        if (empty($this->config['serverUrl'])) {
            $this->config['serverUrl'] = Url::to(['/assets/ueditor']);
        } elseif (is_array($this->config['serverUrl'])) {
            $this->config['serverUrl'] = Url::to($this->config['serverUrl']);
        }

        if (empty($this->config['lang'])) {
            $this->config['lang'] = 'zh-cn';
        }

        if (empty($this->config['initialFrameHeight'])) {
            $this->config['initialFrameHeight'] = 400;
        }

        if (empty($this->config['initialFrameWidth'])) {
            $this->config['initialFrameWidth'] = '100%';
        }

        if (empty($this->config['enableAutoSave'])) {
            $this->config['enableAutoSave'] = false;
        }

        //扩展默认不直接引入config.js文件，因此需要自定义配置项.
        if (empty($this->config['toolbars'])) {
            //为了避免每次使用都输入乱七八糟的按钮，这里预先定义一些常用的编辑器按钮。
            //这是一个丑陋的二维数组
            $this->config['toolbars'] = [
                [
                    'fullscreen',
                    'source',
                    'undo',
                    'redo',
                    '|',
                    'customstyle',
                    'paragraph',
                    'fontfamily',
                    'fontsize'
                ],
                [
                    'bold',
                    'italic',
                    'underline',
                    'fontborder',
                    'strikethrough',
                    'superscript',
                    'subscript',
                    'removeformat',
                    'formatmatch',
                    'autotypeset',
                    'blockquote',
                    'pasteplain',
                    '|',
                    'forecolor',
                    'backcolor',
                    'insertorderedlist',
                    'insertunorderedlist',
                    '|',
                    'rowspacingtop',
                    'rowspacingbottom',
                    'lineheight',
                    '|',
                    'directionalityltr',
                    'directionalityrtl',
                    'indent',
                    '|'
                ],
                [
                    'justifyleft',
                    'justifycenter',
                    'justifyright',
                    'justifyjustify',
                    '|',
                    'link',
                    'unlink',
                    '|',
                    'insertimage',
                    'emotion',
                    'scrawl',
                    'insertvideo',
                    'music',
                    'attachment',
                    'map',
                    'insertcode',
                    'pagebreak',
                    '|',
                    'horizontal',
                    'inserttable',
                    '|',
                    'print',
                    'preview',
                    'searchreplace',
                    'help'
                ]
            ];
        }
    }
609828
function (fields, data, vaildRules, method = '') {
    let result = { status: 1, msg: '' }, rdata = {}, rflag = false;
    if (method === 'ADD') { //新增数据add
        for (let f in fields) {
            rflag = !fields[f].pk || fields[f].isnull !== true;
            //默认值
            if (lib.isEmpty(data[f])) {
                if (rflag) {
                    rdata[f] = setDefault(fields[f].defaults, fields[f].type, data[f]);
                } else {
                    data[f] !== undefined && (rdata[f] = data[f]);
                }
            } else {
                rdata[f] = data[f];
            }

            //数据类型检查
            if (rflag) {
                result = dataCheck(f, rdata[f], (fields[f].type || 'string'));
                if (!result.status) {
                    return Promise.reject(result.msg);
                }
            }

            //自定义规则检查
            if (vaildRules[f]) {
                result = ruleCheck(f, rdata[f], vaildRules[f], method);
                if (!result.status) {
                    return Promise.reject(result.msg);
                }
            }
        }
    } else if (method === 'UPDATE') { //编辑数据update
        for (let d in data) {
            //剔除多余字段
            if (fields[d] && data[d] !== undefined) {
                //isnull or pk
                rflag = !fields[d].pk || fields[d].isnull !== true;
                //默认值
                if (lib.isEmpty(data[d])) {
                    if (rflag) {
                        rdata[d] = (fields[d].defaults !== undefined && fields[d].defaults !== null) ? fields[d].defaults : data[d];
                    } else {
                        data[d] !== undefined && (rdata[d] = data[d]);
                    }
                } else {
                    rdata[d] = data[d];
                }

                //数据类型检查
                if (rflag) {
                    result = dataCheck(d, rdata[d], (fields[d].type || 'string'));
                    if (!result.status) {
                        return Promise.reject(result.msg);
                    }
                }

                //自定义规则检查
                if (vaildRules[d]) {
                    result = ruleCheck(d, rdata[d], vaildRules[d], method);
                    if (!result.status) {
                        return Promise.reject(result.msg);
                    }
                }
            }
        }
    } else {
        rdata = data;
    }
    return Promise.resolve(rdata);
}
1295
function (ele) {
            var node = this[0];
            //结点类型判断
            if (node.nodeType === 1 || node.nodeType === 11 || node.nodeType === 9) {
                if(ele instanceof vQ){
                    ele.each(function(inx,ele){
                        node.appendChild(ele);
                    });
                } else if(ele.nodeType){
                    node.appendChild(ele);
                }
                // string array
            }
            return this;
        }
327523
public static void initBigramTables() {
        try (BufferedReader reader = IOUtil.getReader(DicReader.getInputStream("bigramdict.dic"), "UTF-8")) {
            String temp = null;
            String[] strs = null;
            int freq = 0;
            while ((temp = reader.readLine()) != null) {
                if (StringUtil.isBlank(temp)) {
                    continue;
                }
                strs = temp.split("\t");
                freq = Integer.parseInt(strs[1]);
                strs = strs[0].split("@");
                AnsjItem fromItem = DATDictionary.getItem(strs[0]);

                AnsjItem toItem = DATDictionary.getItem(strs[1]);

                if (fromItem == AnsjItem.NULL && strs[0].contains("#")) {
                    fromItem = AnsjItem.BEGIN;
                }

                if (toItem == AnsjItem.NULL && strs[1].contains("#")) {
                    toItem = AnsjItem.END;
                }

                if (fromItem == AnsjItem.NULL || toItem == AnsjItem.NULL) {
                    continue;
                }

                if (fromItem.bigramEntryMap == null) {
                    fromItem.bigramEntryMap = new HashMap<Integer, Integer>();
                }

                fromItem.bigramEntryMap.put(toItem.getIndex(), freq);

            }
        } catch (NumberFormatException e) {
            LOG.warn("数字格式异常", e);
        } catch (UnsupportedEncodingException e) {
            LOG.warn("不支持的编码", e);
        } catch (IOException e) {
            LOG.warn("IO异常", e);
        }
    }
525767
function() {
		var t = this;

		var loading = document.createElement('div');
		loading.className = 'dec_loading';
		loading.style.display = 'none';
		t.container.appendChild(loading);

		var error = document.createElement('div');
		error.className = 'dec_error';
		error.style.display = 'none';
		error.innerHTML = '播放异常';
		t.container.appendChild(error);

		var bigPlay = document.createElement('div');

		if (!zyMedia.features.isVendorBigPlay) {
			bigPlay.className = 'dec_play';
			t.container.appendChild(bigPlay);
			bigPlay.addEventListener('click', function() {
				// For some device trigger 'play' event 
				t.media.isUserClick = true;

				t.media.play();
				// Controls bar auto hide after 3s
				if (!t.media.paused && !t.options.alwaysShowControls) {
					t.setControlsTimer(3000)
				}
			});
		}

		t.media.addEventListener('play', function() {
			// Only for user click
			if (t.media.isUserClick) {
				bigPlay.style.display = 'none';
				loading.style.display = '';
				t.buffering.style.display = 'none'
			}
		});

		t.media.addEventListener('playing', function() {
			bigPlay.style.display = 'none';
			loading.style.display = 'none';
			t.buffering.style.display = 'none';
			error.style.display = 'none';
		});

		t.media.addEventListener('seeking', function() {
			loading.style.display = '';
			bigPlay.style.display = 'none';
			t.buffering.style.display = '';
		});

		t.media.addEventListener('seeked', function() {
			loading.style.display = 'none';
			t.buffering.style.display = 'none';
		});

		t.media.addEventListener('pause', function() {
			bigPlay.style.display = ''
		});

		t.media.addEventListener('waiting', function() {
			loading.style.display = '';
			bigPlay.style.display = 'none';
			t.buffering.style.display = '';
		});

		// Don't listen to 'loadeddata' and 'canplay', 
		// some Android device can't fire 'canplay' or irregular working when use 'createEvent' to trigger 'canplay' (读者i800)

		// Error handling
		t.media.addEventListener('error', function(e) {
			loading.style.display = 'none';
			bigPlay.style.display = '';
			t.buffering.style.display = 'none';
			t.media.pause();
			error.style.display = '';

			if (typeof t.options.error == 'function') {
				t.options.error(e);
			}
		});
	}
589664
function Overloader() {
		var overloaded = new OverloadedFunction();
		var append = function(args) {
			overloaded.overload.apply(overloaded, args);
		};

		if (arguments.length) {
			// append(arguments);
		}

		var fn = function() {
			return overloaded.apply(this, arguments);
		};

		// 已创建的多态函数，仍可通过 overload() 方法扩展其多态实现。
		fn.overload = function(/* Type, Type, ..., Function */) {
			append(arguments);
			return fn;
		};

		// 扩展多态实现，同时将该实现设定为默认实现。
		fn.default = function(method) {
			overloaded.default(method);
			return fn;
		};

		// 返回一个函数实体。
		return fn;
	}
157576
function checkError( id, hard ) {
            if ( visited[ id ] || modIs( id, MODULE_DEFINED ) ) {
                return;
            }

            visited[ id ] = 1;

            if ( !modIs( id, MODULE_PREPARED ) ) {
                // HACK: 为gzip后体积优化，不做抽取
                if ( !hangModulesMap[ id ] ) {
                    hangModulesMap[ id ] = 1;
                    hangModules.push( id );
                }
            }

            var module = modModules[ id ];
            if ( !module ) {
                if ( !missModulesMap[ id ] ) {
                    missModulesMap[ id ] = 1;
                    missModules.push( id );
                }
            }
            else if ( hard ) {
                if ( !hangModulesMap[ id ] ) {
                    hangModulesMap[ id ] = 1;
                    hangModules.push( id );
                }

                each(
                    module.depMs,
                    function ( dep ) {
                        checkError( dep.absId, dep.hard );
                    }
                );
            }
        }
198419
async def grant(self, user_id, *permissions):
        "  "

        prefix = f"{self._prefix_perm}/{user_id}/"

        perm_names = [str(p) for p in permissions]        
        checkings = [
            KV.put.txn(prefix + p, b'\0', prev_kv=True) for p in perm_names
        ]
        success, response = await self._client.txn(compare=[], success=checkings)
        if not success:
            errmsg = f"无法授予用户({user_id})的权限: {{{', '.join(perm_names)}}}"
            raise Unprocessable(errmsg)

        if logger.isEnabledFor(logging.DEBUG):
            granted, ignored = set(), set()
            for i, (perm, _)  in enumerate(response):
                if perm is None:
                    granted.add(perm_names[i])
                else:
                    ignored.add(perm_names[i])
            
            logger.debug(f"授予用户({user_id})权限({', '.join(granted)}), "
                            f"忽略已授权({', '.join(ignored)})")