Subversion Repositories oidplus

Rev

Rev 800 | Rev 978 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 800 Rev 801
Line 81... Line 81...
81
                                return array("status" => 0);
81
                                return array("status" => 0);
82
                        } else {
82
                        } else {
83
                                OIDplus::logger()->log("[INFO]RA($old_email)!+RA($new_email)!", "Requested email address change from '$old_email' to '$new_email'");
83
                                OIDplus::logger()->log("[INFO]RA($old_email)!+RA($new_email)!", "Requested email address change from '$old_email' to '$new_email'");
84
 
84
 
85
                                $timestamp = time();
85
                                $timestamp = time();
86
                                $activate_url = OIDplus::webpath(null,false) . '?goto='.urlencode('oidplus:activate_new_ra_email$'.$old_email.'$'.$new_email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('activate_new_ra_email;'.$old_email.';'.$new_email.';'.$timestamp));
86
                                $activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:activate_new_ra_email$'.$old_email.'$'.$new_email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('activate_new_ra_email;'.$old_email.';'.$new_email.';'.$timestamp));
87
 
87
 
88
                                $message = file_get_contents(__DIR__ . '/change_request_email.tpl');
88
                                $message = file_get_contents(__DIR__ . '/change_request_email.tpl');
89
                                $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,false), $message);
89
                                $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL), $message);
90
                                $message = str_replace('{{SYSTEM_TITLE}}', OIDplus::config()->getValue('system_title'), $message);
90
                                $message = str_replace('{{SYSTEM_TITLE}}', OIDplus::config()->getValue('system_title'), $message);
91
                                $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message);
91
                                $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message);
92
                                $message = str_replace('{{OLD_EMAIL}}', $old_email, $message);
92
                                $message = str_replace('{{OLD_EMAIL}}', $old_email, $message);
93
                                $message = str_replace('{{NEW_EMAIL}}', $new_email, $message);
93
                                $message = str_replace('{{NEW_EMAIL}}', $new_email, $message);
94
                                $message = str_replace('{{ACTIVATE_URL}}', $activate_url, $message);
94
                                $message = str_replace('{{ACTIVATE_URL}}', $activate_url, $message);
Line 165... Line 165...
165
                                OIDplus::authUtils()->raLogin($new_email);
165
                                OIDplus::authUtils()->raLogin($new_email);
166
                        }
166
                        }
167
 
167
 
168
                        // Send email
168
                        // Send email
169
                        $message = file_get_contents(__DIR__ . '/email_change_confirmation.tpl');
169
                        $message = file_get_contents(__DIR__ . '/email_change_confirmation.tpl');
170
                        $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,false), $message);
170
                        $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL), $message);
171
                        $message = str_replace('{{SYSTEM_TITLE}}', OIDplus::config()->getValue('system_title'), $message);
171
                        $message = str_replace('{{SYSTEM_TITLE}}', OIDplus::config()->getValue('system_title'), $message);
172
                        $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message);
172
                        $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message);
173
                        $message = str_replace('{{OLD_EMAIL}}', $old_email, $message);
173
                        $message = str_replace('{{OLD_EMAIL}}', $old_email, $message);
174
                        $message = str_replace('{{NEW_EMAIL}}', $new_email, $message);
174
                        $message = str_replace('{{NEW_EMAIL}}', $new_email, $message);
175
                        OIDplus::mailUtils()->sendMail($old_email, OIDplus::config()->getValue('system_title').' - eMail address changed', $message);
175
                        OIDplus::mailUtils()->sendMail($old_email, OIDplus::config()->getValue('system_title').' - eMail address changed', $message);
Line 198... Line 198...
198
                        $handled = true;
198
                        $handled = true;
199
 
199
 
200
                        $ra_email = explode('$',$id)[1];
200
                        $ra_email = explode('$',$id)[1];
201
 
201
 
202
                        $out['title'] = _L('Change RA email');
202
                        $out['title'] = _L('Change RA email');
203
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,true).'img/main_icon.png' : '';
203
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
204
 
204
 
205
                        if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) {
205
                        if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) {
206
                                $out['icon'] = 'img/error.png';
206
                                $out['icon'] = 'img/error.png';
207
                                $out['text'] = '<p>'._L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>').'</p>';
207
                                $out['text'] = '<p>'._L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>').'</p>';
208
                                return;
208
                                return;
Line 257... Line 257...
257
                        $new_email = explode('$',$id)[2];
257
                        $new_email = explode('$',$id)[2];
258
                        $timestamp = explode('$',$id)[3];
258
                        $timestamp = explode('$',$id)[3];
259
                        $auth = explode('$',$id)[4];
259
                        $auth = explode('$',$id)[4];
260
 
260
 
261
                        $out['title'] = _L('Perform email address change');
261
                        $out['title'] = _L('Perform email address change');
262
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,true).'img/main_icon.png' : '';
262
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
263
 
263
 
264
                        if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()->isAdminLoggedIn()) {
264
                        if (!OIDplus::config()->getValue('allow_ra_email_change') && !OIDplus::authUtils()->isAdminLoggedIn()) {
265
                                $out['icon'] = 'img/error.png';
265
                                $out['icon'] = 'img/error.png';
266
                                $out['text'] = '<p>'._L('This functionality has been disabled by the administrator.').'</p>';
266
                                $out['text'] = '<p>'._L('This functionality has been disabled by the administrator.').'</p>';
267
                                return;
267
                                return;
Line 309... Line 309...
309
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
309
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
310
                if (!$ra_email) return false;
310
                if (!$ra_email) return false;
311
                if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) return false;
311
                if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) return false;
312
 
312
 
313
                if (file_exists(__DIR__.'/img/main_icon16.png')) {
313
                if (file_exists(__DIR__.'/img/main_icon16.png')) {
314
                        $tree_icon = OIDplus::webpath(__DIR__,true).'img/main_icon16.png';
314
                        $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png';
315
                } else {
315
                } else {
316
                        $tree_icon = null; // default icon (folder)
316
                        $tree_icon = null; // default icon (folder)
317
                }
317
                }
318
 
318
 
319
                $json[] = array(
319
                $json[] = array(