@@ -13,255 +13,255 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function boincuser_views_data() { |
15 | 15 | |
16 | - // ----------------------------------------------------------------------------------------------- |
|
17 | - // Definition for user table |
|
18 | - // ----------------------------------------------------------------------------------------------- |
|
16 | + // ----------------------------------------------------------------------------------------------- |
|
17 | + // Definition for user table |
|
18 | + // ----------------------------------------------------------------------------------------------- |
|
19 | 19 | |
20 | - $data['user']['table']['group'] = t('BOINC'); |
|
20 | + $data['user']['table']['group'] = t('BOINC'); |
|
21 | 21 | |
22 | - $data['user']['table']['base'] = array( |
|
23 | - 'field' => 'id', |
|
24 | - 'title' => t('BOINC user'), |
|
25 | - 'help' => t('BOINC account data for a user'), |
|
26 | - 'database' => 'boinc' |
|
27 | - ); |
|
22 | + $data['user']['table']['base'] = array( |
|
23 | + 'field' => 'id', |
|
24 | + 'title' => t('BOINC user'), |
|
25 | + 'help' => t('BOINC account data for a user'), |
|
26 | + 'database' => 'boinc' |
|
27 | + ); |
|
28 | 28 | |
29 | - // Describe each of the individual fields in this table to Views. For |
|
30 | - // each field, you may define what field, sort, argument, and/or filter |
|
31 | - // handlers it supports. This will determine where in the Views interface you |
|
32 | - // may use the field. |
|
29 | + // Describe each of the individual fields in this table to Views. For |
|
30 | + // each field, you may define what field, sort, argument, and/or filter |
|
31 | + // handlers it supports. This will determine where in the Views interface you |
|
32 | + // may use the field. |
|
33 | 33 | |
34 | - // Primary keys allowed as arguments |
|
34 | + // Primary keys allowed as arguments |
|
35 | 35 | |
36 | - $data['user']['id'] = array( |
|
36 | + $data['user']['id'] = array( |
|
37 | 37 | 'title' => bts('Id'), |
38 | 38 | 'help' => t('The BOINC ID of the user account.'), |
39 | 39 | 'field' => array( |
40 | - 'handler' => 'views_handler_field_numeric', |
|
41 | - 'click sortable' => TRUE |
|
40 | + 'handler' => 'views_handler_field_numeric', |
|
41 | + 'click sortable' => TRUE |
|
42 | 42 | ), |
43 | 43 | 'argument' => array( |
44 | - 'handler' => 'views_handler_argument_boincuser_id', // custom handler |
|
45 | - 'name field' => 'title', // the field to display in the summary. |
|
46 | - 'numeric' => TRUE, |
|
47 | - 'validate type' => 'id' |
|
44 | + 'handler' => 'views_handler_argument_boincuser_id', // custom handler |
|
45 | + 'name field' => 'title', // the field to display in the summary. |
|
46 | + 'numeric' => TRUE, |
|
47 | + 'validate type' => 'id' |
|
48 | 48 | ), |
49 | 49 | 'filter' => array( |
50 | - 'handler' => 'views_handler_filter_numeric' |
|
50 | + 'handler' => 'views_handler_filter_numeric' |
|
51 | 51 | ), |
52 | 52 | 'sort' => array( |
53 | - 'handler' => 'views_handler_sort_numeric' |
|
53 | + 'handler' => 'views_handler_sort_numeric' |
|
54 | 54 | ) |
55 | - ); |
|
56 | - $data['user']['teamid'] = array( |
|
55 | + ); |
|
56 | + $data['user']['teamid'] = array( |
|
57 | 57 | 'title' => bts('Team ID'), |
58 | 58 | 'help' => t('The ID of the user\'s team.'), |
59 | 59 | 'field' => array( |
60 | - 'handler' => 'views_handler_field_numeric', |
|
61 | - 'click sortable' => TRUE, |
|
60 | + 'handler' => 'views_handler_field_numeric', |
|
61 | + 'click sortable' => TRUE, |
|
62 | 62 | ), |
63 | 63 | 'argument' => array( |
64 | - 'handler' => 'views_handler_argument_boincteam_id', // custom handler |
|
65 | - 'name field' => 'title', // the field to display in the summary. |
|
66 | - 'numeric' => TRUE, |
|
67 | - 'validate type' => 'id' |
|
64 | + 'handler' => 'views_handler_argument_boincteam_id', // custom handler |
|
65 | + 'name field' => 'title', // the field to display in the summary. |
|
66 | + 'numeric' => TRUE, |
|
67 | + 'validate type' => 'id' |
|
68 | 68 | ), |
69 | 69 | 'filter' => array( |
70 | - 'handler' => 'views_handler_filter_numeric' |
|
70 | + 'handler' => 'views_handler_filter_numeric' |
|
71 | 71 | ), |
72 | 72 | 'sort' => array( |
73 | - 'handler' => 'views_handler_sort_numeric' |
|
73 | + 'handler' => 'views_handler_sort_numeric' |
|
74 | 74 | ) |
75 | - ); |
|
75 | + ); |
|
76 | 76 | |
77 | - // Descriptions of general host fields (alphabetized) |
|
77 | + // Descriptions of general host fields (alphabetized) |
|
78 | 78 | |
79 | - $data['user']['authenticator'] = array( |
|
79 | + $data['user']['authenticator'] = array( |
|
80 | 80 | 'title' => bts('Account Key'), |
81 | 81 | 'help' => t('The BOINC account key of the user.'), |
82 | 82 | 'field' => array( |
83 | - 'handler' => 'views_handler_field', |
|
84 | - 'click sortable' => TRUE |
|
83 | + 'handler' => 'views_handler_field', |
|
84 | + 'click sortable' => TRUE |
|
85 | 85 | ), |
86 | 86 | 'filter' => array( |
87 | - 'handler' => 'views_handler_filter_string' |
|
87 | + 'handler' => 'views_handler_filter_string' |
|
88 | 88 | ), |
89 | 89 | 'sort' => array( |
90 | - 'handler' => 'views_handler_sort_string' |
|
90 | + 'handler' => 'views_handler_sort_string' |
|
91 | 91 | ) |
92 | - ); |
|
93 | - $data['user']['country'] = array( |
|
92 | + ); |
|
93 | + $data['user']['country'] = array( |
|
94 | 94 | 'title' => bts('Country'), |
95 | 95 | 'help' => t('The country of the user.'), |
96 | 96 | 'field' => array( |
97 | - 'handler' => 'views_handler_field', |
|
98 | - 'click sortable' => TRUE |
|
97 | + 'handler' => 'views_handler_field', |
|
98 | + 'click sortable' => TRUE |
|
99 | 99 | ), |
100 | 100 | 'filter' => array( |
101 | - 'handler' => 'views_handler_filter_string' |
|
101 | + 'handler' => 'views_handler_filter_string' |
|
102 | 102 | ), |
103 | 103 | 'sort' => array( |
104 | - 'handler' => 'views_handler_sort_string' |
|
104 | + 'handler' => 'views_handler_sort_string' |
|
105 | 105 | ) |
106 | - ); |
|
107 | - $data['user']['create_time'] = array( |
|
106 | + ); |
|
107 | + $data['user']['create_time'] = array( |
|
108 | 108 | 'title' => bts('Member since'), |
109 | 109 | 'help' => t('When the BOINC account was created.'), |
110 | 110 | 'field' => array( |
111 | - 'handler' => 'views_handler_field_date', |
|
112 | - 'click sortable' => TRUE |
|
111 | + 'handler' => 'views_handler_field_date', |
|
112 | + 'click sortable' => TRUE |
|
113 | 113 | ), |
114 | 114 | 'filter' => array( |
115 | - 'handler' => 'views_handler_filter_date' |
|
115 | + 'handler' => 'views_handler_filter_date' |
|
116 | 116 | ), |
117 | 117 | 'sort' => array( |
118 | - 'handler' => 'views_handler_sort_date' |
|
118 | + 'handler' => 'views_handler_sort_date' |
|
119 | 119 | ) |
120 | - ); |
|
121 | - $data['user']['cross_project_id'] = array( |
|
120 | + ); |
|
121 | + $data['user']['cross_project_id'] = array( |
|
122 | 122 | 'title' => bts('CPID'), |
123 | 123 | 'help' => t('The cross project user identifier.'), |
124 | 124 | 'field' => array( |
125 | - 'handler' => 'views_handler_field', |
|
126 | - 'click sortable' => TRUE |
|
125 | + 'handler' => 'views_handler_field', |
|
126 | + 'click sortable' => TRUE |
|
127 | 127 | ), |
128 | 128 | 'filter' => array( |
129 | - 'handler' => 'views_handler_filter_string' |
|
129 | + 'handler' => 'views_handler_filter_string' |
|
130 | 130 | ), |
131 | 131 | 'sort' => array( |
132 | - 'handler' => 'views_handler_sort_string' |
|
132 | + 'handler' => 'views_handler_sort_string' |
|
133 | 133 | ) |
134 | - ); |
|
135 | - $data['user']['email_addr'] = array( |
|
134 | + ); |
|
135 | + $data['user']['email_addr'] = array( |
|
136 | 136 | 'title' => bts('Email Address'), |
137 | 137 | 'help' => t('The BOINC account email address.'), |
138 | 138 | 'field' => array( |
139 | - 'handler' => 'views_handler_field', |
|
140 | - 'click sortable' => TRUE |
|
139 | + 'handler' => 'views_handler_field', |
|
140 | + 'click sortable' => TRUE |
|
141 | 141 | ), |
142 | 142 | 'filter' => array( |
143 | - 'handler' => 'views_handler_filter_string' |
|
143 | + 'handler' => 'views_handler_filter_string' |
|
144 | 144 | ), |
145 | 145 | 'sort' => array( |
146 | - 'handler' => 'views_handler_sort_string' |
|
146 | + 'handler' => 'views_handler_sort_string' |
|
147 | 147 | ) |
148 | - ); |
|
149 | - $data['user']['expavg_credit'] = array( |
|
148 | + ); |
|
149 | + $data['user']['expavg_credit'] = array( |
|
150 | 150 | 'title' => bts('Recent average credit'), |
151 | 151 | 'help' => t('A decaying average of credit per day for the user.'), |
152 | 152 | 'field' => array( |
153 | - 'handler' => 'views_handler_field_numeric', |
|
154 | - 'click sortable' => TRUE, |
|
155 | - 'float' => TRUE |
|
153 | + 'handler' => 'views_handler_field_numeric', |
|
154 | + 'click sortable' => TRUE, |
|
155 | + 'float' => TRUE |
|
156 | 156 | ), |
157 | 157 | 'filter' => array( |
158 | - 'handler' => 'views_handler_filter_numeric' |
|
158 | + 'handler' => 'views_handler_filter_numeric' |
|
159 | 159 | ), |
160 | 160 | 'sort' => array( |
161 | - 'handler' => 'views_handler_sort_numeric' |
|
161 | + 'handler' => 'views_handler_sort_numeric' |
|
162 | 162 | ) |
163 | - ); |
|
164 | - $data['user']['name'] = array( |
|
163 | + ); |
|
164 | + $data['user']['name'] = array( |
|
165 | 165 | 'title' => bts('Name'), |
166 | 166 | 'help' => t('The BOINC account user name.'), |
167 | 167 | 'field' => array( |
168 | - 'handler' => 'views_handler_field', |
|
169 | - 'click sortable' => TRUE |
|
168 | + 'handler' => 'views_handler_field', |
|
169 | + 'click sortable' => TRUE |
|
170 | 170 | ), |
171 | 171 | 'filter' => array( |
172 | - 'handler' => 'views_handler_filter_string' |
|
172 | + 'handler' => 'views_handler_filter_string' |
|
173 | 173 | ), |
174 | 174 | 'sort' => array( |
175 | - 'handler' => 'views_handler_sort_string' |
|
175 | + 'handler' => 'views_handler_sort_string' |
|
176 | 176 | ) |
177 | - ); |
|
178 | - $data['user']['passwd_hash'] = array( |
|
177 | + ); |
|
178 | + $data['user']['passwd_hash'] = array( |
|
179 | 179 | 'title' => bts('Password Hash'), |
180 | 180 | 'help' => t('The user password hash'), |
181 | 181 | 'field' => array( |
182 | - 'handler' => 'views_handler_field', |
|
183 | - 'click sortable' => TRUE |
|
182 | + 'handler' => 'views_handler_field', |
|
183 | + 'click sortable' => TRUE |
|
184 | 184 | ), |
185 | 185 | 'filter' => array( |
186 | - 'handler' => 'views_handler_filter_string' |
|
186 | + 'handler' => 'views_handler_filter_string' |
|
187 | 187 | ), |
188 | 188 | 'sort' => array( |
189 | - 'handler' => 'views_handler_sort_string' |
|
189 | + 'handler' => 'views_handler_sort_string' |
|
190 | 190 | ) |
191 | - ); |
|
192 | - $data['user']['postal_code'] = array( |
|
191 | + ); |
|
192 | + $data['user']['postal_code'] = array( |
|
193 | 193 | 'title' => bts('Postal Code'), |
194 | 194 | 'help' => t('The postal code of the user.'), |
195 | 195 | 'field' => array( |
196 | - 'handler' => 'views_handler_field', |
|
197 | - 'click sortable' => TRUE |
|
196 | + 'handler' => 'views_handler_field', |
|
197 | + 'click sortable' => TRUE |
|
198 | 198 | ), |
199 | 199 | 'filter' => array( |
200 | - 'handler' => 'views_handler_filter_string' |
|
200 | + 'handler' => 'views_handler_filter_string' |
|
201 | 201 | ), |
202 | 202 | 'sort' => array( |
203 | - 'handler' => 'views_handler_sort_string' |
|
203 | + 'handler' => 'views_handler_sort_string' |
|
204 | 204 | ) |
205 | - ); |
|
206 | - $data['user']['send_email'] = array( |
|
205 | + ); |
|
206 | + $data['user']['send_email'] = array( |
|
207 | 207 | 'title' => bts('Send Email'), |
208 | 208 | 'help' => t('User preference to allow email communications.'), |
209 | 209 | 'field' => array( |
210 | - 'handler' => 'views_handler_field_numeric', |
|
211 | - 'click sortable' => TRUE |
|
210 | + 'handler' => 'views_handler_field_numeric', |
|
211 | + 'click sortable' => TRUE |
|
212 | 212 | ), |
213 | 213 | 'filter' => array( |
214 | - 'handler' => 'views_handler_filter_numeric' |
|
214 | + 'handler' => 'views_handler_filter_numeric' |
|
215 | 215 | ), |
216 | 216 | 'sort' => array( |
217 | - 'handler' => 'views_handler_sort_numeric' |
|
217 | + 'handler' => 'views_handler_sort_numeric' |
|
218 | 218 | ) |
219 | - ); |
|
220 | - $data['user']['show_hosts'] = array( |
|
219 | + ); |
|
220 | + $data['user']['show_hosts'] = array( |
|
221 | 221 | 'title' => bts('Show Hosts'), |
222 | 222 | 'help' => t('User preference to display owned computers.'), |
223 | 223 | 'field' => array( |
224 | - 'handler' => 'views_handler_field_numeric', |
|
225 | - 'click sortable' => TRUE |
|
224 | + 'handler' => 'views_handler_field_numeric', |
|
225 | + 'click sortable' => TRUE |
|
226 | 226 | ), |
227 | 227 | 'filter' => array( |
228 | - 'handler' => 'views_handler_filter_numeric' |
|
228 | + 'handler' => 'views_handler_filter_numeric' |
|
229 | 229 | ), |
230 | 230 | 'sort' => array( |
231 | - 'handler' => 'views_handler_sort_numeric' |
|
231 | + 'handler' => 'views_handler_sort_numeric' |
|
232 | 232 | ) |
233 | - ); |
|
234 | - $data['user']['total_credit'] = array( |
|
233 | + ); |
|
234 | + $data['user']['total_credit'] = array( |
|
235 | 235 | 'title' => bts('Total Credit'), |
236 | 236 | 'help' => t('The total accumulated BOINC credit for the user.'), |
237 | 237 | 'field' => array( |
238 | - 'handler' => 'views_handler_field_numeric', |
|
239 | - 'click sortable' => TRUE, |
|
240 | - 'float' => TRUE |
|
238 | + 'handler' => 'views_handler_field_numeric', |
|
239 | + 'click sortable' => TRUE, |
|
240 | + 'float' => TRUE |
|
241 | 241 | ), |
242 | 242 | 'filter' => array( |
243 | - 'handler' => 'views_handler_filter_numeric' |
|
243 | + 'handler' => 'views_handler_filter_numeric' |
|
244 | 244 | ), |
245 | 245 | 'sort' => array( |
246 | - 'handler' => 'views_handler_sort_numeric' |
|
246 | + 'handler' => 'views_handler_sort_numeric' |
|
247 | 247 | ) |
248 | - ); |
|
249 | - $data['user']['url'] = array( |
|
248 | + ); |
|
249 | + $data['user']['url'] = array( |
|
250 | 250 | 'title' => bts('URL'), |
251 | 251 | 'help' => t('The URL provided by the user'), |
252 | 252 | 'field' => array( |
253 | - 'handler' => 'views_handler_field', |
|
254 | - 'click sortable' => TRUE |
|
253 | + 'handler' => 'views_handler_field', |
|
254 | + 'click sortable' => TRUE |
|
255 | 255 | ), |
256 | 256 | 'filter' => array( |
257 | - 'handler' => 'views_handler_filter_string' |
|
257 | + 'handler' => 'views_handler_filter_string' |
|
258 | 258 | ), |
259 | 259 | 'sort' => array( |
260 | - 'handler' => 'views_handler_sort_string' |
|
260 | + 'handler' => 'views_handler_sort_string' |
|
261 | 261 | ) |
262 | - ); |
|
262 | + ); |
|
263 | 263 | |
264 | - return $data; |
|
264 | + return $data; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /* |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | */ |
273 | 273 | |
274 | 274 | function boincuser_views_handlers() { |
275 | - return array( |
|
275 | + return array( |
|
276 | 276 | 'info' => array( |
277 | - 'path' => drupal_get_path('module', 'boincuser') . '/views', |
|
277 | + 'path' => drupal_get_path('module', 'boincuser') . '/views', |
|
278 | 278 | ), |
279 | 279 | 'handlers' => array( |
280 | - 'views_handler_argument_boincuser_id' => array( |
|
280 | + 'views_handler_argument_boincuser_id' => array( |
|
281 | 281 | 'parent' => 'views_handler_argument_numeric' |
282 | - ), |
|
283 | - 'views_handler_argument_boincteam_id' => array( |
|
282 | + ), |
|
283 | + 'views_handler_argument_boincteam_id' => array( |
|
284 | 284 | 'parent' => 'views_handler_argument_numeric' |
285 | - ), |
|
285 | + ), |
|
286 | 286 | ) |
287 | - ); |
|
287 | + ); |
|
288 | 288 | } |
@@ -274,7 +274,7 @@ |
||
274 | 274 | function boincuser_views_handlers() { |
275 | 275 | return array( |
276 | 276 | 'info' => array( |
277 | - 'path' => drupal_get_path('module', 'boincuser') . '/views', |
|
277 | + 'path' => drupal_get_path('module', 'boincuser').'/views', |
|
278 | 278 | ), |
279 | 279 | 'handlers' => array( |
280 | 280 | 'views_handler_argument_boincuser_id' => array( |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | 'help' => t('The BOINC ID of the user account.'), |
39 | 39 | 'field' => array( |
40 | 40 | 'handler' => 'views_handler_field_numeric', |
41 | - 'click sortable' => TRUE |
|
41 | + 'click sortable' => true |
|
42 | 42 | ), |
43 | 43 | 'argument' => array( |
44 | 44 | 'handler' => 'views_handler_argument_boincuser_id', // custom handler |
45 | 45 | 'name field' => 'title', // the field to display in the summary. |
46 | - 'numeric' => TRUE, |
|
46 | + 'numeric' => true, |
|
47 | 47 | 'validate type' => 'id' |
48 | 48 | ), |
49 | 49 | 'filter' => array( |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | 'help' => t('The ID of the user\'s team.'), |
59 | 59 | 'field' => array( |
60 | 60 | 'handler' => 'views_handler_field_numeric', |
61 | - 'click sortable' => TRUE, |
|
61 | + 'click sortable' => true, |
|
62 | 62 | ), |
63 | 63 | 'argument' => array( |
64 | 64 | 'handler' => 'views_handler_argument_boincteam_id', // custom handler |
65 | 65 | 'name field' => 'title', // the field to display in the summary. |
66 | - 'numeric' => TRUE, |
|
66 | + 'numeric' => true, |
|
67 | 67 | 'validate type' => 'id' |
68 | 68 | ), |
69 | 69 | 'filter' => array( |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 'help' => t('The BOINC account key of the user.'), |
82 | 82 | 'field' => array( |
83 | 83 | 'handler' => 'views_handler_field', |
84 | - 'click sortable' => TRUE |
|
84 | + 'click sortable' => true |
|
85 | 85 | ), |
86 | 86 | 'filter' => array( |
87 | 87 | 'handler' => 'views_handler_filter_string' |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'help' => t('The country of the user.'), |
96 | 96 | 'field' => array( |
97 | 97 | 'handler' => 'views_handler_field', |
98 | - 'click sortable' => TRUE |
|
98 | + 'click sortable' => true |
|
99 | 99 | ), |
100 | 100 | 'filter' => array( |
101 | 101 | 'handler' => 'views_handler_filter_string' |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'help' => t('When the BOINC account was created.'), |
110 | 110 | 'field' => array( |
111 | 111 | 'handler' => 'views_handler_field_date', |
112 | - 'click sortable' => TRUE |
|
112 | + 'click sortable' => true |
|
113 | 113 | ), |
114 | 114 | 'filter' => array( |
115 | 115 | 'handler' => 'views_handler_filter_date' |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | 'help' => t('The cross project user identifier.'), |
124 | 124 | 'field' => array( |
125 | 125 | 'handler' => 'views_handler_field', |
126 | - 'click sortable' => TRUE |
|
126 | + 'click sortable' => true |
|
127 | 127 | ), |
128 | 128 | 'filter' => array( |
129 | 129 | 'handler' => 'views_handler_filter_string' |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'help' => t('The BOINC account email address.'), |
138 | 138 | 'field' => array( |
139 | 139 | 'handler' => 'views_handler_field', |
140 | - 'click sortable' => TRUE |
|
140 | + 'click sortable' => true |
|
141 | 141 | ), |
142 | 142 | 'filter' => array( |
143 | 143 | 'handler' => 'views_handler_filter_string' |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | 'help' => t('A decaying average of credit per day for the user.'), |
152 | 152 | 'field' => array( |
153 | 153 | 'handler' => 'views_handler_field_numeric', |
154 | - 'click sortable' => TRUE, |
|
155 | - 'float' => TRUE |
|
154 | + 'click sortable' => true, |
|
155 | + 'float' => true |
|
156 | 156 | ), |
157 | 157 | 'filter' => array( |
158 | 158 | 'handler' => 'views_handler_filter_numeric' |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | 'help' => t('The BOINC account user name.'), |
167 | 167 | 'field' => array( |
168 | 168 | 'handler' => 'views_handler_field', |
169 | - 'click sortable' => TRUE |
|
169 | + 'click sortable' => true |
|
170 | 170 | ), |
171 | 171 | 'filter' => array( |
172 | 172 | 'handler' => 'views_handler_filter_string' |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'help' => t('The user password hash'), |
181 | 181 | 'field' => array( |
182 | 182 | 'handler' => 'views_handler_field', |
183 | - 'click sortable' => TRUE |
|
183 | + 'click sortable' => true |
|
184 | 184 | ), |
185 | 185 | 'filter' => array( |
186 | 186 | 'handler' => 'views_handler_filter_string' |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | 'help' => t('The postal code of the user.'), |
195 | 195 | 'field' => array( |
196 | 196 | 'handler' => 'views_handler_field', |
197 | - 'click sortable' => TRUE |
|
197 | + 'click sortable' => true |
|
198 | 198 | ), |
199 | 199 | 'filter' => array( |
200 | 200 | 'handler' => 'views_handler_filter_string' |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | 'help' => t('User preference to allow email communications.'), |
209 | 209 | 'field' => array( |
210 | 210 | 'handler' => 'views_handler_field_numeric', |
211 | - 'click sortable' => TRUE |
|
211 | + 'click sortable' => true |
|
212 | 212 | ), |
213 | 213 | 'filter' => array( |
214 | 214 | 'handler' => 'views_handler_filter_numeric' |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | 'help' => t('User preference to display owned computers.'), |
223 | 223 | 'field' => array( |
224 | 224 | 'handler' => 'views_handler_field_numeric', |
225 | - 'click sortable' => TRUE |
|
225 | + 'click sortable' => true |
|
226 | 226 | ), |
227 | 227 | 'filter' => array( |
228 | 228 | 'handler' => 'views_handler_filter_numeric' |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | 'help' => t('The total accumulated BOINC credit for the user.'), |
237 | 237 | 'field' => array( |
238 | 238 | 'handler' => 'views_handler_field_numeric', |
239 | - 'click sortable' => TRUE, |
|
240 | - 'float' => TRUE |
|
239 | + 'click sortable' => true, |
|
240 | + 'float' => true |
|
241 | 241 | ), |
242 | 242 | 'filter' => array( |
243 | 243 | 'handler' => 'views_handler_filter_numeric' |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | 'help' => t('The URL provided by the user'), |
252 | 252 | 'field' => array( |
253 | 253 | 'handler' => 'views_handler_field', |
254 | - 'click sortable' => TRUE |
|
254 | + 'click sortable' => true |
|
255 | 255 | ), |
256 | 256 | 'filter' => array( |
257 | 257 | 'handler' => 'views_handler_filter_string' |
@@ -15,54 +15,54 @@ discard block |
||
15 | 15 | * Form validation handler for login |
16 | 16 | */ |
17 | 17 | function boincuser_login_validate($form, &$form_state) { |
18 | - /* // SAMPLE: To try validation with Drupal first... |
|
18 | + /* // SAMPLE: To try validation with Drupal first... |
|
19 | 19 | global $user; |
20 | 20 | if (!empty($user->uid)) { |
21 | 21 | // Authentication with Drupal was successful |
22 | 22 | return; |
23 | 23 | }*/ |
24 | 24 | |
25 | - // Set name for logging purposes |
|
26 | - $form_state['values']['name'] = $form_state['values']['email']; |
|
25 | + // Set name for logging purposes |
|
26 | + $form_state['values']['name'] = $form_state['values']['email']; |
|
27 | 27 | |
28 | - // Bypass BOINC validation if passed the name of user 1 |
|
29 | - $user_1 = user_load(1); |
|
30 | - if ($form_state['values']['email'] == $user_1->name) { |
|
28 | + // Bypass BOINC validation if passed the name of user 1 |
|
29 | + $user_1 = user_load(1); |
|
30 | + if ($form_state['values']['email'] == $user_1->name) { |
|
31 | 31 | user_authenticate($form_state['values']); |
32 | 32 | return; |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | - // Call our custom authentication function to check for an existing BOINC user |
|
36 | - if (!boincuser_login_authenticate($form_state['values'])) { |
|
35 | + // Call our custom authentication function to check for an existing BOINC user |
|
36 | + if (!boincuser_login_authenticate($form_state['values'])) { |
|
37 | 37 | // Authentication failed; set an error accordingly |
38 | 38 | form_set_error('name', bts('Sorry, unrecognized email address or password.') . ' ' . l(bts('Have you forgotten your password?'), 'user/password')); |
39 | - } |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Custom authentication function to check BOINC account information |
44 | 44 | */ |
45 | 45 | function boincuser_login_authenticate($form_values) { |
46 | - global $boincuser_authenticated; |
|
47 | - $email_addr = strtolower($form_values['email']); |
|
48 | - $passwd = $form_values['pass']; |
|
49 | - $passwd_hash = md5($passwd.$email_addr); |
|
50 | - |
|
51 | - // Include BOINC user library |
|
52 | - require_boinc('boinc_db'); |
|
53 | - |
|
54 | - // Get the BOINC user and check credentials |
|
55 | - $boinc_user = BoincUser::lookup_email_addr($email_addr); |
|
56 | - if (!$boinc_user) return false; |
|
57 | - if ($passwd_hash != $boinc_user->passwd_hash) return false; |
|
58 | - |
|
59 | - // BOINC authentication successful; log in and synchronize accounts |
|
60 | - boincuser_login_register($boinc_user); |
|
61 | - // Write session, update timestamp, run user 'login' hook. |
|
62 | - user_authenticate_finalize($form_values); |
|
63 | - // Use a global variable to save the fact that we did authentication. |
|
64 | - $boincuser_authenticated = true; |
|
65 | - return true; |
|
46 | + global $boincuser_authenticated; |
|
47 | + $email_addr = strtolower($form_values['email']); |
|
48 | + $passwd = $form_values['pass']; |
|
49 | + $passwd_hash = md5($passwd.$email_addr); |
|
50 | + |
|
51 | + // Include BOINC user library |
|
52 | + require_boinc('boinc_db'); |
|
53 | + |
|
54 | + // Get the BOINC user and check credentials |
|
55 | + $boinc_user = BoincUser::lookup_email_addr($email_addr); |
|
56 | + if (!$boinc_user) return false; |
|
57 | + if ($passwd_hash != $boinc_user->passwd_hash) return false; |
|
58 | + |
|
59 | + // BOINC authentication successful; log in and synchronize accounts |
|
60 | + boincuser_login_register($boinc_user); |
|
61 | + // Write session, update timestamp, run user 'login' hook. |
|
62 | + user_authenticate_finalize($form_values); |
|
63 | + // Use a global variable to save the fact that we did authentication. |
|
64 | + $boincuser_authenticated = true; |
|
65 | + return true; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | * Drupal accounts |
71 | 71 | */ |
72 | 72 | function boincuser_login_register($boinc_user) { |
73 | - global $user; |
|
74 | - require_boinc('boinc_db'); |
|
75 | - // If a Drupal account already exists, log in |
|
76 | - $existing_user = user_load(array('mail' => $boinc_user->email_addr)); |
|
77 | - if (!empty($existing_user->uid)) { |
|
73 | + global $user; |
|
74 | + require_boinc('boinc_db'); |
|
75 | + // If a Drupal account already exists, log in |
|
76 | + $existing_user = user_load(array('mail' => $boinc_user->email_addr)); |
|
77 | + if (!empty($existing_user->uid)) { |
|
78 | 78 | $user = $existing_user; |
79 | - } else { |
|
79 | + } else { |
|
80 | 80 | // Create a Drupal user from the BOINC user |
81 | 81 | if ($user = boincuser_register_make_drupal_user($boinc_user)) { |
82 | - watchdog('user', 'New external user: %email using module %module.', array('%email' => $email_addr, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit')); |
|
82 | + watchdog('user', 'New external user: %email using module %module.', array('%email' => $email_addr, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit')); |
|
83 | + } |
|
83 | 84 | } |
84 | - } |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -93,75 +93,75 @@ discard block |
||
93 | 93 | * New user registration validation handler. |
94 | 94 | */ |
95 | 95 | function boincuser_register_validate($form_values) { |
96 | - // Include BOINC database objects library |
|
97 | - require_boinc('boinc_db'); |
|
98 | - // Check for an existing BOINC user |
|
99 | - $boinc_user = BoincUser::lookup_email_addr($form_values['mail']); |
|
100 | - if ($boinc_user) return false; |
|
101 | - return true; |
|
96 | + // Include BOINC database objects library |
|
97 | + require_boinc('boinc_db'); |
|
98 | + // Check for an existing BOINC user |
|
99 | + $boinc_user = BoincUser::lookup_email_addr($form_values['mail']); |
|
100 | + if ($boinc_user) return false; |
|
101 | + return true; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Create BOINC account |
106 | 106 | */ |
107 | 107 | function boincuser_register_make_user($params) { |
108 | - // Include BOINC user library |
|
109 | - require_boinc('user'); |
|
110 | - // Create the BOINC user |
|
111 | - $boinc_user = make_user($params['email_addr'], $params['name'], $params['passwd_hash'], $params['country'], $params['postal_code']); |
|
112 | - return $boinc_user; |
|
108 | + // Include BOINC user library |
|
109 | + require_boinc('user'); |
|
110 | + // Create the BOINC user |
|
111 | + $boinc_user = make_user($params['email_addr'], $params['name'], $params['passwd_hash'], $params['country'], $params['postal_code']); |
|
112 | + return $boinc_user; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Create Drupal account from existing BOINC account |
117 | 117 | */ |
118 | 118 | function boincuser_register_make_drupal_user($boinc_user) { |
119 | - $account = null; |
|
120 | - if (is_numeric($boinc_user)) { |
|
119 | + $account = null; |
|
120 | + if (is_numeric($boinc_user)) { |
|
121 | 121 | $boinc_user = boincuser_load($boinc_user); |
122 | - } |
|
123 | - if ($boinc_user) { |
|
122 | + } |
|
123 | + if ($boinc_user) { |
|
124 | 124 | $account = boincuser_create_drupal_user($boinc_user); |
125 | 125 | if ($account) { |
126 | - boincuser_create_drupal_profile($account, $boinc_user); |
|
126 | + boincuser_create_drupal_profile($account, $boinc_user); |
|
127 | + } |
|
127 | 128 | } |
128 | - } |
|
129 | - return $account; |
|
129 | + return $account; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | function boincuser_create_drupal_user($boinc_user) { |
133 | - require_boinc('forum_db'); |
|
134 | - BoincForumPrefs::lookup($boinc_user); |
|
135 | - $account = NULL; |
|
136 | - $module = 'boincuser'; |
|
133 | + require_boinc('forum_db'); |
|
134 | + BoincForumPrefs::lookup($boinc_user); |
|
135 | + $account = NULL; |
|
136 | + $module = 'boincuser'; |
|
137 | 137 | |
138 | - // Verify that this account has not already been imported |
|
139 | - $already_imported = db_result(db_query(' |
|
138 | + // Verify that this account has not already been imported |
|
139 | + $already_imported = db_result(db_query(' |
|
140 | 140 | SELECT COUNT(*) FROM {boincuser} WHERE boinc_id = %d', |
141 | 141 | $boinc_user->id) |
142 | - ); |
|
143 | - if ($already_imported) { |
|
142 | + ); |
|
143 | + if ($already_imported) { |
|
144 | 144 | return NULL; |
145 | - } |
|
145 | + } |
|
146 | 146 | |
147 | - // Email is limited to 64 characters... |
|
148 | - $boinc_email = substr($boinc_user->email_addr, 0, 64); |
|
147 | + // Email is limited to 64 characters... |
|
148 | + $boinc_email = substr($boinc_user->email_addr, 0, 64); |
|
149 | 149 | |
150 | - // Email should be unique |
|
151 | - $already_imported = db_result(db_query(" |
|
150 | + // Email should be unique |
|
151 | + $already_imported = db_result(db_query(" |
|
152 | 152 | SELECT COUNT(*) FROM {users} WHERE mail = '%s'", |
153 | 153 | $boinc_email) |
154 | - ); |
|
155 | - if ($already_imported) { |
|
154 | + ); |
|
155 | + if ($already_imported) { |
|
156 | 156 | drupal_set_message(t('An account for @email already exists', array('@email' => $boinc_email)), 'warning'); |
157 | 157 | watchdog('boincimport', 'An account for @email already exists', array('@email' => $boinc_email), WATCHDOG_WARNING); |
158 | 158 | return NULL; |
159 | - } |
|
159 | + } |
|
160 | 160 | |
161 | - // Make sure name is unique |
|
162 | - $unique_name = find_unique_name($boinc_user->name); |
|
161 | + // Make sure name is unique |
|
162 | + $unique_name = find_unique_name($boinc_user->name); |
|
163 | 163 | |
164 | - $userinfo = array( |
|
164 | + $userinfo = array( |
|
165 | 165 | 'name' => $unique_name, |
166 | 166 | 'pass' => $boinc_user->passwd_hash, |
167 | 167 | 'mail' => $boinc_email, |
@@ -171,126 +171,126 @@ discard block |
||
171 | 171 | 'status' => 1, |
172 | 172 | "authname_{$module}" => $boinc_email, |
173 | 173 | 'access' => time() |
174 | - ); |
|
174 | + ); |
|
175 | 175 | |
176 | - $in_penalty = ($boinc_user->prefs->banished_until > time()); |
|
176 | + $in_penalty = ($boinc_user->prefs->banished_until > time()); |
|
177 | 177 | |
178 | - // Add user to community member role (if no current penalty) |
|
179 | - if (!$in_penalty) { |
|
178 | + // Add user to community member role (if no current penalty) |
|
179 | + if (!$in_penalty) { |
|
180 | 180 | $community_role = array_search('community member', user_roles(true)); |
181 | 181 | $userinfo['roles'] = array( |
182 | - $community_role => '' |
|
182 | + $community_role => '' |
|
183 | 183 | ); |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | - // Mark account as imported so a BOINC account is not created on Insert (i.e. user_save) |
|
187 | - $_SESSION['importedUser'] = true; |
|
188 | - $account = user_save('', $userinfo); |
|
186 | + // Mark account as imported so a BOINC account is not created on Insert (i.e. user_save) |
|
187 | + $_SESSION['importedUser'] = true; |
|
188 | + $account = user_save('', $userinfo); |
|
189 | 189 | |
190 | - // Drupal overrides the original registration date, so update to the correct date |
|
191 | - $account = user_save($account, array('created' => $userinfo['created'])); |
|
190 | + // Drupal overrides the original registration date, so update to the correct date |
|
191 | + $account = user_save($account, array('created' => $userinfo['created'])); |
|
192 | 192 | |
193 | - // Terminate if an error occured during user_save(). |
|
194 | - if (!$account) { |
|
193 | + // Terminate if an error occured during user_save(). |
|
194 | + if (!$account) { |
|
195 | 195 | drupal_set_message(t("Error saving user account."), 'error'); |
196 | 196 | return NULL; |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - // Cross reference the Drupal and BOINC accounts |
|
200 | - boincuser_account_cross_reference($account->uid, $boinc_user->id); |
|
199 | + // Cross reference the Drupal and BOINC accounts |
|
200 | + boincuser_account_cross_reference($account->uid, $boinc_user->id); |
|
201 | 201 | |
202 | - if ($in_penalty) { |
|
202 | + if ($in_penalty) { |
|
203 | 203 | // Import the timestamp of when the penalty period will be over |
204 | 204 | $boincuser_record = array( |
205 | - 'uid' => $account->uid, |
|
206 | - 'penalty_expiration' => $boinc_user->prefs->banished_until, |
|
205 | + 'uid' => $account->uid, |
|
206 | + 'penalty_expiration' => $boinc_user->prefs->banished_until, |
|
207 | 207 | ); |
208 | 208 | drupal_write_record('boincuser', $boincuser_record, 'uid'); |
209 | - } |
|
209 | + } |
|
210 | 210 | |
211 | - return $account; |
|
211 | + return $account; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | function boincuser_create_drupal_profile($account, $boinc_user) { |
215 | 215 | |
216 | - require_boinc('forum_db'); |
|
217 | - BoincForumPrefs::lookup($boinc_user); |
|
216 | + require_boinc('forum_db'); |
|
217 | + BoincForumPrefs::lookup($boinc_user); |
|
218 | 218 | |
219 | - $image_dir = boinc_get_path('user_image'); |
|
219 | + $image_dir = boinc_get_path('user_image'); |
|
220 | 220 | |
221 | - // Automatically create a content profile |
|
222 | - $now = time(); |
|
223 | - $profile_background = null; |
|
224 | - $profile_opinions = null; |
|
225 | - $profile_image = null; |
|
226 | - $avatar_image = null; |
|
227 | - $profile_approved = NULL; |
|
221 | + // Automatically create a content profile |
|
222 | + $now = time(); |
|
223 | + $profile_background = null; |
|
224 | + $profile_opinions = null; |
|
225 | + $profile_image = null; |
|
226 | + $avatar_image = null; |
|
227 | + $profile_approved = NULL; |
|
228 | 228 | |
229 | - // Load the BOINC profile, if available |
|
230 | - if ($boinc_user->has_profile) { |
|
229 | + // Load the BOINC profile, if available |
|
230 | + if ($boinc_user->has_profile) { |
|
231 | 231 | $boinc_profile = BoincProfile::lookup("userid={$boinc_user->id}"); |
232 | 232 | $profile_background = $boinc_profile->response1; |
233 | 233 | $profile_opinions = $boinc_profile->response2; |
234 | 234 | if ($boinc_profile->has_picture) { |
235 | - // Load picture; load validators; determine where to store it in Drupal |
|
236 | - $image_path = "{$image_dir}/{$boinc_user->id}.jpg"; |
|
237 | - $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', TRUE); |
|
238 | - // If the user does not have a different image as an avatar, use this one |
|
239 | - if (!$boinc_user->prefs->avatar) { |
|
235 | + // Load picture; load validators; determine where to store it in Drupal |
|
236 | + $image_path = "{$image_dir}/{$boinc_user->id}.jpg"; |
|
237 | + $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', TRUE); |
|
238 | + // If the user does not have a different image as an avatar, use this one |
|
239 | + if (!$boinc_user->prefs->avatar) { |
|
240 | 240 | $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
241 | - } |
|
241 | + } |
|
242 | 242 | } |
243 | 243 | if ($boinc_user->prefs->avatar) { |
244 | - $image_path = "{$image_dir}/{$boinc_user->id}_avatar.jpg"; |
|
245 | - $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
244 | + $image_path = "{$image_dir}/{$boinc_user->id}_avatar.jpg"; |
|
245 | + $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
246 | 246 | } |
247 | 247 | $profile_approved = $boinc_profile->verification ? TRUE : FALSE; |
248 | - } |
|
249 | - $default_input_format = db_result(db_query(" |
|
248 | + } |
|
249 | + $default_input_format = db_result(db_query(" |
|
250 | 250 | SELECT format FROM {filter_formats} WHERE name = '%s'", 'Rich text')); |
251 | - if (!$default_input_format) $default_input_format = 1; |
|
252 | - |
|
253 | - // Populate the profile object |
|
254 | - $profile_node = new stdClass(); |
|
255 | - $profile_node->title = $boinc_user->name; |
|
256 | - $profile_node->uid = $account->uid; |
|
257 | - $profile_node->body = ''; |
|
258 | - $profile_node->type = 'profile'; |
|
259 | - $profile_node->created = $now; |
|
260 | - $profile_node->changed = $now; |
|
261 | - $profile_node->status = 1; |
|
262 | - $profile_node->promote = 0; |
|
263 | - $profile_node->sticky = 0; |
|
264 | - $profile_node->format = $default_input_format; |
|
265 | - $profile_node->name = $account->name; // Set to link profile to account uid! |
|
266 | - $profile_node->field_country[]['value'] = $boinc_user->country; |
|
267 | - $profile_node->field_zip[]['value'] = $boinc_user->postal_code; |
|
268 | - $profile_node->field_url[]['value'] = $boinc_user->url; |
|
269 | - $profile_node->field_background[]['value'] = $profile_background; |
|
270 | - $profile_node->field_opinions[]['value'] = $profile_opinions; |
|
271 | - $profile_node->field_image[] = $avatar_image; |
|
272 | - $profile_node->field_profile_image[] = $profile_image; |
|
273 | - |
|
274 | - // Save the profile object to the database |
|
275 | - // This will automatically set the author uid if node->name has been set |
|
276 | - $profile_node = node_submit($profile_node); |
|
277 | - node_save($profile_node); |
|
278 | - |
|
279 | - // Mark profile as approved if it has already been vetted somehow |
|
280 | - if ($profile_approved OR !$boinc_user->has_profile) { |
|
251 | + if (!$default_input_format) $default_input_format = 1; |
|
252 | + |
|
253 | + // Populate the profile object |
|
254 | + $profile_node = new stdClass(); |
|
255 | + $profile_node->title = $boinc_user->name; |
|
256 | + $profile_node->uid = $account->uid; |
|
257 | + $profile_node->body = ''; |
|
258 | + $profile_node->type = 'profile'; |
|
259 | + $profile_node->created = $now; |
|
260 | + $profile_node->changed = $now; |
|
261 | + $profile_node->status = 1; |
|
262 | + $profile_node->promote = 0; |
|
263 | + $profile_node->sticky = 0; |
|
264 | + $profile_node->format = $default_input_format; |
|
265 | + $profile_node->name = $account->name; // Set to link profile to account uid! |
|
266 | + $profile_node->field_country[]['value'] = $boinc_user->country; |
|
267 | + $profile_node->field_zip[]['value'] = $boinc_user->postal_code; |
|
268 | + $profile_node->field_url[]['value'] = $boinc_user->url; |
|
269 | + $profile_node->field_background[]['value'] = $profile_background; |
|
270 | + $profile_node->field_opinions[]['value'] = $profile_opinions; |
|
271 | + $profile_node->field_image[] = $avatar_image; |
|
272 | + $profile_node->field_profile_image[] = $profile_image; |
|
273 | + |
|
274 | + // Save the profile object to the database |
|
275 | + // This will automatically set the author uid if node->name has been set |
|
276 | + $profile_node = node_submit($profile_node); |
|
277 | + node_save($profile_node); |
|
278 | + |
|
279 | + // Mark profile as approved if it has already been vetted somehow |
|
280 | + if ($profile_approved OR !$boinc_user->has_profile) { |
|
281 | 281 | $profile_node->moderate = 0; |
282 | 282 | node_save($profile_node); |
283 | - } |
|
283 | + } |
|
284 | 284 | |
285 | - return; |
|
285 | + return; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | function boincuser_account_cross_reference($uid, $boinc_id) { |
289 | 289 | // Cross reference Drupal account with BOINC |
290 | 290 | $reference = db_query("INSERT INTO {boincuser} SET uid=%d, boinc_id=%d", $uid, $boinc_id); |
291 | 291 | if (!$reference) { |
292 | - drupal_set_message(t("Error connecting BOINC account."), 'error'); |
|
293 | - return false; |
|
292 | + drupal_set_message(t("Error connecting BOINC account."), 'error'); |
|
293 | + return false; |
|
294 | 294 | } |
295 | 295 | return true; |
296 | 296 | } |
@@ -299,35 +299,35 @@ discard block |
||
299 | 299 | * Convert any BOINC forum thread subscriptions to Drupal flag subscriptions |
300 | 300 | */ |
301 | 301 | function boincuser_pull_subscriptions($account = NULL) { |
302 | - if (!$account) { |
|
302 | + if (!$account) { |
|
303 | 303 | global $user; |
304 | 304 | $account = user_load($user->id); |
305 | - } |
|
306 | - elseif (is_numeric($account)) { |
|
305 | + } |
|
306 | + elseif (is_numeric($account)) { |
|
307 | 307 | $account = user_load($account); |
308 | - } |
|
308 | + } |
|
309 | 309 | |
310 | - // Get any subscriptions for this user |
|
311 | - db_set_active('boinc'); |
|
312 | - $subscriptions = db_query(' |
|
310 | + // Get any subscriptions for this user |
|
311 | + db_set_active('boinc'); |
|
312 | + $subscriptions = db_query(' |
|
313 | 313 | SELECT threadid FROM {subscriptions} |
314 | 314 | WHERE userid = %d', $account->boincuser_id); |
315 | - db_set_active('default'); |
|
315 | + db_set_active('default'); |
|
316 | 316 | |
317 | - $flag = flag_get_flag('subscriptions') or die('no "subscriptions" flag defined'); |
|
318 | - $count = 0; |
|
319 | - while ($thread_id = db_result($subscriptions)) { |
|
317 | + $flag = flag_get_flag('subscriptions') or die('no "subscriptions" flag defined'); |
|
318 | + $count = 0; |
|
319 | + while ($thread_id = db_result($subscriptions)) { |
|
320 | 320 | // For each BOINC thread ID subscribed, look up the corresponding node ID |
321 | 321 | $nid = db_result(db_query(' |
322 | 322 | SELECT nid FROM {boincimport_temp_topic} |
323 | 323 | WHERE topic_id = %d', $thread_id)); |
324 | 324 | // Flag this node for the user |
325 | 325 | if ($nid > 0) { |
326 | - $flag->flag('flag', $nid, $account); |
|
327 | - $count++; |
|
326 | + $flag->flag('flag', $nid, $account); |
|
327 | + $count++; |
|
328 | 328 | } |
329 | - } |
|
330 | - return $count; |
|
329 | + } |
|
330 | + return $count; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -339,45 +339,45 @@ discard block |
||
339 | 339 | * User account update validation handler. |
340 | 340 | */ |
341 | 341 | function boincuser_account_validate($edit, $account) { |
342 | - // Include BOINC database objects library, load BOINC account data |
|
343 | - require_boinc('boinc_db'); |
|
344 | - $boinc_user = BoincUser::lookup_email_addr($account->mail); |
|
345 | - $changing_email = ($edit['mail'] AND $edit['mail'] != $account->mail) ? true : false; |
|
346 | - $changing_pass = ($edit['pass']) ? true : false; |
|
347 | - if ($changing_email) { |
|
342 | + // Include BOINC database objects library, load BOINC account data |
|
343 | + require_boinc('boinc_db'); |
|
344 | + $boinc_user = BoincUser::lookup_email_addr($account->mail); |
|
345 | + $changing_email = ($edit['mail'] AND $edit['mail'] != $account->mail) ? true : false; |
|
346 | + $changing_pass = ($edit['pass']) ? true : false; |
|
347 | + if ($changing_email) { |
|
348 | 348 | // E-mail address is set to change; check for an existing BOINC user |
349 | 349 | $boinc_user_already_exists = BoincUser::lookup_email_addr($edit['mail']); |
350 | 350 | if ($boinc_user_already_exists) { |
351 | - form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']))); |
|
351 | + form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']))); |
|
352 | + } |
|
352 | 353 | } |
353 | - } |
|
354 | 354 | |
355 | - // If user is changing email or password, require that the current |
|
356 | - // password has been given as well. |
|
357 | - if (($changing_email OR $changing_pass) AND !user_access('administer users')) { |
|
355 | + // If user is changing email or password, require that the current |
|
356 | + // password has been given as well. |
|
357 | + if (($changing_email OR $changing_pass) AND !user_access('administer users')) { |
|
358 | 358 | // If changing email or password, require current password |
359 | 359 | // (except in cases where password is being reset) |
360 | 360 | if (isset($_SESSION['reset_pass'])) { |
361 | - unset($_SESSION['reset_pass']); |
|
361 | + unset($_SESSION['reset_pass']); |
|
362 | 362 | } |
363 | 363 | else { |
364 | - $given_hash = md5($edit['current_pass'] . $account->mail); |
|
365 | - if (!$edit['current_pass']) { |
|
364 | + $given_hash = md5($edit['current_pass'] . $account->mail); |
|
365 | + if (!$edit['current_pass']) { |
|
366 | 366 | form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.')); |
367 | - } |
|
368 | - elseif ($given_hash != $boinc_user->passwd_hash) { |
|
367 | + } |
|
368 | + elseif ($given_hash != $boinc_user->passwd_hash) { |
|
369 | 369 | form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.')); |
370 | - } |
|
370 | + } |
|
371 | + } |
|
371 | 372 | } |
372 | - } |
|
373 | 373 | |
374 | - // If an admin tries to change the email and NOT the password, show |
|
375 | - // error message. BOINC requires both to be changed together. |
|
376 | - if ($changing_email AND !$changing_pass AND user_access('administer users')) { |
|
374 | + // If an admin tries to change the email and NOT the password, show |
|
375 | + // error message. BOINC requires both to be changed together. |
|
376 | + if ($changing_email AND !$changing_pass AND user_access('administer users')) { |
|
377 | 377 | form_set_error('pass', bts('If changing a user\'s email, you must also change the password simultaneously.')); |
378 | - } |
|
378 | + } |
|
379 | 379 | |
380 | - // Expansion required to allow account key in place of passwd...? |
|
380 | + // Expansion required to allow account key in place of passwd...? |
|
381 | 381 | |
382 | 382 | } |
383 | 383 | |
@@ -390,118 +390,118 @@ discard block |
||
390 | 390 | * Password request validation handler. |
391 | 391 | */ |
392 | 392 | function boincuser_request_pass_validate($form, &$form_state) { |
393 | - $edit = $form_state['values']; |
|
394 | - // The Drupal submit function expects a "name" field, even though |
|
395 | - // it contains an email address and we will not allow a user name |
|
396 | - if (!$edit['name']) form_set_error('name', bts('Please enter your email address')); |
|
397 | - elseif (!valid_email_address($edit['name'])) form_set_error('name', bts('@email is not a well formed email address, please verify', array('@email' => $edit['name']))); |
|
398 | - else { |
|
393 | + $edit = $form_state['values']; |
|
394 | + // The Drupal submit function expects a "name" field, even though |
|
395 | + // it contains an email address and we will not allow a user name |
|
396 | + if (!$edit['name']) form_set_error('name', bts('Please enter your email address')); |
|
397 | + elseif (!valid_email_address($edit['name'])) form_set_error('name', bts('@email is not a well formed email address, please verify', array('@email' => $edit['name']))); |
|
398 | + else { |
|
399 | 399 | // First look for an existing Drupal account |
400 | 400 | if ($account = user_load_by_mail($edit['name'])) return; |
401 | 401 | // Otherwise, check the BOINC db for this email address |
402 | 402 | require_boinc('boinc_db'); |
403 | 403 | $boinc_user = BoincUser::lookup_email_addr($edit['name']); |
404 | 404 | if ($boinc_user) { |
405 | - // If the user is in BOINC but not Drupal, bring them over... |
|
406 | - boincuser_register_make_drupal_user($boinc_user); |
|
405 | + // If the user is in BOINC but not Drupal, bring them over... |
|
406 | + boincuser_register_make_drupal_user($boinc_user); |
|
407 | 407 | } else { |
408 | - // If there is no existing BOINC user either, show an error |
|
409 | - form_set_error('name', bts('No account exists for @email -- select "Create new account" to register', array('@email' => $edit['name']))); |
|
408 | + // If there is no existing BOINC user either, show an error |
|
409 | + form_set_error('name', bts('No account exists for @email -- select "Create new account" to register', array('@email' => $edit['name']))); |
|
410 | + } |
|
410 | 411 | } |
411 | - } |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
415 | 415 | * The definition of the authenticator login form. |
416 | 416 | */ |
417 | 417 | function boincuser_authloginform() { |
418 | - $headers = apache_request_headers(); |
|
419 | - $project_name = variable_get('site_name', 'einsteinathome.org'); |
|
420 | - $project_domain = $headers['Host']; |
|
421 | - $form['heading'] = array( |
|
418 | + $headers = apache_request_headers(); |
|
419 | + $project_name = variable_get('site_name', 'einsteinathome.org'); |
|
420 | + $project_domain = $headers['Host']; |
|
421 | + $form['heading'] = array( |
|
422 | 422 | '#type' => 'markup', |
423 | 423 | '#value' => '<h3>' . bts("If you forgot your account's email address, or you can't receive email there:") . '</h3>' |
424 | - ); |
|
425 | - $form['instructions'] = array( |
|
424 | + ); |
|
425 | + $form['instructions'] = array( |
|
426 | 426 | '#type' => 'markup', |
427 | 427 | '#value' => '' . |
428 | - '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:") . |
|
429 | - ' <ul>' . |
|
430 | - ' <li>' . bts('Go to the BOINC data directory on your computer (see !boinc_wiki for help finding this).', array('!boinc_wiki' => l(bts('BOINC documentation'), 'http://boinc.berkeley.edu/wiki/BOINC_Data_directory'))) . '</li>' . |
|
431 | - ' <li>' . bts('Find your account file for this project; it will have a name like %file (where the project URL is %url).', array('%file' => "account_{$project_domain}.xml", '%url' => "http://{$project_domain}")) . '</li>' . |
|
432 | - ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:") . |
|
433 | - ' <pre>' . |
|
434 | - '<account>' . "\n" . |
|
435 | - " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
|
436 | - ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>' . "\n" . |
|
437 | - " <project_name>{$project_name}</project_name>" . "\n" . |
|
438 | - ' ...' . "\n" . |
|
439 | - '</account>' . |
|
440 | - ' </pre>' . |
|
441 | - ' </li>' . |
|
442 | - ' <li>' . bts('Select and Copy the string between <authenticator> and </authenticator> (%auth in the above example).', array('%auth' => '8b8496fdd26df7dc0423ecd43c09a56b')) . '</li>' . |
|
443 | - ' <li>' . bts('Paste the string into the field below, and click OK.') . '</li>' . |
|
444 | - ' <li>' . bts('You will now be logged in to your account; update the email and password of your account.') . '</li>' . |
|
445 | - ' </ul>' . |
|
446 | - '</p>' |
|
447 | - ); |
|
448 | - $form['authenticator'] = array( |
|
428 | + '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:") . |
|
429 | + ' <ul>' . |
|
430 | + ' <li>' . bts('Go to the BOINC data directory on your computer (see !boinc_wiki for help finding this).', array('!boinc_wiki' => l(bts('BOINC documentation'), 'http://boinc.berkeley.edu/wiki/BOINC_Data_directory'))) . '</li>' . |
|
431 | + ' <li>' . bts('Find your account file for this project; it will have a name like %file (where the project URL is %url).', array('%file' => "account_{$project_domain}.xml", '%url' => "http://{$project_domain}")) . '</li>' . |
|
432 | + ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:") . |
|
433 | + ' <pre>' . |
|
434 | + '<account>' . "\n" . |
|
435 | + " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
|
436 | + ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>' . "\n" . |
|
437 | + " <project_name>{$project_name}</project_name>" . "\n" . |
|
438 | + ' ...' . "\n" . |
|
439 | + '</account>' . |
|
440 | + ' </pre>' . |
|
441 | + ' </li>' . |
|
442 | + ' <li>' . bts('Select and Copy the string between <authenticator> and </authenticator> (%auth in the above example).', array('%auth' => '8b8496fdd26df7dc0423ecd43c09a56b')) . '</li>' . |
|
443 | + ' <li>' . bts('Paste the string into the field below, and click OK.') . '</li>' . |
|
444 | + ' <li>' . bts('You will now be logged in to your account; update the email and password of your account.') . '</li>' . |
|
445 | + ' </ul>' . |
|
446 | + '</p>' |
|
447 | + ); |
|
448 | + $form['authenticator'] = array( |
|
449 | 449 | '#title' => bts('Log in with authenticator'), |
450 | 450 | '#type' => 'textfield', |
451 | 451 | '#size' => 60, |
452 | 452 | '#maxlength' => 32, |
453 | 453 | '#required' => TRUE, |
454 | 454 | '#description' => null |
455 | - ); |
|
455 | + ); |
|
456 | 456 | |
457 | - // Form control |
|
458 | - $form['form control tabs prefix'] = array( |
|
457 | + // Form control |
|
458 | + $form['form control tabs prefix'] = array( |
|
459 | 459 | '#value' => '<ul class="form-control tab-list">', |
460 | 460 | '#weight' => 1001, |
461 | - ); |
|
462 | - $form['submit'] = array( |
|
461 | + ); |
|
462 | + $form['submit'] = array( |
|
463 | 463 | '#prefix' => '<li class="first tab">', |
464 | 464 | '#type' => 'submit', |
465 | 465 | '#value' => bts('OK'), |
466 | 466 | '#suffix' => '</li>', |
467 | 467 | '#weight' => 1002, |
468 | - ); |
|
469 | - $form['form control tabs'] = array( |
|
468 | + ); |
|
469 | + $form['form control tabs'] = array( |
|
470 | 470 | '#value' => '<li class="tab">' . l(bts('Cancel'), 'user/password') . '</li>', |
471 | 471 | '#weight' => 1003, |
472 | - ); |
|
473 | - $form['form control tabs suffix'] = array( |
|
472 | + ); |
|
473 | + $form['form control tabs suffix'] = array( |
|
474 | 474 | '#value' => '</ul>', |
475 | 475 | '#weight' => 1004, |
476 | - ); |
|
477 | - return $form; |
|
476 | + ); |
|
477 | + return $form; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
481 | 481 | * The authenticator login validation handler |
482 | 482 | */ |
483 | 483 | function boincuser_authloginform_validate($form, &$form_state) { |
484 | - $authenticator = $form_state['values']['authenticator']; |
|
485 | - if (strlen($authenticator) != 32) { |
|
484 | + $authenticator = $form_state['values']['authenticator']; |
|
485 | + if (strlen($authenticator) != 32) { |
|
486 | 486 | // We notify the form API that this field has failed validation. |
487 | 487 | form_set_error('authenticator', bts('That authenticator is not valid.')); |
488 | - } else { |
|
488 | + } else { |
|
489 | 489 | require_boinc('boinc_db'); |
490 | 490 | $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
491 | 491 | if (!$boinc_user) form_set_error('authenticator', bts('There is no account with that authenticator.')); |
492 | - } |
|
492 | + } |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
496 | 496 | * The authenticator login submit handler |
497 | 497 | */ |
498 | 498 | function boincuser_authloginform_submit($form, &$form_state) { |
499 | - global $user; |
|
500 | - $authenticator = $form_state['values']['authenticator']; |
|
501 | - require_boinc('boinc_db'); |
|
502 | - $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
|
503 | - if (!$user = user_load(get_drupal_id($boinc_user->id))) drupal_set_message(t('An unresolved error occurred while logging into this account.')); |
|
504 | - else $form_state['redirect'] = 'account/info/edit'; |
|
499 | + global $user; |
|
500 | + $authenticator = $form_state['values']['authenticator']; |
|
501 | + require_boinc('boinc_db'); |
|
502 | + $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
|
503 | + if (!$user = user_load(get_drupal_id($boinc_user->id))) drupal_set_message(t('An unresolved error occurred while logging into this account.')); |
|
504 | + else $form_state['redirect'] = 'account/info/edit'; |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | |
@@ -509,44 +509,44 @@ discard block |
||
509 | 509 | * The definition of the moderator reject user profile form. |
510 | 510 | */ |
511 | 511 | function boincuser_moderate_profile_reject_form(&$form_state, $uid) { |
512 | - $form_state['storage']['reject_profile_uid'] = $uid; |
|
513 | - $form['reason'] = array( |
|
512 | + $form_state['storage']['reject_profile_uid'] = $uid; |
|
513 | + $form['reason'] = array( |
|
514 | 514 | '#title' => bts('Reason for rejecting this profile'), |
515 | 515 | '#type' => 'textarea', |
516 | 516 | '#description' => bts('This reason will be included in an email to the user. Please write a brief explanation of the problem and how to fix it.'), |
517 | 517 | '#default_value' => '', |
518 | - ); |
|
518 | + ); |
|
519 | 519 | |
520 | - // Form control |
|
521 | - $form['form control tabs prefix'] = array( |
|
520 | + // Form control |
|
521 | + $form['form control tabs prefix'] = array( |
|
522 | 522 | '#value' => '<ul class="form-control tab-list">', |
523 | 523 | '#weight' => 1001, |
524 | - ); |
|
525 | - $form['submit'] = array( |
|
524 | + ); |
|
525 | + $form['submit'] = array( |
|
526 | 526 | '#prefix' => '<li class="first tab">', |
527 | 527 | '#type' => 'submit', |
528 | 528 | '#value' => bts('Submit'), |
529 | 529 | '#suffix' => '</li>', |
530 | 530 | '#weight' => 1002, |
531 | - ); |
|
532 | - $form['form control tabs'] = array( |
|
531 | + ); |
|
532 | + $form['form control tabs'] = array( |
|
533 | 533 | '#value' => '<li class="tab">' . l(bts('Cancel'), "account/{$uid}") . '</li>', |
534 | 534 | '#weight' => 1003, |
535 | - ); |
|
536 | - $form['form control tabs suffix'] = array( |
|
535 | + ); |
|
536 | + $form['form control tabs suffix'] = array( |
|
537 | 537 | '#value' => '</ul>', |
538 | 538 | '#weight' => 1004, |
539 | - ); |
|
540 | - return $form; |
|
539 | + ); |
|
540 | + return $form; |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
544 | 544 | * The moderator reject user profile submit handler |
545 | 545 | */ |
546 | 546 | function boincuser_moderate_profile_reject_form_submit($form, &$form_state) { |
547 | - $uid = $form_state['storage']['reject_profile_uid']; |
|
548 | - $reason = $form_state['values']['reason']; |
|
549 | - boincuser_moderate_profile_reject($uid, $reason); |
|
547 | + $uid = $form_state['storage']['reject_profile_uid']; |
|
548 | + $reason = $form_state['values']['reason']; |
|
549 | + boincuser_moderate_profile_reject($uid, $reason); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | |
@@ -554,52 +554,52 @@ discard block |
||
554 | 554 | * The definition of the ban user form. |
555 | 555 | */ |
556 | 556 | function boincuser_moderate_user_ban_form(&$form_state, $uid) { |
557 | - $form_state['storage']['ban_user_uid'] = $uid; |
|
558 | - $form['reason'] = array( |
|
557 | + $form_state['storage']['ban_user_uid'] = $uid; |
|
558 | + $form['reason'] = array( |
|
559 | 559 | '#title' => bts('Reason for banning this user'), |
560 | 560 | '#type' => 'textarea', |
561 | 561 | '#description' => bts('This reason will be included in an email to the user. Please write a brief explanation of why the user is being banned.'), |
562 | 562 | '#default_value' => '', |
563 | - ); |
|
564 | - $form['duration'] = array( |
|
563 | + ); |
|
564 | + $form['duration'] = array( |
|
565 | 565 | '#title' => bts('Duration of the ban'), |
566 | 566 | '#type' => 'textfield', |
567 | 567 | '#description' => bts('The number of days until the ban expires. Set to 0 to ban permanently.'), |
568 | 568 | '#default_value' => '', |
569 | - ); |
|
569 | + ); |
|
570 | 570 | |
571 | - // Form control |
|
572 | - $form['form control tabs prefix'] = array( |
|
571 | + // Form control |
|
572 | + $form['form control tabs prefix'] = array( |
|
573 | 573 | '#value' => '<ul class="form-control tab-list">', |
574 | 574 | '#weight' => 1001, |
575 | - ); |
|
576 | - $form['submit'] = array( |
|
575 | + ); |
|
576 | + $form['submit'] = array( |
|
577 | 577 | '#prefix' => '<li class="first tab">', |
578 | 578 | '#type' => 'submit', |
579 | 579 | '#value' => bts('Submit'), |
580 | 580 | '#suffix' => '</li>', |
581 | 581 | '#weight' => 1002, |
582 | - ); |
|
583 | - $form['form control tabs'] = array( |
|
582 | + ); |
|
583 | + $form['form control tabs'] = array( |
|
584 | 584 | '#value' => '<li class="tab">' . l(bts('Cancel'), "account/{$uid}") . '</li>', |
585 | 585 | '#weight' => 1003, |
586 | - ); |
|
587 | - $form['form control tabs suffix'] = array( |
|
586 | + ); |
|
587 | + $form['form control tabs suffix'] = array( |
|
588 | 588 | '#value' => '</ul>', |
589 | 589 | '#weight' => 1004, |
590 | - ); |
|
591 | - return $form; |
|
590 | + ); |
|
591 | + return $form; |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
595 | 595 | * The ban user submit handler |
596 | 596 | */ |
597 | 597 | function boincuser_moderate_user_ban_form_submit($form, &$form_state) { |
598 | - $uid = $form_state['storage']['ban_user_uid']; |
|
599 | - $reason = $form_state['values']['reason']; |
|
600 | - $duration = $form_state['values']['duration']; |
|
601 | - if ($duration) $duration = $duration * 24*60*60; |
|
602 | - boincuser_moderate_user_ban($uid, $reason, $duration); |
|
598 | + $uid = $form_state['storage']['ban_user_uid']; |
|
599 | + $reason = $form_state['values']['reason']; |
|
600 | + $duration = $form_state['values']['duration']; |
|
601 | + if ($duration) $duration = $duration * 24*60*60; |
|
602 | + boincuser_moderate_user_ban($uid, $reason, $duration); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | * Hack to fix submission of the flag friend unfriend form |
608 | 608 | */ |
609 | 609 | function boincuser_fix_unfriend_form_submit($form, &$form_state) { |
610 | - // Leaving action as "unfriend" causes problems |
|
611 | - if ($form_state['values']['action'] == 'unfriend') { |
|
610 | + // Leaving action as "unfriend" causes problems |
|
611 | + if ($form_state['values']['action'] == 'unfriend') { |
|
612 | 612 | $form_state['values']['action'] = 'unflag'; |
613 | - } |
|
613 | + } |
|
614 | 614 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | // Call our custom authentication function to check for an existing BOINC user |
36 | 36 | if (!boincuser_login_authenticate($form_state['values'])) { |
37 | 37 | // Authentication failed; set an error accordingly |
38 | - form_set_error('name', bts('Sorry, unrecognized email address or password.') . ' ' . l(bts('Have you forgotten your password?'), 'user/password')); |
|
38 | + form_set_error('name', bts('Sorry, unrecognized email address or password.').' '.l(bts('Have you forgotten your password?'), 'user/password')); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } else { |
80 | 80 | // Create a Drupal user from the BOINC user |
81 | 81 | if ($user = boincuser_register_make_drupal_user($boinc_user)) { |
82 | - watchdog('user', 'New external user: %email using module %module.', array('%email' => $email_addr, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit')); |
|
82 | + watchdog('user', 'New external user: %email using module %module.', array('%email' => $email_addr, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'.$user->uid.'/edit')); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | unset($_SESSION['reset_pass']); |
362 | 362 | } |
363 | 363 | else { |
364 | - $given_hash = md5($edit['current_pass'] . $account->mail); |
|
364 | + $given_hash = md5($edit['current_pass'].$account->mail); |
|
365 | 365 | if (!$edit['current_pass']) { |
366 | 366 | form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.')); |
367 | 367 | } |
@@ -420,29 +420,29 @@ discard block |
||
420 | 420 | $project_domain = $headers['Host']; |
421 | 421 | $form['heading'] = array( |
422 | 422 | '#type' => 'markup', |
423 | - '#value' => '<h3>' . bts("If you forgot your account's email address, or you can't receive email there:") . '</h3>' |
|
423 | + '#value' => '<h3>'.bts("If you forgot your account's email address, or you can't receive email there:").'</h3>' |
|
424 | 424 | ); |
425 | 425 | $form['instructions'] = array( |
426 | 426 | '#type' => 'markup', |
427 | - '#value' => '' . |
|
428 | - '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:") . |
|
429 | - ' <ul>' . |
|
430 | - ' <li>' . bts('Go to the BOINC data directory on your computer (see !boinc_wiki for help finding this).', array('!boinc_wiki' => l(bts('BOINC documentation'), 'http://boinc.berkeley.edu/wiki/BOINC_Data_directory'))) . '</li>' . |
|
431 | - ' <li>' . bts('Find your account file for this project; it will have a name like %file (where the project URL is %url).', array('%file' => "account_{$project_domain}.xml", '%url' => "http://{$project_domain}")) . '</li>' . |
|
432 | - ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:") . |
|
433 | - ' <pre>' . |
|
434 | - '<account>' . "\n" . |
|
435 | - " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
|
436 | - ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>' . "\n" . |
|
437 | - " <project_name>{$project_name}</project_name>" . "\n" . |
|
438 | - ' ...' . "\n" . |
|
439 | - '</account>' . |
|
440 | - ' </pre>' . |
|
441 | - ' </li>' . |
|
442 | - ' <li>' . bts('Select and Copy the string between <authenticator> and </authenticator> (%auth in the above example).', array('%auth' => '8b8496fdd26df7dc0423ecd43c09a56b')) . '</li>' . |
|
443 | - ' <li>' . bts('Paste the string into the field below, and click OK.') . '</li>' . |
|
444 | - ' <li>' . bts('You will now be logged in to your account; update the email and password of your account.') . '</li>' . |
|
445 | - ' </ul>' . |
|
427 | + '#value' => ''. |
|
428 | + '<p>'.bts("If you have run BOINC under the account, you can still access it. Here's how:"). |
|
429 | + ' <ul>'. |
|
430 | + ' <li>'.bts('Go to the BOINC data directory on your computer (see !boinc_wiki for help finding this).', array('!boinc_wiki' => l(bts('BOINC documentation'), 'http://boinc.berkeley.edu/wiki/BOINC_Data_directory'))).'</li>'. |
|
431 | + ' <li>'.bts('Find your account file for this project; it will have a name like %file (where the project URL is %url).', array('%file' => "account_{$project_domain}.xml", '%url' => "http://{$project_domain}")).'</li>'. |
|
432 | + ' <li>'.bts("Open the file in a text editor like Notepad. You'll see something like:"). |
|
433 | + ' <pre>'. |
|
434 | + '<account>'."\n". |
|
435 | + " <master_url>http://{$project_domain}/</master_url>"."\n". |
|
436 | + ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>'."\n". |
|
437 | + " <project_name>{$project_name}</project_name>"."\n". |
|
438 | + ' ...'."\n". |
|
439 | + '</account>'. |
|
440 | + ' </pre>'. |
|
441 | + ' </li>'. |
|
442 | + ' <li>'.bts('Select and Copy the string between <authenticator> and </authenticator> (%auth in the above example).', array('%auth' => '8b8496fdd26df7dc0423ecd43c09a56b')).'</li>'. |
|
443 | + ' <li>'.bts('Paste the string into the field below, and click OK.').'</li>'. |
|
444 | + ' <li>'.bts('You will now be logged in to your account; update the email and password of your account.').'</li>'. |
|
445 | + ' </ul>'. |
|
446 | 446 | '</p>' |
447 | 447 | ); |
448 | 448 | $form['authenticator'] = array( |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | '#weight' => 1002, |
468 | 468 | ); |
469 | 469 | $form['form control tabs'] = array( |
470 | - '#value' => '<li class="tab">' . l(bts('Cancel'), 'user/password') . '</li>', |
|
470 | + '#value' => '<li class="tab">'.l(bts('Cancel'), 'user/password').'</li>', |
|
471 | 471 | '#weight' => 1003, |
472 | 472 | ); |
473 | 473 | $form['form control tabs suffix'] = array( |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | '#weight' => 1002, |
531 | 531 | ); |
532 | 532 | $form['form control tabs'] = array( |
533 | - '#value' => '<li class="tab">' . l(bts('Cancel'), "account/{$uid}") . '</li>', |
|
533 | + '#value' => '<li class="tab">'.l(bts('Cancel'), "account/{$uid}").'</li>', |
|
534 | 534 | '#weight' => 1003, |
535 | 535 | ); |
536 | 536 | $form['form control tabs suffix'] = array( |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | '#weight' => 1002, |
582 | 582 | ); |
583 | 583 | $form['form control tabs'] = array( |
584 | - '#value' => '<li class="tab">' . l(bts('Cancel'), "account/{$uid}") . '</li>', |
|
584 | + '#value' => '<li class="tab">'.l(bts('Cancel'), "account/{$uid}").'</li>', |
|
585 | 585 | '#weight' => 1003, |
586 | 586 | ); |
587 | 587 | $form['form control tabs suffix'] = array( |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | $uid = $form_state['storage']['ban_user_uid']; |
599 | 599 | $reason = $form_state['values']['reason']; |
600 | 600 | $duration = $form_state['values']['duration']; |
601 | - if ($duration) $duration = $duration * 24*60*60; |
|
601 | + if ($duration) $duration = $duration*24*60*60; |
|
602 | 602 | boincuser_moderate_user_ban($uid, $reason, $duration); |
603 | 603 | } |
604 | 604 |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * New user registration validation handler. |
94 | 94 | */ |
95 | -function boincuser_register_validate($form_values) { |
|
95 | +function boincuser_register_validate($form_values) { |
|
96 | 96 | // Include BOINC database objects library |
97 | 97 | require_boinc('boinc_db'); |
98 | 98 | // Check for an existing BOINC user |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Create BOINC account |
106 | 106 | */ |
107 | -function boincuser_register_make_user($params) { |
|
107 | +function boincuser_register_make_user($params) { |
|
108 | 108 | // Include BOINC user library |
109 | 109 | require_boinc('user'); |
110 | 110 | // Create the BOINC user |
@@ -302,8 +302,7 @@ discard block |
||
302 | 302 | if (!$account) { |
303 | 303 | global $user; |
304 | 304 | $account = user_load($user->id); |
305 | - } |
|
306 | - elseif (is_numeric($account)) { |
|
305 | + } elseif (is_numeric($account)) { |
|
307 | 306 | $account = user_load($account); |
308 | 307 | } |
309 | 308 | |
@@ -359,13 +358,11 @@ discard block |
||
359 | 358 | // (except in cases where password is being reset) |
360 | 359 | if (isset($_SESSION['reset_pass'])) { |
361 | 360 | unset($_SESSION['reset_pass']); |
362 | - } |
|
363 | - else { |
|
361 | + } else { |
|
364 | 362 | $given_hash = md5($edit['current_pass'] . $account->mail); |
365 | 363 | if (!$edit['current_pass']) { |
366 | 364 | form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.')); |
367 | - } |
|
368 | - elseif ($given_hash != $boinc_user->passwd_hash) { |
|
365 | + } elseif ($given_hash != $boinc_user->passwd_hash) { |
|
369 | 366 | form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.')); |
370 | 367 | } |
371 | 368 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | function boincuser_create_drupal_user($boinc_user) { |
133 | 133 | require_boinc('forum_db'); |
134 | 134 | BoincForumPrefs::lookup($boinc_user); |
135 | - $account = NULL; |
|
135 | + $account = null; |
|
136 | 136 | $module = 'boincuser'; |
137 | 137 | |
138 | 138 | // Verify that this account has not already been imported |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $boinc_user->id) |
142 | 142 | ); |
143 | 143 | if ($already_imported) { |
144 | - return NULL; |
|
144 | + return null; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | // Email is limited to 64 characters... |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | if ($already_imported) { |
156 | 156 | drupal_set_message(t('An account for @email already exists', array('@email' => $boinc_email)), 'warning'); |
157 | 157 | watchdog('boincimport', 'An account for @email already exists', array('@email' => $boinc_email), WATCHDOG_WARNING); |
158 | - return NULL; |
|
158 | + return null; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | // Make sure name is unique |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Terminate if an error occured during user_save(). |
194 | 194 | if (!$account) { |
195 | 195 | drupal_set_message(t("Error saving user account."), 'error'); |
196 | - return NULL; |
|
196 | + return null; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | // Cross reference the Drupal and BOINC accounts |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $profile_opinions = null; |
225 | 225 | $profile_image = null; |
226 | 226 | $avatar_image = null; |
227 | - $profile_approved = NULL; |
|
227 | + $profile_approved = null; |
|
228 | 228 | |
229 | 229 | // Load the BOINC profile, if available |
230 | 230 | if ($boinc_user->has_profile) { |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | if ($boinc_profile->has_picture) { |
235 | 235 | // Load picture; load validators; determine where to store it in Drupal |
236 | 236 | $image_path = "{$image_dir}/{$boinc_user->id}.jpg"; |
237 | - $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', TRUE); |
|
237 | + $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', true); |
|
238 | 238 | // If the user does not have a different image as an avatar, use this one |
239 | 239 | if (!$boinc_user->prefs->avatar) { |
240 | - $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
240 | + $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', true); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | if ($boinc_user->prefs->avatar) { |
244 | 244 | $image_path = "{$image_dir}/{$boinc_user->id}_avatar.jpg"; |
245 | - $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
245 | + $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', true); |
|
246 | 246 | } |
247 | - $profile_approved = $boinc_profile->verification ? TRUE : FALSE; |
|
247 | + $profile_approved = $boinc_profile->verification ? true : false; |
|
248 | 248 | } |
249 | 249 | $default_input_format = db_result(db_query(" |
250 | 250 | SELECT format FROM {filter_formats} WHERE name = '%s'", 'Rich text')); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | node_save($profile_node); |
278 | 278 | |
279 | 279 | // Mark profile as approved if it has already been vetted somehow |
280 | - if ($profile_approved OR !$boinc_user->has_profile) { |
|
280 | + if ($profile_approved or !$boinc_user->has_profile) { |
|
281 | 281 | $profile_node->moderate = 0; |
282 | 282 | node_save($profile_node); |
283 | 283 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * Convert any BOINC forum thread subscriptions to Drupal flag subscriptions |
300 | 300 | */ |
301 | -function boincuser_pull_subscriptions($account = NULL) { |
|
301 | +function boincuser_pull_subscriptions($account = null) { |
|
302 | 302 | if (!$account) { |
303 | 303 | global $user; |
304 | 304 | $account = user_load($user->id); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | // Include BOINC database objects library, load BOINC account data |
343 | 343 | require_boinc('boinc_db'); |
344 | 344 | $boinc_user = BoincUser::lookup_email_addr($account->mail); |
345 | - $changing_email = ($edit['mail'] AND $edit['mail'] != $account->mail) ? true : false; |
|
345 | + $changing_email = ($edit['mail'] and $edit['mail'] != $account->mail) ? true : false; |
|
346 | 346 | $changing_pass = ($edit['pass']) ? true : false; |
347 | 347 | if ($changing_email) { |
348 | 348 | // E-mail address is set to change; check for an existing BOINC user |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | // If user is changing email or password, require that the current |
356 | 356 | // password has been given as well. |
357 | - if (($changing_email OR $changing_pass) AND !user_access('administer users')) { |
|
357 | + if (($changing_email or $changing_pass) and !user_access('administer users')) { |
|
358 | 358 | // If changing email or password, require current password |
359 | 359 | // (except in cases where password is being reset) |
360 | 360 | if (isset($_SESSION['reset_pass'])) { |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | |
374 | 374 | // If an admin tries to change the email and NOT the password, show |
375 | 375 | // error message. BOINC requires both to be changed together. |
376 | - if ($changing_email AND !$changing_pass AND user_access('administer users')) { |
|
376 | + if ($changing_email and !$changing_pass and user_access('administer users')) { |
|
377 | 377 | form_set_error('pass', bts('If changing a user\'s email, you must also change the password simultaneously.')); |
378 | 378 | } |
379 | 379 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | '#type' => 'textfield', |
451 | 451 | '#size' => 60, |
452 | 452 | '#maxlength' => 32, |
453 | - '#required' => TRUE, |
|
453 | + '#required' => true, |
|
454 | 454 | '#description' => null |
455 | 455 | ); |
456 | 456 |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | }*/ |
29 | 29 | |
30 | 30 | /** |
31 | - * The BOINC environment form allows paths to be set to connect Drupal to an |
|
32 | - * existing BOINC web interface. |
|
33 | - */ |
|
31 | + * The BOINC environment form allows paths to be set to connect Drupal to an |
|
32 | + * existing BOINC web interface. |
|
33 | + */ |
|
34 | 34 | function boincuser_admin_environment(&$form_state) { |
35 | - global $base_url; |
|
36 | - $form = array(); |
|
37 | - $default = array( |
|
35 | + global $base_url; |
|
36 | + $form = array(); |
|
37 | + $default = array( |
|
38 | 38 | 'boinc_root_dir' => variable_get('boinc_root_dir', ''), |
39 | 39 | 'boinc_config_xml_dir' => variable_get('boinc_config_xml_dir', ''), |
40 | 40 | 'boinc_html_inc_dir' => variable_get('boinc_html_inc_dir', ''), |
@@ -44,306 +44,306 @@ discard block |
||
44 | 44 | 'boinc_server_status_url' => variable_get('boinc_server_status_url', ''), |
45 | 45 | 'boinc_app_list_url' => variable_get('boinc_app_list_url', ''), |
46 | 46 | 'boinc_debug_mode' => variable_get('boinc_debug_mode', 0), |
47 | - ); |
|
48 | - //drupal_set_message(print_r($default, true)); |
|
49 | - //drupal_set_message(print_r($form_state, true)); |
|
50 | - // Show overrides if the root dir is set and others have not been detected |
|
51 | - $show_overrides = FALSE; |
|
52 | - if ($default['boinc_root_dir']) { |
|
47 | + ); |
|
48 | + //drupal_set_message(print_r($default, true)); |
|
49 | + //drupal_set_message(print_r($form_state, true)); |
|
50 | + // Show overrides if the root dir is set and others have not been detected |
|
51 | + $show_overrides = FALSE; |
|
52 | + if ($default['boinc_root_dir']) { |
|
53 | 53 | foreach ($default as $key => $dir) { |
54 | - switch ($key) { |
|
55 | - case 'boinc_config_xml_dir': |
|
54 | + switch ($key) { |
|
55 | + case 'boinc_config_xml_dir': |
|
56 | 56 | case 'boinc_html_inc_dir': |
57 | 57 | case 'boinc_project_config_dir': |
58 | 58 | case 'boinc_user_image_dir': |
59 | 59 | // If any of these values are not set, show the overrides section |
60 | 60 | if (!$dir) { |
61 | - $default[$key] = $form_state['values'][$key]; |
|
62 | - $show_overrides = TRUE; |
|
63 | - break; |
|
61 | + $default[$key] = $form_state['values'][$key]; |
|
62 | + $show_overrides = TRUE; |
|
63 | + break; |
|
64 | 64 | } |
65 | 65 | break; |
66 | - default: |
|
66 | + default: |
|
67 | 67 | } |
68 | - if ($show_overrides) { |
|
68 | + if ($show_overrides) { |
|
69 | 69 | break; |
70 | - } |
|
70 | + } |
|
71 | 71 | } |
72 | - } |
|
73 | - // Define the form |
|
74 | - $form['boinc_root_dir'] = array( |
|
72 | + } |
|
73 | + // Define the form |
|
74 | + $form['boinc_root_dir'] = array( |
|
75 | 75 | '#type' => 'textfield', |
76 | 76 | '#title' => t('BOINC project root directory'), |
77 | 77 | '#default_value' => $default['boinc_root_dir'], |
78 | 78 | '#description' => t('The filesystem path to the BOINC project root. This |
79 | 79 | directory should contain config.xml as well as the html subdirectory, |
80 | 80 | which itself contains inc/, project/, and user_profile/.'), |
81 | - ); |
|
82 | - $form['overrides'] = array( |
|
81 | + ); |
|
82 | + $form['overrides'] = array( |
|
83 | 83 | '#title' => t('Overrides'), |
84 | 84 | '#type' => 'fieldset', |
85 | 85 | '#description' => '', |
86 | 86 | '#collapsible' => TRUE, |
87 | 87 | '#collapsed' => !$show_overrides, |
88 | 88 | '#attributes' => array('class' => 'advanced-settings') |
89 | - ); |
|
90 | - $form['overrides']['boinc_config_xml_dir'] = array( |
|
89 | + ); |
|
90 | + $form['overrides']['boinc_config_xml_dir'] = array( |
|
91 | 91 | '#type' => 'textfield', |
92 | 92 | '#title' => t('BOINC config.xml directory'), |
93 | 93 | '#default_value' => $default['boinc_config_xml_dir'], |
94 | 94 | '#description' => t('The filesystem path that contains config.xml'), |
95 | - ); |
|
96 | - $form['overrides']['boinc_html_inc_dir'] = array( |
|
95 | + ); |
|
96 | + $form['overrides']['boinc_html_inc_dir'] = array( |
|
97 | 97 | '#type' => 'textfield', |
98 | 98 | '#title' => t('BOINC web includes directory'), |
99 | 99 | '#default_value' => $default['boinc_html_inc_dir'], |
100 | 100 | '#description' => t('The filesystem path to the html/inc/ directory that |
101 | 101 | contains util.inc'), |
102 | - ); |
|
103 | - $form['overrides']['boinc_project_config_dir'] = array( |
|
102 | + ); |
|
103 | + $form['overrides']['boinc_project_config_dir'] = array( |
|
104 | 104 | '#type' => 'textfield', |
105 | 105 | '#title' => t('BOINC project config directory'), |
106 | 106 | '#default_value' => $default['boinc_project_config_dir'], |
107 | 107 | '#description' => t('The filesystem path to the project/ directory that |
108 | 108 | contains project.inc'), |
109 | - ); |
|
110 | - $form['overrides']['boinc_user_image_dir'] = array( |
|
109 | + ); |
|
110 | + $form['overrides']['boinc_user_image_dir'] = array( |
|
111 | 111 | '#type' => 'textfield', |
112 | 112 | '#title' => t('BOINC user profile image directory'), |
113 | 113 | '#default_value' => $default['boinc_user_image_dir'], |
114 | 114 | '#description' => t('The filesystem directory that contains user images'), |
115 | - ); |
|
116 | - $form['boinc_server_status_url'] = array( |
|
115 | + ); |
|
116 | + $form['boinc_server_status_url'] = array( |
|
117 | 117 | '#type' => 'textfield', |
118 | 118 | '#title' => t('BOINC server status page URL (optional)'), |
119 | 119 | '#default_value' => $default['boinc_server_status_url'], |
120 | 120 | '#description' => t('An absolute URL or path relative to the site base to the server status page (e.g. %full_url or just %relative_url).', |
121 | - array( |
|
121 | + array( |
|
122 | 122 | '%full_url' => $base_url . '/server_status.php', |
123 | 123 | '%relative_url' => 'server_status.php', |
124 | - ) |
|
124 | + ) |
|
125 | 125 | ), |
126 | - ); |
|
127 | - $form['boinc_app_list_url'] = array( |
|
126 | + ); |
|
127 | + $form['boinc_app_list_url'] = array( |
|
128 | 128 | '#type' => 'textfield', |
129 | 129 | '#title' => t('BOINC applications page URL (optional)'), |
130 | 130 | '#default_value' => $default['boinc_app_list_url'], |
131 | 131 | '#description' => t('An absolute URL or path relative to the site base to the applications page (e.g. %full_url or just %relative_url).', |
132 | - array( |
|
132 | + array( |
|
133 | 133 | '%full_url' => $base_url . '/apps.php', |
134 | 134 | '%relative_url' => 'apps.php', |
135 | - ) |
|
135 | + ) |
|
136 | 136 | ), |
137 | - ); |
|
138 | - $form['boinc_host_sched_logs_dir'] = array( |
|
137 | + ); |
|
138 | + $form['boinc_host_sched_logs_dir'] = array( |
|
139 | 139 | '#type' => 'textfield', |
140 | 140 | '#title' => t('BOINC host scheduler log directory (optional)'), |
141 | 141 | '#default_value' => $default['boinc_host_sched_logs_dir'], |
142 | 142 | '#description' => t('The filesystem directory that contains host scheduler logs'), |
143 | - ); |
|
144 | - $form['boinc_debug_mode'] = array( |
|
143 | + ); |
|
144 | + $form['boinc_debug_mode'] = array( |
|
145 | 145 | '#type' => 'checkbox', |
146 | 146 | '#title' => t('Show debug messages in system log'), |
147 | 147 | '#default_value' => $default['boinc_debug_mode'] |
148 | - ); |
|
149 | - return system_settings_form($form); |
|
148 | + ); |
|
149 | + return system_settings_form($form); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
153 | - * Validate the BOINC environment form. |
|
154 | - */ |
|
153 | + * Validate the BOINC environment form. |
|
154 | + */ |
|
155 | 155 | function boincuser_admin_environment_validate($form, &$form_state) { |
156 | - $values = $form_state['values']; |
|
157 | - if (!$values['boinc_root_dir']) { |
|
156 | + $values = $form_state['values']; |
|
157 | + if (!$values['boinc_root_dir']) { |
|
158 | 158 | form_set_error('boinc_root_dir', t('BOINC project root directory must be |
159 | 159 | defined!')); |
160 | - } |
|
161 | - elseif (!is_dir($values['boinc_root_dir'])) { |
|
160 | + } |
|
161 | + elseif (!is_dir($values['boinc_root_dir'])) { |
|
162 | 162 | form_set_error('boinc_root_dir', t('BOINC project root not found at %directory', |
163 | - array('%directory' => $values['boinc_root_dir']) |
|
163 | + array('%directory' => $values['boinc_root_dir']) |
|
164 | 164 | )); |
165 | - } |
|
166 | - else { |
|
165 | + } |
|
166 | + else { |
|
167 | 167 | // By default, try to automatically set specific directories from the root |
168 | 168 | if (!$values['boinc_config_xml_dir']) { |
169 | - $values['boinc_config_xml_dir'] = $values['boinc_root_dir']; |
|
170 | - form_set_value($form['overrides']['boinc_config_xml_dir'], $values['boinc_config_xml_dir'], $form_state); |
|
169 | + $values['boinc_config_xml_dir'] = $values['boinc_root_dir']; |
|
170 | + form_set_value($form['overrides']['boinc_config_xml_dir'], $values['boinc_config_xml_dir'], $form_state); |
|
171 | 171 | } |
172 | 172 | if (!$values['boinc_html_inc_dir']) { |
173 | - $values['boinc_html_inc_dir'] = "{$values['boinc_root_dir']}/html/inc"; |
|
174 | - form_set_value($form['overrides']['boinc_html_inc_dir'], $values['boinc_html_inc_dir'], $form_state); |
|
173 | + $values['boinc_html_inc_dir'] = "{$values['boinc_root_dir']}/html/inc"; |
|
174 | + form_set_value($form['overrides']['boinc_html_inc_dir'], $values['boinc_html_inc_dir'], $form_state); |
|
175 | 175 | } |
176 | 176 | if (!$values['boinc_project_config_dir']) { |
177 | - $values['boinc_project_config_dir'] = "{$values['boinc_root_dir']}/html/project"; |
|
178 | - form_set_value($form['overrides']['boinc_project_config_dir'], $values['boinc_project_config_dir'], $form_state); |
|
177 | + $values['boinc_project_config_dir'] = "{$values['boinc_root_dir']}/html/project"; |
|
178 | + form_set_value($form['overrides']['boinc_project_config_dir'], $values['boinc_project_config_dir'], $form_state); |
|
179 | 179 | } |
180 | 180 | if (!$values['boinc_user_image_dir']) { |
181 | - $values['boinc_user_image_dir'] = "{$values['boinc_root_dir']}/html/user_profile/images"; |
|
182 | - form_set_value($form['overrides']['boinc_user_image_dir'], $values['boinc_user_image_dir'], $form_state); |
|
181 | + $values['boinc_user_image_dir'] = "{$values['boinc_root_dir']}/html/user_profile/images"; |
|
182 | + form_set_value($form['overrides']['boinc_user_image_dir'], $values['boinc_user_image_dir'], $form_state); |
|
183 | 183 | } |
184 | 184 | // Validate that required BOINC content is found |
185 | 185 | if (!is_readable("{$values['boinc_config_xml_dir']}/config.xml")) { |
186 | - form_set_error('boinc_config_xml_dir', t('@file not found in %directory', |
|
186 | + form_set_error('boinc_config_xml_dir', t('@file not found in %directory', |
|
187 | 187 | array( |
188 | - '@file' => 'config.xml', |
|
189 | - '%directory' => "{$values['boinc_config_xml_dir']}/" |
|
188 | + '@file' => 'config.xml', |
|
189 | + '%directory' => "{$values['boinc_config_xml_dir']}/" |
|
190 | 190 | ) |
191 | - )); |
|
191 | + )); |
|
192 | 192 | } |
193 | 193 | if (!is_readable("{$values['boinc_html_inc_dir']}/util.inc")) { |
194 | - form_set_error('boinc_html_inc_dir', t('@file not found in %directory', |
|
194 | + form_set_error('boinc_html_inc_dir', t('@file not found in %directory', |
|
195 | 195 | array( |
196 | - '@file' => 'util.inc', |
|
197 | - '%directory' => "{$values['boinc_html_inc_dir']}/" |
|
196 | + '@file' => 'util.inc', |
|
197 | + '%directory' => "{$values['boinc_html_inc_dir']}/" |
|
198 | 198 | ) |
199 | - )); |
|
199 | + )); |
|
200 | 200 | } |
201 | 201 | if (!is_readable("{$values['boinc_project_config_dir']}/project.inc")) { |
202 | - form_set_error('boinc_project_config_dir', t('@file not found in %directory', |
|
202 | + form_set_error('boinc_project_config_dir', t('@file not found in %directory', |
|
203 | 203 | array( |
204 | - '@file' => 'project.inc', |
|
205 | - '%directory' => "{$values['boinc_project_config_dir']}/" |
|
204 | + '@file' => 'project.inc', |
|
205 | + '%directory' => "{$values['boinc_project_config_dir']}/" |
|
206 | 206 | ) |
207 | - )); |
|
207 | + )); |
|
208 | 208 | } |
209 | 209 | if (!is_dir($values['boinc_user_image_dir'])) { |
210 | - form_set_error('boinc_user_image_dir', t('Profile image directory not found |
|
210 | + form_set_error('boinc_user_image_dir', t('Profile image directory not found |
|
211 | 211 | at %directory', array('%directory' => $values['boinc_user_image_dir']) |
212 | - )); |
|
212 | + )); |
|
213 | 213 | } |
214 | 214 | if ($values['boinc_host_sched_logs_dir'] |
215 | 215 | AND !is_dir($values['boinc_host_sched_logs_dir']) |
216 | - ) { |
|
217 | - form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
|
216 | + ) { |
|
217 | + form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
|
218 | 218 | directory not found at %directory', |
219 | 219 | array('%directory' => $values['boinc_host_sched_logs_dir']) |
220 | - )); |
|
220 | + )); |
|
221 | + } |
|
221 | 222 | } |
222 | - } |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
226 | - * Handle post-validation submission of BOINC environment form. |
|
227 | - */ |
|
226 | + * Handle post-validation submission of BOINC environment form. |
|
227 | + */ |
|
228 | 228 | function boincuser_admin_environment_submit($form, &$form_state) { |
229 | - unset($_SESSION['boinc_env']); |
|
230 | - drupal_set_message(t('BOINC environment settings have been updated.')); |
|
229 | + unset($_SESSION['boinc_env']); |
|
230 | + drupal_set_message(t('BOINC environment settings have been updated.')); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
234 | - * The BOINC scheduler form provides options for how scheduler tags are |
|
235 | - * inserted into the front page |
|
236 | - */ |
|
234 | + * The BOINC scheduler form provides options for how scheduler tags are |
|
235 | + * inserted into the front page |
|
236 | + */ |
|
237 | 237 | function boincuser_admin_scheduler(&$form_state) { |
238 | - $form = array(); |
|
239 | - $config_cgi_url = ''; |
|
240 | - if ($config_xml_dir = variable_get('boinc_config_xml_dir', '')) { |
|
238 | + $form = array(); |
|
239 | + $config_cgi_url = ''; |
|
240 | + if ($config_xml_dir = variable_get('boinc_config_xml_dir', '')) { |
|
241 | 241 | // Get the cgi_url option from the config file as the default scheduler URL |
242 | 242 | $xml = new DOMDocument(); |
243 | 243 | if ($xml->load("{$config_xml_dir}/config.xml")) { |
244 | - $config = xml_to_array($xml); |
|
245 | - if (isset($config['boinc']['config']['cgi_url']['@value'])) { |
|
244 | + $config = xml_to_array($xml); |
|
245 | + if (isset($config['boinc']['config']['cgi_url']['@value'])) { |
|
246 | 246 | $config_cgi_url = rtrim(trim($config['boinc']['config']['cgi_url']['@value']), '/'); |
247 | 247 | $config_cgi_url .= '/cgi'; |
248 | - } |
|
248 | + } |
|
249 | + } |
|
249 | 250 | } |
250 | - } |
|
251 | - $default = array( |
|
251 | + $default = array( |
|
252 | 252 | 'boinc_scheduler_urls' => variable_get('boinc_scheduler_urls', $config_cgi_url), |
253 | 253 | 'boinc_scheduler_tag_format_old' => variable_get('boinc_scheduler_tag_format_old', 1), |
254 | 254 | 'boinc_scheduler_tag_format_new' => variable_get('boinc_scheduler_tag_format_new', 1) |
255 | - ); |
|
255 | + ); |
|
256 | 256 | |
257 | - // Define the form |
|
258 | - $form['boinc_scheduler_urls'] = array( |
|
257 | + // Define the form |
|
258 | + $form['boinc_scheduler_urls'] = array( |
|
259 | 259 | '#type' => 'textarea', |
260 | 260 | '#title' => t('Scheduling server URLs'), |
261 | 261 | '#default_value' => $default['boinc_scheduler_urls'], |
262 | 262 | '#cols' => 60, |
263 | 263 | '#rows' => 5, |
264 | 264 | '#description' => t('If there are multiple URLs, please enter one per line.'), |
265 | - ); |
|
266 | - $form['boinc_scheduler_tag_format_old'] = array( |
|
265 | + ); |
|
266 | + $form['boinc_scheduler_tag_format_old'] = array( |
|
267 | 267 | '#type' => 'checkbox', |
268 | 268 | '#title' => t('Old format (@scheduler tag)', array('@scheduler' => '<scheduler>')), |
269 | 269 | '#default_value' => $default['boinc_scheduler_tag_format_old'] |
270 | - ); |
|
271 | - $form['boinc_scheduler_tag_format_new'] = array( |
|
270 | + ); |
|
271 | + $form['boinc_scheduler_tag_format_new'] = array( |
|
272 | 272 | '#type' => 'checkbox', |
273 | 273 | '#title' => t('New format (@link tag)', array('@link' => '<link>')), |
274 | 274 | '#default_value' => $default['boinc_scheduler_tag_format_new'] |
275 | - ); |
|
275 | + ); |
|
276 | 276 | |
277 | - return system_settings_form($form); |
|
277 | + return system_settings_form($form); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
281 | - * Validate the BOINC scheduler form. |
|
282 | - */ |
|
281 | + * Validate the BOINC scheduler form. |
|
282 | + */ |
|
283 | 283 | function boincuser_admin_scheduler_validate($form, &$form_state) { |
284 | - $values = $form_state['values']; |
|
285 | - if (!$values['boinc_scheduler_urls']) { |
|
284 | + $values = $form_state['values']; |
|
285 | + if (!$values['boinc_scheduler_urls']) { |
|
286 | 286 | form_set_error('boinc_scheduler_urls', t('At least one scheduling server |
287 | 287 | URL must be specified.')); |
288 | - } |
|
289 | - else { |
|
288 | + } |
|
289 | + else { |
|
290 | 290 | $urls = explode("\r\n", $values['boinc_scheduler_urls']); |
291 | 291 | foreach ($urls as $key => $url) { |
292 | - if (!$url) { |
|
292 | + if (!$url) { |
|
293 | 293 | unset($urls[$key]); |
294 | 294 | continue; |
295 | - } |
|
296 | - if (!filter_var($url, FILTER_VALIDATE_URL)) { |
|
295 | + } |
|
296 | + if (!filter_var($url, FILTER_VALIDATE_URL)) { |
|
297 | 297 | form_set_error('boinc_scheduler_urls', t('@url is not a valid URL |
298 | 298 | format.', array('@url' => $url))); |
299 | 299 | break; |
300 | - } |
|
300 | + } |
|
301 | 301 | } |
302 | 302 | $form_state['values']['boinc_scheduler_urls'] = implode("\r\n", $urls); |
303 | - } |
|
303 | + } |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
307 | - * Handle post-validation submission of BOINC scheduler form. |
|
308 | - */ |
|
307 | + * Handle post-validation submission of BOINC scheduler form. |
|
308 | + */ |
|
309 | 309 | function boincuser_admin_scheduler_submit($form, &$form_state) { |
310 | - drupal_set_message(t('BOINC scheduling server settings have been updated.')); |
|
310 | + drupal_set_message(t('BOINC scheduling server settings have been updated.')); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
314 | 314 | /** |
315 | - * Other BOINC options that don't fit elsewhere |
|
316 | - */ |
|
315 | + * Other BOINC options that don't fit elsewhere |
|
316 | + */ |
|
317 | 317 | function boincuser_admin_other(&$form_state) { |
318 | - $form = array(); |
|
318 | + $form = array(); |
|
319 | 319 | |
320 | - //form defaults |
|
321 | - $default = array( |
|
322 | - 'boinc_other_frontpage' => variable_get('boinc_other_frontpage', ''), |
|
323 | - ); |
|
320 | + //form defaults |
|
321 | + $default = array( |
|
322 | + 'boinc_other_frontpage' => variable_get('boinc_other_frontpage', ''), |
|
323 | + ); |
|
324 | 324 | |
325 | - // Define the form |
|
326 | - $form['boinc_other_frontpage'] = array ( |
|
325 | + // Define the form |
|
326 | + $form['boinc_other_frontpage'] = array ( |
|
327 | 327 | '#type' => 'textarea', |
328 | 328 | '#title' => bts('Message for site\'s Home Page'), |
329 | 329 | '#default_value' => $default['boinc_other_frontpage'], |
330 | 330 | '#cols' => 60, |
331 | 331 | '#rows' => 8, |
332 | 332 | '#description' => bts('Text to be displayed on the site\'s Home landing page.'), |
333 | - ); |
|
333 | + ); |
|
334 | 334 | |
335 | - return system_settings_form($form); |
|
335 | + return system_settings_form($form); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
339 | - * Validate BOINC other form |
|
340 | - */ |
|
339 | + * Validate BOINC other form |
|
340 | + */ |
|
341 | 341 | function boincuser_admin_other_validate($form, &$form_state) { |
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
345 | - * Submit BOINC other form |
|
346 | - */ |
|
345 | + * Submit BOINC other form |
|
346 | + */ |
|
347 | 347 | function boincuser_admin_other_submit($form, &$form_state) { |
348 | - drupal_set_message( bts("Status: BOINC other settings have been updated") ); |
|
348 | + drupal_set_message( bts("Status: BOINC other settings have been updated") ); |
|
349 | 349 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | '#default_value' => $default['boinc_server_status_url'], |
120 | 120 | '#description' => t('An absolute URL or path relative to the site base to the server status page (e.g. %full_url or just %relative_url).', |
121 | 121 | array( |
122 | - '%full_url' => $base_url . '/server_status.php', |
|
122 | + '%full_url' => $base_url.'/server_status.php', |
|
123 | 123 | '%relative_url' => 'server_status.php', |
124 | 124 | ) |
125 | 125 | ), |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | '#default_value' => $default['boinc_app_list_url'], |
131 | 131 | '#description' => t('An absolute URL or path relative to the site base to the applications page (e.g. %full_url or just %relative_url).', |
132 | 132 | array( |
133 | - '%full_url' => $base_url . '/apps.php', |
|
133 | + '%full_url' => $base_url.'/apps.php', |
|
134 | 134 | '%relative_url' => 'apps.php', |
135 | 135 | ) |
136 | 136 | ), |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | ); |
324 | 324 | |
325 | 325 | // Define the form |
326 | - $form['boinc_other_frontpage'] = array ( |
|
326 | + $form['boinc_other_frontpage'] = array( |
|
327 | 327 | '#type' => 'textarea', |
328 | 328 | '#title' => bts('Message for site\'s Home Page'), |
329 | 329 | '#default_value' => $default['boinc_other_frontpage'], |
@@ -345,5 +345,5 @@ discard block |
||
345 | 345 | * Submit BOINC other form |
346 | 346 | */ |
347 | 347 | function boincuser_admin_other_submit($form, &$form_state) { |
348 | - drupal_set_message( bts("Status: BOINC other settings have been updated") ); |
|
348 | + drupal_set_message(bts("Status: BOINC other settings have been updated")); |
|
349 | 349 | } |
@@ -157,13 +157,11 @@ discard block |
||
157 | 157 | if (!$values['boinc_root_dir']) { |
158 | 158 | form_set_error('boinc_root_dir', t('BOINC project root directory must be |
159 | 159 | defined!')); |
160 | - } |
|
161 | - elseif (!is_dir($values['boinc_root_dir'])) { |
|
160 | + } elseif (!is_dir($values['boinc_root_dir'])) { |
|
162 | 161 | form_set_error('boinc_root_dir', t('BOINC project root not found at %directory', |
163 | 162 | array('%directory' => $values['boinc_root_dir']) |
164 | 163 | )); |
165 | - } |
|
166 | - else { |
|
164 | + } else { |
|
167 | 165 | // By default, try to automatically set specific directories from the root |
168 | 166 | if (!$values['boinc_config_xml_dir']) { |
169 | 167 | $values['boinc_config_xml_dir'] = $values['boinc_root_dir']; |
@@ -285,8 +283,7 @@ discard block |
||
285 | 283 | if (!$values['boinc_scheduler_urls']) { |
286 | 284 | form_set_error('boinc_scheduler_urls', t('At least one scheduling server |
287 | 285 | URL must be specified.')); |
288 | - } |
|
289 | - else { |
|
286 | + } else { |
|
290 | 287 | $urls = explode("\r\n", $values['boinc_scheduler_urls']); |
291 | 288 | foreach ($urls as $key => $url) { |
292 | 289 | if (!$url) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | //drupal_set_message(print_r($default, true)); |
49 | 49 | //drupal_set_message(print_r($form_state, true)); |
50 | 50 | // Show overrides if the root dir is set and others have not been detected |
51 | - $show_overrides = FALSE; |
|
51 | + $show_overrides = false; |
|
52 | 52 | if ($default['boinc_root_dir']) { |
53 | 53 | foreach ($default as $key => $dir) { |
54 | 54 | switch ($key) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // If any of these values are not set, show the overrides section |
60 | 60 | if (!$dir) { |
61 | 61 | $default[$key] = $form_state['values'][$key]; |
62 | - $show_overrides = TRUE; |
|
62 | + $show_overrides = true; |
|
63 | 63 | break; |
64 | 64 | } |
65 | 65 | break; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | '#title' => t('Overrides'), |
84 | 84 | '#type' => 'fieldset', |
85 | 85 | '#description' => '', |
86 | - '#collapsible' => TRUE, |
|
86 | + '#collapsible' => true, |
|
87 | 87 | '#collapsed' => !$show_overrides, |
88 | 88 | '#attributes' => array('class' => 'advanced-settings') |
89 | 89 | ); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | )); |
213 | 213 | } |
214 | 214 | if ($values['boinc_host_sched_logs_dir'] |
215 | - AND !is_dir($values['boinc_host_sched_logs_dir']) |
|
215 | + and !is_dir($values['boinc_host_sched_logs_dir']) |
|
216 | 216 | ) { |
217 | 217 | form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
218 | 218 | directory not found at %directory', |
@@ -578,13 +578,13 @@ discard block |
||
578 | 578 | $sender = user_load($sender->uid); |
579 | 579 | |
580 | 580 | switch ($status) { |
581 | - case FLAG_FRIEND_FLAGGED: |
|
582 | - // Sender accepted recipient's friend request |
|
583 | - $email['subject'] = bts('!name accepted your friend request [!site]', array( |
|
584 | - '!name' => $sender->boincuser_name, |
|
585 | - '!site' => variable_get('site_name', ''), |
|
586 | - )); |
|
587 | - $email['body'] = bts('!name confirmed you as a friend on !site. |
|
581 | + case FLAG_FRIEND_FLAGGED: |
|
582 | + // Sender accepted recipient's friend request |
|
583 | + $email['subject'] = bts('!name accepted your friend request [!site]', array( |
|
584 | + '!name' => $sender->boincuser_name, |
|
585 | + '!site' => variable_get('site_name', ''), |
|
586 | + )); |
|
587 | + $email['body'] = bts('!name confirmed you as a friend on !site. |
|
588 | 588 | |
589 | 589 | Follow this link to view his or her profile: |
590 | 590 | !link |
@@ -593,17 +593,17 @@ discard block |
||
593 | 593 | |
594 | 594 | Thanks, |
595 | 595 | The !site team', array( |
596 | - '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
|
597 | - '!site' => variable_get('site_name', ''), |
|
598 | - '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
|
599 | - '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
|
600 | - )); |
|
601 | - break; |
|
596 | + '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
|
597 | + '!site' => variable_get('site_name', ''), |
|
598 | + '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
|
599 | + '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
|
600 | + )); |
|
601 | + break; |
|
602 | 602 | |
603 | - case FLAG_FRIEND_PENDING: |
|
604 | - // Sender is requesting to be recipient's friend |
|
605 | - $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', ''))); |
|
606 | - $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts. |
|
603 | + case FLAG_FRIEND_PENDING: |
|
604 | + // Sender is requesting to be recipient's friend |
|
605 | + $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', ''))); |
|
606 | + $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts. |
|
607 | 607 | |
608 | 608 | Follow the link below to view this request: |
609 | 609 | !link |
@@ -612,12 +612,12 @@ discard block |
||
612 | 612 | |
613 | 613 | Thanks, |
614 | 614 | The !site team', array( |
615 | - '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
|
616 | - '!site' => variable_get('site_name', ''), |
|
617 | - '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
|
618 | - '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
|
619 | - )); |
|
620 | - break; |
|
615 | + '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
|
616 | + '!site' => variable_get('site_name', ''), |
|
617 | + '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
|
618 | + '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
|
619 | + )); |
|
620 | + break; |
|
621 | 621 | } |
622 | 622 | return $email; |
623 | 623 | } |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | * Implementation of HOOK_theme(). |
68 | 68 | */ |
69 | 69 | function boinc_theme(&$existing, $type, $theme, $path) { |
70 | - $hooks = zen_theme($existing, $type, $theme, $path); |
|
71 | - // Add your theme hooks like this: |
|
72 | - /* |
|
70 | + $hooks = zen_theme($existing, $type, $theme, $path); |
|
71 | + // Add your theme hooks like this: |
|
72 | + /* |
|
73 | 73 | $hooks['hook_name_here'] = array( // Details go here ); |
74 | 74 | */ |
75 | - // @TODO: Needs detailed comments. Patches welcome! |
|
76 | - return $hooks; |
|
75 | + // @TODO: Needs detailed comments. Patches welcome! |
|
76 | + return $hooks; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -81,43 +81,43 @@ discard block |
||
81 | 81 | * Adjust the rendering of the menu |
82 | 82 | */ |
83 | 83 | function boinc_links__system_main_menu($links, $menu, $element) { |
84 | - $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n"; |
|
85 | - $item_count = count($links); |
|
86 | - $i = 1; |
|
87 | - foreach ($links as $key => $link) { |
|
84 | + $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n"; |
|
85 | + $item_count = count($links); |
|
86 | + $i = 1; |
|
87 | + foreach ($links as $key => $link) { |
|
88 | 88 | $classes = array($key); |
89 | 89 | if (strpos($key, 'active-trail')) $classes[] = 'active'; |
90 | 90 | if ($i == 1) $classes[] = 'first'; |
91 | 91 | if ($i == $item_count) $classes[] = 'last'; |
92 | 92 | $html .= '<li class="' . implode(' ', $classes) .'">'; |
93 | 93 | if ($link['title'] == 'Home') { |
94 | - $link['title'] = bts('Home'); |
|
94 | + $link['title'] = bts('Home'); |
|
95 | 95 | } |
96 | 96 | if (module_exists('privatemsg')) { |
97 | - // Put a new mail notification next to the Account menu item |
|
98 | - if ($link['href'] == 'dashboard') { |
|
97 | + // Put a new mail notification next to the Account menu item |
|
98 | + if ($link['href'] == 'dashboard') { |
|
99 | 99 | $item_count = privatemsg_unread_count(); |
100 | 100 | if ($item_count) { |
101 | - $link['title'] .= '</a> <a href="/messages" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
|
102 | - $link['html'] = TRUE; |
|
103 | - $link['attributes']['class'] = 'compound'; |
|
101 | + $link['title'] .= '</a> <a href="/messages" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
|
102 | + $link['html'] = TRUE; |
|
103 | + $link['attributes']['class'] = 'compound'; |
|
104 | + } |
|
104 | 105 | } |
105 | - } |
|
106 | 106 | } |
107 | 107 | // Put a count of items on the Moderation menu item |
108 | 108 | if ($link['href'] == 'moderate') { |
109 | - $item_count = boincuser_moderation_queue_count(); |
|
110 | - if ($item_count) { |
|
109 | + $item_count = boincuser_moderation_queue_count(); |
|
110 | + if ($item_count) { |
|
111 | 111 | $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
112 | 112 | $link['html'] = TRUE; |
113 | - } |
|
113 | + } |
|
114 | 114 | } |
115 | 115 | $html .= l($link['title'], $link['href'], $link); |
116 | 116 | $html .= '</li>'; |
117 | 117 | $i++; |
118 | - } |
|
119 | - $html .= '</ul>' . "\n"; |
|
120 | - return $html; |
|
118 | + } |
|
119 | + $html .= '</ul>' . "\n"; |
|
120 | + return $html; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | * Remove undesired local task tabs |
126 | 126 | */ |
127 | 127 | function boinc_menu_local_task($link, $active = FALSE) { |
128 | - if (strpos($link, 'admin/build/pages') !== FALSE |
|
128 | + if (strpos($link, 'admin/build/pages') !== FALSE |
|
129 | 129 | AND strpos($link, 'Edit Panel')) { |
130 | 130 | // Remove Edit Panel tab |
131 | 131 | return ''; |
132 | - } |
|
133 | - else { |
|
132 | + } |
|
133 | + else { |
|
134 | 134 | return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n"; |
135 | - } |
|
135 | + } |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -168,83 +168,83 @@ discard block |
||
168 | 168 | * The name of the template being rendered ("page" in this case.) |
169 | 169 | */ |
170 | 170 | function boinc_preprocess_page(&$vars, $hook) { |
171 | - // Responsive Design: Add viewport meta tag to HTML head |
|
172 | - drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1.0" />'); |
|
173 | - $vars['head'] = drupal_get_html_head(); |
|
174 | - //dpm($vars['head'], "preprocess (all) vars[head]"); |
|
175 | - |
|
176 | - // Expose comments to template files; this is needed so that comments can be |
|
177 | - // rendered in locations other than directly below the node content |
|
178 | - $vars['comments'] = $vars['comment_form'] = ''; |
|
179 | - if (module_exists('comment') && isset($vars['node'])) { |
|
171 | + // Responsive Design: Add viewport meta tag to HTML head |
|
172 | + drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1.0" />'); |
|
173 | + $vars['head'] = drupal_get_html_head(); |
|
174 | + //dpm($vars['head'], "preprocess (all) vars[head]"); |
|
175 | + |
|
176 | + // Expose comments to template files; this is needed so that comments can be |
|
177 | + // rendered in locations other than directly below the node content |
|
178 | + $vars['comments'] = $vars['comment_form'] = ''; |
|
179 | + if (module_exists('comment') && isset($vars['node'])) { |
|
180 | 180 | $vars['comments'] = comment_render($vars['node']); |
181 | 181 | $vars['comment_form'] = drupal_get_form('comment_form', array('nid' => $vars['node']->nid)); |
182 | - } |
|
182 | + } |
|
183 | 183 | |
184 | - // Determine locale region code so the correct flag is displayed in footer |
|
185 | - global $language; |
|
186 | - global $theme_path; |
|
187 | - $locality = $language->language; |
|
188 | - if (strpos($language->language, '-')) { |
|
184 | + // Determine locale region code so the correct flag is displayed in footer |
|
185 | + global $language; |
|
186 | + global $theme_path; |
|
187 | + $locality = $language->language; |
|
188 | + if (strpos($language->language, '-')) { |
|
189 | 189 | $flag_icon = "{$theme_path}/images/flags/{$language->language}.png"; |
190 | 190 | if (!file_exists($flag_icon)) { |
191 | - $lang_code = explode('-', $language->language); |
|
192 | - $locality = $lang_code[0]; |
|
191 | + $lang_code = explode('-', $language->language); |
|
192 | + $locality = $lang_code[0]; |
|
193 | 193 | } |
194 | - } |
|
195 | - $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png"; |
|
194 | + } |
|
195 | + $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png"; |
|
196 | 196 | |
197 | - $server_status_url = variable_get('boinc_server_status_url', ''); |
|
198 | - if (!$server_status_url) { |
|
197 | + $server_status_url = variable_get('boinc_server_status_url', ''); |
|
198 | + if (!$server_status_url) { |
|
199 | 199 | $server_status_url = 'server_status.php'; |
200 | - } |
|
201 | - $vars['server_status_url'] = $server_status_url; |
|
200 | + } |
|
201 | + $vars['server_status_url'] = $server_status_url; |
|
202 | 202 | |
203 | - $app_list_url = variable_get('boinc_app_list_url', ''); |
|
204 | - if (!$app_list_url) { |
|
203 | + $app_list_url = variable_get('boinc_app_list_url', ''); |
|
204 | + if (!$app_list_url) { |
|
205 | 205 | $app_list_url = 'apps.php'; |
206 | - } |
|
207 | - $vars['app_list_url'] = $app_list_url; |
|
206 | + } |
|
207 | + $vars['app_list_url'] = $app_list_url; |
|
208 | 208 | |
209 | - // Remove title from search page |
|
210 | - if (arg(0) == 'search') { |
|
209 | + // Remove title from search page |
|
210 | + if (arg(0) == 'search') { |
|
211 | 211 | unset($vars['title']); |
212 | - } |
|
212 | + } |
|
213 | 213 | |
214 | - // Apply classes to tabs to allow for better styling options |
|
215 | - $tabs = explode("\n", $vars['tabs']); |
|
216 | - array_pop($tabs); |
|
217 | - end($tabs); |
|
218 | - $last_key = key($tabs); |
|
219 | - |
|
220 | - foreach ($tabs as $key => &$tab) { |
|
221 | - if (strpos($tab, 'li class=')) { |
|
222 | - if ($key == 0) { |
|
223 | - $tab = str_replace('li class="', 'li class="first ', $tab); |
|
224 | - } |
|
225 | - if ($key == $last_key) { |
|
226 | - $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
|
227 | - } |
|
228 | - } |
|
229 | - elseif (strpos($tab, 'li ')) { |
|
230 | - if ($key == 0) { |
|
231 | - $tab = str_replace('li ', 'li class="first" ', $tab); |
|
232 | - } |
|
233 | - if ($key == $last_key) { |
|
234 | - $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>'; |
|
235 | - } |
|
236 | - } |
|
237 | - } |
|
238 | - $vars['tabs'] = implode("\n", $tabs); |
|
214 | + // Apply classes to tabs to allow for better styling options |
|
215 | + $tabs = explode("\n", $vars['tabs']); |
|
216 | + array_pop($tabs); |
|
217 | + end($tabs); |
|
218 | + $last_key = key($tabs); |
|
219 | + |
|
220 | + foreach ($tabs as $key => &$tab) { |
|
221 | + if (strpos($tab, 'li class=')) { |
|
222 | + if ($key == 0) { |
|
223 | + $tab = str_replace('li class="', 'li class="first ', $tab); |
|
224 | + } |
|
225 | + if ($key == $last_key) { |
|
226 | + $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
|
227 | + } |
|
228 | + } |
|
229 | + elseif (strpos($tab, 'li ')) { |
|
230 | + if ($key == 0) { |
|
231 | + $tab = str_replace('li ', 'li class="first" ', $tab); |
|
232 | + } |
|
233 | + if ($key == $last_key) { |
|
234 | + $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>'; |
|
235 | + } |
|
236 | + } |
|
237 | + } |
|
238 | + $vars['tabs'] = implode("\n", $tabs); |
|
239 | 239 | |
240 | - // Get the main menu but only for the branch the page is on. |
|
241 | - $vars['menu_tree_onlyactive'] = menu_tree('primary-links'); |
|
240 | + // Get the main menu but only for the branch the page is on. |
|
241 | + $vars['menu_tree_onlyactive'] = menu_tree('primary-links'); |
|
242 | 242 | |
243 | - // Create tertiary menu |
|
244 | - $vars['tertiary_links'] = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2); |
|
243 | + // Create tertiary menu |
|
244 | + $vars['tertiary_links'] = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2); |
|
245 | 245 | |
246 | - // Create action links |
|
247 | - $vars['action_links'] = _boinc_action_links(); |
|
246 | + // Create action links |
|
247 | + $vars['action_links'] = _boinc_action_links(); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -257,72 +257,72 @@ discard block |
||
257 | 257 | */ |
258 | 258 | function boinc_preprocess_node(&$vars, $hook) { |
259 | 259 | |
260 | - //$vars['sample_variable'] = t('Lorem ipsum.'); |
|
260 | + //$vars['sample_variable'] = t('Lorem ipsum.'); |
|
261 | 261 | |
262 | - // Detach subscribe link from the links list. Subscribe link will be placed |
|
263 | - // on page separately from links. |
|
264 | - if (!empty($vars['node']->links['flag-subscriptions']['title'])) { |
|
262 | + // Detach subscribe link from the links list. Subscribe link will be placed |
|
263 | + // on page separately from links. |
|
264 | + if (!empty($vars['node']->links['flag-subscriptions']['title'])) { |
|
265 | 265 | $vars['subscribe_link'] = $vars['node']->links['flag-subscriptions']['title']; |
266 | 266 | unset($vars['node']->links['flag-subscriptions']); |
267 | - } |
|
267 | + } |
|
268 | 268 | |
269 | - // Optionally, run node-type-specific preprocess functions, like |
|
270 | - // boinc_preprocess_node_page() or boinc_preprocess_node_story(). |
|
271 | - $function = __FUNCTION__ . '_' . $vars['node']->type; |
|
272 | - if (function_exists($function)) { |
|
269 | + // Optionally, run node-type-specific preprocess functions, like |
|
270 | + // boinc_preprocess_node_page() or boinc_preprocess_node_story(). |
|
271 | + $function = __FUNCTION__ . '_' . $vars['node']->type; |
|
272 | + if (function_exists($function)) { |
|
273 | 273 | $function($vars, $hook); |
274 | - } |
|
274 | + } |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
278 | 278 | * Preprocessing for forum lists |
279 | 279 | */ |
280 | 280 | function boinc_preprocess_forums(&$vars, $hook) { |
281 | - // Add a link to mark all forums as read |
|
282 | - module_load_include('inc', 'forum_tweaks', 'includes/mark-read'); |
|
283 | - forum_tweaks_get_mark_read_link($vars['tid'], $vars['links']); |
|
284 | - if (!$vars['parents']) { |
|
281 | + // Add a link to mark all forums as read |
|
282 | + module_load_include('inc', 'forum_tweaks', 'includes/mark-read'); |
|
283 | + forum_tweaks_get_mark_read_link($vars['tid'], $vars['links']); |
|
284 | + if (!$vars['parents']) { |
|
285 | 285 | // Remove the "Post new forum topic" link from the top level forum list |
286 | 286 | unset($vars['links']['forum']); |
287 | 287 | // Add a link to manage subscriptions for the user |
288 | 288 | $vars['links']['subscriptions'] = array( |
289 | - 'title' => bts('Manage subscriptions'), |
|
290 | - 'href' => 'account/prefs/subscriptions', |
|
289 | + 'title' => bts('Manage subscriptions'), |
|
290 | + 'href' => 'account/prefs/subscriptions', |
|
291 | 291 | ); |
292 | - } |
|
292 | + } |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Preprocessing for forum type nodes |
297 | 297 | */ |
298 | 298 | function boinc_preprocess_node_forum(&$vars, $hook) { |
299 | - global $user; |
|
299 | + global $user; |
|
300 | 300 | |
301 | - // Get the author of the node |
|
302 | - $account = user_load($vars['uid']); |
|
303 | - $comments_per_page = ($user->comments_per_page) ? $user->comments_per_page : variable_get("comment_default_per_page_{$vars['node']->type}", 50); |
|
301 | + // Get the author of the node |
|
302 | + $account = user_load($vars['uid']); |
|
303 | + $comments_per_page = ($user->comments_per_page) ? $user->comments_per_page : variable_get("comment_default_per_page_{$vars['node']->type}", 50); |
|
304 | 304 | |
305 | - // Add signature |
|
306 | - $vars['signature'] = check_markup($account->signature, $vars['node']->format); |
|
305 | + // Add signature |
|
306 | + $vars['signature'] = check_markup($account->signature, $vars['node']->format); |
|
307 | 307 | |
308 | - // Show signatures based on user preference |
|
309 | - $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE; |
|
308 | + // Show signatures based on user preference |
|
309 | + $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE; |
|
310 | 310 | |
311 | - // Expose comment sort order so that the template can put the topic node |
|
312 | - // content (i.e. initial post) at the very end if "Newest post first" is the |
|
313 | - // preference used by this user |
|
314 | - $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE; |
|
315 | - $vars['node']->comment = 0; |
|
311 | + // Expose comment sort order so that the template can put the topic node |
|
312 | + // content (i.e. initial post) at the very end if "Newest post first" is the |
|
313 | + // preference used by this user |
|
314 | + $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE; |
|
315 | + $vars['node']->comment = 0; |
|
316 | 316 | |
317 | - $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1)); |
|
318 | - $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1); |
|
319 | - $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1)); |
|
320 | - |
|
321 | - $links = $vars['links']; |
|
322 | - $moderator_links = array(); |
|
323 | - _boinc_create_moderator_links($links, $moderator_links); |
|
324 | - $vars['links'] = $links; |
|
325 | - $vars['moderator_links'] = $moderator_links; |
|
317 | + $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1)); |
|
318 | + $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1); |
|
319 | + $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1)); |
|
320 | + |
|
321 | + $links = $vars['links']; |
|
322 | + $moderator_links = array(); |
|
323 | + _boinc_create_moderator_links($links, $moderator_links); |
|
324 | + $vars['links'] = $links; |
|
325 | + $vars['moderator_links'] = $moderator_links; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | |
@@ -358,20 +358,20 @@ discard block |
||
358 | 358 | * |
359 | 359 | */ |
360 | 360 | function boinc_preprocess_forum_topic_list(&$variables) { |
361 | - if (!empty($variables['topics'])) { |
|
361 | + if (!empty($variables['topics'])) { |
|
362 | 362 | foreach ($variables['topics'] as $id => $topic) { |
363 | - if ($topic->new_replies) { |
|
363 | + if ($topic->new_replies) { |
|
364 | 364 | $cid = boincuser_get_first_unread_comment_id($topic->nid); |
365 | 365 | if ($cid) { |
366 | - $variables['topics'][$id]->new_url = url("goto/comment/{$cid}"); |
|
366 | + $variables['topics'][$id]->new_url = url("goto/comment/{$cid}"); |
|
367 | 367 | } |
368 | 368 | else { |
369 | - // User hasn't visited this topic before, so all replies are new... |
|
370 | - $topic->new_replies = NULL; |
|
369 | + // User hasn't visited this topic before, so all replies are new... |
|
370 | + $topic->new_replies = NULL; |
|
371 | + } |
|
371 | 372 | } |
372 | - } |
|
373 | 373 | } |
374 | - } |
|
374 | + } |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -384,39 +384,39 @@ discard block |
||
384 | 384 | */ |
385 | 385 | ///* -- Delete this line if you want to use this function |
386 | 386 | function boinc_preprocess_views_view(&$vars, $hook) { |
387 | - switch ($vars['name']) { |
|
388 | - case 'boinc_account_computers': |
|
387 | + switch ($vars['name']) { |
|
388 | + case 'boinc_account_computers': |
|
389 | 389 | switch ($vars['display_id']) { |
390 | 390 | case 'page_1': |
391 | 391 | case 'panel_pane_1': |
392 | 392 | $vars['empty'] = boincwork_views_host_list_empty_text(); |
393 | - break; |
|
393 | + break; |
|
394 | 394 | case 'page_2': |
395 | 395 | $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
396 | - break; |
|
396 | + break; |
|
397 | 397 | case 'block_1': |
398 | 398 | $vars['empty'] = boincwork_views_host_list_empty_text('preferences'); |
399 | - break; |
|
399 | + break; |
|
400 | 400 | default: |
401 | 401 | } |
402 | 402 | break; |
403 | - case 'boinc_account_tasks_all': |
|
403 | + case 'boinc_account_tasks_all': |
|
404 | 404 | $vars['empty'] = boincwork_views_task_list_empty_text(); |
405 | 405 | break; |
406 | - case 'boinc_friends': |
|
406 | + case 'boinc_friends': |
|
407 | 407 | if ($vars['display_id'] == 'block_1') { |
408 | - $vars['header'] = boincuser_views_friends_block_header(); |
|
408 | + $vars['header'] = boincuser_views_friends_block_header(); |
|
409 | 409 | } |
410 | 410 | break; |
411 | - case 'boinc_host_list': |
|
411 | + case 'boinc_host_list': |
|
412 | 412 | if ($vars['display_id'] == 'page_2') { |
413 | - $vars['empty'] = boincwork_views_host_list_empty_text(); |
|
413 | + $vars['empty'] = boincwork_views_host_list_empty_text(); |
|
414 | 414 | } |
415 | 415 | elseif ($vars['display_id'] == 'page_1') { |
416 | - $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
|
416 | + $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
|
417 | 417 | } |
418 | 418 | break; |
419 | - case 'boinc_task': |
|
419 | + case 'boinc_task': |
|
420 | 420 | // Load view object (view data is not available in header / footer); execute view query |
421 | 421 | $view = views_get_current_view(); |
422 | 422 | $view->execute(); |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | $vars['footer'] = '<h3>' . bts('Stderr output') .'</h3>'; |
426 | 426 | $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>'; |
427 | 427 | break; |
428 | - case 'boinc_teams': |
|
428 | + case 'boinc_teams': |
|
429 | 429 | if ($vars['display_id'] == 'panel_pane_3') { |
430 | - $team_id = arg(2); |
|
431 | - $vars['header'] = boincteam_manage_admins_panel_header($team_id); |
|
430 | + $team_id = arg(2); |
|
431 | + $vars['header'] = boincteam_manage_admins_panel_header($team_id); |
|
432 | 432 | } |
433 | 433 | break; |
434 | - case 'boinc_workunit': |
|
434 | + case 'boinc_workunit': |
|
435 | 435 | ob_start(); |
436 | 436 | // Get the workunit ID from the URL |
437 | 437 | $result_id = arg(1); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | project_workunit($wu); |
441 | 441 | // Output of project_workunit() gets caught in the buffer |
442 | 442 | $vars['footer'] = ob_get_clean(); |
443 | - default: |
|
443 | + default: |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 | // */ |
@@ -453,19 +453,19 @@ discard block |
||
453 | 453 | */ |
454 | 454 | ///* -- Delete this line if you want to use this function |
455 | 455 | function boinc_preprocess_privatemsg_view(&$vars, $hook) { |
456 | - $author_picture = '<div class="picture">'; |
|
457 | - $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid); |
|
458 | - if ($user_image) { |
|
456 | + $author_picture = '<div class="picture">'; |
|
457 | + $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid); |
|
458 | + if ($user_image) { |
|
459 | 459 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
460 | - $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
|
460 | + $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
|
461 | 461 | } |
462 | 462 | elseif (is_string($user_image)) { |
463 | - $author_picture .= '<img src="' . $user_image . '"/>'; |
|
463 | + $author_picture .= '<img src="' . $user_image . '"/>'; |
|
464 | 464 | } |
465 | - } |
|
466 | - $author_picture .= '</div>'; |
|
467 | - $vars['author_picture'] = $author_picture; |
|
468 | - $vars['message_timestamp'] = date('j M Y H:i:s T', $vars['message']['timestamp']); |
|
465 | + } |
|
466 | + $author_picture .= '</div>'; |
|
467 | + $vars['author_picture'] = $author_picture; |
|
468 | + $vars['message_timestamp'] = date('j M Y H:i:s T', $vars['message']['timestamp']); |
|
469 | 469 | } |
470 | 470 | // */ |
471 | 471 | |
@@ -484,25 +484,25 @@ discard block |
||
484 | 484 | // */ |
485 | 485 | |
486 | 486 | function boinc_preprocess_search_result(&$variables) { |
487 | - $type = strtolower($variables['result']['type']); |
|
488 | - switch ($type) { |
|
489 | - case 'team': |
|
487 | + $type = strtolower($variables['result']['type']); |
|
488 | + switch ($type) { |
|
489 | + case 'team': |
|
490 | 490 | global $base_url; |
491 | 491 | $node = $variables['result']['node']; |
492 | 492 | $variables['url'] = $base_url .'/community/teams/' . $node->entity_id; |
493 | 493 | break; |
494 | - default: |
|
494 | + default: |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | |
498 | 498 | // Remove the mess of text under the search form and don't display "no results" |
499 | 499 | // if a search hasn't even been submitted |
500 | 500 | function boinc_apachesolr_search_noresults() { |
501 | - $message = bts('No results found...'); |
|
502 | - if (!arg(2)) { |
|
501 | + $message = bts('No results found...'); |
|
502 | + if (!arg(2)) { |
|
503 | 503 | $message = ''; |
504 | - } |
|
505 | - return '<p>' . $message . '</p>'; |
|
504 | + } |
|
505 | + return '<p>' . $message . '</p>'; |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -511,42 +511,42 @@ discard block |
||
511 | 511 | */ |
512 | 512 | function phptemplate_username($object) { |
513 | 513 | |
514 | - if ($object->uid && $object->name) { |
|
514 | + if ($object->uid && $object->name) { |
|
515 | 515 | |
516 | 516 | // Show the profile name in general, not the username |
517 | 517 | $name = user_load($object->uid)->boincuser_name; |
518 | 518 | |
519 | 519 | // Shorten the name when it is too long or it will break many tables. |
520 | 520 | if (drupal_strlen($name) > 20) { |
521 | - $name = drupal_substr($name, 0, 15) . '...'; |
|
521 | + $name = drupal_substr($name, 0, 15) . '...'; |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | if (user_access('access user profiles')) { |
525 | - $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.')))); |
|
525 | + $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.')))); |
|
526 | 526 | } |
527 | 527 | else { |
528 | - $output = check_plain($name); |
|
528 | + $output = check_plain($name); |
|
529 | 529 | } |
530 | - } |
|
531 | - else if ($object->name) { |
|
530 | + } |
|
531 | + else if ($object->name) { |
|
532 | 532 | // Sometimes modules display content composed by people who are |
533 | 533 | // not registered members of the site (e.g. mailing list or news |
534 | 534 | // aggregator modules). This clause enables modules to display |
535 | 535 | // the true author of the content. |
536 | 536 | if (!empty($object->homepage)) { |
537 | - $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); |
|
537 | + $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); |
|
538 | 538 | } |
539 | 539 | else { |
540 | - $output = check_plain($object->name); |
|
540 | + $output = check_plain($object->name); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | $output .= ' (' . bts('not verified') . ')'; |
544 | - } |
|
545 | - else { |
|
544 | + } |
|
545 | + else { |
|
546 | 546 | $output = check_plain(variable_get('anonymous', bts('Anonymous'))); |
547 | - } |
|
547 | + } |
|
548 | 548 | |
549 | - return $output; |
|
549 | + return $output; |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | /** |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * "More information about formatting options" |
555 | 555 | */ |
556 | 556 | function boinc_filter_tips_more_info () { |
557 | - return ''; |
|
557 | + return ''; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -572,19 +572,19 @@ discard block |
||
572 | 572 | * An array containing the email [type] (mailkey), [subject] and [body]. |
573 | 573 | */ |
574 | 574 | function boinc_flag_friend_message_email($status, $flag, $recipient, $sender) { |
575 | - $email = array(); |
|
576 | - $email['type'] = 'flag-friend'; |
|
577 | - // Reload the sender to get a full user object |
|
578 | - $sender = user_load($sender->uid); |
|
575 | + $email = array(); |
|
576 | + $email['type'] = 'flag-friend'; |
|
577 | + // Reload the sender to get a full user object |
|
578 | + $sender = user_load($sender->uid); |
|
579 | 579 | |
580 | - switch ($status) { |
|
580 | + switch ($status) { |
|
581 | 581 | case FLAG_FRIEND_FLAGGED: |
582 | 582 | // Sender accepted recipient's friend request |
583 | 583 | $email['subject'] = bts('!name accepted your friend request [!site]', array( |
584 | 584 | '!name' => $sender->boincuser_name, |
585 | 585 | '!site' => variable_get('site_name', ''), |
586 | 586 | )); |
587 | - $email['body'] = bts('!name confirmed you as a friend on !site. |
|
587 | + $email['body'] = bts('!name confirmed you as a friend on !site. |
|
588 | 588 | |
589 | 589 | Follow this link to view his or her profile: |
590 | 590 | !link |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
599 | 599 | '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
600 | 600 | )); |
601 | - break; |
|
601 | + break; |
|
602 | 602 | |
603 | 603 | case FLAG_FRIEND_PENDING: |
604 | 604 | // Sender is requesting to be recipient's friend |
605 | 605 | $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', ''))); |
606 | - $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts. |
|
606 | + $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts. |
|
607 | 607 | |
608 | 608 | Follow the link below to view this request: |
609 | 609 | !link |
@@ -617,25 +617,25 @@ discard block |
||
617 | 617 | '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
618 | 618 | '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
619 | 619 | )); |
620 | - break; |
|
621 | - } |
|
622 | - return $email; |
|
620 | + break; |
|
621 | + } |
|
622 | + return $email; |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | /** |
626 | 626 | * Edit action links |
627 | 627 | */ |
628 | 628 | function phptemplate_links($links, $attributes = array('class' => 'links')) { |
629 | - if ($links){ |
|
629 | + if ($links){ |
|
630 | 630 | // Remove flag-subscriptions link. It will be placed elsewhere. |
631 | 631 | if (isset($links['flag-subscriptions'])) { |
632 | - unset($links['flag-subscriptions']); |
|
632 | + unset($links['flag-subscriptions']); |
|
633 | 633 | } |
634 | 634 | // Reorder the links however you need them. |
635 | 635 | $links = reorder_links($links, array('comment_edit','quote','comment_add','comment_reply','flag-abuse_comment','flag-abuse_node'), array('comment_delete')); |
636 | 636 | // Use the built-in theme_links() function to format the $links array. |
637 | 637 | return theme_links($links, $attributes); |
638 | - } |
|
638 | + } |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | /** |
@@ -679,8 +679,8 @@ discard block |
||
679 | 679 | * That is to say, get rid of it and use the views-view-table.tpl.php template. |
680 | 680 | */ |
681 | 681 | function boinc_tablesort_indicator($style) { |
682 | - return ''; |
|
683 | - /* |
|
682 | + return ''; |
|
683 | + /* |
|
684 | 684 | if ($style == "asc") { |
685 | 685 | return theme('image', 'misc/arrow-asc.png', t('sort icon'), t('sort ascending')); |
686 | 686 | } |
@@ -703,48 +703,48 @@ discard block |
||
703 | 703 | * |
704 | 704 | */ |
705 | 705 | function _boinc_create_moderator_links(&$links, &$moderator_links) { |
706 | - // If there are no links, then do nothing |
|
707 | - if (empty($links)) { |
|
706 | + // If there are no links, then do nothing |
|
707 | + if (empty($links)) { |
|
708 | 708 | return; |
709 | - } |
|
709 | + } |
|
710 | 710 | |
711 | - $alllinks = array(); |
|
712 | - $modlinks = array(); |
|
711 | + $alllinks = array(); |
|
712 | + $modlinks = array(); |
|
713 | 713 | |
714 | - // Create an array of HTML elements from the $links string, keys |
|
715 | - // are the class attribute for the <li> tags. |
|
716 | - $dom = new DOMDocument; |
|
717 | - $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8')); |
|
718 | - foreach($dom->getElementsByTagName('li') as $node) { |
|
714 | + // Create an array of HTML elements from the $links string, keys |
|
715 | + // are the class attribute for the <li> tags. |
|
716 | + $dom = new DOMDocument; |
|
717 | + $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8')); |
|
718 | + foreach($dom->getElementsByTagName('li') as $node) { |
|
719 | 719 | $key = $node->getAttribute("class"); |
720 | 720 | $alllinks[$key] = $dom->saveHTML($node); |
721 | - } |
|
721 | + } |
|
722 | 722 | |
723 | - // Select classes to be placed into moderator links array |
|
724 | - $selected_classes = array( |
|
723 | + // Select classes to be placed into moderator links array |
|
724 | + $selected_classes = array( |
|
725 | 725 | "make_sticky", "make_unsticky", |
726 | 726 | "lock", "unlock", |
727 | 727 | "convert", |
728 | 728 | "hide", "unhide", |
729 | 729 | "comment_delete", |
730 | - ); |
|
731 | - foreach(array_keys($alllinks) as $key1) { |
|
730 | + ); |
|
731 | + foreach(array_keys($alllinks) as $key1) { |
|
732 | 732 | // Select string up to first space, if present. |
733 | 733 | $class1 = strtok($key1, ' '); |
734 | 734 | if (in_array($class1, $selected_classes)) { |
735 | - if (empty($modlinks)) { |
|
735 | + if (empty($modlinks)) { |
|
736 | 736 | _boinc_firstlink($alllinks[$key1]); |
737 | - } |
|
738 | - $modlinks[$key1] = $alllinks[$key1]; |
|
739 | - unset($alllinks[$key1]); |
|
737 | + } |
|
738 | + $modlinks[$key1] = $alllinks[$key1]; |
|
739 | + unset($alllinks[$key1]); |
|
740 | 740 | } |
741 | - } |
|
742 | - // Convert the HTML arrays back into strings, wrap them in <ul> |
|
743 | - // tags |
|
744 | - $links = "<ul class=\"links\">".implode($alllinks)."</ul>"; |
|
745 | - $moderator_links = "<ul class=\"links\">".implode($modlinks)."</ul>"; |
|
741 | + } |
|
742 | + // Convert the HTML arrays back into strings, wrap them in <ul> |
|
743 | + // tags |
|
744 | + $links = "<ul class=\"links\">".implode($alllinks)."</ul>"; |
|
745 | + $moderator_links = "<ul class=\"links\">".implode($modlinks)."</ul>"; |
|
746 | 746 | |
747 | - return; |
|
747 | + return; |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /* |
@@ -752,36 +752,36 @@ discard block |
||
752 | 752 | * attribute to class. |
753 | 753 | */ |
754 | 754 | function _boinc_firstlink(&$alink) { |
755 | - if (!empty($alink)) { |
|
755 | + if (!empty($alink)) { |
|
756 | 756 | $dom = new DomDocument; |
757 | 757 | $dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8')); |
758 | 758 | |
759 | 759 | $myli = $dom->getElementsByTagName('li'); |
760 | 760 | if ($myli->length>0) { |
761 | - $newclasses = trim(($myli[0]->getAttribute("class"))." first"); |
|
762 | - $myli[0]->setAttribute("class", $newclasses); |
|
763 | - $alink = $dom->saveHTML($myli[0]); |
|
761 | + $newclasses = trim(($myli[0]->getAttribute("class"))." first"); |
|
762 | + $myli[0]->setAttribute("class", $newclasses); |
|
763 | + $alink = $dom->saveHTML($myli[0]); |
|
764 | + } |
|
764 | 765 | } |
765 | - } |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /* |
769 | 769 | * Private function to generate the action links |
770 | 770 | */ |
771 | 771 | function _boinc_action_links() { |
772 | - global $user; |
|
773 | - global $base_path; |
|
772 | + global $user; |
|
773 | + global $base_path; |
|
774 | 774 | |
775 | - $output = '<ul class="menu"><li class="first">'; |
|
776 | - if ($user->uid) { |
|
775 | + $output = '<ul class="menu"><li class="first">'; |
|
776 | + if ($user->uid) { |
|
777 | 777 | $output .= '<a href="' . $base_path . 'logout">' . bts('Logout') . '</a>'; |
778 | - } else { |
|
778 | + } else { |
|
779 | 779 | $output .= '<a href="' . $base_path . 'user/login?' . drupal_get_destination() . '">' . bts('Login') . '</a>'; |
780 | - } |
|
781 | - $output .= '</li>'; |
|
782 | - if (module_exists('global_search') OR module_exists('global_search_solr')) { |
|
780 | + } |
|
781 | + $output .= '</li>'; |
|
782 | + if (module_exists('global_search') OR module_exists('global_search_solr')) { |
|
783 | 783 | $output .= '<li class="last"> <a class="search" href="' . $base_path . 'search/site">' . bts('search') . '</a> </li>'; |
784 | - } |
|
785 | - $output .= '</ul>'; |
|
786 | - return $output; |
|
784 | + } |
|
785 | + $output .= '</ul>'; |
|
786 | + return $output; |
|
787 | 787 | } |
788 | 788 | \ No newline at end of file |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * Adjust the rendering of the menu |
82 | 82 | */ |
83 | 83 | function boinc_links__system_main_menu($links, $menu, $element) { |
84 | - $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n"; |
|
84 | + $html .= '<ul id="'.$menu['id'].'" class="'.$menu['class'].'">'."\n"; |
|
85 | 85 | $item_count = count($links); |
86 | 86 | $i = 1; |
87 | 87 | foreach ($links as $key => $link) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if (strpos($key, 'active-trail')) $classes[] = 'active'; |
90 | 90 | if ($i == 1) $classes[] = 'first'; |
91 | 91 | if ($i == $item_count) $classes[] = 'last'; |
92 | - $html .= '<li class="' . implode(' ', $classes) .'">'; |
|
92 | + $html .= '<li class="'.implode(' ', $classes).'">'; |
|
93 | 93 | if ($link['title'] == 'Home') { |
94 | 94 | $link['title'] = bts('Home'); |
95 | 95 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if ($link['href'] == 'dashboard') { |
99 | 99 | $item_count = privatemsg_unread_count(); |
100 | 100 | if ($item_count) { |
101 | - $link['title'] .= '</a> <a href="/messages" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
|
101 | + $link['title'] .= '</a> <a href="/messages" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">'.$item_count.'</span></div>'; |
|
102 | 102 | $link['html'] = TRUE; |
103 | 103 | $link['attributes']['class'] = 'compound'; |
104 | 104 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | if ($link['href'] == 'moderate') { |
109 | 109 | $item_count = boincuser_moderation_queue_count(); |
110 | 110 | if ($item_count) { |
111 | - $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
|
111 | + $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">'.$item_count.'</span></div>'; |
|
112 | 112 | $link['html'] = TRUE; |
113 | 113 | } |
114 | 114 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $html .= '</li>'; |
117 | 117 | $i++; |
118 | 118 | } |
119 | - $html .= '</ul>' . "\n"; |
|
119 | + $html .= '</ul>'."\n"; |
|
120 | 120 | return $html; |
121 | 121 | } |
122 | 122 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | return ''; |
132 | 132 | } |
133 | 133 | else { |
134 | - return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n"; |
|
134 | + return '<li '.($active ? 'class="active" ' : '').'>'.$link."</li>\n"; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $locality = $lang_code[0]; |
193 | 193 | } |
194 | 194 | } |
195 | - $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png"; |
|
195 | + $vars['flag_path'] = base_path().path_to_theme()."/images/flags/{$locality}.png"; |
|
196 | 196 | |
197 | 197 | $server_status_url = variable_get('boinc_server_status_url', ''); |
198 | 198 | if (!$server_status_url) { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $tab = str_replace('li class="', 'li class="first ', $tab); |
224 | 224 | } |
225 | 225 | if ($key == $last_key) { |
226 | - $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
|
226 | + $tab = str_replace('li class="', 'li class="last ', $tab).'</ul>'; |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | elseif (strpos($tab, 'li ')) { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $tab = str_replace('li ', 'li class="first" ', $tab); |
232 | 232 | } |
233 | 233 | if ($key == $last_key) { |
234 | - $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>'; |
|
234 | + $tab = str_replace('li ', 'li class="last" ', $tab).'</ul>'; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | // Optionally, run node-type-specific preprocess functions, like |
270 | 270 | // boinc_preprocess_node_page() or boinc_preprocess_node_story(). |
271 | - $function = __FUNCTION__ . '_' . $vars['node']->type; |
|
271 | + $function = __FUNCTION__.'_'.$vars['node']->type; |
|
272 | 272 | if (function_exists($function)) { |
273 | 273 | $function($vars, $hook); |
274 | 274 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $vars['node']->comment = 0; |
316 | 316 | |
317 | 317 | $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1)); |
318 | - $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1); |
|
318 | + $page_count = max(ceil($vars['comment_count']/$comments_per_page), 1); |
|
319 | 319 | $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1)); |
320 | 320 | |
321 | 321 | $links = $vars['links']; |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | $view->execute(); |
423 | 423 | $result = reset($view->result); |
424 | 424 | // Display the stderr output in the footer |
425 | - $vars['footer'] = '<h3>' . bts('Stderr output') .'</h3>'; |
|
426 | - $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>'; |
|
425 | + $vars['footer'] = '<h3>'.bts('Stderr output').'</h3>'; |
|
426 | + $vars['footer'] .= '<pre>'.htmlspecialchars($result->result_stderr_out).'</pre>'; |
|
427 | 427 | break; |
428 | 428 | case 'boinc_teams': |
429 | 429 | if ($vars['display_id'] == 'panel_pane_3') { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | ob_start(); |
436 | 436 | // Get the workunit ID from the URL |
437 | 437 | $result_id = arg(1); |
438 | - require_boinc(array('util','boinc_db')); |
|
438 | + require_boinc(array('util', 'boinc_db')); |
|
439 | 439 | $wu = BoincWorkunit::lookup_id($result_id); |
440 | 440 | project_workunit($wu); |
441 | 441 | // Output of project_workunit() gets caught in the buffer |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
461 | 461 | } |
462 | 462 | elseif (is_string($user_image)) { |
463 | - $author_picture .= '<img src="' . $user_image . '"/>'; |
|
463 | + $author_picture .= '<img src="'.$user_image.'"/>'; |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | $author_picture .= '</div>'; |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | case 'team': |
490 | 490 | global $base_url; |
491 | 491 | $node = $variables['result']['node']; |
492 | - $variables['url'] = $base_url .'/community/teams/' . $node->entity_id; |
|
492 | + $variables['url'] = $base_url.'/community/teams/'.$node->entity_id; |
|
493 | 493 | break; |
494 | 494 | default: |
495 | 495 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | if (!arg(2)) { |
503 | 503 | $message = ''; |
504 | 504 | } |
505 | - return '<p>' . $message . '</p>'; |
|
505 | + return '<p>'.$message.'</p>'; |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -518,11 +518,11 @@ discard block |
||
518 | 518 | |
519 | 519 | // Shorten the name when it is too long or it will break many tables. |
520 | 520 | if (drupal_strlen($name) > 20) { |
521 | - $name = drupal_substr($name, 0, 15) . '...'; |
|
521 | + $name = drupal_substr($name, 0, 15).'...'; |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | if (user_access('access user profiles')) { |
525 | - $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.')))); |
|
525 | + $output = l($name, 'account/'.$object->uid, array('attributes' => array('title' => bts('View user profile.')))); |
|
526 | 526 | } |
527 | 527 | else { |
528 | 528 | $output = check_plain($name); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $output = check_plain($object->name); |
541 | 541 | } |
542 | 542 | |
543 | - $output .= ' (' . bts('not verified') . ')'; |
|
543 | + $output .= ' ('.bts('not verified').')'; |
|
544 | 544 | } |
545 | 545 | else { |
546 | 546 | $output = check_plain(variable_get('anonymous', bts('Anonymous'))); |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * Remove the link under text areas that reads: |
554 | 554 | * "More information about formatting options" |
555 | 555 | */ |
556 | -function boinc_filter_tips_more_info () { |
|
556 | +function boinc_filter_tips_more_info() { |
|
557 | 557 | return ''; |
558 | 558 | } |
559 | 559 | |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | The !site team', array( |
596 | 596 | '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
597 | 597 | '!site' => variable_get('site_name', ''), |
598 | - '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
|
599 | - '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
|
598 | + '!message' => $flag->friend_message ? bts('Message').': '.$flag->friend_message : '', |
|
599 | + '!link' => url('account/'.$sender->uid, array('absolute' => TRUE)), |
|
600 | 600 | )); |
601 | 601 | break; |
602 | 602 | |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | The !site team', array( |
615 | 615 | '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
616 | 616 | '!site' => variable_get('site_name', ''), |
617 | - '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
|
617 | + '!message' => $flag->friend_message ? bts('Message').': '.$flag->friend_message : '', |
|
618 | 618 | '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
619 | 619 | )); |
620 | 620 | break; |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | * Edit action links |
627 | 627 | */ |
628 | 628 | function phptemplate_links($links, $attributes = array('class' => 'links')) { |
629 | - if ($links){ |
|
629 | + if ($links) { |
|
630 | 630 | // Remove flag-subscriptions link. It will be placed elsewhere. |
631 | 631 | if (isset($links['flag-subscriptions'])) { |
632 | 632 | unset($links['flag-subscriptions']); |
633 | 633 | } |
634 | 634 | // Reorder the links however you need them. |
635 | - $links = reorder_links($links, array('comment_edit','quote','comment_add','comment_reply','flag-abuse_comment','flag-abuse_node'), array('comment_delete')); |
|
635 | + $links = reorder_links($links, array('comment_edit', 'quote', 'comment_add', 'comment_reply', 'flag-abuse_comment', 'flag-abuse_node'), array('comment_delete')); |
|
636 | 636 | // Use the built-in theme_links() function to format the $links array. |
637 | 637 | return theme_links($links, $attributes); |
638 | 638 | } |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | // are the class attribute for the <li> tags. |
716 | 716 | $dom = new DOMDocument; |
717 | 717 | $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8')); |
718 | - foreach($dom->getElementsByTagName('li') as $node) { |
|
718 | + foreach ($dom->getElementsByTagName('li') as $node) { |
|
719 | 719 | $key = $node->getAttribute("class"); |
720 | 720 | $alllinks[$key] = $dom->saveHTML($node); |
721 | 721 | } |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | "hide", "unhide", |
729 | 729 | "comment_delete", |
730 | 730 | ); |
731 | - foreach(array_keys($alllinks) as $key1) { |
|
731 | + foreach (array_keys($alllinks) as $key1) { |
|
732 | 732 | // Select string up to first space, if present. |
733 | 733 | $class1 = strtok($key1, ' '); |
734 | 734 | if (in_array($class1, $selected_classes)) { |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | $dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8')); |
758 | 758 | |
759 | 759 | $myli = $dom->getElementsByTagName('li'); |
760 | - if ($myli->length>0) { |
|
760 | + if ($myli->length > 0) { |
|
761 | 761 | $newclasses = trim(($myli[0]->getAttribute("class"))." first"); |
762 | 762 | $myli[0]->setAttribute("class", $newclasses); |
763 | 763 | $alink = $dom->saveHTML($myli[0]); |
@@ -774,13 +774,13 @@ discard block |
||
774 | 774 | |
775 | 775 | $output = '<ul class="menu"><li class="first">'; |
776 | 776 | if ($user->uid) { |
777 | - $output .= '<a href="' . $base_path . 'logout">' . bts('Logout') . '</a>'; |
|
777 | + $output .= '<a href="'.$base_path.'logout">'.bts('Logout').'</a>'; |
|
778 | 778 | } else { |
779 | - $output .= '<a href="' . $base_path . 'user/login?' . drupal_get_destination() . '">' . bts('Login') . '</a>'; |
|
779 | + $output .= '<a href="'.$base_path.'user/login?'.drupal_get_destination().'">'.bts('Login').'</a>'; |
|
780 | 780 | } |
781 | 781 | $output .= '</li>'; |
782 | 782 | if (module_exists('global_search') OR module_exists('global_search_solr')) { |
783 | - $output .= '<li class="last"> <a class="search" href="' . $base_path . 'search/site">' . bts('search') . '</a> </li>'; |
|
783 | + $output .= '<li class="last"> <a class="search" href="'.$base_path.'search/site">'.bts('search').'</a> </li>'; |
|
784 | 784 | } |
785 | 785 | $output .= '</ul>'; |
786 | 786 | return $output; |
@@ -129,8 +129,7 @@ discard block |
||
129 | 129 | AND strpos($link, 'Edit Panel')) { |
130 | 130 | // Remove Edit Panel tab |
131 | 131 | return ''; |
132 | - } |
|
133 | - else { |
|
132 | + } else { |
|
134 | 133 | return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n"; |
135 | 134 | } |
136 | 135 | } |
@@ -225,8 +224,7 @@ discard block |
||
225 | 224 | if ($key == $last_key) { |
226 | 225 | $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
227 | 226 | } |
228 | - } |
|
229 | - elseif (strpos($tab, 'li ')) { |
|
227 | + } elseif (strpos($tab, 'li ')) { |
|
230 | 228 | if ($key == 0) { |
231 | 229 | $tab = str_replace('li ', 'li class="first" ', $tab); |
232 | 230 | } |
@@ -364,8 +362,7 @@ discard block |
||
364 | 362 | $cid = boincuser_get_first_unread_comment_id($topic->nid); |
365 | 363 | if ($cid) { |
366 | 364 | $variables['topics'][$id]->new_url = url("goto/comment/{$cid}"); |
367 | - } |
|
368 | - else { |
|
365 | + } else { |
|
369 | 366 | // User hasn't visited this topic before, so all replies are new... |
370 | 367 | $topic->new_replies = NULL; |
371 | 368 | } |
@@ -411,8 +408,7 @@ discard block |
||
411 | 408 | case 'boinc_host_list': |
412 | 409 | if ($vars['display_id'] == 'page_2') { |
413 | 410 | $vars['empty'] = boincwork_views_host_list_empty_text(); |
414 | - } |
|
415 | - elseif ($vars['display_id'] == 'page_1') { |
|
411 | + } elseif ($vars['display_id'] == 'page_1') { |
|
416 | 412 | $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
417 | 413 | } |
418 | 414 | break; |
@@ -458,8 +454,7 @@ discard block |
||
458 | 454 | if ($user_image) { |
459 | 455 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
460 | 456 | $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
461 | - } |
|
462 | - elseif (is_string($user_image)) { |
|
457 | + } elseif (is_string($user_image)) { |
|
463 | 458 | $author_picture .= '<img src="' . $user_image . '"/>'; |
464 | 459 | } |
465 | 460 | } |
@@ -523,26 +518,22 @@ discard block |
||
523 | 518 | |
524 | 519 | if (user_access('access user profiles')) { |
525 | 520 | $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.')))); |
526 | - } |
|
527 | - else { |
|
521 | + } else { |
|
528 | 522 | $output = check_plain($name); |
529 | 523 | } |
530 | - } |
|
531 | - else if ($object->name) { |
|
524 | + } else if ($object->name) { |
|
532 | 525 | // Sometimes modules display content composed by people who are |
533 | 526 | // not registered members of the site (e.g. mailing list or news |
534 | 527 | // aggregator modules). This clause enables modules to display |
535 | 528 | // the true author of the content. |
536 | 529 | if (!empty($object->homepage)) { |
537 | 530 | $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); |
538 | - } |
|
539 | - else { |
|
531 | + } else { |
|
540 | 532 | $output = check_plain($object->name); |
541 | 533 | } |
542 | 534 | |
543 | 535 | $output .= ' (' . bts('not verified') . ')'; |
544 | - } |
|
545 | - else { |
|
536 | + } else { |
|
546 | 537 | $output = check_plain(variable_get('anonymous', bts('Anonymous'))); |
547 | 538 | } |
548 | 539 | |
@@ -626,7 +617,7 @@ discard block |
||
626 | 617 | * Edit action links |
627 | 618 | */ |
628 | 619 | function phptemplate_links($links, $attributes = array('class' => 'links')) { |
629 | - if ($links){ |
|
620 | + if ($links) { |
|
630 | 621 | // Remove flag-subscriptions link. It will be placed elsewhere. |
631 | 622 | if (isset($links['flag-subscriptions'])) { |
632 | 623 | unset($links['flag-subscriptions']); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $item_count = privatemsg_unread_count(); |
100 | 100 | if ($item_count) { |
101 | 101 | $link['title'] .= '</a> <a href="/messages" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
102 | - $link['html'] = TRUE; |
|
102 | + $link['html'] = true; |
|
103 | 103 | $link['attributes']['class'] = 'compound'; |
104 | 104 | } |
105 | 105 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $item_count = boincuser_moderation_queue_count(); |
110 | 110 | if ($item_count) { |
111 | 111 | $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
112 | - $link['html'] = TRUE; |
|
112 | + $link['html'] = true; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | $html .= l($link['title'], $link['href'], $link); |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * Remove undesired local task tabs |
126 | 126 | */ |
127 | -function boinc_menu_local_task($link, $active = FALSE) { |
|
128 | - if (strpos($link, 'admin/build/pages') !== FALSE |
|
129 | - AND strpos($link, 'Edit Panel')) { |
|
127 | +function boinc_menu_local_task($link, $active = false) { |
|
128 | + if (strpos($link, 'admin/build/pages') !== false |
|
129 | + and strpos($link, 'Edit Panel')) { |
|
130 | 130 | // Remove Edit Panel tab |
131 | 131 | return ''; |
132 | 132 | } |
@@ -306,17 +306,17 @@ discard block |
||
306 | 306 | $vars['signature'] = check_markup($account->signature, $vars['node']->format); |
307 | 307 | |
308 | 308 | // Show signatures based on user preference |
309 | - $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE; |
|
309 | + $vars['show_signatures'] = ($user->hide_signatures) ? false : true; |
|
310 | 310 | |
311 | 311 | // Expose comment sort order so that the template can put the topic node |
312 | 312 | // content (i.e. initial post) at the very end if "Newest post first" is the |
313 | 313 | // preference used by this user |
314 | - $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE; |
|
314 | + $vars['oldest_post_first'] = ($user->sort != 1) ? true : false; |
|
315 | 315 | $vars['node']->comment = 0; |
316 | 316 | |
317 | - $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1)); |
|
317 | + $vars['first_page'] = (!isset($_GET['page']) or ($_GET['page'] < 1)); |
|
318 | 318 | $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1); |
319 | - $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1)); |
|
319 | + $vars['last_page'] = ($page_count == 1 or ($page_count > 1 and $_GET['page'] == $page_count - 1)); |
|
320 | 320 | |
321 | 321 | $links = $vars['links']; |
322 | 322 | $moderator_links = array(); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | function boinc_preprocess_comment(&$vars, $hook) { |
346 | 346 | // Show signatures based on user preference |
347 | 347 | global $user; |
348 | - $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE; |
|
348 | + $vars['show_signatures'] = ($user->hide_signatures) ? false : true; |
|
349 | 349 | |
350 | 350 | $links = $vars['links']; |
351 | 351 | $moderator_links = array(); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | } |
368 | 368 | else { |
369 | 369 | // User hasn't visited this topic before, so all replies are new... |
370 | - $topic->new_replies = NULL; |
|
370 | + $topic->new_replies = null; |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | } |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $author_picture = '<div class="picture">'; |
457 | 457 | $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid); |
458 | 458 | if ($user_image) { |
459 | - if (is_array($user_image) AND $user_image['image']['filepath']) { |
|
459 | + if (is_array($user_image) and $user_image['image']['filepath']) { |
|
460 | 460 | $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
461 | 461 | } |
462 | 462 | elseif (is_string($user_image)) { |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
597 | 597 | '!site' => variable_get('site_name', ''), |
598 | 598 | '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
599 | - '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
|
599 | + '!link' => url('account/'. $sender->uid, array('absolute' => true)), |
|
600 | 600 | )); |
601 | 601 | break; |
602 | 602 | |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
616 | 616 | '!site' => variable_get('site_name', ''), |
617 | 617 | '!message' => $flag->friend_message ? bts('Message') . ': ' . $flag->friend_message : '', |
618 | - '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
|
618 | + '!link' => url('goto/friend-requests', array('absolute' => true)), |
|
619 | 619 | )); |
620 | 620 | break; |
621 | 621 | } |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | $output .= '<a href="' . $base_path . 'user/login?' . drupal_get_destination() . '">' . bts('Login') . '</a>'; |
780 | 780 | } |
781 | 781 | $output .= '</li>'; |
782 | - if (module_exists('global_search') OR module_exists('global_search_solr')) { |
|
782 | + if (module_exists('global_search') or module_exists('global_search_solr')) { |
|
783 | 783 | $output .= '<li class="last"> <a class="search" href="' . $base_path . 'search/site">' . bts('search') . '</a> </li>'; |
784 | 784 | } |
785 | 785 | $output .= '</ul>'; |
@@ -15,42 +15,42 @@ |
||
15 | 15 | */ |
16 | 16 | function boinc_settings($saved_settings) { |
17 | 17 | |
18 | - // Get the default values from the .info file. |
|
19 | - $defaults = zen_theme_get_default_settings('boinc'); |
|
18 | + // Get the default values from the .info file. |
|
19 | + $defaults = zen_theme_get_default_settings('boinc'); |
|
20 | 20 | |
21 | - // Merge the saved variables and their default values. |
|
22 | - $settings = array_merge($defaults, $saved_settings); |
|
21 | + // Merge the saved variables and their default values. |
|
22 | + $settings = array_merge($defaults, $saved_settings); |
|
23 | 23 | |
24 | - /* |
|
24 | + /* |
|
25 | 25 | * Create the form using Forms API: http://api.drupal.org/api/6 |
26 | 26 | */ |
27 | - $form = array(); |
|
28 | - $form['boinc_stats_charts'] = array( |
|
27 | + $form = array(); |
|
28 | + $form['boinc_stats_charts'] = array( |
|
29 | 29 | '#type' => 'fieldset', |
30 | 30 | '#title' => t('Chart settings'), |
31 | 31 | '#attributes' => array( |
32 | - 'class' => 'zen-settings', |
|
32 | + 'class' => 'zen-settings', |
|
33 | 33 | ), |
34 | - ); |
|
35 | - $form['boinc_stats_charts']['boinc_stats_chart_color'] = array( |
|
34 | + ); |
|
35 | + $form['boinc_stats_charts']['boinc_stats_chart_color'] = array( |
|
36 | 36 | '#type' => 'textfield', |
37 | 37 | '#title' => t('Chart color'), |
38 | 38 | '#default_value' => $settings['boinc_stats_chart_color'], |
39 | 39 | '#description' => t('The primary color of the stats chart in hex format (e.g. #FAA341).'), |
40 | - ); |
|
41 | - $form['boinc_stats_charts']['boinc_stats_chart_bcolor'] = array( |
|
40 | + ); |
|
41 | + $form['boinc_stats_charts']['boinc_stats_chart_bcolor'] = array( |
|
42 | 42 | '#type' => 'textfield', |
43 | 43 | '#title' => t('Chart background color'), |
44 | 44 | '#default_value' => $settings['boinc_stats_chart_bcolor'], |
45 | 45 | '#description' => t('The background color of the stats chart in hex format (e.g. #FFFFFF).'), |
46 | - ); |
|
46 | + ); |
|
47 | 47 | |
48 | - // Add the base theme's settings. |
|
49 | - $form += zen_settings($saved_settings, $defaults); |
|
48 | + // Add the base theme's settings. |
|
49 | + $form += zen_settings($saved_settings, $defaults); |
|
50 | 50 | |
51 | - // Remove some of the base theme's settings. |
|
52 | - unset($form['themedev']['zen_layout']); // We don't need to select the base stylesheet. |
|
51 | + // Remove some of the base theme's settings. |
|
52 | + unset($form['themedev']['zen_layout']); // We don't need to select the base stylesheet. |
|
53 | 53 | |
54 | - // Return the form |
|
55 | - return $form; |
|
54 | + // Return the form |
|
55 | + return $form; |
|
56 | 56 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | // $Id: theme-settings.php,v 1.7 2008/09/11 09:36:50 johnalbin Exp $ |
3 | 3 | |
4 | 4 | // Include the definition of zen_settings() and zen_theme_get_default_settings(). |
5 | -include_once './' . drupal_get_path('theme', 'zen') . '/theme-settings.php'; |
|
5 | +include_once './'.drupal_get_path('theme', 'zen').'/theme-settings.php'; |
|
6 | 6 | |
7 | 7 | |
8 | 8 | /** |
@@ -4,34 +4,34 @@ |
||
4 | 4 | * Implementation of hook_strongarm(). |
5 | 5 | */ |
6 | 6 | function internationalization_strongarm() { |
7 | - $export = array(); |
|
7 | + $export = array(); |
|
8 | 8 | |
9 | - $strongarm = new stdClass; |
|
10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
11 | - $strongarm->api_version = 1; |
|
12 | - $strongarm->name = 'i18nstrings_allowed_formats'; |
|
13 | - $strongarm->value = array( |
|
9 | + $strongarm = new stdClass; |
|
10 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
11 | + $strongarm->api_version = 1; |
|
12 | + $strongarm->name = 'i18nstrings_allowed_formats'; |
|
13 | + $strongarm->value = array( |
|
14 | 14 | 0 => 4, |
15 | 15 | 1 => 5, |
16 | - ); |
|
17 | - $export['i18nstrings_allowed_formats'] = $strongarm; |
|
16 | + ); |
|
17 | + $export['i18nstrings_allowed_formats'] = $strongarm; |
|
18 | 18 | |
19 | - $strongarm = new stdClass; |
|
20 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
21 | - $strongarm->api_version = 1; |
|
22 | - $strongarm->name = 'i18ntaxonomy_vocabulary'; |
|
23 | - $strongarm->value = array( |
|
19 | + $strongarm = new stdClass; |
|
20 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
21 | + $strongarm->api_version = 1; |
|
22 | + $strongarm->name = 'i18ntaxonomy_vocabulary'; |
|
23 | + $strongarm->value = array( |
|
24 | 24 | 2 => '1', |
25 | 25 | 1 => '0', |
26 | - ); |
|
27 | - $export['i18ntaxonomy_vocabulary'] = $strongarm; |
|
26 | + ); |
|
27 | + $export['i18ntaxonomy_vocabulary'] = $strongarm; |
|
28 | 28 | |
29 | - $strongarm = new stdClass; |
|
30 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
31 | - $strongarm->api_version = 1; |
|
32 | - $strongarm->name = 'language_negotiation'; |
|
33 | - $strongarm->value = '2'; |
|
34 | - $export['language_negotiation'] = $strongarm; |
|
29 | + $strongarm = new stdClass; |
|
30 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
31 | + $strongarm->api_version = 1; |
|
32 | + $strongarm->name = 'language_negotiation'; |
|
33 | + $strongarm->value = '2'; |
|
34 | + $export['language_negotiation'] = $strongarm; |
|
35 | 35 | |
36 | - return $export; |
|
36 | + return $export; |
|
37 | 37 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $export = array(); |
8 | 8 | |
9 | 9 | $strongarm = new stdClass; |
10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
10 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
11 | 11 | $strongarm->api_version = 1; |
12 | 12 | $strongarm->name = 'i18nstrings_allowed_formats'; |
13 | 13 | $strongarm->value = array( |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $export['i18nstrings_allowed_formats'] = $strongarm; |
18 | 18 | |
19 | 19 | $strongarm = new stdClass; |
20 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
20 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
21 | 21 | $strongarm->api_version = 1; |
22 | 22 | $strongarm->name = 'i18ntaxonomy_vocabulary'; |
23 | 23 | $strongarm->value = array( |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $export['i18ntaxonomy_vocabulary'] = $strongarm; |
28 | 28 | |
29 | 29 | $strongarm = new stdClass; |
30 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
30 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
31 | 31 | $strongarm->api_version = 1; |
32 | 32 | $strongarm->name = 'language_negotiation'; |
33 | 33 | $strongarm->value = '2'; |
@@ -4,47 +4,47 @@ |
||
4 | 4 | * Implementation of hook_user_default_permissions(). |
5 | 5 | */ |
6 | 6 | function internationalization_user_default_permissions() { |
7 | - $permissions = array(); |
|
7 | + $permissions = array(); |
|
8 | 8 | |
9 | - // Exported permission: administer all languages |
|
10 | - $permissions['administer all languages'] = array( |
|
9 | + // Exported permission: administer all languages |
|
10 | + $permissions['administer all languages'] = array( |
|
11 | 11 | 'name' => 'administer all languages', |
12 | 12 | 'roles' => array( |
13 | - '0' => 'administrator', |
|
13 | + '0' => 'administrator', |
|
14 | 14 | ), |
15 | - ); |
|
15 | + ); |
|
16 | 16 | |
17 | - // Exported permission: administer languages |
|
18 | - $permissions['administer languages'] = array( |
|
17 | + // Exported permission: administer languages |
|
18 | + $permissions['administer languages'] = array( |
|
19 | 19 | 'name' => 'administer languages', |
20 | 20 | 'roles' => array( |
21 | - '0' => 'administrator', |
|
21 | + '0' => 'administrator', |
|
22 | 22 | ), |
23 | - ); |
|
23 | + ); |
|
24 | 24 | |
25 | - // Exported permission: administer translations |
|
26 | - $permissions['administer translations'] = array( |
|
25 | + // Exported permission: administer translations |
|
26 | + $permissions['administer translations'] = array( |
|
27 | 27 | 'name' => 'administer translations', |
28 | 28 | 'roles' => array( |
29 | - '0' => 'administrator', |
|
29 | + '0' => 'administrator', |
|
30 | 30 | ), |
31 | - ); |
|
31 | + ); |
|
32 | 32 | |
33 | - // Exported permission: translate content |
|
34 | - $permissions['translate content'] = array( |
|
33 | + // Exported permission: translate content |
|
34 | + $permissions['translate content'] = array( |
|
35 | 35 | 'name' => 'translate content', |
36 | 36 | 'roles' => array( |
37 | - '0' => 'administrator', |
|
37 | + '0' => 'administrator', |
|
38 | 38 | ), |
39 | - ); |
|
39 | + ); |
|
40 | 40 | |
41 | - // Exported permission: translate interface |
|
42 | - $permissions['translate interface'] = array( |
|
41 | + // Exported permission: translate interface |
|
42 | + $permissions['translate interface'] = array( |
|
43 | 43 | 'name' => 'translate interface', |
44 | 44 | 'roles' => array( |
45 | - '0' => 'administrator', |
|
45 | + '0' => 'administrator', |
|
46 | 46 | ), |
47 | - ); |
|
47 | + ); |
|
48 | 48 | |
49 | - return $permissions; |
|
49 | + return $permissions; |
|
50 | 50 | } |
@@ -4,8 +4,8 @@ |
||
4 | 4 | * Implementation of hook_ctools_plugin_api(). |
5 | 5 | */ |
6 | 6 | function internationalization_ctools_plugin_api() { |
7 | - list($module, $api) = func_get_args(); |
|
8 | - if ($module == "strongarm" && $api == "strongarm") { |
|
7 | + list($module, $api) = func_get_args(); |
|
8 | + if ($module == "strongarm" && $api == "strongarm") { |
|
9 | 9 | return array("version" => 1); |
10 | - } |
|
10 | + } |
|
11 | 11 | } |
@@ -4,8 +4,8 @@ |
||
4 | 4 | * Implementation of hook_ctools_plugin_api(). |
5 | 5 | */ |
6 | 6 | function global_search_teams_solr_ctools_plugin_api() { |
7 | - list($module, $api) = func_get_args(); |
|
8 | - if ($module == "apachesolr_search" && $api == "apachesolr_search_defaults") { |
|
7 | + list($module, $api) = func_get_args(); |
|
8 | + if ($module == "apachesolr_search" && $api == "apachesolr_search_defaults") { |
|
9 | 9 | return array("version" => 3); |
10 | - } |
|
10 | + } |
|
11 | 11 | } |