Rev 800 | Rev 875 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 800 | Rev 801 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | $this->inviteSecurityCheck($email); |
34 | $this->inviteSecurityCheck($email); |
35 | // TODO: should we also log who has invited? |
35 | // TODO: should we also log who has invited? |
36 | OIDplus::logger()->log("[INFO]RA($email)!", "RA '$email' has been invited"); |
36 | OIDplus::logger()->log("[INFO]RA($email)!", "RA '$email' has been invited"); |
37 | 37 | ||
38 | $timestamp = time(); |
38 | $timestamp = time(); |
39 | $activate_url = OIDplus::webpath() . '?goto='.urlencode('oidplus:activate_ra$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('activate_ra;'.$email.';'.$timestamp)); |
39 | $activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:activate_ra$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('activate_ra;'.$email.';'.$timestamp)); |
40 | 40 | ||
41 | $message = $this->getInvitationText($email); |
41 | $message = $this->getInvitationText($email); |
42 | $message = str_replace('{{ACTIVATE_URL}}', $activate_url, $message); |
42 | $message = str_replace('{{ACTIVATE_URL}}', $activate_url, $message); |
43 | 43 | ||
44 | OIDplus::mailUtils()->sendMail($email, OIDplus::config()->getValue('system_title').' - Invitation', $message, OIDplus::config()->getValue('global_cc')); |
44 | OIDplus::mailUtils()->sendMail($email, OIDplus::config()->getValue('system_title').' - Invitation', $message, OIDplus::config()->getValue('global_cc')); |
Line 113... | Line 113... | ||
113 | $out['icon'] = 'img/error.png'; |
113 | $out['icon'] = 'img/error.png'; |
114 | $out['text'] = '<p>'._L('Invitations are disabled by the administrator.').'</p>'; |
114 | $out['text'] = '<p>'._L('Invitations are disabled by the administrator.').'</p>'; |
115 | return; |
115 | return; |
116 | } |
116 | } |
117 | 117 | ||
118 | $out['icon'] = OIDplus::webpath(__DIR__,true).'img/invite_icon.png'; |
118 | $out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/invite_icon.png'; |
119 | 119 | ||
120 | try { |
120 | try { |
121 | $this->inviteSecurityCheck($email); |
121 | $this->inviteSecurityCheck($email); |
122 | $cont = $this->getInvitationText($email); |
122 | $cont = $this->getInvitationText($email); |
123 | 123 | ||
Line 149... | Line 149... | ||
149 | $out['icon'] = 'img/error.png'; |
149 | $out['icon'] = 'img/error.png'; |
150 | $out['text'] = '<p>'._L('Invitations are disabled by the administrator.').'</p>'; |
150 | $out['text'] = '<p>'._L('Invitations are disabled by the administrator.').'</p>'; |
151 | return; |
151 | return; |
152 | } |
152 | } |
153 | 153 | ||
154 | $out['icon'] = OIDplus::webpath(__DIR__,true).'img/activate_icon.png'; |
154 | $out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/activate_icon.png'; |
155 | 155 | ||
156 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($email)); |
156 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($email)); |
157 | if ($res->any()) { |
157 | if ($res->any()) { |
158 | $out['text'] = _L('This RA is already registered and does not need to be invited.'); |
158 | $out['text'] = _L('This RA is already registered and does not need to be invited.'); |
159 | } else { |
159 | } else { |
Line 215... | Line 215... | ||
215 | } |
215 | } |
216 | 216 | ||
217 | $message = file_get_contents(__DIR__ . '/invite_msg.tpl'); |
217 | $message = file_get_contents(__DIR__ . '/invite_msg.tpl'); |
218 | 218 | ||
219 | // Resolve stuff |
219 | // Resolve stuff |
220 | $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,false), $message); |
220 | $message = str_replace('{{SYSTEM_URL}}', OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL), $message); |
221 | $message = str_replace('{{OID_LIST}}', implode("\n", $list_of_oids), $message); |
221 | $message = str_replace('{{OID_LIST}}', implode("\n", $list_of_oids), $message); |
222 | $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message); |
222 | $message = str_replace('{{ADMIN_EMAIL}}', OIDplus::config()->getValue('admin_email'), $message); |
223 | $message = str_replace('{{PARTY}}', OIDplus::authUtils()->isAdminLoggedIn() ? 'the system administrator' : 'a superior Registration Authority', $message); |
223 | $message = str_replace('{{PARTY}}', OIDplus::authUtils()->isAdminLoggedIn() ? 'the system administrator' : 'a superior Registration Authority', $message); |
224 | 224 | ||
225 | // {{ACTIVATE_URL}} will be resolved in ajax.php |
225 | // {{ACTIVATE_URL}} will be resolved in ajax.php |