Subversion Repositories oidplus

Rev

Rev 1288 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1288 Rev 1297
1
/*
1
/*
2
 * OIDplus 2.0
2
 * OIDplus 2.0
3
 * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
3
 * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
4
 *
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
7
 * You may obtain a copy of the License at
8
 *
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */
16
 */
17
 
17
 
18
var OIDplusPagePublicWhois = {
18
var OIDplusPagePublicWhois = {
19
 
19
 
20
        openInBrowser: function() {
20
        openInBrowser: function() {
21
                var url = $("#whois_url_bar")[0].innerText;
21
                var url = $("#whois_url_bar")[0].innerText;
22
                //document.location.href = url;
22
                //document.location.href = url;
23
                window.open(url);
23
                window.open(url);
24
        },
24
        },
25
 
25
 
26
        refresh_whois_url_bar: function() {
26
        refresh_whois_url_bar: function() {
27
                var query = "";
27
                var query = "";
28
                // -------------------------------------------------------------
28
                // -------------------------------------------------------------
29
                var obj = $("#whois_query")[0].value.trim();
29
                var obj = $("#whois_query")[0].value.trim();
30
                var tmp = obj.split(":");
30
                var tmp = obj.split(":");
31
                var ns = tmp.shift();
31
                var ns = tmp.shift();
32
                var id = tmp.join(":");
32
                var id = tmp.join(":");
33
                if (!/^[a-z0-9]+$/.test(ns) || id.includes("$")) {
33
                if (!/^[a-z0-9]+$/.test(ns) || id.includes("$")) {
34
                        $("#whois_query_invalid")[0].style.display = "Inline";
34
                        $("#whois_query_invalid")[0].style.display = "Inline";
35
                } else {
35
                } else {
36
                        $("#whois_query_invalid")[0].style.display = "None";
36
                        $("#whois_query_invalid")[0].style.display = "None";
37
                }
37
                }
38
                query = ns + ":" + id;
38
                query = ns + ":" + id;
39
                // -------------------------------------------------------------
39
                // -------------------------------------------------------------
40
                var format = "text";
40
                var format = "text";
41
                var radios = $("[name=format]");
41
                var radios = $("[name=format]");
42
                for (var i = 0, length = radios.length; i < length; i++) {
42
                for (var i = 0, length = radios.length; i < length; i++) {
43
                        if (radios[i].checked) {
43
                        if (radios[i].checked) {
44
                                format = radios[i].value;
44
                                format = radios[i].value;
45
                        }
45
                        }
46
                }
46
                }
47
                if (format != "text") query += "$format="+format;
47
                if (format != "text") query += "$format="+format;
48
                // -------------------------------------------------------------
48
                // -------------------------------------------------------------
49
                var auth = $("#whois_auth")[0].value;
49
                var auth = $("#whois_auth")[0].value;
50
                var invalid_tokens = false;
50
                var invalid_tokens = false;
51
                if (auth != "") {
51
                if (auth != "") {
52
                        var tokens = auth.split(",");
52
                        var tokens = auth.split(",");
53
                        for (var i=0; i<tokens.length; i++) {
53
                        for (var i=0; i<tokens.length; i++) {
54
                                var token = tokens[i];
54
                                var token = tokens[i];
55
                                if ((token == "") || token.includes("$") || token.includes("=")) {
55
                                if ((token == "") || token.includes("$") || token.includes("=")) {
56
                                        invalid_tokens = true;
56
                                        invalid_tokens = true;
57
                                        break;
57
                                        break;
58
                                }
58
                                }
59
                                tokens[i] = token.trim();
59
                                tokens[i] = token.trim();
60
                        }
60
                        }
61
                        auth = tokens.join(",");
61
                        auth = tokens.join(",");
62
                }
62
                }
63
                if (invalid_tokens) {
63
                if (invalid_tokens) {
64
                        $("#whois_auth_invalid")[0].style.display = "Inline";
64
                        $("#whois_auth_invalid")[0].style.display = "Inline";
65
                        auth = "";
65
                        auth = "";
66
                } else {
66
                } else {
67
                        $("#whois_auth_invalid")[0].style.display = "None";
67
                        $("#whois_auth_invalid")[0].style.display = "None";
68
                }
68
                }
69
                if (auth != "") query += "$auth="+auth;
69
                if (auth != "") query += "$auth="+auth;
70
                // -------------------------------------------------------------
70
                // -------------------------------------------------------------
-
 
71
                // var sys = getSystemUrl(false);
-
 
72
                var sys = oidplus_webpath_absolute_canonical;
71
                $("#whois_url_bar")[0].innerText = getSystemUrl(false) + 'plugins/viathinksoft/publicPages/100_whois/whois/webwhois.php?query=' + encodeURIComponent(query);
73
                $("#whois_url_bar")[0].innerText = sys + 'plugins/viathinksoft/publicPages/100_whois/whois/webwhois.php?query=' + encodeURIComponent(query);
-
 
74
 
72
                $("#whois_query_bar")[0].innerText = query;
75
                $("#whois_query_bar")[0].innerText = query;
73
        }
76
        }
74
 
77
 
75
};
78
};
76
 
79