Rev 1267 | Rev 1283 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1267 | Rev 1282 | ||
---|---|---|---|
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | /* |
3 | /* |
4 | * OIDplus 2.0 |
4 | * OIDplus 2.0 |
5 | * Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft |
5 | * Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft |
6 | * |
6 | * |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | * you may not use this file except in compliance with the License. |
8 | * you may not use this file except in compliance with the License. |
9 | * You may obtain a copy of the License at |
9 | * You may obtain a copy of the License at |
10 | * |
10 | * |
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
12 | * |
12 | * |
13 | * Unless required by applicable law or agreed to in writing, software |
13 | * Unless required by applicable law or agreed to in writing, software |
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | * See the License for the specific language governing permissions and |
16 | * See the License for the specific language governing permissions and |
17 | * limitations under the License. |
17 | * limitations under the License. |
18 | */ |
18 | */ |
19 | 19 | ||
20 | namespace ViaThinkSoft\OIDplus; |
20 | namespace ViaThinkSoft\OIDplus; |
21 | 21 | ||
22 | // phpcs:disable PSR1.Files.SideEffects |
22 | // phpcs:disable PSR1.Files.SideEffects |
23 | \defined('INSIDE_OIDPLUS') or die; |
23 | \defined('INSIDE_OIDPLUS') or die; |
24 | // phpcs:enable PSR1.Files.SideEffects |
24 | // phpcs:enable PSR1.Files.SideEffects |
25 | 25 | ||
26 | class OIDplusPageRaInvite extends OIDplusPagePluginRa { |
26 | class OIDplusPageRaInvite extends OIDplusPagePluginRa { |
27 | 27 | ||
28 | /** |
28 | /** |
29 | * @param string $actionID |
29 | * @param string $actionID |
30 | * @param array $params |
30 | * @param array $params |
31 | * @return array |
31 | * @return array |
32 | * @throws OIDplusException |
32 | * @throws OIDplusException |
33 | * @throws OIDplusMailException |
33 | * @throws OIDplusMailException |
34 | */ |
34 | */ |
35 | public function action(string $actionID, array $params): array { |
35 | public function action(string $actionID, array $params): array { |
36 | if ($actionID == 'invite_ra') { |
36 | if ($actionID == 'invite_ra') { |
37 | $email = $params['email']; |
37 | $email = $params['email']; |
38 | 38 | ||
39 | if (!OIDplus::mailUtils()->validMailAddress($email)) { |
39 | if (!OIDplus::mailUtils()->validMailAddress($email)) { |
40 | throw new OIDplusException(_L('Invalid email address')); |
40 | throw new OIDplusException(_L('Invalid email address')); |
41 | } |
41 | } |
42 | 42 | ||
43 | OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha'); |
43 | OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha'); |
44 | 44 | ||
45 | $this->inviteSecurityCheck($email); |
45 | $this->inviteSecurityCheck($email); |
46 | // TODO: should we also log who has invited? |
46 | // TODO: should we also log who has invited? |
47 | OIDplus::logger()->log("V2:[INFO]RA(%1)", "RA '%1' has been invited", $email); |
47 | OIDplus::logger()->log("V2:[INFO]RA(%1)", "RA '%1' has been invited", $email); |
48 | 48 | ||
49 | $timestamp = time(); |
49 | $timestamp = time(); |
50 | $activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:activate_ra$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('activate_ra;'.$email.';'.$timestamp)); |
50 | $activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:activate_ra$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('ed840c3e-f4fa-11ed-b67e-3c4a92df8582:'.$email.'/'.$timestamp)); |
51 | 51 | ||
52 | $message = $this->getInvitationText($email); |
52 | $message = $this->getInvitationText($email); |
53 | $message = str_replace('{{ACTIVATE_URL}}', $activate_url, $message); |
53 | $message = str_replace('{{ACTIVATE_URL}}', $activate_url, $message); |
54 | 54 | ||
55 | OIDplus::mailUtils()->sendMail($email, OIDplus::config()->getValue('system_title').' - Invitation', $message); |
55 | OIDplus::mailUtils()->sendMail($email, OIDplus::config()->getValue('system_title').' - Invitation', $message); |
56 | 56 | ||
57 | return array("status" => 0); |
57 | return array("status" => 0); |
58 | 58 | ||
59 | } else if ($actionID == 'activate_ra') { |
59 | } else if ($actionID == 'activate_ra') { |
60 | 60 | ||
61 | _CheckParamExists($params, 'password1'); |
61 | _CheckParamExists($params, 'password1'); |
62 | _CheckParamExists($params, 'password2'); |
62 | _CheckParamExists($params, 'password2'); |
63 | _CheckParamExists($params, 'email'); |
63 | _CheckParamExists($params, 'email'); |
64 | _CheckParamExists($params, 'auth'); |
64 | _CheckParamExists($params, 'auth'); |
65 | _CheckParamExists($params, 'timestamp'); |
65 | _CheckParamExists($params, 'timestamp'); |
66 | 66 | ||
67 | $password1 = $params['password1']; |
67 | $password1 = $params['password1']; |
68 | $password2 = $params['password2']; |
68 | $password2 = $params['password2']; |
69 | $email = $params['email']; |
69 | $email = $params['email']; |
70 | $auth = $params['auth']; |
70 | $auth = $params['auth']; |
71 | $timestamp = $params['timestamp']; |
71 | $timestamp = $params['timestamp']; |
72 | 72 | ||
73 | if (!OIDplus::authUtils()->validateAuthKey('activate_ra;'.$email.';'.$timestamp, $auth)) { |
73 | if (!OIDplus::authUtils()->validateAuthKey('ed840c3e-f4fa-11ed-b67e-3c4a92df8582:'.$email.'/'.$timestamp, $auth)) { |
74 | throw new OIDplusException(_L('Invalid auth key')); |
74 | throw new OIDplusException(_L('Invalid auth key')); |
75 | } |
75 | } |
76 | 76 | ||
77 | if ((OIDplus::config()->getValue('max_ra_invite_time') > 0) && (time()-$timestamp > OIDplus::config()->getValue('max_ra_invite_time'))) { |
77 | if ((OIDplus::config()->getValue('max_ra_invite_time') > 0) && (time()-$timestamp > OIDplus::config()->getValue('max_ra_invite_time'))) { |
78 | throw new OIDplusException(_L('Invitation expired!')); |
78 | throw new OIDplusException(_L('Invitation expired!')); |
79 | } |
79 | } |
80 | 80 | ||
81 | if ($password1 !== $password2) { |
81 | if ($password1 !== $password2) { |
82 | throw new OIDplusException(_L('Passwords do not match')); |
82 | throw new OIDplusException(_L('Passwords do not match')); |
83 | } |
83 | } |
84 | 84 | ||
85 | if (strlen($password1) < OIDplus::config()->getValue('ra_min_password_length')) { |
85 | if (strlen($password1) < OIDplus::config()->getValue('ra_min_password_length')) { |
86 | $minlen = OIDplus::config()->getValue('ra_min_password_length'); |
86 | $minlen = OIDplus::config()->getValue('ra_min_password_length'); |
87 | throw new OIDplusException(_L('Password is too short. Need at least %1 characters',$minlen)); |
87 | throw new OIDplusException(_L('Password is too short. Need at least %1 characters',$minlen)); |
88 | } |
88 | } |
89 | 89 | ||
90 | OIDplus::logger()->log("V2:[OK]RA(%1)", "RA '%1' has been registered due to invitation", $email); |
90 | OIDplus::logger()->log("V2:[OK]RA(%1)", "RA '%1' has been registered due to invitation", $email); |
91 | 91 | ||
92 | $ra = new OIDplusRA($email); |
92 | $ra = new OIDplusRA($email); |
93 | $ra->register_ra($password1); |
93 | $ra->register_ra($password1); |
94 | 94 | ||
95 | return array("status" => 0); |
95 | return array("status" => 0); |
96 | } else { |
96 | } else { |
97 | return parent::action($actionID, $params); |
97 | return parent::action($actionID, $params); |
98 | } |
98 | } |
99 | } |
99 | } |
100 | 100 | ||
101 | /** |
101 | /** |
102 | * @param bool $html |
102 | * @param bool $html |
103 | * @return void |
103 | * @return void |
104 | * @throws OIDplusException |
104 | * @throws OIDplusException |
105 | */ |
105 | */ |
106 | public function init(bool $html=true) { |
106 | public function init(bool $html=true) { |
107 | OIDplus::config()->prepareConfigKey('max_ra_invite_time', 'Max RA invite time in seconds (0 = infinite)', '0', OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
107 | OIDplus::config()->prepareConfigKey('max_ra_invite_time', 'Max RA invite time in seconds (0 = infinite)', '0', OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
108 | if (!is_numeric($value) || ($value < 0)) { |
108 | if (!is_numeric($value) || ($value < 0)) { |
109 | throw new OIDplusException(_L('Please enter a valid value.')); |
109 | throw new OIDplusException(_L('Please enter a valid value.')); |
110 | } |
110 | } |
111 | }); |
111 | }); |
112 | OIDplus::config()->prepareConfigKey('ra_invitation_enabled', 'May RAs be invited? (0=no, 1=yes)', '1', OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
112 | OIDplus::config()->prepareConfigKey('ra_invitation_enabled', 'May RAs be invited? (0=no, 1=yes)', '1', OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
113 | if (($value != 0) && ($value != 1)) { |
113 | if (($value != 0) && ($value != 1)) { |
114 | throw new OIDplusException(_L('Please enter a valid value (0=no, 1=yes).')); |
114 | throw new OIDplusException(_L('Please enter a valid value (0=no, 1=yes).')); |
115 | } |
115 | } |
116 | }); |
116 | }); |
117 | } |
117 | } |
118 | 118 | ||
119 | /** |
119 | /** |
120 | * @param string $id |
120 | * @param string $id |
121 | * @param array $out |
121 | * @param array $out |
122 | * @param bool $handled |
122 | * @param bool $handled |
123 | * @return void |
123 | * @return void |
124 | * @throws OIDplusException |
124 | * @throws OIDplusException |
125 | */ |
125 | */ |
126 | public function gui(string $id, array &$out, bool &$handled) { |
126 | public function gui(string $id, array &$out, bool &$handled) { |
127 | if (explode('$',$id)[0] == 'oidplus:invite_ra') { |
127 | if (explode('$',$id)[0] == 'oidplus:invite_ra') { |
128 | $handled = true; |
128 | $handled = true; |
129 | 129 | ||
130 | $email = explode('$',$id)[1]; |
130 | $email = explode('$',$id)[1]; |
131 | $origin = explode('$',$id)[2]; |
131 | $origin = explode('$',$id)[2]; |
132 | 132 | ||
133 | $out['title'] = _L('Invite a Registration Authority'); |
133 | $out['title'] = _L('Invite a Registration Authority'); |
134 | 134 | ||
135 | if (!OIDplus::config()->getValue('ra_invitation_enabled')) { |
135 | if (!OIDplus::config()->getValue('ra_invitation_enabled')) { |
136 | throw new OIDplusException(_L('Invitations are disabled by the administrator.'), $out['title']); |
136 | throw new OIDplusException(_L('Invitations are disabled by the administrator.'), $out['title']); |
137 | } |
137 | } |
138 | 138 | ||
139 | $out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/invite_icon.png'; |
139 | $out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/invite_icon.png'; |
140 | 140 | ||
141 | try { |
141 | try { |
142 | $this->inviteSecurityCheck($email); |
142 | $this->inviteSecurityCheck($email); |
143 | $cont = $this->getInvitationText($email); |
143 | $cont = $this->getInvitationText($email); |
144 | 144 | ||
145 | $out['text'] .= '<p>'._L('You have chosen to invite %1 as a Registration Authority. If you click "Send", the following email will be sent to %2:','<b>'.$email.'</b>',$email).'</p><p><i>'.nl2br(htmlentities($cont)).'</i></p> |
145 | $out['text'] .= '<p>'._L('You have chosen to invite %1 as a Registration Authority. If you click "Send", the following email will be sent to %2:','<b>'.$email.'</b>',$email).'</p><p><i>'.nl2br(htmlentities($cont)).'</i></p> |
146 | <form id="inviteForm" action="javascript:void(0);" onsubmit="return OIDplusPageRaInvite.inviteFormOnSubmit();"> |
146 | <form id="inviteForm" action="javascript:void(0);" onsubmit="return OIDplusPageRaInvite.inviteFormOnSubmit();"> |
147 | <input type="hidden" id="email" value="'.htmlentities($email).'"/> |
147 | <input type="hidden" id="email" value="'.htmlentities($email).'"/> |
148 | <input type="hidden" id="origin" value="'.htmlentities($origin).'"/> |
148 | <input type="hidden" id="origin" value="'.htmlentities($origin).'"/> |
149 | '.OIDplus::getActiveCaptchaPlugin()->captchaGenerate().' |
149 | '.OIDplus::getActiveCaptchaPlugin()->captchaGenerate().' |
150 | <br> |
150 | <br> |
151 | <input type="submit" value="'._L('Send invitation').'"> |
151 | <input type="submit" value="'._L('Send invitation').'"> |
152 | </form>'; |
152 | </form>'; |
153 | 153 | ||
154 | } catch (\Exception $e) { |
154 | } catch (\Exception $e) { |
155 | 155 | ||
156 | $htmlmsg = $e instanceof OIDplusException ? $e->getHtmlMessage() : htmlentities($e->getMessage()); |
156 | $htmlmsg = $e instanceof OIDplusException ? $e->getHtmlMessage() : htmlentities($e->getMessage()); |
157 | throw new OIDplusHtmlException(_L('Error: %1',$htmlmsg), $out['title']); |
157 | throw new OIDplusHtmlException(_L('Error: %1',$htmlmsg), $out['title']); |
158 | 158 | ||
159 | } |
159 | } |
160 | } else if (explode('$',$id)[0] == 'oidplus:activate_ra') { |
160 | } else if (explode('$',$id)[0] == 'oidplus:activate_ra') { |
161 | $handled = true; |
161 | $handled = true; |
162 | 162 | ||
163 | $email = explode('$',$id)[1]; |
163 | $email = explode('$',$id)[1]; |
164 | $timestamp = explode('$',$id)[2]; |
164 | $timestamp = explode('$',$id)[2]; |
165 | $auth = explode('$',$id)[3]; |
165 | $auth = explode('$',$id)[3]; |
166 | 166 | ||
167 | $out['title'] = _L('Register as Registration Authority'); |
167 | $out['title'] = _L('Register as Registration Authority'); |
168 | 168 | ||
169 | if (!OIDplus::config()->getValue('ra_invitation_enabled')) { |
169 | if (!OIDplus::config()->getValue('ra_invitation_enabled')) { |
170 | throw new OIDplusException(_L('Invitations are disabled by the administrator.'), $out['title']); |
170 | throw new OIDplusException(_L('Invitations are disabled by the administrator.'), $out['title']); |
171 | } |
171 | } |
172 | 172 | ||
173 | $out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/activate_icon.png'; |
173 | $out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/activate_icon.png'; |
174 | 174 | ||
175 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($email)); |
175 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($email)); |
176 | if ($res->any()) { |
176 | if ($res->any()) { |
177 | $out['text'] = _L('This RA is already registered and does not need to be invited.'); |
177 | $out['text'] = _L('This RA is already registered and does not need to be invited.'); |
178 | } else { |
178 | } else { |
179 | if (!OIDplus::authUtils()->validateAuthKey('activate_ra;'.$email.';'.$timestamp, $auth)) { |
179 | if (!OIDplus::authUtils()->validateAuthKey('activate_ra;'.$email.';'.$timestamp, $auth)) { |
180 | throw new OIDplusException(_L('Invalid authorization. Is the URL OK?'), $out['title']); |
180 | throw new OIDplusException(_L('Invalid authorization. Is the URL OK?'), $out['title']); |
181 | } else { |
181 | } else { |
182 | // TODO: like in the FreeOID plugin, we could ask here at least for a name for the RA |
182 | // TODO: like in the FreeOID plugin, we could ask here at least for a name for the RA |
183 | $out['text'] = '<p>'._L('E-Mail-Address').': <b>'.$email.'</b></p> |
183 | $out['text'] = '<p>'._L('E-Mail-Address').': <b>'.$email.'</b></p> |
184 | 184 | ||
185 | <form id="activateRaForm" action="javascript:void(0);" onsubmit="return OIDplusPageRaInvite.activateRaFormOnSubmit();"> |
185 | <form id="activateRaForm" action="javascript:void(0);" onsubmit="return OIDplusPageRaInvite.activateRaFormOnSubmit();"> |
186 | <input type="hidden" id="email" value="'.htmlentities($email).'"/> |
186 | <input type="hidden" id="email" value="'.htmlentities($email).'"/> |
187 | <input type="hidden" id="timestamp" value="'.htmlentities($timestamp).'"/> |
187 | <input type="hidden" id="timestamp" value="'.htmlentities($timestamp).'"/> |
188 | <input type="hidden" id="auth" value="'.htmlentities($auth).'"/> |
188 | <input type="hidden" id="auth" value="'.htmlentities($auth).'"/> |
189 | <div><label class="padding_label">'._L('New password').':</label><input type="password" id="password1" value=""/></div> |
189 | <div><label class="padding_label">'._L('New password').':</label><input type="password" id="password1" value=""/></div> |
190 | <div><label class="padding_label">'._L('Repeat').':</label><input type="password" id="password2" value=""/></div> |
190 | <div><label class="padding_label">'._L('Repeat').':</label><input type="password" id="password2" value=""/></div> |
191 | <br><input type="submit" value="'._L('Register').'"> |
191 | <br><input type="submit" value="'._L('Register').'"> |
192 | </form>'; |
192 | </form>'; |
193 | } |
193 | } |
194 | } |
194 | } |
195 | } |
195 | } |
196 | } |
196 | } |
197 | 197 | ||
198 | /** |
198 | /** |
199 | * @param array $json |
199 | * @param array $json |
200 | * @param string|null $ra_email |
200 | * @param string|null $ra_email |
201 | * @param bool $nonjs |
201 | * @param bool $nonjs |
202 | * @param string $req_goto |
202 | * @param string $req_goto |
203 | * @return bool |
203 | * @return bool |
204 | */ |
204 | */ |
205 | public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool { |
205 | public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool { |
206 | //if (!$ra_email) return false; |
206 | //if (!$ra_email) return false; |
207 | //if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) return false; |
207 | //if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) return false; |
208 | 208 | ||
209 | return false; |
209 | return false; |
210 | } |
210 | } |
211 | 211 | ||
212 | /** |
212 | /** |
213 | * @param string $email |
213 | * @param string $email |
214 | * @return void |
214 | * @return void |
215 | * @throws OIDplusException |
215 | * @throws OIDplusException |
216 | */ |
216 | */ |
217 | private function inviteSecurityCheck(string $email) { |
217 | private function inviteSecurityCheck(string $email) { |
218 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($email)); |
218 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($email)); |
219 | if ($res->any()) { |
219 | if ($res->any()) { |
220 | throw new OIDplusException(_L('This RA is already registered and does not need to be invited.')); |
220 | throw new OIDplusException(_L('This RA is already registered and does not need to be invited.')); |
221 | } |
221 | } |
222 | 222 | ||
223 | if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
223 | if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
224 | // Check if the RA may invite the user (i.e. the they are the parent of an OID of that person) |
224 | // Check if the RA may invite the user (i.e. the they are the parent of an OID of that person) |
225 | $ok = false; |
225 | $ok = false; |
226 | $res = OIDplus::db()->query("select parent from ###objects where ra_email = ?", array($email)); |
226 | $res = OIDplus::db()->query("select parent from ###objects where ra_email = ?", array($email)); |
227 | while ($row = $res->fetch_array()) { |
227 | while ($row = $res->fetch_array()) { |
228 | if (!$row['parent']) continue; |
228 | if (!$row['parent']) continue; |
229 | $objParent = OIDplusObject::parse($row['parent']); |
229 | $objParent = OIDplusObject::parse($row['parent']); |
230 | if (!$objParent) throw new OIDplusException(_L('Type of %1 unknown',$row['parent'])); |
230 | if (!$objParent) throw new OIDplusException(_L('Type of %1 unknown',$row['parent'])); |
231 | if ($objParent->userHasWriteRights()) { |
231 | if ($objParent->userHasWriteRights()) { |
232 | $ok = true; |
232 | $ok = true; |
233 | } |
233 | } |
234 | } |
234 | } |
235 | if (!$ok) { |
235 | if (!$ok) { |
236 | throw new OIDplusHtmlException(_L('You may not invite this RA. Maybe you need to <a %1>log in</a> again.',OIDplus::gui()->link('oidplus:login')), null, 401); |
236 | throw new OIDplusHtmlException(_L('You may not invite this RA. Maybe you need to <a %1>log in</a> again.',OIDplus::gui()->link('oidplus:login')), null, 401); |
237 | } |
237 | } |
238 | } |
238 | } |
239 | } |
239 | } |
240 | 240 | ||
241 | /** |
241 | /** |
242 | * @param string $email |
242 | * @param string $email |
243 | * @return string |
243 | * @return string |
244 | * @throws OIDplusException |
244 | * @throws OIDplusException |
245 | */ |
245 | */ |
246 | private function getInvitationText(string $email): string { |
246 | private function getInvitationText(string $email): string { |
247 | $list_of_oids = array(); |
247 | $list_of_oids = array(); |
248 | $res = OIDplus::db()->query("select id from ###objects where ra_email = ?", array($email)); |
248 | $res = OIDplus::db()->query("select id from ###objects where ra_email = ?", array($email)); |
249 | while ($row = $res->fetch_array()) { |
249 | while ($row = $res->fetch_array()) { |
250 | $list_of_oids[] = $row['id']; |
250 | $list_of_oids[] = $row['id']; |
251 | } |
251 | } |
252 | 252 | ||
253 | $message = file_get_contents(__DIR__ . '/invite_msg.tpl'); |
253 | $message = file_get_contents(__DIR__ . '/invite_msg.tpl'); |
254 | 254 | ||
255 | // Resolve stuff |
255 | // Resolve stuff |
256 | // Note: {{ACTIVATE_URL}} will be resolved in ajax.php |
256 | // Note: {{ACTIVATE_URL}} will be resolved in ajax.php |
257 | 257 | ||
258 | $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL), $message); |
258 | $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL), $message); |
259 | $message = str_replace('{{OID_LIST}}', implode("\n", $list_of_oids), $message); |
259 | $message = str_replace('{{OID_LIST}}', implode("\n", $list_of_oids), $message); |
260 | $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message); |
260 | $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message); |
261 | 261 | ||
262 | return str_replace('{{PARTY}}', OIDplus::authUtils()->isAdminLoggedIn() ? 'the system administrator' : 'a superior Registration Authority', $message); |
262 | return str_replace('{{PARTY}}', OIDplus::authUtils()->isAdminLoggedIn() ? 'the system administrator' : 'a superior Registration Authority', $message); |
263 | } |
263 | } |
264 | 264 | ||
265 | /** |
265 | /** |
266 | * @param string $request |
266 | * @param string $request |
267 | * @return array|false |
267 | * @return array|false |
268 | */ |
268 | */ |
269 | public function tree_search(string $request) { |
269 | public function tree_search(string $request) { |
270 | return false; |
270 | return false; |
271 | } |
271 | } |
272 | } |
272 | } |
273 | 273 |