Passed
Push — master ( 7dcdd9...287ee3 )
by Stefan
08:07 queued 17s
created
devices/ms/Files/common.inc 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 !define MUI_HEADERIMAGE_BITMAP "cat_150.bmp"
136 136
 !define MUI_COMPONENTSPAGE_SMALLDESC
137 137
 
138
-!define WELCOME_HEADER "<?php printf(WindowsCommon::sprint_nsi(_("Welcome to the %s installer")),CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])?>"
139
-!define FAREWELL_HEADER "<?php WindowsCommon::echo_nsi( _("Installation complete"))?>"
140
-!define FAREWELL_TEXT	"<?php WindowsCommon::echo_nsi( _("Network profiles have been installed."))?>$\r$\n$\n <?php WindowsCommon::echo_nsi(  _("Your system is ready."))?>"
141
-!define FAREWELL_FAIL	"<?php WindowsCommon::echo_nsi( _("Network installation had errors."))?>$\r$\n$\n <?php WindowsCommon::echo_nsi( _("Please contact \${SUPPORT}."))?>"
138
+!define WELCOME_HEADER "<?php printf(WindowsCommon::sprint_nsi(_("Welcome to the %s installer")), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])?>"
139
+!define FAREWELL_HEADER "<?php WindowsCommon::echo_nsi(_("Installation complete"))?>"
140
+!define FAREWELL_TEXT	"<?php WindowsCommon::echo_nsi(_("Network profiles have been installed."))?>$\r$\n$\n <?php WindowsCommon::echo_nsi(_("Your system is ready."))?>"
141
+!define FAREWELL_FAIL	"<?php WindowsCommon::echo_nsi(_("Network installation had errors."))?>$\r$\n$\n <?php WindowsCommon::echo_nsi(_("Please contact \${SUPPORT}."))?>"
142 142
 ;--------------------------------
143 143
 ;Languages
144 144
 !insertmacro MUI_LANGUAGE "${LANG}"
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 ;--------------------------------
147 147
 ; License file
148 148
 !ifdef LICENSE_FILE
149
-LicenseForceSelection checkbox "<?php WindowsCommon::echo_nsi( _("Accept"))?>"
149
+LicenseForceSelection checkbox "<?php WindowsCommon::echo_nsi(_("Accept"))?>"
150 150
 LicenseText "<?php WindowsCommon::echo_nsi(_("If you accept the conditions then select Accept and then click Install to continue."))?>"
151 151
 LicenseData ${LICENSE_FILE}
152 152
 !endif
153 153
 
154 154
 ;-----------------------------------
155 155
 
156
-MiscButtonText "" "" "" "<?php WindowsCommon::echo_nsi( _("Finish"))?>"
156
+MiscButtonText "" "" "" "<?php WindowsCommon::echo_nsi(_("Finish"))?>"
157 157
 ;----------------------------------
158 158
 ;  FUNCTIONS
159 159
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
 !macro install_ca_cert ca_file ca_fingerprint level
188 188
    !insertmacro debug_cat 2 "locating certificate  SHA=${ca_fingerprint} Level=${level}"
189
-   DetailPrint "<?php WindowsCommon::echo_nsi( _("searching for certificate"))?> ${ca_file}"
189
+   DetailPrint "<?php WindowsCommon::echo_nsi(_("searching for certificate"))?> ${ca_file}"
190 190
    File "${ca_file}"
191 191
    nsArray::Set Delete_files "${ca_file}"
192 192
    !insertmacro debug_cat 2 "Testing machine store root"
@@ -248,13 +248,13 @@  discard block
 block discarded – undo
248 248
    ${EndIf}
249 249
    !insertmacro debug_cat 2 "installing certificate $TEMP\${ca_file}"
250 250
    !insertmacro debug_cat 3 "Execute: certutil -addstore -user ${level} $TEMP\${ca_file}"
251
-   DetailPrint "<?php WindowsCommon::echo_nsi( _("installing certificate"))?> ${ca_file}"
251
+   DetailPrint "<?php WindowsCommon::echo_nsi(_("installing certificate"))?> ${ca_file}"
252 252
    nsExec::Exec '"certutil" -addstore -user ${level} "$TEMP"\${ca_file}'
253 253
    Pop $0
254 254
    !insertmacro debug_cat 3 "certutil returned $0"
255 255
    ${If} $0 != 0
256 256
      IfSilent +2
257
-     MessageBox MB_OK|MB_ICONEXCLAMATION "<?php WindowsCommon::echo_nsi( _("could not install certificate"))?>  ${ca_file}"
257
+     MessageBox MB_OK|MB_ICONEXCLAMATION "<?php WindowsCommon::echo_nsi(_("could not install certificate"))?>  ${ca_file}"
258 258
      !insertmacro debug_cat 1 "could not install certificate ${ca_file}"
259 259
    ${EndIf}
260 260
 no_install_${ca_file}:
@@ -461,26 +461,26 @@  discard block
 block discarded – undo
461 461
   pop $R0
462 462
   ${If} $tkip_count > 0
463 463
     ${If} $aes_count > 1
464
-      StrCpy $R1 "$\r$\n$\n<?php WindowsCommon::echo_nsi( _("The non TKIP profiles are preferred. Always use them if you have a choice."))?>"
464
+      StrCpy $R1 "$\r$\n$\n<?php WindowsCommon::echo_nsi(_("The non TKIP profiles are preferred. Always use them if you have a choice."))?>"
465 465
     ${Else}
466
-     StrCpy $R1 "$\r$\n$\n<?php WindowsCommon::echo_nsi( _("The non TKIP profile is preferred. Always use it if you have a choice."))?>"
466
+     StrCpy $R1 "$\r$\n$\n<?php WindowsCommon::echo_nsi(_("The non TKIP profile is preferred. Always use it if you have a choice."))?>"
467 467
     ${EndIf}
468 468
   ${Else}
469 469
     StrCpy $R1 ""
470 470
   ${EndIf}
471 471
   ${If} $profile_count > 0
472
-    StrCpy $welcome_message "<?php WindowsCommon::echo_nsi( _("This installer has been prepared for \${ORGANISATION}"))?>.$\r$\n\
473
-<?php WindowsCommon::echo_nsi( _("The installer will create the following wireless profiles:"))?>$\r$\n\
472
+    StrCpy $welcome_message "<?php WindowsCommon::echo_nsi(_("This installer has been prepared for \${ORGANISATION}"))?>.$\r$\n\
473
+<?php WindowsCommon::echo_nsi(_("The installer will create the following wireless profiles:"))?>$\r$\n\
474 474
 $R0.\
475 475
 $R1$\r$\n$\n\
476
-<?php WindowsCommon::echo_nsi( _("More information and comments:"))?>$\r$\n\
476
+<?php WindowsCommon::echo_nsi(_("More information and comments:"))?>$\r$\n\
477 477
    EMAIL: ${SUPPORT}$\r$\n\
478 478
    WWW: ${URL}"
479 479
 ${Else}
480
-StrCpy $welcome_message "<?php WindowsCommon::echo_nsi( _("This installer has been prepared for \${ORGANISATION}"))?>.$\r$\n\
481
-<?php WindowsCommon::echo_nsi( _("The installer will create the wireless profile:"))?> $R0.\
480
+StrCpy $welcome_message "<?php WindowsCommon::echo_nsi(_("This installer has been prepared for \${ORGANISATION}"))?>.$\r$\n\
481
+<?php WindowsCommon::echo_nsi(_("The installer will create the wireless profile:"))?> $R0.\
482 482
 $R1$\r$\n$\n\
483
-<?php WindowsCommon::echo_nsi( _("More information and comments:"))?>$\r$\n\
483
+<?php WindowsCommon::echo_nsi(_("More information and comments:"))?>$\r$\n\
484 484
    EMAIL: ${SUPPORT}$\r$\n\
485 485
    WWW: ${URL}"
486 486
 ${EndIf}
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
   SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0
507 507
 ;TRANSLATION
508 508
   nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 46u -130u -32u "$welcome_message\
509
-$\r$\n$\r$\n<?php WindowsCommon::echo_nsi( _("Installer created with software from the GEANT project."))?>"
509
+$\r$\n$\r$\n<?php WindowsCommon::echo_nsi(_("Installer created with software from the GEANT project."))?>"
510 510
   Pop $TEXT
511 511
 
512 512
   SetCtlColors $DIALOG "" 0xffffff
@@ -619,18 +619,18 @@  discard block
 block discarded – undo
619 619
     ${If} $wireless_result == 1
620 620
       !insertmacro debug_cat 1 "wlan_test.exe did not find wireless configuration service"
621 621
       IfSilent +2
622
-      MessageBox MB_OK|MB_ICONEXCLAMATION "<?php WindowsCommon::echo_nsi( _("Windows wireless configuration service is not enabled. The installer cannot continue."))?>"
622
+      MessageBox MB_OK|MB_ICONEXCLAMATION "<?php WindowsCommon::echo_nsi(_("Windows wireless configuration service is not enabled. The installer cannot continue."))?>"
623 623
       Call Cleanup
624 624
     ${EndIf}
625 625
     ${If} $wireless_result == 2
626 626
       IfSilent +2
627
-      MessageBox MB_OK|MB_ICONEXCLAMATION "<?php WindowsCommon::echo_nsi( _("No wireless interfaces found. The installer cannot continue."))?>"
627
+      MessageBox MB_OK|MB_ICONEXCLAMATION "<?php WindowsCommon::echo_nsi(_("No wireless interfaces found. The installer cannot continue."))?>"
628 628
       Call Cleanup
629 629
     ${EndIf}
630 630
   ${Else}
631 631
     ${If} $wireless_result > 0
632 632
        IfSilent +3
633
-       MessageBox MB_YESNO "<?php WindowsCommon::echo_nsi( _("No wireless interfaces found. Wireless access will not be configured. Would you like to continue and configure access on the wired interface?"))?>" IDYES wired_yes
633
+       MessageBox MB_YESNO "<?php WindowsCommon::echo_nsi(_("No wireless interfaces found. Wireless access will not be configured. Would you like to continue and configure access on the wired interface?"))?>" IDYES wired_yes
634 634
        Call Cleanup
635 635
        wired_yes:
636 636
        Push 1
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
     ${If} $wired == 1
647 647
       ${If} $force_wired == 0
648 648
         IfSilent wired
649
-        MessageBox MB_YESNO "<?php WindowsCommon::echo_nsi( _("Do you want to enable access on wired interfaces?"))?>" IDYES wired
649
+        MessageBox MB_YESNO "<?php WindowsCommon::echo_nsi(_("Do you want to enable access on wired interfaces?"))?>" IDYES wired
650 650
         Push 0
651 651
         Pop $wired
652 652
       ${EndIf}
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 ;================================
688 688
 
689 689
 Function ShowInstfiles
690
-  !insertmacro MUI_HEADER_TEXT "<?php WindowsCommon::echo_nsi( _("Profiles installation"))?>" " "
690
+  !insertmacro MUI_HEADER_TEXT "<?php WindowsCommon::echo_nsi(_("Profiles installation"))?>" " "
691 691
 FunctionEnd
692 692
 ;================================
693 693
 ;  Check if a wireless profile exist and put it on delete list
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 
707 707
 Function FindProfile
708 708
   Pop $R8
709
-  DetailPrint "<?php WindowsCommon::echo_nsi( _("Checking for profile \$R8"))?>"
709
+  DetailPrint "<?php WindowsCommon::echo_nsi(_("Checking for profile \$R8"))?>"
710 710
   !insertmacro debug_cat 2 "Checking for profile $R8"
711 711
   !insertmacro debug_cat 3 "Exec: $Netsh wlan show profiles $R8"
712 712
   nsExec::Exec  '"$Netsh" wlan show profiles "$R8"'
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
   !insertmacro debug_cat 4 "netsh returned $0"
715 715
   ${If} $0 == 0
716 716
     !insertmacro debug_cat 1 "found profile $R8"
717
-    DetailPrint "<?php WindowsCommon::echo_nsi( _("found profile \$R8"))?>"
717
+    DetailPrint "<?php WindowsCommon::echo_nsi(_("found profile \$R8"))?>"
718 718
     Push 0
719 719
   ${Else}
720 720
     !insertmacro debug_cat 1 "profile $R8 not found"
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
     ${If} $Symantec_installed  != 0
810 810
      !insertmacro debug_cat 3 "Symantec problem"
811 811
      IfSilent +2
812
-     MessageBox MB_OK|MB_ICONEXCLAMATION "<?php printf(WindowsCommon::sprint_nsi(_("Please READ this message it is IMPORTANT.$\\r$\\nInstallation problems may be due to the fact that Symantec Endpoint Protection is installed on your machine.$\\r$\\nWhile this is a well-known bug of the Symantec product, about which the installer can not do anything, there is a workaround.$\\r$\\nWhen you close this window the installer will exit and an explorer window will be started (it could appear underneath already opened windows). In this window you should see a script named inst_cat. Start it by double-clicking, It will install the profiles. You will need to login to %s with your username and password.")),CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) ?>"
812
+     MessageBox MB_OK|MB_ICONEXCLAMATION "<?php printf(WindowsCommon::sprint_nsi(_("Please READ this message it is IMPORTANT.$\\r$\\nInstallation problems may be due to the fact that Symantec Endpoint Protection is installed on your machine.$\\r$\\nWhile this is a well-known bug of the Symantec product, about which the installer can not do anything, there is a workaround.$\\r$\\nWhen you close this window the installer will exit and an explorer window will be started (it could appear underneath already opened windows). In this window you should see a script named inst_cat. Start it by double-clicking, It will install the profiles. You will need to login to %s with your username and password.")), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) ?>"
813 813
     Exec '"explorer" /select,"$EXEDIR\inst_cat.cmd"'
814 814
     Quit
815 815
 
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 Function PFXCertificateSelect
1098 1098
   !ifndef SILVERBULLET
1099 1099
 ;TRANSLATION
1100
-!insertmacro MUI_HEADER_TEXT "<?php printf(WindowsCommon::sprint_nsi(_("%s installer for")),CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])?> " "<?php WindowsCommon::echo_nsi(_("Install personal certificate"))?>"
1100
+!insertmacro MUI_HEADER_TEXT "<?php printf(WindowsCommon::sprint_nsi(_("%s installer for")), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])?> " "<?php WindowsCommon::echo_nsi(_("Install personal certificate"))?>"
1101 1101
 ;TRANSLATION
1102 1102
     IfSilent +2
1103 1103
   MessageBox MB_OK "<?php WindowsCommon::echo_nsi(_("Preparing to install personal certificate."))?>$\r$\n<?php WindowsCommon::echo_nsi(_("Click OK to continue"))?> "
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
         $certPasswordLength = strlen($certPasswordLabel);
1114 1114
         $certUsernameLabel = WindowsCommon::sprint_nsi(_("Username:"));
1115 1115
         $certUsernameLength = strlen($certUsernameLabel);
1116
-        $labelLength = max($certPasswordLength,$certUsernameLength);
1116
+        $labelLength = max($certPasswordLength, $certUsernameLength);
1117 1117
   ?>
1118 1118
   ${NSD_CreateLabel} 0 0 100% 32u "<?php WindowsCommon::echo_nsi(_("Selected file: \$Cert_file"))?>"
1119 1119
   !else
@@ -1130,11 +1130,11 @@  discard block
 block discarded – undo
1130 1130
   !insertmacro debug_cat 3 "Vista level (Vista without Service pack): $VistaNoSP";
1131 1131
   ${If} $VistaNoSP == 0
1132 1132
     !ifdef PFX_USERNAME
1133
-       !define LABEL_LENGTH "<?php echo($labelLength*3.5)?>u"
1134
-       !define TEXT_START "<?php echo($labelLength*3.5 +5)?>u"
1133
+       !define LABEL_LENGTH "<?php echo($labelLength * 3.5)?>u"
1134
+       !define TEXT_START "<?php echo($labelLength * 3.5 + 5)?>u"
1135 1135
     !else
1136
-       !define LABEL_LENGTH "<?php echo($certPasswordLength*3.5)?>u"
1137
-       !define TEXT_START "<?php echo($certPasswordLength*3.5 +5)?>u"
1136
+       !define LABEL_LENGTH "<?php echo($certPasswordLength * 3.5)?>u"
1137
+       !define TEXT_START "<?php echo($certPasswordLength * 3.5 + 5)?>u"
1138 1138
     !endif
1139 1139
     ${NSD_CreateLabel} 0 35u ${LABEL_LENGTH} 12u "<?php echo $certPasswordLabel?>"
1140 1140
     ${NSD_CreatePassword} ${TEXT_START} 34.5u 120u 12u ""
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
 Section "-start"
1497 1497
 SectionIn RO
1498 1498
 
1499
-!insertmacro MUI_HEADER_TEXT "<?php WindowsCommon::echo_nsi( _("Installation"))?>" "<?php WindowsCommon::echo_nsi( _("Checking for existing wireless profiles"))?>"
1499
+!insertmacro MUI_HEADER_TEXT "<?php WindowsCommon::echo_nsi(_("Installation"))?>" "<?php WindowsCommon::echo_nsi(_("Checking for existing wireless profiles"))?>"
1500 1500
 !ifndef PWD
1501 1501
 !include "certs.nsh"
1502 1502
 !endif
Please login to merge, or discard this patch.
web/admin/API.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *          <base_url>/copyright.php after deploying the software
21 21
  */
22 22
 
23
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
23
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
24 24
 
25 25
 /**
26 26
  * Checks if the profile is a valid SB profile belonging to the federation
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 $inputRaw = file_get_contents('php://input');
70 70
 $inputDecoded = json_decode($inputRaw, TRUE);
71 71
 if (!is_array($inputDecoded)) {
72
-    $adminApi->returnError(web\lib\admin\API::ERROR_MALFORMED_REQUEST, "Unable to decode JSON POST data." . json_last_error_msg() . $inputRaw);
72
+    $adminApi->returnError(web\lib\admin\API::ERROR_MALFORMED_REQUEST, "Unable to decode JSON POST data.".json_last_error_msg().$inputRaw);
73 73
     exit(1);
74 74
 }
75 75
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
159 159
         }
160 160
         $newtokens = $mgmt->createTokens(true, [$admin], $idp);
161
-        $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0];
161
+        $URL = "https://".$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME'])."/action_enrollment.php?token=".array_keys($newtokens)[0];
162 162
         $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]];
163 163
         // done with the essentials - display in response. But if we also have an email address, send it there
164 164
         $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         if ($found) {
196 196
             $adminApi->returnSuccess([]);
197 197
         }
198
-        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier);
198
+        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP ".$idp->identifier);
199 199
         break;
200 200
     case web\lib\admin\API::ACTION_STATISTICS_FED:
201 201
         $adminApi->returnSuccess($fed->downloadStats("array"));
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
                 $outer = "";
243 243
                 $profile->setAnonymousIDSupport(FALSE);
244 244
             } else {
245
-                $outer = $outer . "@";
245
+                $outer = $outer."@";
246 246
                 $profile->setAnonymousIDSupport(TRUE);
247 247
             }
248
-            $profile->setRealm($outer . $realm);
248
+            $profile->setRealm($outer.$realm);
249 249
         }
250 250
         /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */
251 251
         $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER);
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         // extract relevant subset of information from cert objects
474 474
         $certDetails = [];
475 475
         foreach ($certs as $cert) {
476
-            $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
476
+            $certDetails[$cert->ca_type.":".$cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
477 477
         }
478 478
         $adminApi->returnSuccess($certDetails);
479 479
         break;
Please login to merge, or discard this patch.
Switch Indentation   +356 added lines, -356 removed lines patch added patch discarded remove patch
@@ -115,217 +115,217 @@  discard block
 block discarded – undo
115 115
 }
116 116
 
117 117
 switch ($inputDecoded['ACTION']) {
118
-    case web\lib\admin\API::ACTION_NEWINST:
119
-        // create the inst, no admin, no attributes
120
-        $typeRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_INSTTYPE);
121
-        if ($typeRaw === FALSE) {
122
-            throw new Exception("We did not receive a valid participant type!");
123
-        }
124
-        $type = $validator->partType($typeRaw);
125
-        $idp = new \core\IdP($fed->newIdP($type, "PENDING", "API"));
126
-        // now add all submitted attributes
127
-        $inputs = $adminApi->uglify($scrubbedParameters);
128
-        $optionParser->processSubmittedFields($idp, $inputs["POST"], $inputs["FILES"]);
129
-        $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_CAT_INST_ID => $idp->identifier]);
130
-        break;
131
-    case web\lib\admin\API::ACTION_DELINST:
132
-        try {
133
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
134
-        } catch (Exception $e) {
135
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
136
-            exit(1);
137
-        }
138
-        $idp->destroy();
139
-        $adminApi->returnSuccess([]);
140
-        break;
141
-    case web\lib\admin\API::ACTION_ADMIN_LIST:
142
-        try {
143
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
144
-        } catch (Exception $e) {
145
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
146
-            exit(1);
147
-        }
148
-        $adminApi->returnSuccess($idp->listOwners());
149
-        break;
150
-    case web\lib\admin\API::ACTION_ADMIN_ADD:
151
-        // IdP in question
152
-        try {
153
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
154
-        } catch (Exception $e) {
155
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
156
-            exit(1);
157
-        }
158
-        // here is the token
159
-        $mgmt = new core\UserManagement();
160
-        // we know we have an admin ID but scrutinizer wants this checked more explicitly
161
-        $admin = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID);
162
-        if ($admin === FALSE) {
163
-            throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
164
-        }
165
-        $newtokens = $mgmt->createTokens(true, [$admin], $idp);
166
-        $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0];
167
-        $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]];
168
-        // done with the essentials - display in response. But if we also have an email address, send it there
169
-        $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL);
170
-        if ($email !== FALSE) {
171
-            $sent = \core\common\OutsideComm::adminInvitationMail($email, "EXISTING-FED", array_keys($newtokens)[0], $idp->name, $fed, $idp->type);
172
-            $success["EMAIL SENT"] = $sent["SENT"];
173
-            if ($sent["SENT"] === TRUE) {
174
-                $success["EMAIL TRANSPORT SECURE"] = $sent["TRANSPORT"];
118
+        case web\lib\admin\API::ACTION_NEWINST:
119
+            // create the inst, no admin, no attributes
120
+            $typeRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_INSTTYPE);
121
+            if ($typeRaw === FALSE) {
122
+                throw new Exception("We did not receive a valid participant type!");
175 123
             }
176
-        }
177
-        $adminApi->returnSuccess($success);
178
-        break;
179
-    case web\lib\admin\API::ACTION_ADMIN_DEL:
180
-        // IdP in question
181
-        try {
182
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
183
-        } catch (Exception $e) {
184
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
185
-            exit(1);
186
-        }
187
-        $currentAdmins = $idp->listOwners();
188
-        $toBeDeleted = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID);
189
-        if ($toBeDeleted === FALSE) {
190
-            throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
191
-        }
192
-        $found = FALSE;
193
-        foreach ($currentAdmins as $oneAdmin) {
194
-            if ($oneAdmin['MAIL'] == $toBeDeleted) {
195
-                $found = TRUE;
196
-                $mgmt = new core\UserManagement();
197
-                $mgmt->removeAdminFromIdP($idp, $oneAdmin['ID']);
124
+            $type = $validator->partType($typeRaw);
125
+            $idp = new \core\IdP($fed->newIdP($type, "PENDING", "API"));
126
+            // now add all submitted attributes
127
+            $inputs = $adminApi->uglify($scrubbedParameters);
128
+            $optionParser->processSubmittedFields($idp, $inputs["POST"], $inputs["FILES"]);
129
+            $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_CAT_INST_ID => $idp->identifier]);
130
+            break;
131
+        case web\lib\admin\API::ACTION_DELINST:
132
+            try {
133
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
134
+            } catch (Exception $e) {
135
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
136
+                exit(1);
198 137
             }
199
-        }
200
-        if ($found) {
138
+            $idp->destroy();
201 139
             $adminApi->returnSuccess([]);
202
-        }
203
-        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier);
204
-        break;
205
-    case web\lib\admin\API::ACTION_STATISTICS_FED:
206
-        $adminApi->returnSuccess($fed->downloadStats("array"));
207
-        break;
208
-    case \web\lib\admin\API::ACTION_NEWPROF_RADIUS:
209
-    // fall-through intended: both get mostly identical treatment
210
-    case web\lib\admin\API::ACTION_NEWPROF_SB:
211
-        try {
212
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
213
-        } catch (Exception $e) {
214
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
215
-            exit(1);
216
-        }
217
-        if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_RADIUS) {
218
-            $type = "RADIUS";
219
-        } else {
220
-            $type = "SILVERBULLET";
221
-        }
222
-        $profile = $idp->newProfile($type);
223
-        if ($profile === NULL) {
224
-            $adminApi->returnError(\web\lib\admin\API::ERROR_INTERNAL_ERROR, "Unable to create a new Profile, for no apparent reason. Please contact support.");
225
-            exit(1);
226
-        }
227
-        $inputs = $adminApi->uglify($scrubbedParameters);
228
-        $optionParser->processSubmittedFields($profile, $inputs["POST"], $inputs["FILES"]);
229
-        if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_SB) {
230
-            // auto-accept ToU?
231
-            if ($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_TOU) !== FALSE) {
232
-                $profile->addAttribute("hiddenprofile:tou_accepted", NULL, 1);
233
-            }
234
-            // we're done at this point
235
-            $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profile->identifier]);
236 140
             break;
237
-        }
238
-        if (!$profile instanceof core\ProfileRADIUS) {
239
-            throw new Exception("Can't be. This is only here to convince Scrutinizer that we're really talking RADIUS.");
240
-        }
241
-        /* const AUXATTRIB_PROFILE_REALM = 'ATTRIB-PROFILE-REALM';
242
-          const AUXATTRIB_PROFILE_OUTERVALUE = 'ATTRIB-PROFILE-OUTERVALUE'; */
243
-        $realm = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_REALM);
244
-        $outer = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_OUTERVALUE);
245
-        if ($realm !== FALSE) {
246
-            if ($outer === FALSE) {
247
-                $outer = "";
248
-                $profile->setAnonymousIDSupport(FALSE);
141
+        case web\lib\admin\API::ACTION_ADMIN_LIST:
142
+            try {
143
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
144
+            } catch (Exception $e) {
145
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
146
+                exit(1);
147
+            }
148
+            $adminApi->returnSuccess($idp->listOwners());
149
+            break;
150
+        case web\lib\admin\API::ACTION_ADMIN_ADD:
151
+            // IdP in question
152
+            try {
153
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
154
+            } catch (Exception $e) {
155
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
156
+                exit(1);
157
+            }
158
+            // here is the token
159
+            $mgmt = new core\UserManagement();
160
+            // we know we have an admin ID but scrutinizer wants this checked more explicitly
161
+            $admin = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID);
162
+            if ($admin === FALSE) {
163
+                throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
164
+            }
165
+            $newtokens = $mgmt->createTokens(true, [$admin], $idp);
166
+            $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0];
167
+            $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]];
168
+            // done with the essentials - display in response. But if we also have an email address, send it there
169
+            $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL);
170
+            if ($email !== FALSE) {
171
+                $sent = \core\common\OutsideComm::adminInvitationMail($email, "EXISTING-FED", array_keys($newtokens)[0], $idp->name, $fed, $idp->type);
172
+                $success["EMAIL SENT"] = $sent["SENT"];
173
+                if ($sent["SENT"] === TRUE) {
174
+                    $success["EMAIL TRANSPORT SECURE"] = $sent["TRANSPORT"];
175
+                }
176
+            }
177
+            $adminApi->returnSuccess($success);
178
+            break;
179
+        case web\lib\admin\API::ACTION_ADMIN_DEL:
180
+            // IdP in question
181
+            try {
182
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
183
+            } catch (Exception $e) {
184
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
185
+                exit(1);
186
+            }
187
+            $currentAdmins = $idp->listOwners();
188
+            $toBeDeleted = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID);
189
+            if ($toBeDeleted === FALSE) {
190
+                throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
191
+            }
192
+            $found = FALSE;
193
+            foreach ($currentAdmins as $oneAdmin) {
194
+                if ($oneAdmin['MAIL'] == $toBeDeleted) {
195
+                    $found = TRUE;
196
+                    $mgmt = new core\UserManagement();
197
+                    $mgmt->removeAdminFromIdP($idp, $oneAdmin['ID']);
198
+                }
199
+            }
200
+            if ($found) {
201
+                $adminApi->returnSuccess([]);
202
+            }
203
+            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier);
204
+            break;
205
+        case web\lib\admin\API::ACTION_STATISTICS_FED:
206
+            $adminApi->returnSuccess($fed->downloadStats("array"));
207
+            break;
208
+        case \web\lib\admin\API::ACTION_NEWPROF_RADIUS:
209
+        // fall-through intended: both get mostly identical treatment
210
+        case web\lib\admin\API::ACTION_NEWPROF_SB:
211
+            try {
212
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
213
+            } catch (Exception $e) {
214
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
215
+                exit(1);
216
+            }
217
+            if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_RADIUS) {
218
+                $type = "RADIUS";
249 219
             } else {
250
-                $outer = $outer . "@";
251
-                $profile->setAnonymousIDSupport(TRUE);
220
+                $type = "SILVERBULLET";
252 221
             }
253
-            $profile->setRealm($outer . $realm);
254
-        }
255
-        /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */
256
-        $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER);
257
-        if ($testuser !== FALSE) {
258
-            $profile->setRealmCheckUser(TRUE, $testuser);
259
-        }
260
-        /* const AUXATTRIB_PROFILE_INPUT_HINT = 'ATTRIB-PROFILE-HINTREALM';
222
+            $profile = $idp->newProfile($type);
223
+            if ($profile === NULL) {
224
+                $adminApi->returnError(\web\lib\admin\API::ERROR_INTERNAL_ERROR, "Unable to create a new Profile, for no apparent reason. Please contact support.");
225
+                exit(1);
226
+            }
227
+            $inputs = $adminApi->uglify($scrubbedParameters);
228
+            $optionParser->processSubmittedFields($profile, $inputs["POST"], $inputs["FILES"]);
229
+            if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_SB) {
230
+                // auto-accept ToU?
231
+                if ($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_TOU) !== FALSE) {
232
+                    $profile->addAttribute("hiddenprofile:tou_accepted", NULL, 1);
233
+                }
234
+                // we're done at this point
235
+                $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profile->identifier]);
236
+                break;
237
+            }
238
+            if (!$profile instanceof core\ProfileRADIUS) {
239
+                throw new Exception("Can't be. This is only here to convince Scrutinizer that we're really talking RADIUS.");
240
+            }
241
+            /* const AUXATTRIB_PROFILE_REALM = 'ATTRIB-PROFILE-REALM';
242
+          const AUXATTRIB_PROFILE_OUTERVALUE = 'ATTRIB-PROFILE-OUTERVALUE'; */
243
+            $realm = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_REALM);
244
+            $outer = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_OUTERVALUE);
245
+            if ($realm !== FALSE) {
246
+                if ($outer === FALSE) {
247
+                    $outer = "";
248
+                    $profile->setAnonymousIDSupport(FALSE);
249
+                } else {
250
+                    $outer = $outer . "@";
251
+                    $profile->setAnonymousIDSupport(TRUE);
252
+                }
253
+                $profile->setRealm($outer . $realm);
254
+            }
255
+            /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */
256
+            $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER);
257
+            if ($testuser !== FALSE) {
258
+                $profile->setRealmCheckUser(TRUE, $testuser);
259
+            }
260
+            /* const AUXATTRIB_PROFILE_INPUT_HINT = 'ATTRIB-PROFILE-HINTREALM';
261 261
           const AUXATTRIB_PROFILE_INPUT_VERIFY = 'ATTRIB-PROFILE-VERIFYREALM'; */
262
-        $hint = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_HINT);
263
-        $enforce = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_VERIFY);
264
-        if ($enforce !== FALSE) {
265
-            $profile->setInputVerificationPreference($enforce, $hint);
266
-        }
267
-        /* const AUXATTRIB_PROFILE_EAPTYPE */
268
-        $iterator = 1;
269
-        foreach ($scrubbedParameters as $oneParam) {
270
-            if ($oneParam['NAME'] == web\lib\admin\API::AUXATTRIB_PROFILE_EAPTYPE && is_int($oneParam["VALUE"])) {
271
-                $type = new \core\common\EAP($oneParam["VALUE"]);
272
-                $profile->addSupportedEapMethod($type, $iterator);
273
-                $iterator = $iterator + 1;
262
+            $hint = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_HINT);
263
+            $enforce = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_VERIFY);
264
+            if ($enforce !== FALSE) {
265
+                $profile->setInputVerificationPreference($enforce, $hint);
274 266
             }
275
-        }
276
-        // reinstantiate $profile freshly from DB - it was updated in the process
277
-        $profileFresh = new core\ProfileRADIUS($profile->identifier);
278
-        $profileFresh->prepShowtime();
279
-        $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profileFresh->identifier]);
280
-        break;
281
-    case web\lib\admin\API::ACTION_ENDUSER_NEW:
282
-        $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
283
-        if ($prof_id === FALSE) {
284
-            exit(1);
285
-        }
286
-        $evaluation = commonSbProfileChecks($fed, $prof_id);
287
-        if ($evaluation === FALSE) {
288
-            exit(1);
289
-        }
290
-        list($idp, $profile) = $evaluation;
291
-        $user = $validator->string($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME));
292
-        $expiryRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_EXPIRY);
293
-        if ($expiryRaw === FALSE) {
294
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The expiry date wasn't found in the request.");
295
-            exit(1);
296
-        }
297
-        $expiry = new DateTime($expiryRaw);
298
-        try {
299
-            $retval = $profile->addUser($user, $expiry);
300
-        } catch (Exception $e) {
301
-            $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed. Maybe a duplicate username, or malformed expiry date?");
302
-            exit(1);
303
-        }
304
-        if ($retval == 0) {// that didn't work, it seems
305
-            $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed subtly. Contact the administrators.");
306
-            exit(1);
307
-        }
308
-        $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $user, \web\lib\admin\API::AUXATTRIB_SB_USERID => $retval]);
309
-        break;
310
-    case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE:
311
-    // fall-through intended: both actions are very similar
312
-    case \web\lib\admin\API::ACTION_TOKEN_NEW:
313
-        $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
314
-        if ($profile_id === FALSE) {
315
-            exit(1);
316
-        }
317
-        $evaluation = commonSbProfileChecks($fed, $profile_id);
318
-        if ($evaluation === FALSE) {
319
-            exit(1);
320
-        }
321
-        list($idp, $profile) = $evaluation;
322
-        $userId = $validator->integer($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID));
323
-        if ($userId === FALSE) {
324
-            $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "User ID is not an integer.");
325
-            exit(1);
326
-        }
327
-        $additionalInfo = [];
328
-        switch ($inputDecoded['ACTION']) { // this is where the two differ
267
+            /* const AUXATTRIB_PROFILE_EAPTYPE */
268
+            $iterator = 1;
269
+            foreach ($scrubbedParameters as $oneParam) {
270
+                if ($oneParam['NAME'] == web\lib\admin\API::AUXATTRIB_PROFILE_EAPTYPE && is_int($oneParam["VALUE"])) {
271
+                    $type = new \core\common\EAP($oneParam["VALUE"]);
272
+                    $profile->addSupportedEapMethod($type, $iterator);
273
+                    $iterator = $iterator + 1;
274
+                }
275
+            }
276
+            // reinstantiate $profile freshly from DB - it was updated in the process
277
+            $profileFresh = new core\ProfileRADIUS($profile->identifier);
278
+            $profileFresh->prepShowtime();
279
+            $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profileFresh->identifier]);
280
+            break;
281
+        case web\lib\admin\API::ACTION_ENDUSER_NEW:
282
+            $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
283
+            if ($prof_id === FALSE) {
284
+                exit(1);
285
+            }
286
+            $evaluation = commonSbProfileChecks($fed, $prof_id);
287
+            if ($evaluation === FALSE) {
288
+                exit(1);
289
+            }
290
+            list($idp, $profile) = $evaluation;
291
+            $user = $validator->string($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME));
292
+            $expiryRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_EXPIRY);
293
+            if ($expiryRaw === FALSE) {
294
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The expiry date wasn't found in the request.");
295
+                exit(1);
296
+            }
297
+            $expiry = new DateTime($expiryRaw);
298
+            try {
299
+                $retval = $profile->addUser($user, $expiry);
300
+            } catch (Exception $e) {
301
+                $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed. Maybe a duplicate username, or malformed expiry date?");
302
+                exit(1);
303
+            }
304
+            if ($retval == 0) {// that didn't work, it seems
305
+                $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed subtly. Contact the administrators.");
306
+                exit(1);
307
+            }
308
+            $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $user, \web\lib\admin\API::AUXATTRIB_SB_USERID => $retval]);
309
+            break;
310
+        case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE:
311
+        // fall-through intended: both actions are very similar
312
+        case \web\lib\admin\API::ACTION_TOKEN_NEW:
313
+            $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
314
+            if ($profile_id === FALSE) {
315
+                exit(1);
316
+            }
317
+            $evaluation = commonSbProfileChecks($fed, $profile_id);
318
+            if ($evaluation === FALSE) {
319
+                exit(1);
320
+            }
321
+            list($idp, $profile) = $evaluation;
322
+            $userId = $validator->integer($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID));
323
+            if ($userId === FALSE) {
324
+                $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "User ID is not an integer.");
325
+                exit(1);
326
+            }
327
+            $additionalInfo = [];
328
+            switch ($inputDecoded['ACTION']) { // this is where the two differ
329 329
             case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE:
330 330
                 $result = $profile->deactivateUser($userId);
331 331
                 break;
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                     }
359 359
                 }
360 360
                 break;
361
-        }
361
+            }
362 362
 
363 363
         if ($result !== TRUE) {
364 364
             $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "These parameters did not lead to an existing, active user.");
@@ -366,65 +366,65 @@  discard block
 block discarded – undo
366 366
         }
367 367
         $adminApi->returnSuccess($additionalInfo);
368 368
         break;
369
-    case \web\lib\admin\API::ACTION_ENDUSER_IDENTIFY:
370
-        $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
371
-        if ($profile_id === FALSE) {
372
-            exit(1);
373
-        }
374
-        $evaluation = commonSbProfileChecks($fed, $profile_id);
375
-        if ($evaluation === FALSE) {
376
-            exit(1);
377
-        }
378
-        list($idp, $profile) = $evaluation;
379
-        $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID);
380
-        $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME);
381
-        $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
382
-        if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE) {
383
-            // we need at least one of those
384
-            $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, or certificate serial is required.");
385
-        }
386
-        $userlist = $profile->listAllUsers();
387
-        if ($userName === FALSE && $certSerial === FALSE) { // we got a user ID
388
-            if (!isset($userlist[$userId])) {
389
-                return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This user ID does not exist in this profile.");
369
+        case \web\lib\admin\API::ACTION_ENDUSER_IDENTIFY:
370
+            $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
371
+            if ($profile_id === FALSE) {
372
+                exit(1);
390 373
             }
391
-            $adminApi->returnSuccess([$userId => $userlist[$userId]]);
392
-        }
393
-        if ($userId === FALSE && $certSerial === FALSE) { // we got a username
394
-            $key = array_search($userName, $userlist);
395
-            if ($key === FALSE) {
396
-                return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This username does not exist in this profile.");
374
+            $evaluation = commonSbProfileChecks($fed, $profile_id);
375
+            if ($evaluation === FALSE) {
376
+                exit(1);
397 377
             }
398
-            $adminApi->returnSuccess([$key => $userlist[$key]]);
399
-        }
400
-        if ($userId === FALSE && $userName === FALSE) { // we got a cert serial
401
-            $serial = explode(":", $certSerial);
402
-            $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
403
-            if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
404
-                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
378
+            list($idp, $profile) = $evaluation;
379
+            $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID);
380
+            $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME);
381
+            $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
382
+            if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE) {
383
+                // we need at least one of those
384
+                $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, or certificate serial is required.");
405 385
             }
406
-            if ($cert->profileId != $profile->identifier) {
407
-                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
386
+            $userlist = $profile->listAllUsers();
387
+            if ($userName === FALSE && $certSerial === FALSE) { // we got a user ID
388
+                if (!isset($userlist[$userId])) {
389
+                    return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This user ID does not exist in this profile.");
390
+                }
391
+                $adminApi->returnSuccess([$userId => $userlist[$userId]]);
408 392
             }
409
-            $adminApi->returnSuccess([$cert->userId => $userlist[$cert->userId]]);
410
-        }
411
-        $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "Only exactly one of User ID, username or cert serial can be specified.");
412
-        break;
413
-    case \web\lib\admin\API::ACTION_ENDUSER_LIST:
414
-    // fall-through: those two are similar
415
-    case \web\lib\admin\API::ACTION_TOKEN_LIST:
416
-        $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
417
-        if ($profile_id === FALSE) {
418
-            exit(1);
419
-        }
420
-        $evaluation = commonSbProfileChecks($fed, $profile_id);
421
-        if ($evaluation === FALSE) {
422
-            exit(1);
423
-        }
424
-        list($idp, $profile) = $evaluation;
425
-        $allUsers = $profile->listAllUsers();
426
-        // this is where they differ
427
-        switch ($inputDecoded['ACTION']) {
393
+            if ($userId === FALSE && $certSerial === FALSE) { // we got a username
394
+                $key = array_search($userName, $userlist);
395
+                if ($key === FALSE) {
396
+                    return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This username does not exist in this profile.");
397
+                }
398
+                $adminApi->returnSuccess([$key => $userlist[$key]]);
399
+            }
400
+            if ($userId === FALSE && $userName === FALSE) { // we got a cert serial
401
+                $serial = explode(":", $certSerial);
402
+                $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
403
+                if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
404
+                    $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
405
+                }
406
+                if ($cert->profileId != $profile->identifier) {
407
+                    $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
408
+                }
409
+                $adminApi->returnSuccess([$cert->userId => $userlist[$cert->userId]]);
410
+            }
411
+            $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "Only exactly one of User ID, username or cert serial can be specified.");
412
+            break;
413
+        case \web\lib\admin\API::ACTION_ENDUSER_LIST:
414
+        // fall-through: those two are similar
415
+        case \web\lib\admin\API::ACTION_TOKEN_LIST:
416
+            $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
417
+            if ($profile_id === FALSE) {
418
+                exit(1);
419
+            }
420
+            $evaluation = commonSbProfileChecks($fed, $profile_id);
421
+            if ($evaluation === FALSE) {
422
+                exit(1);
423
+            }
424
+            list($idp, $profile) = $evaluation;
425
+            $allUsers = $profile->listAllUsers();
426
+            // this is where they differ
427
+            switch ($inputDecoded['ACTION']) {
428 428
             case \web\lib\admin\API::ACTION_ENDUSER_LIST:
429 429
                 $adminApi->returnSuccess($allUsers);
430 430
                 break;
@@ -443,105 +443,105 @@  discard block
 block discarded – undo
443 443
                     $infoSet[$oneTokenObject->userId] = [\web\lib\admin\API::AUXATTRIB_TOKEN => $oneTokenObject->invitationTokenString, "STATUS" => $oneTokenObject->invitationTokenStatus];
444 444
                 }
445 445
                 $adminApi->returnSuccess($infoSet);
446
-        }
447
-        break;
448
-    case \web\lib\admin\API::ACTION_TOKEN_REVOKE:
449
-        $tokenRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TOKEN);
450
-        if ($tokenRaw === FALSE) {
451
-            exit(1);
452
-        }
453
-        $token = new core\SilverbulletInvitation($tokenRaw);
454
-        if ($token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_VALID && $token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) {
455
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "This is not a currently valid token.");
456
-            exit(1);
457
-        }
458
-        $token->revokeInvitation();
459
-        $adminApi->returnSuccess([]);
460
-        break;
461
-    case \web\lib\admin\API::ACTION_CERT_LIST:
462
-        $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
463
-        $user_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID);
464
-        if ($prof_id === FALSE || !is_int($user_id)) {
465
-            exit(1);
466
-        }
467
-        $evaluation = commonSbProfileChecks($fed, $prof_id);
468
-        if ($evaluation === FALSE) {
469
-            exit(1);
470
-        }
471
-        list($idp, $profile) = $evaluation;
472
-        $invitations = $profile->userStatus($user_id);
473
-        // now pull out cert information from the object
474
-        $certs = [];
475
-        foreach ($invitations as $oneInvitation) {
476
-            $certs = array_merge($certs, $oneInvitation->associatedCertificates);
477
-        }
478
-        // extract relevant subset of information from cert objects
479
-        $certDetails = [];
480
-        foreach ($certs as $cert) {
481
-            $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
482
-        }
483
-        $adminApi->returnSuccess($certDetails);
484
-        break;
485
-    case \web\lib\admin\API::ACTION_CERT_REVOKE:
486
-        $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
487
-        if ($prof_id === FALSE) {
488
-            exit(1);
489
-        }
490
-        $evaluation = commonSbProfileChecks($fed, $prof_id);
491
-        if ($evaluation === FALSE) {
492
-            exit(1);
493
-        }
494
-        list($idp, $profile) = $evaluation;
495
-        // tear apart the serial
496
-        $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
497
-        if ($serialRaw === FALSE) {
498
-            exit(1);
499
-        }
500
-        $serial = explode(":", $serialRaw);
501
-        $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
502
-        if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
503
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
504
-        }
505
-        if ($cert->profileId != $profile->identifier) {
506
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
507
-        }
508
-        $cert->revokeCertificate();
509
-        $adminApi->returnSuccess([]);
446
+            }
510 447
         break;
511
-    case \web\lib\admin\API::ACTION_CERT_ANNOTATE:
512
-        $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
513
-        if ($prof_id === FALSE) {
514
-            exit(1);
515
-        }
516
-        $evaluation = commonSbProfileChecks($fed, $prof_id);
517
-        if ($evaluation === FALSE) {
518
-            exit(1);
519
-        }
520
-        list($idp, $profile) = $evaluation;
521
-        // tear apart the serial
522
-        $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
523
-        if ($serialRaw === FALSE) {
524
-            exit(1);
525
-        }
526
-        $serial = explode(":", $serialRaw);
527
-        $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
528
-        if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
529
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
530
-        }
531
-        if ($cert->profileId != $profile->identifier) {
532
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
533
-        }
534
-        $annotationRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTANNOTATION);
535
-        if ($annotationRaw === FALSE) {
536
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Unable to extract annotation.");
448
+        case \web\lib\admin\API::ACTION_TOKEN_REVOKE:
449
+            $tokenRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TOKEN);
450
+            if ($tokenRaw === FALSE) {
451
+                exit(1);
452
+            }
453
+            $token = new core\SilverbulletInvitation($tokenRaw);
454
+            if ($token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_VALID && $token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) {
455
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "This is not a currently valid token.");
456
+                exit(1);
457
+            }
458
+            $token->revokeInvitation();
459
+            $adminApi->returnSuccess([]);
537 460
             break;
538
-        }
539
-        $annotation = json_decode($annotationRaw, TRUE);
540
-        $cert->annotate($annotation);
541
-        $adminApi->returnSuccess([]);
461
+        case \web\lib\admin\API::ACTION_CERT_LIST:
462
+            $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
463
+            $user_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID);
464
+            if ($prof_id === FALSE || !is_int($user_id)) {
465
+                exit(1);
466
+            }
467
+            $evaluation = commonSbProfileChecks($fed, $prof_id);
468
+            if ($evaluation === FALSE) {
469
+                exit(1);
470
+            }
471
+            list($idp, $profile) = $evaluation;
472
+            $invitations = $profile->userStatus($user_id);
473
+            // now pull out cert information from the object
474
+            $certs = [];
475
+            foreach ($invitations as $oneInvitation) {
476
+                $certs = array_merge($certs, $oneInvitation->associatedCertificates);
477
+            }
478
+            // extract relevant subset of information from cert objects
479
+            $certDetails = [];
480
+            foreach ($certs as $cert) {
481
+                $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
482
+            }
483
+            $adminApi->returnSuccess($certDetails);
484
+            break;
485
+        case \web\lib\admin\API::ACTION_CERT_REVOKE:
486
+            $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
487
+            if ($prof_id === FALSE) {
488
+                exit(1);
489
+            }
490
+            $evaluation = commonSbProfileChecks($fed, $prof_id);
491
+            if ($evaluation === FALSE) {
492
+                exit(1);
493
+            }
494
+            list($idp, $profile) = $evaluation;
495
+            // tear apart the serial
496
+            $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
497
+            if ($serialRaw === FALSE) {
498
+                exit(1);
499
+            }
500
+            $serial = explode(":", $serialRaw);
501
+            $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
502
+            if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
503
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
504
+            }
505
+            if ($cert->profileId != $profile->identifier) {
506
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
507
+            }
508
+            $cert->revokeCertificate();
509
+            $adminApi->returnSuccess([]);
510
+            break;
511
+        case \web\lib\admin\API::ACTION_CERT_ANNOTATE:
512
+            $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
513
+            if ($prof_id === FALSE) {
514
+                exit(1);
515
+            }
516
+            $evaluation = commonSbProfileChecks($fed, $prof_id);
517
+            if ($evaluation === FALSE) {
518
+                exit(1);
519
+            }
520
+            list($idp, $profile) = $evaluation;
521
+            // tear apart the serial
522
+            $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
523
+            if ($serialRaw === FALSE) {
524
+                exit(1);
525
+            }
526
+            $serial = explode(":", $serialRaw);
527
+            $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
528
+            if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
529
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
530
+            }
531
+            if ($cert->profileId != $profile->identifier) {
532
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
533
+            }
534
+            $annotationRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTANNOTATION);
535
+            if ($annotationRaw === FALSE) {
536
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Unable to extract annotation.");
537
+                break;
538
+            }
539
+            $annotation = json_decode($annotationRaw, TRUE);
540
+            $cert->annotate($annotation);
541
+            $adminApi->returnSuccess([]);
542 542
         
543
-        break;
543
+            break;
544 544
         
545
-    default:
546
-        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_ACTION, "Not implemented yet.");
545
+        default:
546
+            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_ACTION, "Not implemented yet.");
547 547
 }
548 548
\ No newline at end of file
Please login to merge, or discard this patch.
core/DBConnection.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 use \Exception;
34 34
 
35
-require_once dirname(__DIR__) . "/config/_config.php";
35
+require_once dirname(__DIR__)."/config/_config.php";
36 36
 
37 37
 /**
38 38
  * This class is a singleton for establishing a connection to the database
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
             case "EXTERNAL":
61 61
             case "FRONTEND":
62 62
             case "DIAGNOSTICS":
63
-                if (!isset(self::${"instance" . $theDb})) {
63
+                if (!isset(self::${"instance".$theDb})) {
64 64
                     $class = __CLASS__;
65
-                    self::${"instance" . $theDb} = new $class($database);
66
-                    DBConnection::${"instance" . $theDb}->databaseInstance = $theDb;
65
+                    self::${"instance".$theDb} = new $class($database);
66
+                    DBConnection::${"instance".$theDb}->databaseInstance = $theDb;
67 67
                 }
68
-                return self::${"instance" . $theDb};
68
+                return self::${"instance".$theDb};
69 69
             default:
70
-                throw new Exception("This type of database (" . strtoupper($database) . ") is not known!");
70
+                throw new Exception("This type of database (".strtoupper($database).") is not known!");
71 71
         }
72 72
     }
73 73
 
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
             }
107 107
         }
108 108
         // log exact query to debug log, if log level is at 5
109
-        $this->loggerInstance->debug(5, "DB ATTEMPT: " . $querystring . "\n");
109
+        $this->loggerInstance->debug(5, "DB ATTEMPT: ".$querystring."\n");
110 110
         if ($types !== NULL) {
111
-            $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: " . print_r($arguments, true));
111
+            $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: ".print_r($arguments, true));
112 112
         }
113 113
 
114 114
         if ($this->connection->connect_error) {
115
-            throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number" . $this->connection->connect_error . ")!");
115
+            throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number".$this->connection->connect_error.")!");
116 116
         }
117 117
         if ($types === NULL) {
118 118
             $result = $this->connection->query($querystring);
119 119
             if ($result === FALSE) {
120
-                throw new Exception("DB: Unable to execute simple statement! Error was --> " . $this->connection->error . " <--");
120
+                throw new Exception("DB: Unable to execute simple statement! Error was --> ".$this->connection->error." <--");
121 121
             }
122 122
         } else {
123 123
             // fancy! prepared statement with dedicated argument list
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             }
131 131
             $prepResult = $statementObject->prepare($querystring);
132 132
             if ($prepResult === FALSE) {
133
-                throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> " . $statementObject->error . " <--.");
133
+                throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> ".$statementObject->error." <--.");
134 134
             }
135 135
 
136 136
             // we have a variable number of arguments packed into the ... array
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
             array_unshift($localArray, $types);
143 143
             $retval = call_user_func_array([$statementObject, "bind_param"], $localArray);
144 144
             if ($retval === FALSE) {
145
-                throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> " . var_export($localArray, TRUE) . " <--. Error was --> " . $statementObject->error . " <--");
145
+                throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> ".var_export($localArray, TRUE)." <--. Error was --> ".$statementObject->error." <--");
146 146
             }
147 147
             $result = $statementObject->execute();
148 148
             if ($result === FALSE) {
149
-                throw new Exception("DB: Unable to execute prepared statement! Error was --> " . $statementObject->error . " <--");
149
+                throw new Exception("DB: Unable to execute prepared statement! Error was --> ".$statementObject->error." <--");
150 150
             }
151 151
             $selectResult = $statementObject->get_result();
152 152
             if ($selectResult !== FALSE) {
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 
159 159
         // all cases where $result could be FALSE have been caught earlier
160 160
         if ($this->connection->errno) {
161
-            throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was " . $this->connection->errno . "!");
161
+            throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was ".$this->connection->errno."!");
162 162
         }
163 163
 
164 164
 
165 165
         if ($isMoreThanSelect) {
166
-            $this->loggerInstance->writeSQLAudit("[DB: " . strtoupper($this->databaseInstance) . "] " . $querystring);
166
+            $this->loggerInstance->writeSQLAudit("[DB: ".strtoupper($this->databaseInstance)."] ".$querystring);
167 167
             if ($types !== NULL) {
168
-                $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: " . print_r($arguments, true));
168
+                $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: ".print_r($arguments, true));
169 169
             }
170 170
         }
171 171
         return $result;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         $databaseCapitalised = strtoupper($database);
250 250
         $this->connection = new \mysqli(CONFIG['DB'][$databaseCapitalised]['host'], CONFIG['DB'][$databaseCapitalised]['user'], CONFIG['DB'][$databaseCapitalised]['pass'], CONFIG['DB'][$databaseCapitalised]['db']);
251 251
         if ($this->connection->connect_error) {
252
-            throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
252
+            throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.").");
253 253
         }
254 254
 
255 255
         if ($databaseCapitalised == "EXTERNAL" && CONFIG_CONFASSISTANT['CONSORTIUM']['name'] == "eduroam" && isset(CONFIG_CONFASSISTANT['CONSORTIUM']['deployment-voodoo']) && CONFIG_CONFASSISTANT['CONSORTIUM']['deployment-voodoo'] == "Operations Team") {
Please login to merge, or discard this patch.
core/User.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
         common\Entity::intoThePotatoes();
155 155
         $mail = \core\common\OutsideComm::mailHandle();
156 156
 // who to whom?
157
-        $mail->FromName = CONFIG['APPEARANCE']['productname'] . " Notification System";
158
-        $mail->addReplyTo(CONFIG['APPEARANCE']['support-contact']['developer-mail'], CONFIG['APPEARANCE']['productname'] . " " . _("Feedback"));
157
+        $mail->FromName = CONFIG['APPEARANCE']['productname']." Notification System";
158
+        $mail->addReplyTo(CONFIG['APPEARANCE']['support-contact']['developer-mail'], CONFIG['APPEARANCE']['productname']." "._("Feedback"));
159 159
         $mail->addAddress($mailaddr[0]["value"]);
160 160
 // what do we want to say?
161 161
         $mail->Subject = $subject;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 }
219 219
                 $lookFor .= "$name";
220 220
             }
221
-            $finding = preg_match("/^(" . $lookFor . "):(.*)/", $oneRow->user_id, $matches);
221
+            $finding = preg_match("/^(".$lookFor."):(.*)/", $oneRow->user_id, $matches);
222 222
             if ($finding === 0 || $finding === FALSE) {
223 223
                 return FALSE;
224 224
             }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                         $matchedProviders[] = $idp;
237 237
                         $name = $idp;
238 238
                         if ($skipCurl == 0) {
239
-                            $url = CONFIG_DIAGNOSTICS['eduGainResolver']['url'] . "?action=get_entity_name&type=idp&e_id=$idp&lang=$lang";
239
+                            $url = CONFIG_DIAGNOSTICS['eduGainResolver']['url']."?action=get_entity_name&type=idp&e_id=$idp&lang=$lang";
240 240
                             $ch = curl_init($url);
241 241
                             if ($ch === FALSE) {
242 242
                                 $loggerInstance->debug(2, "Unable ask eduGAIN about IdP - CURL init failed!");
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                             }
253 253
                             curl_close($ch);
254 254
                         }
255
-                        $listOfProviders[] = User::PROVIDER_STRINGS[$providerStrings[0]] . " - IdP: " . $name;
255
+                        $listOfProviders[] = User::PROVIDER_STRINGS[$providerStrings[0]]." - IdP: ".$name;
256 256
                     }
257 257
                     break;
258 258
                 case $providerStrings[1]:
Please login to merge, or discard this patch.
web/lib/admin/UIElements.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $find = array_keys($displayNames, $input, TRUE);
129 129
 
130 130
         if (count($find) == 0) { // this is an error! throw an Exception
131
-            throw new \Exception("The translation of an option name was requested, but the option is not known to the system: " . htmlentities($input));
131
+            throw new \Exception("The translation of an option name was requested, but the option is not known to the system: ".htmlentities($input));
132 132
         }
133 133
         \core\common\Entity::outOfThePotatoes();
134 134
         return $find[0];
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
         foreach ($optionlist as $option) {
151 151
             $type = $optioninfo->optionType($option['name']);
152
-            if (preg_match('/^' . $class . '/', $option['name']) && $option['level'] == "$level") {
152
+            if (preg_match('/^'.$class.'/', $option['name']) && $option['level'] == "$level") {
153 153
                 // all non-multilang attribs get this assignment ...
154 154
                 $language = "";
155 155
                 $content = $option['value'];
@@ -167,19 +167,19 @@  discard block
 block discarded – undo
167 167
                         $locationMarkers[] = $coords;
168 168
                         break;
169 169
                     case "file":
170
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td>";
170
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td>";
171 171
                         switch ($option['name']) {
172 172
                             case "general:logo_file":
173 173
                             case "fed:logo_file":
174
-                                $retval .= $this->previewImageinHTML('ROWID-' . $option['level'] . '-' . $option['row']);
174
+                                $retval .= $this->previewImageinHTML('ROWID-'.$option['level'].'-'.$option['row']);
175 175
                                 break;
176 176
                             case "eap:ca_file":
177 177
                             // fall-through intended: display both the same way
178 178
                             case "fed:minted_ca_file":
179
-                                $retval .= $this->previewCAinHTML('ROWID-' . $option['level'] . '-' . $option['row']);
179
+                                $retval .= $this->previewCAinHTML('ROWID-'.$option['level'].'-'.$option['row']);
180 180
                                 break;
181 181
                             case "support:info_file":
182
-                                $retval .= $this->previewInfoFileinHTML('ROWID-' . $option['level'] . '-' . $option['row']);
182
+                                $retval .= $this->previewInfoFileinHTML('ROWID-'.$option['level'].'-'.$option['row']);
183 183
                                 break;
184 184
                             default:
185 185
                         }
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
                             // do not display the option at all; it gets auto-set by the ProfileSilverbullet constructor and doesn't have to be seen
190 190
                             break;
191 191
                         }
192
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off") ) . "</strong></td></tr>";
192
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td><strong>".($content == "on" ? _("on") : _("off"))."</strong></td></tr>";
193 193
                         break;
194 194
                     default:
195
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>$content</strong></td></tr>";
195
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td><strong>$content</strong></td></tr>";
196 196
                 }
197 197
             }
198 198
         }
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
             $locationCount = 0;
202 202
             foreach ($locationMarkers as $g) {
203 203
                 $locationCount++;
204
-                $marker .= '<marker name="' . $locationCount . '" lat="' . $g['lat'] . '" lng="' . $g['lon'] . '" />';
204
+                $marker .= '<marker name="'.$locationCount.'" lat="'.$g['lat'].'" lng="'.$g['lon'].'" />';
205 205
             }
206 206
             $marker .= '<\/markers>'; // some validator says this should be escaped
207 207
             $jMarker = json_encode($locationMarkers);
208
-            $retval .= '<tr><td><script>markers=\'' . $marker . '\'; jmarkers = \'' . $jMarker . '\';</script></td><td></td><td></td></tr>';
208
+            $retval .= '<tr><td><script>markers=\''.$marker.'\'; jmarkers = \''.$jMarker.'\';</script></td><td></td><td></td></tr>';
209 209
         }
210 210
         \core\common\Entity::outOfThePotatoes();
211 211
         return $retval;
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
         \core\common\Entity::intoThePotatoes();
222 222
         $idpoptions = $myInst->getAttributes();
223 223
         $retval = "<div class='infobox'>
224
-        <h2>" . sprintf(_("General %s details"), $this->nomenclatureInst) . "</h2>
224
+        <h2>" . sprintf(_("General %s details"), $this->nomenclatureInst)."</h2>
225 225
         <table>
226 226
             <tr>
227 227
                 <td>
228
-                    " . _("Country:") . "
228
+                    " . _("Country:")."
229 229
                 </td>
230 230
                 <td>
231 231
                 </td>
@@ -235,16 +235,16 @@  discard block
 block discarded – undo
235 235
         $retval .= $myFed->name;
236 236
         $retval .= "</strong>
237 237
                 </td>
238
-            </tr>" . $this->infoblock($idpoptions, "general", "IdP") . "
238
+            </tr>" . $this->infoblock($idpoptions, "general", "IdP")."
239 239
         </table>
240 240
     </div>";
241 241
 
242 242
         $blocks = [["support", _("Global Helpdesk Details")], ["media", _("Media Properties")]];
243 243
         foreach ($blocks as $block) {
244 244
             $retval .= "<div class='infobox'>
245
-            <h2>" . $block[1] . "</h2>
245
+            <h2>" . $block[1]."</h2>
246 246
             <table>" .
247
-                    $this->infoblock($idpoptions, $block[0], "IdP") .
247
+                    $this->infoblock($idpoptions, $block[0], "IdP").
248 248
                     "</table>
249 249
         </div>";
250 250
         }
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
      */
260 260
     private function displaySize(int $number) {
261 261
         if ($number > 1024 * 1024) {
262
-            return round($number / 1024 / 1024, 2) . " MiB";
262
+            return round($number / 1024 / 1024, 2)." MiB";
263 263
         }
264 264
         if ($number > 1024) {
265
-            return round($number / 1024, 2) . " KiB";
265
+            return round($number / 1024, 2)." KiB";
266 266
         }
267
-        return $number . " B";
267
+        return $number." B";
268 268
     }
269 269
 
270 270
     /**
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         $this->checkROWIDpresence($cAReference);
337 337
         $rawResult = UIElements::getBlobFromDB($cAReference, FALSE);
338 338
         if (is_bool($rawResult)) { // we didn't actually get a CA!
339
-            $retval = "<div class='ca-summary'>" . _("There was an error while retrieving the certificate from the database!") . "</div>";
339
+            $retval = "<div class='ca-summary'>"._("There was an error while retrieving the certificate from the database!")."</div>";
340 340
             \core\common\Entity::outOfThePotatoes();
341 341
             return $retval;
342 342
         }
@@ -352,13 +352,13 @@  discard block
 block discarded – undo
352 352
 
353 353
         $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']);
354 354
         $details['name'] = preg_replace('/\//', "", $details['name']);
355
-        $certstatus = ( $details['root'] == 1 ? "R" : "I");
355
+        $certstatus = ($details['root'] == 1 ? "R" : "I");
356 356
         if ($details['ca'] == 0 && $details['root'] != 1) {
357
-            $retval = "<div class='ca-summary' style='background-color:red'><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:maroon;  border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>" . _("This is a <strong>SERVER</strong> certificate!") . "<br/>" . $details['name'] . "</div>";
357
+            $retval = "<div class='ca-summary' style='background-color:red'><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:maroon;  border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>"._("This is a <strong>SERVER</strong> certificate!")."<br/>".$details['name']."</div>";
358 358
             \core\common\Entity::outOfThePotatoes();
359 359
             return $retval;
360 360
         }
361
-        $retval = "<div class='ca-summary'                                ><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:#0000ff; border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>$certstatus</div></div>" . $details['name'] . "</div>";
361
+        $retval = "<div class='ca-summary'                                ><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:#0000ff; border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>$certstatus</div></div>".$details['name']."</div>";
362 362
         \core\common\Entity::outOfThePotatoes();
363 363
         return $retval;
364 364
     }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     public function previewImageinHTML($imageReference) {
373 373
         \core\common\Entity::intoThePotatoes();
374 374
         $this->checkROWIDpresence($imageReference);
375
-        $retval = "<img style='max-width:150px' src='inc/filepreview.php?id=" . $imageReference . "' alt='" . _("Preview of logo file") . "'/>";
375
+        $retval = "<img style='max-width:150px' src='inc/filepreview.php?id=".$imageReference."' alt='"._("Preview of logo file")."'/>";
376 376
         \core\common\Entity::outOfThePotatoes();
377 377
         return $retval;
378 378
     }
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
         $this->checkROWIDpresence($fileReference);
389 389
         $fileBlob = UIElements::getBlobFromDB($fileReference, FALSE);
390 390
         if (is_bool($fileBlob)) { // we didn't actually get a file!
391
-            $retval = "<div class='ca-summary'>" . _("There was an error while retrieving the file from the database!") . "</div>";
391
+            $retval = "<div class='ca-summary'>"._("There was an error while retrieving the file from the database!")."</div>";
392 392
             \core\common\Entity::outOfThePotatoes();
393 393
             return $retval;
394 394
         }
395 395
         $decodedFileBlob = base64_decode($fileBlob);
396 396
         $fileinfo = new \finfo();
397
-        $retval = "<div class='ca-summary'>" . _("File exists") . " (" . $fileinfo->buffer($decodedFileBlob, FILEINFO_MIME_TYPE) . ", " . $this->displaySize(strlen($decodedFileBlob)) . ")<br/><a href='inc/filepreview.php?id=$fileReference'>" . _("Preview") . "</a></div>";
397
+        $retval = "<div class='ca-summary'>"._("File exists")." (".$fileinfo->buffer($decodedFileBlob, FILEINFO_MIME_TYPE).", ".$this->displaySize(strlen($decodedFileBlob)).")<br/><a href='inc/filepreview.php?id=$fileReference'>"._("Preview")."</a></div>";
398 398
         \core\common\Entity::outOfThePotatoes();
399 399
         return $retval;
400 400
     }
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
             $retval .= "<tr><td>";
423 423
         }
424 424
         $finalCaption = ($caption !== NULL ? $caption : $uiMessages[$level]['text']);
425
-        $retval .= "<img class='icon' src='" . $uiMessages[$level]['icon'] . "' alt='" . $finalCaption . "' title='" . $finalCaption . "'/>";
425
+        $retval .= "<img class='icon' src='".$uiMessages[$level]['icon']."' alt='".$finalCaption."' title='".$finalCaption."'/>";
426 426
         if (!$omittabletags) {
427 427
             $retval .= "</td><td>";
428 428
         }
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
             return "";
503 503
         }
504 504
 
505
-        $loggerInstance->debug(4, "Consortium logo is at: " . ROOT . "/web/resources/images/consortium_logo_large.png");
506
-        $logogd = imagecreatefrompng(ROOT . "/web/resources/images/consortium_logo_large.png");
505
+        $loggerInstance->debug(4, "Consortium logo is at: ".ROOT."/web/resources/images/consortium_logo_large.png");
506
+        $logogd = imagecreatefrompng(ROOT."/web/resources/images/consortium_logo_large.png");
507 507
         if ($logogd === FALSE) { // consortium logo is bogus; don't do anything
508 508
             return "";
509 509
         }
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
         $scale = sqrt($maxoccupy / $totallogopixels);
519 519
         $loggerInstance->debug(4, "Scaling info: $scale, $maxoccupy, $totallogopixels\n");
520 520
         // determine final pixel size - round to multitude of $symbolsize to match exact symbol boundary
521
-        $targetwidth = (int)($symbolsize * round($sizelogo[0] * $scale / $symbolsize));
522
-        $targetheight = (int)($symbolsize * round($sizelogo[1] * $scale / $symbolsize));
521
+        $targetwidth = (int) ($symbolsize * round($sizelogo[0] * $scale / $symbolsize));
522
+        $targetheight = (int) ($symbolsize * round($sizelogo[1] * $scale / $symbolsize));
523 523
         // paint white below the logo, in case it has transparencies (looks bad)
524 524
         // have one symbol in each direction extra white space
525 525
         $whiteimage = imagecreate($targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize);
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
         }
529 529
         imagecolorallocate($whiteimage, 255, 255, 255);
530 530
         // also make sure the initial placement is a multitude of 12; otherwise "two half" symbols might be affected
531
-        $targetplacementx = (int)($symbolsize * round(($sizeinput[0] / 2 - ($targetwidth - $symbolsize) / 2) / $symbolsize));
532
-        $targetplacementy = (int)($symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize) / 2) / $symbolsize));
531
+        $targetplacementx = (int) ($symbolsize * round(($sizeinput[0] / 2 - ($targetwidth - $symbolsize) / 2) / $symbolsize));
532
+        $targetplacementy = (int) ($symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize) / 2) / $symbolsize));
533 533
         imagecopyresized($inputgd, $whiteimage, $targetplacementx - $symbolsize, $targetplacementy - $symbolsize, 0, 0, $targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize, $targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize);
534 534
         imagecopyresized($inputgd, $logogd, $targetplacementx, $targetplacementy, 0, 0, $targetwidth, $targetheight, $sizelogo[0], $sizelogo[1]);
535 535
         ob_start();
Please login to merge, or discard this patch.
web/diag/magicTelepath.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  *          <base_url>/copyright.php after deploying the software
20 20
  */
21 21
 
22
-require_once dirname(dirname(__DIR__)) . "/config/_config.php";
22
+require_once dirname(dirname(__DIR__))."/config/_config.php";
23 23
 $realm = filter_input(INPUT_GET, 'realm', FILTER_SANITIZE_STRING);
24
-$visited = filter_input(INPUT_GET,'visited', FILTER_SANITIZE_STRING);
25
-$nro = filter_input(INPUT_GET,'nro', FILTER_SANITIZE_STRING);
24
+$visited = filter_input(INPUT_GET, 'visited', FILTER_SANITIZE_STRING);
25
+$nro = filter_input(INPUT_GET, 'nro', FILTER_SANITIZE_STRING);
26 26
 CAT_session_start();
27 27
 $languageObject = new core\common\Language();
28 28
 $languageObject->setTextDomain("diagonstics");
Please login to merge, or discard this patch.
web/diag/diag.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
     $auth->authenticate();
43 43
 }
44 44
 if (isset($_SESSION['admin_diag_auth'])) {
45
-   $admin =  1;
46
-   unset($_SESSION['admin_diag_auth']);
45
+    $admin =  1;
46
+    unset($_SESSION['admin_diag_auth']);
47 47
 }
48 48
 $Gui = new \web\lib\user\Gui();
49 49
 $skinObject = new \web\lib\user\Skinjob($_REQUEST['skin'] ?? $_SESSION['skin'] ?? $fedskin[0] ?? CONFIG['APPEARANCE']['skins'][0]);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *          <base_url>/copyright.php after deploying the software
20 20
  */
21 21
 
22
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
22
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
23 23
 $admin = filter_input(INPUT_GET, 'admin', FILTER_VALIDATE_INT);
24 24
 $auth = new \web\lib\admin\Authentication();
25 25
 $isauth = 0;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             unset($q_el[$idx]);
34 34
             $q_r = preg_replace("/\?.*/", "", $_SERVER['REQUEST_URI']);
35 35
             if (count($q_el)) {
36
-                $q_r = $q_r . '?' . implode('&', $q_el);
36
+                $q_r = $q_r.'?'.implode('&', $q_el);
37 37
             }
38 38
             $_SERVER['REQUEST_URI'] = $q_r;
39 39
         }
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
     $auth->authenticate();
43 43
 }
44 44
 if (isset($_SESSION['admin_diag_auth'])) {
45
-   $admin =  1;
45
+   $admin = 1;
46 46
    unset($_SESSION['admin_diag_auth']);
47 47
 }
48 48
 $Gui = new \web\lib\user\Gui();
49 49
 $skinObject = new \web\lib\user\Skinjob($_REQUEST['skin'] ?? $_SESSION['skin'] ?? $fedskin[0] ?? CONFIG['APPEARANCE']['skins'][0]);
50
-require "../skins/" . $skinObject->skin . "/diag/diag.php";
50
+require "../skins/".$skinObject->skin."/diag/diag.php";
51 51
 
52 52
 
Please login to merge, or discard this patch.
web/skins/modern/diag/diag.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
                         echo "0\">";
157 157
                         echo _("This service is for authenticated admins only.") . '<br>';
158 158
                         echo "<a href=\"diag.php?admin=1\">" .
159
-                             _("eduroam® admin access is needed") . "</a>";
159
+                                _("eduroam® admin access is needed") . "</a>";
160 160
                     }
161 161
                 ?>
162 162
             </div> 
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 
41 41
 <?php
42 42
 $profile_list_size = 1;
43
-require_once dirname(__DIR__) . '/Divs.php';
43
+require_once dirname(__DIR__).'/Divs.php';
44 44
 $divs = new \web\skins\modern\Divs($Gui);
45 45
 $visibility = 'index';
46 46
 $operatingSystem = $Gui->detectOS();
47 47
 $Gui->loggerInstance->debug(4, $operatingSystem);
48 48
 $uiElements = new web\lib\admin\UIElements();
49 49
 if ($operatingSystem) {
50
-    print "recognisedOS = '" . $operatingSystem['device'] . "';\n";
50
+    print "recognisedOS = '".$operatingSystem['device']."';\n";
51 51
 }
52
-require dirname(__DIR__) . '/user/js/cat_js.php';
52
+require dirname(__DIR__).'/user/js/cat_js.php';
53 53
 ?>
54 54
 
55 55
 </script>
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
             <?php echo $divs->div_pagetitle(_("Diagnostics site"), ""); ?>
82 82
             <div id="user_info" style='padding-top: 10px;'>
83 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") .'?'; ?>
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 87
             </div>
88 88
             <div id='diagnostic_enduser' style='display: none;'>
89 89
                 <h2><?php echo _("Tools for End Users"); ?></h2>
@@ -93,24 +93,24 @@  discard block
 block discarded – undo
93 93
                 ?>
94 94
                 </p>
95 95
                 <?php
96
-                    echo '<div id="before_stage_1"><h3>' . _("The system needs some information on your home institution - issuer of your account") . '</h3>';
96
+                    echo '<div id="before_stage_1"><h3>'._("The system needs some information on your home institution - issuer of your account").'</h3>';
97 97
                     echo _("What is the realm part of your user account (the part behind the @ of 'your.username@<b>realm.tld</b>):");
98 98
                 ?>
99 99
                 <input type='text' name='user_realm' id='user_realm' value=''>
100 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/>';
101
+                    echo '<div id="realm_by_select"><br/>'._("alternatively").'<br/>';
102
+                    echo _("You can select your home institution from the following list").'<br/>';
103 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>';
104
+                    echo '<span id="realmselect">'._("Click to select your country/region and organisation").'</span></a></div>';
105 105
                 ?>
106 106
                 <div id="select_idp_area" style="display:none;">
107 107
                 </div>
108 108
                 </div>
109 109
                 <div id="position_info">
110 110
                     <?php
111
-                        echo '<h3>' . _("Optionally, to improve tests, you can provide information on your current location") . '</h3>';
111
+                        echo '<h3>'._("Optionally, to improve tests, you can provide information on your current location").'</h3>';
112 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>';
113
+                        echo '<span id="spselect">'._("Click to select a location in which you have an eduroam problem").'</span></a></div>';
114 114
                     ?>
115 115
                     <div id="select_sp_area" style="display:none;">
116 116
                     </div>
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
                             echo 'none';
144 144
                         }
145 145
                         echo ";'>";
146
-                        echo '<h3>' . _("Which problem are you reporting?") . '</h3>';
146
+                        echo '<h3>'._("Which problem are you reporting?").'</h3>';
147 147
                         echo '<input type="radio" name="problem_type" value="1">';
148
-                        echo _("SP contacting IdP due to technical problems or abuse") . '<br>';
148
+                        echo _("SP contacting IdP due to technical problems or abuse").'<br>';
149 149
                         echo '<input type="radio" name="problem_type" value="2">';
150 150
                         echo _("IdP contacting SP due to technical problems");
151 151
                         echo "<div id='idp_contact_area'></div>";
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
                         echo "</div>"; 
155 155
                     } else {
156 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>";
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 160
                     }
161 161
                 ?>
162 162
             </div> 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         if (type === 'idp' || type === 'sp') {
181 181
             shtml = '<table><tbody><tr id="row_'+type+'_country"></tr>';
182 182
             shtml = shtml + '<tr id="row_'+type+'_institution" style="visibility: collapse;">';
183
-            shtml = shtml + '<td>' + <?php echo '"' . _("Select institiution:") . '"'; ?> + '</td><td></td></tr>';
183
+            shtml = shtml + '<td>' + <?php echo '"'._("Select institiution:").'"'; ?> + '</td><td></td></tr>';
184 184
             if (type === 'idp') {
185 185
                 shtml = shtml + '<tr id="row_idp_realm"></tr>';
186 186
             }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         var options = '';
207 207
         var selecthead = '';
208 208
         if (type1 === 'sp' || type1 === 'idp') {
209
-            selecthead = <?php echo '"<td>' . _("Select country or region:") . ' </td>"'; ?>;
209
+            selecthead = <?php echo '"<td>'._("Select country or region:").' </td>"'; ?>;
210 210
             selecthead = selecthead + '<td>\n';
211 211
         }
212 212
         var select = '<select id="' + type1 + '_country" name="' + type1 + '_country" style="margin-left:0px; width:400px;">';
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             options = ($('#'+type2+'_country').html());
215 215
             countryAddSelect(selecthead, select + options + '</select>', type1);
216 216
         } else {
217
-            var comment = <?php echo '"<br><br>' . _("Fetching country/region list") . '..."'; ?>;
217
+            var comment = <?php echo '"<br><br>'._("Fetching country/region list").'..."'; ?>;
218 218
             inProgress(1, comment);
219 219
             $.ajax({
220 220
                 url: "findRealm.php",
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         return false;
249 249
     }
250 250
     function testSociopath(realm, answer) {
251
-        var comment = <?php echo '"' . _("Testing realm") . '..."'; ?>; 
251
+        var comment = <?php echo '"'._("Testing realm").'..."'; ?>; 
252 252
         inProgress(1, comment);
253 253
         if ($('#tested_realm').length == 0) {
254 254
             $('<input>').attr({
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
                                 query = '<input type="hidden" id="tested_realm" value="' + realm + '">';
274 274
                             }    
275 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>';
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 279
                             $('#sociopath_queries').html(query);
280 280
                             $('#sociopath_query_area').show();
281 281
                         }
@@ -306,55 +306,55 @@  discard block
 block discarded – undo
306 306
        }); 
307 307
     }
308 308
     function finalVerdict(realm, verdict) {
309
-        var title = <?php echo '"' . _("Diagnostic tests results for selected realm") . '"'; ?>;
309
+        var title = <?php echo '"'._("Diagnostic tests results for selected realm").'"'; ?>;
310 310
         result = '<div class="padding">';
311 311
         result = result + '<div><h3>';
312
-        result = result + <?php echo '"' . _("The result for tested realm:") . ' "'; ?> + realm;
312
+        result = result + <?php echo '"'._("The result for tested realm:").' "'; ?> + realm;
313 313
         result = result + '</h3></p><div style="padding: 5px;"><div style="padding: 0px;">';
314
-        result = result + <?php echo '"' . _("The system identified") . '" '; ?>  + ' ';
314
+        result = result + <?php echo '"'._("The system identified").'" '; ?>  + ' ';
315 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.") . '"'; ?>;
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 318
         result = result + '</div><div style="padding: 5px;"><table>';
319 319
         k = 1;
320 320
         for (key in verdict) {
321 321
             result = result + '<tr><td>' + k + '.</td>';
322 322
             k = k + 1;
323 323
             if (key === 'INFRA_DEVICE') {
324
-                result = result + '<td>' + <?php echo '"' . _("Your device configuration is broken") . '"'; ?> + '</td>';
324
+                result = result + '<td>' + <?php echo '"'._("Your device configuration is broken").'"'; ?> + '</td>';
325 325
             }
326 326
             if (key === 'INFRA_SP_80211') {
327
-                result = result + '<td>' + <?php echo '"' . _("The Wi-Fi network in your vicinity has quality issues") . '"'; ?> + '</td>';
327
+                result = result + '<td>' + <?php echo '"'._("The Wi-Fi network in your vicinity has quality issues").'"'; ?> + '</td>';
328 328
             }
329 329
             if (key === 'INFRA_SP_LAN') {
330
-                result = result + '<td>' + <?php echo '"' . _("The network environment around you is broken") . '"'; ?> + '</td>';
330
+                result = result + '<td>' + <?php echo '"'._("The network environment around you is broken").'"'; ?> + '</td>';
331 331
             }
332 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>';
333
+                result = result + '<td>' + <?php echo '"'._("The RADIUS server of your service provider is the source of the problem").'"'; ?> + '</td>';
334 334
             }
335 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>';
336
+                result = result + '<td>' + <?php echo '"'._("The RADIUS server in your home institution is currently unable to authenticate you").'"'; ?> + '</td>';
337 337
             }
338 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>';
339
+                result = result + '<td>' + <?php echo '"'._("The national server in the country/region you are visiting is not functioning correctly").'"'; ?> + '</td>';
340 340
             }
341 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>';
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 343
             }
344 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>';
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 346
             }
347 347
             if (key === 'INFRA_ETLR') {
348
-                result = result + '<td>' + <?php echo '"' . _("The communication to the top-level server is down") . '"'; ?> + '</td>';
348
+                result = result + '<td>' + <?php echo '"'._("The communication to the top-level server is down").'"'; ?> + '</td>';
349 349
             }
350 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>';
351
+                result = result + '<td>' + <?php echo '"'._("The national server in your home country/region is not functioning properly.").'"'; ?> + '</td>';
352 352
             }
353 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>';
354
+                result = result + '<td>' + <?php echo '"'._("The RADIUS server of your home institution is the source of the problem").'"'; ?> + '</td>';
355 355
             }
356 356
             if (key === 'INFRA_NONEXISTENTREALM') {
357
-                result = result + '<td>' + <?php echo '"' . _("This realm does not exist") . '"'; ?> + '</td>';
357
+                result = result + '<td>' + <?php echo '"'._("This realm does not exist").'"'; ?> + '</td>';
358 358
             }
359 359
             result = result + '<td style="padding-left: 5px;">' + (verdict[key] * 100).toFixed(2) + "%</td></tr>";
360 360
         }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
         return false;
467 467
     });
468 468
     $(document).on('change', '#idp_country, #sp_country, #asp_country' , function() {
469
-        var comment = <?php echo '"' . _("Fetching institutions list") . '..."'; ?>;  
469
+        var comment = <?php echo '"'._("Fetching institutions list").'..."'; ?>;  
470 470
         var id = $(this).attr('id');
471 471
         var k = id.indexOf('_');
472 472
         var type = id.substr(0,k);
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                         var shtml = '';
485 485
                         var select = '';
486 486
                         if (type !== 'asp') {
487
-                            shtml = <?php echo '"<td>' . _("Select institution:") . '</td><td>"'; ?>;
487
+                            shtml = <?php echo '"<td>'._("Select institution:").'</td><td>"'; ?>;
488 488
                         }
489 489
                         select = '<select id="' + type + '_inst" name="' + type + '_inst" style="margin-left:0px; width:400px;"><option value=""></option>';
490 490
                         for (var i in institutions) {
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
             $('#start_test_area').hide();
525 525
             return false;
526 526
         }
527
-        var comment = <?php echo '"' . _("Fetching realms list") . '..."'; ?>;
527
+        var comment = <?php echo '"'._("Fetching realms list").'..."'; ?>;
528 528
         inProgress(1, comment);
529 529
         $.ajax({
530 530
             url: "findRealm.php",
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                     var realms = data.realms;
537 537
                     var realmselect = '';
538 538
                     if (realms.length > 1) {
539
-                        realmselect = <?php echo '"<td>' . _("Check realm(s):") . '</td>"'; ?>;
539
+                        realmselect = <?php echo '"<td>'._("Check realm(s):").'</td>"'; ?>;
540 540
                         realmselect = realmselect + '<td>' + "<span style='margin-left: 10px'>";
541 541
                         for (var i in realms) {
542 542
                             realmselect = realmselect + '<input type="radio" name="realm" ';
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
                         }
549 549
                         realmselect = realmselect + '</span></td>';
550 550
                     } else {
551
-                        realmselect = <?php echo '"<td>' . _("Realm:") . '</td>"'; ?>;
551
+                        realmselect = <?php echo '"<td>'._("Realm:").'</td>"'; ?>;
552 552
                         realmselect = realmselect + '<td>' + "<span style='margin-left: 10px'>";
553 553
                         realmselect = realmselect + realms[0] + '</span>';
554 554
                         realmselect = realmselect + '<input type="hidden" name="realm" value="' + realms[0] + '">';
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
             });
604 604
             t = 1;
605 605
         }
606
-        var comment = <?php echo '"' . _("Running realm tests") . '..."'; ?>;
606
+        var comment = <?php echo '"'._("Running realm tests").'..."'; ?>;
607 607
         inProgress(1, comment);
608 608
         /*waiting(comment);*/
609 609
         $.ajax({
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
                             }
648 648
                         });
649 649
                         $('#sp_questions > tbody').append('<tr class="error_row"><td>' +
650
-                                <?php echo '"' . _("Realm is not registered with the eduroam database:") . '"'; ?> +
650
+                                <?php echo '"'._("Realm is not registered with the eduroam database:").'"'; ?> +
651 651
                                 '</td><td>' + realm + '</td></tr>');
652 652
                         $('#admin_realm').val('');
653 653
                     }    
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
         testSociopath('', answer);
672 672
     });
673 673
     $('#realmtest').click(function(event){
674
-        var comment = <?php echo '"<br><br>' . _("Running realm tests") . '..."'; ?>;
674
+        var comment = <?php echo '"<br><br>'._("Running realm tests").'..."'; ?>;
675 675
         inProgress(1, comment);
676 676
         $('#start_test_area').hide();
677 677
         if ($('#select_sp_area').is(':hidden')) {
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
                         reset_footer();
720 720
                         testSociopath(realm, 0);
721 721
                     } else {
722
-                        var title = <?php echo '"' . _("Diagnostics results for selected realms") . '"'; ?>;
723
-                        result = '<div class="padding"><h3>' + <?php echo '"' . _("An unknown problem occured") . '"'; ?>;
722
+                        var title = <?php echo '"'._("Diagnostics results for selected realms").'"'; ?>;
723
+                        result = '<div class="padding"><h3>' + <?php echo '"'._("An unknown problem occured").'"'; ?>;
724 724
                         result = result + '</h3>'
725 725
                         if (r.length == 1) {
726
-                            result = result + <?php echo '"' . _("This test includes checking of the following realm") . '"'; ?>;
726
+                            result = result + <?php echo '"'._("This test includes checking of the following realm").'"'; ?>;
727 727
                         } else {    
728
-                            result = result + <?php echo '"' . _("This test includes checking of the following realms") . '"'; ?>;
728
+                            result = result + <?php echo '"'._("This test includes checking of the following realms").'"'; ?>;
729 729
                         }
730 730
                         result = result + ': '
731 731
                         for (var i=0; i < r.length; i++) {
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
                             result = result + r[i];
736 736
                         }
737 737
                         result = result + '.<br>';
738
-                        result = result + <?php echo '"' . _("You should report this to") . '"'; ?> + ' <a href="mailto:[email protected]">[email protected]</a>';
738
+                        result = result + <?php echo '"'._("You should report this to").'"'; ?> + ' <a href="mailto:[email protected]">[email protected]</a>';
739 739
                         result = result + '</div>';
740 740
                         $('#after_stage_1').hide();
741 741
                         $('#before_stage_1').show();
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
                 });
789 789
             });
790 790
         });
791
-        var comment = <?php echo '"' . _("Running realm tests") . '..."'; ?>;
791
+        var comment = <?php echo '"'._("Running realm tests").'..."'; ?>;
792 792
         inProgress(1, comment);
793 793
         $.ajax({
794 794
             url: "findRealm.php",
@@ -859,29 +859,29 @@  discard block
 block discarded – undo
859 859
             success:function(data) {
860 860
                 if (data.status === 1) {
861 861
                     var result = '';
862
-                    var title = <?php echo '"' . _("eduroam admin report submission") . '"'; ?>;
862
+                    var title = <?php echo '"'._("eduroam admin report submission").'"'; ?>;
863 863
                     result = '<div class="padding">';
864 864
                     if (type == 'idp_send') {
865
-                        result = result + '<h3>'+ <?php echo '"' . _("SP contacting IdP due to technical problems or abuse") . '"'; ?> + '</h3>';
865
+                        result = result + '<h3>'+ <?php echo '"'._("SP contacting IdP due to technical problems or abuse").'"'; ?> + '</h3>';
866 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>';
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 873
                     }
874 874
                     if (type == 'sp_send') {
875
-                        result = result + '<h3>'+ <?php echo '"' . _("IdP contacting SP due to technical problems or abuse") . '"'; ?> + '</h3>';
875
+                        result = result + '<h3>'+ <?php echo '"'._("IdP contacting SP due to technical problems or abuse").'"'; ?> + '</h3>';
876 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>';
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 885
                     }
886 886
                     result = result + '</div>';
887 887
                     showInfo(result, title);
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
         if ($('#mac').val().length > 0) {
899 899
             if ($('#mac').val().length != 17) {
900 900
                 $('#mac').addClass('error_input');
901
-                $('#mac').attr('title', <?php echo '"' . _("MAC address is incomplete") . '"'; ?>);
901
+                $('#mac').attr('title', <?php echo '"'._("MAC address is incomplete").'"'; ?>);
902 902
             } else {
903 903
                 $('#mac').removeClass('error_input'); 
904 904
                 $('#mac').attr('title', '');
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
         if ($(this).attr('id') == 'email' &&  $(this).val().length > 0) {
908 908
             if (!isEmail($(this).val())) {
909 909
                 $('#email').addClass('error_input');
910
-                $('#email').attr('title', <?php echo '"' . _("Wrong format of email") . '"'; ?>);
910
+                $('#email').attr('title', <?php echo '"'._("Wrong format of email").'"'; ?>);
911 911
             } else {
912 912
                 $('#email').removeClass('error_input');
913 913
                 $('#email').attr('title', '');
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
         if ($(this).attr('id') == 'outer_id' &&  $(this).val().length > 0) {
917 917
             if (!isEmail($(this).val(), true)) {
918 918
                 $('#outer_id').addClass('error_input');
919
-                $('#outer_id').attr('title', <?php echo '"' . _("Wrong format of outer ID") . '"'; ?>);
919
+                $('#outer_id').attr('title', <?php echo '"'._("Wrong format of outer ID").'"'; ?>);
920 920
             } else {
921 921
                 $('#outer_id').removeClass('error_input');
922 922
                 $('#outer_id').attr('title', '');
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
         if ($(this).attr('id') == 'opname' && $('#opname').val().length > 0) {
926 926
             if (!isOperatorName($(this).val())) {
927 927
                 $('#opname').addClass('error_input');
928
-                $('#opname').attr('title', <?php echo '"' . _("Wrong string given as OperatorName") . '"'; ?>);
928
+                $('#opname').attr('title', <?php echo '"'._("Wrong string given as OperatorName").'"'; ?>);
929 929
                 $('#spmanually').show();
930 930
             } else {
931 931
                 $('#opname').removeClass('error_input');
Please login to merge, or discard this patch.
web/lib/user/TextTemplates.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 const DOWNLOAD_REDIRECT_CONTINUE = 1054;
50 50
 const SB_GO_AWAY = 1060;
51 51
 const SB_FRONTPAGE_BIGDOWNLOADBUTTON = 1061;
52
-const SB_FRONTPAGE_ROLLER_CUSTOMBUILT= 1062;
52
+const SB_FRONTPAGE_ROLLER_CUSTOMBUILT = 1062;
53 53
 
54 54
 
55 55
 /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $this->templates[WELCOME_ABOARD_BACKTODOWNLOADS] = _("Back to downloads");
89 89
         $this->templates[EDUROAM_WELCOME_ADVERTISING] = sprintf(_("we would like to warmly welcome you among the several million users of %s! From now on, you will be able to use internet access resources on thousands of universities, research centres and other places all over the globe. All of this completely free of charge!"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
90 90
         $this->templates[HEADING_TOPLEVEL_GREET] = sprintf(_("Welcome to %s"), CONFIG['APPEARANCE']['productname']);
91
-        $this->templates[HEADING_TOPLEVEL_PURPOSE] = sprintf(_("Connect your device to %s"),CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
91
+        $this->templates[HEADING_TOPLEVEL_PURPOSE] = sprintf(_("Connect your device to %s"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
92 92
         $this->templates[FRONTPAGE_ROLLER_EASY] = sprintf(_("%s installation made easy:"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
93 93
         $this->templates[FRONTPAGE_ROLLER_CUSTOMBUILT] = _("Custom built for your organisation");
94 94
         $this->templates[FRONTPAGE_BIGDOWNLOADBUTTON] = sprintf(_("Click here to download your %s installer"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
Please login to merge, or discard this patch.