@@ -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 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | if ($disable_account_creation || defined('INVITE_CODES')) { |
84 | - echo " <account_creation_disabled/>\n"; |
|
84 | + echo " <account_creation_disabled/>\n"; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if (defined('INVITE_CODES')) { |
88 | - echo " <invite_code_required/>\n"; |
|
88 | + echo " <invite_code_required/>\n"; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | echo " <min_passwd_length>$min_passwd_length</min_passwd_length>\n"; |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | // project has not defined the constant TERMSOFUSE_FILE, then look for |
108 | 108 | // the terms_of_use.txt file in the project base directory. |
109 | 109 | if (defined('TERMSOFUSE_FILE')) { |
110 | - $tou_file = TERMSOFUSE_FILE; |
|
110 | + $tou_file = TERMSOFUSE_FILE; |
|
111 | 111 | } |
112 | 112 | else { |
113 | - $tou_file = "../../terms_of_use.txt"; |
|
113 | + $tou_file = "../../terms_of_use.txt"; |
|
114 | 114 | } |
115 | 115 | if (file_exists($tou_file)) { |
116 | 116 | $terms_of_use = trim(file_get_contents($tou_file)); |
@@ -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 | } |
@@ -9,28 +9,28 @@ discard block |
||
9 | 9 | * Helper functions |
10 | 10 | */ |
11 | 11 | function _boincuser_delete_goto_admindelete($form, &$form_state) { |
12 | - drupal_goto('/admin/boinc/user_delete/' . $form['#uid']); |
|
12 | + drupal_goto('/admin/boinc/user_delete/' . $form['#uid']); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | function _boincuser_delete_cancel($form, &$form_state) { |
16 | - drupal_goto('/user/' . $form['#uid'] . '/edit'); |
|
16 | + drupal_goto('/user/' . $form['#uid'] . '/edit'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Validation user password function. |
21 | 21 | */ |
22 | 22 | function _boincuser_delete_validatepasswd($boinc_user, $current_pass) { |
23 | - if (!$current_pass) { |
|
23 | + if (!$current_pass) { |
|
24 | 24 | return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account')); |
25 | - } |
|
25 | + } |
|
26 | 26 | |
27 | - $given_hash = md5($current_pass . $boinc_user->email_addr); |
|
27 | + $given_hash = md5($current_pass . $boinc_user->email_addr); |
|
28 | 28 | |
29 | - if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
29 | + if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
30 | 30 | return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account')); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | - return true; |
|
33 | + return true; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -41,56 +41,56 @@ discard block |
||
41 | 41 | * Delete the user function. |
42 | 42 | */ |
43 | 43 | function _boincuser_delete_deleteuser($account, $action=NULL) { |
44 | - require_boinc('user_util'); |
|
45 | - require_boinc('delete_account'); |
|
44 | + require_boinc('user_util'); |
|
45 | + require_boinc('delete_account'); |
|
46 | 46 | |
47 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
47 | + $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
48 | 48 | |
49 | - // watchdog message |
|
50 | - watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname', |
|
51 | - array( |
|
49 | + // watchdog message |
|
50 | + watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname', |
|
51 | + array( |
|
52 | 52 | '%uid' => $account->uid, |
53 | 53 | '%boincuser_id' => $account->boincuser_id, |
54 | 54 | '%displayname' => $account->boincuser_name, |
55 | - ), WATCHDOG_NOTICE); |
|
55 | + ), WATCHDOG_NOTICE); |
|
56 | 56 | |
57 | - // delete the account - This will delete the boinc user from the |
|
58 | - // boinc project database, and then delete the Drupal user using the |
|
59 | - // hook_user() functions. |
|
57 | + // delete the account - This will delete the boinc user from the |
|
58 | + // boinc project database, and then delete the Drupal user using the |
|
59 | + // hook_user() functions. |
|
60 | 60 | |
61 | - switch ($action) { |
|
61 | + switch ($action) { |
|
62 | 62 | case 'soft_obfuscate': |
63 | 63 | obfuscate_account($boinc_user); |
64 | - _boincuser_delete_comment_reassign($account); |
|
65 | - _boincuser_delete_node_reassign($account); |
|
66 | - _boincuser_delete_privatemsg_delete($account); |
|
67 | - _boincuser_delete_friends($account); |
|
68 | - // delete the user's profile |
|
69 | - $profile = content_profile_load('profile', $account->uid); |
|
70 | - node_delete($profile->nid); |
|
71 | - // Drupal account - |
|
72 | - // * 'block'/disable the account |
|
73 | - // * set name, mail, pass, and init to deleted |
|
74 | - // * erase signature |
|
75 | - $myarray = array( |
|
64 | + _boincuser_delete_comment_reassign($account); |
|
65 | + _boincuser_delete_node_reassign($account); |
|
66 | + _boincuser_delete_privatemsg_delete($account); |
|
67 | + _boincuser_delete_friends($account); |
|
68 | + // delete the user's profile |
|
69 | + $profile = content_profile_load('profile', $account->uid); |
|
70 | + node_delete($profile->nid); |
|
71 | + // Drupal account - |
|
72 | + // * 'block'/disable the account |
|
73 | + // * set name, mail, pass, and init to deleted |
|
74 | + // * erase signature |
|
75 | + $myarray = array( |
|
76 | 76 | 'status' => 0, |
77 | 77 | 'name' => 'deleted_' . time() . '_' . random_string(), |
78 | 78 | 'mail' => 'deleted_' . time() . '_' . random_string(), |
79 | 79 | 'pass' => 'deleted_' . time() . '_' . random_string(), |
80 | 80 | 'signature' => '', |
81 | 81 | 'init' => 'deleted_' . time() . '_' . random_string(), |
82 | - ); |
|
83 | - user_save($account, $myarray); |
|
84 | - break; |
|
82 | + ); |
|
83 | + user_save($account, $myarray); |
|
84 | + break; |
|
85 | 85 | case 'hard_wipe': |
86 | 86 | wipe_account($boinc_user); |
87 | - user_delete(array(), $account->uid); |
|
88 | - break; |
|
87 | + user_delete(array(), $account->uid); |
|
88 | + break; |
|
89 | 89 | default: |
90 | 90 | watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
91 | 91 | '%action' => $action, |
92 | - ), WATCHDOG_ERROR); |
|
93 | - } |
|
92 | + ), WATCHDOG_ERROR); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * Copied from node.module, node_user() |
100 | 100 | */ |
101 | 101 | function _boincuser_delete_node_reassign($account) { |
102 | - db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $account->uid); |
|
103 | - db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $account->uid); |
|
102 | + db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $account->uid); |
|
103 | + db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $account->uid); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * Copied from comment.module, comment_user() |
110 | 110 | */ |
111 | 111 | function _boincuser_delete_comment_reassign($account) { |
112 | - // bug in comment module, remove user name from comments. |
|
113 | - db_query("UPDATE {comments} SET comments.name='' WHERE uid =%d", $account->uid); |
|
112 | + // bug in comment module, remove user name from comments. |
|
113 | + db_query("UPDATE {comments} SET comments.name='' WHERE uid =%d", $account->uid); |
|
114 | 114 | |
115 | - db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $account->uid); |
|
116 | - db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $account->uid); |
|
115 | + db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $account->uid); |
|
116 | + db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $account->uid); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,23 +122,23 @@ discard block |
||
122 | 122 | * Copied from privatemsg module, case 'delete' in privatemsg_user(). |
123 | 123 | */ |
124 | 124 | function _boincuser_delete_privatemsg_delete($account) { |
125 | - // Load all mids of the messages the user wrote. |
|
126 | - $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid); |
|
127 | - $mids = array(); |
|
128 | - while ($row = db_fetch_array($result)) { |
|
125 | + // Load all mids of the messages the user wrote. |
|
126 | + $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid); |
|
127 | + $mids = array(); |
|
128 | + while ($row = db_fetch_array($result)) { |
|
129 | 129 | $mids[] = $row['mid']; |
130 | - } |
|
130 | + } |
|
131 | 131 | |
132 | - // Delete messages the user wrote. |
|
133 | - db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid); |
|
132 | + // Delete messages the user wrote. |
|
133 | + db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid); |
|
134 | 134 | |
135 | - if (!empty($mids)) { |
|
135 | + if (!empty($mids)) { |
|
136 | 136 | // Delete recipient entries in {pm_index} of the messages the user wrote. |
137 | 137 | db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids); |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - // Delete recipient entries of that user. |
|
141 | - db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid); |
|
140 | + // Delete recipient entries of that user. |
|
141 | + db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -147,6 +147,6 @@ discard block |
||
147 | 147 | * Copied from flag_friend, flag_friend_user() |
148 | 148 | */ |
149 | 149 | function _boincuser_delete_friends($account) { |
150 | - // remove any friend relationships if an account is removed |
|
150 | + // remove any friend relationships if an account is removed |
|
151 | 151 | db_query("DELETE FROM {flag_friend} WHERE uid = %d OR friend_uid = %d", $account->uid, $account->uid); |
152 | 152 | } |
153 | 153 | \ No newline at end of file |
@@ -15,59 +15,59 @@ discard block |
||
15 | 15 | * Form validation handler for login |
16 | 16 | */ |
17 | 17 | function boincuser_login_validate($form, &$form_state) { |
18 | - /* // SAMPLE: To try validation with Drupal first... |
|
18 | + /* // SAMPLE: To try validation with Drupal first... |
|
19 | 19 | global $user; |
20 | 20 | if (!empty($user->uid)) { |
21 | 21 | // Authentication with Drupal was successful |
22 | 22 | return; |
23 | 23 | }*/ |
24 | 24 | |
25 | - // Set name for logging purposes |
|
26 | - $form_state['values']['name'] = $form_state['values']['email']; |
|
25 | + // Set name for logging purposes |
|
26 | + $form_state['values']['name'] = $form_state['values']['email']; |
|
27 | 27 | |
28 | - // Bypass BOINC validation if passed the name of user 1 |
|
29 | - $user_1 = user_load(1); |
|
30 | - if ($form_state['values']['email'] == $user_1->name) { |
|
28 | + // Bypass BOINC validation if passed the name of user 1 |
|
29 | + $user_1 = user_load(1); |
|
30 | + if ($form_state['values']['email'] == $user_1->name) { |
|
31 | 31 | user_authenticate($form_state['values']); |
32 | 32 | return; |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | - // Call our custom authentication function to check for an existing BOINC user |
|
36 | - if (!boincuser_login_authenticate($form_state['values'])) { |
|
35 | + // Call our custom authentication function to check for an existing BOINC user |
|
36 | + if (!boincuser_login_authenticate($form_state['values'])) { |
|
37 | 37 | // Authentication failed; set an error accordingly |
38 | 38 | form_set_error('name', bts('Sorry, unrecognized email address or password.', array(), NULL, 'boinc:forgot-password') . ' ' . l(bts('Have you forgotten your password?', array(), NULL, 'boinc:forgot-password'), 'user/password')); |
39 | - } |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Custom authentication function to check BOINC account information |
44 | 44 | */ |
45 | 45 | function boincuser_login_authenticate($form_values) { |
46 | - global $boincuser_authenticated; |
|
47 | - $lower_email_addr = strtolower($form_values['email']); |
|
48 | - $passwd = $form_values['pass']; |
|
49 | - $passwd_hash = md5($passwd.$lower_email_addr); |
|
46 | + global $boincuser_authenticated; |
|
47 | + $lower_email_addr = strtolower($form_values['email']); |
|
48 | + $passwd = $form_values['pass']; |
|
49 | + $passwd_hash = md5($passwd.$lower_email_addr); |
|
50 | 50 | |
51 | - // Include BOINC user library |
|
52 | - require_boinc('boinc_db'); |
|
53 | - require_boinc('user_util'); |
|
51 | + // Include BOINC user library |
|
52 | + require_boinc('boinc_db'); |
|
53 | + require_boinc('user_util'); |
|
54 | 54 | |
55 | - // Get the BOINC user and check credentials |
|
56 | - $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
|
57 | - if (!$boinc_user) return false; |
|
55 | + // Get the BOINC user and check credentials |
|
56 | + $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
|
57 | + if (!$boinc_user) return false; |
|
58 | 58 | |
59 | - if (!check_passwd_hash($boinc_user, $passwd_hash)) { |
|
59 | + if (!check_passwd_hash($boinc_user, $passwd_hash)) { |
|
60 | 60 | return false; |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - // BOINC authentication successful; log in and synchronize accounts |
|
64 | - boincuser_login_register($boinc_user); |
|
65 | - // Write session, update timestamp, run user 'login' hook. |
|
66 | - user_authenticate_finalize($form_values); |
|
67 | - // Use a global variable to save the fact that we did authentication. |
|
68 | - $boincuser_authenticated = true; |
|
63 | + // BOINC authentication successful; log in and synchronize accounts |
|
64 | + boincuser_login_register($boinc_user); |
|
65 | + // Write session, update timestamp, run user 'login' hook. |
|
66 | + user_authenticate_finalize($form_values); |
|
67 | + // Use a global variable to save the fact that we did authentication. |
|
68 | + $boincuser_authenticated = true; |
|
69 | 69 | |
70 | - return true; |
|
70 | + return true; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | * Drupal accounts |
76 | 76 | */ |
77 | 77 | function boincuser_login_register($boinc_user) { |
78 | - global $user; |
|
79 | - require_boinc('boinc_db'); |
|
80 | - // If a Drupal account already exists, log in |
|
81 | - $existing_user = user_load(array('mail' => $boinc_user->email_addr)); |
|
82 | - if (!empty($existing_user->uid)) { |
|
78 | + global $user; |
|
79 | + require_boinc('boinc_db'); |
|
80 | + // If a Drupal account already exists, log in |
|
81 | + $existing_user = user_load(array('mail' => $boinc_user->email_addr)); |
|
82 | + if (!empty($existing_user->uid)) { |
|
83 | 83 | $user = $existing_user; |
84 | - } else { |
|
84 | + } else { |
|
85 | 85 | // Create a Drupal user from the BOINC user |
86 | 86 | if ($user = boincuser_register_make_drupal_user($boinc_user)) { |
87 | - watchdog('user', 'New external user: %email using module %module.', array('%email' => $email_addr, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit')); |
|
87 | + watchdog('user', 'New external user: %email using module %module.', array('%email' => $email_addr, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit')); |
|
88 | + } |
|
88 | 89 | } |
89 | - } |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -98,111 +98,111 @@ discard block |
||
98 | 98 | * New user registration validation handler. |
99 | 99 | */ |
100 | 100 | function boincuser_register_validate($form, &$form_state) { |
101 | - // Include BOINC database objects library |
|
102 | - require_boinc('boinc_db'); |
|
101 | + // Include BOINC database objects library |
|
102 | + require_boinc('boinc_db'); |
|
103 | 103 | |
104 | - // Check terms of use agreement |
|
105 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
106 | - if (!empty($termsofuse)) { |
|
104 | + // Check terms of use agreement |
|
105 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
106 | + if (!empty($termsofuse)) { |
|
107 | 107 | if (!$form_state['values']['agreeTOU']) { |
108 | - form_set_error('termsofuse', bts('ERROR: You must acknowledge our terms of use by clicking the checkbox before registering for an account.', NULL, 'boinc:register-new-user')); |
|
109 | - return false; |
|
108 | + form_set_error('termsofuse', bts('ERROR: You must acknowledge our terms of use by clicking the checkbox before registering for an account.', NULL, 'boinc:register-new-user')); |
|
109 | + return false; |
|
110 | + } |
|
110 | 111 | } |
111 | - } |
|
112 | 112 | |
113 | - // Lower-case the email address |
|
114 | - $lower_email_addr = strtolower($form_state['values']['mail']); |
|
115 | - $tmp_user = BoincUser::lookup_prev_email_addr($lower_email_addr); |
|
116 | - if ($tmp_user) { |
|
113 | + // Lower-case the email address |
|
114 | + $lower_email_addr = strtolower($form_state['values']['mail']); |
|
115 | + $tmp_user = BoincUser::lookup_prev_email_addr($lower_email_addr); |
|
116 | + if ($tmp_user) { |
|
117 | 117 | // User already exists |
118 | 118 | form_set_error('mail', bts('An account already exists for @email. Contact the administrators for @project for additional help.', |
119 | - array( |
|
119 | + array( |
|
120 | 120 | '@email' => $lower_email_addr, |
121 | 121 | '@project' => variable_get('site_name', 'Drupal-BOINC'), NULL, 'boinc:add-new-user', |
122 | - ) |
|
122 | + ) |
|
123 | 123 | , NULL, 'boinc:register-new-user')); |
124 | - } |
|
125 | - |
|
126 | - // Check for an existing BOINC user |
|
127 | - // This is somewhat redundent as Drupal will also check if the email |
|
128 | - // is a duplicate. However, in the case where there is no Drupal |
|
129 | - // account, but a BOINC account exists with this email, the check |
|
130 | - // will fail. |
|
131 | - $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
|
132 | - if ($boinc_user) { |
|
124 | + } |
|
125 | + |
|
126 | + // Check for an existing BOINC user |
|
127 | + // This is somewhat redundent as Drupal will also check if the email |
|
128 | + // is a duplicate. However, in the case where there is no Drupal |
|
129 | + // account, but a BOINC account exists with this email, the check |
|
130 | + // will fail. |
|
131 | + $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
|
132 | + if ($boinc_user) { |
|
133 | 133 | // User already exists |
134 | 134 | form_set_error('mail', bts('An account already exists for @email. Log in or request password assistance to access your @project account.', array('@email' => $lower_email_addr, '@project' => PROJECT), NULL, 'boinc:add-new-user')); |
135 | 135 | return false; |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | - // Check Drupal name is not a duplicate, and create a proper drupal |
|
139 | - // name from the boinc username. |
|
140 | - $form_state['values']['name'] = create_proper_drupalname($form_state['values']['boincuser_name']); |
|
138 | + // Check Drupal name is not a duplicate, and create a proper drupal |
|
139 | + // name from the boinc username. |
|
140 | + $form_state['values']['name'] = create_proper_drupalname($form_state['values']['boincuser_name']); |
|
141 | 141 | |
142 | - return true; |
|
142 | + return true; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Create BOINC account |
147 | 147 | */ |
148 | 148 | function boincuser_register_make_user($params) { |
149 | - // Include BOINC user library |
|
150 | - require_boinc('user_util'); |
|
151 | - // Create the BOINC user |
|
152 | - $boinc_user = make_user($params['email_addr'], $params['name'], $params['passwd_hash'], $params['country'], $params['postal_code']); |
|
153 | - return $boinc_user; |
|
149 | + // Include BOINC user library |
|
150 | + require_boinc('user_util'); |
|
151 | + // Create the BOINC user |
|
152 | + $boinc_user = make_user($params['email_addr'], $params['name'], $params['passwd_hash'], $params['country'], $params['postal_code']); |
|
153 | + return $boinc_user; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Create Drupal account from existing BOINC account |
158 | 158 | */ |
159 | 159 | function boincuser_register_make_drupal_user($boinc_user) { |
160 | - $account = null; |
|
161 | - if (is_numeric($boinc_user)) { |
|
160 | + $account = null; |
|
161 | + if (is_numeric($boinc_user)) { |
|
162 | 162 | $boinc_user = boincuser_load($boinc_user); |
163 | - } |
|
164 | - if ($boinc_user) { |
|
163 | + } |
|
164 | + if ($boinc_user) { |
|
165 | 165 | $account = boincuser_create_drupal_user($boinc_user); |
166 | 166 | if ($account) { |
167 | - boincuser_create_drupal_profile($account, $boinc_user); |
|
167 | + boincuser_create_drupal_profile($account, $boinc_user); |
|
168 | + } |
|
168 | 169 | } |
169 | - } |
|
170 | - return $account; |
|
170 | + return $account; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | function boincuser_create_drupal_user($boinc_user) { |
174 | - require_boinc('forum_db'); |
|
175 | - BoincForumPrefs::lookup($boinc_user); |
|
176 | - $account = NULL; |
|
177 | - $module = 'boincuser'; |
|
174 | + require_boinc('forum_db'); |
|
175 | + BoincForumPrefs::lookup($boinc_user); |
|
176 | + $account = NULL; |
|
177 | + $module = 'boincuser'; |
|
178 | 178 | |
179 | - // Verify that this account has not already been imported |
|
180 | - $already_imported = db_result(db_query(' |
|
179 | + // Verify that this account has not already been imported |
|
180 | + $already_imported = db_result(db_query(' |
|
181 | 181 | SELECT COUNT(*) FROM {boincuser} WHERE boinc_id = %d', |
182 | 182 | $boinc_user->id) |
183 | - ); |
|
184 | - if ($already_imported) { |
|
183 | + ); |
|
184 | + if ($already_imported) { |
|
185 | 185 | return NULL; |
186 | - } |
|
186 | + } |
|
187 | 187 | |
188 | - // Email is limited to 64 characters... |
|
189 | - $boinc_email = substr($boinc_user->email_addr, 0, 64); |
|
188 | + // Email is limited to 64 characters... |
|
189 | + $boinc_email = substr($boinc_user->email_addr, 0, 64); |
|
190 | 190 | |
191 | - // Email should be unique |
|
192 | - $already_imported = db_result(db_query(" |
|
191 | + // Email should be unique |
|
192 | + $already_imported = db_result(db_query(" |
|
193 | 193 | SELECT COUNT(*) FROM {users} WHERE mail = '%s'", |
194 | 194 | $boinc_email) |
195 | - ); |
|
196 | - if ($already_imported) { |
|
195 | + ); |
|
196 | + if ($already_imported) { |
|
197 | 197 | drupal_set_message(t('An account for @email already exists', array('@email' => $boinc_email)), 'warning'); |
198 | 198 | watchdog('boincimport', 'An account for @email already exists', array('@email' => $boinc_email), WATCHDOG_WARNING); |
199 | 199 | return NULL; |
200 | - } |
|
200 | + } |
|
201 | 201 | |
202 | - // Make sure name is unique |
|
203 | - $unique_name = create_proper_drupalname($boinc_user->name); |
|
202 | + // Make sure name is unique |
|
203 | + $unique_name = create_proper_drupalname($boinc_user->name); |
|
204 | 204 | |
205 | - $userinfo = array( |
|
205 | + $userinfo = array( |
|
206 | 206 | 'name' => $unique_name, |
207 | 207 | 'pass' => $boinc_user->passwd_hash, |
208 | 208 | 'mail' => $boinc_email, |
@@ -212,126 +212,126 @@ discard block |
||
212 | 212 | 'status' => 1, |
213 | 213 | "authname_{$module}" => $boinc_email, |
214 | 214 | 'access' => time() |
215 | - ); |
|
215 | + ); |
|
216 | 216 | |
217 | - $in_penalty = ($boinc_user->prefs->banished_until > time()); |
|
217 | + $in_penalty = ($boinc_user->prefs->banished_until > time()); |
|
218 | 218 | |
219 | - // Add user to community member role (if no current penalty) |
|
220 | - if (!$in_penalty) { |
|
219 | + // Add user to community member role (if no current penalty) |
|
220 | + if (!$in_penalty) { |
|
221 | 221 | $community_role = array_search('community member', user_roles(true)); |
222 | 222 | $userinfo['roles'] = array( |
223 | - $community_role => '' |
|
223 | + $community_role => '' |
|
224 | 224 | ); |
225 | - } |
|
225 | + } |
|
226 | 226 | |
227 | - // Mark account as imported so a BOINC account is not created on Insert (i.e. user_save) |
|
228 | - $_SESSION['importedUser'] = true; |
|
229 | - $account = user_save('', $userinfo); |
|
227 | + // Mark account as imported so a BOINC account is not created on Insert (i.e. user_save) |
|
228 | + $_SESSION['importedUser'] = true; |
|
229 | + $account = user_save('', $userinfo); |
|
230 | 230 | |
231 | - // Drupal overrides the original registration date, so update to the correct date |
|
232 | - $account = user_save($account, array('created' => $userinfo['created'])); |
|
231 | + // Drupal overrides the original registration date, so update to the correct date |
|
232 | + $account = user_save($account, array('created' => $userinfo['created'])); |
|
233 | 233 | |
234 | - // Terminate if an error occured during user_save(). |
|
235 | - if (!$account) { |
|
234 | + // Terminate if an error occured during user_save(). |
|
235 | + if (!$account) { |
|
236 | 236 | drupal_set_message(t("Error saving user account."), 'error'); |
237 | 237 | return NULL; |
238 | - } |
|
238 | + } |
|
239 | 239 | |
240 | - // Cross reference the Drupal and BOINC accounts |
|
241 | - boincuser_account_cross_reference($account->uid, $boinc_user->id); |
|
240 | + // Cross reference the Drupal and BOINC accounts |
|
241 | + boincuser_account_cross_reference($account->uid, $boinc_user->id); |
|
242 | 242 | |
243 | - if ($in_penalty) { |
|
243 | + if ($in_penalty) { |
|
244 | 244 | // Import the timestamp of when the penalty period will be over |
245 | 245 | $boincuser_record = array( |
246 | - 'uid' => $account->uid, |
|
247 | - 'penalty_expiration' => $boinc_user->prefs->banished_until, |
|
246 | + 'uid' => $account->uid, |
|
247 | + 'penalty_expiration' => $boinc_user->prefs->banished_until, |
|
248 | 248 | ); |
249 | 249 | drupal_write_record('boincuser', $boincuser_record, 'uid'); |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | - return $account; |
|
252 | + return $account; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | function boincuser_create_drupal_profile($account, $boinc_user) { |
256 | 256 | |
257 | - require_boinc('forum_db'); |
|
258 | - BoincForumPrefs::lookup($boinc_user); |
|
257 | + require_boinc('forum_db'); |
|
258 | + BoincForumPrefs::lookup($boinc_user); |
|
259 | 259 | |
260 | - $image_dir = boinc_get_path('user_image'); |
|
260 | + $image_dir = boinc_get_path('user_image'); |
|
261 | 261 | |
262 | - // Automatically create a content profile |
|
263 | - $now = time(); |
|
264 | - $profile_background = null; |
|
265 | - $profile_opinions = null; |
|
266 | - $profile_image = null; |
|
267 | - $avatar_image = null; |
|
268 | - $profile_approved = NULL; |
|
262 | + // Automatically create a content profile |
|
263 | + $now = time(); |
|
264 | + $profile_background = null; |
|
265 | + $profile_opinions = null; |
|
266 | + $profile_image = null; |
|
267 | + $avatar_image = null; |
|
268 | + $profile_approved = NULL; |
|
269 | 269 | |
270 | - // Load the BOINC profile, if available |
|
271 | - if ($boinc_user->has_profile) { |
|
270 | + // Load the BOINC profile, if available |
|
271 | + if ($boinc_user->has_profile) { |
|
272 | 272 | $boinc_profile = BoincProfile::lookup("userid={$boinc_user->id}"); |
273 | 273 | $profile_background = $boinc_profile->response1; |
274 | 274 | $profile_opinions = $boinc_profile->response2; |
275 | 275 | if ($boinc_profile->has_picture) { |
276 | - // Load picture; load validators; determine where to store it in Drupal |
|
277 | - $image_path = "{$image_dir}/{$boinc_user->id}.jpg"; |
|
278 | - $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', TRUE); |
|
279 | - // If the user does not have a different image as an avatar, use this one |
|
280 | - if (!$boinc_user->prefs->avatar) { |
|
276 | + // Load picture; load validators; determine where to store it in Drupal |
|
277 | + $image_path = "{$image_dir}/{$boinc_user->id}.jpg"; |
|
278 | + $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', TRUE); |
|
279 | + // If the user does not have a different image as an avatar, use this one |
|
280 | + if (!$boinc_user->prefs->avatar) { |
|
281 | 281 | $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
282 | - } |
|
282 | + } |
|
283 | 283 | } |
284 | 284 | if ($boinc_user->prefs->avatar) { |
285 | - $image_path = "{$image_dir}/{$boinc_user->id}_avatar.jpg"; |
|
286 | - $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
285 | + $image_path = "{$image_dir}/{$boinc_user->id}_avatar.jpg"; |
|
286 | + $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
287 | 287 | } |
288 | 288 | $profile_approved = $boinc_profile->verification ? TRUE : FALSE; |
289 | - } |
|
290 | - $default_input_format = db_result(db_query(" |
|
289 | + } |
|
290 | + $default_input_format = db_result(db_query(" |
|
291 | 291 | SELECT format FROM {filter_formats} WHERE name = '%s'", 'Rich text')); |
292 | - if (!$default_input_format) $default_input_format = 1; |
|
293 | - |
|
294 | - // Populate the profile object |
|
295 | - $profile_node = new stdClass(); |
|
296 | - $profile_node->title = $boinc_user->name; |
|
297 | - $profile_node->uid = $account->uid; |
|
298 | - $profile_node->body = ''; |
|
299 | - $profile_node->type = 'profile'; |
|
300 | - $profile_node->created = $now; |
|
301 | - $profile_node->changed = $now; |
|
302 | - $profile_node->status = 1; |
|
303 | - $profile_node->promote = 0; |
|
304 | - $profile_node->sticky = 0; |
|
305 | - $profile_node->format = $default_input_format; |
|
306 | - $profile_node->name = $account->name; // Set to link profile to account uid! |
|
307 | - $profile_node->field_country[]['value'] = $boinc_user->country; |
|
308 | - $profile_node->field_zip[]['value'] = $boinc_user->postal_code; |
|
309 | - $profile_node->field_url[]['value'] = $boinc_user->url; |
|
310 | - $profile_node->field_background[]['value'] = $profile_background; |
|
311 | - $profile_node->field_opinions[]['value'] = $profile_opinions; |
|
312 | - $profile_node->field_image[] = $avatar_image; |
|
313 | - $profile_node->field_profile_image[] = $profile_image; |
|
314 | - |
|
315 | - // Save the profile object to the database |
|
316 | - // This will automatically set the author uid if node->name has been set |
|
317 | - $profile_node = node_submit($profile_node); |
|
318 | - node_save($profile_node); |
|
319 | - |
|
320 | - // Mark profile as approved if it has already been vetted somehow |
|
321 | - if ($profile_approved OR !$boinc_user->has_profile) { |
|
292 | + if (!$default_input_format) $default_input_format = 1; |
|
293 | + |
|
294 | + // Populate the profile object |
|
295 | + $profile_node = new stdClass(); |
|
296 | + $profile_node->title = $boinc_user->name; |
|
297 | + $profile_node->uid = $account->uid; |
|
298 | + $profile_node->body = ''; |
|
299 | + $profile_node->type = 'profile'; |
|
300 | + $profile_node->created = $now; |
|
301 | + $profile_node->changed = $now; |
|
302 | + $profile_node->status = 1; |
|
303 | + $profile_node->promote = 0; |
|
304 | + $profile_node->sticky = 0; |
|
305 | + $profile_node->format = $default_input_format; |
|
306 | + $profile_node->name = $account->name; // Set to link profile to account uid! |
|
307 | + $profile_node->field_country[]['value'] = $boinc_user->country; |
|
308 | + $profile_node->field_zip[]['value'] = $boinc_user->postal_code; |
|
309 | + $profile_node->field_url[]['value'] = $boinc_user->url; |
|
310 | + $profile_node->field_background[]['value'] = $profile_background; |
|
311 | + $profile_node->field_opinions[]['value'] = $profile_opinions; |
|
312 | + $profile_node->field_image[] = $avatar_image; |
|
313 | + $profile_node->field_profile_image[] = $profile_image; |
|
314 | + |
|
315 | + // Save the profile object to the database |
|
316 | + // This will automatically set the author uid if node->name has been set |
|
317 | + $profile_node = node_submit($profile_node); |
|
318 | + node_save($profile_node); |
|
319 | + |
|
320 | + // Mark profile as approved if it has already been vetted somehow |
|
321 | + if ($profile_approved OR !$boinc_user->has_profile) { |
|
322 | 322 | $profile_node->moderate = 0; |
323 | 323 | node_save($profile_node); |
324 | - } |
|
324 | + } |
|
325 | 325 | |
326 | - return; |
|
326 | + return; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | function boincuser_account_cross_reference($uid, $boinc_id) { |
330 | 330 | // Cross reference Drupal account with BOINC |
331 | 331 | $reference = db_query("INSERT INTO {boincuser} SET uid=%d, boinc_id=%d", $uid, $boinc_id); |
332 | 332 | if (!$reference) { |
333 | - drupal_set_message(t("Error connecting BOINC account."), 'error'); |
|
334 | - return false; |
|
333 | + drupal_set_message(t("Error connecting BOINC account."), 'error'); |
|
334 | + return false; |
|
335 | 335 | } |
336 | 336 | return true; |
337 | 337 | } |
@@ -340,35 +340,35 @@ discard block |
||
340 | 340 | * Convert any BOINC forum thread subscriptions to Drupal flag subscriptions |
341 | 341 | */ |
342 | 342 | function boincuser_pull_subscriptions($account = NULL) { |
343 | - if (!$account) { |
|
343 | + if (!$account) { |
|
344 | 344 | global $user; |
345 | 345 | $account = user_load($user->id); |
346 | - } |
|
347 | - elseif (is_numeric($account)) { |
|
346 | + } |
|
347 | + elseif (is_numeric($account)) { |
|
348 | 348 | $account = user_load($account); |
349 | - } |
|
349 | + } |
|
350 | 350 | |
351 | - // Get any subscriptions for this user |
|
352 | - db_set_active('boinc_rw'); |
|
353 | - $subscriptions = db_query(' |
|
351 | + // Get any subscriptions for this user |
|
352 | + db_set_active('boinc_rw'); |
|
353 | + $subscriptions = db_query(' |
|
354 | 354 | SELECT threadid FROM {subscriptions} |
355 | 355 | WHERE userid = %d', $account->boincuser_id); |
356 | - db_set_active('default'); |
|
356 | + db_set_active('default'); |
|
357 | 357 | |
358 | - $flag = flag_get_flag('subscriptions') or die('no "subscriptions" flag defined'); |
|
359 | - $count = 0; |
|
360 | - while ($thread_id = db_result($subscriptions)) { |
|
358 | + $flag = flag_get_flag('subscriptions') or die('no "subscriptions" flag defined'); |
|
359 | + $count = 0; |
|
360 | + while ($thread_id = db_result($subscriptions)) { |
|
361 | 361 | // For each BOINC thread ID subscribed, look up the corresponding node ID |
362 | 362 | $nid = db_result(db_query(' |
363 | 363 | SELECT nid FROM {boincimport_temp_topic} |
364 | 364 | WHERE topic_id = %d', $thread_id)); |
365 | 365 | // Flag this node for the user |
366 | 366 | if ($nid > 0) { |
367 | - $flag->flag('flag', $nid, $account); |
|
368 | - $count++; |
|
367 | + $flag->flag('flag', $nid, $account); |
|
368 | + $count++; |
|
369 | 369 | } |
370 | - } |
|
371 | - return $count; |
|
370 | + } |
|
371 | + return $count; |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | * User account update validation handler. |
381 | 381 | */ |
382 | 382 | function boincuser_account_validate($edit, $account) { |
383 | - // Include BOINC database objects library, load BOINC account data |
|
384 | - require_boinc('boinc_db'); |
|
385 | - $boinc_user = BoincUser::lookup_email_addr($account->mail); |
|
386 | - $changing_email = ($edit['mail'] AND $edit['mail'] != $account->mail) ? true : false; |
|
387 | - $changing_pass = ($edit['pass']) ? true : false; |
|
388 | - if ($changing_email) { |
|
383 | + // Include BOINC database objects library, load BOINC account data |
|
384 | + require_boinc('boinc_db'); |
|
385 | + $boinc_user = BoincUser::lookup_email_addr($account->mail); |
|
386 | + $changing_email = ($edit['mail'] AND $edit['mail'] != $account->mail) ? true : false; |
|
387 | + $changing_pass = ($edit['pass']) ? true : false; |
|
388 | + if ($changing_email) { |
|
389 | 389 | // E-mail address is set to change; check for an existing BOINC user |
390 | 390 | // Check previous email addresses as well, this user's current |
391 | 391 | // email cannot be the same as another user's previous email |
@@ -396,50 +396,50 @@ discard block |
||
396 | 396 | |
397 | 397 | $boinc_user_already_exists = ( BoincUser::lookup_email_addr($edit['mail']) || BoincUser::lookup_prev_email_addr($edit['mail']) ); |
398 | 398 | if ($boinc_user_already_exists) { |
399 | - form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']), NULL, 'boinc:add-new-user')); |
|
399 | + form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']), NULL, 'boinc:add-new-user')); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | // Check email has not been changed in last X days (default X=7). |
403 | 403 | $duration = 86400 * 7; |
404 | 404 | if ( (($boinc_user->email_addr_change_time + $duration) > time()) and (!(user_access('administer users'))) ) { |
405 | - form_set_error('email_addr_change_time', |
|
405 | + form_set_error('email_addr_change_time', |
|
406 | 406 | bts('Your email address was changed within the past seven (7) days. You must wait until !futuredate to change your email again. If you need to reverse this change, please look for an email sent to !prev_email_addr.', |
407 | 407 | array( |
408 | - '!futuredate' => date('F j, Y \a\t H:i T', $boinc_user->email_addr_change_time + $duration), |
|
409 | - '!prev_email_addr' => $boinc_user->previous_email_addr, |
|
408 | + '!futuredate' => date('F j, Y \a\t H:i T', $boinc_user->email_addr_change_time + $duration), |
|
409 | + '!prev_email_addr' => $boinc_user->previous_email_addr, |
|
410 | 410 | ), |
411 | 411 | NULL, 'boinc:account-credentials-change') |
412 | - ); |
|
412 | + ); |
|
413 | + } |
|
413 | 414 | } |
414 | - } |
|
415 | 415 | |
416 | - // If user is changing email or password, require that the current |
|
417 | - // password has been given as well. |
|
418 | - if (($changing_email OR $changing_pass) AND !user_access('administer users')) { |
|
416 | + // If user is changing email or password, require that the current |
|
417 | + // password has been given as well. |
|
418 | + if (($changing_email OR $changing_pass) AND !user_access('administer users')) { |
|
419 | 419 | // If changing email or password, require current password |
420 | 420 | // (except in cases where password is being reset) |
421 | 421 | if (isset($_SESSION['reset_pass'])) { |
422 | - unset($_SESSION['reset_pass']); |
|
422 | + unset($_SESSION['reset_pass']); |
|
423 | 423 | } |
424 | 424 | else { |
425 | - $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
|
426 | - if (!$edit['current_pass']) { |
|
425 | + $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
|
426 | + if (!$edit['current_pass']) { |
|
427 | 427 | form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.', array(), NULL, 'boinc:account-credentials-change')); |
428 | - } |
|
429 | - elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
428 | + } |
|
429 | + elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
430 | 430 | form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:account-credentials-change')); |
431 | - } |
|
431 | + } |
|
432 | 432 | |
433 | 433 | } |
434 | - } |
|
434 | + } |
|
435 | 435 | |
436 | - // If an admin tries to change the email and NOT the password, show |
|
437 | - // error message. BOINC requires both to be changed together. |
|
438 | - if ($changing_email AND !$changing_pass AND user_access('administer users')) { |
|
436 | + // If an admin tries to change the email and NOT the password, show |
|
437 | + // error message. BOINC requires both to be changed together. |
|
438 | + if ($changing_email AND !$changing_pass AND user_access('administer users')) { |
|
439 | 439 | form_set_error('pass', bts('If changing a user\'s email, you must also change the password simultaneously.', array(), NULL, 'boinc:account-credentials-change')); |
440 | - } |
|
440 | + } |
|
441 | 441 | |
442 | - // Expansion required to allow account key in place of passwd...? |
|
442 | + // Expansion required to allow account key in place of passwd...? |
|
443 | 443 | |
444 | 444 | } |
445 | 445 | |
@@ -452,12 +452,12 @@ discard block |
||
452 | 452 | * Password request validation handler. |
453 | 453 | */ |
454 | 454 | function boincuser_request_pass_validate($form, &$form_state) { |
455 | - $edit = $form_state['values']; |
|
456 | - // The Drupal submit function expects a "name" field, even though |
|
457 | - // it contains an email address and we will not allow a user name |
|
458 | - if (!$edit['name']) form_set_error('name', bts('Please enter your email address', array(), NULL, 'boinc:forgot-password')); |
|
459 | - elseif (!valid_email_address($edit['name'])) form_set_error('name', bts('@email is not a well formed email address, please verify', array('@email' => $edit['name']), NULL, 'boinc:forgot-password')); |
|
460 | - else { |
|
455 | + $edit = $form_state['values']; |
|
456 | + // The Drupal submit function expects a "name" field, even though |
|
457 | + // it contains an email address and we will not allow a user name |
|
458 | + if (!$edit['name']) form_set_error('name', bts('Please enter your email address', array(), NULL, 'boinc:forgot-password')); |
|
459 | + elseif (!valid_email_address($edit['name'])) form_set_error('name', bts('@email is not a well formed email address, please verify', array('@email' => $edit['name']), NULL, 'boinc:forgot-password')); |
|
460 | + else { |
|
461 | 461 | // set email addrress to lower case |
462 | 462 | $lower_email_addr = strtolower($edit['name']); |
463 | 463 | |
@@ -467,110 +467,110 @@ discard block |
||
467 | 467 | require_boinc('boinc_db'); |
468 | 468 | $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
469 | 469 | if ($boinc_user) { |
470 | - // If the user is in BOINC but not Drupal, bring them over... |
|
471 | - boincuser_register_make_drupal_user($boinc_user); |
|
470 | + // If the user is in BOINC but not Drupal, bring them over... |
|
471 | + boincuser_register_make_drupal_user($boinc_user); |
|
472 | 472 | } else { |
473 | - // If there is no existing BOINC user either, show an error |
|
474 | - form_set_error('name', bts('No account exists for @email -- please create an account using a BOINC client -- !instructions', |
|
475 | - array( |
|
476 | - '@email' => $edit['name'], |
|
477 | - '!instructions' => l(bts('Instructions', array(), NULL, 'boinc:forgot-password'), 'join') |
|
478 | - ), NULL, 'boinc:forgot-password')); |
|
479 | - } |
|
480 | - } |
|
473 | + // If there is no existing BOINC user either, show an error |
|
474 | + form_set_error('name', bts('No account exists for @email -- please create an account using a BOINC client -- !instructions', |
|
475 | + array( |
|
476 | + '@email' => $edit['name'], |
|
477 | + '!instructions' => l(bts('Instructions', array(), NULL, 'boinc:forgot-password'), 'join') |
|
478 | + ), NULL, 'boinc:forgot-password')); |
|
479 | + } |
|
480 | + } |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
484 | 484 | * The definition of the authenticator login form. |
485 | 485 | */ |
486 | 486 | function boincuser_authloginform() { |
487 | - $headers = apache_request_headers(); |
|
488 | - $project_name = variable_get('site_name', 'Drupal-BOINC'); |
|
489 | - $project_domain = $headers['Host']; |
|
490 | - $form['heading'] = array( |
|
487 | + $headers = apache_request_headers(); |
|
488 | + $project_name = variable_get('site_name', 'Drupal-BOINC'); |
|
489 | + $project_domain = $headers['Host']; |
|
490 | + $form['heading'] = array( |
|
491 | 491 | '#type' => 'markup', |
492 | 492 | '#value' => '<h3>' . bts("If you forgot your account's email address, or you can't receive email there:", array(), NULL, 'boinc:authenticator-login-page') . '</h3>' |
493 | - ); |
|
494 | - $form['instructions'] = array( |
|
493 | + ); |
|
494 | + $form['instructions'] = array( |
|
495 | 495 | '#type' => 'markup', |
496 | 496 | '#value' => '' . |
497 | - '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:", array(), NULL, 'boinc:authenticator-login-page') . |
|
498 | - ' <ul>' . |
|
499 | - ' <li>' . bts('Go to the BOINC data directory on your computer (see !boinc_wiki for help finding this).', array('!boinc_wiki' => l(bts('BOINC documentation', array(), NULL, 'boinc:authenticator-login-page'), 'http://boinc.berkeley.edu/wiki/BOINC_Data_directory')), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
500 | - ' <li>' . bts('Find your account file for this project; it will have a name like %file (where the project URL is %url).', array('%file' => "account_{$project_domain}.xml", '%url' => "http://{$project_domain}"), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
501 | - ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:", array(), NULL, 'boinc:authenticator-login-page') . |
|
502 | - ' <pre>' . |
|
503 | - '<account>' . "\n" . |
|
504 | - " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
|
505 | - ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>' . "\n" . |
|
506 | - " <project_name>{$project_name}</project_name>" . "\n" . |
|
507 | - ' ...' . "\n" . |
|
508 | - '</account>' . |
|
509 | - ' </pre>' . |
|
510 | - ' </li>' . |
|
511 | - ' <li>' . bts('Select and Copy the string between <authenticator> and </authenticator> (%auth in the above example).', array('%auth' => '8b8496fdd26df7dc0423ecd43c09a56b'), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
512 | - ' <li>' . bts('Paste the string into the field below, and click OK.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
513 | - ' <li>' . bts('You will now be logged in to your account; update the email and password of your account.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
514 | - ' </ul>' . |
|
515 | - '</p>' |
|
516 | - ); |
|
517 | - $form['authenticator'] = array( |
|
497 | + '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:", array(), NULL, 'boinc:authenticator-login-page') . |
|
498 | + ' <ul>' . |
|
499 | + ' <li>' . bts('Go to the BOINC data directory on your computer (see !boinc_wiki for help finding this).', array('!boinc_wiki' => l(bts('BOINC documentation', array(), NULL, 'boinc:authenticator-login-page'), 'http://boinc.berkeley.edu/wiki/BOINC_Data_directory')), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
500 | + ' <li>' . bts('Find your account file for this project; it will have a name like %file (where the project URL is %url).', array('%file' => "account_{$project_domain}.xml", '%url' => "http://{$project_domain}"), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
501 | + ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:", array(), NULL, 'boinc:authenticator-login-page') . |
|
502 | + ' <pre>' . |
|
503 | + '<account>' . "\n" . |
|
504 | + " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
|
505 | + ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>' . "\n" . |
|
506 | + " <project_name>{$project_name}</project_name>" . "\n" . |
|
507 | + ' ...' . "\n" . |
|
508 | + '</account>' . |
|
509 | + ' </pre>' . |
|
510 | + ' </li>' . |
|
511 | + ' <li>' . bts('Select and Copy the string between <authenticator> and </authenticator> (%auth in the above example).', array('%auth' => '8b8496fdd26df7dc0423ecd43c09a56b'), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
512 | + ' <li>' . bts('Paste the string into the field below, and click OK.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
513 | + ' <li>' . bts('You will now be logged in to your account; update the email and password of your account.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
514 | + ' </ul>' . |
|
515 | + '</p>' |
|
516 | + ); |
|
517 | + $form['authenticator'] = array( |
|
518 | 518 | '#title' => bts('Log in with authenticator', array(), NULL, 'boinc:authenticator-login-page'), |
519 | 519 | '#type' => 'textfield', |
520 | 520 | '#size' => 60, |
521 | 521 | '#maxlength' => 32, |
522 | 522 | '#required' => TRUE, |
523 | 523 | '#description' => null |
524 | - ); |
|
524 | + ); |
|
525 | 525 | |
526 | - // Form control |
|
527 | - $form['form control tabs prefix'] = array( |
|
526 | + // Form control |
|
527 | + $form['form control tabs prefix'] = array( |
|
528 | 528 | '#value' => '<ul class="form-control tab-list">', |
529 | 529 | '#weight' => 1001, |
530 | - ); |
|
531 | - $form['submit'] = array( |
|
530 | + ); |
|
531 | + $form['submit'] = array( |
|
532 | 532 | '#prefix' => '<li class="first tab">', |
533 | 533 | '#type' => 'submit', |
534 | 534 | '#value' => bts('OK', array(), NULL, 'boinc:form-ok'), |
535 | 535 | '#suffix' => '</li>', |
536 | 536 | '#weight' => 1002, |
537 | - ); |
|
538 | - $form['form control tabs'] = array( |
|
537 | + ); |
|
538 | + $form['form control tabs'] = array( |
|
539 | 539 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/password') . '</li>', |
540 | 540 | '#weight' => 1003, |
541 | - ); |
|
542 | - $form['form control tabs suffix'] = array( |
|
541 | + ); |
|
542 | + $form['form control tabs suffix'] = array( |
|
543 | 543 | '#value' => '</ul>', |
544 | 544 | '#weight' => 1004, |
545 | - ); |
|
546 | - return $form; |
|
545 | + ); |
|
546 | + return $form; |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
550 | 550 | * The authenticator login validation handler |
551 | 551 | */ |
552 | 552 | function boincuser_authloginform_validate($form, &$form_state) { |
553 | - $authenticator = $form_state['values']['authenticator']; |
|
554 | - if (strlen($authenticator) != 32) { |
|
553 | + $authenticator = $form_state['values']['authenticator']; |
|
554 | + if (strlen($authenticator) != 32) { |
|
555 | 555 | // We notify the form API that this field has failed validation. |
556 | 556 | form_set_error('authenticator', bts('That authenticator is not valid.', array(), NULL, 'boinc:authenticator-login-page')); |
557 | - } else { |
|
557 | + } else { |
|
558 | 558 | require_boinc('boinc_db'); |
559 | 559 | $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
560 | 560 | if (!$boinc_user) form_set_error('authenticator', bts('There is no account with that authenticator.', array(), NULL, 'boinc:authenticator-login-page')); |
561 | - } |
|
561 | + } |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | /** |
565 | 565 | * The authenticator login submit handler |
566 | 566 | */ |
567 | 567 | function boincuser_authloginform_submit($form, &$form_state) { |
568 | - global $user; |
|
569 | - $authenticator = $form_state['values']['authenticator']; |
|
570 | - require_boinc('boinc_db'); |
|
571 | - $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
|
572 | - if (!$user = user_load(get_drupal_id($boinc_user->id))) drupal_set_message(t('An unresolved error occurred while logging into this account.')); |
|
573 | - else $form_state['redirect'] = 'account/info/edit'; |
|
568 | + global $user; |
|
569 | + $authenticator = $form_state['values']['authenticator']; |
|
570 | + require_boinc('boinc_db'); |
|
571 | + $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
|
572 | + if (!$user = user_load(get_drupal_id($boinc_user->id))) drupal_set_message(t('An unresolved error occurred while logging into this account.')); |
|
573 | + else $form_state['redirect'] = 'account/info/edit'; |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -578,44 +578,44 @@ discard block |
||
578 | 578 | * The definition of the moderator reject user profile form. |
579 | 579 | */ |
580 | 580 | function boincuser_moderate_profile_reject_form(&$form_state, $uid) { |
581 | - $form_state['storage']['reject_profile_uid'] = $uid; |
|
582 | - $form['reason'] = array( |
|
581 | + $form_state['storage']['reject_profile_uid'] = $uid; |
|
582 | + $form['reason'] = array( |
|
583 | 583 | '#title' => bts('Reason for rejecting this profile', array(), NULL, 'boinc:moderate-user'), |
584 | 584 | '#type' => 'textarea', |
585 | 585 | '#description' => bts('This reason will be included in an email to the user. Please write a brief explanation of the problem and how to fix it.', array(), NULL, 'boinc:moderate-user'), |
586 | 586 | '#default_value' => '', |
587 | - ); |
|
587 | + ); |
|
588 | 588 | |
589 | - // Form control |
|
590 | - $form['form control tabs prefix'] = array( |
|
589 | + // Form control |
|
590 | + $form['form control tabs prefix'] = array( |
|
591 | 591 | '#value' => '<ul class="form-control tab-list">', |
592 | 592 | '#weight' => 1001, |
593 | - ); |
|
594 | - $form['submit'] = array( |
|
593 | + ); |
|
594 | + $form['submit'] = array( |
|
595 | 595 | '#prefix' => '<li class="first tab">', |
596 | 596 | '#type' => 'submit', |
597 | 597 | '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
598 | 598 | '#suffix' => '</li>', |
599 | 599 | '#weight' => 1002, |
600 | - ); |
|
601 | - $form['form control tabs'] = array( |
|
600 | + ); |
|
601 | + $form['form control tabs'] = array( |
|
602 | 602 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
603 | 603 | '#weight' => 1003, |
604 | - ); |
|
605 | - $form['form control tabs suffix'] = array( |
|
604 | + ); |
|
605 | + $form['form control tabs suffix'] = array( |
|
606 | 606 | '#value' => '</ul>', |
607 | 607 | '#weight' => 1004, |
608 | - ); |
|
609 | - return $form; |
|
608 | + ); |
|
609 | + return $form; |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | /** |
613 | 613 | * The moderator reject user profile submit handler |
614 | 614 | */ |
615 | 615 | function boincuser_moderate_profile_reject_form_submit($form, &$form_state) { |
616 | - $uid = $form_state['storage']['reject_profile_uid']; |
|
617 | - $reason = $form_state['values']['reason']; |
|
618 | - boincuser_moderate_profile_reject($uid, $reason); |
|
616 | + $uid = $form_state['storage']['reject_profile_uid']; |
|
617 | + $reason = $form_state['values']['reason']; |
|
618 | + boincuser_moderate_profile_reject($uid, $reason); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -623,52 +623,52 @@ discard block |
||
623 | 623 | * The definition of the ban user form. |
624 | 624 | */ |
625 | 625 | function boincuser_moderate_user_ban_form(&$form_state, $uid) { |
626 | - $form_state['storage']['ban_user_uid'] = $uid; |
|
627 | - $form['reason'] = array( |
|
626 | + $form_state['storage']['ban_user_uid'] = $uid; |
|
627 | + $form['reason'] = array( |
|
628 | 628 | '#title' => bts('Reason for banning this user', array(), NULL, 'boinc:moderate-user'), |
629 | 629 | '#type' => 'textarea', |
630 | 630 | '#description' => bts('This reason will be included in an email to the user. Please write a brief explanation of why the user is being banned.', array(), NULL, 'boinc:moderate-user'), |
631 | 631 | '#default_value' => '', |
632 | - ); |
|
633 | - $form['duration'] = array( |
|
632 | + ); |
|
633 | + $form['duration'] = array( |
|
634 | 634 | '#title' => bts('Duration of the ban', array(), NULL, 'boinc:moderate-user'), |
635 | 635 | '#type' => 'textfield', |
636 | 636 | '#description' => bts('The number of days until the ban expires. Set to 0 to ban permanently.', array(), NULL, 'boinc:moderate-user'), |
637 | 637 | '#default_value' => '', |
638 | - ); |
|
638 | + ); |
|
639 | 639 | |
640 | - // Form control |
|
641 | - $form['form control tabs prefix'] = array( |
|
640 | + // Form control |
|
641 | + $form['form control tabs prefix'] = array( |
|
642 | 642 | '#value' => '<ul class="form-control tab-list">', |
643 | 643 | '#weight' => 1001, |
644 | - ); |
|
645 | - $form['submit'] = array( |
|
644 | + ); |
|
645 | + $form['submit'] = array( |
|
646 | 646 | '#prefix' => '<li class="first tab">', |
647 | 647 | '#type' => 'submit', |
648 | 648 | '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
649 | 649 | '#suffix' => '</li>', |
650 | 650 | '#weight' => 1002, |
651 | - ); |
|
652 | - $form['form control tabs'] = array( |
|
651 | + ); |
|
652 | + $form['form control tabs'] = array( |
|
653 | 653 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
654 | 654 | '#weight' => 1003, |
655 | - ); |
|
656 | - $form['form control tabs suffix'] = array( |
|
655 | + ); |
|
656 | + $form['form control tabs suffix'] = array( |
|
657 | 657 | '#value' => '</ul>', |
658 | 658 | '#weight' => 1004, |
659 | - ); |
|
660 | - return $form; |
|
659 | + ); |
|
660 | + return $form; |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | /** |
664 | 664 | * The ban user submit handler |
665 | 665 | */ |
666 | 666 | function boincuser_moderate_user_ban_form_submit($form, &$form_state) { |
667 | - $uid = $form_state['storage']['ban_user_uid']; |
|
668 | - $reason = $form_state['values']['reason']; |
|
669 | - $duration = $form_state['values']['duration']; |
|
670 | - if ($duration) $duration = $duration * 24*60*60; |
|
671 | - boincuser_moderate_user_ban($uid, $reason, $duration); |
|
667 | + $uid = $form_state['storage']['ban_user_uid']; |
|
668 | + $reason = $form_state['values']['reason']; |
|
669 | + $duration = $form_state['values']['duration']; |
|
670 | + if ($duration) $duration = $duration * 24*60*60; |
|
671 | + boincuser_moderate_user_ban($uid, $reason, $duration); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | |
@@ -676,10 +676,10 @@ discard block |
||
676 | 676 | * Hack to fix submission of the flag friend unfriend form |
677 | 677 | */ |
678 | 678 | function boincuser_fix_unfriend_form_submit($form, &$form_state) { |
679 | - // Leaving action as "unfriend" causes problems |
|
680 | - if ($form_state['values']['action'] == 'unfriend') { |
|
679 | + // Leaving action as "unfriend" causes problems |
|
680 | + if ($form_state['values']['action'] == 'unfriend') { |
|
681 | 681 | $form_state['values']['action'] = 'unflag'; |
682 | - } |
|
682 | + } |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -687,90 +687,90 @@ discard block |
||
687 | 687 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
688 | 688 | |
689 | 689 | function boincuser_termsofuse_form() { |
690 | - global $user; |
|
690 | + global $user; |
|
691 | 691 | |
692 | - // If user has already signed terms of use, and got to this form in error, send them to site home. |
|
693 | - if (boincuser_check_termsofuse($user)) { |
|
692 | + // If user has already signed terms of use, and got to this form in error, send them to site home. |
|
693 | + if (boincuser_check_termsofuse($user)) { |
|
694 | 694 | drupal_goto(); |
695 | - } |
|
695 | + } |
|
696 | 696 | |
697 | - drupal_set_message( bts('WARNING: You have not agreed to our terms of use. Please agree to the terms of use before continuing.', array(), NULL, 'boinc:termsofuse-form'), 'warning' ); |
|
697 | + drupal_set_message( bts('WARNING: You have not agreed to our terms of use. Please agree to the terms of use before continuing.', array(), NULL, 'boinc:termsofuse-form'), 'warning' ); |
|
698 | 698 | |
699 | - $form = array(); |
|
699 | + $form = array(); |
|
700 | 700 | |
701 | - // Terms of use section |
|
702 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
703 | - $form['title1'] = array( |
|
701 | + // Terms of use section |
|
702 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
703 | + $form['title1'] = array( |
|
704 | 704 | '#weight' => -12, |
705 | 705 | '#value' => '<h2>' . bts( variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:termsofuse-form' ) . '</h2>', |
706 | 706 | '#prefix' => '<div id="register-title1">', |
707 | 707 | '#suffix' => '</div>', |
708 | - ); |
|
708 | + ); |
|
709 | 709 | |
710 | - $form['termsofuse'] = array( |
|
710 | + $form['termsofuse'] = array( |
|
711 | 711 | '#weight' => -10, |
712 | 712 | '#value' => bts($termsofuse, array(), NULL, 'project:termsofuse-form'), |
713 | 713 | '#prefix' => '<div id="register-termsofuse">', |
714 | 714 | '#suffix' => '</div>', |
715 | - ); |
|
715 | + ); |
|
716 | 716 | |
717 | - $form['agreeTOU'] = array( |
|
717 | + $form['agreeTOU'] = array( |
|
718 | 718 | '#type' => 'checkbox', |
719 | 719 | '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:termsofuse-form'), |
720 | 720 | '#weight' => -8, |
721 | 721 | '#prefix' => '<div id="register-checkbox">', |
722 | 722 | '#suffix' => '</div>', |
723 | - ); |
|
723 | + ); |
|
724 | 724 | |
725 | - $form['spacer'] = array( |
|
725 | + $form['spacer'] = array( |
|
726 | 726 | '#prefix' => '<div id="register-title2">', |
727 | 727 | '#value' => ' ', |
728 | 728 | '#suffix' => '</div>', |
729 | - ); |
|
729 | + ); |
|
730 | 730 | |
731 | - // Form Control |
|
732 | - $form['submit'] = array( |
|
731 | + // Form Control |
|
732 | + $form['submit'] = array( |
|
733 | 733 | '#prefix' => '<p><p><p><li class="first tab">', |
734 | 734 | '#type' => 'submit', |
735 | 735 | '#value' => bts('Yes', array(), NULL, 'boinc:form-submit'), |
736 | 736 | '#suffix' => '</li>', |
737 | - ); |
|
738 | - $form['form control tabs'] = array( |
|
737 | + ); |
|
738 | + $form['form control tabs'] = array( |
|
739 | 739 | '#value' => '<li class="tab">' . l(bts('NO - LOGOUT', array(), NULL, 'boinc:form-cancel'), '/logout') . '</li>', |
740 | - ); |
|
741 | - if (module_exists('boincuser_delete')) { |
|
740 | + ); |
|
741 | + if (module_exists('boincuser_delete')) { |
|
742 | 742 | $deletelink = '/user/' . $user->uid . '/delete'; |
743 | 743 | $form['deleteaccount'] = array( |
744 | - '#value' => '<li class="tab">' . l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink) . '</li>', |
|
744 | + '#value' => '<li class="tab">' . l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink) . '</li>', |
|
745 | 745 | ); |
746 | - } |
|
746 | + } |
|
747 | 747 | |
748 | - // Set form redirect |
|
749 | - $form['#redirect'] = $_REQUEST['destination']; |
|
748 | + // Set form redirect |
|
749 | + $form['#redirect'] = $_REQUEST['destination']; |
|
750 | 750 | |
751 | - // Add the current user's data into the form |
|
752 | - $form['#account'] = $user; |
|
751 | + // Add the current user's data into the form |
|
752 | + $form['#account'] = $user; |
|
753 | 753 | |
754 | - return $form; |
|
754 | + return $form; |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | function boincuser_termsofuse_form_validate($form, &$form_state) { |
758 | - // Check TOU agreement |
|
759 | - if (!$form_state['values']['agreeTOU']) { |
|
758 | + // Check TOU agreement |
|
759 | + if (!$form_state['values']['agreeTOU']) { |
|
760 | 760 | form_set_error('termsofuse', bts('ERROR: You must acknowledge our terms of use by clicking the checkbox before registering for an account.', array(), NULL, 'boinc:termsofuse-form')); |
761 | - } |
|
761 | + } |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | function boincuser_termsofuse_form_submit($form, &$form_state) { |
765 | - $user = $form['#account']; |
|
766 | - if (!boincuser_consentto_termsofuse($user)) { |
|
765 | + $user = $form['#account']; |
|
766 | + if (!boincuser_consentto_termsofuse($user)) { |
|
767 | 767 | form_set_error('termsofuse', bts('There was an error in agreeing to the terms of use. Please contact the site administrators.', array(), NULL, 'boinc:termsofuse-form')); |
768 | - } |
|
768 | + } |
|
769 | 769 | |
770 | - // Delete session messages |
|
771 | - if ($_SESSION['messages']['warning']) { |
|
770 | + // Delete session messages |
|
771 | + if ($_SESSION['messages']['warning']) { |
|
772 | 772 | unset($_SESSION['messages']['warning']); |
773 | - } |
|
773 | + } |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | /** |
@@ -779,88 +779,88 @@ discard block |
||
779 | 779 | * removed after used. |
780 | 780 | */ |
781 | 781 | function boincuser_revertemail(&$form_state, $token) { |
782 | - require_boinc('token'); |
|
783 | - require_boinc('util'); |
|
782 | + require_boinc('token'); |
|
783 | + require_boinc('util'); |
|
784 | 784 | |
785 | - global $user; |
|
786 | - $form = array(); |
|
785 | + global $user; |
|
786 | + $form = array(); |
|
787 | 787 | |
788 | - // drupal JS for dynamic password validation |
|
789 | - _user_password_dynamic_validation(); |
|
788 | + // drupal JS for dynamic password validation |
|
789 | + _user_password_dynamic_validation(); |
|
790 | 790 | |
791 | - // check BOINC user exists |
|
792 | - $account = user_load(array('uid' => $user->uid)); |
|
793 | - $uid = $user->uid; |
|
794 | - $boincid = $account->boincuser_id; |
|
795 | - // check $token is valid |
|
796 | - if (!is_valid_token($boincid, $token, 'E')) { |
|
791 | + // check BOINC user exists |
|
792 | + $account = user_load(array('uid' => $user->uid)); |
|
793 | + $uid = $user->uid; |
|
794 | + $boincid = $account->boincuser_id; |
|
795 | + // check $token is valid |
|
796 | + if (!is_valid_token($boincid, $token, 'E')) { |
|
797 | 797 | drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your email address.', |
798 | 798 | array( |
799 | - '!link' => l(bts('changing', array(), NULL, 'boinc:revert-email-change'), "/account/info/edit"), |
|
799 | + '!link' => l(bts('changing', array(), NULL, 'boinc:revert-email-change'), "/account/info/edit"), |
|
800 | 800 | ), |
801 | 801 | NULL, 'boinc:revert-email-change'), 'error'); |
802 | 802 | drupal_goto(); |
803 | - } |
|
803 | + } |
|
804 | 804 | |
805 | - // Attach account and token to this form. |
|
806 | - $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
807 | - $form['_token'] = array('#type' => 'value', '#value' => $token); |
|
805 | + // Attach account and token to this form. |
|
806 | + $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
807 | + $form['_token'] = array('#type' => 'value', '#value' => $token); |
|
808 | 808 | |
809 | - // Instructions |
|
810 | - $form['main']['instructions1'] = array( |
|
809 | + // Instructions |
|
810 | + $form['main']['instructions1'] = array( |
|
811 | 811 | '#value' => '<p>'. |
812 | 812 | bts('In order to change your email back to your previous email address, <strong>!prev_email</strong>, you must also change your password.', |
813 | - array( |
|
813 | + array( |
|
814 | 814 | '!prev_email' => $account->boincuser_previous_email_addr, |
815 | - ), |
|
816 | - NULL, 'boinc:revert-email-change'). |
|
815 | + ), |
|
816 | + NULL, 'boinc:revert-email-change'). |
|
817 | 817 | '</p>', |
818 | - ); |
|
818 | + ); |
|
819 | 819 | |
820 | - $form['main']['pass'] = array( |
|
820 | + $form['main']['pass'] = array( |
|
821 | 821 | '#type' => 'password_confirm', |
822 | 822 | '#description' => 'Enter a new password in both fields', |
823 | 823 | '#size' => 17, |
824 | - ); |
|
825 | - |
|
826 | - // Wrap action buttons for styling consistency |
|
827 | - $form['buttons']['form control tabs prefix'] = array( |
|
828 | - '#value' => '<ul class="form-control tab-list">', |
|
829 | - '#weight' => 1001, |
|
830 | - ); |
|
831 | - $form['buttons']['submit']['#type'] = 'submit'; |
|
832 | - $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
|
833 | - $form['buttons']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
834 | - $form['buttons']['submit']['#suffix'] = '</li>'; |
|
835 | - $form['buttons']['submit']['#weight'] = 1002; |
|
836 | - $form['buttons']['cancel'] = array( |
|
837 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit') . '</li>', |
|
838 | - '#weight' => 1005, |
|
839 | - ); |
|
840 | - $form['buttons']['form control tabs suffix'] = array( |
|
841 | - '#value' => '</ul>', |
|
842 | - '#weight' => 1010, |
|
843 | - ); |
|
844 | - |
|
845 | - return $form; |
|
824 | + ); |
|
825 | + |
|
826 | + // Wrap action buttons for styling consistency |
|
827 | + $form['buttons']['form control tabs prefix'] = array( |
|
828 | + '#value' => '<ul class="form-control tab-list">', |
|
829 | + '#weight' => 1001, |
|
830 | + ); |
|
831 | + $form['buttons']['submit']['#type'] = 'submit'; |
|
832 | + $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
|
833 | + $form['buttons']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
834 | + $form['buttons']['submit']['#suffix'] = '</li>'; |
|
835 | + $form['buttons']['submit']['#weight'] = 1002; |
|
836 | + $form['buttons']['cancel'] = array( |
|
837 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit') . '</li>', |
|
838 | + '#weight' => 1005, |
|
839 | + ); |
|
840 | + $form['buttons']['form control tabs suffix'] = array( |
|
841 | + '#value' => '</ul>', |
|
842 | + '#weight' => 1010, |
|
843 | + ); |
|
844 | + |
|
845 | + return $form; |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | /** |
849 | 849 | * Validation handler for revertemail form |
850 | 850 | */ |
851 | 851 | function boincuser_revertemail_validate($form, &$form_state) { |
852 | - // Load account and boincuser |
|
853 | - $account = $form_state['values']['_account']; |
|
854 | - $boinc_user = BoincUser::lookup_id_nocache($account->boincuser_id); |
|
852 | + // Load account and boincuser |
|
853 | + $account = $form_state['values']['_account']; |
|
854 | + $boinc_user = BoincUser::lookup_id_nocache($account->boincuser_id); |
|
855 | 855 | |
856 | - if (BoincUser::lookup_email_addr($boinc_user->previous_email_addr)) { |
|
856 | + if (BoincUser::lookup_email_addr($boinc_user->previous_email_addr)) { |
|
857 | 857 | form_set_error('mail', bts('An account already exists for @email. Please contact admins for @project. Previous email address cannot be used because another account is using it as their email address.', |
858 | - array( |
|
858 | + array( |
|
859 | 859 | '@email' => $boinc_user->previous_email_addr, |
860 | 860 | '@project' => variable_get('site_name', 'Drupal-BOINC'), |
861 | - ), |
|
861 | + ), |
|
862 | 862 | NULL, 'boinc:add-new-user')); |
863 | - } |
|
863 | + } |
|
864 | 864 | |
865 | 865 | } |
866 | 866 | |
@@ -868,25 +868,25 @@ discard block |
||
868 | 868 | * Submit handler for revertemail form |
869 | 869 | */ |
870 | 870 | function boincuser_revertemail_submit($form, &$form_state) { |
871 | - require_boinc('password_compat/password'); |
|
871 | + require_boinc('password_compat/password'); |
|
872 | 872 | |
873 | - // Load account and boincuser |
|
874 | - $account = $form_state['values']['_account']; |
|
875 | - $boinc_user = BoincUser::lookup_id_nocache($account->boincuser_id); |
|
873 | + // Load account and boincuser |
|
874 | + $account = $form_state['values']['_account']; |
|
875 | + $boinc_user = BoincUser::lookup_id_nocache($account->boincuser_id); |
|
876 | 876 | |
877 | - $pem = strtolower($boinc_user->previous_email_addr); |
|
877 | + $pem = strtolower($boinc_user->previous_email_addr); |
|
878 | 878 | |
879 | - // Set new password based on previous email address and entered |
|
880 | - // password. |
|
881 | - $new_passwd_hash = password_hash( md5($form_state['values']['pass'].$pem), PASSWORD_DEFAULT); |
|
879 | + // Set new password based on previous email address and entered |
|
880 | + // password. |
|
881 | + $new_passwd_hash = password_hash( md5($form_state['values']['pass'].$pem), PASSWORD_DEFAULT); |
|
882 | 882 | |
883 | - $boinc_user->update("email_addr='${pem}', previous_email_addr='', email_addr_change_time=0, passwd_hash='${new_passwd_hash}'"); |
|
883 | + $boinc_user->update("email_addr='${pem}', previous_email_addr='', email_addr_change_time=0, passwd_hash='${new_passwd_hash}'"); |
|
884 | 884 | |
885 | - // Set email in drupal database to previous email |
|
886 | - user_save($account, array('mail' => $pem)); |
|
885 | + // Set email in drupal database to previous email |
|
886 | + user_save($account, array('mail' => $pem)); |
|
887 | 887 | |
888 | - // delete the token |
|
889 | - $result = delete_token($account->boincuser_id, $form_state['values']['_token'], 'E'); |
|
888 | + // delete the token |
|
889 | + $result = delete_token($account->boincuser_id, $form_state['values']['_token'], 'E'); |
|
890 | 890 | |
891 | - drupal_goto('account'); |
|
891 | + drupal_goto('account'); |
|
892 | 892 | } |
@@ -31,43 +31,43 @@ |
||
31 | 31 | */ |
32 | 32 | |
33 | 33 | function boincuser_quote_form_alter(&$form, $form_state, $form_id) { |
34 | - switch ($form_id) { |
|
35 | - // Comment form |
|
36 | - case 'comment_form': |
|
34 | + switch ($form_id) { |
|
35 | + // Comment form |
|
36 | + case 'comment_form': |
|
37 | 37 | // If there is a quote as part of the comment body, replace the |
38 | 38 | // first instance of quote=author with quote=boincusername. This |
39 | 39 | // is done with regexp. |
40 | 40 | // Modify for quotes only |
41 | 41 | if ((isset($_POST['quote']) || isset($_GET['quote']) && $_GET['quote'])) { |
42 | - // If default_value is already set, then modify it |
|
43 | - if (isset($form['comment_filter']['comment']['#default_value'])) { |
|
42 | + // If default_value is already set, then modify it |
|
43 | + if (isset($form['comment_filter']['comment']['#default_value'])) { |
|
44 | 44 | $nid = arg(2); |
45 | 45 | $cid = arg(3); |
46 | 46 | |
47 | 47 | $replace = FALSE; |
48 | 48 | if ($cid) { |
49 | - $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = 0', $cid)); |
|
50 | - if ($comment->uid) { |
|
49 | + $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = 0', $cid)); |
|
50 | + if ($comment->uid) { |
|
51 | 51 | $account = user_load($comment->uid); |
52 | 52 | $boincusername = (!empty($account)) ? $account->boincuser_name : variable_get('anonymous', 'Anonymous'); |
53 | 53 | $replace = TRUE; |
54 | - } |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | elseif ($nid && _quote_variable_get('node_link_display')) { |
57 | - $node = node_load(array('nid' => $nid)); |
|
58 | - if (in_array($node->type, _quote_variable_get('node_types'))) { |
|
57 | + $node = node_load(array('nid' => $nid)); |
|
58 | + if (in_array($node->type, _quote_variable_get('node_types'))) { |
|
59 | 59 | $account = user_load($node->uid); |
60 | 60 | $boincusername = (!empty($account)) ? $account->boincuser_name : variable_get('anonymous', 'Anonymous'); |
61 | 61 | $replace = TRUE; |
62 | - } |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Replace the quoted author name (drupal name) with BOINC username. |
66 | 66 | if ($replace) { |
67 | - $form['comment_filter']['comment']['#default_value'] = preg_replace("/\[quote=(.*?)\]/", "[quote=${boincusername}]", $form['comment_filter']['comment']['#default_value'], 1); |
|
67 | + $form['comment_filter']['comment']['#default_value'] = preg_replace("/\[quote=(.*?)\]/", "[quote=${boincusername}]", $form['comment_filter']['comment']['#default_value'], 1); |
|
68 | + } |
|
68 | 69 | } |
69 | - } |
|
70 | 70 | } |
71 | 71 | break; |
72 | - } |
|
72 | + } |
|
73 | 73 | } |
@@ -4,22 +4,22 @@ discard block |
||
4 | 4 | * Implementation of hook_views_default_views(). |
5 | 5 | */ |
6 | 6 | function user_profiles_views_default_views() { |
7 | - $views = array(); |
|
7 | + $views = array(); |
|
8 | 8 | |
9 | - // Exported view: moderation_queue |
|
10 | - $view = new view; |
|
11 | - $view->name = 'moderation_queue'; |
|
12 | - $view->description = ''; |
|
13 | - $view->tag = ''; |
|
14 | - $view->base_table = 'node'; |
|
15 | - $view->core = 6; |
|
16 | - $view->api_version = '2'; |
|
17 | - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
18 | - $handler = $view->new_display('default', 'Defaults', 'default'); |
|
19 | - $handler->override_option('fields', array( |
|
9 | + // Exported view: moderation_queue |
|
10 | + $view = new view; |
|
11 | + $view->name = 'moderation_queue'; |
|
12 | + $view->description = ''; |
|
13 | + $view->tag = ''; |
|
14 | + $view->base_table = 'node'; |
|
15 | + $view->core = 6; |
|
16 | + $view->api_version = '2'; |
|
17 | + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
18 | + $handler = $view->new_display('default', 'Defaults', 'default'); |
|
19 | + $handler->override_option('fields', array( |
|
20 | 20 | 'title' => array( |
21 | - 'label' => 'Title', |
|
22 | - 'alter' => array( |
|
21 | + 'label' => 'Title', |
|
22 | + 'alter' => array( |
|
23 | 23 | 'alter_text' => 0, |
24 | 24 | 'text' => '', |
25 | 25 | 'make_link' => 0, |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | 'ellipsis' => 1, |
39 | 39 | 'html' => 0, |
40 | 40 | 'strip_tags' => 0, |
41 | - ), |
|
42 | - 'empty' => '', |
|
43 | - 'hide_empty' => 0, |
|
44 | - 'empty_zero' => 0, |
|
45 | - 'hide_alter_empty' => 1, |
|
46 | - 'link_to_node' => 1, |
|
47 | - 'exclude' => 0, |
|
48 | - 'id' => 'title', |
|
49 | - 'table' => 'node', |
|
50 | - 'field' => 'title', |
|
51 | - 'relationship' => 'none', |
|
41 | + ), |
|
42 | + 'empty' => '', |
|
43 | + 'hide_empty' => 0, |
|
44 | + 'empty_zero' => 0, |
|
45 | + 'hide_alter_empty' => 1, |
|
46 | + 'link_to_node' => 1, |
|
47 | + 'exclude' => 0, |
|
48 | + 'id' => 'title', |
|
49 | + 'table' => 'node', |
|
50 | + 'field' => 'title', |
|
51 | + 'relationship' => 'none', |
|
52 | 52 | ), |
53 | 53 | 'changed' => array( |
54 | - 'label' => 'Updated date', |
|
55 | - 'alter' => array( |
|
54 | + 'label' => 'Updated date', |
|
55 | + 'alter' => array( |
|
56 | 56 | 'alter_text' => 0, |
57 | 57 | 'text' => '', |
58 | 58 | 'make_link' => 0, |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | 'ellipsis' => 1, |
72 | 72 | 'html' => 0, |
73 | 73 | 'strip_tags' => 0, |
74 | - ), |
|
75 | - 'empty' => '', |
|
76 | - 'hide_empty' => 0, |
|
77 | - 'empty_zero' => 0, |
|
78 | - 'hide_alter_empty' => 1, |
|
79 | - 'date_format' => 'time ago', |
|
80 | - 'custom_date_format' => '', |
|
81 | - 'exclude' => 0, |
|
82 | - 'id' => 'changed', |
|
83 | - 'table' => 'node', |
|
84 | - 'field' => 'changed', |
|
85 | - 'relationship' => 'none', |
|
74 | + ), |
|
75 | + 'empty' => '', |
|
76 | + 'hide_empty' => 0, |
|
77 | + 'empty_zero' => 0, |
|
78 | + 'hide_alter_empty' => 1, |
|
79 | + 'date_format' => 'time ago', |
|
80 | + 'custom_date_format' => '', |
|
81 | + 'exclude' => 0, |
|
82 | + 'id' => 'changed', |
|
83 | + 'table' => 'node', |
|
84 | + 'field' => 'changed', |
|
85 | + 'relationship' => 'none', |
|
86 | 86 | ), |
87 | 87 | 'uid' => array( |
88 | - 'label' => 'Uid', |
|
89 | - 'alter' => array( |
|
88 | + 'label' => 'Uid', |
|
89 | + 'alter' => array( |
|
90 | 90 | 'alter_text' => 0, |
91 | 91 | 'text' => '', |
92 | 92 | 'make_link' => 0, |
@@ -105,21 +105,21 @@ discard block |
||
105 | 105 | 'ellipsis' => 1, |
106 | 106 | 'html' => 0, |
107 | 107 | 'strip_tags' => 0, |
108 | - ), |
|
109 | - 'empty' => '', |
|
110 | - 'hide_empty' => 0, |
|
111 | - 'empty_zero' => 0, |
|
112 | - 'hide_alter_empty' => 1, |
|
113 | - 'link_to_user' => 1, |
|
114 | - 'exclude' => 1, |
|
115 | - 'id' => 'uid', |
|
116 | - 'table' => 'users', |
|
117 | - 'field' => 'uid', |
|
118 | - 'relationship' => 'none', |
|
108 | + ), |
|
109 | + 'empty' => '', |
|
110 | + 'hide_empty' => 0, |
|
111 | + 'empty_zero' => 0, |
|
112 | + 'hide_alter_empty' => 1, |
|
113 | + 'link_to_user' => 1, |
|
114 | + 'exclude' => 1, |
|
115 | + 'id' => 'uid', |
|
116 | + 'table' => 'users', |
|
117 | + 'field' => 'uid', |
|
118 | + 'relationship' => 'none', |
|
119 | 119 | ), |
120 | 120 | 'name' => array( |
121 | - 'label' => 'Author', |
|
122 | - 'alter' => array( |
|
121 | + 'label' => 'Author', |
|
122 | + 'alter' => array( |
|
123 | 123 | 'alter_text' => 0, |
124 | 124 | 'text' => '', |
125 | 125 | 'make_link' => 1, |
@@ -138,81 +138,81 @@ discard block |
||
138 | 138 | 'ellipsis' => 1, |
139 | 139 | 'html' => 0, |
140 | 140 | 'strip_tags' => 0, |
141 | - ), |
|
142 | - 'empty' => '', |
|
143 | - 'hide_empty' => 0, |
|
144 | - 'empty_zero' => 0, |
|
145 | - 'hide_alter_empty' => 0, |
|
146 | - 'link_to_user' => 0, |
|
147 | - 'overwrite_anonymous' => 1, |
|
148 | - 'anonymous_text' => 'Anonymous', |
|
149 | - 'exclude' => 0, |
|
150 | - 'id' => 'name', |
|
151 | - 'table' => 'users', |
|
152 | - 'field' => 'name', |
|
153 | - 'relationship' => 'none', |
|
141 | + ), |
|
142 | + 'empty' => '', |
|
143 | + 'hide_empty' => 0, |
|
144 | + 'empty_zero' => 0, |
|
145 | + 'hide_alter_empty' => 0, |
|
146 | + 'link_to_user' => 0, |
|
147 | + 'overwrite_anonymous' => 1, |
|
148 | + 'anonymous_text' => 'Anonymous', |
|
149 | + 'exclude' => 0, |
|
150 | + 'id' => 'name', |
|
151 | + 'table' => 'users', |
|
152 | + 'field' => 'name', |
|
153 | + 'relationship' => 'none', |
|
154 | 154 | ), |
155 | - )); |
|
156 | - $handler->override_option('filters', array( |
|
155 | + )); |
|
156 | + $handler->override_option('filters', array( |
|
157 | 157 | 'moderate' => array( |
158 | - 'operator' => '=', |
|
159 | - 'value' => '1', |
|
160 | - 'group' => '0', |
|
161 | - 'exposed' => FALSE, |
|
162 | - 'expose' => array( |
|
158 | + 'operator' => '=', |
|
159 | + 'value' => '1', |
|
160 | + 'group' => '0', |
|
161 | + 'exposed' => FALSE, |
|
162 | + 'expose' => array( |
|
163 | 163 | 'operator' => FALSE, |
164 | 164 | 'label' => '', |
165 | - ), |
|
166 | - 'id' => 'moderate', |
|
167 | - 'table' => 'node', |
|
168 | - 'field' => 'moderate', |
|
169 | - 'relationship' => 'none', |
|
165 | + ), |
|
166 | + 'id' => 'moderate', |
|
167 | + 'table' => 'node', |
|
168 | + 'field' => 'moderate', |
|
169 | + 'relationship' => 'none', |
|
170 | 170 | ), |
171 | - )); |
|
172 | - $handler->override_option('access', array( |
|
171 | + )); |
|
172 | + $handler->override_option('access', array( |
|
173 | 173 | 'type' => 'role', |
174 | 174 | 'role' => array( |
175 | - 1271379760 => 1271379760, |
|
175 | + 1271379760 => 1271379760, |
|
176 | 176 | ), |
177 | - )); |
|
178 | - $handler->override_option('cache', array( |
|
177 | + )); |
|
178 | + $handler->override_option('cache', array( |
|
179 | 179 | 'type' => 'none', |
180 | - )); |
|
181 | - $handler->override_option('empty', bts('No content is in the queue for moderation.', array(), NULL, 'boinc:moderate-user-page')); |
|
182 | - $handler->override_option('empty_format', '4'); |
|
183 | - $handler->override_option('use_pager', '1'); |
|
184 | - $handler->override_option('style_plugin', 'table'); |
|
185 | - $handler->override_option('style_options', array( |
|
180 | + )); |
|
181 | + $handler->override_option('empty', bts('No content is in the queue for moderation.', array(), NULL, 'boinc:moderate-user-page')); |
|
182 | + $handler->override_option('empty_format', '4'); |
|
183 | + $handler->override_option('use_pager', '1'); |
|
184 | + $handler->override_option('style_plugin', 'table'); |
|
185 | + $handler->override_option('style_options', array( |
|
186 | 186 | 'grouping' => '', |
187 | 187 | 'override' => 1, |
188 | 188 | 'sticky' => 0, |
189 | 189 | 'order' => 'desc', |
190 | 190 | 'summary' => '', |
191 | 191 | 'columns' => array( |
192 | - 'view_node' => 'view_node', |
|
193 | - 'title' => 'title', |
|
194 | - 'changed' => 'changed', |
|
192 | + 'view_node' => 'view_node', |
|
193 | + 'title' => 'title', |
|
194 | + 'changed' => 'changed', |
|
195 | 195 | ), |
196 | 196 | 'info' => array( |
197 | - 'view_node' => array( |
|
197 | + 'view_node' => array( |
|
198 | 198 | 'separator' => '', |
199 | - ), |
|
200 | - 'title' => array( |
|
199 | + ), |
|
200 | + 'title' => array( |
|
201 | 201 | 'sortable' => 0, |
202 | 202 | 'separator' => '', |
203 | - ), |
|
204 | - 'changed' => array( |
|
203 | + ), |
|
204 | + 'changed' => array( |
|
205 | 205 | 'sortable' => 0, |
206 | 206 | 'separator' => '', |
207 | - ), |
|
207 | + ), |
|
208 | 208 | ), |
209 | 209 | 'default' => 'changed', |
210 | - )); |
|
211 | - $handler = $view->new_display('page', 'User profiles', 'page_1'); |
|
212 | - $handler->override_option('fields', array( |
|
210 | + )); |
|
211 | + $handler = $view->new_display('page', 'User profiles', 'page_1'); |
|
212 | + $handler->override_option('fields', array( |
|
213 | 213 | 'uid' => array( |
214 | - 'label' => 'Uid', |
|
215 | - 'alter' => array( |
|
214 | + 'label' => 'Uid', |
|
215 | + 'alter' => array( |
|
216 | 216 | 'alter_text' => 0, |
217 | 217 | 'text' => '', |
218 | 218 | 'make_link' => 0, |
@@ -231,24 +231,24 @@ discard block |
||
231 | 231 | 'ellipsis' => 1, |
232 | 232 | 'html' => 0, |
233 | 233 | 'strip_tags' => 0, |
234 | - ), |
|
235 | - 'empty' => '', |
|
236 | - 'hide_empty' => 0, |
|
237 | - 'empty_zero' => 0, |
|
238 | - 'hide_alter_empty' => 1, |
|
239 | - 'link_to_user' => 1, |
|
240 | - 'exclude' => 1, |
|
241 | - 'id' => 'uid', |
|
242 | - 'table' => 'users', |
|
243 | - 'field' => 'uid', |
|
244 | - 'override' => array( |
|
234 | + ), |
|
235 | + 'empty' => '', |
|
236 | + 'hide_empty' => 0, |
|
237 | + 'empty_zero' => 0, |
|
238 | + 'hide_alter_empty' => 1, |
|
239 | + 'link_to_user' => 1, |
|
240 | + 'exclude' => 1, |
|
241 | + 'id' => 'uid', |
|
242 | + 'table' => 'users', |
|
243 | + 'field' => 'uid', |
|
244 | + 'override' => array( |
|
245 | 245 | 'button' => 'Use default', |
246 | - ), |
|
247 | - 'relationship' => 'none', |
|
246 | + ), |
|
247 | + 'relationship' => 'none', |
|
248 | 248 | ), |
249 | 249 | 'name' => array( |
250 | - 'label' => 'User', |
|
251 | - 'alter' => array( |
|
250 | + 'label' => 'User', |
|
251 | + 'alter' => array( |
|
252 | 252 | 'alter_text' => 0, |
253 | 253 | 'text' => '', |
254 | 254 | 'make_link' => 1, |
@@ -267,26 +267,26 @@ discard block |
||
267 | 267 | 'ellipsis' => 1, |
268 | 268 | 'html' => 0, |
269 | 269 | 'strip_tags' => 0, |
270 | - ), |
|
271 | - 'empty' => '', |
|
272 | - 'hide_empty' => 0, |
|
273 | - 'empty_zero' => 0, |
|
274 | - 'hide_alter_empty' => 1, |
|
275 | - 'link_to_user' => 1, |
|
276 | - 'overwrite_anonymous' => 0, |
|
277 | - 'anonymous_text' => '', |
|
278 | - 'exclude' => 0, |
|
279 | - 'id' => 'name', |
|
280 | - 'table' => 'users', |
|
281 | - 'field' => 'name', |
|
282 | - 'override' => array( |
|
270 | + ), |
|
271 | + 'empty' => '', |
|
272 | + 'hide_empty' => 0, |
|
273 | + 'empty_zero' => 0, |
|
274 | + 'hide_alter_empty' => 1, |
|
275 | + 'link_to_user' => 1, |
|
276 | + 'overwrite_anonymous' => 0, |
|
277 | + 'anonymous_text' => '', |
|
278 | + 'exclude' => 0, |
|
279 | + 'id' => 'name', |
|
280 | + 'table' => 'users', |
|
281 | + 'field' => 'name', |
|
282 | + 'override' => array( |
|
283 | 283 | 'button' => 'Use default', |
284 | - ), |
|
285 | - 'relationship' => 'none', |
|
284 | + ), |
|
285 | + 'relationship' => 'none', |
|
286 | 286 | ), |
287 | 287 | 'changed' => array( |
288 | - 'label' => 'Updated date', |
|
289 | - 'alter' => array( |
|
288 | + 'label' => 'Updated date', |
|
289 | + 'alter' => array( |
|
290 | 290 | 'alter_text' => 0, |
291 | 291 | 'text' => '', |
292 | 292 | 'make_link' => 0, |
@@ -305,22 +305,22 @@ discard block |
||
305 | 305 | 'ellipsis' => 1, |
306 | 306 | 'html' => 0, |
307 | 307 | 'strip_tags' => 0, |
308 | - ), |
|
309 | - 'empty' => '', |
|
310 | - 'hide_empty' => 0, |
|
311 | - 'empty_zero' => 0, |
|
312 | - 'hide_alter_empty' => 1, |
|
313 | - 'date_format' => 'time ago', |
|
314 | - 'custom_date_format' => '', |
|
315 | - 'exclude' => 0, |
|
316 | - 'id' => 'changed', |
|
317 | - 'table' => 'node', |
|
318 | - 'field' => 'changed', |
|
319 | - 'relationship' => 'none', |
|
308 | + ), |
|
309 | + 'empty' => '', |
|
310 | + 'hide_empty' => 0, |
|
311 | + 'empty_zero' => 0, |
|
312 | + 'hide_alter_empty' => 1, |
|
313 | + 'date_format' => 'time ago', |
|
314 | + 'custom_date_format' => '', |
|
315 | + 'exclude' => 0, |
|
316 | + 'id' => 'changed', |
|
317 | + 'table' => 'node', |
|
318 | + 'field' => 'changed', |
|
319 | + 'relationship' => 'none', |
|
320 | 320 | ), |
321 | 321 | 'phpcode' => array( |
322 | - 'label' => 'Edit Profile', |
|
323 | - 'alter' => array( |
|
322 | + 'label' => 'Edit Profile', |
|
323 | + 'alter' => array( |
|
324 | 324 | 'alter_text' => 0, |
325 | 325 | 'text' => '', |
326 | 326 | 'make_link' => 0, |
@@ -339,108 +339,108 @@ discard block |
||
339 | 339 | 'ellipsis' => 1, |
340 | 340 | 'html' => 0, |
341 | 341 | 'strip_tags' => 0, |
342 | - ), |
|
343 | - 'empty' => '', |
|
344 | - 'hide_empty' => 0, |
|
345 | - 'empty_zero' => 0, |
|
346 | - 'hide_alter_empty' => 1, |
|
347 | - 'value' => '<?php |
|
342 | + ), |
|
343 | + 'empty' => '', |
|
344 | + 'hide_empty' => 0, |
|
345 | + 'empty_zero' => 0, |
|
346 | + 'hide_alter_empty' => 1, |
|
347 | + 'value' => '<?php |
|
348 | 348 | $uid = $data->users_uid; |
349 | 349 | return l( |
350 | 350 | bts(\'edit\', array(), NULL, \'boinc:edit-profile\'), |
351 | 351 | "/moderate/profile/$uid/edit"); |
352 | 352 | ?>', |
353 | - 'exclude' => 0, |
|
354 | - 'id' => 'phpcode', |
|
355 | - 'table' => 'customfield', |
|
356 | - 'field' => 'phpcode', |
|
357 | - 'override' => array( |
|
353 | + 'exclude' => 0, |
|
354 | + 'id' => 'phpcode', |
|
355 | + 'table' => 'customfield', |
|
356 | + 'field' => 'phpcode', |
|
357 | + 'override' => array( |
|
358 | 358 | 'button' => 'Use default', |
359 | - ), |
|
360 | - 'relationship' => 'none', |
|
359 | + ), |
|
360 | + 'relationship' => 'none', |
|
361 | 361 | ), |
362 | - )); |
|
363 | - $handler->override_option('filters', array( |
|
362 | + )); |
|
363 | + $handler->override_option('filters', array( |
|
364 | 364 | 'moderate' => array( |
365 | - 'operator' => '=', |
|
366 | - 'value' => '1', |
|
367 | - 'group' => '0', |
|
368 | - 'exposed' => FALSE, |
|
369 | - 'expose' => array( |
|
365 | + 'operator' => '=', |
|
366 | + 'value' => '1', |
|
367 | + 'group' => '0', |
|
368 | + 'exposed' => FALSE, |
|
369 | + 'expose' => array( |
|
370 | 370 | 'operator' => FALSE, |
371 | 371 | 'label' => '', |
372 | - ), |
|
373 | - 'id' => 'moderate', |
|
374 | - 'table' => 'node', |
|
375 | - 'field' => 'moderate', |
|
376 | - 'override' => array( |
|
372 | + ), |
|
373 | + 'id' => 'moderate', |
|
374 | + 'table' => 'node', |
|
375 | + 'field' => 'moderate', |
|
376 | + 'override' => array( |
|
377 | 377 | 'button' => 'Use default', |
378 | - ), |
|
379 | - 'relationship' => 'none', |
|
378 | + ), |
|
379 | + 'relationship' => 'none', |
|
380 | 380 | ), |
381 | 381 | 'type' => array( |
382 | - 'operator' => 'in', |
|
383 | - 'value' => array( |
|
382 | + 'operator' => 'in', |
|
383 | + 'value' => array( |
|
384 | 384 | 'profile' => 'profile', |
385 | - ), |
|
386 | - 'group' => '0', |
|
387 | - 'exposed' => FALSE, |
|
388 | - 'expose' => array( |
|
385 | + ), |
|
386 | + 'group' => '0', |
|
387 | + 'exposed' => FALSE, |
|
388 | + 'expose' => array( |
|
389 | 389 | 'operator' => FALSE, |
390 | 390 | 'label' => '', |
391 | - ), |
|
392 | - 'id' => 'type', |
|
393 | - 'table' => 'node', |
|
394 | - 'field' => 'type', |
|
395 | - 'override' => array( |
|
391 | + ), |
|
392 | + 'id' => 'type', |
|
393 | + 'table' => 'node', |
|
394 | + 'field' => 'type', |
|
395 | + 'override' => array( |
|
396 | 396 | 'button' => 'Use default', |
397 | - ), |
|
398 | - 'relationship' => 'none', |
|
397 | + ), |
|
398 | + 'relationship' => 'none', |
|
399 | 399 | ), |
400 | - )); |
|
401 | - $handler->override_option('title', bts('User profile moderation queue', array(), NULL, 'boinc:moderate-user-page')); |
|
402 | - $handler->override_option('path', 'moderate/profiles'); |
|
403 | - $handler->override_option('menu', array( |
|
400 | + )); |
|
401 | + $handler->override_option('title', bts('User profile moderation queue', array(), NULL, 'boinc:moderate-user-page')); |
|
402 | + $handler->override_option('path', 'moderate/profiles'); |
|
403 | + $handler->override_option('menu', array( |
|
404 | 404 | 'type' => 'default tab', |
405 | 405 | 'title' => 'Queue', |
406 | 406 | 'description' => '', |
407 | 407 | 'weight' => '-50', |
408 | 408 | 'name' => 'primary-links', |
409 | - )); |
|
410 | - $handler->override_option('tab_options', array( |
|
409 | + )); |
|
410 | + $handler->override_option('tab_options', array( |
|
411 | 411 | 'type' => 'normal', |
412 | 412 | 'title' => 'Moderation', |
413 | 413 | 'description' => '', |
414 | 414 | 'weight' => '0', |
415 | 415 | 'name' => 'primary-links', |
416 | - )); |
|
416 | + )); |
|
417 | 417 | |
418 | - $views[$view->name] = $view; |
|
418 | + $views[$view->name] = $view; |
|
419 | 419 | |
420 | - // Exported view: user_activity |
|
421 | - $view = new view; |
|
422 | - $view->name = 'user_activity'; |
|
423 | - $view->description = 'A feed of a user\'s activity on the site'; |
|
424 | - $view->tag = ''; |
|
425 | - $view->base_table = 'node_revisions'; |
|
426 | - $view->core = 6; |
|
427 | - $view->api_version = '2'; |
|
428 | - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
429 | - $handler = $view->new_display('default', 'Defaults', 'default'); |
|
430 | - $handler->override_option('relationships', array( |
|
420 | + // Exported view: user_activity |
|
421 | + $view = new view; |
|
422 | + $view->name = 'user_activity'; |
|
423 | + $view->description = 'A feed of a user\'s activity on the site'; |
|
424 | + $view->tag = ''; |
|
425 | + $view->base_table = 'node_revisions'; |
|
426 | + $view->core = 6; |
|
427 | + $view->api_version = '2'; |
|
428 | + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
429 | + $handler = $view->new_display('default', 'Defaults', 'default'); |
|
430 | + $handler->override_option('relationships', array( |
|
431 | 431 | 'uid' => array( |
432 | - 'label' => 'user', |
|
433 | - 'required' => 1, |
|
434 | - 'id' => 'uid', |
|
435 | - 'table' => 'node_revisions', |
|
436 | - 'field' => 'uid', |
|
437 | - 'relationship' => 'none', |
|
432 | + 'label' => 'user', |
|
433 | + 'required' => 1, |
|
434 | + 'id' => 'uid', |
|
435 | + 'table' => 'node_revisions', |
|
436 | + 'field' => 'uid', |
|
437 | + 'relationship' => 'none', |
|
438 | 438 | ), |
439 | - )); |
|
440 | - $handler->override_option('fields', array( |
|
439 | + )); |
|
440 | + $handler->override_option('fields', array( |
|
441 | 441 | 'nid' => array( |
442 | - 'label' => 'Nid', |
|
443 | - 'alter' => array( |
|
442 | + 'label' => 'Nid', |
|
443 | + 'alter' => array( |
|
444 | 444 | 'alter_text' => 0, |
445 | 445 | 'text' => '', |
446 | 446 | 'make_link' => 0, |
@@ -459,21 +459,21 @@ discard block |
||
459 | 459 | 'ellipsis' => 1, |
460 | 460 | 'html' => 0, |
461 | 461 | 'strip_tags' => 0, |
462 | - ), |
|
463 | - 'empty' => '', |
|
464 | - 'hide_empty' => 0, |
|
465 | - 'empty_zero' => 0, |
|
466 | - 'hide_alter_empty' => 1, |
|
467 | - 'link_to_node' => 0, |
|
468 | - 'exclude' => 1, |
|
469 | - 'id' => 'nid', |
|
470 | - 'table' => 'node', |
|
471 | - 'field' => 'nid', |
|
472 | - 'relationship' => 'none', |
|
462 | + ), |
|
463 | + 'empty' => '', |
|
464 | + 'hide_empty' => 0, |
|
465 | + 'empty_zero' => 0, |
|
466 | + 'hide_alter_empty' => 1, |
|
467 | + 'link_to_node' => 0, |
|
468 | + 'exclude' => 1, |
|
469 | + 'id' => 'nid', |
|
470 | + 'table' => 'node', |
|
471 | + 'field' => 'nid', |
|
472 | + 'relationship' => 'none', |
|
473 | 473 | ), |
474 | 474 | 'title' => array( |
475 | - 'label' => 'Title', |
|
476 | - 'alter' => array( |
|
475 | + 'label' => 'Title', |
|
476 | + 'alter' => array( |
|
477 | 477 | 'alter_text' => 0, |
478 | 478 | 'text' => '', |
479 | 479 | 'make_link' => 0, |
@@ -492,21 +492,21 @@ discard block |
||
492 | 492 | 'ellipsis' => 1, |
493 | 493 | 'html' => 0, |
494 | 494 | 'strip_tags' => 0, |
495 | - ), |
|
496 | - 'empty' => '', |
|
497 | - 'hide_empty' => 0, |
|
498 | - 'empty_zero' => 0, |
|
499 | - 'hide_alter_empty' => 1, |
|
500 | - 'link_to_node' => 0, |
|
501 | - 'exclude' => 1, |
|
502 | - 'id' => 'title', |
|
503 | - 'table' => 'node', |
|
504 | - 'field' => 'title', |
|
505 | - 'relationship' => 'none', |
|
495 | + ), |
|
496 | + 'empty' => '', |
|
497 | + 'hide_empty' => 0, |
|
498 | + 'empty_zero' => 0, |
|
499 | + 'hide_alter_empty' => 1, |
|
500 | + 'link_to_node' => 0, |
|
501 | + 'exclude' => 1, |
|
502 | + 'id' => 'title', |
|
503 | + 'table' => 'node', |
|
504 | + 'field' => 'title', |
|
505 | + 'relationship' => 'none', |
|
506 | 506 | ), |
507 | 507 | 'type' => array( |
508 | - 'label' => 'Type', |
|
509 | - 'alter' => array( |
|
508 | + 'label' => 'Type', |
|
509 | + 'alter' => array( |
|
510 | 510 | 'alter_text' => 0, |
511 | 511 | 'text' => '', |
512 | 512 | 'make_link' => 0, |
@@ -525,22 +525,22 @@ discard block |
||
525 | 525 | 'ellipsis' => 1, |
526 | 526 | 'html' => 0, |
527 | 527 | 'strip_tags' => 0, |
528 | - ), |
|
529 | - 'empty' => '', |
|
530 | - 'hide_empty' => 0, |
|
531 | - 'empty_zero' => 0, |
|
532 | - 'hide_alter_empty' => 1, |
|
533 | - 'link_to_node' => 0, |
|
534 | - 'machine_name' => 0, |
|
535 | - 'exclude' => 1, |
|
536 | - 'id' => 'type', |
|
537 | - 'table' => 'node', |
|
538 | - 'field' => 'type', |
|
539 | - 'relationship' => 'none', |
|
528 | + ), |
|
529 | + 'empty' => '', |
|
530 | + 'hide_empty' => 0, |
|
531 | + 'empty_zero' => 0, |
|
532 | + 'hide_alter_empty' => 1, |
|
533 | + 'link_to_node' => 0, |
|
534 | + 'machine_name' => 0, |
|
535 | + 'exclude' => 1, |
|
536 | + 'id' => 'type', |
|
537 | + 'table' => 'node', |
|
538 | + 'field' => 'type', |
|
539 | + 'relationship' => 'none', |
|
540 | 540 | ), |
541 | 541 | 'uid' => array( |
542 | - 'label' => 'Uid', |
|
543 | - 'alter' => array( |
|
542 | + 'label' => 'Uid', |
|
543 | + 'alter' => array( |
|
544 | 544 | 'alter_text' => 0, |
545 | 545 | 'text' => '', |
546 | 546 | 'make_link' => 0, |
@@ -559,21 +559,21 @@ discard block |
||
559 | 559 | 'ellipsis' => 1, |
560 | 560 | 'html' => 0, |
561 | 561 | 'strip_tags' => 0, |
562 | - ), |
|
563 | - 'empty' => '', |
|
564 | - 'hide_empty' => 0, |
|
565 | - 'empty_zero' => 0, |
|
566 | - 'hide_alter_empty' => 1, |
|
567 | - 'link_to_user' => 0, |
|
568 | - 'exclude' => 1, |
|
569 | - 'id' => 'uid', |
|
570 | - 'table' => 'users', |
|
571 | - 'field' => 'uid', |
|
572 | - 'relationship' => 'uid', |
|
562 | + ), |
|
563 | + 'empty' => '', |
|
564 | + 'hide_empty' => 0, |
|
565 | + 'empty_zero' => 0, |
|
566 | + 'hide_alter_empty' => 1, |
|
567 | + 'link_to_user' => 0, |
|
568 | + 'exclude' => 1, |
|
569 | + 'id' => 'uid', |
|
570 | + 'table' => 'users', |
|
571 | + 'field' => 'uid', |
|
572 | + 'relationship' => 'uid', |
|
573 | 573 | ), |
574 | 574 | 'nothing' => array( |
575 | - 'label' => '', |
|
576 | - 'alter' => array( |
|
575 | + 'label' => '', |
|
576 | + 'alter' => array( |
|
577 | 577 | 'text' => '<div class="gray-divider"></div>', |
578 | 578 | 'make_link' => 0, |
579 | 579 | 'path' => '', |
@@ -591,20 +591,20 @@ discard block |
||
591 | 591 | 'ellipsis' => 1, |
592 | 592 | 'html' => 0, |
593 | 593 | 'strip_tags' => 0, |
594 | - ), |
|
595 | - 'empty' => '', |
|
596 | - 'hide_empty' => 0, |
|
597 | - 'empty_zero' => 0, |
|
598 | - 'hide_alter_empty' => 1, |
|
599 | - 'exclude' => 0, |
|
600 | - 'id' => 'nothing', |
|
601 | - 'table' => 'views', |
|
602 | - 'field' => 'nothing', |
|
603 | - 'relationship' => 'none', |
|
594 | + ), |
|
595 | + 'empty' => '', |
|
596 | + 'hide_empty' => 0, |
|
597 | + 'empty_zero' => 0, |
|
598 | + 'hide_alter_empty' => 1, |
|
599 | + 'exclude' => 0, |
|
600 | + 'id' => 'nothing', |
|
601 | + 'table' => 'views', |
|
602 | + 'field' => 'nothing', |
|
603 | + 'relationship' => 'none', |
|
604 | 604 | ), |
605 | 605 | 'phpcode_1' => array( |
606 | - 'label' => '', |
|
607 | - 'alter' => array( |
|
606 | + 'label' => '', |
|
607 | + 'alter' => array( |
|
608 | 608 | 'alter_text' => 0, |
609 | 609 | 'text' => '', |
610 | 610 | 'make_link' => 0, |
@@ -623,12 +623,12 @@ discard block |
||
623 | 623 | 'ellipsis' => 1, |
624 | 624 | 'html' => 0, |
625 | 625 | 'strip_tags' => 0, |
626 | - ), |
|
627 | - 'empty' => '', |
|
628 | - 'hide_empty' => 0, |
|
629 | - 'empty_zero' => 0, |
|
630 | - 'hide_alter_empty' => 1, |
|
631 | - 'value' => '<?php |
|
626 | + ), |
|
627 | + 'empty' => '', |
|
628 | + 'hide_empty' => 0, |
|
629 | + 'empty_zero' => 0, |
|
630 | + 'hide_alter_empty' => 1, |
|
631 | + 'value' => '<?php |
|
632 | 632 | |
633 | 633 | switch($data->node_type) { |
634 | 634 | case \'forum\': |
@@ -657,18 +657,18 @@ discard block |
||
657 | 657 | $account = user_load($uid); |
658 | 658 | echo l($account->boincuser_name, "account/{$uid}") . " {$action} " . l($data->node_title, $url, array(\'fragment\' => $fragment)); |
659 | 659 | ?>', |
660 | - 'exclude' => 0, |
|
661 | - 'id' => 'phpcode_1', |
|
662 | - 'table' => 'customfield', |
|
663 | - 'field' => 'phpcode', |
|
664 | - 'relationship' => 'none', |
|
665 | - 'override' => array( |
|
660 | + 'exclude' => 0, |
|
661 | + 'id' => 'phpcode_1', |
|
662 | + 'table' => 'customfield', |
|
663 | + 'field' => 'phpcode', |
|
664 | + 'relationship' => 'none', |
|
665 | + 'override' => array( |
|
666 | 666 | 'button' => 'Override', |
667 | - ), |
|
667 | + ), |
|
668 | 668 | ), |
669 | 669 | 'body' => array( |
670 | - 'label' => '', |
|
671 | - 'alter' => array( |
|
670 | + 'label' => '', |
|
671 | + 'alter' => array( |
|
672 | 672 | 'alter_text' => 0, |
673 | 673 | 'text' => '', |
674 | 674 | 'make_link' => 0, |
@@ -687,20 +687,20 @@ discard block |
||
687 | 687 | 'ellipsis' => 1, |
688 | 688 | 'html' => 0, |
689 | 689 | 'strip_tags' => 1, |
690 | - ), |
|
691 | - 'empty' => '', |
|
692 | - 'hide_empty' => 0, |
|
693 | - 'empty_zero' => 0, |
|
694 | - 'hide_alter_empty' => 1, |
|
695 | - 'exclude' => 0, |
|
696 | - 'id' => 'body', |
|
697 | - 'table' => 'node_revisions', |
|
698 | - 'field' => 'body', |
|
699 | - 'relationship' => 'none', |
|
690 | + ), |
|
691 | + 'empty' => '', |
|
692 | + 'hide_empty' => 0, |
|
693 | + 'empty_zero' => 0, |
|
694 | + 'hide_alter_empty' => 1, |
|
695 | + 'exclude' => 0, |
|
696 | + 'id' => 'body', |
|
697 | + 'table' => 'node_revisions', |
|
698 | + 'field' => 'body', |
|
699 | + 'relationship' => 'none', |
|
700 | 700 | ), |
701 | 701 | 'timestamp' => array( |
702 | - 'label' => '', |
|
703 | - 'alter' => array( |
|
702 | + 'label' => '', |
|
703 | + 'alter' => array( |
|
704 | 704 | 'alter_text' => 0, |
705 | 705 | 'text' => '', |
706 | 706 | 'make_link' => 0, |
@@ -719,40 +719,40 @@ discard block |
||
719 | 719 | 'ellipsis' => 1, |
720 | 720 | 'html' => 0, |
721 | 721 | 'strip_tags' => 0, |
722 | - ), |
|
723 | - 'empty' => '', |
|
724 | - 'hide_empty' => 0, |
|
725 | - 'empty_zero' => 0, |
|
726 | - 'hide_alter_empty' => 1, |
|
727 | - 'date_format' => 'custom', |
|
728 | - 'custom_date_format' => 'jS F Y', |
|
729 | - 'exclude' => 0, |
|
730 | - 'id' => 'timestamp', |
|
731 | - 'table' => 'node_revisions', |
|
732 | - 'field' => 'timestamp', |
|
733 | - 'relationship' => 'none', |
|
722 | + ), |
|
723 | + 'empty' => '', |
|
724 | + 'hide_empty' => 0, |
|
725 | + 'empty_zero' => 0, |
|
726 | + 'hide_alter_empty' => 1, |
|
727 | + 'date_format' => 'custom', |
|
728 | + 'custom_date_format' => 'jS F Y', |
|
729 | + 'exclude' => 0, |
|
730 | + 'id' => 'timestamp', |
|
731 | + 'table' => 'node_revisions', |
|
732 | + 'field' => 'timestamp', |
|
733 | + 'relationship' => 'none', |
|
734 | 734 | ), |
735 | - )); |
|
736 | - $handler->override_option('arguments', array( |
|
735 | + )); |
|
736 | + $handler->override_option('arguments', array( |
|
737 | 737 | 'uid' => array( |
738 | - 'default_action' => 'default', |
|
739 | - 'style_plugin' => 'default_summary', |
|
740 | - 'style_options' => array(), |
|
741 | - 'wildcard' => 'all', |
|
742 | - 'wildcard_substitution' => 'All', |
|
743 | - 'title' => '', |
|
744 | - 'breadcrumb' => '', |
|
745 | - 'default_argument_type' => 'user', |
|
746 | - 'default_argument' => '', |
|
747 | - 'validate_type' => 'user', |
|
748 | - 'validate_fail' => 'empty', |
|
749 | - 'break_phrase' => 0, |
|
750 | - 'not' => 0, |
|
751 | - 'id' => 'uid', |
|
752 | - 'table' => 'users', |
|
753 | - 'field' => 'uid', |
|
754 | - 'validate_user_argument_type' => 'uid', |
|
755 | - 'validate_user_roles' => array( |
|
738 | + 'default_action' => 'default', |
|
739 | + 'style_plugin' => 'default_summary', |
|
740 | + 'style_options' => array(), |
|
741 | + 'wildcard' => 'all', |
|
742 | + 'wildcard_substitution' => 'All', |
|
743 | + 'title' => '', |
|
744 | + 'breadcrumb' => '', |
|
745 | + 'default_argument_type' => 'user', |
|
746 | + 'default_argument' => '', |
|
747 | + 'validate_type' => 'user', |
|
748 | + 'validate_fail' => 'empty', |
|
749 | + 'break_phrase' => 0, |
|
750 | + 'not' => 0, |
|
751 | + 'id' => 'uid', |
|
752 | + 'table' => 'users', |
|
753 | + 'field' => 'uid', |
|
754 | + 'validate_user_argument_type' => 'uid', |
|
755 | + 'validate_user_roles' => array( |
|
756 | 756 | 2 => 0, |
757 | 757 | 3519698132 => 0, |
758 | 758 | 1110965548 => 0, |
@@ -761,20 +761,20 @@ discard block |
||
761 | 761 | 268174006 => 0, |
762 | 762 | 1271379760 => 0, |
763 | 763 | 933038561 => 0, |
764 | - ), |
|
765 | - 'relationship' => 'uid', |
|
766 | - 'default_options_div_prefix' => '', |
|
767 | - 'default_taxonomy_tid_term_page' => 0, |
|
768 | - 'default_taxonomy_tid_node' => 0, |
|
769 | - 'default_taxonomy_tid_limit' => 0, |
|
770 | - 'default_taxonomy_tid_vids' => array( |
|
764 | + ), |
|
765 | + 'relationship' => 'uid', |
|
766 | + 'default_options_div_prefix' => '', |
|
767 | + 'default_taxonomy_tid_term_page' => 0, |
|
768 | + 'default_taxonomy_tid_node' => 0, |
|
769 | + 'default_taxonomy_tid_limit' => 0, |
|
770 | + 'default_taxonomy_tid_vids' => array( |
|
771 | 771 | 1 => 0, |
772 | 772 | 2 => 0, |
773 | - ), |
|
774 | - 'default_argument_user' => 0, |
|
775 | - 'default_argument_fixed' => '', |
|
776 | - 'default_argument_php' => '', |
|
777 | - 'validate_argument_node_type' => array( |
|
773 | + ), |
|
774 | + 'default_argument_user' => 0, |
|
775 | + 'default_argument_fixed' => '', |
|
776 | + 'default_argument_php' => '', |
|
777 | + 'validate_argument_node_type' => array( |
|
778 | 778 | 'page' => 0, |
779 | 779 | 'news' => 0, |
780 | 780 | 'team' => 0, |
@@ -783,20 +783,20 @@ discard block |
||
783 | 783 | 'forum' => 0, |
784 | 784 | 'panel' => 0, |
785 | 785 | 'story' => 0, |
786 | - ), |
|
787 | - 'validate_argument_node_access' => 0, |
|
788 | - 'validate_argument_nid_type' => 'nid', |
|
789 | - 'validate_argument_vocabulary' => array( |
|
786 | + ), |
|
787 | + 'validate_argument_node_access' => 0, |
|
788 | + 'validate_argument_nid_type' => 'nid', |
|
789 | + 'validate_argument_vocabulary' => array( |
|
790 | 790 | 1 => 0, |
791 | 791 | 2 => 0, |
792 | - ), |
|
793 | - 'validate_argument_type' => 'tid', |
|
794 | - 'validate_argument_transform' => 0, |
|
795 | - 'validate_user_restrict_roles' => 0, |
|
796 | - 'validate_argument_php' => '', |
|
797 | - 'me_redirect' => 0, |
|
798 | - 'me_validate_user_argument_type' => 'uid', |
|
799 | - 'me_validate_user_roles' => array( |
|
792 | + ), |
|
793 | + 'validate_argument_type' => 'tid', |
|
794 | + 'validate_argument_transform' => 0, |
|
795 | + 'validate_user_restrict_roles' => 0, |
|
796 | + 'validate_argument_php' => '', |
|
797 | + 'me_redirect' => 0, |
|
798 | + 'me_validate_user_argument_type' => 'uid', |
|
799 | + 'me_validate_user_roles' => array( |
|
800 | 800 | 2 => 0, |
801 | 801 | 3519698132 => 0, |
802 | 802 | 1110965548 => 0, |
@@ -805,67 +805,67 @@ discard block |
||
805 | 805 | 268174006 => 0, |
806 | 806 | 1271379760 => 0, |
807 | 807 | 933038561 => 0, |
808 | - ), |
|
809 | - 'validate_argument_node_flag_name' => '*relationship*', |
|
810 | - 'validate_argument_node_flag_test' => 'flaggable', |
|
811 | - 'validate_argument_node_flag_id_type' => 'id', |
|
812 | - 'validate_argument_user_flag_name' => '*relationship*', |
|
813 | - 'validate_argument_user_flag_test' => 'flaggable', |
|
814 | - 'validate_argument_user_flag_id_type' => 'id', |
|
815 | - 'me_validate_user_restrict_roles' => 0, |
|
808 | + ), |
|
809 | + 'validate_argument_node_flag_name' => '*relationship*', |
|
810 | + 'validate_argument_node_flag_test' => 'flaggable', |
|
811 | + 'validate_argument_node_flag_id_type' => 'id', |
|
812 | + 'validate_argument_user_flag_name' => '*relationship*', |
|
813 | + 'validate_argument_user_flag_test' => 'flaggable', |
|
814 | + 'validate_argument_user_flag_id_type' => 'id', |
|
815 | + 'me_validate_user_restrict_roles' => 0, |
|
816 | 816 | ), |
817 | - )); |
|
818 | - $handler->override_option('access', array( |
|
817 | + )); |
|
818 | + $handler->override_option('access', array( |
|
819 | 819 | 'type' => 'none', |
820 | - )); |
|
821 | - $handler->override_option('cache', array( |
|
820 | + )); |
|
821 | + $handler->override_option('cache', array( |
|
822 | 822 | 'type' => 'none', |
823 | - )); |
|
824 | - $handler->override_option('items_per_page', 5); |
|
825 | - $handler->override_option('use_pager', '1'); |
|
826 | - $handler->override_option('row_options', array( |
|
823 | + )); |
|
824 | + $handler->override_option('items_per_page', 5); |
|
825 | + $handler->override_option('use_pager', '1'); |
|
826 | + $handler->override_option('row_options', array( |
|
827 | 827 | 'inline' => array( |
828 | - 'value' => 'value', |
|
829 | - 'phpcode_1' => 'phpcode_1', |
|
828 | + 'value' => 'value', |
|
829 | + 'phpcode_1' => 'phpcode_1', |
|
830 | 830 | ), |
831 | 831 | 'separator' => ' ', |
832 | 832 | 'hide_empty' => 0, |
833 | - )); |
|
834 | - $handler = $view->new_display('block', 'Block', 'block_1'); |
|
835 | - $handler->override_option('block_description', ''); |
|
836 | - $handler->override_option('block_caching', -1); |
|
837 | - $handler = $view->new_display('page', 'Page', 'page_1'); |
|
838 | - $handler->override_option('title', 'Recent posts'); |
|
839 | - $handler->override_option('style_plugin', 'grid'); |
|
840 | - $handler->override_option('style_options', array( |
|
833 | + )); |
|
834 | + $handler = $view->new_display('block', 'Block', 'block_1'); |
|
835 | + $handler->override_option('block_description', ''); |
|
836 | + $handler->override_option('block_caching', -1); |
|
837 | + $handler = $view->new_display('page', 'Page', 'page_1'); |
|
838 | + $handler->override_option('title', 'Recent posts'); |
|
839 | + $handler->override_option('style_plugin', 'grid'); |
|
840 | + $handler->override_option('style_options', array( |
|
841 | 841 | 'grouping' => '', |
842 | 842 | 'columns' => '1', |
843 | 843 | 'alignment' => 'vertical', |
844 | 844 | 'fill_single_line' => 1, |
845 | 845 | 'summary' => '', |
846 | - )); |
|
847 | - $handler->override_option('row_options', array( |
|
846 | + )); |
|
847 | + $handler->override_option('row_options', array( |
|
848 | 848 | 'inline' => array(), |
849 | 849 | 'separator' => '', |
850 | 850 | 'hide_empty' => 0, |
851 | - )); |
|
852 | - $handler->override_option('path', 'account/%/posts'); |
|
853 | - $handler->override_option('menu', array( |
|
851 | + )); |
|
852 | + $handler->override_option('path', 'account/%/posts'); |
|
853 | + $handler->override_option('menu', array( |
|
854 | 854 | 'type' => 'none', |
855 | 855 | 'title' => '', |
856 | 856 | 'description' => '', |
857 | 857 | 'weight' => '0', |
858 | 858 | 'name' => 'primary-links', |
859 | - )); |
|
860 | - $handler->override_option('tab_options', array( |
|
859 | + )); |
|
860 | + $handler->override_option('tab_options', array( |
|
861 | 861 | 'type' => 'none', |
862 | 862 | 'title' => '', |
863 | 863 | 'description' => '', |
864 | 864 | 'weight' => 0, |
865 | 865 | 'name' => 'navigation', |
866 | - )); |
|
866 | + )); |
|
867 | 867 | |
868 | - $views[$view->name] = $view; |
|
868 | + $views[$view->name] = $view; |
|
869 | 869 | |
870 | - return $views; |
|
870 | + return $views; |
|
871 | 871 | } |