1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* ***************************************************************************** |
4
|
|
|
* Contributions to this work were made on behalf of the GÉANT project, a |
5
|
|
|
* project that has received funding from the European Union’s Framework |
6
|
|
|
* Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus), |
7
|
|
|
* Horizon 2020 research and innovation programme under Grant Agreements No. |
8
|
|
|
* 691567 (GN4-1) and No. 731122 (GN4-2). |
9
|
|
|
* On behalf of the aforementioned projects, GEANT Association is the sole owner |
10
|
|
|
* of the copyright in all material which was developed by a member of the GÉANT |
11
|
|
|
* project. GÉANT Vereniging (Association) is registered with the Chamber of |
12
|
|
|
* Commerce in Amsterdam with registration number 40535155 and operates in the |
13
|
|
|
* UK as a branch of GÉANT Vereniging. |
14
|
|
|
* |
15
|
|
|
* Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. |
16
|
|
|
* UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK |
17
|
|
|
* |
18
|
|
|
* License: see the web/copyright.inc.php file in the file structure or |
19
|
|
|
* <base_url>/copyright.php after deploying the software |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
$Gui->defaultPagePrelude(); |
24
|
|
|
$_SESSION['current_page'] = $_SERVER['SCRIPT_NAME']; |
25
|
|
|
?> |
26
|
|
|
<!-- JQuery --> |
27
|
|
|
<script type="text/javascript" src="<?php echo $Gui->skinObject->findResourceUrl("EXTERNAL", "jquery/jquery.js"); ?>"></script> |
28
|
|
|
<script type="text/javascript" src="<?php echo $Gui->skinObject->findResourceUrl("EXTERNAL", "jquery/jquery-ui.js"); ?>"></script> |
29
|
|
|
<script type='text/javascript' src="<?php echo $Gui->skinObject->findResourceUrl("EXTERNAL", "jquery/Timepicker/jquery-ui-timepicker-addon.js"); ?>"></script> |
30
|
|
|
<script type='text/javascript' src="<?php echo $Gui->skinObject->findResourceUrl("EXTERNAL", "jquery/Timepicker/jquery-ui-sliderAccess.js"); ?>"></script> |
31
|
|
|
<link type="text/css" rel="stylesheet" href="<?php echo $Gui->skinObject->findResourceUrl("EXTERNAL", "jquery/jquery-ui-1.12.1.custom/jquery-ui.css"); ?>" media="all" /> |
32
|
|
|
<link type="text/css" rel="stylesheet" href="<?php echo $Gui->skinObject->findResourceUrl("EXTERNAL", "jquery/Timepicker/jquery-ui-timepicker-addon.css"); ?>" media="all" /> |
33
|
|
|
<script type="text/javascript"> |
34
|
|
|
var recognisedOS = ''; |
35
|
|
|
var downloadMessage; |
36
|
|
|
var noDisco = 1; |
37
|
|
|
var sbPage = 1; |
38
|
|
|
var lang = "<?php echo($Gui->langObject->getLang()) ?>"; |
39
|
|
|
var dir = "<?php echo dirname(__DIR__); ?>"; |
40
|
|
|
|
41
|
|
|
<?php |
42
|
|
|
$profile_list_size = 1; |
43
|
|
|
require_once dirname(__DIR__) . '/Divs.php'; |
44
|
|
|
$divs = new \web\skins\modern\Divs($Gui); |
|
|
|
|
45
|
|
|
$visibility = 'index'; |
46
|
|
|
$operatingSystem = $Gui->detectOS(); |
47
|
|
|
$Gui->loggerInstance->debug(4, $operatingSystem); |
48
|
|
|
$uiElements = new web\lib\admin\UIElements(); |
49
|
|
|
if ($operatingSystem) { |
50
|
|
|
print "recognisedOS = '" . $operatingSystem['device'] . "';\n"; |
51
|
|
|
} |
52
|
|
|
require dirname(__DIR__) . '/user/js/cat_js.php'; |
53
|
|
|
?> |
54
|
|
|
|
55
|
|
|
</script> |
56
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> |
57
|
|
|
<link rel="stylesheet" media="screen" type="text/css" href="<?php echo $Gui->skinObject->findResourceUrl("CSS", "cat-user.css"); ?>" /> |
58
|
|
|
<link rel="stylesheet" media="screen" type="text/css" href="<?php echo $Gui->skinObject->findResourceUrl("CSS", "diag.css", "diag"); ?>" /> |
59
|
|
|
</head> |
60
|
|
|
<body> |
61
|
|
|
<div id='wrap'> |
62
|
|
|
<form id="cat_form" name="cat_form" accept-charset="UTF-8" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="POST"> |
63
|
|
|
<?php |
64
|
|
|
echo $divs->div_heading($visibility); |
65
|
|
|
$Gui->languageInstance->setTextDomain("diagnostics"); |
66
|
|
|
?> |
67
|
|
|
<div id="main_page"> |
68
|
|
|
<div id="loading_ico"> |
69
|
|
|
<span id='load_comment'></span><br><img src="<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "icons/loading51.gif"); ?>" alt="Loading stuff ..."/> |
70
|
|
|
</div> |
71
|
|
|
<div id="info_overlay"> <!-- device info --> |
72
|
|
|
<div id="info_window"></div> |
73
|
|
|
<img id="info_menu_close" class="close_button" src="<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "icons/button_cancel.png"); ?>" ALT="Close"/> |
74
|
|
|
</div> |
75
|
|
|
<div id="main_menu_info" style="display:none"> <!-- stuff triggered form main menu --> |
76
|
|
|
<img id="main_menu_close" class="close_button" src="<?php echo $Gui->skinObject->findResourceUrl("IMAGES", "icons/button_cancel.png"); ?>" ALT="Close"/> |
77
|
|
|
<div id="main_menu_content"></div> |
78
|
|
|
</div> |
79
|
|
|
<div id="main_body"> |
80
|
|
|
<div id="user_page"> |
81
|
|
|
<?php echo $divs->div_pagetitle(_("Diagnostics site"), ""); ?> |
82
|
|
|
<div id="user_info" style='padding-top: 10px;'> |
83
|
|
|
<div id='diagnostic_choice'> |
84
|
|
|
<?php echo _("The diagnostics system will do its best to identify and resolve your problems!") . ' ' . _("Please help the system by answering the questions as precisely as possible.") . "<br/>" . _("Are you a") . ' '; ?> |
85
|
|
|
<input type='radio' name='diagnostic_usertype' value='0'><?php echo _("end-user") . ' ' . _("or"); ?> |
86
|
|
|
<input type='radio' name='diagnostic_usertype' value='1' <?php if ($admin == 1) { echo " checked"; } ?> > <?php echo _("eduroam administrator") .'?'; ?> |
87
|
|
|
</div> |
88
|
|
|
<div id='diagnostic_enduser' style='display: none;'> |
89
|
|
|
<h2><?php echo _("Tools for End Users"); ?></h2> |
90
|
|
|
<p> |
91
|
|
|
<?php |
92
|
|
|
echo _("To resolve your problem a real-time diagnostics for your realm must be performed."); |
93
|
|
|
?> |
94
|
|
|
</p> |
95
|
|
|
<?php |
96
|
|
|
echo '<div id="before_stage_1"><h3>' . _("The system needs some information on your home institution - issuer of your account") . '</h3>'; |
97
|
|
|
echo _("What is the realm part of your user account (the part behind the @ of 'your.username@<b>realm.tld</b>):"); |
98
|
|
|
?> |
99
|
|
|
<input type='text' name='user_realm' id='user_realm' value=''> |
100
|
|
|
<?php |
101
|
|
|
echo '<div id="realm_by_select"><br/>' . _("alternatively") . '<br/>'; |
102
|
|
|
echo _("You can select your home institution from the following list") . '<br/>'; |
103
|
|
|
echo '<div id="select_idp_country"><a href="" id="idp_countries_list">'; |
104
|
|
|
echo '<span id="realmselect">' . _("Click to select your country/region and organisation") . '</span></a></div>'; |
105
|
|
|
?> |
106
|
|
|
<div id="select_idp_area" style="display:none;"> |
107
|
|
|
</div> |
108
|
|
|
</div> |
109
|
|
|
<div id="position_info"> |
110
|
|
|
<?php |
111
|
|
|
echo '<h3>' . _("Optionally, to improve tests, you can provide information on your current location") . '</h3>'; |
112
|
|
|
echo '<div id="select_sp_country"><a href="" id="sp_countries_list">'; |
113
|
|
|
echo '<span id="spselect">' . _("Click to select a location in which you have an eduroam problem") . '</span></a></div>'; |
114
|
|
|
?> |
115
|
|
|
<div id="select_sp_area" style="display:none;"> |
116
|
|
|
</div> |
117
|
|
|
</div> |
118
|
|
|
</div> |
119
|
|
|
<div id="after_stage_1" style="display:none;"> |
120
|
|
|
<h3><?php echo _("Testing realm")." "; ?><span id="realm_name"></span></h3> |
121
|
|
|
<?php echo _("First stage completed."); ?> |
122
|
|
|
<br> |
123
|
|
|
</div> |
124
|
|
|
<div id="sociopath_query_area" style="margin-top:20px; display:none;"> |
125
|
|
|
<b> |
126
|
|
|
<?php echo _("To narrow down the problem, please answer the following few questions."); ?> |
127
|
|
|
</b> |
128
|
|
|
<div id="sociopath_queries"></div> |
129
|
|
|
</div> |
130
|
|
|
<div id="start_test_area" style="padding-top: 10px; padding-bottom: 5px; display:none; text-align:center;"> |
131
|
|
|
<button id='realmtest' accesskey="T" type='button'><?php echo _("Run tests"); ?> |
132
|
|
|
</button> |
133
|
|
|
</div> |
134
|
|
|
</div> |
135
|
|
|
<div id='diagnostic_admin' style='display: <?php if (!$admin) { echo 'none'; } ?> ;'> |
136
|
|
|
<h2><?php echo _("Tools for eduroam admins"); ?></h2> |
137
|
|
|
<?php |
138
|
|
|
echo '<input type="hidden" id="isadmin" value="'; |
139
|
|
|
if ($isauth) { |
140
|
|
|
echo "1\">"; |
141
|
|
|
echo "<div id='admin_test_area' style='display: "; |
142
|
|
|
if (!$admin) { |
143
|
|
|
echo 'none'; |
144
|
|
|
} |
145
|
|
|
echo ";'>"; |
146
|
|
|
echo '<h3>' . _("Which problem are you reporting?") . '</h3>'; |
147
|
|
|
echo '<input type="radio" name="problem_type" value="1">'; |
148
|
|
|
echo _("SP contacting IdP due to technical problems or abuse") . '<br>'; |
149
|
|
|
echo '<input type="radio" name="problem_type" value="2">'; |
150
|
|
|
echo _("IdP contacting SP due to technical problems"); |
151
|
|
|
echo "<div id='idp_contact_area'></div>"; |
152
|
|
|
echo "<div id='sp_abuse'></div>"; |
153
|
|
|
echo "<div id='idp_problem'></div>"; |
154
|
|
|
echo "</div>"; |
155
|
|
|
} else { |
156
|
|
|
echo "0\">"; |
157
|
|
|
echo _("This service is for authenticated admins only.") . '<br>'; |
158
|
|
|
echo "<a href=\"diag.php?admin=1\">" . |
159
|
|
|
_("eduroam® admin access is needed") . "</a>"; |
160
|
|
|
} |
161
|
|
|
?> |
162
|
|
|
</div> |
163
|
|
|
</div> |
164
|
|
|
<input type="hidden" name="lang" id="lang"/> |
165
|
|
|
</div> |
166
|
|
|
</div> |
167
|
|
|
</div> |
168
|
|
|
</form> |
169
|
|
|
<div id="vertical_fill"> </div> |
170
|
|
|
<?php echo $divs->div_footer(); ?> |
171
|
|
|
</div> |
172
|
|
|
|
173
|
|
|
<script> |
174
|
|
|
function countryAddSelect(selecthead, select, type) { |
175
|
|
|
if (selecthead !== '') { |
176
|
|
|
select = selecthead + select + '</td>'; |
177
|
|
|
} |
178
|
|
|
$('#select_'+type+'_country').hide(); |
179
|
|
|
var shtml = ''; |
180
|
|
|
if (type === 'idp' || type === 'sp') { |
181
|
|
|
shtml = '<table><tbody><tr id="row_'+type+'_country"></tr>'; |
182
|
|
|
shtml = shtml + '<tr id="row_'+type+'_institution" style="visibility: collapse;">'; |
183
|
|
|
shtml = shtml + '<td>' + <?php echo '"' . _("Select institiution:") . '"'; ?> + '</td><td></td></tr>'; |
184
|
|
|
if (type === 'idp') { |
185
|
|
|
shtml = shtml + '<tr id="row_idp_realm"></tr>'; |
186
|
|
|
} |
187
|
|
|
shtml = shtml + '</tbody></table>'; |
188
|
|
|
$('#select_' + type+'_area').html(shtml); |
189
|
|
|
$('#select_' + type+'_area').show(); |
190
|
|
|
$('#row_' + type+'_country').append(select); |
191
|
|
|
} else { |
192
|
|
|
shtml = '<div id="inst_asp_area"></div>'; |
193
|
|
|
$('#select_' + type+'_area').html(select + shtml); |
194
|
|
|
$('#select_' + type+'_area').show(); |
195
|
|
|
} |
196
|
|
|
reset_footer(); |
197
|
|
|
} |
198
|
|
|
function countrySelection(type1) { |
199
|
|
|
var type2; |
200
|
|
|
if (type1 === 'sp' || type1 === 'asp') { |
201
|
|
|
type2 = 'idp'; |
202
|
|
|
} |
203
|
|
|
if (type1 === 'idp') { |
204
|
|
|
type2 = 'sp'; |
205
|
|
|
} |
206
|
|
|
var options = ''; |
207
|
|
|
var selecthead = ''; |
208
|
|
|
if (type1 === 'sp' || type1 === 'idp') { |
209
|
|
|
selecthead = <?php echo '"<td>' . _("Select country or region:") . ' </td>"'; ?>; |
210
|
|
|
selecthead = selecthead + '<td>\n'; |
211
|
|
|
} |
212
|
|
|
var select = '<select id="' + type1 + '_country" name="' + type1 + '_country" style="margin-left:0px; width:400px;">'; |
213
|
|
|
if ($("#"+type2+"_country").is('select')) { |
214
|
|
|
options = ($('#'+type2+'_country').html()); |
215
|
|
|
countryAddSelect(selecthead, select + options + '</select>', type1); |
216
|
|
|
} else { |
217
|
|
|
var comment = <?php echo '"<br><br>' . _("Fetching country/region list") . '..."'; ?>; |
218
|
|
|
inProgress(1, comment); |
219
|
|
|
$.ajax({ |
220
|
|
|
url: "findRealm.php", |
221
|
|
|
data: {type: "co", lang: lang}, |
222
|
|
|
dataType: "json", |
223
|
|
|
success:function(data) { |
224
|
|
|
if (data.status) { |
225
|
|
|
inProgress(0); |
226
|
|
|
options = '<option value=""></option>'; |
227
|
|
|
var countries = data.countries; |
228
|
|
|
for (var key in countries) { |
229
|
|
|
options = options + '<option value="'+key+'">' + countries[key] + '</option>'; |
230
|
|
|
} |
231
|
|
|
countryAddSelect(selecthead, select + options + '</select>', type1); |
232
|
|
|
} |
233
|
|
|
}, |
234
|
|
|
error:function() { |
235
|
|
|
passed = false; |
236
|
|
|
inProgress(0); |
237
|
|
|
alert('error'); |
238
|
|
|
} |
239
|
|
|
}); |
240
|
|
|
} |
241
|
|
|
} |
242
|
|
|
function isDomain(realm) { |
243
|
|
|
realm = trimRealm(realm); |
244
|
|
|
var re = new RegExp(/^((([0-9]{1,3}\.){3}[0-9]{1,3})|(([a-zA-Z0-9]+(([\-]?[a-zA-Z0-9]+)*\.)+)*[a-zA-Z]{2,}))$/); |
245
|
|
|
if (re.test(realm)) { |
246
|
|
|
return true; |
247
|
|
|
} |
248
|
|
|
return false; |
249
|
|
|
} |
250
|
|
|
function testSociopath(realm, answer) { |
251
|
|
|
var comment = <?php echo '"' . _("Testing realm") . '..."'; ?>; |
252
|
|
|
inProgress(1, comment); |
253
|
|
|
if ($('#tested_realm').length == 0) { |
254
|
|
|
$('<input>').attr({ |
255
|
|
|
type: 'hidden', |
256
|
|
|
id: 'tested_realm', |
257
|
|
|
value: realm |
258
|
|
|
}).appendTo('form'); |
259
|
|
|
} |
260
|
|
|
console.log('call processSociopath'); |
261
|
|
|
$.ajax({ |
262
|
|
|
url: "processSociopath.php", |
263
|
|
|
data: {answer: answer}, |
264
|
|
|
dataType: "json", |
265
|
|
|
success:function(data) { |
266
|
|
|
$('#start_test_area').hide(); |
267
|
|
|
if (data) { |
268
|
|
|
inProgress(0); |
269
|
|
|
if (data['NEXTEXISTS']) { |
270
|
|
|
if ($('#sociopath_queries').html() == '') { |
271
|
|
|
var query = ''; |
272
|
|
|
if ($('#tested_realm').length == 0) { |
273
|
|
|
query = '<input type="hidden" id="tested_realm" value="' + realm + '">'; |
274
|
|
|
} |
275
|
|
|
query = query + '<div id="current_query">'+data['TEXT']+'</div>'; |
276
|
|
|
query = query + '<div><button id="answer_yes">' + <?php echo '"' . _("Yes") . '"'; ?> + '</button>'; |
277
|
|
|
query = query + '<button style="margin-left:20px;" id="answer_no">' + <?php echo '"' . _("No") . '"'; ?> + '</button>'; |
278
|
|
|
query = query + '<button style="margin-left:20px;" id="answer_noidea">' + <?php echo '"' . _("I don't know") . '"'; ?> + '</button></div>'; |
279
|
|
|
$('#sociopath_queries').html(query); |
280
|
|
|
$('#sociopath_query_area').show(); |
281
|
|
|
} |
282
|
|
|
else { |
283
|
|
|
$('#current_query').html(data['TEXT']); |
284
|
|
|
} |
285
|
|
|
reset_footer(); |
286
|
|
|
} else { |
287
|
|
|
var realm = $('#tested_realm').val(); |
288
|
|
|
$('#tested_realm').remove(); |
289
|
|
|
$('#sociopath_query_area').hide(); |
290
|
|
|
$('#sociopath_queries').html(''); |
291
|
|
|
$('#start_test_area').show(); |
292
|
|
|
$('#after_stage_1').hide(); |
293
|
|
|
$('#before_stage_1').show(); |
294
|
|
|
$('#realm_by_select').show(); |
295
|
|
|
$('#position_info').show(); |
296
|
|
|
finalVerdict(realm, data['SUSPECTS']); |
297
|
|
|
reset_footer(); |
298
|
|
|
} |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
}, |
302
|
|
|
error:function() { |
303
|
|
|
inProgress(0); |
304
|
|
|
alert('error'); |
305
|
|
|
} |
306
|
|
|
}); |
307
|
|
|
} |
308
|
|
|
function finalVerdict(realm, verdict) { |
309
|
|
|
var title = <?php echo '"' . _("Diagnostic tests results for selected realm") . '"'; ?>; |
310
|
|
|
result = '<div class="padding">'; |
311
|
|
|
result = result + '<div><h3>'; |
312
|
|
|
result = result + <?php echo '"' . _("The result for tested realm:") . ' "'; ?> + realm; |
313
|
|
|
result = result + '</h3></p><div style="padding: 5px;"><div style="padding: 0px;">'; |
314
|
|
|
result = result + <?php echo '"' . _("The system identified") . '" '; ?> + ' '; |
315
|
|
|
result = result + Object.keys(verdict).length + ' '; |
316
|
|
|
result = result + <?php echo '"' . _("suspected areas which potentially can cause a problem.") . '"'; ?> + '<br>'; |
317
|
|
|
result = result + <?php echo '"' . _("Next to the problem description we show a speculated probability of this event.") . '"'; ?>; |
318
|
|
|
result = result + '</div><div style="padding: 5px;"><table>'; |
319
|
|
|
k = 1; |
320
|
|
|
for (key in verdict) { |
321
|
|
|
result = result + '<tr><td>' + k + '.</td>'; |
322
|
|
|
k = k + 1; |
323
|
|
|
if (key === 'INFRA_DEVICE') { |
324
|
|
|
result = result + '<td>' + <?php echo '"' . _("Your device configuration is broken") . '"'; ?> + '</td>'; |
325
|
|
|
} |
326
|
|
|
if (key === 'INFRA_SP_80211') { |
327
|
|
|
result = result + '<td>' + <?php echo '"' . _("The Wi-Fi network in your vicinity has quality issues") . '"'; ?> + '</td>'; |
328
|
|
|
} |
329
|
|
|
if (key === 'INFRA_SP_LAN') { |
330
|
|
|
result = result + '<td>' + <?php echo '"' . _("The network environment around you is broken") . '"'; ?> + '</td>'; |
331
|
|
|
} |
332
|
|
|
if (key === 'INFRA_SP_RADIUS') { |
333
|
|
|
result = result + '<td>' + <?php echo '"' . _("The RADIUS server of your service provider is the source of the problem") . '"'; ?> + '</td>'; |
334
|
|
|
} |
335
|
|
|
if (key === 'INFRA_IDP_AUTHBACKEND') { |
336
|
|
|
result = result + '<td>' + <?php echo '"' . _("The RADIUS server in your home institution is currently unable to authenticate you") . '"'; ?> + '</td>'; |
337
|
|
|
} |
338
|
|
|
if (key === 'INFRA_NRO_SP') { |
339
|
|
|
result = result + '<td>' + <?php echo '"' . _("The national server in the country/region you are visiting is not functioning correctly") . '"'; ?> + '</td>'; |
340
|
|
|
} |
341
|
|
|
if (key === 'INFRA_LINK_ETLR_NRO_SP') { |
342
|
|
|
result = result + '<td>' + <?php echo '"' . _("The link between the national server of the country/region you are visiting and the top-level server is broken") . '"'; ?> + '</td>'; |
343
|
|
|
} |
344
|
|
|
if (key === 'INFRA_LINK_ETLR_NRO_IdP') { |
345
|
|
|
result = result + '<td>' + <?php echo '"' . _("The link between the national server of your home country/region and the top-level server is broken") . '"'; ?> + '</td>'; |
346
|
|
|
} |
347
|
|
|
if (key === 'INFRA_ETLR') { |
348
|
|
|
result = result + '<td>' + <?php echo '"' . _("The communication to the top-level server is down") . '"'; ?> + '</td>'; |
349
|
|
|
} |
350
|
|
|
if (key === 'INFRA_NRO_IdP') { |
351
|
|
|
result = result + '<td>' + <?php echo '"' . _("The national server in your home country/region is not functioning properly.") . '"'; ?> + '</td>'; |
352
|
|
|
} |
353
|
|
|
if (key === 'INFRA_IdP_RADIUS') { |
354
|
|
|
result = result + '<td>' + <?php echo '"' . _("The RADIUS server of your home institution is the source of the problem") . '"'; ?> + '</td>'; |
355
|
|
|
} |
356
|
|
|
if (key === 'INFRA_NONEXISTENTREALM') { |
357
|
|
|
result = result + '<td>' + <?php echo '"' . _("This realm does not exist") . '"'; ?> + '</td>'; |
358
|
|
|
} |
359
|
|
|
result = result + '<td style="padding-left: 5px;">' + (verdict[key] * 100).toFixed(2) + "%</td></tr>"; |
360
|
|
|
} |
361
|
|
|
result = result + '</table></div></div>'; |
362
|
|
|
result = result + '</div>'; |
363
|
|
|
result = result + '</div></div>'; |
364
|
|
|
showInfo(result, title); |
365
|
|
|
} |
366
|
|
|
function formatMAC(e) { |
367
|
|
|
var r = /([a-f0-9]{2})([a-f0-9]{2})/i, |
368
|
|
|
str = e.target.value.replace(/[^a-f0-9]/ig, ""); |
369
|
|
|
while (r.test(str)) { |
370
|
|
|
str = str.replace(r, '$1' + ':' + '$2'); |
371
|
|
|
} |
372
|
|
|
e.target.value = str.slice(0, 17); |
373
|
|
|
}; |
374
|
|
|
function isEmail(email, emptyuser) { |
375
|
|
|
if (typeof emptyuser === 'undefined') { |
376
|
|
|
re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
377
|
|
|
} else { |
378
|
|
|
re = /^((([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))|)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
379
|
|
|
} |
380
|
|
|
return re.test(email); |
381
|
|
|
}; |
382
|
|
|
function isOperatorName(str) { |
383
|
|
|
var re = /^(?=.{1,254}$)((?=[a-z0-9-]{1,63}\.)(xn--+)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/; |
384
|
|
|
return re.test(str); |
385
|
|
|
} |
386
|
|
|
function inProgress(s, comment) { |
387
|
|
|
var b = true; |
388
|
|
|
if (s === 1) { |
389
|
|
|
var x = getWindowHCenter() - 16; |
390
|
|
|
var h = ($("body").height() - 128)/2; |
391
|
|
|
$("#loading_ico").css('left',x+'px'); |
392
|
|
|
$("#loading_ico").css('top',h+'px'); |
393
|
|
|
$("#loading_ico").show(); |
394
|
|
|
if (typeof comment !== 'undefined') { |
395
|
|
|
$("#load_comment").html(comment); |
396
|
|
|
} else { |
397
|
|
|
$("#load_comment").html(""); |
398
|
|
|
} |
399
|
|
|
} else { |
400
|
|
|
$("#loading_ico").hide(); |
401
|
|
|
b = false; |
402
|
|
|
$("#load_comment").html(""); |
403
|
|
|
} |
404
|
|
|
var catForm = document.forms['cat_form']; |
405
|
|
|
if (!catForm) { |
406
|
|
|
catForm = document.cat_form; |
407
|
|
|
} |
408
|
|
|
var elements = catForm.elements; |
409
|
|
|
for (var i = 0, len = elements.length; i < len; ++i) { |
410
|
|
|
elements[i].disabled = b; |
411
|
|
|
} |
412
|
|
|
} |
413
|
|
|
function trimRealm(r) { |
414
|
|
|
if (r.substring(0,1) == '@') { |
415
|
|
|
return r.substring(1); |
416
|
|
|
} |
417
|
|
|
return r; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
$('input[name="diagnostic_usertype"]').click(function() { |
421
|
|
|
var t = $('input[name=diagnostic_usertype]:checked').val(); |
422
|
|
|
if (t > 0) { |
423
|
|
|
$('#diagnostic_enduser').hide(); |
424
|
|
|
$('input[name=problem_type]').each(function() { |
425
|
|
|
$(this).prop('checked', false); |
426
|
|
|
}); |
427
|
|
|
$('#user_realm').val(''); |
428
|
|
|
$('#select_idp_area').html(''); |
429
|
|
|
$('#select_idp_country').show(); |
430
|
|
|
$('#select_sp_area').html(''); |
431
|
|
|
$('#sociopath_queries').show(); |
432
|
|
|
$('#diagnostic_admin').show(); |
433
|
|
|
if ($('#isadmin').val() === "1") { |
434
|
|
|
$('#admin_test_area').show(); |
435
|
|
|
} |
436
|
|
|
} else { |
437
|
|
|
$('#diagnostic_admin').hide(); |
438
|
|
|
$('#idp_contact_area').html(''); |
439
|
|
|
$('#sp_abuse').html(''); |
440
|
|
|
$('#idp_problem').html(''); |
441
|
|
|
$('#diagnostic_enduser').show(); |
442
|
|
|
} |
443
|
|
|
reset_footer(); |
444
|
|
|
}); |
445
|
|
|
$('#user_realm').bind('change keyup blur input', function(e) { |
446
|
|
|
if (isDomain($('#user_realm').val())) { |
447
|
|
|
$('#start_test_area').show(); |
448
|
|
|
} else { |
449
|
|
|
$('#start_test_area').hide(); |
450
|
|
|
$('#select_idp_area').hide(); |
451
|
|
|
$('#select_idp_area').html(''); |
452
|
|
|
$('#select_idp_country').show(); |
453
|
|
|
} |
454
|
|
|
}); |
455
|
|
|
$('#idp_countries_list').click(function(event){ |
456
|
|
|
event.preventDefault(); |
457
|
|
|
$('#start_test_area').hide(); |
458
|
|
|
$('#user_realm').val(""); |
459
|
|
|
countrySelection("idp"); |
460
|
|
|
return false; |
461
|
|
|
}); |
462
|
|
|
$(document).on('click', '#sp_countries_list, #asp_countries_list' , function(event) { |
463
|
|
|
event.preventDefault(); |
464
|
|
|
var t = $(this).attr('id').substring(0, $(this).attr('id').indexOf('_')); |
465
|
|
|
countrySelection(t); |
466
|
|
|
return false; |
467
|
|
|
}); |
468
|
|
|
$(document).on('change', '#idp_country, #sp_country, #asp_country' , function() { |
469
|
|
|
var comment = <?php echo '"' . _("Fetching institutions list") . '..."'; ?>; |
470
|
|
|
var id = $(this).attr('id'); |
471
|
|
|
var k = id.indexOf('_'); |
472
|
|
|
var type = id.substr(0,k); |
473
|
|
|
co=$('#'+type+'_country').val(); |
474
|
|
|
if (co !== "") { |
475
|
|
|
inProgress(1, comment); |
476
|
|
|
$.ajax({ |
477
|
|
|
url: "findRealm.php", |
478
|
|
|
data: {type: 'inst', co: co, lang: lang}, |
479
|
|
|
dataType: "json", |
480
|
|
|
success:function(data) { |
481
|
|
|
if (data.status === 1) { |
482
|
|
|
inProgress(0); |
483
|
|
|
var institutions = data.institutions; |
484
|
|
|
var shtml = ''; |
485
|
|
|
var select = ''; |
486
|
|
|
if (type !== 'asp') { |
487
|
|
|
shtml = <?php echo '"<td>' . _("Select institution:") . '</td><td>"'; ?>; |
488
|
|
|
} |
489
|
|
|
select = '<select id="' + type + '_inst" name="' + type + '_inst" style="margin-left:0px; width:400px;"><option value=""></option>'; |
490
|
|
|
for (var i in institutions) { |
491
|
|
|
select = select + '<option value="' + institutions[i].ID + '">' + institutions[i].name + '</option>'; |
492
|
|
|
} |
493
|
|
|
select = select + '</select>'; |
494
|
|
|
if (type !== 'asp') { |
495
|
|
|
shtml = shtml + select + '</td>'; |
496
|
|
|
$('#row_' + type + '_institution').html(''); |
497
|
|
|
$('#row_' + type + '_institution').append(shtml); |
498
|
|
|
$('#row_' + type + '_realm').html(''); |
499
|
|
|
$('#row_' + type + '_institution').css('visibility', 'visible'); |
500
|
|
|
} else { |
501
|
|
|
$('#inst_' + type + '_area').html(select); |
502
|
|
|
$('#' + type + '_desc').show(); |
503
|
|
|
} |
504
|
|
|
reset_footer(); |
505
|
|
|
} |
506
|
|
|
}, |
507
|
|
|
error:function() { |
508
|
|
|
inProgress(0); |
509
|
|
|
alert('error'); |
510
|
|
|
} |
511
|
|
|
}); |
512
|
|
|
} else { |
513
|
|
|
$('#' + type + '_inst').remove(); |
514
|
|
|
$('#row_' + type + '_institution').css('visibility', 'collapse'); |
515
|
|
|
$('#start_test_area').hide(); |
516
|
|
|
$('#row_idp_realm').html(""); |
517
|
|
|
} |
518
|
|
|
return false; |
519
|
|
|
}); |
520
|
|
|
$(document).on('change', '#idp_inst' , function() { |
521
|
|
|
inst=$("#idp_inst").val(); |
522
|
|
|
if (inst === '') { |
523
|
|
|
$('#row_idp_realm').html(""); |
524
|
|
|
$('#start_test_area').hide(); |
525
|
|
|
return false; |
526
|
|
|
} |
527
|
|
|
var comment = <?php echo '"' . _("Fetching realms list") . '..."'; ?>; |
528
|
|
|
inProgress(1, comment); |
529
|
|
|
$.ajax({ |
530
|
|
|
url: "findRealm.php", |
531
|
|
|
data: {type: 'realm', ou: inst, lang: lang}, |
532
|
|
|
dataType: "json", |
533
|
|
|
success:function(data) { |
534
|
|
|
inProgress(0); |
535
|
|
|
if (data.status === 1) { |
536
|
|
|
var realms = data.realms; |
537
|
|
|
var realmselect = ''; |
538
|
|
|
if (realms.length > 1) { |
539
|
|
|
realmselect = <?php echo '"<td>' . _("Check realm(s):") . '</td>"'; ?>; |
540
|
|
|
realmselect = realmselect + '<td>' + "<span style='margin-left: 10px'>"; |
541
|
|
|
for (var i in realms) { |
542
|
|
|
realmselect = realmselect + '<input type="radio" name="realm" '; |
543
|
|
|
realmselect = realmselect + 'value="' + realms[i] + '"'; |
544
|
|
|
if (i === "0") { |
545
|
|
|
realmselect = realmselect + ' checked'; |
546
|
|
|
} |
547
|
|
|
realmselect = realmselect + '><label>' + realms[i] + '</label>'; |
548
|
|
|
} |
549
|
|
|
realmselect = realmselect + '</span></td>'; |
550
|
|
|
} else { |
551
|
|
|
realmselect = <?php echo '"<td>' . _("Realm:") . '</td>"'; ?>; |
552
|
|
|
realmselect = realmselect + '<td>' + "<span style='margin-left: 10px'>"; |
553
|
|
|
realmselect = realmselect + realms[0] + '</span>'; |
554
|
|
|
realmselect = realmselect + '<input type="hidden" name="realm" value="' + realms[0] + '">'; |
555
|
|
|
realmselect = realmselect + '</span></td>'; |
556
|
|
|
} |
557
|
|
|
$('#row_idp_realm').html(""); |
558
|
|
|
$('#row_idp_realm').append(realmselect); |
559
|
|
|
$('#start_test_area').show(); |
560
|
|
|
$("#user_realm").val(""); |
561
|
|
|
$("#realm_info+ok").hide(); |
562
|
|
|
reset_footer(); |
563
|
|
|
} |
564
|
|
|
}, |
565
|
|
|
error:function() { |
566
|
|
|
inProgress(0); |
567
|
|
|
alert('error'); |
568
|
|
|
} |
569
|
|
|
}); |
570
|
|
|
return false; |
571
|
|
|
}); |
572
|
|
|
$(document).on('click', '#realm_in_db, #realm_in_db_admin' , function() { |
573
|
|
|
var id = $(this).attr('id'); |
574
|
|
|
var t = 0; |
575
|
|
|
if (id === 'realm_in_db') { |
576
|
|
|
$('#select_idp_area').hide(); |
577
|
|
|
$('#select_idp_area').html(''); |
578
|
|
|
$('#select_idp_country').show(); |
579
|
|
|
realm = trimRealm($("#user_realm").val()); |
580
|
|
|
} else { |
581
|
|
|
realm = trimRealm($("#admin_realm").val()); |
582
|
|
|
$('#idp_contact_area').html(''); |
583
|
|
|
$('#sp_questions > tbody > tr').each(function() { |
584
|
|
|
if ($(this).attr('class') == 'visible_row') { |
585
|
|
|
$(this).removeClass('visible_row').addClass('hidden_row'); |
586
|
|
|
} |
587
|
|
|
if ($(this).attr('class') == 'error_row') { |
588
|
|
|
$(this).remove(); |
589
|
|
|
} |
590
|
|
|
$(this).children('td').each(function() { |
591
|
|
|
$(this).children('input').each(function() { |
592
|
|
|
if ($(this).prop('tagName').toLowerCase() === 'input' || |
593
|
|
|
$(this).prop('tagName').toLowerCase() === 'textarea') { |
594
|
|
|
if ($(this).attr('id') !== 'admin_realm') { |
595
|
|
|
$(this).val(''); |
596
|
|
|
} |
597
|
|
|
} |
598
|
|
|
}); |
599
|
|
|
$(this).children('textarea').each(function() { |
600
|
|
|
$(this).val(''); |
601
|
|
|
}); |
602
|
|
|
}); |
603
|
|
|
}); |
604
|
|
|
t = 1; |
605
|
|
|
} |
606
|
|
|
var comment = <?php echo '"' . _("Running realm tests") . '..."'; ?>; |
607
|
|
|
inProgress(1, comment); |
608
|
|
|
/*waiting(comment);*/ |
609
|
|
|
$.ajax({ |
610
|
|
|
url: "findRealm.php", |
611
|
|
|
data: {realm: realm, lang: lang}, |
612
|
|
|
dataType: "json", |
613
|
|
|
success:function(data) { |
614
|
|
|
inProgress(0); |
615
|
|
|
var realmFound = 0; |
616
|
|
|
if (data.status) { |
617
|
|
|
var realms = data.realmlist.split(','); |
618
|
|
|
for (var i = 0; i < realms.length; i++) { |
619
|
|
|
if (realms[i] === realm) { |
620
|
|
|
realmFound = 1; |
621
|
|
|
break; |
622
|
|
|
} |
623
|
|
|
}; |
624
|
|
|
} |
625
|
|
|
if (realmFound) { |
626
|
|
|
if (t == 0) { |
627
|
|
|
$('#realm_info_ok').show(); |
628
|
|
|
$('#start_test_area').show(); |
629
|
|
|
$('#realm_info_fail').hide(); |
630
|
|
|
} else { |
631
|
|
|
$('#sp_questions > tbody > tr').each(function() { |
632
|
|
|
if ($(this).attr('class') == 'hidden_row' && $(this).attr('id') != 'send_query_to_idp') { |
633
|
|
|
$(this).removeClass('hidden_row').addClass('visible_row'); |
634
|
|
|
} |
635
|
|
|
}); |
636
|
|
|
$('#idp_contact_area').append('<input type="hidden" name="idp_contact" id="idp_contact" value="' + data.admins + '">'); |
637
|
|
|
} |
638
|
|
|
} else { |
639
|
|
|
if (t == 0) { |
640
|
|
|
$('#realm_info_ok').hide(); |
641
|
|
|
$('#start_test_area').hide(); |
642
|
|
|
$('#realm_info_fail').show(); |
643
|
|
|
} else { |
644
|
|
|
$('#sp_questions > tbody > tr').each(function() { |
645
|
|
|
if ($(this).attr('class') == 'visible_row') { |
646
|
|
|
$(this).removeClass('visible_row').addClass('hidden_row'); |
647
|
|
|
} |
648
|
|
|
}); |
649
|
|
|
$('#sp_questions > tbody').append('<tr class="error_row"><td>' + |
650
|
|
|
<?php echo '"' . _("Realm is not registered with the eduroam database:") . '"'; ?> + |
651
|
|
|
'</td><td>' + realm + '</td></tr>'); |
652
|
|
|
$('#admin_realm').val(''); |
653
|
|
|
} |
654
|
|
|
} |
655
|
|
|
}, |
656
|
|
|
error: function (error) { |
657
|
|
|
alert('Error'); |
658
|
|
|
} |
659
|
|
|
}); |
660
|
|
|
return false; |
661
|
|
|
}); |
662
|
|
|
$(document).on('click', '#answer_yes, #answer_no, #answer_noidea' , function(e) { |
663
|
|
|
e.preventDefault(); |
664
|
|
|
var answer = 1; /* No */ |
665
|
|
|
if ($(this).attr('id') === 'answer_yes') { |
666
|
|
|
answer = 2; /* Yes */ |
667
|
|
|
} |
668
|
|
|
if ($(this).attr('id') === 'answer_noidea') { |
669
|
|
|
answer = 3; /* No idea */ |
670
|
|
|
} |
671
|
|
|
testSociopath('', answer); |
672
|
|
|
}); |
673
|
|
|
$('#realmtest').click(function(event){ |
674
|
|
|
var comment = <?php echo '"<br><br>' . _("Running realm tests") . '..."'; ?>; |
675
|
|
|
inProgress(1, comment); |
676
|
|
|
$('#start_test_area').hide(); |
677
|
|
|
if ($('#select_sp_area').is(':hidden')) { |
678
|
|
|
$('#position_info').hide(); |
679
|
|
|
} |
680
|
|
|
if ($('#select_idp_area').is(':hidden')) { |
681
|
|
|
$('#realm_by_select').hide(); |
682
|
|
|
} |
683
|
|
|
var realm = ''; |
684
|
|
|
if ($('#user_realm').val()) { |
685
|
|
|
realm = trimRealm($('#user_realm').val()); |
686
|
|
|
} |
687
|
|
|
if ($('#idp_inst').val()) { |
688
|
|
|
if ($('input[name="realm"]').attr('type') === 'hidden') { |
689
|
|
|
realm = $('input[name="realm"]').val(); |
690
|
|
|
} else { |
691
|
|
|
$('input[name="realm"]').each(function() { |
692
|
|
|
if ($(this).is(':checked')) { |
693
|
|
|
realm = $(this).val(); |
694
|
|
|
} |
695
|
|
|
}); |
696
|
|
|
} |
697
|
|
|
} |
698
|
|
|
var nro = 0; |
699
|
|
|
if ($('#sp_country').val()) { |
700
|
|
|
nro = $('#sp_country').val(); |
701
|
|
|
} |
702
|
|
|
var visited = 0; |
703
|
|
|
if ($('#sp_inst').val()) { |
704
|
|
|
visited = $('#sp_inst').val(); |
705
|
|
|
} |
706
|
|
|
reset_footer(); |
707
|
|
|
if (realm !== '') { |
708
|
|
|
$.ajax({ |
709
|
|
|
url: "magicTelepath.php", |
710
|
|
|
data: {realm: realm, lang: lang, nro: nro, visited: visited}, |
711
|
|
|
dataType: "json", |
712
|
|
|
success:function(data) { |
713
|
|
|
inProgress(0); |
714
|
|
|
if (data.status === 1) { |
715
|
|
|
var realm = data.realm; |
716
|
|
|
$('#before_stage_1').hide(); |
717
|
|
|
$('#realm_name').text(realm); |
718
|
|
|
$('#after_stage_1').show(); |
719
|
|
|
reset_footer(); |
720
|
|
|
testSociopath(realm, 0); |
721
|
|
|
} else { |
722
|
|
|
var title = <?php echo '"' . _("Diagnostics results for selected realms") . '"'; ?>; |
723
|
|
|
result = '<div class="padding"><h3>' + <?php echo '"' . _("An unknown problem occured") . '"'; ?>; |
724
|
|
|
result = result + '</h3>' |
725
|
|
|
if (r.length == 1) { |
726
|
|
|
result = result + <?php echo '"' . _("This test includes checking of the following realm") . '"'; ?>; |
727
|
|
|
} else { |
728
|
|
|
result = result + <?php echo '"' . _("This test includes checking of the following realms") . '"'; ?>; |
729
|
|
|
} |
730
|
|
|
result = result + ': ' |
731
|
|
|
for (var i=0; i < r.length; i++) { |
732
|
|
|
if (i > 0) { |
733
|
|
|
result = result + ', '; |
734
|
|
|
} |
735
|
|
|
result = result + r[i]; |
736
|
|
|
} |
737
|
|
|
result = result + '.<br>'; |
738
|
|
|
result = result + <?php echo '"' . _("You should report this to") . '"'; ?> + ' <a href="mailto:[email protected]">[email protected]</a>'; |
739
|
|
|
result = result + '</div>'; |
740
|
|
|
$('#after_stage_1').hide(); |
741
|
|
|
$('#before_stage_1').show(); |
742
|
|
|
$('#realm_by_select').show(); |
743
|
|
|
$('#position_info').show(); |
744
|
|
|
reset_footer(); |
745
|
|
|
showInfo(result, title); |
746
|
|
|
} |
747
|
|
|
}, |
748
|
|
|
error: function (error) { |
749
|
|
|
inProgress(0); |
750
|
|
|
reset_footer(); |
751
|
|
|
alert('magicTelepath error'); |
752
|
|
|
} |
753
|
|
|
}); |
754
|
|
|
} |
755
|
|
|
}); |
756
|
|
|
$(document).on('click', 'ul#ul-menu-list.tab-links a', function(e) { |
757
|
|
|
e.preventDefault(); |
758
|
|
|
/*var activeEl = $('.tab-links > li.active > a > active');*/ |
759
|
|
|
var activeTab_a = $('.tab-links > li.active > a').attr('href'); |
760
|
|
|
$('.tab-links > li.active').removeClass('active'); |
761
|
|
|
var currentTab = $(this).attr('href'); |
762
|
|
|
$(activeTab_a).removeClass('active'); |
763
|
|
|
$(currentTab).addClass('active'); |
764
|
|
|
$(this).parent().addClass('active'); |
765
|
|
|
}); |
766
|
|
|
$(document).on('click', '#realm_in_db_admin' , function() { |
767
|
|
|
var id = $(this).attr('id'); |
768
|
|
|
realm = trimRealm($("#admin_realm").val()); |
769
|
|
|
$('#idp_contact_area').html(''); |
770
|
|
|
$('#sp_questions > tbody > tr').each(function() { |
771
|
|
|
if ($(this).attr('class') == 'visible_row') { |
772
|
|
|
$(this).removeClass('visible_row').addClass('hidden_row'); |
773
|
|
|
} |
774
|
|
|
if ($(this).attr('class') == 'error_row') { |
775
|
|
|
$(this).remove(); |
776
|
|
|
} |
777
|
|
|
$(this).children('td').each(function() { |
778
|
|
|
$(this).children('input').each(function() { |
779
|
|
|
if ($(this).prop('tagName').toLowerCase() === 'input' || |
780
|
|
|
$(this).prop('tagName').toLowerCase() === 'textarea') { |
781
|
|
|
if ($(this).attr('id') !== 'admin_realm') { |
782
|
|
|
$(this).val(''); |
783
|
|
|
} |
784
|
|
|
} |
785
|
|
|
}); |
786
|
|
|
$(this).children('textarea').each(function() { |
787
|
|
|
$(this).val(''); |
788
|
|
|
}); |
789
|
|
|
}); |
790
|
|
|
}); |
791
|
|
|
var comment = <?php echo '"' . _("Running realm tests") . '..."'; ?>; |
792
|
|
|
inProgress(1, comment); |
793
|
|
|
$.ajax({ |
794
|
|
|
url: "findRealm.php", |
795
|
|
|
data: {realm: realm, lang: lang}, |
796
|
|
|
dataType: "json", |
797
|
|
|
success:function(data) { |
798
|
|
|
inProgress(0); |
799
|
|
|
var realmFound = 0; |
800
|
|
|
if (data.status) { |
801
|
|
|
var realms = data.realmlist.split(','); |
802
|
|
|
for (var i = 0; i < realms.length; i++) { |
803
|
|
|
if (realms[i] === realm) { |
804
|
|
|
realmFound = 1; |
805
|
|
|
break; |
806
|
|
|
} |
807
|
|
|
}; |
808
|
|
|
} |
809
|
|
|
if (realmFound) { |
810
|
|
|
$('#sp_questions > tbody > tr').each(function() { |
811
|
|
|
if ($(this).attr('class') == 'hidden_row' && $(this).attr('id') != 'send_query_to_idp') { |
812
|
|
|
$(this).removeClass('hidden_row').addClass('visible_row'); |
813
|
|
|
} |
814
|
|
|
}); |
815
|
|
|
$('#idp_contact_area').append('<input type="hidden" name="idp_contact" id="idp_contact" value="'+data.admins+'">'); |
816
|
|
|
} else { |
817
|
|
|
$('#sp_questions > tbody > tr').each(function() { |
818
|
|
|
if ($(this).attr('class') == 'visible_row') { |
819
|
|
|
$(this).removeClass('visible_row').addClass('hidden_row'); |
820
|
|
|
} |
821
|
|
|
}); |
822
|
|
|
$('#admin_realm').val(''); |
823
|
|
|
} |
824
|
|
|
}, |
825
|
|
|
error: function (error) { |
826
|
|
|
alert('error'); |
827
|
|
|
} |
828
|
|
|
}); |
829
|
|
|
return false; |
830
|
|
|
}); |
831
|
|
|
$(document).on('click', '#submit_idp_query, #submit_sp_query' , function() { |
832
|
|
|
var type; |
833
|
|
|
var o = new Object(); |
834
|
|
|
if ($(this).attr('id') === 'submit_idp_query') { |
835
|
|
|
o['realm'] = $('#admin_realm').val(); |
836
|
|
|
o['email'] = $('#email').val(); |
837
|
|
|
o['mac'] = $('#mac').val(); |
838
|
|
|
o['reason'] = $('#select_sp_problem').val(); |
839
|
|
|
o['timestamp'] = $('#timestamp').val(); |
840
|
|
|
o['freetext'] = $('#freetext').val(); |
841
|
|
|
o['idpcontact'] = $('#idp_contact').val(); |
842
|
|
|
type = 'idp_send'; |
843
|
|
|
} else { |
844
|
|
|
o['opname'] = $('#opname').val(); |
845
|
|
|
o['outerid'] = $('#outer_id').val(); |
846
|
|
|
o['email'] = $('#email').val(); |
847
|
|
|
o['mac'] = $('#mac').val(); |
848
|
|
|
o['reason'] = $('#select_idp_problem').val(); |
849
|
|
|
o['timestamp'] = $('#timestamp').val(); |
850
|
|
|
o['freetext'] = $('#freetext').val(); |
851
|
|
|
o['cdetails'] = $('#c_details').val(); |
852
|
|
|
type = 'sp_send'; |
853
|
|
|
} |
854
|
|
|
$.ajax({ |
855
|
|
|
url: "adminQuery.php", |
856
|
|
|
data: {type: type, data: JSON.stringify(o)}, |
857
|
|
|
dataType: "json", |
858
|
|
|
lang: lang, |
859
|
|
|
success:function(data) { |
860
|
|
|
if (data.status === 1) { |
861
|
|
|
var result = ''; |
862
|
|
|
var title = <?php echo '"' . _("eduroam admin report submission") . '"'; ?>; |
863
|
|
|
result = '<div class="padding">'; |
864
|
|
|
if (type == 'idp_send') { |
865
|
|
|
result = result + '<h3>'+ <?php echo '"' . _("SP contacting IdP due to technical problems or abuse") . '"'; ?> + '</h3>'; |
866
|
|
|
result = result + '<table>'; |
867
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("Reason") . '"'; ?> + '</td><td>' + data.reason + '</td></tr>'; |
868
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("SP email") . '"'; ?> + '</td><td>' + data.email + '</td></tr>'; |
869
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("IdP email(s)") . '"'; ?> + '</td><td>' + data.idpcontact + '</td></tr>'; |
870
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("Event's timestamp") . '"'; ?> + '</td><td>' + data.timestamp + '</td></tr>'; |
871
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("Calling-Station-Id") . '"'; ?> + '</td><td>' + data.mac + '</td></tr>'; |
872
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("Additional description") . '"'; ?> +'</td><td>' + data.freetext + '</td></tr>'; |
873
|
|
|
} |
874
|
|
|
if (type == 'sp_send') { |
875
|
|
|
result = result + '<h3>'+ <?php echo '"' . _("IdP contacting SP due to technical problems or abuse") . '"'; ?> + '</h3>'; |
876
|
|
|
result = result + '<table>'; |
877
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("Reason") . '"'; ?> + '</td><td>' + data.reason + '</td></tr>'; |
878
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("SP's Operator-Name") . '"'; ?> + '</td><td>' + data.opname + '</td></tr>'; |
879
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("User's outer ID") . '"'; ?> + '</td><td>' + data.outerid + '</td></tr>'; |
880
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("IdP email") . '"'; ?> + '</td><td>' + data.email + '</td></tr>'; |
881
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("Event's timestamp") . '"'; ?> + '</td><td>' + data.timestamp + '</td></tr>'; |
882
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("Calling-Station-Id") . '"'; ?> + '</td><td>' + data.mac + '</td></tr>'; |
883
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("Additional description") . '"'; ?> +'</td><td>' + data.freetext + '</td></tr>'; |
884
|
|
|
result = result + '<tr><td>' + <?php echo '"' . _("How to contact the user") . '"'; ?> +'</td><td>' + data.cdetails + '</td></tr>'; |
885
|
|
|
} |
886
|
|
|
result = result + '</div>'; |
887
|
|
|
showInfo(result, title); |
888
|
|
|
} |
889
|
|
|
}, |
890
|
|
|
error: function (error) { |
891
|
|
|
alert('adminQuery error'); |
892
|
|
|
} |
893
|
|
|
}); |
894
|
|
|
return false; |
895
|
|
|
}); |
896
|
|
|
$(document).on('blur', '#timestamp, #mac, #email, #opname, #outer_id' , function() { |
897
|
|
|
$(this).val($.trim($(this).val())); |
898
|
|
|
if ($('#mac').val().length > 0) { |
899
|
|
|
if ($('#mac').val().length != 17) { |
900
|
|
|
$('#mac').addClass('error_input'); |
901
|
|
|
$('#mac').attr('title', <?php echo '"' . _("MAC address is incomplete") . '"'; ?>); |
902
|
|
|
} else { |
903
|
|
|
$('#mac').removeClass('error_input'); |
904
|
|
|
$('#mac').attr('title', ''); |
905
|
|
|
} |
906
|
|
|
} |
907
|
|
|
if ($(this).attr('id') == 'email' && $(this).val().length > 0) { |
908
|
|
|
if (!isEmail($(this).val())) { |
909
|
|
|
$('#email').addClass('error_input'); |
910
|
|
|
$('#email').attr('title', <?php echo '"' . _("Wrong format of email") . '"'; ?>); |
911
|
|
|
} else { |
912
|
|
|
$('#email').removeClass('error_input'); |
913
|
|
|
$('#email').attr('title', ''); |
914
|
|
|
} |
915
|
|
|
} |
916
|
|
|
if ($(this).attr('id') == 'outer_id' && $(this).val().length > 0) { |
917
|
|
|
if (!isEmail($(this).val(), true)) { |
918
|
|
|
$('#outer_id').addClass('error_input'); |
919
|
|
|
$('#outer_id').attr('title', <?php echo '"' . _("Wrong format of outer ID") . '"'; ?>); |
920
|
|
|
} else { |
921
|
|
|
$('#outer_id').removeClass('error_input'); |
922
|
|
|
$('#outer_id').attr('title', ''); |
923
|
|
|
} |
924
|
|
|
} |
925
|
|
|
if ($(this).attr('id') == 'opname' && $('#opname').val().length > 0) { |
926
|
|
|
if (!isOperatorName($(this).val())) { |
927
|
|
|
$('#opname').addClass('error_input'); |
928
|
|
|
$('#opname').attr('title', <?php echo '"' . _("Wrong string given as OperatorName") . '"'; ?>); |
929
|
|
|
$('#spmanually').show(); |
930
|
|
|
} else { |
931
|
|
|
$('#opname').removeClass('error_input'); |
932
|
|
|
$('#opname').attr('title', ''); |
933
|
|
|
$('#spmanually').hide(); |
934
|
|
|
} |
935
|
|
|
} |
936
|
|
|
if ($('#timestamp').val().length > 0 && $('#mac').val().length == 17 && $('#email').val().length > 0 && isEmail($('#email').val())) { |
937
|
|
|
if ($('#send_query_to_idp').length > 0) { |
938
|
|
|
$('#send_query_to_idp').removeClass('hidden_row').addClass('visible_row'); |
939
|
|
|
} else { |
940
|
|
|
if ($('#opname').val().length > 0 && $('#outer_id').val().length > 0) { |
941
|
|
|
if (isOperatorName($('#opname').val()) && isEmail($('#email').val(), true) && $('#send_query_to_sp').length > 0) { |
942
|
|
|
$('#send_query_to_sp').removeClass('hidden_row').addClass('visible_row'); |
943
|
|
|
} |
944
|
|
|
} else { |
945
|
|
|
$('#send_query_to_sp').removeClass('visible_row').addClass('hidden_row'); |
946
|
|
|
} |
947
|
|
|
} |
948
|
|
|
} else { |
949
|
|
|
if ($('#send_query_to_idp').length > 0) { |
950
|
|
|
$('#send_query_to_idp').removeClass('visible_row').addClass('hidden_row'); |
951
|
|
|
} |
952
|
|
|
if ($('#send_query_to_sp').length > 0) { |
953
|
|
|
$('#send_query_to_sp').removeClass('visible_row').addClass('hidden_row'); |
954
|
|
|
} |
955
|
|
|
} |
956
|
|
|
}); |
957
|
|
|
$('input[name="problem_type"]').click(function() { |
958
|
|
|
var t = $('input[name=problem_type]:checked').val(); |
959
|
|
|
if (t == 1) { |
960
|
|
|
/* show SP problem block */ |
961
|
|
|
if ($('#sp_abuse').html() === '') { |
962
|
|
|
$.get("adminQuery.php?type=sp&lang="+lang, function(data, status) { |
963
|
|
|
$('#sp_abuse').html(data); |
964
|
|
|
$('#sp_abuse').show(); |
965
|
|
|
$('#idp_problem').html(''); |
966
|
|
|
reset_footer(); |
967
|
|
|
}); |
968
|
|
|
} |
969
|
|
|
|
970
|
|
|
} else { |
971
|
|
|
/* show IdP problem block */ |
972
|
|
|
$('#sp_abuse').html(''); |
973
|
|
|
if ($('#idp_problem').html() === '') { |
974
|
|
|
$.get("adminQuery.php?type=idp&lang="+lang, function(data, status) { |
975
|
|
|
$('#idp_problem').html(data); |
976
|
|
|
$('#sp_abuse').hide(); |
977
|
|
|
$('#idp_problem').show(); |
978
|
|
|
reset_footer(); |
979
|
|
|
}); |
980
|
|
|
} |
981
|
|
|
|
982
|
|
|
} |
983
|
|
|
}); |
984
|
|
|
$(document).on('change', '#asp_inst' , function() { |
985
|
|
|
if ($('#asp_inst').val()) { |
986
|
|
|
$('#by_opname').hide(); |
987
|
|
|
$('#opname').val(''); |
988
|
|
|
$('#asp_desc').val(''); |
989
|
|
|
$('#asp_desc').hide(); |
990
|
|
|
} else { |
991
|
|
|
$('#by_opname').show(); |
992
|
|
|
$('#asp_desc').show(); |
993
|
|
|
} |
994
|
|
|
}); |
995
|
|
|
$(document).on('keypress', '#email', function(e) { |
996
|
|
|
if (e.keyCode == 13) { |
997
|
|
|
if ($('#timestamp').val().length > 0 && $('#mac').val().length == 17 && $('#email').val().length > 0 && isEmail($('#email').val())) { |
998
|
|
|
$('#send_query_to_idp').removeClass('hidden_row').addClass('visible_row'); |
999
|
|
|
} else { |
1000
|
|
|
$('#send_query_to_idp').removeClass('visible_row').addClass('hidden_row'); |
1001
|
|
|
} |
1002
|
|
|
return false; |
1003
|
|
|
} |
1004
|
|
|
}); |
1005
|
|
|
$(document).on('keypress', '#opname', function(e) { |
1006
|
|
|
if (e.keyCode == 13 || e.keyCode == 9) { |
1007
|
|
|
if ($('#opname').val() !== '') { |
1008
|
|
|
$('#spmanually').hide(); |
1009
|
|
|
} else { |
1010
|
|
|
$('#spmanually').show(); |
1011
|
|
|
} |
1012
|
|
|
} |
1013
|
|
|
}); |
1014
|
|
|
$('#answer_yes, #answer_no').click(function(e) { |
1015
|
|
|
e.preventDefault(); |
1016
|
|
|
}); |
1017
|
|
|
|
1018
|
|
|
</script> |
1019
|
|
|
|
1020
|
|
|
</body> |
1021
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths