Passed
Push — master ( 56c883...f703ed )
by Maja
04:39
created
web/admin/inc/manageAdmins.inc.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -97,14 +97,14 @@
 block discarded – undo
97 97
         case "SUCCESS":
98 98
             $cryptText = "";
99 99
             switch ($_GET['transportsecurity']) {
100
-            case "ENCRYPTED":
101
-                $cryptText = _("and <b>encrypted</b> to the mail domain");
102
-                break;
103
-            case "CLEAR":
104
-                $cryptText = _("but <b>in clear text</b> to the mail domain");
105
-                break;
106
-            default:
107
-                throw new Exception("Error: unknown encryption status of invitation!?!");
100
+                case "ENCRYPTED":
101
+                    $cryptText = _("and <b>encrypted</b> to the mail domain");
102
+                    break;
103
+                case "CLEAR":
104
+                    $cryptText = _("but <b>in clear text</b> to the mail domain");
105
+                    break;
106
+                default:
107
+                    throw new Exception("Error: unknown encryption status of invitation!?!");
108 108
             }
109 109
             echo $uiElements->boxRemark(sprintf(_("The invitation email was sent successfully %s."), $cryptText), _("The invitation email was sent."));
110 110
             break;
Please login to merge, or discard this patch.
web/admin/inc/sendinvite.inc.php 1 patch
Switch Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -77,90 +77,90 @@
 block discarded – undo
77 77
 }
78 78
 
79 79
 switch ($operationMode) {
80
-    case OPERATION_MODE_EDIT:
81
-        $idp = $validator->IdP($_GET['inst_id']);
82
-        // editing IdPs is done from within the popup. When we're done, send the 
83
-        // user back to the popup (append the result of the operation later)
84
-        $redirect_destination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&";
85
-        $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
86
-        // is the user admin of this IdP?
87
-        $is_owner = FALSE;
88
-        $owners = $idp->owner();
89
-        foreach ($owners as $oneowner) {
90
-            if ($oneowner['ID'] == $_SESSION['user'] && $oneowner['LEVEL'] == "FED") {
91
-                $is_owner = TRUE;
80
+        case OPERATION_MODE_EDIT:
81
+            $idp = $validator->IdP($_GET['inst_id']);
82
+            // editing IdPs is done from within the popup. When we're done, send the 
83
+            // user back to the popup (append the result of the operation later)
84
+            $redirect_destination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&";
85
+            $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
86
+            // is the user admin of this IdP?
87
+            $is_owner = FALSE;
88
+            $owners = $idp->owner();
89
+            foreach ($owners as $oneowner) {
90
+                if ($oneowner['ID'] == $_SESSION['user'] && $oneowner['LEVEL'] == "FED") {
91
+                    $is_owner = TRUE;
92
+                }
93
+            }
94
+            // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then.
95
+            $fedadmin = $userObject->isFederationAdmin($idp->federation);
96
+            // check if he is either one, if not, complain
97
+            if (!$is_owner && !$fedadmin) {
98
+                echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclature_fed, $uiElements->nomenclature_fed, $uiElements->nomenclature_inst) . "</p>";
99
+                exit(1);
92 100
             }
93
-        }
94
-        // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then.
95
-        $fedadmin = $userObject->isFederationAdmin($idp->federation);
96
-        // check if he is either one, if not, complain
97
-        if (!$is_owner && !$fedadmin) {
98
-            echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclature_fed, $uiElements->nomenclature_fed, $uiElements->nomenclature_inst) . "</p>";
99
-            exit(1);
100
-        }
101 101
 
102
-        $prettyprintname = $idp->name;
103
-        $newtoken = $mgmt->createToken($fedadmin, $mailaddress, $idp);
104
-        $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . $mailaddress);
105
-        $introtext = sprintf(_("a %s of the %s %s \"%s\" has invited you to manage the %s together with him."), $uiElements->nomenclature_fed, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_inst, $prettyprintname, $uiElements->nomenclature_inst) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
106
-        break;
107
-    case OPERATION_MODE_NEWUNLINKED:
108
-        $redirect_destination = "../overview_federation.php?";
109
-        $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
110
-        // run an input check and conversion of the raw inputs... just in case
111
-        $newinstname = $validator->string($_POST['name']);
112
-        $newcountry = $validator->string($_POST['country']);
113
-        $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry);
114
-        if ($new_idp_authorized_fedadmin !== TRUE) {
115
-            throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!");
116
-        }
117
-        $federation = $validator->Federation($newcountry);
118
-        $prettyprintname = $newinstname;
119
-        $introtext = sprintf(_("a %s %s has invited you to manage the future %s  \"%s\" (%s)."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname, $newcountry) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
120
-        // send the user back to his federation overview page, append the result of the operation later
121
-        // do the token creation magic
122
-        $newtoken = $mgmt->createToken(TRUE, $mailaddress, $newinstname, 0, $newcountry);
123
-        $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE  - Token created for " . $mailaddress);
124
-        break;
125
-    case OPERATION_MODE_NEWFROMDB:
126
-        $redirect_destination = "../overview_federation.php?";
127
-        $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
128
-        // a real external DB entry was submitted and all the required parameters are there
129
-        $newexternalid = $validator->string($_POST['externals']);
130
-        $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid);
131
-        $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']);
132
-        if ($new_idp_authorized_fedadmin !== TRUE) {
133
-            throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!");
134
-        }
135
-        $federation = $validator->Federation($extinfo['country']);
136
-        $newcountry = $extinfo['country'];
137
-        // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list
138
-        $prettyprintname = "";
139
-        foreach ($extinfo['names'] as $lang => $name) {
140
-            if ($lang == $languageInstance->getLang()) {
141
-                $prettyprintname = $name;
102
+            $prettyprintname = $idp->name;
103
+            $newtoken = $mgmt->createToken($fedadmin, $mailaddress, $idp);
104
+            $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . $mailaddress);
105
+            $introtext = sprintf(_("a %s of the %s %s \"%s\" has invited you to manage the %s together with him."), $uiElements->nomenclature_fed, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_inst, $prettyprintname, $uiElements->nomenclature_inst) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
106
+            break;
107
+        case OPERATION_MODE_NEWUNLINKED:
108
+            $redirect_destination = "../overview_federation.php?";
109
+            $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
110
+            // run an input check and conversion of the raw inputs... just in case
111
+            $newinstname = $validator->string($_POST['name']);
112
+            $newcountry = $validator->string($_POST['country']);
113
+            $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry);
114
+            if ($new_idp_authorized_fedadmin !== TRUE) {
115
+                throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!");
142 116
             }
143
-        }
144
-        if ($prettyprintname == "" && isset($extinfo['names']['en'])) {
145
-            $prettyprintname = $extinfo['names']['en'];
146
-        }
147
-        if ($prettyprintname == "") {
148
-            foreach ($extinfo['names'] as $name) {
149
-                $prettyprintname = $name;
117
+            $federation = $validator->Federation($newcountry);
118
+            $prettyprintname = $newinstname;
119
+            $introtext = sprintf(_("a %s %s has invited you to manage the future %s  \"%s\" (%s)."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname, $newcountry) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
120
+            // send the user back to his federation overview page, append the result of the operation later
121
+            // do the token creation magic
122
+            $newtoken = $mgmt->createToken(TRUE, $mailaddress, $newinstname, 0, $newcountry);
123
+            $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE  - Token created for " . $mailaddress);
124
+            break;
125
+        case OPERATION_MODE_NEWFROMDB:
126
+            $redirect_destination = "../overview_federation.php?";
127
+            $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
128
+            // a real external DB entry was submitted and all the required parameters are there
129
+            $newexternalid = $validator->string($_POST['externals']);
130
+            $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid);
131
+            $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']);
132
+            if ($new_idp_authorized_fedadmin !== TRUE) {
133
+                throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!");
150 134
             }
151
-        }
152
-        // fill the rest of the text
153
-        $introtext = sprintf(_("a %s %s has invited you to manage the %s  \"%s\"."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
154
-        // do the token creation magic
155
-        $newtoken = $mgmt->createToken(TRUE, $mailaddress, $prettyprintname, $newexternalid);
156
-        $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE  - Token created for " . $mailaddress);
157
-        break;
158
-    default: // includes OPERATION_MODE_INVALID
159
-        $wrongcontent = print_r($_POST, TRUE);
160
-        echo "<pre>Wrong parameters in POST:
135
+            $federation = $validator->Federation($extinfo['country']);
136
+            $newcountry = $extinfo['country'];
137
+            // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list
138
+            $prettyprintname = "";
139
+            foreach ($extinfo['names'] as $lang => $name) {
140
+                if ($lang == $languageInstance->getLang()) {
141
+                    $prettyprintname = $name;
142
+                }
143
+            }
144
+            if ($prettyprintname == "" && isset($extinfo['names']['en'])) {
145
+                $prettyprintname = $extinfo['names']['en'];
146
+            }
147
+            if ($prettyprintname == "") {
148
+                foreach ($extinfo['names'] as $name) {
149
+                    $prettyprintname = $name;
150
+                }
151
+            }
152
+            // fill the rest of the text
153
+            $introtext = sprintf(_("a %s %s has invited you to manage the %s  \"%s\"."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
154
+            // do the token creation magic
155
+            $newtoken = $mgmt->createToken(TRUE, $mailaddress, $prettyprintname, $newexternalid);
156
+            $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE  - Token created for " . $mailaddress);
157
+            break;
158
+        default: // includes OPERATION_MODE_INVALID
159
+            $wrongcontent = print_r($_POST, TRUE);
160
+            echo "<pre>Wrong parameters in POST:
161 161
 " . htmlspecialchars($wrongcontent) . "
162 162
 </pre>";
163
-        exit(1);
163
+            exit(1);
164 164
 }
165 165
 // are we on https?
166 166
 $proto = "http://";
Please login to merge, or discard this patch.
web/admin/action_enrollment.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@
 block discarded – undo
53 53
 }
54 54
 
55 55
 switch ($_GET['token']) {
56
-    case "SELF-REGISTER":
57
-        $token = "SELF-REGISTER";
58
-        $checkval = \core\UserManagement::TOKENSTATUS_OK_NEW;
59
-        $federation = CONFIG_CONFASSISTANT['CONSORTIUM']['selfservice_registration'];
60
-        break;
61
-    default:
62
-        $token = $validator->token(filter_input(INPUT_GET,'token',FILTER_SANITIZE_STRING));
63
-        $checkval = $usermgmt->checkTokenValidity($token);
56
+        case "SELF-REGISTER":
57
+            $token = "SELF-REGISTER";
58
+            $checkval = \core\UserManagement::TOKENSTATUS_OK_NEW;
59
+            $federation = CONFIG_CONFASSISTANT['CONSORTIUM']['selfservice_registration'];
60
+            break;
61
+        default:
62
+            $token = $validator->token(filter_input(INPUT_GET,'token',FILTER_SANITIZE_STRING));
63
+            $checkval = $usermgmt->checkTokenValidity($token);
64 64
 }
65 65
 
66 66
 if ($checkval < 0) {
Please login to merge, or discard this patch.