@@ -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_ro' |
|
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_ro' |
|
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', array(), NULL, 'boinc:user-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', array(), NULL, 'boinc: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', array(), NULL, 'boinc:user-info'), |
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', array(), NULL, 'boinc:country-of-origin'), |
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', array(), NULL, 'boinc:user-info'), |
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', array(), NULL, 'boinc:user-info'), |
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( |
|
136 | - 'title' => bts('Email Address', array(), NULL, 'boinc:user-info'), |
|
134 | + ); |
|
135 | + $data['user']['email_addr'] = array( |
|
136 | + 'title' => bts('Email Address', array(), NULL, 'boinc:user-info'), |
|
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', array(), NULL, 'boinc:user-or-team-RAC'), |
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', array(), NULL, 'boinc:user-or-team-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', array(), NULL, 'boinc:user-info'), |
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', array(), NULL, 'boinc:user-info'), |
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', array(), NULL, 'boinc:user-info'), |
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', array(), NULL, 'boinc:user-info'), |
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', array(), NULL, 'boinc:user-or-team-total-credits'), |
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', array(), NULL, 'boinc:website-of-user-or-team'), |
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 | } |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | * Utility Form to delete teams suspected of being spammers. |
18 | 18 | */ |
19 | 19 | function boincteam_utility_delete(&$form_state) { |
20 | - $form = array(); |
|
20 | + $form = array(); |
|
21 | 21 | |
22 | - $form['help'] = array( |
|
22 | + $form['help'] = array( |
|
23 | 23 | '#type' => 'fieldset', |
24 | 24 | '#title' => t('Help'), |
25 | 25 | '#collapsible' => TRUE, |
26 | - ); |
|
26 | + ); |
|
27 | 27 | |
28 | - $form['help']['text'] = array( |
|
28 | + $form['help']['text'] = array( |
|
29 | 29 | '#type' => 'item', |
30 | 30 | '#description' => t('This utility page will help in identifying BOINC teams created by SPAMMERs which can be deleted. The search will find BOINC teams that meet the following criteria. |
31 | 31 | <ul> |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | <p> <i>How teams are deleted</i>: Select the teams to be deleted from the table below. Click "Delete Selected Teams" button to begin a batch operation to delete the teams. If you select teams, and then page through to another page of the table, your selections will be lost. I.e., only the teams select on the current page will be deleted. |
39 | 39 | <p> The site must be offline/in maintenance mode before searching for and deleting teams. If not, the delete button below is disabled. |
40 | 40 | '), |
41 | - ); |
|
41 | + ); |
|
42 | 42 | |
43 | - // This variable name has been changed for Drupal 7/8. |
|
44 | - $maintenance_mode = variable_get('site_offline'); |
|
45 | - if (!$maintenance_mode) { |
|
43 | + // This variable name has been changed for Drupal 7/8. |
|
44 | + $maintenance_mode = variable_get('site_offline'); |
|
45 | + if (!$maintenance_mode) { |
|
46 | 46 | drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ') . l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning'); |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - $form['teamdelete'] = array( |
|
49 | + $form['teamdelete'] = array( |
|
50 | 50 | '#type' => 'fieldset', |
51 | 51 | '#title' => t('Teams to delete'), |
52 | - ); |
|
53 | - $form['teamdelete']['deleteall'] = array( |
|
52 | + ); |
|
53 | + $form['teamdelete']['deleteall'] = array( |
|
54 | 54 | '#type' => 'submit', |
55 | 55 | '#disabled' => !($maintenance_mode), |
56 | 56 | '#value' => t('Delete Selected Teams'), |
@@ -58,101 +58,101 @@ discard block |
||
58 | 58 | '#attributes' => array( |
59 | 59 | 'onclick' => 'return confirm(\'' . t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?') . '\')', |
60 | 60 | ), |
61 | - ); |
|
62 | - $form['teamdelete']['results_table'] = array( |
|
61 | + ); |
|
62 | + $form['teamdelete']['results_table'] = array( |
|
63 | 63 | '#value' => drupal_get_form('boincteam_utility_team_table'), |
64 | - ); |
|
64 | + ); |
|
65 | 65 | |
66 | - return $form; |
|
66 | + return $form; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | function boincteam_utility_team_table() { |
70 | 70 | |
71 | - $limit=50; |
|
72 | - $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'"; |
|
71 | + $limit=50; |
|
72 | + $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'"; |
|
73 | 73 | |
74 | - // @todo - add bts() or t() |
|
75 | - $resultheader = array( |
|
74 | + // @todo - add bts() or t() |
|
75 | + $resultheader = array( |
|
76 | 76 | array( |
77 | - 'data' => 'Team ID', |
|
78 | - 'field' => 'id', |
|
79 | - 'sort' => 'asc', |
|
77 | + 'data' => 'Team ID', |
|
78 | + 'field' => 'id', |
|
79 | + 'sort' => 'asc', |
|
80 | 80 | ), |
81 | 81 | array( |
82 | - 'data' => 'Team Name', |
|
83 | - 'field' => 'name', |
|
82 | + 'data' => 'Team Name', |
|
83 | + 'field' => 'name', |
|
84 | 84 | ), |
85 | 85 | array( |
86 | - 'data' => 'Num Users', |
|
87 | - 'field' => 'nusers', |
|
86 | + 'data' => 'Num Users', |
|
87 | + 'field' => 'nusers', |
|
88 | 88 | ), |
89 | 89 | array( |
90 | - 'data' => 'Link to Team', |
|
91 | - 'field' => 'link', |
|
90 | + 'data' => 'Link to Team', |
|
91 | + 'field' => 'link', |
|
92 | 92 | ), |
93 | - ); |
|
93 | + ); |
|
94 | 94 | |
95 | - $tablesort = tablesort_sql($resultheader); |
|
96 | - db_set_active('boinc_rw'); |
|
97 | - $db_res = pager_query($sql . $tablesort, $limit); |
|
98 | - db_set_active('default'); |
|
95 | + $tablesort = tablesort_sql($resultheader); |
|
96 | + db_set_active('boinc_rw'); |
|
97 | + $db_res = pager_query($sql . $tablesort, $limit); |
|
98 | + db_set_active('default'); |
|
99 | 99 | |
100 | - $form = array(); |
|
101 | - $form['options'] = array(); |
|
102 | - $checkboxes = array(); |
|
103 | - if ($db_res) { |
|
100 | + $form = array(); |
|
101 | + $form['options'] = array(); |
|
102 | + $checkboxes = array(); |
|
103 | + if ($db_res) { |
|
104 | 104 | while ($result = db_fetch_object($db_res)) { |
105 | - $drupalnid = boincteam_lookup_nid($result->id); |
|
106 | - if ($drupalnid) { |
|
105 | + $drupalnid = boincteam_lookup_nid($result->id); |
|
106 | + if ($drupalnid) { |
|
107 | 107 | $tlink = l($result->name, '/community/teams/' . $drupalnid); |
108 | - } |
|
109 | - else { |
|
108 | + } |
|
109 | + else { |
|
110 | 110 | $tlink = ''; |
111 | - } |
|
112 | - // only keys no values |
|
113 | - $checkboxes[$result->id] = ''; |
|
111 | + } |
|
112 | + // only keys no values |
|
113 | + $checkboxes[$result->id] = ''; |
|
114 | 114 | |
115 | - $form['id'][$result->id] = array( |
|
115 | + $form['id'][$result->id] = array( |
|
116 | 116 | '#value' => $result->id, |
117 | - ); |
|
118 | - $form['name'][$result->id] = array( |
|
117 | + ); |
|
118 | + $form['name'][$result->id] = array( |
|
119 | 119 | '#value' => $result->name, |
120 | - ); |
|
121 | - $form['nusers'][$result->id] = array( |
|
120 | + ); |
|
121 | + $form['nusers'][$result->id] = array( |
|
122 | 122 | '#value' => $result->nusers, |
123 | - ); |
|
124 | - $form['link'][$result->id] = array( |
|
123 | + ); |
|
124 | + $form['link'][$result->id] = array( |
|
125 | 125 | '#value' => $tlink, |
126 | - ); |
|
126 | + ); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | $form['checkboxes'] = array('#type' => 'checkboxes', '#options' => $checkboxes); |
130 | 130 | $form['pager'] = array('#value' => theme('pager', NULL, $limit, 0)); |
131 | 131 | |
132 | 132 | return $form; |
133 | - } |
|
134 | - return "<p>No teams matched the criteria for a SPAM team.</p>"; |
|
133 | + } |
|
134 | + return "<p>No teams matched the criteria for a SPAM team.</p>"; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | 138 | * Submit handler - also creates the batch job to delete the teams. |
139 | 139 | */ |
140 | 140 | function boincteam_utility_delete_team($form, &$form_state) { |
141 | - $checkedteamids = $form_state['clicked_button']['#post']['checkboxes']; |
|
142 | - // Use batch to delete teams |
|
143 | - $operations = array(); |
|
144 | - foreach ($checkedteamids as $id) { |
|
141 | + $checkedteamids = $form_state['clicked_button']['#post']['checkboxes']; |
|
142 | + // Use batch to delete teams |
|
143 | + $operations = array(); |
|
144 | + foreach ($checkedteamids as $id) { |
|
145 | 145 | $operations[] = array('boincteam_utility_batch_process', array($id)); |
146 | - } |
|
147 | - $batch = array( |
|
146 | + } |
|
147 | + $batch = array( |
|
148 | 148 | 'title' => t('Processing BOINC Teams'), |
149 | 149 | 'operations' => $operations, |
150 | 150 | 'init_message' => t('Starting team deletion'), |
151 | 151 | 'finished' => 'boincteam_utility_batch_finished', |
152 | 152 | 'file' => drupal_get_path('module', 'boincteam') . '/boincteam.admin.inc', |
153 | - ); |
|
154 | - batch_set($batch); |
|
155 | - //batch_process('/admin/boinc/utility-team-delete'); |
|
153 | + ); |
|
154 | + batch_set($batch); |
|
155 | + //batch_process('/admin/boinc/utility-team-delete'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /* |
@@ -163,37 +163,37 @@ discard block |
||
163 | 163 | * Input form (table) |
164 | 164 | */ |
165 | 165 | function theme_boincteam_utility_team_table($form) { |
166 | - //define table header |
|
167 | - $header = array( |
|
166 | + //define table header |
|
167 | + $header = array( |
|
168 | 168 | theme('table_select_header_cell'), //using that previously empty field |
169 | 169 | array('data' => t('Team ID'), 'field' => 'id', 'sort' => 'asc'), |
170 | 170 | array('data' => t('Name'), 'field' => 'name'), |
171 | 171 | array('data' => t('Num Users'), 'field' => 'nusers'), |
172 | 172 | array('data' => t('Link to Team'), 'field' => 'link'), |
173 | - ); |
|
174 | - $rows = array(); |
|
175 | - $output = ""; |
|
176 | - if(!empty($form['checkboxes']['#options'])) { |
|
173 | + ); |
|
174 | + $rows = array(); |
|
175 | + $output = ""; |
|
176 | + if(!empty($form['checkboxes']['#options'])) { |
|
177 | 177 | foreach (element_children($form['id']) as $key) { |
178 | - $rows[] = array( |
|
178 | + $rows[] = array( |
|
179 | 179 | drupal_render($form['checkboxes'][$key]), |
180 | 180 | drupal_render($form['id'][$key]), |
181 | 181 | drupal_render($form['name'][$key]), |
182 | 182 | drupal_render($form['nusers'][$key]), |
183 | 183 | drupal_render($form['link'][$key]), |
184 | - ); |
|
184 | + ); |
|
185 | + } |
|
185 | 186 | } |
186 | - } |
|
187 | - else { |
|
187 | + else { |
|
188 | 188 | $rows[] = array(array('data' => '<div class="error">No teams found</div>', 'colspan' => 5)); |
189 | - } |
|
190 | - $output .= theme('table', $header, $rows); |
|
191 | - if ($form['pager']['#value']) { |
|
189 | + } |
|
190 | + $output .= theme('table', $header, $rows); |
|
191 | + if ($form['pager']['#value']) { |
|
192 | 192 | $output .= drupal_render($form['pager']); |
193 | - } |
|
193 | + } |
|
194 | 194 | |
195 | - $output .= drupal_render($form); |
|
196 | - return $output; |
|
195 | + $output .= drupal_render($form); |
|
196 | + return $output; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -202,26 +202,26 @@ discard block |
||
202 | 202 | * table. It also removes the team's drupal page (node) if found. |
203 | 203 | */ |
204 | 204 | function boincteam_utility_batch_process($id, &$context) { |
205 | - $boincteam = boincteam_load($id); |
|
206 | - $drupalid = boincteam_lookup_nid($id); |
|
205 | + $boincteam = boincteam_load($id); |
|
206 | + $drupalid = boincteam_lookup_nid($id); |
|
207 | 207 | |
208 | - // Delete entry in team table |
|
209 | - db_set_active('boinc_rw'); |
|
210 | - $sql1='DELETE FROM {team} WHERE id=%d'; |
|
211 | - $db_res = db_query($sql1, $id); |
|
212 | - db_set_active('default'); |
|
208 | + // Delete entry in team table |
|
209 | + db_set_active('boinc_rw'); |
|
210 | + $sql1='DELETE FROM {team} WHERE id=%d'; |
|
211 | + $db_res = db_query($sql1, $id); |
|
212 | + db_set_active('default'); |
|
213 | 213 | |
214 | - // Delete entry in boincteam table |
|
215 | - $sql2='DELETE FROM {boincteam} WHERE id=%d'; |
|
216 | - $db_res = db_query($sql2, $id); |
|
214 | + // Delete entry in boincteam table |
|
215 | + $sql2='DELETE FROM {boincteam} WHERE id=%d'; |
|
216 | + $db_res = db_query($sql2, $id); |
|
217 | 217 | |
218 | - // Delete the drupal node (if present) |
|
219 | - if ($drupalid) { |
|
218 | + // Delete the drupal node (if present) |
|
219 | + if ($drupalid) { |
|
220 | 220 | node_delete($drupalid); |
221 | - } |
|
221 | + } |
|
222 | 222 | |
223 | - $context['results'][] = $id . ' : ' . check_plain($boincteam->name); |
|
224 | - $context['message'] = t('Processing team @name', array('@name' => $boincteam->name)); |
|
223 | + $context['results'][] = $id . ' : ' . check_plain($boincteam->name); |
|
224 | + $context['message'] = t('Processing team @name', array('@name' => $boincteam->name)); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | * or failure. |
230 | 230 | */ |
231 | 231 | function boincteam_utility_batch_finished($success, $results, $operations) { |
232 | - if ($success) { |
|
232 | + if ($success) { |
|
233 | 233 | $message = 'Info: Delete SPAM Teams utility- ' . count($results) . ' team(s) deleted.'; |
234 | 234 | drupal_set_message($message, 'info'); |
235 | - } |
|
236 | - else { |
|
235 | + } |
|
236 | + else { |
|
237 | 237 | // An error occurred. |
238 | 238 | // $operations contains the operations that remained unprocessed. |
239 | 239 | $error_operation = reset($operations); |
240 | 240 | $message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
241 | 241 | drupal_set_message($message, 'error'); |
242 | - } |
|
242 | + } |
|
243 | 243 | } |
244 | 244 | \ No newline at end of file |
@@ -15,30 +15,30 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function boinctranslate_initialize_languages() { |
17 | 17 | |
18 | - require_once(getcwd() . '/includes/locale.inc'); |
|
18 | + require_once(getcwd() . '/includes/locale.inc'); |
|
19 | 19 | |
20 | - $api_base_url = 'https://www.transifex.com/api/2'; |
|
21 | - $project_name = variable_get( |
|
20 | + $api_base_url = 'https://www.transifex.com/api/2'; |
|
21 | + $project_name = variable_get( |
|
22 | 22 | 'boinc_translate_transifex_project_name', '' |
23 | - ); |
|
24 | - $operations = array(); |
|
23 | + ); |
|
24 | + $operations = array(); |
|
25 | 25 | |
26 | - if ($project_name) { |
|
26 | + if ($project_name) { |
|
27 | 27 | // Get all languages configured for this project at Transifex |
28 | 28 | $path = "project/{$project_name}/languages"; |
29 | 29 | $response = boinctranslate_transifex_request($path); |
30 | 30 | |
31 | 31 | if ($response == '404 NOT FOUND') { |
32 | - drupal_set_message( |
|
32 | + drupal_set_message( |
|
33 | 33 | t('Unable to get languages for %project.', |
34 | - array( |
|
34 | + array( |
|
35 | 35 | '%project' => $project_name, |
36 | - ) |
|
36 | + ) |
|
37 | 37 | ), 'warning' |
38 | - ); |
|
38 | + ); |
|
39 | 39 | } |
40 | 40 | elseif ($response) { |
41 | - if (is_array($response)) { |
|
41 | + if (is_array($response)) { |
|
42 | 42 | |
43 | 43 | $installed_languages = language_list(); |
44 | 44 | $available_languages = _locale_get_predefined_list(); |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | |
49 | 49 | // Set up Transifex languages in Drupal |
50 | 50 | foreach ($response as $language) { |
51 | - $posix_code = $language['language_code']; |
|
52 | - $rfc_code = strtolower(str_replace('_', '-', $posix_code)); |
|
53 | - $transifex_languages[$rfc_code] = $language; |
|
54 | - if (!isset($installed_languages[$rfc_code])) { |
|
51 | + $posix_code = $language['language_code']; |
|
52 | + $rfc_code = strtolower(str_replace('_', '-', $posix_code)); |
|
53 | + $transifex_languages[$rfc_code] = $language; |
|
54 | + if (!isset($installed_languages[$rfc_code])) { |
|
55 | 55 | // See if this language can be installed from a predefined list |
56 | 56 | if (isset($available_languages[$rfc_code])) { |
57 | - locale_add_language( |
|
57 | + locale_add_language( |
|
58 | 58 | $rfc_code, |
59 | 59 | NULL, |
60 | 60 | NULL, |
@@ -62,30 +62,30 @@ discard block |
||
62 | 62 | NULL, |
63 | 63 | NULL, |
64 | 64 | FALSE |
65 | - ); |
|
66 | - drupal_set_message( |
|
65 | + ); |
|
66 | + drupal_set_message( |
|
67 | 67 | 'Added predefined language: '.$available_languages[$rfc_code][0] |
68 | - ); |
|
69 | - db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code); |
|
68 | + ); |
|
69 | + db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code); |
|
70 | 70 | } |
71 | 71 | else { |
72 | - // Retrieve language details from Transifex |
|
73 | - $path = "language/{$posix_code}"; |
|
74 | - $response = boinctranslate_transifex_request($path); |
|
72 | + // Retrieve language details from Transifex |
|
73 | + $path = "language/{$posix_code}"; |
|
74 | + $response = boinctranslate_transifex_request($path); |
|
75 | 75 | |
76 | - if ($response == '404 NOT FOUND') { |
|
76 | + if ($response == '404 NOT FOUND') { |
|
77 | 77 | drupal_set_message( |
78 | - t('Unable to get details for language %code.', |
|
78 | + t('Unable to get details for language %code.', |
|
79 | 79 | array( |
80 | - '%code' => $posix_code, |
|
80 | + '%code' => $posix_code, |
|
81 | 81 | ) |
82 | - ), 'warning' |
|
82 | + ), 'warning' |
|
83 | 83 | ); |
84 | - } |
|
85 | - elseif ($response) { |
|
84 | + } |
|
85 | + elseif ($response) { |
|
86 | 86 | if (!empty($response['name'])) { |
87 | - // Add a custom language to Drupal and enable |
|
88 | - locale_add_language( |
|
87 | + // Add a custom language to Drupal and enable |
|
88 | + locale_add_language( |
|
89 | 89 | $rfc_code, |
90 | 90 | $response['name'], |
91 | 91 | $response['name'], |
@@ -93,362 +93,362 @@ discard block |
||
93 | 93 | NULL, |
94 | 94 | NULL, |
95 | 95 | TRUE |
96 | - ); |
|
97 | - drupal_set_message( |
|
96 | + ); |
|
97 | + drupal_set_message( |
|
98 | 98 | 'Added new language: '.$response['name'] |
99 | - ); |
|
99 | + ); |
|
100 | 100 | } |
101 | 101 | else { |
102 | - $variables = array( |
|
102 | + $variables = array( |
|
103 | 103 | '%code' => $posix_code, |
104 | - ); |
|
105 | - drupal_set_message( |
|
104 | + ); |
|
105 | + drupal_set_message( |
|
106 | 106 | t('Unable to get details for language %code.', $variables), |
107 | 107 | 'error' |
108 | - ); |
|
109 | - watchdog( |
|
108 | + ); |
|
109 | + watchdog( |
|
110 | 110 | 'boinctranslate', |
111 | 111 | 'Unable to get details for language %code.', |
112 | 112 | $variables, |
113 | 113 | WATCHDOG_ERROR |
114 | - ); |
|
114 | + ); |
|
115 | + } |
|
115 | 116 | } |
116 | - } |
|
117 | - else { |
|
118 | - $variables = array( |
|
119 | - '%code' => $posix_code, |
|
117 | + else { |
|
118 | + $variables = array( |
|
119 | + '%code' => $posix_code, |
|
120 | 120 | ); |
121 | 121 | drupal_set_message( |
122 | - t('Invalid response while getting details for language %code.', $variables), |
|
123 | - 'error' |
|
122 | + t('Invalid response while getting details for language %code.', $variables), |
|
123 | + 'error' |
|
124 | 124 | ); |
125 | 125 | watchdog( |
126 | - 'boinctranslate', |
|
127 | - 'Invalid response while getting details for language %code.', |
|
128 | - $variables, |
|
129 | - WATCHDOG_ERROR |
|
126 | + 'boinctranslate', |
|
127 | + 'Invalid response while getting details for language %code.', |
|
128 | + $variables, |
|
129 | + WATCHDOG_ERROR |
|
130 | 130 | ); |
131 | - } |
|
131 | + } |
|
132 | 132 | } |
133 | 133 | // Import any language files for the newly added language |
134 | 134 | if ($batch = locale_batch_by_language($rfc_code, '_locale_batch_language_finished')) { |
135 | - $operations = array_merge($operations, $batch['operations']); |
|
136 | - $process_batches = TRUE; |
|
135 | + $operations = array_merge($operations, $batch['operations']); |
|
136 | + $process_batches = TRUE; |
|
137 | + } |
|
137 | 138 | } |
138 | - } |
|
139 | 139 | } |
140 | 140 | drupal_set_message('Finished installing official BOINC languages.'); |
141 | 141 | // Disable languages that are not in Transifex |
142 | 142 | foreach ($installed_languages as $langcode => $language) { |
143 | - if (!isset($transifex_languages[$langcode])) { |
|
143 | + if (!isset($transifex_languages[$langcode])) { |
|
144 | 144 | $disabled_languages[$langcode] = $langcode; |
145 | 145 | db_query("UPDATE {languages} SET enabled = 0 WHERE language = '%s'", $langcode); |
146 | - } |
|
146 | + } |
|
147 | 147 | } |
148 | 148 | if ($disabled_languages) { |
149 | - drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages)); |
|
149 | + drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages)); |
|
150 | 150 | } |
151 | 151 | if ($process_batches) { |
152 | - $batch = array( |
|
152 | + $batch = array( |
|
153 | 153 | 'operations' => $operations, |
154 | - ); |
|
155 | - batch_set($batch); |
|
156 | - batch_process('admin/boinc/translation'); |
|
154 | + ); |
|
155 | + batch_set($batch); |
|
156 | + batch_process('admin/boinc/translation'); |
|
157 | + } |
|
157 | 158 | } |
158 | - } |
|
159 | - else { |
|
159 | + else { |
|
160 | 160 | $variables = array( |
161 | - '%project' => $project_name, |
|
161 | + '%project' => $project_name, |
|
162 | 162 | ); |
163 | 163 | drupal_set_message( |
164 | - t('No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)', $variables), |
|
165 | - 'error' |
|
164 | + t('No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)', $variables), |
|
165 | + 'error' |
|
166 | 166 | ); |
167 | 167 | watchdog( |
168 | - 'boinctranslate', |
|
169 | - 'No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)', |
|
170 | - $variables, |
|
171 | - WATCHDOG_ERROR |
|
168 | + 'boinctranslate', |
|
169 | + 'No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)', |
|
170 | + $variables, |
|
171 | + WATCHDOG_ERROR |
|
172 | 172 | ); |
173 | - } |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | else { |
176 | - $variables = array( |
|
176 | + $variables = array( |
|
177 | 177 | '%project' => $project_name, |
178 | - ); |
|
179 | - drupal_set_message( |
|
178 | + ); |
|
179 | + drupal_set_message( |
|
180 | 180 | t('Invalid response while getting languages for %project.', $variables), |
181 | 181 | 'error' |
182 | - ); |
|
183 | - watchdog( |
|
182 | + ); |
|
183 | + watchdog( |
|
184 | 184 | 'boinctranslate', |
185 | 185 | 'Invalid response while getting languages for %project.', |
186 | 186 | $variables, |
187 | 187 | WATCHDOG_ERROR |
188 | - ); |
|
188 | + ); |
|
189 | 189 | } |
190 | - } |
|
191 | - drupal_goto('admin/boinc/translation'); |
|
190 | + } |
|
191 | + drupal_goto('admin/boinc/translation'); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
195 | 195 | * |
196 | 196 | */ |
197 | 197 | function boinctranslate_export_translations() { |
198 | - require_once(getcwd() . '/includes/locale.inc'); |
|
199 | - $project_name = variable_get( |
|
198 | + require_once(getcwd() . '/includes/locale.inc'); |
|
199 | + $project_name = variable_get( |
|
200 | 200 | 'boinc_translate_transifex_project_name', '' |
201 | - ); |
|
202 | - // Get resource names from local config |
|
203 | - $resource_config = (variable_get( |
|
201 | + ); |
|
202 | + // Get resource names from local config |
|
203 | + $resource_config = (variable_get( |
|
204 | 204 | 'boinc_translate_transifex_project_resources', '' |
205 | - )); |
|
206 | - $resource_names = boinctranslate_parse_resources($resource_config); |
|
207 | - $primary_resource = reset($resource_names); |
|
205 | + )); |
|
206 | + $resource_names = boinctranslate_parse_resources($resource_config); |
|
207 | + $primary_resource = reset($resource_names); |
|
208 | 208 | |
209 | - if ($project_name AND $primary_resource) { |
|
209 | + if ($project_name AND $primary_resource) { |
|
210 | 210 | // Create or update the translation source, if needed |
211 | 211 | $source_exists = FALSE; |
212 | 212 | $path = "project/{$project_name}/resources"; |
213 | 213 | $resources = boinctranslate_transifex_request($path); |
214 | 214 | if ($resources AND is_array($resources)) { |
215 | - foreach ($resources as $resource) { |
|
215 | + foreach ($resources as $resource) { |
|
216 | 216 | if ($resource['slug'] == $primary_resource) { |
217 | - $source_exists = TRUE; |
|
218 | - break; |
|
217 | + $source_exists = TRUE; |
|
218 | + break; |
|
219 | 219 | } |
220 | - } |
|
221 | - if (!$source_exists) { |
|
220 | + } |
|
221 | + if (!$source_exists) { |
|
222 | 222 | // Create the source |
223 | 223 | $path = "project/{$project_name}/resources"; |
224 | 224 | $post = array( |
225 | - 'slug' => $primary_resource, |
|
226 | - 'name' => 'Drupal-Project', |
|
227 | - 'i18n_type' => 'PO', |
|
228 | - 'category' => 'Drupal', |
|
229 | - 'content' => boinctranslate_get_po('en', 'project'), |
|
225 | + 'slug' => $primary_resource, |
|
226 | + 'name' => 'Drupal-Project', |
|
227 | + 'i18n_type' => 'PO', |
|
228 | + 'category' => 'Drupal', |
|
229 | + 'content' => boinctranslate_get_po('en', 'project'), |
|
230 | 230 | ); |
231 | 231 | $result = boinctranslate_transifex_request($path, $post); |
232 | - } |
|
233 | - else { |
|
232 | + } |
|
233 | + else { |
|
234 | 234 | // Update the source |
235 | 235 | $path = "project/{$project_name}/resource/{$primary_resource}/content"; |
236 | 236 | $post = array( |
237 | - 'content' => boinctranslate_get_po('en', 'project') |
|
237 | + 'content' => boinctranslate_get_po('en', 'project') |
|
238 | 238 | ); |
239 | 239 | $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE); |
240 | - } |
|
240 | + } |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | if (is_array($result) OR substr($result, 0, 6) != 'ERROR:') { |
244 | - $enabled_languages = locale_language_list(); |
|
245 | - if ($source_exists) { |
|
244 | + $enabled_languages = locale_language_list(); |
|
245 | + if ($source_exists) { |
|
246 | 246 | drupal_set_message('Updated source translation strings at Transifex'); |
247 | - } |
|
248 | - else { |
|
247 | + } |
|
248 | + else { |
|
249 | 249 | drupal_set_message('Established new translation resource at Transifex'); |
250 | - } |
|
251 | - // Try to export translations for all enabled languages |
|
252 | - foreach ($enabled_languages as $langcode => $language_name) { |
|
250 | + } |
|
251 | + // Try to export translations for all enabled languages |
|
252 | + foreach ($enabled_languages as $langcode => $language_name) { |
|
253 | 253 | if ($langcode == 'en') { |
254 | - continue; |
|
254 | + continue; |
|
255 | 255 | } |
256 | 256 | $po_file = boinctranslate_get_po($langcode, 'project'); |
257 | 257 | if ($po_file) { |
258 | - $path = "project/{$project_name}/resource/{$primary_resource}/translation/{$langcode}"; |
|
259 | - $post = array( |
|
258 | + $path = "project/{$project_name}/resource/{$primary_resource}/translation/{$langcode}"; |
|
259 | + $post = array( |
|
260 | 260 | 'content' => $po_file, |
261 | - ); |
|
262 | - $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE); |
|
263 | - if (!is_array($result) |
|
261 | + ); |
|
262 | + $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE); |
|
263 | + if (!is_array($result) |
|
264 | 264 | AND substr($result, 0, 6) == 'ERROR:') { |
265 | 265 | drupal_set_message( |
266 | - "Unable to update {$language_name} translations: {$result}", |
|
267 | - 'warning' |
|
266 | + "Unable to update {$language_name} translations: {$result}", |
|
267 | + 'warning' |
|
268 | 268 | ); |
269 | - } |
|
270 | - else { |
|
269 | + } |
|
270 | + else { |
|
271 | 271 | drupal_set_message("Updated {$language_name} translations"); |
272 | 272 | //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>'); |
273 | - } |
|
273 | + } |
|
274 | 274 | } |
275 | 275 | else { |
276 | - drupal_set_message("No translations to export for {$language_name}"); |
|
276 | + drupal_set_message("No translations to export for {$language_name}"); |
|
277 | + } |
|
277 | 278 | } |
278 | - } |
|
279 | 279 | } |
280 | 280 | else { |
281 | - drupal_set_message( |
|
281 | + drupal_set_message( |
|
282 | 282 | "Unable to update the translation source: {$result}", |
283 | 283 | 'warning' |
284 | - ); |
|
284 | + ); |
|
285 | 285 | } |
286 | - } |
|
287 | - else { |
|
286 | + } |
|
287 | + else { |
|
288 | 288 | drupal_set_message( |
289 | - 'Failed to export translations: Transifex settings are not intiailized.', |
|
290 | - 'error' |
|
289 | + 'Failed to export translations: Transifex settings are not intiailized.', |
|
290 | + 'error' |
|
291 | 291 | ); |
292 | - } |
|
293 | - drupal_goto('admin/boinc/translation'); |
|
292 | + } |
|
293 | + drupal_goto('admin/boinc/translation'); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
297 | 297 | * |
298 | 298 | */ |
299 | 299 | function boinctranslate_update_official_boinc_translations() { |
300 | - require_once(getcwd() . '/includes/locale.inc'); |
|
301 | - $project_name = variable_get( |
|
300 | + require_once(getcwd() . '/includes/locale.inc'); |
|
301 | + $project_name = variable_get( |
|
302 | 302 | 'boinc_translate_transifex_standard_name', '' |
303 | - ); |
|
304 | - $drupal_resource = variable_get( |
|
303 | + ); |
|
304 | + $drupal_resource = variable_get( |
|
305 | 305 | 'boinc_translate_transifex_boinc_drupal_resource', '' |
306 | - ); |
|
306 | + ); |
|
307 | 307 | |
308 | - if ($project_name AND $drupal_resource) { |
|
308 | + if ($project_name AND $drupal_resource) { |
|
309 | 309 | // Create or update the translation source, if needed |
310 | 310 | $source_exists = FALSE; |
311 | 311 | $path = "project/{$project_name}/resources"; |
312 | 312 | $resources = boinctranslate_transifex_request($path); |
313 | 313 | if ($resources AND is_array($resources)) { |
314 | - foreach ($resources as $resource) { |
|
314 | + foreach ($resources as $resource) { |
|
315 | 315 | if ($resource['slug'] == $drupal_resource) { |
316 | - $source_exists = TRUE; |
|
317 | - break; |
|
316 | + $source_exists = TRUE; |
|
317 | + break; |
|
318 | + } |
|
318 | 319 | } |
319 | - } |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | if ($source_exists) { |
323 | - $enabled_languages = locale_language_list(); |
|
324 | - // Try to export translations for all enabled languages |
|
325 | - foreach ($enabled_languages as $langcode => $language_name) { |
|
323 | + $enabled_languages = locale_language_list(); |
|
324 | + // Try to export translations for all enabled languages |
|
325 | + foreach ($enabled_languages as $langcode => $language_name) { |
|
326 | 326 | if ($langcode == 'en') { |
327 | - continue; |
|
327 | + continue; |
|
328 | 328 | } |
329 | 329 | $po_file = boinctranslate_get_po($langcode, 'boinc'); |
330 | 330 | if ($po_file) { |
331 | - $path = "project/{$project_name}/resource/{$drupal_resource}/translation/{$langcode}"; |
|
332 | - $post = array( |
|
331 | + $path = "project/{$project_name}/resource/{$drupal_resource}/translation/{$langcode}"; |
|
332 | + $post = array( |
|
333 | 333 | 'content' => $po_file, |
334 | - ); |
|
335 | - $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE); |
|
334 | + ); |
|
335 | + $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE); |
|
336 | 336 | |
337 | - if (!is_array($result)) { |
|
337 | + if (!is_array($result)) { |
|
338 | 338 | if (substr($result, 0, 6) == 'ERROR:') { |
339 | - drupal_set_message( |
|
339 | + drupal_set_message( |
|
340 | 340 | "Unable to update {$language_name} official BOINC translations: {$result}", |
341 | 341 | 'warning' |
342 | - ); |
|
342 | + ); |
|
343 | 343 | } |
344 | 344 | elseif ($result == '401 UNAUTHORIZED') { |
345 | - drupal_set_message( |
|
345 | + drupal_set_message( |
|
346 | 346 | 'Not authorized to update official BOINC translations', |
347 | 347 | 'warning' |
348 | - ); |
|
349 | - break; |
|
348 | + ); |
|
349 | + break; |
|
350 | 350 | } |
351 | 351 | elseif ($result == 'success') { |
352 | - drupal_set_message("Updated {$language_name} official BOINC translations"); |
|
352 | + drupal_set_message("Updated {$language_name} official BOINC translations"); |
|
353 | 353 | } |
354 | 354 | else { |
355 | - drupal_set_message( |
|
355 | + drupal_set_message( |
|
356 | 356 | "Unexpected response for {$language_name}: {$result}", |
357 | 357 | 'warning' |
358 | - ); |
|
358 | + ); |
|
359 | 359 | } |
360 | - } |
|
361 | - else { |
|
360 | + } |
|
361 | + else { |
|
362 | 362 | drupal_set_message("Updated {$language_name} official BOINC translations"); |
363 | 363 | //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>'); |
364 | - } |
|
364 | + } |
|
365 | 365 | } |
366 | 366 | else { |
367 | - drupal_set_message("No official BOINC translations to export for {$language_name}"); |
|
367 | + drupal_set_message("No official BOINC translations to export for {$language_name}"); |
|
368 | + } |
|
368 | 369 | } |
369 | - } |
|
370 | 370 | } |
371 | 371 | else { |
372 | - drupal_set_message( |
|
372 | + drupal_set_message( |
|
373 | 373 | "The {$drupal_resource} resource does not exist in the {$project_name} project at Transifex", |
374 | 374 | 'warning' |
375 | - ); |
|
375 | + ); |
|
376 | 376 | } |
377 | - } |
|
378 | - else { |
|
377 | + } |
|
378 | + else { |
|
379 | 379 | drupal_set_message( |
380 | - 'Failed to export official BOINC translations: Transifex settings are not intiailized.', |
|
381 | - 'error' |
|
380 | + 'Failed to export official BOINC translations: Transifex settings are not intiailized.', |
|
381 | + 'error' |
|
382 | 382 | ); |
383 | - } |
|
384 | - drupal_goto('admin/boinc/translation'); |
|
383 | + } |
|
384 | + drupal_goto('admin/boinc/translation'); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
388 | 388 | * |
389 | 389 | */ |
390 | 390 | function boinctranslate_download_pot($type = 'boinc') { |
391 | - $po = boinctranslate_get_po(NULL, $type); |
|
392 | - _locale_export_po(NULL, $po); |
|
391 | + $po = boinctranslate_get_po(NULL, $type); |
|
392 | + _locale_export_po(NULL, $po); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
396 | 396 | * |
397 | 397 | */ |
398 | 398 | function boinctranslate_transifex_request($path, $post = NULL, $json = TRUE, $use_put = FALSE, $username = '', $password = '') { |
399 | - $debug_mode = variable_get('boinc_debug_mode', 0); |
|
399 | + $debug_mode = variable_get('boinc_debug_mode', 0); |
|
400 | 400 | |
401 | - // Transifex details |
|
402 | - $api_base_url = 'https://www.transifex.com/api/2'; |
|
403 | - if (!$username) $username = variable_get('boinc_translate_transifex_user', ''); |
|
404 | - if (!$password) $password = variable_get('boinc_translate_transifex_pass', ''); |
|
401 | + // Transifex details |
|
402 | + $api_base_url = 'https://www.transifex.com/api/2'; |
|
403 | + if (!$username) $username = variable_get('boinc_translate_transifex_user', ''); |
|
404 | + if (!$password) $password = variable_get('boinc_translate_transifex_pass', ''); |
|
405 | 405 | |
406 | - $url = "{$api_base_url}/{$path}"; |
|
407 | - $headers = array( |
|
406 | + $url = "{$api_base_url}/{$path}"; |
|
407 | + $headers = array( |
|
408 | 408 | 'Authorization' => 'Basic ' . base64_encode($username . ":" . $password), |
409 | - ); |
|
410 | - $data = NULL; |
|
409 | + ); |
|
410 | + $data = NULL; |
|
411 | 411 | |
412 | - if ($post) { |
|
412 | + if ($post) { |
|
413 | 413 | if ($json) { |
414 | - $headers['Content-Type'] = 'application/json'; |
|
415 | - $data = json_encode($post); |
|
414 | + $headers['Content-Type'] = 'application/json'; |
|
415 | + $data = json_encode($post); |
|
416 | 416 | } |
417 | 417 | else { |
418 | - $data = drupal_query_string_encode($post); |
|
418 | + $data = drupal_query_string_encode($post); |
|
419 | 419 | } |
420 | 420 | $method = ($use_put) ? 'PUT' : 'POST'; |
421 | - } |
|
422 | - else { |
|
421 | + } |
|
422 | + else { |
|
423 | 423 | $method = 'GET'; |
424 | - } |
|
424 | + } |
|
425 | 425 | |
426 | - $response = drupal_http_request($url, $headers, $method, $data, 1, 10); |
|
426 | + $response = drupal_http_request($url, $headers, $method, $data, 1, 10); |
|
427 | 427 | |
428 | - switch ($response->code) { |
|
429 | - case 200: |
|
428 | + switch ($response->code) { |
|
429 | + case 200: |
|
430 | 430 | case 304: |
431 | 431 | if ($json) { |
432 | - // Process as JSON |
|
433 | - return json_decode($response->data, TRUE); |
|
432 | + // Process as JSON |
|
433 | + return json_decode($response->data, TRUE); |
|
434 | 434 | } |
435 | 435 | else { |
436 | - return (string) $response->data; |
|
436 | + return (string) $response->data; |
|
437 | 437 | } |
438 | 438 | break; |
439 | - case 404: |
|
439 | + case 404: |
|
440 | 440 | return '404 NOT FOUND'; |
441 | - case 401: |
|
441 | + case 401: |
|
442 | 442 | return '401 UNAUTHORIZED'; |
443 | - case 400: |
|
443 | + case 400: |
|
444 | 444 | if ($debug_mode) watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING); |
445 | 445 | return "ERROR: {$response->data}"; |
446 | - case 405: |
|
446 | + case 405: |
|
447 | 447 | if ($debug_mode) watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING); |
448 | 448 | return "ERROR: User not allowed to perform this action"; |
449 | - } |
|
449 | + } |
|
450 | 450 | |
451 | - return NULL; |
|
451 | + return NULL; |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | /** |
@@ -456,58 +456,58 @@ discard block |
||
456 | 456 | */ |
457 | 457 | function boinctranslate_get_po($langcode, $type = 'standard') { |
458 | 458 | |
459 | - require_once(getcwd() . '/includes/locale.inc'); |
|
459 | + require_once(getcwd() . '/includes/locale.inc'); |
|
460 | 460 | |
461 | - $all_languages = language_list(); |
|
462 | - $language = $langcode ? $all_languages[$langcode] : NULL; |
|
463 | - $textgroups = array(); |
|
464 | - $strings = array(); |
|
461 | + $all_languages = language_list(); |
|
462 | + $language = $langcode ? $all_languages[$langcode] : NULL; |
|
463 | + $textgroups = array(); |
|
464 | + $strings = array(); |
|
465 | 465 | |
466 | - switch ($type) { |
|
467 | - case 'standard': |
|
466 | + switch ($type) { |
|
467 | + case 'standard': |
|
468 | 468 | $textgroups = array( |
469 | - 'default', |
|
470 | - 'taxonomy', |
|
471 | - 'views', |
|
469 | + 'default', |
|
470 | + 'taxonomy', |
|
471 | + 'views', |
|
472 | 472 | ); |
473 | 473 | break; |
474 | - case 'boinc': |
|
474 | + case 'boinc': |
|
475 | 475 | $textgroups = array( |
476 | - 'boinc', |
|
476 | + 'boinc', |
|
477 | 477 | ); |
478 | 478 | break; |
479 | - case 'project': |
|
479 | + case 'project': |
|
480 | 480 | $textgroups = array( |
481 | - 'blocks', |
|
482 | - 'menu', |
|
483 | - 'project', |
|
481 | + 'blocks', |
|
482 | + 'menu', |
|
483 | + 'project', |
|
484 | 484 | ); |
485 | 485 | break; |
486 | - default: |
|
486 | + default: |
|
487 | 487 | } |
488 | 488 | |
489 | - // Merge textgroup strings together for export as one file |
|
490 | - foreach ($textgroups as $textgroup) { |
|
489 | + // Merge textgroup strings together for export as one file |
|
490 | + foreach ($textgroups as $textgroup) { |
|
491 | 491 | $strings += _locale_export_get_strings($language, $textgroup); |
492 | - } |
|
493 | - ksort($strings); |
|
494 | - foreach ($strings as $id => $string) { |
|
492 | + } |
|
493 | + ksort($strings); |
|
494 | + foreach ($strings as $id => $string) { |
|
495 | 495 | // Set the string context |
496 | 496 | $strings[$id]['context'] = trim($string['comment']); |
497 | - } |
|
498 | - if ($langcode AND $langcode != 'en') { |
|
497 | + } |
|
498 | + if ($langcode AND $langcode != 'en') { |
|
499 | 499 | // If not the source language, remove untranslated strings from the ouput |
500 | 500 | foreach ($strings as $i => $string) { |
501 | - if (!$string['translation']) { |
|
501 | + if (!$string['translation']) { |
|
502 | 502 | unset($strings[$i]); |
503 | - } |
|
503 | + } |
|
504 | 504 | } |
505 | - } |
|
506 | - if ($strings) { |
|
505 | + } |
|
506 | + if ($strings) { |
|
507 | 507 | return boinctranslate_export_po_generate($language, $strings, NULL, $type); |
508 | - } |
|
508 | + } |
|
509 | 509 | |
510 | - return NULL; |
|
510 | + return NULL; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -515,21 +515,21 @@ discard block |
||
515 | 515 | */ |
516 | 516 | function boinctranslate_export_po_generate($language = NULL, $strings = array(), $header = NULL, $type = NULL) { |
517 | 517 | |
518 | - require_once(getcwd() . '/includes/locale.inc'); |
|
519 | - global $user; |
|
518 | + require_once(getcwd() . '/includes/locale.inc'); |
|
519 | + global $user; |
|
520 | 520 | |
521 | - // unset $language to indicate template creation |
|
522 | - if (isset($language) && $language->language == "en") { |
|
521 | + // unset $language to indicate template creation |
|
522 | + if (isset($language) && $language->language == "en") { |
|
523 | 523 | $language = NULL; |
524 | - } |
|
524 | + } |
|
525 | 525 | |
526 | - if (!isset($header)) { |
|
526 | + if (!isset($header)) { |
|
527 | 527 | if (isset($type) && $type == "project") { |
528 | - $header = "# ".variable_get('site_name', 'Drupal-BOINC')." drupal localization template\n"; |
|
529 | - $header .= "# Copyright (C) ".date("Y")." ".variable_get('site_name', 'Drupal-BOINC')."\n"; |
|
528 | + $header = "# ".variable_get('site_name', 'Drupal-BOINC')." drupal localization template\n"; |
|
529 | + $header .= "# Copyright (C) ".date("Y")." ".variable_get('site_name', 'Drupal-BOINC')."\n"; |
|
530 | 530 | } else { |
531 | - $header = "# BOINC drupal localization template\n"; |
|
532 | - $header .= "# Copyright (C) ".date("Y")." University of California\n"; |
|
531 | + $header = "# BOINC drupal localization template\n"; |
|
532 | + $header .= "# Copyright (C) ".date("Y")." University of California\n"; |
|
533 | 533 | } |
534 | 534 | $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n"; |
535 | 535 | $header .= "#\n"; |
@@ -538,201 +538,201 @@ discard block |
||
538 | 538 | $header .= "msgid \"\"\n"; |
539 | 539 | $header .= "msgstr \"\"\n"; |
540 | 540 | if (isset($type) && $type == "project") { |
541 | - $header .= "\"Project-Id-Version: ".variable_get('site_name', 'Drupal-BOINC')." ".date("Y-m-d-H:iO")."\\n\"\n"; |
|
541 | + $header .= "\"Project-Id-Version: ".variable_get('site_name', 'Drupal-BOINC')." ".date("Y-m-d-H:iO")."\\n\"\n"; |
|
542 | 542 | } else { |
543 | - $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here |
|
543 | + $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here |
|
544 | 544 | } |
545 | 545 | $header .= "\"Report-Msgid-Bugs-To: BOINC translation team <[email protected]>\\n\"\n"; |
546 | 546 | $header .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; |
547 | 547 | if (isset($language)) { |
548 | - $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; |
|
548 | + $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; |
|
549 | 549 | } |
550 | 550 | $header .= "\"Last-Translator: Generated automatically from Drupal translate interface\\n\"\n"; |
551 | 551 | $header .= "\"MIME-Version: 1.0\\n\"\n"; |
552 | 552 | $header .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n"; |
553 | 553 | $header .= "\"Content-Transfer-Encoding: 8bit\\n\"\n"; |
554 | 554 | if (isset($language)) { |
555 | - $header .= "\"Language: ".$language->language."\\n\""; |
|
556 | - if ($language->formula && $language->plurals) { |
|
555 | + $header .= "\"Language: ".$language->language."\\n\""; |
|
556 | + if ($language->formula && $language->plurals) { |
|
557 | 557 | $header .= "\"Plural-Forms: nplurals=" . $language->plurals . "; plural=" . strtr($language->formula, array('$' => '')) . ";\\n\"\n"; |
558 | - } |
|
558 | + } |
|
559 | 559 | } |
560 | 560 | $header .= "\"X-Poedit-SourceCharset: utf-8\\n\"\n"; |
561 | - } |
|
561 | + } |
|
562 | 562 | |
563 | - $output = $header . "\n"; |
|
563 | + $output = $header . "\n"; |
|
564 | 564 | |
565 | - foreach ($strings as $lid => $string) { |
|
565 | + foreach ($strings as $lid => $string) { |
|
566 | 566 | // Only process non-children, children are output below their parent. |
567 | 567 | if (!isset($string['child'])) { |
568 | - if ($string['comment']) { |
|
568 | + if ($string['comment']) { |
|
569 | 569 | $output .= '#: ' . $string['comment'] . "\n"; |
570 | - } |
|
571 | - if ($string['context']) { |
|
570 | + } |
|
571 | + if ($string['context']) { |
|
572 | 572 | $output .= 'msgctxt "' . $string['context'] . "\"\n"; |
573 | - } |
|
574 | - $output .= 'msgid ' . _locale_export_string($string['source']); |
|
575 | - if (!empty($string['plural'])) { |
|
573 | + } |
|
574 | + $output .= 'msgid ' . _locale_export_string($string['source']); |
|
575 | + if (!empty($string['plural'])) { |
|
576 | 576 | $plural = $string['plural']; |
577 | 577 | $output .= 'msgid_plural ' . _locale_export_string($strings[$plural]['source']); |
578 | 578 | if (isset($language)) { |
579 | - $translation = $string['translation']; |
|
580 | - for ($i = 0; $i < $language->plurals; $i++) { |
|
579 | + $translation = $string['translation']; |
|
580 | + for ($i = 0; $i < $language->plurals; $i++) { |
|
581 | 581 | $output .= 'msgstr[' . $i . '] ' . _locale_export_string($translation); |
582 | 582 | if ($plural) { |
583 | - $translation = _locale_export_remove_plural($strings[$plural]['translation']); |
|
584 | - $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0; |
|
583 | + $translation = _locale_export_remove_plural($strings[$plural]['translation']); |
|
584 | + $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0; |
|
585 | 585 | } |
586 | 586 | else { |
587 | - $translation = ''; |
|
587 | + $translation = ''; |
|
588 | + } |
|
588 | 589 | } |
589 | - } |
|
590 | 590 | } |
591 | 591 | else { |
592 | - $output .= 'msgstr[0] ""' . "\n"; |
|
593 | - $output .= 'msgstr[1] ""' . "\n"; |
|
592 | + $output .= 'msgstr[0] ""' . "\n"; |
|
593 | + $output .= 'msgstr[1] ""' . "\n"; |
|
594 | + } |
|
594 | 595 | } |
595 | - } |
|
596 | - else { |
|
596 | + else { |
|
597 | 597 | $output .= 'msgstr ' . _locale_export_string($string['translation']); |
598 | - } |
|
599 | - $output .= "\n"; |
|
598 | + } |
|
599 | + $output .= "\n"; |
|
600 | 600 | } |
601 | - } |
|
602 | - return $output; |
|
601 | + } |
|
602 | + return $output; |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
606 | 606 | * |
607 | 607 | */ |
608 | 608 | function boinctranslate_refresh_translations() { |
609 | - require_once(getcwd() . '/includes/locale.inc'); |
|
610 | - $errors = array(); |
|
611 | - $languages = locale_language_list(); |
|
612 | - $translation_resources = array(); |
|
613 | - $operations = array(); |
|
614 | - $debug_mode = variable_get('boinc_debug_mode', 0); |
|
615 | - |
|
616 | - $boinc_name = variable_get( |
|
609 | + require_once(getcwd() . '/includes/locale.inc'); |
|
610 | + $errors = array(); |
|
611 | + $languages = locale_language_list(); |
|
612 | + $translation_resources = array(); |
|
613 | + $operations = array(); |
|
614 | + $debug_mode = variable_get('boinc_debug_mode', 0); |
|
615 | + |
|
616 | + $boinc_name = variable_get( |
|
617 | 617 | 'boinc_translate_transifex_standard_name', '' |
618 | - ); |
|
619 | - $boinc_resources = boinctranslate_parse_resources( |
|
618 | + ); |
|
619 | + $boinc_resources = boinctranslate_parse_resources( |
|
620 | 620 | variable_get('boinc_translate_transifex_standard_resources', array()) |
621 | - ); |
|
622 | - // Add the Official BOINC resource to the list of BOINC resources; |
|
623 | - // The official resource overrides any additional resources provided, so it |
|
624 | - // should be added to the end so as to be processed last |
|
625 | - $drupal_resource = variable_get( |
|
621 | + ); |
|
622 | + // Add the Official BOINC resource to the list of BOINC resources; |
|
623 | + // The official resource overrides any additional resources provided, so it |
|
624 | + // should be added to the end so as to be processed last |
|
625 | + $drupal_resource = variable_get( |
|
626 | 626 | 'boinc_translate_transifex_boinc_drupal_resource', '' |
627 | - ); |
|
628 | - $boinc_resources[] = $drupal_resource; |
|
629 | - if ($boinc_name AND $boinc_resources) { |
|
627 | + ); |
|
628 | + $boinc_resources[] = $drupal_resource; |
|
629 | + if ($boinc_name AND $boinc_resources) { |
|
630 | 630 | $translation_resources[$boinc_name] = array( |
631 | - 'resources' => $boinc_resources, |
|
632 | - 'textgroups' => array( |
|
631 | + 'resources' => $boinc_resources, |
|
632 | + 'textgroups' => array( |
|
633 | 633 | 'boinc', |
634 | 634 | 'default', |
635 | 635 | 'taxonomy', |
636 | 636 | 'views', |
637 | - ), |
|
637 | + ), |
|
638 | 638 | ); |
639 | - } |
|
640 | - $project_name = variable_get( |
|
639 | + } |
|
640 | + $project_name = variable_get( |
|
641 | 641 | 'boinc_translate_transifex_project_name', '' |
642 | - ); |
|
643 | - $project_resources = boinctranslate_parse_resources( |
|
642 | + ); |
|
643 | + $project_resources = boinctranslate_parse_resources( |
|
644 | 644 | variable_get('boinc_translate_transifex_project_resources', array()) |
645 | - ); |
|
646 | - if ($project_name AND $project_resources) { |
|
645 | + ); |
|
646 | + if ($project_name AND $project_resources) { |
|
647 | 647 | $translation_resources[$project_name] = array( |
648 | - 'resources' => $project_resources, |
|
649 | - 'textgroups' => array( |
|
648 | + 'resources' => $project_resources, |
|
649 | + 'textgroups' => array( |
|
650 | 650 | 'blocks', |
651 | 651 | 'menu', |
652 | 652 | 'project', |
653 | - ), |
|
653 | + ), |
|
654 | 654 | ); |
655 | 655 | // Be sure any strings from the override file are added to the boinc group |
656 | 656 | $override_file = './' . drupal_get_path('module', 'boinctranslate') . '/includes/other-boinc-translation-strings.txt'; |
657 | 657 | $other_strings = file($override_file); |
658 | 658 | if ($other_strings) { |
659 | - foreach ($other_strings as $string) { |
|
659 | + foreach ($other_strings as $string) { |
|
660 | 660 | $string = trim($string); |
661 | 661 | if ($string) { |
662 | - // Ignore lines starting with '#' i.e., comments. |
|
663 | - if ($string[0] === "#") |
|
662 | + // Ignore lines starting with '#' i.e., comments. |
|
663 | + if ($string[0] === "#") |
|
664 | 664 | continue; |
665 | 665 | |
666 | - // Use '|' as delimiter to split string and context info. |
|
667 | - $line = explode("|", $string); |
|
668 | - if ($line) { |
|
666 | + // Use '|' as delimiter to split string and context info. |
|
667 | + $line = explode("|", $string); |
|
668 | + if ($line) { |
|
669 | 669 | if (count($line)==1) { |
670 | - $tl0 = trim($line[0]); |
|
671 | - if ($tl0) { |
|
670 | + $tl0 = trim($line[0]); |
|
671 | + if ($tl0) { |
|
672 | 672 | bts($tl0); |
673 | - } |
|
673 | + } |
|
674 | 674 | } |
675 | 675 | elseif (count($line)>1) { |
676 | - $tl0 = trim($line[0]); |
|
677 | - $tl1 = trim($line[1]); |
|
678 | - if ($tl0 and $tl1) { |
|
676 | + $tl0 = trim($line[0]); |
|
677 | + $tl1 = trim($line[1]); |
|
678 | + if ($tl0 and $tl1) { |
|
679 | 679 | bts($tl0, array(), NULL, $tl1); |
680 | - } |
|
680 | + } |
|
681 | 681 | } |
682 | - }// if ($line) |
|
682 | + }// if ($line) |
|
683 | 683 | |
684 | 684 | }// if ($string) |
685 | - }// foreach |
|
685 | + }// foreach |
|
686 | 686 | }// if ($other_strings) |
687 | - } |
|
687 | + } |
|
688 | 688 | |
689 | - foreach ($languages as $langcode => $language) { |
|
689 | + foreach ($languages as $langcode => $language) { |
|
690 | 690 | if ($langcode == 'en') { |
691 | - continue; |
|
691 | + continue; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | $import_stats = array( |
695 | - 'new' => 0, |
|
696 | - 'updated' => 0, |
|
697 | - 'deleted' => 0, |
|
698 | - 'skipped' => 0, |
|
695 | + 'new' => 0, |
|
696 | + 'updated' => 0, |
|
697 | + 'deleted' => 0, |
|
698 | + 'skipped' => 0, |
|
699 | 699 | ); |
700 | 700 | |
701 | 701 | foreach ($translation_resources as $project => $translation) { |
702 | - foreach ($translation['resources'] as $resource) { |
|
702 | + foreach ($translation['resources'] as $resource) { |
|
703 | 703 | |
704 | 704 | // Add this language to the batch operations |
705 | 705 | $operations[] = array( |
706 | - 'boinctranslate_refresh_translations_op', |
|
707 | - array( |
|
706 | + 'boinctranslate_refresh_translations_op', |
|
707 | + array( |
|
708 | 708 | $project, $resource, $langcode, $language, $translation['textgroups'], $debug_mode |
709 | - ), |
|
709 | + ), |
|
710 | 710 | ); |
711 | - } |
|
711 | + } |
|
712 | 712 | } |
713 | 713 | if ($batch = locale_batch_by_language($langcode)) { |
714 | - foreach ($batch['operations'] as $op) { |
|
714 | + foreach ($batch['operations'] as $op) { |
|
715 | 715 | $operations[] = array( |
716 | - 'boinctranslate_refresh_translations_op', |
|
717 | - array( |
|
716 | + 'boinctranslate_refresh_translations_op', |
|
717 | + array( |
|
718 | 718 | NULL, $op[1][0], $langcode, $language, array('default'), $debug_mode |
719 | - ), |
|
719 | + ), |
|
720 | 720 | ); |
721 | - } |
|
721 | + } |
|
722 | + } |
|
722 | 723 | } |
723 | - } |
|
724 | 724 | |
725 | - $batch = array( |
|
725 | + $batch = array( |
|
726 | 726 | 'operations' => $operations, |
727 | 727 | 'finished' => 'boinctranslate_refresh_translations_finished', |
728 | 728 | 'title' => t('Importing translations'), |
729 | 729 | 'init_message' => t('Beginning translation import...'), |
730 | 730 | 'progress_message' => t('Applied @current out of @total translation updates.'), |
731 | 731 | 'error_message' => t('Translation import has encountered an error.'), |
732 | - ); |
|
732 | + ); |
|
733 | 733 | |
734 | - batch_set($batch); |
|
735 | - batch_process(); |
|
734 | + batch_set($batch); |
|
735 | + batch_process(); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -741,18 +741,18 @@ discard block |
||
741 | 741 | */ |
742 | 742 | function boinctranslate_refresh_translations_op($project, $resource, $langcode, $language, $textgroups, $debug_mode, &$context) { |
743 | 743 | |
744 | - require_once(getcwd() . '/includes/locale.inc'); |
|
744 | + require_once(getcwd() . '/includes/locale.inc'); |
|
745 | 745 | |
746 | - if ($debug_mode) { |
|
746 | + if ($debug_mode) { |
|
747 | 747 | watchdog( |
748 | - 'boinctranslate', |
|
749 | - 'Checking for @language updates in @project:@resource', |
|
750 | - array('@language' => $language, '@project' => $project, '@resource' => $resource), |
|
751 | - WATCHDOG_INFO |
|
748 | + 'boinctranslate', |
|
749 | + 'Checking for @language updates in @project:@resource', |
|
750 | + array('@language' => $language, '@project' => $project, '@resource' => $resource), |
|
751 | + WATCHDOG_INFO |
|
752 | 752 | ); |
753 | - } |
|
753 | + } |
|
754 | 754 | |
755 | - if ($project) { |
|
755 | + if ($project) { |
|
756 | 756 | // Import the configured resources |
757 | 757 | $success = FALSE; |
758 | 758 | $message = ''; |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | $response = boinctranslate_transifex_request($path); |
761 | 761 | |
762 | 762 | if ($response == '404 NOT FOUND') { |
763 | - $message = "Project resource {$project}:{$resource} not found in {$language}."; |
|
763 | + $message = "Project resource {$project}:{$resource} not found in {$language}."; |
|
764 | 764 | } |
765 | 765 | elseif ($response) { |
766 | - if (!empty($response['content'])) { |
|
766 | + if (!empty($response['content'])) { |
|
767 | 767 | $po_text = $response['content']; |
768 | 768 | |
769 | 769 | // Write the translation file to a temporary location |
@@ -771,163 +771,163 @@ discard block |
||
771 | 771 | $file->filepath = file_save_data($po_text, NULL); |
772 | 772 | $file->filename = basename($file->filepath); |
773 | 773 | if (!$file->filepath) { |
774 | - $message = 'Unable to create temporary file in ' |
|
774 | + $message = 'Unable to create temporary file in ' |
|
775 | 775 | . file_directory_temp() . " for {$language} translation " |
776 | 776 | . "resource {$project}:{$resource}"; |
777 | 777 | } |
778 | 778 | |
779 | 779 | foreach ($textgroups as $textgroup) { |
780 | - // Import the translations from the file to each related textgroup |
|
781 | - if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) { |
|
780 | + // Import the translations from the file to each related textgroup |
|
781 | + if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) { |
|
782 | 782 | $message = "The {$language} translation import of" |
783 | - . " {$project}:{$resource} failed."; |
|
783 | + . " {$project}:{$resource} failed."; |
|
784 | 784 | $success = FALSE; |
785 | 785 | break; |
786 | - } |
|
787 | - else { |
|
786 | + } |
|
787 | + else { |
|
788 | 788 | $success = TRUE; |
789 | - } |
|
789 | + } |
|
790 | + } |
|
790 | 791 | } |
791 | - } |
|
792 | - else { |
|
792 | + else { |
|
793 | 793 | $message = "Unable to read response for {$language} translation import" |
794 | - . " of {$project}:{$resource}."; |
|
795 | - } |
|
794 | + . " of {$project}:{$resource}."; |
|
795 | + } |
|
796 | 796 | } |
797 | 797 | else { |
798 | - $message = "Translation data not found in response for {$language}" |
|
798 | + $message = "Translation data not found in response for {$language}" |
|
799 | 799 | . " translation import of {$project}:{$resource}."; |
800 | 800 | } |
801 | - } |
|
802 | - else { |
|
801 | + } |
|
802 | + else { |
|
803 | 803 | // If project isn't specified, import as a local Drupal resource |
804 | 804 | $project = 'drupal.local'; |
805 | 805 | $file = new stdClass(); |
806 | 806 | $file->filepath = $resource; |
807 | 807 | $file->filename = basename($file->filepath); |
808 | 808 | if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) { |
809 | - $message = "The {$language} translation import of" |
|
809 | + $message = "The {$language} translation import of" |
|
810 | 810 | . " local file {$resource} failed."; |
811 | - $success = FALSE; |
|
811 | + $success = FALSE; |
|
812 | 812 | } |
813 | 813 | else { |
814 | - $success = TRUE; |
|
814 | + $success = TRUE; |
|
815 | + } |
|
815 | 816 | } |
816 | - } |
|
817 | 817 | |
818 | - if ($success) { |
|
818 | + if ($success) { |
|
819 | 819 | // Store some result for post-processing in the finished callback. |
820 | 820 | $context['results']['success'][] = "{$langcode}:{$textgroup}"; |
821 | 821 | $message = "Imported {$language} translations in {$project}:{$resource} ({$results['new']} added, {$results['updated']} refreshed, {$results['deleted']} removed)"; |
822 | 822 | |
823 | 823 | if ($debug_mode) { |
824 | - watchdog( |
|
824 | + watchdog( |
|
825 | 825 | 'boinctranslate', |
826 | 826 | $message, |
827 | 827 | array(), |
828 | 828 | WATCHDOG_INFO |
829 | - ); |
|
829 | + ); |
|
830 | 830 | } |
831 | - } |
|
832 | - else { |
|
831 | + } |
|
832 | + else { |
|
833 | 833 | $context['results']['failure'][] = "{$langcode}:{$textgroup}"; |
834 | 834 | watchdog( |
835 | - 'boinctranslate', |
|
836 | - $message, |
|
837 | - array(), |
|
838 | - WATCHDOG_WARNING |
|
835 | + 'boinctranslate', |
|
836 | + $message, |
|
837 | + array(), |
|
838 | + WATCHDOG_WARNING |
|
839 | 839 | ); |
840 | - } |
|
840 | + } |
|
841 | 841 | |
842 | - // Update our progress information. |
|
843 | - $context['sandbox']['progress']++; |
|
844 | - $context['sandbox']['language'] = $langcode; |
|
845 | - $context['message'] = $message; |
|
842 | + // Update our progress information. |
|
843 | + $context['sandbox']['progress']++; |
|
844 | + $context['sandbox']['language'] = $langcode; |
|
845 | + $context['message'] = $message; |
|
846 | 846 | |
847 | - // Update the progress for the batch engine |
|
848 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
847 | + // Update the progress for the batch engine |
|
848 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
849 | 849 | $context['finished'] = 1; |
850 | - } |
|
851 | - else { |
|
850 | + } |
|
851 | + else { |
|
852 | 852 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
853 | - } |
|
853 | + } |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | /** |
857 | 857 | * Batch 'finished' callback |
858 | 858 | */ |
859 | 859 | function boinctranslate_refresh_translations_finished($success, $results, $operations) { |
860 | - if ($success) { |
|
860 | + if ($success) { |
|
861 | 861 | // Let's count our successes |
862 | 862 | $count = count($results['success']); |
863 | 863 | $message = "Successfully completed {$count} import operations"; |
864 | 864 | watchdog( |
865 | - 'boinctranslate', |
|
866 | - 'Successfully completed @count import operations.', |
|
867 | - array('@count' => $count), |
|
868 | - WATCHDOG_INFO |
|
865 | + 'boinctranslate', |
|
866 | + 'Successfully completed @count import operations.', |
|
867 | + array('@count' => $count), |
|
868 | + WATCHDOG_INFO |
|
869 | 869 | ); |
870 | - } |
|
871 | - else { |
|
870 | + } |
|
871 | + else { |
|
872 | 872 | // An error occurred. |
873 | 873 | // $operations contains the operations that remained unprocessed. |
874 | 874 | $error_operation = reset($operations); |
875 | 875 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
876 | 876 | watchdog( |
877 | - 'boinctranslate', |
|
878 | - $message, |
|
879 | - array(), |
|
880 | - WATCHDOG_WARNING |
|
877 | + 'boinctranslate', |
|
878 | + $message, |
|
879 | + array(), |
|
880 | + WATCHDOG_WARNING |
|
881 | 881 | ); |
882 | - } |
|
883 | - drupal_set_message($message); |
|
884 | - drupal_goto('admin/boinc/translation'); |
|
882 | + } |
|
883 | + drupal_set_message($message); |
|
884 | + drupal_goto('admin/boinc/translation'); |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | /** |
888 | 888 | * |
889 | 889 | */ |
890 | 890 | function _boinctranslate_locale_import_po($file, $langcode, $mode, $group = NULL) { |
891 | - // Try to allocate enough time to parse and import the data. |
|
892 | - if (function_exists('set_time_limit')) { |
|
891 | + // Try to allocate enough time to parse and import the data. |
|
892 | + if (function_exists('set_time_limit')) { |
|
893 | 893 | @set_time_limit(240); |
894 | - } |
|
894 | + } |
|
895 | 895 | |
896 | - require_once(getcwd() . '/includes/locale.inc'); |
|
896 | + require_once(getcwd() . '/includes/locale.inc'); |
|
897 | 897 | |
898 | - // Check if we have the language already in the database. |
|
899 | - if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) { |
|
898 | + // Check if we have the language already in the database. |
|
899 | + if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) { |
|
900 | 900 | drupal_set_message(t('The language selected for import is not supported.'), 'error'); |
901 | 901 | return FALSE; |
902 | - } |
|
902 | + } |
|
903 | 903 | |
904 | - // Get strings from file (returns on failure after a partial import, or on success) |
|
905 | - $status = _boinctranslate_locale_import_read_po('db-store', $file, $mode, $langcode, $group); |
|
906 | - if ($status === FALSE) { |
|
904 | + // Get strings from file (returns on failure after a partial import, or on success) |
|
905 | + $status = _boinctranslate_locale_import_read_po('db-store', $file, $mode, $langcode, $group); |
|
906 | + if ($status === FALSE) { |
|
907 | 907 | // Error messages are set in _locale_import_read_po(). |
908 | 908 | return FALSE; |
909 | - } |
|
909 | + } |
|
910 | 910 | |
911 | - // Get status information on import process. |
|
912 | - list($headerdone, $additions, $updates, $deletes, $skips) = _boinctranslate_locale_import_one_string('db-report'); |
|
911 | + // Get status information on import process. |
|
912 | + list($headerdone, $additions, $updates, $deletes, $skips) = _boinctranslate_locale_import_one_string('db-report'); |
|
913 | 913 | |
914 | - if (!$headerdone) { |
|
914 | + if (!$headerdone) { |
|
915 | 915 | drupal_set_message(t('The translation file %filename appears to have a missing or malformed header.', array('%filename' => $file->filename)), 'error'); |
916 | - } |
|
916 | + } |
|
917 | 917 | |
918 | - // Clear cache and force refresh of JavaScript translations. |
|
919 | - _locale_invalidate_js($langcode); |
|
920 | - cache_clear_all('locale:', 'cache', TRUE); |
|
918 | + // Clear cache and force refresh of JavaScript translations. |
|
919 | + _locale_invalidate_js($langcode); |
|
920 | + cache_clear_all('locale:', 'cache', TRUE); |
|
921 | 921 | |
922 | - // Rebuild the menu, strings may have changed. |
|
923 | - menu_rebuild(); |
|
922 | + // Rebuild the menu, strings may have changed. |
|
923 | + menu_rebuild(); |
|
924 | 924 | |
925 | - return array( |
|
925 | + return array( |
|
926 | 926 | 'new' => $additions, |
927 | 927 | 'updated' => $updates, |
928 | 928 | 'deleted' => $deletes, |
929 | 929 | 'skipped' => $skips, |
930 | - ); |
|
930 | + ); |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | /** |
@@ -935,253 +935,253 @@ discard block |
||
935 | 935 | */ |
936 | 936 | function _boinctranslate_locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') { |
937 | 937 | |
938 | - require_once(getcwd() . '/includes/locale.inc'); |
|
938 | + require_once(getcwd() . '/includes/locale.inc'); |
|
939 | 939 | |
940 | - $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return |
|
941 | - if (!$fd) { |
|
940 | + $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return |
|
941 | + if (!$fd) { |
|
942 | 942 | watchdog( |
943 | - 'boinctranslate', |
|
944 | - 'The translation import for %lang failed, because %filename could not be read.', |
|
945 | - array('%lang' => $lang, '%filename' => $file->filename), |
|
946 | - WATCHDOG_WARNING |
|
943 | + 'boinctranslate', |
|
944 | + 'The translation import for %lang failed, because %filename could not be read.', |
|
945 | + array('%lang' => $lang, '%filename' => $file->filename), |
|
946 | + WATCHDOG_WARNING |
|
947 | 947 | ); |
948 | 948 | _locale_import_message('The translation import failed, because the file %filename could not be read.', $file); |
949 | 949 | return FALSE; |
950 | - } |
|
950 | + } |
|
951 | 951 | |
952 | - $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR |
|
953 | - $current = array(); // Current entry being read |
|
954 | - $plural = 0; // Current plural form |
|
955 | - $lineno = 0; // Current line |
|
952 | + $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR |
|
953 | + $current = array(); // Current entry being read |
|
954 | + $plural = 0; // Current plural form |
|
955 | + $lineno = 0; // Current line |
|
956 | 956 | |
957 | - while (!feof($fd)) { |
|
957 | + while (!feof($fd)) { |
|
958 | 958 | $line = fgets($fd, 10 * 1024); // A line should not be this long |
959 | 959 | if ($lineno == 0) { |
960 | - // The first line might come with a UTF-8 BOM, which should be removed. |
|
961 | - $line = str_replace("\xEF\xBB\xBF", '', $line); |
|
960 | + // The first line might come with a UTF-8 BOM, which should be removed. |
|
961 | + $line = str_replace("\xEF\xBB\xBF", '', $line); |
|
962 | 962 | } |
963 | 963 | $lineno++; |
964 | 964 | $line = trim(strtr($line, array("\\\n" => ""))); |
965 | 965 | |
966 | 966 | if (!strncmp("#", $line, 1)) { // A comment |
967 | - if ($context == "COMMENT") { // Already in comment context: add |
|
967 | + if ($context == "COMMENT") { // Already in comment context: add |
|
968 | 968 | $current["#"][] = substr($line, 1); |
969 | - } |
|
970 | - elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
969 | + } |
|
970 | + elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
971 | 971 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
972 | 972 | $current = array(); |
973 | 973 | $current["#"][] = substr($line, 1); |
974 | 974 | $context = "COMMENT"; |
975 | - } |
|
976 | - else { // Parse error |
|
975 | + } |
|
976 | + else { // Parse error |
|
977 | 977 | watchdog( |
978 | - 'boinctranslate', |
|
979 | - 'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.', |
|
980 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
981 | - WATCHDOG_WARNING |
|
978 | + 'boinctranslate', |
|
979 | + 'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.', |
|
980 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
981 | + WATCHDOG_WARNING |
|
982 | 982 | ); |
983 | 983 | _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno); |
984 | 984 | return FALSE; |
985 | - } |
|
985 | + } |
|
986 | 986 | } |
987 | 987 | elseif (!strncmp("msgctxt", $line, 7)) { |
988 | - if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
988 | + if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
989 | 989 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
990 | 990 | $current = array(); |
991 | - } |
|
992 | - elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error |
|
991 | + } |
|
992 | + elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error |
|
993 | 993 | watchdog( |
994 | - 'boinctranslate', |
|
995 | - 'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.', |
|
996 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
997 | - WATCHDOG_WARNING |
|
994 | + 'boinctranslate', |
|
995 | + 'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.', |
|
996 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
997 | + WATCHDOG_WARNING |
|
998 | 998 | ); |
999 | 999 | _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno); |
1000 | 1000 | return FALSE; |
1001 | - } |
|
1002 | - $line = trim(substr($line, 7)); |
|
1003 | - $quoted = _locale_import_parse_quoted($line); |
|
1004 | - if ($quoted === FALSE) { |
|
1001 | + } |
|
1002 | + $line = trim(substr($line, 7)); |
|
1003 | + $quoted = _locale_import_parse_quoted($line); |
|
1004 | + if ($quoted === FALSE) { |
|
1005 | 1005 | watchdog( |
1006 | - 'boinctranslate', |
|
1007 | - 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1008 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1009 | - WATCHDOG_WARNING |
|
1006 | + 'boinctranslate', |
|
1007 | + 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1008 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1009 | + WATCHDOG_WARNING |
|
1010 | 1010 | ); |
1011 | 1011 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1012 | 1012 | return FALSE; |
1013 | - } |
|
1014 | - $current["msgctxt"] = $quoted; |
|
1015 | - $context = "MSGCTXT"; |
|
1013 | + } |
|
1014 | + $current["msgctxt"] = $quoted; |
|
1015 | + $context = "MSGCTXT"; |
|
1016 | 1016 | } |
1017 | 1017 | elseif (!strncmp("msgid_plural", $line, 12)) { |
1018 | - if ($context != "MSGID") { // Must be plural form for current entry |
|
1018 | + if ($context != "MSGID") { // Must be plural form for current entry |
|
1019 | 1019 | watchdog( |
1020 | - 'boinctranslate', |
|
1021 | - 'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.', |
|
1022 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1023 | - WATCHDOG_WARNING |
|
1020 | + 'boinctranslate', |
|
1021 | + 'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.', |
|
1022 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1023 | + WATCHDOG_WARNING |
|
1024 | 1024 | ); |
1025 | 1025 | _locale_import_message('The translation file %filename contains an error: "msgid_plural" was expected but not found on line %line.', $file, $lineno); |
1026 | 1026 | return FALSE; |
1027 | - } |
|
1028 | - $line = trim(substr($line, 12)); |
|
1029 | - $quoted = _locale_import_parse_quoted($line); |
|
1030 | - if ($quoted === FALSE) { |
|
1027 | + } |
|
1028 | + $line = trim(substr($line, 12)); |
|
1029 | + $quoted = _locale_import_parse_quoted($line); |
|
1030 | + if ($quoted === FALSE) { |
|
1031 | 1031 | watchdog( |
1032 | - 'boinctranslate', |
|
1033 | - 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1034 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1035 | - WATCHDOG_WARNING |
|
1032 | + 'boinctranslate', |
|
1033 | + 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1034 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1035 | + WATCHDOG_WARNING |
|
1036 | 1036 | ); |
1037 | 1037 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1038 | 1038 | return FALSE; |
1039 | - } |
|
1040 | - $current["msgid"] = $current["msgid"] . "\0" . $quoted; |
|
1041 | - $context = "MSGID_PLURAL"; |
|
1039 | + } |
|
1040 | + $current["msgid"] = $current["msgid"] . "\0" . $quoted; |
|
1041 | + $context = "MSGID_PLURAL"; |
|
1042 | 1042 | } |
1043 | 1043 | elseif (!strncmp("msgid", $line, 5)) { |
1044 | - if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
1044 | + if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
1045 | 1045 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
1046 | 1046 | $current = array(); |
1047 | - } |
|
1048 | - elseif ($context == "MSGID") { // Already in this context? Parse error |
|
1047 | + } |
|
1048 | + elseif ($context == "MSGID") { // Already in this context? Parse error |
|
1049 | 1049 | watchdog( |
1050 | - 'boinctranslate', |
|
1051 | - 'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.', |
|
1052 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1053 | - WATCHDOG_WARNING |
|
1050 | + 'boinctranslate', |
|
1051 | + 'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.', |
|
1052 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1053 | + WATCHDOG_WARNING |
|
1054 | 1054 | ); |
1055 | 1055 | _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno); |
1056 | 1056 | return FALSE; |
1057 | - } |
|
1058 | - $line = trim(substr($line, 5)); |
|
1059 | - $quoted = _locale_import_parse_quoted($line); |
|
1060 | - if ($quoted === FALSE) { |
|
1057 | + } |
|
1058 | + $line = trim(substr($line, 5)); |
|
1059 | + $quoted = _locale_import_parse_quoted($line); |
|
1060 | + if ($quoted === FALSE) { |
|
1061 | 1061 | watchdog( |
1062 | - 'boinctranslate', |
|
1063 | - 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1064 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1065 | - WATCHDOG_WARNING |
|
1062 | + 'boinctranslate', |
|
1063 | + 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1064 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1065 | + WATCHDOG_WARNING |
|
1066 | 1066 | ); |
1067 | 1067 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1068 | 1068 | return FALSE; |
1069 | - } |
|
1070 | - $current["msgid"] = $quoted; |
|
1071 | - $context = "MSGID"; |
|
1069 | + } |
|
1070 | + $current["msgid"] = $quoted; |
|
1071 | + $context = "MSGID"; |
|
1072 | 1072 | } |
1073 | 1073 | elseif (!strncmp("msgstr[", $line, 7)) { |
1074 | - if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[] |
|
1074 | + if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[] |
|
1075 | 1075 | watchdog( |
1076 | - 'boinctranslate', |
|
1077 | - 'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.', |
|
1078 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1079 | - WATCHDOG_WARNING |
|
1076 | + 'boinctranslate', |
|
1077 | + 'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.', |
|
1078 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1079 | + WATCHDOG_WARNING |
|
1080 | 1080 | ); |
1081 | 1081 | _locale_import_message('The translation file %filename contains an error: "msgstr[]" is unexpected on line %line.', $file, $lineno); |
1082 | 1082 | return FALSE; |
1083 | - } |
|
1084 | - if (strpos($line, "]") === FALSE) { |
|
1083 | + } |
|
1084 | + if (strpos($line, "]") === FALSE) { |
|
1085 | 1085 | watchdog( |
1086 | - 'boinctranslate', |
|
1087 | - 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1088 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1089 | - WATCHDOG_WARNING |
|
1086 | + 'boinctranslate', |
|
1087 | + 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1088 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1089 | + WATCHDOG_WARNING |
|
1090 | 1090 | ); |
1091 | 1091 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1092 | 1092 | return FALSE; |
1093 | - } |
|
1094 | - $frombracket = strstr($line, "["); |
|
1095 | - $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1); |
|
1096 | - $line = trim(strstr($line, " ")); |
|
1097 | - $quoted = _locale_import_parse_quoted($line); |
|
1098 | - if ($quoted === FALSE) { |
|
1093 | + } |
|
1094 | + $frombracket = strstr($line, "["); |
|
1095 | + $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1); |
|
1096 | + $line = trim(strstr($line, " ")); |
|
1097 | + $quoted = _locale_import_parse_quoted($line); |
|
1098 | + if ($quoted === FALSE) { |
|
1099 | 1099 | watchdog( |
1100 | - 'boinctranslate', |
|
1101 | - 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1102 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1103 | - WATCHDOG_WARNING |
|
1100 | + 'boinctranslate', |
|
1101 | + 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1102 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1103 | + WATCHDOG_WARNING |
|
1104 | 1104 | ); |
1105 | 1105 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1106 | 1106 | return FALSE; |
1107 | - } |
|
1108 | - $current["msgstr"][$plural] = $quoted; |
|
1109 | - $context = "MSGSTR_ARR"; |
|
1107 | + } |
|
1108 | + $current["msgstr"][$plural] = $quoted; |
|
1109 | + $context = "MSGSTR_ARR"; |
|
1110 | 1110 | } |
1111 | 1111 | elseif (!strncmp("msgstr", $line, 6)) { |
1112 | - if ($context != "MSGID") { // Should come just after a msgid block |
|
1112 | + if ($context != "MSGID") { // Should come just after a msgid block |
|
1113 | 1113 | watchdog( |
1114 | - 'boinctranslate', |
|
1115 | - 'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.', |
|
1116 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1117 | - WATCHDOG_WARNING |
|
1114 | + 'boinctranslate', |
|
1115 | + 'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.', |
|
1116 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1117 | + WATCHDOG_WARNING |
|
1118 | 1118 | ); |
1119 | 1119 | _locale_import_message('The translation file %filename contains an error: "msgstr" is unexpected on line %line.', $file, $lineno); |
1120 | 1120 | return FALSE; |
1121 | - } |
|
1122 | - $line = trim(substr($line, 6)); |
|
1123 | - $quoted = _locale_import_parse_quoted($line); |
|
1124 | - if ($quoted === FALSE) { |
|
1121 | + } |
|
1122 | + $line = trim(substr($line, 6)); |
|
1123 | + $quoted = _locale_import_parse_quoted($line); |
|
1124 | + if ($quoted === FALSE) { |
|
1125 | 1125 | watchdog( |
1126 | - 'boinctranslate', |
|
1127 | - 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1128 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1129 | - WATCHDOG_WARNING |
|
1126 | + 'boinctranslate', |
|
1127 | + 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1128 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1129 | + WATCHDOG_WARNING |
|
1130 | 1130 | ); |
1131 | 1131 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1132 | 1132 | return FALSE; |
1133 | - } |
|
1134 | - $current["msgstr"] = $quoted; |
|
1135 | - $context = "MSGSTR"; |
|
1133 | + } |
|
1134 | + $current["msgstr"] = $quoted; |
|
1135 | + $context = "MSGSTR"; |
|
1136 | 1136 | } |
1137 | 1137 | elseif ($line != "") { |
1138 | - $quoted = _locale_import_parse_quoted($line); |
|
1139 | - if ($quoted === FALSE) { |
|
1138 | + $quoted = _locale_import_parse_quoted($line); |
|
1139 | + if ($quoted === FALSE) { |
|
1140 | 1140 | watchdog( |
1141 | - 'boinctranslate', |
|
1142 | - 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1143 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1144 | - WATCHDOG_WARNING |
|
1141 | + 'boinctranslate', |
|
1142 | + 'The translation file %filename for language %lang contains a syntax error on line %line.', |
|
1143 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1144 | + WATCHDOG_WARNING |
|
1145 | 1145 | ); |
1146 | 1146 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1147 | 1147 | return FALSE; |
1148 | - } |
|
1149 | - if (($context == "MSGID") || ($context == "MSGID_PLURAL")) { |
|
1148 | + } |
|
1149 | + if (($context == "MSGID") || ($context == "MSGID_PLURAL")) { |
|
1150 | 1150 | $current["msgid"] .= $quoted; |
1151 | - } |
|
1152 | - elseif ($context == "MSGSTR") { |
|
1151 | + } |
|
1152 | + elseif ($context == "MSGSTR") { |
|
1153 | 1153 | $current["msgstr"] .= $quoted; |
1154 | - } |
|
1155 | - elseif ($context == "MSGSTR_ARR") { |
|
1154 | + } |
|
1155 | + elseif ($context == "MSGSTR_ARR") { |
|
1156 | 1156 | $current["msgstr"][$plural] .= $quoted; |
1157 | - } |
|
1158 | - else { |
|
1157 | + } |
|
1158 | + else { |
|
1159 | 1159 | watchdog( |
1160 | - 'boinctranslate', |
|
1161 | - 'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.', |
|
1162 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1163 | - WATCHDOG_WARNING |
|
1160 | + 'boinctranslate', |
|
1161 | + 'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.', |
|
1162 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1163 | + WATCHDOG_WARNING |
|
1164 | 1164 | ); |
1165 | 1165 | _locale_import_message('The translation file %filename contains an error: there is an unexpected string on line %line.', $file, $lineno); |
1166 | 1166 | return FALSE; |
1167 | - } |
|
1167 | + } |
|
1168 | + } |
|
1168 | 1169 | } |
1169 | - } |
|
1170 | 1170 | |
1171 | - // End of PO file, flush last entry |
|
1172 | - if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
|
1171 | + // End of PO file, flush last entry |
|
1172 | + if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
|
1173 | 1173 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
1174 | - } |
|
1175 | - elseif ($context != "COMMENT") { |
|
1174 | + } |
|
1175 | + elseif ($context != "COMMENT") { |
|
1176 | 1176 | watchdog( |
1177 | - 'boinctranslate', |
|
1178 | - 'The translation file %filename for %lang ended unexpectedly at line %line.', |
|
1179 | - array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1180 | - WATCHDOG_WARNING |
|
1177 | + 'boinctranslate', |
|
1178 | + 'The translation file %filename for %lang ended unexpectedly at line %line.', |
|
1179 | + array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno), |
|
1180 | + WATCHDOG_WARNING |
|
1181 | 1181 | ); |
1182 | 1182 | _locale_import_message('The translation file %filename ended unexpectedly at line %line.', $file, $lineno); |
1183 | 1183 | return FALSE; |
1184 | - } |
|
1184 | + } |
|
1185 | 1185 | |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1190,28 +1190,28 @@ discard block |
||
1190 | 1190 | */ |
1191 | 1191 | function _boinctranslate_locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') { |
1192 | 1192 | |
1193 | - require_once(getcwd() . '/includes/locale.inc'); |
|
1193 | + require_once(getcwd() . '/includes/locale.inc'); |
|
1194 | 1194 | |
1195 | - static $report = array( |
|
1195 | + static $report = array( |
|
1196 | 1196 | 'additions' => 0, |
1197 | 1197 | 'updates' => 0, |
1198 | 1198 | 'deletes' => 0, |
1199 | 1199 | 'skips' => 0, |
1200 | - ); |
|
1201 | - static $headerdone = FALSE; |
|
1202 | - static $strings = array(); |
|
1200 | + ); |
|
1201 | + static $headerdone = FALSE; |
|
1202 | + static $strings = array(); |
|
1203 | 1203 | |
1204 | - switch ($op) { |
|
1204 | + switch ($op) { |
|
1205 | 1205 | // Return stored strings |
1206 | 1206 | case 'mem-report': |
1207 | 1207 | return $strings; |
1208 | 1208 | |
1209 | - // Store string in memory (only supports single strings) |
|
1209 | + // Store string in memory (only supports single strings) |
|
1210 | 1210 | case 'mem-store': |
1211 | 1211 | $strings[$value['msgid']] = $value['msgstr']; |
1212 | - return; |
|
1212 | + return; |
|
1213 | 1213 | |
1214 | - // Called at end of import to inform the user |
|
1214 | + // Called at end of import to inform the user |
|
1215 | 1215 | case 'db-report': |
1216 | 1216 | return array( |
1217 | 1217 | $headerdone, |
@@ -1219,57 +1219,57 @@ discard block |
||
1219 | 1219 | $report['updates'], |
1220 | 1220 | $report['deletes'], |
1221 | 1221 | $report['skips'], |
1222 | - ); |
|
1222 | + ); |
|
1223 | 1223 | |
1224 | - // Store the string we got in the database. |
|
1224 | + // Store the string we got in the database. |
|
1225 | 1225 | case 'db-store': |
1226 | 1226 | // We got header information. |
1227 | 1227 | if ($value['msgid'] == '') { |
1228 | 1228 | $languages = language_list(); |
1229 | 1229 | if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) { |
1230 | - // Since we only need to parse the header if we ought to update the |
|
1231 | - // plural formula, only run this if we don't need to keep existing |
|
1232 | - // data untouched or if we don't have an existing plural formula. |
|
1233 | - $header = _locale_import_parse_header($value['msgstr']); |
|
1230 | + // Since we only need to parse the header if we ought to update the |
|
1231 | + // plural formula, only run this if we don't need to keep existing |
|
1232 | + // data untouched or if we don't have an existing plural formula. |
|
1233 | + $header = _locale_import_parse_header($value['msgstr']); |
|
1234 | 1234 | |
1235 | - // Get and store the plural formula if available. |
|
1236 | - if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) { |
|
1235 | + // Get and store the plural formula if available. |
|
1236 | + if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) { |
|
1237 | 1237 | list($nplurals, $plural) = $p; |
1238 | 1238 | db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang); |
1239 | - } |
|
1239 | + } |
|
1240 | 1240 | } |
1241 | 1241 | $headerdone = TRUE; |
1242 | - } |
|
1242 | + } |
|
1243 | 1243 | |
1244 | - else { |
|
1244 | + else { |
|
1245 | 1245 | // Some real string to import. |
1246 | 1246 | $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); |
1247 | 1247 | |
1248 | 1248 | if (strpos($value['msgid'], "\0")) { |
1249 | - // This string has plural versions. |
|
1250 | - $english = explode("\0", $value['msgid'], 2); |
|
1251 | - $entries = array_keys($value['msgstr']); |
|
1252 | - for ($i = 3; $i <= count($entries); $i++) { |
|
1249 | + // This string has plural versions. |
|
1250 | + $english = explode("\0", $value['msgid'], 2); |
|
1251 | + $entries = array_keys($value['msgstr']); |
|
1252 | + for ($i = 3; $i <= count($entries); $i++) { |
|
1253 | 1253 | $english[] = $english[1]; |
1254 | - } |
|
1255 | - $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries); |
|
1256 | - $english = array_map('_locale_import_append_plural', $english, $entries); |
|
1257 | - foreach ($translation as $key => $trans) { |
|
1254 | + } |
|
1255 | + $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries); |
|
1256 | + $english = array_map('_locale_import_append_plural', $english, $entries); |
|
1257 | + foreach ($translation as $key => $trans) { |
|
1258 | 1258 | if ($key == 0) { |
1259 | - $plid = 0; |
|
1259 | + $plid = 0; |
|
1260 | 1260 | } |
1261 | 1261 | $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); |
1262 | - } |
|
1262 | + } |
|
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | else { |
1266 | - // A simple string to import. |
|
1267 | - $english = $value['msgid']; |
|
1268 | - $translation = $value['msgstr']; |
|
1269 | - _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode); |
|
1266 | + // A simple string to import. |
|
1267 | + $english = $value['msgid']; |
|
1268 | + $translation = $value['msgstr']; |
|
1269 | + _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode); |
|
1270 | 1270 | } |
1271 | - } |
|
1272 | - } // end of db-store operation |
|
1271 | + } |
|
1272 | + } // end of db-store operation |
|
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | /** |
@@ -1286,15 +1286,15 @@ discard block |
||
1286 | 1286 | */ |
1287 | 1287 | function _boinctranslate_locale_import_one_string_db(&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid = NULL, $plural = NULL) { |
1288 | 1288 | |
1289 | - $ignoreoverwrite = FALSE; |
|
1290 | - $lid = 0; |
|
1289 | + $ignoreoverwrite = FALSE; |
|
1290 | + $lid = 0; |
|
1291 | 1291 | |
1292 | - // Use different DB query depending on the textgroup. |
|
1293 | - $uselocation = array("boinc", "project"); |
|
1294 | - if (in_array($textgroup, $uselocation)) { |
|
1292 | + // Use different DB query depending on the textgroup. |
|
1293 | + $uselocation = array("boinc", "project"); |
|
1294 | + if (in_array($textgroup, $uselocation)) { |
|
1295 | 1295 | $resource = db_query("SELECT lid FROM {locales_source} WHERE location = '%s' AND source = '%s' AND textgroup = '%s'", $location, $source, $textgroup); |
1296 | - } |
|
1297 | - else { |
|
1296 | + } |
|
1297 | + else { |
|
1298 | 1298 | $resource = db_query("SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'", $source, $textgroup); |
1299 | 1299 | |
1300 | 1300 | // Parse the location string for the string ignoreoverwrite, which |
@@ -1303,61 +1303,61 @@ discard block |
||
1303 | 1303 | // location string. |
1304 | 1304 | $parts = explode(':', $location); |
1305 | 1305 | if (!empty($parts[2])) { |
1306 | - if (preg_match('/(ignoreoverwrite)/', $parts[2])) { |
|
1306 | + if (preg_match('/(ignoreoverwrite)/', $parts[2])) { |
|
1307 | 1307 | $ignoreoverwrite = TRUE; |
1308 | - } |
|
1308 | + } |
|
1309 | 1309 | } |
1310 | - }// if (in_array($textgroup, $uselocation)) |
|
1310 | + }// if (in_array($textgroup, $uselocation)) |
|
1311 | 1311 | |
1312 | - if (!empty($translation)) { |
|
1312 | + if (!empty($translation)) { |
|
1313 | 1313 | // Skip this string unless it passes a check for dangerous code. |
1314 | 1314 | // Text groups other than default still can contain HTML tags |
1315 | 1315 | // (i.e. translatable blocks). |
1316 | 1316 | if ($textgroup == "default" && !locale_string_is_safe($translation)) { |
1317 | - $report['skips']++; |
|
1318 | - $lid = 0; |
|
1317 | + $report['skips']++; |
|
1318 | + $lid = 0; |
|
1319 | 1319 | } |
1320 | 1320 | elseif ($resource) { |
1321 | - // We have this source string saved already. Loop over the db results from locales_source table. |
|
1322 | - while ($row = db_fetch_array($resource)) { |
|
1321 | + // We have this source string saved already. Loop over the db results from locales_source table. |
|
1322 | + while ($row = db_fetch_array($resource)) { |
|
1323 | 1323 | |
1324 | 1324 | $lid = $row['lid']; |
1325 | 1325 | // Check of if one or more translations exist for this lid in locales_target table. |
1326 | 1326 | $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
1327 | 1327 | if (!$exists) { |
1328 | - // No translation in this language, insert translation into locales_target table. |
|
1329 | - db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural); |
|
1330 | - $report['additions']++; |
|
1328 | + // No translation in this language, insert translation into locales_target table. |
|
1329 | + db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural); |
|
1330 | + $report['additions']++; |
|
1331 | 1331 | } |
1332 | 1332 | else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) { |
1333 | - // Translation exists, only overwrite if instructed. |
|
1334 | - db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid); |
|
1335 | - $report['updates']++; |
|
1333 | + // Translation exists, only overwrite if instructed. |
|
1334 | + db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid); |
|
1335 | + $report['updates']++; |
|
1336 | 1336 | } |
1337 | 1337 | else { |
1338 | - $report['skips']++; |
|
1338 | + $report['skips']++; |
|
1339 | 1339 | }// end if !$exists |
1340 | 1340 | |
1341 | - }// while |
|
1341 | + }// while |
|
1342 | 1342 | } |
1343 | - } |
|
1344 | - elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) { |
|
1343 | + } |
|
1344 | + elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) { |
|
1345 | 1345 | // Loop over db results from locales_source table. |
1346 | 1346 | while ($row = db_fetch_array($resource)) { |
1347 | - $lid = $row['lid']; |
|
1348 | - $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1349 | - if ($exists) { |
|
1347 | + $lid = $row['lid']; |
|
1348 | + $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1349 | + if ($exists) { |
|
1350 | 1350 | // Empty translation, remove existing if instructed. |
1351 | 1351 | db_query("DELETE FROM {locales_target} WHERE language = '%s' AND lid = %d AND plid = %d AND plural = %d", $langcode, $lid, $plid, $plural); |
1352 | 1352 | $report['deletes']++; |
1353 | - }// if $exists |
|
1353 | + }// if $exists |
|
1354 | 1354 | }// while |
1355 | - } |
|
1356 | - else { |
|
1355 | + } |
|
1356 | + else { |
|
1357 | 1357 | $report['skips']++; |
1358 | - } |
|
1358 | + } |
|
1359 | 1359 | |
1360 | - return $lid; |
|
1360 | + return $lid; |
|
1361 | 1361 | } |
1362 | 1362 | |
1363 | 1363 | |
@@ -1366,17 +1366,17 @@ discard block |
||
1366 | 1366 | * Parse valid resources out of configuration |
1367 | 1367 | */ |
1368 | 1368 | function boinctranslate_parse_resources($resource_text) { |
1369 | - $resources = array(); |
|
1370 | - $resource_array = explode( |
|
1369 | + $resources = array(); |
|
1370 | + $resource_array = explode( |
|
1371 | 1371 | "\n", $resource_text |
1372 | - ); |
|
1373 | - foreach ($resource_array as $resource) { |
|
1372 | + ); |
|
1373 | + foreach ($resource_array as $resource) { |
|
1374 | 1374 | $resource = trim($resource); |
1375 | 1375 | if ($resource AND $resource[0] != '#') { |
1376 | - $resources[] = $resource; |
|
1376 | + $resources[] = $resource; |
|
1377 | 1377 | } |
1378 | - } |
|
1379 | - return $resources; |
|
1378 | + } |
|
1379 | + return $resources; |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -1403,5 +1403,5 @@ discard block |
||
1403 | 1403 | * database. |
1404 | 1404 | */ |
1405 | 1405 | function _boinctranslate_supertrim($instr) { |
1406 | - return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) ); |
|
1406 | + return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) ); |
|
1407 | 1407 | } |
@@ -56,9 +56,9 @@ |
||
56 | 56 | "email_addr=previous_email_addr, previous_email_addr='', email_addr_change_time=0, passwd_hash='$database_passwd_hash', email_validated=0" |
57 | 57 | ); |
58 | 58 | $result = delete_token($userid, $token, TOKEN_TYPE_CHANGE_EMAIL); |
59 | - } |
|
59 | + } |
|
60 | 60 | } else { |
61 | - echo tra("Invalid token."); |
|
61 | + echo tra("Invalid token."); |
|
62 | 62 | } |
63 | 63 | } else { |
64 | 64 | echo tra("Invalid token."); |
@@ -44,9 +44,9 @@ |
||
44 | 44 | page_head(tra("Delete Account")); |
45 | 45 | |
46 | 46 | echo "<p>".tra("Thank you for verifying ownership of your account.")."</p>" |
47 | - ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>" |
|
48 | - ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>" |
|
49 | - ."<br/>"; |
|
47 | + ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>" |
|
48 | + ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>" |
|
49 | + ."<br/>"; |
|
50 | 50 | |
51 | 51 | form_start(secure_url_base()."delete_account_confirm.php", "post"); |
52 | 52 | form_input_hidden("token", $token); |
@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | // $Id$ |
3 | 3 | |
4 | 4 | /** |
5 | - * @file |
|
6 | - * Enable BOINC features related to processing work and credit. |
|
7 | - */ |
|
5 | + * @file |
|
6 | + * Enable BOINC features related to processing work and credit. |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | |
10 | 10 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -20,70 +20,70 @@ discard block |
||
20 | 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
21 | 21 | |
22 | 22 | /** |
23 | - * Implementation of hook_menu(). |
|
24 | - */ |
|
23 | + * Implementation of hook_menu(). |
|
24 | + */ |
|
25 | 25 | function boincwork_menu() { |
26 | - require_boinc('util'); |
|
27 | - $items['account/prefs'] = array( |
|
26 | + require_boinc('util'); |
|
27 | + $items['account/prefs'] = array( |
|
28 | 28 | 'title' => 'Computing', |
29 | 29 | 'description' => '', |
30 | 30 | 'page callback' => 'generalprefs_page', |
31 | 31 | 'access callback' => 'user_is_logged_in', |
32 | 32 | 'type' => MENU_NORMAL_ITEM |
33 | - ); |
|
34 | - $items['account/prefs/computing'] = array( |
|
33 | + ); |
|
34 | + $items['account/prefs/computing'] = array( |
|
35 | 35 | 'title' => 'Computing', |
36 | 36 | 'page callback' => 'generalprefs_page', |
37 | 37 | 'access callback' => 'user_is_logged_in', |
38 | 38 | 'type' => MENU_DEFAULT_LOCAL_TASK, |
39 | 39 | 'weight' => 0 |
40 | - ); |
|
41 | - $items['account/prefs/project'] = array( |
|
40 | + ); |
|
41 | + $items['account/prefs/project'] = array( |
|
42 | 42 | 'title' => 'Project', |
43 | 43 | 'page callback' => 'projectprefs_page', |
44 | 44 | 'access callback' => 'user_is_logged_in', |
45 | 45 | 'type' => MENU_LOCAL_TASK, |
46 | 46 | 'weight' => 5 |
47 | - ); |
|
48 | - $items['account/prefs/community'] = array( |
|
47 | + ); |
|
48 | + $items['account/prefs/community'] = array( |
|
49 | 49 | 'title' => 'Community', |
50 | 50 | 'page callback' => 'communityprefs_page', |
51 | 51 | 'access callback' => 'user_is_logged_in', |
52 | 52 | 'type' => MENU_LOCAL_TASK, |
53 | 53 | 'weight' => 10 |
54 | - ); |
|
55 | - $items['account/prefs/privacy'] = array( |
|
54 | + ); |
|
55 | + $items['account/prefs/privacy'] = array( |
|
56 | 56 | 'title' => 'Privacy', |
57 | 57 | 'page callback' => 'privacyprefs_page', |
58 | 58 | 'access callback' => 'user_is_logged_in', |
59 | 59 | 'type' => MENU_LOCAL_TASK, |
60 | 60 | 'weight' => 15 |
61 | - ); |
|
62 | - if (module_exists('ignore_user')) { |
|
61 | + ); |
|
62 | + if (module_exists('ignore_user')) { |
|
63 | 63 | $items['account/prefs/privacy/ignore_user/add'] = array( |
64 | - 'title' => 'Add from ignore list', |
|
65 | - 'description' => 'Add user that you with to ignore to your ignore list.', |
|
66 | - 'page callback' => 'boincwork_ignore_user_add_user', |
|
67 | - 'access callback' => 'user_access', |
|
68 | - 'access arguments' => array('ignore user'), |
|
69 | - 'type' => MENU_CALLBACK, |
|
64 | + 'title' => 'Add from ignore list', |
|
65 | + 'description' => 'Add user that you with to ignore to your ignore list.', |
|
66 | + 'page callback' => 'boincwork_ignore_user_add_user', |
|
67 | + 'access callback' => 'user_access', |
|
68 | + 'access arguments' => array('ignore user'), |
|
69 | + 'type' => MENU_CALLBACK, |
|
70 | 70 | ); |
71 | 71 | $items['account/prefs/privacy/ignore_user/remove'] = array( |
72 | - 'title' => 'Remove from ignore list', |
|
73 | - 'description' => 'Remove user from your ignore list.', |
|
74 | - 'page callback' => 'boincwork_ignore_user_remove_user', |
|
75 | - 'access callback' => 'user_access', |
|
76 | - 'access arguments' => array('ignore user'), |
|
77 | - 'type' => MENU_CALLBACK, |
|
72 | + 'title' => 'Remove from ignore list', |
|
73 | + 'description' => 'Remove user from your ignore list.', |
|
74 | + 'page callback' => 'boincwork_ignore_user_remove_user', |
|
75 | + 'access callback' => 'user_access', |
|
76 | + 'access arguments' => array('ignore user'), |
|
77 | + 'type' => MENU_CALLBACK, |
|
78 | 78 | ); |
79 | - }// endif module_exists |
|
80 | - $items['account/certs'] = array( |
|
79 | + }// endif module_exists |
|
80 | + $items['account/certs'] = array( |
|
81 | 81 | 'title' =>'Account certificate', |
82 | 82 | 'page callback' => 'boincwork_certificates', |
83 | 83 | 'access arguments' => array('access content'), |
84 | 84 | 'type' => MENU_CALLBACK |
85 | - ); |
|
86 | - $items['admin/boinc/prefs/general'] = array( |
|
85 | + ); |
|
86 | + $items['admin/boinc/prefs/general'] = array( |
|
87 | 87 | 'title' => 'Preferences: General', |
88 | 88 | 'description' => 'Set options for BOINC preference set pages', |
89 | 89 | 'page callback' => 'drupal_get_form', |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | 'access arguments' => array('administer site configuration'), |
92 | 92 | 'type' => MENU_NORMAL_ITEM, |
93 | 93 | 'file' => 'boincwork.admin.inc' |
94 | - ); |
|
95 | - $items['admin/boinc/prefs/presets'] = array( |
|
94 | + ); |
|
95 | + $items['admin/boinc/prefs/presets'] = array( |
|
96 | 96 | 'title' => 'Preferences: Presets', |
97 | 97 | 'description' => 'Set values for BOINC preference set presets.', |
98 | 98 | 'page callback' => 'boincwork_admin_prefs_presets_page', |
99 | 99 | 'access arguments' => array('administer site configuration'), |
100 | 100 | 'type' => MENU_NORMAL_ITEM, |
101 | 101 | 'file' => 'boincwork.admin.inc' |
102 | - ); |
|
103 | - $items['admin/boinc/prefs/upload'] = array( |
|
102 | + ); |
|
103 | + $items['admin/boinc/prefs/upload'] = array( |
|
104 | 104 | 'title' => 'Preferences: Project-specific XML upload', |
105 | 105 | 'description' => 'Upload XML configuration for project specific preferences.', |
106 | 106 | 'page callback' => 'drupal_get_form', |
@@ -108,153 +108,153 @@ discard block |
||
108 | 108 | 'access arguments' => array('administer site configuration'), |
109 | 109 | 'type' => MENU_NORMAL_ITEM, |
110 | 110 | 'file' => 'boincwork.admin.inc' |
111 | - ); |
|
112 | - $items['host/%/delete'] = array( |
|
111 | + ); |
|
112 | + $items['host/%/delete'] = array( |
|
113 | 113 | 'title' => 'Delete host', |
114 | 114 | 'page callback' => 'boincwork_host_delete', |
115 | 115 | 'page arguments' => array(1), |
116 | 116 | 'access callback' => 'user_is_logged_in', |
117 | 117 | 'type' => MENU_CALLBACK, |
118 | - ); |
|
119 | - $items['host/%/log'] = array( |
|
118 | + ); |
|
119 | + $items['host/%/log'] = array( |
|
120 | 120 | 'title' => 'Host log', |
121 | 121 | 'page callback' => 'boincwork_host_log', |
122 | 122 | 'page arguments' => array(1), |
123 | 123 | 'access callback' => 'user_is_logged_in', |
124 | 124 | 'type' => MENU_CALLBACK, |
125 | - ); |
|
126 | - $items['host/%/merge'] = array( |
|
125 | + ); |
|
126 | + $items['host/%/merge'] = array( |
|
127 | 127 | 'title' => 'Merge computer', |
128 | 128 | 'page callback' => 'drupal_get_form', |
129 | 129 | 'page arguments' => array('boincwork_host_merge_form', 1), |
130 | 130 | 'access callback' => 'user_is_logged_in', |
131 | 131 | 'type' => MENU_CALLBACK, |
132 | - ); |
|
133 | - $items['host/%/set-venue/%'] = array( |
|
132 | + ); |
|
133 | + $items['host/%/set-venue/%'] = array( |
|
134 | 134 | 'title' => 'Set host venue', |
135 | 135 | 'page callback' => 'boincwork_host_set_venue', |
136 | 136 | 'page arguments' => array(1,3), |
137 | 137 | 'access callback' => 'user_is_logged_in', |
138 | 138 | 'type' => MENU_CALLBACK, |
139 | - ); |
|
140 | - $items['user/%/mobile'] = array( |
|
139 | + ); |
|
140 | + $items['user/%/mobile'] = array( |
|
141 | 141 | 'title' => 'Mobile stats', |
142 | 142 | 'page callback' => 'boincwork_mobile_stats', |
143 | 143 | 'page arguments' => array(1), |
144 | 144 | 'access callback' => 'user_is_logged_in', |
145 | 145 | 'type' => MENU_CALLBACK |
146 | - ); |
|
147 | - $items['server_status.php'] = array( |
|
146 | + ); |
|
147 | + $items['server_status.php'] = array( |
|
148 | 148 | 'title' => 'Server status', |
149 | 149 | 'page callback' => 'boincwork_server_status', |
150 | 150 | 'access arguments' => array('access content'), |
151 | 151 | 'type' => MENU_CALLBACK |
152 | - ); |
|
153 | - $items['job_file.php'] = array( |
|
152 | + ); |
|
153 | + $items['job_file.php'] = array( |
|
154 | 154 | 'title' => 'Job file input', |
155 | 155 | 'page callback' => 'boincwork_job_file', |
156 | 156 | 'access arguments' => array('access content'), |
157 | 157 | 'type' => MENU_CALLBACK |
158 | - ); |
|
159 | - $items['get_output.php'] = array( |
|
158 | + ); |
|
159 | + $items['get_output.php'] = array( |
|
160 | 160 | 'title' => 'Get output file', |
161 | 161 | 'page callback' => 'boincwork_get_output', |
162 | 162 | 'access arguments' => array('access content'), |
163 | 163 | 'type' => MENU_CALLBACK |
164 | - ); |
|
165 | - $items['get_project_config.php'] = array( |
|
164 | + ); |
|
165 | + $items['get_project_config.php'] = array( |
|
166 | 166 | 'title' => 'Project config', |
167 | 167 | 'page callback' => 'boincwork_get_project_config', |
168 | 168 | 'access arguments' => array('access content'), |
169 | 169 | 'type' => MENU_CALLBACK |
170 | - ); |
|
171 | - $items['submit_rpc_handler.php'] = array( |
|
170 | + ); |
|
171 | + $items['submit_rpc_handler.php'] = array( |
|
172 | 172 | 'title' => 'Remote job submission', |
173 | 173 | 'page callback' => 'boincwork_submit_rpc_handler', |
174 | 174 | 'access arguments' => array('access content'), |
175 | 175 | 'type' => MENU_CALLBACK |
176 | - ); |
|
177 | - $items['userw.php'] = array( |
|
176 | + ); |
|
177 | + $items['userw.php'] = array( |
|
178 | 178 | 'title' => 'User WAP', |
179 | 179 | 'page callback' => 'boincwork_user_wap', |
180 | 180 | 'access arguments' => array('access content'), |
181 | 181 | 'type' => MENU_CALLBACK |
182 | - ); |
|
183 | - $items['account/tasks/%/%'] = array( |
|
182 | + ); |
|
183 | + $items['account/tasks/%/%'] = array( |
|
184 | 184 | 'title' => 'Account Tasks Table', |
185 | 185 | 'description' => '', |
186 | 186 | 'page callback' => 'boincwork_account_task_table', |
187 | 187 | 'page arguments' => array(2,3), |
188 | 188 | 'access arguments' => array('access content'), |
189 | 189 | 'type' => MENU_CALLBACK, |
190 | - ); |
|
191 | - $items['host/%/tasks/%/%'] = array( |
|
190 | + ); |
|
191 | + $items['host/%/tasks/%/%'] = array( |
|
192 | 192 | 'title' => 'Host Tasks Table', |
193 | 193 | 'description' => '', |
194 | 194 | 'page callback' => 'boincwork_host_task_table', |
195 | 195 | 'page arguments' => array(1,3,4), |
196 | 196 | 'access arguments' => array('access content'), |
197 | 197 | 'type' => MENU_CALLBACK, |
198 | - ); |
|
199 | - // Workunit task table disabled |
|
200 | - //$items['workunit/%/tasks/%/%'] = array( |
|
201 | - // 'title' => 'Workunit Tasks Table', |
|
202 | - // 'description' => '', |
|
203 | - // 'page callback' => 'boincwork_workunit_task_table', |
|
204 | - // 'page arguments' => array(1,3,4), |
|
205 | - // 'access arguments' => array('access content'), |
|
206 | - // 'type' => MENU_CALLBACK, |
|
207 | - //); |
|
208 | - return $items; |
|
198 | + ); |
|
199 | + // Workunit task table disabled |
|
200 | + //$items['workunit/%/tasks/%/%'] = array( |
|
201 | + // 'title' => 'Workunit Tasks Table', |
|
202 | + // 'description' => '', |
|
203 | + // 'page callback' => 'boincwork_workunit_task_table', |
|
204 | + // 'page arguments' => array(1,3,4), |
|
205 | + // 'access arguments' => array('access content'), |
|
206 | + // 'type' => MENU_CALLBACK, |
|
207 | + //); |
|
208 | + return $items; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Implementation of hook_theme(). |
213 | 213 | */ |
214 | 214 | function boincwork_theme() { |
215 | - return array( |
|
215 | + return array( |
|
216 | 216 | 'boincwork_privacyprefs_form' => array( |
217 | - 'arguments' => array('form'), |
|
217 | + 'arguments' => array('form'), |
|
218 | 218 | ), |
219 | - ); |
|
219 | + ); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
223 | 223 | * Implementation of hook_views_api(). |
224 | 224 | */ |
225 | 225 | function boincwork_views_api() { |
226 | - return array( |
|
226 | + return array( |
|
227 | 227 | 'api' => 2.0, |
228 | 228 | 'path' => drupal_get_path('module', 'boincwork') |
229 | - ); |
|
229 | + ); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Implementation of hook_locale(). |
234 | 234 | */ |
235 | 235 | function boincwork_locale($op = 'groups', $group = NULL) { |
236 | - switch ($op) { |
|
236 | + switch ($op) { |
|
237 | 237 | case 'groups': |
238 | 238 | return array('project' => bts('Project')); |
239 | 239 | case 'info': |
240 | 240 | $info['project']['refresh callback'] = 'boincwork_locale_refresh'; |
241 | - $info['project']['format'] = FALSE; |
|
242 | - return $info; |
|
243 | - } |
|
241 | + $info['project']['format'] = FALSE; |
|
242 | + return $info; |
|
243 | + } |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
247 | 247 | * Refresh strings. |
248 | 248 | */ |
249 | 249 | function boincwork_locale_refresh() { |
250 | - // Mimic process of adding project specific prefs to the project preferences |
|
251 | - // form -- this parses the prefs XML and calls i18nstrings_update() |
|
252 | - $form = array(); |
|
253 | - $prefs = array( |
|
250 | + // Mimic process of adding project specific prefs to the project preferences |
|
251 | + // form -- this parses the prefs XML and calls i18nstrings_update() |
|
252 | + $form = array(); |
|
253 | + $prefs = array( |
|
254 | 254 | 'project_specific' => array(), |
255 | - ); |
|
256 | - boincwork_add_project_specific_prefs($form, $prefs); |
|
257 | - return TRUE; // Meaning it completed with no issues |
|
255 | + ); |
|
256 | + boincwork_add_project_specific_prefs($form, $prefs); |
|
257 | + return TRUE; // Meaning it completed with no issues |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -263,43 +263,43 @@ discard block |
||
263 | 263 | */ |
264 | 264 | |
265 | 265 | function boincwork_privatemsg_message_view_alter(&$vars) { |
266 | - global $user; |
|
266 | + global $user; |
|
267 | 267 | |
268 | - $author = $vars['message']['author']; |
|
269 | - if (!isset($vars['message']['thread_id'])) { |
|
268 | + $author = $vars['message']['author']; |
|
269 | + if (!isset($vars['message']['thread_id'])) { |
|
270 | 270 | // No thread id, this is probably only a preview |
271 | 271 | return; |
272 | - } |
|
273 | - $thread_id = $vars['message']['thread_id']; |
|
272 | + } |
|
273 | + $thread_id = $vars['message']['thread_id']; |
|
274 | 274 | |
275 | - if ($user->uid != $author->uid) { |
|
275 | + if ($user->uid != $author->uid) { |
|
276 | 276 | if ($vars['message']['is_blocked']) { |
277 | - $vars['message_actions']['unignore_user'] = array( |
|
277 | + $vars['message_actions']['unignore_user'] = array( |
|
278 | 278 | 'title' => bts('Stop Ignoring User', array(), NULL, 'boinc:ignore-user-remove'), |
279 | 279 | 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
280 | 280 | 'query' => 'destination=messages/view/' . $thread_id, |
281 | - ); |
|
281 | + ); |
|
282 | 282 | } |
283 | 283 | else { |
284 | - $vars['message_actions']['ignore_user'] = array( |
|
284 | + $vars['message_actions']['ignore_user'] = array( |
|
285 | 285 | 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
286 | 286 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
287 | 287 | 'query' => 'destination=messages/view/' . $thread_id, |
288 | - ); |
|
288 | + ); |
|
289 | + } |
|
289 | 290 | } |
290 | - } |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
294 | 294 | * Implementation of hook_cron() |
295 | 295 | */ |
296 | 296 | function boincwork_cron() { |
297 | - // Delete expired hosts in the BOINC database, host_delete table. |
|
298 | - require_boinc('boinc_db'); |
|
299 | - $num_deleted = BoincHostDeleted::delete_expired(); |
|
300 | - if ($num_deleted>0) { |
|
297 | + // Delete expired hosts in the BOINC database, host_delete table. |
|
298 | + require_boinc('boinc_db'); |
|
299 | + $num_deleted = BoincHostDeleted::delete_expired(); |
|
300 | + if ($num_deleted>0) { |
|
301 | 301 | watchdog('boincwork', "Deleted ${num_deleted} hosts from host_deleted table", WATCHDOG_NOTICE); |
302 | - } |
|
302 | + } |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -307,41 +307,41 @@ discard block |
||
307 | 307 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
308 | 308 | |
309 | 309 | /** |
310 | - * General preferences menu callback. |
|
311 | - * Called when user goes to edit preferences page |
|
312 | - */ |
|
310 | + * General preferences menu callback. |
|
311 | + * Called when user goes to edit preferences page |
|
312 | + */ |
|
313 | 313 | function generalprefs_page($action = null, $venue = null, $advanced = FALSE) { |
314 | 314 | |
315 | - // Keep the venue selected across preference pages |
|
316 | - boincwork_select_venue($venue); |
|
315 | + // Keep the venue selected across preference pages |
|
316 | + boincwork_select_venue($venue); |
|
317 | 317 | |
318 | - $pref_sets = array('generic', 'home', 'school', 'work'); |
|
319 | - $output = null; |
|
320 | - // Set the page title |
|
321 | - $title = 'Computing'; |
|
322 | - drupal_set_title($title); |
|
318 | + $pref_sets = array('generic', 'home', 'school', 'work'); |
|
319 | + $output = null; |
|
320 | + // Set the page title |
|
321 | + $title = 'Computing'; |
|
322 | + drupal_set_title($title); |
|
323 | 323 | |
324 | - switch ($action) { |
|
324 | + switch ($action) { |
|
325 | 325 | |
326 | - case 'clear': |
|
326 | + case 'clear': |
|
327 | 327 | // Remove settings from this preference set |
328 | 328 | if ($venue AND $venue != 'generic') { |
329 | - boincwork_save_prefs(NULL, 'general', $venue); |
|
330 | - drupal_set_message(t('Settings for the "@name" preference set have been |
|
329 | + boincwork_save_prefs(NULL, 'general', $venue); |
|
330 | + drupal_set_message(t('Settings for the "@name" preference set have been |
|
331 | 331 | cleared', array('@name' => ucfirst($venue)))); |
332 | - // Set the generic preference set as active |
|
333 | - $_SESSION['prefs venue'] = 'generic'; |
|
332 | + // Set the generic preference set as active |
|
333 | + $_SESSION['prefs venue'] = 'generic'; |
|
334 | 334 | } |
335 | 335 | drupal_goto(); |
336 | 336 | break; |
337 | 337 | |
338 | - case 'combined': |
|
338 | + case 'combined': |
|
339 | 339 | // Compare preference sets; tabular view |
340 | 340 | |
341 | 341 | foreach ($pref_sets as $pref_set) { |
342 | - $form_state = array(); |
|
343 | - $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set); |
|
344 | - drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state); |
|
342 | + $form_state = array(); |
|
343 | + $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set); |
|
344 | + drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>'; |
@@ -354,29 +354,29 @@ discard block |
||
354 | 354 | $prefs_table = boincwork_make_prefs_table($prefs['generic']['prefs']['advanced']); |
355 | 355 | |
356 | 356 | foreach ($prefs_table as $category => $section) { |
357 | - $output .= '<tr class="section-heading">'; |
|
358 | - $output .= "<td>{$section['name']}</td>"; |
|
359 | - foreach ($pref_sets as $pref_set) { |
|
357 | + $output .= '<tr class="section-heading">'; |
|
358 | + $output .= "<td>{$section['name']}</td>"; |
|
359 | + foreach ($pref_sets as $pref_set) { |
|
360 | 360 | $output .= '<td>' . $pref_set . '</td>'; |
361 | - } |
|
362 | - $output .= '</tr>'; |
|
363 | - foreach ($section['elements'] as $name => $setting) { |
|
361 | + } |
|
362 | + $output .= '</tr>'; |
|
363 | + foreach ($section['elements'] as $name => $setting) { |
|
364 | 364 | // Output the setting name and description, with an ugly exception |
365 | 365 | // made for preferences with special formatting |
366 | 366 | $special_map = array( |
367 | - 'start_hour' => 'end_hour', |
|
368 | - 'net_start_hour'=> 'net_end_hour', |
|
369 | - 'daily_xfer_limit_mb' => 'daily_xfer_period_days', |
|
367 | + 'start_hour' => 'end_hour', |
|
368 | + 'net_start_hour'=> 'net_end_hour', |
|
369 | + 'daily_xfer_limit_mb' => 'daily_xfer_period_days', |
|
370 | 370 | ); |
371 | 371 | $special_delimiter = array( |
372 | - 'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'), |
|
373 | - 'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'), |
|
374 | - 'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'), |
|
372 | + 'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'), |
|
373 | + 'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'), |
|
374 | + 'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'), |
|
375 | 375 | ); |
376 | 376 | $special = isset($special_map[$name]); |
377 | 377 | $very_special = in_array($name, $special_map); |
378 | 378 | if ($very_special) { |
379 | - continue; |
|
379 | + continue; |
|
380 | 380 | } |
381 | 381 | $output .= '<tr>'; |
382 | 382 | $output .= '<td>'; |
@@ -386,35 +386,35 @@ discard block |
||
386 | 386 | // Output values for each preference set, again with ugly hacks for |
387 | 387 | // time range preferences |
388 | 388 | foreach ($pref_sets as $pref_set) { |
389 | - if (($prefs[$pref_set]) AND |
|
389 | + if (($prefs[$pref_set]) AND |
|
390 | 390 | $prefs[$pref_set]['#established'] AND |
391 | 391 | isset($prefs[$pref_set]['prefs']['advanced'][$category])) { |
392 | 392 | $pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$name]; |
393 | 393 | $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value']; |
394 | 394 | if ($value == '') { |
395 | - $value = '---'; |
|
395 | + $value = '---'; |
|
396 | 396 | } |
397 | 397 | if (!isset($pref_setting['#field_suffix'])) { |
398 | - $pref_setting['#field_suffix'] = ''; |
|
398 | + $pref_setting['#field_suffix'] = ''; |
|
399 | 399 | } |
400 | 400 | if (!$special) { |
401 | - $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
|
401 | + $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
|
402 | 402 | } |
403 | 403 | else { |
404 | - // The "very special" case where we merge two prefs |
|
405 | - $second_pref = $special_map[$name]; |
|
406 | - $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
|
407 | - $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value']; |
|
408 | - $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
|
404 | + // The "very special" case where we merge two prefs |
|
405 | + $second_pref = $special_map[$name]; |
|
406 | + $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
|
407 | + $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value']; |
|
408 | + $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
|
409 | 409 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
410 | 410 | } |
411 | - } |
|
412 | - else { |
|
411 | + } |
|
412 | + else { |
|
413 | 413 | $output .= '<td>---</td>'; |
414 | - } |
|
414 | + } |
|
415 | 415 | } |
416 | 416 | $output .= '</tr>'; |
417 | - } |
|
417 | + } |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | // Empty line above action links... :/ |
@@ -430,24 +430,24 @@ discard block |
||
430 | 430 | $output .= '<tr>'; |
431 | 431 | $output .= '<td></td>'; |
432 | 432 | foreach ($pref_sets as $pref_set) { |
433 | - $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
434 | - $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
435 | - $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1", |
|
433 | + $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
434 | + $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
435 | + $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1", |
|
436 | 436 | array('fragment' => "") |
437 | - ); |
|
438 | - // Show Clear links for established preference sets |
|
439 | - if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
437 | + ); |
|
438 | + // Show Clear links for established preference sets |
|
439 | + if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
440 | 440 | $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}", |
441 | - array( |
|
441 | + array( |
|
442 | 442 | 'query' => drupal_get_destination(), |
443 | 443 | 'attributes' => array( |
444 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
444 | + 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
445 | 445 | array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')' |
446 | 446 | ) |
447 | - ) |
|
447 | + ) |
|
448 | 448 | ); |
449 | - } |
|
450 | - $output .= '</li></ul></td>'; |
|
449 | + } |
|
450 | + $output .= '</li></ul></td>'; |
|
451 | 451 | } |
452 | 452 | $output .= '</tr>'; |
453 | 453 | |
@@ -455,28 +455,28 @@ discard block |
||
455 | 455 | |
456 | 456 | break; |
457 | 457 | |
458 | - case 'edit': |
|
458 | + case 'edit': |
|
459 | 459 | default: |
460 | 460 | |
461 | 461 | // Return the HTML generated from the $form data structure. |
462 | 462 | if (function_exists('jump_quickly')) { |
463 | - $path = 'account/prefs/computing/edit'; |
|
464 | - $venues = array( |
|
463 | + $path = 'account/prefs/computing/edit'; |
|
464 | + $venues = array( |
|
465 | 465 | "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'), |
466 | 466 | "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
467 | 467 | "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'), |
468 | 468 | "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
469 | - ); |
|
470 | - variable_set('jump_use_js_venues-Array', 1); |
|
471 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
472 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
469 | + ); |
|
470 | + variable_set('jump_use_js_venues-Array', 1); |
|
471 | + drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
472 | + drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
473 | 473 | |
474 | - $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
475 | - $output .= ' <div class="form-item venue">'; |
|
476 | - $output .= ' <label>Preference set:</label>'; |
|
477 | - $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
478 | - $output .= ' </div>'; |
|
479 | - $output .= '</div>'; |
|
474 | + $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
475 | + $output .= ' <div class="form-item venue">'; |
|
476 | + $output .= ' <label>Preference set:</label>'; |
|
477 | + $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
478 | + $output .= ' </div>'; |
|
479 | + $output .= '</div>'; |
|
480 | 480 | } |
481 | 481 | $output .= drupal_get_form('boincwork_generalprefs_form', $venue, NULL, $advanced); |
482 | 482 | |
@@ -487,54 +487,54 @@ discard block |
||
487 | 487 | drupal_prepare_form('boincwork_generalprefs_form', $current_set, $form_state); |
488 | 488 | |
489 | 489 | if (!$current_set['#established']) { |
490 | - drupal_set_message(bts( |
|
491 | - "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
492 | - array( '@venue' => $venue, ), |
|
493 | - NULL, 'boinc:account-preferences'), 'status'); |
|
490 | + drupal_set_message(bts( |
|
491 | + "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
492 | + array( '@venue' => $venue, ), |
|
493 | + NULL, 'boinc:account-preferences'), 'status'); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | break; |
497 | - } |
|
497 | + } |
|
498 | 498 | |
499 | - return $output; |
|
499 | + return $output; |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | /** |
503 | - * Project preferences menu callback |
|
504 | - * Called when user goes to edit project preferences page. |
|
505 | - */ |
|
503 | + * Project preferences menu callback |
|
504 | + * Called when user goes to edit project preferences page. |
|
505 | + */ |
|
506 | 506 | function projectprefs_page($action = null, $venue = null) { |
507 | 507 | |
508 | - // Keep the venue selected across preference pages |
|
509 | - boincwork_select_venue($venue); |
|
508 | + // Keep the venue selected across preference pages |
|
509 | + boincwork_select_venue($venue); |
|
510 | 510 | |
511 | - require_boinc(array('util', 'prefs')); |
|
512 | - global $project_has_beta; |
|
513 | - $pref_sets = array('generic', 'home', 'school', 'work'); |
|
514 | - $output = null; |
|
511 | + require_boinc(array('util', 'prefs')); |
|
512 | + global $project_has_beta; |
|
513 | + $pref_sets = array('generic', 'home', 'school', 'work'); |
|
514 | + $output = null; |
|
515 | 515 | |
516 | - $title = 'Project'; |
|
517 | - drupal_set_title($title); |
|
516 | + $title = 'Project'; |
|
517 | + drupal_set_title($title); |
|
518 | 518 | |
519 | - switch ($action) { |
|
519 | + switch ($action) { |
|
520 | 520 | |
521 | - case 'clear': |
|
521 | + case 'clear': |
|
522 | 522 | // Remove settings from this preference set |
523 | 523 | if ($venue AND $venue != 'generic') { |
524 | - boincwork_save_prefs(NULL, 'project', $venue); |
|
525 | - drupal_set_message(t('Settings for the "@name" preference set have been |
|
524 | + boincwork_save_prefs(NULL, 'project', $venue); |
|
525 | + drupal_set_message(t('Settings for the "@name" preference set have been |
|
526 | 526 | cleared', array('@name' => ucfirst($venue)))); |
527 | 527 | |
528 | - // Set the generic preference set as active |
|
529 | - $_SESSION['prefs venue'] = 'generic'; |
|
528 | + // Set the generic preference set as active |
|
529 | + $_SESSION['prefs venue'] = 'generic'; |
|
530 | 530 | |
531 | - // If the user has removed their default preference set, make it generic |
|
532 | - boincwork_set_default_venue(); |
|
531 | + // If the user has removed their default preference set, make it generic |
|
532 | + boincwork_set_default_venue(); |
|
533 | 533 | } |
534 | 534 | drupal_goto(); |
535 | 535 | break; |
536 | 536 | |
537 | - case 'combined': |
|
537 | + case 'combined': |
|
538 | 538 | |
539 | 539 | // Compare preference sets; tabular view |
540 | 540 | |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | $boincuser = BoincUser::lookup_id($account->boincuser_id); |
544 | 544 | |
545 | 545 | foreach ($pref_sets as $pref_set) { |
546 | - $form_state = array(); |
|
547 | - $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set); |
|
548 | - drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state); |
|
546 | + $form_state = array(); |
|
547 | + $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set); |
|
548 | + drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['modified']['#value'])), NULL, 'boinc:account-preferences') . '</p>'; |
@@ -556,20 +556,20 @@ discard block |
||
556 | 556 | $prefs_table = boincwork_make_prefs_table($prefs['generic']); |
557 | 557 | |
558 | 558 | foreach ($prefs_table as $category => $section) { |
559 | - $output .= '<tr class="section-heading">'; |
|
560 | - $output .= "<td>{$section['name']}</td>"; |
|
561 | - foreach ($pref_sets as $pref_set) { |
|
559 | + $output .= '<tr class="section-heading">'; |
|
560 | + $output .= "<td>{$section['name']}</td>"; |
|
561 | + foreach ($pref_sets as $pref_set) { |
|
562 | 562 | $output .= '<td>' . $pref_set . '</td>'; |
563 | - } |
|
564 | - $output .= '</tr>'; |
|
565 | - foreach ($section['elements'] as $name => $setting) { |
|
563 | + } |
|
564 | + $output .= '</tr>'; |
|
565 | + foreach ($section['elements'] as $name => $setting) { |
|
566 | 566 | $output .= '<tr>'; |
567 | 567 | $output .= '<td>'; |
568 | 568 | $output .= "<div class=\"title\">{$setting['name']}</div>"; |
569 | 569 | $output .= "<div class=\"description\">{$setting['description']}</div>"; |
570 | 570 | $output .= '</td>'; |
571 | 571 | foreach ($pref_sets as $pref_set) { |
572 | - if (($prefs[$pref_set]) AND |
|
572 | + if (($prefs[$pref_set]) AND |
|
573 | 573 | $prefs[$pref_set]['#established'] AND |
574 | 574 | isset($prefs[$pref_set][$category])) { |
575 | 575 | $pref_setting = $prefs[$pref_set][$category][$name]; |
@@ -577,10 +577,10 @@ discard block |
||
577 | 577 | if ($value == '') $value = '---'; |
578 | 578 | if (!isset($pref_setting['#field_suffix'])) $pref_setting['#field_suffix'] = ''; |
579 | 579 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
580 | - } else $output .= '<td>---</td>'; |
|
580 | + } else $output .= '<td>---</td>'; |
|
581 | 581 | } |
582 | 582 | $output .= '</tr>'; |
583 | - } |
|
583 | + } |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | // Empty line above action links... :/ |
@@ -596,29 +596,29 @@ discard block |
||
596 | 596 | $output .= '<tr>'; |
597 | 597 | $output .= '<td></td>'; |
598 | 598 | foreach ($pref_sets as $pref_set) { |
599 | - $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
600 | - $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
601 | - $output .= l($action_text, "account/prefs/project/edit/{$pref_set}"); |
|
602 | - // Show Clear links for established preference sets |
|
603 | - if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
599 | + $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
600 | + $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
601 | + $output .= l($action_text, "account/prefs/project/edit/{$pref_set}"); |
|
602 | + // Show Clear links for established preference sets |
|
603 | + if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
604 | 604 | $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}", |
605 | - array( |
|
605 | + array( |
|
606 | 606 | 'query' => drupal_get_destination(), |
607 | 607 | 'attributes' => array( |
608 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
608 | + 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
609 | 609 | array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')' |
610 | 610 | ) |
611 | - ) |
|
611 | + ) |
|
612 | 612 | ); |
613 | - } |
|
614 | - $output .= '</li></ul></td>'; |
|
613 | + } |
|
614 | + $output .= '</li></ul></td>'; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | $output .= '</table>'; |
618 | 618 | |
619 | 619 | break; |
620 | 620 | |
621 | - case 'set-default': |
|
621 | + case 'set-default': |
|
622 | 622 | // Set this preference set as the one to use for any new hosts attached |
623 | 623 | // to the user account |
624 | 624 | boincwork_set_default_venue($venue); |
@@ -626,30 +626,30 @@ discard block |
||
626 | 626 | drupal_goto('account/prefs/project/combined'); |
627 | 627 | break; |
628 | 628 | |
629 | - case 'edit': |
|
629 | + case 'edit': |
|
630 | 630 | default: |
631 | 631 | |
632 | 632 | // Return the HTML generated from the $form data structure. |
633 | 633 | require_boinc('util'); |
634 | 634 | |
635 | 635 | if (function_exists('jump_quickly')) { |
636 | - $path = 'account/prefs/project/edit'; |
|
637 | - $venues = array( |
|
636 | + $path = 'account/prefs/project/edit'; |
|
637 | + $venues = array( |
|
638 | 638 | "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'), |
639 | 639 | "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
640 | 640 | "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'), |
641 | 641 | "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
642 | - ); |
|
643 | - variable_set('jump_use_js_venues-Array', 1); |
|
644 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
645 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
642 | + ); |
|
643 | + variable_set('jump_use_js_venues-Array', 1); |
|
644 | + drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
645 | + drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
646 | 646 | |
647 | - $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
648 | - $output .= ' <div class="form-item venue">'; |
|
649 | - $output .= ' <label>Preference set:</label>'; |
|
650 | - $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
651 | - $output .= ' </div>'; |
|
652 | - $output .= '</div>'; |
|
647 | + $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
648 | + $output .= ' <div class="form-item venue">'; |
|
649 | + $output .= ' <label>Preference set:</label>'; |
|
650 | + $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
651 | + $output .= ' </div>'; |
|
652 | + $output .= '</div>'; |
|
653 | 653 | } |
654 | 654 | $output .= drupal_get_form('boincwork_projectprefs_form', $venue); |
655 | 655 | |
@@ -660,63 +660,63 @@ discard block |
||
660 | 660 | drupal_prepare_form('boincwork_projectprefs_form', $current_set, $form_state); |
661 | 661 | |
662 | 662 | if (!$current_set['#established']) { |
663 | - drupal_set_message(bts( |
|
664 | - "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
665 | - array( '@venue' => $venue, ), |
|
666 | - NULL, 'boinc:account-preferences'), 'status'); |
|
663 | + drupal_set_message(bts( |
|
664 | + "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
665 | + array( '@venue' => $venue, ), |
|
666 | + NULL, 'boinc:account-preferences'), 'status'); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | break; |
670 | 670 | |
671 | - } |
|
672 | - return $output; |
|
671 | + } |
|
672 | + return $output; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | /** |
676 | - * Community preferences menu callback |
|
677 | - * Called when user goes to edit community preferences page. |
|
678 | - */ |
|
676 | + * Community preferences menu callback |
|
677 | + * Called when user goes to edit community preferences page. |
|
678 | + */ |
|
679 | 679 | function communityprefs_page($action = null) { |
680 | 680 | |
681 | - require_boinc(array('util', 'prefs')); |
|
682 | - $output = null; |
|
681 | + require_boinc(array('util', 'prefs')); |
|
682 | + $output = null; |
|
683 | 683 | |
684 | - $title = 'Community'; |
|
685 | - drupal_set_title($title); |
|
684 | + $title = 'Community'; |
|
685 | + drupal_set_title($title); |
|
686 | 686 | |
687 | - //$output .= '<h2>Community preferences</h2>'; |
|
687 | + //$output .= '<h2>Community preferences</h2>'; |
|
688 | 688 | |
689 | - $output .= drupal_get_form('communityprefs_form'); |
|
689 | + $output .= drupal_get_form('communityprefs_form'); |
|
690 | 690 | |
691 | - return $output; |
|
691 | + return $output; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | /** |
695 | - * Privacy preferences menu callback |
|
696 | - * Called when user goes to edit privacy preferences page. |
|
697 | - */ |
|
695 | + * Privacy preferences menu callback |
|
696 | + * Called when user goes to edit privacy preferences page. |
|
697 | + */ |
|
698 | 698 | function privacyprefs_page($action = null) { |
699 | 699 | |
700 | - require_boinc(array('util', 'prefs')); |
|
701 | - $output = null; |
|
702 | - $title = 'Privacy'; |
|
703 | - drupal_set_title($title); |
|
700 | + require_boinc(array('util', 'prefs')); |
|
701 | + $output = null; |
|
702 | + $title = 'Privacy'; |
|
703 | + drupal_set_title($title); |
|
704 | 704 | |
705 | - switch ($action) { |
|
706 | - case 'view': |
|
705 | + switch ($action) { |
|
706 | + case 'view': |
|
707 | 707 | $form_state = array(); |
708 | 708 | $prefs = drupal_retrieve_form('boincwork_privacyprefs_form', $form_state); |
709 | 709 | drupal_prepare_form('boincwork_privacyprefs_form', $prefs, $form_state); |
710 | 710 | $output .= '<table>'; |
711 | 711 | |
712 | 712 | $sections = array( |
713 | - 'privacy' => $prefs['privacy'] |
|
713 | + 'privacy' => $prefs['privacy'] |
|
714 | 714 | ); |
715 | 715 | |
716 | 716 | foreach ($sections as $section) { |
717 | - $output .= '<tr class="section-heading">'; |
|
718 | - $output .= "<td>{$section['#title']}</td></tr>"; |
|
719 | - foreach ($section as $name => $setting) { |
|
717 | + $output .= '<tr class="section-heading">'; |
|
718 | + $output .= "<td>{$section['#title']}</td></tr>"; |
|
719 | + foreach ($section as $name => $setting) { |
|
720 | 720 | if ($name{0} == '#') continue; |
721 | 721 | $value = isset($setting['#default_value']) ? $setting['#default_value'] : ''; |
722 | 722 | if ($value AND isset($setting['#options'])) $value = $setting['#options'][$value]; |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $output .= "<td>{$setting['#title']}<br/>{$setting['#description']}</td>"; |
729 | 729 | $output .= "<td>{$value} {$setting['#field_suffix']}</td>"; |
730 | 730 | $output .= '</tr>'; |
731 | - } |
|
731 | + } |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | // Edit preferences link |
@@ -741,33 +741,33 @@ discard block |
||
741 | 741 | |
742 | 742 | break; |
743 | 743 | |
744 | - case 'edit': |
|
744 | + case 'edit': |
|
745 | 745 | default: |
746 | 746 | require_boinc('util'); |
747 | 747 | // Return the HTML generated from the $form data structure. |
748 | 748 | $output .= drupal_get_form('boincwork_privacyprefs_form'); |
749 | 749 | break; |
750 | 750 | |
751 | - } |
|
751 | + } |
|
752 | 752 | |
753 | - return $output; |
|
753 | + return $output; |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | /** |
757 | - * Certificates menu callback |
|
758 | - * Called when user goes to account certificate pages |
|
759 | - */ |
|
757 | + * Certificates menu callback |
|
758 | + * Called when user goes to account certificate pages |
|
759 | + */ |
|
760 | 760 | function boincwork_certificates($type = null, $border = null) { |
761 | - global $user; |
|
762 | - $drupuser = user_load($user->uid); |
|
763 | - // Load BOINC account and pre-authenticate with BOINC code |
|
764 | - require_boinc(array('util', 'cert')); |
|
765 | - $boincuser = BoincUser::lookup_id($drupuser->boincuser_id); |
|
766 | - //global $g_logged_in_user; |
|
767 | - //$g_logged_in_user = $boincuser; |
|
768 | - //print_r($boincuser); exit; |
|
769 | - switch ($type) { |
|
770 | - case 'all': |
|
761 | + global $user; |
|
762 | + $drupuser = user_load($user->uid); |
|
763 | + // Load BOINC account and pre-authenticate with BOINC code |
|
764 | + require_boinc(array('util', 'cert')); |
|
765 | + $boincuser = BoincUser::lookup_id($drupuser->boincuser_id); |
|
766 | + //global $g_logged_in_user; |
|
767 | + //$g_logged_in_user = $boincuser; |
|
768 | + //print_r($boincuser); exit; |
|
769 | + switch ($type) { |
|
770 | + case 'all': |
|
771 | 771 | //include_boinc('user/cert_all.php'); |
772 | 772 | require_boinc(array('util','cert','user')); |
773 | 773 | |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | "; |
838 | 838 | break; |
839 | 839 | |
840 | - case 'account': |
|
840 | + case 'account': |
|
841 | 841 | default: |
842 | 842 | //include_boinc('user/cert1.php'); |
843 | 843 | require_boinc(array('util','cert')); |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | echo " |
914 | 914 | </td><tr></table> |
915 | 915 | "; |
916 | - } |
|
916 | + } |
|
917 | 917 | } |
918 | 918 | |
919 | 919 | /** |
@@ -921,42 +921,42 @@ discard block |
||
921 | 921 | * Called when user selects to delete a host |
922 | 922 | */ |
923 | 923 | function boincwork_host_delete($host_id) { |
924 | - // Verify that host has no tasks |
|
925 | - if (boincwork_host_user_is_owner($host_id)) { |
|
924 | + // Verify that host has no tasks |
|
925 | + if (boincwork_host_user_is_owner($host_id)) { |
|
926 | 926 | if (!boincwork_host_get_task_count($host_id)) { |
927 | - // Delete the host record |
|
928 | - db_set_active('boinc_rw'); |
|
929 | - $host_deleted = db_query( |
|
927 | + // Delete the host record |
|
928 | + db_set_active('boinc_rw'); |
|
929 | + $host_deleted = db_query( |
|
930 | 930 | "DELETE FROM {host} WHERE id = '%d'", |
931 | 931 | $host_id |
932 | - ); |
|
933 | - db_set_active('default'); |
|
934 | - if ($host_deleted) { |
|
932 | + ); |
|
933 | + db_set_active('default'); |
|
934 | + if ($host_deleted) { |
|
935 | 935 | drupal_set_message(t('Host @id has been removed from your account.', |
936 | - array('@id' => $host_id))); |
|
936 | + array('@id' => $host_id))); |
|
937 | 937 | drupal_goto('account/computers'); |
938 | - } |
|
939 | - else { |
|
938 | + } |
|
939 | + else { |
|
940 | 940 | drupal_set_message(t('Host @id could not be deleted. Not sure why...', |
941 | - array('@id' => $host_id)), 'error' |
|
941 | + array('@id' => $host_id)), 'error' |
|
942 | 942 | ); |
943 | - } |
|
943 | + } |
|
944 | 944 | } |
945 | 945 | else { |
946 | - drupal_set_message(t('Host @id cannot be deleted because it still has |
|
946 | + drupal_set_message(t('Host @id cannot be deleted because it still has |
|
947 | 947 | tasks associated with it. These tasks should be processed within the |
948 | 948 | next few days, after which the host can be deleted.', |
949 | 949 | array('@id' => $host_id)), 'warning' |
950 | - ); |
|
950 | + ); |
|
951 | + } |
|
951 | 952 | } |
952 | - } |
|
953 | - else { |
|
953 | + else { |
|
954 | 954 | drupal_set_message(t('You are not the owner of host @id, so you cannot |
955 | 955 | delete it.', |
956 | - array('@id' => $host_id)), 'error' |
|
956 | + array('@id' => $host_id)), 'error' |
|
957 | 957 | ); |
958 | - } |
|
959 | - drupal_goto("host/{$host_id}"); |
|
958 | + } |
|
959 | + drupal_goto("host/{$host_id}"); |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | /** |
@@ -964,55 +964,55 @@ discard block |
||
964 | 964 | * Called when user accesses the log for a host |
965 | 965 | */ |
966 | 966 | function boincwork_host_log($host_id = null) { |
967 | - $root_log_dir = variable_get('boinc_host_sched_logs_dir', ''); |
|
968 | - $log = ''; |
|
969 | - if ($root_log_dir AND $host_id) { |
|
967 | + $root_log_dir = variable_get('boinc_host_sched_logs_dir', ''); |
|
968 | + $log = ''; |
|
969 | + if ($root_log_dir AND $host_id) { |
|
970 | 970 | $subdir = substr($host_id, 0, -3) OR $subdir = 0; |
971 | 971 | $log = implode('/', array($root_log_dir, $subdir, $host_id)); |
972 | - } |
|
973 | - if ($log AND file_exists($log)) { |
|
972 | + } |
|
973 | + if ($log AND file_exists($log)) { |
|
974 | 974 | header('Content-type: text/plain'); |
975 | 975 | include($log); |
976 | - } |
|
976 | + } |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | function boincwork_host_set_venue($host_id = NULL, $venue = NULL) { |
980 | - global $user; |
|
981 | - $account = user_load($user->uid); |
|
982 | - db_set_active('boinc_ro'); |
|
983 | - // Verify that this is my host |
|
984 | - $host_owner = db_result(db_query( |
|
980 | + global $user; |
|
981 | + $account = user_load($user->uid); |
|
982 | + db_set_active('boinc_ro'); |
|
983 | + // Verify that this is my host |
|
984 | + $host_owner = db_result(db_query( |
|
985 | 985 | "SELECT userid FROM {host} WHERE id = '%d'", |
986 | 986 | $host_id |
987 | - )); |
|
988 | - db_set_active('default'); |
|
989 | - if ($host_owner AND $host_owner == $account->boincuser_id) { |
|
987 | + )); |
|
988 | + db_set_active('default'); |
|
989 | + if ($host_owner AND $host_owner == $account->boincuser_id) { |
|
990 | 990 | db_set_active('boinc_rw'); |
991 | 991 | $updated = db_query( |
992 | - "UPDATE {host} SET venue = '%s' WHERE id = '%d'", |
|
993 | - $venue, $host_id |
|
992 | + "UPDATE {host} SET venue = '%s' WHERE id = '%d'", |
|
993 | + $venue, $host_id |
|
994 | 994 | ); |
995 | 995 | db_set_active('default'); |
996 | 996 | if ($updated) { |
997 | - drupal_set_message( |
|
997 | + drupal_set_message( |
|
998 | 998 | bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details') |
999 | 999 | . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details') |
1000 | - ); |
|
1000 | + ); |
|
1001 | 1001 | } |
1002 | 1002 | else { |
1003 | - drupal_set_message( |
|
1003 | + drupal_set_message( |
|
1004 | 1004 | bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'), |
1005 | 1005 | 'error' |
1006 | - ); |
|
1006 | + ); |
|
1007 | 1007 | } |
1008 | - } |
|
1009 | - else { |
|
1008 | + } |
|
1009 | + else { |
|
1010 | 1010 | drupal_set_message( |
1011 | - bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
|
1012 | - 'warning' |
|
1011 | + bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
|
1012 | + 'warning' |
|
1013 | 1013 | ); |
1014 | - } |
|
1015 | - drupal_goto("host/{$host_id}"); |
|
1014 | + } |
|
1015 | + drupal_goto("host/{$host_id}"); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | /** |
@@ -1020,8 +1020,8 @@ discard block |
||
1020 | 1020 | * Called when user accesses cell phone stats |
1021 | 1021 | */ |
1022 | 1022 | function boincwork_mobile_stats($userid = null) { |
1023 | - $_GET['id'] = $userid; |
|
1024 | - include_boinc('user/userw.php'); |
|
1023 | + $_GET['id'] = $userid; |
|
1024 | + include_boinc('user/userw.php'); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | /** |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | * Called to build the server status page |
1030 | 1030 | */ |
1031 | 1031 | function boincwork_server_status() { |
1032 | - include_boinc('user/server_status.php'); |
|
1032 | + include_boinc('user/server_status.php'); |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | /** |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | * RPC for managing job input files |
1038 | 1038 | */ |
1039 | 1039 | function boincwork_job_file() { |
1040 | - include_boinc('user/job_file.php'); |
|
1040 | + include_boinc('user/job_file.php'); |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | /** |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | * Get output file from remote job submission |
1046 | 1046 | */ |
1047 | 1047 | function boincwork_get_output() { |
1048 | - include_boinc('user/get_output.php'); |
|
1048 | + include_boinc('user/get_output.php'); |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | /** |
@@ -1053,28 +1053,28 @@ discard block |
||
1053 | 1053 | * Get the project configuration XML; used by client software |
1054 | 1054 | */ |
1055 | 1055 | function boincwork_get_project_config() { |
1056 | - ob_start(); |
|
1057 | - include_boinc('user/get_project_config.php'); |
|
1058 | - $xml = ob_get_clean(); |
|
1059 | - $xml = load_configuration($xml); |
|
1060 | - |
|
1061 | - // obtain Drupal variables |
|
1062 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
1063 | - $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE); |
|
1064 | - |
|
1065 | - // If terms of use string exists and override is true, set terms-of-use |
|
1066 | - // to Drupal varaible. |
|
1067 | - if ( (!empty($termsofuse) && ($overrideboinctou)) ) { |
|
1056 | + ob_start(); |
|
1057 | + include_boinc('user/get_project_config.php'); |
|
1058 | + $xml = ob_get_clean(); |
|
1059 | + $xml = load_configuration($xml); |
|
1060 | + |
|
1061 | + // obtain Drupal variables |
|
1062 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
1063 | + $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE); |
|
1064 | + |
|
1065 | + // If terms of use string exists and override is true, set terms-of-use |
|
1066 | + // to Drupal varaible. |
|
1067 | + if ( (!empty($termsofuse) && ($overrideboinctou)) ) { |
|
1068 | 1068 | if (!empty($xml['project_config']['terms_of_use'])) { |
1069 | - // Remove any existing terms of use |
|
1070 | - unset($xml['project_config']['terms_of_use']); |
|
1069 | + // Remove any existing terms of use |
|
1070 | + unset($xml['project_config']['terms_of_use']); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | // Add terms of use from Drupal |
1074 | 1074 | $xml['project_config']['terms_of_use']['@value'] = $termsofuse; |
1075 | - } |
|
1075 | + } |
|
1076 | 1076 | |
1077 | - print save_configuration($xml); |
|
1077 | + print save_configuration($xml); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1082,16 +1082,16 @@ discard block |
||
1082 | 1082 | * Page callback for the remote job submission RPC (submit_rpc_handler.php). |
1083 | 1083 | */ |
1084 | 1084 | function boincwork_submit_rpc_handler() { |
1085 | - include_boinc('user/submit_rpc_handler.php'); |
|
1085 | + include_boinc('user/submit_rpc_handler.php'); |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | /** |
1089 | 1089 | * Page callback for user WAP (userw.php). |
1090 | 1090 | */ |
1091 | 1091 | function boincwork_user_wap() { |
1092 | - // Remove q from the GET request or BOINC will panic |
|
1093 | - unset($_GET['q']); |
|
1094 | - include_boinc('user/userw.php'); |
|
1092 | + // Remove q from the GET request or BOINC will panic |
|
1093 | + unset($_GET['q']); |
|
1094 | + include_boinc('user/userw.php'); |
|
1095 | 1095 | } |
1096 | 1096 | |
1097 | 1097 | |
@@ -1099,44 +1099,44 @@ discard block |
||
1099 | 1099 | * Page callback for user account task table |
1100 | 1100 | */ |
1101 | 1101 | function boincwork_account_task_table($tselect = NULL, $app_id = NULL) { |
1102 | - $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table'); |
|
1103 | - drupal_set_title($title); |
|
1102 | + $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table'); |
|
1103 | + drupal_set_title($title); |
|
1104 | 1104 | |
1105 | - global $user; |
|
1106 | - $account = user_load($user->uid); |
|
1107 | - return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id); |
|
1105 | + global $user; |
|
1106 | + $account = user_load($user->uid); |
|
1107 | + return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id); |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | /** |
1111 | 1111 | * Page callback for host task table |
1112 | 1112 | */ |
1113 | 1113 | function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) { |
1114 | - require_boinc( array('util', 'result') ); |
|
1114 | + require_boinc( array('util', 'result') ); |
|
1115 | 1115 | |
1116 | - $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table'); |
|
1117 | - drupal_set_title($title); |
|
1116 | + $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table'); |
|
1117 | + drupal_set_title($title); |
|
1118 | 1118 | |
1119 | - if (is_null($host_id)) { |
|
1119 | + if (is_null($host_id)) { |
|
1120 | 1120 | drupal_set_message(bts('ERROR: Invalid host ID', array(), NULL, 'boinc:host-task-table'), 'error'); |
1121 | 1121 | return ''; |
1122 | - } |
|
1122 | + } |
|
1123 | 1123 | |
1124 | - return boincwork_tasktable(2, $host_id, $tselect, $app_id); |
|
1124 | + return boincwork_tasktable(2, $host_id, $tselect, $app_id); |
|
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | /** |
1128 | 1128 | * Page callback for workunit task table |
1129 | 1129 | */ |
1130 | 1130 | function boincwork_workunit_task_table($workunit_id = NULL, $tselect = NULL, $app_id = NULL) { |
1131 | - $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table'); |
|
1132 | - drupal_set_title($title); |
|
1131 | + $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table'); |
|
1132 | + drupal_set_title($title); |
|
1133 | 1133 | |
1134 | - if (is_null($workunit_id)) { |
|
1134 | + if (is_null($workunit_id)) { |
|
1135 | 1135 | drupal_set_message(bts('ERROR: Invalid workunit ID', array(), NULL, 'boinc:workunit-task-table'), 'error'); |
1136 | 1136 | return ''; |
1137 | - } |
|
1137 | + } |
|
1138 | 1138 | |
1139 | - return boincwork_tasktable(1, $workunit_id, $tselect, $app_id); |
|
1139 | + return boincwork_tasktable(1, $workunit_id, $tselect, $app_id); |
|
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | /** |
@@ -1144,8 +1144,8 @@ discard block |
||
1144 | 1144 | * Take a node ID and render that node as a page |
1145 | 1145 | */ |
1146 | 1146 | function boincwork_view_page($nid) { |
1147 | - $node = node_load($nid); |
|
1148 | - return node_page_view($node); |
|
1147 | + $node = node_load($nid); |
|
1148 | + return node_page_view($node); |
|
1149 | 1149 | } |
1150 | 1150 | |
1151 | 1151 | |
@@ -1157,16 +1157,16 @@ discard block |
||
1157 | 1157 | * Determine which venue should be selected |
1158 | 1158 | */ |
1159 | 1159 | function boincwork_select_venue(&$venue) { |
1160 | - if (!$venue) { |
|
1160 | + if (!$venue) { |
|
1161 | 1161 | $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : NULL; |
1162 | 1162 | if ($active_venue) { |
1163 | - $venue = $active_venue; |
|
1164 | - //unset($_SESSION['prefs venue']); |
|
1163 | + $venue = $active_venue; |
|
1164 | + //unset($_SESSION['prefs venue']); |
|
1165 | + } |
|
1165 | 1166 | } |
1166 | - } |
|
1167 | - else { |
|
1167 | + else { |
|
1168 | 1168 | // Set the active venue to keep it selected between computing and project |
1169 | 1169 | // preference pages |
1170 | 1170 | $_SESSION['prefs venue'] = $venue; |
1171 | - } |
|
1171 | + } |
|
1172 | 1172 | } |
@@ -4,110 +4,110 @@ |
||
4 | 4 | * Implementation of hook_user_default_permissions(). |
5 | 5 | */ |
6 | 6 | function discussion_forums_user_default_permissions() { |
7 | - $permissions = array(); |
|
7 | + $permissions = array(); |
|
8 | 8 | |
9 | - // Exported permission: access comments |
|
10 | - $permissions['access comments'] = array( |
|
9 | + // Exported permission: access comments |
|
10 | + $permissions['access comments'] = array( |
|
11 | 11 | 'name' => 'access comments', |
12 | 12 | 'roles' => array( |
13 | - '0' => 'administrator', |
|
14 | - '1' => 'anonymous user', |
|
15 | - '2' => 'authenticated user', |
|
13 | + '0' => 'administrator', |
|
14 | + '1' => 'anonymous user', |
|
15 | + '2' => 'authenticated user', |
|
16 | 16 | ), |
17 | - ); |
|
17 | + ); |
|
18 | 18 | |
19 | - // Exported permission: administer comments |
|
20 | - $permissions['administer comments'] = array( |
|
19 | + // Exported permission: administer comments |
|
20 | + $permissions['administer comments'] = array( |
|
21 | 21 | 'name' => 'administer comments', |
22 | 22 | 'roles' => array( |
23 | - '0' => 'administrator', |
|
24 | - '1' => 'moderator', |
|
23 | + '0' => 'administrator', |
|
24 | + '1' => 'moderator', |
|
25 | 25 | ), |
26 | - ); |
|
26 | + ); |
|
27 | 27 | |
28 | - // Exported permission: administer forums |
|
29 | - $permissions['administer forums'] = array( |
|
28 | + // Exported permission: administer forums |
|
29 | + $permissions['administer forums'] = array( |
|
30 | 30 | 'name' => 'administer forums', |
31 | 31 | 'roles' => array( |
32 | - '0' => 'administrator', |
|
32 | + '0' => 'administrator', |
|
33 | 33 | ), |
34 | - ); |
|
34 | + ); |
|
35 | 35 | |
36 | - // Exported permission: assign community member role |
|
37 | - $permissions['assign community member role'] = array( |
|
36 | + // Exported permission: assign community member role |
|
37 | + $permissions['assign community member role'] = array( |
|
38 | 38 | 'name' => 'assign community member role', |
39 | 39 | 'roles' => array( |
40 | - '0' => 'moderator', |
|
40 | + '0' => 'moderator', |
|
41 | 41 | ), |
42 | - ); |
|
42 | + ); |
|
43 | 43 | |
44 | - // Exported permission: create forum topics |
|
45 | - $permissions['create forum topics'] = array( |
|
44 | + // Exported permission: create forum topics |
|
45 | + $permissions['create forum topics'] = array( |
|
46 | 46 | 'name' => 'create forum topics', |
47 | 47 | 'roles' => array( |
48 | - '0' => 'administrator', |
|
49 | - '1' => 'community member', |
|
50 | - '2' => 'moderator', |
|
51 | - '3' => 'verified contributor', |
|
48 | + '0' => 'administrator', |
|
49 | + '1' => 'community member', |
|
50 | + '2' => 'moderator', |
|
51 | + '3' => 'verified contributor', |
|
52 | 52 | ), |
53 | - ); |
|
53 | + ); |
|
54 | 54 | |
55 | - // Exported permission: delete any forum topic |
|
56 | - $permissions['delete any forum topic'] = array( |
|
55 | + // Exported permission: delete any forum topic |
|
56 | + $permissions['delete any forum topic'] = array( |
|
57 | 57 | 'name' => 'delete any forum topic', |
58 | 58 | 'roles' => array( |
59 | - '0' => 'administrator', |
|
59 | + '0' => 'administrator', |
|
60 | 60 | ), |
61 | - ); |
|
61 | + ); |
|
62 | 62 | |
63 | - // Exported permission: delete own forum topics |
|
64 | - $permissions['delete own forum topics'] = array( |
|
63 | + // Exported permission: delete own forum topics |
|
64 | + $permissions['delete own forum topics'] = array( |
|
65 | 65 | 'name' => 'delete own forum topics', |
66 | 66 | 'roles' => array( |
67 | - '0' => 'administrator', |
|
67 | + '0' => 'administrator', |
|
68 | 68 | ), |
69 | - ); |
|
69 | + ); |
|
70 | 70 | |
71 | - // Exported permission: edit any forum topic |
|
72 | - $permissions['edit any forum topic'] = array( |
|
71 | + // Exported permission: edit any forum topic |
|
72 | + $permissions['edit any forum topic'] = array( |
|
73 | 73 | 'name' => 'edit any forum topic', |
74 | 74 | 'roles' => array( |
75 | - '0' => 'administrator', |
|
76 | - '1' => 'moderator', |
|
75 | + '0' => 'administrator', |
|
76 | + '1' => 'moderator', |
|
77 | 77 | ), |
78 | - ); |
|
78 | + ); |
|
79 | 79 | |
80 | - // Exported permission: edit own forum topics |
|
81 | - $permissions['edit own forum topics'] = array( |
|
80 | + // Exported permission: edit own forum topics |
|
81 | + $permissions['edit own forum topics'] = array( |
|
82 | 82 | 'name' => 'edit own forum topics', |
83 | 83 | 'roles' => array( |
84 | - '0' => 'administrator', |
|
85 | - '1' => 'community member', |
|
86 | - '2' => 'verified contributor', |
|
84 | + '0' => 'administrator', |
|
85 | + '1' => 'community member', |
|
86 | + '2' => 'verified contributor', |
|
87 | 87 | ), |
88 | - ); |
|
88 | + ); |
|
89 | 89 | |
90 | - // Exported permission: post comments |
|
91 | - $permissions['post comments'] = array( |
|
90 | + // Exported permission: post comments |
|
91 | + $permissions['post comments'] = array( |
|
92 | 92 | 'name' => 'post comments', |
93 | 93 | 'roles' => array( |
94 | - '0' => 'administrator', |
|
95 | - '1' => 'community member', |
|
96 | - '2' => 'moderator', |
|
97 | - '3' => 'verified contributor', |
|
94 | + '0' => 'administrator', |
|
95 | + '1' => 'community member', |
|
96 | + '2' => 'moderator', |
|
97 | + '3' => 'verified contributor', |
|
98 | 98 | ), |
99 | - ); |
|
99 | + ); |
|
100 | 100 | |
101 | - // Exported permission: post comments without approval |
|
102 | - $permissions['post comments without approval'] = array( |
|
101 | + // Exported permission: post comments without approval |
|
102 | + $permissions['post comments without approval'] = array( |
|
103 | 103 | 'name' => 'post comments without approval', |
104 | 104 | 'roles' => array( |
105 | - '0' => 'administrator', |
|
106 | - '1' => 'community member', |
|
107 | - '2' => 'moderator', |
|
108 | - '3' => 'verified contributor', |
|
105 | + '0' => 'administrator', |
|
106 | + '1' => 'community member', |
|
107 | + '2' => 'moderator', |
|
108 | + '3' => 'verified contributor', |
|
109 | 109 | ), |
110 | - ); |
|
110 | + ); |
|
111 | 111 | |
112 | - return $permissions; |
|
112 | + return $permissions; |
|
113 | 113 | } |
@@ -4,113 +4,113 @@ discard block |
||
4 | 4 | * Implementation of hook_default_page_manager_pages(). |
5 | 5 | */ |
6 | 6 | function boinc_standard_default_page_manager_pages() { |
7 | - $page = new stdClass; |
|
8 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
9 | - $page->api_version = 1; |
|
10 | - $page->name = 'about_us'; |
|
11 | - $page->task = 'page'; |
|
12 | - $page->admin_title = 'About Us'; |
|
13 | - $page->admin_description = ''; |
|
14 | - $page->path = 'about.fail'; |
|
15 | - $page->access = array( |
|
7 | + $page = new stdClass; |
|
8 | + $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
9 | + $page->api_version = 1; |
|
10 | + $page->name = 'about_us'; |
|
11 | + $page->task = 'page'; |
|
12 | + $page->admin_title = 'About Us'; |
|
13 | + $page->admin_description = ''; |
|
14 | + $page->path = 'about.fail'; |
|
15 | + $page->access = array( |
|
16 | 16 | 'type' => 'none', |
17 | 17 | 'settings' => NULL, |
18 | - ); |
|
19 | - $page->menu = array(); |
|
20 | - $page->arguments = array(); |
|
21 | - $page->conf = array(); |
|
22 | - $page->default_handlers = array(); |
|
23 | - $pages['about_us'] = $page; |
|
18 | + ); |
|
19 | + $page->menu = array(); |
|
20 | + $page->arguments = array(); |
|
21 | + $page->conf = array(); |
|
22 | + $page->default_handlers = array(); |
|
23 | + $pages['about_us'] = $page; |
|
24 | 24 | |
25 | - $page = new stdClass; |
|
26 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
27 | - $page->api_version = 1; |
|
28 | - $page->name = 'account_dashboard'; |
|
29 | - $page->task = 'page'; |
|
30 | - $page->admin_title = 'Dashboard'; |
|
31 | - $page->admin_description = ''; |
|
32 | - $page->path = 'dashboard'; |
|
33 | - $page->access = array( |
|
25 | + $page = new stdClass; |
|
26 | + $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
27 | + $page->api_version = 1; |
|
28 | + $page->name = 'account_dashboard'; |
|
29 | + $page->task = 'page'; |
|
30 | + $page->admin_title = 'Dashboard'; |
|
31 | + $page->admin_description = ''; |
|
32 | + $page->path = 'dashboard'; |
|
33 | + $page->access = array( |
|
34 | 34 | 'plugins' => array( |
35 | - 1 => array( |
|
35 | + 1 => array( |
|
36 | 36 | 'name' => 'role', |
37 | 37 | 'settings' => array( |
38 | - 'rids' => array( |
|
38 | + 'rids' => array( |
|
39 | 39 | 0 => 2, |
40 | - ), |
|
40 | + ), |
|
41 | 41 | ), |
42 | 42 | 'context' => 'logged-in-user', |
43 | 43 | 'not' => FALSE, |
44 | - ), |
|
44 | + ), |
|
45 | 45 | ), |
46 | 46 | 'logic' => 'and', |
47 | 47 | 'type' => 'none', |
48 | 48 | 'settings' => NULL, |
49 | - ); |
|
50 | - $page->menu = array( |
|
49 | + ); |
|
50 | + $page->menu = array( |
|
51 | 51 | 'type' => 'none', |
52 | 52 | 'title' => 'Dashboard', |
53 | 53 | 'name' => 'navigation', |
54 | 54 | 'weight' => '0', |
55 | 55 | 'parent' => array( |
56 | - 'type' => 'normal', |
|
57 | - 'title' => 'Account', |
|
58 | - 'name' => 'navigation', |
|
59 | - 'weight' => '0', |
|
56 | + 'type' => 'normal', |
|
57 | + 'title' => 'Account', |
|
58 | + 'name' => 'navigation', |
|
59 | + 'weight' => '0', |
|
60 | 60 | ), |
61 | - ); |
|
62 | - $page->arguments = array(); |
|
63 | - $page->conf = array(); |
|
64 | - $page->default_handlers = array(); |
|
65 | - $handler = new stdClass; |
|
66 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
67 | - $handler->api_version = 1; |
|
68 | - $handler->name = 'page_account_dashboard_panel_context'; |
|
69 | - $handler->task = 'page'; |
|
70 | - $handler->subtask = 'account_dashboard'; |
|
71 | - $handler->handler = 'panel_context'; |
|
72 | - $handler->weight = 0; |
|
73 | - $handler->conf = array( |
|
61 | + ); |
|
62 | + $page->arguments = array(); |
|
63 | + $page->conf = array(); |
|
64 | + $page->default_handlers = array(); |
|
65 | + $handler = new stdClass; |
|
66 | + $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
67 | + $handler->api_version = 1; |
|
68 | + $handler->name = 'page_account_dashboard_panel_context'; |
|
69 | + $handler->task = 'page'; |
|
70 | + $handler->subtask = 'account_dashboard'; |
|
71 | + $handler->handler = 'panel_context'; |
|
72 | + $handler->weight = 0; |
|
73 | + $handler->conf = array( |
|
74 | 74 | 'title' => 'Landing page', |
75 | 75 | 'no_blocks' => FALSE, |
76 | 76 | 'pipeline' => 'ipe', |
77 | 77 | 'css_id' => '', |
78 | 78 | 'css' => '', |
79 | 79 | 'contexts' => array( |
80 | - 0 => array( |
|
80 | + 0 => array( |
|
81 | 81 | 'name' => 'user', |
82 | 82 | 'id' => 1, |
83 | 83 | 'identifier' => 'User', |
84 | 84 | 'keyword' => 'user', |
85 | 85 | 'context_settings' => array( |
86 | - 'type' => 'current', |
|
87 | - 'user' => '', |
|
88 | - 'uid' => '', |
|
86 | + 'type' => 'current', |
|
87 | + 'user' => '', |
|
88 | + 'uid' => '', |
|
89 | + ), |
|
89 | 90 | ), |
90 | - ), |
|
91 | 91 | ), |
92 | 92 | 'relationships' => array(), |
93 | 93 | 'access' => array( |
94 | - 'plugins' => array(), |
|
95 | - 'logic' => 'and', |
|
94 | + 'plugins' => array(), |
|
95 | + 'logic' => 'and', |
|
96 | 96 | ), |
97 | - ); |
|
98 | - $display = new panels_display; |
|
99 | - $display->layout = 'one_sidebar_second'; |
|
100 | - $display->layout_settings = array(); |
|
101 | - $display->panel_settings = array( |
|
97 | + ); |
|
98 | + $display = new panels_display; |
|
99 | + $display->layout = 'one_sidebar_second'; |
|
100 | + $display->layout_settings = array(); |
|
101 | + $display->panel_settings = array( |
|
102 | 102 | 'style_settings' => array( |
103 | - 'default' => NULL, |
|
104 | - 'content' => NULL, |
|
105 | - 'sidebar_first' => NULL, |
|
103 | + 'default' => NULL, |
|
104 | + 'content' => NULL, |
|
105 | + 'sidebar_first' => NULL, |
|
106 | 106 | ), |
107 | - ); |
|
108 | - $display->cache = array(); |
|
109 | - $display->title = 'Dashboard'; |
|
110 | - $display->storage_type = 'page_manager'; |
|
111 | - $display->storage_id = 'page_account_dashboard_panel_context'; |
|
112 | - $display->content = array(); |
|
113 | - $display->panels = array(); |
|
107 | + ); |
|
108 | + $display->cache = array(); |
|
109 | + $display->title = 'Dashboard'; |
|
110 | + $display->storage_type = 'page_manager'; |
|
111 | + $display->storage_id = 'page_account_dashboard_panel_context'; |
|
112 | + $display->content = array(); |
|
113 | + $display->panels = array(); |
|
114 | 114 | $pane = new stdClass; |
115 | 115 | $pane->pid = 'new-1'; |
116 | 116 | $pane->panel = 'content'; |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | $pane->shown = TRUE; |
120 | 120 | $pane->access = array(); |
121 | 121 | $pane->configuration = array( |
122 | - 'override_title' => 1, |
|
123 | - 'override_title_text' => 'My stats', |
|
122 | + 'override_title' => 1, |
|
123 | + 'override_title_text' => 'My stats', |
|
124 | 124 | ); |
125 | 125 | $pane->cache = array(); |
126 | 126 | $pane->style = array( |
127 | - 'settings' => NULL, |
|
127 | + 'settings' => NULL, |
|
128 | 128 | ); |
129 | 129 | $pane->css = array( |
130 | - 'css_id' => '', |
|
131 | - 'css_class' => 'panel-primary container shadow', |
|
130 | + 'css_id' => '', |
|
131 | + 'css_class' => 'panel-primary container shadow', |
|
132 | 132 | ); |
133 | 133 | $pane->extras = array(); |
134 | 134 | $pane->position = 0; |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $pane->configuration = array(); |
145 | 145 | $pane->cache = array(); |
146 | 146 | $pane->style = array( |
147 | - 'settings' => NULL, |
|
147 | + 'settings' => NULL, |
|
148 | 148 | ); |
149 | 149 | $pane->css = array( |
150 | - 'css_id' => '', |
|
151 | - 'css_class' => 'panel-primary container shadow', |
|
150 | + 'css_id' => '', |
|
151 | + 'css_class' => 'panel-primary container shadow', |
|
152 | 152 | ); |
153 | 153 | $pane->extras = array(); |
154 | 154 | $pane->position = 1; |
@@ -161,31 +161,31 @@ discard block |
||
161 | 161 | $pane->subtype = 'custom'; |
162 | 162 | $pane->shown = TRUE; |
163 | 163 | $pane->access = array( |
164 | - 'plugins' => array( |
|
164 | + 'plugins' => array( |
|
165 | 165 | 1 => array( |
166 | - 'name' => 'perm', |
|
167 | - 'settings' => array( |
|
166 | + 'name' => 'perm', |
|
167 | + 'settings' => array( |
|
168 | 168 | 'perm' => 'edit any profile content', |
169 | - ), |
|
170 | - 'context' => 'context_user_1', |
|
171 | - 'not' => FALSE, |
|
169 | + ), |
|
170 | + 'context' => 'context_user_1', |
|
171 | + 'not' => FALSE, |
|
172 | + ), |
|
172 | 173 | ), |
173 | - ), |
|
174 | 174 | ); |
175 | 175 | $pane->configuration = array( |
176 | - 'admin_title' => 'Moderation overview', |
|
177 | - 'title' => '', |
|
178 | - 'body' => '<?php print boinccore_moderation_overview_panel(); ?>', |
|
179 | - 'format' => '3', |
|
180 | - 'substitute' => 1, |
|
176 | + 'admin_title' => 'Moderation overview', |
|
177 | + 'title' => '', |
|
178 | + 'body' => '<?php print boinccore_moderation_overview_panel(); ?>', |
|
179 | + 'format' => '3', |
|
180 | + 'substitute' => 1, |
|
181 | 181 | ); |
182 | 182 | $pane->cache = array(); |
183 | 183 | $pane->style = array( |
184 | - 'settings' => NULL, |
|
184 | + 'settings' => NULL, |
|
185 | 185 | ); |
186 | 186 | $pane->css = array( |
187 | - 'css_id' => '', |
|
188 | - 'css_class' => 'panel-secondary container shadow', |
|
187 | + 'css_id' => '', |
|
188 | + 'css_class' => 'panel-secondary container shadow', |
|
189 | 189 | ); |
190 | 190 | $pane->extras = array(); |
191 | 191 | $pane->position = 0; |
@@ -199,16 +199,16 @@ discard block |
||
199 | 199 | $pane->shown = TRUE; |
200 | 200 | $pane->access = array(); |
201 | 201 | $pane->configuration = array( |
202 | - 'override_title' => 0, |
|
203 | - 'override_title_text' => '', |
|
202 | + 'override_title' => 0, |
|
203 | + 'override_title_text' => '', |
|
204 | 204 | ); |
205 | 205 | $pane->cache = array(); |
206 | 206 | $pane->style = array( |
207 | - 'settings' => NULL, |
|
207 | + 'settings' => NULL, |
|
208 | 208 | ); |
209 | 209 | $pane->css = array( |
210 | - 'css_id' => '', |
|
211 | - 'css_class' => 'panel-secondary container shadow', |
|
210 | + 'css_id' => '', |
|
211 | + 'css_class' => 'panel-secondary container shadow', |
|
212 | 212 | ); |
213 | 213 | $pane->extras = array(); |
214 | 214 | $pane->position = 1; |
@@ -222,23 +222,23 @@ discard block |
||
222 | 222 | $pane->shown = TRUE; |
223 | 223 | $pane->access = array(); |
224 | 224 | $pane->configuration = array( |
225 | - 'admin_title' => 'Team summary', |
|
226 | - 'title' => '', |
|
227 | - 'body' => '<?php |
|
225 | + 'admin_title' => 'Team summary', |
|
226 | + 'title' => '', |
|
227 | + 'body' => '<?php |
|
228 | 228 | if (module_exists(\'boincteam\')) { |
229 | 229 | echo boincteam_dashboard_panel(); |
230 | 230 | } |
231 | 231 | ?>', |
232 | - 'format' => '3', |
|
233 | - 'substitute' => 1, |
|
232 | + 'format' => '3', |
|
233 | + 'substitute' => 1, |
|
234 | 234 | ); |
235 | 235 | $pane->cache = array(); |
236 | 236 | $pane->style = array( |
237 | - 'settings' => NULL, |
|
237 | + 'settings' => NULL, |
|
238 | 238 | ); |
239 | 239 | $pane->css = array( |
240 | - 'css_id' => 'team-dashboard-pane', |
|
241 | - 'css_class' => 'panel-secondary container shadow', |
|
240 | + 'css_id' => 'team-dashboard-pane', |
|
241 | + 'css_class' => 'panel-secondary container shadow', |
|
242 | 242 | ); |
243 | 243 | $pane->extras = array(); |
244 | 244 | $pane->position = 2; |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | $pane->shown = TRUE; |
253 | 253 | $pane->access = array(); |
254 | 254 | $pane->configuration = array( |
255 | - 'admin_title' => 'User activity summary', |
|
256 | - 'title' => '', |
|
257 | - 'body' => '<?php |
|
255 | + 'admin_title' => 'User activity summary', |
|
256 | + 'title' => '', |
|
257 | + 'body' => '<?php |
|
258 | 258 | |
259 | 259 | global $user; |
260 | 260 | $uid = $user->uid; |
@@ -263,16 +263,16 @@ discard block |
||
263 | 263 | echo \'<div class="item-count-wrapper"><div class="item-count">\' . $account->post_count . \'</div></div>\'; |
264 | 264 | |
265 | 265 | ?>', |
266 | - 'format' => '3', |
|
267 | - 'substitute' => 1, |
|
266 | + 'format' => '3', |
|
267 | + 'substitute' => 1, |
|
268 | 268 | ); |
269 | 269 | $pane->cache = array(); |
270 | 270 | $pane->style = array( |
271 | - 'settings' => NULL, |
|
271 | + 'settings' => NULL, |
|
272 | 272 | ); |
273 | 273 | $pane->css = array( |
274 | - 'css_id' => '', |
|
275 | - 'css_class' => 'panel-secondary container shadow', |
|
274 | + 'css_id' => '', |
|
275 | + 'css_class' => 'panel-secondary container shadow', |
|
276 | 276 | ); |
277 | 277 | $pane->extras = array(); |
278 | 278 | $pane->position = 3; |
@@ -286,74 +286,74 @@ discard block |
||
286 | 286 | $pane->shown = TRUE; |
287 | 287 | $pane->access = array(); |
288 | 288 | $pane->configuration = array( |
289 | - 'override_pager_settings' => 0, |
|
290 | - 'use_pager' => 0, |
|
291 | - 'nodes_per_page' => '6', |
|
292 | - 'pager_id' => '', |
|
293 | - 'offset' => '0', |
|
294 | - 'more_link' => 1, |
|
295 | - 'feed_icons' => 0, |
|
296 | - 'panel_args' => 0, |
|
297 | - 'link_to_view' => 0, |
|
298 | - 'args' => '', |
|
299 | - 'url' => '', |
|
300 | - 'display' => 'block_1', |
|
301 | - 'context' => array( |
|
289 | + 'override_pager_settings' => 0, |
|
290 | + 'use_pager' => 0, |
|
291 | + 'nodes_per_page' => '6', |
|
292 | + 'pager_id' => '', |
|
293 | + 'offset' => '0', |
|
294 | + 'more_link' => 1, |
|
295 | + 'feed_icons' => 0, |
|
296 | + 'panel_args' => 0, |
|
297 | + 'link_to_view' => 0, |
|
298 | + 'args' => '', |
|
299 | + 'url' => '', |
|
300 | + 'display' => 'block_1', |
|
301 | + 'context' => array( |
|
302 | 302 | 0 => 'context_user_1.uid', |
303 | - ), |
|
304 | - 'override_title' => 0, |
|
305 | - 'override_title_text' => '', |
|
303 | + ), |
|
304 | + 'override_title' => 0, |
|
305 | + 'override_title_text' => '', |
|
306 | 306 | ); |
307 | 307 | $pane->cache = array(); |
308 | 308 | $pane->style = array( |
309 | - 'settings' => NULL, |
|
309 | + 'settings' => NULL, |
|
310 | 310 | ); |
311 | 311 | $pane->css = array( |
312 | - 'css_id' => '', |
|
313 | - 'css_class' => 'panel-secondary container shadow', |
|
312 | + 'css_id' => '', |
|
313 | + 'css_class' => 'panel-secondary container shadow', |
|
314 | 314 | ); |
315 | 315 | $pane->extras = array(); |
316 | 316 | $pane->position = 4; |
317 | 317 | $display->content['new-7'] = $pane; |
318 | 318 | $display->panels['sidebar_first'][4] = 'new-7'; |
319 | - $display->hide_title = PANELS_TITLE_FIXED; |
|
320 | - $display->title_pane = 'new-1'; |
|
321 | - $handler->conf['display'] = $display; |
|
322 | - $page->default_handlers[$handler->name] = $handler; |
|
323 | - $pages['account_dashboard'] = $page; |
|
319 | + $display->hide_title = PANELS_TITLE_FIXED; |
|
320 | + $display->title_pane = 'new-1'; |
|
321 | + $handler->conf['display'] = $display; |
|
322 | + $page->default_handlers[$handler->name] = $handler; |
|
323 | + $pages['account_dashboard'] = $page; |
|
324 | 324 | |
325 | - $page = new stdClass; |
|
326 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
327 | - $page->api_version = 1; |
|
328 | - $page->name = 'boinc_user'; |
|
329 | - $page->task = 'page'; |
|
330 | - $page->admin_title = 'User profile template (boinc)'; |
|
331 | - $page->admin_description = ''; |
|
332 | - $page->path = 'account/%user'; |
|
333 | - $page->access = array( |
|
325 | + $page = new stdClass; |
|
326 | + $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
327 | + $page->api_version = 1; |
|
328 | + $page->name = 'boinc_user'; |
|
329 | + $page->task = 'page'; |
|
330 | + $page->admin_title = 'User profile template (boinc)'; |
|
331 | + $page->admin_description = ''; |
|
332 | + $page->path = 'account/%user'; |
|
333 | + $page->access = array( |
|
334 | 334 | 'type' => 'none', |
335 | 335 | 'settings' => NULL, |
336 | - ); |
|
337 | - $page->menu = array(); |
|
338 | - $page->arguments = array( |
|
336 | + ); |
|
337 | + $page->menu = array(); |
|
338 | + $page->arguments = array( |
|
339 | 339 | 'user' => array( |
340 | - 'id' => 1, |
|
341 | - 'identifier' => 'User: ID', |
|
342 | - 'name' => 'uid', |
|
343 | - 'settings' => array(), |
|
340 | + 'id' => 1, |
|
341 | + 'identifier' => 'User: ID', |
|
342 | + 'name' => 'uid', |
|
343 | + 'settings' => array(), |
|
344 | 344 | ), |
345 | - ); |
|
346 | - $page->conf = array(); |
|
347 | - $page->default_handlers = array(); |
|
348 | - $handler = new stdClass; |
|
349 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
350 | - $handler->api_version = 1; |
|
351 | - $handler->name = 'page_boinc_user_panel_context_2'; |
|
352 | - $handler->task = 'page'; |
|
353 | - $handler->subtask = 'boinc_user'; |
|
354 | - $handler->handler = 'panel_context'; |
|
355 | - $handler->weight = 1; |
|
356 | - $handler->conf = array( |
|
345 | + ); |
|
346 | + $page->conf = array(); |
|
347 | + $page->default_handlers = array(); |
|
348 | + $handler = new stdClass; |
|
349 | + $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
350 | + $handler->api_version = 1; |
|
351 | + $handler->name = 'page_boinc_user_panel_context_2'; |
|
352 | + $handler->task = 'page'; |
|
353 | + $handler->subtask = 'boinc_user'; |
|
354 | + $handler->handler = 'panel_context'; |
|
355 | + $handler->weight = 1; |
|
356 | + $handler->conf = array( |
|
357 | 357 | 'title' => 'Panel', |
358 | 358 | 'no_blocks' => 0, |
359 | 359 | 'pipeline' => 'standard', |
@@ -362,37 +362,37 @@ discard block |
||
362 | 362 | 'contexts' => array(), |
363 | 363 | 'relationships' => array(), |
364 | 364 | 'access' => array( |
365 | - 'plugins' => array( |
|
365 | + 'plugins' => array( |
|
366 | 366 | 0 => array( |
367 | - 'name' => 'php', |
|
368 | - 'settings' => array( |
|
367 | + 'name' => 'php', |
|
368 | + 'settings' => array( |
|
369 | 369 | 'description' => 'if user status then show profile', |
370 | 370 | 'php' => '$account = $contexts[\'argument_uid_1\']->data; |
371 | 371 | return ($account->status); |
372 | 372 | ', |
373 | - ), |
|
374 | - 'not' => FALSE, |
|
373 | + ), |
|
374 | + 'not' => FALSE, |
|
375 | + ), |
|
375 | 376 | ), |
376 | - ), |
|
377 | - 'logic' => 'and', |
|
377 | + 'logic' => 'and', |
|
378 | 378 | ), |
379 | - ); |
|
380 | - $display = new panels_display; |
|
381 | - $display->layout = 'one_sidebar_second'; |
|
382 | - $display->layout_settings = array(); |
|
383 | - $display->panel_settings = array( |
|
379 | + ); |
|
380 | + $display = new panels_display; |
|
381 | + $display->layout = 'one_sidebar_second'; |
|
382 | + $display->layout_settings = array(); |
|
383 | + $display->panel_settings = array( |
|
384 | 384 | 'style_settings' => array( |
385 | - 'default' => NULL, |
|
386 | - 'content' => NULL, |
|
387 | - 'sidebar_first' => NULL, |
|
385 | + 'default' => NULL, |
|
386 | + 'content' => NULL, |
|
387 | + 'sidebar_first' => NULL, |
|
388 | 388 | ), |
389 | - ); |
|
390 | - $display->cache = array(); |
|
391 | - $display->title = 'Account'; |
|
392 | - $display->storage_type = 'page_manager'; |
|
393 | - $display->storage_id = 'page_boinc_user_panel_context_2'; |
|
394 | - $display->content = array(); |
|
395 | - $display->panels = array(); |
|
389 | + ); |
|
390 | + $display->cache = array(); |
|
391 | + $display->title = 'Account'; |
|
392 | + $display->storage_type = 'page_manager'; |
|
393 | + $display->storage_id = 'page_boinc_user_panel_context_2'; |
|
394 | + $display->content = array(); |
|
395 | + $display->panels = array(); |
|
396 | 396 | $pane = new stdClass; |
397 | 397 | $pane->pid = 'new-1'; |
398 | 398 | $pane->panel = 'content'; |
@@ -401,19 +401,19 @@ discard block |
||
401 | 401 | $pane->shown = TRUE; |
402 | 402 | $pane->access = array(); |
403 | 403 | $pane->configuration = array( |
404 | - 'context' => array( |
|
404 | + 'context' => array( |
|
405 | 405 | 0 => 'argument_uid_1', |
406 | - ), |
|
407 | - 'override_title' => 0, |
|
408 | - 'override_title_text' => '', |
|
406 | + ), |
|
407 | + 'override_title' => 0, |
|
408 | + 'override_title_text' => '', |
|
409 | 409 | ); |
410 | 410 | $pane->cache = array(); |
411 | 411 | $pane->style = array( |
412 | - 'settings' => NULL, |
|
412 | + 'settings' => NULL, |
|
413 | 413 | ); |
414 | 414 | $pane->css = array( |
415 | - 'css_id' => '', |
|
416 | - 'css_class' => 'panel-primary container shadow', |
|
415 | + 'css_id' => '', |
|
416 | + 'css_class' => 'panel-primary container shadow', |
|
417 | 417 | ); |
418 | 418 | $pane->extras = array(); |
419 | 419 | $pane->position = 0; |
@@ -427,16 +427,16 @@ discard block |
||
427 | 427 | $pane->shown = TRUE; |
428 | 428 | $pane->access = array(); |
429 | 429 | $pane->configuration = array( |
430 | - 'override_title' => 0, |
|
431 | - 'override_title_text' => '', |
|
430 | + 'override_title' => 0, |
|
431 | + 'override_title_text' => '', |
|
432 | 432 | ); |
433 | 433 | $pane->cache = array(); |
434 | 434 | $pane->style = array( |
435 | - 'settings' => NULL, |
|
435 | + 'settings' => NULL, |
|
436 | 436 | ); |
437 | 437 | $pane->css = array( |
438 | - 'css_id' => '', |
|
439 | - 'css_class' => 'panel-secondary container shadow', |
|
438 | + 'css_id' => '', |
|
439 | + 'css_class' => 'panel-secondary container shadow', |
|
440 | 440 | ); |
441 | 441 | $pane->extras = array(); |
442 | 442 | $pane->position = 0; |
@@ -450,23 +450,23 @@ discard block |
||
450 | 450 | $pane->shown = TRUE; |
451 | 451 | $pane->access = array(); |
452 | 452 | $pane->configuration = array( |
453 | - 'admin_title' => 'Team summary', |
|
454 | - 'title' => '', |
|
455 | - 'body' => '<?php |
|
453 | + 'admin_title' => 'Team summary', |
|
454 | + 'title' => '', |
|
455 | + 'body' => '<?php |
|
456 | 456 | if (module_exists(\'boincteam\')) { |
457 | 457 | echo boincteam_dashboard_panel(%user:uid); |
458 | 458 | } |
459 | 459 | ?>', |
460 | - 'format' => '3', |
|
461 | - 'substitute' => 1, |
|
460 | + 'format' => '3', |
|
461 | + 'substitute' => 1, |
|
462 | 462 | ); |
463 | 463 | $pane->cache = array(); |
464 | 464 | $pane->style = array( |
465 | - 'settings' => NULL, |
|
465 | + 'settings' => NULL, |
|
466 | 466 | ); |
467 | 467 | $pane->css = array( |
468 | - 'css_id' => 'team-dashboard-pane', |
|
469 | - 'css_class' => 'panel-secondary container shadow', |
|
468 | + 'css_id' => 'team-dashboard-pane', |
|
469 | + 'css_class' => 'panel-secondary container shadow', |
|
470 | 470 | ); |
471 | 471 | $pane->extras = array(); |
472 | 472 | $pane->position = 1; |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | $pane->shown = TRUE; |
481 | 481 | $pane->access = array(); |
482 | 482 | $pane->configuration = array( |
483 | - 'admin_title' => 'User activity summary', |
|
484 | - 'title' => '', |
|
485 | - 'body' => '<?php |
|
483 | + 'admin_title' => 'User activity summary', |
|
484 | + 'title' => '', |
|
485 | + 'body' => '<?php |
|
486 | 486 | |
487 | 487 | $uid = arg(1); |
488 | 488 | $account = user_load($uid); |
@@ -490,16 +490,16 @@ discard block |
||
490 | 490 | echo \'<div class="item-count-wrapper"><div class="item-count">\' . $account->post_count . \'</div></div>\'; |
491 | 491 | |
492 | 492 | ?>', |
493 | - 'format' => '3', |
|
494 | - 'substitute' => 0, |
|
493 | + 'format' => '3', |
|
494 | + 'substitute' => 0, |
|
495 | 495 | ); |
496 | 496 | $pane->cache = array(); |
497 | 497 | $pane->style = array( |
498 | - 'settings' => NULL, |
|
498 | + 'settings' => NULL, |
|
499 | 499 | ); |
500 | 500 | $pane->css = array( |
501 | - 'css_id' => '', |
|
502 | - 'css_class' => 'panel-secondary container shadow', |
|
501 | + 'css_id' => '', |
|
502 | + 'css_class' => 'panel-secondary container shadow', |
|
503 | 503 | ); |
504 | 504 | $pane->extras = array(); |
505 | 505 | $pane->position = 2; |
@@ -513,31 +513,31 @@ discard block |
||
513 | 513 | $pane->shown = TRUE; |
514 | 514 | $pane->access = array(); |
515 | 515 | $pane->configuration = array( |
516 | - 'override_pager_settings' => 0, |
|
517 | - 'use_pager' => 0, |
|
518 | - 'nodes_per_page' => '6', |
|
519 | - 'pager_id' => '', |
|
520 | - 'offset' => '0', |
|
521 | - 'more_link' => 0, |
|
522 | - 'feed_icons' => 0, |
|
523 | - 'panel_args' => 0, |
|
524 | - 'link_to_view' => 0, |
|
525 | - 'args' => '', |
|
526 | - 'url' => '', |
|
527 | - 'display' => 'block_1', |
|
528 | - 'context' => array( |
|
516 | + 'override_pager_settings' => 0, |
|
517 | + 'use_pager' => 0, |
|
518 | + 'nodes_per_page' => '6', |
|
519 | + 'pager_id' => '', |
|
520 | + 'offset' => '0', |
|
521 | + 'more_link' => 0, |
|
522 | + 'feed_icons' => 0, |
|
523 | + 'panel_args' => 0, |
|
524 | + 'link_to_view' => 0, |
|
525 | + 'args' => '', |
|
526 | + 'url' => '', |
|
527 | + 'display' => 'block_1', |
|
528 | + 'context' => array( |
|
529 | 529 | 0 => 'argument_uid_1.uid', |
530 | - ), |
|
531 | - 'override_title' => 0, |
|
532 | - 'override_title_text' => '', |
|
530 | + ), |
|
531 | + 'override_title' => 0, |
|
532 | + 'override_title_text' => '', |
|
533 | 533 | ); |
534 | 534 | $pane->cache = array(); |
535 | 535 | $pane->style = array( |
536 | - 'settings' => NULL, |
|
536 | + 'settings' => NULL, |
|
537 | 537 | ); |
538 | 538 | $pane->css = array( |
539 | - 'css_id' => '', |
|
540 | - 'css_class' => 'panel-secondary container shadow', |
|
539 | + 'css_id' => '', |
|
540 | + 'css_class' => 'panel-secondary container shadow', |
|
541 | 541 | ); |
542 | 542 | $pane->extras = array(); |
543 | 543 | $pane->position = 3; |
@@ -551,66 +551,66 @@ discard block |
||
551 | 551 | $pane->shown = TRUE; |
552 | 552 | $pane->access = array(); |
553 | 553 | $pane->configuration = array( |
554 | - 'admin_title' => 'Project list', |
|
555 | - 'title' => 'Projects', |
|
556 | - 'body' => '<?php echo boincuser_get_projects_table(%user:uid); ?>', |
|
557 | - 'format' => '3', |
|
558 | - 'substitute' => 1, |
|
554 | + 'admin_title' => 'Project list', |
|
555 | + 'title' => 'Projects', |
|
556 | + 'body' => '<?php echo boincuser_get_projects_table(%user:uid); ?>', |
|
557 | + 'format' => '3', |
|
558 | + 'substitute' => 1, |
|
559 | 559 | ); |
560 | 560 | $pane->cache = array(); |
561 | 561 | $pane->style = array( |
562 | - 'settings' => NULL, |
|
562 | + 'settings' => NULL, |
|
563 | 563 | ); |
564 | 564 | $pane->css = array( |
565 | - 'css_id' => '', |
|
566 | - 'css_class' => 'panel-secondary container shadow', |
|
565 | + 'css_id' => '', |
|
566 | + 'css_class' => 'panel-secondary container shadow', |
|
567 | 567 | ); |
568 | 568 | $pane->extras = array(); |
569 | 569 | $pane->position = 4; |
570 | 570 | $display->content['new-6'] = $pane; |
571 | 571 | $display->panels['sidebar_first'][4] = 'new-6'; |
572 | - $display->hide_title = PANELS_TITLE_FIXED; |
|
573 | - $display->title_pane = '0'; |
|
574 | - $handler->conf['display'] = $display; |
|
575 | - $page->default_handlers[$handler->name] = $handler; |
|
576 | - $pages['boinc_user'] = $page; |
|
572 | + $display->hide_title = PANELS_TITLE_FIXED; |
|
573 | + $display->title_pane = '0'; |
|
574 | + $handler->conf['display'] = $display; |
|
575 | + $page->default_handlers[$handler->name] = $handler; |
|
576 | + $pages['boinc_user'] = $page; |
|
577 | 577 | |
578 | - $page = new stdClass; |
|
579 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
580 | - $page->api_version = 1; |
|
581 | - $page->name = 'home'; |
|
582 | - $page->task = 'page'; |
|
583 | - $page->admin_title = 'Home page'; |
|
584 | - $page->admin_description = ''; |
|
585 | - $page->path = 'home'; |
|
586 | - $page->access = array( |
|
578 | + $page = new stdClass; |
|
579 | + $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
580 | + $page->api_version = 1; |
|
581 | + $page->name = 'home'; |
|
582 | + $page->task = 'page'; |
|
583 | + $page->admin_title = 'Home page'; |
|
584 | + $page->admin_description = ''; |
|
585 | + $page->path = 'home'; |
|
586 | + $page->access = array( |
|
587 | 587 | 'type' => 'none', |
588 | 588 | 'settings' => NULL, |
589 | - ); |
|
590 | - $page->menu = array( |
|
589 | + ); |
|
590 | + $page->menu = array( |
|
591 | 591 | 'type' => 'normal', |
592 | 592 | 'title' => 'Home', |
593 | 593 | 'name' => 'navigation', |
594 | 594 | 'weight' => '0', |
595 | 595 | 'parent' => array( |
596 | - 'type' => 'none', |
|
597 | - 'title' => '', |
|
598 | - 'name' => 'navigation', |
|
599 | - 'weight' => '0', |
|
596 | + 'type' => 'none', |
|
597 | + 'title' => '', |
|
598 | + 'name' => 'navigation', |
|
599 | + 'weight' => '0', |
|
600 | 600 | ), |
601 | - ); |
|
602 | - $page->arguments = array(); |
|
603 | - $page->conf = array(); |
|
604 | - $page->default_handlers = array(); |
|
605 | - $handler = new stdClass; |
|
606 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
607 | - $handler->api_version = 1; |
|
608 | - $handler->name = 'page_home_panel_context'; |
|
609 | - $handler->task = 'page'; |
|
610 | - $handler->subtask = 'home'; |
|
611 | - $handler->handler = 'panel_context'; |
|
612 | - $handler->weight = 0; |
|
613 | - $handler->conf = array( |
|
601 | + ); |
|
602 | + $page->arguments = array(); |
|
603 | + $page->conf = array(); |
|
604 | + $page->default_handlers = array(); |
|
605 | + $handler = new stdClass; |
|
606 | + $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
607 | + $handler->api_version = 1; |
|
608 | + $handler->name = 'page_home_panel_context'; |
|
609 | + $handler->task = 'page'; |
|
610 | + $handler->subtask = 'home'; |
|
611 | + $handler->handler = 'panel_context'; |
|
612 | + $handler->weight = 0; |
|
613 | + $handler->conf = array( |
|
614 | 614 | 'title' => 'Landing page', |
615 | 615 | 'no_blocks' => FALSE, |
616 | 616 | 'pipeline' => 'ipe', |
@@ -618,23 +618,23 @@ discard block |
||
618 | 618 | 'css' => '', |
619 | 619 | 'contexts' => array(), |
620 | 620 | 'relationships' => array(), |
621 | - ); |
|
622 | - $display = new panels_display; |
|
623 | - $display->layout = 'one_sidebar_second'; |
|
624 | - $display->layout_settings = array(); |
|
625 | - $display->panel_settings = array( |
|
621 | + ); |
|
622 | + $display = new panels_display; |
|
623 | + $display->layout = 'one_sidebar_second'; |
|
624 | + $display->layout_settings = array(); |
|
625 | + $display->panel_settings = array( |
|
626 | 626 | 'style_settings' => array( |
627 | - 'default' => NULL, |
|
628 | - 'content' => NULL, |
|
629 | - 'sidebar_first' => NULL, |
|
627 | + 'default' => NULL, |
|
628 | + 'content' => NULL, |
|
629 | + 'sidebar_first' => NULL, |
|
630 | 630 | ), |
631 | - ); |
|
632 | - $display->cache = array(); |
|
633 | - $display->title = ''; |
|
634 | - $display->storage_type = 'page_manager'; |
|
635 | - $display->storage_id = 'page_home_panel_context'; |
|
636 | - $display->content = array(); |
|
637 | - $display->panels = array(); |
|
631 | + ); |
|
632 | + $display->cache = array(); |
|
633 | + $display->title = ''; |
|
634 | + $display->storage_type = 'page_manager'; |
|
635 | + $display->storage_id = 'page_home_panel_context'; |
|
636 | + $display->content = array(); |
|
637 | + $display->panels = array(); |
|
638 | 638 | $pane = new stdClass; |
639 | 639 | $pane->pid = 'new-1'; |
640 | 640 | $pane->panel = 'content'; |
@@ -642,22 +642,22 @@ discard block |
||
642 | 642 | $pane->subtype = 'custom'; |
643 | 643 | $pane->shown = TRUE; |
644 | 644 | $pane->access = array( |
645 | - 'plugins' => array(), |
|
645 | + 'plugins' => array(), |
|
646 | 646 | ); |
647 | 647 | $pane->configuration = array( |
648 | - 'admin_title' => 'BOINC overview', |
|
649 | - 'title' => '', |
|
650 | - 'body' => '<?php print boincuser_home_page(); ?>', |
|
651 | - 'format' => '3', |
|
652 | - 'substitute' => TRUE, |
|
648 | + 'admin_title' => 'BOINC overview', |
|
649 | + 'title' => '', |
|
650 | + 'body' => '<?php print boincuser_home_page(); ?>', |
|
651 | + 'format' => '3', |
|
652 | + 'substitute' => TRUE, |
|
653 | 653 | ); |
654 | 654 | $pane->cache = array(); |
655 | 655 | $pane->style = array( |
656 | - 'settings' => NULL, |
|
656 | + 'settings' => NULL, |
|
657 | 657 | ); |
658 | 658 | $pane->css = array( |
659 | - 'css_id' => '', |
|
660 | - 'css_class' => 'panel-primary container shadow', |
|
659 | + 'css_id' => '', |
|
660 | + 'css_class' => 'panel-primary container shadow', |
|
661 | 661 | ); |
662 | 662 | $pane->extras = array(); |
663 | 663 | $pane->position = 0; |
@@ -671,16 +671,16 @@ discard block |
||
671 | 671 | $pane->shown = TRUE; |
672 | 672 | $pane->access = array(); |
673 | 673 | $pane->configuration = array( |
674 | - 'override_title' => 0, |
|
675 | - 'override_title_text' => '', |
|
674 | + 'override_title' => 0, |
|
675 | + 'override_title_text' => '', |
|
676 | 676 | ); |
677 | 677 | $pane->cache = array(); |
678 | 678 | $pane->style = array( |
679 | - 'settings' => NULL, |
|
679 | + 'settings' => NULL, |
|
680 | 680 | ); |
681 | 681 | $pane->css = array( |
682 | - 'css_id' => '', |
|
683 | - 'css_class' => 'panel-secondary container shadow balance-height-front no-resize', |
|
682 | + 'css_id' => '', |
|
683 | + 'css_class' => 'panel-secondary container shadow balance-height-front no-resize', |
|
684 | 684 | ); |
685 | 685 | $pane->extras = array(); |
686 | 686 | $pane->position = 0; |
@@ -694,39 +694,39 @@ discard block |
||
694 | 694 | $pane->shown = TRUE; |
695 | 695 | $pane->access = array(); |
696 | 696 | $pane->configuration = array( |
697 | - 'override_pager_settings' => 1, |
|
698 | - 'use_pager' => 0, |
|
699 | - 'nodes_per_page' => '2', |
|
700 | - 'pager_id' => '', |
|
701 | - 'offset' => '0', |
|
702 | - 'more_link' => 1, |
|
703 | - 'feed_icons' => 1, |
|
704 | - 'panel_args' => 0, |
|
705 | - 'link_to_view' => 0, |
|
706 | - 'args' => '', |
|
707 | - 'url' => '', |
|
708 | - 'display' => 'page_2', |
|
709 | - 'override_title' => 1, |
|
710 | - 'override_title_text' => '', |
|
697 | + 'override_pager_settings' => 1, |
|
698 | + 'use_pager' => 0, |
|
699 | + 'nodes_per_page' => '2', |
|
700 | + 'pager_id' => '', |
|
701 | + 'offset' => '0', |
|
702 | + 'more_link' => 1, |
|
703 | + 'feed_icons' => 1, |
|
704 | + 'panel_args' => 0, |
|
705 | + 'link_to_view' => 0, |
|
706 | + 'args' => '', |
|
707 | + 'url' => '', |
|
708 | + 'display' => 'page_2', |
|
709 | + 'override_title' => 1, |
|
710 | + 'override_title_text' => '', |
|
711 | 711 | ); |
712 | 712 | $pane->cache = array(); |
713 | 713 | $pane->style = array( |
714 | - 'settings' => NULL, |
|
714 | + 'settings' => NULL, |
|
715 | 715 | ); |
716 | 716 | $pane->css = array( |
717 | - 'css_id' => '', |
|
718 | - 'css_class' => 'panel-secondary container shadow balance-height-front', |
|
717 | + 'css_id' => '', |
|
718 | + 'css_class' => 'panel-secondary container shadow balance-height-front', |
|
719 | 719 | ); |
720 | 720 | $pane->extras = array(); |
721 | 721 | $pane->position = 1; |
722 | 722 | $display->content['new-3'] = $pane; |
723 | 723 | $display->panels['sidebar_first'][1] = 'new-3'; |
724 | - $display->hide_title = PANELS_TITLE_NONE; |
|
725 | - $display->title_pane = '0'; |
|
726 | - $handler->conf['display'] = $display; |
|
727 | - $page->default_handlers[$handler->name] = $handler; |
|
728 | - $pages['home'] = $page; |
|
724 | + $display->hide_title = PANELS_TITLE_NONE; |
|
725 | + $display->title_pane = '0'; |
|
726 | + $handler->conf['display'] = $display; |
|
727 | + $page->default_handlers[$handler->name] = $handler; |
|
728 | + $pages['home'] = $page; |
|
729 | 729 | |
730 | - return $pages; |
|
730 | + return $pages; |
|
731 | 731 | |
732 | 732 | } |
@@ -13,45 +13,45 @@ discard block |
||
13 | 13 | * a form array |
14 | 14 | */ |
15 | 15 | function boincuser_delete_settings() { |
16 | - $form = array(); |
|
16 | + $form = array(); |
|
17 | 17 | |
18 | - $default = array( |
|
18 | + $default = array( |
|
19 | 19 | 'boincuser_delete_type' => variable_get('boincuser_delete_type', ''), |
20 | 20 | 'boincuser_delete_redirect' => variable_get('boincuser_delete_redirect', '<front>'), |
21 | - ); |
|
21 | + ); |
|
22 | 22 | |
23 | - $form['options'] = array( |
|
23 | + $form['options'] = array( |
|
24 | 24 | '#type' => 'fieldset', |
25 | 25 | '#title' => t('Options'), |
26 | - ); |
|
27 | - $form['options']['help'] = array( |
|
26 | + ); |
|
27 | + $form['options']['help'] = array( |
|
28 | 28 | '#value' => t('When a user deletes their account, which option is shown to the user? A soft/obfusate delete, a hard/wipe delete, or let the user chose between the two.'), |
29 | 29 | '#weight' => 11, |
30 | - ); |
|
31 | - $form['options']['boincuser_delete_type'] = array( |
|
30 | + ); |
|
31 | + $form['options']['boincuser_delete_type'] = array( |
|
32 | 32 | '#type' => 'radios', |
33 | 33 | '#title' => t('Type of delete'), |
34 | 34 | '#default_value' => $default['boincuser_delete_type'], |
35 | 35 | '#options' => array( |
36 | - 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
37 | - 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
38 | - 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
36 | + 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
37 | + 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
38 | + 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
39 | 39 | ), |
40 | 40 | '#weight' => 21, |
41 | - ); |
|
41 | + ); |
|
42 | 42 | |
43 | - $form['redirect'] = array( |
|
43 | + $form['redirect'] = array( |
|
44 | 44 | '#type' => 'fieldset', |
45 | 45 | '#title' => t('Redirect'), |
46 | - ); |
|
47 | - $form['redirect']['boincuser_delete_redirect'] = array( |
|
46 | + ); |
|
47 | + $form['redirect']['boincuser_delete_redirect'] = array( |
|
48 | 48 | '#type' => 'textfield', |
49 | 49 | '#title' => t('Redirection page'), |
50 | 50 | '#default_value' => $default['boincuser_delete_redirect'], |
51 | 51 | '#description' => t('Choose where to redirect your users after account deletion. Any valid Drupal path will do, e.g. %front or %node', array('%front' => '<front>', '%node' => 'node/1')), |
52 | - ); |
|
52 | + ); |
|
53 | 53 | |
54 | - return system_settings_form($form); |
|
54 | + return system_settings_form($form); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -60,124 +60,124 @@ discard block |
||
60 | 60 | * password checks. |
61 | 61 | */ |
62 | 62 | function boincuser_delete_admindelete(&$form_state, $uid) { |
63 | - $form = array(); |
|
63 | + $form = array(); |
|
64 | 64 | |
65 | - $form['#uid'] = $uid; |
|
65 | + $form['#uid'] = $uid; |
|
66 | 66 | |
67 | - $form['account']['help'] = array( |
|
67 | + $form['account']['help'] = array( |
|
68 | 68 | '#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>", |
69 | 69 | '#weight' => -1, |
70 | 70 | '#prefix' => "<div id='delete-instructions'>", |
71 | 71 | '#suffix' => "</div>", |
72 | - ); |
|
72 | + ); |
|
73 | 73 | |
74 | - $account = user_load($uid); |
|
75 | - if ($account) { |
|
74 | + $account = user_load($uid); |
|
75 | + if ($account) { |
|
76 | 76 | drupal_set_title($account->boincuser_name); |
77 | 77 | |
78 | 78 | $form['account']['boincuser_name'] = array( |
79 | - '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
79 | + '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
80 | 80 | ); |
81 | 81 | $form['account']['boincuser_id'] = array( |
82 | - '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
82 | + '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
83 | 83 | ); |
84 | 84 | $form['account']['drupal_name'] = array( |
85 | - '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
85 | + '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
86 | 86 | ); |
87 | 87 | $form['account']['user_id'] = array( |
88 | - '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
88 | + '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | $form['account']['user_delete_action'] = array( |
92 | 92 | '#type' => 'radios', |
93 | 93 | '#options' => array( |
94 | - 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | - 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
96 | - ); |
|
94 | + 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | + 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
96 | + ); |
|
97 | 97 | |
98 | 98 | $form['account']['surecheckbox'] = array( |
99 | - '#type' => 'checkbox', |
|
100 | - '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
99 | + '#type' => 'checkbox', |
|
100 | + '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
101 | 101 | array('%name' => $account->boincuser_name) |
102 | - ), |
|
103 | - '#default_value' => FALSE, |
|
102 | + ), |
|
103 | + '#default_value' => FALSE, |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | $form['account']['current_pass'] = array( |
107 | - '#type' => 'password', |
|
108 | - '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
109 | - '#size' => 17, |
|
110 | - '#attributes' => array( |
|
107 | + '#type' => 'password', |
|
108 | + '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
109 | + '#size' => 17, |
|
110 | + '#attributes' => array( |
|
111 | 111 | 'autocomplete' => 'off', |
112 | - ), |
|
113 | - '#weight' => 25, |
|
112 | + ), |
|
113 | + '#weight' => 25, |
|
114 | 114 | ); |
115 | 115 | |
116 | 116 | // Action buttons |
117 | 117 | $form['actions']['submit'] = array( |
118 | - '#type' => 'submit', |
|
119 | - '#value' => t('Submit'), |
|
118 | + '#type' => 'submit', |
|
119 | + '#value' => t('Submit'), |
|
120 | 120 | ); |
121 | 121 | $form['actions']['cancel'] = array( |
122 | - '#type' => 'button', |
|
123 | - '#value' => t('Cancel'), |
|
124 | - '#executes_submit_callback' => TRUE, |
|
125 | - '#validate' => array(), |
|
126 | - '#submit' => array('_boincuser_delete_cancel'), |
|
122 | + '#type' => 'button', |
|
123 | + '#value' => t('Cancel'), |
|
124 | + '#executes_submit_callback' => TRUE, |
|
125 | + '#validate' => array(), |
|
126 | + '#submit' => array('_boincuser_delete_cancel'), |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | $form['#redirect'] = 'account'; |
130 | - } |
|
131 | - else { |
|
130 | + } |
|
131 | + else { |
|
132 | 132 | $form['noaccount'] = array( |
133 | - '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
133 | + '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
134 | 134 | ); |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | - return $form; |
|
137 | + return $form; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Validation function for admin delete user. |
142 | 142 | */ |
143 | 143 | function boincuser_delete_admindelete_validate($form, &$form_state) { |
144 | - global $user; |
|
145 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
144 | + global $user; |
|
145 | + $boinc_user = boincuser_load($user->uid, TRUE); |
|
146 | 146 | |
147 | - if ($form_state['values']['user_delete_action'] == '') { |
|
147 | + if ($form_state['values']['user_delete_action'] == '') { |
|
148 | 148 | form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
149 | - } |
|
149 | + } |
|
150 | 150 | |
151 | - if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
151 | + if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
152 | 152 | form_set_error('user_delete_action', t('User Delete action not a predefined value, unknown error in radio buttons.')); |
153 | - } |
|
153 | + } |
|
154 | 154 | |
155 | - if (!($form_state['values']['surecheckbox'])) { |
|
155 | + if (!($form_state['values']['surecheckbox'])) { |
|
156 | 156 | return form_set_error('surecheckbox', t('Please confirm you are sure you want to delete this account.')); |
157 | - } |
|
157 | + } |
|
158 | 158 | |
159 | - if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
159 | + if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
160 | 160 | return true; |
161 | - } |
|
161 | + } |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Submit function for admin delete user. |
166 | 166 | */ |
167 | 167 | function boincuser_delete_admindelete_submit($form, &$form_state) { |
168 | - // This is the account to be deleted, and not the administrator's |
|
169 | - // account. |
|
170 | - $account = user_load(array('uid' => $form['#uid'])); |
|
171 | - $action = $form_state['values']['user_delete_action']; |
|
168 | + // This is the account to be deleted, and not the administrator's |
|
169 | + // account. |
|
170 | + $account = user_load(array('uid' => $form['#uid'])); |
|
171 | + $action = $form_state['values']['user_delete_action']; |
|
172 | 172 | |
173 | - drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
173 | + drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
174 | 174 | array( |
175 | - '@uid' => $form['#uid'], |
|
176 | - '@displayname' => $account->boincuser_name, |
|
175 | + '@uid' => $form['#uid'], |
|
176 | + '@displayname' => $account->boincuser_name, |
|
177 | 177 | )), 'warning'); |
178 | 178 | |
179 | - // Delete the user |
|
180 | - _boincuser_delete_deleteuser($account, $action); |
|
179 | + // Delete the user |
|
180 | + _boincuser_delete_deleteuser($account, $action); |
|
181 | 181 | |
182 | - drupal_goto('/admin/boinc/user_delete'); |
|
182 | + drupal_goto('/admin/boinc/user_delete'); |
|
183 | 183 | } |