@@ -214,23 +214,23 @@ discard block |
||
214 | 214 | $c_photo = $_FILES['c_photo']; |
215 | 215 | |
216 | 216 | foreach($c_photo as $c){ |
217 | - $printing_files .= $c .' , '; |
|
217 | + $printing_files .= $c .' , '; |
|
218 | 218 | } |
219 | 219 | if(reset($c_photo) ){ |
220 | - $prefix = "groups_c_photo/" . $group->guid; |
|
220 | + $prefix = "groups_c_photo/" . $group->guid; |
|
221 | 221 | |
222 | - $filehandler2 = new ElggFile(); |
|
222 | + $filehandler2 = new ElggFile(); |
|
223 | 223 | $filehandler2->owner_guid = $group->owner_guid; |
224 | - $filehandler2->container_guid = $group->guid; |
|
225 | - $filehandler2->subtype = 'c_photo'; |
|
224 | + $filehandler2->container_guid = $group->guid; |
|
225 | + $filehandler2->subtype = 'c_photo'; |
|
226 | 226 | $filehandler2->setFilename($prefix . ".jpg"); |
227 | 227 | $filehandler2->open("write"); |
228 | 228 | $filehandler2->write(get_uploaded_file('c_photo')); |
229 | 229 | $filehandler2->close(); |
230 | - $filehandler2->save(); |
|
230 | + $filehandler2->save(); |
|
231 | 231 | |
232 | - $c_photo_guid = $filehandler2->getGUID(); |
|
233 | - $subtype_testing = $filehandler2->getSubtype(); |
|
232 | + $c_photo_guid = $filehandler2->getGUID(); |
|
233 | + $subtype_testing = $filehandler2->getSubtype(); |
|
234 | 234 | $group->cover_photo =$c_photo_guid; //Nick - Set Cover photo metadata |
235 | 235 | }else if(isset($group->cover_photo) && $group->cover_photo !='nope'){ |
236 | 236 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | $remove_c_photo = get_input('remove_photo'); //Nick - Checkbox will set cover photo metadata to 'nope' |
242 | 242 | if($remove_c_photo){ |
243 | - $group->cover_photo = 'nope'; |
|
243 | + $group->cover_photo = 'nope'; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // owner transfer |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $user = elgg_get_logged_in_user_entity(); |
45 | 45 | |
46 | -$group_guid = (int)get_input('group_guid'); |
|
46 | +$group_guid = (int) get_input('group_guid'); |
|
47 | 47 | $is_new_group = $group_guid == 0; |
48 | 48 | |
49 | 49 | if ($is_new_group |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | $group = $group_guid ? get_entity($group_guid) : new ElggGroup(); |
57 | -if (elgg_instanceof($group, "group") && !$group->canEdit()) { |
|
57 | +if (elgg_instanceof($group, "group") && !$group->canEdit()) { |
|
58 | 58 | register_error(elgg_echo("groups:cantedit")); |
59 | 59 | forward(REFERER); |
60 | 60 | } |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | |
79 | 79 | $group->$shortname = $value; |
80 | 80 | } |
81 | - if(!$group->name){ |
|
81 | + if (!$group->name) { |
|
82 | 82 | $group->name = $group->name2; |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | // Validate create |
87 | -if ((!$group->name)&& (!$group->name2)){ |
|
87 | +if ((!$group->name) && (!$group->name2)) { |
|
88 | 88 | register_error(elgg_echo("groups:notitle")); |
89 | 89 | forward(REFERER); |
90 | 90 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | // is an odd requirement and should be removed. Either the acl creation happens |
125 | 125 | // in the action or the visibility moves to a plugin hook |
126 | 126 | if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { |
127 | - $visibility = (int)get_input('vis'); |
|
127 | + $visibility = (int) get_input('vis'); |
|
128 | 128 | |
129 | 129 | if ($visibility == ACCESS_PRIVATE) { |
130 | 130 | // Make this group visible only to group members. We need to use |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | |
214 | 214 | $c_photo = $_FILES['c_photo']; |
215 | 215 | |
216 | -foreach($c_photo as $c){ |
|
217 | - $printing_files .= $c .' , '; |
|
216 | +foreach ($c_photo as $c) { |
|
217 | + $printing_files .= $c . ' , '; |
|
218 | 218 | } |
219 | -if(reset($c_photo) ){ |
|
219 | +if (reset($c_photo)) { |
|
220 | 220 | $prefix = "groups_c_photo/" . $group->guid; |
221 | 221 | |
222 | 222 | $filehandler2 = new ElggFile(); |
@@ -231,15 +231,15 @@ discard block |
||
231 | 231 | |
232 | 232 | $c_photo_guid = $filehandler2->getGUID(); |
233 | 233 | $subtype_testing = $filehandler2->getSubtype(); |
234 | - $group->cover_photo =$c_photo_guid; //Nick - Set Cover photo metadata |
|
235 | -}else if(isset($group->cover_photo) && $group->cover_photo !='nope'){ |
|
234 | + $group->cover_photo = $c_photo_guid; //Nick - Set Cover photo metadata |
|
235 | +} else if (isset($group->cover_photo) && $group->cover_photo != 'nope') { |
|
236 | 236 | |
237 | -}else{ |
|
237 | +} else { |
|
238 | 238 | $group->cover_photo = 'nope'; |
239 | 239 | } |
240 | 240 | |
241 | 241 | $remove_c_photo = get_input('remove_photo'); //Nick - Checkbox will set cover photo metadata to 'nope' |
242 | -if($remove_c_photo){ |
|
242 | +if ($remove_c_photo) { |
|
243 | 243 | $group->cover_photo = 'nope'; |
244 | 244 | } |
245 | 245 |
@@ -232,9 +232,9 @@ |
||
232 | 232 | $c_photo_guid = $filehandler2->getGUID(); |
233 | 233 | $subtype_testing = $filehandler2->getSubtype(); |
234 | 234 | $group->cover_photo =$c_photo_guid; //Nick - Set Cover photo metadata |
235 | -}else if(isset($group->cover_photo) && $group->cover_photo !='nope'){ |
|
235 | +} else if(isset($group->cover_photo) && $group->cover_photo !='nope'){ |
|
236 | 236 | |
237 | -}else{ |
|
237 | +} else{ |
|
238 | 238 | $group->cover_photo = 'nope'; |
239 | 239 | } |
240 | 240 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $title = elgg_echo('groups:activity'); |
57 | 57 | |
58 | 58 | |
59 | - elgg_push_breadcrumb(gc_explode_translation($group->title,$lang), $group->getURL()); |
|
59 | + elgg_push_breadcrumb(gc_explode_translation($group->title, $lang), $group->getURL()); |
|
60 | 60 | |
61 | 61 | |
62 | 62 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | ?> |
26 | 26 | <script type="text/javascript"> |
27 | - $('div.groups-stats').append("<p id='<?php echo $id; ?>'><?php echo $status;?></p>"); |
|
27 | + $('div.groups-stats').append("<p id='<?php echo $id; ?>'><?php echo $status; ?></p>"); |
|
28 | 28 | </script> |
29 | 29 | <?php |
30 | 30 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | ?> |
25 | 25 | <script type="text/javascript"> |
26 | - $('div.elgg-owner-block div.elgg-image-block').append("<div id='<?php echo $id; ?>'><?php echo $status;?></div>"); |
|
26 | + $('div.elgg-owner-block div.elgg-image-block').append("<div id='<?php echo $id; ?>'><?php echo $status; ?></div>"); |
|
27 | 27 | </script> |
28 | 28 | <?php |
29 | 29 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'cp_msg_type' => 'cp_group_invite' |
117 | 117 | ); |
118 | 118 | elgg_trigger_plugin_hook('cp_overwrite_notification', 'all', $message); |
119 | - $result = true; |
|
119 | + $result = true; |
|
120 | 120 | |
121 | 121 | } else { |
122 | 122 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'cp_msg_type' => 'cp_group_add' |
186 | 186 | ); |
187 | 187 | elgg_trigger_plugin_hook('cp_overwrite_notification', 'all', $message); |
188 | - $result = true; |
|
188 | + $result = true; |
|
189 | 189 | } else { |
190 | 190 | |
191 | 191 | $msg = elgg_trigger_plugin_hook("invite_notification", "group_tools", $params, $msg); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | 'cp_msg_type' => 'cp_group_invite_email' |
295 | 295 | ); |
296 | 296 | elgg_trigger_plugin_hook('cp_overwrite_notification', 'all', $message); |
297 | - $result = true; |
|
297 | + $result = true; |
|
298 | 298 | |
299 | 299 | } else { |
300 | 300 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $url |
102 | 102 | )); |
103 | 103 | |
104 | - if(!$group->name){ |
|
104 | + if (!$group->name) { |
|
105 | 105 | $group->name = $group->name2; |
106 | 106 | } |
107 | 107 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | "inviter" => $loggedin_user, |
172 | 172 | "invitee" => $user |
173 | 173 | ); |
174 | - if(!$group->name){ |
|
174 | + if (!$group->name) { |
|
175 | 175 | $group->name = $group->name2; |
176 | 176 | } |
177 | 177 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | "invitee" => $email |
268 | 268 | ); |
269 | 269 | |
270 | - if(!$group->name){ |
|
270 | + if (!$group->name) { |
|
271 | 271 | $group->name = $group->name2; |
272 | 272 | } |
273 | 273 | $body = elgg_trigger_plugin_hook("invite_notification", "group_tools", $params, $body); |
@@ -285,12 +285,12 @@ discard block |
||
285 | 285 | 'cp_invitee' => $email, |
286 | 286 | 'cp_inviter' => $loggedin_user, |
287 | 287 | 'cp_group_invite' => $group, |
288 | - 'group_link' => elgg_get_site_url().'groups/profile/'.$group->guid.'/'.$group->name, |
|
289 | - 'cp_invitation_nonuser_url' => elgg_get_site_url()."register?group_invitecode={$invite_code}", |
|
290 | - 'cp_invitation_url' => elgg_get_site_url()."groups/invitations/?invitecode={$invite_code}", |
|
288 | + 'group_link' => elgg_get_site_url() . 'groups/profile/' . $group->guid . '/' . $group->name, |
|
289 | + 'cp_invitation_nonuser_url' => elgg_get_site_url() . "register?group_invitecode={$invite_code}", |
|
290 | + 'cp_invitation_url' => elgg_get_site_url() . "groups/invitations/?invitecode={$invite_code}", |
|
291 | 291 | 'cp_invitation_code' => $invite_code, |
292 | 292 | 'cp_invitation_msg' => $text, |
293 | - 'cp_user_profile'=> elgg_get_site_url().'profile/'.$loggedin_user->name, |
|
293 | + 'cp_user_profile'=> elgg_get_site_url() . 'profile/' . $loggedin_user->name, |
|
294 | 294 | 'cp_msg_type' => 'cp_group_invite_email' |
295 | 295 | ); |
296 | 296 | elgg_trigger_plugin_hook('cp_overwrite_notification', 'all', $message); |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | $dbprefix = elgg_get_config("dbprefix"); |
689 | 689 | $group_membership_where = "e.guid NOT IN (SELECT er.guid_two FROM {$dbprefix}entity_relationships er where er.guid_one = {$user->getGUID()} and er.relationship IN ('member', 'membership_request'))"; |
690 | 690 | |
691 | - if (elgg_get_plugin_setting("auto_suggest_groups","group_tools") !== "no") { |
|
691 | + if (elgg_get_plugin_setting("auto_suggest_groups", "group_tools") !== "no") { |
|
692 | 692 | $tag_names = elgg_get_registered_tag_metadata_names(); |
693 | 693 | if (!empty($tag_names)) { |
694 | 694 | $user_metadata_options = array( |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | } |
728 | 728 | |
729 | 729 | // get admin defined suggested groups |
730 | - $group_guids = string_to_tag_array(elgg_get_plugin_setting("suggested_groups","group_tools")); |
|
730 | + $group_guids = string_to_tag_array(elgg_get_plugin_setting("suggested_groups", "group_tools")); |
|
731 | 731 | if (!empty($group_guids) && ($limit > 0)) { |
732 | 732 | $group_options = array( |
733 | 733 | "guids" => $group_guids, |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | 'cp_appointer' => $loggedin_user->name, |
1016 | 1016 | 'cp_new_owner_user' => $new_owner, |
1017 | 1017 | ); |
1018 | - $result = elgg_trigger_plugin_hook('cp_overwrite_notification','all',$message); |
|
1018 | + $result = elgg_trigger_plugin_hook('cp_overwrite_notification', 'all', $message); |
|
1019 | 1019 | } else { |
1020 | 1020 | notify_user($new_owner->getGUID(), $group->getGUID(), $subject, $message); |
1021 | 1021 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | 'gcRegister:ministry' => 'Ministry', |
31 | 31 | |
32 | 32 | // labels |
33 | - 'gcRegister:form' => 'Registration form', |
|
33 | + 'gcRegister:form' => 'Registration form', |
|
34 | 34 | 'gcRegister:email' => 'Enter your e-mail', |
35 | 35 | 'gcRegister:email_secondary' => 'Confirm your e-mail', |
36 | 36 | 'gcRegister:username' => 'Your username (auto-generated)', |
@@ -279,7 +279,7 @@ |
||
279 | 279 | foreach($meta_fields as $field){ |
280 | 280 | $new_user->set($field, $$field); |
281 | 281 | } |
282 | - $new_user->last_department_verify = time(); |
|
282 | + $new_user->last_department_verify = time(); |
|
283 | 283 | |
284 | 284 | // Forward on success, assume everything else is an error... |
285 | 285 | forward(); |
@@ -19,23 +19,23 @@ discard block |
||
19 | 19 | * MWooff Jan 18 2017 Re-built for GCcollab-specific functions |
20 | 20 | ***********************************************************************/ |
21 | 21 | |
22 | -function replaceAccents2( $str ){ |
|
22 | +function replaceAccents2($str) { |
|
23 | 23 | $a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'); |
24 | 24 | $b = array('A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'); |
25 | 25 | return str_replace($a, $b, $str); |
26 | 26 | } |
27 | 27 | |
28 | -function usernameize2( $str, $a_char = array("'", "-", ".") ){ |
|
29 | - $string = replaceAccents2(mb_strtolower(strtok( $str, '@' ))); |
|
30 | - foreach ($a_char as $temp){ |
|
31 | - $pos = strpos($string,$temp); |
|
32 | - if ($pos){ |
|
28 | +function usernameize2($str, $a_char = array("'", "-", ".")) { |
|
29 | + $string = replaceAccents2(mb_strtolower(strtok($str, '@'))); |
|
30 | + foreach ($a_char as $temp) { |
|
31 | + $pos = strpos($string, $temp); |
|
32 | + if ($pos) { |
|
33 | 33 | $mend = ''; |
34 | - $a_split = explode($temp,$string); |
|
35 | - foreach ($a_split as $temp2){ |
|
36 | - $mend .= ucfirst($temp2).$temp; |
|
34 | + $a_split = explode($temp, $string); |
|
35 | + foreach ($a_split as $temp2) { |
|
36 | + $mend .= ucfirst($temp2) . $temp; |
|
37 | 37 | } |
38 | - $string = substr($mend,0,-1); |
|
38 | + $string = substr($mend, 0, -1); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | return ucfirst($string); |
@@ -56,36 +56,36 @@ discard block |
||
56 | 56 | $invitecode = get_input('invitecode'); |
57 | 57 | |
58 | 58 | $meta_fields = array('user_type', 'institution', 'university', 'college', 'highschool', 'federal', 'provincial', 'ministry', 'municipal', 'international', 'ngo', 'community', 'business', 'media', 'retired', 'other'); |
59 | -foreach($meta_fields as $field){ |
|
59 | +foreach ($meta_fields as $field) { |
|
60 | 60 | $$field = get_input($field); |
61 | 61 | } |
62 | 62 | |
63 | 63 | // check form (incompleteness & validity) |
64 | 64 | if (elgg_get_config('allow_registration')) { |
65 | 65 | try { |
66 | - $emaildomain = explode('@',$email); |
|
67 | - $emailgc = explode('.',$emaildomain[1]); |
|
68 | - $gcca = $emailgc[count($emailgc) - 2] .".".$emailgc[count($emailgc) - 1]; |
|
66 | + $emaildomain = explode('@', $email); |
|
67 | + $emailgc = explode('.', $emaildomain[1]); |
|
68 | + $gcca = $emailgc[count($emailgc) - 2] . "." . $emailgc[count($emailgc) - 1]; |
|
69 | 69 | |
70 | 70 | $resulting_error = ""; |
71 | 71 | $validemail = false; |
72 | 72 | |
73 | 73 | // if domain doesn't exist in database, check if it's a gc.ca domain |
74 | - if (strcmp($gcca, 'gc.ca') == 0){ |
|
74 | + if (strcmp($gcca, 'gc.ca') == 0) { |
|
75 | 75 | $validemail = true; |
76 | 76 | } |
77 | 77 | |
78 | - if( elgg_is_active_plugin('c_email_extensions') ){ |
|
78 | + if (elgg_is_active_plugin('c_email_extensions')) { |
|
79 | 79 | // Checks against the domain manager list... |
80 | 80 | $wildcard_query = "SELECT ext FROM email_extensions WHERE ext LIKE '%*%'"; |
81 | 81 | $wildcard_emails = get_data($wildcard_query); |
82 | 82 | |
83 | - if( $wildcard_emails ){ |
|
84 | - foreach($wildcard_emails as $wildcard){ |
|
83 | + if ($wildcard_emails) { |
|
84 | + foreach ($wildcard_emails as $wildcard) { |
|
85 | 85 | $regex = str_replace(".", "\.", $wildcard->ext); |
86 | 86 | $regex = str_replace("*", "[\w-.]+", $regex); |
87 | 87 | $regex = "/^@" . $regex . "$/"; |
88 | - if(preg_match($regex, "@".$emaildomain[1]) || strtolower(str_replace("*.", "", $wildcard->ext)) == strtolower($emaildomain[1])){ |
|
88 | + if (preg_match($regex, "@" . $emaildomain[1]) || strtolower(str_replace("*.", "", $wildcard->ext)) == strtolower($emaildomain[1])) { |
|
89 | 89 | $validemail = true; |
90 | 90 | break; |
91 | 91 | } |
@@ -93,96 +93,96 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - if( elgg_is_active_plugin('gcRegistration_invitation') ){ |
|
96 | + if (elgg_is_active_plugin('gcRegistration_invitation')) { |
|
97 | 97 | // Checks against the email invitation list... |
98 | 98 | $invitation_query = "SELECT email FROM email_invitations WHERE email = '{$email}'"; |
99 | 99 | $result = get_data($invitation_query); |
100 | 100 | |
101 | - if( count($result) > 0 ) |
|
101 | + if (count($result) > 0) |
|
102 | 102 | $validemail = true; |
103 | 103 | } |
104 | 104 | |
105 | 105 | // check if the college/university is filled |
106 | 106 | if ($user_type === 'student' || $user_type === 'academic') { |
107 | - if($institution === 'default_invalid_value') |
|
108 | - $resulting_error .= elgg_echo('gcRegister:InstitutionNotSelected').'<br/>'; |
|
107 | + if ($institution === 'default_invalid_value') |
|
108 | + $resulting_error .= elgg_echo('gcRegister:InstitutionNotSelected') . '<br/>'; |
|
109 | 109 | |
110 | - if($institution === 'university' && $university === 'default_invalid_value') |
|
111 | - $resulting_error .= elgg_echo('gcRegister:UniversityNotSelected').'<br/>'; |
|
110 | + if ($institution === 'university' && $university === 'default_invalid_value') |
|
111 | + $resulting_error .= elgg_echo('gcRegister:UniversityNotSelected') . '<br/>'; |
|
112 | 112 | |
113 | - if($institution === 'college' && $college === 'default_invalid_value') |
|
114 | - $resulting_error .= elgg_echo('gcRegister:CollegeNotSelected').'<br/>'; |
|
113 | + if ($institution === 'college' && $college === 'default_invalid_value') |
|
114 | + $resulting_error .= elgg_echo('gcRegister:CollegeNotSelected') . '<br/>'; |
|
115 | 115 | |
116 | - if($institution === 'highschool' && $highschool === '') |
|
117 | - $resulting_error .= elgg_echo('gcRegister:HighschoolNotSelected').'<br/>'; |
|
116 | + if ($institution === 'highschool' && $highschool === '') |
|
117 | + $resulting_error .= elgg_echo('gcRegister:HighschoolNotSelected') . '<br/>'; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // check if the federal department is filled |
121 | 121 | if ($user_type === 'federal' && $federal === 'default_invalid_value') |
122 | - $resulting_error .= elgg_echo('gcRegister:FederalNotSelected').'<br/>'; |
|
122 | + $resulting_error .= elgg_echo('gcRegister:FederalNotSelected') . '<br/>'; |
|
123 | 123 | |
124 | 124 | // check if the provincial department is filled |
125 | 125 | if ($user_type === 'provincial') { |
126 | - if($provincial === 'default_invalid_value') |
|
127 | - $resulting_error .= elgg_echo('gcRegister:ProvincialNotSelected').'<br/>'; |
|
126 | + if ($provincial === 'default_invalid_value') |
|
127 | + $resulting_error .= elgg_echo('gcRegister:ProvincialNotSelected') . '<br/>'; |
|
128 | 128 | |
129 | - if($ministry === 'default_invalid_value') |
|
130 | - $resulting_error .= elgg_echo('gcRegister:MinistryNotSelected').'<br/>'; |
|
129 | + if ($ministry === 'default_invalid_value') |
|
130 | + $resulting_error .= elgg_echo('gcRegister:MinistryNotSelected') . '<br/>'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // check if the municipal department is filled |
134 | 134 | if ($user_type === 'municipal' && $municipal === '') |
135 | - $resulting_error .= elgg_echo('gcRegister:MunicipalNotSelected').'<br/>'; |
|
135 | + $resulting_error .= elgg_echo('gcRegister:MunicipalNotSelected') . '<br/>'; |
|
136 | 136 | |
137 | 137 | // check if the international department is filled |
138 | 138 | if ($user_type === 'international' && $international === '') |
139 | - $resulting_error .= elgg_echo('gcRegister:InternationalNotSelected').'<br/>'; |
|
139 | + $resulting_error .= elgg_echo('gcRegister:InternationalNotSelected') . '<br/>'; |
|
140 | 140 | |
141 | 141 | // check if the NGO department is filled |
142 | 142 | if ($user_type === 'ngo' && $ngo === '') |
143 | - $resulting_error .= elgg_echo('gcRegister:NGONotSelected').'<br/>'; |
|
143 | + $resulting_error .= elgg_echo('gcRegister:NGONotSelected') . '<br/>'; |
|
144 | 144 | |
145 | 145 | // check if the community department is filled |
146 | 146 | if ($user_type === 'community' && $community === '') |
147 | - $resulting_error .= elgg_echo('gcRegister:CommunityNotSelected').'<br/>'; |
|
147 | + $resulting_error .= elgg_echo('gcRegister:CommunityNotSelected') . '<br/>'; |
|
148 | 148 | |
149 | 149 | // check if the business department is filled |
150 | 150 | if ($user_type === 'business' && $business === '') |
151 | - $resulting_error .= elgg_echo('gcRegister:BusinessNotSelected').'<br/>'; |
|
151 | + $resulting_error .= elgg_echo('gcRegister:BusinessNotSelected') . '<br/>'; |
|
152 | 152 | |
153 | 153 | // check if the media department is filled |
154 | 154 | if ($user_type === 'media' && $media === '') |
155 | - $resulting_error .= elgg_echo('gcRegister:MediaNotSelected').'<br/>'; |
|
155 | + $resulting_error .= elgg_echo('gcRegister:MediaNotSelected') . '<br/>'; |
|
156 | 156 | |
157 | 157 | // check if the retired department is filled |
158 | 158 | if ($user_type === 'retired' && $retired === '') |
159 | - $resulting_error .= elgg_echo('gcRegister:RetiredNotSelected').'<br/>'; |
|
159 | + $resulting_error .= elgg_echo('gcRegister:RetiredNotSelected') . '<br/>'; |
|
160 | 160 | |
161 | 161 | // check if the other department is filled |
162 | 162 | if ($user_type === 'other' && $other === '') |
163 | - $resulting_error .= elgg_echo('gcRegister:OtherNotSelected').'<br/>'; |
|
163 | + $resulting_error .= elgg_echo('gcRegister:OtherNotSelected') . '<br/>'; |
|
164 | 164 | |
165 | - if( empty(trim($name)) ) |
|
166 | - $resulting_error .= elgg_echo('gcRegister:display_name_is_empty').'<br/>'; |
|
165 | + if (empty(trim($name))) |
|
166 | + $resulting_error .= elgg_echo('gcRegister:display_name_is_empty') . '<br/>'; |
|
167 | 167 | |
168 | - if( !$validemail ) |
|
169 | - $resulting_error .= elgg_echo('gcRegister:invalid_email_link').'<br/>'; |
|
168 | + if (!$validemail) |
|
169 | + $resulting_error .= elgg_echo('gcRegister:invalid_email_link') . '<br/>'; |
|
170 | 170 | |
171 | 171 | // check if two emails match |
172 | 172 | if (strcmp($email, $email2) != 0) |
173 | - $resulting_error .= elgg_echo('gcRegister:email_mismatch').'<br/>'; |
|
173 | + $resulting_error .= elgg_echo('gcRegister:email_mismatch') . '<br/>'; |
|
174 | 174 | |
175 | 175 | // check if two passwords are not empty |
176 | 176 | if (empty(trim($password)) || empty(trim($password2))) |
177 | - $resulting_error .= elgg_echo('gcRegister:EmptyPassword').'<br/>'; |
|
177 | + $resulting_error .= elgg_echo('gcRegister:EmptyPassword') . '<br/>'; |
|
178 | 178 | |
179 | 179 | // check if two passwords match |
180 | 180 | if (strcmp($password, $password2) != 0) |
181 | - $resulting_error .= elgg_echo('gcRegister:PasswordMismatch').'<br/>'; |
|
181 | + $resulting_error .= elgg_echo('gcRegister:PasswordMismatch') . '<br/>'; |
|
182 | 182 | |
183 | 183 | // check if toc is checked, user agrees to TOC |
184 | 184 | if ($toc[0] != 1) |
185 | - $resulting_error .= elgg_echo('gcRegister:toc_error').'<br/>'; |
|
185 | + $resulting_error .= elgg_echo('gcRegister:toc_error') . '<br/>'; |
|
186 | 186 | |
187 | 187 | // if there are any registration error, throw an exception |
188 | 188 | if (!empty($resulting_error)) |
@@ -194,20 +194,20 @@ discard block |
||
194 | 194 | $usrname = str_replace("'", "", usernameize2($temp_name)); |
195 | 195 | |
196 | 196 | // Troy - fix for usernames generated with "-" in them; better solution may present itself. |
197 | - while( strpos($usrname,'-')!==false ){ |
|
198 | - $usrname = substr_replace($usrname, ".", strpos($usrname,'-'),1); |
|
197 | + while (strpos($usrname, '-') !== false) { |
|
198 | + $usrname = substr_replace($usrname, ".", strpos($usrname, '-'), 1); |
|
199 | 199 | } |
200 | 200 | |
201 | - if( rtrim($usrname, "0..9") != "" ){ |
|
201 | + if (rtrim($usrname, "0..9") != "") { |
|
202 | 202 | $usrname = rtrim($usrname, "0..9"); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // select matching usernames |
206 | - $query1 = "SELECT count(*) as num FROM elggusers_entity WHERE username = '". $usrname ."'"; |
|
206 | + $query1 = "SELECT count(*) as num FROM elggusers_entity WHERE username = '" . $usrname . "'"; |
|
207 | 207 | $result1 = get_data($query1); |
208 | 208 | |
209 | 209 | // check if username exists and increment it |
210 | - if ( $result1[0]->num > 0 ){ |
|
210 | + if ($result1[0]->num > 0) { |
|
211 | 211 | $unamePostfix = 0; |
212 | 212 | $usrnameQuery = $usrname; |
213 | 213 | |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | $unamePostfix++; |
216 | 216 | $tmpUsrnameQuery = $usrnameQuery . $unamePostfix; |
217 | 217 | |
218 | - $query = "SELECT count(*) as num FROM elggusers_entity WHERE username = '". $tmpUsrnameQuery ."'"; |
|
218 | + $query = "SELECT count(*) as num FROM elggusers_entity WHERE username = '" . $tmpUsrnameQuery . "'"; |
|
219 | 219 | $tmpResult = get_data($query); |
220 | 220 | |
221 | 221 | $uname = $tmpUsrnameQuery; |
222 | - } while ( $tmpResult[0]->num > 0); |
|
222 | + } while ($tmpResult[0]->num > 0); |
|
223 | 223 | } else { |
224 | 224 | // username is available |
225 | 225 | $uname = $usrname; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | // Save user metadata |
279 | - foreach($meta_fields as $field){ |
|
279 | + foreach ($meta_fields as $field) { |
|
280 | 280 | $new_user->set($field, $$field); |
281 | 281 | } |
282 | 282 | $new_user->last_department_verify = time(); |
@@ -98,95 +98,118 @@ |
||
98 | 98 | $invitation_query = "SELECT email FROM email_invitations WHERE email = '{$email}'"; |
99 | 99 | $result = get_data($invitation_query); |
100 | 100 | |
101 | - if( count($result) > 0 ) |
|
102 | - $validemail = true; |
|
101 | + if( count($result) > 0 ) { |
|
102 | + $validemail = true; |
|
103 | + } |
|
103 | 104 | } |
104 | 105 | |
105 | 106 | // check if the college/university is filled |
106 | 107 | if ($user_type === 'student' || $user_type === 'academic') { |
107 | - if($institution === 'default_invalid_value') |
|
108 | - $resulting_error .= elgg_echo('gcRegister:InstitutionNotSelected').'<br/>'; |
|
108 | + if($institution === 'default_invalid_value') { |
|
109 | + $resulting_error .= elgg_echo('gcRegister:InstitutionNotSelected').'<br/>'; |
|
110 | + } |
|
109 | 111 | |
110 | - if($institution === 'university' && $university === 'default_invalid_value') |
|
111 | - $resulting_error .= elgg_echo('gcRegister:UniversityNotSelected').'<br/>'; |
|
112 | + if($institution === 'university' && $university === 'default_invalid_value') { |
|
113 | + $resulting_error .= elgg_echo('gcRegister:UniversityNotSelected').'<br/>'; |
|
114 | + } |
|
112 | 115 | |
113 | - if($institution === 'college' && $college === 'default_invalid_value') |
|
114 | - $resulting_error .= elgg_echo('gcRegister:CollegeNotSelected').'<br/>'; |
|
116 | + if($institution === 'college' && $college === 'default_invalid_value') { |
|
117 | + $resulting_error .= elgg_echo('gcRegister:CollegeNotSelected').'<br/>'; |
|
118 | + } |
|
115 | 119 | |
116 | - if($institution === 'highschool' && $highschool === '') |
|
117 | - $resulting_error .= elgg_echo('gcRegister:HighschoolNotSelected').'<br/>'; |
|
120 | + if($institution === 'highschool' && $highschool === '') { |
|
121 | + $resulting_error .= elgg_echo('gcRegister:HighschoolNotSelected').'<br/>'; |
|
122 | + } |
|
118 | 123 | } |
119 | 124 | |
120 | 125 | // check if the federal department is filled |
121 | - if ($user_type === 'federal' && $federal === 'default_invalid_value') |
|
122 | - $resulting_error .= elgg_echo('gcRegister:FederalNotSelected').'<br/>'; |
|
126 | + if ($user_type === 'federal' && $federal === 'default_invalid_value') { |
|
127 | + $resulting_error .= elgg_echo('gcRegister:FederalNotSelected').'<br/>'; |
|
128 | + } |
|
123 | 129 | |
124 | 130 | // check if the provincial department is filled |
125 | 131 | if ($user_type === 'provincial') { |
126 | - if($provincial === 'default_invalid_value') |
|
127 | - $resulting_error .= elgg_echo('gcRegister:ProvincialNotSelected').'<br/>'; |
|
132 | + if($provincial === 'default_invalid_value') { |
|
133 | + $resulting_error .= elgg_echo('gcRegister:ProvincialNotSelected').'<br/>'; |
|
134 | + } |
|
128 | 135 | |
129 | - if($ministry === 'default_invalid_value') |
|
130 | - $resulting_error .= elgg_echo('gcRegister:MinistryNotSelected').'<br/>'; |
|
136 | + if($ministry === 'default_invalid_value') { |
|
137 | + $resulting_error .= elgg_echo('gcRegister:MinistryNotSelected').'<br/>'; |
|
138 | + } |
|
131 | 139 | } |
132 | 140 | |
133 | 141 | // check if the municipal department is filled |
134 | - if ($user_type === 'municipal' && $municipal === '') |
|
135 | - $resulting_error .= elgg_echo('gcRegister:MunicipalNotSelected').'<br/>'; |
|
142 | + if ($user_type === 'municipal' && $municipal === '') { |
|
143 | + $resulting_error .= elgg_echo('gcRegister:MunicipalNotSelected').'<br/>'; |
|
144 | + } |
|
136 | 145 | |
137 | 146 | // check if the international department is filled |
138 | - if ($user_type === 'international' && $international === '') |
|
139 | - $resulting_error .= elgg_echo('gcRegister:InternationalNotSelected').'<br/>'; |
|
147 | + if ($user_type === 'international' && $international === '') { |
|
148 | + $resulting_error .= elgg_echo('gcRegister:InternationalNotSelected').'<br/>'; |
|
149 | + } |
|
140 | 150 | |
141 | 151 | // check if the NGO department is filled |
142 | - if ($user_type === 'ngo' && $ngo === '') |
|
143 | - $resulting_error .= elgg_echo('gcRegister:NGONotSelected').'<br/>'; |
|
152 | + if ($user_type === 'ngo' && $ngo === '') { |
|
153 | + $resulting_error .= elgg_echo('gcRegister:NGONotSelected').'<br/>'; |
|
154 | + } |
|
144 | 155 | |
145 | 156 | // check if the community department is filled |
146 | - if ($user_type === 'community' && $community === '') |
|
147 | - $resulting_error .= elgg_echo('gcRegister:CommunityNotSelected').'<br/>'; |
|
157 | + if ($user_type === 'community' && $community === '') { |
|
158 | + $resulting_error .= elgg_echo('gcRegister:CommunityNotSelected').'<br/>'; |
|
159 | + } |
|
148 | 160 | |
149 | 161 | // check if the business department is filled |
150 | - if ($user_type === 'business' && $business === '') |
|
151 | - $resulting_error .= elgg_echo('gcRegister:BusinessNotSelected').'<br/>'; |
|
162 | + if ($user_type === 'business' && $business === '') { |
|
163 | + $resulting_error .= elgg_echo('gcRegister:BusinessNotSelected').'<br/>'; |
|
164 | + } |
|
152 | 165 | |
153 | 166 | // check if the media department is filled |
154 | - if ($user_type === 'media' && $media === '') |
|
155 | - $resulting_error .= elgg_echo('gcRegister:MediaNotSelected').'<br/>'; |
|
167 | + if ($user_type === 'media' && $media === '') { |
|
168 | + $resulting_error .= elgg_echo('gcRegister:MediaNotSelected').'<br/>'; |
|
169 | + } |
|
156 | 170 | |
157 | 171 | // check if the retired department is filled |
158 | - if ($user_type === 'retired' && $retired === '') |
|
159 | - $resulting_error .= elgg_echo('gcRegister:RetiredNotSelected').'<br/>'; |
|
172 | + if ($user_type === 'retired' && $retired === '') { |
|
173 | + $resulting_error .= elgg_echo('gcRegister:RetiredNotSelected').'<br/>'; |
|
174 | + } |
|
160 | 175 | |
161 | 176 | // check if the other department is filled |
162 | - if ($user_type === 'other' && $other === '') |
|
163 | - $resulting_error .= elgg_echo('gcRegister:OtherNotSelected').'<br/>'; |
|
177 | + if ($user_type === 'other' && $other === '') { |
|
178 | + $resulting_error .= elgg_echo('gcRegister:OtherNotSelected').'<br/>'; |
|
179 | + } |
|
164 | 180 | |
165 | - if( empty(trim($name)) ) |
|
166 | - $resulting_error .= elgg_echo('gcRegister:display_name_is_empty').'<br/>'; |
|
181 | + if( empty(trim($name)) ) { |
|
182 | + $resulting_error .= elgg_echo('gcRegister:display_name_is_empty').'<br/>'; |
|
183 | + } |
|
167 | 184 | |
168 | - if( !$validemail ) |
|
169 | - $resulting_error .= elgg_echo('gcRegister:invalid_email_link').'<br/>'; |
|
185 | + if( !$validemail ) { |
|
186 | + $resulting_error .= elgg_echo('gcRegister:invalid_email_link').'<br/>'; |
|
187 | + } |
|
170 | 188 | |
171 | 189 | // check if two emails match |
172 | - if (strcmp($email, $email2) != 0) |
|
173 | - $resulting_error .= elgg_echo('gcRegister:email_mismatch').'<br/>'; |
|
190 | + if (strcmp($email, $email2) != 0) { |
|
191 | + $resulting_error .= elgg_echo('gcRegister:email_mismatch').'<br/>'; |
|
192 | + } |
|
174 | 193 | |
175 | 194 | // check if two passwords are not empty |
176 | - if (empty(trim($password)) || empty(trim($password2))) |
|
177 | - $resulting_error .= elgg_echo('gcRegister:EmptyPassword').'<br/>'; |
|
195 | + if (empty(trim($password)) || empty(trim($password2))) { |
|
196 | + $resulting_error .= elgg_echo('gcRegister:EmptyPassword').'<br/>'; |
|
197 | + } |
|
178 | 198 | |
179 | 199 | // check if two passwords match |
180 | - if (strcmp($password, $password2) != 0) |
|
181 | - $resulting_error .= elgg_echo('gcRegister:PasswordMismatch').'<br/>'; |
|
200 | + if (strcmp($password, $password2) != 0) { |
|
201 | + $resulting_error .= elgg_echo('gcRegister:PasswordMismatch').'<br/>'; |
|
202 | + } |
|
182 | 203 | |
183 | 204 | // check if toc is checked, user agrees to TOC |
184 | - if ($toc[0] != 1) |
|
185 | - $resulting_error .= elgg_echo('gcRegister:toc_error').'<br/>'; |
|
205 | + if ($toc[0] != 1) { |
|
206 | + $resulting_error .= elgg_echo('gcRegister:toc_error').'<br/>'; |
|
207 | + } |
|
186 | 208 | |
187 | 209 | // if there are any registration error, throw an exception |
188 | - if (!empty($resulting_error)) |
|
189 | - throw new RegistrationException($resulting_error); |
|
210 | + if (!empty($resulting_error)) { |
|
211 | + throw new RegistrationException($resulting_error); |
|
212 | + } |
|
190 | 213 | |
191 | 214 | |
192 | 215 | /*** Username Generation ***/ |
@@ -109,72 +109,72 @@ discard block |
||
109 | 109 | |
110 | 110 | <section class="col-md-6"><div class="plm"> |
111 | 111 | <?php |
112 | - $InviteGUID = get_input('friend_guid'); |
|
112 | + $InviteGUID = get_input('friend_guid'); |
|
113 | 113 | |
114 | - if( $InviteGUID ): |
|
114 | + if( $InviteGUID ): |
|
115 | 115 | |
116 | 116 | $userObj = get_user($InviteGUID); |
117 | 117 | |
118 | 118 | if( $userObj ): |
119 | 119 | |
120 | - $userType = $userObj->user_type; |
|
121 | - // if user is public servant |
|
122 | - if( $userType == 'federal' ){ |
|
123 | - $deptObj = elgg_get_entities(array( |
|
124 | - 'type' => 'object', |
|
125 | - 'subtype' => 'federal_departments', |
|
126 | - )); |
|
127 | - $depts = get_entity($deptObj[0]->guid); |
|
128 | - |
|
129 | - $federal_departments = array(); |
|
130 | - if (get_current_language() == 'en'){ |
|
131 | - $federal_departments = json_decode($depts->federal_departments_en, true); |
|
132 | - } else { |
|
133 | - $federal_departments = json_decode($depts->federal_departments_fr, true); |
|
134 | - } |
|
135 | - |
|
136 | - $department = $federal_departments[$userObj->federal]; |
|
137 | - |
|
138 | - // otherwise if user is student or academic |
|
139 | - } else if( $userType == 'student' || $userType == 'academic' ){ |
|
140 | - $institution = $userObj->institution; |
|
141 | - $department = ($institution == 'university') ? $userObj->university : $userObj->college; |
|
142 | - |
|
143 | - // otherwise if user is provincial employee |
|
144 | - } else if( $userType == 'provincial' ){ |
|
145 | - $provObj = elgg_get_entities(array( |
|
146 | - 'type' => 'object', |
|
147 | - 'subtype' => 'provinces', |
|
148 | - )); |
|
149 | - $provs = get_entity($provObj[0]->guid); |
|
150 | - |
|
151 | - $provinces = array(); |
|
152 | - if (get_current_language() == 'en'){ |
|
153 | - $provinces = json_decode($provs->provinces_en, true); |
|
154 | - } else { |
|
155 | - $provinces = json_decode($provs->provinces_fr, true); |
|
156 | - } |
|
157 | - |
|
158 | - $minObj = elgg_get_entities(array( |
|
159 | - 'type' => 'object', |
|
160 | - 'subtype' => 'ministries', |
|
161 | - )); |
|
162 | - $mins = get_entity($minObj[0]->guid); |
|
163 | - |
|
164 | - $ministries = array(); |
|
165 | - if (get_current_language() == 'en'){ |
|
166 | - $ministries = json_decode($mins->ministries_en, true); |
|
167 | - } else { |
|
168 | - $ministries = json_decode($mins->ministries_fr, true); |
|
169 | - } |
|
170 | - |
|
171 | - $department = $provinces[$userObj->provincial]; |
|
172 | - if($userObj->ministry && $userObj->ministry !== "default_invalid_value"){ $department .= ' / ' . $ministries[$userObj->provincial][$userObj->ministry]; } |
|
173 | - |
|
174 | - // otherwise show basic info |
|
175 | - } else { |
|
176 | - $department = $userObj->$userType; |
|
177 | - } |
|
120 | + $userType = $userObj->user_type; |
|
121 | + // if user is public servant |
|
122 | + if( $userType == 'federal' ){ |
|
123 | + $deptObj = elgg_get_entities(array( |
|
124 | + 'type' => 'object', |
|
125 | + 'subtype' => 'federal_departments', |
|
126 | + )); |
|
127 | + $depts = get_entity($deptObj[0]->guid); |
|
128 | + |
|
129 | + $federal_departments = array(); |
|
130 | + if (get_current_language() == 'en'){ |
|
131 | + $federal_departments = json_decode($depts->federal_departments_en, true); |
|
132 | + } else { |
|
133 | + $federal_departments = json_decode($depts->federal_departments_fr, true); |
|
134 | + } |
|
135 | + |
|
136 | + $department = $federal_departments[$userObj->federal]; |
|
137 | + |
|
138 | + // otherwise if user is student or academic |
|
139 | + } else if( $userType == 'student' || $userType == 'academic' ){ |
|
140 | + $institution = $userObj->institution; |
|
141 | + $department = ($institution == 'university') ? $userObj->university : $userObj->college; |
|
142 | + |
|
143 | + // otherwise if user is provincial employee |
|
144 | + } else if( $userType == 'provincial' ){ |
|
145 | + $provObj = elgg_get_entities(array( |
|
146 | + 'type' => 'object', |
|
147 | + 'subtype' => 'provinces', |
|
148 | + )); |
|
149 | + $provs = get_entity($provObj[0]->guid); |
|
150 | + |
|
151 | + $provinces = array(); |
|
152 | + if (get_current_language() == 'en'){ |
|
153 | + $provinces = json_decode($provs->provinces_en, true); |
|
154 | + } else { |
|
155 | + $provinces = json_decode($provs->provinces_fr, true); |
|
156 | + } |
|
157 | + |
|
158 | + $minObj = elgg_get_entities(array( |
|
159 | + 'type' => 'object', |
|
160 | + 'subtype' => 'ministries', |
|
161 | + )); |
|
162 | + $mins = get_entity($minObj[0]->guid); |
|
163 | + |
|
164 | + $ministries = array(); |
|
165 | + if (get_current_language() == 'en'){ |
|
166 | + $ministries = json_decode($mins->ministries_en, true); |
|
167 | + } else { |
|
168 | + $ministries = json_decode($mins->ministries_fr, true); |
|
169 | + } |
|
170 | + |
|
171 | + $department = $provinces[$userObj->provincial]; |
|
172 | + if($userObj->ministry && $userObj->ministry !== "default_invalid_value"){ $department .= ' / ' . $ministries[$userObj->provincial][$userObj->ministry]; } |
|
173 | + |
|
174 | + // otherwise show basic info |
|
175 | + } else { |
|
176 | + $department = $userObj->$userType; |
|
177 | + } |
|
178 | 178 | ?> |
179 | 179 | <p><strong><?php echo $userObj->name . elgg_echo('gcRegister:has_invited'); ?></strong></p> |
180 | 180 | <hr class="mtm mbm"> |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | </div> |
196 | 196 | <hr class="mtm mbl"> |
197 | 197 | <?php |
198 | - endif; |
|
199 | - endif; |
|
198 | + endif; |
|
199 | + endif; |
|
200 | 200 | |
201 | 201 | echo elgg_echo('gcRegister:welcome_message'); |
202 | 202 | ?> |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | echo elgg_view('input/select', array( |
231 | 231 | 'name' => 'user_type', |
232 | 232 | 'id' => 'user_type', |
233 | - 'class' => 'form-control', |
|
233 | + 'class' => 'form-control', |
|
234 | 234 | 'aria-required' => 'true', |
235 | 235 | 'required' => true, |
236 | 236 | 'options_values' => $departments |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | echo elgg_view('input/select', array( |
255 | 255 | 'name' => 'institution', |
256 | 256 | 'id' => 'institution', |
257 | - 'class' => 'form-control', |
|
258 | - 'value' => 'default_invalid_value', |
|
257 | + 'class' => 'form-control', |
|
258 | + 'value' => 'default_invalid_value', |
|
259 | 259 | 'options_values' => $institutions |
260 | 260 | )); |
261 | 261 | ?> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $university_choices = elgg_view('input/select', array( |
283 | 283 | 'name' => 'university', |
284 | 284 | 'id' => 'university', |
285 | - 'class' => 'form-control', |
|
285 | + 'class' => 'form-control', |
|
286 | 286 | 'options_values' => array_merge(array('default_invalid_value' => elgg_echo('gcRegister:make_selection')), $universities), |
287 | 287 | )); |
288 | 288 | ?> |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $college_choices = elgg_view('input/select', array( |
314 | 314 | 'name' => 'college', |
315 | 315 | 'id' => 'college', |
316 | - 'class' => 'form-control', |
|
316 | + 'class' => 'form-control', |
|
317 | 317 | 'options_values' => array_merge(array('default_invalid_value' => elgg_echo('gcRegister:make_selection')), $colleges), |
318 | 318 | )); |
319 | 319 | ?> |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $highschool_choices = elgg_view('input/text', array( |
330 | 330 | 'name' => 'highschool', |
331 | 331 | 'id' => 'highschool', |
332 | - 'class' => 'form-control', |
|
332 | + 'class' => 'form-control', |
|
333 | 333 | )); |
334 | 334 | ?> |
335 | 335 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $federal_choices = elgg_view('input/select', array( |
361 | 361 | 'name' => 'federal', |
362 | 362 | 'id' => 'federal', |
363 | - 'class' => 'form-control', |
|
363 | + 'class' => 'form-control', |
|
364 | 364 | 'options_values' => array_merge(array('default_invalid_value' => elgg_echo('gcRegister:make_selection')), $federal_departments), |
365 | 365 | )); |
366 | 366 | ?> |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $provincial_choices = elgg_view('input/select', array( |
392 | 392 | 'name' => 'provincial', |
393 | 393 | 'id' => 'provincial', |
394 | - 'class' => 'form-control', |
|
394 | + 'class' => 'form-control', |
|
395 | 395 | 'options_values' => array_merge(array('default_invalid_value' => elgg_echo('gcRegister:make_selection')), $provincial_departments), |
396 | 396 | )); |
397 | 397 | ?> |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | echo elgg_view('input/select', array( |
426 | 426 | 'name' => 'ministry', |
427 | 427 | 'id' => $prov_id, |
428 | - 'class' => 'form-control', |
|
428 | + 'class' => 'form-control', |
|
429 | 429 | 'options_values' => array_merge(array('default_invalid_value' => elgg_echo('gcRegister:make_selection')), $ministries[$province]), |
430 | 430 | )); |
431 | 431 | echo '</div>'; |
@@ -452,8 +452,8 @@ discard block |
||
452 | 452 | $municipal_choices = elgg_view('input/text', array( |
453 | 453 | 'name' => 'municipal', |
454 | 454 | 'id' => 'municipal', |
455 | - 'class' => 'form-control', |
|
456 | - 'list' => 'municipal-list' |
|
455 | + 'class' => 'form-control', |
|
456 | + 'list' => 'municipal-list' |
|
457 | 457 | )); |
458 | 458 | ?> |
459 | 459 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | $international_choices = elgg_view('input/text', array( |
480 | 480 | 'name' => 'international', |
481 | 481 | 'id' => 'international', |
482 | - 'class' => 'form-control', |
|
482 | + 'class' => 'form-control', |
|
483 | 483 | )); |
484 | 484 | ?> |
485 | 485 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | $ngo_choices = elgg_view('input/text', array( |
496 | 496 | 'name' => 'ngo', |
497 | 497 | 'id' => 'ngo', |
498 | - 'class' => 'form-control', |
|
498 | + 'class' => 'form-control', |
|
499 | 499 | )); |
500 | 500 | ?> |
501 | 501 | |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | $community_choices = elgg_view('input/text', array( |
512 | 512 | 'name' => 'community', |
513 | 513 | 'id' => 'community', |
514 | - 'class' => 'form-control', |
|
514 | + 'class' => 'form-control', |
|
515 | 515 | )); |
516 | 516 | ?> |
517 | 517 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $business_choices = elgg_view('input/text', array( |
527 | 527 | 'name' => 'business', |
528 | 528 | 'id' => 'business', |
529 | - 'class' => 'form-control', |
|
529 | + 'class' => 'form-control', |
|
530 | 530 | )); |
531 | 531 | ?> |
532 | 532 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | $media_choices = elgg_view('input/text', array( |
542 | 542 | 'name' => 'media', |
543 | 543 | 'id' => 'media', |
544 | - 'class' => 'form-control', |
|
544 | + 'class' => 'form-control', |
|
545 | 545 | )); |
546 | 546 | ?> |
547 | 547 | |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | $retired_choices = elgg_view('input/text', array( |
557 | 557 | 'name' => 'retired', |
558 | 558 | 'id' => 'retired', |
559 | - 'class' => 'form-control', |
|
560 | - 'list' => 'retired-list' |
|
559 | + 'class' => 'form-control', |
|
560 | + 'list' => 'retired-list' |
|
561 | 561 | )); |
562 | 562 | ?> |
563 | 563 | |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | $other_choices = elgg_view('input/text', array( |
596 | 596 | 'name' => 'other', |
597 | 597 | 'id' => 'other', |
598 | - 'class' => 'form-control', |
|
599 | - 'list' => 'other-list' |
|
598 | + 'class' => 'form-control', |
|
599 | + 'list' => 'other-list' |
|
600 | 600 | )); |
601 | 601 | ?> |
602 | 602 | |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | echo elgg_view('input/text', array( |
626 | 626 | 'name' => 'name', |
627 | 627 | 'id' => 'name', |
628 | - 'class' => 'form-control display_name', |
|
628 | + 'class' => 'form-control display_name', |
|
629 | 629 | 'value' => $name, |
630 | 630 | 'aria-describedby' => 'display_name_notice', |
631 | 631 | 'aria-required' => 'true', |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | echo elgg_view('input/text', array( |
645 | 645 | 'name' => 'email', |
646 | 646 | 'id' => 'email', |
647 | - 'class' => 'form-control', |
|
647 | + 'class' => 'form-control', |
|
648 | 648 | 'aria-required' => 'true', |
649 | 649 | 'required' => true |
650 | 650 | )); |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | echo elgg_view('input/text', array( |
679 | 679 | 'name' => 'email2', |
680 | 680 | 'id' => 'email2', |
681 | - 'class' => 'form-control', |
|
681 | + 'class' => 'form-control', |
|
682 | 682 | 'aria-required' => 'true', |
683 | 683 | 'required' => true |
684 | 684 | )); |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | echo elgg_view('input/password', array( |
695 | 695 | 'name' => 'password', |
696 | 696 | 'id' => 'password1', |
697 | - 'class' => 'password_test form-control', |
|
697 | + 'class' => 'password_test form-control', |
|
698 | 698 | 'value' => $password, |
699 | 699 | 'aria-required' => 'true', |
700 | 700 | 'required' => true |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | echo elgg_view('input/password', array( |
712 | 712 | 'name' => 'password2', |
713 | 713 | 'id' => 'password2', |
714 | - 'class' => 'password2_test form-control', |
|
714 | + 'class' => 'password2_test form-control', |
|
715 | 715 | 'value' => $password2, |
716 | 716 | 'aria-required' => 'true', |
717 | 717 | 'required' => true |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | <div class="checkbox"> |
725 | 725 | <label for="toc2"> |
726 | 726 | <?php |
727 | - echo elgg_view('input/checkbox', array( |
|
727 | + echo elgg_view('input/checkbox', array( |
|
728 | 728 | 'name' => 'toc2', |
729 | 729 | 'id' => 'toc2', |
730 | 730 | 'value' => '1', |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | |
750 | 750 | // note: disable |
751 | 751 | echo elgg_view('input/submit', array( |
752 | - 'value' => elgg_echo('gcRegister:register'), |
|
753 | - 'class' => 'btn-primary' |
|
752 | + 'value' => elgg_echo('gcRegister:register'), |
|
753 | + 'class' => 'btn-primary' |
|
754 | 754 | )); |
755 | 755 | echo '</div>'; |
756 | 756 | ?> |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | <?php |
112 | 112 | $InviteGUID = get_input('friend_guid'); |
113 | 113 | |
114 | - if( $InviteGUID ): |
|
114 | + if ($InviteGUID): |
|
115 | 115 | |
116 | 116 | $userObj = get_user($InviteGUID); |
117 | 117 | |
118 | - if( $userObj ): |
|
118 | + if ($userObj): |
|
119 | 119 | |
120 | 120 | $userType = $userObj->user_type; |
121 | 121 | // if user is public servant |
122 | - if( $userType == 'federal' ){ |
|
122 | + if ($userType == 'federal') { |
|
123 | 123 | $deptObj = elgg_get_entities(array( |
124 | 124 | 'type' => 'object', |
125 | 125 | 'subtype' => 'federal_departments', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $depts = get_entity($deptObj[0]->guid); |
128 | 128 | |
129 | 129 | $federal_departments = array(); |
130 | - if (get_current_language() == 'en'){ |
|
130 | + if (get_current_language() == 'en') { |
|
131 | 131 | $federal_departments = json_decode($depts->federal_departments_en, true); |
132 | 132 | } else { |
133 | 133 | $federal_departments = json_decode($depts->federal_departments_fr, true); |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | $department = $federal_departments[$userObj->federal]; |
137 | 137 | |
138 | 138 | // otherwise if user is student or academic |
139 | - } else if( $userType == 'student' || $userType == 'academic' ){ |
|
139 | + } else if ($userType == 'student' || $userType == 'academic') { |
|
140 | 140 | $institution = $userObj->institution; |
141 | 141 | $department = ($institution == 'university') ? $userObj->university : $userObj->college; |
142 | 142 | |
143 | 143 | // otherwise if user is provincial employee |
144 | - } else if( $userType == 'provincial' ){ |
|
144 | + } else if ($userType == 'provincial') { |
|
145 | 145 | $provObj = elgg_get_entities(array( |
146 | 146 | 'type' => 'object', |
147 | 147 | 'subtype' => 'provinces', |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $provs = get_entity($provObj[0]->guid); |
150 | 150 | |
151 | 151 | $provinces = array(); |
152 | - if (get_current_language() == 'en'){ |
|
152 | + if (get_current_language() == 'en') { |
|
153 | 153 | $provinces = json_decode($provs->provinces_en, true); |
154 | 154 | } else { |
155 | 155 | $provinces = json_decode($provs->provinces_fr, true); |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | $mins = get_entity($minObj[0]->guid); |
163 | 163 | |
164 | 164 | $ministries = array(); |
165 | - if (get_current_language() == 'en'){ |
|
165 | + if (get_current_language() == 'en') { |
|
166 | 166 | $ministries = json_decode($mins->ministries_en, true); |
167 | 167 | } else { |
168 | 168 | $ministries = json_decode($mins->ministries_fr, true); |
169 | 169 | } |
170 | 170 | |
171 | 171 | $department = $provinces[$userObj->provincial]; |
172 | - if($userObj->ministry && $userObj->ministry !== "default_invalid_value"){ $department .= ' / ' . $ministries[$userObj->provincial][$userObj->ministry]; } |
|
172 | + if ($userObj->ministry && $userObj->ministry !== "default_invalid_value") { $department .= ' / ' . $ministries[$userObj->provincial][$userObj->ministry]; } |
|
173 | 173 | |
174 | 174 | // otherwise show basic info |
175 | 175 | } else { |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $unis = get_entity($uniObj[0]->guid); |
272 | 272 | |
273 | 273 | $universities = array(); |
274 | - if (get_current_language() == 'en'){ |
|
274 | + if (get_current_language() == 'en') { |
|
275 | 275 | $universities = json_decode($unis->universities_en, true); |
276 | 276 | } else { |
277 | 277 | $universities = json_decode($unis->universities_fr, true); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $cols = get_entity($colObj[0]->guid); |
303 | 303 | |
304 | 304 | $colleges = array(); |
305 | - if (get_current_language() == 'en'){ |
|
305 | + if (get_current_language() == 'en') { |
|
306 | 306 | $colleges = json_decode($cols->colleges_en, true); |
307 | 307 | } else { |
308 | 308 | $colleges = json_decode($cols->colleges_fr, true); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $depts = get_entity($deptObj[0]->guid); |
350 | 350 | |
351 | 351 | $federal_departments = array(); |
352 | - if (get_current_language() == 'en'){ |
|
352 | + if (get_current_language() == 'en') { |
|
353 | 353 | $federal_departments = json_decode($depts->federal_departments_en, true); |
354 | 354 | } else { |
355 | 355 | $federal_departments = json_decode($depts->federal_departments_fr, true); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | $provs = get_entity($provObj[0]->guid); |
381 | 381 | |
382 | 382 | $provincial_departments = array(); |
383 | - if (get_current_language() == 'en'){ |
|
383 | + if (get_current_language() == 'en') { |
|
384 | 384 | $provincial_departments = json_decode($provs->provinces_en, true); |
385 | 385 | } else { |
386 | 386 | $provincial_departments = json_decode($provs->provinces_fr, true); |
@@ -409,15 +409,15 @@ discard block |
||
409 | 409 | $mins = get_entity($minObj[0]->guid); |
410 | 410 | |
411 | 411 | $ministries = array(); |
412 | - if (get_current_language() == 'en'){ |
|
412 | + if (get_current_language() == 'en') { |
|
413 | 413 | $ministries = json_decode($mins->ministries_en, true); |
414 | 414 | } else { |
415 | 415 | $ministries = json_decode($mins->ministries_fr, true); |
416 | 416 | } |
417 | 417 | asort($ministries); |
418 | 418 | |
419 | - if( !empty($provincial_departments) ){ |
|
420 | - foreach($provincial_departments as $province => $province_name){ |
|
419 | + if (!empty($provincial_departments)) { |
|
420 | + foreach ($provincial_departments as $province => $province_name) { |
|
421 | 421 | asort($ministries[$province]); |
422 | 422 | |
423 | 423 | $prov_id = str_replace(" ", "-", strtolower($province)); |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $municipals = get_entity($munObj[0]->guid); |
444 | 444 | |
445 | 445 | $municipal = array(); |
446 | - if (get_current_language() == 'en'){ |
|
446 | + if (get_current_language() == 'en') { |
|
447 | 447 | $municipal = json_decode($municipals->municipal_en, true); |
448 | 448 | } else { |
449 | 449 | $municipal = json_decode($municipals->municipal_fr, true); |
@@ -462,10 +462,10 @@ discard block |
||
462 | 462 | <?php echo $municipal_choices; ?> |
463 | 463 | <datalist id="municipal-list"> |
464 | 464 | <?php |
465 | - if( !empty($municipal) ){ |
|
465 | + if (!empty($municipal)) { |
|
466 | 466 | asort($municipal); |
467 | 467 | |
468 | - foreach($municipal as $municipal_name => $value){ |
|
468 | + foreach ($municipal as $municipal_name => $value) { |
|
469 | 469 | echo '<option value="' . $municipal_name . '">' . $value . '</option>'; |
470 | 470 | } |
471 | 471 | } |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | <?php echo $retired_choices; ?> |
567 | 567 | <datalist id="retired-list"> |
568 | 568 | <?php |
569 | - if( !empty($federal_departments) ){ |
|
570 | - foreach($federal_departments as $federal_name => $value){ |
|
569 | + if (!empty($federal_departments)) { |
|
570 | + foreach ($federal_departments as $federal_name => $value) { |
|
571 | 571 | echo '<option value="' . $value . '"></option>'; |
572 | 572 | } |
573 | 573 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | $others = get_entity($otherObj[0]->guid); |
586 | 586 | |
587 | 587 | $other = array(); |
588 | - if (get_current_language() == 'en'){ |
|
588 | + if (get_current_language() == 'en') { |
|
589 | 589 | $other = json_decode($others->other_en, true); |
590 | 590 | } else { |
591 | 591 | $other = json_decode($others->other_fr, true); |
@@ -605,8 +605,8 @@ discard block |
||
605 | 605 | <?php echo $other_choices; ?> |
606 | 606 | <datalist id="other-list"> |
607 | 607 | <?php |
608 | - if( !empty($other) ){ |
|
609 | - foreach($other as $other_name => $value){ |
|
608 | + if (!empty($other)) { |
|
609 | + foreach ($other as $other_name => $value) { |
|
610 | 610 | echo '<option value="' . $other_name . '">' . $value . '</option>'; |
611 | 611 | } |
612 | 612 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | $site_guid = $CONFIG->site_id; |
53 | 53 | } |
54 | 54 | |
55 | - $site_guid = (int)$site_guid; |
|
56 | - $user_guid = (int)$user_guid; |
|
55 | + $site_guid = (int) $site_guid; |
|
56 | + $user_guid = (int) $user_guid; |
|
57 | 57 | |
58 | 58 | $tokens = get_data("SELECT * from {$CONFIG->dbprefix}users_apisessions |
59 | 59 | where user_guid=$user_guid and site_guid=$site_guid"); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $site_guid = $CONFIG->site_id; |
80 | 80 | } |
81 | 81 | |
82 | - $site_guid = (int)$site_guid; |
|
82 | + $site_guid = (int) $site_guid; |
|
83 | 83 | $token = sanitise_string($token); |
84 | 84 | |
85 | 85 | $time = time(); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $site_guid = $CONFIG->site_id; |
111 | 111 | } |
112 | 112 | |
113 | - $site_guid = (int)$site_guid; |
|
113 | + $site_guid = (int) $site_guid; |
|
114 | 114 | $token = sanitise_string($token); |
115 | 115 | |
116 | 116 | return delete_data("DELETE from {$CONFIG->dbprefix}users_apisessions |