Rev 279 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 279 | Rev 281 | ||
---|---|---|---|
Line 156... | Line 156... | ||
156 | } |
156 | } |
157 | 157 | ||
158 | public function gui($id, &$out, &$handled) { |
158 | public function gui($id, &$out, &$handled) { |
159 | if (explode('$',$id)[0] == 'oidplus:change_ra_email') { |
159 | if (explode('$',$id)[0] == 'oidplus:change_ra_email') { |
160 | $handled = true; |
160 | $handled = true; |
- | 161 | ||
- | 162 | $ra_email = explode('$',$id)[1]; |
|
- | 163 | ||
161 | $out['title'] = 'Change RA email'; |
164 | $out['title'] = 'Change RA email'; |
162 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
165 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
163 | 166 | ||
- | 167 | if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) { |
|
164 | $ra_email = explode('$',$id)[1]; |
168 | $out['icon'] = 'img/error_big.png'; |
- | 169 | $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b> or as admin.</p>'; |
|
- | 170 | return; |
|
- | 171 | } |
|
165 | 172 | ||
166 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
173 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
167 | if ($res->num_rows() == 0) { |
174 | if ($res->num_rows() == 0) { |
168 | $out['icon'] = 'img/error_big.png'; |
175 | $out['icon'] = 'img/error_big.png'; |
169 | $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist'; |
176 | $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist'; |
- | 177 | return; |
|
- | 178 | } |
|
- | 179 | ||
170 | } else if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()::isAdminLoggedIn()) { |
180 | if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()::isAdminLoggedIn()) { |
171 | $out['icon'] = 'img/error_big.png'; |
181 | $out['icon'] = 'img/error_big.png'; |
172 | $out['text'] = '<p>This functionality has been disabled by the administrator.</p>'; |
182 | $out['text'] = '<p>This functionality has been disabled by the administrator.</p>'; |
173 | } else if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) { |
- | |
174 | $out['icon'] = 'img/error_big.png'; |
183 | return; |
175 | $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b> or as admin.</p>'; |
- | |
176 | } else { |
184 | } |
- | 185 | ||
177 | if (OIDplus::authUtils()::isAdminLoggedIn()) { |
186 | if (OIDplus::authUtils()::isAdminLoggedIn()) { |
178 | $out['text'] .= '<form id="changeRaEmailForm" onsubmit="return changeRaEmailFormOnSubmit(true);">'; |
187 | $out['text'] .= '<form id="changeRaEmailForm" onsubmit="return changeRaEmailFormOnSubmit(true);">'; |
179 | $out['text'] .= '<input type="hidden" id="old_email" value="'.htmlentities($ra_email).'"/><br>'; |
188 | $out['text'] .= '<input type="hidden" id="old_email" value="'.htmlentities($ra_email).'"/><br>'; |
180 | $out['text'] .= '<div><label class="padding_label">Old address:</label><b>'.htmlentities($ra_email).'</b></div>'; |
189 | $out['text'] .= '<div><label class="padding_label">Old address:</label><b>'.htmlentities($ra_email).'</b></div>'; |
181 | $out['text'] .= '<div><label class="padding_label">New address:</label><input type="text" id="new_email" value=""/></div>'; |
190 | $out['text'] .= '<div><label class="padding_label">New address:</label><input type="text" id="new_email" value=""/></div>'; |
Line 185... | Line 194... | ||
185 | $out['text'] .= '<input type="hidden" id="old_email" value="'.htmlentities($ra_email).'"/><br>'; |
194 | $out['text'] .= '<input type="hidden" id="old_email" value="'.htmlentities($ra_email).'"/><br>'; |
186 | $out['text'] .= '<div><label class="padding_label">Old address:</label><b>'.htmlentities($ra_email).'</b></div>'; |
195 | $out['text'] .= '<div><label class="padding_label">Old address:</label><b>'.htmlentities($ra_email).'</b></div>'; |
187 | $out['text'] .= '<div><label class="padding_label">New address:</label><input type="text" id="new_email" value=""/></div>'; |
196 | $out['text'] .= '<div><label class="padding_label">New address:</label><input type="text" id="new_email" value=""/></div>'; |
188 | $out['text'] .= '<br><input type="submit" value="Send new activation email"></form>'; |
197 | $out['text'] .= '<br><input type="submit" value="Send new activation email"></form>'; |
189 | } |
198 | } |
190 | } |
- | |
191 | } else if (explode('$',$id)[0] == 'oidplus:activate_new_ra_email') { |
199 | } else if (explode('$',$id)[0] == 'oidplus:activate_new_ra_email') { |
192 | $handled = true; |
200 | $handled = true; |
193 | 201 | ||
194 | $old_email = explode('$',$id)[1]; |
202 | $old_email = explode('$',$id)[1]; |
195 | $new_email = explode('$',$id)[2]; |
203 | $new_email = explode('$',$id)[2]; |
Line 197... | Line 205... | ||
197 | $auth = explode('$',$id)[4]; |
205 | $auth = explode('$',$id)[4]; |
198 | 206 | ||
199 | if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()::isAdminLoggedIn()) { |
207 | if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()::isAdminLoggedIn()) { |
200 | $out['icon'] = 'img/error_big.png'; |
208 | $out['icon'] = 'img/error_big.png'; |
201 | $out['text'] = '<p>This functionality has been disabled by the administrator.</p>'; |
209 | $out['text'] = '<p>This functionality has been disabled by the administrator.</p>'; |
202 | } else { |
210 | return; |
- | 211 | } |
|
- | 212 | ||
203 | $out['title'] = 'Perform email address change'; |
213 | $out['title'] = 'Perform email address change'; |
204 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
214 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
205 | 215 | ||
206 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($old_email)); |
216 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($old_email)); |
207 | if ($res->num_rows() == 0) { |
217 | if ($res->num_rows() == 0) { |
Line 232... | Line 242... | ||
232 | } |
242 | } |
233 | } |
243 | } |
234 | } |
244 | } |
235 | } |
245 | } |
236 | } |
246 | } |
237 | } |
- | |
238 | 247 | ||
239 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
248 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
- | 249 | if (!$ra_email) return false; |
|
- | 250 | if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) return false; |
|
- | 251 | ||
240 | if (file_exists(__DIR__.'/treeicon.png')) { |
252 | if (file_exists(__DIR__.'/treeicon.png')) { |
241 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
253 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
242 | } else { |
254 | } else { |
243 | $tree_icon = null; // default icon (folder) |
255 | $tree_icon = null; // default icon (folder) |
244 | } |
256 | } |