@@ 24-78 (lines=55) @@ | ||
21 | elgg_load_library('c_ext_lib'); |
|
22 | $isValid = false; |
|
23 | ||
24 | if ($v) { |
|
25 | // cyu - check if the email is in the list of exceptions |
|
26 | $user_email = explode('@',$v); |
|
27 | $list_of_domains = getExtension(); |
|
28 | ||
29 | if( elgg_is_active_plugin('c_email_extensions') ){ |
|
30 | // Checks against the domain manager list... |
|
31 | $wildcard_query = "SELECT ext FROM email_extensions WHERE ext LIKE '%*%'"; |
|
32 | $wildcard_emails = get_data($wildcard_query); |
|
33 | ||
34 | if( $wildcard_emails ){ |
|
35 | foreach($wildcard_emails as $wildcard){ |
|
36 | $regex = str_replace(".", "\.", $wildcard->ext); |
|
37 | $regex = str_replace("*", "[\w-.]+", $regex); |
|
38 | $regex = "/^@" . $regex . "$/"; |
|
39 | if(preg_match($regex, "@".$user_email[1]) || strtolower(str_replace("*.", "", $wildcard->ext)) == strtolower($user_email[1])){ |
|
40 | $isValid = true; |
|
41 | break; |
|
42 | } |
|
43 | } |
|
44 | } |
|
45 | } |
|
46 | ||
47 | if( elgg_is_active_plugin('gcRegistration_invitation') ){ |
|
48 | // Checks against the email invitation list... |
|
49 | $invitation_query = "SELECT email FROM email_invitations WHERE email = '{$email}'"; |
|
50 | $result = get_data($invitation_query); |
|
51 | ||
52 | if( count($result) > 0 ) |
|
53 | $isValid = true; |
|
54 | } |
|
55 | ||
56 | if (count($list_of_domains) > 0) { |
|
57 | while ($row = mysqli_fetch_array($list_of_domains)) { |
|
58 | if (strtolower($row['ext']) === strtolower($user_email[1])) { |
|
59 | $isValid = true; |
|
60 | break; |
|
61 | } |
|
62 | } |
|
63 | $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
64 | } |
|
65 | ||
66 | // cyu - check if domain is gc.ca |
|
67 | if (!$isValid) { |
|
68 | $govt_domain = explode('.',$user_email[1]); |
|
69 | $govt_domain_len = count($govt_domain) - 1; |
|
70 | ||
71 | if ($govt_domain[$govt_domain_len - 1].'.'.$govt_domain[$govt_domain_len] === 'gc.ca') { |
|
72 | $isValid = true; |
|
73 | } else { |
|
74 | $isValid = false; |
|
75 | $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
76 | } |
|
77 | } |
|
78 | } |
|
79 | ||
80 | if (!$isValid) { |
|
81 | prepare_email_change($user_guid, $v); |
@@ 116-170 (lines=55) @@ | ||
113 | elgg_load_library('c_ext_lib'); |
|
114 | $isValid = false; |
|
115 | ||
116 | if ($email) { |
|
117 | // cyu - check if the email is in the list of exceptions |
|
118 | $user_email = explode('@',$email); |
|
119 | $list_of_domains = getExtension(); |
|
120 | ||
121 | if( elgg_is_active_plugin('c_email_extensions') ){ |
|
122 | // Checks against the domain manager list... |
|
123 | $wildcard_query = "SELECT ext FROM email_extensions WHERE ext LIKE '%*%'"; |
|
124 | $wildcard_emails = get_data($wildcard_query); |
|
125 | ||
126 | if( $wildcard_emails ){ |
|
127 | foreach($wildcard_emails as $wildcard){ |
|
128 | $regex = str_replace(".", "\.", $wildcard->ext); |
|
129 | $regex = str_replace("*", "[\w-.]+", $regex); |
|
130 | $regex = "/^@" . $regex . "$/"; |
|
131 | if(preg_match($regex, "@".$user_email[1]) || strtolower(str_replace("*.", "", $wildcard->ext)) == strtolower($user_email[1])){ |
|
132 | $isValid = true; |
|
133 | break; |
|
134 | } |
|
135 | } |
|
136 | } |
|
137 | } |
|
138 | ||
139 | if( elgg_is_active_plugin('gcRegistration_invitation') ){ |
|
140 | // Checks against the email invitation list... |
|
141 | $invitation_query = "SELECT email FROM email_invitations WHERE email = '{$email}'"; |
|
142 | $result = get_data($invitation_query); |
|
143 | ||
144 | if( count($result) > 0 ) |
|
145 | $isValid = true; |
|
146 | } |
|
147 | ||
148 | if (count($list_of_domains) > 0) { |
|
149 | while ($row = mysqli_fetch_array($list_of_domains)) { |
|
150 | if (strtolower($row['ext']) === strtolower($user_email[1])) { |
|
151 | $isValid = true; |
|
152 | break; |
|
153 | } |
|
154 | } |
|
155 | $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
156 | } |
|
157 | ||
158 | // cyu - check if domain is gc.ca |
|
159 | if (!$isValid) { |
|
160 | $govt_domain = explode('.',$user_email[1]); |
|
161 | $govt_domain_len = count($govt_domain) - 1; |
|
162 | ||
163 | if ($govt_domain[$govt_domain_len - 1].'.'.$govt_domain[$govt_domain_len] === 'gc.ca') { |
|
164 | $isValid = true; |
|
165 | } else { |
|
166 | $isValid = false; |
|
167 | $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
168 | } |
|
169 | } |
|
170 | } |
|
171 | ||
172 | if( !$isValid ){ |
|
173 | if( elgg_is_active_plugin('b_extended_profile_collab') ){ |