Subversion Repositories oidplus

Rev

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

Rev 1266 Rev 1267
Line 72... Line 72...
72
 
72
 
73
                                $ra = new OIDplusRA($old_email);
73
                                $ra = new OIDplusRA($old_email);
74
 
74
 
75
                                // Change RA email
75
                                // Change RA email
76
                                $ra->change_email($new_email);
76
                                $ra->change_email($new_email);
77
                                OIDplus::logger()->log("[WARN]RA(%1)!+[INFO]RA(%2)!+[OK]A!", "Admin changed email address '%1' to '%2'", $old_email, $new_email);
77
                                OIDplus::logger()->log("V2:[WARN]RA(%1)+[INFO]RA(%2)+[OK]A", "Admin changed email address '%1' to '%2'", $old_email, $new_email);
78
 
78
 
79
                                // Change objects
79
                                // Change objects
80
                                $res = OIDplus::db()->query("select id from ###objects where ra_email = ?", array($old_email));
80
                                $res = OIDplus::db()->query("select id from ###objects where ra_email = ?", array($old_email));
81
                                while ($row = $res->fetch_array()) {
81
                                while ($row = $res->fetch_array()) {
82
                                        OIDplus::logger()->log("[INFO]OID(%1)+SUPOID(%1)", "Admin changed email address of RA '%2' (owner of %1) to '%3'", $row['id'], $old_email, $new_email);
82
                                        OIDplus::logger()->log("V2:[INFO]OID(%1)+SUPOID(%1)", "Admin changed email address of RA '%2' (owner of %1) to '%3'", $row['id'], $old_email, $new_email);
83
                                }
83
                                }
84
                                OIDplus::db()->query("update ###objects set ra_email = ? where ra_email = ?", array($new_email, $old_email));
84
                                OIDplus::db()->query("update ###objects set ra_email = ? where ra_email = ?", array($new_email, $old_email));
85
                                OIDplusObject::resetObjectInformationCache();
85
                                OIDplusObject::resetObjectInformationCache();
86
 
86
 
87
                                // Re-login
87
                                // Re-login
Line 90... Line 90...
90
                                        OIDplus::authUtils()->raLogin($new_email);
90
                                        OIDplus::authUtils()->raLogin($new_email);
91
                                }
91
                                }
92
 
92
 
93
                                return array("status" => 0);
93
                                return array("status" => 0);
94
                        } else {
94
                        } else {
95
                                OIDplus::logger()->log("[INFO]RA(%1)!+RA(%2)!", "Requested email address change from '%1' to '%2'", $old_email, $new_email);
95
                                OIDplus::logger()->log("V2:[INFO]RA(%1)+RA(%2)", "Requested email address change from '%1' to '%2'", $old_email, $new_email);
96
 
96
 
97
                                $timestamp = time();
97
                                $timestamp = time();
98
                                $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));
98
                                $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));
99
 
99
 
100
                                $message = file_get_contents(__DIR__ . '/change_request_email.tpl');
100
                                $message = file_get_contents(__DIR__ . '/change_request_email.tpl');
Line 160... Line 160...
160
                                }
160
                                }
161
                        }
161
                        }
162
 
162
 
163
                        // Change address of RA
163
                        // Change address of RA
164
                        $ra->change_email($new_email);
164
                        $ra->change_email($new_email);
165
                        OIDplus::logger()->log("[OK]RA(%2)!+RA(%1)!", "RA '%1' has changed their email address to '%2'", $old_email, $new_email);
165
                        OIDplus::logger()->log("V2:[OK]RA(%2)+RA(%1)", "RA '%1' has changed their email address to '%2'", $old_email, $new_email);
166
 
166
 
167
                        // Change objects
167
                        // Change objects
168
                        $res = OIDplus::db()->query("select id from ###objects where ra_email = ?", array($old_email));
168
                        $res = OIDplus::db()->query("select id from ###objects where ra_email = ?", array($old_email));
169
                        while ($row = $res->fetch_array()) {
169
                        while ($row = $res->fetch_array()) {
170
                                OIDplus::logger()->log("[INFO]OID(%1)+SUPOID(%1)", "RA '%2' (owner of %1) has changed their email address to '%3'", $row['id'], $old_email, $new_email);
170
                                OIDplus::logger()->log("V2:[INFO]OID(%1)+SUPOID(%1)", "RA '%2' (owner of %1) has changed their email address to '%3'", $row['id'], $old_email, $new_email);
171
                        }
171
                        }
172
                        OIDplus::db()->query("update ###objects set ra_email = ? where ra_email = ?", array($new_email, $old_email));
172
                        OIDplus::db()->query("update ###objects set ra_email = ? where ra_email = ?", array($new_email, $old_email));
173
                        OIDplusObject::resetObjectInformationCache();
173
                        OIDplusObject::resetObjectInformationCache();
174
 
174
 
175
                        // Re-login
175
                        // Re-login