加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_泰州站长网 (http://www.0523zz.com/)- 视觉智能、AI应用、CDN、行业物联网、智能数字人!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

关于对discuz.gtimg.cn不明代码的解决措施

发布时间:2021-11-30 17:41:23 所属栏目:PHP教程 来源:互联网
导读:今天看了下一个频道的页面,发现有js什么的冲突代码 最近用排除方法 是底部 这代码引起的,既然在底部那就很好找,找到模版 footer.htm 里面是用 调用的 之前没有这代码的,打了0339补丁就有了,那就去0339补丁里搜索这代码 在 source/function/function_clo

今天看了下一个频道的页面,发现有js什么的冲突代码
 
最近用排除方法 是底部
 
这代码引起的,既然在底部那就很好找,找到模版 footer.htm  里面是用 调用的
 
之前没有这代码的,打了0339补丁就有了,那就去0339补丁里搜索这代码
 
在 source/function/function_cloud.php 里有这么一句赤裸裸的代码,为什么我叫他赤裸裸
 
一 因为这gtimg.cn跟官方,压跟没有联系
 
二 这js代码还会影响我们js的效果
 
三 下载这个js还使用一个eval(function(p,a,c,k,e,d)加密
 
-----------------------------------------------------------------------------------------------
 
解密后得到的代码
001
var clearTips;
002
DiscuzCloudNameSpace = new Object();
003
DiscuzCloudNameSpace.register = function(fullName) {
004
    try {
005
        var nsArray = fullName.split(".");
006
        var strNS = "";
007
        var strEval = "";
008
        for (var i = 0; i < nsArray.length; i++) {
009
            if (strNS.length > 0) strNS += ".";
010
            strNS += nsArray;
011
            strEval += " if (typeof(" + strNS + ") =='undefined') " + strNS + " = new Object(); "
012
        };
013
        if (strEval != "") eval(strEval)
014
    } catch(e) {
015
        alert(e.message)
016
    }
017
};
018
DiscuzCloudNameSpace.register('DiscuzCloud');
019
DiscuzCloud.JSONP = (function() {
020
    var counter = 0,
021
    head, query, key, window = this;
022
    function load(url) {
023
        script = document.createElement('script'),
024
        done = false;
025
        script.src = url;
026
        script.charset = 'UTF-8';
027
        script.async = true;
028
        script.onload = script.onreadystatechange = function() {
029
            if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
030
                done = true;
031
                script.onload = script.onreadystatechange = null;
032
                if (script && script.parentNode) {
033
                    script.parentNode.removeChild(script)
034
                }
035
            }
036
        };
037
        if (!head) {
038
            head = document.getElementsByTagName('head')[0]
039
        };
040
        head.appendChild(script)
041
    };
042
    function jsonp(url, params, callback) {
043
        if (url.indexOf('?') > -1) {
044
            query = '&'
045
        } else {
046
            query = '?'
047
        };
048
        params = params || {};
049
        for (key in params) {
050
            if (params.hasOwnProperty(key)) {
051
                query += encodeURIComponent(key) + "=" + encodeURIComponent(params[key]) + "&"
052
            }
053
        };
054
        var jsonp = 'discuzTipsCallback';
055
        window[jsonp] = function(data) {
056
            callback(data);
057
            try {
058
                delete window[jsonp]
059
            } catch(e) {}
060
            window[jsonp] = null
061
        };
062
        load(url + query + "callback=" + jsonp);
063
        return jsonp
064
    };
065
    return {
066
        get: jsonp
067
    }
068
} ());
069
DiscuzCloud.htmlspecialchars = function(string, quote_style, charset, double_encode) {
070
    var optTemp = 0,
071
    i = 0,
072
    noquotes = false;
073
    if (typeof quote_style === 'undefined' || quote_style === null) {
074
        quote_style = 2
075
    };
076
    string = string.toString();
077
    if (double_encode !== false) {
078
        string = string.replace(/&/g, '&')
079
    };
080
    string = string.replace(//g, '>');
081
    var OPTS = {
082
        'ENT_NOQUOTES': 0,
083
        'ENT_HTML_QUOTE_SINGLE': 1,
084
        'ENT_HTML_QUOTE_DOUBLE': 2,
085
        'ENT_COMPAT': 2,
086
        'ENT_QUOTES': 3,
087
        'ENT_IGNORE': 4
088
    };
089
    if (quote_style === 0) {
090
        noquotes = true
091
    };
092
    if (typeof quote_style !== 'number') {
093
        quote_style = [].concat(quote_style);
094
        for (i = 0; i < quote_style.length; i++) {
095
            if (OPTS[quote_style] === 0) {
096
                noquotes = true
097
            } else if (OPTS[quote_style]) {
098
                optTemp = optTemp | OPTS[quote_style]
099
            }
100
        };
101
        quote_style = optTemp
102
    };
103
    if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
104
        string = string.replace(/'/g, ''')
105
    };
106
    if (!noquotes) {
107
        string = string.replace(/"/g, '"')
108
    };
109
    return string
110
};
111
DiscuzCloud.setCookie = function(name, value, sec) {
112
    if (typeof(sec) == 'undefined') {
113
        sec = 86400000;
114
    } else {
115
        sec = sec * 1000
116
    };
117
    var expires = new Date();
118
    expires.setTime(expires.getTime() + sec);
119
    document.cookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString()
120
};
121
DiscuzCloud.getCookie = function(name) {
122
    var cookie_start = document.cookie.indexOf(name);
123
    var cookie_end = document.cookie.indexOf(';', cookie_start);
124
    return cookie_start == -1 ? '': unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end: document.cookie.length)))
125
};
126
DiscuzCloud.$ = function(id) {
127
    return document.getElementById(id)
128
};
129
DiscuzCloud.Tips = function(sId, version, release, api, founder, fix, sUrl, sCharset, ts, sig, adminId, groupId, uid, openId) {
130
    this.sId = sId;
131
    this.sUrl = sUrl;
132
    this.version = version;
133
    this.release = release;
134
    this.api = api;
135
    this.founder = founder;
136
    this.fix = fix;
137
    this.clientWidth = document.documentElement.clientWidth;
138
    this.clientHeight = document.documentElement.clientHeight;
139
    this.discuzTips = DiscuzCloud.$('discuz_tips');
140
    newDate = new Date();
141
    this.url = 'http://cp.discuz.qq.com/tips/get?rand=' + newDate.getDate() + newDate.getHours();
142
    this.secret = '';
143
    this.tipsId = '';
144
    this.cacheKey = '';
145
    this.sendTime = '';
146
    this.sCharset = sCharset;
147
    if (typeof(document.characterSet) == 'undefined') {
148
        this.browserCharset = document.charset
149
    } else {
150
        this.browserCharset = document.characterSet
151
    };
152
    if (discuzTipsCVersion == '2') {
153
        this.adminId = adminId;
154
        this.groupId = groupId;
155
        this.uid = uid;
156
        this.openId = openId
157
    };
158
    this.ts = ts;
159
    this.sig = sig
160
};
161
DiscuzCloud.Tips.prototype.show = function() {
162
    if (discuzTipsCVersion == '2' && this.adminId != 1) {
163
        return false
164
    };
165
    if (this.checkManyou()) {
166
&
 

(编辑:云计算网_泰州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读