@@ -247,7 +247,7 @@ |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | $new_user->set('department',$deptString); |
250 | - $new_user->last_department_verify = time(); |
|
250 | + $new_user->last_department_verify = time(); |
|
251 | 251 | |
252 | 252 | // Forward on success, assume everything else is an error... |
253 | 253 | forward(); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | //if (get_input('noscript') !== 'retired' && get_input('form_type') === 'standard') |
40 | 40 | //{ |
41 | 41 | $username = get_input('username'); |
42 | - $email = str_replace(' ','',trim(get_input('email'))); |
|
42 | + $email = str_replace(' ', '', trim(get_input('email'))); |
|
43 | 43 | $password = trim(get_input('password', null, false)); |
44 | 44 | $password2 = trim(get_input('password2', null, false)); |
45 | 45 | $name = get_input('name'); |
46 | - $email2 = str_replace(' ','',get_input('email_initial')); |
|
46 | + $email2 = str_replace(' ', '', get_input('email_initial')); |
|
47 | 47 | $toc = get_input('toc2'); |
48 | 48 | |
49 | 49 | |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | $read_settings = $db_config->getConnectionConfig(\Elgg\Database\Config::READ_WRITE); |
113 | 113 | } |
114 | 114 | |
115 | - $connection = mysqli_connect($read_settings["host"], $read_settings["user"], $read_settings["password"], $read_settings["database"])or die(mysqli_error($connection)); |
|
116 | - $emaildomain = explode('@',$email); |
|
117 | - $query = "SELECT count(*) AS num FROM email_extensions WHERE ext ='".$emaildomain[1]."'"; |
|
115 | + $connection = mysqli_connect($read_settings["host"], $read_settings["user"], $read_settings["password"], $read_settings["database"]) or die(mysqli_error($connection)); |
|
116 | + $emaildomain = explode('@', $email); |
|
117 | + $query = "SELECT count(*) AS num FROM email_extensions WHERE ext ='" . $emaildomain[1] . "'"; |
|
118 | 118 | |
119 | - $result = mysqli_query($connection, $query)or die(mysqli_error($connection)); |
|
119 | + $result = mysqli_query($connection, $query) or die(mysqli_error($connection)); |
|
120 | 120 | $result = mysqli_fetch_array($result); |
121 | 121 | |
122 | - $emailgc = explode('.',$emaildomain[1]); |
|
123 | - $gcca = $emailgc[count($emailgc) - 2] .".".$emailgc[count($emailgc) - 1]; |
|
122 | + $emailgc = explode('.', $emaildomain[1]); |
|
123 | + $gcca = $emailgc[count($emailgc) - 2] . "." . $emailgc[count($emailgc) - 1]; |
|
124 | 124 | |
125 | 125 | mysqli_close($connection); |
126 | 126 | |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | if ($toc[0] != 1) |
130 | 130 | { |
131 | 131 | //throw new RegistrationException(elgg_echo('gcRegister:toc_error')); |
132 | - $resulting_error .= elgg_echo('gcRegister:toc_error').'<br/>'; |
|
132 | + $resulting_error .= elgg_echo('gcRegister:toc_error') . '<br/>'; |
|
133 | 133 | } |
134 | - error_log('num - '.is_null($result)); |
|
134 | + error_log('num - ' . is_null($result)); |
|
135 | 135 | // if domain doesn't exist in database, check if it's a gc.ca domain |
136 | 136 | if ($result['num'][0] <= 0) |
137 | 137 | { |
138 | 138 | if ($gcca !== 'gc.ca') |
139 | 139 | //throw new RegistrationException(elgg_echo('gcRegister:email_error')); |
140 | - $resulting_error .= '- '.elgg_echo('gcRegister:invalid_email').'<br/>'; |
|
140 | + $resulting_error .= '- ' . elgg_echo('gcRegister:invalid_email') . '<br/>'; |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | { |
146 | 146 | if (trim($email) !== trim($email2)) |
147 | 147 | //throw new RegistrationException(elgg_echo('gcRegister:email_error')); |
148 | - $resulting_error .= elgg_echo('gcRegister:email_mismatch').'<br/>'; |
|
148 | + $resulting_error .= elgg_echo('gcRegister:email_mismatch') . '<br/>'; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (trim($password) == "" || trim($password2) == "") { |
152 | 152 | //throw new RegistrationException(elgg_echo('RegistrationException:EmptyPassword')); |
153 | - $resulting_error .= '- '.elgg_echo('RegistrationException:EmptyPassword').'<br/>'; |
|
153 | + $resulting_error .= '- ' . elgg_echo('RegistrationException:EmptyPassword') . '<br/>'; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | if (strcmp($password, $password2) != 0) { |
157 | 157 | //throw new RegistrationException(elgg_echo('RegistrationException:PasswordMismatch')); |
158 | - $resulting_error .= '- '.elgg_echo('RegistrationException:PasswordMismatch').'<br/>'; |
|
158 | + $resulting_error .= '- ' . elgg_echo('RegistrationException:PasswordMismatch') . '<br/>'; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $provincesEn['pov-que'] = 'Government of Quebec'; |
223 | 223 | $provincesEn['pov-sask'] = 'Government of Saskatchewan'; |
224 | 224 | $provincesEn['pov-yuk'] = 'Government of Yukon'; |
225 | - $departmentsEn = array_merge($departmentsEn,$provincesEn); |
|
225 | + $departmentsEn = array_merge($departmentsEn, $provincesEn); |
|
226 | 226 | |
227 | 227 | $departmentsFr = json_decode($obj[0]->deptsFr, true); |
228 | 228 | $provincesFr['pov-alb'] = "Gouvernement de l'Alberta"; |
@@ -238,15 +238,15 @@ discard block |
||
238 | 238 | $provincesFr['pov-que'] = 'Gouvernement du Québec'; |
239 | 239 | $provincesFr['pov-sask'] = 'Gouvernement de Saskatchewan'; |
240 | 240 | $provincesFr['pov-yuk'] = 'Gouvernement du Yukon'; |
241 | - $departmentsFr = array_merge($departmentsFr,$provincesFr); |
|
241 | + $departmentsFr = array_merge($departmentsFr, $provincesFr); |
|
242 | 242 | |
243 | - if (get_current_language()=='en'){ |
|
244 | - $deptString = $departmentsEn[$deptNum]." / ".$departmentsFr[$deptNum]; |
|
245 | - }else{ |
|
246 | - $deptString = $departmentsFr[$deptNum]." / ".$departmentsEn[$deptNum]; |
|
243 | + if (get_current_language() == 'en') { |
|
244 | + $deptString = $departmentsEn[$deptNum] . " / " . $departmentsFr[$deptNum]; |
|
245 | + } else { |
|
246 | + $deptString = $departmentsFr[$deptNum] . " / " . $departmentsEn[$deptNum]; |
|
247 | 247 | } |
248 | 248 | |
249 | - $new_user->set('department',$deptString); |
|
249 | + $new_user->set('department', $deptString); |
|
250 | 250 | $new_user->last_department_verify = time(); |
251 | 251 | |
252 | 252 | // Forward on success, assume everything else is an error... |
@@ -135,17 +135,19 @@ discard block |
||
135 | 135 | // if domain doesn't exist in database, check if it's a gc.ca domain |
136 | 136 | if ($result['num'][0] <= 0) |
137 | 137 | { |
138 | - if ($gcca !== 'gc.ca') |
|
139 | - //throw new RegistrationException(elgg_echo('gcRegister:email_error')); |
|
138 | + if ($gcca !== 'gc.ca') { |
|
139 | + //throw new RegistrationException(elgg_echo('gcRegister:email_error')); |
|
140 | 140 | $resulting_error .= '- '.elgg_echo('gcRegister:invalid_email').'<br/>'; |
141 | + } |
|
141 | 142 | |
142 | 143 | } |
143 | 144 | |
144 | 145 | if (get_input('form_type') !== 'standard') |
145 | 146 | { |
146 | - if (trim($email) !== trim($email2)) |
|
147 | - //throw new RegistrationException(elgg_echo('gcRegister:email_error')); |
|
147 | + if (trim($email) !== trim($email2)) { |
|
148 | + //throw new RegistrationException(elgg_echo('gcRegister:email_error')); |
|
148 | 149 | $resulting_error .= elgg_echo('gcRegister:email_mismatch').'<br/>'; |
150 | + } |
|
149 | 151 | } |
150 | 152 | |
151 | 153 | if (trim($password) == "" || trim($password2) == "") { |
@@ -242,7 +244,7 @@ discard block |
||
242 | 244 | |
243 | 245 | if (get_current_language()=='en'){ |
244 | 246 | $deptString = $departmentsEn[$deptNum]." / ".$departmentsFr[$deptNum]; |
245 | - }else{ |
|
247 | + } else{ |
|
246 | 248 | $deptString = $departmentsFr[$deptNum]." / ".$departmentsEn[$deptNum]; |
247 | 249 | } |
248 | 250 |
@@ -78,13 +78,13 @@ |
||
78 | 78 | 'rename_friends:settings' => "Rename Friends for each language", |
79 | 79 | 'rename_friends:singular' => "Singular", |
80 | 80 | |
81 | - /* |
|
81 | + /* |
|
82 | 82 | * Default Notification Settings |
83 | 83 | */ |
84 | 84 | 'notifications_tools:friends_notifications' => "Choose the default notification method for {$lplural} notifications (This will be applied when a new user acount is created)", |
85 | - 'notifications_tools:friends_batch_method' => "Choose a notification method for {$lplural} notifications (This will affect all site users)", |
|
85 | + 'notifications_tools:friends_batch_method' => "Choose a notification method for {$lplural} notifications (This will affect all site users)", |
|
86 | 86 | |
87 | - /* |
|
87 | + /* |
|
88 | 88 | * Elgg Core |
89 | 89 | */ |
90 | 90 |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | $plural = elgg_get_plugin_setting($pluralvar, 'rename_friends'); |
10 | 10 | |
11 | 11 | // set defaults if setting can't be found |
12 | -if(empty($singular)){ $singular = elgg_echo('collègue'); } |
|
13 | -if(empty($plural)){ $plural = elgg_echo('collègues'); } |
|
12 | +if (empty($singular)) { $singular = elgg_echo('collègue'); } |
|
13 | +if (empty($plural)) { $plural = elgg_echo('collègues'); } |
|
14 | 14 | |
15 | 15 | // get first letter of each, and register variables for starting with uppercase and lowercase first letter |
16 | 16 | // $usingle = uppercase singluar eg. Friend |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | // get variables for groups |
39 | 39 | $singular = ''; |
40 | 40 | $plural = ''; |
41 | -if(elgg_is_active_plugin('rename_groups')){ |
|
41 | +if (elgg_is_active_plugin('rename_groups')) { |
|
42 | 42 | $singular = elgg_get_plugin_setting($singularvar, 'rename_groups'); |
43 | 43 | $plural = elgg_get_plugin_setting($pluralvar, 'rename_groups'); |
44 | 44 | } |
45 | 45 | |
46 | 46 | // set defaults if setting can't be found |
47 | - if(empty($singular)){ $singular = elgg_echo('groups:group'); } |
|
48 | - if(empty($plural)){ $plural = elgg_echo('groups'); } |
|
47 | + if (empty($singular)) { $singular = elgg_echo('groups:group'); } |
|
48 | + if (empty($plural)) { $plural = elgg_echo('groups'); } |
|
49 | 49 | |
50 | 50 | // get first letter of each, and register variables for starting with uppercase and lowercase first letter |
51 | 51 | // $usingle = uppercase singluar eg. Group |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | 'rename_friends:singular' => "Singular", |
80 | 80 | |
81 | 81 | |
82 | - /* |
|
82 | + /* |
|
83 | 83 | * Default Notification Settings |
84 | 84 | */ |
85 | 85 | 'notifications_tools:friends_notifications' => "Choose the default notification method for {$lplural} notifications (This will be applied when a new user acount is created)", |
86 | - 'notifications_tools:friends_batch_method' => "Choose a notification method for {$lplural} notifications (This will affect all site users)", |
|
86 | + 'notifications_tools:friends_batch_method' => "Choose a notification method for {$lplural} notifications (This will affect all site users)", |
|
87 | 87 | |
88 | - /* |
|
88 | + /* |
|
89 | 89 | * Elgg Core |
90 | 90 | */ |
91 | 91 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | You cannot reply to this email.", |
129 | 129 | |
130 | - /* |
|
130 | + /* |
|
131 | 131 | * Extendafriend |
132 | 132 | */ |
133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | 'extendafriend:updated' => "{$usingle} access circles have been updated", |
136 | 136 | |
137 | 137 | |
138 | - /* |
|
138 | + /* |
|
139 | 139 | * Friend Request |
140 | 140 | */ |
141 | 141 | |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | |
193 | 193 | |
194 | 194 | |
195 | - /* |
|
195 | + /* |
|
196 | 196 | * HypeEvents |
197 | 197 | */ |
198 | 198 | |
199 | - 'hj:events:friendevents' => "{$uplural} Events", |
|
199 | + 'hj:events:friendevents' => "{$uplural} Events", |
|
200 | 200 | |
201 | - /* |
|
201 | + /* |
|
202 | 202 | * Invite Friends |
203 | 203 | */ |
204 | 204 |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | $plural = elgg_get_plugin_setting($pluralvar, 'rename_friends'); |
10 | 10 | |
11 | 11 | // set defaults if setting can't be found |
12 | -if(empty($singular)){ $singular = elgg_echo('friend'); } |
|
13 | -if(empty($plural)){ $plural = elgg_echo('friends'); } |
|
12 | +if (empty($singular)) { $singular = elgg_echo('friend'); } |
|
13 | +if (empty($plural)) { $plural = elgg_echo('friends'); } |
|
14 | 14 | |
15 | 15 | // get first letter of each, and register variables for starting with uppercase and lowercase first letter |
16 | 16 | // $usingle = uppercase singluar eg. Friend |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | // get variables for groups |
39 | 39 | $singular = ''; |
40 | 40 | $plural = ''; |
41 | -if(elgg_is_active_plugin('rename_groups')){ |
|
41 | +if (elgg_is_active_plugin('rename_groups')) { |
|
42 | 42 | $singular = elgg_get_plugin_setting($singularvar, 'rename_groups'); |
43 | 43 | $plural = elgg_get_plugin_setting($pluralvar, 'rename_groups'); |
44 | 44 | } |
45 | 45 | |
46 | 46 | // set defaults if setting can't be found |
47 | - if(empty($singular)){ $singular = elgg_echo('groups:group'); } |
|
48 | - if(empty($plural)){ $plural = elgg_echo('groups'); } |
|
47 | + if (empty($singular)) { $singular = elgg_echo('groups:group'); } |
|
48 | + if (empty($plural)) { $plural = elgg_echo('groups'); } |
|
49 | 49 | |
50 | 50 | // get first letter of each, and register variables for starting with uppercase and lowercase first letter |
51 | 51 | // $usingle = uppercase singluar eg. Group |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | elgg_make_sticky_form('blog'); |
16 | 16 | |
17 | 17 | // save or preview |
18 | -$save = (bool)get_input('preview'); |
|
18 | +$save = (bool) get_input('preview'); |
|
19 | 19 | |
20 | 20 | // store errors to pass along |
21 | 21 | $error = FALSE; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'comments_on' => 'On', |
58 | 58 | 'excerpt' => '', |
59 | 59 | 'tags' => '', |
60 | - 'container_guid' => (int)get_input('container_guid'), |
|
60 | + 'container_guid' => (int) get_input('container_guid'), |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | // fail if a required entity isn't set |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | //implode for tranlation |
113 | 113 | $values['title'] = gc_implode_translation($values['title'], $values['title2']); |
114 | 114 | $values['excerpt'] = gc_implode_translation($values['excerpt'], $values['excerpt2']); |
115 | -$values['description'] =gc_implode_translation($values['description'], $values['description2']); |
|
115 | +$values['description'] = gc_implode_translation($values['description'], $values['description2']); |
|
116 | 116 | |
117 | 117 | // if preview, force status to be draft |
118 | 118 | if ($save == true) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // assign values to the entity, stopping on error. |
129 | 129 | if (!$error) { |
130 | 130 | foreach ($values as $name => $value) { |
131 | - if (($name != 'title2') && ($name != 'description2') && ($name != 'excerpt2')){ // remove input 2 in metastring table |
|
131 | + if (($name != 'title2') && ($name != 'description2') && ($name != 'excerpt2')) { // remove input 2 in metastring table |
|
132 | 132 | $blog->$name = $value; |
133 | 133 | } |
134 | 134 | } |
@@ -12,49 +12,49 @@ discard block |
||
12 | 12 | $guid = elgg_extract('guid', $vars, null); |
13 | 13 | |
14 | 14 | $help_link_main = elgg_view('output/url', array( |
15 | - 'text' => '[?] <span class="wb-invisible">'.elgg_echo("gctags:help:title").'</span>', |
|
16 | - 'href' => '/community-help', |
|
17 | - 'title' => elgg_echo("gctags:help:title"), |
|
18 | - 'target' => '_blank', |
|
15 | + 'text' => '[?] <span class="wb-invisible">'.elgg_echo("gctags:help:title").'</span>', |
|
16 | + 'href' => '/community-help', |
|
17 | + 'title' => elgg_echo("gctags:help:title"), |
|
18 | + 'target' => '_blank', |
|
19 | 19 | )); |
20 | 20 | |
21 | 21 | $help_link_tags = elgg_view('output/url', array( |
22 | - 'text' => '[?] <span class="wb-invisible">'.elgg_echo("gctags:help:tags").'</span>', |
|
23 | - 'href' => '/community-help#what-are-tags', |
|
24 | - 'title' => elgg_echo("gctags:help:tags"), |
|
25 | - 'target' => '_blank', |
|
22 | + 'text' => '[?] <span class="wb-invisible">'.elgg_echo("gctags:help:tags").'</span>', |
|
23 | + 'href' => '/community-help#what-are-tags', |
|
24 | + 'title' => elgg_echo("gctags:help:tags"), |
|
25 | + 'target' => '_blank', |
|
26 | 26 | )); |
27 | 27 | |
28 | 28 | $community_button = elgg_view('input/community',array( |
29 | - 'entity' => $entity, |
|
30 | - 'value' => $vars['audience'], |
|
31 | - 'guid' => $guid, |
|
29 | + 'entity' => $entity, |
|
30 | + 'value' => $vars['audience'], |
|
31 | + 'guid' => $guid, |
|
32 | 32 | )); |
33 | 33 | |
34 | 34 | //different mods like to call tags other things! neato |
35 | 35 | if(elgg_in_context('groups')){ |
36 | - $tag_name = 'interests'; |
|
36 | + $tag_name = 'interests'; |
|
37 | 37 | }else{ |
38 | - $tag_name ='tags'; |
|
38 | + $tag_name ='tags'; |
|
39 | 39 | } |
40 | 40 | $tags_button = elgg_view('input/tags',array( |
41 | - 'name' => $tag_name, |
|
42 | - 'value' => $vars[$tag_name], |
|
41 | + 'name' => $tag_name, |
|
42 | + 'value' => $vars[$tag_name], |
|
43 | 43 | )); |
44 | 44 | |
45 | 45 | |
46 | 46 | $save_button = elgg_view('input/submit', array( |
47 | 47 | 'value' => elgg_echo('publish'), |
48 | 48 | 'name' => 'save', |
49 | - 'class' => 'btn btn-primary form-submit', |
|
49 | + 'class' => 'btn btn-primary form-submit', |
|
50 | 50 | )); |
51 | 51 | |
52 | 52 | $cancel_tagging = elgg_view('output/url',array( |
53 | - 'text' => elgg_echo('close'), |
|
54 | - 'href' => '#', |
|
55 | - 'class' => 'close-tag-modal', |
|
56 | - 'data-dismiss' => 'modal', |
|
57 | - 'aria-label' => 'Close', |
|
53 | + 'text' => elgg_echo('close'), |
|
54 | + 'href' => '#', |
|
55 | + 'class' => 'close-tag-modal', |
|
56 | + 'data-dismiss' => 'modal', |
|
57 | + 'aria-label' => 'Close', |
|
58 | 58 | )); |
59 | 59 | $buttonText = elgg_echo('gctags:button:create'); |
60 | 60 | ?> |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | </div> |
73 | 73 | <div class="modal-body"> |
74 | 74 | <?php |
75 | - echo $community_button; |
|
76 | - echo elgg_format_element('label', array('for' => 'tags'), elgg_echo('tags')); |
|
77 | - echo elgg_format_element('span',array('class' => 'mrgn-lft-sm'),$help_link_tags); |
|
78 | - echo $tags_button; |
|
75 | + echo $community_button; |
|
76 | + echo elgg_format_element('label', array('for' => 'tags'), elgg_echo('tags')); |
|
77 | + echo elgg_format_element('span',array('class' => 'mrgn-lft-sm'),$help_link_tags); |
|
78 | + echo $tags_button; |
|
79 | 79 | |
80 | - ?> |
|
80 | + ?> |
|
81 | 81 | </div> |
82 | 82 | <div class="modal-footer"> |
83 | 83 | <?php |
84 | - echo $cancel_tagging; |
|
85 | - echo $save_button; |
|
86 | - ?> |
|
84 | + echo $cancel_tagging; |
|
85 | + echo $save_button; |
|
86 | + ?> |
|
87 | 87 | </div> |
88 | 88 | </div> |
89 | 89 | </div> |
@@ -12,32 +12,32 @@ discard block |
||
12 | 12 | $guid = elgg_extract('guid', $vars, null); |
13 | 13 | |
14 | 14 | $help_link_main = elgg_view('output/url', array( |
15 | - 'text' => '[?] <span class="wb-invisible">'.elgg_echo("gctags:help:title").'</span>', |
|
15 | + 'text' => '[?] <span class="wb-invisible">' . elgg_echo("gctags:help:title") . '</span>', |
|
16 | 16 | 'href' => '/community-help', |
17 | 17 | 'title' => elgg_echo("gctags:help:title"), |
18 | 18 | 'target' => '_blank', |
19 | 19 | )); |
20 | 20 | |
21 | 21 | $help_link_tags = elgg_view('output/url', array( |
22 | - 'text' => '[?] <span class="wb-invisible">'.elgg_echo("gctags:help:tags").'</span>', |
|
22 | + 'text' => '[?] <span class="wb-invisible">' . elgg_echo("gctags:help:tags") . '</span>', |
|
23 | 23 | 'href' => '/community-help#what-are-tags', |
24 | 24 | 'title' => elgg_echo("gctags:help:tags"), |
25 | 25 | 'target' => '_blank', |
26 | 26 | )); |
27 | 27 | |
28 | -$community_button = elgg_view('input/community',array( |
|
28 | +$community_button = elgg_view('input/community', array( |
|
29 | 29 | 'entity' => $entity, |
30 | 30 | 'value' => $vars['audience'], |
31 | 31 | 'guid' => $guid, |
32 | 32 | )); |
33 | 33 | |
34 | 34 | //different mods like to call tags other things! neato |
35 | -if(elgg_in_context('groups')){ |
|
35 | +if (elgg_in_context('groups')) { |
|
36 | 36 | $tag_name = 'interests'; |
37 | -}else{ |
|
38 | - $tag_name ='tags'; |
|
37 | +} else { |
|
38 | + $tag_name = 'tags'; |
|
39 | 39 | } |
40 | -$tags_button = elgg_view('input/tags',array( |
|
40 | +$tags_button = elgg_view('input/tags', array( |
|
41 | 41 | 'name' => $tag_name, |
42 | 42 | 'value' => $vars[$tag_name], |
43 | 43 | )); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'class' => 'btn btn-primary form-submit', |
50 | 50 | )); |
51 | 51 | |
52 | -$cancel_tagging = elgg_view('output/url',array( |
|
52 | +$cancel_tagging = elgg_view('output/url', array( |
|
53 | 53 | 'text' => elgg_echo('close'), |
54 | 54 | 'href' => '#', |
55 | 55 | 'class' => 'close-tag-modal', |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <div class="modal-header"> |
67 | 67 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
68 | 68 | <div class="modal-title"> |
69 | - <span class="h4"><?php echo elgg_echo('gctags:modal:header');?></span> |
|
69 | + <span class="h4"><?php echo elgg_echo('gctags:modal:header'); ?></span> |
|
70 | 70 | <span><?php echo $help_link; ?></span> |
71 | 71 | </div> |
72 | 72 | </div> |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | <?php |
75 | 75 | echo $community_button; |
76 | 76 | echo elgg_format_element('label', array('for' => 'tags'), elgg_echo('tags')); |
77 | - echo elgg_format_element('span',array('class' => 'mrgn-lft-sm'),$help_link_tags); |
|
77 | + echo elgg_format_element('span', array('class' => 'mrgn-lft-sm'), $help_link_tags); |
|
78 | 78 | echo $tags_button; |
79 | 79 | |
80 | 80 | ?> |
@@ -34,7 +34,7 @@ |
||
34 | 34 | //different mods like to call tags other things! neato |
35 | 35 | if(elgg_in_context('groups')){ |
36 | 36 | $tag_name = 'interests'; |
37 | -}else{ |
|
37 | +} else{ |
|
38 | 38 | $tag_name ='tags'; |
39 | 39 | } |
40 | 40 | $tags_button = elgg_view('input/tags',array( |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | /** |
134 | 134 | * External Pages |
135 | 135 | */ |
136 | - 'expages:about' => "About", // GCChange change - Ilia: Bilingual page url |
|
137 | - 'expages:terms' => "Terms", // GCChange change - Ilia: Bilingual page url |
|
138 | - 'expages:privacy' => "Privacy", // GCChange change - Ilia: Bilingual page url |
|
136 | + 'expages:about' => "About", // GCChange change - Ilia: Bilingual page url |
|
137 | + 'expages:terms' => "Terms", // GCChange change - Ilia: Bilingual page url |
|
138 | + 'expages:privacy' => "Privacy", // GCChange change - Ilia: Bilingual page url |
|
139 | 139 | 'expages:a_propos' => "À propos", |
140 | 140 | 'expages:termes' => "Termes", |
141 | 141 | 'expages:confidentialite' => "Confidentialité", |
@@ -147,20 +147,20 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * Notifications |
149 | 149 | */ |
150 | - 'cp_newsletter:notice' => "Choisissez le moyen par lequel vous souhaitez recevoir des avis sur les activités de GCcollab qui vous intéressent. Le <strong>résumé des notifications</strong> vous permet de recevoir un courriel quotidien ou hebdomadaire contenant un sommaire des activités auxquelles vous êtes abonné. Vous préférez recevoir un avis instantané? Oubliez le résumé et sélectionnez le contenu pour lequel vous souhaitez recevoir des avis en temps réel. Veuillez noter que les avis par courriel sont envoyés à l’adresse électronique utilisée dans vos <a href='".elgg_get_site_url()."settings/user/?utm_source=notification_digest&utm_medium=email'>paramètres d’utilisateur</a>.", |
|
150 | + 'cp_newsletter:notice' => "Choisissez le moyen par lequel vous souhaitez recevoir des avis sur les activités de GCcollab qui vous intéressent. Le <strong>résumé des notifications</strong> vous permet de recevoir un courriel quotidien ou hebdomadaire contenant un sommaire des activités auxquelles vous êtes abonné. Vous préférez recevoir un avis instantané? Oubliez le résumé et sélectionnez le contenu pour lequel vous souhaitez recevoir des avis en temps réel. Veuillez noter que les avis par courriel sont envoyés à l’adresse électronique utilisée dans vos <a href='" . elgg_get_site_url() . "settings/user/?utm_source=notification_digest&utm_medium=email'>paramètres d’utilisateur</a>.", |
|
151 | 151 | 'cp_newsletter:notice:disable_digest' => "Le résumé des avis est maintenant activé; veuillez choisir ci après vos préférences applicables au résumé (fréquence et langue). Le résumé comprendra tout le contenu sélectionné dans la colonne « Courriel », de même que les abonnements dans la section « Autres abonnements de contenu ». Si vous choisissez d’activer le résumé des notifications, vous ne recevrez plus de notifications par courriel ou de site en temps réel (instantanément) au moment où ont lieu les différentes activités de GCcollab (à l’exception des notifications de type administratif).", |
152 | 152 | 'cp_notifications:mail_body:subtype:thewire' => "<a href='%s'>%s</a> a publié sur le <a href='%s'>%s</a>", |
153 | - 'cp_newsletter:body:nothing' => "Il semble que c'était calme dans votre réseau sur GCcollab. Joignez-vous à des <a href='".elgg_get_site_url()."groups/all?filter=popular?utm_source=notification_digest&utm_medium=email'>groupes</a> d'intérêt, partagez des informations et ajoutez des nouveaux <a href='".elgg_get_site_url()."members/popular?utm_source=notification_digest&utm_medium=email'>collègues</a> pour rester informé et grandir votre réseau!", |
|
153 | + 'cp_newsletter:body:nothing' => "Il semble que c'était calme dans votre réseau sur GCcollab. Joignez-vous à des <a href='" . elgg_get_site_url() . "groups/all?filter=popular?utm_source=notification_digest&utm_medium=email'>groupes</a> d'intérêt, partagez des informations et ajoutez des nouveaux <a href='" . elgg_get_site_url() . "members/popular?utm_source=notification_digest&utm_medium=email'>collègues</a> pour rester informé et grandir votre réseau!", |
|
154 | 154 | 'cp_notification:email_header' => "Ceci est un message généré par le système de GCcollab. Veuillez ne pas répondre à ce message", |
155 | 155 | 'cp_notify:body_edit:description' => "<a href='%s'>Visualiser ou afficher un commentaire</a> <br/> |
156 | 156 | Vous pouvez aimer, partager et vous abonner à ce contenu dans GCcollab.", |
157 | 157 | 'cp_notify:body_group_invite_email:title' => "<a href='%s'>%s</a> vous a invité à joindre le groupe <a href='%s'>%s</a> sur GCcollab. <br>", |
158 | 158 | 'cp_notify:body_group_invite_email:description' => "<a href='%s'>Inscrivez-vous maintenant</a> et vous serez automatiquement ajouté au groupe.<br/><br/> |
159 | 159 | |
160 | - Si vous désirez vous inscrire à une date ultérieure en utilisant le <a href='".elgg_get_site_url()."register'>formulaire d’inscription</a> sur GCcollab, vous pouvez vous joindre au groupe en utilisant le code suivant sur votre page d'<a href='%s'>invitation de groupe</a> : %s .<br/><br/> |
|
160 | + Si vous désirez vous inscrire à une date ultérieure en utilisant le <a href='".elgg_get_site_url() . "register'>formulaire d’inscription</a> sur GCcollab, vous pouvez vous joindre au groupe en utilisant le code suivant sur votre page d'<a href='%s'>invitation de groupe</a> : %s .<br/><br/> |
|
161 | 161 | |
162 | - Vous-êtes déjà sur GCcollab? Votre adresse est peut-être désuète. <a href='".elgg_get_site_url()."login'>Connectez-vous</a> et mettez à jour vos paramètres de comptes.<br/> ", |
|
163 | - 'cp_notify:footer:no_user' => 'Besoin d\'aide? <a href="'.elgg_get_site_url().'help/knowledgebase/?utm_source=notification&utm_medium=email">Contactez-nous</a>.', |
|
162 | + Vous-êtes déjà sur GCcollab? Votre adresse est peut-être désuète. <a href='".elgg_get_site_url() . "login'>Connectez-vous</a> et mettez à jour vos paramètres de comptes.<br/> ", |
|
163 | + 'cp_notify:footer:no_user' => 'Besoin d\'aide? <a href="' . elgg_get_site_url() . 'help/knowledgebase/?utm_source=notification&utm_medium=email">Contactez-nous</a>.', |
|
164 | 164 | 'cp_personalized_message' => "<div style='border: 1px solid #46246A; padding:5px; margin-bottom:10px;'>%s vous a envoyé un message personnalisé:<br/><i>%s</i></div>", |
165 | 165 | 'cp_notify:body_new_content:description' => "La description de leur nouvelle publication se lit comme suit : <br/> |
166 | 166 | %s <br/> |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | <p>Il est possible d’obtenir des réponses à toute question ayant trait au codage et à tout problème lié(e) à la plateforme à partir de GitHub. Ainsi, si vous avez des suggestions ou souhaitez nous aider à les améliorer, joignez-vous à nous!</p>", |
193 | 193 | 'cp_notify:body_validate_user:description' => "Bienvenue sur GCconnex. Afin de compléter votre inscription, veuillez valider votre compte enregistré sous le nom %s en cliquant sur le lien suivant : %s", |
194 | 194 | 'cp_notify:footer' => "", |
195 | - 'cp_notify:footer2' => "Besoin d’aide? <a href='".elgg_get_site_url()."help/knowledgebase/?utm_source=notification&utm_medium=email'>Contactez-nous</a>.<br/>Pour vous désabonner de ces notifications, connectez-vous à GCcollab et modifiez vos <a href='%s'>paramètres de notifications</a>.", |
|
195 | + 'cp_notify:footer2' => "Besoin d’aide? <a href='" . elgg_get_site_url() . "help/knowledgebase/?utm_source=notification&utm_medium=email'>Contactez-nous</a>.<br/>Pour vous désabonner de ces notifications, connectez-vous à GCcollab et modifiez vos <a href='%s'>paramètres de notifications</a>.", |
|
196 | 196 | 'cp_notify:visitTutorials'=>'', |
197 | 197 | 'cp_notify:body:contentshare:description' => "<p>%s a partagé votre contenu sur le fil.</p> |
198 | 198 | <p><i>%s</i></p> <br/> |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | /** |
150 | 150 | * External Pages |
151 | 151 | */ |
152 | - 'expages:about' => "About", // GCChange change - Ilia: Bilingual page url |
|
153 | - 'expages:terms' => "Terms", // GCChange change - Ilia: Bilingual page url |
|
154 | - 'expages:privacy' => "Privacy", // GCChange change - Ilia: Bilingual page url |
|
152 | + 'expages:about' => "About", // GCChange change - Ilia: Bilingual page url |
|
153 | + 'expages:terms' => "Terms", // GCChange change - Ilia: Bilingual page url |
|
154 | + 'expages:privacy' => "Privacy", // GCChange change - Ilia: Bilingual page url |
|
155 | 155 | 'expages:a_propos' => "À propos", |
156 | 156 | 'expages:termes' => "Termes", |
157 | 157 | 'expages:confidentialite' => "Confidentialité", |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | /** |
164 | 164 | * Notifications |
165 | 165 | */ |
166 | - 'cp_newsletter:notice' => "Choose how you want to be notified of GCcollab activities of interest to you. The <strong>notifications digest</strong> can be used to receive a daily or weekly email that provides a summary of the activities to which you are subscribed. Prefer to receive instant notification? Forgo the digest and select the content for which you want to receive notification in real-time. Please note that email notifications are sent to the email address used in your <a href='".elgg_get_site_url()."settings/user/?utm_source=notification_digest&utm_medium=email'>Account Settings</a>.", |
|
166 | + 'cp_newsletter:notice' => "Choose how you want to be notified of GCcollab activities of interest to you. The <strong>notifications digest</strong> can be used to receive a daily or weekly email that provides a summary of the activities to which you are subscribed. Prefer to receive instant notification? Forgo the digest and select the content for which you want to receive notification in real-time. Please note that email notifications are sent to the email address used in your <a href='" . elgg_get_site_url() . "settings/user/?utm_source=notification_digest&utm_medium=email'>Account Settings</a>.", |
|
167 | 167 | 'cp_newsletter:notice:disable_digest' => "The notifications digest is now enabled; please select your digest preferences below (frequency and language preference). The digest will include all content selected in the 'Email' column below, as well the subscriptions in the 'Other content subscriptions' section. If you choose to enable the notifications digest, you will no longer receive real-time (instant) notifications by email and/or on the site, about activities happening on GCcollab (with the exception of administrative-type notifications).", |
168 | 168 | 'cp_notifications:mail_body:subtype:thewire' => "<a href='%s'>%s</a> posted on the <a href='%s'>%s</a>", |
169 | - 'cp_newsletter:body:nothing' => "It seems it was quiet in your network on GCcollab. Join <a href='".elgg_get_site_url()."groups/all?filter=popular?utm_source=notification_digest&utm_medium=email'>groups</a> of interest, share information and add new <a href='".elgg_get_site_url()."members/popular?utm_source=notification_digest&utm_medium=email'>colleagues</a> to stay informed and grow your network!", |
|
169 | + 'cp_newsletter:body:nothing' => "It seems it was quiet in your network on GCcollab. Join <a href='" . elgg_get_site_url() . "groups/all?filter=popular?utm_source=notification_digest&utm_medium=email'>groups</a> of interest, share information and add new <a href='" . elgg_get_site_url() . "members/popular?utm_source=notification_digest&utm_medium=email'>colleagues</a> to stay informed and grow your network!", |
|
170 | 170 | 'cp_notification:email_header' => "This is a system-generated message from GCcollab. Please do not reply to this message", |
171 | 171 | 'cp_notify:body_edit:description' => "<a href='%s'>View or comment</a><br/>You can like, share or subscribe to this content directly in GCcollab", |
172 | 172 | 'cp_notify:body_group_invite_email:title' => "<a href='%s'>%s</a> invited you to join the <a href='%s'>%s</a> group on GCcollab.<br>", |
173 | 173 | 'cp_notify:body_group_invite_email:description' => "<a href='%s'>Register now</a> and be automatically added to the group.<br/><br/> |
174 | 174 | |
175 | - If you would like to register at a later time using the <a href='".elgg_get_site_url()."register'>Registration form</a> on GCcollab, you can join the group by using the following code on your <a href='%s'>group invitations</a> page: %s .<br/><br/> |
|
175 | + If you would like to register at a later time using the <a href='".elgg_get_site_url() . "register'>Registration form</a> on GCcollab, you can join the group by using the following code on your <a href='%s'>group invitations</a> page: %s .<br/><br/> |
|
176 | 176 | |
177 | - Already on GCcollab? Your email address may be out of date. <a href='".elgg_get_site_url()."login'>Login</a> and update your account settings.<br/> ", |
|
178 | - 'cp_notify:footer:no_user' => 'Need help? <a href="'.elgg_get_site_url().'help/knowledgebase/?utm_source=notification&utm_medium=email">Contact us</a>.', |
|
177 | + Already on GCcollab? Your email address may be out of date. <a href='".elgg_get_site_url() . "login'>Login</a> and update your account settings.<br/> ", |
|
178 | + 'cp_notify:footer:no_user' => 'Need help? <a href="' . elgg_get_site_url() . 'help/knowledgebase/?utm_source=notification&utm_medium=email">Contact us</a>.', |
|
179 | 179 | 'cp_personalized_message' => "<div style='border: 1px solid #46246A; padding:5px; margin-bottom:10px;'>Personalized message from %s:<br/><i>%s</i></div>", |
180 | 180 | 'cp_notify:body_new_content:description' => "The description of the new posting is: <br/> |
181 | 181 | %s <br/> |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | <p>All of the code and issues related to the platform are available on GitHub, so if you have any suggestions or want to help us make them better, please join in!</p>", |
208 | 208 | 'cp_notify:body_validate_user:description' => "Welcome to GCcollab, to complete your registration, please validate the account registered under %s by clicking on this link: %s", |
209 | 209 | 'cp_notify:footer' => "", |
210 | - 'cp_notify:footer2' => "Need help? <a href='".elgg_get_site_url()."help/knowledgebase/?utm_source=notification&utm_medium=email'>Contact us</a>.<br/>To unsubscribe from these notifications, login to GCcollab and edit your <a href='%s'>notifications' settings</a>.", |
|
210 | + 'cp_notify:footer2' => "Need help? <a href='" . elgg_get_site_url() . "help/knowledgebase/?utm_source=notification&utm_medium=email'>Contact us</a>.<br/>To unsubscribe from these notifications, login to GCcollab and edit your <a href='%s'>notifications' settings</a>.", |
|
211 | 211 | 'cp_notify:visitTutorials'=>'', |
212 | 212 | 'cp_notify:body:contentshare:description' => "<p>%s shared your content on the wire.</p> |
213 | 213 | <p><i>%s</i></p> <br/> |
@@ -11,61 +11,61 @@ discard block |
||
11 | 11 | elgg_register_event_handler('init', 'system', 'gccollab_theme_init'); |
12 | 12 | |
13 | 13 | function gccollab_theme_init() { |
14 | - elgg_register_page_handler('hello', 'gccollab_theme_page_handler'); |
|
15 | - elgg_register_plugin_hook_handler('register', 'menu:site', 'career_menu_hander'); |
|
14 | + elgg_register_page_handler('hello', 'gccollab_theme_page_handler'); |
|
15 | + elgg_register_plugin_hook_handler('register', 'menu:site', 'career_menu_hander'); |
|
16 | 16 | |
17 | - //jobs.gc.ca menu link |
|
18 | - elgg_register_menu_item('subSite', array( |
|
19 | - 'name' => 'jobs', |
|
20 | - 'text' => elgg_echo('wet:jobs:link'), |
|
21 | - 'href' => elgg_echo('wet:jobs:href'), |
|
22 | - 'target' => '_blank', |
|
23 | - )); |
|
17 | + //jobs.gc.ca menu link |
|
18 | + elgg_register_menu_item('subSite', array( |
|
19 | + 'name' => 'jobs', |
|
20 | + 'text' => elgg_echo('wet:jobs:link'), |
|
21 | + 'href' => elgg_echo('wet:jobs:href'), |
|
22 | + 'target' => '_blank', |
|
23 | + )); |
|
24 | 24 | |
25 | - //menu item for Jobs Marketplace |
|
26 | - elgg_register_menu_item('subSite', array( |
|
27 | - 'name' => 'Jobs Marketplace', |
|
28 | - 'text' => elgg_echo('wet:marketplace:link'), |
|
29 | - 'href' => elgg_echo('wet:marketplace:href'), |
|
30 | - )); |
|
25 | + //menu item for Jobs Marketplace |
|
26 | + elgg_register_menu_item('subSite', array( |
|
27 | + 'name' => 'Jobs Marketplace', |
|
28 | + 'text' => elgg_echo('wet:marketplace:link'), |
|
29 | + 'href' => elgg_echo('wet:marketplace:href'), |
|
30 | + )); |
|
31 | 31 | |
32 | - //menu item for career dropdown |
|
33 | - elgg_register_menu_item('site', array( |
|
32 | + //menu item for career dropdown |
|
33 | + elgg_register_menu_item('site', array( |
|
34 | 34 | 'name' => 'career', |
35 | 35 | 'href' => '#career_menu', |
36 | 36 | 'text' => elgg_echo('career') . '<span class="expicon glyphicon glyphicon-chevron-down"></span>' |
37 | - )); |
|
37 | + )); |
|
38 | 38 | |
39 | - elgg_register_page_handler('about', 'expages_collab_page_handler'); |
|
40 | - elgg_register_page_handler('a_propos', 'expages_collab_page_handler'); |
|
39 | + elgg_register_page_handler('about', 'expages_collab_page_handler'); |
|
40 | + elgg_register_page_handler('a_propos', 'expages_collab_page_handler'); |
|
41 | 41 | |
42 | - elgg_register_page_handler('terms', 'expages_collab_page_handler'); |
|
43 | - elgg_register_page_handler('termes', 'expages_collab_page_handler'); |
|
42 | + elgg_register_page_handler('terms', 'expages_collab_page_handler'); |
|
43 | + elgg_register_page_handler('termes', 'expages_collab_page_handler'); |
|
44 | 44 | |
45 | - elgg_register_page_handler('privacy', 'expages_collab_page_handler'); |
|
46 | - elgg_register_page_handler('confidentialite', 'expages_collab_page_handler'); |
|
45 | + elgg_register_page_handler('privacy', 'expages_collab_page_handler'); |
|
46 | + elgg_register_page_handler('confidentialite', 'expages_collab_page_handler'); |
|
47 | 47 | |
48 | - elgg_register_page_handler('faq', 'expages_collab_page_handler'); |
|
49 | - elgg_register_page_handler('qfp', 'expages_collab_page_handler'); |
|
48 | + elgg_register_page_handler('faq', 'expages_collab_page_handler'); |
|
49 | + elgg_register_page_handler('qfp', 'expages_collab_page_handler'); |
|
50 | 50 | |
51 | - elgg_register_page_handler('participating_organizations', 'expages_collab_page_handler'); |
|
52 | - elgg_register_page_handler('organismes_participants', 'expages_collab_page_handler'); |
|
51 | + elgg_register_page_handler('participating_organizations', 'expages_collab_page_handler'); |
|
52 | + elgg_register_page_handler('organismes_participants', 'expages_collab_page_handler'); |
|
53 | 53 | |
54 | - // Register public external pages |
|
55 | - elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'expages_collab_public'); |
|
54 | + // Register public external pages |
|
55 | + elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'expages_collab_public'); |
|
56 | 56 | |
57 | - elgg_register_plugin_hook_handler('register', 'menu:expages', 'expages_collab_menu_register_hook'); |
|
57 | + elgg_register_plugin_hook_handler('register', 'menu:expages', 'expages_collab_menu_register_hook'); |
|
58 | 58 | |
59 | - // add footer links |
|
60 | - expages_collab_setup_footer_menu(); |
|
59 | + // add footer links |
|
60 | + expages_collab_setup_footer_menu(); |
|
61 | 61 | |
62 | - elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'collab_menu_block_handler'); |
|
62 | + elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'collab_menu_block_handler'); |
|
63 | 63 | |
64 | - elgg_register_plugin_hook_handler('members:list', 'type', "members_list_type"); |
|
65 | - elgg_register_plugin_hook_handler('members:config', 'tabs', "members_nav_type"); |
|
64 | + elgg_register_plugin_hook_handler('members:list', 'type', "members_list_type"); |
|
65 | + elgg_register_plugin_hook_handler('members:config', 'tabs', "members_nav_type"); |
|
66 | 66 | |
67 | - elgg_register_widget_type('poll',elgg_echo('polls:my_widget_title'),elgg_echo('polls:my_widget_description'), array("profile", "dashboard", "index", "groups"), true); |
|
68 | - elgg_register_widget_type('poll_individual',elgg_echo('polls:individual'),elgg_echo('poll_individual_group:widget:description'), array("profile", "dashboard", "index", "groups"), true); |
|
67 | + elgg_register_widget_type('poll',elgg_echo('polls:my_widget_title'),elgg_echo('polls:my_widget_description'), array("profile", "dashboard", "index", "groups"), true); |
|
68 | + elgg_register_widget_type('poll_individual',elgg_echo('polls:individual'),elgg_echo('poll_individual_group:widget:description'), array("profile", "dashboard", "index", "groups"), true); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | */ |
75 | 75 | function expages_collab_public($hook, $handler, $return, $params){ |
76 | - $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase'); // GCChange change - Ilia: Bilingual page url |
|
77 | - return array_merge($pages, $return); |
|
76 | + $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase'); // GCChange change - Ilia: Bilingual page url |
|
77 | + return array_merge($pages, $return); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Setup the links to site pages |
82 | 82 | */ |
83 | 83 | function expages_collab_setup_footer_menu() { |
84 | - $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase'); // GCChange change - Ilia: Bilingual page url |
|
84 | + $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase'); // GCChange change - Ilia: Bilingual page url |
|
85 | 85 | |
86 | - foreach ($pages as $page) { |
|
87 | - $url = "$page"; |
|
88 | - $wg_item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url); |
|
89 | - elgg_register_menu_item('walled_garden', $wg_item); |
|
90 | - |
|
91 | - $footer_item = clone $wg_item; |
|
92 | - elgg_register_menu_item('footer', $footer_item); |
|
93 | - } |
|
86 | + foreach ($pages as $page) { |
|
87 | + $url = "$page"; |
|
88 | + $wg_item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url); |
|
89 | + elgg_register_menu_item('walled_garden', $wg_item); |
|
90 | + |
|
91 | + $footer_item = clone $wg_item; |
|
92 | + elgg_register_menu_item('footer', $footer_item); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -101,44 +101,44 @@ discard block |
||
101 | 101 | * @return bool |
102 | 102 | */ |
103 | 103 | function expages_collab_page_handler($page, $handler) { |
104 | - if ($handler == 'expages') { |
|
105 | - expages_url_forwarder($page[1]); |
|
106 | - } |
|
107 | - $type = strtolower($handler); |
|
108 | - |
|
109 | - $title = elgg_echo("expages:$type"); |
|
110 | - $header = elgg_view_title($title); |
|
111 | - |
|
112 | - $object = elgg_get_entities(array( |
|
113 | - 'type' => 'object', |
|
114 | - 'subtype' => $type, |
|
115 | - 'limit' => 1, |
|
116 | - )); |
|
117 | - if ($object) { |
|
118 | - $content .= elgg_view('output/longtext', array('value' => $object[0]->description)); |
|
119 | - } else { |
|
120 | - $content .= elgg_echo("expages:notset"); |
|
121 | - } |
|
122 | - $content = elgg_view('expages/wrapper', array('content' => $content)); |
|
104 | + if ($handler == 'expages') { |
|
105 | + expages_url_forwarder($page[1]); |
|
106 | + } |
|
107 | + $type = strtolower($handler); |
|
108 | + |
|
109 | + $title = elgg_echo("expages:$type"); |
|
110 | + $header = elgg_view_title($title); |
|
111 | + |
|
112 | + $object = elgg_get_entities(array( |
|
113 | + 'type' => 'object', |
|
114 | + 'subtype' => $type, |
|
115 | + 'limit' => 1, |
|
116 | + )); |
|
117 | + if ($object) { |
|
118 | + $content .= elgg_view('output/longtext', array('value' => $object[0]->description)); |
|
119 | + } else { |
|
120 | + $content .= elgg_echo("expages:notset"); |
|
121 | + } |
|
122 | + $content = elgg_view('expages/wrapper', array('content' => $content)); |
|
123 | 123 | |
124 | - if (elgg_is_admin_logged_in()) { |
|
125 | - elgg_register_menu_item('title', array( |
|
126 | - 'name' => 'edit', |
|
127 | - 'text' => elgg_echo('edit'), |
|
128 | - 'href' => "admin/appearance/expages?type=$type", |
|
129 | - 'link_class' => 'elgg-button elgg-button-action', |
|
130 | - )); |
|
131 | - } |
|
132 | - |
|
133 | - if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) { |
|
134 | - $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content)); |
|
135 | - echo elgg_view_page($title, $body); |
|
136 | - } else { |
|
137 | - elgg_load_css('elgg.walled_garden'); |
|
138 | - $body = elgg_view_layout('walled_garden', array('content' => $header . $content)); |
|
139 | - echo elgg_view_page($title, $body, 'walled_garden'); |
|
140 | - } |
|
141 | - return true; |
|
124 | + if (elgg_is_admin_logged_in()) { |
|
125 | + elgg_register_menu_item('title', array( |
|
126 | + 'name' => 'edit', |
|
127 | + 'text' => elgg_echo('edit'), |
|
128 | + 'href' => "admin/appearance/expages?type=$type", |
|
129 | + 'link_class' => 'elgg-button elgg-button-action', |
|
130 | + )); |
|
131 | + } |
|
132 | + |
|
133 | + if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) { |
|
134 | + $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content)); |
|
135 | + echo elgg_view_page($title, $body); |
|
136 | + } else { |
|
137 | + elgg_load_css('elgg.walled_garden'); |
|
138 | + $body = elgg_view_layout('walled_garden', array('content' => $header . $content)); |
|
139 | + echo elgg_view_page($title, $body, 'walled_garden'); |
|
140 | + } |
|
141 | + return true; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -152,208 +152,208 @@ discard block |
||
152 | 152 | * @return array |
153 | 153 | */ |
154 | 154 | function expages_collab_menu_register_hook($hook, $type, $return, $params) { |
155 | - $type = elgg_extract('type', $params); |
|
155 | + $type = elgg_extract('type', $params); |
|
156 | 156 | |
157 | - $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants'); |
|
158 | - foreach ($pages as $page) { |
|
159 | - $return[] = ElggMenuItem::factory(array( |
|
160 | - 'name' => $page, |
|
161 | - 'text' => elgg_echo("expages:$page"), |
|
162 | - 'href' => "admin/appearance/expages?type=$page", |
|
163 | - 'selected' => $page === $type, |
|
164 | - )); |
|
165 | - } |
|
166 | - return $return; |
|
157 | + $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants'); |
|
158 | + foreach ($pages as $page) { |
|
159 | + $return[] = ElggMenuItem::factory(array( |
|
160 | + 'name' => $page, |
|
161 | + 'text' => elgg_echo("expages:$page"), |
|
162 | + 'href' => "admin/appearance/expages?type=$page", |
|
163 | + 'selected' => $page === $type, |
|
164 | + )); |
|
165 | + } |
|
166 | + return $return; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // function that handles moving jobs marketplace and micro missions into drop down menu |
170 | 170 | function career_menu_hander($hook, $type, $menu, $params){ |
171 | - foreach ($menu as $key => $item){ |
|
171 | + foreach ($menu as $key => $item){ |
|
172 | 172 | |
173 | - switch ($item->getName()) { |
|
174 | - case 'career': |
|
175 | - $item->addChild(elgg_get_menu_item('subSite', 'Jobs Marketplace')); |
|
173 | + switch ($item->getName()) { |
|
174 | + case 'career': |
|
175 | + $item->addChild(elgg_get_menu_item('subSite', 'Jobs Marketplace')); |
|
176 | 176 | |
177 | - if(elgg_is_active_plugin('missions')){ |
|
178 | - $item->addChild(elgg_get_menu_item('site', 'mission_main')); |
|
179 | - } |
|
180 | - if(elgg_is_active_plugin('gcforums')){ |
|
181 | - $item->addChild(elgg_get_menu_item('subSite', 'Forum')); |
|
182 | - } |
|
183 | - |
|
184 | - $item->addChild(elgg_get_menu_item('subSite', 'jobs')); |
|
185 | - $item->setLinkClass('item'); |
|
186 | - break; |
|
187 | - } |
|
188 | - } |
|
177 | + if(elgg_is_active_plugin('missions')){ |
|
178 | + $item->addChild(elgg_get_menu_item('site', 'mission_main')); |
|
179 | + } |
|
180 | + if(elgg_is_active_plugin('gcforums')){ |
|
181 | + $item->addChild(elgg_get_menu_item('subSite', 'Forum')); |
|
182 | + } |
|
183 | + |
|
184 | + $item->addChild(elgg_get_menu_item('subSite', 'jobs')); |
|
185 | + $item->setLinkClass('item'); |
|
186 | + break; |
|
187 | + } |
|
188 | + } |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | function collab_menu_block_handler($hook, $type, $menu, $params){ |
192 | - //rearrange menu items |
|
193 | - if(elgg_get_context() == 'groupSubPage' || elgg_in_context('group_profile')){ |
|
194 | - |
|
195 | - elgg_unregister_menu_item('owner_block', 'activity'); |
|
196 | - |
|
197 | - //turn owner_block menu into tabs |
|
198 | - foreach ($menu as $key => $item){ |
|
199 | - switch ($item->getName()) { |
|
200 | - case 'discussion': |
|
201 | - $item->setText(elgg_echo('gprofile:discussion')); |
|
202 | - $item->setPriority('1'); |
|
203 | - break; |
|
204 | - case 'gcforums': |
|
205 | - $item->setPriority('1'); |
|
206 | - $item->setLinkClass('forums'); |
|
207 | - break; |
|
208 | - case 'file': |
|
209 | - $item->setText(elgg_echo('gprofile:files')); |
|
210 | - $item->setPriority('2'); |
|
211 | - break; |
|
212 | - case 'blog': |
|
213 | - $item->setText(elgg_echo('gprofile:blogs')); |
|
214 | - $item->setPriority('3'); |
|
215 | - break; |
|
216 | - case 'event_calendar': |
|
217 | - $item->setText(elgg_echo('gprofile:events')); |
|
218 | - $item->setPriority('4'); |
|
219 | - break; |
|
220 | - case 'etherpad': |
|
221 | - $item->setPriority('5'); |
|
222 | - break; |
|
223 | - case 'pages': |
|
224 | - $item->setText(elgg_echo('gprofile:pages')); |
|
225 | - $item->setPriority('6'); |
|
226 | - break; |
|
227 | - case 'bookmarks': |
|
228 | - $item->setText(elgg_echo('gprofile:bookmarks')); |
|
229 | - $item->setPriority('7'); |
|
230 | - break; |
|
231 | - case 'activity': |
|
232 | - $item->setText('Activity'); |
|
233 | - $item->setPriority('8'); |
|
234 | - $item->addItemClass('removeMe'); |
|
235 | - break; |
|
236 | - case 'questions': |
|
237 | - $item->setText(elgg_echo('widget:questions:title')); |
|
238 | - $item->setPriority('9'); |
|
239 | - break; |
|
240 | - case 'polls': |
|
241 | - $item->setText(elgg_echo('gprofile:polls')); |
|
242 | - $item->setPriority('10'); |
|
243 | - break; |
|
244 | - case 'tasks': |
|
245 | - $item->setText(elgg_echo('gprofile:tasks')); |
|
246 | - $item->setPriority('11'); |
|
247 | - break; |
|
248 | - case 'photos': |
|
249 | - $item->setText(elgg_echo('gprofile:photos')); |
|
250 | - $item->addItemClass('removeMe'); |
|
251 | - $item->setPriority('12'); |
|
252 | - break; |
|
253 | - case 'photo_albums': |
|
254 | - $item->setText(elgg_echo('gprofile:albumsCatch')); |
|
255 | - $item->setPriority('13'); |
|
256 | - break; |
|
257 | - case 'ideas': |
|
258 | - $item->setText(elgg_echo('gprofile:ideas')); |
|
259 | - $item->setPriority('14'); |
|
260 | - break; |
|
261 | - case 'related_groups': |
|
262 | - $item->setPriority('15'); |
|
263 | - break; |
|
264 | - } |
|
265 | - } |
|
266 | - } |
|
267 | - |
|
268 | - if(elgg_get_context() == 'profile'){ |
|
269 | - |
|
270 | - elgg_unregister_menu_item('owner_block', 'activity'); |
|
271 | - |
|
272 | - //turn owner_block menu into tabs |
|
273 | - foreach ($menu as $key => $item){ |
|
274 | - switch ($item->getName()) { |
|
275 | - case 'discussion': |
|
276 | - $item->setText(elgg_echo('gprofile:discussion')); |
|
277 | - $item->setPriority('1'); |
|
278 | - break; |
|
279 | - case 'file': |
|
280 | - $item->setText(elgg_echo('gprofile:files')); |
|
281 | - $item->setHref('#file'); |
|
282 | - $item->setPriority('2'); |
|
283 | - break; |
|
284 | - case 'blog': |
|
285 | - $item->setText(elgg_echo('gprofile:blogs')); |
|
286 | - $item->setHref('#blog'); |
|
287 | - $item->setPriority('3'); |
|
288 | - break; |
|
289 | - case 'event_calendar': |
|
290 | - $item->setText(elgg_echo('gprofile:events')); |
|
291 | - $item->setHref('#events'); |
|
292 | - $item->setPriority('4'); |
|
293 | - break; |
|
294 | - case 'thewire': |
|
295 | - //$item->setText(elgg_echo('The Wire')); |
|
296 | - $item->setHref('#thewire'); |
|
297 | - $item->setPriority('5'); |
|
298 | - break; |
|
299 | - case 'etherpad': |
|
300 | - $item->setHref('#etherpad'); |
|
301 | - $item->setPriority('6'); |
|
302 | - break; |
|
303 | - case 'pages': |
|
304 | - $item->setText(elgg_echo('gprofile:pages')); |
|
305 | - $item->setHref('#page_top'); |
|
306 | - $item->setPriority('7'); |
|
307 | - break; |
|
308 | - case 'questions': |
|
309 | - $item->setText(elgg_echo('widget:questions:title')); |
|
310 | - $item->setHref('#question'); |
|
311 | - $item->setPriority('8'); |
|
312 | - break; |
|
313 | - case 'bookmarks': |
|
314 | - $item->setText(elgg_echo('gprofile:bookmarks')); |
|
315 | - $item->setHref('#bookmarks'); |
|
316 | - $item->setPriority('9'); |
|
317 | - break; |
|
318 | - case 'polls': |
|
319 | - $item->setText(elgg_echo('gprofile:polls')); |
|
320 | - $item->setHref('#poll'); |
|
321 | - $item->setPriority('10'); |
|
322 | - break; |
|
323 | - case 'tasks': |
|
324 | - $item->setText(elgg_echo('gprofile:tasks')); |
|
325 | - $item->setHref('#task_top'); |
|
326 | - $item->setPriority('11'); |
|
327 | - break; |
|
328 | - case 'photos': |
|
329 | - $item->setText(elgg_echo('gprofile:photos')); |
|
330 | - $item->addItemClass('removeMe'); |
|
331 | - $item->setPriority('12'); |
|
332 | - break; |
|
333 | - case 'photo_albums': |
|
334 | - $item->setText(elgg_echo('gprofile:albumsCatch')); |
|
335 | - $item->setHref('#album'); |
|
336 | - $item->setPriority('13'); |
|
337 | - break; |
|
338 | - case 'ideas': |
|
339 | - $item->setText(elgg_echo('gprofile:ideas')); |
|
340 | - $item->addItemClass('removeMe'); |
|
341 | - $item->setPriority('14'); |
|
342 | - break; |
|
343 | - case 'orgs': |
|
344 | - $item->setPriority('15'); |
|
345 | - break; |
|
346 | - case 'activity': |
|
347 | - $item->setText('Activity'); |
|
348 | - $item->setPriority('16'); |
|
349 | - $item->addItemClass('removeMe'); |
|
350 | - break; |
|
351 | - case 'user_invite_from_profile': |
|
352 | - $item->setPriority('17'); |
|
353 | - break; |
|
354 | - } |
|
355 | - } |
|
356 | - } |
|
192 | + //rearrange menu items |
|
193 | + if(elgg_get_context() == 'groupSubPage' || elgg_in_context('group_profile')){ |
|
194 | + |
|
195 | + elgg_unregister_menu_item('owner_block', 'activity'); |
|
196 | + |
|
197 | + //turn owner_block menu into tabs |
|
198 | + foreach ($menu as $key => $item){ |
|
199 | + switch ($item->getName()) { |
|
200 | + case 'discussion': |
|
201 | + $item->setText(elgg_echo('gprofile:discussion')); |
|
202 | + $item->setPriority('1'); |
|
203 | + break; |
|
204 | + case 'gcforums': |
|
205 | + $item->setPriority('1'); |
|
206 | + $item->setLinkClass('forums'); |
|
207 | + break; |
|
208 | + case 'file': |
|
209 | + $item->setText(elgg_echo('gprofile:files')); |
|
210 | + $item->setPriority('2'); |
|
211 | + break; |
|
212 | + case 'blog': |
|
213 | + $item->setText(elgg_echo('gprofile:blogs')); |
|
214 | + $item->setPriority('3'); |
|
215 | + break; |
|
216 | + case 'event_calendar': |
|
217 | + $item->setText(elgg_echo('gprofile:events')); |
|
218 | + $item->setPriority('4'); |
|
219 | + break; |
|
220 | + case 'etherpad': |
|
221 | + $item->setPriority('5'); |
|
222 | + break; |
|
223 | + case 'pages': |
|
224 | + $item->setText(elgg_echo('gprofile:pages')); |
|
225 | + $item->setPriority('6'); |
|
226 | + break; |
|
227 | + case 'bookmarks': |
|
228 | + $item->setText(elgg_echo('gprofile:bookmarks')); |
|
229 | + $item->setPriority('7'); |
|
230 | + break; |
|
231 | + case 'activity': |
|
232 | + $item->setText('Activity'); |
|
233 | + $item->setPriority('8'); |
|
234 | + $item->addItemClass('removeMe'); |
|
235 | + break; |
|
236 | + case 'questions': |
|
237 | + $item->setText(elgg_echo('widget:questions:title')); |
|
238 | + $item->setPriority('9'); |
|
239 | + break; |
|
240 | + case 'polls': |
|
241 | + $item->setText(elgg_echo('gprofile:polls')); |
|
242 | + $item->setPriority('10'); |
|
243 | + break; |
|
244 | + case 'tasks': |
|
245 | + $item->setText(elgg_echo('gprofile:tasks')); |
|
246 | + $item->setPriority('11'); |
|
247 | + break; |
|
248 | + case 'photos': |
|
249 | + $item->setText(elgg_echo('gprofile:photos')); |
|
250 | + $item->addItemClass('removeMe'); |
|
251 | + $item->setPriority('12'); |
|
252 | + break; |
|
253 | + case 'photo_albums': |
|
254 | + $item->setText(elgg_echo('gprofile:albumsCatch')); |
|
255 | + $item->setPriority('13'); |
|
256 | + break; |
|
257 | + case 'ideas': |
|
258 | + $item->setText(elgg_echo('gprofile:ideas')); |
|
259 | + $item->setPriority('14'); |
|
260 | + break; |
|
261 | + case 'related_groups': |
|
262 | + $item->setPriority('15'); |
|
263 | + break; |
|
264 | + } |
|
265 | + } |
|
266 | + } |
|
267 | + |
|
268 | + if(elgg_get_context() == 'profile'){ |
|
269 | + |
|
270 | + elgg_unregister_menu_item('owner_block', 'activity'); |
|
271 | + |
|
272 | + //turn owner_block menu into tabs |
|
273 | + foreach ($menu as $key => $item){ |
|
274 | + switch ($item->getName()) { |
|
275 | + case 'discussion': |
|
276 | + $item->setText(elgg_echo('gprofile:discussion')); |
|
277 | + $item->setPriority('1'); |
|
278 | + break; |
|
279 | + case 'file': |
|
280 | + $item->setText(elgg_echo('gprofile:files')); |
|
281 | + $item->setHref('#file'); |
|
282 | + $item->setPriority('2'); |
|
283 | + break; |
|
284 | + case 'blog': |
|
285 | + $item->setText(elgg_echo('gprofile:blogs')); |
|
286 | + $item->setHref('#blog'); |
|
287 | + $item->setPriority('3'); |
|
288 | + break; |
|
289 | + case 'event_calendar': |
|
290 | + $item->setText(elgg_echo('gprofile:events')); |
|
291 | + $item->setHref('#events'); |
|
292 | + $item->setPriority('4'); |
|
293 | + break; |
|
294 | + case 'thewire': |
|
295 | + //$item->setText(elgg_echo('The Wire')); |
|
296 | + $item->setHref('#thewire'); |
|
297 | + $item->setPriority('5'); |
|
298 | + break; |
|
299 | + case 'etherpad': |
|
300 | + $item->setHref('#etherpad'); |
|
301 | + $item->setPriority('6'); |
|
302 | + break; |
|
303 | + case 'pages': |
|
304 | + $item->setText(elgg_echo('gprofile:pages')); |
|
305 | + $item->setHref('#page_top'); |
|
306 | + $item->setPriority('7'); |
|
307 | + break; |
|
308 | + case 'questions': |
|
309 | + $item->setText(elgg_echo('widget:questions:title')); |
|
310 | + $item->setHref('#question'); |
|
311 | + $item->setPriority('8'); |
|
312 | + break; |
|
313 | + case 'bookmarks': |
|
314 | + $item->setText(elgg_echo('gprofile:bookmarks')); |
|
315 | + $item->setHref('#bookmarks'); |
|
316 | + $item->setPriority('9'); |
|
317 | + break; |
|
318 | + case 'polls': |
|
319 | + $item->setText(elgg_echo('gprofile:polls')); |
|
320 | + $item->setHref('#poll'); |
|
321 | + $item->setPriority('10'); |
|
322 | + break; |
|
323 | + case 'tasks': |
|
324 | + $item->setText(elgg_echo('gprofile:tasks')); |
|
325 | + $item->setHref('#task_top'); |
|
326 | + $item->setPriority('11'); |
|
327 | + break; |
|
328 | + case 'photos': |
|
329 | + $item->setText(elgg_echo('gprofile:photos')); |
|
330 | + $item->addItemClass('removeMe'); |
|
331 | + $item->setPriority('12'); |
|
332 | + break; |
|
333 | + case 'photo_albums': |
|
334 | + $item->setText(elgg_echo('gprofile:albumsCatch')); |
|
335 | + $item->setHref('#album'); |
|
336 | + $item->setPriority('13'); |
|
337 | + break; |
|
338 | + case 'ideas': |
|
339 | + $item->setText(elgg_echo('gprofile:ideas')); |
|
340 | + $item->addItemClass('removeMe'); |
|
341 | + $item->setPriority('14'); |
|
342 | + break; |
|
343 | + case 'orgs': |
|
344 | + $item->setPriority('15'); |
|
345 | + break; |
|
346 | + case 'activity': |
|
347 | + $item->setText('Activity'); |
|
348 | + $item->setPriority('16'); |
|
349 | + $item->addItemClass('removeMe'); |
|
350 | + break; |
|
351 | + case 'user_invite_from_profile': |
|
352 | + $item->setPriority('17'); |
|
353 | + break; |
|
354 | + } |
|
355 | + } |
|
356 | + } |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -366,17 +366,17 @@ discard block |
||
366 | 366 | * @return string |
367 | 367 | */ |
368 | 368 | function members_list_type($hook, $type, $returnvalue, $params) { |
369 | - if ($returnvalue !== null) { |
|
370 | - return; |
|
371 | - } |
|
369 | + if ($returnvalue !== null) { |
|
370 | + return; |
|
371 | + } |
|
372 | 372 | |
373 | - $type = get_input('type'); |
|
373 | + $type = get_input('type'); |
|
374 | 374 | |
375 | - $user_types = array('' => elgg_echo('gcRegister:make_selection'), 'academic' => elgg_echo('gcRegister:occupation:academic'), 'student' => elgg_echo('gcRegister:occupation:student'), 'federal' => elgg_echo('gcRegister:occupation:federal'), 'provincial' => elgg_echo('gcRegister:occupation:provincial'), 'municipal' => elgg_echo('gcRegister:occupation:municipal'), 'international' => elgg_echo('gcRegister:occupation:international'), 'ngo' => elgg_echo('gcRegister:occupation:ngo'), 'community' => elgg_echo('gcRegister:occupation:community'), 'business' => elgg_echo('gcRegister:occupation:business'), 'media' => elgg_echo('gcRegister:occupation:media'), 'retired' => elgg_echo('gcRegister:occupation:retired'), 'other' => elgg_echo('gcRegister:occupation:other')); |
|
375 | + $user_types = array('' => elgg_echo('gcRegister:make_selection'), 'academic' => elgg_echo('gcRegister:occupation:academic'), 'student' => elgg_echo('gcRegister:occupation:student'), 'federal' => elgg_echo('gcRegister:occupation:federal'), 'provincial' => elgg_echo('gcRegister:occupation:provincial'), 'municipal' => elgg_echo('gcRegister:occupation:municipal'), 'international' => elgg_echo('gcRegister:occupation:international'), 'ngo' => elgg_echo('gcRegister:occupation:ngo'), 'community' => elgg_echo('gcRegister:occupation:community'), 'business' => elgg_echo('gcRegister:occupation:business'), 'media' => elgg_echo('gcRegister:occupation:media'), 'retired' => elgg_echo('gcRegister:occupation:retired'), 'other' => elgg_echo('gcRegister:occupation:other')); |
|
376 | 376 | |
377 | - $data = "<label class='mtm' for='by_type'>" . elgg_echo('gcRegister:membertype') . "</label>" . elgg_view('input/dropdown', array('id' => 'by_type', 'class' => 'mbm', 'name' => 'by_type', 'options_values' => $user_types, 'value' => $type)); |
|
377 | + $data = "<label class='mtm' for='by_type'>" . elgg_echo('gcRegister:membertype') . "</label>" . elgg_view('input/dropdown', array('id' => 'by_type', 'class' => 'mbm', 'name' => 'by_type', 'options_values' => $user_types, 'value' => $type)); |
|
378 | 378 | |
379 | - $data .= '<script>$(function() { |
|
379 | + $data .= '<script>$(function() { |
|
380 | 380 | $("#by_type").on("change", function() { |
381 | 381 | if( $(this).val() !== "" ){ |
382 | 382 | window.location.href = window.location.href.replace(/[\?#].*|$/, "?type=" + $(this).val()); |
@@ -384,15 +384,15 @@ discard block |
||
384 | 384 | }); |
385 | 385 | });</script>'; |
386 | 386 | |
387 | - $data .= elgg_list_entities_from_metadata(array( |
|
388 | - 'type' => 'user', |
|
389 | - 'metadata_name' => 'user_type', |
|
390 | - 'metadata_value' => $type, |
|
391 | - 'pagination' => true, |
|
392 | - 'limit' => 10 |
|
393 | - )); |
|
387 | + $data .= elgg_list_entities_from_metadata(array( |
|
388 | + 'type' => 'user', |
|
389 | + 'metadata_name' => 'user_type', |
|
390 | + 'metadata_value' => $type, |
|
391 | + 'pagination' => true, |
|
392 | + 'limit' => 10 |
|
393 | + )); |
|
394 | 394 | |
395 | - return $data; |
|
395 | + return $data; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | * @return array |
406 | 406 | */ |
407 | 407 | function members_nav_type($hook, $type, $returnvalue, $params) { |
408 | - $returnvalue['type'] = array( |
|
409 | - 'title' => elgg_echo('members:label:type'), |
|
410 | - 'url' => "members/type", |
|
411 | - ); |
|
412 | - return $returnvalue; |
|
408 | + $returnvalue['type'] = array( |
|
409 | + 'title' => elgg_echo('members:label:type'), |
|
410 | + 'url' => "members/type", |
|
411 | + ); |
|
412 | + return $returnvalue; |
|
413 | 413 | } |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | elgg_register_plugin_hook_handler('members:list', 'type', "members_list_type"); |
65 | 65 | elgg_register_plugin_hook_handler('members:config', 'tabs', "members_nav_type"); |
66 | 66 | |
67 | - elgg_register_widget_type('poll',elgg_echo('polls:my_widget_title'),elgg_echo('polls:my_widget_description'), array("profile", "dashboard", "index", "groups"), true); |
|
68 | - elgg_register_widget_type('poll_individual',elgg_echo('polls:individual'),elgg_echo('poll_individual_group:widget:description'), array("profile", "dashboard", "index", "groups"), true); |
|
67 | + elgg_register_widget_type('poll', elgg_echo('polls:my_widget_title'), elgg_echo('polls:my_widget_description'), array("profile", "dashboard", "index", "groups"), true); |
|
68 | + elgg_register_widget_type('poll_individual', elgg_echo('polls:individual'), elgg_echo('poll_individual_group:widget:description'), array("profile", "dashboard", "index", "groups"), true); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Extend the public pages range |
73 | 73 | * |
74 | 74 | */ |
75 | -function expages_collab_public($hook, $handler, $return, $params){ |
|
76 | - $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase'); // GCChange change - Ilia: Bilingual page url |
|
75 | +function expages_collab_public($hook, $handler, $return, $params) { |
|
76 | + $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase'); // GCChange change - Ilia: Bilingual page url |
|
77 | 77 | return array_merge($pages, $return); |
78 | 78 | } |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * Setup the links to site pages |
82 | 82 | */ |
83 | 83 | function expages_collab_setup_footer_menu() { |
84 | - $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase'); // GCChange change - Ilia: Bilingual page url |
|
84 | + $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase'); // GCChange change - Ilia: Bilingual page url |
|
85 | 85 | |
86 | 86 | foreach ($pages as $page) { |
87 | 87 | $url = "$page"; |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | // function that handles moving jobs marketplace and micro missions into drop down menu |
170 | -function career_menu_hander($hook, $type, $menu, $params){ |
|
171 | - foreach ($menu as $key => $item){ |
|
170 | +function career_menu_hander($hook, $type, $menu, $params) { |
|
171 | + foreach ($menu as $key => $item) { |
|
172 | 172 | |
173 | 173 | switch ($item->getName()) { |
174 | 174 | case 'career': |
175 | 175 | $item->addChild(elgg_get_menu_item('subSite', 'Jobs Marketplace')); |
176 | 176 | |
177 | - if(elgg_is_active_plugin('missions')){ |
|
177 | + if (elgg_is_active_plugin('missions')) { |
|
178 | 178 | $item->addChild(elgg_get_menu_item('site', 'mission_main')); |
179 | 179 | } |
180 | - if(elgg_is_active_plugin('gcforums')){ |
|
180 | + if (elgg_is_active_plugin('gcforums')) { |
|
181 | 181 | $item->addChild(elgg_get_menu_item('subSite', 'Forum')); |
182 | 182 | } |
183 | 183 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | -function collab_menu_block_handler($hook, $type, $menu, $params){ |
|
191 | +function collab_menu_block_handler($hook, $type, $menu, $params) { |
|
192 | 192 | //rearrange menu items |
193 | - if(elgg_get_context() == 'groupSubPage' || elgg_in_context('group_profile')){ |
|
193 | + if (elgg_get_context() == 'groupSubPage' || elgg_in_context('group_profile')) { |
|
194 | 194 | |
195 | 195 | elgg_unregister_menu_item('owner_block', 'activity'); |
196 | 196 | |
197 | 197 | //turn owner_block menu into tabs |
198 | - foreach ($menu as $key => $item){ |
|
198 | + foreach ($menu as $key => $item) { |
|
199 | 199 | switch ($item->getName()) { |
200 | 200 | case 'discussion': |
201 | 201 | $item->setText(elgg_echo('gprofile:discussion')); |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - if(elgg_get_context() == 'profile'){ |
|
268 | + if (elgg_get_context() == 'profile') { |
|
269 | 269 | |
270 | 270 | elgg_unregister_menu_item('owner_block', 'activity'); |
271 | 271 | |
272 | 272 | //turn owner_block menu into tabs |
273 | - foreach ($menu as $key => $item){ |
|
273 | + foreach ($menu as $key => $item) { |
|
274 | 274 | switch ($item->getName()) { |
275 | 275 | case 'discussion': |
276 | 276 | $item->setText(elgg_echo('gprofile:discussion')); |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class FG_CaptchaHandler |
21 | 21 | { |
22 | - function Validate() { return false;} |
|
23 | - function GetError(){ return '';} |
|
22 | + function Validate() { return false;} |
|
23 | + function GetError(){ return '';} |
|
24 | 24 | } |
25 | 25 | /* |
26 | 26 | FGContactForm is a general purpose contact form class |
@@ -29,256 +29,256 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class FGContactForm |
31 | 31 | { |
32 | - var $receipients; |
|
33 | - var $errors; |
|
34 | - var $error_message; |
|
35 | - var $name; |
|
36 | - var $email; |
|
37 | - var $message; |
|
38 | - var $from_address; |
|
39 | - var $form_random_key; |
|
40 | - var $conditional_field; |
|
41 | - var $arr_conditional_receipients; |
|
42 | - var $fileupload_fields; |
|
43 | - var $captcha_handler; |
|
44 | - var $mailer; |
|
45 | - |
|
46 | - function FGContactForm() |
|
47 | - { |
|
48 | - $this->receipients = array(); |
|
49 | - $this->errors = array(); |
|
50 | - $this->form_random_key = 'HTgsjhartag'; |
|
51 | - $this->conditional_field=''; |
|
52 | - $this->arr_conditional_receipients=array(); |
|
53 | - $this->fileupload_fields=array(); |
|
54 | - $this->mailer = new PHPMailer(); |
|
55 | - $this->mailer->CharSet = 'utf-8'; |
|
56 | - $this->mailer->IsSMTP(); |
|
57 | - $this->mailer->Host = elgg_get_plugin_setting('phpmailer_host', 'phpmailer'); // SMTP server |
|
58 | - $this->mailer->Port = elgg_get_plugin_setting('ep_phpmailer_port', 'phpmailer'); // SMTP server port |
|
59 | - $this->mailer->SMTPSecure = 'tls'; |
|
60 | - $this->mailer->SMTPAuth = 'true'; |
|
61 | - $this->mailer->Username = elgg_get_plugin_setting('phpmailer_username', 'phpmailer'); |
|
62 | - $this->mailer->Password = elgg_get_plugin_setting('phpmailer_password', 'phpmailer'); |
|
63 | - } |
|
64 | - |
|
65 | - function EnableCaptcha($captcha_handler) |
|
66 | - { |
|
67 | - $this->captcha_handler = $captcha_handler; |
|
68 | - session_start(); |
|
69 | - } |
|
70 | - |
|
71 | - function AddRecipient($email,$name="") |
|
72 | - { |
|
73 | - $this->mailer->AddAddress($email,$name); |
|
74 | - } |
|
75 | - |
|
76 | - function SetFromAddress($from) |
|
77 | - { |
|
78 | - $this->from_address = $from; |
|
79 | - } |
|
80 | - function SetFormRandomKey($key) |
|
81 | - { |
|
82 | - $this->form_random_key = $key; |
|
83 | - } |
|
84 | - function GetSpamTrapInputName() |
|
85 | - { |
|
86 | - return 'sp'.md5('KHGdnbvsgst'.$this->GetKey()); |
|
87 | - } |
|
88 | - function SafeDisplay($value_name) |
|
89 | - { |
|
90 | - if(empty($_POST[$value_name])) |
|
91 | - { |
|
92 | - return''; |
|
93 | - } |
|
94 | - return htmlentities($_POST[$value_name]); |
|
95 | - } |
|
96 | - function GetFormIDInputName() |
|
97 | - { |
|
98 | - $rand = md5('TygshRt'.$this->GetKey()); |
|
99 | - |
|
100 | - $rand = substr($rand,0,20); |
|
101 | - return 'id'.$rand; |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - function GetFormIDInputValue() |
|
106 | - { |
|
107 | - return md5('jhgahTsajhg'.$this->GetKey()); |
|
108 | - } |
|
109 | - |
|
110 | - function SetConditionalField($field) |
|
111 | - { |
|
112 | - $this->conditional_field = $field; |
|
113 | - } |
|
114 | - function AddConditionalReceipent($value,$email) |
|
115 | - { |
|
116 | - $this->arr_conditional_receipients[$value] = $email; |
|
117 | - } |
|
118 | - |
|
119 | - function AddFileUploadField($file_field_name,$accepted_types,$max_size) |
|
120 | - { |
|
121 | - |
|
122 | - $this->fileupload_fields[] = |
|
123 | - array("name"=>$file_field_name, |
|
124 | - "file_types"=>$accepted_types, |
|
125 | - "maxsize"=>$max_size); |
|
126 | - } |
|
127 | - |
|
128 | - function ProcessForm() |
|
129 | - { |
|
130 | - if(!isset($_POST['submitted'])) |
|
131 | - { |
|
132 | - return false; |
|
133 | - } |
|
134 | - if(!$this->Validate()) |
|
135 | - { |
|
136 | - // $this->error_message = implode('<br/><br/><br/>',$this->errors); |
|
137 | - return false; |
|
138 | - } |
|
139 | - $this->CollectData(); |
|
140 | - |
|
141 | - $ret = $this->SendFormSubmission(); |
|
142 | - |
|
143 | - return $ret; |
|
144 | - } |
|
145 | - |
|
146 | - function RedirectToURL($url) |
|
147 | - { |
|
148 | - header("Location: $url"); |
|
149 | - exit; |
|
150 | - } |
|
151 | - |
|
152 | - function GetErrorMessage() |
|
153 | - { |
|
154 | - return $this->error_message; |
|
155 | - } |
|
156 | - function GetSelfScript() |
|
157 | - { |
|
158 | - return htmlentities($_SERVER['PHP_SELF']); |
|
159 | - } |
|
160 | - |
|
161 | - function GetName() |
|
162 | - { |
|
163 | - return $this->name; |
|
164 | - } |
|
165 | - function GetEmail() |
|
166 | - { |
|
167 | - return $this->email; |
|
168 | - } |
|
169 | - function GetMessage() |
|
170 | - { |
|
171 | - return htmlentities($this->message,ENT_QUOTES,"UTF-8"); |
|
172 | - } |
|
32 | + var $receipients; |
|
33 | + var $errors; |
|
34 | + var $error_message; |
|
35 | + var $name; |
|
36 | + var $email; |
|
37 | + var $message; |
|
38 | + var $from_address; |
|
39 | + var $form_random_key; |
|
40 | + var $conditional_field; |
|
41 | + var $arr_conditional_receipients; |
|
42 | + var $fileupload_fields; |
|
43 | + var $captcha_handler; |
|
44 | + var $mailer; |
|
45 | + |
|
46 | + function FGContactForm() |
|
47 | + { |
|
48 | + $this->receipients = array(); |
|
49 | + $this->errors = array(); |
|
50 | + $this->form_random_key = 'HTgsjhartag'; |
|
51 | + $this->conditional_field=''; |
|
52 | + $this->arr_conditional_receipients=array(); |
|
53 | + $this->fileupload_fields=array(); |
|
54 | + $this->mailer = new PHPMailer(); |
|
55 | + $this->mailer->CharSet = 'utf-8'; |
|
56 | + $this->mailer->IsSMTP(); |
|
57 | + $this->mailer->Host = elgg_get_plugin_setting('phpmailer_host', 'phpmailer'); // SMTP server |
|
58 | + $this->mailer->Port = elgg_get_plugin_setting('ep_phpmailer_port', 'phpmailer'); // SMTP server port |
|
59 | + $this->mailer->SMTPSecure = 'tls'; |
|
60 | + $this->mailer->SMTPAuth = 'true'; |
|
61 | + $this->mailer->Username = elgg_get_plugin_setting('phpmailer_username', 'phpmailer'); |
|
62 | + $this->mailer->Password = elgg_get_plugin_setting('phpmailer_password', 'phpmailer'); |
|
63 | + } |
|
64 | + |
|
65 | + function EnableCaptcha($captcha_handler) |
|
66 | + { |
|
67 | + $this->captcha_handler = $captcha_handler; |
|
68 | + session_start(); |
|
69 | + } |
|
70 | + |
|
71 | + function AddRecipient($email,$name="") |
|
72 | + { |
|
73 | + $this->mailer->AddAddress($email,$name); |
|
74 | + } |
|
75 | + |
|
76 | + function SetFromAddress($from) |
|
77 | + { |
|
78 | + $this->from_address = $from; |
|
79 | + } |
|
80 | + function SetFormRandomKey($key) |
|
81 | + { |
|
82 | + $this->form_random_key = $key; |
|
83 | + } |
|
84 | + function GetSpamTrapInputName() |
|
85 | + { |
|
86 | + return 'sp'.md5('KHGdnbvsgst'.$this->GetKey()); |
|
87 | + } |
|
88 | + function SafeDisplay($value_name) |
|
89 | + { |
|
90 | + if(empty($_POST[$value_name])) |
|
91 | + { |
|
92 | + return''; |
|
93 | + } |
|
94 | + return htmlentities($_POST[$value_name]); |
|
95 | + } |
|
96 | + function GetFormIDInputName() |
|
97 | + { |
|
98 | + $rand = md5('TygshRt'.$this->GetKey()); |
|
99 | + |
|
100 | + $rand = substr($rand,0,20); |
|
101 | + return 'id'.$rand; |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + function GetFormIDInputValue() |
|
106 | + { |
|
107 | + return md5('jhgahTsajhg'.$this->GetKey()); |
|
108 | + } |
|
109 | + |
|
110 | + function SetConditionalField($field) |
|
111 | + { |
|
112 | + $this->conditional_field = $field; |
|
113 | + } |
|
114 | + function AddConditionalReceipent($value,$email) |
|
115 | + { |
|
116 | + $this->arr_conditional_receipients[$value] = $email; |
|
117 | + } |
|
118 | + |
|
119 | + function AddFileUploadField($file_field_name,$accepted_types,$max_size) |
|
120 | + { |
|
121 | + |
|
122 | + $this->fileupload_fields[] = |
|
123 | + array("name"=>$file_field_name, |
|
124 | + "file_types"=>$accepted_types, |
|
125 | + "maxsize"=>$max_size); |
|
126 | + } |
|
127 | + |
|
128 | + function ProcessForm() |
|
129 | + { |
|
130 | + if(!isset($_POST['submitted'])) |
|
131 | + { |
|
132 | + return false; |
|
133 | + } |
|
134 | + if(!$this->Validate()) |
|
135 | + { |
|
136 | + // $this->error_message = implode('<br/><br/><br/>',$this->errors); |
|
137 | + return false; |
|
138 | + } |
|
139 | + $this->CollectData(); |
|
140 | + |
|
141 | + $ret = $this->SendFormSubmission(); |
|
142 | + |
|
143 | + return $ret; |
|
144 | + } |
|
145 | + |
|
146 | + function RedirectToURL($url) |
|
147 | + { |
|
148 | + header("Location: $url"); |
|
149 | + exit; |
|
150 | + } |
|
151 | + |
|
152 | + function GetErrorMessage() |
|
153 | + { |
|
154 | + return $this->error_message; |
|
155 | + } |
|
156 | + function GetSelfScript() |
|
157 | + { |
|
158 | + return htmlentities($_SERVER['PHP_SELF']); |
|
159 | + } |
|
160 | + |
|
161 | + function GetName() |
|
162 | + { |
|
163 | + return $this->name; |
|
164 | + } |
|
165 | + function GetEmail() |
|
166 | + { |
|
167 | + return $this->email; |
|
168 | + } |
|
169 | + function GetMessage() |
|
170 | + { |
|
171 | + return htmlentities($this->message,ENT_QUOTES,"UTF-8"); |
|
172 | + } |
|
173 | 173 | |
174 | 174 | /*-------- Private (Internal) Functions -------- */ |
175 | 175 | |
176 | 176 | |
177 | - function SendFormSubmission() |
|
178 | - { |
|
179 | - $reason = $_POST['reason']; |
|
180 | - $option = explode("$", $_POST['reason']); |
|
181 | - $categoryfr = $option[0]; |
|
182 | - $categoryen = $option[1]; |
|
183 | - |
|
184 | - $depart = $_POST['depart']; |
|
185 | - $reason = $_POST['reason']; |
|
186 | - $option = explode("$", $_POST['reason']); |
|
187 | - $french = $option[0]; |
|
188 | - $english = $option[1]; |
|
189 | - if(empty($_POST['subject'])) |
|
190 | - { |
|
191 | - $subject = $categoryen." - ".$depart. " - $this->name / ".$categoryfr." - ".$depart. " - $this->name"; |
|
192 | - }else{ |
|
193 | - $subject = "GCconnex - ".$depart. " - $this->name / GCconnex - ".$depart. " - $this->name"; |
|
194 | - } |
|
177 | + function SendFormSubmission() |
|
178 | + { |
|
179 | + $reason = $_POST['reason']; |
|
180 | + $option = explode("$", $_POST['reason']); |
|
181 | + $categoryfr = $option[0]; |
|
182 | + $categoryen = $option[1]; |
|
183 | + |
|
184 | + $depart = $_POST['depart']; |
|
185 | + $reason = $_POST['reason']; |
|
186 | + $option = explode("$", $_POST['reason']); |
|
187 | + $french = $option[0]; |
|
188 | + $english = $option[1]; |
|
189 | + if(empty($_POST['subject'])) |
|
190 | + { |
|
191 | + $subject = $categoryen." - ".$depart. " - $this->name / ".$categoryfr." - ".$depart. " - $this->name"; |
|
192 | + }else{ |
|
193 | + $subject = "GCconnex - ".$depart. " - $this->name / GCconnex - ".$depart. " - $this->name"; |
|
194 | + } |
|
195 | 195 | |
196 | - $this->CollectConditionalReceipients(); |
|
197 | - $this->mailer->CharSet = 'utf-8'; |
|
198 | - $this->mailer->Subject = $subject; |
|
199 | - $this->mailer->From = elgg_get_plugin_setting('phpmailer_from_email', 'phpmailer'); |
|
200 | - $this->mailer->FromName = elgg_get_plugin_setting('phpmailer_from_name', 'phpmailer'); |
|
201 | - $this->mailer->AddCC($this->email); |
|
202 | - $message = $this->ComposeFormtoEmail(); |
|
203 | - $this->mailer->ConfirmReadingTo = $this->email; |
|
204 | - $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message))); |
|
205 | - $this->mailer->AltBody = @html_entity_decode($textMsg,ENT_QUOTES,"UTF-8"); |
|
206 | - $this->mailer->MsgHTML($message); |
|
207 | - $this->AttachFiles(); |
|
208 | - |
|
209 | - if(!$this->mailer->Send()) |
|
210 | - { |
|
211 | - $this->add_error("Failed sending email!"); |
|
212 | - return false; |
|
213 | - } |
|
214 | - |
|
215 | - return true; |
|
216 | - } |
|
217 | - |
|
218 | - function CollectConditionalReceipients() |
|
219 | - { |
|
220 | - if(count($this->arr_conditional_receipients)>0 && |
|
221 | - !empty($this->conditional_field) && |
|
222 | - !empty($_POST[$this->conditional_field])) |
|
223 | - { |
|
224 | - foreach($this->arr_conditional_receipients as $condn => $rec) |
|
225 | - { |
|
226 | - if(strcasecmp($condn,$_POST[$this->conditional_field])==0 && |
|
227 | - !empty($rec)) |
|
228 | - { |
|
229 | - $this->AddRecipient($rec); |
|
230 | - } |
|
231 | - } |
|
232 | - } |
|
233 | - } |
|
234 | - |
|
235 | - /* |
|
196 | + $this->CollectConditionalReceipients(); |
|
197 | + $this->mailer->CharSet = 'utf-8'; |
|
198 | + $this->mailer->Subject = $subject; |
|
199 | + $this->mailer->From = elgg_get_plugin_setting('phpmailer_from_email', 'phpmailer'); |
|
200 | + $this->mailer->FromName = elgg_get_plugin_setting('phpmailer_from_name', 'phpmailer'); |
|
201 | + $this->mailer->AddCC($this->email); |
|
202 | + $message = $this->ComposeFormtoEmail(); |
|
203 | + $this->mailer->ConfirmReadingTo = $this->email; |
|
204 | + $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message))); |
|
205 | + $this->mailer->AltBody = @html_entity_decode($textMsg,ENT_QUOTES,"UTF-8"); |
|
206 | + $this->mailer->MsgHTML($message); |
|
207 | + $this->AttachFiles(); |
|
208 | + |
|
209 | + if(!$this->mailer->Send()) |
|
210 | + { |
|
211 | + $this->add_error("Failed sending email!"); |
|
212 | + return false; |
|
213 | + } |
|
214 | + |
|
215 | + return true; |
|
216 | + } |
|
217 | + |
|
218 | + function CollectConditionalReceipients() |
|
219 | + { |
|
220 | + if(count($this->arr_conditional_receipients)>0 && |
|
221 | + !empty($this->conditional_field) && |
|
222 | + !empty($_POST[$this->conditional_field])) |
|
223 | + { |
|
224 | + foreach($this->arr_conditional_receipients as $condn => $rec) |
|
225 | + { |
|
226 | + if(strcasecmp($condn,$_POST[$this->conditional_field])==0 && |
|
227 | + !empty($rec)) |
|
228 | + { |
|
229 | + $this->AddRecipient($rec); |
|
230 | + } |
|
231 | + } |
|
232 | + } |
|
233 | + } |
|
234 | + |
|
235 | + /* |
|
236 | 236 | Internal variables, that you donot want to appear in the email |
237 | 237 | Add those variables in this array. |
238 | 238 | */ |
239 | - function IsInternalVariable($varname) |
|
240 | - { |
|
241 | - $arr_interanl_vars = array('scaptcha', |
|
242 | - 'submitted', |
|
243 | - $this->GetSpamTrapInputName(), |
|
244 | - $this->GetFormIDInputName() |
|
245 | - ); |
|
246 | - if(in_array($varname,$arr_interanl_vars)) |
|
247 | - { |
|
248 | - return true; |
|
249 | - } |
|
250 | - return false; |
|
251 | - } |
|
252 | - |
|
253 | - function FormSubmissionToMail() |
|
254 | - { |
|
255 | - $ret_str=''; |
|
239 | + function IsInternalVariable($varname) |
|
240 | + { |
|
241 | + $arr_interanl_vars = array('scaptcha', |
|
242 | + 'submitted', |
|
243 | + $this->GetSpamTrapInputName(), |
|
244 | + $this->GetFormIDInputName() |
|
245 | + ); |
|
246 | + if(in_array($varname,$arr_interanl_vars)) |
|
247 | + { |
|
248 | + return true; |
|
249 | + } |
|
250 | + return false; |
|
251 | + } |
|
252 | + |
|
253 | + function FormSubmissionToMail() |
|
254 | + { |
|
255 | + $ret_str=''; |
|
256 | 256 | |
257 | - $name = $_POST['name']; |
|
258 | - $email = $_POST['email']; |
|
259 | - $reason = $_POST['reason']; |
|
260 | - $option = explode("$", $_POST['reason']); |
|
261 | - $french = $option[0]; |
|
262 | - $english = $option[1]; |
|
263 | - if(empty($_POST['subject'])) |
|
264 | - { |
|
265 | - $subject = "$this->name has contacted you about ". $english." / $this->name vous a envoyé un message à propos de ".$french; |
|
266 | - }else{ |
|
267 | - $subject = $_POST['subject']; |
|
268 | - } |
|
257 | + $name = $_POST['name']; |
|
258 | + $email = $_POST['email']; |
|
259 | + $reason = $_POST['reason']; |
|
260 | + $option = explode("$", $_POST['reason']); |
|
261 | + $french = $option[0]; |
|
262 | + $english = $option[1]; |
|
263 | + if(empty($_POST['subject'])) |
|
264 | + { |
|
265 | + $subject = "$this->name has contacted you about ". $english." / $this->name vous a envoyé un message à propos de ".$french; |
|
266 | + }else{ |
|
267 | + $subject = $_POST['subject']; |
|
268 | + } |
|
269 | 269 | |
270 | - $message = $_POST['message']; |
|
270 | + $message = $_POST['message']; |
|
271 | 271 | |
272 | - $name=htmlentities($name, ENT_QUOTES, "UTF-8"); |
|
273 | - $email=htmlentities($email, ENT_QUOTES, "UTF-8"); |
|
274 | - $reason=htmlentities($reason, ENT_QUOTES, "UTF-8"); |
|
275 | - $subject=htmlentities($subject, ENT_QUOTES, "UTF-8"); |
|
276 | - $message=htmlentities($message, ENT_QUOTES, "UTF-8"); |
|
272 | + $name=htmlentities($name, ENT_QUOTES, "UTF-8"); |
|
273 | + $email=htmlentities($email, ENT_QUOTES, "UTF-8"); |
|
274 | + $reason=htmlentities($reason, ENT_QUOTES, "UTF-8"); |
|
275 | + $subject=htmlentities($subject, ENT_QUOTES, "UTF-8"); |
|
276 | + $message=htmlentities($message, ENT_QUOTES, "UTF-8"); |
|
277 | 277 | |
278 | - $value = htmlentities($value,ENT_QUOTES,"UTF-8"); |
|
279 | - $value = nl2br($value); |
|
280 | - $key = ucfirst($key); |
|
281 | - $ret_str .= ' |
|
278 | + $value = htmlentities($value,ENT_QUOTES,"UTF-8"); |
|
279 | + $value = nl2br($value); |
|
280 | + $key = ucfirst($key); |
|
281 | + $ret_str .= ' |
|
282 | 282 | |
283 | 283 | <!-- beginning of email template --> |
284 | 284 | <div width="100%" bgcolor="#fcfcfc"> |
@@ -358,34 +358,34 @@ discard block |
||
358 | 358 | </div> |
359 | 359 | </div>'; |
360 | 360 | |
361 | - foreach($this->fileupload_fields as $upload_field) |
|
362 | - { |
|
363 | - $field_name = $upload_field["name"]; |
|
364 | - if(!$this->IsFileUploaded($field_name)) |
|
365 | - { |
|
366 | - continue; |
|
367 | - } |
|
361 | + foreach($this->fileupload_fields as $upload_field) |
|
362 | + { |
|
363 | + $field_name = $upload_field["name"]; |
|
364 | + if(!$this->IsFileUploaded($field_name)) |
|
365 | + { |
|
366 | + continue; |
|
367 | + } |
|
368 | 368 | |
369 | - $filename = basename($_FILES[$field_name]['name']); |
|
370 | - $ret_str .= "<div class='label'>File upload '$field_name' :</div><div class='value'>$filename </div>\n"; |
|
371 | - } |
|
372 | - return $ret_str; |
|
373 | - } |
|
374 | - |
|
375 | - function ExtraInfoToMail() |
|
376 | - { |
|
377 | - $ret_str=''; |
|
378 | - |
|
379 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
380 | - $ret_str = "<div class='label'>IP address of the submitter:</div><div class='value'>$ip</div>\n"; |
|
381 | - |
|
382 | - return $ret_str; |
|
383 | - } |
|
384 | - |
|
385 | - function GetHTMLHeaderPart() |
|
386 | - { |
|
387 | - $retstr = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'."\n". |
|
388 | - '<html><head><title></title><style type="text/css"> |
|
369 | + $filename = basename($_FILES[$field_name]['name']); |
|
370 | + $ret_str .= "<div class='label'>File upload '$field_name' :</div><div class='value'>$filename </div>\n"; |
|
371 | + } |
|
372 | + return $ret_str; |
|
373 | + } |
|
374 | + |
|
375 | + function ExtraInfoToMail() |
|
376 | + { |
|
377 | + $ret_str=''; |
|
378 | + |
|
379 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
380 | + $ret_str = "<div class='label'>IP address of the submitter:</div><div class='value'>$ip</div>\n"; |
|
381 | + |
|
382 | + return $ret_str; |
|
383 | + } |
|
384 | + |
|
385 | + function GetHTMLHeaderPart() |
|
386 | + { |
|
387 | + $retstr = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'."\n". |
|
388 | + '<html><head><title></title><style type="text/css"> |
|
389 | 389 | body {margin: 0; padding: 0; min-width: 100%!important;} |
390 | 390 | img {height: auto;} |
391 | 391 | .content {width: 100%; max-width: 600px;} |
@@ -417,324 +417,324 @@ discard block |
||
417 | 417 | </style>'. |
418 | 418 | '<meta http-equiv=Content-Type content="text/html; charset=utf-8">'; |
419 | 419 | |
420 | - $retstr .= '</head><body yahoo bgcolor="#fcfcfc" style="margin: 0; padding: 0; min-width: 100%!important;">'; |
|
421 | - return $retstr; |
|
422 | - } |
|
423 | - |
|
424 | - function GetHTMLFooterPart() |
|
425 | - { |
|
426 | - $retstr ='</body></html>'; |
|
427 | - return $retstr ; |
|
428 | - } |
|
429 | - |
|
430 | - function ComposeFormtoEmail() |
|
431 | - { |
|
432 | - $header = $this->GetHTMLHeaderPart(); |
|
433 | - $formsubmission = $this->FormSubmissionToMail(); |
|
434 | - $footer = $this->GetHTMLFooterPart(); |
|
435 | - $message = $header."<p>$formsubmission</p><hr/>$extra_info".$footer; |
|
436 | - |
|
437 | - return $message; |
|
438 | - } |
|
439 | - |
|
440 | - function AttachFiles() |
|
441 | - { |
|
442 | - foreach($this->fileupload_fields as $upld_field) |
|
443 | - { |
|
444 | - $field_name = $upld_field["name"]; |
|
445 | - if(!$this->IsFileUploaded($field_name)) |
|
446 | - { |
|
447 | - continue; |
|
448 | - } |
|
420 | + $retstr .= '</head><body yahoo bgcolor="#fcfcfc" style="margin: 0; padding: 0; min-width: 100%!important;">'; |
|
421 | + return $retstr; |
|
422 | + } |
|
423 | + |
|
424 | + function GetHTMLFooterPart() |
|
425 | + { |
|
426 | + $retstr ='</body></html>'; |
|
427 | + return $retstr ; |
|
428 | + } |
|
429 | + |
|
430 | + function ComposeFormtoEmail() |
|
431 | + { |
|
432 | + $header = $this->GetHTMLHeaderPart(); |
|
433 | + $formsubmission = $this->FormSubmissionToMail(); |
|
434 | + $footer = $this->GetHTMLFooterPart(); |
|
435 | + $message = $header."<p>$formsubmission</p><hr/>$extra_info".$footer; |
|
436 | + |
|
437 | + return $message; |
|
438 | + } |
|
439 | + |
|
440 | + function AttachFiles() |
|
441 | + { |
|
442 | + foreach($this->fileupload_fields as $upld_field) |
|
443 | + { |
|
444 | + $field_name = $upld_field["name"]; |
|
445 | + if(!$this->IsFileUploaded($field_name)) |
|
446 | + { |
|
447 | + continue; |
|
448 | + } |
|
449 | 449 | |
450 | - $filename =basename($_FILES[$field_name]['name']); |
|
451 | - $this->mailer->AddAttachment($_FILES[$field_name]["tmp_name"],$filename); |
|
452 | - } |
|
453 | - } |
|
454 | - |
|
455 | - function GetFromAddress() |
|
456 | - { |
|
457 | - if(!empty($this->from_address)) |
|
458 | - { |
|
459 | - return $this->from_address; |
|
460 | - } |
|
461 | - |
|
462 | - $host = $_SERVER['SERVER_NAME']; |
|
463 | - $from ="nobody@$host"; |
|
464 | - return $from; |
|
465 | - } |
|
466 | - |
|
467 | - function Validate() |
|
468 | - { |
|
469 | - $ret = true; |
|
470 | - $numErr=0; |
|
471 | - //security validations |
|
472 | - if(empty($_POST[$this->GetFormIDInputName()]) || |
|
473 | - $_POST[$this->GetFormIDInputName()] != $this->GetFormIDInputValue() ) |
|
474 | - { |
|
475 | - $numErr=$numErr+1; |
|
476 | - //The proper error is not given intentionally |
|
477 | - $this->add_error(); |
|
478 | - register_error("Automated submission prevention: case 1 failed"); |
|
479 | - $ret = false; |
|
480 | - } |
|
481 | - |
|
482 | - //This is a hidden input field. Humans won't fill this field. |
|
483 | - if(!empty($_POST[$this->GetSpamTrapInputName()]) ) |
|
484 | - { |
|
485 | - $numErr=$numErr+1; |
|
486 | - //The proper error is not given intentionally |
|
487 | - $this->add_error(); |
|
488 | - register_error("Automated submission prevention: case 2 failed"); |
|
489 | - $ret = false; |
|
490 | - } |
|
491 | - |
|
492 | - //select validations |
|
493 | - if((($_POST['reason']) =='Select...') || (($_POST['reason']) == "Choisir...")) |
|
494 | - { |
|
495 | - $numErr=$numErr+1; |
|
496 | - $this->add_error(); |
|
497 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errreason'))); |
|
498 | - $ret = false; |
|
499 | - } |
|
500 | - |
|
501 | - if ($_POST['reason'] == 'Autres$Other') |
|
502 | - { |
|
503 | - if (empty($_POST['subject'])) |
|
504 | - { |
|
505 | - $numErr=$numErr+1; |
|
506 | - $this->add_error(); |
|
507 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errsubject'))); |
|
508 | - $ret = false; |
|
509 | - } |
|
510 | - } |
|
511 | - |
|
512 | - //name validations |
|
513 | - if(empty($_POST['name'])) |
|
514 | - { |
|
515 | - $numErr=$numErr+1; |
|
516 | - $this->add_error(); |
|
517 | - //'contactform:Errname' |
|
518 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errname'))); |
|
519 | - $ret = false; |
|
520 | - } |
|
521 | - else |
|
522 | - if(strlen($_POST['name'])>75) |
|
523 | - { |
|
524 | - $numErr=$numErr+1; |
|
525 | - $this->add_error(); |
|
526 | - //'contactform:Errnamebig' |
|
527 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errnamebig'))); |
|
528 | - $ret = false; |
|
529 | - } |
|
530 | - |
|
531 | - //email validations |
|
532 | - if(empty($_POST['email'])) |
|
533 | - { |
|
534 | - $numErr=$numErr+1; |
|
535 | - $this->add_error(); |
|
536 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremail'))); |
|
537 | - $ret = false; |
|
538 | - } |
|
539 | - else |
|
540 | - if(strlen($_POST['email'])>100) |
|
541 | - { |
|
542 | - $numErr=$numErr+1; |
|
543 | - $this->add_error(); |
|
544 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremailbig'))); |
|
545 | - $ret = false; |
|
546 | - } |
|
547 | - else |
|
548 | - if(!$this->validate_email($_POST['email'])) |
|
549 | - { |
|
550 | - $numErr=$numErr+1; |
|
551 | - $this->add_error(); |
|
552 | - //'contactform:Erremailvalid' |
|
553 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremailvalid'))); |
|
554 | - $ret = false; |
|
555 | - } |
|
556 | - |
|
557 | - //department validaions |
|
558 | - if(empty($_POST['depart'])) |
|
559 | - { |
|
560 | - $numErr=$numErr+1; |
|
561 | - $this->add_error(); |
|
562 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errdepart'))); |
|
563 | - $ret = false; |
|
564 | - } |
|
565 | - else |
|
566 | - if(strlen($_POST['depart'])>255) |
|
567 | - { |
|
568 | - $numErr=$numErr+1; |
|
569 | - $this->add_error(); |
|
570 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errdepartbig'))); |
|
571 | - $ret = false; |
|
572 | - } |
|
573 | - |
|
574 | - //message validaions |
|
575 | - if(empty($_POST['message'])) |
|
576 | - { |
|
577 | - $numErr=$numErr+1; |
|
578 | - $this->add_error(); |
|
579 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errmess'))); |
|
580 | - $ret = false; |
|
581 | - } |
|
582 | - else |
|
583 | - if(strlen($_POST['message'])>2048) |
|
584 | - { |
|
585 | - $numErr=$numErr+1; |
|
586 | - $this->add_error(); |
|
587 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errmessbig'))); |
|
588 | - $ret = false; |
|
589 | - } |
|
590 | - |
|
591 | - //file upload validations |
|
592 | - if(!empty($this->fileupload_fields)) |
|
593 | - { |
|
594 | - $numErr=$numErr+1; |
|
595 | - if(!$this->ValidateFileUploads($numErr)) |
|
596 | - { |
|
597 | - $ret = false; |
|
598 | - } |
|
599 | - } |
|
600 | - return $ret; |
|
601 | - } |
|
602 | - |
|
603 | - function ValidateFileType($field_name,$valid_filetypes) |
|
604 | - { |
|
605 | - $ret=true; |
|
606 | - $info = pathinfo($_FILES[$field_name]['name']); |
|
607 | - $extn = $info['extension']; |
|
608 | - $extn = strtolower($extn); |
|
609 | - |
|
610 | - $arr_valid_filetypes= explode(',',$valid_filetypes); |
|
611 | - if(!in_array($extn,$arr_valid_filetypes)) |
|
612 | - { |
|
613 | - $this->add_error(); |
|
614 | - register_error("Valid file types are: $valid_filetypes"); |
|
615 | - $ret=false; |
|
616 | - } |
|
617 | - return $ret; |
|
618 | - } |
|
619 | - |
|
620 | - function ValidateFileSize($field_name,$max_size) |
|
621 | - { |
|
622 | - $size_of_uploaded_file = $_FILES[$field_name]["size"]/1024;//size in KBs |
|
623 | - if($size_of_uploaded_file > $max_size) |
|
624 | - { |
|
625 | - $this->add_error(); |
|
626 | - register_error("The file is too big. File size should be less than $max_size KB"); |
|
627 | - return false; |
|
628 | - } |
|
629 | - return true; |
|
630 | - } |
|
631 | - |
|
632 | - function IsFileUploaded($field_name) |
|
633 | - { |
|
634 | - if(empty($_FILES[$field_name]['name'])) |
|
635 | - { |
|
636 | - return false; |
|
637 | - } |
|
638 | - if(!is_uploaded_file($_FILES[$field_name]['tmp_name'])) |
|
639 | - { |
|
640 | - return false; |
|
641 | - } |
|
642 | - return true; |
|
643 | - } |
|
644 | - function ValidateFileUploads() |
|
645 | - { |
|
646 | - $ret=true; |
|
647 | - foreach($this->fileupload_fields as $upld_field) |
|
648 | - { |
|
649 | - $field_name = $upld_field["name"]; |
|
650 | - |
|
651 | - $valid_filetypes = $upld_field["file_types"]; |
|
450 | + $filename =basename($_FILES[$field_name]['name']); |
|
451 | + $this->mailer->AddAttachment($_FILES[$field_name]["tmp_name"],$filename); |
|
452 | + } |
|
453 | + } |
|
454 | + |
|
455 | + function GetFromAddress() |
|
456 | + { |
|
457 | + if(!empty($this->from_address)) |
|
458 | + { |
|
459 | + return $this->from_address; |
|
460 | + } |
|
461 | + |
|
462 | + $host = $_SERVER['SERVER_NAME']; |
|
463 | + $from ="nobody@$host"; |
|
464 | + return $from; |
|
465 | + } |
|
466 | + |
|
467 | + function Validate() |
|
468 | + { |
|
469 | + $ret = true; |
|
470 | + $numErr=0; |
|
471 | + //security validations |
|
472 | + if(empty($_POST[$this->GetFormIDInputName()]) || |
|
473 | + $_POST[$this->GetFormIDInputName()] != $this->GetFormIDInputValue() ) |
|
474 | + { |
|
475 | + $numErr=$numErr+1; |
|
476 | + //The proper error is not given intentionally |
|
477 | + $this->add_error(); |
|
478 | + register_error("Automated submission prevention: case 1 failed"); |
|
479 | + $ret = false; |
|
480 | + } |
|
481 | + |
|
482 | + //This is a hidden input field. Humans won't fill this field. |
|
483 | + if(!empty($_POST[$this->GetSpamTrapInputName()]) ) |
|
484 | + { |
|
485 | + $numErr=$numErr+1; |
|
486 | + //The proper error is not given intentionally |
|
487 | + $this->add_error(); |
|
488 | + register_error("Automated submission prevention: case 2 failed"); |
|
489 | + $ret = false; |
|
490 | + } |
|
491 | + |
|
492 | + //select validations |
|
493 | + if((($_POST['reason']) =='Select...') || (($_POST['reason']) == "Choisir...")) |
|
494 | + { |
|
495 | + $numErr=$numErr+1; |
|
496 | + $this->add_error(); |
|
497 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errreason'))); |
|
498 | + $ret = false; |
|
499 | + } |
|
500 | + |
|
501 | + if ($_POST['reason'] == 'Autres$Other') |
|
502 | + { |
|
503 | + if (empty($_POST['subject'])) |
|
504 | + { |
|
505 | + $numErr=$numErr+1; |
|
506 | + $this->add_error(); |
|
507 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errsubject'))); |
|
508 | + $ret = false; |
|
509 | + } |
|
510 | + } |
|
511 | + |
|
512 | + //name validations |
|
513 | + if(empty($_POST['name'])) |
|
514 | + { |
|
515 | + $numErr=$numErr+1; |
|
516 | + $this->add_error(); |
|
517 | + //'contactform:Errname' |
|
518 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errname'))); |
|
519 | + $ret = false; |
|
520 | + } |
|
521 | + else |
|
522 | + if(strlen($_POST['name'])>75) |
|
523 | + { |
|
524 | + $numErr=$numErr+1; |
|
525 | + $this->add_error(); |
|
526 | + //'contactform:Errnamebig' |
|
527 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errnamebig'))); |
|
528 | + $ret = false; |
|
529 | + } |
|
530 | + |
|
531 | + //email validations |
|
532 | + if(empty($_POST['email'])) |
|
533 | + { |
|
534 | + $numErr=$numErr+1; |
|
535 | + $this->add_error(); |
|
536 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremail'))); |
|
537 | + $ret = false; |
|
538 | + } |
|
539 | + else |
|
540 | + if(strlen($_POST['email'])>100) |
|
541 | + { |
|
542 | + $numErr=$numErr+1; |
|
543 | + $this->add_error(); |
|
544 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremailbig'))); |
|
545 | + $ret = false; |
|
546 | + } |
|
547 | + else |
|
548 | + if(!$this->validate_email($_POST['email'])) |
|
549 | + { |
|
550 | + $numErr=$numErr+1; |
|
551 | + $this->add_error(); |
|
552 | + //'contactform:Erremailvalid' |
|
553 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremailvalid'))); |
|
554 | + $ret = false; |
|
555 | + } |
|
556 | + |
|
557 | + //department validaions |
|
558 | + if(empty($_POST['depart'])) |
|
559 | + { |
|
560 | + $numErr=$numErr+1; |
|
561 | + $this->add_error(); |
|
562 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errdepart'))); |
|
563 | + $ret = false; |
|
564 | + } |
|
565 | + else |
|
566 | + if(strlen($_POST['depart'])>255) |
|
567 | + { |
|
568 | + $numErr=$numErr+1; |
|
569 | + $this->add_error(); |
|
570 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errdepartbig'))); |
|
571 | + $ret = false; |
|
572 | + } |
|
573 | + |
|
574 | + //message validaions |
|
575 | + if(empty($_POST['message'])) |
|
576 | + { |
|
577 | + $numErr=$numErr+1; |
|
578 | + $this->add_error(); |
|
579 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errmess'))); |
|
580 | + $ret = false; |
|
581 | + } |
|
582 | + else |
|
583 | + if(strlen($_POST['message'])>2048) |
|
584 | + { |
|
585 | + $numErr=$numErr+1; |
|
586 | + $this->add_error(); |
|
587 | + register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errmessbig'))); |
|
588 | + $ret = false; |
|
589 | + } |
|
590 | + |
|
591 | + //file upload validations |
|
592 | + if(!empty($this->fileupload_fields)) |
|
593 | + { |
|
594 | + $numErr=$numErr+1; |
|
595 | + if(!$this->ValidateFileUploads($numErr)) |
|
596 | + { |
|
597 | + $ret = false; |
|
598 | + } |
|
599 | + } |
|
600 | + return $ret; |
|
601 | + } |
|
602 | + |
|
603 | + function ValidateFileType($field_name,$valid_filetypes) |
|
604 | + { |
|
605 | + $ret=true; |
|
606 | + $info = pathinfo($_FILES[$field_name]['name']); |
|
607 | + $extn = $info['extension']; |
|
608 | + $extn = strtolower($extn); |
|
609 | + |
|
610 | + $arr_valid_filetypes= explode(',',$valid_filetypes); |
|
611 | + if(!in_array($extn,$arr_valid_filetypes)) |
|
612 | + { |
|
613 | + $this->add_error(); |
|
614 | + register_error("Valid file types are: $valid_filetypes"); |
|
615 | + $ret=false; |
|
616 | + } |
|
617 | + return $ret; |
|
618 | + } |
|
619 | + |
|
620 | + function ValidateFileSize($field_name,$max_size) |
|
621 | + { |
|
622 | + $size_of_uploaded_file = $_FILES[$field_name]["size"]/1024;//size in KBs |
|
623 | + if($size_of_uploaded_file > $max_size) |
|
624 | + { |
|
625 | + $this->add_error(); |
|
626 | + register_error("The file is too big. File size should be less than $max_size KB"); |
|
627 | + return false; |
|
628 | + } |
|
629 | + return true; |
|
630 | + } |
|
631 | + |
|
632 | + function IsFileUploaded($field_name) |
|
633 | + { |
|
634 | + if(empty($_FILES[$field_name]['name'])) |
|
635 | + { |
|
636 | + return false; |
|
637 | + } |
|
638 | + if(!is_uploaded_file($_FILES[$field_name]['tmp_name'])) |
|
639 | + { |
|
640 | + return false; |
|
641 | + } |
|
642 | + return true; |
|
643 | + } |
|
644 | + function ValidateFileUploads() |
|
645 | + { |
|
646 | + $ret=true; |
|
647 | + foreach($this->fileupload_fields as $upld_field) |
|
648 | + { |
|
649 | + $field_name = $upld_field["name"]; |
|
650 | + |
|
651 | + $valid_filetypes = $upld_field["file_types"]; |
|
652 | 652 | |
653 | - if(!$this->IsFileUploaded($field_name)) |
|
654 | - { |
|
655 | - continue; |
|
656 | - } |
|
657 | - |
|
658 | - if($_FILES[$field_name]["error"] != 0) |
|
659 | - { |
|
660 | - $this->add_error("Error in file upload; Error code:".$_FILES[$field_name]["error"]); |
|
661 | - $ret=false; |
|
662 | - } |
|
663 | - |
|
664 | - if(!empty($valid_filetypes) && |
|
665 | - !$this->ValidateFileType($field_name,$valid_filetypes)) |
|
666 | - { |
|
667 | - $ret=false; |
|
668 | - } |
|
669 | - |
|
670 | - if(!empty($upld_field["maxsize"]) && |
|
671 | - $upld_field["maxsize"]>0) |
|
672 | - { |
|
673 | - if(!$this->ValidateFileSize($field_name,$upld_field["maxsize"])) |
|
674 | - { |
|
675 | - $ret=false; |
|
676 | - } |
|
677 | - } |
|
678 | - } |
|
679 | - return $ret; |
|
680 | - } |
|
681 | - |
|
682 | - function StripSlashes($str) |
|
683 | - { |
|
684 | - if(get_magic_quotes_gpc()) |
|
685 | - { |
|
686 | - $str = stripslashes($str); |
|
687 | - } |
|
688 | - return $str; |
|
689 | - } |
|
690 | - /* |
|
653 | + if(!$this->IsFileUploaded($field_name)) |
|
654 | + { |
|
655 | + continue; |
|
656 | + } |
|
657 | + |
|
658 | + if($_FILES[$field_name]["error"] != 0) |
|
659 | + { |
|
660 | + $this->add_error("Error in file upload; Error code:".$_FILES[$field_name]["error"]); |
|
661 | + $ret=false; |
|
662 | + } |
|
663 | + |
|
664 | + if(!empty($valid_filetypes) && |
|
665 | + !$this->ValidateFileType($field_name,$valid_filetypes)) |
|
666 | + { |
|
667 | + $ret=false; |
|
668 | + } |
|
669 | + |
|
670 | + if(!empty($upld_field["maxsize"]) && |
|
671 | + $upld_field["maxsize"]>0) |
|
672 | + { |
|
673 | + if(!$this->ValidateFileSize($field_name,$upld_field["maxsize"])) |
|
674 | + { |
|
675 | + $ret=false; |
|
676 | + } |
|
677 | + } |
|
678 | + } |
|
679 | + return $ret; |
|
680 | + } |
|
681 | + |
|
682 | + function StripSlashes($str) |
|
683 | + { |
|
684 | + if(get_magic_quotes_gpc()) |
|
685 | + { |
|
686 | + $str = stripslashes($str); |
|
687 | + } |
|
688 | + return $str; |
|
689 | + } |
|
690 | + /* |
|
691 | 691 | Sanitize() function removes any potential threat from the |
692 | 692 | data submitted. Prevents email injections or any other hacker attempts. |
693 | 693 | if $remove_nl is true, newline chracters are removed from the input. |
694 | 694 | */ |
695 | - function Sanitize($str,$remove_nl=true) |
|
696 | - { |
|
697 | - $str = $this->StripSlashes($str); |
|
698 | - |
|
699 | - if($remove_nl) |
|
700 | - { |
|
701 | - $injections = array('/(\n+)/i', |
|
702 | - '/(\r+)/i', |
|
703 | - '/(\t+)/i', |
|
704 | - '/(%0A+)/i', |
|
705 | - '/(%0D+)/i', |
|
706 | - '/(%08+)/i', |
|
707 | - '/(%09+)/i' |
|
708 | - ); |
|
709 | - $str = preg_replace($injections,'',$str); |
|
710 | - } |
|
711 | - |
|
712 | - return $str; |
|
713 | - } |
|
714 | - |
|
715 | - /*Collects clean data from the $_POST array and keeps in internal variables.*/ |
|
716 | - function CollectData() |
|
717 | - { |
|
718 | - $this->name = $this->Sanitize($_POST['name']); |
|
719 | - $this->email = $this->Sanitize($_POST['email']); |
|
720 | - |
|
721 | - /*newline is OK in the message.*/ |
|
722 | - $this->message = $this->StripSlashes($_POST['message']); |
|
723 | - } |
|
724 | - |
|
725 | - function add_error($error) |
|
726 | - { |
|
727 | - array_push($this->errors,$error); |
|
728 | - } |
|
729 | - function validate_email($email) |
|
730 | - { |
|
731 | - return eregi("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$", $email); |
|
732 | - } |
|
733 | - |
|
734 | - function GetKey() |
|
735 | - { |
|
736 | - return $this->form_random_key.$_SERVER['SERVER_NAME'].$_SERVER['REMOTE_ADDR']; |
|
737 | - } |
|
695 | + function Sanitize($str,$remove_nl=true) |
|
696 | + { |
|
697 | + $str = $this->StripSlashes($str); |
|
698 | + |
|
699 | + if($remove_nl) |
|
700 | + { |
|
701 | + $injections = array('/(\n+)/i', |
|
702 | + '/(\r+)/i', |
|
703 | + '/(\t+)/i', |
|
704 | + '/(%0A+)/i', |
|
705 | + '/(%0D+)/i', |
|
706 | + '/(%08+)/i', |
|
707 | + '/(%09+)/i' |
|
708 | + ); |
|
709 | + $str = preg_replace($injections,'',$str); |
|
710 | + } |
|
711 | + |
|
712 | + return $str; |
|
713 | + } |
|
714 | + |
|
715 | + /*Collects clean data from the $_POST array and keeps in internal variables.*/ |
|
716 | + function CollectData() |
|
717 | + { |
|
718 | + $this->name = $this->Sanitize($_POST['name']); |
|
719 | + $this->email = $this->Sanitize($_POST['email']); |
|
720 | + |
|
721 | + /*newline is OK in the message.*/ |
|
722 | + $this->message = $this->StripSlashes($_POST['message']); |
|
723 | + } |
|
724 | + |
|
725 | + function add_error($error) |
|
726 | + { |
|
727 | + array_push($this->errors,$error); |
|
728 | + } |
|
729 | + function validate_email($email) |
|
730 | + { |
|
731 | + return eregi("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$", $email); |
|
732 | + } |
|
733 | + |
|
734 | + function GetKey() |
|
735 | + { |
|
736 | + return $this->form_random_key.$_SERVER['SERVER_NAME'].$_SERVER['REMOTE_ADDR']; |
|
737 | + } |
|
738 | 738 | |
739 | 739 | } |
740 | 740 |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | |
13 | 13 | @copyright html-form-guide.com 2010 |
14 | 14 | */ |
15 | -require_once( elgg_get_plugins_path() ."phpmailer/vendors/class.phpmailer.php"); |
|
15 | +require_once(elgg_get_plugins_path() . "phpmailer/vendors/class.phpmailer.php"); |
|
16 | 16 | |
17 | 17 | /* |
18 | 18 | Interface to Captcha handler |
19 | 19 | */ |
20 | 20 | class FG_CaptchaHandler |
21 | 21 | { |
22 | - function Validate() { return false;} |
|
23 | - function GetError(){ return '';} |
|
22 | + function Validate() { return false; } |
|
23 | + function GetError() { return ''; } |
|
24 | 24 | } |
25 | 25 | /* |
26 | 26 | FGContactForm is a general purpose contact form class |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | $this->receipients = array(); |
49 | 49 | $this->errors = array(); |
50 | 50 | $this->form_random_key = 'HTgsjhartag'; |
51 | - $this->conditional_field=''; |
|
52 | - $this->arr_conditional_receipients=array(); |
|
53 | - $this->fileupload_fields=array(); |
|
51 | + $this->conditional_field = ''; |
|
52 | + $this->arr_conditional_receipients = array(); |
|
53 | + $this->fileupload_fields = array(); |
|
54 | 54 | $this->mailer = new PHPMailer(); |
55 | 55 | $this->mailer->CharSet = 'utf-8'; |
56 | 56 | $this->mailer->IsSMTP(); |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | session_start(); |
69 | 69 | } |
70 | 70 | |
71 | - function AddRecipient($email,$name="") |
|
71 | + function AddRecipient($email, $name = "") |
|
72 | 72 | { |
73 | - $this->mailer->AddAddress($email,$name); |
|
73 | + $this->mailer->AddAddress($email, $name); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | function SetFromAddress($from) |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | } |
84 | 84 | function GetSpamTrapInputName() |
85 | 85 | { |
86 | - return 'sp'.md5('KHGdnbvsgst'.$this->GetKey()); |
|
86 | + return 'sp' . md5('KHGdnbvsgst' . $this->GetKey()); |
|
87 | 87 | } |
88 | 88 | function SafeDisplay($value_name) |
89 | 89 | { |
90 | - if(empty($_POST[$value_name])) |
|
90 | + if (empty($_POST[$value_name])) |
|
91 | 91 | { |
92 | 92 | return''; |
93 | 93 | } |
@@ -95,28 +95,28 @@ discard block |
||
95 | 95 | } |
96 | 96 | function GetFormIDInputName() |
97 | 97 | { |
98 | - $rand = md5('TygshRt'.$this->GetKey()); |
|
98 | + $rand = md5('TygshRt' . $this->GetKey()); |
|
99 | 99 | |
100 | - $rand = substr($rand,0,20); |
|
101 | - return 'id'.$rand; |
|
100 | + $rand = substr($rand, 0, 20); |
|
101 | + return 'id' . $rand; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
105 | 105 | function GetFormIDInputValue() |
106 | 106 | { |
107 | - return md5('jhgahTsajhg'.$this->GetKey()); |
|
107 | + return md5('jhgahTsajhg' . $this->GetKey()); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | function SetConditionalField($field) |
111 | 111 | { |
112 | 112 | $this->conditional_field = $field; |
113 | 113 | } |
114 | - function AddConditionalReceipent($value,$email) |
|
114 | + function AddConditionalReceipent($value, $email) |
|
115 | 115 | { |
116 | - $this->arr_conditional_receipients[$value] = $email; |
|
116 | + $this->arr_conditional_receipients[$value] = $email; |
|
117 | 117 | } |
118 | 118 | |
119 | - function AddFileUploadField($file_field_name,$accepted_types,$max_size) |
|
119 | + function AddFileUploadField($file_field_name, $accepted_types, $max_size) |
|
120 | 120 | { |
121 | 121 | |
122 | 122 | $this->fileupload_fields[] = |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | |
128 | 128 | function ProcessForm() |
129 | 129 | { |
130 | - if(!isset($_POST['submitted'])) |
|
130 | + if (!isset($_POST['submitted'])) |
|
131 | 131 | { |
132 | 132 | return false; |
133 | 133 | } |
134 | - if(!$this->Validate()) |
|
134 | + if (!$this->Validate()) |
|
135 | 135 | { |
136 | 136 | // $this->error_message = implode('<br/><br/><br/>',$this->errors); |
137 | 137 | return false; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | function GetMessage() |
170 | 170 | { |
171 | - return htmlentities($this->message,ENT_QUOTES,"UTF-8"); |
|
171 | + return htmlentities($this->message, ENT_QUOTES, "UTF-8"); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /*-------- Private (Internal) Functions -------- */ |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | $option = explode("$", $_POST['reason']); |
187 | 187 | $french = $option[0]; |
188 | 188 | $english = $option[1]; |
189 | - if(empty($_POST['subject'])) |
|
189 | + if (empty($_POST['subject'])) |
|
190 | 190 | { |
191 | - $subject = $categoryen." - ".$depart. " - $this->name / ".$categoryfr." - ".$depart. " - $this->name"; |
|
192 | - }else{ |
|
193 | - $subject = "GCconnex - ".$depart. " - $this->name / GCconnex - ".$depart. " - $this->name"; |
|
191 | + $subject = $categoryen . " - " . $depart . " - $this->name / " . $categoryfr . " - " . $depart . " - $this->name"; |
|
192 | + } else { |
|
193 | + $subject = "GCconnex - " . $depart . " - $this->name / GCconnex - " . $depart . " - $this->name"; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | $this->CollectConditionalReceipients(); |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | $this->mailer->AddCC($this->email); |
202 | 202 | $message = $this->ComposeFormtoEmail(); |
203 | 203 | $this->mailer->ConfirmReadingTo = $this->email; |
204 | - $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message))); |
|
205 | - $this->mailer->AltBody = @html_entity_decode($textMsg,ENT_QUOTES,"UTF-8"); |
|
204 | + $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message))); |
|
205 | + $this->mailer->AltBody = @html_entity_decode($textMsg, ENT_QUOTES, "UTF-8"); |
|
206 | 206 | $this->mailer->MsgHTML($message); |
207 | 207 | $this->AttachFiles(); |
208 | 208 | |
209 | - if(!$this->mailer->Send()) |
|
209 | + if (!$this->mailer->Send()) |
|
210 | 210 | { |
211 | 211 | $this->add_error("Failed sending email!"); |
212 | 212 | return false; |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | |
218 | 218 | function CollectConditionalReceipients() |
219 | 219 | { |
220 | - if(count($this->arr_conditional_receipients)>0 && |
|
220 | + if (count($this->arr_conditional_receipients) > 0 && |
|
221 | 221 | !empty($this->conditional_field) && |
222 | 222 | !empty($_POST[$this->conditional_field])) |
223 | 223 | { |
224 | - foreach($this->arr_conditional_receipients as $condn => $rec) |
|
224 | + foreach ($this->arr_conditional_receipients as $condn => $rec) |
|
225 | 225 | { |
226 | - if(strcasecmp($condn,$_POST[$this->conditional_field])==0 && |
|
226 | + if (strcasecmp($condn, $_POST[$this->conditional_field]) == 0 && |
|
227 | 227 | !empty($rec)) |
228 | 228 | { |
229 | 229 | $this->AddRecipient($rec); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->GetSpamTrapInputName(), |
244 | 244 | $this->GetFormIDInputName() |
245 | 245 | ); |
246 | - if(in_array($varname,$arr_interanl_vars)) |
|
246 | + if (in_array($varname, $arr_interanl_vars)) |
|
247 | 247 | { |
248 | 248 | return true; |
249 | 249 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | function FormSubmissionToMail() |
254 | 254 | { |
255 | - $ret_str=''; |
|
255 | + $ret_str = ''; |
|
256 | 256 | |
257 | 257 | $name = $_POST['name']; |
258 | 258 | $email = $_POST['email']; |
@@ -260,22 +260,22 @@ discard block |
||
260 | 260 | $option = explode("$", $_POST['reason']); |
261 | 261 | $french = $option[0]; |
262 | 262 | $english = $option[1]; |
263 | - if(empty($_POST['subject'])) |
|
263 | + if (empty($_POST['subject'])) |
|
264 | 264 | { |
265 | - $subject = "$this->name has contacted you about ". $english." / $this->name vous a envoyé un message à propos de ".$french; |
|
266 | - }else{ |
|
265 | + $subject = "$this->name has contacted you about " . $english . " / $this->name vous a envoyé un message à propos de " . $french; |
|
266 | + } else { |
|
267 | 267 | $subject = $_POST['subject']; |
268 | 268 | } |
269 | 269 | |
270 | 270 | $message = $_POST['message']; |
271 | 271 | |
272 | - $name=htmlentities($name, ENT_QUOTES, "UTF-8"); |
|
273 | - $email=htmlentities($email, ENT_QUOTES, "UTF-8"); |
|
274 | - $reason=htmlentities($reason, ENT_QUOTES, "UTF-8"); |
|
275 | - $subject=htmlentities($subject, ENT_QUOTES, "UTF-8"); |
|
276 | - $message=htmlentities($message, ENT_QUOTES, "UTF-8"); |
|
272 | + $name = htmlentities($name, ENT_QUOTES, "UTF-8"); |
|
273 | + $email = htmlentities($email, ENT_QUOTES, "UTF-8"); |
|
274 | + $reason = htmlentities($reason, ENT_QUOTES, "UTF-8"); |
|
275 | + $subject = htmlentities($subject, ENT_QUOTES, "UTF-8"); |
|
276 | + $message = htmlentities($message, ENT_QUOTES, "UTF-8"); |
|
277 | 277 | |
278 | - $value = htmlentities($value,ENT_QUOTES,"UTF-8"); |
|
278 | + $value = htmlentities($value, ENT_QUOTES, "UTF-8"); |
|
279 | 279 | $value = nl2br($value); |
280 | 280 | $key = ucfirst($key); |
281 | 281 | $ret_str .= ' |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | </h2> |
317 | 317 | |
318 | 318 | <!-- BODY OF CONTENT --> |
319 | - <b>Name:</b> '.$name.'<br/> |
|
320 | - <b>Email:</b> '.$email.'<br/> |
|
321 | - <b>Reason:</b> '.$english.' <br/> |
|
322 | - <b>Subject:</b> '.$subject.'<br/> |
|
323 | - <b>Message:</b>'.$message .'<br/> |
|
319 | + <b>Name:</b> '.$name . '<br/> |
|
320 | + <b>Email:</b> '.$email . '<br/> |
|
321 | + <b>Reason:</b> '.$english . ' <br/> |
|
322 | + <b>Subject:</b> '.$subject . '<br/> |
|
323 | + <b>Message:</b>'.$message . '<br/> |
|
324 | 324 | </div> |
325 | 325 | |
326 | 326 | <div style="margin-top:15px; padding: 5px; color: #6d6d6d; border-bottom: 1px solid #ddd;"></div> |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | </h2> |
339 | 339 | |
340 | 340 | <!-- BODY OF CONTENT --> |
341 | - <b>Nom :</b> '.$name.'<br/> |
|
342 | - <b>Courriel :</b> '.$email.'<br/> |
|
343 | - <b>Raison :</b> '.$french.'<br/> |
|
344 | - <b>Sujet :</b> '.$subject.'<br/> |
|
345 | - <b>Message :</b>'.$message.'<br/> |
|
341 | + <b>Nom :</b> '.$name . '<br/> |
|
342 | + <b>Courriel :</b> '.$email . '<br/> |
|
343 | + <b>Raison :</b> '.$french . '<br/> |
|
344 | + <b>Sujet :</b> '.$subject . '<br/> |
|
345 | + <b>Message :</b>'.$message . '<br/> |
|
346 | 346 | </div> |
347 | 347 | <div style="margin-top:15px; padding: 5px; color: #6d6d6d;"></div> |
348 | 348 | |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | </div> |
359 | 359 | </div>'; |
360 | 360 | |
361 | - foreach($this->fileupload_fields as $upload_field) |
|
361 | + foreach ($this->fileupload_fields as $upload_field) |
|
362 | 362 | { |
363 | 363 | $field_name = $upload_field["name"]; |
364 | - if(!$this->IsFileUploaded($field_name)) |
|
364 | + if (!$this->IsFileUploaded($field_name)) |
|
365 | 365 | { |
366 | 366 | continue; |
367 | 367 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | function ExtraInfoToMail() |
376 | 376 | { |
377 | - $ret_str=''; |
|
377 | + $ret_str = ''; |
|
378 | 378 | |
379 | 379 | $ip = $_SERVER['REMOTE_ADDR']; |
380 | 380 | $ret_str = "<div class='label'>IP address of the submitter:</div><div class='value'>$ip</div>\n"; |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | function GetHTMLHeaderPart() |
386 | 386 | { |
387 | - $retstr = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'."\n". |
|
387 | + $retstr = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' . "\n" . |
|
388 | 388 | '<html><head><title></title><style type="text/css"> |
389 | 389 | body {margin: 0; padding: 0; min-width: 100%!important;} |
390 | 390 | img {height: auto;} |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | |
424 | 424 | function GetHTMLFooterPart() |
425 | 425 | { |
426 | - $retstr ='</body></html>'; |
|
427 | - return $retstr ; |
|
426 | + $retstr = '</body></html>'; |
|
427 | + return $retstr; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | function ComposeFormtoEmail() |
@@ -432,47 +432,47 @@ discard block |
||
432 | 432 | $header = $this->GetHTMLHeaderPart(); |
433 | 433 | $formsubmission = $this->FormSubmissionToMail(); |
434 | 434 | $footer = $this->GetHTMLFooterPart(); |
435 | - $message = $header."<p>$formsubmission</p><hr/>$extra_info".$footer; |
|
435 | + $message = $header . "<p>$formsubmission</p><hr/>$extra_info" . $footer; |
|
436 | 436 | |
437 | 437 | return $message; |
438 | 438 | } |
439 | 439 | |
440 | 440 | function AttachFiles() |
441 | 441 | { |
442 | - foreach($this->fileupload_fields as $upld_field) |
|
442 | + foreach ($this->fileupload_fields as $upld_field) |
|
443 | 443 | { |
444 | 444 | $field_name = $upld_field["name"]; |
445 | - if(!$this->IsFileUploaded($field_name)) |
|
445 | + if (!$this->IsFileUploaded($field_name)) |
|
446 | 446 | { |
447 | 447 | continue; |
448 | 448 | } |
449 | 449 | |
450 | - $filename =basename($_FILES[$field_name]['name']); |
|
451 | - $this->mailer->AddAttachment($_FILES[$field_name]["tmp_name"],$filename); |
|
450 | + $filename = basename($_FILES[$field_name]['name']); |
|
451 | + $this->mailer->AddAttachment($_FILES[$field_name]["tmp_name"], $filename); |
|
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | 455 | function GetFromAddress() |
456 | 456 | { |
457 | - if(!empty($this->from_address)) |
|
457 | + if (!empty($this->from_address)) |
|
458 | 458 | { |
459 | 459 | return $this->from_address; |
460 | 460 | } |
461 | 461 | |
462 | 462 | $host = $_SERVER['SERVER_NAME']; |
463 | - $from ="nobody@$host"; |
|
463 | + $from = "nobody@$host"; |
|
464 | 464 | return $from; |
465 | 465 | } |
466 | 466 | |
467 | 467 | function Validate() |
468 | 468 | { |
469 | 469 | $ret = true; |
470 | - $numErr=0; |
|
470 | + $numErr = 0; |
|
471 | 471 | //security validations |
472 | - if(empty($_POST[$this->GetFormIDInputName()]) || |
|
473 | - $_POST[$this->GetFormIDInputName()] != $this->GetFormIDInputValue() ) |
|
472 | + if (empty($_POST[$this->GetFormIDInputName()]) || |
|
473 | + $_POST[$this->GetFormIDInputName()] != $this->GetFormIDInputValue()) |
|
474 | 474 | { |
475 | - $numErr=$numErr+1; |
|
475 | + $numErr = $numErr + 1; |
|
476 | 476 | //The proper error is not given intentionally |
477 | 477 | $this->add_error(); |
478 | 478 | register_error("Automated submission prevention: case 1 failed"); |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | } |
481 | 481 | |
482 | 482 | //This is a hidden input field. Humans won't fill this field. |
483 | - if(!empty($_POST[$this->GetSpamTrapInputName()]) ) |
|
483 | + if (!empty($_POST[$this->GetSpamTrapInputName()])) |
|
484 | 484 | { |
485 | - $numErr=$numErr+1; |
|
485 | + $numErr = $numErr + 1; |
|
486 | 486 | //The proper error is not given intentionally |
487 | 487 | $this->add_error(); |
488 | 488 | register_error("Automated submission prevention: case 2 failed"); |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | } |
491 | 491 | |
492 | 492 | //select validations |
493 | - if((($_POST['reason']) =='Select...') || (($_POST['reason']) == "Choisir...")) |
|
493 | + if ((($_POST['reason']) == 'Select...') || (($_POST['reason']) == "Choisir...")) |
|
494 | 494 | { |
495 | - $numErr=$numErr+1; |
|
495 | + $numErr = $numErr + 1; |
|
496 | 496 | $this->add_error(); |
497 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errreason'))); |
|
497 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Errreason'))); |
|
498 | 498 | $ret = false; |
499 | 499 | } |
500 | 500 | |
@@ -502,97 +502,97 @@ discard block |
||
502 | 502 | { |
503 | 503 | if (empty($_POST['subject'])) |
504 | 504 | { |
505 | - $numErr=$numErr+1; |
|
505 | + $numErr = $numErr + 1; |
|
506 | 506 | $this->add_error(); |
507 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errsubject'))); |
|
507 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Errsubject'))); |
|
508 | 508 | $ret = false; |
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | 512 | //name validations |
513 | - if(empty($_POST['name'])) |
|
513 | + if (empty($_POST['name'])) |
|
514 | 514 | { |
515 | - $numErr=$numErr+1; |
|
515 | + $numErr = $numErr + 1; |
|
516 | 516 | $this->add_error(); |
517 | 517 | //'contactform:Errname' |
518 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errname'))); |
|
518 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Errname'))); |
|
519 | 519 | $ret = false; |
520 | 520 | } |
521 | 521 | else |
522 | - if(strlen($_POST['name'])>75) |
|
522 | + if (strlen($_POST['name']) > 75) |
|
523 | 523 | { |
524 | - $numErr=$numErr+1; |
|
524 | + $numErr = $numErr + 1; |
|
525 | 525 | $this->add_error(); |
526 | 526 | //'contactform:Errnamebig' |
527 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errnamebig'))); |
|
527 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Errnamebig'))); |
|
528 | 528 | $ret = false; |
529 | 529 | } |
530 | 530 | |
531 | 531 | //email validations |
532 | - if(empty($_POST['email'])) |
|
532 | + if (empty($_POST['email'])) |
|
533 | 533 | { |
534 | - $numErr=$numErr+1; |
|
534 | + $numErr = $numErr + 1; |
|
535 | 535 | $this->add_error(); |
536 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremail'))); |
|
536 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Erremail'))); |
|
537 | 537 | $ret = false; |
538 | 538 | } |
539 | 539 | else |
540 | - if(strlen($_POST['email'])>100) |
|
540 | + if (strlen($_POST['email']) > 100) |
|
541 | 541 | { |
542 | - $numErr=$numErr+1; |
|
542 | + $numErr = $numErr + 1; |
|
543 | 543 | $this->add_error(); |
544 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremailbig'))); |
|
544 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Erremailbig'))); |
|
545 | 545 | $ret = false; |
546 | 546 | } |
547 | 547 | else |
548 | - if(!$this->validate_email($_POST['email'])) |
|
548 | + if (!$this->validate_email($_POST['email'])) |
|
549 | 549 | { |
550 | - $numErr=$numErr+1; |
|
550 | + $numErr = $numErr + 1; |
|
551 | 551 | $this->add_error(); |
552 | 552 | //'contactform:Erremailvalid' |
553 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremailvalid'))); |
|
553 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Erremailvalid'))); |
|
554 | 554 | $ret = false; |
555 | 555 | } |
556 | 556 | |
557 | 557 | //department validaions |
558 | - if(empty($_POST['depart'])) |
|
558 | + if (empty($_POST['depart'])) |
|
559 | 559 | { |
560 | - $numErr=$numErr+1; |
|
560 | + $numErr = $numErr + 1; |
|
561 | 561 | $this->add_error(); |
562 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errdepart'))); |
|
562 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Errdepart'))); |
|
563 | 563 | $ret = false; |
564 | 564 | } |
565 | 565 | else |
566 | - if(strlen($_POST['depart'])>255) |
|
566 | + if (strlen($_POST['depart']) > 255) |
|
567 | 567 | { |
568 | - $numErr=$numErr+1; |
|
568 | + $numErr = $numErr + 1; |
|
569 | 569 | $this->add_error(); |
570 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errdepartbig'))); |
|
570 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Errdepartbig'))); |
|
571 | 571 | $ret = false; |
572 | 572 | } |
573 | 573 | |
574 | 574 | //message validaions |
575 | - if(empty($_POST['message'])) |
|
575 | + if (empty($_POST['message'])) |
|
576 | 576 | { |
577 | - $numErr=$numErr+1; |
|
577 | + $numErr = $numErr + 1; |
|
578 | 578 | $this->add_error(); |
579 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errmess'))); |
|
579 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Errmess'))); |
|
580 | 580 | $ret = false; |
581 | 581 | } |
582 | 582 | else |
583 | - if(strlen($_POST['message'])>2048) |
|
583 | + if (strlen($_POST['message']) > 2048) |
|
584 | 584 | { |
585 | - $numErr=$numErr+1; |
|
585 | + $numErr = $numErr + 1; |
|
586 | 586 | $this->add_error(); |
587 | - register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errmessbig'))); |
|
587 | + register_error(str_replace('[#]', $numErr, elgg_echo('contactform:Errmessbig'))); |
|
588 | 588 | $ret = false; |
589 | 589 | } |
590 | 590 | |
591 | 591 | //file upload validations |
592 | - if(!empty($this->fileupload_fields)) |
|
592 | + if (!empty($this->fileupload_fields)) |
|
593 | 593 | { |
594 | - $numErr=$numErr+1; |
|
595 | - if(!$this->ValidateFileUploads($numErr)) |
|
594 | + $numErr = $numErr + 1; |
|
595 | + if (!$this->ValidateFileUploads($numErr)) |
|
596 | 596 | { |
597 | 597 | $ret = false; |
598 | 598 | } |
@@ -600,27 +600,27 @@ discard block |
||
600 | 600 | return $ret; |
601 | 601 | } |
602 | 602 | |
603 | - function ValidateFileType($field_name,$valid_filetypes) |
|
603 | + function ValidateFileType($field_name, $valid_filetypes) |
|
604 | 604 | { |
605 | - $ret=true; |
|
605 | + $ret = true; |
|
606 | 606 | $info = pathinfo($_FILES[$field_name]['name']); |
607 | 607 | $extn = $info['extension']; |
608 | 608 | $extn = strtolower($extn); |
609 | 609 | |
610 | - $arr_valid_filetypes= explode(',',$valid_filetypes); |
|
611 | - if(!in_array($extn,$arr_valid_filetypes)) |
|
610 | + $arr_valid_filetypes = explode(',', $valid_filetypes); |
|
611 | + if (!in_array($extn, $arr_valid_filetypes)) |
|
612 | 612 | { |
613 | 613 | $this->add_error(); |
614 | 614 | register_error("Valid file types are: $valid_filetypes"); |
615 | - $ret=false; |
|
615 | + $ret = false; |
|
616 | 616 | } |
617 | 617 | return $ret; |
618 | 618 | } |
619 | 619 | |
620 | - function ValidateFileSize($field_name,$max_size) |
|
620 | + function ValidateFileSize($field_name, $max_size) |
|
621 | 621 | { |
622 | - $size_of_uploaded_file = $_FILES[$field_name]["size"]/1024;//size in KBs |
|
623 | - if($size_of_uploaded_file > $max_size) |
|
622 | + $size_of_uploaded_file = $_FILES[$field_name]["size"] / 1024; //size in KBs |
|
623 | + if ($size_of_uploaded_file > $max_size) |
|
624 | 624 | { |
625 | 625 | $this->add_error(); |
626 | 626 | register_error("The file is too big. File size should be less than $max_size KB"); |
@@ -631,11 +631,11 @@ discard block |
||
631 | 631 | |
632 | 632 | function IsFileUploaded($field_name) |
633 | 633 | { |
634 | - if(empty($_FILES[$field_name]['name'])) |
|
634 | + if (empty($_FILES[$field_name]['name'])) |
|
635 | 635 | { |
636 | 636 | return false; |
637 | 637 | } |
638 | - if(!is_uploaded_file($_FILES[$field_name]['tmp_name'])) |
|
638 | + if (!is_uploaded_file($_FILES[$field_name]['tmp_name'])) |
|
639 | 639 | { |
640 | 640 | return false; |
641 | 641 | } |
@@ -643,36 +643,36 @@ discard block |
||
643 | 643 | } |
644 | 644 | function ValidateFileUploads() |
645 | 645 | { |
646 | - $ret=true; |
|
647 | - foreach($this->fileupload_fields as $upld_field) |
|
646 | + $ret = true; |
|
647 | + foreach ($this->fileupload_fields as $upld_field) |
|
648 | 648 | { |
649 | 649 | $field_name = $upld_field["name"]; |
650 | 650 | |
651 | 651 | $valid_filetypes = $upld_field["file_types"]; |
652 | 652 | |
653 | - if(!$this->IsFileUploaded($field_name)) |
|
653 | + if (!$this->IsFileUploaded($field_name)) |
|
654 | 654 | { |
655 | 655 | continue; |
656 | 656 | } |
657 | 657 | |
658 | - if($_FILES[$field_name]["error"] != 0) |
|
658 | + if ($_FILES[$field_name]["error"] != 0) |
|
659 | 659 | { |
660 | - $this->add_error("Error in file upload; Error code:".$_FILES[$field_name]["error"]); |
|
661 | - $ret=false; |
|
660 | + $this->add_error("Error in file upload; Error code:" . $_FILES[$field_name]["error"]); |
|
661 | + $ret = false; |
|
662 | 662 | } |
663 | 663 | |
664 | - if(!empty($valid_filetypes) && |
|
665 | - !$this->ValidateFileType($field_name,$valid_filetypes)) |
|
664 | + if (!empty($valid_filetypes) && |
|
665 | + !$this->ValidateFileType($field_name, $valid_filetypes)) |
|
666 | 666 | { |
667 | - $ret=false; |
|
667 | + $ret = false; |
|
668 | 668 | } |
669 | 669 | |
670 | - if(!empty($upld_field["maxsize"]) && |
|
671 | - $upld_field["maxsize"]>0) |
|
670 | + if (!empty($upld_field["maxsize"]) && |
|
671 | + $upld_field["maxsize"] > 0) |
|
672 | 672 | { |
673 | - if(!$this->ValidateFileSize($field_name,$upld_field["maxsize"])) |
|
673 | + if (!$this->ValidateFileSize($field_name, $upld_field["maxsize"])) |
|
674 | 674 | { |
675 | - $ret=false; |
|
675 | + $ret = false; |
|
676 | 676 | } |
677 | 677 | } |
678 | 678 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | function StripSlashes($str) |
683 | 683 | { |
684 | - if(get_magic_quotes_gpc()) |
|
684 | + if (get_magic_quotes_gpc()) |
|
685 | 685 | { |
686 | 686 | $str = stripslashes($str); |
687 | 687 | } |
@@ -692,11 +692,11 @@ discard block |
||
692 | 692 | data submitted. Prevents email injections or any other hacker attempts. |
693 | 693 | if $remove_nl is true, newline chracters are removed from the input. |
694 | 694 | */ |
695 | - function Sanitize($str,$remove_nl=true) |
|
695 | + function Sanitize($str, $remove_nl = true) |
|
696 | 696 | { |
697 | 697 | $str = $this->StripSlashes($str); |
698 | 698 | |
699 | - if($remove_nl) |
|
699 | + if ($remove_nl) |
|
700 | 700 | { |
701 | 701 | $injections = array('/(\n+)/i', |
702 | 702 | '/(\r+)/i', |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | '/(%08+)/i', |
707 | 707 | '/(%09+)/i' |
708 | 708 | ); |
709 | - $str = preg_replace($injections,'',$str); |
|
709 | + $str = preg_replace($injections, '', $str); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | return $str; |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | |
725 | 725 | function add_error($error) |
726 | 726 | { |
727 | - array_push($this->errors,$error); |
|
727 | + array_push($this->errors, $error); |
|
728 | 728 | } |
729 | 729 | function validate_email($email) |
730 | 730 | { |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | |
734 | 734 | function GetKey() |
735 | 735 | { |
736 | - return $this->form_random_key.$_SERVER['SERVER_NAME'].$_SERVER['REMOTE_ADDR']; |
|
736 | + return $this->form_random_key . $_SERVER['SERVER_NAME'] . $_SERVER['REMOTE_ADDR']; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | if(empty($_POST['subject'])) |
190 | 190 | { |
191 | 191 | $subject = $categoryen." - ".$depart. " - $this->name / ".$categoryfr." - ".$depart. " - $this->name"; |
192 | - }else{ |
|
192 | + } else{ |
|
193 | 193 | $subject = "GCconnex - ".$depart. " - $this->name / GCconnex - ".$depart. " - $this->name"; |
194 | 194 | } |
195 | 195 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | if(empty($_POST['subject'])) |
264 | 264 | { |
265 | 265 | $subject = "$this->name has contacted you about ". $english." / $this->name vous a envoyé un message à propos de ".$french; |
266 | - }else{ |
|
266 | + } else{ |
|
267 | 267 | $subject = $_POST['subject']; |
268 | 268 | } |
269 | 269 | |
@@ -517,8 +517,7 @@ discard block |
||
517 | 517 | //'contactform:Errname' |
518 | 518 | register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errname'))); |
519 | 519 | $ret = false; |
520 | - } |
|
521 | - else |
|
520 | + } else |
|
522 | 521 | if(strlen($_POST['name'])>75) |
523 | 522 | { |
524 | 523 | $numErr=$numErr+1; |
@@ -535,16 +534,14 @@ discard block |
||
535 | 534 | $this->add_error(); |
536 | 535 | register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremail'))); |
537 | 536 | $ret = false; |
538 | - } |
|
539 | - else |
|
537 | + } else |
|
540 | 538 | if(strlen($_POST['email'])>100) |
541 | 539 | { |
542 | 540 | $numErr=$numErr+1; |
543 | 541 | $this->add_error(); |
544 | 542 | register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Erremailbig'))); |
545 | 543 | $ret = false; |
546 | - } |
|
547 | - else |
|
544 | + } else |
|
548 | 545 | if(!$this->validate_email($_POST['email'])) |
549 | 546 | { |
550 | 547 | $numErr=$numErr+1; |
@@ -561,8 +558,7 @@ discard block |
||
561 | 558 | $this->add_error(); |
562 | 559 | register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errdepart'))); |
563 | 560 | $ret = false; |
564 | - } |
|
565 | - else |
|
561 | + } else |
|
566 | 562 | if(strlen($_POST['depart'])>255) |
567 | 563 | { |
568 | 564 | $numErr=$numErr+1; |
@@ -578,8 +574,7 @@ discard block |
||
578 | 574 | $this->add_error(); |
579 | 575 | register_error(str_replace('[#]',$numErr,elgg_echo('contactform:Errmess'))); |
580 | 576 | $ret = false; |
581 | - } |
|
582 | - else |
|
577 | + } else |
|
583 | 578 | if(strlen($_POST['message'])>2048) |
584 | 579 | { |
585 | 580 | $numErr=$numErr+1; |