@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | */ |
| 6 | 6 | function boinc_standard_default_page_manager_pages() { |
| 7 | 7 | $page = new stdClass; |
| 8 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 8 | + $page->disabled = false; /* Edit this to true to make a default page disabled initially */ |
|
| 9 | 9 | $page->api_version = 1; |
| 10 | 10 | $page->name = 'about_us'; |
| 11 | 11 | $page->task = 'page'; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $page->path = 'about.fail'; |
| 15 | 15 | $page->access = array( |
| 16 | 16 | 'type' => 'none', |
| 17 | - 'settings' => NULL, |
|
| 17 | + 'settings' => null, |
|
| 18 | 18 | ); |
| 19 | 19 | $page->menu = array(); |
| 20 | 20 | $page->arguments = array(); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $pages['about_us'] = $page; |
| 24 | 24 | |
| 25 | 25 | $page = new stdClass; |
| 26 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 26 | + $page->disabled = false; /* Edit this to true to make a default page disabled initially */ |
|
| 27 | 27 | $page->api_version = 1; |
| 28 | 28 | $page->name = 'account_dashboard'; |
| 29 | 29 | $page->task = 'page'; |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | ), |
| 41 | 41 | ), |
| 42 | 42 | 'context' => 'logged-in-user', |
| 43 | - 'not' => FALSE, |
|
| 43 | + 'not' => false, |
|
| 44 | 44 | ), |
| 45 | 45 | ), |
| 46 | 46 | 'logic' => 'and', |
| 47 | 47 | 'type' => 'none', |
| 48 | - 'settings' => NULL, |
|
| 48 | + 'settings' => null, |
|
| 49 | 49 | ); |
| 50 | 50 | $page->menu = array( |
| 51 | 51 | 'type' => 'none', |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $page->conf = array(); |
| 64 | 64 | $page->default_handlers = array(); |
| 65 | 65 | $handler = new stdClass; |
| 66 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 66 | + $handler->disabled = false; /* Edit this to true to make a default handler disabled initially */ |
|
| 67 | 67 | $handler->api_version = 1; |
| 68 | 68 | $handler->name = 'page_account_dashboard_panel_context'; |
| 69 | 69 | $handler->task = 'page'; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $handler->weight = 0; |
| 73 | 73 | $handler->conf = array( |
| 74 | 74 | 'title' => 'Landing page', |
| 75 | - 'no_blocks' => FALSE, |
|
| 75 | + 'no_blocks' => false, |
|
| 76 | 76 | 'pipeline' => 'ipe', |
| 77 | 77 | 'css_id' => '', |
| 78 | 78 | 'css' => '', |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | $display->layout_settings = array(); |
| 101 | 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 | 107 | ); |
| 108 | 108 | $display->cache = array(); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $pane->panel = 'content'; |
| 117 | 117 | $pane->type = 'panels_mini'; |
| 118 | 118 | $pane->subtype = 'dashboard_tables'; |
| 119 | - $pane->shown = TRUE; |
|
| 119 | + $pane->shown = true; |
|
| 120 | 120 | $pane->access = array(); |
| 121 | 121 | $pane->configuration = array( |
| 122 | 122 | 'override_title' => 1, |
@@ -124,7 +124,7 @@ discard block |
||
| 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 | 130 | 'css_id' => '', |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | $pane->panel = 'content'; |
| 140 | 140 | $pane->type = 'views_panes'; |
| 141 | 141 | $pane->subtype = 'subscriptions-panel_pane_1'; |
| 142 | - $pane->shown = TRUE; |
|
| 142 | + $pane->shown = true; |
|
| 143 | 143 | $pane->access = array(); |
| 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 | 150 | 'css_id' => '', |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $pane->panel = 'sidebar_first'; |
| 160 | 160 | $pane->type = 'custom'; |
| 161 | 161 | $pane->subtype = 'custom'; |
| 162 | - $pane->shown = TRUE; |
|
| 162 | + $pane->shown = true; |
|
| 163 | 163 | $pane->access = array( |
| 164 | 164 | 'plugins' => array( |
| 165 | 165 | 1 => array( |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | 'perm' => 'edit any profile content', |
| 169 | 169 | ), |
| 170 | 170 | 'context' => 'context_user_1', |
| 171 | - 'not' => FALSE, |
|
| 171 | + 'not' => false, |
|
| 172 | 172 | ), |
| 173 | 173 | ), |
| 174 | 174 | ); |
@@ -181,7 +181,7 @@ discard block |
||
| 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 | 187 | 'css_id' => '', |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $pane->panel = 'sidebar_first'; |
| 197 | 197 | $pane->type = 'panels_mini'; |
| 198 | 198 | $pane->subtype = 'user_mail_summary'; |
| 199 | - $pane->shown = TRUE; |
|
| 199 | + $pane->shown = true; |
|
| 200 | 200 | $pane->access = array(); |
| 201 | 201 | $pane->configuration = array( |
| 202 | 202 | 'override_title' => 0, |
@@ -204,7 +204,7 @@ discard block |
||
| 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 | 210 | 'css_id' => '', |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $pane->panel = 'sidebar_first'; |
| 220 | 220 | $pane->type = 'custom'; |
| 221 | 221 | $pane->subtype = 'custom'; |
| 222 | - $pane->shown = TRUE; |
|
| 222 | + $pane->shown = true; |
|
| 223 | 223 | $pane->access = array(); |
| 224 | 224 | $pane->configuration = array( |
| 225 | 225 | 'admin_title' => 'Team summary', |
@@ -234,7 +234,7 @@ discard block |
||
| 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 | 240 | 'css_id' => 'team-dashboard-pane', |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $pane->panel = 'sidebar_first'; |
| 250 | 250 | $pane->type = 'custom'; |
| 251 | 251 | $pane->subtype = 'custom'; |
| 252 | - $pane->shown = TRUE; |
|
| 252 | + $pane->shown = true; |
|
| 253 | 253 | $pane->access = array(); |
| 254 | 254 | $pane->configuration = array( |
| 255 | 255 | 'admin_title' => 'User activity summary', |
@@ -268,7 +268,7 @@ discard block |
||
| 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 | 274 | 'css_id' => '', |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $pane->panel = 'sidebar_first'; |
| 284 | 284 | $pane->type = 'views'; |
| 285 | 285 | $pane->subtype = 'boinc_friends'; |
| 286 | - $pane->shown = TRUE; |
|
| 286 | + $pane->shown = true; |
|
| 287 | 287 | $pane->access = array(); |
| 288 | 288 | $pane->configuration = array( |
| 289 | 289 | 'override_pager_settings' => 0, |
@@ -306,7 +306,7 @@ discard block |
||
| 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 | 312 | 'css_id' => '', |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $pages['account_dashboard'] = $page; |
| 324 | 324 | |
| 325 | 325 | $page = new stdClass; |
| 326 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 326 | + $page->disabled = false; /* Edit this to true to make a default page disabled initially */ |
|
| 327 | 327 | $page->api_version = 1; |
| 328 | 328 | $page->name = 'boinc_user'; |
| 329 | 329 | $page->task = 'page'; |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | $page->path = 'account/%user'; |
| 333 | 333 | $page->access = array( |
| 334 | 334 | 'type' => 'none', |
| 335 | - 'settings' => NULL, |
|
| 335 | + 'settings' => null, |
|
| 336 | 336 | ); |
| 337 | 337 | $page->menu = array(); |
| 338 | 338 | $page->arguments = array( |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $page->conf = array(); |
| 347 | 347 | $page->default_handlers = array(); |
| 348 | 348 | $handler = new stdClass; |
| 349 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 349 | + $handler->disabled = false; /* Edit this to true to make a default handler disabled initially */ |
|
| 350 | 350 | $handler->api_version = 1; |
| 351 | 351 | $handler->name = 'page_boinc_user_panel_context_2'; |
| 352 | 352 | $handler->task = 'page'; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | return ($account->status); |
| 372 | 372 | ', |
| 373 | 373 | ), |
| 374 | - 'not' => FALSE, |
|
| 374 | + 'not' => false, |
|
| 375 | 375 | ), |
| 376 | 376 | ), |
| 377 | 377 | 'logic' => 'and', |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | $display->layout_settings = array(); |
| 383 | 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 | 389 | ); |
| 390 | 390 | $display->cache = array(); |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | $pane->panel = 'content'; |
| 399 | 399 | $pane->type = 'panels_mini'; |
| 400 | 400 | $pane->subtype = 'user_profile'; |
| 401 | - $pane->shown = TRUE; |
|
| 401 | + $pane->shown = true; |
|
| 402 | 402 | $pane->access = array(); |
| 403 | 403 | $pane->configuration = array( |
| 404 | 404 | 'context' => array( |
@@ -409,7 +409,7 @@ discard block |
||
| 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 | 415 | 'css_id' => '', |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | $pane->panel = 'sidebar_first'; |
| 425 | 425 | $pane->type = 'views_panes'; |
| 426 | 426 | $pane->subtype = 'boinc_account_stats-panel_pane_2'; |
| 427 | - $pane->shown = TRUE; |
|
| 427 | + $pane->shown = true; |
|
| 428 | 428 | $pane->access = array(); |
| 429 | 429 | $pane->configuration = array( |
| 430 | 430 | 'override_title' => 0, |
@@ -432,7 +432,7 @@ discard block |
||
| 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 | 438 | 'css_id' => '', |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $pane->panel = 'sidebar_first'; |
| 448 | 448 | $pane->type = 'custom'; |
| 449 | 449 | $pane->subtype = 'custom'; |
| 450 | - $pane->shown = TRUE; |
|
| 450 | + $pane->shown = true; |
|
| 451 | 451 | $pane->access = array(); |
| 452 | 452 | $pane->configuration = array( |
| 453 | 453 | 'admin_title' => 'Team summary', |
@@ -462,7 +462,7 @@ discard block |
||
| 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 | 468 | 'css_id' => 'team-dashboard-pane', |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $pane->panel = 'sidebar_first'; |
| 478 | 478 | $pane->type = 'custom'; |
| 479 | 479 | $pane->subtype = 'custom'; |
| 480 | - $pane->shown = TRUE; |
|
| 480 | + $pane->shown = true; |
|
| 481 | 481 | $pane->access = array(); |
| 482 | 482 | $pane->configuration = array( |
| 483 | 483 | 'admin_title' => 'User activity summary', |
@@ -495,7 +495,7 @@ discard block |
||
| 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 | 501 | 'css_id' => '', |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | $pane->panel = 'sidebar_first'; |
| 511 | 511 | $pane->type = 'views'; |
| 512 | 512 | $pane->subtype = 'boinc_friends'; |
| 513 | - $pane->shown = TRUE; |
|
| 513 | + $pane->shown = true; |
|
| 514 | 514 | $pane->access = array(); |
| 515 | 515 | $pane->configuration = array( |
| 516 | 516 | 'override_pager_settings' => 0, |
@@ -533,7 +533,7 @@ discard block |
||
| 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 | 539 | 'css_id' => '', |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | $pane->panel = 'sidebar_first'; |
| 549 | 549 | $pane->type = 'custom'; |
| 550 | 550 | $pane->subtype = 'custom'; |
| 551 | - $pane->shown = TRUE; |
|
| 551 | + $pane->shown = true; |
|
| 552 | 552 | $pane->access = array(); |
| 553 | 553 | $pane->configuration = array( |
| 554 | 554 | 'admin_title' => 'Project list', |
@@ -559,7 +559,7 @@ discard block |
||
| 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 | 565 | 'css_id' => '', |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | $pages['boinc_user'] = $page; |
| 577 | 577 | |
| 578 | 578 | $page = new stdClass; |
| 579 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 579 | + $page->disabled = false; /* Edit this to true to make a default page disabled initially */ |
|
| 580 | 580 | $page->api_version = 1; |
| 581 | 581 | $page->name = 'home'; |
| 582 | 582 | $page->task = 'page'; |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | $page->path = 'home'; |
| 586 | 586 | $page->access = array( |
| 587 | 587 | 'type' => 'none', |
| 588 | - 'settings' => NULL, |
|
| 588 | + 'settings' => null, |
|
| 589 | 589 | ); |
| 590 | 590 | $page->menu = array( |
| 591 | 591 | 'type' => 'normal', |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | $page->conf = array(); |
| 604 | 604 | $page->default_handlers = array(); |
| 605 | 605 | $handler = new stdClass; |
| 606 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 606 | + $handler->disabled = false; /* Edit this to true to make a default handler disabled initially */ |
|
| 607 | 607 | $handler->api_version = 1; |
| 608 | 608 | $handler->name = 'page_home_panel_context'; |
| 609 | 609 | $handler->task = 'page'; |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $handler->weight = 0; |
| 613 | 613 | $handler->conf = array( |
| 614 | 614 | 'title' => 'Landing page', |
| 615 | - 'no_blocks' => FALSE, |
|
| 615 | + 'no_blocks' => false, |
|
| 616 | 616 | 'pipeline' => 'ipe', |
| 617 | 617 | 'css_id' => '', |
| 618 | 618 | 'css' => '', |
@@ -624,9 +624,9 @@ discard block |
||
| 624 | 624 | $display->layout_settings = array(); |
| 625 | 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 | 631 | ); |
| 632 | 632 | $display->cache = array(); |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | $pane->panel = 'content'; |
| 641 | 641 | $pane->type = 'custom'; |
| 642 | 642 | $pane->subtype = 'custom'; |
| 643 | - $pane->shown = TRUE; |
|
| 643 | + $pane->shown = true; |
|
| 644 | 644 | $pane->access = array( |
| 645 | 645 | 'plugins' => array(), |
| 646 | 646 | ); |
@@ -649,11 +649,11 @@ discard block |
||
| 649 | 649 | 'title' => '', |
| 650 | 650 | 'body' => '<?php print boincuser_home_page(); ?>', |
| 651 | 651 | 'format' => '3', |
| 652 | - 'substitute' => TRUE, |
|
| 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 | 659 | 'css_id' => '', |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $pane->panel = 'sidebar_first'; |
| 669 | 669 | $pane->type = 'panels_mini'; |
| 670 | 670 | $pane->subtype = 'project_stats_overview'; |
| 671 | - $pane->shown = TRUE; |
|
| 671 | + $pane->shown = true; |
|
| 672 | 672 | $pane->access = array(); |
| 673 | 673 | $pane->configuration = array( |
| 674 | 674 | 'override_title' => 0, |
@@ -676,7 +676,7 @@ discard block |
||
| 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 | 682 | 'css_id' => '', |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $pane->panel = 'sidebar_first'; |
| 692 | 692 | $pane->type = 'views'; |
| 693 | 693 | $pane->subtype = 'news'; |
| 694 | - $pane->shown = TRUE; |
|
| 694 | + $pane->shown = true; |
|
| 695 | 695 | $pane->access = array(); |
| 696 | 696 | $pane->configuration = array( |
| 697 | 697 | 'override_pager_settings' => 1, |
@@ -711,7 +711,7 @@ discard block |
||
| 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 | 717 | 'css_id' => '', |
@@ -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 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | // If $selection is provided, and if it matches one of the entries in the file, |
| 33 | 33 | // it will be selected by default. |
| 34 | 34 | // |
| 35 | -function show_combo_box($name, $filename, $selection=null) { |
|
| 35 | +function show_combo_box($name, $filename, $selection = null) { |
|
| 36 | 36 | echo "<select name=\"$name\" class=\"form-control\">\n"; |
| 37 | 37 | |
| 38 | 38 | $file = fopen($filename, "r"); |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | <tr><td colspan=2> |
| 64 | 64 | <table border=0 cellpadding=5 |
| 65 | 65 | <tr> |
| 66 | -<td valign=top><a href=\"" . IMAGE_URL . $profile->userid . '.jpg' . "\"><img src=\"" . IMAGE_URL . $profile->userid . '_sm.jpg' . "\"></a> |
|
| 66 | +<td valign=top><a href=\"" . IMAGE_URL.$profile->userid.'.jpg'."\"><img src=\"".IMAGE_URL.$profile->userid.'_sm.jpg'."\"></a> |
|
| 67 | 67 | </td> |
| 68 | -<td valign=top>" .tra("%1 Your profile picture is shown to the left.", $warning) ." |
|
| 68 | +<td valign=top>" .tra("%1 Your profile picture is shown to the left.", $warning)." |
|
| 69 | 69 | <p>". |
| 70 | -tra("To replace it, click the \"Browse\" button and select a JPEG or PNG file (%1 or less).", "50KB") ."<br /> |
|
| 70 | +tra("To replace it, click the \"Browse\" button and select a JPEG or PNG file (%1 or less).", "50KB")."<br /> |
|
| 71 | 71 | <input name=picture type=file><br> |
| 72 | 72 | <p>". |
| 73 | -tra("To remove it from your profile, check this box:") . " |
|
| 73 | +tra("To remove it from your profile, check this box:")." |
|
| 74 | 74 | <input type=checkbox name=delete_pic> |
| 75 | 75 | <p> |
| 76 | 76 | </td></tr>"; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | end_table(); |
| 79 | 79 | echo "</td></tr>"; |
| 80 | 80 | } else { |
| 81 | - rowify(tra("If you would like include a picture with your profile, click the \"Browse\" button and select a JPEG or PNG file. Please select images of %1 or less.", "50KB") . " |
|
| 81 | + rowify(tra("If you would like include a picture with your profile, click the \"Browse\" button and select a JPEG or PNG file. Please select images of %1 or less.", "50KB")." |
|
| 82 | 82 | <p> |
| 83 | 83 | <input name=picture type=file> |
| 84 | 84 | "); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | row1(tra("Language")); |
| 94 | 94 | echo "<tr><td> |
| 95 | 95 | <p>" . |
| 96 | - tra("Select the language in which your profile is written:") . " |
|
| 96 | + tra("Select the language in which your profile is written:")." |
|
| 97 | 97 | <p> |
| 98 | 98 | "; |
| 99 | 99 | if (isset($profile->language)) { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if ($recaptcha_public_key) { |
| 111 | 111 | table_row(boinc_recaptcha_get_html($recaptcha_public_key)); |
| 112 | 112 | } |
| 113 | - table_row("<p><input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Create/edit profile") ."\" name=\"submit\">"); |
|
| 113 | + table_row("<p><input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Create/edit profile")."\" name=\"submit\">"); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Returns an array containing: |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // Determine if the filetype uploaded is supported. |
| 126 | 126 | // TODO: Change these to constants. |
| 127 | - switch($size[2]) { |
|
| 127 | + switch ($size[2]) { |
|
| 128 | 128 | case '2': // JPEG |
| 129 | 129 | $image = imageCreateFromJPEG($fileName); |
| 130 | 130 | break; |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | function show_description() { |
| 163 | 163 | echo " |
| 164 | - <p>" .tra("Your %1 profile %2 lets you share your opinions and background with the %3 community.", "<b>", "</b>", PROJECT) . " |
|
| 164 | + <p>" .tra("Your %1 profile %2 lets you share your opinions and background with the %3 community.", "<b>", "</b>", PROJECT)." |
|
| 165 | 165 | <p> |
| 166 | 166 | "; |
| 167 | 167 | } |
@@ -179,14 +179,14 @@ discard block |
||
| 179 | 179 | row1(show_profile_heading1()); |
| 180 | 180 | rowify(show_profile_question1().bbcode_info()); |
| 181 | 181 | show_textarea("response1", $response1); |
| 182 | - row1( show_profile_heading2()); |
|
| 183 | - rowify( show_profile_question2().bbcode_info()); |
|
| 182 | + row1(show_profile_heading2()); |
|
| 183 | + rowify(show_profile_question2().bbcode_info()); |
|
| 184 | 184 | show_textarea("response2", $response2); |
| 185 | 185 | show_language_selection($profile); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | function show_textarea($name, $text) { |
| 189 | - rowify("<textarea name=\"$name\" class=\"form-control\" rows=\"10\">" . $text . "</textarea>"); |
|
| 189 | + rowify("<textarea name=\"$name\" class=\"form-control\" rows=\"10\">".$text."</textarea>"); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // $profile is null if user doesn't already have a profile. |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | $delete_pic = "off"; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - if (strlen($response1)==0 && |
|
| 236 | - strlen($response2)==0 && |
|
| 235 | + if (strlen($response1) == 0 && |
|
| 236 | + strlen($response2) == 0 && |
|
| 237 | 237 | $delete_pic != "on" && |
| 238 | 238 | !is_uploaded_file($_FILES['picture']['tmp_name']) |
| 239 | 239 | ) { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $profile->verification = 0; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - $profile ? $has_picture = $profile->has_picture: $has_picture = false; |
|
| 250 | + $profile ? $has_picture = $profile->has_picture : $has_picture = false; |
|
| 251 | 251 | |
| 252 | 252 | if (is_uploaded_file($_FILES['picture']['tmp_name'])) { |
| 253 | 253 | $has_picture = true; |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | // Write the original image file to disk. |
| 264 | 264 | // TODO: define a constant for image quality. |
| 265 | - ImageJPEG($images[0], IMAGE_PATH . $user->id . '.jpg'); |
|
| 266 | - ImageJPEG($images[1], IMAGE_PATH . $user->id . '_sm.jpg'); |
|
| 265 | + ImageJPEG($images[0], IMAGE_PATH.$user->id.'.jpg'); |
|
| 266 | + ImageJPEG($images[1], IMAGE_PATH.$user->id.'_sm.jpg'); |
|
| 267 | 267 | } |
| 268 | 268 | $response1 = sanitize_html($response1); |
| 269 | 269 | $response2 = sanitize_html($response2); |
| 270 | 270 | |
| 271 | - $has_picture = $has_picture?1:0; |
|
| 271 | + $has_picture = $has_picture ? 1 : 0; |
|
| 272 | 272 | if ($profile) { |
| 273 | 273 | $query = " response1 = '".BoincDb::escape_string($response1)."'," |
| 274 | 274 | ." response2 = '".BoincDb::escape_string($response2)."'," |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | page_tail(); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | -function show_profile_form($profile, $warning=null) { |
|
| 313 | +function show_profile_form($profile, $warning = null) { |
|
| 314 | 314 | if ($profile) { |
| 315 | 315 | page_head(tra("Edit your profile"), null, null, null, boinc_recaptcha_get_head_extra()); |
| 316 | 316 | } else { |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | $boincusername = (!empty($account)) ? $account->boincuser_name : variable_get('anonymous', 'Anonymous'); |
| 54 | 54 | $replace = TRUE; |
| 55 | 55 | } |
| 56 | - } |
|
| 57 | - elseif ($nid && _quote_variable_get('node_link_display')) { |
|
| 56 | + } elseif ($nid && _quote_variable_get('node_link_display')) { |
|
| 58 | 57 | $node = node_load(array('nid' => $nid)); |
| 59 | 58 | if (in_array($node->type, _quote_variable_get('node_types'))) { |
| 60 | 59 | $account = user_load($node->uid); |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | $nid = arg(2); |
| 46 | 46 | $cid = arg(3); |
| 47 | 47 | |
| 48 | - $replace = FALSE; |
|
| 48 | + $replace = false; |
|
| 49 | 49 | if ($cid) { |
| 50 | 50 | $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)); |
| 51 | 51 | if ($comment->uid) { |
| 52 | 52 | $account = user_load($comment->uid); |
| 53 | 53 | $boincusername = (!empty($account)) ? $account->boincuser_name : variable_get('anonymous', 'Anonymous'); |
| 54 | - $replace = TRUE; |
|
| 54 | + $replace = true; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | elseif ($nid && _quote_variable_get('node_link_display')) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if (in_array($node->type, _quote_variable_get('node_types'))) { |
| 60 | 60 | $account = user_load($node->uid); |
| 61 | 61 | $boincusername = (!empty($account)) ? $account->boincuser_name : variable_get('anonymous', 'Anonymous'); |
| 62 | - $replace = TRUE; |
|
| 62 | + $replace = true; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -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 | } |
@@ -418,11 +418,9 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | if ($edit['boincuser_name']) { |
| 420 | 420 | $myname = $edit['boincuser_name']; |
| 421 | - } |
|
| 422 | - else if ($edit['name']) { |
|
| 421 | + } else if ($edit['name']) { |
|
| 423 | 422 | $myname = $edit['name']; |
| 424 | - } |
|
| 425 | - else { |
|
| 423 | + } else { |
|
| 426 | 424 | $myname = 'noname'; |
| 427 | 425 | } |
| 428 | 426 | |
@@ -434,8 +432,7 @@ discard block |
||
| 434 | 432 | // If the 'pass' variable is already a hash, then don't hash it again. |
| 435 | 433 | if ($edit['boinchash_flag']) { |
| 436 | 434 | $user_params['passwd_hash'] = $edit['pass']; |
| 437 | - } |
|
| 438 | - else { |
|
| 435 | + } else { |
|
| 439 | 436 | // The passwd_hash here is only the md5() hash. This is |
| 440 | 437 | // because BOINC make_user(), called later, will run |
| 441 | 438 | // password_hash() on this md5 hash. |
@@ -506,8 +503,7 @@ discard block |
||
| 506 | 503 | $prev_email = $account->mail; |
| 507 | 504 | $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time(); |
| 508 | 505 | $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime"; |
| 509 | - } |
|
| 510 | - else { |
|
| 506 | + } else { |
|
| 511 | 507 | $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; |
| 512 | 508 | } |
| 513 | 509 | |
@@ -750,8 +746,7 @@ discard block |
||
| 750 | 746 | case FLAG_FRIEND_APPROVAL: |
| 751 | 747 | if ($action == 'flag') { |
| 752 | 748 | $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
| 753 | - } |
|
| 754 | - elseif ($action == 'unflag') { |
|
| 749 | + } elseif ($action == 'unflag') { |
|
| 755 | 750 | unset($form['actions']); |
| 756 | 751 | $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
| 757 | 752 | } |
@@ -1527,8 +1522,7 @@ discard block |
||
| 1527 | 1522 | array( |
| 1528 | 1523 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
| 1529 | 1524 | ), NULL, 'boinc:join-page') . '</li>'; |
| 1530 | - } |
|
| 1531 | - else { |
|
| 1525 | + } else { |
|
| 1532 | 1526 | $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
| 1533 | 1527 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.", |
| 1534 | 1528 | array( |
@@ -1563,8 +1557,7 @@ discard block |
||
| 1563 | 1557 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
| 1564 | 1558 | '@sitename' => $site_name, |
| 1565 | 1559 | ), NULL, 'boinc:join-page') . '</li>'; |
| 1566 | - } |
|
| 1567 | - else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
| 1560 | + } else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
| 1568 | 1561 | $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
| 1569 | 1562 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
| 1570 | 1563 | ), NULL, 'boinc:join-page') . '</li>'; |
@@ -1606,8 +1599,7 @@ discard block |
||
| 1606 | 1599 | )); |
| 1607 | 1600 | if ($current_uotd->uotd_time < strtotime('today midnight')) { |
| 1608 | 1601 | $uotd = boincuser_select_user_of_the_day(); |
| 1609 | - } |
|
| 1610 | - else { |
|
| 1602 | + } else { |
|
| 1611 | 1603 | $uotd = user_load($current_uotd->uid); |
| 1612 | 1604 | } |
| 1613 | 1605 | $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
@@ -1618,8 +1610,7 @@ discard block |
||
| 1618 | 1610 | $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
| 1619 | 1611 | if ($user->uid) { |
| 1620 | 1612 | $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
| 1621 | - } |
|
| 1622 | - else { |
|
| 1613 | + } else { |
|
| 1623 | 1614 | $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
| 1624 | 1615 | } |
| 1625 | 1616 | $output .= '</div>'; |
@@ -1704,12 +1695,10 @@ discard block |
||
| 1704 | 1695 | if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
| 1705 | 1696 | password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
| 1706 | 1697 | $output = array('authenticator' => $boinc_user->authenticator); |
| 1707 | - } |
|
| 1708 | - else { |
|
| 1698 | + } else { |
|
| 1709 | 1699 | xml_error(-137); |
| 1710 | 1700 | } |
| 1711 | - } |
|
| 1712 | - else { |
|
| 1701 | + } else { |
|
| 1713 | 1702 | // Verify that there isn't somehow a Drupal user already (not possible with proper function) |
| 1714 | 1703 | if ($existing_user = user_load(array('mail' => $params['email_addr']))) { |
| 1715 | 1704 | xml_error(-137, 'account error'); |
@@ -2193,7 +2182,9 @@ discard block |
||
| 2193 | 2182 | 'cpid' => $cpid |
| 2194 | 2183 | ); |
| 2195 | 2184 | $args = array(); |
| 2196 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
| 2185 | + foreach ($get as $arg => $value) { |
|
| 2186 | + $args[] = "{$arg}=" . rawurlencode($value); |
|
| 2187 | + } |
|
| 2197 | 2188 | $query = '?' . implode('&', $args); |
| 2198 | 2189 | |
| 2199 | 2190 | // Load XML from RPC |
@@ -2324,8 +2315,7 @@ discard block |
||
| 2324 | 2315 | if ($node->uid == 0 || strlen($node->name) == 0) { |
| 2325 | 2316 | // @see user_validate_name(). !'0' === TRUE. |
| 2326 | 2317 | $document->ss_name = '0'; |
| 2327 | - } |
|
| 2328 | - else { |
|
| 2318 | + } else { |
|
| 2329 | 2319 | $document->ss_name = $account->boincuser_name; |
| 2330 | 2320 | // We want the name to be searchable for keywords. |
| 2331 | 2321 | $document->tos_name = $account->boincuser_name; |
@@ -27,44 +27,44 @@ discard block |
||
| 27 | 27 | * with defined URL paths |
| 28 | 28 | */ |
| 29 | 29 | function boincuser_menu() { |
| 30 | - $items['account/posts'] = array( |
|
| 30 | + $items['account/posts'] = array( |
|
| 31 | 31 | 'title' => 'Recent posts', |
| 32 | 32 | 'description' => '', |
| 33 | 33 | 'page callback' => 'boincuser_goto_recent_posts', |
| 34 | 34 | 'access callback' => 'user_is_logged_in', |
| 35 | 35 | 'type' => MENU_CALLBACK, |
| 36 | - ); |
|
| 37 | - $items['account/profile'] = array( |
|
| 36 | + ); |
|
| 37 | + $items['account/profile'] = array( |
|
| 38 | 38 | 'title' => '', |
| 39 | 39 | 'description' => '', |
| 40 | 40 | 'page callback' => 'boincuser_view_profile', |
| 41 | 41 | 'access callback' => 'user_is_logged_in', |
| 42 | 42 | 'type' => MENU_NORMAL_ITEM |
| 43 | - ); |
|
| 44 | - $items['account/profile/view'] = array( |
|
| 43 | + ); |
|
| 44 | + $items['account/profile/view'] = array( |
|
| 45 | 45 | 'title' => 'View', |
| 46 | 46 | 'description' => 'Show a user profile', |
| 47 | 47 | 'page callback' => 'boincuser_view_profile', |
| 48 | 48 | 'access callback' => 'user_is_logged_in', |
| 49 | 49 | 'type' => MENU_DEFAULT_LOCAL_TASK, |
| 50 | 50 | 'weight' => 0 |
| 51 | - ); |
|
| 52 | - $items['account/profile/edit'] = array( |
|
| 51 | + ); |
|
| 52 | + $items['account/profile/edit'] = array( |
|
| 53 | 53 | 'title' => 'Edit', |
| 54 | 54 | 'description' => 'Edit a user profile', |
| 55 | 55 | 'page callback' => 'boincuser_edit_profile', |
| 56 | 56 | 'access arguments' => array('edit own profile content'), |
| 57 | 57 | 'type' => MENU_LOCAL_TASK, |
| 58 | 58 | 'weight' => 5 |
| 59 | - ); |
|
| 60 | - $items['account/team'] = array( |
|
| 59 | + ); |
|
| 60 | + $items['account/team'] = array( |
|
| 61 | 61 | 'title' => 'User team', |
| 62 | 62 | 'description' => '', |
| 63 | 63 | 'page callback' => 'boincuser_goto_team', |
| 64 | 64 | 'access callback' => 'user_is_logged_in', |
| 65 | 65 | 'type' => MENU_CALLBACK, |
| 66 | - ); |
|
| 67 | - $items['moderate/profile/%user/approve'] = array( |
|
| 66 | + ); |
|
| 67 | + $items['moderate/profile/%user/approve'] = array( |
|
| 68 | 68 | 'title' => 'Profile approval', |
| 69 | 69 | 'description' => 'Approve profile content', |
| 70 | 70 | 'page callback' => 'boincuser_moderate_profile_approve', |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | 'access arguments' => array('edit any profile content'), |
| 73 | 73 | 'type' => MENU_CALLBACK, |
| 74 | 74 | 'weight' => 5 |
| 75 | - ); |
|
| 76 | - $items['moderate/profile/%user/edit'] = array( |
|
| 75 | + ); |
|
| 76 | + $items['moderate/profile/%user/edit'] = array( |
|
| 77 | 77 | 'title' => 'Profile editor', |
| 78 | 78 | 'description' => 'Edit a user profile', |
| 79 | 79 | 'page callback' => 'boincuser_edit_profile', |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | 'access arguments' => array('edit any profile content'), |
| 82 | 82 | 'type' => MENU_CALLBACK, |
| 83 | 83 | 'weight' => 5 |
| 84 | - ); |
|
| 85 | - $items['moderate/profile/%/reject'] = array( |
|
| 84 | + ); |
|
| 85 | + $items['moderate/profile/%/reject'] = array( |
|
| 86 | 86 | 'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), |
| 87 | 87 | 'description' => 'Reject profile content', |
| 88 | 88 | 'page callback' => 'drupal_get_form', |
@@ -90,60 +90,60 @@ discard block |
||
| 90 | 90 | 'access arguments' => array('edit any profile content'), |
| 91 | 91 | 'type' => MENU_CALLBACK, |
| 92 | 92 | 'weight' => 5 |
| 93 | - ); |
|
| 94 | - $items['moderate/user/%/ban'] = array( |
|
| 93 | + ); |
|
| 94 | + $items['moderate/user/%/ban'] = array( |
|
| 95 | 95 | 'title' => bts('Ban user', array(), NULL, 'boinc:moderate-ban-user'), |
| 96 | 96 | 'description' => 'Ban a user from using community features', |
| 97 | 97 | 'page callback' => 'drupal_get_form', |
| 98 | 98 | 'page arguments' => array('boincuser_moderate_user_ban_form', 2), |
| 99 | 99 | 'access callback' => 'boincuser_moderate_community_access', |
| 100 | 100 | 'type' => MENU_CALLBACK, |
| 101 | - ); |
|
| 102 | - $items['join'] = array( |
|
| 101 | + ); |
|
| 102 | + $items['join'] = array( |
|
| 103 | 103 | 'title' => '', |
| 104 | 104 | 'description' => '', |
| 105 | 105 | 'page callback' => 'join_page', |
| 106 | 106 | 'access arguments' => array('access content'), |
| 107 | 107 | 'type' => MENU_NORMAL_ITEM |
| 108 | - ); |
|
| 109 | - $items['join/new'] = array( |
|
| 108 | + ); |
|
| 109 | + $items['join/new'] = array( |
|
| 110 | 110 | 'title' => bts("I'm new"), |
| 111 | 111 | 'page callback' => 'join_page', |
| 112 | 112 | 'page arguments' => array(1), |
| 113 | 113 | 'access arguments' => array('access content'), |
| 114 | 114 | 'type' => MENU_DEFAULT_LOCAL_TASK, |
| 115 | 115 | 'weight' => 0 |
| 116 | - ); |
|
| 117 | - $items['join/boinc'] = array( |
|
| 116 | + ); |
|
| 117 | + $items['join/boinc'] = array( |
|
| 118 | 118 | 'title' => bts("I'm a BOINC user"), |
| 119 | 119 | 'page callback' => 'join_page', |
| 120 | 120 | 'page arguments' => array(1), |
| 121 | 121 | 'access arguments' => array('access content'), |
| 122 | 122 | 'type' => MENU_LOCAL_TASK, |
| 123 | 123 | 'weight' => 5 |
| 124 | - ); |
|
| 125 | - $items['user/login/auth'] = array( |
|
| 124 | + ); |
|
| 125 | + $items['user/login/auth'] = array( |
|
| 126 | 126 | 'title' => bts('Authenticator login', array(), NULL, 'boinc:authenticator-login-page'), |
| 127 | 127 | 'description' => 'Log in using a user authenticator', |
| 128 | 128 | 'page callback' => 'drupal_get_form', |
| 129 | 129 | 'page arguments' => array('boincuser_authloginform'), |
| 130 | 130 | 'access arguments' => array('access content'), |
| 131 | 131 | 'type' => MENU_CALLBACK, |
| 132 | - ); |
|
| 133 | - $items['user/termsofuse'] = array( |
|
| 132 | + ); |
|
| 133 | + $items['user/termsofuse'] = array( |
|
| 134 | 134 | 'title' => bts('Terms of Use', array(), NULL, 'boinc:termsofuse-form'), |
| 135 | 135 | 'description' => 'A site\'s term of use.', |
| 136 | 136 | 'page callback' => 'drupal_get_form', |
| 137 | 137 | 'page arguments' => array('boincuser_termsofuse_form'), |
| 138 | 138 | 'access callback' => 'user_is_logged_in', |
| 139 | 139 | 'type' => MENU_CALLBACK, |
| 140 | - ); |
|
| 141 | - $items['user_control'] = array( |
|
| 140 | + ); |
|
| 141 | + $items['user_control'] = array( |
|
| 142 | 142 | 'page callback' => 'boincuser_control', |
| 143 | 143 | 'access arguments' => array('access user profiles'), |
| 144 | 144 | 'type' => MENU_CALLBACK |
| 145 | - ); |
|
| 146 | - $items['admin/boinc'] = array( |
|
| 145 | + ); |
|
| 146 | + $items['admin/boinc'] = array( |
|
| 147 | 147 | 'title' => 'BOINC configuration', |
| 148 | 148 | 'position' => 'right', |
| 149 | 149 | 'weight' => -8, |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | 'access arguments' => array('administer site configuration'), |
| 152 | 152 | 'file' => 'system.admin.inc', |
| 153 | 153 | 'file path' => drupal_get_path('module', 'system'), |
| 154 | - ); |
|
| 155 | - $items['admin/boinc/environment'] = array( |
|
| 154 | + ); |
|
| 155 | + $items['admin/boinc/environment'] = array( |
|
| 156 | 156 | 'title' => 'Environment: General', |
| 157 | 157 | 'description' => 'Set paths to BOINC functions and any other necessary |
| 158 | 158 | variables that establish a BOINC environment.', |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | 'access arguments' => array('administer site configuration'), |
| 162 | 162 | 'type' => MENU_NORMAL_ITEM, |
| 163 | 163 | 'file' => 'boincuser.admin.inc' |
| 164 | - ); |
|
| 165 | - $items['admin/boinc/scheduler'] = array( |
|
| 164 | + ); |
|
| 165 | + $items['admin/boinc/scheduler'] = array( |
|
| 166 | 166 | 'title' => 'Environment: Scheduling server URLs', |
| 167 | 167 | 'description' => 'Set BOINC scheduler options.', |
| 168 | 168 | 'page callback' => 'drupal_get_form', |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | 'access arguments' => array('administer site configuration'), |
| 171 | 171 | 'type' => MENU_NORMAL_ITEM, |
| 172 | 172 | 'file' => 'boincuser.admin.inc' |
| 173 | - ); |
|
| 174 | - $items['admin/boinc/weboptions'] = array( |
|
| 173 | + ); |
|
| 174 | + $items['admin/boinc/weboptions'] = array( |
|
| 175 | 175 | 'title' => 'Environment: Website Options', |
| 176 | 176 | 'description' => 'Set options configuring this Drupal-BOINC Web site.', |
| 177 | 177 | 'page callback' => 'drupal_get_form', |
@@ -179,117 +179,117 @@ discard block |
||
| 179 | 179 | 'access arguments' => array('administer site configuration'), |
| 180 | 180 | 'type' => MENU_NORMAL_ITEM, |
| 181 | 181 | 'file' => 'boincuser.admin.inc' |
| 182 | - ); |
|
| 182 | + ); |
|
| 183 | 183 | |
| 184 | - $items['create_account.php'] = array( |
|
| 184 | + $items['create_account.php'] = array( |
|
| 185 | 185 | 'title' => 'Create Account RPC', |
| 186 | 186 | 'description' => 'RPC for creating user accounts.', |
| 187 | 187 | 'page callback' => 'boincuser_create_account', |
| 188 | 188 | 'access callback' => TRUE, |
| 189 | 189 | 'type' => MENU_CALLBACK |
| 190 | - ); |
|
| 191 | - $items['account_finish.php'] = array( |
|
| 190 | + ); |
|
| 191 | + $items['account_finish.php'] = array( |
|
| 192 | 192 | 'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), |
| 193 | 193 | 'description' => 'RPC for after a user has created an account.', |
| 194 | 194 | 'page callback' => 'boincuser_account_finish', |
| 195 | 195 | 'access callback' => TRUE, |
| 196 | 196 | 'type' => MENU_CALLBACK, |
| 197 | - ); |
|
| 198 | - $items['boincuser/autocomplete'] = array( |
|
| 197 | + ); |
|
| 198 | + $items['boincuser/autocomplete'] = array( |
|
| 199 | 199 | 'page callback' => '_boincuser_user_name_autocomplete', |
| 200 | 200 | 'access callback' => TRUE, |
| 201 | 201 | 'type' => MENU_CALLBACK, |
| 202 | - ); |
|
| 203 | - $items['user/%user/recoveremail/%'] = array( |
|
| 202 | + ); |
|
| 203 | + $items['user/%user/recoveremail/%'] = array( |
|
| 204 | 204 | 'title' => t('Recover previous email'), |
| 205 | 205 | 'description' => t('Form to revert email to previous address.'), |
| 206 | 206 | 'page callback' => 'drupal_get_form', |
| 207 | 207 | 'page arguments' => array('boincuser_revertemail', 3), |
| 208 | 208 | 'access callback' => 'user_is_logged_in', |
| 209 | 209 | 'type' => MENU_CALLBACK, |
| 210 | - ); |
|
| 211 | - $items['recover_email.php'] = array( |
|
| 210 | + ); |
|
| 211 | + $items['recover_email.php'] = array( |
|
| 212 | 212 | 'title' => t('Recover previous email'), |
| 213 | 213 | 'description' => t('redirect'), |
| 214 | 214 | 'page callback' => '_boincuser_redirect_recover_email', |
| 215 | 215 | 'access callback' => TRUE, |
| 216 | 216 | 'type' => MENU_CALLBACK, |
| 217 | - ); |
|
| 218 | - return $items; |
|
| 217 | + ); |
|
| 218 | + return $items; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | 222 | * Implementation of hook_init() |
| 223 | 223 | */ |
| 224 | 224 | function boincuser_init() { |
| 225 | - global $user; |
|
| 226 | - // Skip this check for charts, which are loaded separately |
|
| 227 | - // (may get duplicate or unexpected messages otherwise) |
|
| 228 | - if (substr($_GET['q'], 0, 7) == 'charts/') { |
|
| 225 | + global $user; |
|
| 226 | + // Skip this check for charts, which are loaded separately |
|
| 227 | + // (may get duplicate or unexpected messages otherwise) |
|
| 228 | + if (substr($_GET['q'], 0, 7) == 'charts/') { |
|
| 229 | 229 | return; |
| 230 | - } |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - // If admin user, do some basic site functionality checks |
|
| 233 | - if (user_access('administer site configuration')) { |
|
| 232 | + // If admin user, do some basic site functionality checks |
|
| 233 | + if (user_access('administer site configuration')) { |
|
| 234 | 234 | // Ensure we have a configured BOINC environment |
| 235 | 235 | boinc_get_path(); |
| 236 | 236 | boinc_get_scheduler_tags(); |
| 237 | - } |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - // Check credits for the verified contributor role |
|
| 240 | - boincuser_check_credit_requirements(); |
|
| 239 | + // Check credits for the verified contributor role |
|
| 240 | + boincuser_check_credit_requirements(); |
|
| 241 | 241 | |
| 242 | - if (module_exists('boincteam')) { |
|
| 242 | + if (module_exists('boincteam')) { |
|
| 243 | 243 | // Display any persistent team messages |
| 244 | 244 | boincteam_show_messages(); |
| 245 | - } |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - // Check if user has agreed to the terms of use. If not, send the |
|
| 248 | - // user to the terms-of-use form. This is only makes sense if the |
|
| 249 | - // termsofuse is enabled, by having text in the termsofuse variable. |
|
| 250 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
| 251 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 252 | - if ( (!empty($termsofuse)) and ($user->uid) ) { |
|
| 247 | + // Check if user has agreed to the terms of use. If not, send the |
|
| 248 | + // user to the terms-of-use form. This is only makes sense if the |
|
| 249 | + // termsofuse is enabled, by having text in the termsofuse variable. |
|
| 250 | + $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
| 251 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 252 | + if ( (!empty($termsofuse)) and ($user->uid) ) { |
|
| 253 | 253 | if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { |
| 254 | 254 | |
| 255 | - // Admins are exempt, otherwise the admin may not be able to |
|
| 256 | - // access the site! |
|
| 257 | - $administrator_role = array_search('administrator', user_roles(true)); |
|
| 258 | - if (!isset($user->roles[$administrator_role])) { |
|
| 255 | + // Admins are exempt, otherwise the admin may not be able to |
|
| 256 | + // access the site! |
|
| 257 | + $administrator_role = array_search('administrator', user_roles(true)); |
|
| 258 | + if (!isset($user->roles[$administrator_role])) { |
|
| 259 | 259 | $path = drupal_get_path_alias($_GET['q']); |
| 260 | 260 | |
| 261 | 261 | // Any paths that should NOT be redirected go here. |
| 262 | 262 | // The site will not function correctly if these are not exempt! |
| 263 | 263 | $paths0 = array( |
| 264 | - 'user/termsofuse', |
|
| 265 | - 'logout', |
|
| 266 | - 'account/info/edit', |
|
| 267 | - 'user/' . $user->uid . '/edit', |
|
| 268 | - 'user/' . $user->uid . '/recoveremail/*', |
|
| 269 | - 'recover_email.php', |
|
| 264 | + 'user/termsofuse', |
|
| 265 | + 'logout', |
|
| 266 | + 'account/info/edit', |
|
| 267 | + 'user/' . $user->uid . '/edit', |
|
| 268 | + 'user/' . $user->uid . '/recoveremail/*', |
|
| 269 | + 'recover_email.php', |
|
| 270 | 270 | ); |
| 271 | 271 | if (module_exists('boincuser_delete')) { |
| 272 | - $paths0[] = 'user/' . $user->uid . '/delete'; |
|
| 273 | - $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*'; |
|
| 274 | - $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*'; |
|
| 272 | + $paths0[] = 'user/' . $user->uid . '/delete'; |
|
| 273 | + $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*'; |
|
| 274 | + $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*'; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | // Paths added by the admin |
| 278 | 278 | $paths1 = preg_split('/\r\n|\r|\n/', variable_get('boinc_weboptions_pathstoignore', "moderation\ncontent/moderation\nprivacy")); |
| 279 | 279 | $paths2 = array(); |
| 280 | 280 | if (is_array($paths1)) { |
| 281 | - $paths2 = array_map('strtolower', $paths1); |
|
| 281 | + $paths2 = array_map('strtolower', $paths1); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // paths to ignore |
| 285 | 285 | $paths_to_ignore = array_unique( array_merge($paths0, $paths2) ); |
| 286 | 286 | |
| 287 | 287 | if (!_boincuser_ignore_paths($path, $paths_to_ignore)) { |
| 288 | - drupal_goto('user/termsofuse'); |
|
| 288 | + drupal_goto('user/termsofuse'); |
|
| 289 | + } |
|
| 289 | 290 | } |
| 290 | - } |
|
| 291 | 291 | } |
| 292 | - } |
|
| 292 | + } |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | * Drupal user operations |
| 298 | 298 | */ |
| 299 | 299 | function boincuser_user($op, &$edit, &$account, $category = NULL) { |
| 300 | - require_boinc('boinc_db'); |
|
| 301 | - require_boinc('user'); |
|
| 302 | - require_boinc('xml'); |
|
| 300 | + require_boinc('boinc_db'); |
|
| 301 | + require_boinc('user'); |
|
| 302 | + require_boinc('xml'); |
|
| 303 | 303 | |
| 304 | - require_boinc('password_compat/password'); |
|
| 305 | - // Handle BOINC integration for users with UID > 1 (skip anonymous and admin) |
|
| 306 | - if (isset($account->uid) && ($account->uid > 1)) { |
|
| 304 | + require_boinc('password_compat/password'); |
|
| 305 | + // Handle BOINC integration for users with UID > 1 (skip anonymous and admin) |
|
| 306 | + if (isset($account->uid) && ($account->uid > 1)) { |
|
| 307 | 307 | switch($op) { |
| 308 | 308 | case 'load': |
| 309 | 309 | // User loading; insert BOINC data into the user object |
@@ -311,11 +311,11 @@ discard block |
||
| 311 | 311 | SELECT boinc_id, penalty_expiration |
| 312 | 312 | FROM {boincuser} WHERE uid = %d", |
| 313 | 313 | $account->uid |
| 314 | - )); |
|
| 315 | - $account->boincuser_id = $drupal_user->boinc_id; |
|
| 316 | - $account->boincuser_penalty_expiration = $drupal_user->penalty_expiration; |
|
| 317 | - db_set_active('boinc_rw'); |
|
| 318 | - $boinc_user = db_fetch_object(db_query(" |
|
| 314 | + )); |
|
| 315 | + $account->boincuser_id = $drupal_user->boinc_id; |
|
| 316 | + $account->boincuser_penalty_expiration = $drupal_user->penalty_expiration; |
|
| 317 | + db_set_active('boinc_rw'); |
|
| 318 | + $boinc_user = db_fetch_object(db_query(" |
|
| 319 | 319 | SELECT |
| 320 | 320 | name, |
| 321 | 321 | authenticator, |
@@ -331,29 +331,29 @@ discard block |
||
| 331 | 331 | FROM {user} |
| 332 | 332 | WHERE id = %d", |
| 333 | 333 | $account->boincuser_id |
| 334 | - )); |
|
| 335 | - $account->boincuser_name = $boinc_user->name; |
|
| 336 | - $account->boincuser_account_key = $boinc_user->authenticator; |
|
| 337 | - $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash); |
|
| 338 | - $account->boincuser_total_credit = round($boinc_user->total_credit); |
|
| 339 | - $account->boincuser_expavg_credit = round($boinc_user->expavg_credit); |
|
| 340 | - $account->boincuser_expavg_time = round($boinc_user->expavg_time); |
|
| 341 | - $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail); |
|
| 342 | - $account->boincuser_default_pref_set = $boinc_user->venue; |
|
| 343 | - $account->boincteam_id = $boinc_user->teamid; |
|
| 344 | - $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr; |
|
| 345 | - $account->boincuser_email_addr_change_time = $boinc_user->email_addr_change_time; |
|
| 346 | - db_set_active('default'); |
|
| 347 | - // Set Drupal team ID |
|
| 348 | - $account->team = NULL; |
|
| 349 | - if ($account->boincteam_id) { |
|
| 334 | + )); |
|
| 335 | + $account->boincuser_name = $boinc_user->name; |
|
| 336 | + $account->boincuser_account_key = $boinc_user->authenticator; |
|
| 337 | + $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash); |
|
| 338 | + $account->boincuser_total_credit = round($boinc_user->total_credit); |
|
| 339 | + $account->boincuser_expavg_credit = round($boinc_user->expavg_credit); |
|
| 340 | + $account->boincuser_expavg_time = round($boinc_user->expavg_time); |
|
| 341 | + $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail); |
|
| 342 | + $account->boincuser_default_pref_set = $boinc_user->venue; |
|
| 343 | + $account->boincteam_id = $boinc_user->teamid; |
|
| 344 | + $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr; |
|
| 345 | + $account->boincuser_email_addr_change_time = $boinc_user->email_addr_change_time; |
|
| 346 | + db_set_active('default'); |
|
| 347 | + // Set Drupal team ID |
|
| 348 | + $account->team = NULL; |
|
| 349 | + if ($account->boincteam_id) { |
|
| 350 | 350 | $account->team = db_result(db_query(" |
| 351 | 351 | SELECT nid FROM {boincteam} WHERE team_id = %d", |
| 352 | - $account->boincteam_id |
|
| 352 | + $account->boincteam_id |
|
| 353 | 353 | )); |
| 354 | - } |
|
| 355 | - // Set post count |
|
| 356 | - $account->post_count = db_result(db_query(" |
|
| 354 | + } |
|
| 355 | + // Set post count |
|
| 356 | + $account->post_count = db_result(db_query(" |
|
| 357 | 357 | SELECT COUNT(*) + |
| 358 | 358 | ( |
| 359 | 359 | SELECT COUNT(*) FROM {node} |
@@ -366,8 +366,8 @@ discard block |
||
| 366 | 366 | WHERE comments.uid = '%d' |
| 367 | 367 | AND node.status = 1", |
| 368 | 368 | $account->uid, $account->uid |
| 369 | - )); |
|
| 370 | - break; |
|
| 369 | + )); |
|
| 370 | + break; |
|
| 371 | 371 | |
| 372 | 372 | case 'view': |
| 373 | 373 | // SAMPLE: Add BOINC data to the user profile |
@@ -393,74 +393,74 @@ discard block |
||
| 393 | 393 | case 'user_account': |
| 394 | 394 | // Validate data before updating user account info |
| 395 | 395 | boincuser_account_validate($edit, $account); |
| 396 | - break; |
|
| 396 | + break; |
|
| 397 | 397 | |
| 398 | 398 | default: |
| 399 | 399 | |
| 400 | 400 | } |
| 401 | 401 | // We don't want to save validation source, so remove it |
| 402 | 402 | $edit['validation_source'] = null; |
| 403 | - } |
|
| 404 | - break; |
|
| 403 | + } |
|
| 404 | + break; |
|
| 405 | 405 | |
| 406 | 406 | case 'insert': |
| 407 | 407 | // New user being added to the system |
| 408 | 408 | $imported = $_SESSION['importedUser']; |
| 409 | - unset($_SESSION['importedUser']); |
|
| 409 | + unset($_SESSION['importedUser']); |
|
| 410 | 410 | |
| 411 | - watchdog( |
|
| 411 | + watchdog( |
|
| 412 | 412 | 'boincuser', |
| 413 | 413 | 'Creating user account for %email_addr', |
| 414 | 414 | array('%email_addr' => $edit['mail']), |
| 415 | 415 | WATCHDOG_NOTICE |
| 416 | - ); |
|
| 416 | + ); |
|
| 417 | 417 | |
| 418 | - // The create_acount RPC will call this block of code when |
|
| 419 | - // user_save() is used. If user is registering using the Web |
|
| 420 | - // registration form, create a BOINC user and relationships. |
|
| 421 | - // Create a BOINC account unless importing from BOINC. |
|
| 422 | - if (!$imported) { |
|
| 418 | + // The create_acount RPC will call this block of code when |
|
| 419 | + // user_save() is used. If user is registering using the Web |
|
| 420 | + // registration form, create a BOINC user and relationships. |
|
| 421 | + // Create a BOINC account unless importing from BOINC. |
|
| 422 | + if (!$imported) { |
|
| 423 | 423 | |
| 424 | 424 | // set email address lower-case |
| 425 | 425 | $lower_email_addr = strtolower($edit['mail']); |
| 426 | 426 | |
| 427 | 427 | if ($edit['boincuser_name']) { |
| 428 | - $myname = $edit['boincuser_name']; |
|
| 428 | + $myname = $edit['boincuser_name']; |
|
| 429 | 429 | } |
| 430 | 430 | else if ($edit['name']) { |
| 431 | - $myname = $edit['name']; |
|
| 431 | + $myname = $edit['name']; |
|
| 432 | 432 | } |
| 433 | 433 | else { |
| 434 | - $myname = 'noname'; |
|
| 434 | + $myname = 'noname'; |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | $user_params = array( |
| 438 | - 'email_addr' => $lower_email_addr, |
|
| 439 | - 'name' => $myname, |
|
| 438 | + 'email_addr' => $lower_email_addr, |
|
| 439 | + 'name' => $myname, |
|
| 440 | 440 | ); |
| 441 | 441 | |
| 442 | 442 | // If the 'pass' variable is already a hash, then don't hash it again. |
| 443 | 443 | if ($edit['boinchash_flag']) { |
| 444 | - $user_params['passwd_hash'] = $edit['pass']; |
|
| 444 | + $user_params['passwd_hash'] = $edit['pass']; |
|
| 445 | 445 | } |
| 446 | 446 | else { |
| 447 | - // The passwd_hash here is only the md5() hash. This is |
|
| 448 | - // because BOINC make_user(), called later, will run |
|
| 449 | - // password_hash() on this md5 hash. |
|
| 450 | - $user_params['passwd_hash'] = md5($edit['pass'].$lower_email_addr); |
|
| 447 | + // The passwd_hash here is only the md5() hash. This is |
|
| 448 | + // because BOINC make_user(), called later, will run |
|
| 449 | + // password_hash() on this md5 hash. |
|
| 450 | + $user_params['passwd_hash'] = md5($edit['pass'].$lower_email_addr); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | $boinc_user = boincuser_register_make_user($user_params); |
| 454 | 454 | if (!$boinc_user) { |
| 455 | - // Account exists with this email addr |
|
| 456 | - form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user')); |
|
| 457 | - return; |
|
| 455 | + // Account exists with this email addr |
|
| 456 | + form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user')); |
|
| 457 | + return; |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | // Add user to community role by default (not banned) |
| 461 | 461 | $unrestricted_role = array_search('community member', user_roles(true)); |
| 462 | 462 | $edit['roles'] = array( |
| 463 | - $unrestricted_role => '' |
|
| 463 | + $unrestricted_role => '' |
|
| 464 | 464 | ); |
| 465 | 465 | |
| 466 | 466 | // Disable show_hosts flag, set to TRUE by default |
@@ -471,14 +471,14 @@ discard block |
||
| 471 | 471 | // Cross reference Drupal account with BOINC |
| 472 | 472 | $reference = db_query("INSERT INTO {boincuser} SET uid='%d', boinc_id='%d'", $account->uid, $boinc_user->id); |
| 473 | 473 | if (!$reference) { |
| 474 | - drupal_set_message(t('Error connecting BOINC account.'), 'error'); |
|
| 475 | - return; |
|
| 474 | + drupal_set_message(t('Error connecting BOINC account.'), 'error'); |
|
| 475 | + return; |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // if terms of use exist, the user must agree. |
| 479 | 479 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 480 | 480 | if (!empty($termsofuse)) { |
| 481 | - $reference2 = boincuser_consentto_termsofuse($account); |
|
| 481 | + $reference2 = boincuser_consentto_termsofuse($account); |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | // Don't save custom fields to the Drupal user object |
@@ -486,10 +486,10 @@ discard block |
||
| 486 | 486 | $edit['boinchash_flag'] = null; |
| 487 | 487 | // Set email address to lower case in Drupal users table |
| 488 | 488 | if ($account) { |
| 489 | - user_save($account, array('mail' => $lower_email_addr)); |
|
| 489 | + user_save($account, array('mail' => $lower_email_addr)); |
|
| 490 | 490 | } |
| 491 | - } |
|
| 492 | - break; |
|
| 491 | + } |
|
| 492 | + break; |
|
| 493 | 493 | |
| 494 | 494 | case 'update': |
| 495 | 495 | if (isset($edit['update_source'])) { |
@@ -500,8 +500,8 @@ discard block |
||
| 500 | 500 | // Ensure that BOINC data is altered |
| 501 | 501 | |
| 502 | 502 | $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false; |
| 503 | - $changing_pass = ($edit['pass']) ? true : false; |
|
| 504 | - if ($changing_email OR $changing_pass) { |
|
| 503 | + $changing_pass = ($edit['pass']) ? true : false; |
|
| 504 | + if ($changing_email OR $changing_pass) { |
|
| 505 | 505 | // set email address to lower-case |
| 506 | 506 | $lower_email_addr = strtolower($edit['mail']); |
| 507 | 507 | |
@@ -510,47 +510,47 @@ discard block |
||
| 510 | 510 | $passwd_hash = password_hash( md5($passwd.$lower_email_addr), PASSWORD_DEFAULT ); |
| 511 | 511 | // Algorithm for changing email and/or password |
| 512 | 512 | if ($changing_email) { |
| 513 | - // locally store current email to set as previous email |
|
| 514 | - $prev_email = $account->mail; |
|
| 515 | - $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time(); |
|
| 516 | - $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime"; |
|
| 513 | + // locally store current email to set as previous email |
|
| 514 | + $prev_email = $account->mail; |
|
| 515 | + $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time(); |
|
| 516 | + $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime"; |
|
| 517 | 517 | } |
| 518 | 518 | else { |
| 519 | - $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; |
|
| 519 | + $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Update user account information |
| 523 | 523 | $result = $boinc_user->update($querypart); |
| 524 | 524 | |
| 525 | 525 | if ($changing_email) { |
| 526 | - // reload account |
|
| 527 | - $account = user_load($account->uid); |
|
| 528 | - _boincuser_send_emailchange($account, $lower_email_addr, $prev_email, user_access('administer users')); |
|
| 526 | + // reload account |
|
| 527 | + $account = user_load($account->uid); |
|
| 528 | + _boincuser_send_emailchange($account, $lower_email_addr, $prev_email, user_access('administer users')); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | // Change email to edit to lower-case version, this sets |
| 532 | 532 | // email in Drupal database to the lower-case email |
| 533 | 533 | // address. |
| 534 | 534 | $edit['mail'] = strtolower($lower_email_addr); |
| 535 | - } |
|
| 535 | + } |
|
| 536 | 536 | |
| 537 | - // Change boinc username |
|
| 538 | - if ($edit['boincuser_name'] and ($edit['boincuser_name'] != $boinc_user->name)) { |
|
| 537 | + // Change boinc username |
|
| 538 | + if ($edit['boincuser_name'] and ($edit['boincuser_name'] != $boinc_user->name)) { |
|
| 539 | 539 | $boincuser_name = $edit['boincuser_name']; |
| 540 | 540 | $result = $boinc_user->update( |
| 541 | 541 | "name='{$boincuser_name}'" |
| 542 | 542 | ); |
| 543 | - } |
|
| 543 | + } |
|
| 544 | 544 | |
| 545 | - break; |
|
| 545 | + break; |
|
| 546 | 546 | case 'user_profile': |
| 547 | 547 | if ($edit['boincuser_name'] != $boinc_user->name) { |
| 548 | 548 | $boincuser_name = $edit['boincuser_name']; |
| 549 | 549 | $result = $boinc_user->update( |
| 550 | 550 | "name='{$boincuser_name}'" |
| 551 | 551 | ); |
| 552 | - } |
|
| 553 | - break; |
|
| 552 | + } |
|
| 553 | + break; |
|
| 554 | 554 | default: |
| 555 | 555 | } |
| 556 | 556 | // We don't want to save update source or duplicate custom fields, so |
@@ -558,23 +558,23 @@ discard block |
||
| 558 | 558 | $edit['update_source'] = null; |
| 559 | 559 | $edit['boincuser_name'] = null; |
| 560 | 560 | $edit['current_pass'] = null; |
| 561 | - } |
|
| 562 | - break; |
|
| 561 | + } |
|
| 562 | + break; |
|
| 563 | 563 | |
| 564 | 564 | case 'login': |
| 565 | 565 | // Function is forward compatible to Drupal 7 |
| 566 | 566 | boincuser_user_login($edit, $account); |
| 567 | - break; |
|
| 567 | + break; |
|
| 568 | 568 | |
| 569 | 569 | case 'delete': |
| 570 | 570 | // Function is forward compatible to Drupal 7 |
| 571 | 571 | boincuser_user_delete($account); |
| 572 | - break; |
|
| 572 | + break; |
|
| 573 | 573 | |
| 574 | 574 | default: |
| 575 | 575 | |
| 576 | 576 | } |
| 577 | - } |
|
| 577 | + } |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | /** |
@@ -583,39 +583,39 @@ discard block |
||
| 583 | 583 | *(forward compatible to Drupal 7). |
| 584 | 584 | */ |
| 585 | 585 | function boincuser_user_login(&$edit, $account) { |
| 586 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
| 587 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 588 | - |
|
| 589 | - // Use the same code as boincuser_form_alter(), for case |
|
| 590 | - // 'user_profile_form', if the refering page is the user password |
|
| 591 | - // reset form, then do not check for terms of use. |
|
| 592 | - $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1; |
|
| 593 | - if ($reset_pass) { |
|
| 586 | + $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
| 587 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 588 | + |
|
| 589 | + // Use the same code as boincuser_form_alter(), for case |
|
| 590 | + // 'user_profile_form', if the refering page is the user password |
|
| 591 | + // reset form, then do not check for terms of use. |
|
| 592 | + $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1; |
|
| 593 | + if ($reset_pass) { |
|
| 594 | 594 | return; |
| 595 | - } |
|
| 595 | + } |
|
| 596 | 596 | |
| 597 | - // Check if user has agreed to terms of use. |
|
| 598 | - if ( (!empty($termsofuse)) and ($account->uid) and |
|
| 597 | + // Check if user has agreed to terms of use. |
|
| 598 | + if ( (!empty($termsofuse)) and ($account->uid) and |
|
| 599 | 599 | (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) { |
| 600 | 600 | |
| 601 | 601 | // Admins are exempted. |
| 602 | 602 | $administrator_role = array_search('administrator', user_roles(true)); |
| 603 | 603 | if (!isset($account->roles[$administrator_role])) { |
| 604 | 604 | |
| 605 | - // Find and save the current destination and use as an parameter |
|
| 606 | - // to send the user back to here he/she came from. |
|
| 607 | - $np = ltrim('user/termsofuse', '/'); |
|
| 608 | - $path_for_destination = rawurlencode($np); |
|
| 605 | + // Find and save the current destination and use as an parameter |
|
| 606 | + // to send the user back to here he/she came from. |
|
| 607 | + $np = ltrim('user/termsofuse', '/'); |
|
| 608 | + $path_for_destination = rawurlencode($np); |
|
| 609 | 609 | |
| 610 | - $query_for_destination = ''; |
|
| 611 | - $prevdest = $_REQUEST['destination']; |
|
| 612 | - if ($prevdest) { |
|
| 610 | + $query_for_destination = ''; |
|
| 611 | + $prevdest = $_REQUEST['destination']; |
|
| 612 | + if ($prevdest) { |
|
| 613 | 613 | $query_for_destination = '?destination=' . $prevdest; |
| 614 | - } |
|
| 615 | - $_REQUEST['destination'] = $path_for_destination . $query_for_destination; |
|
| 614 | + } |
|
| 615 | + $_REQUEST['destination'] = $path_for_destination . $query_for_destination; |
|
| 616 | 616 | |
| 617 | 617 | } |
| 618 | - } |
|
| 618 | + } |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |
@@ -624,16 +624,16 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | function boincuser_user_delete($account) { |
| 626 | 626 | |
| 627 | - $boincid = $account->boincuser_id; |
|
| 628 | - // bug in comment module, remove user name from comments. Find all |
|
| 629 | - // comments with uid=0 and clear the field 'name'. |
|
| 630 | - $qrc1 = db_query("UPDATE {comments} SET comments.name='' WHERE comments.uid=0"); |
|
| 627 | + $boincid = $account->boincuser_id; |
|
| 628 | + // bug in comment module, remove user name from comments. Find all |
|
| 629 | + // comments with uid=0 and clear the field 'name'. |
|
| 630 | + $qrc1 = db_query("UPDATE {comments} SET comments.name='' WHERE comments.uid=0"); |
|
| 631 | 631 | |
| 632 | - // Delete entry in drupal boincuser table. |
|
| 633 | - $qrc2 = db_query("DELETE FROM {boincuser} WHERE uid=%d", $account->uid); |
|
| 634 | - if (!$qrc2) { |
|
| 632 | + // Delete entry in drupal boincuser table. |
|
| 633 | + $qrc2 = db_query("DELETE FROM {boincuser} WHERE uid=%d", $account->uid); |
|
| 634 | + if (!$qrc2) { |
|
| 635 | 635 | watchdog('user', 'Error deleting user account, boincuser table UID: %uid.', array('%uid' => $account->uid), WATCHDOG_ERROR); |
| 636 | - } |
|
| 636 | + } |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | |
@@ -642,13 +642,13 @@ discard block |
||
| 642 | 642 | * Obsolete in Drupal 7... |
| 643 | 643 | */ |
| 644 | 644 | function boincuser_nodeapi(&$node, $op, $a3 = null, $a4 = null) { |
| 645 | - // In Drupal 7, these operation cases will all exist as their own hooks, |
|
| 646 | - // so let's approximate that here so that this function can simply be removed |
|
| 647 | - // upon migration to 7 |
|
| 648 | - switch($op) { |
|
| 649 | - case 'update': |
|
| 645 | + // In Drupal 7, these operation cases will all exist as their own hooks, |
|
| 646 | + // so let's approximate that here so that this function can simply be removed |
|
| 647 | + // upon migration to 7 |
|
| 648 | + switch($op) { |
|
| 649 | + case 'update': |
|
| 650 | 650 | boincuser_node_update($node); |
| 651 | - } |
|
| 651 | + } |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | /** |
@@ -656,8 +656,8 @@ discard block |
||
| 656 | 656 | * is updated (forward compatible to Drupal 7) |
| 657 | 657 | */ |
| 658 | 658 | function boincuser_node_update($node) { |
| 659 | - switch($node->type) { |
|
| 660 | - case 'profile': |
|
| 659 | + switch($node->type) { |
|
| 660 | + case 'profile': |
|
| 661 | 661 | // Update the BOINC database directly |
| 662 | 662 | $account = user_load($node->uid); |
| 663 | 663 | // Save user account data |
@@ -669,11 +669,11 @@ discard block |
||
| 669 | 669 | UPDATE user |
| 670 | 670 | SET country = '%s', postal_code = '%s', url = '%s', has_profile = 1 |
| 671 | 671 | WHERE id = %d", |
| 672 | - $country, $postal_code, $url, $account->boincuser_id |
|
| 672 | + $country, $postal_code, $url, $account->boincuser_id |
|
| 673 | 673 | ); |
| 674 | 674 | db_set_active('default'); |
| 675 | 675 | if (!$account_updated) { |
| 676 | - drupal_set_message(t('Error saving BOINC account info.'), 'error'); |
|
| 676 | + drupal_set_message(t('Error saving BOINC account info.'), 'error'); |
|
| 677 | 677 | } |
| 678 | 678 | // Save profile data |
| 679 | 679 | $response1 = $node->field_background[0]['value']; |
@@ -684,16 +684,16 @@ discard block |
||
| 684 | 684 | SET userid = %d, response1 = '%s', response2 = '%s' |
| 685 | 685 | ON DUPLICATE KEY UPDATE |
| 686 | 686 | response1 = '%s', response2 = '%s'", |
| 687 | - $account->boincuser_id, $response1, $response2, |
|
| 688 | - $response1, $response2 |
|
| 687 | + $account->boincuser_id, $response1, $response2, |
|
| 688 | + $response1, $response2 |
|
| 689 | 689 | ); |
| 690 | 690 | db_set_active('default'); |
| 691 | 691 | if (!$profile_updated) { |
| 692 | - drupal_set_message(t('Error saving BOINC profile.'), 'error'); |
|
| 692 | + drupal_set_message(t('Error saving BOINC profile.'), 'error'); |
|
| 693 | 693 | } |
| 694 | 694 | break; |
| 695 | 695 | |
| 696 | - default: |
|
| 696 | + default: |
|
| 697 | 697 | |
| 698 | 698 | } |
| 699 | 699 | } |
@@ -702,21 +702,21 @@ discard block |
||
| 702 | 702 | * Implementation of hook_views_api() |
| 703 | 703 | */ |
| 704 | 704 | function boincuser_views_api() { |
| 705 | - return array( |
|
| 705 | + return array( |
|
| 706 | 706 | 'api' => 2.0, |
| 707 | 707 | 'path' => drupal_get_path('module', 'boincuser') |
| 708 | - ); |
|
| 708 | + ); |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /** |
| 712 | 712 | * Implementation of hook_form_alter() |
| 713 | 713 | */ |
| 714 | 714 | function boincuser_form_alter(&$form, $form_state, $form_id) { |
| 715 | - require_boinc('token'); |
|
| 715 | + require_boinc('token'); |
|
| 716 | 716 | |
| 717 | - global $user; |
|
| 718 | - switch ($form_id) { |
|
| 719 | - case 'flag_confirm': |
|
| 717 | + global $user; |
|
| 718 | + switch ($form_id) { |
|
| 719 | + case 'flag_confirm': |
|
| 720 | 720 | // The URL seems to be the only way to put any kind of context to this |
| 721 | 721 | // request! |
| 722 | 722 | $action = arg(2); |
@@ -725,25 +725,25 @@ discard block |
||
| 725 | 725 | |
| 726 | 726 | // Wrap action buttons for styling consistency |
| 727 | 727 | $form['form control tabs prefix'] = array( |
| 728 | - '#value' => '<ul class="form-control tab-list">', |
|
| 729 | - '#weight' => 1001, |
|
| 728 | + '#value' => '<ul class="form-control tab-list">', |
|
| 729 | + '#weight' => 1001, |
|
| 730 | 730 | ); |
| 731 | 731 | |
| 732 | 732 | switch ($flag_type) { |
| 733 | 733 | case 'friend': |
| 734 | 734 | $friend_id = $form['content_id']['#value']; |
| 735 | - $flag = flag_get_flag('friend'); |
|
| 736 | - $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid); |
|
| 737 | - |
|
| 738 | - // General friend form overrides |
|
| 739 | - $form['flag_friend_submit']['#prefix'] = '<li class="first tab">'; |
|
| 740 | - $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); |
|
| 741 | - $form['flag_friend_submit']['#type'] = 'submit'; |
|
| 742 | - $form['flag_friend_submit']['#suffix'] = '</li>'; |
|
| 743 | - $form['flag_friend_submit']['#weight'] = 1002; |
|
| 744 | - |
|
| 745 | - switch ($friend_status) { |
|
| 746 | - case FLAG_FRIEND_BOTH: |
|
| 735 | + $flag = flag_get_flag('friend'); |
|
| 736 | + $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid); |
|
| 737 | + |
|
| 738 | + // General friend form overrides |
|
| 739 | + $form['flag_friend_submit']['#prefix'] = '<li class="first tab">'; |
|
| 740 | + $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); |
|
| 741 | + $form['flag_friend_submit']['#type'] = 'submit'; |
|
| 742 | + $form['flag_friend_submit']['#suffix'] = '</li>'; |
|
| 743 | + $form['flag_friend_submit']['#weight'] = 1002; |
|
| 744 | + |
|
| 745 | + switch ($friend_status) { |
|
| 746 | + case FLAG_FRIEND_BOTH: |
|
| 747 | 747 | case FLAG_FRIEND_FLAGGED: |
| 748 | 748 | unset($form['actions']); |
| 749 | 749 | $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), NULL, 'boinc:friends-remove'); |
@@ -752,53 +752,53 @@ discard block |
||
| 752 | 752 | $form['#submit'][] = 'boincuser_fix_unfriend_form_submit'; |
| 753 | 753 | $form['#submit'][] = $final_handler; |
| 754 | 754 | break; |
| 755 | - case FLAG_FRIEND_PENDING: |
|
| 755 | + case FLAG_FRIEND_PENDING: |
|
| 756 | 756 | unset($form['actions']); |
| 757 | 757 | $form['flag_friend_submit']['#value'] = bts('Remove request', array(), NULL, 'boinc:friends-page'); |
| 758 | 758 | break; |
| 759 | - case FLAG_FRIEND_APPROVAL: |
|
| 759 | + case FLAG_FRIEND_APPROVAL: |
|
| 760 | 760 | if ($action == 'flag') { |
| 761 | - $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
|
| 761 | + $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
|
| 762 | 762 | } |
| 763 | 763 | elseif ($action == 'unflag') { |
| 764 | - unset($form['actions']); |
|
| 765 | - $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
|
| 764 | + unset($form['actions']); |
|
| 765 | + $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
|
| 766 | 766 | } |
| 767 | 767 | break; |
| 768 | - case FLAG_FRIEND_UNFLAGGED: |
|
| 768 | + case FLAG_FRIEND_UNFLAGGED: |
|
| 769 | 769 | default: |
| 770 | 770 | $user_links[] = array( |
| 771 | - 'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), |
|
| 772 | - 'href' => "flag/confirm/flag/friend/{$account->uid}" |
|
| 771 | + 'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), |
|
| 772 | + 'href' => "flag/confirm/flag/friend/{$account->uid}" |
|
| 773 | 773 | ); |
| 774 | - } |
|
| 775 | - break; |
|
| 774 | + } |
|
| 775 | + break; |
|
| 776 | 776 | |
| 777 | 777 | default: |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | $form['cancel'] = array( |
| 781 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
| 782 | - '#weight' => 1004, |
|
| 781 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
| 782 | + '#weight' => 1004, |
|
| 783 | 783 | ); |
| 784 | 784 | $form['form control tabs suffix'] = array( |
| 785 | - '#value' => '</ul>', |
|
| 786 | - '#weight' => 1010, |
|
| 785 | + '#value' => '</ul>', |
|
| 786 | + '#weight' => 1010, |
|
| 787 | 787 | ); |
| 788 | 788 | |
| 789 | 789 | break; |
| 790 | 790 | |
| 791 | - // General node edit form |
|
| 792 | - case 'news_node_form': |
|
| 791 | + // General node edit form |
|
| 792 | + case 'news_node_form': |
|
| 793 | 793 | $form['separator_bottom'] = array( |
| 794 | - '#value' => '<div class="separator buttons"></div>', |
|
| 795 | - '#weight' => 999, |
|
| 794 | + '#value' => '<div class="separator buttons"></div>', |
|
| 795 | + '#weight' => 999, |
|
| 796 | 796 | ); |
| 797 | 797 | |
| 798 | 798 | // Wrap action buttons for styling consistency |
| 799 | 799 | $form['buttons']['form control tabs prefix'] = array( |
| 800 | - '#value' => '<ul class="form-control tab-list">', |
|
| 801 | - '#weight' => 1001, |
|
| 800 | + '#value' => '<ul class="form-control tab-list">', |
|
| 801 | + '#weight' => 1001, |
|
| 802 | 802 | ); |
| 803 | 803 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
| 804 | 804 | $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
@@ -811,15 +811,15 @@ discard block |
||
| 811 | 811 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
| 812 | 812 | $form['buttons']['preview_changes']['#weight'] = 1004; |
| 813 | 813 | $form['buttons']['cancel'] = array( |
| 814 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
| 815 | - '#weight' => 1005, |
|
| 814 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
| 815 | + '#weight' => 1005, |
|
| 816 | 816 | ); |
| 817 | 817 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
| 818 | 818 | $form['buttons']['delete']['#suffix'] = '</li>'; |
| 819 | 819 | $form['buttons']['delete']['#weight'] = 1006; |
| 820 | 820 | $form['buttons']['form control tabs suffix'] = array( |
| 821 | - '#value' => '</ul>', |
|
| 822 | - '#weight' => 1010, |
|
| 821 | + '#value' => '</ul>', |
|
| 822 | + '#weight' => 1010, |
|
| 823 | 823 | ); |
| 824 | 824 | |
| 825 | 825 | // Preview is ugly, unset until it works |
@@ -827,16 +827,16 @@ discard block |
||
| 827 | 827 | |
| 828 | 828 | break; |
| 829 | 829 | |
| 830 | - case 'node_delete_confirm': |
|
| 830 | + case 'node_delete_confirm': |
|
| 831 | 831 | $form['separator_bottom'] = array( |
| 832 | - '#value' => '<div class="separator buttons"></div>', |
|
| 833 | - '#weight' => 999, |
|
| 832 | + '#value' => '<div class="separator buttons"></div>', |
|
| 833 | + '#weight' => 999, |
|
| 834 | 834 | ); |
| 835 | 835 | |
| 836 | 836 | // Wrap action buttons for styling consistency |
| 837 | 837 | $form['actions']['form control tabs prefix'] = array( |
| 838 | - '#value' => '<ul class="form-control tab-list">', |
|
| 839 | - '#weight' => 1001, |
|
| 838 | + '#value' => '<ul class="form-control tab-list">', |
|
| 839 | + '#weight' => 1001, |
|
| 840 | 840 | ); |
| 841 | 841 | $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
| 842 | 842 | $form['actions']['submit']['#value'] = bts('Delete', array(), NULL, 'boinc:form-delete'); |
@@ -844,23 +844,23 @@ discard block |
||
| 844 | 844 | $form['actions']['submit']['#weight'] = 1002; |
| 845 | 845 | $form['actions']['cancel'] = array( |
| 846 | 846 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
| 847 | - '#weight' => 1005, |
|
| 847 | + '#weight' => 1005, |
|
| 848 | 848 | ); |
| 849 | 849 | $form['actions']['form control tabs suffix'] = array( |
| 850 | - '#value' => '</ul>', |
|
| 851 | - '#weight' => 1010, |
|
| 850 | + '#value' => '</ul>', |
|
| 851 | + '#weight' => 1010, |
|
| 852 | 852 | ); |
| 853 | 853 | $form['#redirect'] = 'account/profile'; |
| 854 | 854 | break; |
| 855 | 855 | |
| 856 | - case 'privatemsg_new': |
|
| 856 | + case 'privatemsg_new': |
|
| 857 | 857 | |
| 858 | 858 | $form['privatemsg']['body']['#title'] = ''; |
| 859 | 859 | |
| 860 | 860 | // Wrap action buttons for styling consistency |
| 861 | 861 | $form['privatemsg']['form control tabs prefix'] = array( |
| 862 | - '#value' => '<ul class="form-control tab-list">', |
|
| 863 | - '#weight' => 1001, |
|
| 862 | + '#value' => '<ul class="form-control tab-list">', |
|
| 863 | + '#weight' => 1001, |
|
| 864 | 864 | ); |
| 865 | 865 | $form['privatemsg']['submit']['#prefix'] = '<li class="first tab">'; |
| 866 | 866 | $form['privatemsg']['submit']['#value'] = bts('Send message', array(), NULL, 'boinc:private-message'); |
@@ -870,26 +870,26 @@ discard block |
||
| 870 | 870 | $form['privatemsg']['preview']['#suffix'] = '</li>'; |
| 871 | 871 | $form['privatemsg']['preview']['#weight'] = 1003; |
| 872 | 872 | $form['privatemsg']['cancel'] = array( |
| 873 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 874 | - '#weight' => 1004, |
|
| 873 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 874 | + '#weight' => 1004, |
|
| 875 | 875 | ); |
| 876 | 876 | $form['privatemsg']['form control tabs suffix'] = array( |
| 877 | - '#value' => '</ul>', |
|
| 878 | - '#weight' => 1010, |
|
| 877 | + '#value' => '</ul>', |
|
| 878 | + '#weight' => 1010, |
|
| 879 | 879 | ); |
| 880 | 880 | |
| 881 | 881 | unset($form['privatemsg']['recipient_display']); |
| 882 | 882 | |
| 883 | 883 | break; |
| 884 | 884 | |
| 885 | - // Login form |
|
| 886 | - case 'user_login': |
|
| 885 | + // Login form |
|
| 886 | + case 'user_login': |
|
| 887 | 887 | case 'user_login_block': |
| 888 | 888 | drupal_set_title(bts('Login', array(), NULL, 'boinc:menu-link')); |
| 889 | 889 | // Replace name with email in login form |
| 890 | 890 | unset($form['name']); |
| 891 | 891 | array_unshift($form, array( |
| 892 | - 'email' => array( |
|
| 892 | + 'email' => array( |
|
| 893 | 893 | '#type' => 'textfield', |
| 894 | 894 | '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), |
| 895 | 895 | '#size' => ($form_id == 'user_login_block') ? 15 : 60, |
@@ -897,18 +897,18 @@ discard block |
||
| 897 | 897 | '#required' => TRUE, |
| 898 | 898 | '#attributes' => array('tabindex' => '1'), |
| 899 | 899 | '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:standard-login-page') |
| 900 | - ), |
|
| 901 | - 'validation_source' => array( |
|
| 900 | + ), |
|
| 901 | + 'validation_source' => array( |
|
| 902 | 902 | '#type' => 'hidden', |
| 903 | 903 | '#value' => 'user_login' |
| 904 | - ) |
|
| 904 | + ) |
|
| 905 | 905 | )); |
| 906 | 906 | $form['#redirect'] = 'home'; |
| 907 | 907 | |
| 908 | 908 | // Wrap action buttons for styling consistency |
| 909 | 909 | $form['buttons']['form control tabs prefix'] = array( |
| 910 | - '#value' => '<ul class="form-control tab-list">', |
|
| 911 | - '#weight' => 1001, |
|
| 910 | + '#value' => '<ul class="form-control tab-list">', |
|
| 911 | + '#weight' => 1001, |
|
| 912 | 912 | ); |
| 913 | 913 | $form['buttons']['submit'] = $form['submit']; |
| 914 | 914 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
@@ -916,8 +916,8 @@ discard block |
||
| 916 | 916 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 917 | 917 | $form['buttons']['submit']['#weight'] = 1002; |
| 918 | 918 | $form['buttons']['form control tabs suffix'] = array( |
| 919 | - '#value' => '</ul>', |
|
| 920 | - '#weight' => 1010, |
|
| 919 | + '#value' => '</ul>', |
|
| 920 | + '#weight' => 1010, |
|
| 921 | 921 | ); |
| 922 | 922 | unset($form['submit']); |
| 923 | 923 | |
@@ -926,23 +926,23 @@ discard block |
||
| 926 | 926 | isset($form['buttons']['submit']['#attributes']) ? array_push($form['buttons']['submit']['#attributes'], array('tabindex' => '3')) : $form['buttons']['submit']['#attributes'] = array('tabindex' => '3'); |
| 927 | 927 | // If the user login form is being submitted, use BOINC validation handler. |
| 928 | 928 | if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) { |
| 929 | - // Find the local validation function's entry so we can replace it. |
|
| 930 | - $array_key = array_search('user_login_authenticate_validate', $form['#validate']); |
|
| 931 | - if ($array_key === FALSE) { |
|
| 929 | + // Find the local validation function's entry so we can replace it. |
|
| 930 | + $array_key = array_search('user_login_authenticate_validate', $form['#validate']); |
|
| 931 | + if ($array_key === FALSE) { |
|
| 932 | 932 | // Could not find it. Some other module must have run form_alter(). |
| 933 | 933 | // We will simply add our validation just before the final validator. |
| 934 | 934 | $final_validator = array_pop($form['#validate']); |
| 935 | 935 | $form['#validate'][] = 'boincuser_login_validate'; |
| 936 | 936 | $form['#validate'][] = $final_validator; |
| 937 | - } else { |
|
| 937 | + } else { |
|
| 938 | 938 | // Replace the local validation function with BOINC validation |
| 939 | 939 | $form['#validate'][$array_key] = 'boincuser_login_validate'; |
| 940 | - } |
|
| 940 | + } |
|
| 941 | 941 | } |
| 942 | 942 | break; |
| 943 | 943 | |
| 944 | - // User credentials form |
|
| 945 | - case 'user_profile_form': |
|
| 944 | + // User credentials form |
|
| 945 | + case 'user_profile_form': |
|
| 946 | 946 | |
| 947 | 947 | // Use the displaly name as the title, not the username |
| 948 | 948 | $account = user_load($form['#uid']); |
@@ -950,28 +950,28 @@ discard block |
||
| 950 | 950 | |
| 951 | 951 | // Message for admins |
| 952 | 952 | if (user_access('administer users')) { |
| 953 | - drupal_set_message( |
|
| 953 | + drupal_set_message( |
|
| 954 | 954 | bts('WARNING: You are editing the information for user. Please note: you may change a user\'s password by itself. But to change the user\'s email address you must change both the email address and the password simultaneously.') |
| 955 | - , 'warning'); |
|
| 955 | + , 'warning'); |
|
| 956 | 956 | } |
| 957 | 957 | |
| 958 | 958 | // Set special message if user has not agreed to TOU |
| 959 | 959 | $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
| 960 | 960 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 961 | 961 | if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { |
| 962 | - drupal_set_message( |
|
| 962 | + drupal_set_message( |
|
| 963 | 963 | bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.', |
| 964 | 964 | array( |
| 965 | - '@project' => variable_get('site_name','Drupal-BOINC'), |
|
| 965 | + '@project' => variable_get('site_name','Drupal-BOINC'), |
|
| 966 | 966 | ), NULL, 'boinc:account-credentials-change') |
| 967 | - , 'info'); |
|
| 967 | + , 'info'); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | // A bit hackish... but don't require the user to enter his password if |
| 971 | 971 | // coming from the password reset function |
| 972 | 972 | $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1; |
| 973 | 973 | if ($reset_pass) { |
| 974 | - $_SESSION['reset_pass'] = 1; |
|
| 974 | + $_SESSION['reset_pass'] = 1; |
|
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | // Adjust form elements already present |
@@ -983,8 +983,8 @@ discard block |
||
| 983 | 983 | $form['account']['pass']['#size'] = 17; |
| 984 | 984 | |
| 985 | 985 | if (user_access('administer users')) { |
| 986 | - // Add BOINC username (aka displayname) |
|
| 987 | - $form['account']['boincuser_name'] = array( |
|
| 986 | + // Add BOINC username (aka displayname) |
|
| 987 | + $form['account']['boincuser_name'] = array( |
|
| 988 | 988 | '#type' => 'textfield', |
| 989 | 989 | '#title' => bts('BOINC Username', array(), NULL, 'boinc:user-or-team-name'), |
| 990 | 990 | '#default_value' => $account->boincuser_name, |
@@ -992,68 +992,68 @@ discard block |
||
| 992 | 992 | '#required' => TRUE, |
| 993 | 993 | '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), NULL, 'boinc:username-change'), |
| 994 | 994 | '#size' => 40, |
| 995 | - ); |
|
| 995 | + ); |
|
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | // If email address was changed less than 7 days (7 * 86400 s) |
| 999 | 999 | // ago, it cannot be changed again. |
| 1000 | 1000 | $duration = TOKEN_DURATION_ONE_WEEK; |
| 1001 | 1001 | if (($account->boincuser_email_addr_change_time + $duration) > time() and (!user_access('administer users'))) { |
| 1002 | - $form['account']['mail']['#required'] = FALSE; |
|
| 1003 | - $form['account']['mailhelp'] = array( |
|
| 1002 | + $form['account']['mail']['#required'] = FALSE; |
|
| 1003 | + $form['account']['mailhelp'] = array( |
|
| 1004 | 1004 | '#value' => bts("You email address was changed within the past seven (7) days. Please look for an email to !prev_email if you need to revert this change. You may change your email address on !time.", |
| 1005 | - array( |
|
| 1005 | + array( |
|
| 1006 | 1006 | '!prev_email' => $account->boincuser_previous_email_addr, |
| 1007 | 1007 | '!time' => date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration), |
| 1008 | - ), NULL, 'boinc:account-credentials-change'), |
|
| 1009 | - ); |
|
| 1008 | + ), NULL, 'boinc:account-credentials-change'), |
|
| 1009 | + ); |
|
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) { |
| 1013 | - // Add a password authenticator, required to change email or pw |
|
| 1014 | - $form['account']['current_pass'] = array( |
|
| 1013 | + // Add a password authenticator, required to change email or pw |
|
| 1014 | + $form['account']['current_pass'] = array( |
|
| 1015 | 1015 | '#type' => 'password', |
| 1016 | 1016 | '#title' => bts('Enter your password to save changes', array(), NULL, 'boinc:account-credentials-change'), |
| 1017 | 1017 | '#description' => bts('Enter your current password if changing your email |
| 1018 | 1018 | address or password.', array(), NULL, 'boinc:account-credentials-change'), |
| 1019 | 1019 | '#size' => 17, |
| 1020 | 1020 | '#attributes' => array( |
| 1021 | - 'autocomplete' => 'off', |
|
| 1021 | + 'autocomplete' => 'off', |
|
| 1022 | 1022 | ), |
| 1023 | - ); |
|
| 1023 | + ); |
|
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | // Add account keys, CPID, etc |
| 1027 | 1027 | $form['account']['boincuser_id'] = array( |
| 1028 | - '#value' => ' |
|
| 1028 | + '#value' => ' |
|
| 1029 | 1029 | <div class="form-item"> |
| 1030 | 1030 | <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
| 1031 | 1031 | <span>' . $account->boincuser_id . '</span> |
| 1032 | 1032 | </div>', |
| 1033 | 1033 | ); |
| 1034 | 1034 | $form['account']['user_id'] = array( |
| 1035 | - '#value' => ' |
|
| 1035 | + '#value' => ' |
|
| 1036 | 1036 | <div class="form-item"> |
| 1037 | 1037 | <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
| 1038 | 1038 | <span>' . $account->uid . '</span> |
| 1039 | 1039 | </div>', |
| 1040 | 1040 | ); |
| 1041 | 1041 | $form['account']['account_key'] = array( |
| 1042 | - '#value' => ' |
|
| 1042 | + '#value' => ' |
|
| 1043 | 1043 | <div class="form-item"> |
| 1044 | 1044 | <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
| 1045 | 1045 | <span>' . $account->boincuser_account_key . '</span> |
| 1046 | 1046 | </div>', |
| 1047 | 1047 | ); |
| 1048 | 1048 | $form['account']['weak_account_key'] = array( |
| 1049 | - '#value' => ' |
|
| 1049 | + '#value' => ' |
|
| 1050 | 1050 | <div class="form-item"> |
| 1051 | 1051 | <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
| 1052 | 1052 | <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> |
| 1053 | 1053 | </div>', |
| 1054 | 1054 | ); |
| 1055 | 1055 | $form['account']['cpid'] = array( |
| 1056 | - '#value' => ' |
|
| 1056 | + '#value' => ' |
|
| 1057 | 1057 | <div class="form-item"> |
| 1058 | 1058 | <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
| 1059 | 1059 | <span>' . $account->boincuser_cpid . '</span> |
@@ -1061,30 +1061,30 @@ discard block |
||
| 1061 | 1061 | ); |
| 1062 | 1062 | |
| 1063 | 1063 | $form['account']['separator_bottom'] = array( |
| 1064 | - '#value' => '<div class="separator buttons"></div>' |
|
| 1064 | + '#value' => '<div class="separator buttons"></div>' |
|
| 1065 | 1065 | ); |
| 1066 | 1066 | |
| 1067 | 1067 | // Wrap action buttons for styling consistency |
| 1068 | 1068 | $form['form control tabs prefix'] = array( |
| 1069 | - '#value' => '<ul class="form-control tab-list">', |
|
| 1070 | - '#weight' => 1001, |
|
| 1069 | + '#value' => '<ul class="form-control tab-list">', |
|
| 1070 | + '#weight' => 1001, |
|
| 1071 | 1071 | ); |
| 1072 | 1072 | $form['submit']['#prefix'] = '<li class="first tab">'; |
| 1073 | 1073 | $form['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
| 1074 | 1074 | $form['submit']['#suffix'] = '</li>'; |
| 1075 | 1075 | $form['submit']['#weight'] = 1002; |
| 1076 | 1076 | $form['cancel'] = array( |
| 1077 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1078 | - '#weight' => 1003, |
|
| 1077 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1078 | + '#weight' => 1003, |
|
| 1079 | 1079 | ); |
| 1080 | 1080 | if (isset($form['delete']) AND is_array($form['delete'])) { |
| 1081 | - $form['delete']['#prefix'] = '<li class="first alt tab">'; |
|
| 1082 | - $form['delete']['#suffix'] = '</li>'; |
|
| 1083 | - $form['delete']['#weight'] = 1004; |
|
| 1081 | + $form['delete']['#prefix'] = '<li class="first alt tab">'; |
|
| 1082 | + $form['delete']['#suffix'] = '</li>'; |
|
| 1083 | + $form['delete']['#weight'] = 1004; |
|
| 1084 | 1084 | } |
| 1085 | 1085 | $form['form control tabs suffix'] = array( |
| 1086 | - '#value' => '</ul>', |
|
| 1087 | - '#weight' => 1010, |
|
| 1086 | + '#value' => '</ul>', |
|
| 1087 | + '#weight' => 1010, |
|
| 1088 | 1088 | ); |
| 1089 | 1089 | |
| 1090 | 1090 | // Rearrange form elements |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | // Remove redundant / unnecessary form elements |
| 1105 | 1105 | unset($form['theme_select']); |
| 1106 | 1106 | if (!module_exists('boincuser_delete')) { |
| 1107 | - unset($form['delete']); |
|
| 1107 | + unset($form['delete']); |
|
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | // These are on the Community preferences form (boincwork module) |
@@ -1120,18 +1120,18 @@ discard block |
||
| 1120 | 1120 | |
| 1121 | 1121 | // Internal fields to indicate where these user changes are taking place |
| 1122 | 1122 | array_unshift($form, array( |
| 1123 | - 'validation_source' => array( |
|
| 1123 | + 'validation_source' => array( |
|
| 1124 | 1124 | '#type' => 'hidden', |
| 1125 | 1125 | '#value' => 'user_account' |
| 1126 | - ), |
|
| 1127 | - 'update_source' => array( |
|
| 1126 | + ), |
|
| 1127 | + 'update_source' => array( |
|
| 1128 | 1128 | '#type' => 'hidden', |
| 1129 | 1129 | '#value' => 'user_account' |
| 1130 | - ) |
|
| 1130 | + ) |
|
| 1131 | 1131 | )); |
| 1132 | 1132 | break; |
| 1133 | 1133 | |
| 1134 | - case 'profile_node_form': |
|
| 1134 | + case 'profile_node_form': |
|
| 1135 | 1135 | |
| 1136 | 1136 | // Use the display name as the title, not the username |
| 1137 | 1137 | $account = user_load($form['uid']['#value']); |
@@ -1142,22 +1142,22 @@ discard block |
||
| 1142 | 1142 | $form['title']['#access'] = FALSE; |
| 1143 | 1143 | |
| 1144 | 1144 | $form['separator_bottom'] = array( |
| 1145 | - '#value' => '<div class="separator buttons"></div>', |
|
| 1146 | - '#weight' => 999, |
|
| 1145 | + '#value' => '<div class="separator buttons"></div>', |
|
| 1146 | + '#weight' => 999, |
|
| 1147 | 1147 | ); |
| 1148 | 1148 | |
| 1149 | 1149 | if (module_exists('captcha')) { |
| 1150 | - // Add an optional captcha |
|
| 1151 | - $form['profile_captcha'] = array( |
|
| 1150 | + // Add an optional captcha |
|
| 1151 | + $form['profile_captcha'] = array( |
|
| 1152 | 1152 | '#type' => 'captcha', |
| 1153 | 1153 | '#weight' => 1000, |
| 1154 | - ); |
|
| 1154 | + ); |
|
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | 1157 | // Wrap action buttons for styling consistency |
| 1158 | 1158 | $form['buttons']['form control tabs prefix'] = array( |
| 1159 | - '#value' => '<ul class="form-control tab-list">', |
|
| 1160 | - '#weight' => 1001, |
|
| 1159 | + '#value' => '<ul class="form-control tab-list">', |
|
| 1160 | + '#weight' => 1001, |
|
| 1161 | 1161 | ); |
| 1162 | 1162 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
| 1163 | 1163 | $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
@@ -1170,8 +1170,8 @@ discard block |
||
| 1170 | 1170 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
| 1171 | 1171 | $form['buttons']['preview_changes']['#weight'] = 1004; |
| 1172 | 1172 | $form['buttons']['cancel'] = array( |
| 1173 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1174 | - '#weight' => 1005, |
|
| 1173 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1174 | + '#weight' => 1005, |
|
| 1175 | 1175 | ); |
| 1176 | 1176 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
| 1177 | 1177 | $form['buttons']['delete']['#suffix'] = '</li>'; |
@@ -1179,8 +1179,8 @@ discard block |
||
| 1179 | 1179 | $form['buttons']['delete']['#weight'] = 1006; |
| 1180 | 1180 | $form['buttons']['delete']['#submit'] = array('_boincuser_node_profile_delete_submit'); |
| 1181 | 1181 | $form['buttons']['form control tabs suffix'] = array( |
| 1182 | - '#value' => '</ul>', |
|
| 1183 | - '#weight' => 1010, |
|
| 1182 | + '#value' => '</ul>', |
|
| 1183 | + '#weight' => 1010, |
|
| 1184 | 1184 | ); |
| 1185 | 1185 | |
| 1186 | 1186 | $form['#after_build'][] = 'boincuser_profile_node_form_after_build'; |
@@ -1193,33 +1193,33 @@ discard block |
||
| 1193 | 1193 | |
| 1194 | 1194 | // Internal fields to indicate where these user changes are taking place |
| 1195 | 1195 | array_unshift($form, array( |
| 1196 | - 'validation_source' => array( |
|
| 1196 | + 'validation_source' => array( |
|
| 1197 | 1197 | '#type' => 'hidden', |
| 1198 | 1198 | '#value' => 'user_profile' |
| 1199 | - ), |
|
| 1200 | - 'update_source' => array( |
|
| 1199 | + ), |
|
| 1200 | + 'update_source' => array( |
|
| 1201 | 1201 | '#type' => 'hidden', |
| 1202 | 1202 | '#value' => 'user_profile' |
| 1203 | - ) |
|
| 1203 | + ) |
|
| 1204 | 1204 | )); |
| 1205 | 1205 | break; |
| 1206 | 1206 | |
| 1207 | - // Registration form |
|
| 1208 | - case 'user_register': |
|
| 1207 | + // Registration form |
|
| 1208 | + case 'user_register': |
|
| 1209 | 1209 | array_unshift($form, array( |
| 1210 | - 'boincuser_name' => array( |
|
| 1210 | + 'boincuser_name' => array( |
|
| 1211 | 1211 | '#type' => 'textfield', |
| 1212 | 1212 | '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
| 1213 | 1213 | '#default_value' => $edit['boincuser_name'], |
| 1214 | 1214 | '#maxlength' => USERNAME_MAX_LENGTH, |
| 1215 | 1215 | '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), NULL, 'boinc:user-register'), |
| 1216 | 1216 | '#required' => TRUE |
| 1217 | - ), |
|
| 1217 | + ), |
|
| 1218 | 1218 | )); |
| 1219 | 1219 | // Set name temporarily to dummy value to beat validation |
| 1220 | 1220 | $form['name'] = array( |
| 1221 | - '#type' => 'hidden', |
|
| 1222 | - '#value' => rand() . '.' . time() |
|
| 1221 | + '#type' => 'hidden', |
|
| 1222 | + '#value' => rand() . '.' . time() |
|
| 1223 | 1223 | ); |
| 1224 | 1224 | |
| 1225 | 1225 | // Add JS for submit button disabling |
@@ -1229,50 +1229,50 @@ discard block |
||
| 1229 | 1229 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 1230 | 1230 | if (!empty($termsofuse)) { |
| 1231 | 1231 | |
| 1232 | - $form['termsofuse'] = array( |
|
| 1232 | + $form['termsofuse'] = array( |
|
| 1233 | 1233 | '#type' => 'fieldset', |
| 1234 | 1234 | '#prefix' => '<div id="termsofuse-wrapper">', // This is our wrapper div. |
| 1235 | 1235 | '#suffix' => '</div>', |
| 1236 | 1236 | '#tree' => TRUE, |
| 1237 | 1237 | '#weight' => -15, |
| 1238 | - ); |
|
| 1238 | + ); |
|
| 1239 | 1239 | |
| 1240 | - $form['termsofuse']['title1'] = array( |
|
| 1240 | + $form['termsofuse']['title1'] = array( |
|
| 1241 | 1241 | '#weight' => -12, |
| 1242 | 1242 | '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', |
| 1243 | 1243 | '#prefix' => '<div id="register-title1">', |
| 1244 | 1244 | '#suffix' => '</div>', |
| 1245 | - ); |
|
| 1245 | + ); |
|
| 1246 | 1246 | |
| 1247 | - $form['termsofuse']['body'] = array( |
|
| 1247 | + $form['termsofuse']['body'] = array( |
|
| 1248 | 1248 | '#weight' => -10, |
| 1249 | 1249 | '#value' => bts($termsofuse, array(), NULL, 'project:user-register'), |
| 1250 | 1250 | '#prefix' => '<div id="register-termsofuse">', |
| 1251 | 1251 | '#suffix' => '</div>', |
| 1252 | - ); |
|
| 1252 | + ); |
|
| 1253 | 1253 | |
| 1254 | - $form['termsofuse']['agreeTOU'] = array( |
|
| 1254 | + $form['termsofuse']['agreeTOU'] = array( |
|
| 1255 | 1255 | '#type' => 'checkbox', |
| 1256 | 1256 | '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:user-register'), |
| 1257 | 1257 | '#weight' => -8, |
| 1258 | 1258 | '#prefix' => '<div id="register-checkbox">', |
| 1259 | 1259 | '#suffix' => '</div>', |
| 1260 | - ); |
|
| 1260 | + ); |
|
| 1261 | 1261 | } |
| 1262 | 1262 | |
| 1263 | 1263 | $form['title2'] = array( |
| 1264 | - '#weight' => -6, |
|
| 1265 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', |
|
| 1266 | - '#prefix' => '<div id="register-title2">', |
|
| 1267 | - '#suffix' => '</div>', |
|
| 1264 | + '#weight' => -6, |
|
| 1265 | + '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', |
|
| 1266 | + '#prefix' => '<div id="register-title2">', |
|
| 1267 | + '#suffix' => '</div>', |
|
| 1268 | 1268 | ); |
| 1269 | 1269 | |
| 1270 | 1270 | if (module_exists('captcha')) { |
| 1271 | - // Add an optional captcha |
|
| 1272 | - $form['register_captcha'] = array( |
|
| 1271 | + // Add an optional captcha |
|
| 1272 | + $form['register_captcha'] = array( |
|
| 1273 | 1273 | '#type' => 'captcha', |
| 1274 | 1274 | '#weight' => 1000, |
| 1275 | - ); |
|
| 1275 | + ); |
|
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | $form['#validate'][] = 'boincuser_register_validate'; |
@@ -1280,45 +1280,45 @@ discard block |
||
| 1280 | 1280 | $form['submit']['#weight'] = 1001; |
| 1281 | 1281 | break; |
| 1282 | 1282 | |
| 1283 | - // Request new password form |
|
| 1284 | - case 'user_pass': |
|
| 1283 | + // Request new password form |
|
| 1284 | + case 'user_pass': |
|
| 1285 | 1285 | drupal_set_title(bts('Forgot password', array(), NULL, 'boinc:forgot-password')); |
| 1286 | 1286 | // Replace name/email text box with email only; retain "name" label |
| 1287 | 1287 | // for compatibility with standard Drupal submit function |
| 1288 | 1288 | unset($form['name']); |
| 1289 | 1289 | array_unshift($form, array( |
| 1290 | - 'name' => array( |
|
| 1290 | + 'name' => array( |
|
| 1291 | 1291 | '#type' => 'textfield', |
| 1292 | 1292 | '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), |
| 1293 | 1293 | '#size' => 60, |
| 1294 | 1294 | '#maxlength' => EMAIL_MAX_LENGTH, |
| 1295 | 1295 | '#required' => TRUE, |
| 1296 | 1296 | '#description' => bts( |
| 1297 | - 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).', |
|
| 1298 | - array( |
|
| 1297 | + 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).', |
|
| 1298 | + array( |
|
| 1299 | 1299 | '!authenticator_login' => l( |
| 1300 | - bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), |
|
| 1301 | - 'user/login/auth' |
|
| 1300 | + bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), |
|
| 1301 | + 'user/login/auth' |
|
| 1302 | + ) |
|
| 1302 | 1303 | ) |
| 1303 | - ) |
|
| 1304 | 1304 | , NULL, 'boinc:forgot-password'), |
| 1305 | - ), |
|
| 1305 | + ), |
|
| 1306 | 1306 | )); |
| 1307 | 1307 | |
| 1308 | 1308 | if (module_exists('captcha')) { |
| 1309 | - // Add an optional captcha |
|
| 1310 | - $form['register_captcha'] = array( |
|
| 1309 | + // Add an optional captcha |
|
| 1310 | + $form['register_captcha'] = array( |
|
| 1311 | 1311 | '#type' => 'captcha', |
| 1312 | 1312 | '#weight' => 0, |
| 1313 | 1313 | '#prefix' => '<div id="captcha-password-reset">', |
| 1314 | 1314 | '#suffix' => '</div>' |
| 1315 | - ); |
|
| 1315 | + ); |
|
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | // Wrap action buttons for styling consistency |
| 1319 | 1319 | $form['buttons']['form control tabs prefix'] = array( |
| 1320 | - '#value' => '<ul class="form-control tab-list">', |
|
| 1321 | - '#weight' => 1001, |
|
| 1320 | + '#value' => '<ul class="form-control tab-list">', |
|
| 1321 | + '#weight' => 1001, |
|
| 1322 | 1322 | ); |
| 1323 | 1323 | $form['buttons']['submit'] = $form['submit']; |
| 1324 | 1324 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
@@ -1326,26 +1326,26 @@ discard block |
||
| 1326 | 1326 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 1327 | 1327 | $form['buttons']['submit']['#weight'] = 1002; |
| 1328 | 1328 | $form['buttons']['cancel'] = array( |
| 1329 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
| 1330 | - '#weight' => 1005, |
|
| 1329 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
| 1330 | + '#weight' => 1005, |
|
| 1331 | 1331 | ); |
| 1332 | 1332 | $form['buttons']['form control tabs suffix'] = array( |
| 1333 | - '#value' => '</ul>', |
|
| 1334 | - '#weight' => 1010, |
|
| 1333 | + '#value' => '</ul>', |
|
| 1334 | + '#weight' => 1010, |
|
| 1335 | 1335 | ); |
| 1336 | 1336 | unset($form['submit']); |
| 1337 | 1337 | |
| 1338 | 1338 | // If the form is being submitted, use BOINC validation handler. |
| 1339 | 1339 | if (isset($form_state['post']['name'])) { |
| 1340 | - // Prepend the BOINC validation function to local validation |
|
| 1341 | - array_unshift($form['#validate'], 'boincuser_request_pass_validate'); |
|
| 1340 | + // Prepend the BOINC validation function to local validation |
|
| 1341 | + array_unshift($form['#validate'], 'boincuser_request_pass_validate'); |
|
| 1342 | 1342 | } |
| 1343 | 1343 | break; |
| 1344 | 1344 | |
| 1345 | - case 'views_exposed_form': |
|
| 1345 | + case 'views_exposed_form': |
|
| 1346 | 1346 | $form['submit']['#value'] = bts('Search', array(), NULL, 'boinc:search-user'); |
| 1347 | 1347 | break; |
| 1348 | - } |
|
| 1348 | + } |
|
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | /** |
@@ -1353,10 +1353,10 @@ discard block |
||
| 1353 | 1353 | * built; this is called from boincuser_form_alter() |
| 1354 | 1354 | */ |
| 1355 | 1355 | function boincuser_profile_node_form_after_build($form, &$form_state) { |
| 1356 | - // Move to community prefs form |
|
| 1357 | - $form_state['storage']['avatar'] = $form['field_image']; |
|
| 1358 | - unset($form['field_image']); |
|
| 1359 | - return $form; |
|
| 1356 | + // Move to community prefs form |
|
| 1357 | + $form_state['storage']['avatar'] = $form['field_image']; |
|
| 1358 | + unset($form['field_image']); |
|
| 1359 | + return $form; |
|
| 1360 | 1360 | } |
| 1361 | 1361 | |
| 1362 | 1362 | /** |
@@ -1364,8 +1364,8 @@ discard block |
||
| 1364 | 1364 | * @see http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_elements/6 |
| 1365 | 1365 | */ |
| 1366 | 1366 | function boincuser_elements() { |
| 1367 | - $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm'; |
|
| 1368 | - return $type; |
|
| 1367 | + $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm'; |
|
| 1368 | + return $type; |
|
| 1369 | 1369 | } |
| 1370 | 1370 | |
| 1371 | 1371 | /** |
@@ -1373,11 +1373,11 @@ discard block |
||
| 1373 | 1373 | * profile form |
| 1374 | 1374 | */ |
| 1375 | 1375 | function boincuser_process_password_confirm($element) { |
| 1376 | - // Check if parent element is "account". |
|
| 1377 | - if ($element['#array_parents'][0] == 'account') { |
|
| 1376 | + // Check if parent element is "account". |
|
| 1377 | + if ($element['#array_parents'][0] == 'account') { |
|
| 1378 | 1378 | $element['pass1']['#title'] = bts('Change password', array(), NULL, 'boinc:forgot-password'); |
| 1379 | - } |
|
| 1380 | - return $element; |
|
| 1379 | + } |
|
| 1380 | + return $element; |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | 1383 | /** |
@@ -1385,42 +1385,42 @@ discard block |
||
| 1385 | 1385 | * Register theme functions for use in this module. |
| 1386 | 1386 | */ |
| 1387 | 1387 | function boincuser_theme($existing, $type, $theme, $path) { |
| 1388 | - return array( |
|
| 1388 | + return array( |
|
| 1389 | 1389 | 'boincuser_user_pass' => array( |
| 1390 | - 'arguments' => array() |
|
| 1390 | + 'arguments' => array() |
|
| 1391 | 1391 | ) |
| 1392 | - ); |
|
| 1392 | + ); |
|
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | /** |
| 1396 | 1396 | * Implementation of hook_token_values |
| 1397 | 1397 | */ |
| 1398 | 1398 | function boincuser_token_values($type, $object = NULL, $options = array()) { |
| 1399 | - if ($type == 'user') { |
|
| 1399 | + if ($type == 'user') { |
|
| 1400 | 1400 | $account = user_load($object->uid); |
| 1401 | 1401 | $tokens['display-name'] = $account->boincuser_name; |
| 1402 | 1402 | return $tokens; |
| 1403 | - } |
|
| 1403 | + } |
|
| 1404 | 1404 | } |
| 1405 | 1405 | |
| 1406 | 1406 | /** |
| 1407 | 1407 | * Implementation of hook_token_list |
| 1408 | 1408 | */ |
| 1409 | 1409 | function boincuser_token_list($type = 'all') { |
| 1410 | - if ($type == 'user' || $type == 'all') { |
|
| 1410 | + if ($type == 'user' || $type == 'all') { |
|
| 1411 | 1411 | $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
| 1412 | 1412 | return $tokens; |
| 1413 | - } |
|
| 1413 | + } |
|
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | 1416 | /** |
| 1417 | 1417 | * Implementation of hook_views_pre_execute() |
| 1418 | 1418 | */ |
| 1419 | 1419 | function boincuser_views_pre_execute(&$view) { |
| 1420 | - if ($view->args) { |
|
| 1420 | + if ($view->args) { |
|
| 1421 | 1421 | $account_id = $view->args[0]; |
| 1422 | - } |
|
| 1423 | - if ($view->name=="user_activity") { |
|
| 1422 | + } |
|
| 1423 | + if ($view->name=="user_activity") { |
|
| 1424 | 1424 | // Run the following custom query for the user_activity view |
| 1425 | 1425 | $view->build_info['query']= " |
| 1426 | 1426 | SELECT node_revisions.vid AS vid, |
@@ -1452,25 +1452,25 @@ discard block |
||
| 1452 | 1452 | |
| 1453 | 1453 | // count_query determines the pager. Do this so the right item count is returned. |
| 1454 | 1454 | $view->build_info['count_query'] = $view->build_info['query']; |
| 1455 | - } |
|
| 1455 | + } |
|
| 1456 | 1456 | } |
| 1457 | 1457 | |
| 1458 | 1458 | /** |
| 1459 | 1459 | * Implementation of hook_cron() |
| 1460 | 1460 | */ |
| 1461 | 1461 | function boincuser_cron() { |
| 1462 | - // Delete expired users in the BOINC database, user_delete table. |
|
| 1463 | - require_boinc('boinc_db'); |
|
| 1464 | - $num_deleted = BoincUserDeleted::delete_expired(); |
|
| 1465 | - if ($num_deleted>0) { |
|
| 1462 | + // Delete expired users in the BOINC database, user_delete table. |
|
| 1463 | + require_boinc('boinc_db'); |
|
| 1464 | + $num_deleted = BoincUserDeleted::delete_expired(); |
|
| 1465 | + if ($num_deleted>0) { |
|
| 1466 | 1466 | watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
| 1467 | - } |
|
| 1467 | + } |
|
| 1468 | 1468 | |
| 1469 | - // Delete expired tokens from token table |
|
| 1470 | - $tokens_deleted = BoincToken::delete_expired(); |
|
| 1471 | - if ($tokens_deleted>0) { |
|
| 1469 | + // Delete expired tokens from token table |
|
| 1470 | + $tokens_deleted = BoincToken::delete_expired(); |
|
| 1471 | + if ($tokens_deleted>0) { |
|
| 1472 | 1472 | watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
| 1473 | - } |
|
| 1473 | + } |
|
| 1474 | 1474 | } |
| 1475 | 1475 | |
| 1476 | 1476 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -1481,17 +1481,17 @@ discard block |
||
| 1481 | 1481 | * Page callback shortcut to recent posts for the logged in user |
| 1482 | 1482 | */ |
| 1483 | 1483 | function boincuser_goto_recent_posts() { |
| 1484 | - global $user; |
|
| 1485 | - drupal_goto("account/{$user->uid}/posts"); |
|
| 1484 | + global $user; |
|
| 1485 | + drupal_goto("account/{$user->uid}/posts"); |
|
| 1486 | 1486 | } |
| 1487 | 1487 | |
| 1488 | 1488 | /** |
| 1489 | 1489 | * Page callback shortcut to the team of the logged in user |
| 1490 | 1490 | */ |
| 1491 | 1491 | function boincuser_goto_team() { |
| 1492 | - global $user; |
|
| 1493 | - $account = user_load($user->uid); |
|
| 1494 | - drupal_goto("community/teams/{$account->team}"); |
|
| 1492 | + global $user; |
|
| 1493 | + $account = user_load($user->uid); |
|
| 1494 | + drupal_goto("community/teams/{$account->team}"); |
|
| 1495 | 1495 | } |
| 1496 | 1496 | |
| 1497 | 1497 | /** |
@@ -1500,93 +1500,93 @@ discard block |
||
| 1500 | 1500 | * user profile pages, so use a wrapper for display |
| 1501 | 1501 | */ |
| 1502 | 1502 | function boincuser_view_profile($account = null) { |
| 1503 | - // Create the user profile page |
|
| 1504 | - if (!$account) { |
|
| 1503 | + // Create the user profile page |
|
| 1504 | + if (!$account) { |
|
| 1505 | 1505 | global $user; |
| 1506 | 1506 | $account = $user; |
| 1507 | - } |
|
| 1507 | + } |
|
| 1508 | 1508 | |
| 1509 | - $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
|
| 1510 | - $verified_contributor = array_search('verified contributor', user_roles(true)); |
|
| 1511 | - if (!isset($account->roles[$verified_contributor])) { |
|
| 1509 | + $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
|
| 1510 | + $verified_contributor = array_search('verified contributor', user_roles(true)); |
|
| 1511 | + if (!isset($account->roles[$verified_contributor])) { |
|
| 1512 | 1512 | drupal_set_message(bts( |
| 1513 | 1513 | 'You may only create or modify your user profile after earning @count credits.', |
| 1514 | 1514 | array('@count' => $min_credit_to_post), NULL, 'boinc:view-profile' |
| 1515 | 1515 | ), 'warning', FALSE); |
| 1516 | - } |
|
| 1516 | + } |
|
| 1517 | 1517 | |
| 1518 | - // For now, just call the user module profile view function |
|
| 1519 | - user_build_content($account); |
|
| 1520 | - return theme('user_profile', $account); |
|
| 1518 | + // For now, just call the user module profile view function |
|
| 1519 | + user_build_content($account); |
|
| 1520 | + return theme('user_profile', $account); |
|
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | 1523 | /** |
| 1524 | 1524 | * Page callback for editing a user profile |
| 1525 | 1525 | */ |
| 1526 | 1526 | function boincuser_edit_profile($account = null) { |
| 1527 | - // Create the user profile form |
|
| 1528 | - if (!$account) { |
|
| 1527 | + // Create the user profile form |
|
| 1528 | + if (!$account) { |
|
| 1529 | 1529 | global $user; |
| 1530 | 1530 | $account = $user; |
| 1531 | - } |
|
| 1532 | - // Render the form |
|
| 1533 | - module_load_include('pages.inc', 'node', 'node'); |
|
| 1534 | - return content_profile_page_edit('profile', $account); |
|
| 1531 | + } |
|
| 1532 | + // Render the form |
|
| 1533 | + module_load_include('pages.inc', 'node', 'node'); |
|
| 1534 | + return content_profile_page_edit('profile', $account); |
|
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | 1537 | /** |
| 1538 | - * Join page menu callback. |
|
| 1539 | - * Display instructions on joining for new or existing BOINC users |
|
| 1540 | - */ |
|
| 1538 | + * Join page menu callback. |
|
| 1539 | + * Display instructions on joining for new or existing BOINC users |
|
| 1540 | + */ |
|
| 1541 | 1541 | function join_page($type = null) { |
| 1542 | - global $base_url; |
|
| 1543 | - /* The paths/links to the rules-and-policies page is hardcoded |
|
| 1542 | + global $base_url; |
|
| 1543 | + /* The paths/links to the rules-and-policies page is hardcoded |
|
| 1544 | 1544 | * here. An improvement would be admin settings for the Join Page |
| 1545 | 1545 | * where this path could be set. |
| 1546 | 1546 | */ |
| 1547 | - $ruleslinkA = 'rules-and-policies'; |
|
| 1548 | - $ruleslinkB = 'content/rules-and-policies'; |
|
| 1549 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 1550 | - $registration_enabled = variable_get('user_register', 0); |
|
| 1551 | - $output = '<div class="join">'; |
|
| 1552 | - switch ($type) { |
|
| 1553 | - case 'boinc': |
|
| 1547 | + $ruleslinkA = 'rules-and-policies'; |
|
| 1548 | + $ruleslinkB = 'content/rules-and-policies'; |
|
| 1549 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 1550 | + $registration_enabled = variable_get('user_register', 0); |
|
| 1551 | + $output = '<div class="join">'; |
|
| 1552 | + switch ($type) { |
|
| 1553 | + case 'boinc': |
|
| 1554 | 1554 | $output .= '<ol>'; |
| 1555 | 1555 | if ($registration_enabled) { |
| 1556 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
| 1557 | - array( |
|
| 1556 | + $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
| 1557 | + array( |
|
| 1558 | 1558 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
| 1559 | 1559 | '@sitename' => $site_name, |
| 1560 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1560 | + ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1561 | 1561 | } |
| 1562 | 1562 | $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; |
| 1563 | 1563 | $output .= ' <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
| 1564 | 1564 | array( |
| 1565 | - '@sitename' => $site_name, |
|
| 1566 | - '@siteurl' => $base_url, |
|
| 1565 | + '@sitename' => $site_name, |
|
| 1566 | + '@siteurl' => $base_url, |
|
| 1567 | 1567 | ), NULL, 'boinc:join-page') . '</li>'; |
| 1568 | 1568 | if ($registration_enabled) { |
| 1569 | - $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", |
|
| 1569 | + $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", |
|
| 1570 | 1570 | array( |
| 1571 | - '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
|
| 1571 | + '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
|
| 1572 | 1572 | ), NULL, 'boinc:join-page') . '</li>'; |
| 1573 | 1573 | } |
| 1574 | 1574 | else { |
| 1575 | - $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
|
| 1575 | + $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
|
| 1576 | 1576 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.", |
| 1577 | 1577 | array( |
| 1578 | - '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
|
| 1578 | + '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
|
| 1579 | 1579 | ), NULL, 'boinc:join-page') . '</li>'; |
| 1580 | 1580 | } |
| 1581 | 1581 | $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please |
| 1582 | 1582 | upgrade to a more recent version of BOINC to create an account |
| 1583 | 1583 | at @this_project.", |
| 1584 | - array( |
|
| 1584 | + array( |
|
| 1585 | 1585 | '@this_project' => $site_name, |
| 1586 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1586 | + ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1587 | 1587 | $output .= '</ol>'; |
| 1588 | 1588 | break; |
| 1589 | - case 'new': |
|
| 1589 | + case 'new': |
|
| 1590 | 1590 | default: |
| 1591 | 1591 | // Determine if there is a link to rules-and-policies |
| 1592 | 1592 | //$ruleslink=''; |
@@ -1601,95 +1601,95 @@ discard block |
||
| 1601 | 1601 | // Join page output |
| 1602 | 1602 | $output .= '<ol>'; |
| 1603 | 1603 | if ($registration_enabled) { |
| 1604 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
| 1605 | - array( |
|
| 1604 | + $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
| 1605 | + array( |
|
| 1606 | 1606 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
| 1607 | 1607 | '@sitename' => $site_name, |
| 1608 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1608 | + ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1609 | 1609 | } |
| 1610 | 1610 | else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
| 1611 | - $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
|
| 1611 | + $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
|
| 1612 | 1612 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
| 1613 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1613 | + ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1614 | 1614 | } |
| 1615 | 1615 | $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
| 1616 | 1616 | $output .= ' <p>'; |
| 1617 | 1617 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>'; |
| 1618 | 1618 | $output .= ' </p>'; |
| 1619 | 1619 | $output .= ' ' . bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( |
| 1620 | - '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>', |
|
| 1621 | - '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>', |
|
| 1620 | + '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>', |
|
| 1621 | + '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>', |
|
| 1622 | 1622 | ), NULL, 'boinc:join-page'); |
| 1623 | 1623 | $output .= ' </li>'; |
| 1624 | 1624 | $output .= ' <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; |
| 1625 | 1625 | $output .= ' <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( |
| 1626 | - '@sitename' => $site_name, |
|
| 1627 | - '@siteurl' => $base_url, |
|
| 1626 | + '@sitename' => $site_name, |
|
| 1627 | + '@siteurl' => $base_url, |
|
| 1628 | 1628 | ), NULL, 'boinc:join-page') . '</li>'; |
| 1629 | 1629 | $output .= '</ol>'; |
| 1630 | - } |
|
| 1631 | - $output .= '</div>'; |
|
| 1632 | - return $output; |
|
| 1630 | + } |
|
| 1631 | + $output .= '</div>'; |
|
| 1632 | + return $output; |
|
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | 1635 | /** |
| 1636 | - * Home page content for embedding in Panels page |
|
| 1637 | - */ |
|
| 1636 | + * Home page content for embedding in Panels page |
|
| 1637 | + */ |
|
| 1638 | 1638 | function boincuser_home_page() { |
| 1639 | - global $user; |
|
| 1640 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 1641 | - // get the front page message from database; this is set in the admin interface under BOINC Other |
|
| 1642 | - $site_message = variable_get('boinc_other_frontpage',''); |
|
| 1639 | + global $user; |
|
| 1640 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 1641 | + // get the front page message from database; this is set in the admin interface under BOINC Other |
|
| 1642 | + $site_message = variable_get('boinc_other_frontpage',''); |
|
| 1643 | 1643 | |
| 1644 | - // Determine the user of the day |
|
| 1645 | - $current_uotd = db_fetch_object(db_query(" |
|
| 1644 | + // Determine the user of the day |
|
| 1645 | + $current_uotd = db_fetch_object(db_query(" |
|
| 1646 | 1646 | SELECT |
| 1647 | 1647 | uid, |
| 1648 | 1648 | uotd_time |
| 1649 | 1649 | FROM {boincuser} |
| 1650 | 1650 | ORDER BY uotd_time DESC |
| 1651 | 1651 | LIMIT 1" |
| 1652 | - )); |
|
| 1653 | - if ($current_uotd->uotd_time < strtotime('today midnight')) { |
|
| 1652 | + )); |
|
| 1653 | + if ($current_uotd->uotd_time < strtotime('today midnight')) { |
|
| 1654 | 1654 | $uotd = boincuser_select_user_of_the_day(); |
| 1655 | - } |
|
| 1656 | - else { |
|
| 1655 | + } |
|
| 1656 | + else { |
|
| 1657 | 1657 | $uotd = user_load($current_uotd->uid); |
| 1658 | - } |
|
| 1659 | - $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
|
| 1660 | - $output = '<h2 class="pane-title">'; |
|
| 1661 | - $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); |
|
| 1662 | - $output .= '</h2>'; |
|
| 1663 | - $output .= '<div class="boinc-overview balance-height-front">'; |
|
| 1664 | - $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
| 1665 | - if ($user->uid) { |
|
| 1658 | + } |
|
| 1659 | + $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
|
| 1660 | + $output = '<h2 class="pane-title">'; |
|
| 1661 | + $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); |
|
| 1662 | + $output .= '</h2>'; |
|
| 1663 | + $output .= '<div class="boinc-overview balance-height-front">'; |
|
| 1664 | + $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
| 1665 | + if ($user->uid) { |
|
| 1666 | 1666 | $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
| 1667 | - } |
|
| 1668 | - else { |
|
| 1667 | + } |
|
| 1668 | + else { |
|
| 1669 | 1669 | $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
| 1670 | - } |
|
| 1671 | - $output .= '</div>'; |
|
| 1672 | - $output .= '<div class="boinc-overview-details">'; |
|
| 1673 | - $output .= ' <div class="detail-container">'; |
|
| 1674 | - $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
|
| 1675 | - $output .= ' <div class="picture">'; |
|
| 1676 | - $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
|
| 1670 | + } |
|
| 1671 | + $output .= '</div>'; |
|
| 1672 | + $output .= '<div class="boinc-overview-details">'; |
|
| 1673 | + $output .= ' <div class="detail-container">'; |
|
| 1674 | + $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
|
| 1675 | + $output .= ' <div class="picture">'; |
|
| 1676 | + $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
|
| 1677 | 1677 | $uotd_image['alt'], array(), FALSE); |
| 1678 | - $output .= ' </div>'; |
|
| 1679 | - $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1680 | - $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
|
| 1681 | - $output .= ' </a>'; |
|
| 1682 | - $output .= ' <div class="volunteers">'; |
|
| 1683 | - $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1684 | - $output .= ' <div class="platforms">'; |
|
| 1685 | - $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1686 | - $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1687 | - $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1688 | - $output .= ' </div>'; |
|
| 1689 | - $output .= ' </div>'; |
|
| 1690 | - $output .= ' </div>'; |
|
| 1691 | - $output .= '</div>'; |
|
| 1692 | - return $output; |
|
| 1678 | + $output .= ' </div>'; |
|
| 1679 | + $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1680 | + $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
|
| 1681 | + $output .= ' </a>'; |
|
| 1682 | + $output .= ' <div class="volunteers">'; |
|
| 1683 | + $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1684 | + $output .= ' <div class="platforms">'; |
|
| 1685 | + $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1686 | + $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1687 | + $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1688 | + $output .= ' </div>'; |
|
| 1689 | + $output .= ' </div>'; |
|
| 1690 | + $output .= ' </div>'; |
|
| 1691 | + $output .= '</div>'; |
|
| 1692 | + return $output; |
|
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | 1695 | /** |
@@ -1697,81 +1697,81 @@ discard block |
||
| 1697 | 1697 | * Create a new user account based on supplied parameters. |
| 1698 | 1698 | */ |
| 1699 | 1699 | function boincuser_create_account() { |
| 1700 | - global $base_url; |
|
| 1700 | + global $base_url; |
|
| 1701 | 1701 | |
| 1702 | - require_boinc('boinc_db'); |
|
| 1703 | - require_boinc('user_util'); |
|
| 1704 | - require_boinc('xml'); |
|
| 1705 | - $params = array( |
|
| 1702 | + require_boinc('boinc_db'); |
|
| 1703 | + require_boinc('user_util'); |
|
| 1704 | + require_boinc('xml'); |
|
| 1705 | + $params = array( |
|
| 1706 | 1706 | 'email_addr' => isset($_GET['email_addr']) ? $_GET['email_addr'] : '', |
| 1707 | 1707 | 'user_name' => isset($_GET['user_name']) ? $_GET['user_name'] : '', |
| 1708 | 1708 | 'passwd_hash' => isset($_GET['passwd_hash']) ? $_GET['passwd_hash'] : '' |
| 1709 | - ); |
|
| 1709 | + ); |
|
| 1710 | 1710 | |
| 1711 | - // Begin output |
|
| 1712 | - xml_header(); |
|
| 1711 | + // Begin output |
|
| 1712 | + xml_header(); |
|
| 1713 | 1713 | |
| 1714 | - // Account creation disabled |
|
| 1715 | - $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
|
| 1716 | - if (!$enablethisRPC) { |
|
| 1714 | + // Account creation disabled |
|
| 1715 | + $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
|
| 1716 | + if (!$enablethisRPC) { |
|
| 1717 | 1717 | $mess = bts('Account creation is done through our Web site. Please register at @url', array( |
| 1718 | - '@url' => $base_url . '/user/registration', |
|
| 1718 | + '@url' => $base_url . '/user/registration', |
|
| 1719 | 1719 | ), |
| 1720 | 1720 | NULL, 'boinc:create_account'); |
| 1721 | 1721 | xml_error(-208, $mess); |
| 1722 | - } |
|
| 1723 | - // Invalid invite code |
|
| 1722 | + } |
|
| 1723 | + // Invalid invite code |
|
| 1724 | 1724 | |
| 1725 | - // Validate input |
|
| 1726 | - if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) { |
|
| 1725 | + // Validate input |
|
| 1726 | + if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) { |
|
| 1727 | 1727 | xml_error(-205); |
| 1728 | - } |
|
| 1728 | + } |
|
| 1729 | 1729 | |
| 1730 | - // Make sure user_name is unique and cleaned |
|
| 1731 | - $unique_name = create_proper_drupalname($params['user_name']); |
|
| 1732 | - if ($error = user_validate_name($unique_name)) { |
|
| 1730 | + // Make sure user_name is unique and cleaned |
|
| 1731 | + $unique_name = create_proper_drupalname($params['user_name']); |
|
| 1732 | + if ($error = user_validate_name($unique_name)) { |
|
| 1733 | 1733 | xml_error(-188, $error); |
| 1734 | - } |
|
| 1735 | - if (strlen($params['passwd_hash']) != 32) { |
|
| 1734 | + } |
|
| 1735 | + if (strlen($params['passwd_hash']) != 32) { |
|
| 1736 | 1736 | xml_error(-1, 'password hash length not 32'); |
| 1737 | - } |
|
| 1737 | + } |
|
| 1738 | 1738 | |
| 1739 | - // Process input |
|
| 1740 | - // Check this email against previous email addresses. |
|
| 1741 | - $tmpuser = BoincUser::lookup_prev_email_addr($params['email_addr']); |
|
| 1742 | - if ($tmpuser) { |
|
| 1739 | + // Process input |
|
| 1740 | + // Check this email against previous email addresses. |
|
| 1741 | + $tmpuser = BoincUser::lookup_prev_email_addr($params['email_addr']); |
|
| 1742 | + if ($tmpuser) { |
|
| 1743 | 1743 | xml_error(-137); |
| 1744 | - } |
|
| 1744 | + } |
|
| 1745 | 1745 | |
| 1746 | - // Check this email on current email addresses. |
|
| 1747 | - $boinc_user = BoincUser::lookup_email_addr($params['email_addr']); |
|
| 1748 | - if ($boinc_user) { |
|
| 1746 | + // Check this email on current email addresses. |
|
| 1747 | + $boinc_user = BoincUser::lookup_email_addr($params['email_addr']); |
|
| 1748 | + if ($boinc_user) { |
|
| 1749 | 1749 | // Return authenticator for existing users |
| 1750 | 1750 | if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
| 1751 | 1751 | password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
| 1752 | - $output = array('authenticator' => $boinc_user->authenticator); |
|
| 1752 | + $output = array('authenticator' => $boinc_user->authenticator); |
|
| 1753 | 1753 | } |
| 1754 | 1754 | else { |
| 1755 | - xml_error(-137); |
|
| 1755 | + xml_error(-137); |
|
| 1756 | 1756 | } |
| 1757 | - } |
|
| 1758 | - else { |
|
| 1757 | + } |
|
| 1758 | + else { |
|
| 1759 | 1759 | // Verify that there isn't somehow a Drupal user already (not possible with proper function) |
| 1760 | 1760 | if ($existing_user = user_load(array('mail' => $params['email_addr']))) { |
| 1761 | - xml_error(-137, 'account error'); |
|
| 1761 | + xml_error(-137, 'account error'); |
|
| 1762 | 1762 | } |
| 1763 | 1763 | // Create new account |
| 1764 | 1764 | $unrestricted_role = array_search('community member', user_roles(true)); |
| 1765 | 1765 | |
| 1766 | 1766 | $newUser = array( |
| 1767 | - 'name' => $unique_name, |
|
| 1768 | - 'pass' => $params['passwd_hash'], // note: passing a hash here requires ALL passwords to be hashed via hook prior to interacting with the hash stored in the db |
|
| 1769 | - 'mail' => $params['email_addr'], |
|
| 1770 | - 'status' => 1, |
|
| 1771 | - 'init' => $params['email_addr'], |
|
| 1772 | - 'roles' => array($unrestricted_role => ''), |
|
| 1773 | - 'boincuser_name' => $params['user_name'], |
|
| 1774 | - 'boinchash_flag' => TRUE, |
|
| 1767 | + 'name' => $unique_name, |
|
| 1768 | + 'pass' => $params['passwd_hash'], // note: passing a hash here requires ALL passwords to be hashed via hook prior to interacting with the hash stored in the db |
|
| 1769 | + 'mail' => $params['email_addr'], |
|
| 1770 | + 'status' => 1, |
|
| 1771 | + 'init' => $params['email_addr'], |
|
| 1772 | + 'roles' => array($unrestricted_role => ''), |
|
| 1773 | + 'boincuser_name' => $params['user_name'], |
|
| 1774 | + 'boinchash_flag' => TRUE, |
|
| 1775 | 1775 | ); |
| 1776 | 1776 | |
| 1777 | 1777 | // Create the drupal user. If the drupal user cannot be created, |
@@ -1779,17 +1779,17 @@ discard block |
||
| 1779 | 1779 | // The user is created in the 'insert' op in hook_user. |
| 1780 | 1780 | $user = user_save(null, $newUser); |
| 1781 | 1781 | if (!$user) { |
| 1782 | - watchdog('boincuser', 'create_account: Failed to create Drupal user account for @email', array('@email' => $params['email_addr']), WATCHDOG_WARNING); |
|
| 1783 | - xml_error(-137, 'error creating BOINC account'); |
|
| 1782 | + watchdog('boincuser', 'create_account: Failed to create Drupal user account for @email', array('@email' => $params['email_addr']), WATCHDOG_WARNING); |
|
| 1783 | + xml_error(-137, 'error creating BOINC account'); |
|
| 1784 | 1784 | }// if drupal user created. |
| 1785 | 1785 | |
| 1786 | 1786 | $output = array('authenticator' => $user->boincuser_account_key); |
| 1787 | - }// if existing user found. |
|
| 1787 | + }// if existing user found. |
|
| 1788 | 1788 | |
| 1789 | - // Output authenticator |
|
| 1790 | - echo " <account_out>\n"; |
|
| 1791 | - echo " <authenticator>{$output['authenticator']}</authenticator>\n"; |
|
| 1792 | - echo "</account_out>\n"; |
|
| 1789 | + // Output authenticator |
|
| 1790 | + echo " <account_out>\n"; |
|
| 1791 | + echo " <authenticator>{$output['authenticator']}</authenticator>\n"; |
|
| 1792 | + echo "</account_out>\n"; |
|
| 1793 | 1793 | } |
| 1794 | 1794 | |
| 1795 | 1795 | /** |
@@ -1797,166 +1797,166 @@ discard block |
||
| 1797 | 1797 | * account is created using the BOINC clinet. |
| 1798 | 1798 | */ |
| 1799 | 1799 | function boincuser_account_finish() { |
| 1800 | - global $user; |
|
| 1800 | + global $user; |
|
| 1801 | 1801 | |
| 1802 | - $authtoken = isset($_GET['auth']) ? $_GET['auth'] : ''; |
|
| 1802 | + $authtoken = isset($_GET['auth']) ? $_GET['auth'] : ''; |
|
| 1803 | 1803 | |
| 1804 | - // Ensure there is a authentication token before continuing |
|
| 1805 | - if (empty($authtoken)) { |
|
| 1804 | + // Ensure there is a authentication token before continuing |
|
| 1805 | + if (empty($authtoken)) { |
|
| 1806 | 1806 | drupal_not_found(); |
| 1807 | 1807 | return ; |
| 1808 | - } |
|
| 1808 | + } |
|
| 1809 | 1809 | |
| 1810 | - if (strlen($authtoken) != 32) { |
|
| 1810 | + if (strlen($authtoken) != 32) { |
|
| 1811 | 1811 | drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); |
| 1812 | 1812 | drupal_goto(); |
| 1813 | - } |
|
| 1813 | + } |
|
| 1814 | 1814 | |
| 1815 | - require_boinc('boinc_db'); |
|
| 1816 | - $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); |
|
| 1817 | - if (!$boinc_user) { |
|
| 1815 | + require_boinc('boinc_db'); |
|
| 1816 | + $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); |
|
| 1817 | + if (!$boinc_user) { |
|
| 1818 | 1818 | drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); |
| 1819 | 1819 | drupal_goto(); |
| 1820 | - } |
|
| 1821 | - $user = user_load(get_drupal_id($boinc_user->id)); |
|
| 1820 | + } |
|
| 1821 | + $user = user_load(get_drupal_id($boinc_user->id)); |
|
| 1822 | 1822 | |
| 1823 | - if (!$user) { |
|
| 1823 | + if (!$user) { |
|
| 1824 | 1824 | drupal_set_message(bts('ERROR: There was a problem loading your account. Try logging in with your user name and password.', array(), NULL, 'boinc:account-finish'), 'error'); |
| 1825 | 1825 | drupal_goto(); |
| 1826 | - } |
|
| 1826 | + } |
|
| 1827 | 1827 | |
| 1828 | - // Lookup path to custom account finish page |
|
| 1829 | - $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); |
|
| 1830 | - if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { |
|
| 1828 | + // Lookup path to custom account finish page |
|
| 1829 | + $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); |
|
| 1830 | + if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { |
|
| 1831 | 1831 | $node = menu_get_object('node', 1, $customaccountfinishpath); |
| 1832 | 1832 | if ($node) { |
| 1833 | - return node_page_view($node); |
|
| 1833 | + return node_page_view($node); |
|
| 1834 | + } |
|
| 1834 | 1835 | } |
| 1835 | - } |
|
| 1836 | 1836 | |
| 1837 | - // open links in new window |
|
| 1838 | - $options = array( |
|
| 1837 | + // open links in new window |
|
| 1838 | + $options = array( |
|
| 1839 | 1839 | 'attributes' => array( 'target' => '_blank' ), |
| 1840 | - ); |
|
| 1840 | + ); |
|
| 1841 | 1841 | |
| 1842 | - // Check moderation page exists |
|
| 1843 | - $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
|
| 1844 | - if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
|
| 1842 | + // Check moderation page exists |
|
| 1843 | + $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
|
| 1844 | + if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
|
| 1845 | 1845 | $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish'); |
| 1846 | - } else { |
|
| 1846 | + } else { |
|
| 1847 | 1847 | $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); |
| 1848 | - } |
|
| 1848 | + } |
|
| 1849 | 1849 | |
| 1850 | - $username = $user->boincuser_name; |
|
| 1851 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 1852 | - $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', |
|
| 1853 | - array( |
|
| 1850 | + $username = $user->boincuser_name; |
|
| 1851 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 1852 | + $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', |
|
| 1853 | + array( |
|
| 1854 | 1854 | '@user_name' => $username, |
| 1855 | 1855 | '@site_name' => $site_name, |
| 1856 | - ), NULL, 'boinc:account-finish') . "</p>"; |
|
| 1856 | + ), NULL, 'boinc:account-finish') . "</p>"; |
|
| 1857 | 1857 | |
| 1858 | - $links = array( |
|
| 1858 | + $links = array( |
|
| 1859 | 1859 | array( |
| 1860 | - 'data' => bts('Change your username at !community_preferences.', array( |
|
| 1860 | + 'data' => bts('Change your username at !community_preferences.', array( |
|
| 1861 | 1861 | '!community_preferences' => l(bts('Community Preferences', array(), NULL, 'boinc:account-fininsh'), 'account/prefs/community', $options), |
| 1862 | - ), NULL, 'boinc:account-finish'), |
|
| 1863 | - 'children' => array( |
|
| 1862 | + ), NULL, 'boinc:account-finish'), |
|
| 1863 | + 'children' => array( |
|
| 1864 | 1864 | bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), NULL, 'boinc:account-finish'), |
| 1865 | 1865 | bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), NULL, 'boinc:account-finish'), |
| 1866 | - ), |
|
| 1866 | + ), |
|
| 1867 | 1867 | ), |
| 1868 | 1868 | array( |
| 1869 | - 'data' => bts('Change your !computing_preferences.', array( |
|
| 1869 | + 'data' => bts('Change your !computing_preferences.', array( |
|
| 1870 | 1870 | '!computing_preferences' => l(bts('Computing Preferences', array(), NULL, 'boinc:account-finish'), 'account/prefs', $options), |
| 1871 | - ), NULL, 'boinc:account-finish'), |
|
| 1872 | - 'children' => array( |
|
| 1871 | + ), NULL, 'boinc:account-finish'), |
|
| 1872 | + 'children' => array( |
|
| 1873 | 1873 | bts('You may adjust how much CPU, RAM, and Disk space the BOINC client is allowed to use for tasks on your computer.', array(), NULL, 'boinc:account-finish'), |
| 1874 | 1874 | bts('By default, you will run @site_name tasks without any additional configuration.', array( |
| 1875 | - '@site_name' => $site_name, |
|
| 1875 | + '@site_name' => $site_name, |
|
| 1876 | 1876 | ), NULL, 'boinc:account-finish'), |
| 1877 | 1877 | bts('It is recommended new volunteers leave the default settings until they gain experience running some tasks. Ask questions in the !forums to get advice before making changes to a setting you don\'t understand.', array( |
| 1878 | - '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), |
|
| 1878 | + '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), |
|
| 1879 | 1879 | ), NULL, 'boinc:account-finish'), |
| 1880 | - ), |
|
| 1880 | + ), |
|
| 1881 | 1881 | ), |
| 1882 | 1882 | array( |
| 1883 | 1883 | 'data' => bts('Create a !user_profile.', array( |
| 1884 | - '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), |
|
| 1884 | + '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), |
|
| 1885 | 1885 | ), NULL, 'boinc:account-finish'), |
| 1886 | - 'children' => array( |
|
| 1886 | + 'children' => array( |
|
| 1887 | 1887 | bts('A user profile will inform other volunteers who you are and why you joined @site_name.', array( |
| 1888 | - '@site_name' => $site_name, |
|
| 1888 | + '@site_name' => $site_name, |
|
| 1889 | 1889 | ), NULL, 'boinc:account-finish'), |
| 1890 | 1890 | $modsentence, |
| 1891 | - ), |
|
| 1891 | + ), |
|
| 1892 | 1892 | ), |
| 1893 | 1893 | array( |
| 1894 | - 'data' => bts('Join a !team.', array( |
|
| 1894 | + 'data' => bts('Join a !team.', array( |
|
| 1895 | 1895 | '!team' => l(bts('Team', array(), NULL, 'boinc:account-finish'), '/community/teams', $options), |
| 1896 | - ), NULL, 'boinc:account-finish'), |
|
| 1897 | - 'children' => array( |
|
| 1896 | + ), NULL, 'boinc:account-finish'), |
|
| 1897 | + 'children' => array( |
|
| 1898 | 1898 | bts('You may join a team, made up of other volunteers.', array(), NULL, 'boinc:account-finish'), |
| 1899 | - ), |
|
| 1899 | + ), |
|
| 1900 | 1900 | ), |
| 1901 | 1901 | array( |
| 1902 | - 'data' => bts('Go to your !account_dashboard.', array( |
|
| 1902 | + 'data' => bts('Go to your !account_dashboard.', array( |
|
| 1903 | 1903 | '!account_dashboard'=> l(bts('Account Dashboard', array(), NULL, 'boinc:account-finish'), 'account/dashboard', $options), |
| 1904 | - ), NULL, 'boinc:account-finish'), |
|
| 1905 | - 'children' => array( |
|
| 1904 | + ), NULL, 'boinc:account-finish'), |
|
| 1905 | + 'children' => array( |
|
| 1906 | 1906 | bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), NULL, 'boinc:account-finish'), |
| 1907 | - ), |
|
| 1907 | + ), |
|
| 1908 | 1908 | ), |
| 1909 | 1909 | array( |
| 1910 | - 'data' => bts('Visit our !help pages.', array( |
|
| 1910 | + 'data' => bts('Visit our !help pages.', array( |
|
| 1911 | 1911 | '!help' => l(bts('Help', array(), NULL, 'boinc:account-finish'), '/help', $options) |
| 1912 | - ), NULL, 'boinc:account-finish'), |
|
| 1913 | - 'children' => array( |
|
| 1912 | + ), NULL, 'boinc:account-finish'), |
|
| 1913 | + 'children' => array( |
|
| 1914 | 1914 | bts('Ask for help in our community\'s !forums.', array( |
| 1915 | - '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) |
|
| 1915 | + '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) |
|
| 1916 | 1916 | ), NULL, 'boinc:account-finish'), |
| 1917 | - ), |
|
| 1917 | + ), |
|
| 1918 | 1918 | ), |
| 1919 | - ); |
|
| 1919 | + ); |
|
| 1920 | 1920 | |
| 1921 | - //List of links |
|
| 1922 | - $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
| 1921 | + //List of links |
|
| 1922 | + $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
| 1923 | 1923 | |
| 1924 | - return $output; |
|
| 1924 | + return $output; |
|
| 1925 | 1925 | } |
| 1926 | 1926 | |
| 1927 | 1927 | /** |
| 1928 | 1928 | * Determine if the user has permission to control community access |
| 1929 | 1929 | */ |
| 1930 | 1930 | function boincuser_moderate_community_access() { |
| 1931 | - if (user_access('assign community member role') |
|
| 1931 | + if (user_access('assign community member role') |
|
| 1932 | 1932 | OR user_access('assign all roles')) { |
| 1933 | 1933 | return TRUE; |
| 1934 | - } |
|
| 1935 | - return FALSE; |
|
| 1934 | + } |
|
| 1935 | + return FALSE; |
|
| 1936 | 1936 | } |
| 1937 | 1937 | |
| 1938 | 1938 | /** |
| 1939 | 1939 | * Get the count of items in the moderation queue |
| 1940 | 1940 | */ |
| 1941 | 1941 | function boincuser_moderation_queue_count($caller = 'user') { |
| 1942 | - $allowed = FALSE; |
|
| 1943 | - switch ($caller) { |
|
| 1944 | - case 'cron': |
|
| 1942 | + $allowed = FALSE; |
|
| 1943 | + switch ($caller) { |
|
| 1944 | + case 'cron': |
|
| 1945 | 1945 | $allowed = TRUE; |
| 1946 | 1946 | break; |
| 1947 | - case 'user': |
|
| 1947 | + case 'user': |
|
| 1948 | 1948 | default: |
| 1949 | 1949 | $allowed = user_access('edit any profile content'); |
| 1950 | - } |
|
| 1951 | - if ($allowed) { |
|
| 1950 | + } |
|
| 1951 | + if ($allowed) { |
|
| 1952 | 1952 | return db_result(db_query(" |
| 1953 | 1953 | SELECT COUNT(*) |
| 1954 | 1954 | FROM {node} |
| 1955 | 1955 | WHERE type = 'profile' |
| 1956 | 1956 | AND moderate = 1" |
| 1957 | 1957 | )); |
| 1958 | - } |
|
| 1959 | - return NULL; |
|
| 1958 | + } |
|
| 1959 | + return NULL; |
|
| 1960 | 1960 | } |
| 1961 | 1961 | |
| 1962 | 1962 | /** |
@@ -1965,43 +1965,43 @@ discard block |
||
| 1965 | 1965 | * than through the user account info form. |
| 1966 | 1966 | */ |
| 1967 | 1967 | function boincuser_control($uid = NULL, $action = NULL) { |
| 1968 | - if (!$uid OR !$account = user_load($uid)) { |
|
| 1968 | + if (!$uid OR !$account = user_load($uid)) { |
|
| 1969 | 1969 | // What are you even doing here... |
| 1970 | 1970 | return FALSE; |
| 1971 | - } |
|
| 1972 | - switch ($action) { |
|
| 1973 | - case 'ban': |
|
| 1971 | + } |
|
| 1972 | + switch ($action) { |
|
| 1973 | + case 'ban': |
|
| 1974 | 1974 | if (boincuser_moderate_community_access()) { |
| 1975 | - $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60); |
|
| 1976 | - $boincuser_record = array( |
|
| 1975 | + $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60); |
|
| 1976 | + $boincuser_record = array( |
|
| 1977 | 1977 | 'uid' => $uid, |
| 1978 | 1978 | 'penalty_expiration' => time() + $penalty_period, |
| 1979 | - ); |
|
| 1980 | - drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
| 1981 | - $community_role = array_search('community member', user_roles(true)); |
|
| 1982 | - if (isset($account->roles[$community_role])) { |
|
| 1979 | + ); |
|
| 1980 | + drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
| 1981 | + $community_role = array_search('community member', user_roles(true)); |
|
| 1982 | + if (isset($account->roles[$community_role])) { |
|
| 1983 | 1983 | unset($account->roles[$community_role]); |
| 1984 | 1984 | user_save($account, array('roles' => $account->roles)); |
| 1985 | - } |
|
| 1985 | + } |
|
| 1986 | 1986 | } |
| 1987 | 1987 | break; |
| 1988 | - case 'lift-ban': |
|
| 1988 | + case 'lift-ban': |
|
| 1989 | 1989 | if (boincuser_moderate_community_access()) { |
| 1990 | - $boincuser_record = array( |
|
| 1990 | + $boincuser_record = array( |
|
| 1991 | 1991 | 'uid' => $uid, |
| 1992 | 1992 | 'penalty_expiration' => 0, |
| 1993 | - ); |
|
| 1994 | - drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
| 1995 | - $community_role = array_search('community member', user_roles(true)); |
|
| 1996 | - if (!isset($account->roles[$community_role])) { |
|
| 1993 | + ); |
|
| 1994 | + drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
| 1995 | + $community_role = array_search('community member', user_roles(true)); |
|
| 1996 | + if (!isset($account->roles[$community_role])) { |
|
| 1997 | 1997 | $account->roles[$community_role] = 'community member'; |
| 1998 | 1998 | user_save($account, array('roles' => $account->roles)); |
| 1999 | - } |
|
| 1999 | + } |
|
| 2000 | 2000 | } |
| 2001 | 2001 | break; |
| 2002 | - default: |
|
| 2002 | + default: |
|
| 2003 | 2003 | } |
| 2004 | - drupal_goto("account/{$account->uid}"); |
|
| 2004 | + drupal_goto("account/{$account->uid}"); |
|
| 2005 | 2005 | } |
| 2006 | 2006 | |
| 2007 | 2007 | /** |
@@ -2009,29 +2009,29 @@ discard block |
||
| 2009 | 2009 | * moderation flag. |
| 2010 | 2010 | */ |
| 2011 | 2011 | function boincuser_moderate_profile_approve($account) { |
| 2012 | - $node = new stdClass; |
|
| 2013 | - $node->type = 'profile'; |
|
| 2014 | - $node->language = ''; |
|
| 2015 | - $nid = content_profile_profile_exists($node, $account->uid); |
|
| 2016 | - $profile = node_load($nid); |
|
| 2017 | - $profile->moderate = 0; |
|
| 2018 | - $profile->status = 1; |
|
| 2019 | - node_save($profile); |
|
| 2020 | - drupal_set_message('This profile has been marked as approved.'); |
|
| 2021 | - drupal_goto(); |
|
| 2012 | + $node = new stdClass; |
|
| 2013 | + $node->type = 'profile'; |
|
| 2014 | + $node->language = ''; |
|
| 2015 | + $nid = content_profile_profile_exists($node, $account->uid); |
|
| 2016 | + $profile = node_load($nid); |
|
| 2017 | + $profile->moderate = 0; |
|
| 2018 | + $profile->status = 1; |
|
| 2019 | + node_save($profile); |
|
| 2020 | + drupal_set_message('This profile has been marked as approved.'); |
|
| 2021 | + drupal_goto(); |
|
| 2022 | 2022 | } |
| 2023 | 2023 | |
| 2024 | 2024 | /** |
| 2025 | 2025 | * Mark a user profile as rejected and notify the user of the reason. |
| 2026 | 2026 | */ |
| 2027 | 2027 | function boincuser_moderate_profile_reject($uid, $reason = '') { |
| 2028 | - $account = user_load($uid); |
|
| 2029 | - $node = new stdClass; |
|
| 2030 | - $node->type = 'profile'; |
|
| 2031 | - $node->language = ''; |
|
| 2032 | - $nid = content_profile_profile_exists($node, $uid); |
|
| 2033 | - $profile = node_load($nid); |
|
| 2034 | - if ($profile->nid) { |
|
| 2028 | + $account = user_load($uid); |
|
| 2029 | + $node = new stdClass; |
|
| 2030 | + $node->type = 'profile'; |
|
| 2031 | + $node->language = ''; |
|
| 2032 | + $nid = content_profile_profile_exists($node, $uid); |
|
| 2033 | + $profile = node_load($nid); |
|
| 2034 | + if ($profile->nid) { |
|
| 2035 | 2035 | global $user; |
| 2036 | 2036 | global $base_url; |
| 2037 | 2037 | global $base_path; |
@@ -2042,64 +2042,64 @@ discard block |
||
| 2042 | 2042 | $profile->status = 0; |
| 2043 | 2043 | node_save($profile); |
| 2044 | 2044 | $settings = array( |
| 2045 | - 'from' => '', |
|
| 2046 | - 'subject' => "Profile moderation at {$site_name}", |
|
| 2047 | - 'message' => '' |
|
| 2048 | - . "{$account->boincuser_name},\n" |
|
| 2049 | - . "\n" |
|
| 2050 | - . "{$moderator->boincuser_name} has rejected your profile at" |
|
| 2051 | - . " {$site_name} for the following reason: \n" |
|
| 2052 | - . "\n" |
|
| 2053 | - . "{$reason}\n" |
|
| 2054 | - . "\n" |
|
| 2055 | - . "\n" |
|
| 2056 | - . "Since it has not been approved, your profile is not visible to other" |
|
| 2057 | - . " {$site_name} users. Please make the needed changes here:\n" |
|
| 2058 | - . "\n" |
|
| 2059 | - . "{$site_url}account/profile \n" |
|
| 2060 | - . "\n" |
|
| 2061 | - . "Thanks, \n" |
|
| 2062 | - . "\n" |
|
| 2063 | - . "{$site_name} support team", |
|
| 2045 | + 'from' => '', |
|
| 2046 | + 'subject' => "Profile moderation at {$site_name}", |
|
| 2047 | + 'message' => '' |
|
| 2048 | + . "{$account->boincuser_name},\n" |
|
| 2049 | + . "\n" |
|
| 2050 | + . "{$moderator->boincuser_name} has rejected your profile at" |
|
| 2051 | + . " {$site_name} for the following reason: \n" |
|
| 2052 | + . "\n" |
|
| 2053 | + . "{$reason}\n" |
|
| 2054 | + . "\n" |
|
| 2055 | + . "\n" |
|
| 2056 | + . "Since it has not been approved, your profile is not visible to other" |
|
| 2057 | + . " {$site_name} users. Please make the needed changes here:\n" |
|
| 2058 | + . "\n" |
|
| 2059 | + . "{$site_url}account/profile \n" |
|
| 2060 | + . "\n" |
|
| 2061 | + . "Thanks, \n" |
|
| 2062 | + . "\n" |
|
| 2063 | + . "{$site_name} support team", |
|
| 2064 | 2064 | ); |
| 2065 | 2065 | rules_action_mail_to_user($account, $settings); |
| 2066 | 2066 | drupal_set_message('This profile has been marked as rejected.'); |
| 2067 | - } |
|
| 2068 | - drupal_goto(); |
|
| 2067 | + } |
|
| 2068 | + drupal_goto(); |
|
| 2069 | 2069 | } |
| 2070 | 2070 | |
| 2071 | 2071 | /** |
| 2072 | 2072 | * Ban a user and send a notification of the reason. |
| 2073 | 2073 | */ |
| 2074 | 2074 | function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') { |
| 2075 | - if (user_access('assign community member role') |
|
| 2075 | + if (user_access('assign community member role') |
|
| 2076 | 2076 | OR user_access('assign all roles')) { |
| 2077 | 2077 | $account = user_load($uid); |
| 2078 | 2078 | if ($account->uid) { |
| 2079 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
| 2080 | - if ($duration === '') { |
|
| 2079 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
| 2080 | + if ($duration === '') { |
|
| 2081 | 2081 | $duration = variable_get('boinc_penalty_period', 7*24*60*60); |
| 2082 | - } |
|
| 2083 | - $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295; |
|
| 2084 | - $boincuser_record = array( |
|
| 2082 | + } |
|
| 2083 | + $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295; |
|
| 2084 | + $boincuser_record = array( |
|
| 2085 | 2085 | 'uid' => $uid, |
| 2086 | 2086 | 'penalty_expiration' => $penalty_expiration, |
| 2087 | - ); |
|
| 2088 | - drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
| 2087 | + ); |
|
| 2088 | + drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
| 2089 | 2089 | |
| 2090 | - $community_role = array_search('community member', user_roles(true)); |
|
| 2091 | - if (isset($account->roles[$community_role])) { |
|
| 2090 | + $community_role = array_search('community member', user_roles(true)); |
|
| 2091 | + if (isset($account->roles[$community_role])) { |
|
| 2092 | 2092 | unset($account->roles[$community_role]); |
| 2093 | 2093 | user_save($account, array('roles' => $account->roles)); |
| 2094 | - } |
|
| 2095 | - |
|
| 2096 | - global $user; |
|
| 2097 | - global $base_url; |
|
| 2098 | - global $base_path; |
|
| 2099 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 2100 | - $site_url = $base_url . $base_path; |
|
| 2101 | - $moderator = user_load($user->uid); |
|
| 2102 | - $settings = array( |
|
| 2094 | + } |
|
| 2095 | + |
|
| 2096 | + global $user; |
|
| 2097 | + global $base_url; |
|
| 2098 | + global $base_path; |
|
| 2099 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 2100 | + $site_url = $base_url . $base_path; |
|
| 2101 | + $moderator = user_load($user->uid); |
|
| 2102 | + $settings = array( |
|
| 2103 | 2103 | 'from' => '', |
| 2104 | 2104 | 'subject' => "User moderation at {$site_name}", |
| 2105 | 2105 | 'message' => '' |
@@ -2120,12 +2120,12 @@ discard block |
||
| 2120 | 2120 | . "Thanks, \n" |
| 2121 | 2121 | . "\n" |
| 2122 | 2122 | . "{$site_name} support team", |
| 2123 | - ); |
|
| 2124 | - rules_action_mail_to_user($account, $settings); |
|
| 2125 | - drupal_set_message('This user has been banned.'); |
|
| 2123 | + ); |
|
| 2124 | + rules_action_mail_to_user($account, $settings); |
|
| 2125 | + drupal_set_message('This user has been banned.'); |
|
| 2126 | 2126 | } |
| 2127 | - } |
|
| 2128 | - drupal_goto(); |
|
| 2127 | + } |
|
| 2128 | + drupal_goto(); |
|
| 2129 | 2129 | } |
| 2130 | 2130 | |
| 2131 | 2131 | |
@@ -2137,15 +2137,15 @@ discard block |
||
| 2137 | 2137 | * |
| 2138 | 2138 | */ |
| 2139 | 2139 | function boincuser_get_weak_auth($boinc_id = null) { |
| 2140 | - if (!$boinc_id) { |
|
| 2140 | + if (!$boinc_id) { |
|
| 2141 | 2141 | global $user; |
| 2142 | 2142 | $account = user_load($user->uid); |
| 2143 | 2143 | $boinc_id = $account->boincuser_id; |
| 2144 | - } |
|
| 2144 | + } |
|
| 2145 | 2145 | |
| 2146 | - $boinc_user = boincuser_load($account->boincuser_id); |
|
| 2146 | + $boinc_user = boincuser_load($account->boincuser_id); |
|
| 2147 | 2147 | |
| 2148 | - return weak_auth($boinc_user); |
|
| 2148 | + return weak_auth($boinc_user); |
|
| 2149 | 2149 | } |
| 2150 | 2150 | |
| 2151 | 2151 | /** |
@@ -2154,75 +2154,75 @@ discard block |
||
| 2154 | 2154 | * Drupal User so must be inserted into comments, etc. (not so by default) |
| 2155 | 2155 | */ |
| 2156 | 2156 | function boincuser_get_user_profile_image($uid, $avatar = TRUE) { |
| 2157 | - // Though the function name implies otherwise, get the avatar by default |
|
| 2158 | - $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid'; |
|
| 2159 | - $image_fid = db_result(db_query(" |
|
| 2157 | + // Though the function name implies otherwise, get the avatar by default |
|
| 2158 | + $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid'; |
|
| 2159 | + $image_fid = db_result(db_query(" |
|
| 2160 | 2160 | SELECT ctp.%s |
| 2161 | 2161 | FROM {content_type_profile} ctp |
| 2162 | 2162 | INNER JOIN {node} n ON ctp.nid = n.nid |
| 2163 | 2163 | WHERE n.uid = %d AND n.type = '%s'", |
| 2164 | 2164 | $image_field, $uid, 'profile')); |
| 2165 | - $user_image['image'] = field_file_load($image_fid); |
|
| 2166 | - if (!$user_image['image']['filepath']) { |
|
| 2165 | + $user_image['image'] = field_file_load($image_fid); |
|
| 2166 | + if (!$user_image['image']['filepath']) { |
|
| 2167 | 2167 | // Load the default image if one does not exist |
| 2168 | 2168 | $account = user_load($uid); |
| 2169 | 2169 | if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) { |
| 2170 | - // Use a Gravatar rather than the system default image |
|
| 2171 | - $options = array( |
|
| 2170 | + // Use a Gravatar rather than the system default image |
|
| 2171 | + $options = array( |
|
| 2172 | 2172 | 'size' => 100, |
| 2173 | 2173 | 'rating' => 'G', |
| 2174 | - ); |
|
| 2175 | - // Get the Gravatar URL and see if the image exists |
|
| 2176 | - $url = gravatar_get_gravatar($account->mail, $options); |
|
| 2177 | - $headers = @get_headers($url); |
|
| 2178 | - if (preg_match("|200|", $headers[0])) { |
|
| 2174 | + ); |
|
| 2175 | + // Get the Gravatar URL and see if the image exists |
|
| 2176 | + $url = gravatar_get_gravatar($account->mail, $options); |
|
| 2177 | + $headers = @get_headers($url); |
|
| 2178 | + if (preg_match("|200|", $headers[0])) { |
|
| 2179 | 2179 | return $url; |
| 2180 | - } |
|
| 2180 | + } |
|
| 2181 | 2181 | } |
| 2182 | 2182 | // Get default image if nothing else works |
| 2183 | 2183 | $content_node_widget_settings = db_result(db_query("SELECT widget_settings FROM {content_node_field_instance} WHERE field_name = '%s'", ($avatar ? 'field_image' : 'field_profile_image'))); |
| 2184 | 2184 | $content_node_widget_settings = unserialize($content_node_widget_settings); |
| 2185 | 2185 | $user_image['image'] = $content_node_widget_settings['default_image']; |
| 2186 | - } |
|
| 2187 | - $user = user_load($uid); |
|
| 2188 | - // Use boinc username for image alt/title attributes |
|
| 2189 | - $user_image['alt'] = $user->boincuser_name; |
|
| 2190 | - return $user_image; |
|
| 2186 | + } |
|
| 2187 | + $user = user_load($uid); |
|
| 2188 | + // Use boinc username for image alt/title attributes |
|
| 2189 | + $user_image['alt'] = $user->boincuser_name; |
|
| 2190 | + return $user_image; |
|
| 2191 | 2191 | } |
| 2192 | 2192 | |
| 2193 | 2193 | /** |
| 2194 | 2194 | * Generate a table of a user's projects |
| 2195 | 2195 | */ |
| 2196 | 2196 | function boincuser_get_projects_table($account = null) { |
| 2197 | - if ($account AND is_numeric($account)) { |
|
| 2197 | + if ($account AND is_numeric($account)) { |
|
| 2198 | 2198 | $account = user_load($account); |
| 2199 | - } |
|
| 2200 | - $projects = boincuser_get_projects($account); |
|
| 2201 | - if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
|
| 2202 | - |
|
| 2203 | - $output = ''; |
|
| 2204 | - $output .= '<table class="user-projects">' . "\n"; |
|
| 2205 | - $output .= '<thead>' . "\n"; |
|
| 2206 | - $output .= ' <tr>' . "\n"; |
|
| 2207 | - $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
| 2208 | - $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
| 2209 | - $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
| 2210 | - $output .= ' </tr>' . "\n"; |
|
| 2211 | - $output .= '</thead>' . "\n"; |
|
| 2212 | - $output .= '<tbody>' . "\n"; |
|
| 2213 | - foreach ($projects AS $project) { |
|
| 2199 | + } |
|
| 2200 | + $projects = boincuser_get_projects($account); |
|
| 2201 | + if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
|
| 2202 | + |
|
| 2203 | + $output = ''; |
|
| 2204 | + $output .= '<table class="user-projects">' . "\n"; |
|
| 2205 | + $output .= '<thead>' . "\n"; |
|
| 2206 | + $output .= ' <tr>' . "\n"; |
|
| 2207 | + $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
| 2208 | + $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
| 2209 | + $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
| 2210 | + $output .= ' </tr>' . "\n"; |
|
| 2211 | + $output .= '</thead>' . "\n"; |
|
| 2212 | + $output .= '<tbody>' . "\n"; |
|
| 2213 | + foreach ($projects AS $project) { |
|
| 2214 | 2214 | $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id; |
| 2215 | 2215 | $output .= ' <tr>' . "\n"; |
| 2216 | 2216 | $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n"; |
| 2217 | 2217 | $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; |
| 2218 | 2218 | $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n"; |
| 2219 | 2219 | $output .= ' </tr>' . "\n"; |
| 2220 | - } |
|
| 2221 | - $output .= '</tbody>' . "\n"; |
|
| 2222 | - $output .= '</table>' . "\n"; |
|
| 2223 | - $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; |
|
| 2224 | - //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; |
|
| 2225 | - return $output; |
|
| 2220 | + } |
|
| 2221 | + $output .= '</tbody>' . "\n"; |
|
| 2222 | + $output .= '</table>' . "\n"; |
|
| 2223 | + $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; |
|
| 2224 | + //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; |
|
| 2225 | + return $output; |
|
| 2226 | 2226 | } |
| 2227 | 2227 | |
| 2228 | 2228 | /** |
@@ -2230,25 +2230,25 @@ discard block |
||
| 2230 | 2230 | */ |
| 2231 | 2231 | function boincuser_get_stats_user_data($cpid = null) { |
| 2232 | 2232 | |
| 2233 | - // [TODO] Set this stuff in site config! |
|
| 2234 | - $stats_server = 'stats.gridrepublic.org'; |
|
| 2235 | - $stats_rpc = 'rpc/get_user.php'; |
|
| 2233 | + // [TODO] Set this stuff in site config! |
|
| 2234 | + $stats_server = 'stats.gridrepublic.org'; |
|
| 2235 | + $stats_rpc = 'rpc/get_user.php'; |
|
| 2236 | 2236 | |
| 2237 | - // Construct query string |
|
| 2238 | - $get = array( |
|
| 2237 | + // Construct query string |
|
| 2238 | + $get = array( |
|
| 2239 | 2239 | 'cpid' => $cpid |
| 2240 | - ); |
|
| 2241 | - $args = array(); |
|
| 2242 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
| 2243 | - $query = '?' . implode('&', $args); |
|
| 2244 | - |
|
| 2245 | - // Load XML from RPC |
|
| 2246 | - $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
|
| 2247 | - $result = drupal_http_request($target_url); |
|
| 2248 | - if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { |
|
| 2240 | + ); |
|
| 2241 | + $args = array(); |
|
| 2242 | + foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
| 2243 | + $query = '?' . implode('&', $args); |
|
| 2244 | + |
|
| 2245 | + // Load XML from RPC |
|
| 2246 | + $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
|
| 2247 | + $result = drupal_http_request($target_url); |
|
| 2248 | + if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { |
|
| 2249 | 2249 | return simplexml_load_string($result->data); |
| 2250 | - } |
|
| 2251 | - return NULL; |
|
| 2250 | + } |
|
| 2251 | + return NULL; |
|
| 2252 | 2252 | } |
| 2253 | 2253 | |
| 2254 | 2254 | /** |
@@ -2256,15 +2256,15 @@ discard block |
||
| 2256 | 2256 | */ |
| 2257 | 2257 | function boincuser_get_projects($account = null) { |
| 2258 | 2258 | |
| 2259 | - // Use the current user by default |
|
| 2260 | - if (!$account) { |
|
| 2259 | + // Use the current user by default |
|
| 2260 | + if (!$account) { |
|
| 2261 | 2261 | global $user; |
| 2262 | 2262 | $account = user_load($user->uid); |
| 2263 | - } |
|
| 2263 | + } |
|
| 2264 | 2264 | |
| 2265 | - $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid); |
|
| 2265 | + $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid); |
|
| 2266 | 2266 | |
| 2267 | - return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null; |
|
| 2267 | + return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null; |
|
| 2268 | 2268 | } |
| 2269 | 2269 | |
| 2270 | 2270 | |
@@ -2272,11 +2272,11 @@ discard block |
||
| 2272 | 2272 | * Get the links to display under the user profile |
| 2273 | 2273 | */ |
| 2274 | 2274 | function boincuser_get_profile_links($uid) { |
| 2275 | - global $user; |
|
| 2276 | - $account = user_load($uid); |
|
| 2277 | - $profile = content_profile_load('profile', $account->uid); |
|
| 2278 | - $output = ''; |
|
| 2279 | - if ($profile) { |
|
| 2275 | + global $user; |
|
| 2276 | + $account = user_load($uid); |
|
| 2277 | + $profile = content_profile_load('profile', $account->uid); |
|
| 2278 | + $output = ''; |
|
| 2279 | + if ($profile) { |
|
| 2280 | 2280 | $profile_is_approved = ($profile->status AND !$profile->moderate); |
| 2281 | 2281 | $user_is_moderator = user_access('edit any profile content'); |
| 2282 | 2282 | $is_own_profile = ($user->uid == $account->uid); |
@@ -2284,15 +2284,15 @@ discard block |
||
| 2284 | 2284 | $links = array(); |
| 2285 | 2285 | |
| 2286 | 2286 | if ($profile->moderate AND $user_is_moderator) { |
| 2287 | - $links['approve_profile'] = array( |
|
| 2287 | + $links['approve_profile'] = array( |
|
| 2288 | 2288 | 'title' => bts('Approve profile', array(), NULL, 'boinc:moderate-user'), |
| 2289 | 2289 | 'href' => "{$profile_moderation_path}/approve", |
| 2290 | 2290 | 'attributes' => array( |
| 2291 | - 'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), |
|
| 2292 | - 'class' => 'first primary tab', |
|
| 2291 | + 'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), |
|
| 2292 | + 'class' => 'first primary tab', |
|
| 2293 | 2293 | ) |
| 2294 | - ); |
|
| 2295 | - /*$links['edit_profile'] = array( |
|
| 2294 | + ); |
|
| 2295 | + /*$links['edit_profile'] = array( |
|
| 2296 | 2296 | 'title' => bts('Edit profile', array(), NULL, 'boinc:moderate-user'), |
| 2297 | 2297 | 'href' => "{$profile_moderation_path}/edit", |
| 2298 | 2298 | 'attributes' => array( |
@@ -2300,27 +2300,27 @@ discard block |
||
| 2300 | 2300 | 'class' => 'tab', |
| 2301 | 2301 | ) |
| 2302 | 2302 | );*/ |
| 2303 | - $links['reject_profile'] = array( |
|
| 2303 | + $links['reject_profile'] = array( |
|
| 2304 | 2304 | 'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), |
| 2305 | 2305 | 'href' => "{$profile_moderation_path}/reject", |
| 2306 | 2306 | 'attributes' => array( |
| 2307 | - 'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), |
|
| 2308 | - 'class' => 'tab', |
|
| 2307 | + 'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), |
|
| 2308 | + 'class' => 'tab', |
|
| 2309 | 2309 | ) |
| 2310 | - ); |
|
| 2310 | + ); |
|
| 2311 | 2311 | } |
| 2312 | 2312 | $output .= '<ul class="tab-list">'; |
| 2313 | 2313 | $count = 0; |
| 2314 | 2314 | foreach ($links as $key => $link) { |
| 2315 | - $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">'; |
|
| 2316 | - $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); |
|
| 2317 | - $output .= '</li>'; |
|
| 2318 | - $count++; |
|
| 2315 | + $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">'; |
|
| 2316 | + $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); |
|
| 2317 | + $output .= '</li>'; |
|
| 2318 | + $count++; |
|
| 2319 | 2319 | } |
| 2320 | 2320 | $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user_meta', $account->uid) . '</li>'; |
| 2321 | 2321 | $output .= '</ul>'; |
| 2322 | - } |
|
| 2323 | - return $output; |
|
| 2322 | + } |
|
| 2323 | + return $output; |
|
| 2324 | 2324 | /* |
| 2325 | 2325 | <ul class="tab-list"> |
| 2326 | 2326 | <li class="primary first tab"> |
@@ -2357,36 +2357,36 @@ discard block |
||
| 2357 | 2357 | */ |
| 2358 | 2358 | function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { |
| 2359 | 2359 | |
| 2360 | - foreach ($documents as $document) { |
|
| 2360 | + foreach ($documents as $document) { |
|
| 2361 | 2361 | if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { |
| 2362 | - // Node information. |
|
| 2363 | - $nid = $document->entity_id; |
|
| 2364 | - $node = node_load($nid); |
|
| 2365 | - $account = user_load($node->uid); |
|
| 2366 | - |
|
| 2367 | - // Use boincuser name and not drupal user name |
|
| 2368 | - $document->label = apachesolr_clean_text($account->boincuser_name); |
|
| 2369 | - // Author information |
|
| 2370 | - if ($node->uid == 0 || strlen($node->name) == 0) { |
|
| 2362 | + // Node information. |
|
| 2363 | + $nid = $document->entity_id; |
|
| 2364 | + $node = node_load($nid); |
|
| 2365 | + $account = user_load($node->uid); |
|
| 2366 | + |
|
| 2367 | + // Use boincuser name and not drupal user name |
|
| 2368 | + $document->label = apachesolr_clean_text($account->boincuser_name); |
|
| 2369 | + // Author information |
|
| 2370 | + if ($node->uid == 0 || strlen($node->name) == 0) { |
|
| 2371 | 2371 | // @see user_validate_name(). !'0' === TRUE. |
| 2372 | 2372 | $document->ss_name = '0'; |
| 2373 | - } |
|
| 2374 | - else { |
|
| 2373 | + } |
|
| 2374 | + else { |
|
| 2375 | 2375 | $document->ss_name = $account->boincuser_name; |
| 2376 | 2376 | // We want the name to be searchable for keywords. |
| 2377 | 2377 | $document->tos_name = $account->boincuser_name; |
| 2378 | - } |
|
| 2378 | + } |
|
| 2379 | 2379 | |
| 2380 | - // Rename "Profle" to "User" |
|
| 2381 | - $document->bundle = "User"; |
|
| 2382 | - $document->bundle_name = "User"; |
|
| 2380 | + // Rename "Profle" to "User" |
|
| 2381 | + $document->bundle = "User"; |
|
| 2382 | + $document->bundle_name = "User"; |
|
| 2383 | 2383 | |
| 2384 | - // Replace the Solr document's created field with the date the user |
|
| 2385 | - // account was created. This replaces the node creation date typically |
|
| 2386 | - // used for indexing nodes. |
|
| 2387 | - $document->ds_created = apachesolr_date_iso($account->created); |
|
| 2384 | + // Replace the Solr document's created field with the date the user |
|
| 2385 | + // account was created. This replaces the node creation date typically |
|
| 2386 | + // used for indexing nodes. |
|
| 2387 | + $document->ds_created = apachesolr_date_iso($account->created); |
|
| 2388 | + } |
|
| 2388 | 2389 | } |
| 2389 | - } |
|
| 2390 | 2390 | |
| 2391 | 2391 | } |
| 2392 | 2392 | |
@@ -2398,23 +2398,23 @@ discard block |
||
| 2398 | 2398 | * Implementation of hook_privatemsg_name_lookup(); |
| 2399 | 2399 | */ |
| 2400 | 2400 | function boincuser_privatemsg_name_lookup($string) { |
| 2401 | - // Get the BOINC ID from the name string, and lookup the |
|
| 2402 | - // corresponding drupal user. |
|
| 2403 | - $boincname = substr($string, 0, strrpos($string, '_')); |
|
| 2404 | - $boincid = substr($string, strrpos($string, '_') + 1); |
|
| 2405 | - $drupalid = get_drupal_id($boincid); |
|
| 2406 | - |
|
| 2407 | - // Name has spaced replaced with special UTF-8 characters in |
|
| 2408 | - // privatemsg module. We need to convert them back to spaces for the |
|
| 2409 | - // check below. |
|
| 2410 | - $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); |
|
| 2411 | - if ($drupalid>0) { |
|
| 2401 | + // Get the BOINC ID from the name string, and lookup the |
|
| 2402 | + // corresponding drupal user. |
|
| 2403 | + $boincname = substr($string, 0, strrpos($string, '_')); |
|
| 2404 | + $boincid = substr($string, strrpos($string, '_') + 1); |
|
| 2405 | + $drupalid = get_drupal_id($boincid); |
|
| 2406 | + |
|
| 2407 | + // Name has spaced replaced with special UTF-8 characters in |
|
| 2408 | + // privatemsg module. We need to convert them back to spaces for the |
|
| 2409 | + // check below. |
|
| 2410 | + $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); |
|
| 2411 | + if ($drupalid>0) { |
|
| 2412 | 2412 | if ($recipient = user_load(array('uid' => $drupalid))) { |
| 2413 | - // Double-check that the loaded user matches both boincuser_id |
|
| 2414 | - // and boincuser_name. |
|
| 2415 | - if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
| 2413 | + // Double-check that the loaded user matches both boincuser_id |
|
| 2414 | + // and boincuser_name. |
|
| 2415 | + if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
| 2416 | 2416 | return $recipient; |
| 2417 | - } |
|
| 2417 | + } |
|
| 2418 | + } |
|
| 2418 | 2419 | } |
| 2419 | - } |
|
| 2420 | 2420 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | 'type' => MENU_CALLBACK |
| 190 | 190 | ); |
| 191 | 191 | $items['account_finish.php'] = array( |
| 192 | - 'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), |
|
| 192 | + 'title' => 'Welcome to '.variable_get('site_name', 'Drupal-BOINC'), |
|
| 193 | 193 | 'description' => 'RPC for after a user has created an account.', |
| 194 | 194 | 'page callback' => 'boincuser_account_finish', |
| 195 | 195 | 'access callback' => TRUE, |
@@ -249,8 +249,8 @@ discard block |
||
| 249 | 249 | // termsofuse is enabled, by having text in the termsofuse variable. |
| 250 | 250 | $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
| 251 | 251 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 252 | - if ( (!empty($termsofuse)) and ($user->uid) ) { |
|
| 253 | - if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { |
|
| 252 | + if ((!empty($termsofuse)) and ($user->uid)) { |
|
| 253 | + if (!boincuser_check_termsofuse($user) and ($existinguser_tou)) { |
|
| 254 | 254 | |
| 255 | 255 | // Admins are exempt, otherwise the admin may not be able to |
| 256 | 256 | // access the site! |
@@ -264,14 +264,14 @@ discard block |
||
| 264 | 264 | 'user/termsofuse', |
| 265 | 265 | 'logout', |
| 266 | 266 | 'account/info/edit', |
| 267 | - 'user/' . $user->uid . '/edit', |
|
| 268 | - 'user/' . $user->uid . '/recoveremail/*', |
|
| 267 | + 'user/'.$user->uid.'/edit', |
|
| 268 | + 'user/'.$user->uid.'/recoveremail/*', |
|
| 269 | 269 | 'recover_email.php', |
| 270 | 270 | ); |
| 271 | 271 | if (module_exists('boincuser_delete')) { |
| 272 | - $paths0[] = 'user/' . $user->uid . '/delete'; |
|
| 273 | - $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*'; |
|
| 274 | - $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*'; |
|
| 272 | + $paths0[] = 'user/'.$user->uid.'/delete'; |
|
| 273 | + $paths0[] = 'user/'.$user->uid.'/deleteconfirm/*'; |
|
| 274 | + $paths0[] = 'user/'.$user->uid.'/odeleteconfirm/*'; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | // Paths added by the admin |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // paths to ignore |
| 285 | - $paths_to_ignore = array_unique( array_merge($paths0, $paths2) ); |
|
| 285 | + $paths_to_ignore = array_unique(array_merge($paths0, $paths2)); |
|
| 286 | 286 | |
| 287 | 287 | if (!_boincuser_ignore_paths($path, $paths_to_ignore)) { |
| 288 | 288 | drupal_goto('user/termsofuse'); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | require_boinc('password_compat/password'); |
| 305 | 305 | // Handle BOINC integration for users with UID > 1 (skip anonymous and admin) |
| 306 | 306 | if (isset($account->uid) && ($account->uid > 1)) { |
| 307 | - switch($op) { |
|
| 307 | + switch ($op) { |
|
| 308 | 308 | case 'load': |
| 309 | 309 | // User loading; insert BOINC data into the user object |
| 310 | 310 | $drupal_user = db_fetch_object(db_query(" |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | )); |
| 335 | 335 | $account->boincuser_name = $boinc_user->name; |
| 336 | 336 | $account->boincuser_account_key = $boinc_user->authenticator; |
| 337 | - $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash); |
|
| 337 | + $account->boincuser_weak_auth = md5($boinc_user->authenticator.$boinc_user->passwd_hash); |
|
| 338 | 338 | $account->boincuser_total_credit = round($boinc_user->total_credit); |
| 339 | 339 | $account->boincuser_expavg_credit = round($boinc_user->expavg_credit); |
| 340 | 340 | $account->boincuser_expavg_time = round($boinc_user->expavg_time); |
| 341 | - $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail); |
|
| 341 | + $account->boincuser_cpid = md5($boinc_user->cross_project_id.$account->mail); |
|
| 342 | 342 | $account->boincuser_default_pref_set = $boinc_user->venue; |
| 343 | 343 | $account->boincteam_id = $boinc_user->teamid; |
| 344 | 344 | $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr; |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | // Set password hash appropriately |
| 509 | 509 | $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass']; |
| 510 | - $passwd_hash = password_hash( md5($passwd.$lower_email_addr), PASSWORD_DEFAULT ); |
|
| 510 | + $passwd_hash = password_hash(md5($passwd.$lower_email_addr), PASSWORD_DEFAULT); |
|
| 511 | 511 | // Algorithm for changing email and/or password |
| 512 | 512 | if ($changing_email) { |
| 513 | 513 | // locally store current email to set as previous email |
@@ -595,8 +595,8 @@ discard block |
||
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | // Check if user has agreed to terms of use. |
| 598 | - if ( (!empty($termsofuse)) and ($account->uid) and |
|
| 599 | - (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) { |
|
| 598 | + if ((!empty($termsofuse)) and ($account->uid) and |
|
| 599 | + (!boincuser_check_termsofuse($account)) and ($existinguser_tou)) { |
|
| 600 | 600 | |
| 601 | 601 | // Admins are exempted. |
| 602 | 602 | $administrator_role = array_search('administrator', user_roles(true)); |
@@ -610,9 +610,9 @@ discard block |
||
| 610 | 610 | $query_for_destination = ''; |
| 611 | 611 | $prevdest = $_REQUEST['destination']; |
| 612 | 612 | if ($prevdest) { |
| 613 | - $query_for_destination = '?destination=' . $prevdest; |
|
| 613 | + $query_for_destination = '?destination='.$prevdest; |
|
| 614 | 614 | } |
| 615 | - $_REQUEST['destination'] = $path_for_destination . $query_for_destination; |
|
| 615 | + $_REQUEST['destination'] = $path_for_destination.$query_for_destination; |
|
| 616 | 616 | |
| 617 | 617 | } |
| 618 | 618 | } |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | // In Drupal 7, these operation cases will all exist as their own hooks, |
| 646 | 646 | // so let's approximate that here so that this function can simply be removed |
| 647 | 647 | // upon migration to 7 |
| 648 | - switch($op) { |
|
| 648 | + switch ($op) { |
|
| 649 | 649 | case 'update': |
| 650 | 650 | boincuser_node_update($node); |
| 651 | 651 | } |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | * is updated (forward compatible to Drupal 7) |
| 657 | 657 | */ |
| 658 | 658 | function boincuser_node_update($node) { |
| 659 | - switch($node->type) { |
|
| 659 | + switch ($node->type) { |
|
| 660 | 660 | case 'profile': |
| 661 | 661 | // Update the BOINC database directly |
| 662 | 662 | $account = user_load($node->uid); |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | $form['cancel'] = array( |
| 781 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
| 781 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest).'</li>', |
|
| 782 | 782 | '#weight' => 1004, |
| 783 | 783 | ); |
| 784 | 784 | $form['form control tabs suffix'] = array( |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
| 812 | 812 | $form['buttons']['preview_changes']['#weight'] = 1004; |
| 813 | 813 | $form['buttons']['cancel'] = array( |
| 814 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
| 814 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>', |
|
| 815 | 815 | '#weight' => 1005, |
| 816 | 816 | ); |
| 817 | 817 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | $form['actions']['submit']['#suffix'] = '</li>'; |
| 844 | 844 | $form['actions']['submit']['#weight'] = 1002; |
| 845 | 845 | $form['actions']['cancel'] = array( |
| 846 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
| 846 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>', |
|
| 847 | 847 | '#weight' => 1005, |
| 848 | 848 | ); |
| 849 | 849 | $form['actions']['form control tabs suffix'] = array( |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | $form['privatemsg']['preview']['#suffix'] = '</li>'; |
| 871 | 871 | $form['privatemsg']['preview']['#weight'] = 1003; |
| 872 | 872 | $form['privatemsg']['cancel'] = array( |
| 873 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 873 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
| 874 | 874 | '#weight' => 1004, |
| 875 | 875 | ); |
| 876 | 876 | $form['privatemsg']['form control tabs suffix'] = array( |
@@ -958,11 +958,11 @@ discard block |
||
| 958 | 958 | // Set special message if user has not agreed to TOU |
| 959 | 959 | $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
| 960 | 960 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 961 | - if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { |
|
| 961 | + if ((!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users'))) { |
|
| 962 | 962 | drupal_set_message( |
| 963 | 963 | bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.', |
| 964 | 964 | array( |
| 965 | - '@project' => variable_get('site_name','Drupal-BOINC'), |
|
| 965 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), |
|
| 966 | 966 | ), NULL, 'boinc:account-credentials-change') |
| 967 | 967 | , 'info'); |
| 968 | 968 | } |
@@ -1027,36 +1027,36 @@ discard block |
||
| 1027 | 1027 | $form['account']['boincuser_id'] = array( |
| 1028 | 1028 | '#value' => ' |
| 1029 | 1029 | <div class="form-item"> |
| 1030 | - <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1031 | - <span>' . $account->boincuser_id . '</span> |
|
| 1030 | + <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
| 1031 | + <span>' . $account->boincuser_id.'</span> |
|
| 1032 | 1032 | </div>', |
| 1033 | 1033 | ); |
| 1034 | 1034 | $form['account']['user_id'] = array( |
| 1035 | 1035 | '#value' => ' |
| 1036 | 1036 | <div class="form-item"> |
| 1037 | - <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1038 | - <span>' . $account->uid . '</span> |
|
| 1037 | + <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
| 1038 | + <span>' . $account->uid.'</span> |
|
| 1039 | 1039 | </div>', |
| 1040 | 1040 | ); |
| 1041 | 1041 | $form['account']['account_key'] = array( |
| 1042 | 1042 | '#value' => ' |
| 1043 | 1043 | <div class="form-item"> |
| 1044 | - <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1045 | - <span>' . $account->boincuser_account_key . '</span> |
|
| 1044 | + <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
| 1045 | + <span>' . $account->boincuser_account_key.'</span> |
|
| 1046 | 1046 | </div>', |
| 1047 | 1047 | ); |
| 1048 | 1048 | $form['account']['weak_account_key'] = array( |
| 1049 | 1049 | '#value' => ' |
| 1050 | 1050 | <div class="form-item"> |
| 1051 | - <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1052 | - <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> |
|
| 1051 | + <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
| 1052 | + <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}".'</span> |
|
| 1053 | 1053 | </div>', |
| 1054 | 1054 | ); |
| 1055 | 1055 | $form['account']['cpid'] = array( |
| 1056 | 1056 | '#value' => ' |
| 1057 | 1057 | <div class="form-item"> |
| 1058 | - <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1059 | - <span>' . $account->boincuser_cpid . '</span> |
|
| 1058 | + <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
| 1059 | + <span>' . $account->boincuser_cpid.'</span> |
|
| 1060 | 1060 | </div>', |
| 1061 | 1061 | ); |
| 1062 | 1062 | |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | $form['submit']['#suffix'] = '</li>'; |
| 1075 | 1075 | $form['submit']['#weight'] = 1002; |
| 1076 | 1076 | $form['cancel'] = array( |
| 1077 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1077 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
| 1078 | 1078 | '#weight' => 1003, |
| 1079 | 1079 | ); |
| 1080 | 1080 | if (isset($form['delete']) AND is_array($form['delete'])) { |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
| 1171 | 1171 | $form['buttons']['preview_changes']['#weight'] = 1004; |
| 1172 | 1172 | $form['buttons']['cancel'] = array( |
| 1173 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1173 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
| 1174 | 1174 | '#weight' => 1005, |
| 1175 | 1175 | ); |
| 1176 | 1176 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
@@ -1219,11 +1219,11 @@ discard block |
||
| 1219 | 1219 | // Set name temporarily to dummy value to beat validation |
| 1220 | 1220 | $form['name'] = array( |
| 1221 | 1221 | '#type' => 'hidden', |
| 1222 | - '#value' => rand() . '.' . time() |
|
| 1222 | + '#value' => rand().'.'.time() |
|
| 1223 | 1223 | ); |
| 1224 | 1224 | |
| 1225 | 1225 | // Add JS for submit button disabling |
| 1226 | - drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); |
|
| 1226 | + drupal_add_js(drupal_get_path('module', 'boincuser').'/boincuser.js'); |
|
| 1227 | 1227 | |
| 1228 | 1228 | // Terms of use section |
| 1229 | 1229 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | |
| 1240 | 1240 | $form['termsofuse']['title1'] = array( |
| 1241 | 1241 | '#weight' => -12, |
| 1242 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', |
|
| 1242 | + '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register').'</h2>', |
|
| 1243 | 1243 | '#prefix' => '<div id="register-title1">', |
| 1244 | 1244 | '#suffix' => '</div>', |
| 1245 | 1245 | ); |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | |
| 1263 | 1263 | $form['title2'] = array( |
| 1264 | 1264 | '#weight' => -6, |
| 1265 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', |
|
| 1265 | + '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register').'</h2>', |
|
| 1266 | 1266 | '#prefix' => '<div id="register-title2">', |
| 1267 | 1267 | '#suffix' => '</div>', |
| 1268 | 1268 | ); |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 1327 | 1327 | $form['buttons']['submit']['#weight'] = 1002; |
| 1328 | 1328 | $form['buttons']['cancel'] = array( |
| 1329 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
| 1329 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login').'</li>', |
|
| 1330 | 1330 | '#weight' => 1005, |
| 1331 | 1331 | ); |
| 1332 | 1332 | $form['buttons']['form control tabs suffix'] = array( |
@@ -1408,7 +1408,7 @@ discard block |
||
| 1408 | 1408 | */ |
| 1409 | 1409 | function boincuser_token_list($type = 'all') { |
| 1410 | 1410 | if ($type == 'user' || $type == 'all') { |
| 1411 | - $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
|
| 1411 | + $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
|
| 1412 | 1412 | return $tokens; |
| 1413 | 1413 | } |
| 1414 | 1414 | } |
@@ -1420,9 +1420,9 @@ discard block |
||
| 1420 | 1420 | if ($view->args) { |
| 1421 | 1421 | $account_id = $view->args[0]; |
| 1422 | 1422 | } |
| 1423 | - if ($view->name=="user_activity") { |
|
| 1423 | + if ($view->name == "user_activity") { |
|
| 1424 | 1424 | // Run the following custom query for the user_activity view |
| 1425 | - $view->build_info['query']= " |
|
| 1425 | + $view->build_info['query'] = " |
|
| 1426 | 1426 | SELECT node_revisions.vid AS vid, |
| 1427 | 1427 | node.nid AS node_nid, |
| 1428 | 1428 | node.uid AS users_node_uid, |
@@ -1462,13 +1462,13 @@ discard block |
||
| 1462 | 1462 | // Delete expired users in the BOINC database, user_delete table. |
| 1463 | 1463 | require_boinc('boinc_db'); |
| 1464 | 1464 | $num_deleted = BoincUserDeleted::delete_expired(); |
| 1465 | - if ($num_deleted>0) { |
|
| 1465 | + if ($num_deleted > 0) { |
|
| 1466 | 1466 | watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | // Delete expired tokens from token table |
| 1470 | 1470 | $tokens_deleted = BoincToken::delete_expired(); |
| 1471 | - if ($tokens_deleted>0) { |
|
| 1471 | + if ($tokens_deleted > 0) { |
|
| 1472 | 1472 | watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
| 1473 | 1473 | } |
| 1474 | 1474 | } |
@@ -1553,38 +1553,38 @@ discard block |
||
| 1553 | 1553 | case 'boinc': |
| 1554 | 1554 | $output .= '<ol>'; |
| 1555 | 1555 | if ($registration_enabled) { |
| 1556 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
| 1556 | + $output .= '<li>'.bts('First !create_an_account here at @sitename.', |
|
| 1557 | 1557 | array( |
| 1558 | 1558 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
| 1559 | 1559 | '@sitename' => $site_name, |
| 1560 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1560 | + ), NULL, 'boinc:join-page').'</li>'; |
|
| 1561 | 1561 | } |
| 1562 | - $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; |
|
| 1563 | - $output .= ' <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
|
| 1562 | + $output .= ' <li>'.bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page').'</li>'; |
|
| 1563 | + $output .= ' <li>'.bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
|
| 1564 | 1564 | array( |
| 1565 | 1565 | '@sitename' => $site_name, |
| 1566 | 1566 | '@siteurl' => $base_url, |
| 1567 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1567 | + ), NULL, 'boinc:join-page').'</li>'; |
|
| 1568 | 1568 | if ($registration_enabled) { |
| 1569 | - $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", |
|
| 1569 | + $output .= '<li>'.bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", |
|
| 1570 | 1570 | array( |
| 1571 | 1571 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
| 1572 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1572 | + ), NULL, 'boinc:join-page').'</li>'; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | else { |
| 1575 | - $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
|
| 1575 | + $output .= '<li>'.bts("If you're running a command-line version of BOINC, |
|
| 1576 | 1576 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.", |
| 1577 | 1577 | array( |
| 1578 | 1578 | '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
| 1579 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1579 | + ), NULL, 'boinc:join-page').'</li>'; |
|
| 1580 | 1580 | } |
| 1581 | - $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please |
|
| 1581 | + $output .= '<li>'.bts("If you're running a pre-5.0 version of BOINC, please |
|
| 1582 | 1582 | upgrade to a more recent version of BOINC to create an account |
| 1583 | 1583 | at @this_project.", |
| 1584 | 1584 | array( |
| 1585 | 1585 | '@this_project' => $site_name, |
| 1586 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1587 | - $output .= '</ol>'; |
|
| 1586 | + ), NULL, 'boinc:join-page').'</li>'; |
|
| 1587 | + $output .= '</ol>'; |
|
| 1588 | 1588 | break; |
| 1589 | 1589 | case 'new': |
| 1590 | 1590 | default: |
@@ -1596,37 +1596,37 @@ discard block |
||
| 1596 | 1596 | // $ruleslink = drupal_lookup_path('source', $ruleslinkB); |
| 1597 | 1597 | //} |
| 1598 | 1598 | |
| 1599 | - $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '') ); |
|
| 1599 | + $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '')); |
|
| 1600 | 1600 | |
| 1601 | 1601 | // Join page output |
| 1602 | 1602 | $output .= '<ol>'; |
| 1603 | 1603 | if ($registration_enabled) { |
| 1604 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
| 1604 | + $output .= '<li>'.bts('First !create_an_account here at @sitename.', |
|
| 1605 | 1605 | array( |
| 1606 | 1606 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
| 1607 | 1607 | '@sitename' => $site_name, |
| 1608 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1608 | + ), NULL, 'boinc:join-page').'</li>'; |
|
| 1609 | 1609 | } |
| 1610 | - else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
| 1611 | - $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
|
| 1610 | + else if (menu_valid_path(array('link_path' => $ruleslink))) { |
|
| 1611 | + $output .= ' <li>'.bts("Read our !rules_and_policies.", array( |
|
| 1612 | 1612 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
| 1613 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1613 | + ), NULL, 'boinc:join-page').'</li>'; |
|
| 1614 | 1614 | } |
| 1615 | - $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
| 1615 | + $output .= ' <li>'.bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
| 1616 | 1616 | $output .= ' <p>'; |
| 1617 | 1617 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>'; |
| 1618 | 1618 | $output .= ' </p>'; |
| 1619 | - $output .= ' ' . bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( |
|
| 1619 | + $output .= ' '.bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( |
|
| 1620 | 1620 | '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>', |
| 1621 | 1621 | '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>', |
| 1622 | 1622 | ), NULL, 'boinc:join-page'); |
| 1623 | 1623 | $output .= ' </li>'; |
| 1624 | - $output .= ' <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; |
|
| 1625 | - $output .= ' <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( |
|
| 1624 | + $output .= ' <li>'.bts('Run the installer.', array(), NULL, 'boinc:join-page').'</li>'; |
|
| 1625 | + $output .= ' <li>'.bts('Choose @sitename from the list, or enter @siteurl.', array( |
|
| 1626 | 1626 | '@sitename' => $site_name, |
| 1627 | 1627 | '@siteurl' => $base_url, |
| 1628 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1629 | - $output .= '</ol>'; |
|
| 1628 | + ), NULL, 'boinc:join-page').'</li>'; |
|
| 1629 | + $output .= '</ol>'; |
|
| 1630 | 1630 | } |
| 1631 | 1631 | $output .= '</div>'; |
| 1632 | 1632 | return $output; |
@@ -1639,7 +1639,7 @@ discard block |
||
| 1639 | 1639 | global $user; |
| 1640 | 1640 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
| 1641 | 1641 | // get the front page message from database; this is set in the admin interface under BOINC Other |
| 1642 | - $site_message = variable_get('boinc_other_frontpage',''); |
|
| 1642 | + $site_message = variable_get('boinc_other_frontpage', ''); |
|
| 1643 | 1643 | |
| 1644 | 1644 | // Determine the user of the day |
| 1645 | 1645 | $current_uotd = db_fetch_object(db_query(" |
@@ -1661,30 +1661,30 @@ discard block |
||
| 1661 | 1661 | $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); |
| 1662 | 1662 | $output .= '</h2>'; |
| 1663 | 1663 | $output .= '<div class="boinc-overview balance-height-front">'; |
| 1664 | - $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
| 1664 | + $output .= ' <div>'.bts($site_message, array(), NULL, "project:front page").' '.l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about').'</div>'; |
|
| 1665 | 1665 | if ($user->uid) { |
| 1666 | - $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
| 1666 | + $output .= ' <div>'.l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))).'</div>'; |
|
| 1667 | 1667 | } |
| 1668 | 1668 | else { |
| 1669 | - $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
| 1669 | + $output .= ' <div>'.l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))).'</div>'; |
|
| 1670 | 1670 | } |
| 1671 | 1671 | $output .= '</div>'; |
| 1672 | 1672 | $output .= '<div class="boinc-overview-details">'; |
| 1673 | 1673 | $output .= ' <div class="detail-container">'; |
| 1674 | - $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
|
| 1674 | + $output .= ' <a class="user-of-the-day" href="account/'.$uotd->uid.'">'; |
|
| 1675 | 1675 | $output .= ' <div class="picture">'; |
| 1676 | 1676 | $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
| 1677 | 1677 | $uotd_image['alt'], array(), FALSE); |
| 1678 | 1678 | $output .= ' </div>'; |
| 1679 | - $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1680 | - $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
|
| 1679 | + $output .= ' <div class="text">'.bts('User of the day', array(), NULL, 'boinc:front-page').'</div>'; |
|
| 1680 | + $output .= ' <div class="detail">'.$uotd->boincuser_name.'</div>'; |
|
| 1681 | 1681 | $output .= ' </a>'; |
| 1682 | 1682 | $output .= ' <div class="volunteers">'; |
| 1683 | - $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1683 | + $output .= ' <div class="text">'.bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page').'</div>'; |
|
| 1684 | 1684 | $output .= ' <div class="platforms">'; |
| 1685 | - $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1686 | - $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1687 | - $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1685 | + $output .= ' <div class="detail platform windows">'.bts('Windows', array(), NULL, 'boinc:front-page').'</div>'; |
|
| 1686 | + $output .= ' <div class="detail platform mac">'.bts('Mac', array(), NULL, 'boinc:front-page').'</div>'; |
|
| 1687 | + $output .= ' <div class="detail platform linux">'.bts('Linux', array(), NULL, 'boinc:front-page').'</div>'; |
|
| 1688 | 1688 | $output .= ' </div>'; |
| 1689 | 1689 | $output .= ' </div>'; |
| 1690 | 1690 | $output .= ' </div>'; |
@@ -1715,7 +1715,7 @@ discard block |
||
| 1715 | 1715 | $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
| 1716 | 1716 | if (!$enablethisRPC) { |
| 1717 | 1717 | $mess = bts('Account creation is done through our Web site. Please register at @url', array( |
| 1718 | - '@url' => $base_url . '/user/registration', |
|
| 1718 | + '@url' => $base_url.'/user/registration', |
|
| 1719 | 1719 | ), |
| 1720 | 1720 | NULL, 'boinc:create_account'); |
| 1721 | 1721 | xml_error(-208, $mess); |
@@ -1747,8 +1747,8 @@ discard block |
||
| 1747 | 1747 | $boinc_user = BoincUser::lookup_email_addr($params['email_addr']); |
| 1748 | 1748 | if ($boinc_user) { |
| 1749 | 1749 | // Return authenticator for existing users |
| 1750 | - if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
|
| 1751 | - password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
|
| 1750 | + if (($params['passwd_hash'] == $boinc_user->passwd_hash) or |
|
| 1751 | + password_verify($params['passwd_hash'], $boinc_user->passwd_hash)) { |
|
| 1752 | 1752 | $output = array('authenticator' => $boinc_user->authenticator); |
| 1753 | 1753 | } |
| 1754 | 1754 | else { |
@@ -1804,7 +1804,7 @@ discard block |
||
| 1804 | 1804 | // Ensure there is a authentication token before continuing |
| 1805 | 1805 | if (empty($authtoken)) { |
| 1806 | 1806 | drupal_not_found(); |
| 1807 | - return ; |
|
| 1807 | + return; |
|
| 1808 | 1808 | } |
| 1809 | 1809 | |
| 1810 | 1810 | if (strlen($authtoken) != 32) { |
@@ -1826,8 +1826,8 @@ discard block |
||
| 1826 | 1826 | } |
| 1827 | 1827 | |
| 1828 | 1828 | // Lookup path to custom account finish page |
| 1829 | - $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); |
|
| 1830 | - if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { |
|
| 1829 | + $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '')); |
|
| 1830 | + if (menu_valid_path(array('link_path' => $customaccountfinishpath))) { |
|
| 1831 | 1831 | $node = menu_get_object('node', 1, $customaccountfinishpath); |
| 1832 | 1832 | if ($node) { |
| 1833 | 1833 | return node_page_view($node); |
@@ -1836,12 +1836,12 @@ discard block |
||
| 1836 | 1836 | |
| 1837 | 1837 | // open links in new window |
| 1838 | 1838 | $options = array( |
| 1839 | - 'attributes' => array( 'target' => '_blank' ), |
|
| 1839 | + 'attributes' => array('target' => '_blank'), |
|
| 1840 | 1840 | ); |
| 1841 | 1841 | |
| 1842 | 1842 | // Check moderation page exists |
| 1843 | - $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
|
| 1844 | - if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
|
| 1843 | + $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '')); |
|
| 1844 | + if (menu_valid_path(array('link_path' => $moderationpath))) { |
|
| 1845 | 1845 | $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish'); |
| 1846 | 1846 | } else { |
| 1847 | 1847 | $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); |
@@ -1849,11 +1849,11 @@ discard block |
||
| 1849 | 1849 | |
| 1850 | 1850 | $username = $user->boincuser_name; |
| 1851 | 1851 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
| 1852 | - $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', |
|
| 1852 | + $output = "<p>".bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', |
|
| 1853 | 1853 | array( |
| 1854 | 1854 | '@user_name' => $username, |
| 1855 | 1855 | '@site_name' => $site_name, |
| 1856 | - ), NULL, 'boinc:account-finish') . "</p>"; |
|
| 1856 | + ), NULL, 'boinc:account-finish')."</p>"; |
|
| 1857 | 1857 | |
| 1858 | 1858 | $links = array( |
| 1859 | 1859 | array( |
@@ -1919,7 +1919,7 @@ discard block |
||
| 1919 | 1919 | ); |
| 1920 | 1920 | |
| 1921 | 1921 | //List of links |
| 1922 | - $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
| 1922 | + $output .= theme_item_list($links, $title = NULL, $type = 'ul'); |
|
| 1923 | 1923 | |
| 1924 | 1924 | return $output; |
| 1925 | 1925 | } |
@@ -2036,7 +2036,7 @@ discard block |
||
| 2036 | 2036 | global $base_url; |
| 2037 | 2037 | global $base_path; |
| 2038 | 2038 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
| 2039 | - $site_url = $base_url . $base_path; |
|
| 2039 | + $site_url = $base_url.$base_path; |
|
| 2040 | 2040 | $moderator = user_load($user->uid); |
| 2041 | 2041 | $profile->moderate = 0; |
| 2042 | 2042 | $profile->status = 0; |
@@ -2097,7 +2097,7 @@ discard block |
||
| 2097 | 2097 | global $base_url; |
| 2098 | 2098 | global $base_path; |
| 2099 | 2099 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
| 2100 | - $site_url = $base_url . $base_path; |
|
| 2100 | + $site_url = $base_url.$base_path; |
|
| 2101 | 2101 | $moderator = user_load($user->uid); |
| 2102 | 2102 | $settings = array( |
| 2103 | 2103 | 'from' => '', |
@@ -2201,25 +2201,25 @@ discard block |
||
| 2201 | 2201 | if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
| 2202 | 2202 | |
| 2203 | 2203 | $output = ''; |
| 2204 | - $output .= '<table class="user-projects">' . "\n"; |
|
| 2205 | - $output .= '<thead>' . "\n"; |
|
| 2206 | - $output .= ' <tr>' . "\n"; |
|
| 2207 | - $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
| 2208 | - $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
| 2209 | - $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
| 2210 | - $output .= ' </tr>' . "\n"; |
|
| 2211 | - $output .= '</thead>' . "\n"; |
|
| 2212 | - $output .= '<tbody>' . "\n"; |
|
| 2204 | + $output .= '<table class="user-projects">'."\n"; |
|
| 2205 | + $output .= '<thead>'."\n"; |
|
| 2206 | + $output .= ' <tr>'."\n"; |
|
| 2207 | + $output .= ' <th>'.bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite').'</th>'."\n"; |
|
| 2208 | + $output .= ' <th class="numeric">'.bts('Avg credit', array(), NULL, 'boinc:account-dashboard').'</th>'."\n"; |
|
| 2209 | + $output .= ' <th class="numeric">'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').'</th>'."\n"; |
|
| 2210 | + $output .= ' </tr>'."\n"; |
|
| 2211 | + $output .= '</thead>'."\n"; |
|
| 2212 | + $output .= '<tbody>'."\n"; |
|
| 2213 | 2213 | foreach ($projects AS $project) { |
| 2214 | - $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id; |
|
| 2215 | - $output .= ' <tr>' . "\n"; |
|
| 2216 | - $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n"; |
|
| 2217 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; |
|
| 2218 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n"; |
|
| 2219 | - $output .= ' </tr>' . "\n"; |
|
| 2214 | + $url = rtrim($project->url, '/').'/show_user.php?userid='.$project->id; |
|
| 2215 | + $output .= ' <tr>'."\n"; |
|
| 2216 | + $output .= ' <td>'.l($project->name, $url).'</td>'."\n"; |
|
| 2217 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->expavg_credit).'</td>'."\n"; |
|
| 2218 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->total_credit).'</td>'."\n"; |
|
| 2219 | + $output .= ' </tr>'."\n"; |
|
| 2220 | 2220 | } |
| 2221 | - $output .= '</tbody>' . "\n"; |
|
| 2222 | - $output .= '</table>' . "\n"; |
|
| 2221 | + $output .= '</tbody>'."\n"; |
|
| 2222 | + $output .= '</table>'."\n"; |
|
| 2223 | 2223 | $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; |
| 2224 | 2224 | //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; |
| 2225 | 2225 | return $output; |
@@ -2239,8 +2239,8 @@ discard block |
||
| 2239 | 2239 | 'cpid' => $cpid |
| 2240 | 2240 | ); |
| 2241 | 2241 | $args = array(); |
| 2242 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
| 2243 | - $query = '?' . implode('&', $args); |
|
| 2242 | + foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value); |
|
| 2243 | + $query = '?'.implode('&', $args); |
|
| 2244 | 2244 | |
| 2245 | 2245 | // Load XML from RPC |
| 2246 | 2246 | $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
@@ -2312,12 +2312,12 @@ discard block |
||
| 2312 | 2312 | $output .= '<ul class="tab-list">'; |
| 2313 | 2313 | $count = 0; |
| 2314 | 2314 | foreach ($links as $key => $link) { |
| 2315 | - $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">'; |
|
| 2315 | + $output .= '<li class="'.(($count == 0) ? 'first primary ' : '').'tab">'; |
|
| 2316 | 2316 | $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); |
| 2317 | 2317 | $output .= '</li>'; |
| 2318 | 2318 | $count++; |
| 2319 | 2319 | } |
| 2320 | - $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user_meta', $account->uid) . '</li>'; |
|
| 2320 | + $output .= '<li class="'.(($count) ? '' : 'first ').'last tab">'.flag_create_link('abuse_user_meta', $account->uid).'</li>'; |
|
| 2321 | 2321 | $output .= '</ul>'; |
| 2322 | 2322 | } |
| 2323 | 2323 | return $output; |
@@ -2358,7 +2358,7 @@ discard block |
||
| 2358 | 2358 | function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { |
| 2359 | 2359 | |
| 2360 | 2360 | foreach ($documents as $document) { |
| 2361 | - if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { |
|
| 2361 | + if ($document->entity_type == 'node' AND $document->bundle == 'profile') { |
|
| 2362 | 2362 | // Node information. |
| 2363 | 2363 | $nid = $document->entity_id; |
| 2364 | 2364 | $node = node_load($nid); |
@@ -2408,11 +2408,11 @@ discard block |
||
| 2408 | 2408 | // privatemsg module. We need to convert them back to spaces for the |
| 2409 | 2409 | // check below. |
| 2410 | 2410 | $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); |
| 2411 | - if ($drupalid>0) { |
|
| 2411 | + if ($drupalid > 0) { |
|
| 2412 | 2412 | if ($recipient = user_load(array('uid' => $drupalid))) { |
| 2413 | 2413 | // Double-check that the loaded user matches both boincuser_id |
| 2414 | 2414 | // and boincuser_name. |
| 2415 | - if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
| 2415 | + if (($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name)) { |
|
| 2416 | 2416 | return $recipient; |
| 2417 | 2417 | } |
| 2418 | 2418 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | 'weight' => 5 |
| 84 | 84 | ); |
| 85 | 85 | $items['moderate/profile/%/reject'] = array( |
| 86 | - 'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), |
|
| 86 | + 'title' => bts('Reject profile', array(), null, 'boinc:moderate-user'), |
|
| 87 | 87 | 'description' => 'Reject profile content', |
| 88 | 88 | 'page callback' => 'drupal_get_form', |
| 89 | 89 | 'page arguments' => array('boincuser_moderate_profile_reject_form', 2), |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | 'weight' => 5 |
| 93 | 93 | ); |
| 94 | 94 | $items['moderate/user/%/ban'] = array( |
| 95 | - 'title' => bts('Ban user', array(), NULL, 'boinc:moderate-ban-user'), |
|
| 95 | + 'title' => bts('Ban user', array(), null, 'boinc:moderate-ban-user'), |
|
| 96 | 96 | 'description' => 'Ban a user from using community features', |
| 97 | 97 | 'page callback' => 'drupal_get_form', |
| 98 | 98 | 'page arguments' => array('boincuser_moderate_user_ban_form', 2), |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | 'weight' => 5 |
| 124 | 124 | ); |
| 125 | 125 | $items['user/login/auth'] = array( |
| 126 | - 'title' => bts('Authenticator login', array(), NULL, 'boinc:authenticator-login-page'), |
|
| 126 | + 'title' => bts('Authenticator login', array(), null, 'boinc:authenticator-login-page'), |
|
| 127 | 127 | 'description' => 'Log in using a user authenticator', |
| 128 | 128 | 'page callback' => 'drupal_get_form', |
| 129 | 129 | 'page arguments' => array('boincuser_authloginform'), |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | 'type' => MENU_CALLBACK, |
| 132 | 132 | ); |
| 133 | 133 | $items['user/termsofuse'] = array( |
| 134 | - 'title' => bts('Terms of Use', array(), NULL, 'boinc:termsofuse-form'), |
|
| 134 | + 'title' => bts('Terms of Use', array(), null, 'boinc:termsofuse-form'), |
|
| 135 | 135 | 'description' => 'A site\'s term of use.', |
| 136 | 136 | 'page callback' => 'drupal_get_form', |
| 137 | 137 | 'page arguments' => array('boincuser_termsofuse_form'), |
@@ -185,19 +185,19 @@ discard block |
||
| 185 | 185 | 'title' => 'Create Account RPC', |
| 186 | 186 | 'description' => 'RPC for creating user accounts.', |
| 187 | 187 | 'page callback' => 'boincuser_create_account', |
| 188 | - 'access callback' => TRUE, |
|
| 188 | + 'access callback' => true, |
|
| 189 | 189 | 'type' => MENU_CALLBACK |
| 190 | 190 | ); |
| 191 | 191 | $items['account_finish.php'] = array( |
| 192 | 192 | 'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), |
| 193 | 193 | 'description' => 'RPC for after a user has created an account.', |
| 194 | 194 | 'page callback' => 'boincuser_account_finish', |
| 195 | - 'access callback' => TRUE, |
|
| 195 | + 'access callback' => true, |
|
| 196 | 196 | 'type' => MENU_CALLBACK, |
| 197 | 197 | ); |
| 198 | 198 | $items['boincuser/autocomplete'] = array( |
| 199 | 199 | 'page callback' => '_boincuser_user_name_autocomplete', |
| 200 | - 'access callback' => TRUE, |
|
| 200 | + 'access callback' => true, |
|
| 201 | 201 | 'type' => MENU_CALLBACK, |
| 202 | 202 | ); |
| 203 | 203 | $items['user/%user/recoveremail/%'] = array( |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | 'title' => t('Recover previous email'), |
| 213 | 213 | 'description' => t('redirect'), |
| 214 | 214 | 'page callback' => '_boincuser_redirect_recover_email', |
| 215 | - 'access callback' => TRUE, |
|
| 215 | + 'access callback' => true, |
|
| 216 | 216 | 'type' => MENU_CALLBACK, |
| 217 | 217 | ); |
| 218 | 218 | return $items; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | // Check if user has agreed to the terms of use. If not, send the |
| 248 | 248 | // user to the terms-of-use form. This is only makes sense if the |
| 249 | 249 | // termsofuse is enabled, by having text in the termsofuse variable. |
| 250 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
| 250 | + $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', false); |
|
| 251 | 251 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 252 | 252 | if ( (!empty($termsofuse)) and ($user->uid) ) { |
| 253 | 253 | if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * Implementation of hook_user(); add custom actions to standard |
| 297 | 297 | * Drupal user operations |
| 298 | 298 | */ |
| 299 | -function boincuser_user($op, &$edit, &$account, $category = NULL) { |
|
| 299 | +function boincuser_user($op, &$edit, &$account, $category = null) { |
|
| 300 | 300 | require_boinc('boinc_db'); |
| 301 | 301 | require_boinc('user'); |
| 302 | 302 | require_boinc('xml'); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $account->boincuser_email_addr_change_time = $boinc_user->email_addr_change_time; |
| 346 | 346 | db_set_active('default'); |
| 347 | 347 | // Set Drupal team ID |
| 348 | - $account->team = NULL; |
|
| 348 | + $account->team = null; |
|
| 349 | 349 | if ($account->boincteam_id) { |
| 350 | 350 | $account->team = db_result(db_query(" |
| 351 | 351 | SELECT nid FROM {boincteam} WHERE team_id = %d", |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $boinc_user = boincuser_register_make_user($user_params); |
| 454 | 454 | if (!$boinc_user) { |
| 455 | 455 | // Account exists with this email addr |
| 456 | - form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user')); |
|
| 456 | + form_set_error('email', bts('Error creating BOINC account.', array(), null, 'boinc:add-new-user')); |
|
| 457 | 457 | return; |
| 458 | 458 | } |
| 459 | 459 | |
@@ -499,9 +499,9 @@ discard block |
||
| 499 | 499 | case 'user_account': |
| 500 | 500 | // Ensure that BOINC data is altered |
| 501 | 501 | |
| 502 | - $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false; |
|
| 502 | + $changing_email = ($edit['mail'] and $edit['mail'] != $boinc_user->email_addr) ? true : false; |
|
| 503 | 503 | $changing_pass = ($edit['pass']) ? true : false; |
| 504 | - if ($changing_email OR $changing_pass) { |
|
| 504 | + if ($changing_email or $changing_pass) { |
|
| 505 | 505 | // set email address to lower-case |
| 506 | 506 | $lower_email_addr = strtolower($edit['mail']); |
| 507 | 507 | |
@@ -583,13 +583,13 @@ discard block |
||
| 583 | 583 | *(forward compatible to Drupal 7). |
| 584 | 584 | */ |
| 585 | 585 | function boincuser_user_login(&$edit, $account) { |
| 586 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
| 586 | + $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', false); |
|
| 587 | 587 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 588 | 588 | |
| 589 | 589 | // Use the same code as boincuser_form_alter(), for case |
| 590 | 590 | // 'user_profile_form', if the refering page is the user password |
| 591 | 591 | // reset form, then do not check for terms of use. |
| 592 | - $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1; |
|
| 592 | + $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === false) ? 0 : 1; |
|
| 593 | 593 | if ($reset_pass) { |
| 594 | 594 | return; |
| 595 | 595 | } |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | |
| 738 | 738 | // General friend form overrides |
| 739 | 739 | $form['flag_friend_submit']['#prefix'] = '<li class="first tab">'; |
| 740 | - $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); |
|
| 740 | + $form['flag_friend_submit']['#value'] = bts('Send request', array(), null, 'boinc:friends-page'); |
|
| 741 | 741 | $form['flag_friend_submit']['#type'] = 'submit'; |
| 742 | 742 | $form['flag_friend_submit']['#suffix'] = '</li>'; |
| 743 | 743 | $form['flag_friend_submit']['#weight'] = 1002; |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | case FLAG_FRIEND_BOTH: |
| 747 | 747 | case FLAG_FRIEND_FLAGGED: |
| 748 | 748 | unset($form['actions']); |
| 749 | - $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), NULL, 'boinc:friends-remove'); |
|
| 749 | + $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), null, 'boinc:friends-remove'); |
|
| 750 | 750 | // Add in our hack handler to fix the flag_friend module |
| 751 | 751 | $final_handler = array_pop($form['#submit']); |
| 752 | 752 | $form['#submit'][] = 'boincuser_fix_unfriend_form_submit'; |
@@ -754,21 +754,21 @@ discard block |
||
| 754 | 754 | break; |
| 755 | 755 | case FLAG_FRIEND_PENDING: |
| 756 | 756 | unset($form['actions']); |
| 757 | - $form['flag_friend_submit']['#value'] = bts('Remove request', array(), NULL, 'boinc:friends-page'); |
|
| 757 | + $form['flag_friend_submit']['#value'] = bts('Remove request', array(), null, 'boinc:friends-page'); |
|
| 758 | 758 | break; |
| 759 | 759 | case FLAG_FRIEND_APPROVAL: |
| 760 | 760 | if ($action == 'flag') { |
| 761 | - $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
|
| 761 | + $form['flag_friend_submit']['#value'] = bts('Approve request', array(), null, 'boinc:friends-page'); |
|
| 762 | 762 | } |
| 763 | 763 | elseif ($action == 'unflag') { |
| 764 | 764 | unset($form['actions']); |
| 765 | - $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
|
| 765 | + $form['flag_friend_submit']['#value'] = bts('Deny request', array(), null, 'boinc:friends-page'); |
|
| 766 | 766 | } |
| 767 | 767 | break; |
| 768 | 768 | case FLAG_FRIEND_UNFLAGGED: |
| 769 | 769 | default: |
| 770 | 770 | $user_links[] = array( |
| 771 | - 'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), |
|
| 771 | + 'title' => bts('Add as friend', array(), null, 'boinc:friends-add'), |
|
| 772 | 772 | 'href' => "flag/confirm/flag/friend/{$account->uid}" |
| 773 | 773 | ); |
| 774 | 774 | } |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | $form['cancel'] = array( |
| 781 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
| 781 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
| 782 | 782 | '#weight' => 1004, |
| 783 | 783 | ); |
| 784 | 784 | $form['form control tabs suffix'] = array( |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | '#weight' => 1001, |
| 802 | 802 | ); |
| 803 | 803 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
| 804 | - $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
|
| 804 | + $form['buttons']['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); |
|
| 805 | 805 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 806 | 806 | $form['buttons']['submit']['#weight'] = 1002; |
| 807 | 807 | $form['buttons']['preview']['#prefix'] = '<li class="tab">'; |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
| 812 | 812 | $form['buttons']['preview_changes']['#weight'] = 1004; |
| 813 | 813 | $form['buttons']['cancel'] = array( |
| 814 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
| 814 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
| 815 | 815 | '#weight' => 1005, |
| 816 | 816 | ); |
| 817 | 817 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
@@ -839,11 +839,11 @@ discard block |
||
| 839 | 839 | '#weight' => 1001, |
| 840 | 840 | ); |
| 841 | 841 | $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
| 842 | - $form['actions']['submit']['#value'] = bts('Delete', array(), NULL, 'boinc:form-delete'); |
|
| 842 | + $form['actions']['submit']['#value'] = bts('Delete', array(), null, 'boinc:form-delete'); |
|
| 843 | 843 | $form['actions']['submit']['#suffix'] = '</li>'; |
| 844 | 844 | $form['actions']['submit']['#weight'] = 1002; |
| 845 | 845 | $form['actions']['cancel'] = array( |
| 846 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
| 846 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
| 847 | 847 | '#weight' => 1005, |
| 848 | 848 | ); |
| 849 | 849 | $form['actions']['form control tabs suffix'] = array( |
@@ -863,14 +863,14 @@ discard block |
||
| 863 | 863 | '#weight' => 1001, |
| 864 | 864 | ); |
| 865 | 865 | $form['privatemsg']['submit']['#prefix'] = '<li class="first tab">'; |
| 866 | - $form['privatemsg']['submit']['#value'] = bts('Send message', array(), NULL, 'boinc:private-message'); |
|
| 866 | + $form['privatemsg']['submit']['#value'] = bts('Send message', array(), null, 'boinc:private-message'); |
|
| 867 | 867 | $form['privatemsg']['submit']['#suffix'] = '</li>'; |
| 868 | 868 | $form['privatemsg']['submit']['#weight'] = 1002; |
| 869 | 869 | $form['privatemsg']['preview']['#prefix'] = '<li class="tab">'; |
| 870 | 870 | $form['privatemsg']['preview']['#suffix'] = '</li>'; |
| 871 | 871 | $form['privatemsg']['preview']['#weight'] = 1003; |
| 872 | 872 | $form['privatemsg']['cancel'] = array( |
| 873 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 873 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 874 | 874 | '#weight' => 1004, |
| 875 | 875 | ); |
| 876 | 876 | $form['privatemsg']['form control tabs suffix'] = array( |
@@ -885,18 +885,18 @@ discard block |
||
| 885 | 885 | // Login form |
| 886 | 886 | case 'user_login': |
| 887 | 887 | case 'user_login_block': |
| 888 | - drupal_set_title(bts('Login', array(), NULL, 'boinc:menu-link')); |
|
| 888 | + drupal_set_title(bts('Login', array(), null, 'boinc:menu-link')); |
|
| 889 | 889 | // Replace name with email in login form |
| 890 | 890 | unset($form['name']); |
| 891 | 891 | array_unshift($form, array( |
| 892 | 892 | 'email' => array( |
| 893 | 893 | '#type' => 'textfield', |
| 894 | - '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), |
|
| 894 | + '#title' => bts('Email address', array(), null, 'boinc:email-address-to-login'), |
|
| 895 | 895 | '#size' => ($form_id == 'user_login_block') ? 15 : 60, |
| 896 | 896 | '#maxlength' => EMAIL_MAX_LENGTH, |
| 897 | - '#required' => TRUE, |
|
| 897 | + '#required' => true, |
|
| 898 | 898 | '#attributes' => array('tabindex' => '1'), |
| 899 | - '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:standard-login-page') |
|
| 899 | + '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:standard-login-page') |
|
| 900 | 900 | ), |
| 901 | 901 | 'validation_source' => array( |
| 902 | 902 | '#type' => 'hidden', |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | ); |
| 913 | 913 | $form['buttons']['submit'] = $form['submit']; |
| 914 | 914 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
| 915 | - $form['buttons']['submit']['#value'] = bts('Log in', array(), NULL, 'boinc:standard-login-page'); |
|
| 915 | + $form['buttons']['submit']['#value'] = bts('Log in', array(), null, 'boinc:standard-login-page'); |
|
| 916 | 916 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 917 | 917 | $form['buttons']['submit']['#weight'] = 1002; |
| 918 | 918 | $form['buttons']['form control tabs suffix'] = array( |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) { |
| 929 | 929 | // Find the local validation function's entry so we can replace it. |
| 930 | 930 | $array_key = array_search('user_login_authenticate_validate', $form['#validate']); |
| 931 | - if ($array_key === FALSE) { |
|
| 931 | + if ($array_key === false) { |
|
| 932 | 932 | // Could not find it. Some other module must have run form_alter(). |
| 933 | 933 | // We will simply add our validation just before the final validator. |
| 934 | 934 | $final_validator = array_pop($form['#validate']); |
@@ -956,26 +956,26 @@ discard block |
||
| 956 | 956 | } |
| 957 | 957 | |
| 958 | 958 | // Set special message if user has not agreed to TOU |
| 959 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
| 959 | + $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', false); |
|
| 960 | 960 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 961 | 961 | if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { |
| 962 | 962 | drupal_set_message( |
| 963 | 963 | bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.', |
| 964 | 964 | array( |
| 965 | 965 | '@project' => variable_get('site_name','Drupal-BOINC'), |
| 966 | - ), NULL, 'boinc:account-credentials-change') |
|
| 966 | + ), null, 'boinc:account-credentials-change') |
|
| 967 | 967 | , 'info'); |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | // A bit hackish... but don't require the user to enter his password if |
| 971 | 971 | // coming from the password reset function |
| 972 | - $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1; |
|
| 972 | + $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === false) ? 0 : 1; |
|
| 973 | 973 | if ($reset_pass) { |
| 974 | 974 | $_SESSION['reset_pass'] = 1; |
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | // Adjust form elements already present |
| 978 | - $form['account']['name']['#title'] = bts('Drupal Username', array(), NULL, 'boinc:drupal-username'); |
|
| 978 | + $form['account']['name']['#title'] = bts('Drupal Username', array(), null, 'boinc:drupal-username'); |
|
| 979 | 979 | $form['account']['name']['#size'] = 40; |
| 980 | 980 | $form['account']['name']['#attributes']['autocomplete'] = 'off'; |
| 981 | 981 | $form['account']['name']['#description'] .= '<p>This is the drupal (internal) username. The title above shows the BOINC username, which is the display name used publicly that the user can change in Community Preferences.'; |
@@ -986,11 +986,11 @@ discard block |
||
| 986 | 986 | // Add BOINC username (aka displayname) |
| 987 | 987 | $form['account']['boincuser_name'] = array( |
| 988 | 988 | '#type' => 'textfield', |
| 989 | - '#title' => bts('BOINC Username', array(), NULL, 'boinc:user-or-team-name'), |
|
| 989 | + '#title' => bts('BOINC Username', array(), null, 'boinc:user-or-team-name'), |
|
| 990 | 990 | '#default_value' => $account->boincuser_name, |
| 991 | 991 | '#maxlength' => USERNAME_MAX_LENGTH, |
| 992 | - '#required' => TRUE, |
|
| 993 | - '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), NULL, 'boinc:username-change'), |
|
| 992 | + '#required' => true, |
|
| 993 | + '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), null, 'boinc:username-change'), |
|
| 994 | 994 | '#size' => 40, |
| 995 | 995 | ); |
| 996 | 996 | } |
@@ -999,23 +999,23 @@ discard block |
||
| 999 | 999 | // ago, it cannot be changed again. |
| 1000 | 1000 | $duration = TOKEN_DURATION_ONE_WEEK; |
| 1001 | 1001 | if (($account->boincuser_email_addr_change_time + $duration) > time() and (!user_access('administer users'))) { |
| 1002 | - $form['account']['mail']['#required'] = FALSE; |
|
| 1002 | + $form['account']['mail']['#required'] = false; |
|
| 1003 | 1003 | $form['account']['mailhelp'] = array( |
| 1004 | 1004 | '#value' => bts("You email address was changed within the past seven (7) days. Please look for an email to !prev_email if you need to revert this change. You may change your email address on !time.", |
| 1005 | 1005 | array( |
| 1006 | 1006 | '!prev_email' => $account->boincuser_previous_email_addr, |
| 1007 | 1007 | '!time' => date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration), |
| 1008 | - ), NULL, 'boinc:account-credentials-change'), |
|
| 1008 | + ), null, 'boinc:account-credentials-change'), |
|
| 1009 | 1009 | ); |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | - if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) { |
|
| 1012 | + if (!$reset_pass and ($user->uid == $account->uid or !user_access('administer users'))) { |
|
| 1013 | 1013 | // Add a password authenticator, required to change email or pw |
| 1014 | 1014 | $form['account']['current_pass'] = array( |
| 1015 | 1015 | '#type' => 'password', |
| 1016 | - '#title' => bts('Enter your password to save changes', array(), NULL, 'boinc:account-credentials-change'), |
|
| 1016 | + '#title' => bts('Enter your password to save changes', array(), null, 'boinc:account-credentials-change'), |
|
| 1017 | 1017 | '#description' => bts('Enter your current password if changing your email |
| 1018 | - address or password.', array(), NULL, 'boinc:account-credentials-change'), |
|
| 1018 | + address or password.', array(), null, 'boinc:account-credentials-change'), |
|
| 1019 | 1019 | '#size' => 17, |
| 1020 | 1020 | '#attributes' => array( |
| 1021 | 1021 | 'autocomplete' => 'off', |
@@ -1027,35 +1027,35 @@ discard block |
||
| 1027 | 1027 | $form['account']['boincuser_id'] = array( |
| 1028 | 1028 | '#value' => ' |
| 1029 | 1029 | <div class="form-item"> |
| 1030 | - <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1030 | + <label>' . bts('BOINC user ID', array(), null, 'boinc:account-credentials-change') . '</label> |
|
| 1031 | 1031 | <span>' . $account->boincuser_id . '</span> |
| 1032 | 1032 | </div>', |
| 1033 | 1033 | ); |
| 1034 | 1034 | $form['account']['user_id'] = array( |
| 1035 | 1035 | '#value' => ' |
| 1036 | 1036 | <div class="form-item"> |
| 1037 | - <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1037 | + <label>' . bts('Drupal user ID', array(), null, 'boinc:account-credentials-change') . '</label> |
|
| 1038 | 1038 | <span>' . $account->uid . '</span> |
| 1039 | 1039 | </div>', |
| 1040 | 1040 | ); |
| 1041 | 1041 | $form['account']['account_key'] = array( |
| 1042 | 1042 | '#value' => ' |
| 1043 | 1043 | <div class="form-item"> |
| 1044 | - <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1044 | + <label>' . bts('Account key', array(), null, 'boinc:account-credentials-change') . '</label> |
|
| 1045 | 1045 | <span>' . $account->boincuser_account_key . '</span> |
| 1046 | 1046 | </div>', |
| 1047 | 1047 | ); |
| 1048 | 1048 | $form['account']['weak_account_key'] = array( |
| 1049 | 1049 | '#value' => ' |
| 1050 | 1050 | <div class="form-item"> |
| 1051 | - <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1051 | + <label>' . bts('Weak account key', array(), null, 'boinc:account-credentials-change') . '</label> |
|
| 1052 | 1052 | <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> |
| 1053 | 1053 | </div>', |
| 1054 | 1054 | ); |
| 1055 | 1055 | $form['account']['cpid'] = array( |
| 1056 | 1056 | '#value' => ' |
| 1057 | 1057 | <div class="form-item"> |
| 1058 | - <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
| 1058 | + <label>' . bts('Cross-project ID', array(), null, 'boinc:account-credentials-change') . '</label> |
|
| 1059 | 1059 | <span>' . $account->boincuser_cpid . '</span> |
| 1060 | 1060 | </div>', |
| 1061 | 1061 | ); |
@@ -1070,14 +1070,14 @@ discard block |
||
| 1070 | 1070 | '#weight' => 1001, |
| 1071 | 1071 | ); |
| 1072 | 1072 | $form['submit']['#prefix'] = '<li class="first tab">'; |
| 1073 | - $form['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
|
| 1073 | + $form['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); |
|
| 1074 | 1074 | $form['submit']['#suffix'] = '</li>'; |
| 1075 | 1075 | $form['submit']['#weight'] = 1002; |
| 1076 | 1076 | $form['cancel'] = array( |
| 1077 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1077 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1078 | 1078 | '#weight' => 1003, |
| 1079 | 1079 | ); |
| 1080 | - if (isset($form['delete']) AND is_array($form['delete'])) { |
|
| 1080 | + if (isset($form['delete']) and is_array($form['delete'])) { |
|
| 1081 | 1081 | $form['delete']['#prefix'] = '<li class="first alt tab">'; |
| 1082 | 1082 | $form['delete']['#suffix'] = '</li>'; |
| 1083 | 1083 | $form['delete']['#weight'] = 1004; |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | |
| 1140 | 1140 | // Set form['title'], but hide it |
| 1141 | 1141 | $form['title']['#default_value'] = $account->boincuser_name; |
| 1142 | - $form['title']['#access'] = FALSE; |
|
| 1142 | + $form['title']['#access'] = false; |
|
| 1143 | 1143 | |
| 1144 | 1144 | $form['separator_bottom'] = array( |
| 1145 | 1145 | '#value' => '<div class="separator buttons"></div>', |
@@ -1160,7 +1160,7 @@ discard block |
||
| 1160 | 1160 | '#weight' => 1001, |
| 1161 | 1161 | ); |
| 1162 | 1162 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
| 1163 | - $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
|
| 1163 | + $form['buttons']['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); |
|
| 1164 | 1164 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 1165 | 1165 | $form['buttons']['submit']['#weight'] = 1002; |
| 1166 | 1166 | $form['buttons']['preview']['#prefix'] = '<li class="tab">'; |
@@ -1170,12 +1170,12 @@ discard block |
||
| 1170 | 1170 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
| 1171 | 1171 | $form['buttons']['preview_changes']['#weight'] = 1004; |
| 1172 | 1172 | $form['buttons']['cancel'] = array( |
| 1173 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1173 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1174 | 1174 | '#weight' => 1005, |
| 1175 | 1175 | ); |
| 1176 | 1176 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
| 1177 | 1177 | $form['buttons']['delete']['#suffix'] = '</li>'; |
| 1178 | - $form['buttons']['delete']['#value'] = bts('Clear User Profile', array(), NULL, 'boinc:form-save'); |
|
| 1178 | + $form['buttons']['delete']['#value'] = bts('Clear User Profile', array(), null, 'boinc:form-save'); |
|
| 1179 | 1179 | $form['buttons']['delete']['#weight'] = 1006; |
| 1180 | 1180 | $form['buttons']['delete']['#submit'] = array('_boincuser_node_profile_delete_submit'); |
| 1181 | 1181 | $form['buttons']['form control tabs suffix'] = array( |
@@ -1209,11 +1209,11 @@ discard block |
||
| 1209 | 1209 | array_unshift($form, array( |
| 1210 | 1210 | 'boincuser_name' => array( |
| 1211 | 1211 | '#type' => 'textfield', |
| 1212 | - '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
|
| 1212 | + '#title' => bts('Name', array(), null, 'boinc:user-or-team-name'), |
|
| 1213 | 1213 | '#default_value' => $edit['boincuser_name'], |
| 1214 | 1214 | '#maxlength' => USERNAME_MAX_LENGTH, |
| 1215 | - '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), NULL, 'boinc:user-register'), |
|
| 1216 | - '#required' => TRUE |
|
| 1215 | + '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), null, 'boinc:user-register'), |
|
| 1216 | + '#required' => true |
|
| 1217 | 1217 | ), |
| 1218 | 1218 | )); |
| 1219 | 1219 | // Set name temporarily to dummy value to beat validation |
@@ -1233,27 +1233,27 @@ discard block |
||
| 1233 | 1233 | '#type' => 'fieldset', |
| 1234 | 1234 | '#prefix' => '<div id="termsofuse-wrapper">', // This is our wrapper div. |
| 1235 | 1235 | '#suffix' => '</div>', |
| 1236 | - '#tree' => TRUE, |
|
| 1236 | + '#tree' => true, |
|
| 1237 | 1237 | '#weight' => -15, |
| 1238 | 1238 | ); |
| 1239 | 1239 | |
| 1240 | 1240 | $form['termsofuse']['title1'] = array( |
| 1241 | 1241 | '#weight' => -12, |
| 1242 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', |
|
| 1242 | + '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), null, 'project:user-register' ) . '</h2>', |
|
| 1243 | 1243 | '#prefix' => '<div id="register-title1">', |
| 1244 | 1244 | '#suffix' => '</div>', |
| 1245 | 1245 | ); |
| 1246 | 1246 | |
| 1247 | 1247 | $form['termsofuse']['body'] = array( |
| 1248 | 1248 | '#weight' => -10, |
| 1249 | - '#value' => bts($termsofuse, array(), NULL, 'project:user-register'), |
|
| 1249 | + '#value' => bts($termsofuse, array(), null, 'project:user-register'), |
|
| 1250 | 1250 | '#prefix' => '<div id="register-termsofuse">', |
| 1251 | 1251 | '#suffix' => '</div>', |
| 1252 | 1252 | ); |
| 1253 | 1253 | |
| 1254 | 1254 | $form['termsofuse']['agreeTOU'] = array( |
| 1255 | 1255 | '#type' => 'checkbox', |
| 1256 | - '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:user-register'), |
|
| 1256 | + '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), null, 'project:user-register'), |
|
| 1257 | 1257 | '#weight' => -8, |
| 1258 | 1258 | '#prefix' => '<div id="register-checkbox">', |
| 1259 | 1259 | '#suffix' => '</div>', |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | |
| 1263 | 1263 | $form['title2'] = array( |
| 1264 | 1264 | '#weight' => -6, |
| 1265 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', |
|
| 1265 | + '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), null, 'project:user-register') . '</h2>', |
|
| 1266 | 1266 | '#prefix' => '<div id="register-title2">', |
| 1267 | 1267 | '#suffix' => '</div>', |
| 1268 | 1268 | ); |
@@ -1282,26 +1282,26 @@ discard block |
||
| 1282 | 1282 | |
| 1283 | 1283 | // Request new password form |
| 1284 | 1284 | case 'user_pass': |
| 1285 | - drupal_set_title(bts('Forgot password', array(), NULL, 'boinc:forgot-password')); |
|
| 1285 | + drupal_set_title(bts('Forgot password', array(), null, 'boinc:forgot-password')); |
|
| 1286 | 1286 | // Replace name/email text box with email only; retain "name" label |
| 1287 | 1287 | // for compatibility with standard Drupal submit function |
| 1288 | 1288 | unset($form['name']); |
| 1289 | 1289 | array_unshift($form, array( |
| 1290 | 1290 | 'name' => array( |
| 1291 | 1291 | '#type' => 'textfield', |
| 1292 | - '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), |
|
| 1292 | + '#title' => bts('Email address', array(), null, 'boinc:email-address-to-login'), |
|
| 1293 | 1293 | '#size' => 60, |
| 1294 | 1294 | '#maxlength' => EMAIL_MAX_LENGTH, |
| 1295 | - '#required' => TRUE, |
|
| 1295 | + '#required' => true, |
|
| 1296 | 1296 | '#description' => bts( |
| 1297 | 1297 | 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).', |
| 1298 | 1298 | array( |
| 1299 | 1299 | '!authenticator_login' => l( |
| 1300 | - bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), |
|
| 1300 | + bts('authenticator-based login', array(), null, 'boinc:forgot-password'), |
|
| 1301 | 1301 | 'user/login/auth' |
| 1302 | 1302 | ) |
| 1303 | 1303 | ) |
| 1304 | - , NULL, 'boinc:forgot-password'), |
|
| 1304 | + , null, 'boinc:forgot-password'), |
|
| 1305 | 1305 | ), |
| 1306 | 1306 | )); |
| 1307 | 1307 | |
@@ -1322,11 +1322,11 @@ discard block |
||
| 1322 | 1322 | ); |
| 1323 | 1323 | $form['buttons']['submit'] = $form['submit']; |
| 1324 | 1324 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
| 1325 | - $form['buttons']['submit']['#value'] = bts('Send', array(), NULL, 'boinc:form-send'); |
|
| 1325 | + $form['buttons']['submit']['#value'] = bts('Send', array(), null, 'boinc:form-send'); |
|
| 1326 | 1326 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 1327 | 1327 | $form['buttons']['submit']['#weight'] = 1002; |
| 1328 | 1328 | $form['buttons']['cancel'] = array( |
| 1329 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
| 1329 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
| 1330 | 1330 | '#weight' => 1005, |
| 1331 | 1331 | ); |
| 1332 | 1332 | $form['buttons']['form control tabs suffix'] = array( |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | break; |
| 1344 | 1344 | |
| 1345 | 1345 | case 'views_exposed_form': |
| 1346 | - $form['submit']['#value'] = bts('Search', array(), NULL, 'boinc:search-user'); |
|
| 1346 | + $form['submit']['#value'] = bts('Search', array(), null, 'boinc:search-user'); |
|
| 1347 | 1347 | break; |
| 1348 | 1348 | } |
| 1349 | 1349 | } |
@@ -1375,7 +1375,7 @@ discard block |
||
| 1375 | 1375 | function boincuser_process_password_confirm($element) { |
| 1376 | 1376 | // Check if parent element is "account". |
| 1377 | 1377 | if ($element['#array_parents'][0] == 'account') { |
| 1378 | - $element['pass1']['#title'] = bts('Change password', array(), NULL, 'boinc:forgot-password'); |
|
| 1378 | + $element['pass1']['#title'] = bts('Change password', array(), null, 'boinc:forgot-password'); |
|
| 1379 | 1379 | } |
| 1380 | 1380 | return $element; |
| 1381 | 1381 | } |
@@ -1395,7 +1395,7 @@ discard block |
||
| 1395 | 1395 | /** |
| 1396 | 1396 | * Implementation of hook_token_values |
| 1397 | 1397 | */ |
| 1398 | -function boincuser_token_values($type, $object = NULL, $options = array()) { |
|
| 1398 | +function boincuser_token_values($type, $object = null, $options = array()) { |
|
| 1399 | 1399 | if ($type == 'user') { |
| 1400 | 1400 | $account = user_load($object->uid); |
| 1401 | 1401 | $tokens['display-name'] = $account->boincuser_name; |
@@ -1463,13 +1463,13 @@ discard block |
||
| 1463 | 1463 | require_boinc('boinc_db'); |
| 1464 | 1464 | $num_deleted = BoincUserDeleted::delete_expired(); |
| 1465 | 1465 | if ($num_deleted>0) { |
| 1466 | - watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
|
| 1466 | + watchdog('boincuser', "deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
|
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | // Delete expired tokens from token table |
| 1470 | 1470 | $tokens_deleted = BoincToken::delete_expired(); |
| 1471 | 1471 | if ($tokens_deleted>0) { |
| 1472 | - watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
|
| 1472 | + watchdog('boincuser', "deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
|
| 1473 | 1473 | } |
| 1474 | 1474 | } |
| 1475 | 1475 | |
@@ -1511,8 +1511,8 @@ discard block |
||
| 1511 | 1511 | if (!isset($account->roles[$verified_contributor])) { |
| 1512 | 1512 | drupal_set_message(bts( |
| 1513 | 1513 | 'You may only create or modify your user profile after earning @count credits.', |
| 1514 | - array('@count' => $min_credit_to_post), NULL, 'boinc:view-profile' |
|
| 1515 | - ), 'warning', FALSE); |
|
| 1514 | + array('@count' => $min_credit_to_post), null, 'boinc:view-profile' |
|
| 1515 | + ), 'warning', false); |
|
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | 1518 | // For now, just call the user module profile view function |
@@ -1555,35 +1555,35 @@ discard block |
||
| 1555 | 1555 | if ($registration_enabled) { |
| 1556 | 1556 | $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
| 1557 | 1557 | array( |
| 1558 | - '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
|
| 1558 | + '!create_an_account' => l(bts('create an account', array(), null, 'boinc:join-page'), 'user/registration'), |
|
| 1559 | 1559 | '@sitename' => $site_name, |
| 1560 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1560 | + ), null, 'boinc:join-page') . '</li>'; |
|
| 1561 | 1561 | } |
| 1562 | - $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; |
|
| 1562 | + $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), null, 'boinc:join-page') . '</li>'; |
|
| 1563 | 1563 | $output .= ' <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
| 1564 | 1564 | array( |
| 1565 | 1565 | '@sitename' => $site_name, |
| 1566 | 1566 | '@siteurl' => $base_url, |
| 1567 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1567 | + ), null, 'boinc:join-page') . '</li>'; |
|
| 1568 | 1568 | if ($registration_enabled) { |
| 1569 | 1569 | $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", |
| 1570 | 1570 | array( |
| 1571 | 1571 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
| 1572 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1572 | + ), null, 'boinc:join-page') . '</li>'; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | else { |
| 1575 | 1575 | $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
| 1576 | 1576 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.", |
| 1577 | 1577 | array( |
| 1578 | 1578 | '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
| 1579 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1579 | + ), null, 'boinc:join-page') . '</li>'; |
|
| 1580 | 1580 | } |
| 1581 | 1581 | $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please |
| 1582 | 1582 | upgrade to a more recent version of BOINC to create an account |
| 1583 | 1583 | at @this_project.", |
| 1584 | 1584 | array( |
| 1585 | 1585 | '@this_project' => $site_name, |
| 1586 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1586 | + ), null, 'boinc:join-page') . '</li>'; |
|
| 1587 | 1587 | $output .= '</ol>'; |
| 1588 | 1588 | break; |
| 1589 | 1589 | case 'new': |
@@ -1603,29 +1603,29 @@ discard block |
||
| 1603 | 1603 | if ($registration_enabled) { |
| 1604 | 1604 | $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
| 1605 | 1605 | array( |
| 1606 | - '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
|
| 1606 | + '!create_an_account' => l(bts('create an account', array(), null, 'boinc:join-page'), 'user/registration'), |
|
| 1607 | 1607 | '@sitename' => $site_name, |
| 1608 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1608 | + ), null, 'boinc:join-page') . '</li>'; |
|
| 1609 | 1609 | } |
| 1610 | 1610 | else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
| 1611 | 1611 | $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
| 1612 | - '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
|
| 1613 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1612 | + '!rules_and_policies' => l(bts('Rules and Policies', array(), null, 'boinc:join-page'), $ruleslink), |
|
| 1613 | + ), null, 'boinc:join-page') . '</li>'; |
|
| 1614 | 1614 | } |
| 1615 | - $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
| 1615 | + $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), null, 'boinc:join-page'); |
|
| 1616 | 1616 | $output .= ' <p>'; |
| 1617 | 1617 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>'; |
| 1618 | 1618 | $output .= ' </p>'; |
| 1619 | 1619 | $output .= ' ' . bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( |
| 1620 | 1620 | '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>', |
| 1621 | 1621 | '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>', |
| 1622 | - ), NULL, 'boinc:join-page'); |
|
| 1622 | + ), null, 'boinc:join-page'); |
|
| 1623 | 1623 | $output .= ' </li>'; |
| 1624 | - $output .= ' <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; |
|
| 1624 | + $output .= ' <li>' . bts('Run the installer.', array(), null, 'boinc:join-page') . '</li>'; |
|
| 1625 | 1625 | $output .= ' <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( |
| 1626 | 1626 | '@sitename' => $site_name, |
| 1627 | 1627 | '@siteurl' => $base_url, |
| 1628 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
| 1628 | + ), null, 'boinc:join-page') . '</li>'; |
|
| 1629 | 1629 | $output .= '</ol>'; |
| 1630 | 1630 | } |
| 1631 | 1631 | $output .= '</div>'; |
@@ -1656,17 +1656,17 @@ discard block |
||
| 1656 | 1656 | else { |
| 1657 | 1657 | $uotd = user_load($current_uotd->uid); |
| 1658 | 1658 | } |
| 1659 | - $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
|
| 1659 | + $uotd_image = boincuser_get_user_profile_image($uotd->uid, false); |
|
| 1660 | 1660 | $output = '<h2 class="pane-title">'; |
| 1661 | - $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); |
|
| 1661 | + $output .= ($user->uid) ? bts('Welcome back!', array(), null, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), null, 'boinc:front-page')); |
|
| 1662 | 1662 | $output .= '</h2>'; |
| 1663 | 1663 | $output .= '<div class="boinc-overview balance-height-front">'; |
| 1664 | - $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
| 1664 | + $output .= ' <div>' . bts($site_message, array(), null, "project:front page") . ' ' . l(bts('Learn more', array(), null, 'boinc:front-page'), 'about') . '</div>'; |
|
| 1665 | 1665 | if ($user->uid) { |
| 1666 | - $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
| 1666 | + $output .= ' <div>' . l(bts('View account', array(), null, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
| 1667 | 1667 | } |
| 1668 | 1668 | else { |
| 1669 | - $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
| 1669 | + $output .= ' <div>' . l(bts('Join now', array(), null, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
| 1670 | 1670 | } |
| 1671 | 1671 | $output .= '</div>'; |
| 1672 | 1672 | $output .= '<div class="boinc-overview-details">'; |
@@ -1674,17 +1674,17 @@ discard block |
||
| 1674 | 1674 | $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
| 1675 | 1675 | $output .= ' <div class="picture">'; |
| 1676 | 1676 | $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
| 1677 | - $uotd_image['alt'], array(), FALSE); |
|
| 1677 | + $uotd_image['alt'], array(), false); |
|
| 1678 | 1678 | $output .= ' </div>'; |
| 1679 | - $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1679 | + $output .= ' <div class="text">' . bts('User of the day', array(), null, 'boinc:front-page') . '</div>'; |
|
| 1680 | 1680 | $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
| 1681 | 1681 | $output .= ' </a>'; |
| 1682 | 1682 | $output .= ' <div class="volunteers">'; |
| 1683 | - $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1683 | + $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), null, 'boinc:front-page') . '</div>'; |
|
| 1684 | 1684 | $output .= ' <div class="platforms">'; |
| 1685 | - $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1686 | - $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1687 | - $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
| 1685 | + $output .= ' <div class="detail platform windows">' . bts('Windows', array(), null, 'boinc:front-page') . '</div>'; |
|
| 1686 | + $output .= ' <div class="detail platform mac">' . bts('Mac', array(), null, 'boinc:front-page') . '</div>'; |
|
| 1687 | + $output .= ' <div class="detail platform linux">' . bts('Linux', array(), null, 'boinc:front-page') . '</div>'; |
|
| 1688 | 1688 | $output .= ' </div>'; |
| 1689 | 1689 | $output .= ' </div>'; |
| 1690 | 1690 | $output .= ' </div>'; |
@@ -1712,12 +1712,12 @@ discard block |
||
| 1712 | 1712 | xml_header(); |
| 1713 | 1713 | |
| 1714 | 1714 | // Account creation disabled |
| 1715 | - $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
|
| 1715 | + $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', true); |
|
| 1716 | 1716 | if (!$enablethisRPC) { |
| 1717 | 1717 | $mess = bts('Account creation is done through our Web site. Please register at @url', array( |
| 1718 | 1718 | '@url' => $base_url . '/user/registration', |
| 1719 | 1719 | ), |
| 1720 | - NULL, 'boinc:create_account'); |
|
| 1720 | + null, 'boinc:create_account'); |
|
| 1721 | 1721 | xml_error(-208, $mess); |
| 1722 | 1722 | } |
| 1723 | 1723 | // Invalid invite code |
@@ -1771,7 +1771,7 @@ discard block |
||
| 1771 | 1771 | 'init' => $params['email_addr'], |
| 1772 | 1772 | 'roles' => array($unrestricted_role => ''), |
| 1773 | 1773 | 'boincuser_name' => $params['user_name'], |
| 1774 | - 'boinchash_flag' => TRUE, |
|
| 1774 | + 'boinchash_flag' => true, |
|
| 1775 | 1775 | ); |
| 1776 | 1776 | |
| 1777 | 1777 | // Create the drupal user. If the drupal user cannot be created, |
@@ -1808,20 +1808,20 @@ discard block |
||
| 1808 | 1808 | } |
| 1809 | 1809 | |
| 1810 | 1810 | if (strlen($authtoken) != 32) { |
| 1811 | - drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); |
|
| 1811 | + drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), null, 'boinc:account-finish'), 'error'); |
|
| 1812 | 1812 | drupal_goto(); |
| 1813 | 1813 | } |
| 1814 | 1814 | |
| 1815 | 1815 | require_boinc('boinc_db'); |
| 1816 | 1816 | $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); |
| 1817 | 1817 | if (!$boinc_user) { |
| 1818 | - drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); |
|
| 1818 | + drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), null, 'boinc:account-finish'), 'error'); |
|
| 1819 | 1819 | drupal_goto(); |
| 1820 | 1820 | } |
| 1821 | 1821 | $user = user_load(get_drupal_id($boinc_user->id)); |
| 1822 | 1822 | |
| 1823 | 1823 | if (!$user) { |
| 1824 | - drupal_set_message(bts('ERROR: There was a problem loading your account. Try logging in with your user name and password.', array(), NULL, 'boinc:account-finish'), 'error'); |
|
| 1824 | + drupal_set_message(bts('ERROR: There was a problem loading your account. Try logging in with your user name and password.', array(), null, 'boinc:account-finish'), 'error'); |
|
| 1825 | 1825 | drupal_goto(); |
| 1826 | 1826 | } |
| 1827 | 1827 | |
@@ -1842,9 +1842,9 @@ discard block |
||
| 1842 | 1842 | // Check moderation page exists |
| 1843 | 1843 | $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
| 1844 | 1844 | if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
| 1845 | - $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish'); |
|
| 1845 | + $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), null, 'boinc:account-finish'), $moderationpath, $options)), null, 'boinc:account-finish'); |
|
| 1846 | 1846 | } else { |
| 1847 | - $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); |
|
| 1847 | + $modsentence = bts('Please note: user profiles are subject to moderation.', array(), null, 'boinc:account-finish'); |
|
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | 1850 | $username = $user->boincuser_name; |
@@ -1853,73 +1853,73 @@ discard block |
||
| 1853 | 1853 | array( |
| 1854 | 1854 | '@user_name' => $username, |
| 1855 | 1855 | '@site_name' => $site_name, |
| 1856 | - ), NULL, 'boinc:account-finish') . "</p>"; |
|
| 1856 | + ), null, 'boinc:account-finish') . "</p>"; |
|
| 1857 | 1857 | |
| 1858 | 1858 | $links = array( |
| 1859 | 1859 | array( |
| 1860 | 1860 | 'data' => bts('Change your username at !community_preferences.', array( |
| 1861 | - '!community_preferences' => l(bts('Community Preferences', array(), NULL, 'boinc:account-fininsh'), 'account/prefs/community', $options), |
|
| 1862 | - ), NULL, 'boinc:account-finish'), |
|
| 1861 | + '!community_preferences' => l(bts('Community Preferences', array(), null, 'boinc:account-fininsh'), 'account/prefs/community', $options), |
|
| 1862 | + ), null, 'boinc:account-finish'), |
|
| 1863 | 1863 | 'children' => array( |
| 1864 | - bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), NULL, 'boinc:account-finish'), |
|
| 1865 | - bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), NULL, 'boinc:account-finish'), |
|
| 1864 | + bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), null, 'boinc:account-finish'), |
|
| 1865 | + bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), null, 'boinc:account-finish'), |
|
| 1866 | 1866 | ), |
| 1867 | 1867 | ), |
| 1868 | 1868 | array( |
| 1869 | 1869 | 'data' => bts('Change your !computing_preferences.', array( |
| 1870 | - '!computing_preferences' => l(bts('Computing Preferences', array(), NULL, 'boinc:account-finish'), 'account/prefs', $options), |
|
| 1871 | - ), NULL, 'boinc:account-finish'), |
|
| 1870 | + '!computing_preferences' => l(bts('Computing Preferences', array(), null, 'boinc:account-finish'), 'account/prefs', $options), |
|
| 1871 | + ), null, 'boinc:account-finish'), |
|
| 1872 | 1872 | 'children' => array( |
| 1873 | - bts('You may adjust how much CPU, RAM, and Disk space the BOINC client is allowed to use for tasks on your computer.', array(), NULL, 'boinc:account-finish'), |
|
| 1873 | + bts('You may adjust how much CPU, RAM, and Disk space the BOINC client is allowed to use for tasks on your computer.', array(), null, 'boinc:account-finish'), |
|
| 1874 | 1874 | bts('By default, you will run @site_name tasks without any additional configuration.', array( |
| 1875 | 1875 | '@site_name' => $site_name, |
| 1876 | - ), NULL, 'boinc:account-finish'), |
|
| 1876 | + ), null, 'boinc:account-finish'), |
|
| 1877 | 1877 | bts('It is recommended new volunteers leave the default settings until they gain experience running some tasks. Ask questions in the !forums to get advice before making changes to a setting you don\'t understand.', array( |
| 1878 | - '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), |
|
| 1879 | - ), NULL, 'boinc:account-finish'), |
|
| 1878 | + '!forums' => l(bts('forums', array(), null, 'boinc:account-finish'), 'community/forum', $options), |
|
| 1879 | + ), null, 'boinc:account-finish'), |
|
| 1880 | 1880 | ), |
| 1881 | 1881 | ), |
| 1882 | 1882 | array( |
| 1883 | 1883 | 'data' => bts('Create a !user_profile.', array( |
| 1884 | - '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), |
|
| 1885 | - ), NULL, 'boinc:account-finish'), |
|
| 1884 | + '!user_profile' => l(bts('User Profile', array(), null, 'boinc:account-finish'), '/account/profile/edit', $options), |
|
| 1885 | + ), null, 'boinc:account-finish'), |
|
| 1886 | 1886 | 'children' => array( |
| 1887 | 1887 | bts('A user profile will inform other volunteers who you are and why you joined @site_name.', array( |
| 1888 | 1888 | '@site_name' => $site_name, |
| 1889 | - ), NULL, 'boinc:account-finish'), |
|
| 1889 | + ), null, 'boinc:account-finish'), |
|
| 1890 | 1890 | $modsentence, |
| 1891 | 1891 | ), |
| 1892 | 1892 | ), |
| 1893 | 1893 | array( |
| 1894 | 1894 | 'data' => bts('Join a !team.', array( |
| 1895 | - '!team' => l(bts('Team', array(), NULL, 'boinc:account-finish'), '/community/teams', $options), |
|
| 1896 | - ), NULL, 'boinc:account-finish'), |
|
| 1895 | + '!team' => l(bts('Team', array(), null, 'boinc:account-finish'), '/community/teams', $options), |
|
| 1896 | + ), null, 'boinc:account-finish'), |
|
| 1897 | 1897 | 'children' => array( |
| 1898 | - bts('You may join a team, made up of other volunteers.', array(), NULL, 'boinc:account-finish'), |
|
| 1898 | + bts('You may join a team, made up of other volunteers.', array(), null, 'boinc:account-finish'), |
|
| 1899 | 1899 | ), |
| 1900 | 1900 | ), |
| 1901 | 1901 | array( |
| 1902 | 1902 | 'data' => bts('Go to your !account_dashboard.', array( |
| 1903 | - '!account_dashboard'=> l(bts('Account Dashboard', array(), NULL, 'boinc:account-finish'), 'account/dashboard', $options), |
|
| 1904 | - ), NULL, 'boinc:account-finish'), |
|
| 1903 | + '!account_dashboard'=> l(bts('Account Dashboard', array(), null, 'boinc:account-finish'), 'account/dashboard', $options), |
|
| 1904 | + ), null, 'boinc:account-finish'), |
|
| 1905 | 1905 | 'children' => array( |
| 1906 | - bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), NULL, 'boinc:account-finish'), |
|
| 1906 | + bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), null, 'boinc:account-finish'), |
|
| 1907 | 1907 | ), |
| 1908 | 1908 | ), |
| 1909 | 1909 | array( |
| 1910 | 1910 | 'data' => bts('Visit our !help pages.', array( |
| 1911 | - '!help' => l(bts('Help', array(), NULL, 'boinc:account-finish'), '/help', $options) |
|
| 1912 | - ), NULL, 'boinc:account-finish'), |
|
| 1911 | + '!help' => l(bts('Help', array(), null, 'boinc:account-finish'), '/help', $options) |
|
| 1912 | + ), null, 'boinc:account-finish'), |
|
| 1913 | 1913 | 'children' => array( |
| 1914 | 1914 | bts('Ask for help in our community\'s !forums.', array( |
| 1915 | - '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) |
|
| 1916 | - ), NULL, 'boinc:account-finish'), |
|
| 1915 | + '!forums' => l(bts('forums', array(), null, 'boinc:account-finish'), 'community/forum', $options) |
|
| 1916 | + ), null, 'boinc:account-finish'), |
|
| 1917 | 1917 | ), |
| 1918 | 1918 | ), |
| 1919 | 1919 | ); |
| 1920 | 1920 | |
| 1921 | 1921 | //List of links |
| 1922 | - $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
| 1922 | + $output .= theme_item_list($links, $title = null, $type='ul'); |
|
| 1923 | 1923 | |
| 1924 | 1924 | return $output; |
| 1925 | 1925 | } |
@@ -1929,20 +1929,20 @@ discard block |
||
| 1929 | 1929 | */ |
| 1930 | 1930 | function boincuser_moderate_community_access() { |
| 1931 | 1931 | if (user_access('assign community member role') |
| 1932 | - OR user_access('assign all roles')) { |
|
| 1933 | - return TRUE; |
|
| 1932 | + or user_access('assign all roles')) { |
|
| 1933 | + return true; |
|
| 1934 | 1934 | } |
| 1935 | - return FALSE; |
|
| 1935 | + return false; |
|
| 1936 | 1936 | } |
| 1937 | 1937 | |
| 1938 | 1938 | /** |
| 1939 | 1939 | * Get the count of items in the moderation queue |
| 1940 | 1940 | */ |
| 1941 | 1941 | function boincuser_moderation_queue_count($caller = 'user') { |
| 1942 | - $allowed = FALSE; |
|
| 1942 | + $allowed = false; |
|
| 1943 | 1943 | switch ($caller) { |
| 1944 | 1944 | case 'cron': |
| 1945 | - $allowed = TRUE; |
|
| 1945 | + $allowed = true; |
|
| 1946 | 1946 | break; |
| 1947 | 1947 | case 'user': |
| 1948 | 1948 | default: |
@@ -1956,7 +1956,7 @@ discard block |
||
| 1956 | 1956 | AND moderate = 1" |
| 1957 | 1957 | )); |
| 1958 | 1958 | } |
| 1959 | - return NULL; |
|
| 1959 | + return null; |
|
| 1960 | 1960 | } |
| 1961 | 1961 | |
| 1962 | 1962 | /** |
@@ -1964,10 +1964,10 @@ discard block |
||
| 1964 | 1964 | * Allow community membership status to be set for users by direct link rather |
| 1965 | 1965 | * than through the user account info form. |
| 1966 | 1966 | */ |
| 1967 | -function boincuser_control($uid = NULL, $action = NULL) { |
|
| 1968 | - if (!$uid OR !$account = user_load($uid)) { |
|
| 1967 | +function boincuser_control($uid = null, $action = null) { |
|
| 1968 | + if (!$uid or !$account = user_load($uid)) { |
|
| 1969 | 1969 | // What are you even doing here... |
| 1970 | - return FALSE; |
|
| 1970 | + return false; |
|
| 1971 | 1971 | } |
| 1972 | 1972 | switch ($action) { |
| 1973 | 1973 | case 'ban': |
@@ -2073,7 +2073,7 @@ discard block |
||
| 2073 | 2073 | */ |
| 2074 | 2074 | function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') { |
| 2075 | 2075 | if (user_access('assign community member role') |
| 2076 | - OR user_access('assign all roles')) { |
|
| 2076 | + or user_access('assign all roles')) { |
|
| 2077 | 2077 | $account = user_load($uid); |
| 2078 | 2078 | if ($account->uid) { |
| 2079 | 2079 | module_load_include('inc', 'rules', 'modules/system.rules'); |
@@ -2153,7 +2153,7 @@ discard block |
||
| 2153 | 2153 | * User profile image is managed by the content_profile module rather than core |
| 2154 | 2154 | * Drupal User so must be inserted into comments, etc. (not so by default) |
| 2155 | 2155 | */ |
| 2156 | -function boincuser_get_user_profile_image($uid, $avatar = TRUE) { |
|
| 2156 | +function boincuser_get_user_profile_image($uid, $avatar = true) { |
|
| 2157 | 2157 | // Though the function name implies otherwise, get the avatar by default |
| 2158 | 2158 | $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid'; |
| 2159 | 2159 | $image_fid = db_result(db_query(" |
@@ -2166,7 +2166,7 @@ discard block |
||
| 2166 | 2166 | if (!$user_image['image']['filepath']) { |
| 2167 | 2167 | // Load the default image if one does not exist |
| 2168 | 2168 | $account = user_load($uid); |
| 2169 | - if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) { |
|
| 2169 | + if ($avatar and module_exists('gravatar') and user_access('use gravatar', $account) and $account->gravatar) { |
|
| 2170 | 2170 | // Use a Gravatar rather than the system default image |
| 2171 | 2171 | $options = array( |
| 2172 | 2172 | 'size' => 100, |
@@ -2194,23 +2194,23 @@ discard block |
||
| 2194 | 2194 | * Generate a table of a user's projects |
| 2195 | 2195 | */ |
| 2196 | 2196 | function boincuser_get_projects_table($account = null) { |
| 2197 | - if ($account AND is_numeric($account)) { |
|
| 2197 | + if ($account and is_numeric($account)) { |
|
| 2198 | 2198 | $account = user_load($account); |
| 2199 | 2199 | } |
| 2200 | 2200 | $projects = boincuser_get_projects($account); |
| 2201 | - if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
|
| 2201 | + if (!$projects) return bts('no projects...', array(), null, 'boinc:account-dashboard'); |
|
| 2202 | 2202 | |
| 2203 | 2203 | $output = ''; |
| 2204 | 2204 | $output .= '<table class="user-projects">' . "\n"; |
| 2205 | 2205 | $output .= '<thead>' . "\n"; |
| 2206 | 2206 | $output .= ' <tr>' . "\n"; |
| 2207 | - $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
| 2208 | - $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
| 2209 | - $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
| 2207 | + $output .= ' <th>' . bts('Name', array(), null, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
| 2208 | + $output .= ' <th class="numeric">' . bts('Avg credit', array(), null, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
| 2209 | + $output .= ' <th class="numeric">' . bts('Total credit', array(), null, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
| 2210 | 2210 | $output .= ' </tr>' . "\n"; |
| 2211 | 2211 | $output .= '</thead>' . "\n"; |
| 2212 | 2212 | $output .= '<tbody>' . "\n"; |
| 2213 | - foreach ($projects AS $project) { |
|
| 2213 | + foreach ($projects as $project) { |
|
| 2214 | 2214 | $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id; |
| 2215 | 2215 | $output .= ' <tr>' . "\n"; |
| 2216 | 2216 | $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n"; |
@@ -2248,7 +2248,7 @@ discard block |
||
| 2248 | 2248 | if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { |
| 2249 | 2249 | return simplexml_load_string($result->data); |
| 2250 | 2250 | } |
| 2251 | - return NULL; |
|
| 2251 | + return null; |
|
| 2252 | 2252 | } |
| 2253 | 2253 | |
| 2254 | 2254 | /** |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | |
| 2265 | 2265 | $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid); |
| 2266 | 2266 | |
| 2267 | - return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null; |
|
| 2267 | + return ($account_stats and isset($account_stats->project)) ? $account_stats->project : null; |
|
| 2268 | 2268 | } |
| 2269 | 2269 | |
| 2270 | 2270 | |
@@ -2277,18 +2277,18 @@ discard block |
||
| 2277 | 2277 | $profile = content_profile_load('profile', $account->uid); |
| 2278 | 2278 | $output = ''; |
| 2279 | 2279 | if ($profile) { |
| 2280 | - $profile_is_approved = ($profile->status AND !$profile->moderate); |
|
| 2280 | + $profile_is_approved = ($profile->status and !$profile->moderate); |
|
| 2281 | 2281 | $user_is_moderator = user_access('edit any profile content'); |
| 2282 | 2282 | $is_own_profile = ($user->uid == $account->uid); |
| 2283 | 2283 | $profile_moderation_path = "moderate/profile/{$account->uid}"; |
| 2284 | 2284 | $links = array(); |
| 2285 | 2285 | |
| 2286 | - if ($profile->moderate AND $user_is_moderator) { |
|
| 2286 | + if ($profile->moderate and $user_is_moderator) { |
|
| 2287 | 2287 | $links['approve_profile'] = array( |
| 2288 | - 'title' => bts('Approve profile', array(), NULL, 'boinc:moderate-user'), |
|
| 2288 | + 'title' => bts('Approve profile', array(), null, 'boinc:moderate-user'), |
|
| 2289 | 2289 | 'href' => "{$profile_moderation_path}/approve", |
| 2290 | 2290 | 'attributes' => array( |
| 2291 | - 'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), |
|
| 2291 | + 'title' => bts('Approve this profile content', array(), null, 'boinc:moderate-user'), |
|
| 2292 | 2292 | 'class' => 'first primary tab', |
| 2293 | 2293 | ) |
| 2294 | 2294 | ); |
@@ -2301,10 +2301,10 @@ discard block |
||
| 2301 | 2301 | ) |
| 2302 | 2302 | );*/ |
| 2303 | 2303 | $links['reject_profile'] = array( |
| 2304 | - 'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), |
|
| 2304 | + 'title' => bts('Reject profile', array(), null, 'boinc:moderate-user'), |
|
| 2305 | 2305 | 'href' => "{$profile_moderation_path}/reject", |
| 2306 | 2306 | 'attributes' => array( |
| 2307 | - 'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), |
|
| 2307 | + 'title' => bts('Reject this profile content', array(), null, 'boinc:moderate-user'), |
|
| 2308 | 2308 | 'class' => 'tab', |
| 2309 | 2309 | ) |
| 2310 | 2310 | ); |
@@ -2358,7 +2358,7 @@ discard block |
||
| 2358 | 2358 | function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { |
| 2359 | 2359 | |
| 2360 | 2360 | foreach ($documents as $document) { |
| 2361 | - if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { |
|
| 2361 | + if ( $document->entity_type=='node' and $document->bundle=='profile' ) { |
|
| 2362 | 2362 | // Node information. |
| 2363 | 2363 | $nid = $document->entity_id; |
| 2364 | 2364 | $node = node_load($nid); |
@@ -2412,7 +2412,7 @@ discard block |
||
| 2412 | 2412 | if ($recipient = user_load(array('uid' => $drupalid))) { |
| 2413 | 2413 | // Double-check that the loaded user matches both boincuser_id |
| 2414 | 2414 | // and boincuser_name. |
| 2415 | - if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
| 2415 | + if ( ($boincid == $recipient->boincuser_id) and ($boincname == $recipient->boincuser_name) ) { |
|
| 2416 | 2416 | return $recipient; |
| 2417 | 2417 | } |
| 2418 | 2418 | } |
@@ -556,14 +556,14 @@ |
||
| 556 | 556 | $tnow = get_str('tnow', true); |
| 557 | 557 | $ttok = get_str('ttok', true); |
| 558 | 558 | if (!$tnow) { |
| 559 | - if (isset($_POST['tnow'])) { |
|
| 560 | - $tnow = $_POST['tnow']; |
|
| 561 | - } |
|
| 559 | + if (isset($_POST['tnow'])) { |
|
| 560 | + $tnow = $_POST['tnow']; |
|
| 561 | + } |
|
| 562 | 562 | } |
| 563 | 563 | if (!$ttok) { |
| 564 | - if (isset($_POST['ttok'])) { |
|
| 565 | - $ttok = $_POST['ttok']; |
|
| 566 | - } |
|
| 564 | + if (isset($_POST['ttok'])) { |
|
| 565 | + $ttok = $_POST['ttok']; |
|
| 566 | + } |
|
| 567 | 567 | } |
| 568 | 568 | if (!$tnow) return false; |
| 569 | 569 | if (!$ttok) return false; |
@@ -306,7 +306,7 @@ |
||
| 306 | 306 | <link rel="stylesheet" href="custom_dark.css" media="(prefers-color-scheme: dark)"> |
| 307 | 307 | <link rel="stylesheet" href="sample_bootstrap.min.css" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: light)"> |
| 308 | 308 | <link rel="stylesheet" href="custom.css" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: light)"> |
| 309 | -EOT; |
|
| 309 | +eot; |
|
| 310 | 310 | } else { |
| 311 | 311 | echo ' |
| 312 | 312 | <link type="text/css" rel="stylesheet" href="'.secure_url_base().'/bootstrap.min.css" media="all"> |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | // with an existing web framework can more easily do so. |
| 243 | 243 | // To do so, define page_head() in the project include file. |
| 244 | 244 | // |
| 245 | -if (!function_exists("page_head")){ |
|
| 245 | +if (!function_exists("page_head")) { |
|
| 246 | 246 | function page_head( |
| 247 | 247 | $title, |
| 248 | 248 | // page title. Put in <title>, used as title for browser tab. |
@@ -361,7 +361,8 @@ discard block |
||
| 361 | 361 | echo '<div class="container-fluid"> |
| 362 | 362 | '; |
| 363 | 363 | |
| 364 | - switch($title) { //kludge |
|
| 364 | + switch($title) { |
|
| 365 | +//kludge |
|
| 365 | 366 | case tra("Log in"): |
| 366 | 367 | case tra("Create an account"): |
| 367 | 368 | case tra("Server status page"): |
@@ -376,7 +377,7 @@ discard block |
||
| 376 | 377 | |
| 377 | 378 | // See the comments for page_head() |
| 378 | 379 | // |
| 379 | -if (!function_exists("page_tail")){ |
|
| 380 | +if (!function_exists("page_tail")) { |
|
| 380 | 381 | function page_tail( |
| 381 | 382 | $show_date=false, |
| 382 | 383 | // true for pages that are generated periodically rather than on the fly |
@@ -882,7 +883,7 @@ discard block |
||
| 882 | 883 | return $str; |
| 883 | 884 | } |
| 884 | 885 | |
| 885 | -function strip_bbcode($string){ |
|
| 886 | +function strip_bbcode($string) { |
|
| 886 | 887 | return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
| 887 | 888 | } |
| 888 | 889 | |
@@ -1186,7 +1187,7 @@ discard block |
||
| 1186 | 1187 | // Otherwise return 0. |
| 1187 | 1188 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
| 1188 | 1189 | // |
| 1189 | -function boinc_client_version(){ |
|
| 1190 | +function boinc_client_version() { |
|
| 1190 | 1191 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
| 1191 | 1192 | $x = $_SERVER['HTTP_USER_AGENT']; |
| 1192 | 1193 | $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | // |
| 34 | 34 | $config = get_config(); |
| 35 | 35 | global $master_url; |
| 36 | -$master_url = parse_config($config , "<master_url>"); |
|
| 36 | +$master_url = parse_config($config, "<master_url>"); |
|
| 37 | 37 | $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>"); |
| 38 | 38 | $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>"); |
| 39 | 39 | |
| 40 | 40 | // Set parameters to defaults if not defined in config.xml |
| 41 | 41 | |
| 42 | 42 | $x = parse_config($config, "<user_country>"); |
| 43 | -define('USER_COUNTRY', ($x===null)?1:(int)$x); |
|
| 43 | +define('USER_COUNTRY', ($x === null) ? 1 : (int)$x); |
|
| 44 | 44 | |
| 45 | 45 | $x = parse_config($config, "<user_url>"); |
| 46 | -define('USER_URL', ($x===null)?1:(int)$x); |
|
| 46 | +define('USER_URL', ($x === null) ? 1 : (int)$x); |
|
| 47 | 47 | |
| 48 | 48 | // Set parameters to defaults if not defined in project.inc |
| 49 | 49 | |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | function url_base() { |
| 154 | - return is_https()?secure_url_base():URL_BASE; |
|
| 154 | + return is_https() ?secure_url_base() : URL_BASE; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
| 157 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
| 158 | 158 | global $master_url; |
| 159 | 159 | |
| 160 | 160 | // the following allows independent login for projects on the same server |
@@ -165,15 +165,15 @@ discard block |
||
| 165 | 165 | $path = substr($path, 0, -1); |
| 166 | 166 | $path .= "_ops/"; |
| 167 | 167 | } |
| 168 | - $expire = $permanent?time()+3600*24*365:0; |
|
| 168 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
| 169 | 169 | setcookie($name, $value, $expire, $path, |
| 170 | 170 | '', |
| 171 | - is_https(), // if this page is secure, make cookie secure |
|
| 171 | + is_https(), // if this page is secure, make cookie secure |
|
| 172 | 172 | true // httponly; no JS access |
| 173 | 173 | ); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | -function clear_cookie($name, $ops=false) { |
|
| 176 | +function clear_cookie($name, $ops = false) { |
|
| 177 | 177 | global $master_url; |
| 178 | 178 | $url = parse_url($master_url); |
| 179 | 179 | $path = $url['path']; |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | $path = substr($path, 0, -1); |
| 182 | 182 | $path .= "_ops/"; |
| 183 | 183 | } |
| 184 | - setcookie($name, '', time()-3600, $path); |
|
| 184 | + setcookie($name, '', time() - 3600, $path); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $g_logged_in_user = null; |
| 188 | 188 | $got_logged_in_user = false; |
| 189 | 189 | |
| 190 | -function get_logged_in_user($must_be_logged_in=true) { |
|
| 190 | +function get_logged_in_user($must_be_logged_in = true) { |
|
| 191 | 191 | global $g_logged_in_user, $got_logged_in_user; |
| 192 | 192 | if ($got_logged_in_user) { |
| 193 | 193 | // this could have been called earlier with $must_be_logged_in false |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $next_url = $_SERVER['REQUEST_URI']; |
| 214 | 214 | $n = strrpos($next_url, "/"); |
| 215 | 215 | if ($n) { |
| 216 | - $next_url = substr($next_url, $n+1); |
|
| 216 | + $next_url = substr($next_url, $n + 1); |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | $next_url = urlencode($next_url); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | return $g_logged_in_user; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | -function show_login_info($prefix="") { |
|
| 227 | +function show_login_info($prefix = "") { |
|
| 228 | 228 | $user = get_logged_in_user(false); |
| 229 | 229 | if ($user) { |
| 230 | 230 | $url_tokens = url_tokens($user->authenticator); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -$cache_control_extra=""; |
|
| 237 | +$cache_control_extra = ""; |
|
| 238 | 238 | $is_login_page = false; |
| 239 | 239 | |
| 240 | 240 | // Call this to start pages. |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | // with an existing web framework can more easily do so. |
| 247 | 247 | // To do so, define page_head() in the project include file. |
| 248 | 248 | // |
| 249 | -if (!function_exists("page_head")){ |
|
| 249 | +if (!function_exists("page_head")) { |
|
| 250 | 250 | function page_head( |
| 251 | 251 | $title, |
| 252 | 252 | // page title. Put in <title>, used as title for browser tab. |
| 253 | - $body_attrs=null, |
|
| 253 | + $body_attrs = null, |
|
| 254 | 254 | // <body XXXX> |
| 255 | 255 | // e.g. Javascript to put focus in an input field |
| 256 | 256 | // (onload="document.form.foo.focus()") |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | // if set, include schedulers.txt. |
| 260 | 260 | // also pass to project_banner() in case you want a different |
| 261 | 261 | // header for your main page. |
| 262 | - $url_prefix="", |
|
| 262 | + $url_prefix = "", |
|
| 263 | 263 | // prepend this to links. |
| 264 | 264 | // Use for web pages not in the top directory |
| 265 | - $head_extra=null |
|
| 265 | + $head_extra = null |
|
| 266 | 266 | // extra stuff to put in <head>. E.g.: |
| 267 | 267 | // reCAPTCHA code (create_profile.php) |
| 268 | 268 | // bbcode javascript (forums) |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | header("Content-type: text/html; charset=utf-8"); |
| 285 | 285 | header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); |
| 286 | 286 | // Date in the past |
| 287 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); |
|
| 287 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); |
|
| 288 | 288 | // always modified |
| 289 | 289 | header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); |
| 290 | 290 | // for HTTP/1.1 |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | if ($head_extra) { |
| 306 | 306 | echo "\n$head_extra\n"; |
| 307 | 307 | } |
| 308 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
| 308 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
| 309 | 309 | readfile("schedulers.txt"); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - $t = $title?$title:PROJECT; |
|
| 312 | + $t = $title ? $title : PROJECT; |
|
| 313 | 313 | echo "<title>$t</title>\n"; |
| 314 | 314 | echo ' |
| 315 | 315 | <meta charset="utf-8"> |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | echo '<div class="container-fluid"> |
| 366 | 366 | '; |
| 367 | 367 | |
| 368 | - switch($title) { //kludge |
|
| 368 | + switch ($title) { //kludge |
|
| 369 | 369 | case tra("Log in"): |
| 370 | 370 | case tra("Create an account"): |
| 371 | 371 | case tra("Server status page"): |
@@ -380,13 +380,13 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | // See the comments for page_head() |
| 382 | 382 | // |
| 383 | -if (!function_exists("page_tail")){ |
|
| 383 | +if (!function_exists("page_tail")) { |
|
| 384 | 384 | function page_tail( |
| 385 | - $show_date=false, |
|
| 385 | + $show_date = false, |
|
| 386 | 386 | // true for pages that are generated periodically rather than on the fly |
| 387 | - $url_prefix="", |
|
| 387 | + $url_prefix = "", |
|
| 388 | 388 | // use for pages not at top level |
| 389 | - $is_main=false |
|
| 389 | + $is_main = false |
|
| 390 | 390 | // passed to project_footer; |
| 391 | 391 | ) { |
| 392 | 392 | echo "<br>\n"; |
@@ -421,24 +421,24 @@ discard block |
||
| 421 | 421 | // convert time interval in seconds to a string of the form |
| 422 | 422 | // 'D days h hours m min s sec'. |
| 423 | 423 | |
| 424 | -function time_diff($x, $res=3) { |
|
| 424 | +function time_diff($x, $res = 3) { |
|
| 425 | 425 | $x = (int)$x; |
| 426 | 426 | $days = (int)($x/86400); |
| 427 | - $hours = (int)(($x-$days*86400)/3600); |
|
| 428 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
| 429 | - $seconds = $x % 60; |
|
| 427 | + $hours = (int)(($x - $days*86400)/3600); |
|
| 428 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
| 429 | + $seconds = $x%60; |
|
| 430 | 430 | |
| 431 | 431 | $s = ""; |
| 432 | 432 | if ($days) { |
| 433 | 433 | $s .= "$days ".tra("days")." "; |
| 434 | 434 | } |
| 435 | - if ($res>0 && ($hours || strlen($s))) { |
|
| 435 | + if ($res > 0 && ($hours || strlen($s))) { |
|
| 436 | 436 | $s .= "$hours ".tra("hours")." "; |
| 437 | 437 | } |
| 438 | - if ($res>1 && ($minutes || strlen($s))) { |
|
| 438 | + if ($res > 1 && ($minutes || strlen($s))) { |
|
| 439 | 439 | $s .= "$minutes ".tra("min")." "; |
| 440 | 440 | } |
| 441 | - if ($res>2) { |
|
| 441 | + if ($res > 2) { |
|
| 442 | 442 | $s .= "$seconds ".tra("sec")." "; |
| 443 | 443 | } |
| 444 | 444 | return $s; |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | |
| 453 | 453 | function time_str($x) { |
| 454 | 454 | if ($x == 0) return "---"; |
| 455 | - return gmdate('j M Y, G:i:s', (int)$x) . " UTC"; |
|
| 455 | + return gmdate('j M Y, G:i:s', (int)$x)." UTC"; |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | function local_time_str($x) { |
@@ -464,14 +464,14 @@ discard block |
||
| 464 | 464 | return time_str($x); |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | -function start_table_str($class="", $style="") { |
|
| 468 | - $s = $style?'style="'.$style.'"':''; |
|
| 467 | +function start_table_str($class = "", $style = "") { |
|
| 468 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
| 469 | 469 | return '<div class="table"> |
| 470 | 470 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
| 471 | 471 | '; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | -function start_table($class="", $style="") { |
|
| 474 | +function start_table($class = "", $style = "") { |
|
| 475 | 475 | echo start_table_str($class, $style); |
| 476 | 476 | } |
| 477 | 477 | |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | echo "</tr>\n"; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | -function row1($x, $ncols=2, $class="heading") { |
|
| 519 | +function row1($x, $ncols = 2, $class = "heading") { |
|
| 520 | 520 | if ($class == "heading") { |
| 521 | 521 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
| 522 | 522 | } else { |
@@ -530,10 +530,10 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | // a table row with 2 columns, with the left on right-aligned |
| 532 | 532 | |
| 533 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
| 534 | - if ($x==="") $x="<br>"; |
|
| 535 | - if ($y==="") $y="<br>"; |
|
| 536 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 533 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
| 534 | + if ($x === "") $x = "<br>"; |
|
| 535 | + if ($y === "") $y = "<br>"; |
|
| 536 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 537 | 537 | echo "<tr> |
| 538 | 538 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
| 539 | 539 | <td $attrs >$y</td> |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | // output the first part of row2(); |
| 545 | 545 | // then write the content, followed by </td></tr> |
| 546 | 546 | |
| 547 | -function row2_init($x, $lwidth='40%') { |
|
| 547 | +function row2_init($x, $lwidth = '40%') { |
|
| 548 | 548 | echo sprintf('<tr> |
| 549 | 549 | <td width="%s" %s>%s</td> |
| 550 | 550 | <td %s>', |
@@ -560,31 +560,31 @@ discard block |
||
| 560 | 560 | echo "<tr><td>$string</td></tr>"; |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | -function row_array($x, $attrs=null) { |
|
| 563 | +function row_array($x, $attrs = null) { |
|
| 564 | 564 | echo "<tr>\n"; |
| 565 | 565 | $i = 0; |
| 566 | 566 | foreach ($x as $h) { |
| 567 | - $a = $attrs?$attrs[$i]:""; |
|
| 567 | + $a = $attrs ? $attrs[$i] : ""; |
|
| 568 | 568 | echo "<td $a>$h</td>\n"; |
| 569 | 569 | $i++; |
| 570 | 570 | } |
| 571 | 571 | echo "</tr>\n"; |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 574 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 575 | 575 | |
| 576 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
| 576 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
| 577 | 577 | echo "<tr>"; |
| 578 | 578 | $i = 0; |
| 579 | 579 | foreach ($x as $h) { |
| 580 | - $a = $attrs?$attrs[$i]:""; |
|
| 580 | + $a = $attrs ? $attrs[$i] : ""; |
|
| 581 | 581 | echo "<th $a class=\"$class\">$h</th>"; |
| 582 | 582 | $i++; |
| 583 | 583 | } |
| 584 | 584 | echo "</tr>\n"; |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | -function row_heading($x, $class='bg-primary') { |
|
| 587 | +function row_heading($x, $class = 'bg-primary') { |
|
| 588 | 588 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
| 589 | 589 | ', $class, $x |
| 590 | 590 | ); |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
| 645 | 645 | // is cut short. |
| 646 | 646 | |
| 647 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
| 647 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
| 648 | 648 | $words = explode($delimiter, $sentence); |
| 649 | 649 | $total_chars = 0; |
| 650 | 650 | $trunc = false; |
@@ -727,8 +727,8 @@ discard block |
||
| 727 | 727 | |
| 728 | 728 | // returns null if the arg is optional and missing |
| 729 | 729 | // |
| 730 | -function get_int($name, $optional=false) { |
|
| 731 | - $x=null; |
|
| 730 | +function get_int($name, $optional = false) { |
|
| 731 | + $x = null; |
|
| 732 | 732 | if (isset($_GET[$name])) $x = $_GET[$name]; |
| 733 | 733 | if (!is_numeric($x)) { |
| 734 | 734 | if ($optional) { |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | |
| 748 | 748 | // returns null if the arg is optional and missing |
| 749 | 749 | // |
| 750 | -function post_num($name, $optional=false) { |
|
| 750 | +function post_num($name, $optional = false) { |
|
| 751 | 751 | $x = null; |
| 752 | 752 | if (isset($_POST[$name])) $x = $_POST[$name]; |
| 753 | 753 | if (!is_numeric($x)) { |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | |
| 763 | 763 | // returns null if the arg is optional and missing |
| 764 | 764 | // |
| 765 | -function post_int($name, $optional=false) { |
|
| 765 | +function post_int($name, $optional = false) { |
|
| 766 | 766 | $x = post_num($name, $optional); |
| 767 | 767 | if (is_null($x)) return null; |
| 768 | 768 | $y = (int)$x; |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | } |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | -function get_str($name, $optional=false) { |
|
| 783 | +function get_str($name, $optional = false) { |
|
| 784 | 784 | if (isset($_GET[$name])) { |
| 785 | 785 | $x = $_GET[$name]; |
| 786 | 786 | } else { |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | return undo_magic_quotes($x); |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | -function post_str($name, $optional=false) { |
|
| 795 | +function post_str($name, $optional = false) { |
|
| 796 | 796 | if (isset($_POST[$name])) { |
| 797 | 797 | $x = $_POST[$name]; |
| 798 | 798 | } else { |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | return undo_magic_quotes($x); |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | -function post_arr($name, $optional=false) { |
|
| 807 | +function post_arr($name, $optional = false) { |
|
| 808 | 808 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
| 809 | 809 | $x = $_POST[$name]; |
| 810 | 810 | } else { |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | // the mb_* functions are not included by default |
| 821 | 821 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
| 822 | 822 | |
| 823 | - for ($i=0; $i<strlen($str); $i++) { |
|
| 823 | + for ($i = 0; $i < strlen($str); $i++) { |
|
| 824 | 824 | $c = ord(substr($str, $i)); |
| 825 | 825 | if ($c < 32 || $c > 127) return false; |
| 826 | 826 | } |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
| 845 | 845 | // if no value was entered and this is ok |
| 846 | 846 | // |
| 847 | - if ($number=='' && !$low) return true; |
|
| 847 | + if ($number == '' && !$low) return true; |
|
| 848 | 848 | |
| 849 | 849 | // the supplied value contains alphabetic characters |
| 850 | 850 | // |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | |
| 862 | 862 | // Generate a "select" element from an array of values |
| 863 | 863 | // |
| 864 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
| 864 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
| 865 | 865 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
| 866 | 866 | |
| 867 | 867 | foreach ($array as $key => $value) { |
@@ -886,12 +886,12 @@ discard block |
||
| 886 | 886 | return $str; |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | -function strip_bbcode($string){ |
|
| 890 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
| 889 | +function strip_bbcode($string) { |
|
| 890 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | function current_url() { |
| 894 | - $url = is_https()?'https':'http'; |
|
| 894 | + $url = is_https() ? 'https' : 'http'; |
|
| 895 | 895 | $url .= "://"; |
| 896 | 896 | $url .= $_SERVER['SERVER_NAME']; |
| 897 | 897 | $url .= ":".$_SERVER['SERVER_PORT']; |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | // the colors for bootstrap's btn-success are almost illegible; |
| 910 | 910 | // the green is too light. Use a darker green. |
| 911 | 911 | // |
| 912 | -function button_style($color='green', $font_size=null) { |
|
| 912 | +function button_style($color = 'green', $font_size = null) { |
|
| 913 | 913 | $fs = ''; |
| 914 | 914 | if ($font_size) { |
| 915 | 915 | $fs = sprintf('; font-size:%dpx', $font_size); |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | // class: class of the button, e.g. btn |
| 929 | 929 | // extra: Additional text in href tag |
| 930 | 930 | // |
| 931 | -function button_text($url, $text, $desc=null, $class=null, $extra='') { |
|
| 931 | +function button_text($url, $text, $desc = null, $class = null, $extra = '') { |
|
| 932 | 932 | if (!$desc) { |
| 933 | 933 | $desc = $text; |
| 934 | 934 | } |
@@ -943,23 +943,23 @@ discard block |
||
| 943 | 943 | ); |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | -function button_text_small($url, $text, $desc=null) { |
|
| 946 | +function button_text_small($url, $text, $desc = null) { |
|
| 947 | 947 | return button_text($url, $text, $desc, "btn btn-xs", button_style()); |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | -function show_button($url, $text, $desc=null, $class=null, $extra=null) { |
|
| 950 | +function show_button($url, $text, $desc = null, $class = null, $extra = null) { |
|
| 951 | 951 | echo button_text($url, $text, $desc, $class, $extra); |
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | // for places with a bunch of buttons, like forum posts |
| 955 | 955 | // |
| 956 | -function show_button_small($url, $text, $desc=null) { |
|
| 956 | +function show_button_small($url, $text, $desc = null) { |
|
| 957 | 957 | echo button_text_small($url, $text, $desc); |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | // used for showing icons |
| 961 | 961 | // |
| 962 | -function show_image($src, $title, $alt, $height=null) { |
|
| 962 | +function show_image($src, $title, $alt, $height = null) { |
|
| 963 | 963 | $h = ""; |
| 964 | 964 | if ($height) { |
| 965 | 965 | $h = "height=\"$height\""; |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | // tries instead to connect to <replica_db_host> if tag exists. |
| 997 | 997 | // DEPRECATED - use boinc_db.inc |
| 998 | 998 | // |
| 999 | -function db_init($try_replica=false) { |
|
| 999 | +function db_init($try_replica = false) { |
|
| 1000 | 1000 | check_web_stopped(); |
| 1001 | 1001 | $retval = db_init_aux($try_replica); |
| 1002 | 1002 | if ($retval == 1) { |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | // Check this to avoid XSS vulnerability |
| 1073 | 1073 | // |
| 1074 | 1074 | function sanitize_sort_by($x) { |
| 1075 | - switch($x) { |
|
| 1075 | + switch ($x) { |
|
| 1076 | 1076 | case 'expavg_credit': |
| 1077 | 1077 | case 'total_credit': |
| 1078 | 1078 | return; |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | 1092 | function do_download($path) { |
| 1093 | - $name=basename($path); |
|
| 1093 | + $name = basename($path); |
|
| 1094 | 1094 | header('Content-Description: File Transfer'); |
| 1095 | 1095 | header('Content-Type: application/octet-stream'); |
| 1096 | 1096 | header('Content-Disposition: attachment; filename='.$name); |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | header('Expires: 0'); |
| 1099 | 1099 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 1100 | 1100 | header('Pragma: public'); |
| 1101 | - header('Content-Length: ' . filesize($path)); |
|
| 1101 | + header('Content-Length: '.filesize($path)); |
|
| 1102 | 1102 | flush(); |
| 1103 | 1103 | readfile($path); |
| 1104 | 1104 | } |
@@ -1147,10 +1147,10 @@ discard block |
||
| 1147 | 1147 | // Otherwise return 0. |
| 1148 | 1148 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
| 1149 | 1149 | // |
| 1150 | -function boinc_client_version(){ |
|
| 1150 | +function boinc_client_version() { |
|
| 1151 | 1151 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
| 1152 | 1152 | $x = $_SERVER['HTTP_USER_AGENT']; |
| 1153 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1153 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1154 | 1154 | if (preg_match($e, $x, $matches)) { |
| 1155 | 1155 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
| 1156 | 1156 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | $rem_name = $name."_remaining"; |
| 1180 | 1180 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
| 1181 | 1181 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
| 1182 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1182 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1183 | 1183 | ; |
| 1184 | 1184 | } |
| 1185 | 1185 | |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | // use the following around text with long lines, |
| 1210 | 1210 | // to limit the width and make it more readable. |
| 1211 | 1211 | // |
| 1212 | -function text_start($width=640) { |
|
| 1212 | +function text_start($width = 640) { |
|
| 1213 | 1213 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
| 1214 | 1214 | } |
| 1215 | 1215 | function text_end() { |
@@ -1235,7 +1235,7 @@ discard block |
||
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | function cert_filename() { |
| 1238 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
| 1238 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | // if user hasn't validated their email addr, tell them to |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $globals->batch = 1000; |
| 56 | 56 | $globals->lapsed_interval = 60*86400; |
| 57 | 57 | |
| 58 | -for ($i=1; $i<$argc; $i++) { |
|
| 58 | +for ($i = 1; $i < $argc; $i++) { |
|
| 59 | 59 | if ($argv[$i] == "--batch") { |
| 60 | 60 | $i++; |
| 61 | 61 | $globals->batch = $argv[$i]; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | gmdate('d F Y', $user->create_time), |
| 170 | 170 | number_format($user->total_credit, 0), |
| 171 | 171 | opt_out_url($user), |
| 172 | - floor((time() - $user->last_rpc_time) / 86400), |
|
| 172 | + floor((time() - $user->last_rpc_time)/86400), |
|
| 173 | 173 | ); |
| 174 | 174 | return preg_replace($pat, $rep, $template); |
| 175 | 175 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | while ($user = _mysql_fetch_object($result)) { |
| 239 | 239 | handle_user($user); |
| 240 | 240 | $startid = $user->id; |
| 241 | - fputs($log, $user->id . "\n"); |
|
| 241 | + fputs($log, $user->id."\n"); |
|
| 242 | 242 | fflush($log); |
| 243 | 243 | } |
| 244 | 244 | _mysql_free_result($result); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $user = _mysql_fetch_object($result); |
| 253 | 253 | if ($user) { |
| 254 | 254 | handle_user($user); |
| 255 | - fputs($log, $user->id . "\n"); |
|
| 255 | + fputs($log, $user->id."\n"); |
|
| 256 | 256 | fflush($log); |
| 257 | 257 | } |
| 258 | 258 | _mysql_free_result($result); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } else { |
| 290 | 290 | $fid = fopen($id_file, 'r'); |
| 291 | 291 | if (!$fid) { |
| 292 | - echo $id_file . ' not found - create ID list and run again\n'; |
|
| 292 | + echo $id_file.' not found - create ID list and run again\n'; |
|
| 293 | 293 | exit(); |
| 294 | 294 | } |
| 295 | 295 | $thisid = 0; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | fclose($fid); |
| 302 | 302 | } |
| 303 | - echo 'All done!' . "\n"; |
|
| 303 | + echo 'All done!'."\n"; |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | if (!function_exists('make_php_mailer')) { |
@@ -127,8 +127,7 @@ discard block |
||
| 127 | 127 | if (isset($prefs[$name]['@value'])) { |
| 128 | 128 | $default[$name] = $prefs[$name]['@value']; |
| 129 | 129 | } |
| 130 | - } |
|
| 131 | - else { |
|
| 130 | + } else { |
|
| 132 | 131 | $default[$name] = $prefs[$name]; |
| 133 | 132 | } |
| 134 | 133 | } |
@@ -655,8 +654,7 @@ discard block |
||
| 655 | 654 | // Save the preset selection (or lack thereof) |
| 656 | 655 | if (!$preset OR $preset == 'custom') { |
| 657 | 656 | $prefs['preset'] = 'custom'; |
| 658 | - } |
|
| 659 | - else { |
|
| 657 | + } else { |
|
| 660 | 658 | $prefs['preset'] = $preset; |
| 661 | 659 | } |
| 662 | 660 | |
@@ -671,8 +669,7 @@ discard block |
||
| 671 | 669 | if (!$result) { |
| 672 | 670 | watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
| 673 | 671 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
| 674 | - } |
|
| 675 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
| 672 | + } elseif (!drupal_get_messages('status', FALSE)) { |
|
| 676 | 673 | // Show this message if the set wasn't created automatically (in which case |
| 677 | 674 | // there is a message tailored to that) { |
| 678 | 675 | drupal_set_message(t('Your preferences have been updated. |
@@ -927,8 +924,7 @@ discard block |
||
| 927 | 924 | if (boincwork_host_merge($old_host, $current_host, $message)) { |
| 928 | 925 | $merged[$old_host->id] = $old_host->id; |
| 929 | 926 | $current_host = boincwork_host_get_info($current_host_id); |
| 930 | - } |
|
| 931 | - else { |
|
| 927 | + } else { |
|
| 932 | 928 | $errors[$old_host->id] = $message; |
| 933 | 929 | } |
| 934 | 930 | } |
@@ -944,8 +940,7 @@ discard block |
||
| 944 | 940 | $oxford_comma = ''; |
| 945 | 941 | } |
| 946 | 942 | $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
| 947 | - } |
|
| 948 | - else { |
|
| 943 | + } else { |
|
| 949 | 944 | $list = $last; |
| 950 | 945 | } |
| 951 | 946 | if (count($merged) == 1) { |
@@ -956,8 +951,7 @@ discard block |
||
| 956 | 951 | '@id' => $current_host_id |
| 957 | 952 | ), |
| 958 | 953 | NULL, 'boinc:account-host-merge')); |
| 959 | - } |
|
| 960 | - else { |
|
| 954 | + } else { |
|
| 961 | 955 | drupal_set_message(bts( |
| 962 | 956 | 'Computers @old_ids have been merged successfully into @id.', |
| 963 | 957 | array( |
@@ -1023,11 +1017,9 @@ discard block |
||
| 1023 | 1017 | if ($account->boincuser_default_pref_set == $venue) { |
| 1024 | 1018 | $venue_is_default = TRUE; |
| 1025 | 1019 | } |
| 1026 | - } |
|
| 1027 | - elseif (!$venue OR $venue == 'generic') { |
|
| 1020 | + } elseif (!$venue OR $venue == 'generic') { |
|
| 1028 | 1021 | $venue_is_default = TRUE; |
| 1029 | - } |
|
| 1030 | - else { |
|
| 1022 | + } else { |
|
| 1031 | 1023 | $venue_is_default = FALSE; |
| 1032 | 1024 | } |
| 1033 | 1025 | |
@@ -1047,8 +1039,7 @@ discard block |
||
| 1047 | 1039 | if (isset($prefs[$name]['@value'])) { |
| 1048 | 1040 | $default[$name] = $prefs[$name]['@value']; |
| 1049 | 1041 | } |
| 1050 | - } |
|
| 1051 | - else { |
|
| 1042 | + } else { |
|
| 1052 | 1043 | $default[$name] = $prefs[$name]; |
| 1053 | 1044 | } |
| 1054 | 1045 | } |
@@ -1232,16 +1223,13 @@ discard block |
||
| 1232 | 1223 | foreach ($element as $ordered_element) { |
| 1233 | 1224 | if (isset($ordered_element['@position'])) { |
| 1234 | 1225 | $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
| 1235 | - } |
|
| 1236 | - else { |
|
| 1226 | + } else { |
|
| 1237 | 1227 | $unordered_array[] = array($type => $ordered_element); |
| 1238 | 1228 | } |
| 1239 | 1229 | } |
| 1240 | - } |
|
| 1241 | - elseif (isset($element['@position'])) { |
|
| 1230 | + } elseif (isset($element['@position'])) { |
|
| 1242 | 1231 | $ordered_array[$element['@position']] = array($type => $element); |
| 1243 | - } |
|
| 1244 | - else { |
|
| 1232 | + } else { |
|
| 1245 | 1233 | $unordered_array[] = array($type => $element); |
| 1246 | 1234 | } |
| 1247 | 1235 | } |
@@ -1356,8 +1344,7 @@ discard block |
||
| 1356 | 1344 | // Update the user's default preference set |
| 1357 | 1345 | if ($edit['default_set']['default_venue']) { |
| 1358 | 1346 | boincwork_set_default_venue($venue); |
| 1359 | - } |
|
| 1360 | - elseif ($venue == $account->boincuser_default_pref_set) { |
|
| 1347 | + } elseif ($venue == $account->boincuser_default_pref_set) { |
|
| 1361 | 1348 | // User has cleared out the default venue setting |
| 1362 | 1349 | boincwork_set_default_venue(); |
| 1363 | 1350 | } |
@@ -1365,8 +1352,7 @@ discard block |
||
| 1365 | 1352 | if (!$result) { |
| 1366 | 1353 | watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
| 1367 | 1354 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
| 1368 | - } |
|
| 1369 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
| 1355 | + } elseif (!drupal_get_messages('status', FALSE)) { |
|
| 1370 | 1356 | // Show this message if the set wasn't created automatically (in which case |
| 1371 | 1357 | // there is a message tailored to that) |
| 1372 | 1358 | drupal_set_message(t('Your preferences have been updated. |
@@ -1519,8 +1505,7 @@ discard block |
||
| 1519 | 1505 | // Upload an avatar (pulled from profile_node_form): |
| 1520 | 1506 | if (!empty($profile_form['field_image'])) { |
| 1521 | 1507 | $form['field_image'] = $profile_form['field_image']; |
| 1522 | - } |
|
| 1523 | - else { |
|
| 1508 | + } else { |
|
| 1524 | 1509 | $form['field_image'] = array( |
| 1525 | 1510 | '#value' => '<div class="form-item">' |
| 1526 | 1511 | . '<label class="placeholder">' |
@@ -1690,8 +1675,7 @@ discard block |
||
| 1690 | 1675 | global $base_url; |
| 1691 | 1676 | if ($edit['language'] != language_default('language')) { |
| 1692 | 1677 | $form_state['redirect'] = $base_url . '/' . $edit['language'] . '/' . $_GET['q']; |
| 1693 | - } |
|
| 1694 | - else { |
|
| 1678 | + } else { |
|
| 1695 | 1679 | $form_state['redirect'] = $base_url . '/' . $_GET['q']; |
| 1696 | 1680 | } |
| 1697 | 1681 | } |
@@ -1882,8 +1866,7 @@ discard block |
||
| 1882 | 1866 | $row[] = drupal_render($form['ignoreblock']['delete'][$key]); |
| 1883 | 1867 | $rows[] = $row; |
| 1884 | 1868 | } |
| 1885 | - } |
|
| 1886 | - else { |
|
| 1869 | + } else { |
|
| 1887 | 1870 | $rows[] = array( |
| 1888 | 1871 | array( |
| 1889 | 1872 | 'data' => bts('You have not added any users to your Ignore List.', array(), NULL, 'boinc:ignore-user-list'), |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | }// switch |
| 72 | 72 | } else { |
| 73 | 73 | $form_state['storage']['wip'] = TRUE; |
| 74 | - if ( !in_array($prefs_preset, array('standard','maximum','green','minimum','custom')) ) { |
|
| 74 | + if (!in_array($prefs_preset, array('standard', 'maximum', 'green', 'minimum', 'custom'))) { |
|
| 75 | 75 | if ($established) { |
| 76 | 76 | $prefs_preset = 'custom'; |
| 77 | 77 | } else { |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | ); |
| 142 | 142 | $form['hour_options'] = array( |
| 143 | 143 | '#type' => 'value', |
| 144 | - '#value' => array('0:00','1:00','2:00','3:00','4:00', |
|
| 145 | - '5:00','6:00','7:00','8:00','9:00','10:00','11:00', |
|
| 146 | - '12:00','13:00','14:00','15:00','16:00','17:00', |
|
| 147 | - '18:00','19:00','20:00','21:00','22:00','23:00') |
|
| 144 | + '#value' => array('0:00', '1:00', '2:00', '3:00', '4:00', |
|
| 145 | + '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', |
|
| 146 | + '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', |
|
| 147 | + '18:00', '19:00', '20:00', '21:00', '22:00', '23:00') |
|
| 148 | 148 | ); |
| 149 | 149 | |
| 150 | 150 | // Identify preference sets that are established to distinguish what has been |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | '#description' => bts('Suspend computing when your computer is busy running other programs.', array(), NULL, 'boinc:account-preferences-computing'), |
| 282 | 282 | ); |
| 283 | 283 | $form['prefs']['advanced']['processor']['hour_label'] = array( |
| 284 | - '#value' => '<div class="form-item"><label>' . bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
|
| 284 | + '#value' => '<div class="form-item"><label>'.bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing').'</label></div>' |
|
| 285 | 285 | ); |
| 286 | 286 | $form['prefs']['advanced']['processor']['start_hour'] = array( |
| 287 | 287 | '#type' => 'select', |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | '#default_value' => $default['start_hour'] |
| 290 | 290 | ); |
| 291 | 291 | $form['prefs']['advanced']['processor']['hour_delimiter'] = array( |
| 292 | - '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
|
| 292 | + '#value' => '<span>'.bts('and', array(), NULL, 'boinc:account-preference').'</span>' |
|
| 293 | 293 | ); |
| 294 | 294 | $form['prefs']['advanced']['processor']['end_hour'] = array( |
| 295 | 295 | '#type' => 'select', |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | '#default_value' => $default['end_hour'] |
| 298 | 298 | ); |
| 299 | 299 | $form['prefs']['advanced']['processor']['hour_description'] = array( |
| 300 | - '#value' => '<div class="form-item slim"><div class="description">' . bts('Compute only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
|
| 300 | + '#value' => '<div class="form-item slim"><div class="description">'.bts('Compute only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing').'</div></div>' |
|
| 301 | 301 | ); |
| 302 | 302 | $form['prefs']['advanced']['processor']['leave_apps_in_memory'] = array( |
| 303 | 303 | '#title' => bts('Leave non-GPU tasks in memory while suspended?', array(), NULL, 'boinc:account-preferences-computing'), |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | '#description' => bts('Limit the upload rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
| 455 | 455 | ); |
| 456 | 456 | $form['prefs']['advanced']['network']['hour_label'] = array( |
| 457 | - '#value' => '<div class="form-item"><label>' . bts('Transfer files only between', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
|
| 457 | + '#value' => '<div class="form-item"><label>'.bts('Transfer files only between', array(), NULL, 'boinc:account-preferences-computing').'</label></div>' |
|
| 458 | 458 | ); |
| 459 | 459 | $form['prefs']['advanced']['network']['net_start_hour'] = array( |
| 460 | 460 | '#type' => 'select', |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | '#default_value' => $default['net_start_hour'] |
| 463 | 463 | ); |
| 464 | 464 | $form['prefs']['advanced']['network']['hour_delimiter'] = array( |
| 465 | - '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
|
| 465 | + '#value' => '<span>'.bts('and', array(), NULL, 'boinc:account-preference').'</span>' |
|
| 466 | 466 | ); |
| 467 | 467 | $form['prefs']['advanced']['network']['net_end_hour'] = array( |
| 468 | 468 | '#type' => 'select', |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | '#default_value' => $default['net_end_hour'] |
| 471 | 471 | ); |
| 472 | 472 | $form['prefs']['advanced']['network']['hour_description'] = array( |
| 473 | - '#value' => '<div class="form-item slim"><div class="description">' . bts('Transfer files only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
|
| 473 | + '#value' => '<div class="form-item slim"><div class="description">'.bts('Transfer files only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing').'</div></div>' |
|
| 474 | 474 | ); |
| 475 | 475 | $form['prefs']['advanced']['network']['daily_xfer_limit_mb'] = array( |
| 476 | 476 | '#title' => bts('Limit usage to', array(), NULL, 'boinc:account-preferences-computing'), |
@@ -530,23 +530,23 @@ discard block |
||
| 530 | 530 | '#suffix' => '</li>' |
| 531 | 531 | ); |
| 532 | 532 | $form['prefs']['form control tabs'] = array( |
| 533 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")) . '</li>' |
|
| 533 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")).'</li>' |
|
| 534 | 534 | ); |
| 535 | 535 | if ($venue AND $venue != 'generic') { |
| 536 | 536 | global $base_path; |
| 537 | - $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
|
| 537 | + $form['prefs']['form control tabs']['#value'] .= '<li class="tab">'. |
|
| 538 | 538 | l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
| 539 | 539 | array( |
| 540 | - 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
|
| 540 | + 'query' => 'destination='.urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
|
| 541 | 541 | 'attributes' => array( |
| 542 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
|
| 543 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
| 542 | + 'onclick' => 'return confirm(\''.bts('This will remove all of your settings from the @name preference set. Are you sure?', |
|
| 543 | + array('@name' => $venue), NULL, 'boinc:account-preferences').'\')' |
|
| 544 | 544 | ) |
| 545 | 545 | ) |
| 546 | - ) . '</li>'; |
|
| 546 | + ).'</li>'; |
|
| 547 | 547 | } |
| 548 | 548 | $form['prefs']['view control'] = array( |
| 549 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing/combined') . '</li>' |
|
| 549 | + '#value' => '<li class="first alt tab">'.l('('.bts('Show comparison view', array(), NULL, 'boinc:account-preferences').')', 'account/prefs/computing/combined').'</li>' |
|
| 550 | 550 | ); |
| 551 | 551 | $form['prefs']['form control tabs suffix'] = array( |
| 552 | 552 | '#value' => '</ul>' |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | return FALSE; |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | - if ($new_host->userid==0) { |
|
| 787 | + if ($new_host->userid == 0) { |
|
| 788 | 788 | rules_invoke_event('boincwork_zombie_merge_error', $old_host->id, $new_host->id, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 789 | 789 | watchdog('boincwork', |
| 790 | 790 | 'Zombie merge attempted, target host has userid=0: old host id=%old_host, target host id=%new_host', |
@@ -880,9 +880,9 @@ discard block |
||
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | $form['overview'] = array( |
| 883 | - '#value' => '<p>' . bts('Sometimes BOINC assigns separate identities to' |
|
| 883 | + '#value' => '<p>'.bts('Sometimes BOINC assigns separate identities to' |
|
| 884 | 884 | . ' the same computer by mistake. You can correct this by merging old' |
| 885 | - . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge') . '</p>' |
|
| 885 | + . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge').'</p>' |
|
| 886 | 886 | . '<p>' |
| 887 | 887 | . bts('Check the computers that are the same as @name' |
| 888 | 888 | . ' (created on @date at @time with computer ID @id)', |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | '@time' => date('G:i:s T', $current_host->create_time), |
| 893 | 893 | '@id' => $current_host->id, |
| 894 | 894 | ), |
| 895 | - NULL, 'boinc:account-host-merge') . '</p>', |
|
| 895 | + NULL, 'boinc:account-host-merge').'</p>', |
|
| 896 | 896 | ); |
| 897 | 897 | |
| 898 | 898 | $options = array(); |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | '#suffix' => '</li>' |
| 927 | 927 | ); |
| 928 | 928 | $form['prefs']['form control tabs'] = array( |
| 929 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "host/{$host_id}") . '</li>' |
|
| 929 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "host/{$host_id}").'</li>' |
|
| 930 | 930 | ); |
| 931 | 931 | |
| 932 | 932 | return $form; |
@@ -971,7 +971,7 @@ discard block |
||
| 971 | 971 | if (count($merged) == 2) { |
| 972 | 972 | $oxford_comma = ''; |
| 973 | 973 | } |
| 974 | - $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
|
| 974 | + $list = implode(', ', $list).$oxford_comma.' '.$conjunction.' '.$last; |
|
| 975 | 975 | } |
| 976 | 976 | else { |
| 977 | 977 | $list = $last; |
@@ -1220,23 +1220,23 @@ discard block |
||
| 1220 | 1220 | '#suffix' => '</li>' |
| 1221 | 1221 | ); |
| 1222 | 1222 | $form['prefs']['form control tabs'] = array( |
| 1223 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 1223 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>' |
|
| 1224 | 1224 | ); |
| 1225 | 1225 | if ($venue AND $venue != 'generic') { |
| 1226 | 1226 | global $base_path; |
| 1227 | - $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
|
| 1227 | + $form['prefs']['form control tabs']['#value'] .= '<li class="tab">'. |
|
| 1228 | 1228 | l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
| 1229 | 1229 | array( |
| 1230 | - 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
|
| 1230 | + 'query' => 'destination='.urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
|
| 1231 | 1231 | 'attributes' => array( |
| 1232 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
|
| 1233 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
| 1232 | + 'onclick' => 'return confirm(\''.bts('This will remove all of your settings from the @name preference set. Are you sure?', |
|
| 1233 | + array('@name' => $venue), NULL, 'boinc:account-preferences').'\')' |
|
| 1234 | 1234 | ) |
| 1235 | 1235 | ) |
| 1236 | - ) . '</li>'; |
|
| 1236 | + ).'</li>'; |
|
| 1237 | 1237 | } |
| 1238 | 1238 | $form['prefs']['view control'] = array( |
| 1239 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
| 1239 | + '#value' => '<li class="first alt tab">'.l('('.bts('Show comparison view', array(), NULL, 'boinc:account-preferences').')', 'account/prefs/project/combined').'</li>' |
|
| 1240 | 1240 | ); |
| 1241 | 1241 | $form['prefs']['form control tabs suffix'] = array( |
| 1242 | 1242 | '#value' => '</ul>' |
@@ -1279,7 +1279,7 @@ discard block |
||
| 1279 | 1279 | |
| 1280 | 1280 | foreach ($xml['project_specific_preferences'] as $wrapped_element) { |
| 1281 | 1281 | $type = key($wrapped_element); |
| 1282 | - $element= reset($wrapped_element); |
|
| 1282 | + $element = reset($wrapped_element); |
|
| 1283 | 1283 | boincwork_generate_prefs_element($form, $type, $element, $prefs['project_specific']); |
| 1284 | 1284 | } |
| 1285 | 1285 | } |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | $names = array(); |
| 1506 | 1506 | foreach ($languages as $langcode => $item) { |
| 1507 | 1507 | $name = t($item->name); |
| 1508 | - $names[check_plain($langcode)] = check_plain($name . ($item->native != $name ? ' ('. $item->native .')' : '')); |
|
| 1508 | + $names[check_plain($langcode)] = check_plain($name.($item->native != $name ? ' ('.$item->native.')' : '')); |
|
| 1509 | 1509 | } |
| 1510 | 1510 | $form['locale'] = array( |
| 1511 | 1511 | '#type' => 'fieldset', |
@@ -1530,20 +1530,20 @@ discard block |
||
| 1530 | 1530 | // Avatar options |
| 1531 | 1531 | $form['gravatar'] = array( |
| 1532 | 1532 | '#type' => 'item', |
| 1533 | - '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
| 1533 | + '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/'.$account->mail), NULL, 'boinc:account-preferences-community'), |
|
| 1534 | 1534 | '#description' => bts('Your Gravatar will not be shown if you upload a user picture.', array(), NULL, 'boinc:account-preferences-community'), |
| 1535 | 1535 | ); |
| 1536 | 1536 | if (user_access('disable own gravatar', $account)) { |
| 1537 | 1537 | $form['gravatar'] = array( |
| 1538 | 1538 | '#type' => 'checkbox', |
| 1539 | - '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
| 1539 | + '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/'.$account->mail), NULL, 'boinc:account-preferences-community'), |
|
| 1540 | 1540 | '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), NULL, 'boinc:account-preferences-community'), |
| 1541 | 1541 | '#default_value' => isset($account->gravatar) ? $account->gravatar : 0, |
| 1542 | 1542 | '#disabled' => !empty($account->picture), |
| 1543 | 1543 | ); |
| 1544 | 1544 | } |
| 1545 | 1545 | $form['gravatar']['#weight'] = 15; |
| 1546 | - $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community') . '</a></legend>'; |
|
| 1546 | + $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">'.bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community').'</a></legend>'; |
|
| 1547 | 1547 | // Upload an avatar (pulled from profile_node_form): |
| 1548 | 1548 | if (!empty($profile_form['field_image'])) { |
| 1549 | 1549 | $form['field_image'] = $profile_form['field_image']; |
@@ -1578,7 +1578,7 @@ discard block |
||
| 1578 | 1578 | ); |
| 1579 | 1579 | // Can't have a typical Drupal form suffix on a select box? |
| 1580 | 1580 | $form['forums']['comments_per_page_suffix'] = array( |
| 1581 | - '#value' => '<span>' . bts('comments per page', array(), NULL, 'boinc:account-preferences-community') . '</span>' |
|
| 1581 | + '#value' => '<span>'.bts('comments per page', array(), NULL, 'boinc:account-preferences-community').'</span>' |
|
| 1582 | 1582 | ); |
| 1583 | 1583 | $form['forums']['comments_order'] = array( |
| 1584 | 1584 | '#type' => 'select', |
@@ -1631,7 +1631,7 @@ discard block |
||
| 1631 | 1631 | '#weight' => 1002, |
| 1632 | 1632 | ); |
| 1633 | 1633 | $form['form control tabs'] = array( |
| 1634 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1634 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
| 1635 | 1635 | '#weight' => 1003, |
| 1636 | 1636 | ); |
| 1637 | 1637 | $form['form control tabs suffix'] = array( |
@@ -1717,10 +1717,10 @@ discard block |
||
| 1717 | 1717 | if ($user->language != $edit['language']) { |
| 1718 | 1718 | global $base_url; |
| 1719 | 1719 | if ($edit['language'] != language_default('language')) { |
| 1720 | - $form_state['redirect'] = $base_url . '/' . $edit['language'] . '/' . $_GET['q']; |
|
| 1720 | + $form_state['redirect'] = $base_url.'/'.$edit['language'].'/'.$_GET['q']; |
|
| 1721 | 1721 | } |
| 1722 | 1722 | else { |
| 1723 | - $form_state['redirect'] = $base_url . '/' . $_GET['q']; |
|
| 1723 | + $form_state['redirect'] = $base_url.'/'.$_GET['q']; |
|
| 1724 | 1724 | } |
| 1725 | 1725 | } |
| 1726 | 1726 | } |
@@ -1790,7 +1790,7 @@ discard block |
||
| 1790 | 1790 | // option that deals with privacy. |
| 1791 | 1791 | foreach ($privacy_consent_types as $ct) { |
| 1792 | 1792 | |
| 1793 | - $currstate = (check_user_consent($boincuser, $ct['shortname'])) ? 1 : 0 ; |
|
| 1793 | + $currstate = (check_user_consent($boincuser, $ct['shortname'])) ? 1 : 0; |
|
| 1794 | 1794 | // Set name to 'privacyconsent_SHORTNAME', which can be parsed |
| 1795 | 1795 | // later in the submit function. |
| 1796 | 1796 | $form['privacy']['privacyconsent_'.$ct['shortname']] = array( |
@@ -1804,7 +1804,7 @@ discard block |
||
| 1804 | 1804 | // Add a description with link to the question 'Do you consent to |
| 1805 | 1805 | // exporting your data...'. |
| 1806 | 1806 | $mypatt = '/Do you consent to exporting your data/'; |
| 1807 | - if (preg_match($mypatt, $ct['description']) ) { |
|
| 1807 | + if (preg_match($mypatt, $ct['description'])) { |
|
| 1808 | 1808 | $form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics exports.', |
| 1809 | 1809 | array( |
| 1810 | 1810 | '!privacy_policy_link' => l( |
@@ -1843,7 +1843,7 @@ discard block |
||
| 1843 | 1843 | $form['ignoreblock']['delete'][$ignored_user['iuid']] = array( |
| 1844 | 1844 | '#value' => l( |
| 1845 | 1845 | bts('delete', array(), NULL, 'boinc:ignore-user-delete-button'), |
| 1846 | - 'account/prefs/privacy/ignore_user/remove/'. $ignored_user['iuid'], |
|
| 1846 | + 'account/prefs/privacy/ignore_user/remove/'.$ignored_user['iuid'], |
|
| 1847 | 1847 | array() |
| 1848 | 1848 | ), |
| 1849 | 1849 | ); |
@@ -1894,7 +1894,7 @@ discard block |
||
| 1894 | 1894 | '#suffix' => '</li>' |
| 1895 | 1895 | ); |
| 1896 | 1896 | $form['prefs']['form control tabs'] = array( |
| 1897 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 1897 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>' |
|
| 1898 | 1898 | ); |
| 1899 | 1899 | $form['prefs']['form control tabs suffix'] = array( |
| 1900 | 1900 | '#value' => '</ul>' |
@@ -1981,7 +1981,7 @@ discard block |
||
| 1981 | 1981 | $privacyconsent_prefs = array_intersect_key($form_state['values'], array_flip($result)); |
| 1982 | 1982 | foreach ($privacyconsent_prefs as $name => $newstate) { |
| 1983 | 1983 | $subname = explode('_', $name)[1]; |
| 1984 | - $currstate = (check_user_consent($boincuser, $subname)) ? 1 : 0 ; |
|
| 1984 | + $currstate = (check_user_consent($boincuser, $subname)) ? 1 : 0; |
|
| 1985 | 1985 | list($checkct, $ctid) = check_consent_type($subname); |
| 1986 | 1986 | if ($checkct && ($currstate != $newstate)) { |
| 1987 | 1987 | consent_to_a_policy($boincuser, $ctid, $newstate, 0, 'Webform', time()); |
@@ -2047,7 +2047,7 @@ discard block |
||
| 2047 | 2047 | function boincwork_selectapp_form_submit($form, &$form_state) { |
| 2048 | 2048 | $myargs = arg(); |
| 2049 | 2049 | array_pop($myargs); |
| 2050 | - $newpath = implode('/', $myargs ) . '/' . $form['selectapp']['#value']; |
|
| 2050 | + $newpath = implode('/', $myargs).'/'.$form['selectapp']['#value']; |
|
| 2051 | 2051 | $form_state['redirect'] = $newpath; |
| 2052 | 2052 | } |
| 2053 | 2053 | |
@@ -15,16 +15,16 @@ discard block |
||
| 15 | 15 | * The structure of the general preferences form |
| 16 | 16 | */ |
| 17 | 17 | function boincwork_generalprefs_form(&$form_state, $venue, $prefs_preset = null, $advanced = FALSE) { |
| 18 | - $form = array(); |
|
| 19 | - $prefs = null; |
|
| 20 | - $established = TRUE; |
|
| 18 | + $form = array(); |
|
| 19 | + $prefs = null; |
|
| 20 | + $established = TRUE; |
|
| 21 | 21 | |
| 22 | - // Enable AHAH form support for dynamically updating content based on preset |
|
| 23 | - ahah_helper_register($form, $form_state); |
|
| 22 | + // Enable AHAH form support for dynamically updating content based on preset |
|
| 23 | + ahah_helper_register($form, $form_state); |
|
| 24 | 24 | |
| 25 | - if (!$prefs_preset) { |
|
| 25 | + if (!$prefs_preset) { |
|
| 26 | 26 | if (isset($form_state['storage']['prefs']['preset'])) { |
| 27 | - $prefs_preset = $form_state['storage']['prefs']['preset']; |
|
| 27 | + $prefs_preset = $form_state['storage']['prefs']['preset']; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // Load preferences from BOINC account |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // Take note if this is not an established preference set on the account |
| 34 | 34 | if (isset($prefs['@attributes']['cleared'])) { |
| 35 | - $established = FALSE; |
|
| 35 | + $established = FALSE; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Determine if a preset is selected or if these are custom settings |
@@ -47,45 +47,45 @@ discard block |
||
| 47 | 47 | $prefs_preset = $prefs['preset']['@value']; |
| 48 | 48 | } |
| 49 | 49 | }// if !$prefs_preset |
| 50 | - } |
|
| 51 | - // Extract mod_time tag if present, because it will be erased with |
|
| 52 | - // boincwork_get_preset_prefs() below. |
|
| 53 | - $mod_time = null; |
|
| 54 | - if (isset($prefs['mod_time']['@value'])) { |
|
| 55 | - $mod_time = $prefs['mod_time']['@value']; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if (isset($form_state['storage']['wip'])) { |
|
| 59 | - switch ($prefs_preset) { |
|
| 60 | - case 'standard': |
|
| 50 | + } |
|
| 51 | + // Extract mod_time tag if present, because it will be erased with |
|
| 52 | + // boincwork_get_preset_prefs() below. |
|
| 53 | + $mod_time = null; |
|
| 54 | + if (isset($prefs['mod_time']['@value'])) { |
|
| 55 | + $mod_time = $prefs['mod_time']['@value']; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if (isset($form_state['storage']['wip'])) { |
|
| 59 | + switch ($prefs_preset) { |
|
| 60 | + case 'standard': |
|
| 61 | 61 | case 'maximum': |
| 62 | 62 | case 'green': |
| 63 | 63 | case 'minimum': |
| 64 | 64 | $prefs = boincwork_get_preset_prefs($prefs_preset); |
| 65 | - break; |
|
| 66 | - case 'custom': |
|
| 65 | + break; |
|
| 66 | + case 'custom': |
|
| 67 | 67 | default: |
| 68 | 68 | // Just keeps prefs as they are |
| 69 | 69 | unset($prefs['preset']); |
| 70 | - break; |
|
| 71 | - }// switch |
|
| 72 | - } else { |
|
| 73 | - $form_state['storage']['wip'] = TRUE; |
|
| 74 | - if ( !in_array($prefs_preset, array('standard','maximum','green','minimum','custom')) ) { |
|
| 75 | - if ($established) { |
|
| 76 | - $prefs_preset = 'custom'; |
|
| 77 | - } else { |
|
| 78 | - $prefs_preset = 'standard'; |
|
| 79 | - $prefs = boincwork_get_preset_prefs($prefs_preset); |
|
| 80 | - }// if $established |
|
| 81 | - }// if $prefs_preset |
|
| 82 | - }// if WIP |
|
| 83 | - |
|
| 84 | - // This set of preferences is used in the form if no preferences |
|
| 85 | - // have been set above, in variable $prefs. |
|
| 86 | - require_boinc(array('db', 'prefs')); |
|
| 87 | - $disk_space_config = get_disk_space_config(); |
|
| 88 | - $default = array( |
|
| 70 | + break; |
|
| 71 | + }// switch |
|
| 72 | + } else { |
|
| 73 | + $form_state['storage']['wip'] = TRUE; |
|
| 74 | + if ( !in_array($prefs_preset, array('standard','maximum','green','minimum','custom')) ) { |
|
| 75 | + if ($established) { |
|
| 76 | + $prefs_preset = 'custom'; |
|
| 77 | + } else { |
|
| 78 | + $prefs_preset = 'standard'; |
|
| 79 | + $prefs = boincwork_get_preset_prefs($prefs_preset); |
|
| 80 | + }// if $established |
|
| 81 | + }// if $prefs_preset |
|
| 82 | + }// if WIP |
|
| 83 | + |
|
| 84 | + // This set of preferences is used in the form if no preferences |
|
| 85 | + // have been set above, in variable $prefs. |
|
| 86 | + require_boinc(array('db', 'prefs')); |
|
| 87 | + $disk_space_config = get_disk_space_config(); |
|
| 88 | + $default = array( |
|
| 89 | 89 | 'preset' => $prefs_preset, |
| 90 | 90 | // Processing... |
| 91 | 91 | 'run_on_batteries' => 0, |
@@ -120,385 +120,385 @@ discard block |
||
| 120 | 120 | 'daily_xfer_limit_mb' => 0, |
| 121 | 121 | 'daily_xfer_period_days' => 0, |
| 122 | 122 | 'dont_verify_images' => 0 |
| 123 | - ); |
|
| 124 | - foreach ($default as $name => $value) { |
|
| 123 | + ); |
|
| 124 | + foreach ($default as $name => $value) { |
|
| 125 | 125 | if (isset($prefs[$name])) { |
| 126 | - if (is_array($prefs[$name])) { |
|
| 126 | + if (is_array($prefs[$name])) { |
|
| 127 | 127 | if (isset($prefs[$name]['@value'])) { |
| 128 | - $default[$name] = $prefs[$name]['@value']; |
|
| 128 | + $default[$name] = $prefs[$name]['@value']; |
|
| 129 | + } |
|
| 129 | 130 | } |
| 130 | - } |
|
| 131 | - else { |
|
| 131 | + else { |
|
| 132 | 132 | $default[$name] = $prefs[$name]; |
| 133 | - } |
|
| 133 | + } |
|
| 134 | + } |
|
| 134 | 135 | } |
| 135 | - } |
|
| 136 | 136 | |
| 137 | - // Standard option sets |
|
| 138 | - $form['boolean_options'] = array( |
|
| 137 | + // Standard option sets |
|
| 138 | + $form['boolean_options'] = array( |
|
| 139 | 139 | '#type' => 'value', |
| 140 | 140 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
| 141 | - ); |
|
| 142 | - $form['hour_options'] = array( |
|
| 141 | + ); |
|
| 142 | + $form['hour_options'] = array( |
|
| 143 | 143 | '#type' => 'value', |
| 144 | 144 | '#value' => array('0:00','1:00','2:00','3:00','4:00', |
| 145 | - '5:00','6:00','7:00','8:00','9:00','10:00','11:00', |
|
| 146 | - '12:00','13:00','14:00','15:00','16:00','17:00', |
|
| 147 | - '18:00','19:00','20:00','21:00','22:00','23:00') |
|
| 148 | - ); |
|
| 145 | + '5:00','6:00','7:00','8:00','9:00','10:00','11:00', |
|
| 146 | + '12:00','13:00','14:00','15:00','16:00','17:00', |
|
| 147 | + '18:00','19:00','20:00','21:00','22:00','23:00') |
|
| 148 | + ); |
|
| 149 | 149 | |
| 150 | - // Identify preference sets that are established to distinguish what has been |
|
| 151 | - // saved to the database from what is just showing default values |
|
| 152 | - $form['#established'] = $established; |
|
| 150 | + // Identify preference sets that are established to distinguish what has been |
|
| 151 | + // saved to the database from what is just showing default values |
|
| 152 | + $form['#established'] = $established; |
|
| 153 | 153 | |
| 154 | - // Set up the preference container for AHAH |
|
| 155 | - $form['prefs'] = array( |
|
| 154 | + // Set up the preference container for AHAH |
|
| 155 | + $form['prefs'] = array( |
|
| 156 | 156 | '#title' => '', |
| 157 | 157 | '#type' => 'fieldset', |
| 158 | 158 | '#prefix' => '<div id="prefs-wrapper">', // This is our wrapper div. |
| 159 | 159 | '#attributes' => array('class' => 'ahah-container'), |
| 160 | 160 | '#suffix' => '</div>', |
| 161 | 161 | '#tree' => TRUE |
| 162 | - ); |
|
| 163 | - //$form['prefs']['debug'] = array('#value' => '<pre>' . print_r($form_state, true) . '</pre>'); |
|
| 162 | + ); |
|
| 163 | + //$form['prefs']['debug'] = array('#value' => '<pre>' . print_r($form_state, true) . '</pre>'); |
|
| 164 | 164 | |
| 165 | - // Hidden elements |
|
| 166 | - $form['prefs']['modified'] = array( |
|
| 165 | + // Hidden elements |
|
| 166 | + $form['prefs']['modified'] = array( |
|
| 167 | 167 | '#type' => 'hidden', |
| 168 | 168 | '#value' => $mod_time |
| 169 | - ); |
|
| 170 | - $form['prefs']['venue'] = array( |
|
| 169 | + ); |
|
| 170 | + $form['prefs']['venue'] = array( |
|
| 171 | 171 | '#type' => 'hidden', |
| 172 | 172 | '#value' => $venue |
| 173 | - ); |
|
| 173 | + ); |
|
| 174 | 174 | |
| 175 | - $form['prefs']['separator_top'] = array( |
|
| 175 | + $form['prefs']['separator_top'] = array( |
|
| 176 | 176 | '#value' => '<div class="separator"></div>' |
| 177 | - ); |
|
| 177 | + ); |
|
| 178 | 178 | |
| 179 | - // Simplified selectors |
|
| 180 | - $form['prefs']['preset'] = array( |
|
| 181 | - '#title' => bts('Presets', array(), NULL, 'boinc:account-preferences-preset:-1:for a user to choose a computing or project preference preset.'), |
|
| 179 | + // Simplified selectors |
|
| 180 | + $form['prefs']['preset'] = array( |
|
| 181 | + '#title' => bts('Presets', array(), NULL, 'boinc:account-preferences-preset:-1:for a user to choose a computing or project preference preset.'), |
|
| 182 | 182 | '#type' => 'radios', |
| 183 | 183 | '#description' => ' ', |
| 184 | 184 | '#options' => array( |
| 185 | - 'standard' => bts('Standard', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 186 | - 'maximum' => bts('Maximum', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 187 | - 'green' => bts('Green', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 188 | - 'minimum' => bts('Minimum', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 189 | - 'custom' => bts('Custom', array(), NULL, 'boinc:account-preferences-preset') |
|
| 185 | + 'standard' => bts('Standard', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 186 | + 'maximum' => bts('Maximum', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 187 | + 'green' => bts('Green', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 188 | + 'minimum' => bts('Minimum', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 189 | + 'custom' => bts('Custom', array(), NULL, 'boinc:account-preferences-preset') |
|
| 190 | 190 | ), |
| 191 | 191 | '#prefix' => '<div class="simple-form-controls">', |
| 192 | 192 | '#suffix' => '</div>', |
| 193 | 193 | '#default_value' => $default['preset'], |
| 194 | 194 | '#ahah' => array( |
| 195 | - 'event' => 'change', |
|
| 196 | - 'path' => ahah_helper_path(array('prefs')), |
|
| 197 | - 'wrapper' => 'prefs-wrapper' |
|
| 195 | + 'event' => 'change', |
|
| 196 | + 'path' => ahah_helper_path(array('prefs')), |
|
| 197 | + 'wrapper' => 'prefs-wrapper' |
|
| 198 | 198 | ) |
| 199 | - ); |
|
| 200 | - $form['prefs']['select preset'] = array( |
|
| 199 | + ); |
|
| 200 | + $form['prefs']['select preset'] = array( |
|
| 201 | 201 | '#type' => 'submit', |
| 202 | 202 | '#value' => bts('Update preset', array(), NULL, 'boinc:account-preferences-preset'), |
| 203 | 203 | '#submit' => array('ahah_helper_generic_submit'), |
| 204 | 204 | // The 'no-js' class only displays this button if javascript is disabled |
| 205 | 205 | '#attributes' => array('class' => 'no-js'), |
| 206 | - ); |
|
| 206 | + ); |
|
| 207 | 207 | |
| 208 | - // Advanced preferences |
|
| 209 | - $form['prefs']['advanced'] = array( |
|
| 208 | + // Advanced preferences |
|
| 209 | + $form['prefs']['advanced'] = array( |
|
| 210 | 210 | '#title' => bts('Advanced settings', array(), NULL, 'boinc:account-preferences-option'), |
| 211 | 211 | '#type' => 'fieldset', |
| 212 | 212 | '#description' => '', |
| 213 | 213 | '#collapsible' => TRUE, |
| 214 | 214 | '#collapsed' => !$advanced, |
| 215 | 215 | '#attributes' => array('class' => 'advanced-settings'), |
| 216 | - ); |
|
| 216 | + ); |
|
| 217 | 217 | |
| 218 | - // Processing preferences |
|
| 218 | + // Processing preferences |
|
| 219 | 219 | |
| 220 | - $form['prefs']['advanced']['anchor'] = array( |
|
| 220 | + $form['prefs']['advanced']['anchor'] = array( |
|
| 221 | 221 | '#value' => '<a name="advanced"></a>' |
| 222 | - ); |
|
| 222 | + ); |
|
| 223 | 223 | |
| 224 | - $form['prefs']['advanced']['separator_top'] = array( |
|
| 224 | + $form['prefs']['advanced']['separator_top'] = array( |
|
| 225 | 225 | '#value' => '<div class="separator"></div>' |
| 226 | - ); |
|
| 226 | + ); |
|
| 227 | 227 | |
| 228 | - $form['prefs']['advanced']['processor'] = array( |
|
| 228 | + $form['prefs']['advanced']['processor'] = array( |
|
| 229 | 229 | '#title' => bts('Processor usage', array(), NULL, 'boinc:account-preferences-computing'), |
| 230 | 230 | '#type' => 'fieldset', |
| 231 | 231 | '#description' => '', |
| 232 | 232 | '#collapsible' => FALSE, |
| 233 | 233 | '#collapsed' => FALSE |
| 234 | - ); |
|
| 235 | - $form['prefs']['advanced']['processor']['run_on_batteries'] = array( |
|
| 234 | + ); |
|
| 235 | + $form['prefs']['advanced']['processor']['run_on_batteries'] = array( |
|
| 236 | 236 | '#title' => bts('Suspend when computer is on battery?', array(), NULL, 'boinc:account-preferences-computing'), |
| 237 | 237 | '#type' => 'radios', |
| 238 | 238 | '#description' => bts('Suspends computing on portables when running on battery power.', array(), NULL, 'boinc:account-preferences-computing'), |
| 239 | 239 | '#options' => $form['boolean_options']['#value'], |
| 240 | 240 | '#attributes' => array('class' => 'fancy'), |
| 241 | 241 | '#default_value' => ($default['run_on_batteries']) ? 0 : 1 // intentional inversion of setting |
| 242 | - ); |
|
| 243 | - $form['prefs']['advanced']['processor']['run_if_user_active'] = array( |
|
| 242 | + ); |
|
| 243 | + $form['prefs']['advanced']['processor']['run_if_user_active'] = array( |
|
| 244 | 244 | '#title' => bts('Suspend when computer is in use?', array(), NULL, 'boinc:account-preferences-computing'), |
| 245 | 245 | '#type' => 'radios', |
| 246 | 246 | '#description' => bts("Suspends computing and file transfers when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing'), |
| 247 | 247 | '#options' => $form['boolean_options']['#value'], |
| 248 | 248 | '#attributes' => array('class' => 'fancy'), |
| 249 | 249 | '#default_value' => ($default['run_if_user_active']) ? 0 : 1 // intentional inversion of setting |
| 250 | - ); |
|
| 251 | - $form['prefs']['advanced']['processor']['run_gpu_if_user_active'] = array( |
|
| 250 | + ); |
|
| 251 | + $form['prefs']['advanced']['processor']['run_gpu_if_user_active'] = array( |
|
| 252 | 252 | '#title' => bts('Suspend GPU computing when computer is in use?', array(), NULL, 'boinc:account-preferences-computing'), |
| 253 | 253 | '#type' => 'radios', |
| 254 | 254 | '#description' => bts("Suspends GPU computing when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing'), |
| 255 | 255 | '#options' => $form['boolean_options']['#value'], |
| 256 | 256 | '#attributes' => array('class' => 'fancy'), |
| 257 | 257 | '#default_value' => ($default['run_gpu_if_user_active']) ? 0 : 1 // intentional inversion of setting |
| 258 | - ); |
|
| 259 | - $form['prefs']['advanced']['processor']['idle_time_to_run'] = array( |
|
| 260 | - '#title' => bts('"In use" means mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 258 | + ); |
|
| 259 | + $form['prefs']['advanced']['processor']['idle_time_to_run'] = array( |
|
| 260 | + '#title' => bts('"In use" means mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 261 | 261 | '#type' => 'textfield', |
| 262 | 262 | '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
| 263 | 263 | '#default_value' => $default['idle_time_to_run'], |
| 264 | 264 | '#size' => 1, |
| 265 | 265 | '#description' => bts('This determines when the computer is considered "in use".', array(), NULL, 'boinc:account-preferences-computing') |
| 266 | - ); |
|
| 267 | - $form['prefs']['advanced']['processor']['suspend_if_no_recent_input'] = array( |
|
| 266 | + ); |
|
| 267 | + $form['prefs']['advanced']['processor']['suspend_if_no_recent_input'] = array( |
|
| 268 | 268 | '#title' => bts('Suspend when no mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
| 269 | 269 | '#type' => 'textfield', |
| 270 | 270 | '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
| 271 | 271 | '#default_value' => $default['suspend_if_no_recent_input'], |
| 272 | 272 | '#size' => 1, |
| 273 | 273 | '#description' => bts('This allows some computers to enter low-power mode when not in use.', array(), NULL, 'boinc:account-preferences-computing') |
| 274 | - ); |
|
| 275 | - $form['prefs']['advanced']['processor']['suspend_cpu_usage'] = array( |
|
| 274 | + ); |
|
| 275 | + $form['prefs']['advanced']['processor']['suspend_cpu_usage'] = array( |
|
| 276 | 276 | '#title' => bts('Suspend when non-BOINC CPU usage is above', array(), NULL, 'boinc:account-preferences-computing'), |
| 277 | 277 | '#type' => 'textfield', |
| 278 | 278 | '#field_suffix' => '%', |
| 279 | 279 | '#default_value' => $default['suspend_cpu_usage'], |
| 280 | 280 | '#size' => 1, |
| 281 | 281 | '#description' => bts('Suspend computing when your computer is busy running other programs.', array(), NULL, 'boinc:account-preferences-computing'), |
| 282 | - ); |
|
| 283 | - $form['prefs']['advanced']['processor']['hour_label'] = array( |
|
| 282 | + ); |
|
| 283 | + $form['prefs']['advanced']['processor']['hour_label'] = array( |
|
| 284 | 284 | '#value' => '<div class="form-item"><label>' . bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
| 285 | - ); |
|
| 286 | - $form['prefs']['advanced']['processor']['start_hour'] = array( |
|
| 285 | + ); |
|
| 286 | + $form['prefs']['advanced']['processor']['start_hour'] = array( |
|
| 287 | 287 | '#type' => 'select', |
| 288 | 288 | '#options' => $form['hour_options']['#value'], |
| 289 | 289 | '#default_value' => $default['start_hour'] |
| 290 | - ); |
|
| 291 | - $form['prefs']['advanced']['processor']['hour_delimiter'] = array( |
|
| 290 | + ); |
|
| 291 | + $form['prefs']['advanced']['processor']['hour_delimiter'] = array( |
|
| 292 | 292 | '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
| 293 | - ); |
|
| 294 | - $form['prefs']['advanced']['processor']['end_hour'] = array( |
|
| 293 | + ); |
|
| 294 | + $form['prefs']['advanced']['processor']['end_hour'] = array( |
|
| 295 | 295 | '#type' => 'select', |
| 296 | 296 | '#options' => $form['hour_options']['#value'], |
| 297 | 297 | '#default_value' => $default['end_hour'] |
| 298 | - ); |
|
| 299 | - $form['prefs']['advanced']['processor']['hour_description'] = array( |
|
| 298 | + ); |
|
| 299 | + $form['prefs']['advanced']['processor']['hour_description'] = array( |
|
| 300 | 300 | '#value' => '<div class="form-item slim"><div class="description">' . bts('Compute only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
| 301 | - ); |
|
| 302 | - $form['prefs']['advanced']['processor']['leave_apps_in_memory'] = array( |
|
| 301 | + ); |
|
| 302 | + $form['prefs']['advanced']['processor']['leave_apps_in_memory'] = array( |
|
| 303 | 303 | '#title' => bts('Leave non-GPU tasks in memory while suspended?', array(), NULL, 'boinc:account-preferences-computing'), |
| 304 | 304 | '#type' => 'radios', |
| 305 | 305 | '#options' => $form['boolean_options']['#value'], |
| 306 | 306 | '#attributes' => array('class' => 'fancy'), |
| 307 | 307 | '#default_value' => $default['leave_apps_in_memory'], |
| 308 | 308 | '#description' => bts('If "Yes", suspended tasks stay in memory, and resume with no work lost. If "No", suspended tasks are removed from memory, and resume from their last checkpoint.', array(), NULL, 'boinc:account-preferences-computing') |
| 309 | - ); |
|
| 310 | - $form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes'] = array( |
|
| 309 | + ); |
|
| 310 | + $form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes'] = array( |
|
| 311 | 311 | '#title' => bts('Switch between tasks every', array(), NULL, 'boinc:account-preferences-computing'), |
| 312 | 312 | '#type' => 'textfield', |
| 313 | 313 | '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
| 314 | 314 | '#default_value' => $default['cpu_scheduling_period_minutes'], |
| 315 | 315 | '#size' => 1, |
| 316 | 316 | '#description' => bts('If you run several projects, BOINC may switch between them this often.', array(), NULL, 'boinc:account-preferences-computing') |
| 317 | - ); |
|
| 318 | - $form['prefs']['advanced']['processor']['max_ncpus_pct'] = array( |
|
| 317 | + ); |
|
| 318 | + $form['prefs']['advanced']['processor']['max_ncpus_pct'] = array( |
|
| 319 | 319 | '#title' => bts('Use at most', array(), NULL, 'boinc:account-preferences-computing'), |
| 320 | 320 | '#type' => 'textfield', |
| 321 | 321 | '#field_suffix' => bts('% of the processors', array(), NULL, 'boinc:account-preferences-computing'), |
| 322 | 322 | '#default_value' => $default['max_ncpus_pct'], |
| 323 | 323 | '#size' => 1, |
| 324 | 324 | '#description' => bts('Keep some CPUs free for other applications. Example: 75% means use 6 cores on an 8-core CPU.', array(), NULL, 'boinc:account-preferences-computing'), |
| 325 | - ); |
|
| 326 | - $form['prefs']['advanced']['processor']['cpu_usage_limit'] = array( |
|
| 325 | + ); |
|
| 326 | + $form['prefs']['advanced']['processor']['cpu_usage_limit'] = array( |
|
| 327 | 327 | '#title' => bts('Use at most', array(), NULL, 'boinc:account-preferences-computing'), |
| 328 | 328 | '#type' => 'textfield', |
| 329 | 329 | '#field_suffix' => bts('% of the CPU time', array(), NULL, 'boinc:account-preferences-computing'), |
| 330 | 330 | '#default_value' => $default['cpu_usage_limit'], |
| 331 | 331 | '#size' => 1, |
| 332 | 332 | '#description' => bts('Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat.', array(), NULL, 'boinc:account-preferences-computing') |
| 333 | - ); |
|
| 333 | + ); |
|
| 334 | 334 | |
| 335 | - // Disk and memory preferences |
|
| 336 | - $form['prefs']['advanced']['storage'] = array( |
|
| 335 | + // Disk and memory preferences |
|
| 336 | + $form['prefs']['advanced']['storage'] = array( |
|
| 337 | 337 | '#title' => bts('Disk and memory usage', array(), NULL, 'boinc:account-preferences-computing'), |
| 338 | 338 | '#type' => 'fieldset', |
| 339 | 339 | '#description' => '', |
| 340 | 340 | '#collapsible' => FALSE, |
| 341 | 341 | '#collapsed' => FALSE |
| 342 | - ); |
|
| 343 | - $form['prefs']['advanced']['storage']['disk_max_used_gb'] = array( |
|
| 342 | + ); |
|
| 343 | + $form['prefs']['advanced']['storage']['disk_max_used_gb'] = array( |
|
| 344 | 344 | '#title' => bts('Disk: use no more than', array(), NULL, 'boinc:account-preferences-computing'), |
| 345 | 345 | '#type' => 'textfield', |
| 346 | 346 | '#field_suffix' => 'GB', |
| 347 | 347 | '#default_value' => $default['disk_max_used_gb'], |
| 348 | 348 | '#size' => 1, |
| 349 | 349 | '#description' => bts('Limit the total amount of disk space used by BOINC.', array(), NULL, 'boinc:account-preferences-computing'), |
| 350 | - ); |
|
| 351 | - $form['prefs']['advanced']['storage']['disk_min_free_gb'] = array( |
|
| 350 | + ); |
|
| 351 | + $form['prefs']['advanced']['storage']['disk_min_free_gb'] = array( |
|
| 352 | 352 | '#title' => bts('Disk: leave at least', array(), NULL, 'boinc:account-preferences-computing'), |
| 353 | 353 | '#type' => 'textfield', |
| 354 | 354 | '#field_suffix' => 'GB free', |
| 355 | 355 | '#default_value' => $default['disk_min_free_gb'], |
| 356 | 356 | '#size' => 1, |
| 357 | 357 | '#description' => bts('Limit disk usage to leave this much free space on the volume where BOINC stores data.', array(), NULL, 'boinc:account-preferences-computing'), |
| 358 | - ); |
|
| 359 | - $form['prefs']['advanced']['storage']['disk_max_used_pct'] = array( |
|
| 358 | + ); |
|
| 359 | + $form['prefs']['advanced']['storage']['disk_max_used_pct'] = array( |
|
| 360 | 360 | '#title' => bts('Disk: use no more than', array(), NULL, 'boinc:account-preferences-computing'), |
| 361 | 361 | '#type' => 'textfield', |
| 362 | 362 | '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
| 363 | 363 | '#default_value' => $default['disk_max_used_pct'], |
| 364 | 364 | '#size' => 1, |
| 365 | 365 | '#description' => bts('Limit the percentage of disk space used by BOINC on the volume where it stores data.', array(), NULL, 'boinc:account-preferences-computing') |
| 366 | - ); |
|
| 367 | - $form['prefs']['advanced']['storage']['disk_interval'] = array( |
|
| 366 | + ); |
|
| 367 | + $form['prefs']['advanced']['storage']['disk_interval'] = array( |
|
| 368 | 368 | '#title' => bts('Request tasks to checkpoint at most every', array(), NULL, 'boinc:account-preferences-computing'), |
| 369 | 369 | '#type' => 'textfield', |
| 370 | 370 | '#field_suffix' => bts('seconds', array(), NULL, 'boinc:unit-of-time'), |
| 371 | 371 | '#default_value' => $default['disk_interval'], |
| 372 | 372 | '#size' => 1, |
| 373 | 373 | '#description' => bts('This controls how often tasks save their state to disk, so that later they can be continued from that point.', array(), NULL, 'boinc:account-preferences-computing') |
| 374 | - ); |
|
| 375 | - $form['prefs']['advanced']['storage']['vm_max_used_pct'] = array( |
|
| 374 | + ); |
|
| 375 | + $form['prefs']['advanced']['storage']['vm_max_used_pct'] = array( |
|
| 376 | 376 | '#title' => bts('Page/swap file: use at most', array(), NULL, 'boinc:account-preferences-computing'), |
| 377 | 377 | '#type' => 'textfield', |
| 378 | 378 | '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
| 379 | 379 | '#default_value' => $default['vm_max_used_pct'], |
| 380 | 380 | '#size' => 1, |
| 381 | 381 | '#description' => bts('Limit the swap space (page file) used by BOINC.', array(), NULL, 'boinc:account-preferences-computing') |
| 382 | - ); |
|
| 383 | - $form['prefs']['advanced']['storage']['ram_max_used_busy_pct'] = array( |
|
| 382 | + ); |
|
| 383 | + $form['prefs']['advanced']['storage']['ram_max_used_busy_pct'] = array( |
|
| 384 | 384 | '#title' => bts('Memory: when computer is in use, use at most', array(), NULL, 'boinc:account-preferences-computing'), |
| 385 | 385 | '#type' => 'textfield', |
| 386 | 386 | '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
| 387 | 387 | '#default_value' => $default['ram_max_used_busy_pct'], |
| 388 | 388 | '#size' => 1, |
| 389 | 389 | '#description' => bts("Limit the memory used by BOINC when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing') |
| 390 | - ); |
|
| 391 | - $form['prefs']['advanced']['storage']['ram_max_used_idle_pct'] = array( |
|
| 390 | + ); |
|
| 391 | + $form['prefs']['advanced']['storage']['ram_max_used_idle_pct'] = array( |
|
| 392 | 392 | '#title' => bts('Memory: when computer is not in use, use at most', array(), NULL, 'boinc:account-preferences-computing'), |
| 393 | 393 | '#type' => 'textfield', |
| 394 | 394 | '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
| 395 | 395 | '#default_value' => $default['ram_max_used_idle_pct'], |
| 396 | 396 | '#size' => 1, |
| 397 | 397 | '#description' => bts("Limit the memory used by BOINC when you're not using the computer.", array(), NULL, 'boinc:account-preferences-computing') |
| 398 | - ); |
|
| 398 | + ); |
|
| 399 | 399 | |
| 400 | - // Network preferences |
|
| 401 | - $form['prefs']['advanced']['network'] = array( |
|
| 400 | + // Network preferences |
|
| 401 | + $form['prefs']['advanced']['network'] = array( |
|
| 402 | 402 | '#title' => bts('Network usage', array(), NULL, 'boinc:account-preferences-computing'), |
| 403 | 403 | '#type' => 'fieldset', |
| 404 | 404 | '#description' => '', |
| 405 | 405 | '#collapsible' => FALSE, |
| 406 | 406 | '#collapsed' => FALSE |
| 407 | - ); |
|
| 408 | - $form['prefs']['advanced']['network']['work_buf_min_days'] = array( |
|
| 407 | + ); |
|
| 408 | + $form['prefs']['advanced']['network']['work_buf_min_days'] = array( |
|
| 409 | 409 | '#title' => bts('Store at least', array(), NULL, 'boinc:account-preferences-computing'), |
| 410 | 410 | '#type' => 'textfield', |
| 411 | 411 | '#field_suffix' => bts('days of work', array(), NULL, 'boinc:account-preferences-computing'), |
| 412 | 412 | '#default_value' => $default['work_buf_min_days'], |
| 413 | 413 | '#size' => 1, |
| 414 | 414 | '#description' => bts('Store at least enough tasks to keep the computer busy for this long.', array(), NULL, 'boinc:account-preferences-computing') |
| 415 | - ); |
|
| 416 | - $form['prefs']['advanced']['network']['work_buf_additional_days'] = array( |
|
| 415 | + ); |
|
| 416 | + $form['prefs']['advanced']['network']['work_buf_additional_days'] = array( |
|
| 417 | 417 | '#title' => bts('Store up to an additional', array(), NULL, 'boinc:account-preferences-computing'), |
| 418 | 418 | '#type' => 'textfield', |
| 419 | 419 | '#field_suffix' => bts('days', array(), NULL, 'boinc:unit-of-time'), |
| 420 | 420 | '#default_value' => $default['work_buf_additional_days'], |
| 421 | 421 | '#size' => 1, |
| 422 | 422 | '#description' => bts('Store additional tasks above the minimum level. Determines how much work is requested when contacting a project.', array(), NULL, 'boinc:account-preferences-computing') |
| 423 | - ); |
|
| 424 | - $form['prefs']['advanced']['network']['confirm_before_connecting'] = array( |
|
| 423 | + ); |
|
| 424 | + $form['prefs']['advanced']['network']['confirm_before_connecting'] = array( |
|
| 425 | 425 | '#title' => bts('Confirm before connecting to Internet?', array(), NULL, 'boinc:account-preferences-computing'), |
| 426 | 426 | '#type' => 'radios', |
| 427 | 427 | '#options' => $form['boolean_options']['#value'], |
| 428 | 428 | '#attributes' => array('class' => 'fancy'), |
| 429 | 429 | '#default_value' => $default['confirm_before_connecting'], |
| 430 | 430 | '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), NULL, 'boinc:account-preferences-computing') |
| 431 | - ); |
|
| 432 | - $form['prefs']['advanced']['network']['hangup_if_dialed'] = array( |
|
| 431 | + ); |
|
| 432 | + $form['prefs']['advanced']['network']['hangup_if_dialed'] = array( |
|
| 433 | 433 | '#title' => bts('Disconnect when done?', array(), NULL, 'boinc:account-preferences-computing'), |
| 434 | 434 | '#type' => 'radios', |
| 435 | 435 | '#options' => $form['boolean_options']['#value'], |
| 436 | 436 | '#attributes' => array('class' => 'fancy'), |
| 437 | 437 | '#default_value' => $default['hangup_if_dialed'], |
| 438 | 438 | '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), NULL, 'boinc:account-preferences-computing') |
| 439 | - ); |
|
| 440 | - $form['prefs']['advanced']['network']['max_bytes_sec_down'] = array( |
|
| 439 | + ); |
|
| 440 | + $form['prefs']['advanced']['network']['max_bytes_sec_down'] = array( |
|
| 441 | 441 | '#title' => bts('Limit download rate to', array(), NULL, 'boinc:account-preferences-computing'), |
| 442 | 442 | '#type' => 'textfield', |
| 443 | 443 | '#field_suffix' => 'Kbytes/sec', |
| 444 | 444 | '#default_value' => $default['max_bytes_sec_down']/1000, |
| 445 | 445 | '#size' => 1, |
| 446 | 446 | '#description' => bts('Limit the download rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
| 447 | - ); |
|
| 448 | - $form['prefs']['advanced']['network']['max_bytes_sec_up'] = array( |
|
| 447 | + ); |
|
| 448 | + $form['prefs']['advanced']['network']['max_bytes_sec_up'] = array( |
|
| 449 | 449 | '#title' => bts('Limit upload rate to', array(), NULL, 'boinc:account-preferences-computing'), |
| 450 | 450 | '#type' => 'textfield', |
| 451 | 451 | '#field_suffix' => 'Kbytes/sec', |
| 452 | 452 | '#default_value' => $default['max_bytes_sec_up']/1000, |
| 453 | 453 | '#size' => 1, |
| 454 | 454 | '#description' => bts('Limit the upload rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
| 455 | - ); |
|
| 456 | - $form['prefs']['advanced']['network']['hour_label'] = array( |
|
| 455 | + ); |
|
| 456 | + $form['prefs']['advanced']['network']['hour_label'] = array( |
|
| 457 | 457 | '#value' => '<div class="form-item"><label>' . bts('Transfer files only between', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
| 458 | - ); |
|
| 459 | - $form['prefs']['advanced']['network']['net_start_hour'] = array( |
|
| 458 | + ); |
|
| 459 | + $form['prefs']['advanced']['network']['net_start_hour'] = array( |
|
| 460 | 460 | '#type' => 'select', |
| 461 | 461 | '#options' => $form['hour_options']['#value'], |
| 462 | 462 | '#default_value' => $default['net_start_hour'] |
| 463 | - ); |
|
| 464 | - $form['prefs']['advanced']['network']['hour_delimiter'] = array( |
|
| 463 | + ); |
|
| 464 | + $form['prefs']['advanced']['network']['hour_delimiter'] = array( |
|
| 465 | 465 | '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
| 466 | - ); |
|
| 467 | - $form['prefs']['advanced']['network']['net_end_hour'] = array( |
|
| 466 | + ); |
|
| 467 | + $form['prefs']['advanced']['network']['net_end_hour'] = array( |
|
| 468 | 468 | '#type' => 'select', |
| 469 | 469 | '#options' => $form['hour_options']['#value'], |
| 470 | 470 | '#default_value' => $default['net_end_hour'] |
| 471 | - ); |
|
| 472 | - $form['prefs']['advanced']['network']['hour_description'] = array( |
|
| 471 | + ); |
|
| 472 | + $form['prefs']['advanced']['network']['hour_description'] = array( |
|
| 473 | 473 | '#value' => '<div class="form-item slim"><div class="description">' . bts('Transfer files only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
| 474 | - ); |
|
| 475 | - $form['prefs']['advanced']['network']['daily_xfer_limit_mb'] = array( |
|
| 474 | + ); |
|
| 475 | + $form['prefs']['advanced']['network']['daily_xfer_limit_mb'] = array( |
|
| 476 | 476 | '#title' => bts('Limit usage to', array(), NULL, 'boinc:account-preferences-computing'), |
| 477 | 477 | '#type' => 'textfield', |
| 478 | 478 | '#field_suffix' => 'Mbytes', |
| 479 | 479 | '#default_value' => $default['daily_xfer_limit_mb'], |
| 480 | 480 | '#size' => 1 |
| 481 | - ); |
|
| 482 | - $form['prefs']['advanced']['network']['daily_xfer_period_days'] = array( |
|
| 481 | + ); |
|
| 482 | + $form['prefs']['advanced']['network']['daily_xfer_period_days'] = array( |
|
| 483 | 483 | '#field_prefix' => 'every', |
| 484 | 484 | '#type' => 'textfield', |
| 485 | 485 | '#field_suffix' => bts('days', array(), NULL, 'boinc:unit-of-time'), |
| 486 | 486 | '#default_value' => $default['daily_xfer_period_days'], |
| 487 | 487 | '#size' => 1, |
| 488 | 488 | '#description' => bts('Example: BOINC should transfer at most 2000 MB of data every 30 days.', array(), NULL, 'boinc:account-preferences-computing'), |
| 489 | - ); |
|
| 490 | - $form['prefs']['advanced']['network']['dont_verify_images'] = array( |
|
| 489 | + ); |
|
| 490 | + $form['prefs']['advanced']['network']['dont_verify_images'] = array( |
|
| 491 | 491 | '#title' => bts('Skip data verification for image files?', array(), NULL, 'boinc:account-preferences-computing'), |
| 492 | 492 | '#type' => 'radios', |
| 493 | 493 | '#options' => $form['boolean_options']['#value'], |
| 494 | 494 | '#attributes' => array('class' => 'fancy'), |
| 495 | 495 | '#default_value' => $default['dont_verify_images'], |
| 496 | 496 | '#description' => bts('Only select "Yes" if your Internet provider modifies image files. Skipping verification reduces the security of BOINC.', array(), NULL, 'boinc:account-preferences-computing') |
| 497 | - ); |
|
| 497 | + ); |
|
| 498 | 498 | |
| 499 | - // The "fancy radios" are made via javascript on document load. In order for |
|
| 500 | - // these to work with AHAH, we need this crazy setTimeout() call. |
|
| 501 | - $form['prefs']['fancy-radios'] = array( |
|
| 499 | + // The "fancy radios" are made via javascript on document load. In order for |
|
| 500 | + // these to work with AHAH, we need this crazy setTimeout() call. |
|
| 501 | + $form['prefs']['fancy-radios'] = array( |
|
| 502 | 502 | '#value' => ' |
| 503 | 503 | <script> |
| 504 | 504 | setTimeout( |
@@ -509,177 +509,177 @@ discard block |
||
| 509 | 509 | 300 |
| 510 | 510 | ) |
| 511 | 511 | </script>' |
| 512 | - ); |
|
| 513 | - $form['prefs']['view advanced'] = array( |
|
| 512 | + ); |
|
| 513 | + $form['prefs']['view advanced'] = array( |
|
| 514 | 514 | '#type' => 'hidden', |
| 515 | 515 | '#value' => 1 |
| 516 | - ); |
|
| 516 | + ); |
|
| 517 | 517 | |
| 518 | - $form['prefs']['separator_bottom'] = array( |
|
| 518 | + $form['prefs']['separator_bottom'] = array( |
|
| 519 | 519 | '#value' => '<div class="separator buttons"></div>' |
| 520 | - ); |
|
| 520 | + ); |
|
| 521 | 521 | |
| 522 | - // Form control |
|
| 523 | - $form['prefs']['form control tabs prefix'] = array( |
|
| 522 | + // Form control |
|
| 523 | + $form['prefs']['form control tabs prefix'] = array( |
|
| 524 | 524 | '#value' => '<ul class="form-control tab-list">' |
| 525 | - ); |
|
| 526 | - $form['prefs']['submit'] = array( |
|
| 525 | + ); |
|
| 526 | + $form['prefs']['submit'] = array( |
|
| 527 | 527 | '#prefix' => '<li class="first tab">', |
| 528 | 528 | '#type' => 'submit', |
| 529 | 529 | '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
| 530 | 530 | '#suffix' => '</li>' |
| 531 | - ); |
|
| 532 | - $form['prefs']['form control tabs'] = array( |
|
| 531 | + ); |
|
| 532 | + $form['prefs']['form control tabs'] = array( |
|
| 533 | 533 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")) . '</li>' |
| 534 | - ); |
|
| 535 | - if ($venue AND $venue != 'generic') { |
|
| 534 | + ); |
|
| 535 | + if ($venue AND $venue != 'generic') { |
|
| 536 | 536 | global $base_path; |
| 537 | 537 | $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
| 538 | - l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
|
| 538 | + l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
|
| 539 | 539 | array( |
| 540 | - 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
|
| 541 | - 'attributes' => array( |
|
| 540 | + 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
|
| 541 | + 'attributes' => array( |
|
| 542 | 542 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
| 543 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
| 544 | - ) |
|
| 543 | + array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
| 544 | + ) |
|
| 545 | 545 | ) |
| 546 | - ) . '</li>'; |
|
| 547 | - } |
|
| 548 | - $form['prefs']['view control'] = array( |
|
| 546 | + ) . '</li>'; |
|
| 547 | + } |
|
| 548 | + $form['prefs']['view control'] = array( |
|
| 549 | 549 | '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing/combined') . '</li>' |
| 550 | - ); |
|
| 551 | - $form['prefs']['form control tabs suffix'] = array( |
|
| 550 | + ); |
|
| 551 | + $form['prefs']['form control tabs suffix'] = array( |
|
| 552 | 552 | '#value' => '</ul>' |
| 553 | - ); |
|
| 554 | - $form['#submit'][] = 'boincwork_generalprefs_form_submit'; |
|
| 553 | + ); |
|
| 554 | + $form['#submit'][] = 'boincwork_generalprefs_form_submit'; |
|
| 555 | 555 | |
| 556 | - return $form; |
|
| 556 | + return $form; |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | /** |
| 560 | - * Validate the general preferences form. |
|
| 561 | - */ |
|
| 560 | + * Validate the general preferences form. |
|
| 561 | + */ |
|
| 562 | 562 | function boincwork_generalprefs_form_validate($form, &$form_state) { |
| 563 | - require_boinc('util'); |
|
| 564 | - $values = $form_state['values']['prefs']['advanced']; |
|
| 565 | - |
|
| 566 | - //drupal_set_message('<pre>' . print_r($form_state['values'], true) . '</pre>'); |
|
| 567 | - // Verify all non-boolean user input values and notify form API of failures |
|
| 568 | - |
|
| 569 | - // Processing preferences |
|
| 570 | - if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['idle_time_to_run']['#title']} [x] {$form['prefs']['advanced']['processor']['idle_time_to_run']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 571 | - if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 572 | - if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 573 | - if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['start_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['start_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 574 | - if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['end_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['end_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 575 | - if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 576 | - if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['max_ncpus_pct']['#title']} [x] {$form['prefs']['advanced']['processor']['max_ncpus_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 577 | - if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_usage_limit']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_usage_limit']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 578 | - |
|
| 579 | - // Storage preferences |
|
| 580 | - if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_gb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 581 | - if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_min_free_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_min_free_gb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 582 | - if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 583 | - if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_interval']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_interval']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 584 | - if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['vm_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['vm_max_used_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 585 | - if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 586 | - if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 587 | - |
|
| 588 | - // Network preferences |
|
| 589 | - if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_min_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_min_days']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 590 | - if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_additional_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_additional_days']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 591 | - if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_down']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_down']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 592 | - if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_up']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_up']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 593 | - if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_start_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_start_hour']['#field_suffix']}"), NULL, 'boinc:account-prefrences-computing')); |
|
| 594 | - if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_end_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_end_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 595 | - if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 596 | - if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 563 | + require_boinc('util'); |
|
| 564 | + $values = $form_state['values']['prefs']['advanced']; |
|
| 565 | + |
|
| 566 | + //drupal_set_message('<pre>' . print_r($form_state['values'], true) . '</pre>'); |
|
| 567 | + // Verify all non-boolean user input values and notify form API of failures |
|
| 568 | + |
|
| 569 | + // Processing preferences |
|
| 570 | + if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['idle_time_to_run']['#title']} [x] {$form['prefs']['advanced']['processor']['idle_time_to_run']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 571 | + if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 572 | + if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 573 | + if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['start_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['start_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 574 | + if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['end_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['end_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 575 | + if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 576 | + if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['max_ncpus_pct']['#title']} [x] {$form['prefs']['advanced']['processor']['max_ncpus_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 577 | + if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_usage_limit']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_usage_limit']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 578 | + |
|
| 579 | + // Storage preferences |
|
| 580 | + if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_gb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 581 | + if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_min_free_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_min_free_gb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 582 | + if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 583 | + if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_interval']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_interval']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 584 | + if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['vm_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['vm_max_used_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 585 | + if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 586 | + if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 587 | + |
|
| 588 | + // Network preferences |
|
| 589 | + if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_min_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_min_days']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 590 | + if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_additional_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_additional_days']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 591 | + if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_down']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_down']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 592 | + if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_up']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_up']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 593 | + if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_start_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_start_hour']['#field_suffix']}"), NULL, 'boinc:account-prefrences-computing')); |
|
| 594 | + if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_end_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_end_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 595 | + if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 596 | + if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | /** |
| 600 | - * Handle post-validation submission of general preferences form. |
|
| 601 | - */ |
|
| 600 | + * Handle post-validation submission of general preferences form. |
|
| 601 | + */ |
|
| 602 | 602 | function boincwork_generalprefs_form_submit($form, &$form_state) { |
| 603 | - global $user; |
|
| 604 | - $account = user_load($user->uid); |
|
| 605 | - |
|
| 606 | - $values = $form_state['values']['prefs']['advanced']; |
|
| 607 | - $venue = $form_state['values']['prefs']['venue']; |
|
| 608 | - $preset = $form_state['values']['prefs']['preset']; |
|
| 609 | - |
|
| 610 | - // Load preferences from BOINC account |
|
| 611 | - $prefs = boincwork_load_prefs('general', $venue); |
|
| 612 | - |
|
| 613 | - // Processing preferences |
|
| 614 | - $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1; |
|
| 615 | - $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1; |
|
| 616 | - $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0 : 1; |
|
| 617 | - $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run']; |
|
| 618 | - $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input']; |
|
| 619 | - $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage']; |
|
| 620 | - $prefs['start_hour'] = $values['processor']['start_hour']; |
|
| 621 | - $prefs['end_hour'] = $values['processor']['end_hour']; |
|
| 622 | - $prefs['leave_apps_in_memory'] = ($values['processor']['leave_apps_in_memory']) ? 1 : 0; |
|
| 623 | - $prefs['cpu_scheduling_period_minutes'] = $values['processor']['cpu_scheduling_period_minutes']; |
|
| 624 | - $prefs['max_ncpus_pct'] = $values['processor']['max_ncpus_pct']; |
|
| 625 | - $prefs['cpu_usage_limit'] = $values['processor']['cpu_usage_limit']; |
|
| 626 | - |
|
| 627 | - // Storage preferences |
|
| 628 | - $prefs['disk_max_used_gb'] = $values['storage']['disk_max_used_gb']; |
|
| 629 | - $prefs['disk_min_free_gb'] = $values['storage']['disk_min_free_gb']; |
|
| 630 | - $prefs['disk_max_used_pct'] = $values['storage']['disk_max_used_pct']; |
|
| 631 | - $prefs['disk_interval'] = $values['storage']['disk_interval']; |
|
| 632 | - $prefs['vm_max_used_pct'] = $values['storage']['vm_max_used_pct']; |
|
| 633 | - $prefs['ram_max_used_busy_pct'] = $values['storage']['ram_max_used_busy_pct']; |
|
| 634 | - $prefs['ram_max_used_idle_pct'] = $values['storage']['ram_max_used_idle_pct']; |
|
| 635 | - |
|
| 636 | - // Network preferences |
|
| 637 | - $prefs['work_buf_min_days'] = $values['network']['work_buf_min_days']; |
|
| 638 | - $prefs['work_buf_additional_days'] = $values['network']['work_buf_additional_days']; |
|
| 639 | - $prefs['confirm_before_connecting'] = ($values['network']['confirm_before_connecting']) ? 1 : 0; |
|
| 640 | - $prefs['hangup_if_dialed'] = ($values['network']['hangup_if_dialed']) ? 1 : 0; |
|
| 641 | - $prefs['max_bytes_sec_down'] = $values['network']['max_bytes_sec_down']*1000; |
|
| 642 | - $prefs['max_bytes_sec_up'] = $values['network']['max_bytes_sec_up']*1000; |
|
| 643 | - $prefs['net_start_hour'] = $values['network']['net_start_hour']; |
|
| 644 | - $prefs['net_end_hour'] = $values['network']['net_end_hour']; |
|
| 645 | - $prefs['daily_xfer_limit_mb'] = $values['network']['daily_xfer_limit_mb']; |
|
| 646 | - $prefs['daily_xfer_period_days'] = $values['network']['daily_xfer_period_days']; |
|
| 647 | - $prefs['dont_verify_images'] = ($values['network']['dont_verify_images']) ? 1 : 0; |
|
| 648 | - |
|
| 649 | - // transform old way to store the preset into new way |
|
| 650 | - // ideally this should already have happened in boincwork_generalprefs_form() |
|
| 651 | - if (isset($prefs['@attributes']['preset'])) { |
|
| 603 | + global $user; |
|
| 604 | + $account = user_load($user->uid); |
|
| 605 | + |
|
| 606 | + $values = $form_state['values']['prefs']['advanced']; |
|
| 607 | + $venue = $form_state['values']['prefs']['venue']; |
|
| 608 | + $preset = $form_state['values']['prefs']['preset']; |
|
| 609 | + |
|
| 610 | + // Load preferences from BOINC account |
|
| 611 | + $prefs = boincwork_load_prefs('general', $venue); |
|
| 612 | + |
|
| 613 | + // Processing preferences |
|
| 614 | + $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1; |
|
| 615 | + $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1; |
|
| 616 | + $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0 : 1; |
|
| 617 | + $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run']; |
|
| 618 | + $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input']; |
|
| 619 | + $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage']; |
|
| 620 | + $prefs['start_hour'] = $values['processor']['start_hour']; |
|
| 621 | + $prefs['end_hour'] = $values['processor']['end_hour']; |
|
| 622 | + $prefs['leave_apps_in_memory'] = ($values['processor']['leave_apps_in_memory']) ? 1 : 0; |
|
| 623 | + $prefs['cpu_scheduling_period_minutes'] = $values['processor']['cpu_scheduling_period_minutes']; |
|
| 624 | + $prefs['max_ncpus_pct'] = $values['processor']['max_ncpus_pct']; |
|
| 625 | + $prefs['cpu_usage_limit'] = $values['processor']['cpu_usage_limit']; |
|
| 626 | + |
|
| 627 | + // Storage preferences |
|
| 628 | + $prefs['disk_max_used_gb'] = $values['storage']['disk_max_used_gb']; |
|
| 629 | + $prefs['disk_min_free_gb'] = $values['storage']['disk_min_free_gb']; |
|
| 630 | + $prefs['disk_max_used_pct'] = $values['storage']['disk_max_used_pct']; |
|
| 631 | + $prefs['disk_interval'] = $values['storage']['disk_interval']; |
|
| 632 | + $prefs['vm_max_used_pct'] = $values['storage']['vm_max_used_pct']; |
|
| 633 | + $prefs['ram_max_used_busy_pct'] = $values['storage']['ram_max_used_busy_pct']; |
|
| 634 | + $prefs['ram_max_used_idle_pct'] = $values['storage']['ram_max_used_idle_pct']; |
|
| 635 | + |
|
| 636 | + // Network preferences |
|
| 637 | + $prefs['work_buf_min_days'] = $values['network']['work_buf_min_days']; |
|
| 638 | + $prefs['work_buf_additional_days'] = $values['network']['work_buf_additional_days']; |
|
| 639 | + $prefs['confirm_before_connecting'] = ($values['network']['confirm_before_connecting']) ? 1 : 0; |
|
| 640 | + $prefs['hangup_if_dialed'] = ($values['network']['hangup_if_dialed']) ? 1 : 0; |
|
| 641 | + $prefs['max_bytes_sec_down'] = $values['network']['max_bytes_sec_down']*1000; |
|
| 642 | + $prefs['max_bytes_sec_up'] = $values['network']['max_bytes_sec_up']*1000; |
|
| 643 | + $prefs['net_start_hour'] = $values['network']['net_start_hour']; |
|
| 644 | + $prefs['net_end_hour'] = $values['network']['net_end_hour']; |
|
| 645 | + $prefs['daily_xfer_limit_mb'] = $values['network']['daily_xfer_limit_mb']; |
|
| 646 | + $prefs['daily_xfer_period_days'] = $values['network']['daily_xfer_period_days']; |
|
| 647 | + $prefs['dont_verify_images'] = ($values['network']['dont_verify_images']) ? 1 : 0; |
|
| 648 | + |
|
| 649 | + // transform old way to store the preset into new way |
|
| 650 | + // ideally this should already have happened in boincwork_generalprefs_form() |
|
| 651 | + if (isset($prefs['@attributes']['preset'])) { |
|
| 652 | 652 | $prefs['preset'] = $prefs['@attributes']['preset']; |
| 653 | 653 | unset($prefs['@attributes']['preset']); |
| 654 | - } |
|
| 655 | - // Save the preset selection (or lack thereof) |
|
| 656 | - if (!$preset OR $preset == 'custom') { |
|
| 654 | + } |
|
| 655 | + // Save the preset selection (or lack thereof) |
|
| 656 | + if (!$preset OR $preset == 'custom') { |
|
| 657 | 657 | $prefs['preset'] = 'custom'; |
| 658 | - } |
|
| 659 | - else { |
|
| 658 | + } |
|
| 659 | + else { |
|
| 660 | 660 | $prefs['preset'] = $preset; |
| 661 | - } |
|
| 661 | + } |
|
| 662 | 662 | |
| 663 | - // If this is a new preference set, be sure to unset the "cleared" attribute |
|
| 664 | - if (isset($prefs['@attributes']['cleared'])) { |
|
| 663 | + // If this is a new preference set, be sure to unset the "cleared" attribute |
|
| 664 | + if (isset($prefs['@attributes']['cleared'])) { |
|
| 665 | 665 | unset($prefs['@attributes']['cleared']); |
| 666 | - } |
|
| 666 | + } |
|
| 667 | 667 | |
| 668 | - // Update database |
|
| 669 | - $result = boincwork_save_prefs($prefs, 'general', $venue); |
|
| 668 | + // Update database |
|
| 669 | + $result = boincwork_save_prefs($prefs, 'general', $venue); |
|
| 670 | 670 | |
| 671 | - if (!$result) { |
|
| 671 | + if (!$result) { |
|
| 672 | 672 | watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
| 673 | 673 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
| 674 | - } |
|
| 675 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
| 674 | + } |
|
| 675 | + elseif (!drupal_get_messages('status', FALSE)) { |
|
| 676 | 676 | // Show this message if the set wasn't created automatically (in which case |
| 677 | 677 | // there is a message tailored to that) { |
| 678 | 678 | drupal_set_message(t('Your preferences have been updated. |
| 679 | 679 | Client-related preferences will take effect when your computer |
| 680 | 680 | communicates with @project or you issue the "Update" |
| 681 | 681 | command from the BOINC client.', array('@project' => PROJECT))); |
| 682 | - } |
|
| 682 | + } |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | |
@@ -691,116 +691,116 @@ discard block |
||
| 691 | 691 | * Find compatible hosts for merging |
| 692 | 692 | */ |
| 693 | 693 | function boincwork_host_get_compatible_hosts($host_id) { |
| 694 | - require_boinc('host'); |
|
| 695 | - global $user; |
|
| 696 | - $account = user_load($user->uid); |
|
| 697 | - $compatible_hosts = array(); |
|
| 698 | - $host_count = 0; |
|
| 699 | - db_set_active('boinc_ro'); |
|
| 700 | - $current_host = db_fetch_object(db_query(" |
|
| 694 | + require_boinc('host'); |
|
| 695 | + global $user; |
|
| 696 | + $account = user_load($user->uid); |
|
| 697 | + $compatible_hosts = array(); |
|
| 698 | + $host_count = 0; |
|
| 699 | + db_set_active('boinc_ro'); |
|
| 700 | + $current_host = db_fetch_object(db_query(" |
|
| 701 | 701 | SELECT id, domain_name, create_time, total_credit, rpc_time, os_name, |
| 702 | 702 | p_vendor, p_model |
| 703 | 703 | FROM {host} |
| 704 | 704 | WHERE userid = '%d' AND id = '%d'", |
| 705 | 705 | $account->boincuser_id, $host_id |
| 706 | - )); |
|
| 707 | - db_set_active('default'); |
|
| 708 | - $current_host->task_count = boincwork_host_get_task_count($current_host->id); |
|
| 709 | - $current_host->is_new = !$current_host->total_credit AND !$current_host->task_count; |
|
| 710 | - // Get the list of all other hosts owned by this user for comparison |
|
| 711 | - db_set_active('boinc_ro'); |
|
| 712 | - $all_other_hosts = db_query(" |
|
| 706 | + )); |
|
| 707 | + db_set_active('default'); |
|
| 708 | + $current_host->task_count = boincwork_host_get_task_count($current_host->id); |
|
| 709 | + $current_host->is_new = !$current_host->total_credit AND !$current_host->task_count; |
|
| 710 | + // Get the list of all other hosts owned by this user for comparison |
|
| 711 | + db_set_active('boinc_ro'); |
|
| 712 | + $all_other_hosts = db_query(" |
|
| 713 | 713 | SELECT id, domain_name, create_time, total_credit, rpc_time, os_name, |
| 714 | 714 | p_vendor, p_model |
| 715 | 715 | FROM {host} |
| 716 | 716 | WHERE userid = '%d' AND id <> '%d'", |
| 717 | 717 | $account->boincuser_id, $host_id |
| 718 | - ); |
|
| 719 | - db_set_active('default'); |
|
| 720 | - // Compare all hosts to see if any are plausible duplicates |
|
| 721 | - while ($other_host = db_fetch_object($all_other_hosts)) { |
|
| 718 | + ); |
|
| 719 | + db_set_active('default'); |
|
| 720 | + // Compare all hosts to see if any are plausible duplicates |
|
| 721 | + while ($other_host = db_fetch_object($all_other_hosts)) { |
|
| 722 | 722 | // First, disqualify if hosts were active at the same time |
| 723 | 723 | if (!$current_host->is_new) { |
| 724 | - $other_host->task_count = boincwork_host_get_task_count($other_host->id); |
|
| 725 | - $other_host->is_new = !$other_host->total_credit AND !$other_host->task_count; |
|
| 726 | - if (!$other_host->is_new) { |
|
| 724 | + $other_host->task_count = boincwork_host_get_task_count($other_host->id); |
|
| 725 | + $other_host->is_new = !$other_host->total_credit AND !$other_host->task_count; |
|
| 726 | + if (!$other_host->is_new) { |
|
| 727 | 727 | // If both hosts being compared are not new, see if times overlap |
| 728 | 728 | if (!times_disjoint($current_host, $other_host)) { |
| 729 | - // Hosts were active at the same time; can't be a duplicate |
|
| 730 | - continue; |
|
| 729 | + // Hosts were active at the same time; can't be a duplicate |
|
| 730 | + continue; |
|
| 731 | + } |
|
| 731 | 732 | } |
| 732 | - } |
|
| 733 | 733 | } |
| 734 | 734 | // Next, disqualify if hosts have different OS platforms |
| 735 | 735 | if (!os_compatible($current_host, $other_host)) { |
| 736 | - // Hosts have different OS platforms; not really a duplicate |
|
| 737 | - continue; |
|
| 736 | + // Hosts have different OS platforms; not really a duplicate |
|
| 737 | + continue; |
|
| 738 | 738 | } |
| 739 | 739 | // Finally, disqualify if hosts have different CPUs |
| 740 | 740 | if (!cpus_compatible($current_host, $other_host)) { |
| 741 | - // CPUs don't match; not a duplicate |
|
| 742 | - continue; |
|
| 741 | + // CPUs don't match; not a duplicate |
|
| 742 | + continue; |
|
| 743 | 743 | } |
| 744 | 744 | // If not disqualified, this host is available for merging |
| 745 | 745 | $hosts[] = $other_host; |
| 746 | 746 | $host_count++; |
| 747 | 747 | if ($host_count == 500) { |
| 748 | - // This is enough! |
|
| 749 | - break; |
|
| 748 | + // This is enough! |
|
| 749 | + break; |
|
| 750 | 750 | } |
| 751 | - } |
|
| 752 | - return $hosts; |
|
| 751 | + } |
|
| 752 | + return $hosts; |
|
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | /** |
| 756 | 756 | * Perform the database updates to merge the old host into the new host |
| 757 | 757 | */ |
| 758 | 758 | function boincwork_host_merge($old_host, $new_host, &$message = NULL) { |
| 759 | - // Decay the average credit of the two hosts |
|
| 760 | - require_boinc('credit'); |
|
| 761 | - $now = time(); |
|
| 762 | - update_average($now, 0, 0, $old_host->expavg_credit, $old_host->expavg_time); |
|
| 763 | - update_average($now, 0, 0, $new_host->expavg_credit, $new_host->expavg_time); |
|
| 759 | + // Decay the average credit of the two hosts |
|
| 760 | + require_boinc('credit'); |
|
| 761 | + $now = time(); |
|
| 762 | + update_average($now, 0, 0, $old_host->expavg_credit, $old_host->expavg_time); |
|
| 763 | + update_average($now, 0, 0, $new_host->expavg_credit, $new_host->expavg_time); |
|
| 764 | 764 | |
| 765 | - // Update the database: |
|
| 766 | - // - add credit from old host to new host |
|
| 767 | - // - change results to refer to the new host |
|
| 768 | - // - put old host in "zombie" state (userid=0, rpc_seqno=[new_host_id]) |
|
| 765 | + // Update the database: |
|
| 766 | + // - add credit from old host to new host |
|
| 767 | + // - change results to refer to the new host |
|
| 768 | + // - put old host in "zombie" state (userid=0, rpc_seqno=[new_host_id]) |
|
| 769 | 769 | |
| 770 | - $total_credit = $old_host->total_credit + $new_host->total_credit; |
|
| 771 | - $recent_credit = $old_host->expavg_credit + $new_host->expavg_credit; |
|
| 770 | + $total_credit = $old_host->total_credit + $new_host->total_credit; |
|
| 771 | + $recent_credit = $old_host->expavg_credit + $new_host->expavg_credit; |
|
| 772 | 772 | |
| 773 | - if ($new_host->rpc_seqno == $old_host->id) { |
|
| 773 | + if ($new_host->rpc_seqno == $old_host->id) { |
|
| 774 | 774 | rules_invoke_event('boincwork_circular_merge_error', $old_host->id, $new_host->id, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 775 | 775 | watchdog('boincwork', |
| 776 | - 'Circular merge attempted, target host rpc_seqno is equal to old host\'s id: old host id=%old_host, target host id=%new_host', |
|
| 777 | - array( |
|
| 776 | + 'Circular merge attempted, target host rpc_seqno is equal to old host\'s id: old host id=%old_host, target host id=%new_host', |
|
| 777 | + array( |
|
| 778 | 778 | '%old_host' => $old_host->id, |
| 779 | 779 | '%new_host' => $new_host->id, |
| 780 | - ), |
|
| 781 | - WATCHDOG_WARNING |
|
| 780 | + ), |
|
| 781 | + WATCHDOG_WARNING |
|
| 782 | 782 | ); |
| 783 | 783 | $message = 'Could not merge due to a circular merge error. The site administrators have been contacted about this issue, and will investigate further.'; |
| 784 | 784 | return FALSE; |
| 785 | - } |
|
| 785 | + } |
|
| 786 | 786 | |
| 787 | - if ($new_host->userid==0) { |
|
| 787 | + if ($new_host->userid==0) { |
|
| 788 | 788 | rules_invoke_event('boincwork_zombie_merge_error', $old_host->id, $new_host->id, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 789 | 789 | watchdog('boincwork', |
| 790 | - 'Zombie merge attempted, target host has userid=0: old host id=%old_host, target host id=%new_host', |
|
| 791 | - array( |
|
| 790 | + 'Zombie merge attempted, target host has userid=0: old host id=%old_host, target host id=%new_host', |
|
| 791 | + array( |
|
| 792 | 792 | '%old_host' => $old_host->id, |
| 793 | 793 | '%new_host' => $new_host->id, |
| 794 | - ), |
|
| 795 | - WATCHDOG_WARNING |
|
| 794 | + ), |
|
| 795 | + WATCHDOG_WARNING |
|
| 796 | 796 | ); |
| 797 | 797 | $message = 'Could not merge because the target host has userid=0. The site administrators have been contacted about this issue, and will investigate further.'; |
| 798 | 798 | return FALSE; |
| 799 | - } |
|
| 799 | + } |
|
| 800 | 800 | |
| 801 | - // Move credit from the old host to the new host |
|
| 802 | - db_set_active('boinc_rw'); |
|
| 803 | - $credit_updated = db_query(" |
|
| 801 | + // Move credit from the old host to the new host |
|
| 802 | + db_set_active('boinc_rw'); |
|
| 803 | + $credit_updated = db_query(" |
|
| 804 | 804 | UPDATE {host} |
| 805 | 805 | SET |
| 806 | 806 | total_credit = '%d', |
@@ -808,34 +808,34 @@ discard block |
||
| 808 | 808 | expavg_time = '%d' |
| 809 | 809 | WHERE id = '%d'", |
| 810 | 810 | $total_credit, $recent_credit, $now, $new_host->id |
| 811 | - ); |
|
| 812 | - db_set_active('default'); |
|
| 813 | - if (!$credit_updated) { |
|
| 811 | + ); |
|
| 812 | + db_set_active('default'); |
|
| 813 | + if (!$credit_updated) { |
|
| 814 | 814 | if ($message !== NULL) { |
| 815 | - $message = bts('Could not update credit', array(), NULL, 'boinc:account-host-merge'); |
|
| 815 | + $message = bts('Could not update credit', array(), NULL, 'boinc:account-host-merge'); |
|
| 816 | 816 | } |
| 817 | 817 | return FALSE; |
| 818 | - } |
|
| 818 | + } |
|
| 819 | 819 | |
| 820 | - // Move results from the old host to the new host |
|
| 821 | - db_set_active('boinc_rw'); |
|
| 822 | - $results_updated = db_query(" |
|
| 820 | + // Move results from the old host to the new host |
|
| 821 | + db_set_active('boinc_rw'); |
|
| 822 | + $results_updated = db_query(" |
|
| 823 | 823 | UPDATE {result} |
| 824 | 824 | SET hostid = '%d' |
| 825 | 825 | WHERE hostid = '%d'", |
| 826 | 826 | $new_host->id, $old_host->id |
| 827 | - ); |
|
| 828 | - db_set_active('default'); |
|
| 829 | - if (!$results_updated) { |
|
| 827 | + ); |
|
| 828 | + db_set_active('default'); |
|
| 829 | + if (!$results_updated) { |
|
| 830 | 830 | if ($message !== NULL) { |
| 831 | - $message = bts('Could not update results', array(), NULL, 'boinc:account-host-merge'); |
|
| 831 | + $message = bts('Could not update results', array(), NULL, 'boinc:account-host-merge'); |
|
| 832 | 832 | } |
| 833 | 833 | return FALSE; |
| 834 | - } |
|
| 834 | + } |
|
| 835 | 835 | |
| 836 | - // Retire the old host |
|
| 837 | - db_set_active('boinc_rw'); |
|
| 838 | - $old_host_retired = db_query(" |
|
| 836 | + // Retire the old host |
|
| 837 | + db_set_active('boinc_rw'); |
|
| 838 | + $old_host_retired = db_query(" |
|
| 839 | 839 | UPDATE {host} |
| 840 | 840 | SET |
| 841 | 841 | total_credit = '0', |
@@ -844,16 +844,16 @@ discard block |
||
| 844 | 844 | rpc_seqno = '%d' |
| 845 | 845 | WHERE id = '%d'", |
| 846 | 846 | $new_host->id, $old_host->id |
| 847 | - ); |
|
| 848 | - db_set_active('default'); |
|
| 849 | - if (!$old_host_retired) { |
|
| 847 | + ); |
|
| 848 | + db_set_active('default'); |
|
| 849 | + if (!$old_host_retired) { |
|
| 850 | 850 | if ($message !== NULL) { |
| 851 | - $message = bts('Could not retire old computer', array(), NULL, 'boinc:account-host-merge'); |
|
| 851 | + $message = bts('Could not retire old computer', array(), NULL, 'boinc:account-host-merge'); |
|
| 852 | 852 | } |
| 853 | 853 | return FALSE; |
| 854 | - } |
|
| 854 | + } |
|
| 855 | 855 | |
| 856 | - return TRUE; |
|
| 856 | + return TRUE; |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | /** |
@@ -861,75 +861,75 @@ discard block |
||
| 861 | 861 | */ |
| 862 | 862 | function boincwork_host_merge_form(&$form_state, $host_id) { |
| 863 | 863 | |
| 864 | - if (!boincwork_host_user_is_owner($host_id)) { |
|
| 864 | + if (!boincwork_host_user_is_owner($host_id)) { |
|
| 865 | 865 | drupal_goto("host/{$host_id}"); |
| 866 | - } |
|
| 866 | + } |
|
| 867 | 867 | |
| 868 | - $form = array(); |
|
| 869 | - $form_state['storage']['current_host_id'] = $host_id; |
|
| 870 | - $current_host = boincwork_host_get_info($host_id); |
|
| 868 | + $form = array(); |
|
| 869 | + $form_state['storage']['current_host_id'] = $host_id; |
|
| 870 | + $current_host = boincwork_host_get_info($host_id); |
|
| 871 | 871 | |
| 872 | - // Get hosts that could be merged with this one |
|
| 873 | - $hosts = boincwork_host_get_compatible_hosts($host_id); |
|
| 872 | + // Get hosts that could be merged with this one |
|
| 873 | + $hosts = boincwork_host_get_compatible_hosts($host_id); |
|
| 874 | 874 | |
| 875 | - if (!$hosts) { |
|
| 875 | + if (!$hosts) { |
|
| 876 | 876 | drupal_set_message(t('There are no computers eligible for merging with this |
| 877 | 877 | one'), 'warning' |
| 878 | 878 | ); |
| 879 | 879 | drupal_goto("host/{$host_id}"); |
| 880 | - } |
|
| 880 | + } |
|
| 881 | 881 | |
| 882 | - $form['overview'] = array( |
|
| 882 | + $form['overview'] = array( |
|
| 883 | 883 | '#value' => '<p>' . bts('Sometimes BOINC assigns separate identities to' |
| 884 | - . ' the same computer by mistake. You can correct this by merging old' |
|
| 885 | - . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge') . '</p>' |
|
| 886 | - . '<p>' |
|
| 887 | - . bts('Check the computers that are the same as @name' |
|
| 888 | - . ' (created on @date at @time with computer ID @id)', |
|
| 884 | + . ' the same computer by mistake. You can correct this by merging old' |
|
| 885 | + . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge') . '</p>' |
|
| 886 | + . '<p>' |
|
| 887 | + . bts('Check the computers that are the same as @name' |
|
| 888 | + . ' (created on @date at @time with computer ID @id)', |
|
| 889 | 889 | array( |
| 890 | - '@name' => $current_host->domain_name, |
|
| 891 | - '@date' => date('j M Y', $current_host->create_time), |
|
| 892 | - '@time' => date('G:i:s T', $current_host->create_time), |
|
| 893 | - '@id' => $current_host->id, |
|
| 890 | + '@name' => $current_host->domain_name, |
|
| 891 | + '@date' => date('j M Y', $current_host->create_time), |
|
| 892 | + '@time' => date('G:i:s T', $current_host->create_time), |
|
| 893 | + '@id' => $current_host->id, |
|
| 894 | 894 | ), |
| 895 | 895 | NULL, 'boinc:account-host-merge') . '</p>', |
| 896 | - ); |
|
| 896 | + ); |
|
| 897 | 897 | |
| 898 | - $options = array(); |
|
| 899 | - foreach ($hosts as $host) { |
|
| 898 | + $options = array(); |
|
| 899 | + foreach ($hosts as $host) { |
|
| 900 | 900 | $options[$host->id] = array( |
| 901 | - $host->domain_name, |
|
| 902 | - date('j M Y G:i:s T', $host->create_time), |
|
| 903 | - $host->id, |
|
| 901 | + $host->domain_name, |
|
| 902 | + date('j M Y G:i:s T', $host->create_time), |
|
| 903 | + $host->id, |
|
| 904 | 904 | ); |
| 905 | - } |
|
| 905 | + } |
|
| 906 | 906 | |
| 907 | - $form['merge'] = array( |
|
| 907 | + $form['merge'] = array( |
|
| 908 | 908 | '#title' => '', |
| 909 | 909 | '#type' => 'tableselect', |
| 910 | 910 | '#header' => array(bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), bts('Created', array(), NULL, 'boinc:host-details'), bts('Computer ID', array(), NULL, 'boinc:host-list')), |
| 911 | 911 | '#options' => $options, |
| 912 | - ); |
|
| 912 | + ); |
|
| 913 | 913 | |
| 914 | - $form['prefs']['separator_bottom'] = array( |
|
| 915 | - // '#value' => '<div class="separator buttons"></div>' |
|
| 916 | - ); |
|
| 914 | + $form['prefs']['separator_bottom'] = array( |
|
| 915 | + // '#value' => '<div class="separator buttons"></div>' |
|
| 916 | + ); |
|
| 917 | 917 | |
| 918 | - // Form control |
|
| 919 | - $form['prefs']['form control tabs prefix'] = array( |
|
| 918 | + // Form control |
|
| 919 | + $form['prefs']['form control tabs prefix'] = array( |
|
| 920 | 920 | '#value' => '<ul class="form-control tab-list">' |
| 921 | - ); |
|
| 922 | - $form['prefs']['submit'] = array( |
|
| 921 | + ); |
|
| 922 | + $form['prefs']['submit'] = array( |
|
| 923 | 923 | '#prefix' => '<li class="first tab">', |
| 924 | 924 | '#type' => 'submit', |
| 925 | 925 | '#value' => bts('Merge', array(), NULL, 'boinc:form-merge'), |
| 926 | 926 | '#suffix' => '</li>' |
| 927 | - ); |
|
| 928 | - $form['prefs']['form control tabs'] = array( |
|
| 927 | + ); |
|
| 928 | + $form['prefs']['form control tabs'] = array( |
|
| 929 | 929 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "host/{$host_id}") . '</li>' |
| 930 | - ); |
|
| 930 | + ); |
|
| 931 | 931 | |
| 932 | - return $form; |
|
| 932 | + return $form; |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | /** |
@@ -942,76 +942,76 @@ discard block |
||
| 942 | 942 | * Handle submission of the merge host form |
| 943 | 943 | */ |
| 944 | 944 | function boincwork_host_merge_form_submit($form, &$form_state) { |
| 945 | - $merged = array(); |
|
| 946 | - $errors = array(); |
|
| 947 | - $current_host_id = $form_state['storage']['current_host_id']; |
|
| 948 | - $current_host = boincwork_host_get_info($current_host_id); |
|
| 949 | - $selected_hosts = array_filter($form_state['values']['merge']); |
|
| 945 | + $merged = array(); |
|
| 946 | + $errors = array(); |
|
| 947 | + $current_host_id = $form_state['storage']['current_host_id']; |
|
| 948 | + $current_host = boincwork_host_get_info($current_host_id); |
|
| 949 | + $selected_hosts = array_filter($form_state['values']['merge']); |
|
| 950 | 950 | |
| 951 | - foreach ($selected_hosts as $host_id) { |
|
| 951 | + foreach ($selected_hosts as $host_id) { |
|
| 952 | 952 | // Attempt to merge each host, noting the results |
| 953 | 953 | $message = ''; |
| 954 | 954 | $old_host = boincwork_host_get_info($host_id); |
| 955 | 955 | if (boincwork_host_merge($old_host, $current_host, $message)) { |
| 956 | - $merged[$old_host->id] = $old_host->id; |
|
| 957 | - $current_host = boincwork_host_get_info($current_host_id); |
|
| 956 | + $merged[$old_host->id] = $old_host->id; |
|
| 957 | + $current_host = boincwork_host_get_info($current_host_id); |
|
| 958 | 958 | } |
| 959 | 959 | else { |
| 960 | - $errors[$old_host->id] = $message; |
|
| 960 | + $errors[$old_host->id] = $message; |
|
| 961 | + } |
|
| 961 | 962 | } |
| 962 | - } |
|
| 963 | 963 | |
| 964 | - if ($merged) { |
|
| 964 | + if ($merged) { |
|
| 965 | 965 | // Generate a natural language list of IDs that were merged |
| 966 | 966 | $oxford_comma = ','; |
| 967 | 967 | $conjunction = bts('and', array(), NULL, 'boinc:account-preference'); |
| 968 | 968 | $list = array_keys($merged); |
| 969 | 969 | $last = array_pop($list); |
| 970 | 970 | if ($list) { |
| 971 | - if (count($merged) == 2) { |
|
| 971 | + if (count($merged) == 2) { |
|
| 972 | 972 | $oxford_comma = ''; |
| 973 | - } |
|
| 974 | - $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
|
| 973 | + } |
|
| 974 | + $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
|
| 975 | 975 | } |
| 976 | 976 | else { |
| 977 | - $list = $last; |
|
| 977 | + $list = $last; |
|
| 978 | 978 | } |
| 979 | 979 | if (count($merged) == 1) { |
| 980 | - drupal_set_message(bts( |
|
| 980 | + drupal_set_message(bts( |
|
| 981 | 981 | 'Computer @old_id has been merged successfully into @id.', |
| 982 | 982 | array( |
| 983 | - '@old_id' => $list, |
|
| 984 | - '@id' => $current_host_id |
|
| 983 | + '@old_id' => $list, |
|
| 984 | + '@id' => $current_host_id |
|
| 985 | 985 | ), |
| 986 | 986 | NULL, 'boinc:account-host-merge')); |
| 987 | 987 | } |
| 988 | 988 | else { |
| 989 | - drupal_set_message(bts( |
|
| 989 | + drupal_set_message(bts( |
|
| 990 | 990 | 'Computers @old_ids have been merged successfully into @id.', |
| 991 | 991 | array( |
| 992 | - '@old_ids' => $list, |
|
| 993 | - '@id' => $current_host_id |
|
| 992 | + '@old_ids' => $list, |
|
| 993 | + '@id' => $current_host_id |
|
| 994 | 994 | ), |
| 995 | 995 | NULL, 'boinc:account-host-merge')); |
| 996 | 996 | } |
| 997 | - } |
|
| 997 | + } |
|
| 998 | 998 | |
| 999 | - if ($errors) { |
|
| 999 | + if ($errors) { |
|
| 1000 | 1000 | // Report any hosts that failed to merge |
| 1001 | 1001 | foreach ($errors as $id => $error) { |
| 1002 | - drupal_set_message( |
|
| 1002 | + drupal_set_message( |
|
| 1003 | 1003 | bts('Computer @old_id failed to merge: @message', |
| 1004 | - array( |
|
| 1004 | + array( |
|
| 1005 | 1005 | '@old_id' => $id, |
| 1006 | 1006 | '@message' => $error, |
| 1007 | - ), |
|
| 1008 | - NULL, 'boinc:account-host-merge'), |
|
| 1007 | + ), |
|
| 1008 | + NULL, 'boinc:account-host-merge'), |
|
| 1009 | 1009 | 'warning' |
| 1010 | - ); |
|
| 1010 | + ); |
|
| 1011 | + } |
|
| 1011 | 1012 | } |
| 1012 | - } |
|
| 1013 | 1013 | |
| 1014 | - drupal_goto("host/{$current_host_id}"); |
|
| 1014 | + drupal_goto("host/{$current_host_id}"); |
|
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -1023,44 +1023,44 @@ discard block |
||
| 1023 | 1023 | */ |
| 1024 | 1024 | function boincwork_projectprefs_form(&$form_state, $venue) { |
| 1025 | 1025 | |
| 1026 | - global $user; |
|
| 1027 | - $account = user_load($user->uid); |
|
| 1026 | + global $user; |
|
| 1027 | + $account = user_load($user->uid); |
|
| 1028 | 1028 | |
| 1029 | - $established = TRUE; |
|
| 1029 | + $established = TRUE; |
|
| 1030 | 1030 | |
| 1031 | - // Get availability of special BOINC preferences |
|
| 1032 | - require_boinc(array('util')); |
|
| 1033 | - $app_types = get_app_types(); |
|
| 1031 | + // Get availability of special BOINC preferences |
|
| 1032 | + require_boinc(array('util')); |
|
| 1033 | + $app_types = get_app_types(); |
|
| 1034 | 1034 | |
| 1035 | - // Load any existing preferences from BOINC account |
|
| 1036 | - $prefs = boincwork_load_prefs('project', $venue); |
|
| 1035 | + // Load any existing preferences from BOINC account |
|
| 1036 | + $prefs = boincwork_load_prefs('project', $venue); |
|
| 1037 | 1037 | |
| 1038 | - // Take note if this is not an established preference set on the account |
|
| 1039 | - if (isset($prefs['@attributes']['cleared'])) { |
|
| 1038 | + // Take note if this is not an established preference set on the account |
|
| 1039 | + if (isset($prefs['@attributes']['cleared'])) { |
|
| 1040 | 1040 | $established = FALSE; |
| 1041 | - } |
|
| 1041 | + } |
|
| 1042 | 1042 | |
| 1043 | - // Extract modified tag if present |
|
| 1044 | - $modified = NULL; |
|
| 1045 | - if (isset($prefs['modified']['@value'])) { |
|
| 1043 | + // Extract modified tag if present |
|
| 1044 | + $modified = NULL; |
|
| 1045 | + if (isset($prefs['modified']['@value'])) { |
|
| 1046 | 1046 | $modified = $prefs['modified']['@value']; |
| 1047 | - } |
|
| 1047 | + } |
|
| 1048 | 1048 | |
| 1049 | - $venue_is_default = FALSE; |
|
| 1050 | - if ($account->boincuser_default_pref_set) { |
|
| 1049 | + $venue_is_default = FALSE; |
|
| 1050 | + if ($account->boincuser_default_pref_set) { |
|
| 1051 | 1051 | if ($account->boincuser_default_pref_set == $venue) { |
| 1052 | - $venue_is_default = TRUE; |
|
| 1052 | + $venue_is_default = TRUE; |
|
| 1053 | 1053 | } |
| 1054 | - } |
|
| 1055 | - elseif (!$venue OR $venue == 'generic') { |
|
| 1054 | + } |
|
| 1055 | + elseif (!$venue OR $venue == 'generic') { |
|
| 1056 | 1056 | $venue_is_default = TRUE; |
| 1057 | - } |
|
| 1058 | - else { |
|
| 1057 | + } |
|
| 1058 | + else { |
|
| 1059 | 1059 | $venue_is_default = FALSE; |
| 1060 | - } |
|
| 1060 | + } |
|
| 1061 | 1061 | |
| 1062 | - // Define form defaults |
|
| 1063 | - $default = array( |
|
| 1062 | + // Define form defaults |
|
| 1063 | + $default = array( |
|
| 1064 | 1064 | 'resource_share' => 100, |
| 1065 | 1065 | 'no_cpu' => 0, |
| 1066 | 1066 | 'no_cuda' => 0, |
@@ -1069,344 +1069,344 @@ discard block |
||
| 1069 | 1069 | 'no_apple_gpu' => 0, |
| 1070 | 1070 | 'default_venue' => $venue_is_default, |
| 1071 | 1071 | 'allow_beta_work' => $prefs['allow_beta_work'], |
| 1072 | - ); |
|
| 1073 | - foreach ($default as $name => $value) { |
|
| 1072 | + ); |
|
| 1073 | + foreach ($default as $name => $value) { |
|
| 1074 | 1074 | if (isset($prefs[$name])) { |
| 1075 | - if (is_array($prefs[$name])) { |
|
| 1075 | + if (is_array($prefs[$name])) { |
|
| 1076 | 1076 | if (isset($prefs[$name]['@value'])) { |
| 1077 | - $default[$name] = $prefs[$name]['@value']; |
|
| 1077 | + $default[$name] = $prefs[$name]['@value']; |
|
| 1078 | + } |
|
| 1078 | 1079 | } |
| 1079 | - } |
|
| 1080 | - else { |
|
| 1080 | + else { |
|
| 1081 | 1081 | $default[$name] = $prefs[$name]; |
| 1082 | - } |
|
| 1082 | + } |
|
| 1083 | + } |
|
| 1083 | 1084 | } |
| 1084 | - } |
|
| 1085 | 1085 | |
| 1086 | - // Standard option sets |
|
| 1087 | - $form['boolean_options'] = array( |
|
| 1086 | + // Standard option sets |
|
| 1087 | + $form['boolean_options'] = array( |
|
| 1088 | 1088 | '#type' => 'value', |
| 1089 | 1089 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
| 1090 | - ); |
|
| 1090 | + ); |
|
| 1091 | 1091 | |
| 1092 | - // Identify preference sets that are established to distinguish what has been |
|
| 1093 | - // saved to the database from what is just showing default values |
|
| 1094 | - $form['#established'] = $established; |
|
| 1092 | + // Identify preference sets that are established to distinguish what has been |
|
| 1093 | + // saved to the database from what is just showing default values |
|
| 1094 | + $form['#established'] = $established; |
|
| 1095 | 1095 | |
| 1096 | - // Top level form options |
|
| 1097 | - $form['#tree'] = TRUE; |
|
| 1096 | + // Top level form options |
|
| 1097 | + $form['#tree'] = TRUE; |
|
| 1098 | 1098 | |
| 1099 | - // Hidden elements |
|
| 1100 | - $form['modified'] = array( |
|
| 1099 | + // Hidden elements |
|
| 1100 | + $form['modified'] = array( |
|
| 1101 | 1101 | '#type' => 'hidden', |
| 1102 | 1102 | '#value' => $modified, |
| 1103 | - ); |
|
| 1104 | - $form['venue'] = array( |
|
| 1103 | + ); |
|
| 1104 | + $form['venue'] = array( |
|
| 1105 | 1105 | '#type' => 'hidden', |
| 1106 | 1106 | '#value' => $venue, |
| 1107 | - ); |
|
| 1107 | + ); |
|
| 1108 | 1108 | |
| 1109 | - $form['separator_top'] = array( |
|
| 1109 | + $form['separator_top'] = array( |
|
| 1110 | 1110 | '#value' => '<div class="separator"></div>' |
| 1111 | - ); |
|
| 1111 | + ); |
|
| 1112 | 1112 | |
| 1113 | - // Common project preferences |
|
| 1114 | - $form['resource'] = array( |
|
| 1113 | + // Common project preferences |
|
| 1114 | + $form['resource'] = array( |
|
| 1115 | 1115 | '#title' => bts('Resource settings', array(), NULL, 'boinc:account-preferences-project'), |
| 1116 | 1116 | '#type' => 'fieldset', |
| 1117 | 1117 | '#description' => null, |
| 1118 | 1118 | '#collapsible' => TRUE, |
| 1119 | 1119 | '#collapsed' => FALSE |
| 1120 | - ); |
|
| 1121 | - $form['resource']['resource_share'] = array( |
|
| 1120 | + ); |
|
| 1121 | + $form['resource']['resource_share'] = array( |
|
| 1122 | 1122 | '#title' => bts('Resource share', array(), NULL, 'boinc:account-preferences-project'), |
| 1123 | 1123 | '#type' => 'textfield', |
| 1124 | 1124 | '#default_value' => $default['resource_share'], |
| 1125 | 1125 | '#size' => 5, |
| 1126 | 1126 | '#description' => bts("Determines the proportion of your computer's resources allocated to this project. Example: if you participate in two BOINC projects with resource shares of 100 and 200, the first will get 1/3 of your resources and the second will get 2/3.", array(), NULL, 'boinc:account-preferences-project') |
| 1127 | - ); |
|
| 1128 | - if ($app_types->count > 1) { |
|
| 1127 | + ); |
|
| 1128 | + if ($app_types->count > 1) { |
|
| 1129 | 1129 | if ($app_types->cpu) { |
| 1130 | - $form['resource']['no_cpu'] = array( |
|
| 1130 | + $form['resource']['no_cpu'] = array( |
|
| 1131 | 1131 | '#title' => bts('Use CPU', array(), NULL, 'boinc:account-preferences-project'), |
| 1132 | 1132 | '#type' => 'radios', |
| 1133 | 1133 | '#options' => $form['boolean_options']['#value'], |
| 1134 | 1134 | '#attributes' => array('class' => 'fancy'), |
| 1135 | 1135 | '#default_value' => $default['no_cpu'] ? 0 : 1, |
| 1136 | 1136 | '#description' => bts('Request CPU-only tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
| 1137 | - ); |
|
| 1137 | + ); |
|
| 1138 | 1138 | } |
| 1139 | 1139 | if ($app_types->cuda) { |
| 1140 | - $form['resource']['no_cuda'] = array( |
|
| 1140 | + $form['resource']['no_cuda'] = array( |
|
| 1141 | 1141 | '#title' => bts('Use NVIDIA GPU', array(), NULL, 'boinc:account-preferences-project'), |
| 1142 | 1142 | '#type' => 'radios', |
| 1143 | 1143 | '#options' => $form['boolean_options']['#value'], |
| 1144 | 1144 | '#attributes' => array('class' => 'fancy'), |
| 1145 | 1145 | '#default_value' => $default['no_cuda'] ? 0 : 1, |
| 1146 | 1146 | '#description' => bts('Request NVIDIA GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
| 1147 | - ); |
|
| 1147 | + ); |
|
| 1148 | 1148 | } |
| 1149 | 1149 | if ($app_types->ati) { |
| 1150 | - $form['resource']['no_ati'] = array( |
|
| 1150 | + $form['resource']['no_ati'] = array( |
|
| 1151 | 1151 | '#title' => bts('Use AMD GPU', array(), NULL, 'boinc:account-preferences-project'), |
| 1152 | 1152 | '#type' => 'radios', |
| 1153 | 1153 | '#options' => $form['boolean_options']['#value'], |
| 1154 | 1154 | '#attributes' => array('class' => 'fancy'), |
| 1155 | 1155 | '#default_value' => $default['no_ati'] ? 0 : 1, |
| 1156 | 1156 | '#description' => bts('Request AMD GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
| 1157 | - ); |
|
| 1157 | + ); |
|
| 1158 | 1158 | } |
| 1159 | 1159 | if ($app_types->intel_gpu) { |
| 1160 | - $form['resource']['no_intel_gpu'] = array( |
|
| 1160 | + $form['resource']['no_intel_gpu'] = array( |
|
| 1161 | 1161 | '#title' => bts('Use INTEL GPU', array(), NULL, 'boinc:account-preferences-project'), |
| 1162 | 1162 | '#type' => 'radios', |
| 1163 | 1163 | '#options' => $form['boolean_options']['#value'], |
| 1164 | 1164 | '#attributes' => array('class' => 'fancy'), |
| 1165 | 1165 | '#default_value' => $default['no_intel_gpu'] ? 0 : 1, |
| 1166 | 1166 | '#description' => bts('Request Intel GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
| 1167 | - ); |
|
| 1167 | + ); |
|
| 1168 | 1168 | } |
| 1169 | 1169 | if ($app_types->apple_gpu) { |
| 1170 | - $form['resource']['no_apple_gpu'] = array( |
|
| 1170 | + $form['resource']['no_apple_gpu'] = array( |
|
| 1171 | 1171 | '#title' => bts('Use Apple GPU', array(), NULL, 'boinc:account-preferences-project'), |
| 1172 | 1172 | '#type' => 'radios', |
| 1173 | 1173 | '#options' => $form['boolean_options']['#value'], |
| 1174 | 1174 | '#attributes' => array('class' => 'fancy'), |
| 1175 | 1175 | '#default_value' => $default['no_apple_gpu'] ? 0 : 1, |
| 1176 | 1176 | '#description' => bts('Request Apple GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
| 1177 | - ); |
|
| 1177 | + ); |
|
| 1178 | + } |
|
| 1178 | 1179 | } |
| 1179 | - } |
|
| 1180 | 1180 | |
| 1181 | - if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
| 1181 | + if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
| 1182 | 1182 | $form['beta'] = array( |
| 1183 | - '#title' => bts('Beta settings', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1184 | - '#type' => 'fieldset', |
|
| 1185 | - '#description' => null, |
|
| 1186 | - '#collapsible' => TRUE, |
|
| 1187 | - '#collapsed' => FALSE |
|
| 1183 | + '#title' => bts('Beta settings', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1184 | + '#type' => 'fieldset', |
|
| 1185 | + '#description' => null, |
|
| 1186 | + '#collapsible' => TRUE, |
|
| 1187 | + '#collapsed' => FALSE |
|
| 1188 | 1188 | ); |
| 1189 | 1189 | $form['beta']['allow_beta_work'] = array( |
| 1190 | - '#title' => bts('Run test applications?', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1191 | - '#type' => 'radios', |
|
| 1192 | - '#options' => $form['boolean_options']['#value'], |
|
| 1193 | - '#attributes' => array('class' => 'fancy'), |
|
| 1194 | - '#default_value' => ($default['allow_beta_work']) ? 1 : 0, |
|
| 1195 | - '#description' => bts('This helps us develop applications, but may cause jobs to fail on your computer', array(), NULL, 'boinc:account-preferences-project') |
|
| 1190 | + '#title' => bts('Run test applications?', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1191 | + '#type' => 'radios', |
|
| 1192 | + '#options' => $form['boolean_options']['#value'], |
|
| 1193 | + '#attributes' => array('class' => 'fancy'), |
|
| 1194 | + '#default_value' => ($default['allow_beta_work']) ? 1 : 0, |
|
| 1195 | + '#description' => bts('This helps us develop applications, but may cause jobs to fail on your computer', array(), NULL, 'boinc:account-preferences-project') |
|
| 1196 | 1196 | ); |
| 1197 | - } |
|
| 1197 | + } |
|
| 1198 | 1198 | |
| 1199 | - // Add project specific prefs to the form |
|
| 1200 | - boincwork_add_project_specific_prefs($form, $prefs); |
|
| 1199 | + // Add project specific prefs to the form |
|
| 1200 | + boincwork_add_project_specific_prefs($form, $prefs); |
|
| 1201 | 1201 | |
| 1202 | - // Set whether to use this preference set by default for new computers |
|
| 1203 | - $form['default_set'] = array( |
|
| 1202 | + // Set whether to use this preference set by default for new computers |
|
| 1203 | + $form['default_set'] = array( |
|
| 1204 | 1204 | '#title' => bts('Default set', array(), NULL, 'boinc:account-preferences-project'), |
| 1205 | 1205 | '#type' => 'fieldset', |
| 1206 | 1206 | '#description' => null, |
| 1207 | 1207 | '#collapsible' => TRUE, |
| 1208 | 1208 | '#collapsed' => FALSE |
| 1209 | - ); |
|
| 1210 | - $form['default_set']['default_venue'] = array( |
|
| 1209 | + ); |
|
| 1210 | + $form['default_set']['default_venue'] = array( |
|
| 1211 | 1211 | '#title' => bts('Set used for new computers', array(), NULL, 'boinc:account-preferences-project'), |
| 1212 | 1212 | '#type' => 'radios', |
| 1213 | 1213 | '#options' => $form['boolean_options']['#value'], |
| 1214 | 1214 | '#attributes' => array('class' => 'fancy'), |
| 1215 | 1215 | '#default_value' => $default['default_venue'] ? 1 : 0, |
| 1216 | 1216 | '#description' => '' |
| 1217 | - ); |
|
| 1217 | + ); |
|
| 1218 | 1218 | |
| 1219 | - $form['prefs']['separator_bottom'] = array( |
|
| 1219 | + $form['prefs']['separator_bottom'] = array( |
|
| 1220 | 1220 | '#value' => '<div class="separator buttons"></div>' |
| 1221 | - ); |
|
| 1221 | + ); |
|
| 1222 | 1222 | |
| 1223 | - // Form control |
|
| 1224 | - $form['prefs']['form control tabs prefix'] = array( |
|
| 1223 | + // Form control |
|
| 1224 | + $form['prefs']['form control tabs prefix'] = array( |
|
| 1225 | 1225 | '#value' => '<ul class="form-control tab-list">' |
| 1226 | - ); |
|
| 1227 | - $form['prefs']['submit'] = array( |
|
| 1226 | + ); |
|
| 1227 | + $form['prefs']['submit'] = array( |
|
| 1228 | 1228 | '#prefix' => '<li class="first tab">', |
| 1229 | 1229 | '#type' => 'submit', |
| 1230 | 1230 | '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
| 1231 | 1231 | '#suffix' => '</li>' |
| 1232 | - ); |
|
| 1233 | - $form['prefs']['form control tabs'] = array( |
|
| 1232 | + ); |
|
| 1233 | + $form['prefs']['form control tabs'] = array( |
|
| 1234 | 1234 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
| 1235 | - ); |
|
| 1236 | - if ($venue AND $venue != 'generic') { |
|
| 1235 | + ); |
|
| 1236 | + if ($venue AND $venue != 'generic') { |
|
| 1237 | 1237 | global $base_path; |
| 1238 | 1238 | $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
| 1239 | - l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
|
| 1239 | + l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
|
| 1240 | 1240 | array( |
| 1241 | - 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
|
| 1242 | - 'attributes' => array( |
|
| 1241 | + 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
|
| 1242 | + 'attributes' => array( |
|
| 1243 | 1243 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
| 1244 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
| 1245 | - ) |
|
| 1244 | + array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
| 1245 | + ) |
|
| 1246 | 1246 | ) |
| 1247 | - ) . '</li>'; |
|
| 1248 | - } |
|
| 1249 | - $form['prefs']['view control'] = array( |
|
| 1250 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
| 1251 | - ); |
|
| 1252 | - $form['prefs']['form control tabs suffix'] = array( |
|
| 1247 | + ) . '</li>'; |
|
| 1248 | + } |
|
| 1249 | + $form['prefs']['view control'] = array( |
|
| 1250 | + '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
| 1251 | + ); |
|
| 1252 | + $form['prefs']['form control tabs suffix'] = array( |
|
| 1253 | 1253 | '#value' => '</ul>' |
| 1254 | - ); |
|
| 1254 | + ); |
|
| 1255 | 1255 | |
| 1256 | - return $form; |
|
| 1256 | + return $form; |
|
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | /** |
| 1260 | 1260 | * Add project specific preferences to the project preferences form |
| 1261 | 1261 | */ |
| 1262 | 1262 | function boincwork_add_project_specific_prefs(&$form, $prefs) { |
| 1263 | - // Load project specific preferences from XML config |
|
| 1264 | - $xml = boincwork_get_project_specific_config(); |
|
| 1263 | + // Load project specific preferences from XML config |
|
| 1264 | + $xml = boincwork_get_project_specific_config(); |
|
| 1265 | 1265 | |
| 1266 | - // Respect the order of the top level elements |
|
| 1267 | - $ordered_array = array(); |
|
| 1268 | - $unordered_array = array(); |
|
| 1269 | - foreach ($xml['project_specific_preferences'] as $type => $element) { |
|
| 1266 | + // Respect the order of the top level elements |
|
| 1267 | + $ordered_array = array(); |
|
| 1268 | + $unordered_array = array(); |
|
| 1269 | + foreach ($xml['project_specific_preferences'] as $type => $element) { |
|
| 1270 | 1270 | if (is_array($element) AND is_numeric(key($element))) { |
| 1271 | - foreach ($element as $ordered_element) { |
|
| 1271 | + foreach ($element as $ordered_element) { |
|
| 1272 | 1272 | if (isset($ordered_element['@position'])) { |
| 1273 | - $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
|
| 1273 | + $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
|
| 1274 | 1274 | } |
| 1275 | 1275 | else { |
| 1276 | - $unordered_array[] = array($type => $ordered_element); |
|
| 1276 | + $unordered_array[] = array($type => $ordered_element); |
|
| 1277 | + } |
|
| 1277 | 1278 | } |
| 1278 | - } |
|
| 1279 | 1279 | } |
| 1280 | 1280 | elseif (isset($element['@position'])) { |
| 1281 | - $ordered_array[$element['@position']] = array($type => $element); |
|
| 1281 | + $ordered_array[$element['@position']] = array($type => $element); |
|
| 1282 | 1282 | } |
| 1283 | 1283 | else { |
| 1284 | - $unordered_array[] = array($type => $element); |
|
| 1284 | + $unordered_array[] = array($type => $element); |
|
| 1285 | 1285 | } |
| 1286 | - } |
|
| 1287 | - ksort($ordered_array); |
|
| 1288 | - $primed_array = array_merge($ordered_array, $unordered_array); |
|
| 1289 | - $xml = array('project_specific_preferences' => $primed_array); |
|
| 1286 | + } |
|
| 1287 | + ksort($ordered_array); |
|
| 1288 | + $primed_array = array_merge($ordered_array, $unordered_array); |
|
| 1289 | + $xml = array('project_specific_preferences' => $primed_array); |
|
| 1290 | 1290 | |
| 1291 | - foreach ($xml['project_specific_preferences'] as $wrapped_element) { |
|
| 1291 | + foreach ($xml['project_specific_preferences'] as $wrapped_element) { |
|
| 1292 | 1292 | $type = key($wrapped_element); |
| 1293 | 1293 | $element= reset($wrapped_element); |
| 1294 | 1294 | boincwork_generate_prefs_element($form, $type, $element, $prefs['project_specific']); |
| 1295 | - } |
|
| 1295 | + } |
|
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | 1298 | /** |
| 1299 | - * Validate the project preferences form. |
|
| 1300 | - */ |
|
| 1299 | + * Validate the project preferences form. |
|
| 1300 | + */ |
|
| 1301 | 1301 | function boincwork_projectprefs_form_validate($form, &$form_state) { |
| 1302 | 1302 | |
| 1303 | - // Verify all text user input values and notify form API of failures |
|
| 1304 | - $validation_rules = array( |
|
| 1303 | + // Verify all text user input values and notify form API of failures |
|
| 1304 | + $validation_rules = array( |
|
| 1305 | 1305 | 'resource' => array( |
| 1306 | - 'resource_share' => array( |
|
| 1306 | + 'resource_share' => array( |
|
| 1307 | 1307 | 'datatype' => 'integer', |
| 1308 | 1308 | 'min' => 0 |
| 1309 | - ), |
|
| 1309 | + ), |
|
| 1310 | 1310 | ), |
| 1311 | - ); |
|
| 1311 | + ); |
|
| 1312 | 1312 | |
| 1313 | - // Add validation rules for project specific settings |
|
| 1314 | - $validation_rules += boincwork_get_project_specific_config_validation_rules(); |
|
| 1313 | + // Add validation rules for project specific settings |
|
| 1314 | + $validation_rules += boincwork_get_project_specific_config_validation_rules(); |
|
| 1315 | 1315 | |
| 1316 | - // Perform validation |
|
| 1317 | - boincwork_validate_form($validation_rules, $form_state['values']); |
|
| 1316 | + // Perform validation |
|
| 1317 | + boincwork_validate_form($validation_rules, $form_state['values']); |
|
| 1318 | 1318 | |
| 1319 | - // Check for app validation |
|
| 1320 | - if (isset($validation_rules['apps'])) { |
|
| 1319 | + // Check for app validation |
|
| 1320 | + if (isset($validation_rules['apps'])) { |
|
| 1321 | 1321 | if (isset($validation_rules['apps']['minimum selected']) |
| 1322 | 1322 | AND $validation_rules['apps']['minimum selected'] > 0) { |
| 1323 | - $apps_selected = 0; |
|
| 1324 | - foreach ($validation_rules['apps']['list'] as $app) { |
|
| 1323 | + $apps_selected = 0; |
|
| 1324 | + foreach ($validation_rules['apps']['list'] as $app) { |
|
| 1325 | 1325 | if ($form_state['values']['applications'][$app]) $apps_selected++; |
| 1326 | - } |
|
| 1327 | - if ($apps_selected < $validation_rules['apps']['minimum selected']) { |
|
| 1326 | + } |
|
| 1327 | + if ($apps_selected < $validation_rules['apps']['minimum selected']) { |
|
| 1328 | 1328 | form_set_error( |
| 1329 | - 'applications', |
|
| 1330 | - bts('At least one application must be selected', array(), NULL, 'boinc:account-preferences-project') |
|
| 1329 | + 'applications', |
|
| 1330 | + bts('At least one application must be selected', array(), NULL, 'boinc:account-preferences-project') |
|
| 1331 | 1331 | ); |
| 1332 | - } |
|
| 1333 | - if ($apps_selected == count($validation_rules['apps']['list'])) { |
|
| 1332 | + } |
|
| 1333 | + if ($apps_selected == count($validation_rules['apps']['list'])) { |
|
| 1334 | 1334 | foreach ($validation_rules['apps']['list'] as $app) { |
| 1335 | - unset($form_state['values']['applications'][$app]); |
|
| 1335 | + unset($form_state['values']['applications'][$app]); |
|
| 1336 | 1336 | } |
| 1337 | 1337 | $form_state['storage']['all apps selected'] = TRUE; |
| 1338 | - } |
|
| 1338 | + } |
|
| 1339 | + } |
|
| 1339 | 1340 | } |
| 1340 | - } |
|
| 1341 | 1341 | } |
| 1342 | 1342 | |
| 1343 | 1343 | /** |
| 1344 | - * Handle post-validation submission of project preferences form. |
|
| 1345 | - */ |
|
| 1344 | + * Handle post-validation submission of project preferences form. |
|
| 1345 | + */ |
|
| 1346 | 1346 | function boincwork_projectprefs_form_submit($form, &$form_state) { |
| 1347 | - global $user; |
|
| 1348 | - global $site_name; |
|
| 1347 | + global $user; |
|
| 1348 | + global $site_name; |
|
| 1349 | 1349 | |
| 1350 | - require_boinc(array('util')); |
|
| 1351 | - $app_types = get_app_types(); |
|
| 1350 | + require_boinc(array('util')); |
|
| 1351 | + $app_types = get_app_types(); |
|
| 1352 | 1352 | |
| 1353 | - $account = user_load($user->uid); |
|
| 1354 | - $edit = $form_state['values']; |
|
| 1355 | - $venue = $edit['venue']; |
|
| 1353 | + $account = user_load($user->uid); |
|
| 1354 | + $edit = $form_state['values']; |
|
| 1355 | + $venue = $edit['venue']; |
|
| 1356 | 1356 | |
| 1357 | - // Load preferences from BOINC account |
|
| 1358 | - $prefs = boincwork_load_prefs('project', $venue); |
|
| 1357 | + // Load preferences from BOINC account |
|
| 1358 | + $prefs = boincwork_load_prefs('project', $venue); |
|
| 1359 | 1359 | |
| 1360 | - // Resource preferences |
|
| 1361 | - $prefs['resource_share'] = $edit['resource']['resource_share']; |
|
| 1362 | - if ($app_types->count > 1) { |
|
| 1360 | + // Resource preferences |
|
| 1361 | + $prefs['resource_share'] = $edit['resource']['resource_share']; |
|
| 1362 | + if ($app_types->count > 1) { |
|
| 1363 | 1363 | if ($app_types->cpu) $prefs['no_cpu'] = ($edit['resource']['no_cpu']) ? 0 : 1; |
| 1364 | 1364 | if ($app_types->cuda) $prefs['no_cuda'] = ($edit['resource']['no_cuda']) ? 0 : 1; |
| 1365 | 1365 | if ($app_types->ati) $prefs['no_ati'] = ($edit['resource']['no_ati']) ? 0 : 1; |
| 1366 | 1366 | if ($app_types->intel_gpu) $prefs['no_intel_gpu'] = ($edit['resource']['no_intel_gpu']) ? 0 : 1; |
| 1367 | 1367 | if ($app_types->apple_gpu) $prefs['no_apple_gpu'] = ($edit['resource']['no_apple_gpu']) ? 0 : 1; |
| 1368 | - } |
|
| 1368 | + } |
|
| 1369 | 1369 | |
| 1370 | - // Beta preferences |
|
| 1371 | - if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
| 1370 | + // Beta preferences |
|
| 1371 | + if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
| 1372 | 1372 | $prefs['allow_beta_work'] = ($edit['beta']['allow_beta_work']) ? 1 : 0; |
| 1373 | - } |
|
| 1373 | + } |
|
| 1374 | 1374 | |
| 1375 | - // Load project specific preferences from XML config |
|
| 1376 | - $xml = boincwork_get_project_specific_config(); |
|
| 1377 | - $updated_prefs = array( |
|
| 1375 | + // Load project specific preferences from XML config |
|
| 1376 | + $xml = boincwork_get_project_specific_config(); |
|
| 1377 | + $updated_prefs = array( |
|
| 1378 | 1378 | 'project_specific' => boincwork_format_project_specific_prefs_data($edit) |
| 1379 | - ); |
|
| 1380 | - $prefs = $updated_prefs + $prefs; |
|
| 1379 | + ); |
|
| 1380 | + $prefs = $updated_prefs + $prefs; |
|
| 1381 | 1381 | |
| 1382 | - // Don't specify apps if all are selected |
|
| 1383 | - if (isset($form_state['storage']['all apps selected'])) { |
|
| 1382 | + // Don't specify apps if all are selected |
|
| 1383 | + if (isset($form_state['storage']['all apps selected'])) { |
|
| 1384 | 1384 | unset($prefs['project_specific']['app_id']); |
| 1385 | 1385 | unset($form_state['storage']['all apps selected']); |
| 1386 | - } |
|
| 1386 | + } |
|
| 1387 | 1387 | |
| 1388 | - // If this is a new preference set, be sure to unset the "cleared" attribute |
|
| 1389 | - if (isset($prefs['@attributes']['cleared'])) { |
|
| 1388 | + // If this is a new preference set, be sure to unset the "cleared" attribute |
|
| 1389 | + if (isset($prefs['@attributes']['cleared'])) { |
|
| 1390 | 1390 | unset($prefs['@attributes']['cleared']); |
| 1391 | - } |
|
| 1391 | + } |
|
| 1392 | 1392 | |
| 1393 | - // Save preferences back to the BOINC account |
|
| 1394 | - $result = boincwork_save_prefs($prefs, 'project', $venue); |
|
| 1393 | + // Save preferences back to the BOINC account |
|
| 1394 | + $result = boincwork_save_prefs($prefs, 'project', $venue); |
|
| 1395 | 1395 | |
| 1396 | - // Update the user's default preference set |
|
| 1397 | - if ($edit['default_set']['default_venue']) { |
|
| 1396 | + // Update the user's default preference set |
|
| 1397 | + if ($edit['default_set']['default_venue']) { |
|
| 1398 | 1398 | boincwork_set_default_venue($venue); |
| 1399 | - } |
|
| 1400 | - elseif ($venue == $account->boincuser_default_pref_set) { |
|
| 1399 | + } |
|
| 1400 | + elseif ($venue == $account->boincuser_default_pref_set) { |
|
| 1401 | 1401 | // User has cleared out the default venue setting |
| 1402 | 1402 | boincwork_set_default_venue(); |
| 1403 | - } |
|
| 1403 | + } |
|
| 1404 | 1404 | |
| 1405 | - if (!$result) { |
|
| 1405 | + if (!$result) { |
|
| 1406 | 1406 | watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
| 1407 | 1407 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
| 1408 | - } |
|
| 1409 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
| 1408 | + } |
|
| 1409 | + elseif (!drupal_get_messages('status', FALSE)) { |
|
| 1410 | 1410 | // Show this message if the set wasn't created automatically (in which case |
| 1411 | 1411 | // there is a message tailored to that) |
| 1412 | 1412 | drupal_set_message(t('Your preferences have been updated. |
@@ -1414,53 +1414,53 @@ discard block |
||
| 1414 | 1414 | communicates with @project or you issue the "Update" |
| 1415 | 1415 | command from the BOINC client.', |
| 1416 | 1416 | array('@project' => $site_name))); |
| 1417 | - } |
|
| 1417 | + } |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | /** |
| 1421 | 1421 | * The structure of the community preferences form |
| 1422 | 1422 | */ |
| 1423 | 1423 | function communityprefs_form(&$form_state) { |
| 1424 | - global $user; |
|
| 1425 | - $account = user_load($user->uid); |
|
| 1426 | - $form = array(); |
|
| 1427 | - |
|
| 1428 | - // Pull in some elements from the profile form |
|
| 1429 | - $profile_form_state = array(); |
|
| 1430 | - $profile = new stdClass(); |
|
| 1431 | - $profile->type = 'profile'; |
|
| 1432 | - $profile->language = ''; |
|
| 1433 | - if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
|
| 1424 | + global $user; |
|
| 1425 | + $account = user_load($user->uid); |
|
| 1426 | + $form = array(); |
|
| 1427 | + |
|
| 1428 | + // Pull in some elements from the profile form |
|
| 1429 | + $profile_form_state = array(); |
|
| 1430 | + $profile = new stdClass(); |
|
| 1431 | + $profile->type = 'profile'; |
|
| 1432 | + $profile->language = ''; |
|
| 1433 | + if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
|
| 1434 | 1434 | $profile_node = node_load($profile_nid); |
| 1435 | 1435 | $form_state['storage']['profile_node'] = $profile_node; |
| 1436 | 1436 | module_load_include('inc', 'node', 'node.pages'); |
| 1437 | 1437 | $profile_form = drupal_retrieve_form('profile_node_form', $profile_form_state, $profile_node); |
| 1438 | 1438 | drupal_prepare_form('profile_node_form', $profile_form, $profile_form_state); |
| 1439 | - } |
|
| 1439 | + } |
|
| 1440 | 1440 | |
| 1441 | - // Standard option sets |
|
| 1442 | - $form['boolean_options'] = array( |
|
| 1441 | + // Standard option sets |
|
| 1442 | + $form['boolean_options'] = array( |
|
| 1443 | 1443 | '#type' => 'value', |
| 1444 | 1444 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
| 1445 | - ); |
|
| 1445 | + ); |
|
| 1446 | 1446 | |
| 1447 | - $default = array( |
|
| 1447 | + $default = array( |
|
| 1448 | 1448 | 'pm_send_notification' => '', // This is set already in pm_email_notify_user |
| 1449 | 1449 | 'friend_notification' => isset($account->friend_notification) ? $account->friend_notification : 0, |
| 1450 | 1450 | 'comments_per_page' => (isset($account->comments_per_page) AND $account->comments_per_page) ? $account->comments_per_page : variable_get('comment_default_per_page_forum', 50), |
| 1451 | 1451 | 'comments_order' => (isset($account->sort) AND $account->sort) ? $account->sort : variable_get('comment_default_order_forum', COMMENT_ORDER_OLDEST_FIRST), |
| 1452 | - ); |
|
| 1452 | + ); |
|
| 1453 | 1453 | |
| 1454 | - // General options |
|
| 1455 | - $form['general'] = array( |
|
| 1454 | + // General options |
|
| 1455 | + $form['general'] = array( |
|
| 1456 | 1456 | '#type' => 'fieldset', |
| 1457 | 1457 | '#title' => bts('General settings', array(), NULL, 'boinc:account-preferences-community'), |
| 1458 | 1458 | '#weight' => 0, |
| 1459 | 1459 | '#collapsible' => TRUE, |
| 1460 | 1460 | '#collapsed' => FALSE |
| 1461 | - ); |
|
| 1462 | - // Add the BOINC user name (non-unique, user editable) |
|
| 1463 | - $form['general']['boincuser_name'] = array( |
|
| 1461 | + ); |
|
| 1462 | + // Add the BOINC user name (non-unique, user editable) |
|
| 1463 | + $form['general']['boincuser_name'] = array( |
|
| 1464 | 1464 | '#type' => 'textfield', |
| 1465 | 1465 | '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
| 1466 | 1466 | '#default_value' => $account->boincuser_name, |
@@ -1468,252 +1468,252 @@ discard block |
||
| 1468 | 1468 | '#required' => TRUE, |
| 1469 | 1469 | '#description' => '', |
| 1470 | 1470 | '#size' => 40 |
| 1471 | - ); |
|
| 1472 | - // Time zone |
|
| 1473 | - if (variable_get('configurable_timezones', 1)) { |
|
| 1471 | + ); |
|
| 1472 | + // Time zone |
|
| 1473 | + if (variable_get('configurable_timezones', 1)) { |
|
| 1474 | 1474 | $zones = _system_zonelist(); |
| 1475 | 1475 | $form['general']['timezone'] = array( |
| 1476 | - '#type' => 'select', |
|
| 1477 | - '#title' => bts('Time zone', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1478 | - '#default_value' => ($account->timezone !== NULL) ? $account->timezone : variable_get('date_default_timezone', 0), |
|
| 1479 | - '#options' => $zones, |
|
| 1480 | - '#description' => '', |
|
| 1476 | + '#type' => 'select', |
|
| 1477 | + '#title' => bts('Time zone', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1478 | + '#default_value' => ($account->timezone !== NULL) ? $account->timezone : variable_get('date_default_timezone', 0), |
|
| 1479 | + '#options' => $zones, |
|
| 1480 | + '#description' => '', |
|
| 1481 | 1481 | ); |
| 1482 | - } |
|
| 1482 | + } |
|
| 1483 | 1483 | |
| 1484 | - // Notification options |
|
| 1485 | - $form['notifications'] = array( |
|
| 1484 | + // Notification options |
|
| 1485 | + $form['notifications'] = array( |
|
| 1486 | 1486 | '#type' => 'fieldset', |
| 1487 | 1487 | '#title' => bts('Notification settings', array(), NULL, 'boinc:account-preferences-community'), |
| 1488 | 1488 | '#weight' => 5, |
| 1489 | 1489 | '#collapsible' => TRUE, |
| 1490 | 1490 | '#collapsed' => FALSE |
| 1491 | - ); |
|
| 1492 | - // Pull in private message notification handling and tweak the form |
|
| 1493 | - $pm_notify = pm_email_notify_user('form', $edit, $account, 'account'); |
|
| 1494 | - $form['notifications']['pm_send_notifications'] = array_replace( |
|
| 1491 | + ); |
|
| 1492 | + // Pull in private message notification handling and tweak the form |
|
| 1493 | + $pm_notify = pm_email_notify_user('form', $edit, $account, 'account'); |
|
| 1494 | + $form['notifications']['pm_send_notifications'] = array_replace( |
|
| 1495 | 1495 | $pm_notify['enable_pm_mail']['pm_send_notifications'], |
| 1496 | 1496 | array( |
| 1497 | - '#type' => 'radios', |
|
| 1498 | - '#title' => bts('Receive email notification for private messages?', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1499 | - '#description' => ' ', |
|
| 1500 | - '#options' => $form['boolean_options']['#value'], |
|
| 1501 | - '#attributes' => array('class' => 'fancy') |
|
| 1497 | + '#type' => 'radios', |
|
| 1498 | + '#title' => bts('Receive email notification for private messages?', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1499 | + '#description' => ' ', |
|
| 1500 | + '#options' => $form['boolean_options']['#value'], |
|
| 1501 | + '#attributes' => array('class' => 'fancy') |
|
| 1502 | 1502 | ) |
| 1503 | - ); |
|
| 1504 | - $form['notifications']['friend_notification'] = array( |
|
| 1503 | + ); |
|
| 1504 | + $form['notifications']['friend_notification'] = array( |
|
| 1505 | 1505 | '#type' => 'radios', |
| 1506 | 1506 | '#title' => bts('Receive email notification for friend requests?', array(), NULL, 'boinc:account-preferences-community'), |
| 1507 | 1507 | '#description' => ' ', |
| 1508 | 1508 | '#options' => array(0 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), -1 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
| 1509 | 1509 | '#attributes' => array('class' => 'fancy'), |
| 1510 | 1510 | '#default_value' => $default['friend_notification'] |
| 1511 | - ); |
|
| 1511 | + ); |
|
| 1512 | 1512 | |
| 1513 | - // Internationalization options |
|
| 1514 | - if (module_exists('internationalization')) { |
|
| 1513 | + // Internationalization options |
|
| 1514 | + if (module_exists('internationalization')) { |
|
| 1515 | 1515 | $languages = language_list('enabled'); |
| 1516 | 1516 | $languages = $languages[1]; |
| 1517 | 1517 | $names = array(); |
| 1518 | 1518 | foreach ($languages as $langcode => $item) { |
| 1519 | - $name = t($item->name); |
|
| 1520 | - $names[check_plain($langcode)] = check_plain($name . ($item->native != $name ? ' ('. $item->native .')' : '')); |
|
| 1519 | + $name = t($item->name); |
|
| 1520 | + $names[check_plain($langcode)] = check_plain($name . ($item->native != $name ? ' ('. $item->native .')' : '')); |
|
| 1521 | 1521 | } |
| 1522 | 1522 | $form['locale'] = array( |
| 1523 | - '#type' => 'fieldset', |
|
| 1524 | - '#title' => bts('Language settings', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1525 | - '#weight' => 10, |
|
| 1526 | - '#collapsible' => TRUE, |
|
| 1527 | - '#collapsed' => FALSE, |
|
| 1523 | + '#type' => 'fieldset', |
|
| 1524 | + '#title' => bts('Language settings', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1525 | + '#weight' => 10, |
|
| 1526 | + '#collapsible' => TRUE, |
|
| 1527 | + '#collapsed' => FALSE, |
|
| 1528 | 1528 | ); |
| 1529 | 1529 | |
| 1530 | 1530 | // Get language negotiation settings. |
| 1531 | 1531 | $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); |
| 1532 | 1532 | $user_preferred_language = user_preferred_language($account); |
| 1533 | 1533 | $form['locale']['language'] = array( |
| 1534 | - '#type' => 'select', |
|
| 1535 | - '#title' => bts('Language', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1536 | - '#default_value' => check_plain($user_preferred_language->language), |
|
| 1537 | - '#options' => $names, |
|
| 1538 | - '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? bts("This account's default language for e-mails and preferred language for site presentation.", array(), NULL, 'boinc:account-preferences-community') : bts("This account's default language for e-mails.", array(), NULL, 'boinc:account-preferences-community'), |
|
| 1534 | + '#type' => 'select', |
|
| 1535 | + '#title' => bts('Language', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1536 | + '#default_value' => check_plain($user_preferred_language->language), |
|
| 1537 | + '#options' => $names, |
|
| 1538 | + '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? bts("This account's default language for e-mails and preferred language for site presentation.", array(), NULL, 'boinc:account-preferences-community') : bts("This account's default language for e-mails.", array(), NULL, 'boinc:account-preferences-community'), |
|
| 1539 | 1539 | ); |
| 1540 | - } |
|
| 1540 | + } |
|
| 1541 | 1541 | |
| 1542 | - // Avatar options |
|
| 1543 | - $form['gravatar'] = array( |
|
| 1542 | + // Avatar options |
|
| 1543 | + $form['gravatar'] = array( |
|
| 1544 | 1544 | '#type' => 'item', |
| 1545 | 1545 | '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
| 1546 | 1546 | '#description' => bts('Your Gravatar will not be shown if you upload a user picture.', array(), NULL, 'boinc:account-preferences-community'), |
| 1547 | - ); |
|
| 1548 | - if (user_access('disable own gravatar', $account)) { |
|
| 1547 | + ); |
|
| 1548 | + if (user_access('disable own gravatar', $account)) { |
|
| 1549 | 1549 | $form['gravatar'] = array( |
| 1550 | - '#type' => 'checkbox', |
|
| 1551 | - '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
| 1552 | - '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1553 | - '#default_value' => isset($account->gravatar) ? $account->gravatar : 0, |
|
| 1554 | - '#disabled' => !empty($account->picture), |
|
| 1555 | - ); |
|
| 1556 | - } |
|
| 1557 | - $form['gravatar']['#weight'] = 15; |
|
| 1558 | - $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community') . '</a></legend>'; |
|
| 1559 | - // Upload an avatar (pulled from profile_node_form): |
|
| 1560 | - if (!empty($profile_form['field_image'])) { |
|
| 1550 | + '#type' => 'checkbox', |
|
| 1551 | + '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
| 1552 | + '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1553 | + '#default_value' => isset($account->gravatar) ? $account->gravatar : 0, |
|
| 1554 | + '#disabled' => !empty($account->picture), |
|
| 1555 | + ); |
|
| 1556 | + } |
|
| 1557 | + $form['gravatar']['#weight'] = 15; |
|
| 1558 | + $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community') . '</a></legend>'; |
|
| 1559 | + // Upload an avatar (pulled from profile_node_form): |
|
| 1560 | + if (!empty($profile_form['field_image'])) { |
|
| 1561 | 1561 | $form['field_image'] = $profile_form['field_image']; |
| 1562 | - } |
|
| 1563 | - else { |
|
| 1562 | + } |
|
| 1563 | + else { |
|
| 1564 | 1564 | $form['field_image'] = array( |
| 1565 | - '#value' => '<div class="form-item">' |
|
| 1565 | + '#value' => '<div class="form-item">' |
|
| 1566 | 1566 | . '<label class="placeholder">' |
| 1567 | 1567 | . bts('This is not available until your profile is set up.', array(), NULL, 'boinc:account-preferences-community') |
| 1568 | 1568 | . '</label>' |
| 1569 | 1569 | . l(bts('Create a profile', array(), NULL, 'boinc:account-preferences-community'), 'account/profile/edit', array('attributes' => array('class' => 'form-link'))) |
| 1570 | 1570 | . '</div>', |
| 1571 | 1571 | ); |
| 1572 | - } |
|
| 1573 | - $form['field_image'][0]['#title'] = bts('Upload an avatar', array(), NULL, 'boinc:account-preferences-community'); |
|
| 1574 | - $form['field_image']['#weight'] = 20; |
|
| 1575 | - $form['field_image']['#suffix'] = '</fieldset>'; |
|
| 1572 | + } |
|
| 1573 | + $form['field_image'][0]['#title'] = bts('Upload an avatar', array(), NULL, 'boinc:account-preferences-community'); |
|
| 1574 | + $form['field_image']['#weight'] = 20; |
|
| 1575 | + $form['field_image']['#suffix'] = '</fieldset>'; |
|
| 1576 | 1576 | |
| 1577 | - // Forum options |
|
| 1578 | - $form['forums'] = array( |
|
| 1577 | + // Forum options |
|
| 1578 | + $form['forums'] = array( |
|
| 1579 | 1579 | '#type' => 'fieldset', |
| 1580 | 1580 | '#title' => bts('Forum settings', array(), NULL, 'boinc:account-preferences-community'), |
| 1581 | 1581 | '#weight' => 25, |
| 1582 | 1582 | '#collapsible' => TRUE, |
| 1583 | 1583 | '#collapsed' => FALSE |
| 1584 | - ); |
|
| 1585 | - $form['forums']['comments_per_page'] = array( |
|
| 1584 | + ); |
|
| 1585 | + $form['forums']['comments_per_page'] = array( |
|
| 1586 | 1586 | '#type' => 'select', |
| 1587 | 1587 | '#title' => bts('In discussion topics, show at most @comments_per_page', array('@comments_per_page' => ''), NULL, 'boinc:account-preferences-community'), |
| 1588 | 1588 | '#options' => array(10 => 10, 20 => 20, 30 => 30, 50 => 50, 100 => 100), |
| 1589 | 1589 | '#default_value' => $default['comments_per_page'] |
| 1590 | - ); |
|
| 1591 | - // Can't have a typical Drupal form suffix on a select box? |
|
| 1592 | - $form['forums']['comments_per_page_suffix'] = array( |
|
| 1590 | + ); |
|
| 1591 | + // Can't have a typical Drupal form suffix on a select box? |
|
| 1592 | + $form['forums']['comments_per_page_suffix'] = array( |
|
| 1593 | 1593 | '#value' => '<span>' . bts('comments per page', array(), NULL, 'boinc:account-preferences-community') . '</span>' |
| 1594 | - ); |
|
| 1595 | - $form['forums']['comments_order'] = array( |
|
| 1594 | + ); |
|
| 1595 | + $form['forums']['comments_order'] = array( |
|
| 1596 | 1596 | '#type' => 'select', |
| 1597 | 1597 | '#title' => bts('Sort comments in discussions', array(), NULL, 'boinc:account-preferences-community'), |
| 1598 | 1598 | '#options' => array(1 => bts('Newest post first', array(), NULL, 'boinc:account-preferences-community'), 2 => bts('Oldest post first', array(), NULL, 'boinc:account-preferences-community')), |
| 1599 | 1599 | '#default_value' => $default['comments_order'] |
| 1600 | - ); |
|
| 1601 | - // Signature (pulled from user_edit_form): |
|
| 1602 | - if (variable_get('user_signatures', 0) && module_exists('comment')) { |
|
| 1600 | + ); |
|
| 1601 | + // Signature (pulled from user_edit_form): |
|
| 1602 | + if (variable_get('user_signatures', 0) && module_exists('comment')) { |
|
| 1603 | 1603 | $form['forums']['signature'] = array( |
| 1604 | - '#type' => 'textarea', |
|
| 1605 | - '#title' => bts('Signature', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1606 | - '#description' => bts('Your signature will be publicly displayed at the end of your comments.', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1607 | - '#default_value' => $account->signature |
|
| 1608 | - ); |
|
| 1604 | + '#type' => 'textarea', |
|
| 1605 | + '#title' => bts('Signature', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1606 | + '#description' => bts('Your signature will be publicly displayed at the end of your comments.', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1607 | + '#default_value' => $account->signature |
|
| 1608 | + ); |
|
| 1609 | 1609 | // Prevent a "validation error" message when the user attempts to save with a default value they |
| 1610 | 1610 | // do not have access to. |
| 1611 | 1611 | if (!filter_access($account->signature_format) && empty($_POST)) { |
| 1612 | - drupal_set_message(t("The signature input format has been set to a format you don't have access to. It will be changed to a format you have access to when you save this page.")); |
|
| 1613 | - $edit['signature_format'] = FILTER_FORMAT_DEFAULT; |
|
| 1612 | + drupal_set_message(t("The signature input format has been set to a format you don't have access to. It will be changed to a format you have access to when you save this page.")); |
|
| 1613 | + $edit['signature_format'] = FILTER_FORMAT_DEFAULT; |
|
| 1614 | 1614 | } |
| 1615 | 1615 | $form['forums']['signature_format'] = filter_form($account->signature_format, NULL, array('signature_format')); |
| 1616 | 1616 | // Optionally hide signatures from comments |
| 1617 | 1617 | $form['forums']['hide_signatures'] = array( |
| 1618 | - '#type' => 'radios', |
|
| 1619 | - '#title' => bts('Hide signatures in forums', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1620 | - '#description' => ' ', |
|
| 1621 | - '#options' => $form['boolean_options']['#value'], |
|
| 1622 | - '#attributes' => array('class' => 'fancy'), |
|
| 1623 | - '#default_value' => isset($account->hide_signatures) ? $account->hide_signatures : 0, |
|
| 1618 | + '#type' => 'radios', |
|
| 1619 | + '#title' => bts('Hide signatures in forums', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1620 | + '#description' => ' ', |
|
| 1621 | + '#options' => $form['boolean_options']['#value'], |
|
| 1622 | + '#attributes' => array('class' => 'fancy'), |
|
| 1623 | + '#default_value' => isset($account->hide_signatures) ? $account->hide_signatures : 0, |
|
| 1624 | 1624 | ); |
| 1625 | - } |
|
| 1625 | + } |
|
| 1626 | 1626 | |
| 1627 | - //Bottom separator |
|
| 1628 | - $form['separator_bottom'] = array( |
|
| 1627 | + //Bottom separator |
|
| 1628 | + $form['separator_bottom'] = array( |
|
| 1629 | 1629 | '#value' => '<div class="separator buttons"></div>', |
| 1630 | 1630 | '#weight' => 999, |
| 1631 | - ); |
|
| 1631 | + ); |
|
| 1632 | 1632 | |
| 1633 | - // Form control |
|
| 1634 | - $form['form control tabs prefix'] = array( |
|
| 1633 | + // Form control |
|
| 1634 | + $form['form control tabs prefix'] = array( |
|
| 1635 | 1635 | '#value' => '<ul class="form-control tab-list">', |
| 1636 | 1636 | '#weight' => 1001, |
| 1637 | - ); |
|
| 1638 | - $form['submit'] = array( |
|
| 1637 | + ); |
|
| 1638 | + $form['submit'] = array( |
|
| 1639 | 1639 | '#prefix' => '<li class="first tab">', |
| 1640 | 1640 | '#type' => 'submit', |
| 1641 | 1641 | '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
| 1642 | 1642 | '#suffix' => '</li>', |
| 1643 | 1643 | '#weight' => 1002, |
| 1644 | - ); |
|
| 1645 | - $form['form control tabs'] = array( |
|
| 1644 | + ); |
|
| 1645 | + $form['form control tabs'] = array( |
|
| 1646 | 1646 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
| 1647 | 1647 | '#weight' => 1003, |
| 1648 | - ); |
|
| 1649 | - $form['form control tabs suffix'] = array( |
|
| 1648 | + ); |
|
| 1649 | + $form['form control tabs suffix'] = array( |
|
| 1650 | 1650 | '#value' => '</ul>', |
| 1651 | 1651 | '#weight' => 1004, |
| 1652 | - ); |
|
| 1653 | - return $form; |
|
| 1652 | + ); |
|
| 1653 | + return $form; |
|
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | 1656 | /** |
| 1657 | - * Handle validation submission of community preferences form. |
|
| 1658 | - */ |
|
| 1657 | + * Handle validation submission of community preferences form. |
|
| 1658 | + */ |
|
| 1659 | 1659 | function communityprefs_form_validate($form, &$form_state) { |
| 1660 | - // require_boinc(); |
|
| 1661 | - global $user; |
|
| 1662 | - $account = user_load($user->uid); |
|
| 1663 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
| 1664 | - $edit = $form_state['values']; |
|
| 1660 | + // require_boinc(); |
|
| 1661 | + global $user; |
|
| 1662 | + $account = user_load($user->uid); |
|
| 1663 | + $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
| 1664 | + $edit = $form_state['values']; |
|
| 1665 | 1665 | |
| 1666 | - if ($edit['boincuser_name'] != $boinc_user->name) { |
|
| 1666 | + if ($edit['boincuser_name'] != $boinc_user->name) { |
|
| 1667 | 1667 | $blacklist1 = preg_split('/\r\n|\r|\n/', variable_get('boinc_weboptions_blacklisted_usernames', "admin\nadministrator\nmoderator")); |
| 1668 | 1668 | $blacklist2 = array(); |
| 1669 | 1669 | if (is_array($blacklist1)) { |
| 1670 | - $blacklist2 = array_map('strtolower', $blacklist1); |
|
| 1670 | + $blacklist2 = array_map('strtolower', $blacklist1); |
|
| 1671 | 1671 | } |
| 1672 | 1672 | if (in_array(strtolower($edit['boincuser_name']), $blacklist2)) { |
| 1673 | - form_set_error('boincuser_name', |
|
| 1673 | + form_set_error('boincuser_name', |
|
| 1674 | 1674 | bts('You may not use username @blname, as that name is not allowed. Please choose another name.', |
| 1675 | 1675 | array('@blname' => $edit['boincuser_name']), |
| 1676 | 1676 | NULL, 'boinc:account-preferences-community')); |
| 1677 | - return false; |
|
| 1677 | + return false; |
|
| 1678 | + } |
|
| 1678 | 1679 | } |
| 1679 | - } |
|
| 1680 | 1680 | |
| 1681 | - return true; |
|
| 1681 | + return true; |
|
| 1682 | 1682 | } |
| 1683 | 1683 | |
| 1684 | 1684 | /** |
| 1685 | - * Handle post-validation submission of community preferences form. |
|
| 1686 | - */ |
|
| 1685 | + * Handle post-validation submission of community preferences form. |
|
| 1686 | + */ |
|
| 1687 | 1687 | function communityprefs_form_submit($form, &$form_state) { |
| 1688 | - require_boinc('boinc_db'); |
|
| 1689 | - global $user; |
|
| 1690 | - $account = user_load($user->uid); |
|
| 1691 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
| 1692 | - $edit = $form_state['values']; |
|
| 1693 | - $profile_node = $form_state['storage']['profile_node']; |
|
| 1694 | - |
|
| 1695 | - // Display name |
|
| 1696 | - if ($edit['boincuser_name'] != $boinc_user->name) { |
|
| 1688 | + require_boinc('boinc_db'); |
|
| 1689 | + global $user; |
|
| 1690 | + $account = user_load($user->uid); |
|
| 1691 | + $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
| 1692 | + $edit = $form_state['values']; |
|
| 1693 | + $profile_node = $form_state['storage']['profile_node']; |
|
| 1694 | + |
|
| 1695 | + // Display name |
|
| 1696 | + if ($edit['boincuser_name'] != $boinc_user->name) { |
|
| 1697 | 1697 | $boincuser_name = $edit['boincuser_name']; |
| 1698 | 1698 | $result = $boinc_user->update( |
| 1699 | 1699 | "name='{$boincuser_name}'" |
| 1700 | 1700 | ); |
| 1701 | - } |
|
| 1701 | + } |
|
| 1702 | 1702 | |
| 1703 | - // Private message settings |
|
| 1704 | - pm_email_notify_user('submit', $edit, $user); |
|
| 1703 | + // Private message settings |
|
| 1704 | + pm_email_notify_user('submit', $edit, $user); |
|
| 1705 | 1705 | |
| 1706 | - // Avatar settings - only set if profile_node exists. |
|
| 1707 | - if ($profile_node) { |
|
| 1706 | + // Avatar settings - only set if profile_node exists. |
|
| 1707 | + if ($profile_node) { |
|
| 1708 | 1708 | if (!$edit['field_image']) $edit['field_image'] = array(); |
| 1709 | 1709 | $profile_node->field_image = $edit['field_image']; |
| 1710 | 1710 | node_save($profile_node); |
| 1711 | 1711 | // Flush this from the node cache or changes won't show up immediately! |
| 1712 | 1712 | $profile_node = node_load($profile_node->nid, NULL, TRUE); |
| 1713 | - } |
|
| 1713 | + } |
|
| 1714 | 1714 | |
| 1715 | - // All other settings |
|
| 1716 | - $settings = array( |
|
| 1715 | + // All other settings |
|
| 1716 | + $settings = array( |
|
| 1717 | 1717 | 'signature' => $edit['signature'], |
| 1718 | 1718 | 'signature_format' => $edit['signature_format'], |
| 1719 | 1719 | 'timezone' => $edit['timezone'], |
@@ -1722,197 +1722,197 @@ discard block |
||
| 1722 | 1722 | 'hide_signatures' => $edit['hide_signatures'], |
| 1723 | 1723 | 'sort' => $edit['comments_order'], |
| 1724 | 1724 | 'gravatar' => $edit['gravatar'], |
| 1725 | - ); |
|
| 1726 | - if (module_exists('internationalization')) { |
|
| 1725 | + ); |
|
| 1726 | + if (module_exists('internationalization')) { |
|
| 1727 | 1727 | $settings['language'] = $edit['language']; |
| 1728 | 1728 | global $language; |
| 1729 | 1729 | if ($user->language != $edit['language']) { |
| 1730 | - global $base_url; |
|
| 1731 | - if ($edit['language'] != language_default('language')) { |
|
| 1730 | + global $base_url; |
|
| 1731 | + if ($edit['language'] != language_default('language')) { |
|
| 1732 | 1732 | $form_state['redirect'] = $base_url . '/' . $edit['language'] . '/' . $_GET['q']; |
| 1733 | - } |
|
| 1734 | - else { |
|
| 1733 | + } |
|
| 1734 | + else { |
|
| 1735 | 1735 | $form_state['redirect'] = $base_url . '/' . $_GET['q']; |
| 1736 | - } |
|
| 1736 | + } |
|
| 1737 | + } |
|
| 1737 | 1738 | } |
| 1738 | - } |
|
| 1739 | - user_save($user, $settings); |
|
| 1739 | + user_save($user, $settings); |
|
| 1740 | 1740 | |
| 1741 | - drupal_set_message(bts('Your community preferences have been updated.', array(), NULL, 'boinc:account-preferences-community')); |
|
| 1741 | + drupal_set_message(bts('Your community preferences have been updated.', array(), NULL, 'boinc:account-preferences-community')); |
|
| 1742 | 1742 | |
| 1743 | - // Form will not redirect if storage is set; not good if language changes |
|
| 1744 | - unset($form_state['storage']); |
|
| 1743 | + // Form will not redirect if storage is set; not good if language changes |
|
| 1744 | + unset($form_state['storage']); |
|
| 1745 | 1745 | } |
| 1746 | 1746 | |
| 1747 | 1747 | /** |
| 1748 | 1748 | * The structure of the privacy preferences form |
| 1749 | 1749 | */ |
| 1750 | 1750 | function boincwork_privacyprefs_form(&$form_state) { |
| 1751 | - require_boinc(array('user', 'prefs', 'util', 'consent')); |
|
| 1751 | + require_boinc(array('user', 'prefs', 'util', 'consent')); |
|
| 1752 | 1752 | |
| 1753 | - global $user; |
|
| 1754 | - $account = user_load($user->uid); |
|
| 1755 | - $boincuser = BoincUser::lookup_id($account->boincuser_id); |
|
| 1753 | + global $user; |
|
| 1754 | + $account = user_load($user->uid); |
|
| 1755 | + $boincuser = BoincUser::lookup_id($account->boincuser_id); |
|
| 1756 | 1756 | |
| 1757 | - // Load preferences from BOINC account |
|
| 1758 | - $prefs = boincwork_load_prefs('project'); |
|
| 1757 | + // Load preferences from BOINC account |
|
| 1758 | + $prefs = boincwork_load_prefs('project'); |
|
| 1759 | 1759 | |
| 1760 | - //if (!$prefs AND !$initialize_if_empty) return null; |
|
| 1760 | + //if (!$prefs AND !$initialize_if_empty) return null; |
|
| 1761 | 1761 | |
| 1762 | - $privacy_consent_types = boincwork_load_privacyconsenttypes(); |
|
| 1762 | + $privacy_consent_types = boincwork_load_privacyconsenttypes(); |
|
| 1763 | 1763 | |
| 1764 | - // Define form defaults |
|
| 1765 | - $default = array( |
|
| 1764 | + // Define form defaults |
|
| 1765 | + $default = array( |
|
| 1766 | 1766 | 'privacy' => array( |
| 1767 | - 'send_email' => ($boincuser->send_email) ? 1 : 0, |
|
| 1768 | - 'show_hosts' => ($boincuser->show_hosts) ? 1 : 0 |
|
| 1767 | + 'send_email' => ($boincuser->send_email) ? 1 : 0, |
|
| 1768 | + 'show_hosts' => ($boincuser->show_hosts) ? 1 : 0 |
|
| 1769 | 1769 | ) |
| 1770 | - ); |
|
| 1770 | + ); |
|
| 1771 | 1771 | |
| 1772 | - // Standard option sets |
|
| 1773 | - $form['boolean_options'] = array( |
|
| 1772 | + // Standard option sets |
|
| 1773 | + $form['boolean_options'] = array( |
|
| 1774 | 1774 | '#type' => 'value', |
| 1775 | 1775 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
| 1776 | - ); |
|
| 1776 | + ); |
|
| 1777 | 1777 | |
| 1778 | - $form['privacy'] = array( |
|
| 1778 | + $form['privacy'] = array( |
|
| 1779 | 1779 | '#title' => bts('Privacy settings', array(), NULL, 'boinc:account-preferences-privacy'), |
| 1780 | 1780 | '#type' => 'fieldset', |
| 1781 | 1781 | '#description' => null, |
| 1782 | 1782 | '#collapsible' => TRUE, |
| 1783 | 1783 | '#collapsed' => FALSE |
| 1784 | - ); |
|
| 1785 | - $form['privacy']['send_email'] = array( |
|
| 1784 | + ); |
|
| 1785 | + $form['privacy']['send_email'] = array( |
|
| 1786 | 1786 | '#title' => bts('Is it OK for @project and your team (if any) to email you?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-preferences-privacy'), |
| 1787 | 1787 | '#type' => 'radios', |
| 1788 | 1788 | '#options' => $form['boolean_options']['#value'], |
| 1789 | 1789 | '#attributes' => array('class' => 'fancy'), |
| 1790 | 1790 | '#default_value' => $default['privacy']['send_email'] |
| 1791 | - ); |
|
| 1792 | - $form['privacy']['show_hosts'] = array( |
|
| 1791 | + ); |
|
| 1792 | + $form['privacy']['show_hosts'] = array( |
|
| 1793 | 1793 | '#title' => bts('Should @project show your computers on its website?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-preferences-privacy'), |
| 1794 | 1794 | '#description' => bts('At times, you may be asked to enable this option in order to receive help from the forums. Advanced users may need to be able to inspect your computers\' information in order to help diagnose any problems.', array(), NULL, 'boinc:account-preferences-privacy'), |
| 1795 | 1795 | '#type' => 'radios', |
| 1796 | 1796 | '#options' => $form['boolean_options']['#value'], |
| 1797 | 1797 | '#attributes' => array('class' => 'fancy'), |
| 1798 | 1798 | '#default_value' => $default['privacy']['show_hosts'] |
| 1799 | - ); |
|
| 1799 | + ); |
|
| 1800 | 1800 | |
| 1801 | - // Loop over privacy consent types and create form question for each |
|
| 1802 | - // option that deals with privacy. |
|
| 1803 | - foreach ($privacy_consent_types as $ct) { |
|
| 1801 | + // Loop over privacy consent types and create form question for each |
|
| 1802 | + // option that deals with privacy. |
|
| 1803 | + foreach ($privacy_consent_types as $ct) { |
|
| 1804 | 1804 | |
| 1805 | 1805 | $currstate = (check_user_consent($boincuser, $ct['shortname'])) ? 1 : 0 ; |
| 1806 | 1806 | // Set name to 'privacyconsent_SHORTNAME', which can be parsed |
| 1807 | 1807 | // later in the submit function. |
| 1808 | 1808 | $form['privacy']['privacyconsent_'.$ct['shortname']] = array( |
| 1809 | - '#title' => bts($ct['description'], array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1810 | - '#type' => 'radios', |
|
| 1811 | - '#options' => $form['boolean_options']['#value'], |
|
| 1812 | - '#attributes' => array('class' => 'fancy'), |
|
| 1813 | - '#default_value' => $currstate, |
|
| 1809 | + '#title' => bts($ct['description'], array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1810 | + '#type' => 'radios', |
|
| 1811 | + '#options' => $form['boolean_options']['#value'], |
|
| 1812 | + '#attributes' => array('class' => 'fancy'), |
|
| 1813 | + '#default_value' => $currstate, |
|
| 1814 | 1814 | ); |
| 1815 | 1815 | |
| 1816 | 1816 | // Add a description with link to the question 'Do you consent to |
| 1817 | 1817 | // exporting your data...'. |
| 1818 | 1818 | $mypatt = '/Do you consent to exporting your data/'; |
| 1819 | 1819 | if (preg_match($mypatt, $ct['description']) ) { |
| 1820 | - $form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics exports.', |
|
| 1821 | - array( |
|
| 1820 | + $form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics exports.', |
|
| 1821 | + array( |
|
| 1822 | 1822 | '!privacy_policy_link' => l( |
| 1823 | - bts('privacy policy', array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1824 | - '/privacy' |
|
| 1823 | + bts('privacy policy', array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1824 | + '/privacy' |
|
| 1825 | 1825 | ) |
| 1826 | - ), |
|
| 1827 | - NULL, 'boinc:account-preferences-privacy'); |
|
| 1826 | + ), |
|
| 1827 | + NULL, 'boinc:account-preferences-privacy'); |
|
| 1828 | + } |
|
| 1828 | 1829 | } |
| 1829 | - } |
|
| 1830 | 1830 | |
| 1831 | - // Ignore and block users |
|
| 1832 | - if (module_exists('ignore_user')) { |
|
| 1831 | + // Ignore and block users |
|
| 1832 | + if (module_exists('ignore_user')) { |
|
| 1833 | 1833 | $form['ignoreblock'] = array( |
| 1834 | - '#title' => bts('Ignore Users', array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1835 | - '#type' => 'fieldset', |
|
| 1836 | - '#description' => bts('<p>You may ignore users in the forums and block users from sending you private messages.<p>', array(), NULL, 'boinc:ignore-user-help'), |
|
| 1837 | - '#collapsible' => TRUE, |
|
| 1838 | - '#collapsed' => FALSE |
|
| 1834 | + '#title' => bts('Ignore Users', array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1835 | + '#type' => 'fieldset', |
|
| 1836 | + '#description' => bts('<p>You may ignore users in the forums and block users from sending you private messages.<p>', array(), NULL, 'boinc:ignore-user-help'), |
|
| 1837 | + '#collapsible' => TRUE, |
|
| 1838 | + '#collapsed' => FALSE |
|
| 1839 | 1839 | ); |
| 1840 | 1840 | |
| 1841 | 1841 | // Table for ignored users |
| 1842 | 1842 | $form['ignoreblock']['current_ignore_section'] = array( |
| 1843 | - '#type' => 'item', |
|
| 1844 | - '#value' => bts('Current users on your Ignore List', array(), NULL, 'boinc:ignore-user-list'), |
|
| 1845 | - '#prefix' => '<h4>', |
|
| 1846 | - '#suffix' => '</h4>', |
|
| 1847 | - '#weight' => -20, |
|
| 1843 | + '#type' => 'item', |
|
| 1844 | + '#value' => bts('Current users on your Ignore List', array(), NULL, 'boinc:ignore-user-list'), |
|
| 1845 | + '#prefix' => '<h4>', |
|
| 1846 | + '#suffix' => '</h4>', |
|
| 1847 | + '#weight' => -20, |
|
| 1848 | 1848 | ); |
| 1849 | 1849 | |
| 1850 | 1850 | $ignored_users = _ignore_user_ignored_users(); |
| 1851 | 1851 | foreach ($ignored_users as $ignored_user) { |
| 1852 | - $form['ignoreblock']['username'][$ignored_user['iuid']] = array( |
|
| 1852 | + $form['ignoreblock']['username'][$ignored_user['iuid']] = array( |
|
| 1853 | 1853 | '#value' => $ignored_user['username'], |
| 1854 | - ); |
|
| 1855 | - $form['ignoreblock']['delete'][$ignored_user['iuid']] = array( |
|
| 1854 | + ); |
|
| 1855 | + $form['ignoreblock']['delete'][$ignored_user['iuid']] = array( |
|
| 1856 | 1856 | '#value' => l( |
| 1857 | - bts('delete', array(), NULL, 'boinc:ignore-user-delete-button'), |
|
| 1858 | - 'account/prefs/privacy/ignore_user/remove/'. $ignored_user['iuid'], |
|
| 1859 | - array() |
|
| 1857 | + bts('delete', array(), NULL, 'boinc:ignore-user-delete-button'), |
|
| 1858 | + 'account/prefs/privacy/ignore_user/remove/'. $ignored_user['iuid'], |
|
| 1859 | + array() |
|
| 1860 | 1860 | ), |
| 1861 | - ); |
|
| 1861 | + ); |
|
| 1862 | 1862 | } |
| 1863 | 1863 | $form['ignoreblock']['pager'] = array('#value' => theme('pager', NULL, 10, 0)); |
| 1864 | 1864 | |
| 1865 | 1865 | // Sub-form to add user to ignore list |
| 1866 | 1866 | $form['ignoreblock']['add_ignore_user_section'] = array( |
| 1867 | - '#type' => 'item', |
|
| 1868 | - '#value' => bts('Add user to Ignore List', array(), NULL, 'boinc:ignore-user-add'), |
|
| 1869 | - '#prefix' => '<h4>', |
|
| 1870 | - '#suffix' => '</h4>', |
|
| 1871 | - '#weight' => 10, |
|
| 1867 | + '#type' => 'item', |
|
| 1868 | + '#value' => bts('Add user to Ignore List', array(), NULL, 'boinc:ignore-user-add'), |
|
| 1869 | + '#prefix' => '<h4>', |
|
| 1870 | + '#suffix' => '</h4>', |
|
| 1871 | + '#weight' => 10, |
|
| 1872 | 1872 | ); |
| 1873 | 1873 | |
| 1874 | 1874 | $form['ignoreblock']['addusername_toignorelist'] = array( |
| 1875 | - '#type' => 'textfield', |
|
| 1876 | - '#title' => bts('Username', array(), NULL, 'boinc:ignore-user-searchbox'), |
|
| 1877 | - '#description' => bts('To lookup a username start typing in the search box. A list of usernames will appear as you type. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.', array(), NULL, 'boinc:ignore-user-searchbox-help'), |
|
| 1878 | - '#weight' => 11, |
|
| 1879 | - '#size' => 50, |
|
| 1880 | - '#autocomplete_path' => 'boincuser/autocomplete', |
|
| 1875 | + '#type' => 'textfield', |
|
| 1876 | + '#title' => bts('Username', array(), NULL, 'boinc:ignore-user-searchbox'), |
|
| 1877 | + '#description' => bts('To lookup a username start typing in the search box. A list of usernames will appear as you type. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.', array(), NULL, 'boinc:ignore-user-searchbox-help'), |
|
| 1878 | + '#weight' => 11, |
|
| 1879 | + '#size' => 50, |
|
| 1880 | + '#autocomplete_path' => 'boincuser/autocomplete', |
|
| 1881 | 1881 | ); |
| 1882 | 1882 | |
| 1883 | 1883 | $form['ignoreblock']['addusername_submit'] = array( |
| 1884 | - '#type' => 'submit', |
|
| 1885 | - '#value' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
|
| 1886 | - '#submit' => array('_boincwork_ignore_list_form_submit'), |
|
| 1887 | - '#weight' => 12, |
|
| 1888 | - '#attributes' => array('class' => 'add_ignore_user'), |
|
| 1884 | + '#type' => 'submit', |
|
| 1885 | + '#value' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
|
| 1886 | + '#submit' => array('_boincwork_ignore_list_form_submit'), |
|
| 1887 | + '#weight' => 12, |
|
| 1888 | + '#attributes' => array('class' => 'add_ignore_user'), |
|
| 1889 | 1889 | ); |
| 1890 | - }// endif module_exists |
|
| 1890 | + }// endif module_exists |
|
| 1891 | 1891 | |
| 1892 | - $form['prefs']['separator_bottom'] = array( |
|
| 1892 | + $form['prefs']['separator_bottom'] = array( |
|
| 1893 | 1893 | '#value' => '<div class="separator buttons"></div>' |
| 1894 | - ); |
|
| 1894 | + ); |
|
| 1895 | 1895 | |
| 1896 | - // Form control |
|
| 1897 | - $form['prefs']['form control tabs prefix'] = array( |
|
| 1896 | + // Form control |
|
| 1897 | + $form['prefs']['form control tabs prefix'] = array( |
|
| 1898 | 1898 | '#value' => '<ul class="form-control tab-list">' |
| 1899 | - ); |
|
| 1900 | - $form['prefs']['submit'] = array( |
|
| 1899 | + ); |
|
| 1900 | + $form['prefs']['submit'] = array( |
|
| 1901 | 1901 | '#prefix' => '<li class="first tab">', |
| 1902 | 1902 | '#type' => 'submit', |
| 1903 | 1903 | '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
| 1904 | 1904 | '#validate' => array('boincwork_privacyprefs_form_validate'), |
| 1905 | 1905 | '#submit' => array('boincwork_privacyprefs_form_submit'), |
| 1906 | 1906 | '#suffix' => '</li>' |
| 1907 | - ); |
|
| 1908 | - $form['prefs']['form control tabs'] = array( |
|
| 1907 | + ); |
|
| 1908 | + $form['prefs']['form control tabs'] = array( |
|
| 1909 | 1909 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
| 1910 | - ); |
|
| 1911 | - $form['prefs']['form control tabs suffix'] = array( |
|
| 1910 | + ); |
|
| 1911 | + $form['prefs']['form control tabs suffix'] = array( |
|
| 1912 | 1912 | '#value' => '</ul>' |
| 1913 | - ); |
|
| 1913 | + ); |
|
| 1914 | 1914 | |
| 1915 | - return $form; |
|
| 1915 | + return $form; |
|
| 1916 | 1916 | } |
| 1917 | 1917 | |
| 1918 | 1918 | /** |
@@ -1920,93 +1920,93 @@ discard block |
||
| 1920 | 1920 | */ |
| 1921 | 1921 | function theme_boincwork_privacyprefs_form($form) { |
| 1922 | 1922 | |
| 1923 | - $output = ''; |
|
| 1924 | - $output .= drupal_render($form['privacy']); |
|
| 1923 | + $output = ''; |
|
| 1924 | + $output .= drupal_render($form['privacy']); |
|
| 1925 | 1925 | |
| 1926 | - $header = array( |
|
| 1926 | + $header = array( |
|
| 1927 | 1927 | bts('Username', array(), NULL, 'boinc:ignore-user-list'), |
| 1928 | 1928 | bts('Operations', array(), NULL, 'boinc:ignore-user-list') |
| 1929 | - ); |
|
| 1929 | + ); |
|
| 1930 | 1930 | |
| 1931 | - $rows = array(); |
|
| 1932 | - if (isset($form['ignoreblock']['username']) && is_array($form['ignoreblock']['username'])) { |
|
| 1931 | + $rows = array(); |
|
| 1932 | + if (isset($form['ignoreblock']['username']) && is_array($form['ignoreblock']['username'])) { |
|
| 1933 | 1933 | foreach (element_children($form['ignoreblock']['username']) as $key) { |
| 1934 | - $row = array(); |
|
| 1935 | - $row[] = drupal_render($form['ignoreblock']['username'][$key]); |
|
| 1936 | - $row[] = drupal_render($form['ignoreblock']['delete'][$key]); |
|
| 1937 | - $rows[] = $row; |
|
| 1934 | + $row = array(); |
|
| 1935 | + $row[] = drupal_render($form['ignoreblock']['username'][$key]); |
|
| 1936 | + $row[] = drupal_render($form['ignoreblock']['delete'][$key]); |
|
| 1937 | + $rows[] = $row; |
|
| 1938 | 1938 | } |
| 1939 | - } |
|
| 1940 | - else { |
|
| 1939 | + } |
|
| 1940 | + else { |
|
| 1941 | 1941 | $rows[] = array( |
| 1942 | - array( |
|
| 1942 | + array( |
|
| 1943 | 1943 | 'data' => bts('You have not added any users to your Ignore List.', array(), NULL, 'boinc:ignore-user-list'), |
| 1944 | 1944 | 'colspan' => '2', |
| 1945 | - ) |
|
| 1945 | + ) |
|
| 1946 | 1946 | ); |
| 1947 | - } |
|
| 1947 | + } |
|
| 1948 | 1948 | |
| 1949 | - $attr = array('class' => 'ignore_user'); |
|
| 1950 | - $form['ignoreblock']['current_list']['ignored_users']['#value'] = theme('table', $header, $rows, $attr); |
|
| 1951 | - $output .= drupal_render($form['current_list']); |
|
| 1949 | + $attr = array('class' => 'ignore_user'); |
|
| 1950 | + $form['ignoreblock']['current_list']['ignored_users']['#value'] = theme('table', $header, $rows, $attr); |
|
| 1951 | + $output .= drupal_render($form['current_list']); |
|
| 1952 | 1952 | |
| 1953 | - if ($form['pager']['#value']) { |
|
| 1953 | + if ($form['pager']['#value']) { |
|
| 1954 | 1954 | $output .= drupal_render($form['pager']); |
| 1955 | - } |
|
| 1955 | + } |
|
| 1956 | 1956 | |
| 1957 | - $output .= drupal_render($form); |
|
| 1957 | + $output .= drupal_render($form); |
|
| 1958 | 1958 | |
| 1959 | - return $output; |
|
| 1959 | + return $output; |
|
| 1960 | 1960 | } |
| 1961 | 1961 | |
| 1962 | 1962 | /** |
| 1963 | - * Validate the privacy preferences form. |
|
| 1964 | - */ |
|
| 1963 | + * Validate the privacy preferences form. |
|
| 1964 | + */ |
|
| 1965 | 1965 | function boincwork_privacyprefs_form_validate($form, &$form_state) { |
| 1966 | - require_boinc('util'); |
|
| 1966 | + require_boinc('util'); |
|
| 1967 | 1967 | |
| 1968 | - // Verify all non-boolean user input values and notify form API of failures |
|
| 1969 | - // ... currently there are no non-boolean values! |
|
| 1968 | + // Verify all non-boolean user input values and notify form API of failures |
|
| 1969 | + // ... currently there are no non-boolean values! |
|
| 1970 | 1970 | } |
| 1971 | 1971 | |
| 1972 | 1972 | /** |
| 1973 | - * Handle post-validation submission of privacy preferences form. |
|
| 1974 | - */ |
|
| 1973 | + * Handle post-validation submission of privacy preferences form. |
|
| 1974 | + */ |
|
| 1975 | 1975 | function boincwork_privacyprefs_form_submit($form, &$form_state) { |
| 1976 | - require_boinc(array('user', 'prefs', 'consent')); |
|
| 1976 | + require_boinc(array('user', 'prefs', 'consent')); |
|
| 1977 | 1977 | |
| 1978 | - global $user; |
|
| 1979 | - $account = user_load($user->uid); |
|
| 1978 | + global $user; |
|
| 1979 | + $account = user_load($user->uid); |
|
| 1980 | 1980 | |
| 1981 | - // Load BOINC account |
|
| 1982 | - $boincuser = BoincUser::lookup_id($account->boincuser_id); |
|
| 1981 | + // Load BOINC account |
|
| 1982 | + $boincuser = BoincUser::lookup_id($account->boincuser_id); |
|
| 1983 | 1983 | |
| 1984 | - // Privacy preferences |
|
| 1985 | - $boincuser->send_email = ($form_state['values']['send_email']) ? true : false; |
|
| 1986 | - $boincuser->show_hosts = ($form_state['values']['show_hosts']) ? true : false; |
|
| 1984 | + // Privacy preferences |
|
| 1985 | + $boincuser->send_email = ($form_state['values']['send_email']) ? true : false; |
|
| 1986 | + $boincuser->show_hosts = ($form_state['values']['show_hosts']) ? true : false; |
|
| 1987 | 1987 | |
| 1988 | - // Privacy consent options, extract the 'privacyconsent_SHORTNAME' |
|
| 1989 | - // from values array, and loop over them; each is checked with |
|
| 1990 | - // check_consent_type(). Also check the current state of the option |
|
| 1991 | - // in the database. If the form value is a new state, then set it. |
|
| 1992 | - $result = preg_grep("/^privacyconsent/", array_keys($form_state['values'])); |
|
| 1993 | - $privacyconsent_prefs = array_intersect_key($form_state['values'], array_flip($result)); |
|
| 1994 | - foreach ($privacyconsent_prefs as $name => $newstate) { |
|
| 1988 | + // Privacy consent options, extract the 'privacyconsent_SHORTNAME' |
|
| 1989 | + // from values array, and loop over them; each is checked with |
|
| 1990 | + // check_consent_type(). Also check the current state of the option |
|
| 1991 | + // in the database. If the form value is a new state, then set it. |
|
| 1992 | + $result = preg_grep("/^privacyconsent/", array_keys($form_state['values'])); |
|
| 1993 | + $privacyconsent_prefs = array_intersect_key($form_state['values'], array_flip($result)); |
|
| 1994 | + foreach ($privacyconsent_prefs as $name => $newstate) { |
|
| 1995 | 1995 | $subname = explode('_', $name)[1]; |
| 1996 | 1996 | $currstate = (check_user_consent($boincuser, $subname)) ? 1 : 0 ; |
| 1997 | 1997 | list($checkct, $ctid) = check_consent_type($subname); |
| 1998 | 1998 | if ($checkct && ($currstate != $newstate)) { |
| 1999 | - consent_to_a_policy($boincuser, $ctid, $newstate, 0, 'Webform', time()); |
|
| 1999 | + consent_to_a_policy($boincuser, $ctid, $newstate, 0, 'Webform', time()); |
|
| 2000 | + } |
|
| 2000 | 2001 | } |
| 2001 | - } |
|
| 2002 | 2002 | |
| 2003 | - //project_prefs_update($boincuser, $main_prefs); |
|
| 2003 | + //project_prefs_update($boincuser, $main_prefs); |
|
| 2004 | 2004 | |
| 2005 | - db_set_active('boinc_rw'); |
|
| 2006 | - db_query("UPDATE user SET send_email = '{$boincuser->send_email}', show_hosts = '{$boincuser->show_hosts}' WHERE id = '{$boincuser->id}'"); |
|
| 2007 | - db_set_active('default'); |
|
| 2005 | + db_set_active('boinc_rw'); |
|
| 2006 | + db_query("UPDATE user SET send_email = '{$boincuser->send_email}', show_hosts = '{$boincuser->show_hosts}' WHERE id = '{$boincuser->id}'"); |
|
| 2007 | + db_set_active('default'); |
|
| 2008 | 2008 | |
| 2009 | - drupal_set_message(t('Your privacy preferences have been updated.')); |
|
| 2009 | + drupal_set_message(t('Your privacy preferences have been updated.')); |
|
| 2010 | 2010 | } |
| 2011 | 2011 | |
| 2012 | 2012 | /** |
@@ -2014,14 +2014,14 @@ discard block |
||
| 2014 | 2014 | * ignore list. |
| 2015 | 2015 | */ |
| 2016 | 2016 | function _boincwork_ignore_list_form_submit($form, $form_state) { |
| 2017 | - boincwork_ignore_user_add_user_username($form_state['values']['addusername_toignorelist']); |
|
| 2018 | - drupal_set_message( |
|
| 2017 | + boincwork_ignore_user_add_user_username($form_state['values']['addusername_toignorelist']); |
|
| 2018 | + drupal_set_message( |
|
| 2019 | 2019 | bts('@username has been added to your ignore list. See your !privacy_preferences for more details.', |
| 2020 | - array( |
|
| 2020 | + array( |
|
| 2021 | 2021 | '@username' => $form_state['values']['addusername_toignorelist'], |
| 2022 | 2022 | '!privacy_preferences' => l(bts('privacy preferences', array(), NULL, 'boinc:ignore-user-add'), 'account/prefs/privacy'), |
| 2023 | - ), |
|
| 2024 | - NULL, 'boinc:ignore-user-add'), |
|
| 2023 | + ), |
|
| 2024 | + NULL, 'boinc:ignore-user-add'), |
|
| 2025 | 2025 | 'status'); |
| 2026 | 2026 | } |
| 2027 | 2027 | |
@@ -2030,37 +2030,37 @@ discard block |
||
| 2030 | 2030 | */ |
| 2031 | 2031 | function boincwork_selectapp_form(&$form_state, $apps, $current_app) { |
| 2032 | 2032 | |
| 2033 | - $form['selectapp'] = array( |
|
| 2033 | + $form['selectapp'] = array( |
|
| 2034 | 2034 | '#type' => 'select', |
| 2035 | 2035 | '#attributes' => array( |
| 2036 | - 'class' => 'task-app-filter', |
|
| 2037 | - 'onchange' => 'this.form.submit();', |
|
| 2036 | + 'class' => 'task-app-filter', |
|
| 2037 | + 'onchange' => 'this.form.submit();', |
|
| 2038 | 2038 | ), |
| 2039 | 2039 | '#default_value' => $current_app, |
| 2040 | 2040 | '#options' => $apps, |
| 2041 | 2041 | '#post_render' => array('_boincwork_selectapp_form_callback'), |
| 2042 | - ); |
|
| 2042 | + ); |
|
| 2043 | 2043 | |
| 2044 | - // Class task-app-filter-submit for this form is used in |
|
| 2045 | - // theming. CSS sets 'display:none' if javascript is present. Thus |
|
| 2046 | - // only non-js users/browsers will see the Apply Filter button. |
|
| 2047 | - $form['submit'] = array( |
|
| 2044 | + // Class task-app-filter-submit for this form is used in |
|
| 2045 | + // theming. CSS sets 'display:none' if javascript is present. Thus |
|
| 2046 | + // only non-js users/browsers will see the Apply Filter button. |
|
| 2047 | + $form['submit'] = array( |
|
| 2048 | 2048 | '#type' => 'submit', |
| 2049 | 2049 | '#value' => bts('Apply Filter', array(), NULL, 'boinc:form-save'), |
| 2050 | 2050 | '#attributes' => array('class' => 'js-hide',), |
| 2051 | - ); |
|
| 2051 | + ); |
|
| 2052 | 2052 | |
| 2053 | - return $form; |
|
| 2053 | + return $form; |
|
| 2054 | 2054 | } |
| 2055 | 2055 | |
| 2056 | 2056 | /** |
| 2057 | 2057 | * Submit function for select appliacation form. |
| 2058 | 2058 | */ |
| 2059 | 2059 | function boincwork_selectapp_form_submit($form, &$form_state) { |
| 2060 | - $myargs = arg(); |
|
| 2061 | - array_pop($myargs); |
|
| 2062 | - $newpath = implode('/', $myargs ) . '/' . $form['selectapp']['#value']; |
|
| 2063 | - $form_state['redirect'] = $newpath; |
|
| 2060 | + $myargs = arg(); |
|
| 2061 | + array_pop($myargs); |
|
| 2062 | + $newpath = implode('/', $myargs ) . '/' . $form['selectapp']['#value']; |
|
| 2063 | + $form_state['redirect'] = $newpath; |
|
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | 2066 | /** |
@@ -2070,7 +2070,7 @@ discard block |
||
| 2070 | 2070 | * 'title' for the Application drop down box. |
| 2071 | 2071 | */ |
| 2072 | 2072 | function _boincwork_selectapp_form_callback($theContent, $theElement) { |
| 2073 | - $disabled = '<option value="-1" disabled hidden'; |
|
| 2074 | - $newContent = preg_replace('/<option value="-1"/', $disabled, $theContent); |
|
| 2075 | - return $newContent; |
|
| 2073 | + $disabled = '<option value="-1" disabled hidden'; |
|
| 2074 | + $newContent = preg_replace('/<option value="-1"/', $disabled, $theContent); |
|
| 2075 | + return $newContent; |
|
| 2076 | 2076 | } |
@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * The structure of the general preferences form |
| 16 | 16 | */ |
| 17 | -function boincwork_generalprefs_form(&$form_state, $venue, $prefs_preset = null, $advanced = FALSE) { |
|
| 17 | +function boincwork_generalprefs_form(&$form_state, $venue, $prefs_preset = null, $advanced = false) { |
|
| 18 | 18 | $form = array(); |
| 19 | 19 | $prefs = null; |
| 20 | - $established = TRUE; |
|
| 20 | + $established = true; |
|
| 21 | 21 | |
| 22 | 22 | // Enable AHAH form support for dynamically updating content based on preset |
| 23 | 23 | ahah_helper_register($form, $form_state); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // Take note if this is not an established preference set on the account |
| 34 | 34 | if (isset($prefs['@attributes']['cleared'])) { |
| 35 | - $established = FALSE; |
|
| 35 | + $established = false; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Determine if a preset is selected or if these are custom settings |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | break; |
| 71 | 71 | }// switch |
| 72 | 72 | } else { |
| 73 | - $form_state['storage']['wip'] = TRUE; |
|
| 73 | + $form_state['storage']['wip'] = true; |
|
| 74 | 74 | if ( !in_array($prefs_preset, array('standard','maximum','green','minimum','custom')) ) { |
| 75 | 75 | if ($established) { |
| 76 | 76 | $prefs_preset = 'custom'; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | // Standard option sets |
| 138 | 138 | $form['boolean_options'] = array( |
| 139 | 139 | '#type' => 'value', |
| 140 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
| 140 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
| 141 | 141 | ); |
| 142 | 142 | $form['hour_options'] = array( |
| 143 | 143 | '#type' => 'value', |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | '#prefix' => '<div id="prefs-wrapper">', // This is our wrapper div. |
| 159 | 159 | '#attributes' => array('class' => 'ahah-container'), |
| 160 | 160 | '#suffix' => '</div>', |
| 161 | - '#tree' => TRUE |
|
| 161 | + '#tree' => true |
|
| 162 | 162 | ); |
| 163 | 163 | //$form['prefs']['debug'] = array('#value' => '<pre>' . print_r($form_state, true) . '</pre>'); |
| 164 | 164 | |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | // Simplified selectors |
| 180 | 180 | $form['prefs']['preset'] = array( |
| 181 | - '#title' => bts('Presets', array(), NULL, 'boinc:account-preferences-preset:-1:for a user to choose a computing or project preference preset.'), |
|
| 181 | + '#title' => bts('Presets', array(), null, 'boinc:account-preferences-preset:-1:for a user to choose a computing or project preference preset.'), |
|
| 182 | 182 | '#type' => 'radios', |
| 183 | 183 | '#description' => ' ', |
| 184 | 184 | '#options' => array( |
| 185 | - 'standard' => bts('Standard', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 186 | - 'maximum' => bts('Maximum', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 187 | - 'green' => bts('Green', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 188 | - 'minimum' => bts('Minimum', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 189 | - 'custom' => bts('Custom', array(), NULL, 'boinc:account-preferences-preset') |
|
| 185 | + 'standard' => bts('Standard', array(), null, 'boinc:account-preferences-preset'), |
|
| 186 | + 'maximum' => bts('Maximum', array(), null, 'boinc:account-preferences-preset'), |
|
| 187 | + 'green' => bts('Green', array(), null, 'boinc:account-preferences-preset'), |
|
| 188 | + 'minimum' => bts('Minimum', array(), null, 'boinc:account-preferences-preset'), |
|
| 189 | + 'custom' => bts('Custom', array(), null, 'boinc:account-preferences-preset') |
|
| 190 | 190 | ), |
| 191 | 191 | '#prefix' => '<div class="simple-form-controls">', |
| 192 | 192 | '#suffix' => '</div>', |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | ); |
| 200 | 200 | $form['prefs']['select preset'] = array( |
| 201 | 201 | '#type' => 'submit', |
| 202 | - '#value' => bts('Update preset', array(), NULL, 'boinc:account-preferences-preset'), |
|
| 202 | + '#value' => bts('Update preset', array(), null, 'boinc:account-preferences-preset'), |
|
| 203 | 203 | '#submit' => array('ahah_helper_generic_submit'), |
| 204 | 204 | // The 'no-js' class only displays this button if javascript is disabled |
| 205 | 205 | '#attributes' => array('class' => 'no-js'), |
@@ -207,10 +207,10 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | // Advanced preferences |
| 209 | 209 | $form['prefs']['advanced'] = array( |
| 210 | - '#title' => bts('Advanced settings', array(), NULL, 'boinc:account-preferences-option'), |
|
| 210 | + '#title' => bts('Advanced settings', array(), null, 'boinc:account-preferences-option'), |
|
| 211 | 211 | '#type' => 'fieldset', |
| 212 | 212 | '#description' => '', |
| 213 | - '#collapsible' => TRUE, |
|
| 213 | + '#collapsible' => true, |
|
| 214 | 214 | '#collapsed' => !$advanced, |
| 215 | 215 | '#attributes' => array('class' => 'advanced-settings'), |
| 216 | 216 | ); |
@@ -226,62 +226,62 @@ discard block |
||
| 226 | 226 | ); |
| 227 | 227 | |
| 228 | 228 | $form['prefs']['advanced']['processor'] = array( |
| 229 | - '#title' => bts('Processor usage', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 229 | + '#title' => bts('Processor usage', array(), null, 'boinc:account-preferences-computing'), |
|
| 230 | 230 | '#type' => 'fieldset', |
| 231 | 231 | '#description' => '', |
| 232 | - '#collapsible' => FALSE, |
|
| 233 | - '#collapsed' => FALSE |
|
| 232 | + '#collapsible' => false, |
|
| 233 | + '#collapsed' => false |
|
| 234 | 234 | ); |
| 235 | 235 | $form['prefs']['advanced']['processor']['run_on_batteries'] = array( |
| 236 | - '#title' => bts('Suspend when computer is on battery?', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 236 | + '#title' => bts('Suspend when computer is on battery?', array(), null, 'boinc:account-preferences-computing'), |
|
| 237 | 237 | '#type' => 'radios', |
| 238 | - '#description' => bts('Suspends computing on portables when running on battery power.', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 238 | + '#description' => bts('Suspends computing on portables when running on battery power.', array(), null, 'boinc:account-preferences-computing'), |
|
| 239 | 239 | '#options' => $form['boolean_options']['#value'], |
| 240 | 240 | '#attributes' => array('class' => 'fancy'), |
| 241 | 241 | '#default_value' => ($default['run_on_batteries']) ? 0 : 1 // intentional inversion of setting |
| 242 | 242 | ); |
| 243 | 243 | $form['prefs']['advanced']['processor']['run_if_user_active'] = array( |
| 244 | - '#title' => bts('Suspend when computer is in use?', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 244 | + '#title' => bts('Suspend when computer is in use?', array(), null, 'boinc:account-preferences-computing'), |
|
| 245 | 245 | '#type' => 'radios', |
| 246 | - '#description' => bts("Suspends computing and file transfers when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing'), |
|
| 246 | + '#description' => bts("Suspends computing and file transfers when you're using the computer.", array(), null, 'boinc:account-preferences-computing'), |
|
| 247 | 247 | '#options' => $form['boolean_options']['#value'], |
| 248 | 248 | '#attributes' => array('class' => 'fancy'), |
| 249 | 249 | '#default_value' => ($default['run_if_user_active']) ? 0 : 1 // intentional inversion of setting |
| 250 | 250 | ); |
| 251 | 251 | $form['prefs']['advanced']['processor']['run_gpu_if_user_active'] = array( |
| 252 | - '#title' => bts('Suspend GPU computing when computer is in use?', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 252 | + '#title' => bts('Suspend GPU computing when computer is in use?', array(), null, 'boinc:account-preferences-computing'), |
|
| 253 | 253 | '#type' => 'radios', |
| 254 | - '#description' => bts("Suspends GPU computing when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing'), |
|
| 254 | + '#description' => bts("Suspends GPU computing when you're using the computer.", array(), null, 'boinc:account-preferences-computing'), |
|
| 255 | 255 | '#options' => $form['boolean_options']['#value'], |
| 256 | 256 | '#attributes' => array('class' => 'fancy'), |
| 257 | 257 | '#default_value' => ($default['run_gpu_if_user_active']) ? 0 : 1 // intentional inversion of setting |
| 258 | 258 | ); |
| 259 | 259 | $form['prefs']['advanced']['processor']['idle_time_to_run'] = array( |
| 260 | - '#title' => bts('"In use" means mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 260 | + '#title' => bts('"In use" means mouse/keyboard input in last', array(), null, 'boinc:account-preferences-computing'), |
|
| 261 | 261 | '#type' => 'textfield', |
| 262 | - '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
|
| 262 | + '#field_suffix' => bts('minutes', array(), null, 'boinc:unit-of-time'), |
|
| 263 | 263 | '#default_value' => $default['idle_time_to_run'], |
| 264 | 264 | '#size' => 1, |
| 265 | - '#description' => bts('This determines when the computer is considered "in use".', array(), NULL, 'boinc:account-preferences-computing') |
|
| 265 | + '#description' => bts('This determines when the computer is considered "in use".', array(), null, 'boinc:account-preferences-computing') |
|
| 266 | 266 | ); |
| 267 | 267 | $form['prefs']['advanced']['processor']['suspend_if_no_recent_input'] = array( |
| 268 | - '#title' => bts('Suspend when no mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 268 | + '#title' => bts('Suspend when no mouse/keyboard input in last', array(), null, 'boinc:account-preferences-computing'), |
|
| 269 | 269 | '#type' => 'textfield', |
| 270 | - '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
|
| 270 | + '#field_suffix' => bts('minutes', array(), null, 'boinc:unit-of-time'), |
|
| 271 | 271 | '#default_value' => $default['suspend_if_no_recent_input'], |
| 272 | 272 | '#size' => 1, |
| 273 | - '#description' => bts('This allows some computers to enter low-power mode when not in use.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 273 | + '#description' => bts('This allows some computers to enter low-power mode when not in use.', array(), null, 'boinc:account-preferences-computing') |
|
| 274 | 274 | ); |
| 275 | 275 | $form['prefs']['advanced']['processor']['suspend_cpu_usage'] = array( |
| 276 | - '#title' => bts('Suspend when non-BOINC CPU usage is above', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 276 | + '#title' => bts('Suspend when non-BOINC CPU usage is above', array(), null, 'boinc:account-preferences-computing'), |
|
| 277 | 277 | '#type' => 'textfield', |
| 278 | 278 | '#field_suffix' => '%', |
| 279 | 279 | '#default_value' => $default['suspend_cpu_usage'], |
| 280 | 280 | '#size' => 1, |
| 281 | - '#description' => bts('Suspend computing when your computer is busy running other programs.', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 281 | + '#description' => bts('Suspend computing when your computer is busy running other programs.', array(), null, 'boinc:account-preferences-computing'), |
|
| 282 | 282 | ); |
| 283 | 283 | $form['prefs']['advanced']['processor']['hour_label'] = array( |
| 284 | - '#value' => '<div class="form-item"><label>' . bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
|
| 284 | + '#value' => '<div class="form-item"><label>' . bts('Compute only between:', array(), null, 'boinc:account-preferences-computing') . '</label></div>' |
|
| 285 | 285 | ); |
| 286 | 286 | $form['prefs']['advanced']['processor']['start_hour'] = array( |
| 287 | 287 | '#type' => 'select', |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | '#default_value' => $default['start_hour'] |
| 290 | 290 | ); |
| 291 | 291 | $form['prefs']['advanced']['processor']['hour_delimiter'] = array( |
| 292 | - '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
|
| 292 | + '#value' => '<span>' . bts('and', array(), null, 'boinc:account-preference') . '</span>' |
|
| 293 | 293 | ); |
| 294 | 294 | $form['prefs']['advanced']['processor']['end_hour'] = array( |
| 295 | 295 | '#type' => 'select', |
@@ -297,164 +297,164 @@ discard block |
||
| 297 | 297 | '#default_value' => $default['end_hour'] |
| 298 | 298 | ); |
| 299 | 299 | $form['prefs']['advanced']['processor']['hour_description'] = array( |
| 300 | - '#value' => '<div class="form-item slim"><div class="description">' . bts('Compute only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
|
| 300 | + '#value' => '<div class="form-item slim"><div class="description">' . bts('Compute only during a particular period each day.', array(), null, 'boinc:account-preferences-computing') . '</div></div>' |
|
| 301 | 301 | ); |
| 302 | 302 | $form['prefs']['advanced']['processor']['leave_apps_in_memory'] = array( |
| 303 | - '#title' => bts('Leave non-GPU tasks in memory while suspended?', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 303 | + '#title' => bts('Leave non-GPU tasks in memory while suspended?', array(), null, 'boinc:account-preferences-computing'), |
|
| 304 | 304 | '#type' => 'radios', |
| 305 | 305 | '#options' => $form['boolean_options']['#value'], |
| 306 | 306 | '#attributes' => array('class' => 'fancy'), |
| 307 | 307 | '#default_value' => $default['leave_apps_in_memory'], |
| 308 | - '#description' => bts('If "Yes", suspended tasks stay in memory, and resume with no work lost. If "No", suspended tasks are removed from memory, and resume from their last checkpoint.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 308 | + '#description' => bts('If "Yes", suspended tasks stay in memory, and resume with no work lost. If "No", suspended tasks are removed from memory, and resume from their last checkpoint.', array(), null, 'boinc:account-preferences-computing') |
|
| 309 | 309 | ); |
| 310 | 310 | $form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes'] = array( |
| 311 | - '#title' => bts('Switch between tasks every', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 311 | + '#title' => bts('Switch between tasks every', array(), null, 'boinc:account-preferences-computing'), |
|
| 312 | 312 | '#type' => 'textfield', |
| 313 | - '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
|
| 313 | + '#field_suffix' => bts('minutes', array(), null, 'boinc:unit-of-time'), |
|
| 314 | 314 | '#default_value' => $default['cpu_scheduling_period_minutes'], |
| 315 | 315 | '#size' => 1, |
| 316 | - '#description' => bts('If you run several projects, BOINC may switch between them this often.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 316 | + '#description' => bts('If you run several projects, BOINC may switch between them this often.', array(), null, 'boinc:account-preferences-computing') |
|
| 317 | 317 | ); |
| 318 | 318 | $form['prefs']['advanced']['processor']['max_ncpus_pct'] = array( |
| 319 | - '#title' => bts('Use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 319 | + '#title' => bts('Use at most', array(), null, 'boinc:account-preferences-computing'), |
|
| 320 | 320 | '#type' => 'textfield', |
| 321 | - '#field_suffix' => bts('% of the processors', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 321 | + '#field_suffix' => bts('% of the processors', array(), null, 'boinc:account-preferences-computing'), |
|
| 322 | 322 | '#default_value' => $default['max_ncpus_pct'], |
| 323 | 323 | '#size' => 1, |
| 324 | - '#description' => bts('Keep some CPUs free for other applications. Example: 75% means use 6 cores on an 8-core CPU.', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 324 | + '#description' => bts('Keep some CPUs free for other applications. Example: 75% means use 6 cores on an 8-core CPU.', array(), null, 'boinc:account-preferences-computing'), |
|
| 325 | 325 | ); |
| 326 | 326 | $form['prefs']['advanced']['processor']['cpu_usage_limit'] = array( |
| 327 | - '#title' => bts('Use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 327 | + '#title' => bts('Use at most', array(), null, 'boinc:account-preferences-computing'), |
|
| 328 | 328 | '#type' => 'textfield', |
| 329 | - '#field_suffix' => bts('% of the CPU time', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 329 | + '#field_suffix' => bts('% of the CPU time', array(), null, 'boinc:account-preferences-computing'), |
|
| 330 | 330 | '#default_value' => $default['cpu_usage_limit'], |
| 331 | 331 | '#size' => 1, |
| 332 | - '#description' => bts('Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 332 | + '#description' => bts('Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat.', array(), null, 'boinc:account-preferences-computing') |
|
| 333 | 333 | ); |
| 334 | 334 | |
| 335 | 335 | // Disk and memory preferences |
| 336 | 336 | $form['prefs']['advanced']['storage'] = array( |
| 337 | - '#title' => bts('Disk and memory usage', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 337 | + '#title' => bts('Disk and memory usage', array(), null, 'boinc:account-preferences-computing'), |
|
| 338 | 338 | '#type' => 'fieldset', |
| 339 | 339 | '#description' => '', |
| 340 | - '#collapsible' => FALSE, |
|
| 341 | - '#collapsed' => FALSE |
|
| 340 | + '#collapsible' => false, |
|
| 341 | + '#collapsed' => false |
|
| 342 | 342 | ); |
| 343 | 343 | $form['prefs']['advanced']['storage']['disk_max_used_gb'] = array( |
| 344 | - '#title' => bts('Disk: use no more than', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 344 | + '#title' => bts('Disk: use no more than', array(), null, 'boinc:account-preferences-computing'), |
|
| 345 | 345 | '#type' => 'textfield', |
| 346 | 346 | '#field_suffix' => 'GB', |
| 347 | 347 | '#default_value' => $default['disk_max_used_gb'], |
| 348 | 348 | '#size' => 1, |
| 349 | - '#description' => bts('Limit the total amount of disk space used by BOINC.', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 349 | + '#description' => bts('Limit the total amount of disk space used by BOINC.', array(), null, 'boinc:account-preferences-computing'), |
|
| 350 | 350 | ); |
| 351 | 351 | $form['prefs']['advanced']['storage']['disk_min_free_gb'] = array( |
| 352 | - '#title' => bts('Disk: leave at least', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 352 | + '#title' => bts('Disk: leave at least', array(), null, 'boinc:account-preferences-computing'), |
|
| 353 | 353 | '#type' => 'textfield', |
| 354 | 354 | '#field_suffix' => 'GB free', |
| 355 | 355 | '#default_value' => $default['disk_min_free_gb'], |
| 356 | 356 | '#size' => 1, |
| 357 | - '#description' => bts('Limit disk usage to leave this much free space on the volume where BOINC stores data.', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 357 | + '#description' => bts('Limit disk usage to leave this much free space on the volume where BOINC stores data.', array(), null, 'boinc:account-preferences-computing'), |
|
| 358 | 358 | ); |
| 359 | 359 | $form['prefs']['advanced']['storage']['disk_max_used_pct'] = array( |
| 360 | - '#title' => bts('Disk: use no more than', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 360 | + '#title' => bts('Disk: use no more than', array(), null, 'boinc:account-preferences-computing'), |
|
| 361 | 361 | '#type' => 'textfield', |
| 362 | - '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 362 | + '#field_suffix' => bts('% of total', array(), null, 'boinc:account-preferences-computing'), |
|
| 363 | 363 | '#default_value' => $default['disk_max_used_pct'], |
| 364 | 364 | '#size' => 1, |
| 365 | - '#description' => bts('Limit the percentage of disk space used by BOINC on the volume where it stores data.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 365 | + '#description' => bts('Limit the percentage of disk space used by BOINC on the volume where it stores data.', array(), null, 'boinc:account-preferences-computing') |
|
| 366 | 366 | ); |
| 367 | 367 | $form['prefs']['advanced']['storage']['disk_interval'] = array( |
| 368 | - '#title' => bts('Request tasks to checkpoint at most every', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 368 | + '#title' => bts('Request tasks to checkpoint at most every', array(), null, 'boinc:account-preferences-computing'), |
|
| 369 | 369 | '#type' => 'textfield', |
| 370 | - '#field_suffix' => bts('seconds', array(), NULL, 'boinc:unit-of-time'), |
|
| 370 | + '#field_suffix' => bts('seconds', array(), null, 'boinc:unit-of-time'), |
|
| 371 | 371 | '#default_value' => $default['disk_interval'], |
| 372 | 372 | '#size' => 1, |
| 373 | - '#description' => bts('This controls how often tasks save their state to disk, so that later they can be continued from that point.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 373 | + '#description' => bts('This controls how often tasks save their state to disk, so that later they can be continued from that point.', array(), null, 'boinc:account-preferences-computing') |
|
| 374 | 374 | ); |
| 375 | 375 | $form['prefs']['advanced']['storage']['vm_max_used_pct'] = array( |
| 376 | - '#title' => bts('Page/swap file: use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 376 | + '#title' => bts('Page/swap file: use at most', array(), null, 'boinc:account-preferences-computing'), |
|
| 377 | 377 | '#type' => 'textfield', |
| 378 | - '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 378 | + '#field_suffix' => bts('% of total', array(), null, 'boinc:account-preferences-computing'), |
|
| 379 | 379 | '#default_value' => $default['vm_max_used_pct'], |
| 380 | 380 | '#size' => 1, |
| 381 | - '#description' => bts('Limit the swap space (page file) used by BOINC.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 381 | + '#description' => bts('Limit the swap space (page file) used by BOINC.', array(), null, 'boinc:account-preferences-computing') |
|
| 382 | 382 | ); |
| 383 | 383 | $form['prefs']['advanced']['storage']['ram_max_used_busy_pct'] = array( |
| 384 | - '#title' => bts('Memory: when computer is in use, use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 384 | + '#title' => bts('Memory: when computer is in use, use at most', array(), null, 'boinc:account-preferences-computing'), |
|
| 385 | 385 | '#type' => 'textfield', |
| 386 | - '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 386 | + '#field_suffix' => bts('% of total', array(), null, 'boinc:account-preferences-computing'), |
|
| 387 | 387 | '#default_value' => $default['ram_max_used_busy_pct'], |
| 388 | 388 | '#size' => 1, |
| 389 | - '#description' => bts("Limit the memory used by BOINC when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing') |
|
| 389 | + '#description' => bts("Limit the memory used by BOINC when you're using the computer.", array(), null, 'boinc:account-preferences-computing') |
|
| 390 | 390 | ); |
| 391 | 391 | $form['prefs']['advanced']['storage']['ram_max_used_idle_pct'] = array( |
| 392 | - '#title' => bts('Memory: when computer is not in use, use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 392 | + '#title' => bts('Memory: when computer is not in use, use at most', array(), null, 'boinc:account-preferences-computing'), |
|
| 393 | 393 | '#type' => 'textfield', |
| 394 | - '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 394 | + '#field_suffix' => bts('% of total', array(), null, 'boinc:account-preferences-computing'), |
|
| 395 | 395 | '#default_value' => $default['ram_max_used_idle_pct'], |
| 396 | 396 | '#size' => 1, |
| 397 | - '#description' => bts("Limit the memory used by BOINC when you're not using the computer.", array(), NULL, 'boinc:account-preferences-computing') |
|
| 397 | + '#description' => bts("Limit the memory used by BOINC when you're not using the computer.", array(), null, 'boinc:account-preferences-computing') |
|
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | 400 | // Network preferences |
| 401 | 401 | $form['prefs']['advanced']['network'] = array( |
| 402 | - '#title' => bts('Network usage', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 402 | + '#title' => bts('Network usage', array(), null, 'boinc:account-preferences-computing'), |
|
| 403 | 403 | '#type' => 'fieldset', |
| 404 | 404 | '#description' => '', |
| 405 | - '#collapsible' => FALSE, |
|
| 406 | - '#collapsed' => FALSE |
|
| 405 | + '#collapsible' => false, |
|
| 406 | + '#collapsed' => false |
|
| 407 | 407 | ); |
| 408 | 408 | $form['prefs']['advanced']['network']['work_buf_min_days'] = array( |
| 409 | - '#title' => bts('Store at least', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 409 | + '#title' => bts('Store at least', array(), null, 'boinc:account-preferences-computing'), |
|
| 410 | 410 | '#type' => 'textfield', |
| 411 | - '#field_suffix' => bts('days of work', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 411 | + '#field_suffix' => bts('days of work', array(), null, 'boinc:account-preferences-computing'), |
|
| 412 | 412 | '#default_value' => $default['work_buf_min_days'], |
| 413 | 413 | '#size' => 1, |
| 414 | - '#description' => bts('Store at least enough tasks to keep the computer busy for this long.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 414 | + '#description' => bts('Store at least enough tasks to keep the computer busy for this long.', array(), null, 'boinc:account-preferences-computing') |
|
| 415 | 415 | ); |
| 416 | 416 | $form['prefs']['advanced']['network']['work_buf_additional_days'] = array( |
| 417 | - '#title' => bts('Store up to an additional', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 417 | + '#title' => bts('Store up to an additional', array(), null, 'boinc:account-preferences-computing'), |
|
| 418 | 418 | '#type' => 'textfield', |
| 419 | - '#field_suffix' => bts('days', array(), NULL, 'boinc:unit-of-time'), |
|
| 419 | + '#field_suffix' => bts('days', array(), null, 'boinc:unit-of-time'), |
|
| 420 | 420 | '#default_value' => $default['work_buf_additional_days'], |
| 421 | 421 | '#size' => 1, |
| 422 | - '#description' => bts('Store additional tasks above the minimum level. Determines how much work is requested when contacting a project.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 422 | + '#description' => bts('Store additional tasks above the minimum level. Determines how much work is requested when contacting a project.', array(), null, 'boinc:account-preferences-computing') |
|
| 423 | 423 | ); |
| 424 | 424 | $form['prefs']['advanced']['network']['confirm_before_connecting'] = array( |
| 425 | - '#title' => bts('Confirm before connecting to Internet?', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 425 | + '#title' => bts('Confirm before connecting to Internet?', array(), null, 'boinc:account-preferences-computing'), |
|
| 426 | 426 | '#type' => 'radios', |
| 427 | 427 | '#options' => $form['boolean_options']['#value'], |
| 428 | 428 | '#attributes' => array('class' => 'fancy'), |
| 429 | 429 | '#default_value' => $default['confirm_before_connecting'], |
| 430 | - '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 430 | + '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), null, 'boinc:account-preferences-computing') |
|
| 431 | 431 | ); |
| 432 | 432 | $form['prefs']['advanced']['network']['hangup_if_dialed'] = array( |
| 433 | - '#title' => bts('Disconnect when done?', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 433 | + '#title' => bts('Disconnect when done?', array(), null, 'boinc:account-preferences-computing'), |
|
| 434 | 434 | '#type' => 'radios', |
| 435 | 435 | '#options' => $form['boolean_options']['#value'], |
| 436 | 436 | '#attributes' => array('class' => 'fancy'), |
| 437 | 437 | '#default_value' => $default['hangup_if_dialed'], |
| 438 | - '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 438 | + '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), null, 'boinc:account-preferences-computing') |
|
| 439 | 439 | ); |
| 440 | 440 | $form['prefs']['advanced']['network']['max_bytes_sec_down'] = array( |
| 441 | - '#title' => bts('Limit download rate to', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 441 | + '#title' => bts('Limit download rate to', array(), null, 'boinc:account-preferences-computing'), |
|
| 442 | 442 | '#type' => 'textfield', |
| 443 | 443 | '#field_suffix' => 'Kbytes/sec', |
| 444 | 444 | '#default_value' => $default['max_bytes_sec_down']/1000, |
| 445 | 445 | '#size' => 1, |
| 446 | - '#description' => bts('Limit the download rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 446 | + '#description' => bts('Limit the download rate of file transfers.', array(), null, 'boinc:account-preferences-computing') |
|
| 447 | 447 | ); |
| 448 | 448 | $form['prefs']['advanced']['network']['max_bytes_sec_up'] = array( |
| 449 | - '#title' => bts('Limit upload rate to', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 449 | + '#title' => bts('Limit upload rate to', array(), null, 'boinc:account-preferences-computing'), |
|
| 450 | 450 | '#type' => 'textfield', |
| 451 | 451 | '#field_suffix' => 'Kbytes/sec', |
| 452 | 452 | '#default_value' => $default['max_bytes_sec_up']/1000, |
| 453 | 453 | '#size' => 1, |
| 454 | - '#description' => bts('Limit the upload rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 454 | + '#description' => bts('Limit the upload rate of file transfers.', array(), null, 'boinc:account-preferences-computing') |
|
| 455 | 455 | ); |
| 456 | 456 | $form['prefs']['advanced']['network']['hour_label'] = array( |
| 457 | - '#value' => '<div class="form-item"><label>' . bts('Transfer files only between', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
|
| 457 | + '#value' => '<div class="form-item"><label>' . bts('Transfer files only between', array(), null, 'boinc:account-preferences-computing') . '</label></div>' |
|
| 458 | 458 | ); |
| 459 | 459 | $form['prefs']['advanced']['network']['net_start_hour'] = array( |
| 460 | 460 | '#type' => 'select', |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | '#default_value' => $default['net_start_hour'] |
| 463 | 463 | ); |
| 464 | 464 | $form['prefs']['advanced']['network']['hour_delimiter'] = array( |
| 465 | - '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
|
| 465 | + '#value' => '<span>' . bts('and', array(), null, 'boinc:account-preference') . '</span>' |
|
| 466 | 466 | ); |
| 467 | 467 | $form['prefs']['advanced']['network']['net_end_hour'] = array( |
| 468 | 468 | '#type' => 'select', |
@@ -470,10 +470,10 @@ discard block |
||
| 470 | 470 | '#default_value' => $default['net_end_hour'] |
| 471 | 471 | ); |
| 472 | 472 | $form['prefs']['advanced']['network']['hour_description'] = array( |
| 473 | - '#value' => '<div class="form-item slim"><div class="description">' . bts('Transfer files only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
|
| 473 | + '#value' => '<div class="form-item slim"><div class="description">' . bts('Transfer files only during a particular period each day.', array(), null, 'boinc:account-preferences-computing') . '</div></div>' |
|
| 474 | 474 | ); |
| 475 | 475 | $form['prefs']['advanced']['network']['daily_xfer_limit_mb'] = array( |
| 476 | - '#title' => bts('Limit usage to', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 476 | + '#title' => bts('Limit usage to', array(), null, 'boinc:account-preferences-computing'), |
|
| 477 | 477 | '#type' => 'textfield', |
| 478 | 478 | '#field_suffix' => 'Mbytes', |
| 479 | 479 | '#default_value' => $default['daily_xfer_limit_mb'], |
@@ -482,18 +482,18 @@ discard block |
||
| 482 | 482 | $form['prefs']['advanced']['network']['daily_xfer_period_days'] = array( |
| 483 | 483 | '#field_prefix' => 'every', |
| 484 | 484 | '#type' => 'textfield', |
| 485 | - '#field_suffix' => bts('days', array(), NULL, 'boinc:unit-of-time'), |
|
| 485 | + '#field_suffix' => bts('days', array(), null, 'boinc:unit-of-time'), |
|
| 486 | 486 | '#default_value' => $default['daily_xfer_period_days'], |
| 487 | 487 | '#size' => 1, |
| 488 | - '#description' => bts('Example: BOINC should transfer at most 2000 MB of data every 30 days.', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 488 | + '#description' => bts('Example: BOINC should transfer at most 2000 MB of data every 30 days.', array(), null, 'boinc:account-preferences-computing'), |
|
| 489 | 489 | ); |
| 490 | 490 | $form['prefs']['advanced']['network']['dont_verify_images'] = array( |
| 491 | - '#title' => bts('Skip data verification for image files?', array(), NULL, 'boinc:account-preferences-computing'), |
|
| 491 | + '#title' => bts('Skip data verification for image files?', array(), null, 'boinc:account-preferences-computing'), |
|
| 492 | 492 | '#type' => 'radios', |
| 493 | 493 | '#options' => $form['boolean_options']['#value'], |
| 494 | 494 | '#attributes' => array('class' => 'fancy'), |
| 495 | 495 | '#default_value' => $default['dont_verify_images'], |
| 496 | - '#description' => bts('Only select "Yes" if your Internet provider modifies image files. Skipping verification reduces the security of BOINC.', array(), NULL, 'boinc:account-preferences-computing') |
|
| 496 | + '#description' => bts('Only select "Yes" if your Internet provider modifies image files. Skipping verification reduces the security of BOINC.', array(), null, 'boinc:account-preferences-computing') |
|
| 497 | 497 | ); |
| 498 | 498 | |
| 499 | 499 | // The "fancy radios" are made via javascript on document load. In order for |
@@ -526,27 +526,27 @@ discard block |
||
| 526 | 526 | $form['prefs']['submit'] = array( |
| 527 | 527 | '#prefix' => '<li class="first tab">', |
| 528 | 528 | '#type' => 'submit', |
| 529 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
| 529 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
| 530 | 530 | '#suffix' => '</li>' |
| 531 | 531 | ); |
| 532 | 532 | $form['prefs']['form control tabs'] = array( |
| 533 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")) . '</li>' |
|
| 533 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")) . '</li>' |
|
| 534 | 534 | ); |
| 535 | - if ($venue AND $venue != 'generic') { |
|
| 535 | + if ($venue and $venue != 'generic') { |
|
| 536 | 536 | global $base_path; |
| 537 | 537 | $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
| 538 | - l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
|
| 538 | + l(bts('Clear', array(), null, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
|
| 539 | 539 | array( |
| 540 | 540 | 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
| 541 | 541 | 'attributes' => array( |
| 542 | 542 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
| 543 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
| 543 | + array('@name' => $venue), null, 'boinc:account-preferences') . '\')' |
|
| 544 | 544 | ) |
| 545 | 545 | ) |
| 546 | 546 | ) . '</li>'; |
| 547 | 547 | } |
| 548 | 548 | $form['prefs']['view control'] = array( |
| 549 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing/combined') . '</li>' |
|
| 549 | + '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), null, 'boinc:account-preferences') . ')', 'account/prefs/computing/combined') . '</li>' |
|
| 550 | 550 | ); |
| 551 | 551 | $form['prefs']['form control tabs suffix'] = array( |
| 552 | 552 | '#value' => '</ul>' |
@@ -567,33 +567,33 @@ discard block |
||
| 567 | 567 | // Verify all non-boolean user input values and notify form API of failures |
| 568 | 568 | |
| 569 | 569 | // Processing preferences |
| 570 | - if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['idle_time_to_run']['#title']} [x] {$form['prefs']['advanced']['processor']['idle_time_to_run']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 571 | - if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 572 | - if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 573 | - if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['start_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['start_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 574 | - if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['end_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['end_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 575 | - if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 576 | - if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['max_ncpus_pct']['#title']} [x] {$form['prefs']['advanced']['processor']['max_ncpus_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 577 | - if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_usage_limit']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_usage_limit']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 570 | + if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['idle_time_to_run']['#title']} [x] {$form['prefs']['advanced']['processor']['idle_time_to_run']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 571 | + if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 572 | + if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 573 | + if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['start_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['start_hour']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 574 | + if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['end_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['end_hour']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 575 | + if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 576 | + if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['max_ncpus_pct']['#title']} [x] {$form['prefs']['advanced']['processor']['max_ncpus_pct']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 577 | + if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_usage_limit']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_usage_limit']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 578 | 578 | |
| 579 | 579 | // Storage preferences |
| 580 | - if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_gb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 581 | - if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_min_free_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_min_free_gb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 582 | - if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 583 | - if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_interval']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_interval']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 584 | - if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['vm_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['vm_max_used_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 585 | - if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 586 | - if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 580 | + if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_gb']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 581 | + if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_min_free_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_min_free_gb']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 582 | + if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_pct']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 583 | + if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_interval']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_interval']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 584 | + if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['vm_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['vm_max_used_pct']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 585 | + if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 586 | + if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 587 | 587 | |
| 588 | 588 | // Network preferences |
| 589 | - if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_min_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_min_days']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 590 | - if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_additional_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_additional_days']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 591 | - if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_down']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_down']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 592 | - if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_up']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_up']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 593 | - if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_start_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_start_hour']['#field_suffix']}"), NULL, 'boinc:account-prefrences-computing')); |
|
| 594 | - if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_end_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_end_hour']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 595 | - if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 596 | - if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"), NULL, 'boinc:account-preferences-computing')); |
|
| 589 | + if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_min_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_min_days']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 590 | + if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_additional_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_additional_days']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 591 | + if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_down']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_down']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 592 | + if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_up']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_up']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 593 | + if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_start_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_start_hour']['#field_suffix']}"), null, 'boinc:account-prefrences-computing')); |
|
| 594 | + if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_end_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_end_hour']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 595 | + if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 596 | + if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"), null, 'boinc:account-preferences-computing')); |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | /** |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | unset($prefs['@attributes']['preset']); |
| 654 | 654 | } |
| 655 | 655 | // Save the preset selection (or lack thereof) |
| 656 | - if (!$preset OR $preset == 'custom') { |
|
| 656 | + if (!$preset or $preset == 'custom') { |
|
| 657 | 657 | $prefs['preset'] = 'custom'; |
| 658 | 658 | } |
| 659 | 659 | else { |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
| 673 | 673 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
| 674 | 674 | } |
| 675 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
| 675 | + elseif (!drupal_get_messages('status', false)) { |
|
| 676 | 676 | // Show this message if the set wasn't created automatically (in which case |
| 677 | 677 | // there is a message tailored to that) { |
| 678 | 678 | drupal_set_message(t('Your preferences have been updated. |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | )); |
| 707 | 707 | db_set_active('default'); |
| 708 | 708 | $current_host->task_count = boincwork_host_get_task_count($current_host->id); |
| 709 | - $current_host->is_new = !$current_host->total_credit AND !$current_host->task_count; |
|
| 709 | + $current_host->is_new = !$current_host->total_credit and !$current_host->task_count; |
|
| 710 | 710 | // Get the list of all other hosts owned by this user for comparison |
| 711 | 711 | db_set_active('boinc_ro'); |
| 712 | 712 | $all_other_hosts = db_query(" |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | // First, disqualify if hosts were active at the same time |
| 723 | 723 | if (!$current_host->is_new) { |
| 724 | 724 | $other_host->task_count = boincwork_host_get_task_count($other_host->id); |
| 725 | - $other_host->is_new = !$other_host->total_credit AND !$other_host->task_count; |
|
| 725 | + $other_host->is_new = !$other_host->total_credit and !$other_host->task_count; |
|
| 726 | 726 | if (!$other_host->is_new) { |
| 727 | 727 | // If both hosts being compared are not new, see if times overlap |
| 728 | 728 | if (!times_disjoint($current_host, $other_host)) { |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | /** |
| 756 | 756 | * Perform the database updates to merge the old host into the new host |
| 757 | 757 | */ |
| 758 | -function boincwork_host_merge($old_host, $new_host, &$message = NULL) { |
|
| 758 | +function boincwork_host_merge($old_host, $new_host, &$message = null) { |
|
| 759 | 759 | // Decay the average credit of the two hosts |
| 760 | 760 | require_boinc('credit'); |
| 761 | 761 | $now = time(); |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | WATCHDOG_WARNING |
| 782 | 782 | ); |
| 783 | 783 | $message = 'Could not merge due to a circular merge error. The site administrators have been contacted about this issue, and will investigate further.'; |
| 784 | - return FALSE; |
|
| 784 | + return false; |
|
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | if ($new_host->userid==0) { |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | WATCHDOG_WARNING |
| 796 | 796 | ); |
| 797 | 797 | $message = 'Could not merge because the target host has userid=0. The site administrators have been contacted about this issue, and will investigate further.'; |
| 798 | - return FALSE; |
|
| 798 | + return false; |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | // Move credit from the old host to the new host |
@@ -811,10 +811,10 @@ discard block |
||
| 811 | 811 | ); |
| 812 | 812 | db_set_active('default'); |
| 813 | 813 | if (!$credit_updated) { |
| 814 | - if ($message !== NULL) { |
|
| 815 | - $message = bts('Could not update credit', array(), NULL, 'boinc:account-host-merge'); |
|
| 814 | + if ($message !== null) { |
|
| 815 | + $message = bts('Could not update credit', array(), null, 'boinc:account-host-merge'); |
|
| 816 | 816 | } |
| 817 | - return FALSE; |
|
| 817 | + return false; |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | // Move results from the old host to the new host |
@@ -827,10 +827,10 @@ discard block |
||
| 827 | 827 | ); |
| 828 | 828 | db_set_active('default'); |
| 829 | 829 | if (!$results_updated) { |
| 830 | - if ($message !== NULL) { |
|
| 831 | - $message = bts('Could not update results', array(), NULL, 'boinc:account-host-merge'); |
|
| 830 | + if ($message !== null) { |
|
| 831 | + $message = bts('Could not update results', array(), null, 'boinc:account-host-merge'); |
|
| 832 | 832 | } |
| 833 | - return FALSE; |
|
| 833 | + return false; |
|
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | // Retire the old host |
@@ -847,13 +847,13 @@ discard block |
||
| 847 | 847 | ); |
| 848 | 848 | db_set_active('default'); |
| 849 | 849 | if (!$old_host_retired) { |
| 850 | - if ($message !== NULL) { |
|
| 851 | - $message = bts('Could not retire old computer', array(), NULL, 'boinc:account-host-merge'); |
|
| 850 | + if ($message !== null) { |
|
| 851 | + $message = bts('Could not retire old computer', array(), null, 'boinc:account-host-merge'); |
|
| 852 | 852 | } |
| 853 | - return FALSE; |
|
| 853 | + return false; |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | - return TRUE; |
|
| 856 | + return true; |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | /** |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | $form['overview'] = array( |
| 883 | 883 | '#value' => '<p>' . bts('Sometimes BOINC assigns separate identities to' |
| 884 | 884 | . ' the same computer by mistake. You can correct this by merging old' |
| 885 | - . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge') . '</p>' |
|
| 885 | + . ' identities with the newest one.', array(), null, 'boinc:account-host-merge') . '</p>' |
|
| 886 | 886 | . '<p>' |
| 887 | 887 | . bts('Check the computers that are the same as @name' |
| 888 | 888 | . ' (created on @date at @time with computer ID @id)', |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | '@time' => date('G:i:s T', $current_host->create_time), |
| 893 | 893 | '@id' => $current_host->id, |
| 894 | 894 | ), |
| 895 | - NULL, 'boinc:account-host-merge') . '</p>', |
|
| 895 | + null, 'boinc:account-host-merge') . '</p>', |
|
| 896 | 896 | ); |
| 897 | 897 | |
| 898 | 898 | $options = array(); |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | $form['merge'] = array( |
| 908 | 908 | '#title' => '', |
| 909 | 909 | '#type' => 'tableselect', |
| 910 | - '#header' => array(bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), bts('Created', array(), NULL, 'boinc:host-details'), bts('Computer ID', array(), NULL, 'boinc:host-list')), |
|
| 910 | + '#header' => array(bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), bts('Created', array(), null, 'boinc:host-details'), bts('Computer ID', array(), null, 'boinc:host-list')), |
|
| 911 | 911 | '#options' => $options, |
| 912 | 912 | ); |
| 913 | 913 | |
@@ -922,11 +922,11 @@ discard block |
||
| 922 | 922 | $form['prefs']['submit'] = array( |
| 923 | 923 | '#prefix' => '<li class="first tab">', |
| 924 | 924 | '#type' => 'submit', |
| 925 | - '#value' => bts('Merge', array(), NULL, 'boinc:form-merge'), |
|
| 925 | + '#value' => bts('Merge', array(), null, 'boinc:form-merge'), |
|
| 926 | 926 | '#suffix' => '</li>' |
| 927 | 927 | ); |
| 928 | 928 | $form['prefs']['form control tabs'] = array( |
| 929 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "host/{$host_id}") . '</li>' |
|
| 929 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "host/{$host_id}") . '</li>' |
|
| 930 | 930 | ); |
| 931 | 931 | |
| 932 | 932 | return $form; |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | if ($merged) { |
| 965 | 965 | // Generate a natural language list of IDs that were merged |
| 966 | 966 | $oxford_comma = ','; |
| 967 | - $conjunction = bts('and', array(), NULL, 'boinc:account-preference'); |
|
| 967 | + $conjunction = bts('and', array(), null, 'boinc:account-preference'); |
|
| 968 | 968 | $list = array_keys($merged); |
| 969 | 969 | $last = array_pop($list); |
| 970 | 970 | if ($list) { |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | '@old_id' => $list, |
| 984 | 984 | '@id' => $current_host_id |
| 985 | 985 | ), |
| 986 | - NULL, 'boinc:account-host-merge')); |
|
| 986 | + null, 'boinc:account-host-merge')); |
|
| 987 | 987 | } |
| 988 | 988 | else { |
| 989 | 989 | drupal_set_message(bts( |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | '@old_ids' => $list, |
| 993 | 993 | '@id' => $current_host_id |
| 994 | 994 | ), |
| 995 | - NULL, 'boinc:account-host-merge')); |
|
| 995 | + null, 'boinc:account-host-merge')); |
|
| 996 | 996 | } |
| 997 | 997 | } |
| 998 | 998 | |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | '@old_id' => $id, |
| 1006 | 1006 | '@message' => $error, |
| 1007 | 1007 | ), |
| 1008 | - NULL, 'boinc:account-host-merge'), |
|
| 1008 | + null, 'boinc:account-host-merge'), |
|
| 1009 | 1009 | 'warning' |
| 1010 | 1010 | ); |
| 1011 | 1011 | } |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | global $user; |
| 1027 | 1027 | $account = user_load($user->uid); |
| 1028 | 1028 | |
| 1029 | - $established = TRUE; |
|
| 1029 | + $established = true; |
|
| 1030 | 1030 | |
| 1031 | 1031 | // Get availability of special BOINC preferences |
| 1032 | 1032 | require_boinc(array('util')); |
@@ -1037,26 +1037,26 @@ discard block |
||
| 1037 | 1037 | |
| 1038 | 1038 | // Take note if this is not an established preference set on the account |
| 1039 | 1039 | if (isset($prefs['@attributes']['cleared'])) { |
| 1040 | - $established = FALSE; |
|
| 1040 | + $established = false; |
|
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | // Extract modified tag if present |
| 1044 | - $modified = NULL; |
|
| 1044 | + $modified = null; |
|
| 1045 | 1045 | if (isset($prefs['modified']['@value'])) { |
| 1046 | 1046 | $modified = $prefs['modified']['@value']; |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | - $venue_is_default = FALSE; |
|
| 1049 | + $venue_is_default = false; |
|
| 1050 | 1050 | if ($account->boincuser_default_pref_set) { |
| 1051 | 1051 | if ($account->boincuser_default_pref_set == $venue) { |
| 1052 | - $venue_is_default = TRUE; |
|
| 1052 | + $venue_is_default = true; |
|
| 1053 | 1053 | } |
| 1054 | 1054 | } |
| 1055 | - elseif (!$venue OR $venue == 'generic') { |
|
| 1056 | - $venue_is_default = TRUE; |
|
| 1055 | + elseif (!$venue or $venue == 'generic') { |
|
| 1056 | + $venue_is_default = true; |
|
| 1057 | 1057 | } |
| 1058 | 1058 | else { |
| 1059 | - $venue_is_default = FALSE; |
|
| 1059 | + $venue_is_default = false; |
|
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | // Define form defaults |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | // Standard option sets |
| 1087 | 1087 | $form['boolean_options'] = array( |
| 1088 | 1088 | '#type' => 'value', |
| 1089 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
| 1089 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
| 1090 | 1090 | ); |
| 1091 | 1091 | |
| 1092 | 1092 | // Identify preference sets that are established to distinguish what has been |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | $form['#established'] = $established; |
| 1095 | 1095 | |
| 1096 | 1096 | // Top level form options |
| 1097 | - $form['#tree'] = TRUE; |
|
| 1097 | + $form['#tree'] = true; |
|
| 1098 | 1098 | |
| 1099 | 1099 | // Hidden elements |
| 1100 | 1100 | $form['modified'] = array( |
@@ -1112,87 +1112,87 @@ discard block |
||
| 1112 | 1112 | |
| 1113 | 1113 | // Common project preferences |
| 1114 | 1114 | $form['resource'] = array( |
| 1115 | - '#title' => bts('Resource settings', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1115 | + '#title' => bts('Resource settings', array(), null, 'boinc:account-preferences-project'), |
|
| 1116 | 1116 | '#type' => 'fieldset', |
| 1117 | 1117 | '#description' => null, |
| 1118 | - '#collapsible' => TRUE, |
|
| 1119 | - '#collapsed' => FALSE |
|
| 1118 | + '#collapsible' => true, |
|
| 1119 | + '#collapsed' => false |
|
| 1120 | 1120 | ); |
| 1121 | 1121 | $form['resource']['resource_share'] = array( |
| 1122 | - '#title' => bts('Resource share', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1122 | + '#title' => bts('Resource share', array(), null, 'boinc:account-preferences-project'), |
|
| 1123 | 1123 | '#type' => 'textfield', |
| 1124 | 1124 | '#default_value' => $default['resource_share'], |
| 1125 | 1125 | '#size' => 5, |
| 1126 | - '#description' => bts("Determines the proportion of your computer's resources allocated to this project. Example: if you participate in two BOINC projects with resource shares of 100 and 200, the first will get 1/3 of your resources and the second will get 2/3.", array(), NULL, 'boinc:account-preferences-project') |
|
| 1126 | + '#description' => bts("Determines the proportion of your computer's resources allocated to this project. Example: if you participate in two BOINC projects with resource shares of 100 and 200, the first will get 1/3 of your resources and the second will get 2/3.", array(), null, 'boinc:account-preferences-project') |
|
| 1127 | 1127 | ); |
| 1128 | 1128 | if ($app_types->count > 1) { |
| 1129 | 1129 | if ($app_types->cpu) { |
| 1130 | 1130 | $form['resource']['no_cpu'] = array( |
| 1131 | - '#title' => bts('Use CPU', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1131 | + '#title' => bts('Use CPU', array(), null, 'boinc:account-preferences-project'), |
|
| 1132 | 1132 | '#type' => 'radios', |
| 1133 | 1133 | '#options' => $form['boolean_options']['#value'], |
| 1134 | 1134 | '#attributes' => array('class' => 'fancy'), |
| 1135 | 1135 | '#default_value' => $default['no_cpu'] ? 0 : 1, |
| 1136 | - '#description' => bts('Request CPU-only tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
| 1136 | + '#description' => bts('Request CPU-only tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
| 1137 | 1137 | ); |
| 1138 | 1138 | } |
| 1139 | 1139 | if ($app_types->cuda) { |
| 1140 | 1140 | $form['resource']['no_cuda'] = array( |
| 1141 | - '#title' => bts('Use NVIDIA GPU', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1141 | + '#title' => bts('Use NVIDIA GPU', array(), null, 'boinc:account-preferences-project'), |
|
| 1142 | 1142 | '#type' => 'radios', |
| 1143 | 1143 | '#options' => $form['boolean_options']['#value'], |
| 1144 | 1144 | '#attributes' => array('class' => 'fancy'), |
| 1145 | 1145 | '#default_value' => $default['no_cuda'] ? 0 : 1, |
| 1146 | - '#description' => bts('Request NVIDIA GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
| 1146 | + '#description' => bts('Request NVIDIA GPU tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
| 1147 | 1147 | ); |
| 1148 | 1148 | } |
| 1149 | 1149 | if ($app_types->ati) { |
| 1150 | 1150 | $form['resource']['no_ati'] = array( |
| 1151 | - '#title' => bts('Use AMD GPU', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1151 | + '#title' => bts('Use AMD GPU', array(), null, 'boinc:account-preferences-project'), |
|
| 1152 | 1152 | '#type' => 'radios', |
| 1153 | 1153 | '#options' => $form['boolean_options']['#value'], |
| 1154 | 1154 | '#attributes' => array('class' => 'fancy'), |
| 1155 | 1155 | '#default_value' => $default['no_ati'] ? 0 : 1, |
| 1156 | - '#description' => bts('Request AMD GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
| 1156 | + '#description' => bts('Request AMD GPU tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
| 1157 | 1157 | ); |
| 1158 | 1158 | } |
| 1159 | 1159 | if ($app_types->intel_gpu) { |
| 1160 | 1160 | $form['resource']['no_intel_gpu'] = array( |
| 1161 | - '#title' => bts('Use INTEL GPU', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1161 | + '#title' => bts('Use INTEL GPU', array(), null, 'boinc:account-preferences-project'), |
|
| 1162 | 1162 | '#type' => 'radios', |
| 1163 | 1163 | '#options' => $form['boolean_options']['#value'], |
| 1164 | 1164 | '#attributes' => array('class' => 'fancy'), |
| 1165 | 1165 | '#default_value' => $default['no_intel_gpu'] ? 0 : 1, |
| 1166 | - '#description' => bts('Request Intel GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
| 1166 | + '#description' => bts('Request Intel GPU tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
| 1167 | 1167 | ); |
| 1168 | 1168 | } |
| 1169 | 1169 | if ($app_types->apple_gpu) { |
| 1170 | 1170 | $form['resource']['no_apple_gpu'] = array( |
| 1171 | - '#title' => bts('Use Apple GPU', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1171 | + '#title' => bts('Use Apple GPU', array(), null, 'boinc:account-preferences-project'), |
|
| 1172 | 1172 | '#type' => 'radios', |
| 1173 | 1173 | '#options' => $form['boolean_options']['#value'], |
| 1174 | 1174 | '#attributes' => array('class' => 'fancy'), |
| 1175 | 1175 | '#default_value' => $default['no_apple_gpu'] ? 0 : 1, |
| 1176 | - '#description' => bts('Request Apple GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
| 1176 | + '#description' => bts('Request Apple GPU tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
| 1177 | 1177 | ); |
| 1178 | 1178 | } |
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | - if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
| 1181 | + if (variable_get('boinc_prefs_options_beta', false)) { |
|
| 1182 | 1182 | $form['beta'] = array( |
| 1183 | - '#title' => bts('Beta settings', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1183 | + '#title' => bts('Beta settings', array(), null, 'boinc:account-preferences-project'), |
|
| 1184 | 1184 | '#type' => 'fieldset', |
| 1185 | 1185 | '#description' => null, |
| 1186 | - '#collapsible' => TRUE, |
|
| 1187 | - '#collapsed' => FALSE |
|
| 1186 | + '#collapsible' => true, |
|
| 1187 | + '#collapsed' => false |
|
| 1188 | 1188 | ); |
| 1189 | 1189 | $form['beta']['allow_beta_work'] = array( |
| 1190 | - '#title' => bts('Run test applications?', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1190 | + '#title' => bts('Run test applications?', array(), null, 'boinc:account-preferences-project'), |
|
| 1191 | 1191 | '#type' => 'radios', |
| 1192 | 1192 | '#options' => $form['boolean_options']['#value'], |
| 1193 | 1193 | '#attributes' => array('class' => 'fancy'), |
| 1194 | 1194 | '#default_value' => ($default['allow_beta_work']) ? 1 : 0, |
| 1195 | - '#description' => bts('This helps us develop applications, but may cause jobs to fail on your computer', array(), NULL, 'boinc:account-preferences-project') |
|
| 1195 | + '#description' => bts('This helps us develop applications, but may cause jobs to fail on your computer', array(), null, 'boinc:account-preferences-project') |
|
| 1196 | 1196 | ); |
| 1197 | 1197 | } |
| 1198 | 1198 | |
@@ -1201,14 +1201,14 @@ discard block |
||
| 1201 | 1201 | |
| 1202 | 1202 | // Set whether to use this preference set by default for new computers |
| 1203 | 1203 | $form['default_set'] = array( |
| 1204 | - '#title' => bts('Default set', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1204 | + '#title' => bts('Default set', array(), null, 'boinc:account-preferences-project'), |
|
| 1205 | 1205 | '#type' => 'fieldset', |
| 1206 | 1206 | '#description' => null, |
| 1207 | - '#collapsible' => TRUE, |
|
| 1208 | - '#collapsed' => FALSE |
|
| 1207 | + '#collapsible' => true, |
|
| 1208 | + '#collapsed' => false |
|
| 1209 | 1209 | ); |
| 1210 | 1210 | $form['default_set']['default_venue'] = array( |
| 1211 | - '#title' => bts('Set used for new computers', array(), NULL, 'boinc:account-preferences-project'), |
|
| 1211 | + '#title' => bts('Set used for new computers', array(), null, 'boinc:account-preferences-project'), |
|
| 1212 | 1212 | '#type' => 'radios', |
| 1213 | 1213 | '#options' => $form['boolean_options']['#value'], |
| 1214 | 1214 | '#attributes' => array('class' => 'fancy'), |
@@ -1227,27 +1227,27 @@ discard block |
||
| 1227 | 1227 | $form['prefs']['submit'] = array( |
| 1228 | 1228 | '#prefix' => '<li class="first tab">', |
| 1229 | 1229 | '#type' => 'submit', |
| 1230 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
| 1230 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
| 1231 | 1231 | '#suffix' => '</li>' |
| 1232 | 1232 | ); |
| 1233 | 1233 | $form['prefs']['form control tabs'] = array( |
| 1234 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 1234 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 1235 | 1235 | ); |
| 1236 | - if ($venue AND $venue != 'generic') { |
|
| 1236 | + if ($venue and $venue != 'generic') { |
|
| 1237 | 1237 | global $base_path; |
| 1238 | 1238 | $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
| 1239 | - l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
|
| 1239 | + l(bts('Clear', array(), null, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
|
| 1240 | 1240 | array( |
| 1241 | 1241 | 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
| 1242 | 1242 | 'attributes' => array( |
| 1243 | 1243 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
| 1244 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
| 1244 | + array('@name' => $venue), null, 'boinc:account-preferences') . '\')' |
|
| 1245 | 1245 | ) |
| 1246 | 1246 | ) |
| 1247 | 1247 | ) . '</li>'; |
| 1248 | 1248 | } |
| 1249 | 1249 | $form['prefs']['view control'] = array( |
| 1250 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
| 1250 | + '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), null, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
| 1251 | 1251 | ); |
| 1252 | 1252 | $form['prefs']['form control tabs suffix'] = array( |
| 1253 | 1253 | '#value' => '</ul>' |
@@ -1267,7 +1267,7 @@ discard block |
||
| 1267 | 1267 | $ordered_array = array(); |
| 1268 | 1268 | $unordered_array = array(); |
| 1269 | 1269 | foreach ($xml['project_specific_preferences'] as $type => $element) { |
| 1270 | - if (is_array($element) AND is_numeric(key($element))) { |
|
| 1270 | + if (is_array($element) and is_numeric(key($element))) { |
|
| 1271 | 1271 | foreach ($element as $ordered_element) { |
| 1272 | 1272 | if (isset($ordered_element['@position'])) { |
| 1273 | 1273 | $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | // Check for app validation |
| 1320 | 1320 | if (isset($validation_rules['apps'])) { |
| 1321 | 1321 | if (isset($validation_rules['apps']['minimum selected']) |
| 1322 | - AND $validation_rules['apps']['minimum selected'] > 0) { |
|
| 1322 | + and $validation_rules['apps']['minimum selected'] > 0) { |
|
| 1323 | 1323 | $apps_selected = 0; |
| 1324 | 1324 | foreach ($validation_rules['apps']['list'] as $app) { |
| 1325 | 1325 | if ($form_state['values']['applications'][$app]) $apps_selected++; |
@@ -1327,14 +1327,14 @@ discard block |
||
| 1327 | 1327 | if ($apps_selected < $validation_rules['apps']['minimum selected']) { |
| 1328 | 1328 | form_set_error( |
| 1329 | 1329 | 'applications', |
| 1330 | - bts('At least one application must be selected', array(), NULL, 'boinc:account-preferences-project') |
|
| 1330 | + bts('At least one application must be selected', array(), null, 'boinc:account-preferences-project') |
|
| 1331 | 1331 | ); |
| 1332 | 1332 | } |
| 1333 | 1333 | if ($apps_selected == count($validation_rules['apps']['list'])) { |
| 1334 | 1334 | foreach ($validation_rules['apps']['list'] as $app) { |
| 1335 | 1335 | unset($form_state['values']['applications'][$app]); |
| 1336 | 1336 | } |
| 1337 | - $form_state['storage']['all apps selected'] = TRUE; |
|
| 1337 | + $form_state['storage']['all apps selected'] = true; |
|
| 1338 | 1338 | } |
| 1339 | 1339 | } |
| 1340 | 1340 | } |
@@ -1368,7 +1368,7 @@ discard block |
||
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | // Beta preferences |
| 1371 | - if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
| 1371 | + if (variable_get('boinc_prefs_options_beta', false)) { |
|
| 1372 | 1372 | $prefs['allow_beta_work'] = ($edit['beta']['allow_beta_work']) ? 1 : 0; |
| 1373 | 1373 | } |
| 1374 | 1374 | |
@@ -1406,7 +1406,7 @@ discard block |
||
| 1406 | 1406 | watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
| 1407 | 1407 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
| 1408 | 1408 | } |
| 1409 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
| 1409 | + elseif (!drupal_get_messages('status', false)) { |
|
| 1410 | 1410 | // Show this message if the set wasn't created automatically (in which case |
| 1411 | 1411 | // there is a message tailored to that) |
| 1412 | 1412 | drupal_set_message(t('Your preferences have been updated. |
@@ -1441,31 +1441,31 @@ discard block |
||
| 1441 | 1441 | // Standard option sets |
| 1442 | 1442 | $form['boolean_options'] = array( |
| 1443 | 1443 | '#type' => 'value', |
| 1444 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
| 1444 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
| 1445 | 1445 | ); |
| 1446 | 1446 | |
| 1447 | 1447 | $default = array( |
| 1448 | 1448 | 'pm_send_notification' => '', // This is set already in pm_email_notify_user |
| 1449 | 1449 | 'friend_notification' => isset($account->friend_notification) ? $account->friend_notification : 0, |
| 1450 | - 'comments_per_page' => (isset($account->comments_per_page) AND $account->comments_per_page) ? $account->comments_per_page : variable_get('comment_default_per_page_forum', 50), |
|
| 1451 | - 'comments_order' => (isset($account->sort) AND $account->sort) ? $account->sort : variable_get('comment_default_order_forum', COMMENT_ORDER_OLDEST_FIRST), |
|
| 1450 | + 'comments_per_page' => (isset($account->comments_per_page) and $account->comments_per_page) ? $account->comments_per_page : variable_get('comment_default_per_page_forum', 50), |
|
| 1451 | + 'comments_order' => (isset($account->sort) and $account->sort) ? $account->sort : variable_get('comment_default_order_forum', COMMENT_ORDER_OLDEST_FIRST), |
|
| 1452 | 1452 | ); |
| 1453 | 1453 | |
| 1454 | 1454 | // General options |
| 1455 | 1455 | $form['general'] = array( |
| 1456 | 1456 | '#type' => 'fieldset', |
| 1457 | - '#title' => bts('General settings', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1457 | + '#title' => bts('General settings', array(), null, 'boinc:account-preferences-community'), |
|
| 1458 | 1458 | '#weight' => 0, |
| 1459 | - '#collapsible' => TRUE, |
|
| 1460 | - '#collapsed' => FALSE |
|
| 1459 | + '#collapsible' => true, |
|
| 1460 | + '#collapsed' => false |
|
| 1461 | 1461 | ); |
| 1462 | 1462 | // Add the BOINC user name (non-unique, user editable) |
| 1463 | 1463 | $form['general']['boincuser_name'] = array( |
| 1464 | 1464 | '#type' => 'textfield', |
| 1465 | - '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
|
| 1465 | + '#title' => bts('Name', array(), null, 'boinc:user-or-team-name'), |
|
| 1466 | 1466 | '#default_value' => $account->boincuser_name, |
| 1467 | 1467 | '#maxlength' => USERNAME_MAX_LENGTH, |
| 1468 | - '#required' => TRUE, |
|
| 1468 | + '#required' => true, |
|
| 1469 | 1469 | '#description' => '', |
| 1470 | 1470 | '#size' => 40 |
| 1471 | 1471 | ); |
@@ -1474,8 +1474,8 @@ discard block |
||
| 1474 | 1474 | $zones = _system_zonelist(); |
| 1475 | 1475 | $form['general']['timezone'] = array( |
| 1476 | 1476 | '#type' => 'select', |
| 1477 | - '#title' => bts('Time zone', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1478 | - '#default_value' => ($account->timezone !== NULL) ? $account->timezone : variable_get('date_default_timezone', 0), |
|
| 1477 | + '#title' => bts('Time zone', array(), null, 'boinc:account-preferences-community'), |
|
| 1478 | + '#default_value' => ($account->timezone !== null) ? $account->timezone : variable_get('date_default_timezone', 0), |
|
| 1479 | 1479 | '#options' => $zones, |
| 1480 | 1480 | '#description' => '', |
| 1481 | 1481 | ); |
@@ -1484,10 +1484,10 @@ discard block |
||
| 1484 | 1484 | // Notification options |
| 1485 | 1485 | $form['notifications'] = array( |
| 1486 | 1486 | '#type' => 'fieldset', |
| 1487 | - '#title' => bts('Notification settings', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1487 | + '#title' => bts('Notification settings', array(), null, 'boinc:account-preferences-community'), |
|
| 1488 | 1488 | '#weight' => 5, |
| 1489 | - '#collapsible' => TRUE, |
|
| 1490 | - '#collapsed' => FALSE |
|
| 1489 | + '#collapsible' => true, |
|
| 1490 | + '#collapsed' => false |
|
| 1491 | 1491 | ); |
| 1492 | 1492 | // Pull in private message notification handling and tweak the form |
| 1493 | 1493 | $pm_notify = pm_email_notify_user('form', $edit, $account, 'account'); |
@@ -1495,7 +1495,7 @@ discard block |
||
| 1495 | 1495 | $pm_notify['enable_pm_mail']['pm_send_notifications'], |
| 1496 | 1496 | array( |
| 1497 | 1497 | '#type' => 'radios', |
| 1498 | - '#title' => bts('Receive email notification for private messages?', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1498 | + '#title' => bts('Receive email notification for private messages?', array(), null, 'boinc:account-preferences-community'), |
|
| 1499 | 1499 | '#description' => ' ', |
| 1500 | 1500 | '#options' => $form['boolean_options']['#value'], |
| 1501 | 1501 | '#attributes' => array('class' => 'fancy') |
@@ -1503,9 +1503,9 @@ discard block |
||
| 1503 | 1503 | ); |
| 1504 | 1504 | $form['notifications']['friend_notification'] = array( |
| 1505 | 1505 | '#type' => 'radios', |
| 1506 | - '#title' => bts('Receive email notification for friend requests?', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1506 | + '#title' => bts('Receive email notification for friend requests?', array(), null, 'boinc:account-preferences-community'), |
|
| 1507 | 1507 | '#description' => ' ', |
| 1508 | - '#options' => array(0 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), -1 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
|
| 1508 | + '#options' => array(0 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), -1 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
|
| 1509 | 1509 | '#attributes' => array('class' => 'fancy'), |
| 1510 | 1510 | '#default_value' => $default['friend_notification'] |
| 1511 | 1511 | ); |
@@ -1521,10 +1521,10 @@ discard block |
||
| 1521 | 1521 | } |
| 1522 | 1522 | $form['locale'] = array( |
| 1523 | 1523 | '#type' => 'fieldset', |
| 1524 | - '#title' => bts('Language settings', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1524 | + '#title' => bts('Language settings', array(), null, 'boinc:account-preferences-community'), |
|
| 1525 | 1525 | '#weight' => 10, |
| 1526 | - '#collapsible' => TRUE, |
|
| 1527 | - '#collapsed' => FALSE, |
|
| 1526 | + '#collapsible' => true, |
|
| 1527 | + '#collapsed' => false, |
|
| 1528 | 1528 | ); |
| 1529 | 1529 | |
| 1530 | 1530 | // Get language negotiation settings. |
@@ -1532,30 +1532,30 @@ discard block |
||
| 1532 | 1532 | $user_preferred_language = user_preferred_language($account); |
| 1533 | 1533 | $form['locale']['language'] = array( |
| 1534 | 1534 | '#type' => 'select', |
| 1535 | - '#title' => bts('Language', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1535 | + '#title' => bts('Language', array(), null, 'boinc:account-preferences-community'), |
|
| 1536 | 1536 | '#default_value' => check_plain($user_preferred_language->language), |
| 1537 | 1537 | '#options' => $names, |
| 1538 | - '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? bts("This account's default language for e-mails and preferred language for site presentation.", array(), NULL, 'boinc:account-preferences-community') : bts("This account's default language for e-mails.", array(), NULL, 'boinc:account-preferences-community'), |
|
| 1538 | + '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? bts("This account's default language for e-mails and preferred language for site presentation.", array(), null, 'boinc:account-preferences-community') : bts("This account's default language for e-mails.", array(), null, 'boinc:account-preferences-community'), |
|
| 1539 | 1539 | ); |
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | // Avatar options |
| 1543 | 1543 | $form['gravatar'] = array( |
| 1544 | 1544 | '#type' => 'item', |
| 1545 | - '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
| 1546 | - '#description' => bts('Your Gravatar will not be shown if you upload a user picture.', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1545 | + '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), null, 'boinc:account-preferences-community'), |
|
| 1546 | + '#description' => bts('Your Gravatar will not be shown if you upload a user picture.', array(), null, 'boinc:account-preferences-community'), |
|
| 1547 | 1547 | ); |
| 1548 | 1548 | if (user_access('disable own gravatar', $account)) { |
| 1549 | 1549 | $form['gravatar'] = array( |
| 1550 | 1550 | '#type' => 'checkbox', |
| 1551 | - '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
| 1552 | - '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1551 | + '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), null, 'boinc:account-preferences-community'), |
|
| 1552 | + '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), null, 'boinc:account-preferences-community'), |
|
| 1553 | 1553 | '#default_value' => isset($account->gravatar) ? $account->gravatar : 0, |
| 1554 | 1554 | '#disabled' => !empty($account->picture), |
| 1555 | 1555 | ); |
| 1556 | 1556 | } |
| 1557 | 1557 | $form['gravatar']['#weight'] = 15; |
| 1558 | - $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community') . '</a></legend>'; |
|
| 1558 | + $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), null, 'boinc:account-preferences-community') . '</a></legend>'; |
|
| 1559 | 1559 | // Upload an avatar (pulled from profile_node_form): |
| 1560 | 1560 | if (!empty($profile_form['field_image'])) { |
| 1561 | 1561 | $form['field_image'] = $profile_form['field_image']; |
@@ -1564,46 +1564,46 @@ discard block |
||
| 1564 | 1564 | $form['field_image'] = array( |
| 1565 | 1565 | '#value' => '<div class="form-item">' |
| 1566 | 1566 | . '<label class="placeholder">' |
| 1567 | - . bts('This is not available until your profile is set up.', array(), NULL, 'boinc:account-preferences-community') |
|
| 1567 | + . bts('This is not available until your profile is set up.', array(), null, 'boinc:account-preferences-community') |
|
| 1568 | 1568 | . '</label>' |
| 1569 | - . l(bts('Create a profile', array(), NULL, 'boinc:account-preferences-community'), 'account/profile/edit', array('attributes' => array('class' => 'form-link'))) |
|
| 1569 | + . l(bts('Create a profile', array(), null, 'boinc:account-preferences-community'), 'account/profile/edit', array('attributes' => array('class' => 'form-link'))) |
|
| 1570 | 1570 | . '</div>', |
| 1571 | 1571 | ); |
| 1572 | 1572 | } |
| 1573 | - $form['field_image'][0]['#title'] = bts('Upload an avatar', array(), NULL, 'boinc:account-preferences-community'); |
|
| 1573 | + $form['field_image'][0]['#title'] = bts('Upload an avatar', array(), null, 'boinc:account-preferences-community'); |
|
| 1574 | 1574 | $form['field_image']['#weight'] = 20; |
| 1575 | 1575 | $form['field_image']['#suffix'] = '</fieldset>'; |
| 1576 | 1576 | |
| 1577 | 1577 | // Forum options |
| 1578 | 1578 | $form['forums'] = array( |
| 1579 | 1579 | '#type' => 'fieldset', |
| 1580 | - '#title' => bts('Forum settings', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1580 | + '#title' => bts('Forum settings', array(), null, 'boinc:account-preferences-community'), |
|
| 1581 | 1581 | '#weight' => 25, |
| 1582 | - '#collapsible' => TRUE, |
|
| 1583 | - '#collapsed' => FALSE |
|
| 1582 | + '#collapsible' => true, |
|
| 1583 | + '#collapsed' => false |
|
| 1584 | 1584 | ); |
| 1585 | 1585 | $form['forums']['comments_per_page'] = array( |
| 1586 | 1586 | '#type' => 'select', |
| 1587 | - '#title' => bts('In discussion topics, show at most @comments_per_page', array('@comments_per_page' => ''), NULL, 'boinc:account-preferences-community'), |
|
| 1587 | + '#title' => bts('In discussion topics, show at most @comments_per_page', array('@comments_per_page' => ''), null, 'boinc:account-preferences-community'), |
|
| 1588 | 1588 | '#options' => array(10 => 10, 20 => 20, 30 => 30, 50 => 50, 100 => 100), |
| 1589 | 1589 | '#default_value' => $default['comments_per_page'] |
| 1590 | 1590 | ); |
| 1591 | 1591 | // Can't have a typical Drupal form suffix on a select box? |
| 1592 | 1592 | $form['forums']['comments_per_page_suffix'] = array( |
| 1593 | - '#value' => '<span>' . bts('comments per page', array(), NULL, 'boinc:account-preferences-community') . '</span>' |
|
| 1593 | + '#value' => '<span>' . bts('comments per page', array(), null, 'boinc:account-preferences-community') . '</span>' |
|
| 1594 | 1594 | ); |
| 1595 | 1595 | $form['forums']['comments_order'] = array( |
| 1596 | 1596 | '#type' => 'select', |
| 1597 | - '#title' => bts('Sort comments in discussions', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1598 | - '#options' => array(1 => bts('Newest post first', array(), NULL, 'boinc:account-preferences-community'), 2 => bts('Oldest post first', array(), NULL, 'boinc:account-preferences-community')), |
|
| 1597 | + '#title' => bts('Sort comments in discussions', array(), null, 'boinc:account-preferences-community'), |
|
| 1598 | + '#options' => array(1 => bts('Newest post first', array(), null, 'boinc:account-preferences-community'), 2 => bts('Oldest post first', array(), null, 'boinc:account-preferences-community')), |
|
| 1599 | 1599 | '#default_value' => $default['comments_order'] |
| 1600 | 1600 | ); |
| 1601 | 1601 | // Signature (pulled from user_edit_form): |
| 1602 | 1602 | if (variable_get('user_signatures', 0) && module_exists('comment')) { |
| 1603 | 1603 | $form['forums']['signature'] = array( |
| 1604 | 1604 | '#type' => 'textarea', |
| 1605 | - '#title' => bts('Signature', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1606 | - '#description' => bts('Your signature will be publicly displayed at the end of your comments.', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1605 | + '#title' => bts('Signature', array(), null, 'boinc:account-preferences-community'), |
|
| 1606 | + '#description' => bts('Your signature will be publicly displayed at the end of your comments.', array(), null, 'boinc:account-preferences-community'), |
|
| 1607 | 1607 | '#default_value' => $account->signature |
| 1608 | 1608 | ); |
| 1609 | 1609 | // Prevent a "validation error" message when the user attempts to save with a default value they |
@@ -1612,11 +1612,11 @@ discard block |
||
| 1612 | 1612 | drupal_set_message(t("The signature input format has been set to a format you don't have access to. It will be changed to a format you have access to when you save this page.")); |
| 1613 | 1613 | $edit['signature_format'] = FILTER_FORMAT_DEFAULT; |
| 1614 | 1614 | } |
| 1615 | - $form['forums']['signature_format'] = filter_form($account->signature_format, NULL, array('signature_format')); |
|
| 1615 | + $form['forums']['signature_format'] = filter_form($account->signature_format, null, array('signature_format')); |
|
| 1616 | 1616 | // Optionally hide signatures from comments |
| 1617 | 1617 | $form['forums']['hide_signatures'] = array( |
| 1618 | 1618 | '#type' => 'radios', |
| 1619 | - '#title' => bts('Hide signatures in forums', array(), NULL, 'boinc:account-preferences-community'), |
|
| 1619 | + '#title' => bts('Hide signatures in forums', array(), null, 'boinc:account-preferences-community'), |
|
| 1620 | 1620 | '#description' => ' ', |
| 1621 | 1621 | '#options' => $form['boolean_options']['#value'], |
| 1622 | 1622 | '#attributes' => array('class' => 'fancy'), |
@@ -1638,12 +1638,12 @@ discard block |
||
| 1638 | 1638 | $form['submit'] = array( |
| 1639 | 1639 | '#prefix' => '<li class="first tab">', |
| 1640 | 1640 | '#type' => 'submit', |
| 1641 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
| 1641 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
| 1642 | 1642 | '#suffix' => '</li>', |
| 1643 | 1643 | '#weight' => 1002, |
| 1644 | 1644 | ); |
| 1645 | 1645 | $form['form control tabs'] = array( |
| 1646 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1646 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
| 1647 | 1647 | '#weight' => 1003, |
| 1648 | 1648 | ); |
| 1649 | 1649 | $form['form control tabs suffix'] = array( |
@@ -1673,7 +1673,7 @@ discard block |
||
| 1673 | 1673 | form_set_error('boincuser_name', |
| 1674 | 1674 | bts('You may not use username @blname, as that name is not allowed. Please choose another name.', |
| 1675 | 1675 | array('@blname' => $edit['boincuser_name']), |
| 1676 | - NULL, 'boinc:account-preferences-community')); |
|
| 1676 | + null, 'boinc:account-preferences-community')); |
|
| 1677 | 1677 | return false; |
| 1678 | 1678 | } |
| 1679 | 1679 | } |
@@ -1709,7 +1709,7 @@ discard block |
||
| 1709 | 1709 | $profile_node->field_image = $edit['field_image']; |
| 1710 | 1710 | node_save($profile_node); |
| 1711 | 1711 | // Flush this from the node cache or changes won't show up immediately! |
| 1712 | - $profile_node = node_load($profile_node->nid, NULL, TRUE); |
|
| 1712 | + $profile_node = node_load($profile_node->nid, null, true); |
|
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | 1715 | // All other settings |
@@ -1738,7 +1738,7 @@ discard block |
||
| 1738 | 1738 | } |
| 1739 | 1739 | user_save($user, $settings); |
| 1740 | 1740 | |
| 1741 | - drupal_set_message(bts('Your community preferences have been updated.', array(), NULL, 'boinc:account-preferences-community')); |
|
| 1741 | + drupal_set_message(bts('Your community preferences have been updated.', array(), null, 'boinc:account-preferences-community')); |
|
| 1742 | 1742 | |
| 1743 | 1743 | // Form will not redirect if storage is set; not good if language changes |
| 1744 | 1744 | unset($form_state['storage']); |
@@ -1772,26 +1772,26 @@ discard block |
||
| 1772 | 1772 | // Standard option sets |
| 1773 | 1773 | $form['boolean_options'] = array( |
| 1774 | 1774 | '#type' => 'value', |
| 1775 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
| 1775 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
| 1776 | 1776 | ); |
| 1777 | 1777 | |
| 1778 | 1778 | $form['privacy'] = array( |
| 1779 | - '#title' => bts('Privacy settings', array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1779 | + '#title' => bts('Privacy settings', array(), null, 'boinc:account-preferences-privacy'), |
|
| 1780 | 1780 | '#type' => 'fieldset', |
| 1781 | 1781 | '#description' => null, |
| 1782 | - '#collapsible' => TRUE, |
|
| 1783 | - '#collapsed' => FALSE |
|
| 1782 | + '#collapsible' => true, |
|
| 1783 | + '#collapsed' => false |
|
| 1784 | 1784 | ); |
| 1785 | 1785 | $form['privacy']['send_email'] = array( |
| 1786 | - '#title' => bts('Is it OK for @project and your team (if any) to email you?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-preferences-privacy'), |
|
| 1786 | + '#title' => bts('Is it OK for @project and your team (if any) to email you?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:account-preferences-privacy'), |
|
| 1787 | 1787 | '#type' => 'radios', |
| 1788 | 1788 | '#options' => $form['boolean_options']['#value'], |
| 1789 | 1789 | '#attributes' => array('class' => 'fancy'), |
| 1790 | 1790 | '#default_value' => $default['privacy']['send_email'] |
| 1791 | 1791 | ); |
| 1792 | 1792 | $form['privacy']['show_hosts'] = array( |
| 1793 | - '#title' => bts('Should @project show your computers on its website?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-preferences-privacy'), |
|
| 1794 | - '#description' => bts('At times, you may be asked to enable this option in order to receive help from the forums. Advanced users may need to be able to inspect your computers\' information in order to help diagnose any problems.', array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1793 | + '#title' => bts('Should @project show your computers on its website?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:account-preferences-privacy'), |
|
| 1794 | + '#description' => bts('At times, you may be asked to enable this option in order to receive help from the forums. Advanced users may need to be able to inspect your computers\' information in order to help diagnose any problems.', array(), null, 'boinc:account-preferences-privacy'), |
|
| 1795 | 1795 | '#type' => 'radios', |
| 1796 | 1796 | '#options' => $form['boolean_options']['#value'], |
| 1797 | 1797 | '#attributes' => array('class' => 'fancy'), |
@@ -1806,7 +1806,7 @@ discard block |
||
| 1806 | 1806 | // Set name to 'privacyconsent_SHORTNAME', which can be parsed |
| 1807 | 1807 | // later in the submit function. |
| 1808 | 1808 | $form['privacy']['privacyconsent_'.$ct['shortname']] = array( |
| 1809 | - '#title' => bts($ct['description'], array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1809 | + '#title' => bts($ct['description'], array(), null, 'boinc:account-preferences-privacy'), |
|
| 1810 | 1810 | '#type' => 'radios', |
| 1811 | 1811 | '#options' => $form['boolean_options']['#value'], |
| 1812 | 1812 | '#attributes' => array('class' => 'fancy'), |
@@ -1820,28 +1820,28 @@ discard block |
||
| 1820 | 1820 | $form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics exports.', |
| 1821 | 1821 | array( |
| 1822 | 1822 | '!privacy_policy_link' => l( |
| 1823 | - bts('privacy policy', array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1823 | + bts('privacy policy', array(), null, 'boinc:account-preferences-privacy'), |
|
| 1824 | 1824 | '/privacy' |
| 1825 | 1825 | ) |
| 1826 | 1826 | ), |
| 1827 | - NULL, 'boinc:account-preferences-privacy'); |
|
| 1827 | + null, 'boinc:account-preferences-privacy'); |
|
| 1828 | 1828 | } |
| 1829 | 1829 | } |
| 1830 | 1830 | |
| 1831 | 1831 | // Ignore and block users |
| 1832 | 1832 | if (module_exists('ignore_user')) { |
| 1833 | 1833 | $form['ignoreblock'] = array( |
| 1834 | - '#title' => bts('Ignore Users', array(), NULL, 'boinc:account-preferences-privacy'), |
|
| 1834 | + '#title' => bts('Ignore Users', array(), null, 'boinc:account-preferences-privacy'), |
|
| 1835 | 1835 | '#type' => 'fieldset', |
| 1836 | - '#description' => bts('<p>You may ignore users in the forums and block users from sending you private messages.<p>', array(), NULL, 'boinc:ignore-user-help'), |
|
| 1837 | - '#collapsible' => TRUE, |
|
| 1838 | - '#collapsed' => FALSE |
|
| 1836 | + '#description' => bts('<p>You may ignore users in the forums and block users from sending you private messages.<p>', array(), null, 'boinc:ignore-user-help'), |
|
| 1837 | + '#collapsible' => true, |
|
| 1838 | + '#collapsed' => false |
|
| 1839 | 1839 | ); |
| 1840 | 1840 | |
| 1841 | 1841 | // Table for ignored users |
| 1842 | 1842 | $form['ignoreblock']['current_ignore_section'] = array( |
| 1843 | 1843 | '#type' => 'item', |
| 1844 | - '#value' => bts('Current users on your Ignore List', array(), NULL, 'boinc:ignore-user-list'), |
|
| 1844 | + '#value' => bts('Current users on your Ignore List', array(), null, 'boinc:ignore-user-list'), |
|
| 1845 | 1845 | '#prefix' => '<h4>', |
| 1846 | 1846 | '#suffix' => '</h4>', |
| 1847 | 1847 | '#weight' => -20, |
@@ -1854,18 +1854,18 @@ discard block |
||
| 1854 | 1854 | ); |
| 1855 | 1855 | $form['ignoreblock']['delete'][$ignored_user['iuid']] = array( |
| 1856 | 1856 | '#value' => l( |
| 1857 | - bts('delete', array(), NULL, 'boinc:ignore-user-delete-button'), |
|
| 1857 | + bts('delete', array(), null, 'boinc:ignore-user-delete-button'), |
|
| 1858 | 1858 | 'account/prefs/privacy/ignore_user/remove/'. $ignored_user['iuid'], |
| 1859 | 1859 | array() |
| 1860 | 1860 | ), |
| 1861 | 1861 | ); |
| 1862 | 1862 | } |
| 1863 | - $form['ignoreblock']['pager'] = array('#value' => theme('pager', NULL, 10, 0)); |
|
| 1863 | + $form['ignoreblock']['pager'] = array('#value' => theme('pager', null, 10, 0)); |
|
| 1864 | 1864 | |
| 1865 | 1865 | // Sub-form to add user to ignore list |
| 1866 | 1866 | $form['ignoreblock']['add_ignore_user_section'] = array( |
| 1867 | 1867 | '#type' => 'item', |
| 1868 | - '#value' => bts('Add user to Ignore List', array(), NULL, 'boinc:ignore-user-add'), |
|
| 1868 | + '#value' => bts('Add user to Ignore List', array(), null, 'boinc:ignore-user-add'), |
|
| 1869 | 1869 | '#prefix' => '<h4>', |
| 1870 | 1870 | '#suffix' => '</h4>', |
| 1871 | 1871 | '#weight' => 10, |
@@ -1873,8 +1873,8 @@ discard block |
||
| 1873 | 1873 | |
| 1874 | 1874 | $form['ignoreblock']['addusername_toignorelist'] = array( |
| 1875 | 1875 | '#type' => 'textfield', |
| 1876 | - '#title' => bts('Username', array(), NULL, 'boinc:ignore-user-searchbox'), |
|
| 1877 | - '#description' => bts('To lookup a username start typing in the search box. A list of usernames will appear as you type. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.', array(), NULL, 'boinc:ignore-user-searchbox-help'), |
|
| 1876 | + '#title' => bts('Username', array(), null, 'boinc:ignore-user-searchbox'), |
|
| 1877 | + '#description' => bts('To lookup a username start typing in the search box. A list of usernames will appear as you type. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.', array(), null, 'boinc:ignore-user-searchbox-help'), |
|
| 1878 | 1878 | '#weight' => 11, |
| 1879 | 1879 | '#size' => 50, |
| 1880 | 1880 | '#autocomplete_path' => 'boincuser/autocomplete', |
@@ -1882,7 +1882,7 @@ discard block |
||
| 1882 | 1882 | |
| 1883 | 1883 | $form['ignoreblock']['addusername_submit'] = array( |
| 1884 | 1884 | '#type' => 'submit', |
| 1885 | - '#value' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
|
| 1885 | + '#value' => bts('Ignore user', array(), null, 'boinc:ignore-user-add'), |
|
| 1886 | 1886 | '#submit' => array('_boincwork_ignore_list_form_submit'), |
| 1887 | 1887 | '#weight' => 12, |
| 1888 | 1888 | '#attributes' => array('class' => 'add_ignore_user'), |
@@ -1900,13 +1900,13 @@ discard block |
||
| 1900 | 1900 | $form['prefs']['submit'] = array( |
| 1901 | 1901 | '#prefix' => '<li class="first tab">', |
| 1902 | 1902 | '#type' => 'submit', |
| 1903 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
| 1903 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
| 1904 | 1904 | '#validate' => array('boincwork_privacyprefs_form_validate'), |
| 1905 | 1905 | '#submit' => array('boincwork_privacyprefs_form_submit'), |
| 1906 | 1906 | '#suffix' => '</li>' |
| 1907 | 1907 | ); |
| 1908 | 1908 | $form['prefs']['form control tabs'] = array( |
| 1909 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 1909 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 1910 | 1910 | ); |
| 1911 | 1911 | $form['prefs']['form control tabs suffix'] = array( |
| 1912 | 1912 | '#value' => '</ul>' |
@@ -1924,8 +1924,8 @@ discard block |
||
| 1924 | 1924 | $output .= drupal_render($form['privacy']); |
| 1925 | 1925 | |
| 1926 | 1926 | $header = array( |
| 1927 | - bts('Username', array(), NULL, 'boinc:ignore-user-list'), |
|
| 1928 | - bts('Operations', array(), NULL, 'boinc:ignore-user-list') |
|
| 1927 | + bts('Username', array(), null, 'boinc:ignore-user-list'), |
|
| 1928 | + bts('Operations', array(), null, 'boinc:ignore-user-list') |
|
| 1929 | 1929 | ); |
| 1930 | 1930 | |
| 1931 | 1931 | $rows = array(); |
@@ -1940,7 +1940,7 @@ discard block |
||
| 1940 | 1940 | else { |
| 1941 | 1941 | $rows[] = array( |
| 1942 | 1942 | array( |
| 1943 | - 'data' => bts('You have not added any users to your Ignore List.', array(), NULL, 'boinc:ignore-user-list'), |
|
| 1943 | + 'data' => bts('You have not added any users to your Ignore List.', array(), null, 'boinc:ignore-user-list'), |
|
| 1944 | 1944 | 'colspan' => '2', |
| 1945 | 1945 | ) |
| 1946 | 1946 | ); |
@@ -2019,9 +2019,9 @@ discard block |
||
| 2019 | 2019 | bts('@username has been added to your ignore list. See your !privacy_preferences for more details.', |
| 2020 | 2020 | array( |
| 2021 | 2021 | '@username' => $form_state['values']['addusername_toignorelist'], |
| 2022 | - '!privacy_preferences' => l(bts('privacy preferences', array(), NULL, 'boinc:ignore-user-add'), 'account/prefs/privacy'), |
|
| 2022 | + '!privacy_preferences' => l(bts('privacy preferences', array(), null, 'boinc:ignore-user-add'), 'account/prefs/privacy'), |
|
| 2023 | 2023 | ), |
| 2024 | - NULL, 'boinc:ignore-user-add'), |
|
| 2024 | + null, 'boinc:ignore-user-add'), |
|
| 2025 | 2025 | 'status'); |
| 2026 | 2026 | } |
| 2027 | 2027 | |
@@ -2046,7 +2046,7 @@ discard block |
||
| 2046 | 2046 | // only non-js users/browsers will see the Apply Filter button. |
| 2047 | 2047 | $form['submit'] = array( |
| 2048 | 2048 | '#type' => 'submit', |
| 2049 | - '#value' => bts('Apply Filter', array(), NULL, 'boinc:form-save'), |
|
| 2049 | + '#value' => bts('Apply Filter', array(), null, 'boinc:form-save'), |
|
| 2050 | 2050 | '#attributes' => array('class' => 'js-hide',), |
| 2051 | 2051 | ); |
| 2052 | 2052 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | '#suffix' => '</li>', |
| 120 | 120 | ); |
| 121 | 121 | $form['form control tabs'] = array( |
| 122 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 122 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>' |
|
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | 125 | return $form; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | // Create the team in the BOINC db |
| 165 | 165 | |
| 166 | - require_boinc(array('user','team')); |
|
| 166 | + require_boinc(array('user', 'team')); |
|
| 167 | 167 | $boinc_team = make_team( |
| 168 | 168 | $account->boincuser_id, |
| 169 | 169 | $values['name'], |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | 'teaser' => $teaser, |
| 200 | 200 | 'uid' => $user->uid, |
| 201 | 201 | 'path' => null, |
| 202 | - 'status' => 1, // published or not - always publish |
|
| 202 | + 'status' => 1, // published or not - always publish |
|
| 203 | 203 | 'promote' => 0, |
| 204 | 204 | 'created' => $created_time, |
| 205 | - 'comment' => 0, // comments disabled |
|
| 205 | + 'comment' => 0, // comments disabled |
|
| 206 | 206 | 'moderate' => 0, |
| 207 | 207 | 'sticky' => 0, |
| 208 | 208 | 'format' => $input_format |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $node['og_private'] = 0; |
| 230 | 230 | */ |
| 231 | 231 | |
| 232 | - $node = (object) $node; // node_save requires an object form |
|
| 232 | + $node = (object)$node; // node_save requires an object form |
|
| 233 | 233 | |
| 234 | 234 | /* |
| 235 | 235 | $node->field_description[]['value'] = $boincteam->description; |
@@ -379,12 +379,12 @@ discard block |
||
| 379 | 379 | '#suffix' => '</li>', |
| 380 | 380 | ); |
| 381 | 381 | $form['form control tabs'] = array( |
| 382 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
|
| 382 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)).'</li>' |
|
| 383 | 383 | ); |
| 384 | 384 | } |
| 385 | 385 | else { |
| 386 | 386 | $form['description'] = array( |
| 387 | - '#prefix' => '<div class="form-item"><label>' . bts('Description', array(), NULL, 'boinc:team-description') . ':</label></div><div class="form-item">', |
|
| 387 | + '#prefix' => '<div class="form-item"><label>'.bts('Description', array(), NULL, 'boinc:team-description').':</label></div><div class="form-item">', |
|
| 388 | 388 | '#value' => $default['description'], |
| 389 | 389 | '#suffix' => '</div>', |
| 390 | 390 | ); |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | '#suffix' => '</li>', |
| 541 | 541 | ); |
| 542 | 542 | $form['form control tabs'] = array( |
| 543 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
|
| 543 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)).'</li>' |
|
| 544 | 544 | ); |
| 545 | 545 | |
| 546 | 546 | //$form['#redirect'] = "community/teams/{$team_id}"; |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | drupal_set_title($mytitle); |
| 657 | 657 | |
| 658 | 658 | $form['emailteam']['header'] = array( |
| 659 | - '#value' => '<h1>' . $mytitle . '</h1>', |
|
| 659 | + '#value' => '<h1>'.$mytitle.'</h1>', |
|
| 660 | 660 | '#weight' => '-10', |
| 661 | 661 | '#prefix' => "<div id='sendmessageteammembers-header'>", |
| 662 | 662 | '#suffix' => "</div>", |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | // Check body |
| 781 | - if ( ($message['body'] === NULL || $message['body'] === '') ) { |
|
| 781 | + if (($message['body'] === NULL || $message['body'] === '')) { |
|
| 782 | 782 | form_set_error('body', |
| 783 | 783 | bts('Not allowed to send an empty message.', array(), NULL, 'boinc:team-message-form') |
| 784 | 784 | ); |
@@ -803,8 +803,8 @@ discard block |
||
| 803 | 803 | global $base_path; |
| 804 | 804 | |
| 805 | 805 | $suid = $form_state['values']['_senderuid']; |
| 806 | - $account = user_load(array('uid' => $suid )); |
|
| 807 | - $site_url = $base_url . $base_path . "messages/new/" . $suid; |
|
| 806 | + $account = user_load(array('uid' => $suid)); |
|
| 807 | + $site_url = $base_url.$base_path."messages/new/".$suid; |
|
| 808 | 808 | |
| 809 | 809 | // Form is validated, now send to all team members. Lookup boinc |
| 810 | 810 | // id of all team members, and then use user_load() to load user |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | // emails removed. |
| 816 | 816 | $member_emails = _boincteam_emails($boinc_id); |
| 817 | 817 | // Remove sender's email address, unless selfsend is true. |
| 818 | - if ( !$form_state['values']['selfsend'] ) { |
|
| 818 | + if (!$form_state['values']['selfsend']) { |
|
| 819 | 819 | $pos = array_search($account->mail, $member_emails); |
| 820 | 820 | unset($member_emails[$pos]); |
| 821 | 821 | } |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | |
| 840 | 840 | $om = bts( |
| 841 | 841 | 'Sent your email message to !number team members.', |
| 842 | - array( '!number' => count($member_emails) ), |
|
| 842 | + array('!number' => count($member_emails)), |
|
| 843 | 843 | 'NULL', |
| 844 | 844 | 'boinc:team-message-sent' |
| 845 | 845 | ); |
@@ -135,8 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | if (!$name) { |
| 137 | 137 | form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit')); |
| 138 | - } |
|
| 139 | - else { |
|
| 138 | + } else { |
|
| 140 | 139 | require_boinc('boinc_db'); |
| 141 | 140 | if (BoincTeam::lookup_name($name)) { |
| 142 | 141 | form_set_error('name', bts('A team named "@name" already exists.', |
@@ -177,8 +176,7 @@ discard block |
||
| 177 | 176 | if ($boinc_team) { |
| 178 | 177 | $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
| 179 | 178 | user_join_team($boinc_team, $boinc_user); |
| 180 | - } |
|
| 181 | - else { |
|
| 179 | + } else { |
|
| 182 | 180 | drupal_set_message(t('Teams cannot be created at this time. The @project administrators have been notified.', array('@project' => PROJECT))); |
| 183 | 181 | rules_invoke_event('boincteam_create_team_error', $values['name'], variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 184 | 182 | watchdog('BOINC team', 'BOINC teams cannot be created for an unknown |
@@ -212,8 +210,7 @@ discard block |
||
| 212 | 210 | if (module_exists('pathauto')) { |
| 213 | 211 | module_load_include('inc', 'pathauto', 'pathauto'); |
| 214 | 212 | $node['path'] = pathauto_cleanstring($values['name']); |
| 215 | - } |
|
| 216 | - else { |
|
| 213 | + } else { |
|
| 217 | 214 | drupal_set_message(t('Teams cannot be created at this time. The @project administrators have been notified.', array('@project' => PROJECT))); |
| 218 | 215 | rules_invoke_event('boincteam_create_team_nopathauto_error', $values['name'], variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 219 | 216 | watchdog('BOINC team', 'BOINC teams require the Pathauto module. Teams |
@@ -381,8 +378,7 @@ discard block |
||
| 381 | 378 | $form['form control tabs'] = array( |
| 382 | 379 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
| 383 | 380 | ); |
| 384 | - } |
|
| 385 | - else { |
|
| 381 | + } else { |
|
| 386 | 382 | $form['description'] = array( |
| 387 | 383 | '#prefix' => '<div class="form-item"><label>' . bts('Description', array(), NULL, 'boinc:team-description') . ':</label></div><div class="form-item">', |
| 388 | 384 | '#value' => $default['description'], |
@@ -412,12 +408,10 @@ discard block |
||
| 412 | 408 | |
| 413 | 409 | if ($form_state['storage']['is_boinc_wide']) { |
| 414 | 410 | form_set_error('none', bts('This team is managed by the BOINC-wide teams system and cannot be updated here.', array(), NULL, 'boinc:team-create/edit')); |
| 415 | - } |
|
| 416 | - else { |
|
| 411 | + } else { |
|
| 417 | 412 | if (!$name) { |
| 418 | 413 | form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit')); |
| 419 | - } |
|
| 420 | - else { |
|
| 414 | + } else { |
|
| 421 | 415 | $team = node_load($form_state['storage']['team_id']); |
| 422 | 416 | if ($name != $team->title) { |
| 423 | 417 | // If changing the name ("title" in Drupal terms), check that the new name is available |
@@ -559,8 +553,7 @@ discard block |
||
| 559 | 553 | |
| 560 | 554 | if (!$values['username']) { |
| 561 | 555 | form_set_error('username', bts('BOINC username is required.', array(), NULL, 'boinc:team-add-admin')); |
| 562 | - } |
|
| 563 | - else { |
|
| 556 | + } else { |
|
| 564 | 557 | // Load user account associated with username |
| 565 | 558 | $account = boincuser_privatemsg_name_lookup($values['username']); |
| 566 | 559 | // Validate the account |
@@ -570,24 +563,21 @@ discard block |
||
| 570 | 563 | '@username' => $account->boincuser_name |
| 571 | 564 | ), |
| 572 | 565 | NULL, 'boinc:team-add-admin')); |
| 573 | - } |
|
| 574 | - elseif (boincteam_is_founder($team_id, $account->uid)) { |
|
| 566 | + } elseif (boincteam_is_founder($team_id, $account->uid)) { |
|
| 575 | 567 | form_set_error('username', bts('@user is the founder of @team! Team founder already have all admin privileges.', |
| 576 | 568 | array( |
| 577 | 569 | '@user' => $account->boincuser_name, |
| 578 | 570 | '@team' => $team->title, |
| 579 | 571 | ), |
| 580 | 572 | NULL, 'boinc:team-add-admin')); |
| 581 | - } |
|
| 582 | - elseif (boincteam_is_admin($team_id, $account->uid)) { |
|
| 573 | + } elseif (boincteam_is_admin($team_id, $account->uid)) { |
|
| 583 | 574 | form_set_error('username', bts('@user is already an admin of @team.', |
| 584 | 575 | array( |
| 585 | 576 | '@user' => $account->boincuser_name, |
| 586 | 577 | '@team' => $team->title, |
| 587 | 578 | ), |
| 588 | 579 | NULL, 'boinc:team-add-admin')); |
| 589 | - } |
|
| 590 | - else { |
|
| 580 | + } else { |
|
| 591 | 581 | $form_state['storage']['boincuser_id'] = $account->boincuser_id; |
| 592 | 582 | $form_state['storage']['boincuser_name'] = $account->boincuser_name; |
| 593 | 583 | } |
@@ -645,8 +635,7 @@ discard block |
||
| 645 | 635 | if (isset($form_state['values'])) { |
| 646 | 636 | $subject = $form_state['values']['subject']; |
| 647 | 637 | $body = $form_state['values']['body']; |
| 648 | - } |
|
| 649 | - else { |
|
| 638 | + } else { |
|
| 650 | 639 | $subject = ''; |
| 651 | 640 | $body = ''; |
| 652 | 641 | } |
@@ -22,22 +22,22 @@ discard block |
||
| 22 | 22 | 'website' => '', |
| 23 | 23 | 'type' => 0, |
| 24 | 24 | 'country' => 0, |
| 25 | - 'joinable' => TRUE, |
|
| 25 | + 'joinable' => true, |
|
| 26 | 26 | 'description' => '', |
| 27 | 27 | ); |
| 28 | 28 | |
| 29 | 29 | // Standard option sets |
| 30 | 30 | $form['boolean_options'] = array( |
| 31 | 31 | '#type' => 'value', |
| 32 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
|
| 32 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
|
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | // Vocabulary based option sets |
| 36 | 36 | $form['type_options'] = array( |
| 37 | 37 | '#type' => 'value', |
| 38 | - '#value' => array(0 => bts('Choose type', array(), NULL, 'boinc:form-choose')) |
|
| 38 | + '#value' => array(0 => bts('Choose type', array(), null, 'boinc:form-choose')) |
|
| 39 | 39 | ); |
| 40 | - $vocabs = taxonomy_get_vocabularies(NULL); |
|
| 40 | + $vocabs = taxonomy_get_vocabularies(null); |
|
| 41 | 41 | foreach ($vocabs as $vocab) { |
| 42 | 42 | switch ($vocab->name) { |
| 43 | 43 | case 'Teams': |
@@ -59,40 +59,40 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // Form elements |
| 61 | 61 | $form['name'] = array( |
| 62 | - '#title' => bts('Team name', array(), NULL, 'boinc:team-create/edit'), |
|
| 62 | + '#title' => bts('Team name', array(), null, 'boinc:team-create/edit'), |
|
| 63 | 63 | '#type' => 'textfield', |
| 64 | 64 | '#default_value' => $default['name'], |
| 65 | 65 | '#size' => 34, |
| 66 | - '#description' => bts('Text only, no HTML tags', array(), NULL, 'boinc:team-form-help'), |
|
| 66 | + '#description' => bts('Text only, no HTML tags', array(), null, 'boinc:team-form-help'), |
|
| 67 | 67 | ); |
| 68 | 68 | $form['name_html'] = array( |
| 69 | - '#title' => bts('Team name -- HTML version (optional)', array(), NULL, 'boinc:team-create/edit'), |
|
| 69 | + '#title' => bts('Team name -- HTML version (optional)', array(), null, 'boinc:team-create/edit'), |
|
| 70 | 70 | '#type' => 'textfield', |
| 71 | 71 | '#default_value' => $default['name_html'], |
| 72 | 72 | '#size' => 34, |
| 73 | - '#description' => bts('You may use limited HTML tags', array(), NULL, 'boinc:team-form-help'), |
|
| 73 | + '#description' => bts('You may use limited HTML tags', array(), null, 'boinc:team-form-help'), |
|
| 74 | 74 | ); |
| 75 | 75 | $form['website'] = array( |
| 76 | - '#title' => bts('Team website (optional)', array(), NULL, 'boinc:team-create/edit'), |
|
| 76 | + '#title' => bts('Team website (optional)', array(), null, 'boinc:team-create/edit'), |
|
| 77 | 77 | '#type' => 'textfield', |
| 78 | 78 | '#default_value' => $default['website'], |
| 79 | 79 | '#size' => 34, |
| 80 | - '#description' => bts("Displayed on the team's page", array(), NULL, 'boinc:team-create/edit'), |
|
| 80 | + '#description' => bts("Displayed on the team's page", array(), null, 'boinc:team-create/edit'), |
|
| 81 | 81 | ); |
| 82 | 82 | $form['type'] = array( |
| 83 | - '#title' => bts('Type of team', array(), NULL, 'boinc:team-create/edit'), |
|
| 83 | + '#title' => bts('Type of team', array(), null, 'boinc:team-create/edit'), |
|
| 84 | 84 | '#type' => 'select', |
| 85 | 85 | '#options' => $form['type_options']['#value'], |
| 86 | 86 | '#default_value' => $default['type'], |
| 87 | 87 | ); |
| 88 | 88 | $form['country'] = array( |
| 89 | - '#title' => bts('Country', array(), NULL, 'boinc:country-of-origin'), |
|
| 89 | + '#title' => bts('Country', array(), null, 'boinc:country-of-origin'), |
|
| 90 | 90 | '#type' => 'select', |
| 91 | 91 | '#options' => $form['country_options']['#value'], |
| 92 | 92 | '#default_value' => $default['country'], |
| 93 | 93 | ); |
| 94 | 94 | $form['joinable'] = array( |
| 95 | - '#title' => bts('Accept new members?', array(), NULL, 'boinc:team-create/edit'), |
|
| 95 | + '#title' => bts('Accept new members?', array(), null, 'boinc:team-create/edit'), |
|
| 96 | 96 | '#type' => 'radios', |
| 97 | 97 | '#options' => $form['boolean_options']['#value'], |
| 98 | 98 | '#attributes' => array('class' => 'fancy'), |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | '#size' => 34, |
| 101 | 101 | ); |
| 102 | 102 | $form['description'] = array( |
| 103 | - '#title' => bts('Description of team', array(), NULL, 'boinc:team-create/edit'), |
|
| 103 | + '#title' => bts('Description of team', array(), null, 'boinc:team-create/edit'), |
|
| 104 | 104 | '#type' => 'textarea', |
| 105 | 105 | '#default_value' => $default['description'], |
| 106 | 106 | '#size' => 5, |
| 107 | - '#description' => NULL, |
|
| 107 | + '#description' => null, |
|
| 108 | 108 | ); |
| 109 | 109 | $form['format'] = filter_form(); |
| 110 | 110 | |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | $form['submit'] = array( |
| 116 | 116 | '#prefix' => '<li class="first tab">', |
| 117 | 117 | '#type' => 'submit', |
| 118 | - '#value' => bts('Save team', array(), NULL, 'boinc:team-form-save'), |
|
| 118 | + '#value' => bts('Save team', array(), null, 'boinc:team-form-save'), |
|
| 119 | 119 | '#suffix' => '</li>', |
| 120 | 120 | ); |
| 121 | 121 | $form['form control tabs'] = array( |
| 122 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 122 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | 125 | return $form; |
@@ -134,18 +134,18 @@ discard block |
||
| 134 | 134 | $name = $values['name']; |
| 135 | 135 | |
| 136 | 136 | if (!$name) { |
| 137 | - form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit')); |
|
| 137 | + form_set_error('name', bts('Team name is required.', array(), null, 'boinc:team-create/edit')); |
|
| 138 | 138 | } |
| 139 | 139 | else { |
| 140 | 140 | require_boinc('boinc_db'); |
| 141 | 141 | if (BoincTeam::lookup_name($name)) { |
| 142 | 142 | form_set_error('name', bts('A team named "@name" already exists.', |
| 143 | - array('@name' => $name), NULL, 'boinc:team-create/edit')); |
|
| 143 | + array('@name' => $name), null, 'boinc:team-create/edit')); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if (!$values['type'] OR !isset($values['type_options'][$values['type']])) { |
|
| 148 | - form_set_error('type', bts('Please select a team type.', array(), NULL, 'boinc:team-create/edit')); |
|
| 147 | + if (!$values['type'] or !isset($values['type_options'][$values['type']])) { |
|
| 148 | + form_set_error('type', bts('Please select a team type.', array(), null, 'boinc:team-create/edit')); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | rules_invoke_event('boincteam_create_team_error', $values['name'], variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 184 | 184 | watchdog('BOINC team', 'BOINC teams cannot be created for an unknown |
| 185 | 185 | reason.', 'error'); |
| 186 | - return FALSE; |
|
| 186 | + return false; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | // Create the team node in Drupal |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $team = node_load($team_id); |
| 265 | 265 | $boincteam = boincteam_load(boincteam_lookup_id($team_id)); |
| 266 | 266 | |
| 267 | - $is_boinc_wide = ($boincteam->seti_id > 0) ? TRUE : FALSE; |
|
| 267 | + $is_boinc_wide = ($boincteam->seti_id > 0) ? true : false; |
|
| 268 | 268 | |
| 269 | 269 | $form_state['storage']['team_id'] = $team_id; |
| 270 | 270 | $form_state['storage']['is_boinc_wide'] = $is_boinc_wide; |
@@ -282,15 +282,15 @@ discard block |
||
| 282 | 282 | // Standard option sets |
| 283 | 283 | $form['boolean_options'] = array( |
| 284 | 284 | '#type' => 'value', |
| 285 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
|
| 285 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
|
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | 288 | // Vocabulary based option sets |
| 289 | 289 | $form['type_options'] = array( |
| 290 | 290 | '#type' => 'value', |
| 291 | - '#value' => array(0 => bts('Choose type', array(), NULL, 'boinc:form-choose')) |
|
| 291 | + '#value' => array(0 => bts('Choose type', array(), null, 'boinc:form-choose')) |
|
| 292 | 292 | ); |
| 293 | - $vocabs = taxonomy_get_vocabularies(NULL); |
|
| 293 | + $vocabs = taxonomy_get_vocabularies(null); |
|
| 294 | 294 | foreach ($vocabs as $vocab) { |
| 295 | 295 | switch ($vocab->name) { |
| 296 | 296 | case 'Teams': |
@@ -312,45 +312,45 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | // Form elements |
| 314 | 314 | $form['name'] = array( |
| 315 | - '#title' => bts('Team name', array(), NULL, 'boinc:team-create/edit'), |
|
| 315 | + '#title' => bts('Team name', array(), null, 'boinc:team-create/edit'), |
|
| 316 | 316 | '#type' => 'textfield', |
| 317 | 317 | '#default_value' => $default['name'], |
| 318 | 318 | '#size' => 34, |
| 319 | - '#description' => bts('Text only, no HTML tags', array(), NULL, 'boinc:team-form-help'), |
|
| 319 | + '#description' => bts('Text only, no HTML tags', array(), null, 'boinc:team-form-help'), |
|
| 320 | 320 | '#disabled' => $is_boinc_wide, |
| 321 | 321 | ); |
| 322 | 322 | $form['name_html'] = array( |
| 323 | - '#title' => bts('Team name -- HTML version (optional)', array(), NULL, 'boinc:team-create/edit'), |
|
| 323 | + '#title' => bts('Team name -- HTML version (optional)', array(), null, 'boinc:team-create/edit'), |
|
| 324 | 324 | '#type' => 'textfield', |
| 325 | 325 | '#default_value' => $default['name_html'], |
| 326 | 326 | '#size' => 34, |
| 327 | - '#description' => bts('You may use limited HTML tags', array(), NULL, 'boinc:team-form-help'), |
|
| 327 | + '#description' => bts('You may use limited HTML tags', array(), null, 'boinc:team-form-help'), |
|
| 328 | 328 | '#disabled' => $is_boinc_wide, |
| 329 | 329 | ); |
| 330 | 330 | $form['website'] = array( |
| 331 | - '#title' => bts('Team website (optional)', array(), NULL, 'boinc:team-create/edit'), |
|
| 331 | + '#title' => bts('Team website (optional)', array(), null, 'boinc:team-create/edit'), |
|
| 332 | 332 | '#type' => 'textfield', |
| 333 | 333 | '#default_value' => $default['website'], |
| 334 | 334 | '#size' => 34, |
| 335 | - '#description' => bts("Displayed on the team's page", array(), NULL, 'boinc:team-create/edit'), |
|
| 335 | + '#description' => bts("Displayed on the team's page", array(), null, 'boinc:team-create/edit'), |
|
| 336 | 336 | '#disabled' => $is_boinc_wide, |
| 337 | 337 | ); |
| 338 | 338 | $form['type'] = array( |
| 339 | - '#title' => bts('Type of team', array(), NULL, 'boinc:team-create/edit'), |
|
| 339 | + '#title' => bts('Type of team', array(), null, 'boinc:team-create/edit'), |
|
| 340 | 340 | '#type' => 'select', |
| 341 | 341 | '#options' => $form['type_options']['#value'], |
| 342 | 342 | '#default_value' => $default['type'], |
| 343 | 343 | '#disabled' => $is_boinc_wide, |
| 344 | 344 | ); |
| 345 | 345 | $form['country'] = array( |
| 346 | - '#title' => bts('Country', array(), NULL, 'boinc:country-of-origin'), |
|
| 346 | + '#title' => bts('Country', array(), null, 'boinc:country-of-origin'), |
|
| 347 | 347 | '#type' => 'select', |
| 348 | 348 | '#options' => $form['country_options']['#value'], |
| 349 | 349 | '#default_value' => $default['country'], |
| 350 | 350 | '#disabled' => $is_boinc_wide, |
| 351 | 351 | ); |
| 352 | 352 | $form['joinable'] = array( |
| 353 | - '#title' => bts('Accept new members?', array(), NULL, 'boinc:team-create/edit'), |
|
| 353 | + '#title' => bts('Accept new members?', array(), null, 'boinc:team-create/edit'), |
|
| 354 | 354 | '#type' => 'radios', |
| 355 | 355 | '#options' => $form['boolean_options']['#value'], |
| 356 | 356 | '#attributes' => array('class' => 'fancy'), |
@@ -360,11 +360,11 @@ discard block |
||
| 360 | 360 | ); |
| 361 | 361 | if (!$is_boinc_wide) { |
| 362 | 362 | $form['description'] = array( |
| 363 | - '#title' => bts('Description of team', array(), NULL, 'boinc:team-create/edit'), |
|
| 363 | + '#title' => bts('Description of team', array(), null, 'boinc:team-create/edit'), |
|
| 364 | 364 | '#type' => 'textarea', |
| 365 | 365 | '#default_value' => $default['description'], |
| 366 | 366 | '#size' => 5, |
| 367 | - '#description' => NULL, |
|
| 367 | + '#description' => null, |
|
| 368 | 368 | ); |
| 369 | 369 | $form['format'] = filter_form(); |
| 370 | 370 | |
@@ -375,25 +375,25 @@ discard block |
||
| 375 | 375 | $form['submit'] = array( |
| 376 | 376 | '#prefix' => '<li class="first tab">', |
| 377 | 377 | '#type' => 'submit', |
| 378 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
| 378 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
| 379 | 379 | '#suffix' => '</li>', |
| 380 | 380 | ); |
| 381 | 381 | $form['form control tabs'] = array( |
| 382 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
|
| 382 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', true)) . '</li>' |
|
| 383 | 383 | ); |
| 384 | 384 | } |
| 385 | 385 | else { |
| 386 | 386 | $form['description'] = array( |
| 387 | - '#prefix' => '<div class="form-item"><label>' . bts('Description', array(), NULL, 'boinc:team-description') . ':</label></div><div class="form-item">', |
|
| 387 | + '#prefix' => '<div class="form-item"><label>' . bts('Description', array(), null, 'boinc:team-description') . ':</label></div><div class="form-item">', |
|
| 388 | 388 | '#value' => $default['description'], |
| 389 | 389 | '#suffix' => '</div>', |
| 390 | 390 | ); |
| 391 | 391 | drupal_set_message( |
| 392 | 392 | bts('This is a BOINC-wide team. Changes can be made at the !site.', |
| 393 | - array('!site' => l(bts('BOINC-wide teams site', array(), NULL, 'boinc:link-to-BOINC-wide-teams-Website'), |
|
| 393 | + array('!site' => l(bts('BOINC-wide teams site', array(), null, 'boinc:link-to-BOINC-wide-teams-Website'), |
|
| 394 | 394 | 'http://boinc.berkeley.edu/teams/' |
| 395 | 395 | )), |
| 396 | - NULL, 'boinc:team-edit-warning-message'), |
|
| 396 | + null, 'boinc:team-edit-warning-message'), |
|
| 397 | 397 | 'warning'); |
| 398 | 398 | } |
| 399 | 399 | |
@@ -411,11 +411,11 @@ discard block |
||
| 411 | 411 | $name = $values['name']; |
| 412 | 412 | |
| 413 | 413 | if ($form_state['storage']['is_boinc_wide']) { |
| 414 | - form_set_error('none', bts('This team is managed by the BOINC-wide teams system and cannot be updated here.', array(), NULL, 'boinc:team-create/edit')); |
|
| 414 | + form_set_error('none', bts('This team is managed by the BOINC-wide teams system and cannot be updated here.', array(), null, 'boinc:team-create/edit')); |
|
| 415 | 415 | } |
| 416 | 416 | else { |
| 417 | 417 | if (!$name) { |
| 418 | - form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit')); |
|
| 418 | + form_set_error('name', bts('Team name is required.', array(), null, 'boinc:team-create/edit')); |
|
| 419 | 419 | } |
| 420 | 420 | else { |
| 421 | 421 | $team = node_load($form_state['storage']['team_id']); |
@@ -424,13 +424,13 @@ discard block |
||
| 424 | 424 | require_boinc('boinc_db'); |
| 425 | 425 | if (BoincTeam::lookup_name($name)) { |
| 426 | 426 | form_set_error('name', bts('A team named "@name" already exists.', |
| 427 | - array('@name' => $name), NULL, 'boinc:team-create/edit')); |
|
| 427 | + array('@name' => $name), null, 'boinc:team-create/edit')); |
|
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - if (!$values['type'] OR !isset($values['type_options'][$values['type']])) { |
|
| 433 | - form_set_error('type', bts('Please select a team type.', array(), NULL, 'boinc:team-create/edit')); |
|
| 432 | + if (!$values['type'] or !isset($values['type_options'][$values['type']])) { |
|
| 433 | + form_set_error('type', bts('Please select a team type.', array(), null, 'boinc:team-create/edit')); |
|
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | } |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | // Form elements |
| 523 | 523 | $form['username'] = array( |
| 524 | - '#title' => bts('Enter BOINC username', array(), NULL, 'boinc:team--add-admin'), |
|
| 524 | + '#title' => bts('Enter BOINC username', array(), null, 'boinc:team--add-admin'), |
|
| 525 | 525 | '#description' => bts('The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.'), |
| 526 | 526 | '#type' => 'textfield', |
| 527 | 527 | '#default_value' => $default['username'], |
@@ -536,11 +536,11 @@ discard block |
||
| 536 | 536 | $form['submit'] = array( |
| 537 | 537 | '#prefix' => '<li class="first tab">', |
| 538 | 538 | '#type' => 'submit', |
| 539 | - '#value' => bts('Add', array(), NULL, 'boinc:form-add'), |
|
| 539 | + '#value' => bts('Add', array(), null, 'boinc:form-add'), |
|
| 540 | 540 | '#suffix' => '</li>', |
| 541 | 541 | ); |
| 542 | 542 | $form['form control tabs'] = array( |
| 543 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
|
| 543 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', true)) . '</li>' |
|
| 544 | 544 | ); |
| 545 | 545 | |
| 546 | 546 | //$form['#redirect'] = "community/teams/{$team_id}"; |
@@ -558,18 +558,18 @@ discard block |
||
| 558 | 558 | $team = node_load($team_id); |
| 559 | 559 | |
| 560 | 560 | if (!$values['username']) { |
| 561 | - form_set_error('username', bts('BOINC username is required.', array(), NULL, 'boinc:team-add-admin')); |
|
| 561 | + form_set_error('username', bts('BOINC username is required.', array(), null, 'boinc:team-add-admin')); |
|
| 562 | 562 | } |
| 563 | 563 | else { |
| 564 | 564 | // Load user account associated with username |
| 565 | 565 | $account = boincuser_privatemsg_name_lookup($values['username']); |
| 566 | 566 | // Validate the account |
| 567 | - if ((!$account) OR ($account->team != $team_id)) { |
|
| 567 | + if ((!$account) or ($account->team != $team_id)) { |
|
| 568 | 568 | form_set_error('username', bts('There is no user on your team with name @username.', |
| 569 | 569 | array( |
| 570 | 570 | '@username' => $account->boincuser_name |
| 571 | 571 | ), |
| 572 | - NULL, 'boinc:team-add-admin')); |
|
| 572 | + null, 'boinc:team-add-admin')); |
|
| 573 | 573 | } |
| 574 | 574 | elseif (boincteam_is_founder($team_id, $account->uid)) { |
| 575 | 575 | form_set_error('username', bts('@user is the founder of @team! Team founder already have all admin privileges.', |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | '@user' => $account->boincuser_name, |
| 578 | 578 | '@team' => $team->title, |
| 579 | 579 | ), |
| 580 | - NULL, 'boinc:team-add-admin')); |
|
| 580 | + null, 'boinc:team-add-admin')); |
|
| 581 | 581 | } |
| 582 | 582 | elseif (boincteam_is_admin($team_id, $account->uid)) { |
| 583 | 583 | form_set_error('username', bts('@user is already an admin of @team.', |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | '@user' => $account->boincuser_name, |
| 586 | 586 | '@team' => $team->title, |
| 587 | 587 | ), |
| 588 | - NULL, 'boinc:team-add-admin')); |
|
| 588 | + null, 'boinc:team-add-admin')); |
|
| 589 | 589 | } |
| 590 | 590 | else { |
| 591 | 591 | $form_state['storage']['boincuser_id'] = $account->boincuser_id; |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | // Title |
| 655 | - $mytitle = bts('Send E-mail To All Team Members', array(), NULL, 'boinc:team-message-form'); |
|
| 655 | + $mytitle = bts('Send E-mail To All Team Members', array(), null, 'boinc:team-message-form'); |
|
| 656 | 656 | drupal_set_title($mytitle); |
| 657 | 657 | |
| 658 | 658 | $form['emailteam']['header'] = array( |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | ); |
| 664 | 664 | |
| 665 | 665 | $form['emailteam']['instructions'] = array( |
| 666 | - '#value' => bts('This will send an email to all team members. If a team member has opt-ed out of notification e-mails, they will not receive your message. At the bottom of your message, there will be a link allowing team members to send you a Direct Message. This link is added automatically, you do not need to add it below in the Message box. Your email address will not be shown to the recipients.', array(), NULL, 'boinc:team-message-form'), |
|
| 666 | + '#value' => bts('This will send an email to all team members. If a team member has opt-ed out of notification e-mails, they will not receive your message. At the bottom of your message, there will be a link allowing team members to send you a Direct Message. This link is added automatically, you do not need to add it below in the Message box. Your email address will not be shown to the recipients.', array(), null, 'boinc:team-message-form'), |
|
| 667 | 667 | '#weight' => '-8', |
| 668 | 668 | '#prefix' => "<div id='sendmessageteammembers-instructions'>", |
| 669 | 669 | '#suffix' => "</div>", |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | // Subject |
| 673 | 673 | $form['emailteam']['subject'] = array( |
| 674 | 674 | '#type' => 'textfield', |
| 675 | - '#title' => bts('Subject', array(), NULL, 'boinc:team-message-form'), |
|
| 675 | + '#title' => bts('Subject', array(), null, 'boinc:team-message-form'), |
|
| 676 | 676 | '#size' => 50, |
| 677 | 677 | '#maxlength' => 255, |
| 678 | 678 | '#default_value' => $subject, |
@@ -682,17 +682,17 @@ discard block |
||
| 682 | 682 | // Body |
| 683 | 683 | $form['emailteam']['body'] = array( |
| 684 | 684 | '#type' => 'textarea', |
| 685 | - '#title' => bts('Message', array(), NULL, 'boinc:team-message-form'), |
|
| 685 | + '#title' => bts('Message', array(), null, 'boinc:team-message-form'), |
|
| 686 | 686 | '#rows' => 8, |
| 687 | 687 | '#weight' => 0, |
| 688 | 688 | '#default_value' => $body, |
| 689 | - '#resizable' => TRUE, |
|
| 689 | + '#resizable' => true, |
|
| 690 | 690 | ); |
| 691 | 691 | |
| 692 | 692 | // checkbox for 'sent to self' |
| 693 | 693 | $form['emailteam']['selfsend'] = array( |
| 694 | 694 | '#type' => 'checkbox', |
| 695 | - '#title' => bts('Check this box if you wish to be sent a copy of your message to your email address.', array(), NULL, 'boinc:team-message-form'), |
|
| 695 | + '#title' => bts('Check this box if you wish to be sent a copy of your message to your email address.', array(), null, 'boinc:team-message-form'), |
|
| 696 | 696 | '#weight' => 10, |
| 697 | 697 | '#prefix' => '<div class="clearfix" id="confirm-checkbox">', |
| 698 | 698 | '#suffix' => '</div>', |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | |
| 715 | 715 | $form['emailteam']['submit'] = array( |
| 716 | 716 | '#type' => 'submit', |
| 717 | - '#value' => bts('Send message', array(), NULL, 'boinc:form-submit'), |
|
| 717 | + '#value' => bts('Send message', array(), null, 'boinc:form-submit'), |
|
| 718 | 718 | '#submit' => array('boincteam_sendmessagetoteam_submit'), |
| 719 | 719 | '#validate' => array('boincteam_sendmessagetoteam_validate'), |
| 720 | 720 | '#weight' => 1001, |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | '#suffix' => '</li>' |
| 723 | 723 | ); |
| 724 | 724 | |
| 725 | - $title = bts('Cancel', array(), NULL, 'boinc:form-cancel'); |
|
| 725 | + $title = bts('Cancel', array(), null, 'boinc:form-cancel'); |
|
| 726 | 726 | $url = "community/teams/{$team_id}"; |
| 727 | 727 | $form['emailteam']['cancel'] = array( |
| 728 | 728 | '#value' => l($title, $url, array('attributes' => array('id' => 'edit-cancel'))), |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | // Avoid subjects which only consist of a space as these can not be clicked. |
| 764 | 764 | $message['subject'] = trim($message['subject']); |
| 765 | 765 | |
| 766 | - $trimed_body = trim(truncate_utf8(strip_tags($message['body']), 50, TRUE, TRUE)); |
|
| 766 | + $trimed_body = trim(truncate_utf8(strip_tags($message['body']), 50, true, true)); |
|
| 767 | 767 | if (empty($message['subject']) && !empty($trimed_body)) { |
| 768 | 768 | $message['subject'] = $trimed_body; |
| 769 | 769 | $form_state['values']['subject'] = $message['subject']; |
@@ -773,21 +773,21 @@ discard block |
||
| 773 | 773 | $message['subject'] = trim($message['subject']); |
| 774 | 774 | if (empty($message['subject'])) { |
| 775 | 775 | form_set_error('subject', |
| 776 | - bts('Not allowed to send a message without subject', array(), NULL, 'boinc:team-message-form') |
|
| 776 | + bts('Not allowed to send a message without subject', array(), null, 'boinc:team-message-form') |
|
| 777 | 777 | ); |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | // Check body |
| 781 | - if ( ($message['body'] === NULL || $message['body'] === '') ) { |
|
| 781 | + if ( ($message['body'] === null || $message['body'] === '') ) { |
|
| 782 | 782 | form_set_error('body', |
| 783 | - bts('Not allowed to send an empty message.', array(), NULL, 'boinc:team-message-form') |
|
| 783 | + bts('Not allowed to send an empty message.', array(), null, 'boinc:team-message-form') |
|
| 784 | 784 | ); |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | // Check team id |
| 788 | 788 | if (empty($message['_team_id'])) { |
| 789 | 789 | form_set_error('team_id', |
| 790 | - bts('Error, no team_id supplied.', array(), NULL, 'boinc:team-message-form') |
|
| 790 | + bts('Error, no team_id supplied.', array(), null, 'boinc:team-message-form') |
|
| 791 | 791 | ); |
| 792 | 792 | } |
| 793 | 793 | |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | * The definition of the create team form |
| 15 | 15 | */ |
| 16 | 16 | function boincteam_create_form(&$form_state) { |
| 17 | - $form = array(); |
|
| 17 | + $form = array(); |
|
| 18 | 18 | |
| 19 | - $default = array( |
|
| 19 | + $default = array( |
|
| 20 | 20 | 'name' => '', |
| 21 | 21 | 'name_html' => '', |
| 22 | 22 | 'website' => '', |
@@ -24,105 +24,105 @@ discard block |
||
| 24 | 24 | 'country' => 0, |
| 25 | 25 | 'joinable' => TRUE, |
| 26 | 26 | 'description' => '', |
| 27 | - ); |
|
| 27 | + ); |
|
| 28 | 28 | |
| 29 | - // Standard option sets |
|
| 30 | - $form['boolean_options'] = array( |
|
| 29 | + // Standard option sets |
|
| 30 | + $form['boolean_options'] = array( |
|
| 31 | 31 | '#type' => 'value', |
| 32 | 32 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
| 33 | - ); |
|
| 33 | + ); |
|
| 34 | 34 | |
| 35 | - // Vocabulary based option sets |
|
| 36 | - $form['type_options'] = array( |
|
| 35 | + // Vocabulary based option sets |
|
| 36 | + $form['type_options'] = array( |
|
| 37 | 37 | '#type' => 'value', |
| 38 | 38 | '#value' => array(0 => bts('Choose type', array(), NULL, 'boinc:form-choose')) |
| 39 | - ); |
|
| 40 | - $vocabs = taxonomy_get_vocabularies(NULL); |
|
| 41 | - foreach ($vocabs as $vocab) { |
|
| 39 | + ); |
|
| 40 | + $vocabs = taxonomy_get_vocabularies(NULL); |
|
| 41 | + foreach ($vocabs as $vocab) { |
|
| 42 | 42 | switch ($vocab->name) { |
| 43 | 43 | case 'Teams': |
| 44 | 44 | $team_types = taxonomy_get_tree($vocab->vid); |
| 45 | - if (module_exists('internationalization')) { |
|
| 45 | + if (module_exists('internationalization')) { |
|
| 46 | 46 | $team_types = i18ntaxonomy_localize_terms($team_types); |
| 47 | - } |
|
| 48 | - foreach ($team_types as $team_type) { |
|
| 47 | + } |
|
| 48 | + foreach ($team_types as $team_type) { |
|
| 49 | 49 | $form['type_options']['#value'][$team_type->tid] = $team_type->name; |
| 50 | - } |
|
| 51 | - break; |
|
| 50 | + } |
|
| 51 | + break; |
|
| 52 | 52 | default: |
| 53 | 53 | } |
| 54 | - } |
|
| 55 | - $form['country_options'] = array( |
|
| 54 | + } |
|
| 55 | + $form['country_options'] = array( |
|
| 56 | 56 | '#type' => 'value', |
| 57 | 57 | '#value' => boinccore_get_country_list(), |
| 58 | - ); |
|
| 58 | + ); |
|
| 59 | 59 | |
| 60 | - // Form elements |
|
| 61 | - $form['name'] = array( |
|
| 60 | + // Form elements |
|
| 61 | + $form['name'] = array( |
|
| 62 | 62 | '#title' => bts('Team name', array(), NULL, 'boinc:team-create/edit'), |
| 63 | 63 | '#type' => 'textfield', |
| 64 | 64 | '#default_value' => $default['name'], |
| 65 | 65 | '#size' => 34, |
| 66 | 66 | '#description' => bts('Text only, no HTML tags', array(), NULL, 'boinc:team-form-help'), |
| 67 | - ); |
|
| 68 | - $form['name_html'] = array( |
|
| 67 | + ); |
|
| 68 | + $form['name_html'] = array( |
|
| 69 | 69 | '#title' => bts('Team name -- HTML version (optional)', array(), NULL, 'boinc:team-create/edit'), |
| 70 | 70 | '#type' => 'textfield', |
| 71 | 71 | '#default_value' => $default['name_html'], |
| 72 | 72 | '#size' => 34, |
| 73 | 73 | '#description' => bts('You may use limited HTML tags', array(), NULL, 'boinc:team-form-help'), |
| 74 | - ); |
|
| 75 | - $form['website'] = array( |
|
| 74 | + ); |
|
| 75 | + $form['website'] = array( |
|
| 76 | 76 | '#title' => bts('Team website (optional)', array(), NULL, 'boinc:team-create/edit'), |
| 77 | 77 | '#type' => 'textfield', |
| 78 | 78 | '#default_value' => $default['website'], |
| 79 | 79 | '#size' => 34, |
| 80 | 80 | '#description' => bts("Displayed on the team's page", array(), NULL, 'boinc:team-create/edit'), |
| 81 | - ); |
|
| 82 | - $form['type'] = array( |
|
| 81 | + ); |
|
| 82 | + $form['type'] = array( |
|
| 83 | 83 | '#title' => bts('Type of team', array(), NULL, 'boinc:team-create/edit'), |
| 84 | 84 | '#type' => 'select', |
| 85 | 85 | '#options' => $form['type_options']['#value'], |
| 86 | 86 | '#default_value' => $default['type'], |
| 87 | - ); |
|
| 88 | - $form['country'] = array( |
|
| 87 | + ); |
|
| 88 | + $form['country'] = array( |
|
| 89 | 89 | '#title' => bts('Country', array(), NULL, 'boinc:country-of-origin'), |
| 90 | 90 | '#type' => 'select', |
| 91 | 91 | '#options' => $form['country_options']['#value'], |
| 92 | 92 | '#default_value' => $default['country'], |
| 93 | - ); |
|
| 94 | - $form['joinable'] = array( |
|
| 93 | + ); |
|
| 94 | + $form['joinable'] = array( |
|
| 95 | 95 | '#title' => bts('Accept new members?', array(), NULL, 'boinc:team-create/edit'), |
| 96 | 96 | '#type' => 'radios', |
| 97 | 97 | '#options' => $form['boolean_options']['#value'], |
| 98 | 98 | '#attributes' => array('class' => 'fancy'), |
| 99 | 99 | '#default_value' => $default['joinable'], |
| 100 | 100 | '#size' => 34, |
| 101 | - ); |
|
| 102 | - $form['description'] = array( |
|
| 101 | + ); |
|
| 102 | + $form['description'] = array( |
|
| 103 | 103 | '#title' => bts('Description of team', array(), NULL, 'boinc:team-create/edit'), |
| 104 | 104 | '#type' => 'textarea', |
| 105 | 105 | '#default_value' => $default['description'], |
| 106 | 106 | '#size' => 5, |
| 107 | 107 | '#description' => NULL, |
| 108 | - ); |
|
| 109 | - $form['format'] = filter_form(); |
|
| 108 | + ); |
|
| 109 | + $form['format'] = filter_form(); |
|
| 110 | 110 | |
| 111 | - // Form control |
|
| 112 | - $form['form control tabs prefix'] = array( |
|
| 111 | + // Form control |
|
| 112 | + $form['form control tabs prefix'] = array( |
|
| 113 | 113 | '#value' => '<ul class="form-control tab-list">' |
| 114 | - ); |
|
| 115 | - $form['submit'] = array( |
|
| 114 | + ); |
|
| 115 | + $form['submit'] = array( |
|
| 116 | 116 | '#prefix' => '<li class="first tab">', |
| 117 | 117 | '#type' => 'submit', |
| 118 | 118 | '#value' => bts('Save team', array(), NULL, 'boinc:team-form-save'), |
| 119 | 119 | '#suffix' => '</li>', |
| 120 | - ); |
|
| 121 | - $form['form control tabs'] = array( |
|
| 120 | + ); |
|
| 121 | + $form['form control tabs'] = array( |
|
| 122 | 122 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
| 123 | - ); |
|
| 123 | + ); |
|
| 124 | 124 | |
| 125 | - return $form; |
|
| 125 | + return $form; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -130,41 +130,41 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | function boincteam_create_form_validate($form, &$form_state) { |
| 132 | 132 | |
| 133 | - $values = $form_state['values']; |
|
| 134 | - $name = $values['name']; |
|
| 133 | + $values = $form_state['values']; |
|
| 134 | + $name = $values['name']; |
|
| 135 | 135 | |
| 136 | - if (!$name) { |
|
| 136 | + if (!$name) { |
|
| 137 | 137 | form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit')); |
| 138 | - } |
|
| 139 | - else { |
|
| 138 | + } |
|
| 139 | + else { |
|
| 140 | 140 | require_boinc('boinc_db'); |
| 141 | 141 | if (BoincTeam::lookup_name($name)) { |
| 142 | - form_set_error('name', bts('A team named "@name" already exists.', |
|
| 142 | + form_set_error('name', bts('A team named "@name" already exists.', |
|
| 143 | 143 | array('@name' => $name), NULL, 'boinc:team-create/edit')); |
| 144 | 144 | } |
| 145 | - } |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - if (!$values['type'] OR !isset($values['type_options'][$values['type']])) { |
|
| 147 | + if (!$values['type'] OR !isset($values['type_options'][$values['type']])) { |
|
| 148 | 148 | form_set_error('type', bts('Please select a team type.', array(), NULL, 'boinc:team-create/edit')); |
| 149 | - } |
|
| 149 | + } |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * The create team submit handler |
| 154 | 154 | */ |
| 155 | 155 | function boincteam_create_form_submit($form, &$form_state) { |
| 156 | - global $user; |
|
| 157 | - $account = user_load($user->uid); |
|
| 158 | - $values = $form_state['values']; |
|
| 159 | - //drupal_set_message('<pre>' . print_r($values,true) . '</pre>'); |
|
| 156 | + global $user; |
|
| 157 | + $account = user_load($user->uid); |
|
| 158 | + $values = $form_state['values']; |
|
| 159 | + //drupal_set_message('<pre>' . print_r($values,true) . '</pre>'); |
|
| 160 | 160 | |
| 161 | - $input_format = !empty($values['format']) ? $values['format'] : 4; |
|
| 162 | - $values['description'] = check_markup($values['description'], $input_format); |
|
| 161 | + $input_format = !empty($values['format']) ? $values['format'] : 4; |
|
| 162 | + $values['description'] = check_markup($values['description'], $input_format); |
|
| 163 | 163 | |
| 164 | - // Create the team in the BOINC db |
|
| 164 | + // Create the team in the BOINC db |
|
| 165 | 165 | |
| 166 | - require_boinc(array('user','team')); |
|
| 167 | - $boinc_team = make_team( |
|
| 166 | + require_boinc(array('user','team')); |
|
| 167 | + $boinc_team = make_team( |
|
| 168 | 168 | $account->boincuser_id, |
| 169 | 169 | $values['name'], |
| 170 | 170 | $values['website'], |
@@ -172,27 +172,27 @@ discard block |
||
| 172 | 172 | $values['name_html'], |
| 173 | 173 | $values['description'], |
| 174 | 174 | $values['country'] |
| 175 | - ); |
|
| 175 | + ); |
|
| 176 | 176 | |
| 177 | - if ($boinc_team) { |
|
| 177 | + if ($boinc_team) { |
|
| 178 | 178 | $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
| 179 | 179 | user_join_team($boinc_team, $boinc_user); |
| 180 | - } |
|
| 181 | - else { |
|
| 180 | + } |
|
| 181 | + else { |
|
| 182 | 182 | drupal_set_message(t('Teams cannot be created at this time. The @project administrators have been notified.', array('@project' => PROJECT))); |
| 183 | 183 | rules_invoke_event('boincteam_create_team_error', $values['name'], variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 184 | 184 | watchdog('BOINC team', 'BOINC teams cannot be created for an unknown |
| 185 | 185 | reason.', 'error'); |
| 186 | 186 | return FALSE; |
| 187 | - } |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - // Create the team node in Drupal |
|
| 189 | + // Create the team node in Drupal |
|
| 190 | 190 | |
| 191 | - $teaser = node_teaser($values['description']); |
|
| 192 | - $created_time = time(); |
|
| 193 | - $input_format = variable_get('filter_default_format', 1); |
|
| 191 | + $teaser = node_teaser($values['description']); |
|
| 192 | + $created_time = time(); |
|
| 193 | + $input_format = variable_get('filter_default_format', 1); |
|
| 194 | 194 | |
| 195 | - $node = array( |
|
| 195 | + $node = array( |
|
| 196 | 196 | 'type' => 'team', |
| 197 | 197 | 'title' => $values['name'], |
| 198 | 198 | 'body' => $values['description'], |
@@ -206,21 +206,21 @@ discard block |
||
| 206 | 206 | 'moderate' => 0, |
| 207 | 207 | 'sticky' => 0, |
| 208 | 208 | 'format' => $input_format |
| 209 | - ); |
|
| 209 | + ); |
|
| 210 | 210 | |
| 211 | - // Use pathauto function, if available, to clean up the path |
|
| 212 | - if (module_exists('pathauto')) { |
|
| 211 | + // Use pathauto function, if available, to clean up the path |
|
| 212 | + if (module_exists('pathauto')) { |
|
| 213 | 213 | module_load_include('inc', 'pathauto', 'pathauto'); |
| 214 | 214 | $node['path'] = pathauto_cleanstring($values['name']); |
| 215 | - } |
|
| 216 | - else { |
|
| 215 | + } |
|
| 216 | + else { |
|
| 217 | 217 | drupal_set_message(t('Teams cannot be created at this time. The @project administrators have been notified.', array('@project' => PROJECT))); |
| 218 | 218 | rules_invoke_event('boincteam_create_team_nopathauto_error', $values['name'], variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 219 | 219 | watchdog('BOINC team', 'BOINC teams require the Pathauto module. Teams |
| 220 | 220 | cannot be created.', 'error'); |
| 221 | - } |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | - /* |
|
| 223 | + /* |
|
| 224 | 224 | // Add special organic group properties |
| 225 | 225 | $node['og_description'] = strip_tags($boincteam->description); |
| 226 | 226 | $node['og_selective'] = OG_OPEN; |
@@ -229,26 +229,26 @@ discard block |
||
| 229 | 229 | $node['og_private'] = 0; |
| 230 | 230 | */ |
| 231 | 231 | |
| 232 | - $node = (object) $node; // node_save requires an object form |
|
| 232 | + $node = (object) $node; // node_save requires an object form |
|
| 233 | 233 | |
| 234 | - /* |
|
| 234 | + /* |
|
| 235 | 235 | $node->field_description[]['value'] = $boincteam->description; |
| 236 | 236 | $node->field_url[]['value'] = $boincteam->url; |
| 237 | 237 | $node->field_country[]['value'] = $boincteam->country; |
| 238 | 238 | */ |
| 239 | 239 | |
| 240 | - $node->taxonomy[] = taxonomy_get_term($values['type']); |
|
| 240 | + $node->taxonomy[] = taxonomy_get_term($values['type']); |
|
| 241 | 241 | |
| 242 | - // Save the team node |
|
| 243 | - node_save($node); |
|
| 242 | + // Save the team node |
|
| 243 | + node_save($node); |
|
| 244 | 244 | |
| 245 | - // Save the team IDs to a BOINC <--> Drupal reference table. |
|
| 246 | - db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boinc_team->id, $node->nid); |
|
| 245 | + // Save the team IDs to a BOINC <--> Drupal reference table. |
|
| 246 | + db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boinc_team->id, $node->nid); |
|
| 247 | 247 | |
| 248 | - drupal_set_message(t('Team "@name" has been created.', |
|
| 248 | + drupal_set_message(t('Team "@name" has been created.', |
|
| 249 | 249 | array('@name' => $values['name']))); |
| 250 | 250 | |
| 251 | - $form_state['redirect'] = "community/teams/{$node->nid}"; |
|
| 251 | + $form_state['redirect'] = "community/teams/{$node->nid}"; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -259,17 +259,17 @@ discard block |
||
| 259 | 259 | * The definition of the edit team form |
| 260 | 260 | */ |
| 261 | 261 | function boincteam_edit_form(&$form_state, $team_id) { |
| 262 | - $form = array(); |
|
| 262 | + $form = array(); |
|
| 263 | 263 | |
| 264 | - $team = node_load($team_id); |
|
| 265 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id)); |
|
| 264 | + $team = node_load($team_id); |
|
| 265 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id)); |
|
| 266 | 266 | |
| 267 | - $is_boinc_wide = ($boincteam->seti_id > 0) ? TRUE : FALSE; |
|
| 267 | + $is_boinc_wide = ($boincteam->seti_id > 0) ? TRUE : FALSE; |
|
| 268 | 268 | |
| 269 | - $form_state['storage']['team_id'] = $team_id; |
|
| 270 | - $form_state['storage']['is_boinc_wide'] = $is_boinc_wide; |
|
| 269 | + $form_state['storage']['team_id'] = $team_id; |
|
| 270 | + $form_state['storage']['is_boinc_wide'] = $is_boinc_wide; |
|
| 271 | 271 | |
| 272 | - $default = array( |
|
| 272 | + $default = array( |
|
| 273 | 273 | 'name' => $boincteam->name, |
| 274 | 274 | 'name_html' => $boincteam->name_html, |
| 275 | 275 | 'website' => $boincteam->url, |
@@ -277,79 +277,79 @@ discard block |
||
| 277 | 277 | 'country' => $boincteam->country, |
| 278 | 278 | 'joinable' => $boincteam->joinable, |
| 279 | 279 | 'description' => $boincteam->description, |
| 280 | - ); |
|
| 280 | + ); |
|
| 281 | 281 | |
| 282 | - // Standard option sets |
|
| 283 | - $form['boolean_options'] = array( |
|
| 282 | + // Standard option sets |
|
| 283 | + $form['boolean_options'] = array( |
|
| 284 | 284 | '#type' => 'value', |
| 285 | 285 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
| 286 | - ); |
|
| 286 | + ); |
|
| 287 | 287 | |
| 288 | - // Vocabulary based option sets |
|
| 289 | - $form['type_options'] = array( |
|
| 288 | + // Vocabulary based option sets |
|
| 289 | + $form['type_options'] = array( |
|
| 290 | 290 | '#type' => 'value', |
| 291 | 291 | '#value' => array(0 => bts('Choose type', array(), NULL, 'boinc:form-choose')) |
| 292 | - ); |
|
| 293 | - $vocabs = taxonomy_get_vocabularies(NULL); |
|
| 294 | - foreach ($vocabs as $vocab) { |
|
| 292 | + ); |
|
| 293 | + $vocabs = taxonomy_get_vocabularies(NULL); |
|
| 294 | + foreach ($vocabs as $vocab) { |
|
| 295 | 295 | switch ($vocab->name) { |
| 296 | 296 | case 'Teams': |
| 297 | 297 | $team_types = taxonomy_get_tree($vocab->vid); |
| 298 | - if (module_exists('internationalization')) { |
|
| 298 | + if (module_exists('internationalization')) { |
|
| 299 | 299 | $team_types = i18ntaxonomy_localize_terms($team_types); |
| 300 | - } |
|
| 301 | - foreach ($team_types as $team_type) { |
|
| 300 | + } |
|
| 301 | + foreach ($team_types as $team_type) { |
|
| 302 | 302 | $form['type_options']['#value'][$team_type->tid] = $team_type->name; |
| 303 | - } |
|
| 304 | - break; |
|
| 303 | + } |
|
| 304 | + break; |
|
| 305 | 305 | default: |
| 306 | 306 | } |
| 307 | - } |
|
| 308 | - $form['country_options'] = array( |
|
| 307 | + } |
|
| 308 | + $form['country_options'] = array( |
|
| 309 | 309 | '#type' => 'value', |
| 310 | 310 | '#value' => boinccore_get_country_list(), |
| 311 | - ); |
|
| 311 | + ); |
|
| 312 | 312 | |
| 313 | - // Form elements |
|
| 314 | - $form['name'] = array( |
|
| 313 | + // Form elements |
|
| 314 | + $form['name'] = array( |
|
| 315 | 315 | '#title' => bts('Team name', array(), NULL, 'boinc:team-create/edit'), |
| 316 | 316 | '#type' => 'textfield', |
| 317 | 317 | '#default_value' => $default['name'], |
| 318 | 318 | '#size' => 34, |
| 319 | 319 | '#description' => bts('Text only, no HTML tags', array(), NULL, 'boinc:team-form-help'), |
| 320 | 320 | '#disabled' => $is_boinc_wide, |
| 321 | - ); |
|
| 322 | - $form['name_html'] = array( |
|
| 321 | + ); |
|
| 322 | + $form['name_html'] = array( |
|
| 323 | 323 | '#title' => bts('Team name -- HTML version (optional)', array(), NULL, 'boinc:team-create/edit'), |
| 324 | 324 | '#type' => 'textfield', |
| 325 | 325 | '#default_value' => $default['name_html'], |
| 326 | 326 | '#size' => 34, |
| 327 | 327 | '#description' => bts('You may use limited HTML tags', array(), NULL, 'boinc:team-form-help'), |
| 328 | 328 | '#disabled' => $is_boinc_wide, |
| 329 | - ); |
|
| 330 | - $form['website'] = array( |
|
| 329 | + ); |
|
| 330 | + $form['website'] = array( |
|
| 331 | 331 | '#title' => bts('Team website (optional)', array(), NULL, 'boinc:team-create/edit'), |
| 332 | 332 | '#type' => 'textfield', |
| 333 | 333 | '#default_value' => $default['website'], |
| 334 | 334 | '#size' => 34, |
| 335 | 335 | '#description' => bts("Displayed on the team's page", array(), NULL, 'boinc:team-create/edit'), |
| 336 | 336 | '#disabled' => $is_boinc_wide, |
| 337 | - ); |
|
| 338 | - $form['type'] = array( |
|
| 337 | + ); |
|
| 338 | + $form['type'] = array( |
|
| 339 | 339 | '#title' => bts('Type of team', array(), NULL, 'boinc:team-create/edit'), |
| 340 | 340 | '#type' => 'select', |
| 341 | 341 | '#options' => $form['type_options']['#value'], |
| 342 | 342 | '#default_value' => $default['type'], |
| 343 | 343 | '#disabled' => $is_boinc_wide, |
| 344 | - ); |
|
| 345 | - $form['country'] = array( |
|
| 344 | + ); |
|
| 345 | + $form['country'] = array( |
|
| 346 | 346 | '#title' => bts('Country', array(), NULL, 'boinc:country-of-origin'), |
| 347 | 347 | '#type' => 'select', |
| 348 | 348 | '#options' => $form['country_options']['#value'], |
| 349 | 349 | '#default_value' => $default['country'], |
| 350 | 350 | '#disabled' => $is_boinc_wide, |
| 351 | - ); |
|
| 352 | - $form['joinable'] = array( |
|
| 351 | + ); |
|
| 352 | + $form['joinable'] = array( |
|
| 353 | 353 | '#title' => bts('Accept new members?', array(), NULL, 'boinc:team-create/edit'), |
| 354 | 354 | '#type' => 'radios', |
| 355 | 355 | '#options' => $form['boolean_options']['#value'], |
@@ -357,49 +357,49 @@ discard block |
||
| 357 | 357 | '#default_value' => $default['joinable'], |
| 358 | 358 | '#size' => 34, |
| 359 | 359 | '#disabled' => $is_boinc_wide, |
| 360 | - ); |
|
| 361 | - if (!$is_boinc_wide) { |
|
| 360 | + ); |
|
| 361 | + if (!$is_boinc_wide) { |
|
| 362 | 362 | $form['description'] = array( |
| 363 | - '#title' => bts('Description of team', array(), NULL, 'boinc:team-create/edit'), |
|
| 364 | - '#type' => 'textarea', |
|
| 365 | - '#default_value' => $default['description'], |
|
| 366 | - '#size' => 5, |
|
| 367 | - '#description' => NULL, |
|
| 363 | + '#title' => bts('Description of team', array(), NULL, 'boinc:team-create/edit'), |
|
| 364 | + '#type' => 'textarea', |
|
| 365 | + '#default_value' => $default['description'], |
|
| 366 | + '#size' => 5, |
|
| 367 | + '#description' => NULL, |
|
| 368 | 368 | ); |
| 369 | 369 | $form['format'] = filter_form(); |
| 370 | 370 | |
| 371 | 371 | // Form control |
| 372 | 372 | $form['form control tabs prefix'] = array( |
| 373 | - '#value' => '<ul class="form-control tab-list">' |
|
| 373 | + '#value' => '<ul class="form-control tab-list">' |
|
| 374 | 374 | ); |
| 375 | 375 | $form['submit'] = array( |
| 376 | - '#prefix' => '<li class="first tab">', |
|
| 377 | - '#type' => 'submit', |
|
| 378 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
| 379 | - '#suffix' => '</li>', |
|
| 376 | + '#prefix' => '<li class="first tab">', |
|
| 377 | + '#type' => 'submit', |
|
| 378 | + '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
| 379 | + '#suffix' => '</li>', |
|
| 380 | 380 | ); |
| 381 | 381 | $form['form control tabs'] = array( |
| 382 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
|
| 382 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
|
| 383 | 383 | ); |
| 384 | - } |
|
| 385 | - else { |
|
| 384 | + } |
|
| 385 | + else { |
|
| 386 | 386 | $form['description'] = array( |
| 387 | - '#prefix' => '<div class="form-item"><label>' . bts('Description', array(), NULL, 'boinc:team-description') . ':</label></div><div class="form-item">', |
|
| 388 | - '#value' => $default['description'], |
|
| 389 | - '#suffix' => '</div>', |
|
| 387 | + '#prefix' => '<div class="form-item"><label>' . bts('Description', array(), NULL, 'boinc:team-description') . ':</label></div><div class="form-item">', |
|
| 388 | + '#value' => $default['description'], |
|
| 389 | + '#suffix' => '</div>', |
|
| 390 | 390 | ); |
| 391 | 391 | drupal_set_message( |
| 392 | - bts('This is a BOINC-wide team. Changes can be made at the !site.', |
|
| 392 | + bts('This is a BOINC-wide team. Changes can be made at the !site.', |
|
| 393 | 393 | array('!site' => l(bts('BOINC-wide teams site', array(), NULL, 'boinc:link-to-BOINC-wide-teams-Website'), |
| 394 | - 'http://boinc.berkeley.edu/teams/' |
|
| 394 | + 'http://boinc.berkeley.edu/teams/' |
|
| 395 | 395 | )), |
| 396 | 396 | NULL, 'boinc:team-edit-warning-message'), |
| 397 | - 'warning'); |
|
| 398 | - } |
|
| 397 | + 'warning'); |
|
| 398 | + } |
|
| 399 | 399 | |
| 400 | - $form['#redirect'] = "community/teams/{$team_id}"; |
|
| 400 | + $form['#redirect'] = "community/teams/{$team_id}"; |
|
| 401 | 401 | |
| 402 | - return $form; |
|
| 402 | + return $form; |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | /** |
@@ -407,32 +407,32 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | function boincteam_edit_form_validate($form, &$form_state) { |
| 409 | 409 | |
| 410 | - $values = $form_state['values']; |
|
| 411 | - $name = $values['name']; |
|
| 410 | + $values = $form_state['values']; |
|
| 411 | + $name = $values['name']; |
|
| 412 | 412 | |
| 413 | - if ($form_state['storage']['is_boinc_wide']) { |
|
| 413 | + if ($form_state['storage']['is_boinc_wide']) { |
|
| 414 | 414 | form_set_error('none', bts('This team is managed by the BOINC-wide teams system and cannot be updated here.', array(), NULL, 'boinc:team-create/edit')); |
| 415 | - } |
|
| 416 | - else { |
|
| 415 | + } |
|
| 416 | + else { |
|
| 417 | 417 | if (!$name) { |
| 418 | - form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit')); |
|
| 418 | + form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit')); |
|
| 419 | 419 | } |
| 420 | 420 | else { |
| 421 | - $team = node_load($form_state['storage']['team_id']); |
|
| 422 | - if ($name != $team->title) { |
|
| 421 | + $team = node_load($form_state['storage']['team_id']); |
|
| 422 | + if ($name != $team->title) { |
|
| 423 | 423 | // If changing the name ("title" in Drupal terms), check that the new name is available |
| 424 | 424 | require_boinc('boinc_db'); |
| 425 | 425 | if (BoincTeam::lookup_name($name)) { |
| 426 | - form_set_error('name', bts('A team named "@name" already exists.', |
|
| 426 | + form_set_error('name', bts('A team named "@name" already exists.', |
|
| 427 | 427 | array('@name' => $name), NULL, 'boinc:team-create/edit')); |
| 428 | 428 | } |
| 429 | - } |
|
| 429 | + } |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | if (!$values['type'] OR !isset($values['type_options'][$values['type']])) { |
| 433 | - form_set_error('type', bts('Please select a team type.', array(), NULL, 'boinc:team-create/edit')); |
|
| 433 | + form_set_error('type', bts('Please select a team type.', array(), NULL, 'boinc:team-create/edit')); |
|
| 434 | + } |
|
| 434 | 435 | } |
| 435 | - } |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
@@ -440,18 +440,18 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | function boincteam_edit_form_submit($form, &$form_state) { |
| 442 | 442 | |
| 443 | - $team_id = $form_state['storage']['team_id']; |
|
| 444 | - $values = $form_state['values']; |
|
| 443 | + $team_id = $form_state['storage']['team_id']; |
|
| 444 | + $values = $form_state['values']; |
|
| 445 | 445 | |
| 446 | - $team = node_load($team_id); |
|
| 447 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 446 | + $team = node_load($team_id); |
|
| 447 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 448 | 448 | |
| 449 | - $input_format = !empty($values['format']) ? $values['format'] : 4; |
|
| 450 | - $values['description'] = check_markup($values['description'], $input_format); |
|
| 449 | + $input_format = !empty($values['format']) ? $values['format'] : 4; |
|
| 450 | + $values['description'] = check_markup($values['description'], $input_format); |
|
| 451 | 451 | |
| 452 | - // Update the team in the BOINC db |
|
| 453 | - db_set_active('boinc_rw'); |
|
| 454 | - db_query(" |
|
| 452 | + // Update the team in the BOINC db |
|
| 453 | + db_set_active('boinc_rw'); |
|
| 454 | + db_query(" |
|
| 455 | 455 | UPDATE {team} SET |
| 456 | 456 | name = '%s', |
| 457 | 457 | name_lc = '%s', |
@@ -471,32 +471,32 @@ discard block |
||
| 471 | 471 | $values['country'], |
| 472 | 472 | $values['joinable'], |
| 473 | 473 | $boincteam_id |
| 474 | - ); |
|
| 475 | - db_set_active('default'); |
|
| 474 | + ); |
|
| 475 | + db_set_active('default'); |
|
| 476 | 476 | |
| 477 | - // Update the team node in Drupal |
|
| 477 | + // Update the team node in Drupal |
|
| 478 | 478 | |
| 479 | - $team->title = $values['name']; |
|
| 480 | - $team->body = $values['description']; |
|
| 481 | - $team->teaser = node_teaser($values['description']); |
|
| 479 | + $team->title = $values['name']; |
|
| 480 | + $team->body = $values['description']; |
|
| 481 | + $team->teaser = node_teaser($values['description']); |
|
| 482 | 482 | |
| 483 | - /* |
|
| 483 | + /* |
|
| 484 | 484 | $node->field_description[]['value'] = $boincteam->description; |
| 485 | 485 | $node->field_url[]['value'] = $boincteam->url; |
| 486 | 486 | $node->field_country[]['value'] = $boincteam->country; |
| 487 | 487 | */ |
| 488 | 488 | |
| 489 | - // Replace any existing taxonomy with the new one |
|
| 490 | - $team->taxonomy = array(taxonomy_get_term($values['type'])); |
|
| 489 | + // Replace any existing taxonomy with the new one |
|
| 490 | + $team->taxonomy = array(taxonomy_get_term($values['type'])); |
|
| 491 | 491 | |
| 492 | - // Save the team node |
|
| 493 | - node_save($team); |
|
| 492 | + // Save the team node |
|
| 493 | + node_save($team); |
|
| 494 | 494 | |
| 495 | - drupal_set_message(t('Details for "@team" have been updated.', |
|
| 495 | + drupal_set_message(t('Details for "@team" have been updated.', |
|
| 496 | 496 | array('@team' => $values['name']))); |
| 497 | 497 | |
| 498 | - // The storage variable quietly kills redirection for some reason... unset it |
|
| 499 | - unset($form_state['storage']); |
|
| 498 | + // The storage variable quietly kills redirection for some reason... unset it |
|
| 499 | + unset($form_state['storage']); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | |
@@ -508,44 +508,44 @@ discard block |
||
| 508 | 508 | * The definition of the add team admin form |
| 509 | 509 | */ |
| 510 | 510 | function boincteam_add_admin_form(&$form_state, $team_id) { |
| 511 | - $form = array(); |
|
| 511 | + $form = array(); |
|
| 512 | 512 | |
| 513 | - $team = node_load($team_id); |
|
| 514 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id)); |
|
| 513 | + $team = node_load($team_id); |
|
| 514 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id)); |
|
| 515 | 515 | |
| 516 | - $form_state['storage']['team_id'] = $team_id; |
|
| 516 | + $form_state['storage']['team_id'] = $team_id; |
|
| 517 | 517 | |
| 518 | - $default = array( |
|
| 518 | + $default = array( |
|
| 519 | 519 | 'username' => '', |
| 520 | - ); |
|
| 520 | + ); |
|
| 521 | 521 | |
| 522 | - // Form elements |
|
| 523 | - $form['username'] = array( |
|
| 522 | + // Form elements |
|
| 523 | + $form['username'] = array( |
|
| 524 | 524 | '#title' => bts('Enter BOINC username', array(), NULL, 'boinc:team--add-admin'), |
| 525 | 525 | '#description' => bts('The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.'), |
| 526 | 526 | '#type' => 'textfield', |
| 527 | 527 | '#default_value' => $default['username'], |
| 528 | 528 | '#size' => 34, |
| 529 | 529 | '#autocomplete_path' => "community/teams/${team_id}/user-name-autocomplete", |
| 530 | - ); |
|
| 530 | + ); |
|
| 531 | 531 | |
| 532 | - // Form control |
|
| 533 | - $form['form control tabs prefix'] = array( |
|
| 532 | + // Form control |
|
| 533 | + $form['form control tabs prefix'] = array( |
|
| 534 | 534 | '#value' => '<ul class="form-control tab-list">' |
| 535 | - ); |
|
| 536 | - $form['submit'] = array( |
|
| 535 | + ); |
|
| 536 | + $form['submit'] = array( |
|
| 537 | 537 | '#prefix' => '<li class="first tab">', |
| 538 | 538 | '#type' => 'submit', |
| 539 | 539 | '#value' => bts('Add', array(), NULL, 'boinc:form-add'), |
| 540 | 540 | '#suffix' => '</li>', |
| 541 | - ); |
|
| 542 | - $form['form control tabs'] = array( |
|
| 541 | + ); |
|
| 542 | + $form['form control tabs'] = array( |
|
| 543 | 543 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
| 544 | - ); |
|
| 544 | + ); |
|
| 545 | 545 | |
| 546 | - //$form['#redirect'] = "community/teams/{$team_id}"; |
|
| 546 | + //$form['#redirect'] = "community/teams/{$team_id}"; |
|
| 547 | 547 | |
| 548 | - return $form; |
|
| 548 | + return $form; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | /** |
@@ -553,45 +553,45 @@ discard block |
||
| 553 | 553 | */ |
| 554 | 554 | function boincteam_add_admin_form_validate($form, &$form_state) { |
| 555 | 555 | |
| 556 | - $team_id = $form_state['storage']['team_id']; |
|
| 557 | - $values = $form_state['values']; |
|
| 558 | - $team = node_load($team_id); |
|
| 556 | + $team_id = $form_state['storage']['team_id']; |
|
| 557 | + $values = $form_state['values']; |
|
| 558 | + $team = node_load($team_id); |
|
| 559 | 559 | |
| 560 | - if (!$values['username']) { |
|
| 560 | + if (!$values['username']) { |
|
| 561 | 561 | form_set_error('username', bts('BOINC username is required.', array(), NULL, 'boinc:team-add-admin')); |
| 562 | - } |
|
| 563 | - else { |
|
| 562 | + } |
|
| 563 | + else { |
|
| 564 | 564 | // Load user account associated with username |
| 565 | 565 | $account = boincuser_privatemsg_name_lookup($values['username']); |
| 566 | 566 | // Validate the account |
| 567 | 567 | if ((!$account) OR ($account->team != $team_id)) { |
| 568 | - form_set_error('username', bts('There is no user on your team with name @username.', |
|
| 568 | + form_set_error('username', bts('There is no user on your team with name @username.', |
|
| 569 | 569 | array( |
| 570 | - '@username' => $account->boincuser_name |
|
| 570 | + '@username' => $account->boincuser_name |
|
| 571 | 571 | ), |
| 572 | - NULL, 'boinc:team-add-admin')); |
|
| 572 | + NULL, 'boinc:team-add-admin')); |
|
| 573 | 573 | } |
| 574 | 574 | elseif (boincteam_is_founder($team_id, $account->uid)) { |
| 575 | - form_set_error('username', bts('@user is the founder of @team! Team founder already have all admin privileges.', |
|
| 575 | + form_set_error('username', bts('@user is the founder of @team! Team founder already have all admin privileges.', |
|
| 576 | 576 | array( |
| 577 | - '@user' => $account->boincuser_name, |
|
| 578 | - '@team' => $team->title, |
|
| 577 | + '@user' => $account->boincuser_name, |
|
| 578 | + '@team' => $team->title, |
|
| 579 | 579 | ), |
| 580 | 580 | NULL, 'boinc:team-add-admin')); |
| 581 | 581 | } |
| 582 | 582 | elseif (boincteam_is_admin($team_id, $account->uid)) { |
| 583 | - form_set_error('username', bts('@user is already an admin of @team.', |
|
| 583 | + form_set_error('username', bts('@user is already an admin of @team.', |
|
| 584 | 584 | array( |
| 585 | - '@user' => $account->boincuser_name, |
|
| 586 | - '@team' => $team->title, |
|
| 585 | + '@user' => $account->boincuser_name, |
|
| 586 | + '@team' => $team->title, |
|
| 587 | 587 | ), |
| 588 | 588 | NULL, 'boinc:team-add-admin')); |
| 589 | 589 | } |
| 590 | 590 | else { |
| 591 | - $form_state['storage']['boincuser_id'] = $account->boincuser_id; |
|
| 592 | - $form_state['storage']['boincuser_name'] = $account->boincuser_name; |
|
| 591 | + $form_state['storage']['boincuser_id'] = $account->boincuser_id; |
|
| 592 | + $form_state['storage']['boincuser_name'] = $account->boincuser_name; |
|
| 593 | + } |
|
| 593 | 594 | } |
| 594 | - } |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | /** |
@@ -599,17 +599,17 @@ discard block |
||
| 599 | 599 | */ |
| 600 | 600 | function boincteam_add_admin_form_submit($form, &$form_state) { |
| 601 | 601 | |
| 602 | - $team_id = $form_state['storage']['team_id']; |
|
| 603 | - $boincuser_id = $form_state['storage']['boincuser_id']; |
|
| 604 | - $user_name = $form_state['storage']['boincuser_name']; |
|
| 605 | - $values = $form_state['values']; |
|
| 602 | + $team_id = $form_state['storage']['team_id']; |
|
| 603 | + $boincuser_id = $form_state['storage']['boincuser_id']; |
|
| 604 | + $user_name = $form_state['storage']['boincuser_name']; |
|
| 605 | + $values = $form_state['values']; |
|
| 606 | 606 | |
| 607 | - $team = node_load($team_id); |
|
| 608 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 607 | + $team = node_load($team_id); |
|
| 608 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 609 | 609 | |
| 610 | - // Update the team in the BOINC db |
|
| 611 | - db_set_active('boinc_rw'); |
|
| 612 | - db_query(" |
|
| 610 | + // Update the team in the BOINC db |
|
| 611 | + db_set_active('boinc_rw'); |
|
| 612 | + db_query(" |
|
| 613 | 613 | INSERT INTO {team_admin} SET |
| 614 | 614 | teamid = '%d', |
| 615 | 615 | userid = '%d', |
@@ -617,17 +617,17 @@ discard block |
||
| 617 | 617 | $boincteam_id, |
| 618 | 618 | $boincuser_id, |
| 619 | 619 | time() |
| 620 | - ); |
|
| 621 | - db_set_active('default'); |
|
| 620 | + ); |
|
| 621 | + db_set_active('default'); |
|
| 622 | 622 | |
| 623 | - // Could assign a role in Drupal here, as needed |
|
| 623 | + // Could assign a role in Drupal here, as needed |
|
| 624 | 624 | |
| 625 | 625 | |
| 626 | - drupal_set_message(t('@user has been added as an admin.', |
|
| 626 | + drupal_set_message(t('@user has been added as an admin.', |
|
| 627 | 627 | array('@user' => $user_name))); |
| 628 | 628 | |
| 629 | - // The storage variable quietly kills redirection for some reason... unset it |
|
| 630 | - unset($form_state['storage']); |
|
| 629 | + // The storage variable quietly kills redirection for some reason... unset it |
|
| 630 | + unset($form_state['storage']); |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -639,80 +639,80 @@ discard block |
||
| 639 | 639 | * Send all team members an email message function |
| 640 | 640 | */ |
| 641 | 641 | function boincteam_sendmessagetoteam(&$form_state, $team_id) { |
| 642 | - global $user; |
|
| 643 | - $form = array(); |
|
| 642 | + global $user; |
|
| 643 | + $form = array(); |
|
| 644 | 644 | |
| 645 | - if (isset($form_state['values'])) { |
|
| 645 | + if (isset($form_state['values'])) { |
|
| 646 | 646 | $subject = $form_state['values']['subject']; |
| 647 | 647 | $body = $form_state['values']['body']; |
| 648 | - } |
|
| 649 | - else { |
|
| 648 | + } |
|
| 649 | + else { |
|
| 650 | 650 | $subject = ''; |
| 651 | 651 | $body = ''; |
| 652 | - } |
|
| 652 | + } |
|
| 653 | 653 | |
| 654 | - // Title |
|
| 655 | - $mytitle = bts('Send E-mail To All Team Members', array(), NULL, 'boinc:team-message-form'); |
|
| 656 | - drupal_set_title($mytitle); |
|
| 654 | + // Title |
|
| 655 | + $mytitle = bts('Send E-mail To All Team Members', array(), NULL, 'boinc:team-message-form'); |
|
| 656 | + drupal_set_title($mytitle); |
|
| 657 | 657 | |
| 658 | - $form['emailteam']['header'] = array( |
|
| 658 | + $form['emailteam']['header'] = array( |
|
| 659 | 659 | '#value' => '<h1>' . $mytitle . '</h1>', |
| 660 | 660 | '#weight' => '-10', |
| 661 | 661 | '#prefix' => "<div id='sendmessageteammembers-header'>", |
| 662 | 662 | '#suffix' => "</div>", |
| 663 | - ); |
|
| 663 | + ); |
|
| 664 | 664 | |
| 665 | - $form['emailteam']['instructions'] = array( |
|
| 665 | + $form['emailteam']['instructions'] = array( |
|
| 666 | 666 | '#value' => bts('This will send an email to all team members. If a team member has opt-ed out of notification e-mails, they will not receive your message. At the bottom of your message, there will be a link allowing team members to send you a Direct Message. This link is added automatically, you do not need to add it below in the Message box. Your email address will not be shown to the recipients.', array(), NULL, 'boinc:team-message-form'), |
| 667 | 667 | '#weight' => '-8', |
| 668 | 668 | '#prefix' => "<div id='sendmessageteammembers-instructions'>", |
| 669 | 669 | '#suffix' => "</div>", |
| 670 | - ); |
|
| 670 | + ); |
|
| 671 | 671 | |
| 672 | - // Subject |
|
| 673 | - $form['emailteam']['subject'] = array( |
|
| 672 | + // Subject |
|
| 673 | + $form['emailteam']['subject'] = array( |
|
| 674 | 674 | '#type' => 'textfield', |
| 675 | 675 | '#title' => bts('Subject', array(), NULL, 'boinc:team-message-form'), |
| 676 | 676 | '#size' => 50, |
| 677 | 677 | '#maxlength' => 255, |
| 678 | 678 | '#default_value' => $subject, |
| 679 | 679 | '#weight' => -5, |
| 680 | - ); |
|
| 680 | + ); |
|
| 681 | 681 | |
| 682 | - // Body |
|
| 683 | - $form['emailteam']['body'] = array( |
|
| 682 | + // Body |
|
| 683 | + $form['emailteam']['body'] = array( |
|
| 684 | 684 | '#type' => 'textarea', |
| 685 | 685 | '#title' => bts('Message', array(), NULL, 'boinc:team-message-form'), |
| 686 | 686 | '#rows' => 8, |
| 687 | 687 | '#weight' => 0, |
| 688 | 688 | '#default_value' => $body, |
| 689 | 689 | '#resizable' => TRUE, |
| 690 | - ); |
|
| 690 | + ); |
|
| 691 | 691 | |
| 692 | - // checkbox for 'sent to self' |
|
| 693 | - $form['emailteam']['selfsend'] = array( |
|
| 692 | + // checkbox for 'sent to self' |
|
| 693 | + $form['emailteam']['selfsend'] = array( |
|
| 694 | 694 | '#type' => 'checkbox', |
| 695 | 695 | '#title' => bts('Check this box if you wish to be sent a copy of your message to your email address.', array(), NULL, 'boinc:team-message-form'), |
| 696 | 696 | '#weight' => 10, |
| 697 | 697 | '#prefix' => '<div class="clearfix" id="confirm-checkbox">', |
| 698 | 698 | '#suffix' => '</div>', |
| 699 | - ); |
|
| 699 | + ); |
|
| 700 | 700 | |
| 701 | - // Add a captcha to form |
|
| 702 | - if (module_exists('captcha')) { |
|
| 701 | + // Add a captcha to form |
|
| 702 | + if (module_exists('captcha')) { |
|
| 703 | 703 | $form['register_captcha'] = array( |
| 704 | 704 | '#type' => 'captcha', |
| 705 | 705 | '#weight' => 1000, |
| 706 | 706 | ); |
| 707 | - } |
|
| 707 | + } |
|
| 708 | 708 | |
| 709 | - // form buttons |
|
| 710 | - $form['emailteam']['form control tabs prefix'] = array( |
|
| 709 | + // form buttons |
|
| 710 | + $form['emailteam']['form control tabs prefix'] = array( |
|
| 711 | 711 | '#value' => '<ul class="form-control tab-list">', |
| 712 | 712 | '#weight' => 1000, |
| 713 | - ); |
|
| 713 | + ); |
|
| 714 | 714 | |
| 715 | - $form['emailteam']['submit'] = array( |
|
| 715 | + $form['emailteam']['submit'] = array( |
|
| 716 | 716 | '#type' => 'submit', |
| 717 | 717 | '#value' => bts('Send message', array(), NULL, 'boinc:form-submit'), |
| 718 | 718 | '#submit' => array('boincteam_sendmessagetoteam_submit'), |
@@ -720,133 +720,133 @@ discard block |
||
| 720 | 720 | '#weight' => 1001, |
| 721 | 721 | '#prefix' => '<li class="first tab">', |
| 722 | 722 | '#suffix' => '</li>' |
| 723 | - ); |
|
| 723 | + ); |
|
| 724 | 724 | |
| 725 | - $title = bts('Cancel', array(), NULL, 'boinc:form-cancel'); |
|
| 726 | - $url = "community/teams/{$team_id}"; |
|
| 727 | - $form['emailteam']['cancel'] = array( |
|
| 725 | + $title = bts('Cancel', array(), NULL, 'boinc:form-cancel'); |
|
| 726 | + $url = "community/teams/{$team_id}"; |
|
| 727 | + $form['emailteam']['cancel'] = array( |
|
| 728 | 728 | '#value' => l($title, $url, array('attributes' => array('id' => 'edit-cancel'))), |
| 729 | 729 | '#weight' => 1005, |
| 730 | 730 | '#prefix' => '<li class="tab">', |
| 731 | 731 | '#suffix' => '</li>' |
| 732 | - ); |
|
| 732 | + ); |
|
| 733 | 733 | |
| 734 | - $form['emailteam']['form control tabs suffix'] = array( |
|
| 734 | + $form['emailteam']['form control tabs suffix'] = array( |
|
| 735 | 735 | '#value' => '</ul>', |
| 736 | 736 | '#weight' => 1010, |
| 737 | - ); |
|
| 737 | + ); |
|
| 738 | 738 | |
| 739 | - // Add team id information to form_state |
|
| 740 | - $form['_team_id'] = array( |
|
| 739 | + // Add team id information to form_state |
|
| 740 | + $form['_team_id'] = array( |
|
| 741 | 741 | '#type' => 'value', |
| 742 | 742 | '#value' => $team_id, |
| 743 | - ); |
|
| 743 | + ); |
|
| 744 | 744 | |
| 745 | - // Add sender user object to form_state |
|
| 746 | - $form['_senderuid'] = array( |
|
| 745 | + // Add sender user object to form_state |
|
| 746 | + $form['_senderuid'] = array( |
|
| 747 | 747 | '#type' => 'value', |
| 748 | 748 | '#value' => $user->uid, |
| 749 | - ); |
|
| 749 | + ); |
|
| 750 | 750 | |
| 751 | - // redirect after sending message |
|
| 752 | - $form['#redirect'] = "community/teams/{$team_id}"; |
|
| 751 | + // redirect after sending message |
|
| 752 | + $form['#redirect'] = "community/teams/{$team_id}"; |
|
| 753 | 753 | |
| 754 | - return $form; |
|
| 754 | + return $form; |
|
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | /** |
| 758 | 758 | * Send all team members validation handler |
| 759 | 759 | */ |
| 760 | 760 | function boincteam_sendmessagetoteam_validate($form, &$form_state) { |
| 761 | - $message = $form_state['values']; |
|
| 762 | - $message['timestamp'] = time(); |
|
| 763 | - // Avoid subjects which only consist of a space as these can not be clicked. |
|
| 764 | - $message['subject'] = trim($message['subject']); |
|
| 761 | + $message = $form_state['values']; |
|
| 762 | + $message['timestamp'] = time(); |
|
| 763 | + // Avoid subjects which only consist of a space as these can not be clicked. |
|
| 764 | + $message['subject'] = trim($message['subject']); |
|
| 765 | 765 | |
| 766 | - $trimed_body = trim(truncate_utf8(strip_tags($message['body']), 50, TRUE, TRUE)); |
|
| 767 | - if (empty($message['subject']) && !empty($trimed_body)) { |
|
| 766 | + $trimed_body = trim(truncate_utf8(strip_tags($message['body']), 50, TRUE, TRUE)); |
|
| 767 | + if (empty($message['subject']) && !empty($trimed_body)) { |
|
| 768 | 768 | $message['subject'] = $trimed_body; |
| 769 | 769 | $form_state['values']['subject'] = $message['subject']; |
| 770 | - } |
|
| 770 | + } |
|
| 771 | 771 | |
| 772 | - // Check subject line |
|
| 773 | - $message['subject'] = trim($message['subject']); |
|
| 774 | - if (empty($message['subject'])) { |
|
| 772 | + // Check subject line |
|
| 773 | + $message['subject'] = trim($message['subject']); |
|
| 774 | + if (empty($message['subject'])) { |
|
| 775 | 775 | form_set_error('subject', |
| 776 | - bts('Not allowed to send a message without subject', array(), NULL, 'boinc:team-message-form') |
|
| 776 | + bts('Not allowed to send a message without subject', array(), NULL, 'boinc:team-message-form') |
|
| 777 | 777 | ); |
| 778 | - } |
|
| 778 | + } |
|
| 779 | 779 | |
| 780 | - // Check body |
|
| 781 | - if ( ($message['body'] === NULL || $message['body'] === '') ) { |
|
| 780 | + // Check body |
|
| 781 | + if ( ($message['body'] === NULL || $message['body'] === '') ) { |
|
| 782 | 782 | form_set_error('body', |
| 783 | - bts('Not allowed to send an empty message.', array(), NULL, 'boinc:team-message-form') |
|
| 783 | + bts('Not allowed to send an empty message.', array(), NULL, 'boinc:team-message-form') |
|
| 784 | 784 | ); |
| 785 | - } |
|
| 785 | + } |
|
| 786 | 786 | |
| 787 | - // Check team id |
|
| 788 | - if (empty($message['_team_id'])) { |
|
| 787 | + // Check team id |
|
| 788 | + if (empty($message['_team_id'])) { |
|
| 789 | 789 | form_set_error('team_id', |
| 790 | - bts('Error, no team_id supplied.', array(), NULL, 'boinc:team-message-form') |
|
| 790 | + bts('Error, no team_id supplied.', array(), NULL, 'boinc:team-message-form') |
|
| 791 | 791 | ); |
| 792 | - } |
|
| 792 | + } |
|
| 793 | 793 | |
| 794 | - $form_state['validated_built_message'] = $message; |
|
| 794 | + $form_state['validated_built_message'] = $message; |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
| 798 | 798 | * Send all team members submit handler |
| 799 | 799 | */ |
| 800 | 800 | function boincteam_sendmessagetoteam_submit($form, &$form_state) { |
| 801 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
| 802 | - global $base_url; |
|
| 803 | - global $base_path; |
|
| 804 | - |
|
| 805 | - $suid = $form_state['values']['_senderuid']; |
|
| 806 | - $account = user_load(array('uid' => $suid )); |
|
| 807 | - $site_url = $base_url . $base_path . "messages/new/" . $suid; |
|
| 808 | - |
|
| 809 | - // Form is validated, now send to all team members. Lookup boinc |
|
| 810 | - // id of all team members, and then use user_load() to load user |
|
| 811 | - // object. Send message using email. |
|
| 812 | - // |
|
| 813 | - $boinc_id = boincteam_lookup_id($form_state['values']['_team_id']); |
|
| 814 | - // Email addresses, with those who have opt-ed out of notification |
|
| 815 | - // emails removed. |
|
| 816 | - $member_emails = _boincteam_emails($boinc_id); |
|
| 817 | - // Remove sender's email address, unless selfsend is true. |
|
| 818 | - if ( !$form_state['values']['selfsend'] ) { |
|
| 801 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
| 802 | + global $base_url; |
|
| 803 | + global $base_path; |
|
| 804 | + |
|
| 805 | + $suid = $form_state['values']['_senderuid']; |
|
| 806 | + $account = user_load(array('uid' => $suid )); |
|
| 807 | + $site_url = $base_url . $base_path . "messages/new/" . $suid; |
|
| 808 | + |
|
| 809 | + // Form is validated, now send to all team members. Lookup boinc |
|
| 810 | + // id of all team members, and then use user_load() to load user |
|
| 811 | + // object. Send message using email. |
|
| 812 | + // |
|
| 813 | + $boinc_id = boincteam_lookup_id($form_state['values']['_team_id']); |
|
| 814 | + // Email addresses, with those who have opt-ed out of notification |
|
| 815 | + // emails removed. |
|
| 816 | + $member_emails = _boincteam_emails($boinc_id); |
|
| 817 | + // Remove sender's email address, unless selfsend is true. |
|
| 818 | + if ( !$form_state['values']['selfsend'] ) { |
|
| 819 | 819 | $pos = array_search($account->mail, $member_emails); |
| 820 | 820 | unset($member_emails[$pos]); |
| 821 | - } |
|
| 821 | + } |
|
| 822 | 822 | |
| 823 | - // Add link at bottom of body |
|
| 824 | - $mybody = $form_state['validated_built_message']['body']; |
|
| 825 | - $mybody .= "\n\n" |
|
| 826 | - . "To reply to the sender using a Direct Message (DM), please use this link:\n" |
|
| 827 | - . "${site_url}"; |
|
| 823 | + // Add link at bottom of body |
|
| 824 | + $mybody = $form_state['validated_built_message']['body']; |
|
| 825 | + $mybody .= "\n\n" |
|
| 826 | + . "To reply to the sender using a Direct Message (DM), please use this link:\n" |
|
| 827 | + . "${site_url}"; |
|
| 828 | 828 | |
| 829 | - // Transform HTML body into plain text |
|
| 830 | - $mybody = drupal_html_to_text($mybody); |
|
| 829 | + // Transform HTML body into plain text |
|
| 830 | + $mybody = drupal_html_to_text($mybody); |
|
| 831 | 831 | |
| 832 | - $emailsettings = array( |
|
| 832 | + $emailsettings = array( |
|
| 833 | 833 | 'from' => '', |
| 834 | 834 | 'to' => "webmaster@{$base_url}", |
| 835 | 835 | 'boincteam_headers' => array( |
| 836 | - 'Bcc' => implode(', ', $member_emails), |
|
| 836 | + 'Bcc' => implode(', ', $member_emails), |
|
| 837 | 837 | ), |
| 838 | 838 | 'subject' => $form_state['validated_built_message']['subject'], |
| 839 | 839 | 'message' => $mybody, |
| 840 | - ); |
|
| 841 | - rules_action_mail($emailsettings); |
|
| 840 | + ); |
|
| 841 | + rules_action_mail($emailsettings); |
|
| 842 | 842 | |
| 843 | - $om = bts( |
|
| 843 | + $om = bts( |
|
| 844 | 844 | 'Sent your email message to !number team members.', |
| 845 | 845 | array( '!number' => count($member_emails) ), |
| 846 | 846 | 'NULL', |
| 847 | 847 | 'boinc:team-message-sent' |
| 848 | - ); |
|
| 849 | - drupal_set_message($om, 'info'); |
|
| 848 | + ); |
|
| 849 | + drupal_set_message($om, 'info'); |
|
| 850 | 850 | |
| 851 | - $form_state['redirect'] = "community/teams/{$form_state['values']['_team_id']}"; |
|
| 851 | + $form_state['redirect'] = "community/teams/{$form_state['values']['_team_id']}"; |
|
| 852 | 852 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | // Call our custom authentication function to check for an existing BOINC user |
| 36 | 36 | if (!boincuser_login_authenticate($form_state['values'])) { |
| 37 | 37 | // Authentication failed; set an error accordingly |
| 38 | - form_set_error('name', bts('Sorry, unrecognized email address or password.', array(), NULL, 'boinc:forgot-password') . ' ' . l(bts('Have you forgotten your password?', array(), NULL, 'boinc:forgot-password'), 'user/password')); |
|
| 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 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 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 | } |
@@ -394,14 +394,14 @@ discard block |
||
| 394 | 394 | // set email address lower-case |
| 395 | 395 | $edit['mail'] = strtolower($edit['mail']); |
| 396 | 396 | |
| 397 | - $boinc_user_already_exists = ( BoincUser::lookup_email_addr($edit['mail']) || BoincUser::lookup_prev_email_addr($edit['mail']) ); |
|
| 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 | 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 | - $duration = 86400 * 7; |
|
| 404 | - if ( (($boinc_user->email_addr_change_time + $duration) > time()) and (!(user_access('administer users'))) ) { |
|
| 403 | + $duration = 86400*7; |
|
| 404 | + if ((($boinc_user->email_addr_change_time + $duration) > time()) and (!(user_access('administer users')))) { |
|
| 405 | 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( |
@@ -422,11 +422,11 @@ discard block |
||
| 422 | 422 | unset($_SESSION['reset_pass']); |
| 423 | 423 | } |
| 424 | 424 | else { |
| 425 | - $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
|
| 425 | + $given_hash = md5($edit['current_pass'].strtolower($account->mail)); |
|
| 426 | 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 | 428 | } |
| 429 | - elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
| 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 | |
@@ -489,29 +489,29 @@ discard block |
||
| 489 | 489 | $project_domain = $headers['Host']; |
| 490 | 490 | $form['heading'] = array( |
| 491 | 491 | '#type' => 'markup', |
| 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>' |
|
| 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 | 493 | ); |
| 494 | 494 | $form['instructions'] = array( |
| 495 | 495 | '#type' => 'markup', |
| 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>' . |
|
| 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 | 515 | '</p>' |
| 516 | 516 | ); |
| 517 | 517 | $form['authenticator'] = array( |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | '#weight' => 1002, |
| 537 | 537 | ); |
| 538 | 538 | $form['form control tabs'] = array( |
| 539 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/password') . '</li>', |
|
| 539 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/password').'</li>', |
|
| 540 | 540 | '#weight' => 1003, |
| 541 | 541 | ); |
| 542 | 542 | $form['form control tabs suffix'] = array( |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | '#weight' => 1002, |
| 600 | 600 | ); |
| 601 | 601 | $form['form control tabs'] = array( |
| 602 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
|
| 602 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}").'</li>', |
|
| 603 | 603 | '#weight' => 1003, |
| 604 | 604 | ); |
| 605 | 605 | $form['form control tabs suffix'] = array( |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | '#weight' => 1002, |
| 651 | 651 | ); |
| 652 | 652 | $form['form control tabs'] = array( |
| 653 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
|
| 653 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}").'</li>', |
|
| 654 | 654 | '#weight' => 1003, |
| 655 | 655 | ); |
| 656 | 656 | $form['form control tabs suffix'] = array( |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | $uid = $form_state['storage']['ban_user_uid']; |
| 668 | 668 | $reason = $form_state['values']['reason']; |
| 669 | 669 | $duration = $form_state['values']['duration']; |
| 670 | - if ($duration) $duration = $duration * 24*60*60; |
|
| 670 | + if ($duration) $duration = $duration*24*60*60; |
|
| 671 | 671 | boincuser_moderate_user_ban($uid, $reason, $duration); |
| 672 | 672 | } |
| 673 | 673 | |
@@ -694,10 +694,10 @@ discard block |
||
| 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 | 699 | $form = array(); |
| 700 | - drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); |
|
| 700 | + drupal_add_js(drupal_get_path('module', 'boincuser').'/boincuser.js'); |
|
| 701 | 701 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 702 | 702 | |
| 703 | 703 | // Fieldset to hold all of the form as a container |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | |
| 711 | 711 | $form['termsofuse']['title1'] = array( |
| 712 | 712 | '#weight' => -12, |
| 713 | - '#value' => '<h2>' . bts( variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:termsofuse-form' ) . '</h2>', |
|
| 713 | + '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:termsofuse-form').'</h2>', |
|
| 714 | 714 | '#prefix' => '<div id="register-title1">', |
| 715 | 715 | '#suffix' => '</div>', |
| 716 | 716 | ); |
@@ -745,12 +745,12 @@ discard block |
||
| 745 | 745 | '#suffix' => '</li>', |
| 746 | 746 | ); |
| 747 | 747 | $form['form control tabs'] = array( |
| 748 | - '#value' => '<li class="tab">' . l(bts('NO - LOGOUT', array(), NULL, 'boinc:form-cancel'), '/logout') . '</li>', |
|
| 748 | + '#value' => '<li class="tab">'.l(bts('NO - LOGOUT', array(), NULL, 'boinc:form-cancel'), '/logout').'</li>', |
|
| 749 | 749 | ); |
| 750 | 750 | if (module_exists('boincuser_delete')) { |
| 751 | - $deletelink = '/user/' . $user->uid . '/delete'; |
|
| 751 | + $deletelink = '/user/'.$user->uid.'/delete'; |
|
| 752 | 752 | $form['deleteaccount'] = array( |
| 753 | - '#value' => '<li class="tab">' . l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink) . '</li>', |
|
| 753 | + '#value' => '<li class="tab">'.l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink).'</li>', |
|
| 754 | 754 | ); |
| 755 | 755 | } |
| 756 | 756 | |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 844 | 844 | $form['buttons']['submit']['#weight'] = 1002; |
| 845 | 845 | $form['buttons']['cancel'] = array( |
| 846 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit') . '</li>', |
|
| 846 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit').'</li>', |
|
| 847 | 847 | '#weight' => 1005, |
| 848 | 848 | ); |
| 849 | 849 | $form['buttons']['form control tabs suffix'] = array( |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | |
| 888 | 888 | // Set new password based on previous email address and entered |
| 889 | 889 | // password. |
| 890 | - $new_passwd_hash = password_hash( md5($form_state['values']['pass'].$pem), PASSWORD_DEFAULT); |
|
| 890 | + $new_passwd_hash = password_hash(md5($form_state['values']['pass'].$pem), PASSWORD_DEFAULT); |
|
| 891 | 891 | |
| 892 | 892 | $boinc_user->update("email_addr='${pem}', previous_email_addr='', email_addr_change_time=0, passwd_hash='${new_passwd_hash}'"); |
| 893 | 893 | |
@@ -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,113 +98,113 @@ 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']['termsofuse']['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 | rules_invoke_event('boincuser_change_email_error', $lower_email_addr, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 119 | 119 | form_set_error('mail', |
| 120 | - bts('An account already exists for @email. The @project administrators have been notified.', |
|
| 120 | + bts('An account already exists for @email. The @project administrators have been notified.', |
|
| 121 | 121 | array( |
| 122 | - '@email' => $lower_email_addr, |
|
| 123 | - '@project' => variable_get('site_name', 'Drupal-BOINC') |
|
| 122 | + '@email' => $lower_email_addr, |
|
| 123 | + '@project' => variable_get('site_name', 'Drupal-BOINC') |
|
| 124 | 124 | ), NULL, 'boinc:register-new-user') |
| 125 | 125 | ); |
| 126 | - } |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - // Check for an existing BOINC user |
|
| 129 | - // This is somewhat redundent as Drupal will also check if the email |
|
| 130 | - // is a duplicate. However, in the case where there is no Drupal |
|
| 131 | - // account, but a BOINC account exists with this email, the check |
|
| 132 | - // will fail. |
|
| 133 | - $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
|
| 134 | - if ($boinc_user) { |
|
| 128 | + // Check for an existing BOINC user |
|
| 129 | + // This is somewhat redundent as Drupal will also check if the email |
|
| 130 | + // is a duplicate. However, in the case where there is no Drupal |
|
| 131 | + // account, but a BOINC account exists with this email, the check |
|
| 132 | + // will fail. |
|
| 133 | + $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
|
| 134 | + if ($boinc_user) { |
|
| 135 | 135 | // User already exists |
| 136 | 136 | 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')); |
| 137 | 137 | return false; |
| 138 | - } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - // Check Drupal name is not a duplicate, and create a proper drupal |
|
| 141 | - // name from the boinc username. |
|
| 142 | - $form_state['values']['name'] = create_proper_drupalname($form_state['values']['boincuser_name']); |
|
| 140 | + // Check Drupal name is not a duplicate, and create a proper drupal |
|
| 141 | + // name from the boinc username. |
|
| 142 | + $form_state['values']['name'] = create_proper_drupalname($form_state['values']['boincuser_name']); |
|
| 143 | 143 | |
| 144 | - return true; |
|
| 144 | + return true; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * Create BOINC account |
| 149 | 149 | */ |
| 150 | 150 | function boincuser_register_make_user($params) { |
| 151 | - // Include BOINC user library |
|
| 152 | - require_boinc('user_util'); |
|
| 153 | - // Create the BOINC user |
|
| 154 | - $boinc_user = make_user($params['email_addr'], $params['name'], $params['passwd_hash'], $params['country'], $params['postal_code']); |
|
| 155 | - return $boinc_user; |
|
| 151 | + // Include BOINC user library |
|
| 152 | + require_boinc('user_util'); |
|
| 153 | + // Create the BOINC user |
|
| 154 | + $boinc_user = make_user($params['email_addr'], $params['name'], $params['passwd_hash'], $params['country'], $params['postal_code']); |
|
| 155 | + return $boinc_user; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * Create Drupal account from existing BOINC account |
| 160 | 160 | */ |
| 161 | 161 | function boincuser_register_make_drupal_user($boinc_user) { |
| 162 | - $account = null; |
|
| 163 | - if (is_numeric($boinc_user)) { |
|
| 162 | + $account = null; |
|
| 163 | + if (is_numeric($boinc_user)) { |
|
| 164 | 164 | $boinc_user = boincuser_load($boinc_user); |
| 165 | - } |
|
| 166 | - if ($boinc_user) { |
|
| 165 | + } |
|
| 166 | + if ($boinc_user) { |
|
| 167 | 167 | $account = boincuser_create_drupal_user($boinc_user); |
| 168 | 168 | if ($account) { |
| 169 | - boincuser_create_drupal_profile($account, $boinc_user); |
|
| 169 | + boincuser_create_drupal_profile($account, $boinc_user); |
|
| 170 | + } |
|
| 170 | 171 | } |
| 171 | - } |
|
| 172 | - return $account; |
|
| 172 | + return $account; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | function boincuser_create_drupal_user($boinc_user) { |
| 176 | - require_boinc('forum_db'); |
|
| 177 | - BoincForumPrefs::lookup($boinc_user); |
|
| 178 | - $account = NULL; |
|
| 179 | - $module = 'boincuser'; |
|
| 176 | + require_boinc('forum_db'); |
|
| 177 | + BoincForumPrefs::lookup($boinc_user); |
|
| 178 | + $account = NULL; |
|
| 179 | + $module = 'boincuser'; |
|
| 180 | 180 | |
| 181 | - // Verify that this account has not already been imported |
|
| 182 | - $already_imported = db_result(db_query(' |
|
| 181 | + // Verify that this account has not already been imported |
|
| 182 | + $already_imported = db_result(db_query(' |
|
| 183 | 183 | SELECT COUNT(*) FROM {boincuser} WHERE boinc_id = %d', |
| 184 | 184 | $boinc_user->id) |
| 185 | - ); |
|
| 186 | - if ($already_imported) { |
|
| 185 | + ); |
|
| 186 | + if ($already_imported) { |
|
| 187 | 187 | return NULL; |
| 188 | - } |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | - // Email is limited to 64 characters... |
|
| 191 | - $boinc_email = substr($boinc_user->email_addr, 0, 64); |
|
| 190 | + // Email is limited to 64 characters... |
|
| 191 | + $boinc_email = substr($boinc_user->email_addr, 0, 64); |
|
| 192 | 192 | |
| 193 | - // Email should be unique |
|
| 194 | - $already_imported = db_result(db_query(" |
|
| 193 | + // Email should be unique |
|
| 194 | + $already_imported = db_result(db_query(" |
|
| 195 | 195 | SELECT COUNT(*) FROM {users} WHERE mail = '%s'", |
| 196 | 196 | $boinc_email) |
| 197 | - ); |
|
| 198 | - if ($already_imported) { |
|
| 197 | + ); |
|
| 198 | + if ($already_imported) { |
|
| 199 | 199 | drupal_set_message(t('An account for @email already exists', array('@email' => $boinc_email)), 'warning'); |
| 200 | 200 | watchdog('boincimport', 'An account for @email already exists', array('@email' => $boinc_email), WATCHDOG_WARNING); |
| 201 | 201 | return NULL; |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - // Make sure name is unique |
|
| 205 | - $unique_name = create_proper_drupalname($boinc_user->name); |
|
| 204 | + // Make sure name is unique |
|
| 205 | + $unique_name = create_proper_drupalname($boinc_user->name); |
|
| 206 | 206 | |
| 207 | - $userinfo = array( |
|
| 207 | + $userinfo = array( |
|
| 208 | 208 | 'name' => $unique_name, |
| 209 | 209 | 'pass' => $boinc_user->passwd_hash, |
| 210 | 210 | 'mail' => $boinc_email, |
@@ -214,126 +214,126 @@ discard block |
||
| 214 | 214 | 'status' => 1, |
| 215 | 215 | "authname_{$module}" => $boinc_email, |
| 216 | 216 | 'access' => time() |
| 217 | - ); |
|
| 217 | + ); |
|
| 218 | 218 | |
| 219 | - $in_penalty = ($boinc_user->prefs->banished_until > time()); |
|
| 219 | + $in_penalty = ($boinc_user->prefs->banished_until > time()); |
|
| 220 | 220 | |
| 221 | - // Add user to community member role (if no current penalty) |
|
| 222 | - if (!$in_penalty) { |
|
| 221 | + // Add user to community member role (if no current penalty) |
|
| 222 | + if (!$in_penalty) { |
|
| 223 | 223 | $community_role = array_search('community member', user_roles(true)); |
| 224 | 224 | $userinfo['roles'] = array( |
| 225 | - $community_role => '' |
|
| 225 | + $community_role => '' |
|
| 226 | 226 | ); |
| 227 | - } |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - // Mark account as imported so a BOINC account is not created on Insert (i.e. user_save) |
|
| 230 | - $_SESSION['importedUser'] = true; |
|
| 231 | - $account = user_save('', $userinfo); |
|
| 229 | + // Mark account as imported so a BOINC account is not created on Insert (i.e. user_save) |
|
| 230 | + $_SESSION['importedUser'] = true; |
|
| 231 | + $account = user_save('', $userinfo); |
|
| 232 | 232 | |
| 233 | - // Drupal overrides the original registration date, so update to the correct date |
|
| 234 | - $account = user_save($account, array('created' => $userinfo['created'])); |
|
| 233 | + // Drupal overrides the original registration date, so update to the correct date |
|
| 234 | + $account = user_save($account, array('created' => $userinfo['created'])); |
|
| 235 | 235 | |
| 236 | - // Terminate if an error occured during user_save(). |
|
| 237 | - if (!$account) { |
|
| 236 | + // Terminate if an error occured during user_save(). |
|
| 237 | + if (!$account) { |
|
| 238 | 238 | drupal_set_message(t("Error saving user account."), 'error'); |
| 239 | 239 | return NULL; |
| 240 | - } |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - // Cross reference the Drupal and BOINC accounts |
|
| 243 | - boincuser_account_cross_reference($account->uid, $boinc_user->id); |
|
| 242 | + // Cross reference the Drupal and BOINC accounts |
|
| 243 | + boincuser_account_cross_reference($account->uid, $boinc_user->id); |
|
| 244 | 244 | |
| 245 | - if ($in_penalty) { |
|
| 245 | + if ($in_penalty) { |
|
| 246 | 246 | // Import the timestamp of when the penalty period will be over |
| 247 | 247 | $boincuser_record = array( |
| 248 | - 'uid' => $account->uid, |
|
| 249 | - 'penalty_expiration' => $boinc_user->prefs->banished_until, |
|
| 248 | + 'uid' => $account->uid, |
|
| 249 | + 'penalty_expiration' => $boinc_user->prefs->banished_until, |
|
| 250 | 250 | ); |
| 251 | 251 | drupal_write_record('boincuser', $boincuser_record, 'uid'); |
| 252 | - } |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | - return $account; |
|
| 254 | + return $account; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | function boincuser_create_drupal_profile($account, $boinc_user) { |
| 258 | 258 | |
| 259 | - require_boinc('forum_db'); |
|
| 260 | - BoincForumPrefs::lookup($boinc_user); |
|
| 259 | + require_boinc('forum_db'); |
|
| 260 | + BoincForumPrefs::lookup($boinc_user); |
|
| 261 | 261 | |
| 262 | - $image_dir = boinc_get_path('user_image'); |
|
| 262 | + $image_dir = boinc_get_path('user_image'); |
|
| 263 | 263 | |
| 264 | - // Automatically create a content profile |
|
| 265 | - $now = time(); |
|
| 266 | - $profile_background = null; |
|
| 267 | - $profile_opinions = null; |
|
| 268 | - $profile_image = null; |
|
| 269 | - $avatar_image = null; |
|
| 270 | - $profile_approved = NULL; |
|
| 264 | + // Automatically create a content profile |
|
| 265 | + $now = time(); |
|
| 266 | + $profile_background = null; |
|
| 267 | + $profile_opinions = null; |
|
| 268 | + $profile_image = null; |
|
| 269 | + $avatar_image = null; |
|
| 270 | + $profile_approved = NULL; |
|
| 271 | 271 | |
| 272 | - // Load the BOINC profile, if available |
|
| 273 | - if ($boinc_user->has_profile) { |
|
| 272 | + // Load the BOINC profile, if available |
|
| 273 | + if ($boinc_user->has_profile) { |
|
| 274 | 274 | $boinc_profile = BoincProfile::lookup("userid={$boinc_user->id}"); |
| 275 | 275 | $profile_background = $boinc_profile->response1; |
| 276 | 276 | $profile_opinions = $boinc_profile->response2; |
| 277 | 277 | if ($boinc_profile->has_picture) { |
| 278 | - // Load picture; load validators; determine where to store it in Drupal |
|
| 279 | - $image_path = "{$image_dir}/{$boinc_user->id}.jpg"; |
|
| 280 | - $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', TRUE); |
|
| 281 | - // If the user does not have a different image as an avatar, use this one |
|
| 282 | - if (!$boinc_user->prefs->avatar) { |
|
| 278 | + // Load picture; load validators; determine where to store it in Drupal |
|
| 279 | + $image_path = "{$image_dir}/{$boinc_user->id}.jpg"; |
|
| 280 | + $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', TRUE); |
|
| 281 | + // If the user does not have a different image as an avatar, use this one |
|
| 282 | + if (!$boinc_user->prefs->avatar) { |
|
| 283 | 283 | $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
| 284 | - } |
|
| 284 | + } |
|
| 285 | 285 | } |
| 286 | 286 | if ($boinc_user->prefs->avatar) { |
| 287 | - $image_path = "{$image_dir}/{$boinc_user->id}_avatar.jpg"; |
|
| 288 | - $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
| 287 | + $image_path = "{$image_dir}/{$boinc_user->id}_avatar.jpg"; |
|
| 288 | + $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
| 289 | 289 | } |
| 290 | 290 | $profile_approved = $boinc_profile->verification ? TRUE : FALSE; |
| 291 | - } |
|
| 292 | - $default_input_format = db_result(db_query(" |
|
| 291 | + } |
|
| 292 | + $default_input_format = db_result(db_query(" |
|
| 293 | 293 | SELECT format FROM {filter_formats} WHERE name = '%s'", 'Rich text')); |
| 294 | - if (!$default_input_format) $default_input_format = 1; |
|
| 295 | - |
|
| 296 | - // Populate the profile object |
|
| 297 | - $profile_node = new stdClass(); |
|
| 298 | - $profile_node->title = $boinc_user->name; |
|
| 299 | - $profile_node->uid = $account->uid; |
|
| 300 | - $profile_node->body = ''; |
|
| 301 | - $profile_node->type = 'profile'; |
|
| 302 | - $profile_node->created = $now; |
|
| 303 | - $profile_node->changed = $now; |
|
| 304 | - $profile_node->status = 1; |
|
| 305 | - $profile_node->promote = 0; |
|
| 306 | - $profile_node->sticky = 0; |
|
| 307 | - $profile_node->format = $default_input_format; |
|
| 308 | - $profile_node->name = $account->name; // Set to link profile to account uid! |
|
| 309 | - $profile_node->field_country[]['value'] = $boinc_user->country; |
|
| 310 | - $profile_node->field_zip[]['value'] = $boinc_user->postal_code; |
|
| 311 | - $profile_node->field_url[]['value'] = $boinc_user->url; |
|
| 312 | - $profile_node->field_background[]['value'] = $profile_background; |
|
| 313 | - $profile_node->field_opinions[]['value'] = $profile_opinions; |
|
| 314 | - $profile_node->field_image[] = $avatar_image; |
|
| 315 | - $profile_node->field_profile_image[] = $profile_image; |
|
| 316 | - |
|
| 317 | - // Save the profile object to the database |
|
| 318 | - // This will automatically set the author uid if node->name has been set |
|
| 319 | - $profile_node = node_submit($profile_node); |
|
| 320 | - node_save($profile_node); |
|
| 321 | - |
|
| 322 | - // Mark profile as approved if it has already been vetted somehow |
|
| 323 | - if ($profile_approved OR !$boinc_user->has_profile) { |
|
| 294 | + if (!$default_input_format) $default_input_format = 1; |
|
| 295 | + |
|
| 296 | + // Populate the profile object |
|
| 297 | + $profile_node = new stdClass(); |
|
| 298 | + $profile_node->title = $boinc_user->name; |
|
| 299 | + $profile_node->uid = $account->uid; |
|
| 300 | + $profile_node->body = ''; |
|
| 301 | + $profile_node->type = 'profile'; |
|
| 302 | + $profile_node->created = $now; |
|
| 303 | + $profile_node->changed = $now; |
|
| 304 | + $profile_node->status = 1; |
|
| 305 | + $profile_node->promote = 0; |
|
| 306 | + $profile_node->sticky = 0; |
|
| 307 | + $profile_node->format = $default_input_format; |
|
| 308 | + $profile_node->name = $account->name; // Set to link profile to account uid! |
|
| 309 | + $profile_node->field_country[]['value'] = $boinc_user->country; |
|
| 310 | + $profile_node->field_zip[]['value'] = $boinc_user->postal_code; |
|
| 311 | + $profile_node->field_url[]['value'] = $boinc_user->url; |
|
| 312 | + $profile_node->field_background[]['value'] = $profile_background; |
|
| 313 | + $profile_node->field_opinions[]['value'] = $profile_opinions; |
|
| 314 | + $profile_node->field_image[] = $avatar_image; |
|
| 315 | + $profile_node->field_profile_image[] = $profile_image; |
|
| 316 | + |
|
| 317 | + // Save the profile object to the database |
|
| 318 | + // This will automatically set the author uid if node->name has been set |
|
| 319 | + $profile_node = node_submit($profile_node); |
|
| 320 | + node_save($profile_node); |
|
| 321 | + |
|
| 322 | + // Mark profile as approved if it has already been vetted somehow |
|
| 323 | + if ($profile_approved OR !$boinc_user->has_profile) { |
|
| 324 | 324 | $profile_node->moderate = 0; |
| 325 | 325 | node_save($profile_node); |
| 326 | - } |
|
| 326 | + } |
|
| 327 | 327 | |
| 328 | - return; |
|
| 328 | + return; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | function boincuser_account_cross_reference($uid, $boinc_id) { |
| 332 | 332 | // Cross reference Drupal account with BOINC |
| 333 | 333 | $reference = db_query("INSERT INTO {boincuser} SET uid=%d, boinc_id=%d", $uid, $boinc_id); |
| 334 | 334 | if (!$reference) { |
| 335 | - drupal_set_message(t("Error connecting BOINC account."), 'error'); |
|
| 336 | - return false; |
|
| 335 | + drupal_set_message(t("Error connecting BOINC account."), 'error'); |
|
| 336 | + return false; |
|
| 337 | 337 | } |
| 338 | 338 | return true; |
| 339 | 339 | } |
@@ -342,35 +342,35 @@ discard block |
||
| 342 | 342 | * Convert any BOINC forum thread subscriptions to Drupal flag subscriptions |
| 343 | 343 | */ |
| 344 | 344 | function boincuser_pull_subscriptions($account = NULL) { |
| 345 | - if (!$account) { |
|
| 345 | + if (!$account) { |
|
| 346 | 346 | global $user; |
| 347 | 347 | $account = user_load($user->id); |
| 348 | - } |
|
| 349 | - elseif (is_numeric($account)) { |
|
| 348 | + } |
|
| 349 | + elseif (is_numeric($account)) { |
|
| 350 | 350 | $account = user_load($account); |
| 351 | - } |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | - // Get any subscriptions for this user |
|
| 354 | - db_set_active('boinc_rw'); |
|
| 355 | - $subscriptions = db_query(' |
|
| 353 | + // Get any subscriptions for this user |
|
| 354 | + db_set_active('boinc_rw'); |
|
| 355 | + $subscriptions = db_query(' |
|
| 356 | 356 | SELECT threadid FROM {subscriptions} |
| 357 | 357 | WHERE userid = %d', $account->boincuser_id); |
| 358 | - db_set_active('default'); |
|
| 358 | + db_set_active('default'); |
|
| 359 | 359 | |
| 360 | - $flag = flag_get_flag('subscriptions') or die('no "subscriptions" flag defined'); |
|
| 361 | - $count = 0; |
|
| 362 | - while ($thread_id = db_result($subscriptions)) { |
|
| 360 | + $flag = flag_get_flag('subscriptions') or die('no "subscriptions" flag defined'); |
|
| 361 | + $count = 0; |
|
| 362 | + while ($thread_id = db_result($subscriptions)) { |
|
| 363 | 363 | // For each BOINC thread ID subscribed, look up the corresponding node ID |
| 364 | 364 | $nid = db_result(db_query(' |
| 365 | 365 | SELECT nid FROM {boincimport_temp_topic} |
| 366 | 366 | WHERE topic_id = %d', $thread_id)); |
| 367 | 367 | // Flag this node for the user |
| 368 | 368 | if ($nid > 0) { |
| 369 | - $flag->flag('flag', $nid, $account); |
|
| 370 | - $count++; |
|
| 369 | + $flag->flag('flag', $nid, $account); |
|
| 370 | + $count++; |
|
| 371 | + } |
|
| 371 | 372 | } |
| 372 | - } |
|
| 373 | - return $count; |
|
| 373 | + return $count; |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | |
@@ -382,12 +382,12 @@ discard block |
||
| 382 | 382 | * User account update validation handler. |
| 383 | 383 | */ |
| 384 | 384 | function boincuser_account_validate($edit, $account) { |
| 385 | - // Include BOINC database objects library, load BOINC account data |
|
| 386 | - require_boinc('boinc_db'); |
|
| 387 | - $boinc_user = BoincUser::lookup_email_addr($account->mail); |
|
| 388 | - $changing_email = ($edit['mail'] AND $edit['mail'] != $account->mail) ? true : false; |
|
| 389 | - $changing_pass = ($edit['pass']) ? true : false; |
|
| 390 | - if ($changing_email) { |
|
| 385 | + // Include BOINC database objects library, load BOINC account data |
|
| 386 | + require_boinc('boinc_db'); |
|
| 387 | + $boinc_user = BoincUser::lookup_email_addr($account->mail); |
|
| 388 | + $changing_email = ($edit['mail'] AND $edit['mail'] != $account->mail) ? true : false; |
|
| 389 | + $changing_pass = ($edit['pass']) ? true : false; |
|
| 390 | + if ($changing_email) { |
|
| 391 | 391 | // E-mail address is set to change; check for an existing BOINC user |
| 392 | 392 | // Check previous email addresses as well, this user's current |
| 393 | 393 | // email cannot be the same as another user's previous email |
@@ -398,50 +398,50 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | $boinc_user_already_exists = ( BoincUser::lookup_email_addr($edit['mail']) || BoincUser::lookup_prev_email_addr($edit['mail']) ); |
| 400 | 400 | if ($boinc_user_already_exists) { |
| 401 | - form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']), NULL, 'boinc:add-new-user')); |
|
| 401 | + form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']), NULL, 'boinc:add-new-user')); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | // Check email has not been changed in last X days (default X=7). |
| 405 | 405 | $duration = 86400 * 7; |
| 406 | 406 | if ( (($boinc_user->email_addr_change_time + $duration) > time()) and (!(user_access('administer users'))) ) { |
| 407 | - form_set_error('email_addr_change_time', |
|
| 407 | + form_set_error('email_addr_change_time', |
|
| 408 | 408 | 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.', |
| 409 | 409 | array( |
| 410 | - '!futuredate' => date('F j, Y \a\t H:i T', $boinc_user->email_addr_change_time + $duration), |
|
| 411 | - '!prev_email_addr' => $boinc_user->previous_email_addr, |
|
| 410 | + '!futuredate' => date('F j, Y \a\t H:i T', $boinc_user->email_addr_change_time + $duration), |
|
| 411 | + '!prev_email_addr' => $boinc_user->previous_email_addr, |
|
| 412 | 412 | ), |
| 413 | 413 | NULL, 'boinc:account-credentials-change') |
| 414 | - ); |
|
| 414 | + ); |
|
| 415 | + } |
|
| 415 | 416 | } |
| 416 | - } |
|
| 417 | 417 | |
| 418 | - // If user is changing email or password, require that the current |
|
| 419 | - // password has been given as well. |
|
| 420 | - if (($changing_email OR $changing_pass) AND !user_access('administer users')) { |
|
| 418 | + // If user is changing email or password, require that the current |
|
| 419 | + // password has been given as well. |
|
| 420 | + if (($changing_email OR $changing_pass) AND !user_access('administer users')) { |
|
| 421 | 421 | // If changing email or password, require current password |
| 422 | 422 | // (except in cases where password is being reset) |
| 423 | 423 | if (isset($_SESSION['reset_pass'])) { |
| 424 | - unset($_SESSION['reset_pass']); |
|
| 424 | + unset($_SESSION['reset_pass']); |
|
| 425 | 425 | } |
| 426 | 426 | else { |
| 427 | - $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
|
| 428 | - if (!$edit['current_pass']) { |
|
| 427 | + $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
|
| 428 | + if (!$edit['current_pass']) { |
|
| 429 | 429 | form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.', array(), NULL, 'boinc:account-credentials-change')); |
| 430 | - } |
|
| 431 | - elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
| 430 | + } |
|
| 431 | + elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
| 432 | 432 | form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:account-credentials-change')); |
| 433 | - } |
|
| 433 | + } |
|
| 434 | 434 | |
| 435 | 435 | } |
| 436 | - } |
|
| 436 | + } |
|
| 437 | 437 | |
| 438 | - // If an admin tries to change the email and NOT the password, show |
|
| 439 | - // error message. BOINC requires both to be changed together. |
|
| 440 | - if ($changing_email AND !$changing_pass AND user_access('administer users')) { |
|
| 438 | + // If an admin tries to change the email and NOT the password, show |
|
| 439 | + // error message. BOINC requires both to be changed together. |
|
| 440 | + if ($changing_email AND !$changing_pass AND user_access('administer users')) { |
|
| 441 | 441 | form_set_error('pass', bts('If changing a user\'s email, you must also change the password simultaneously.', array(), NULL, 'boinc:account-credentials-change')); |
| 442 | - } |
|
| 442 | + } |
|
| 443 | 443 | |
| 444 | - // Expansion required to allow account key in place of passwd...? |
|
| 444 | + // Expansion required to allow account key in place of passwd...? |
|
| 445 | 445 | |
| 446 | 446 | } |
| 447 | 447 | |
@@ -454,12 +454,12 @@ discard block |
||
| 454 | 454 | * Password request validation handler. |
| 455 | 455 | */ |
| 456 | 456 | function boincuser_request_pass_validate($form, &$form_state) { |
| 457 | - $edit = $form_state['values']; |
|
| 458 | - // The Drupal submit function expects a "name" field, even though |
|
| 459 | - // it contains an email address and we will not allow a user name |
|
| 460 | - if (!$edit['name']) form_set_error('name', bts('Please enter your email address', array(), NULL, 'boinc:forgot-password')); |
|
| 461 | - 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')); |
|
| 462 | - else { |
|
| 457 | + $edit = $form_state['values']; |
|
| 458 | + // The Drupal submit function expects a "name" field, even though |
|
| 459 | + // it contains an email address and we will not allow a user name |
|
| 460 | + if (!$edit['name']) form_set_error('name', bts('Please enter your email address', array(), NULL, 'boinc:forgot-password')); |
|
| 461 | + 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')); |
|
| 462 | + else { |
|
| 463 | 463 | // set email addrress to lower case |
| 464 | 464 | $lower_email_addr = strtolower($edit['name']); |
| 465 | 465 | |
@@ -469,110 +469,110 @@ discard block |
||
| 469 | 469 | require_boinc('boinc_db'); |
| 470 | 470 | $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
| 471 | 471 | if ($boinc_user) { |
| 472 | - // If the user is in BOINC but not Drupal, bring them over... |
|
| 473 | - boincuser_register_make_drupal_user($boinc_user); |
|
| 472 | + // If the user is in BOINC but not Drupal, bring them over... |
|
| 473 | + boincuser_register_make_drupal_user($boinc_user); |
|
| 474 | 474 | } else { |
| 475 | - // If there is no existing BOINC user either, show an error |
|
| 476 | - form_set_error('name', bts('No account exists for @email -- please create an account using a BOINC client -- !instructions', |
|
| 477 | - array( |
|
| 478 | - '@email' => $edit['name'], |
|
| 479 | - '!instructions' => l(bts('Instructions', array(), NULL, 'boinc:forgot-password'), 'join') |
|
| 480 | - ), NULL, 'boinc:forgot-password')); |
|
| 481 | - } |
|
| 482 | - } |
|
| 475 | + // If there is no existing BOINC user either, show an error |
|
| 476 | + form_set_error('name', bts('No account exists for @email -- please create an account using a BOINC client -- !instructions', |
|
| 477 | + array( |
|
| 478 | + '@email' => $edit['name'], |
|
| 479 | + '!instructions' => l(bts('Instructions', array(), NULL, 'boinc:forgot-password'), 'join') |
|
| 480 | + ), NULL, 'boinc:forgot-password')); |
|
| 481 | + } |
|
| 482 | + } |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | /** |
| 486 | 486 | * The definition of the authenticator login form. |
| 487 | 487 | */ |
| 488 | 488 | function boincuser_authloginform() { |
| 489 | - $headers = apache_request_headers(); |
|
| 490 | - $project_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 491 | - $project_domain = $headers['Host']; |
|
| 492 | - $form['heading'] = array( |
|
| 489 | + $headers = apache_request_headers(); |
|
| 490 | + $project_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 491 | + $project_domain = $headers['Host']; |
|
| 492 | + $form['heading'] = array( |
|
| 493 | 493 | '#type' => 'markup', |
| 494 | 494 | '#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>' |
| 495 | - ); |
|
| 496 | - $form['instructions'] = array( |
|
| 495 | + ); |
|
| 496 | + $form['instructions'] = array( |
|
| 497 | 497 | '#type' => 'markup', |
| 498 | 498 | '#value' => '' . |
| 499 | - '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:", array(), NULL, 'boinc:authenticator-login-page') . |
|
| 500 | - ' <ul>' . |
|
| 501 | - ' <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>' . |
|
| 502 | - ' <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>' . |
|
| 503 | - ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:", array(), NULL, 'boinc:authenticator-login-page') . |
|
| 504 | - ' <pre>' . |
|
| 505 | - '<account>' . "\n" . |
|
| 506 | - " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
|
| 507 | - ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>' . "\n" . |
|
| 508 | - " <project_name>{$project_name}</project_name>" . "\n" . |
|
| 509 | - ' ...' . "\n" . |
|
| 510 | - '</account>' . |
|
| 511 | - ' </pre>' . |
|
| 512 | - ' </li>' . |
|
| 513 | - ' <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>' . |
|
| 514 | - ' <li>' . bts('Paste the string into the field below, and click OK.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
| 515 | - ' <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>' . |
|
| 516 | - ' </ul>' . |
|
| 517 | - '</p>' |
|
| 518 | - ); |
|
| 519 | - $form['authenticator'] = array( |
|
| 499 | + '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:", array(), NULL, 'boinc:authenticator-login-page') . |
|
| 500 | + ' <ul>' . |
|
| 501 | + ' <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>' . |
|
| 502 | + ' <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>' . |
|
| 503 | + ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:", array(), NULL, 'boinc:authenticator-login-page') . |
|
| 504 | + ' <pre>' . |
|
| 505 | + '<account>' . "\n" . |
|
| 506 | + " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
|
| 507 | + ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>' . "\n" . |
|
| 508 | + " <project_name>{$project_name}</project_name>" . "\n" . |
|
| 509 | + ' ...' . "\n" . |
|
| 510 | + '</account>' . |
|
| 511 | + ' </pre>' . |
|
| 512 | + ' </li>' . |
|
| 513 | + ' <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>' . |
|
| 514 | + ' <li>' . bts('Paste the string into the field below, and click OK.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
| 515 | + ' <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>' . |
|
| 516 | + ' </ul>' . |
|
| 517 | + '</p>' |
|
| 518 | + ); |
|
| 519 | + $form['authenticator'] = array( |
|
| 520 | 520 | '#title' => bts('Log in with authenticator', array(), NULL, 'boinc:authenticator-login-page'), |
| 521 | 521 | '#type' => 'textfield', |
| 522 | 522 | '#size' => 60, |
| 523 | 523 | '#maxlength' => 32, |
| 524 | 524 | '#required' => TRUE, |
| 525 | 525 | '#description' => null |
| 526 | - ); |
|
| 526 | + ); |
|
| 527 | 527 | |
| 528 | - // Form control |
|
| 529 | - $form['form control tabs prefix'] = array( |
|
| 528 | + // Form control |
|
| 529 | + $form['form control tabs prefix'] = array( |
|
| 530 | 530 | '#value' => '<ul class="form-control tab-list">', |
| 531 | 531 | '#weight' => 1001, |
| 532 | - ); |
|
| 533 | - $form['submit'] = array( |
|
| 532 | + ); |
|
| 533 | + $form['submit'] = array( |
|
| 534 | 534 | '#prefix' => '<li class="first tab">', |
| 535 | 535 | '#type' => 'submit', |
| 536 | 536 | '#value' => bts('OK', array(), NULL, 'boinc:form-ok'), |
| 537 | 537 | '#suffix' => '</li>', |
| 538 | 538 | '#weight' => 1002, |
| 539 | - ); |
|
| 540 | - $form['form control tabs'] = array( |
|
| 539 | + ); |
|
| 540 | + $form['form control tabs'] = array( |
|
| 541 | 541 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/password') . '</li>', |
| 542 | 542 | '#weight' => 1003, |
| 543 | - ); |
|
| 544 | - $form['form control tabs suffix'] = array( |
|
| 543 | + ); |
|
| 544 | + $form['form control tabs suffix'] = array( |
|
| 545 | 545 | '#value' => '</ul>', |
| 546 | 546 | '#weight' => 1004, |
| 547 | - ); |
|
| 548 | - return $form; |
|
| 547 | + ); |
|
| 548 | + return $form; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | /** |
| 552 | 552 | * The authenticator login validation handler |
| 553 | 553 | */ |
| 554 | 554 | function boincuser_authloginform_validate($form, &$form_state) { |
| 555 | - $authenticator = $form_state['values']['authenticator']; |
|
| 556 | - if (strlen($authenticator) != 32) { |
|
| 555 | + $authenticator = $form_state['values']['authenticator']; |
|
| 556 | + if (strlen($authenticator) != 32) { |
|
| 557 | 557 | // We notify the form API that this field has failed validation. |
| 558 | 558 | form_set_error('authenticator', bts('That authenticator is not valid.', array(), NULL, 'boinc:authenticator-login-page')); |
| 559 | - } else { |
|
| 559 | + } else { |
|
| 560 | 560 | require_boinc('boinc_db'); |
| 561 | 561 | $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
| 562 | 562 | if (!$boinc_user) form_set_error('authenticator', bts('There is no account with that authenticator.', array(), NULL, 'boinc:authenticator-login-page')); |
| 563 | - } |
|
| 563 | + } |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | /** |
| 567 | 567 | * The authenticator login submit handler |
| 568 | 568 | */ |
| 569 | 569 | function boincuser_authloginform_submit($form, &$form_state) { |
| 570 | - global $user; |
|
| 571 | - $authenticator = $form_state['values']['authenticator']; |
|
| 572 | - require_boinc('boinc_db'); |
|
| 573 | - $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
|
| 574 | - if (!$user = user_load(get_drupal_id($boinc_user->id))) drupal_set_message(t('An unresolved error occurred while logging into this account.')); |
|
| 575 | - else $form_state['redirect'] = 'account/info/edit'; |
|
| 570 | + global $user; |
|
| 571 | + $authenticator = $form_state['values']['authenticator']; |
|
| 572 | + require_boinc('boinc_db'); |
|
| 573 | + $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
|
| 574 | + if (!$user = user_load(get_drupal_id($boinc_user->id))) drupal_set_message(t('An unresolved error occurred while logging into this account.')); |
|
| 575 | + else $form_state['redirect'] = 'account/info/edit'; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | |
@@ -580,44 +580,44 @@ discard block |
||
| 580 | 580 | * The definition of the moderator reject user profile form. |
| 581 | 581 | */ |
| 582 | 582 | function boincuser_moderate_profile_reject_form(&$form_state, $uid) { |
| 583 | - $form_state['storage']['reject_profile_uid'] = $uid; |
|
| 584 | - $form['reason'] = array( |
|
| 583 | + $form_state['storage']['reject_profile_uid'] = $uid; |
|
| 584 | + $form['reason'] = array( |
|
| 585 | 585 | '#title' => bts('Reason for rejecting this profile', array(), NULL, 'boinc:moderate-user'), |
| 586 | 586 | '#type' => 'textarea', |
| 587 | 587 | '#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'), |
| 588 | 588 | '#default_value' => '', |
| 589 | - ); |
|
| 589 | + ); |
|
| 590 | 590 | |
| 591 | - // Form control |
|
| 592 | - $form['form control tabs prefix'] = array( |
|
| 591 | + // Form control |
|
| 592 | + $form['form control tabs prefix'] = array( |
|
| 593 | 593 | '#value' => '<ul class="form-control tab-list">', |
| 594 | 594 | '#weight' => 1001, |
| 595 | - ); |
|
| 596 | - $form['submit'] = array( |
|
| 595 | + ); |
|
| 596 | + $form['submit'] = array( |
|
| 597 | 597 | '#prefix' => '<li class="first tab">', |
| 598 | 598 | '#type' => 'submit', |
| 599 | 599 | '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
| 600 | 600 | '#suffix' => '</li>', |
| 601 | 601 | '#weight' => 1002, |
| 602 | - ); |
|
| 603 | - $form['form control tabs'] = array( |
|
| 602 | + ); |
|
| 603 | + $form['form control tabs'] = array( |
|
| 604 | 604 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
| 605 | 605 | '#weight' => 1003, |
| 606 | - ); |
|
| 607 | - $form['form control tabs suffix'] = array( |
|
| 606 | + ); |
|
| 607 | + $form['form control tabs suffix'] = array( |
|
| 608 | 608 | '#value' => '</ul>', |
| 609 | 609 | '#weight' => 1004, |
| 610 | - ); |
|
| 611 | - return $form; |
|
| 610 | + ); |
|
| 611 | + return $form; |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /** |
| 615 | 615 | * The moderator reject user profile submit handler |
| 616 | 616 | */ |
| 617 | 617 | function boincuser_moderate_profile_reject_form_submit($form, &$form_state) { |
| 618 | - $uid = $form_state['storage']['reject_profile_uid']; |
|
| 619 | - $reason = $form_state['values']['reason']; |
|
| 620 | - boincuser_moderate_profile_reject($uid, $reason); |
|
| 618 | + $uid = $form_state['storage']['reject_profile_uid']; |
|
| 619 | + $reason = $form_state['values']['reason']; |
|
| 620 | + boincuser_moderate_profile_reject($uid, $reason); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | |
@@ -625,52 +625,52 @@ discard block |
||
| 625 | 625 | * The definition of the ban user form. |
| 626 | 626 | */ |
| 627 | 627 | function boincuser_moderate_user_ban_form(&$form_state, $uid) { |
| 628 | - $form_state['storage']['ban_user_uid'] = $uid; |
|
| 629 | - $form['reason'] = array( |
|
| 628 | + $form_state['storage']['ban_user_uid'] = $uid; |
|
| 629 | + $form['reason'] = array( |
|
| 630 | 630 | '#title' => bts('Reason for banning this user', array(), NULL, 'boinc:moderate-user'), |
| 631 | 631 | '#type' => 'textarea', |
| 632 | 632 | '#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'), |
| 633 | 633 | '#default_value' => '', |
| 634 | - ); |
|
| 635 | - $form['duration'] = array( |
|
| 634 | + ); |
|
| 635 | + $form['duration'] = array( |
|
| 636 | 636 | '#title' => bts('Duration of the ban', array(), NULL, 'boinc:moderate-user'), |
| 637 | 637 | '#type' => 'textfield', |
| 638 | 638 | '#description' => bts('The number of days until the ban expires. Set to 0 to ban permanently.', array(), NULL, 'boinc:moderate-user'), |
| 639 | 639 | '#default_value' => '', |
| 640 | - ); |
|
| 640 | + ); |
|
| 641 | 641 | |
| 642 | - // Form control |
|
| 643 | - $form['form control tabs prefix'] = array( |
|
| 642 | + // Form control |
|
| 643 | + $form['form control tabs prefix'] = array( |
|
| 644 | 644 | '#value' => '<ul class="form-control tab-list">', |
| 645 | 645 | '#weight' => 1001, |
| 646 | - ); |
|
| 647 | - $form['submit'] = array( |
|
| 646 | + ); |
|
| 647 | + $form['submit'] = array( |
|
| 648 | 648 | '#prefix' => '<li class="first tab">', |
| 649 | 649 | '#type' => 'submit', |
| 650 | 650 | '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
| 651 | 651 | '#suffix' => '</li>', |
| 652 | 652 | '#weight' => 1002, |
| 653 | - ); |
|
| 654 | - $form['form control tabs'] = array( |
|
| 653 | + ); |
|
| 654 | + $form['form control tabs'] = array( |
|
| 655 | 655 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
| 656 | 656 | '#weight' => 1003, |
| 657 | - ); |
|
| 658 | - $form['form control tabs suffix'] = array( |
|
| 657 | + ); |
|
| 658 | + $form['form control tabs suffix'] = array( |
|
| 659 | 659 | '#value' => '</ul>', |
| 660 | 660 | '#weight' => 1004, |
| 661 | - ); |
|
| 662 | - return $form; |
|
| 661 | + ); |
|
| 662 | + return $form; |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | /** |
| 666 | 666 | * The ban user submit handler |
| 667 | 667 | */ |
| 668 | 668 | function boincuser_moderate_user_ban_form_submit($form, &$form_state) { |
| 669 | - $uid = $form_state['storage']['ban_user_uid']; |
|
| 670 | - $reason = $form_state['values']['reason']; |
|
| 671 | - $duration = $form_state['values']['duration']; |
|
| 672 | - if ($duration) $duration = $duration * 24*60*60; |
|
| 673 | - boincuser_moderate_user_ban($uid, $reason, $duration); |
|
| 669 | + $uid = $form_state['storage']['ban_user_uid']; |
|
| 670 | + $reason = $form_state['values']['reason']; |
|
| 671 | + $duration = $form_state['values']['duration']; |
|
| 672 | + if ($duration) $duration = $duration * 24*60*60; |
|
| 673 | + boincuser_moderate_user_ban($uid, $reason, $duration); |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | |
@@ -678,10 +678,10 @@ discard block |
||
| 678 | 678 | * Hack to fix submission of the flag friend unfriend form |
| 679 | 679 | */ |
| 680 | 680 | function boincuser_fix_unfriend_form_submit($form, &$form_state) { |
| 681 | - // Leaving action as "unfriend" causes problems |
|
| 682 | - if ($form_state['values']['action'] == 'unfriend') { |
|
| 681 | + // Leaving action as "unfriend" causes problems |
|
| 682 | + if ($form_state['values']['action'] == 'unfriend') { |
|
| 683 | 683 | $form_state['values']['action'] = 'unflag'; |
| 684 | - } |
|
| 684 | + } |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -689,102 +689,102 @@ discard block |
||
| 689 | 689 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 690 | 690 | |
| 691 | 691 | function boincuser_termsofuse_form() { |
| 692 | - global $user; |
|
| 692 | + global $user; |
|
| 693 | 693 | |
| 694 | - // If user has already signed terms of use, and got to this form in error, send them to site home. |
|
| 695 | - if (boincuser_check_termsofuse($user)) { |
|
| 694 | + // If user has already signed terms of use, and got to this form in error, send them to site home. |
|
| 695 | + if (boincuser_check_termsofuse($user)) { |
|
| 696 | 696 | drupal_goto(); |
| 697 | - } |
|
| 697 | + } |
|
| 698 | 698 | |
| 699 | - 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' ); |
|
| 699 | + 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' ); |
|
| 700 | 700 | |
| 701 | - $form = array(); |
|
| 702 | - drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); |
|
| 703 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 701 | + $form = array(); |
|
| 702 | + drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); |
|
| 703 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 704 | 704 | |
| 705 | - // Fieldset to hold all of the form as a container |
|
| 706 | - $form['termsofuse'] = array( |
|
| 705 | + // Fieldset to hold all of the form as a container |
|
| 706 | + $form['termsofuse'] = array( |
|
| 707 | 707 | '#type' => 'fieldset', |
| 708 | 708 | '#prefix' => '<div id="termsofuse-wrapper">', // This is our wrapper div. |
| 709 | 709 | '#suffix' => '</div>', |
| 710 | 710 | '#tree' => TRUE, |
| 711 | - ); |
|
| 711 | + ); |
|
| 712 | 712 | |
| 713 | - $form['termsofuse']['title1'] = array( |
|
| 713 | + $form['termsofuse']['title1'] = array( |
|
| 714 | 714 | '#weight' => -12, |
| 715 | 715 | '#value' => '<h2>' . bts( variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:termsofuse-form' ) . '</h2>', |
| 716 | 716 | '#prefix' => '<div id="register-title1">', |
| 717 | 717 | '#suffix' => '</div>', |
| 718 | - ); |
|
| 718 | + ); |
|
| 719 | 719 | |
| 720 | - // Terms of use section |
|
| 721 | - $form['termsofuse']['body'] = array( |
|
| 720 | + // Terms of use section |
|
| 721 | + $form['termsofuse']['body'] = array( |
|
| 722 | 722 | '#weight' => -10, |
| 723 | 723 | '#value' => bts($termsofuse, array(), NULL, 'project:termsofuse-form'), |
| 724 | 724 | '#prefix' => '<div id="register-termsofuse">', |
| 725 | 725 | '#suffix' => '</div>', |
| 726 | - ); |
|
| 726 | + ); |
|
| 727 | 727 | |
| 728 | - $form['termsofuse']['agreeTOU'] = array( |
|
| 728 | + $form['termsofuse']['agreeTOU'] = array( |
|
| 729 | 729 | '#type' => 'checkbox', |
| 730 | 730 | '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:termsofuse-form'), |
| 731 | 731 | '#weight' => -8, |
| 732 | 732 | '#prefix' => '<div id="register-checkbox">', |
| 733 | 733 | '#suffix' => '</div>', |
| 734 | - ); |
|
| 734 | + ); |
|
| 735 | 735 | |
| 736 | - $form['termsofuse']['spacer'] = array( |
|
| 736 | + $form['termsofuse']['spacer'] = array( |
|
| 737 | 737 | '#prefix' => '<div class="clearfix" id="register-title2">', |
| 738 | 738 | '#value' => ' ', |
| 739 | 739 | '#suffix' => '</div>', |
| 740 | - ); |
|
| 740 | + ); |
|
| 741 | 741 | |
| 742 | - // Form Control |
|
| 743 | - $form['submit'] = array( |
|
| 742 | + // Form Control |
|
| 743 | + $form['submit'] = array( |
|
| 744 | 744 | '#prefix' => '<p><p><p><li class="first tab" id="register-submit">', |
| 745 | 745 | '#type' => 'submit', |
| 746 | 746 | '#value' => bts('Yes', array(), NULL, 'boinc:form-submit'), |
| 747 | 747 | '#suffix' => '</li>', |
| 748 | - ); |
|
| 749 | - $form['form control tabs'] = array( |
|
| 748 | + ); |
|
| 749 | + $form['form control tabs'] = array( |
|
| 750 | 750 | '#value' => '<li class="tab">' . l(bts('NO - LOGOUT', array(), NULL, 'boinc:form-cancel'), '/logout') . '</li>', |
| 751 | - ); |
|
| 752 | - if (module_exists('boincuser_delete')) { |
|
| 751 | + ); |
|
| 752 | + if (module_exists('boincuser_delete')) { |
|
| 753 | 753 | $deletelink = '/user/' . $user->uid . '/delete'; |
| 754 | 754 | $form['deleteaccount'] = array( |
| 755 | - '#value' => '<li class="tab">' . l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink) . '</li>', |
|
| 755 | + '#value' => '<li class="tab">' . l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink) . '</li>', |
|
| 756 | 756 | ); |
| 757 | - } |
|
| 757 | + } |
|
| 758 | 758 | |
| 759 | - // Set form redirect |
|
| 760 | - $form['#redirect'] = $_REQUEST['destination']; |
|
| 759 | + // Set form redirect |
|
| 760 | + $form['#redirect'] = $_REQUEST['destination']; |
|
| 761 | 761 | |
| 762 | - // Add the current user's data into the form |
|
| 763 | - $form['#account'] = $user; |
|
| 762 | + // Add the current user's data into the form |
|
| 763 | + $form['#account'] = $user; |
|
| 764 | 764 | |
| 765 | - return $form; |
|
| 765 | + return $form; |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | function boincuser_termsofuse_form_validate($form, &$form_state) { |
| 769 | - // Check TOU agreement |
|
| 770 | - if (!$form_state['values']['termsofuse']['agreeTOU']) { |
|
| 769 | + // Check TOU agreement |
|
| 770 | + if (!$form_state['values']['termsofuse']['agreeTOU']) { |
|
| 771 | 771 | 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')); |
| 772 | - } |
|
| 772 | + } |
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | function boincuser_termsofuse_form_submit($form, &$form_state) { |
| 776 | - $user = $form['#account']; |
|
| 777 | - if (!boincuser_consentto_termsofuse($user)) { |
|
| 776 | + $user = $form['#account']; |
|
| 777 | + if (!boincuser_consentto_termsofuse($user)) { |
|
| 778 | 778 | form_set_error('termsofuse', |
| 779 | - bts('There was an error in agreeing to the terms of use. The @project administrators have been notified.', |
|
| 779 | + bts('There was an error in agreeing to the terms of use. The @project administrators have been notified.', |
|
| 780 | 780 | array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:termsofuse-form') |
| 781 | 781 | ); |
| 782 | - } |
|
| 782 | + } |
|
| 783 | 783 | |
| 784 | - // Delete session messages |
|
| 785 | - if ($_SESSION['messages']['warning']) { |
|
| 784 | + // Delete session messages |
|
| 785 | + if ($_SESSION['messages']['warning']) { |
|
| 786 | 786 | unset($_SESSION['messages']['warning']); |
| 787 | - } |
|
| 787 | + } |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | /** |
@@ -793,89 +793,89 @@ discard block |
||
| 793 | 793 | * removed after used. |
| 794 | 794 | */ |
| 795 | 795 | function boincuser_revertemail(&$form_state, $token) { |
| 796 | - require_boinc('token'); |
|
| 797 | - require_boinc('util'); |
|
| 796 | + require_boinc('token'); |
|
| 797 | + require_boinc('util'); |
|
| 798 | 798 | |
| 799 | - global $user; |
|
| 800 | - $form = array(); |
|
| 799 | + global $user; |
|
| 800 | + $form = array(); |
|
| 801 | 801 | |
| 802 | - // drupal JS for dynamic password validation |
|
| 803 | - _user_password_dynamic_validation(); |
|
| 802 | + // drupal JS for dynamic password validation |
|
| 803 | + _user_password_dynamic_validation(); |
|
| 804 | 804 | |
| 805 | - // check BOINC user exists |
|
| 806 | - $account = user_load(array('uid' => $user->uid)); |
|
| 807 | - $uid = $user->uid; |
|
| 808 | - $boincid = $account->boincuser_id; |
|
| 809 | - // check $token is valid |
|
| 810 | - if (!is_valid_token($boincid, $token, 'E')) { |
|
| 805 | + // check BOINC user exists |
|
| 806 | + $account = user_load(array('uid' => $user->uid)); |
|
| 807 | + $uid = $user->uid; |
|
| 808 | + $boincid = $account->boincuser_id; |
|
| 809 | + // check $token is valid |
|
| 810 | + if (!is_valid_token($boincid, $token, 'E')) { |
|
| 811 | 811 | drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your email address.', |
| 812 | 812 | array( |
| 813 | - '!link' => l(bts('changing', array(), NULL, 'boinc:revert-email-change'), "/account/info/edit"), |
|
| 813 | + '!link' => l(bts('changing', array(), NULL, 'boinc:revert-email-change'), "/account/info/edit"), |
|
| 814 | 814 | ), |
| 815 | 815 | NULL, 'boinc:revert-email-change'), 'error'); |
| 816 | 816 | drupal_goto(); |
| 817 | - } |
|
| 817 | + } |
|
| 818 | 818 | |
| 819 | - // Attach account and token to this form. |
|
| 820 | - $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
| 821 | - $form['_token'] = array('#type' => 'value', '#value' => $token); |
|
| 819 | + // Attach account and token to this form. |
|
| 820 | + $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
| 821 | + $form['_token'] = array('#type' => 'value', '#value' => $token); |
|
| 822 | 822 | |
| 823 | - // Instructions |
|
| 824 | - $form['main']['instructions1'] = array( |
|
| 823 | + // Instructions |
|
| 824 | + $form['main']['instructions1'] = array( |
|
| 825 | 825 | '#value' => '<p>'. |
| 826 | 826 | bts('In order to change your email back to your previous email address, <strong>!prev_email</strong>, you must also change your password.', |
| 827 | - array( |
|
| 827 | + array( |
|
| 828 | 828 | '!prev_email' => $account->boincuser_previous_email_addr, |
| 829 | - ), |
|
| 830 | - NULL, 'boinc:revert-email-change'). |
|
| 829 | + ), |
|
| 830 | + NULL, 'boinc:revert-email-change'). |
|
| 831 | 831 | '</p>', |
| 832 | - ); |
|
| 832 | + ); |
|
| 833 | 833 | |
| 834 | - $form['main']['pass'] = array( |
|
| 834 | + $form['main']['pass'] = array( |
|
| 835 | 835 | '#type' => 'password_confirm', |
| 836 | 836 | '#description' => 'Enter a new password in both fields', |
| 837 | 837 | '#size' => 17, |
| 838 | - ); |
|
| 839 | - |
|
| 840 | - // Wrap action buttons for styling consistency |
|
| 841 | - $form['buttons']['form control tabs prefix'] = array( |
|
| 842 | - '#value' => '<ul class="form-control tab-list">', |
|
| 843 | - '#weight' => 1001, |
|
| 844 | - ); |
|
| 845 | - $form['buttons']['submit']['#type'] = 'submit'; |
|
| 846 | - $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
|
| 847 | - $form['buttons']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
| 848 | - $form['buttons']['submit']['#suffix'] = '</li>'; |
|
| 849 | - $form['buttons']['submit']['#weight'] = 1002; |
|
| 850 | - $form['buttons']['cancel'] = array( |
|
| 851 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit') . '</li>', |
|
| 852 | - '#weight' => 1005, |
|
| 853 | - ); |
|
| 854 | - $form['buttons']['form control tabs suffix'] = array( |
|
| 855 | - '#value' => '</ul>', |
|
| 856 | - '#weight' => 1010, |
|
| 857 | - ); |
|
| 858 | - |
|
| 859 | - return $form; |
|
| 838 | + ); |
|
| 839 | + |
|
| 840 | + // Wrap action buttons for styling consistency |
|
| 841 | + $form['buttons']['form control tabs prefix'] = array( |
|
| 842 | + '#value' => '<ul class="form-control tab-list">', |
|
| 843 | + '#weight' => 1001, |
|
| 844 | + ); |
|
| 845 | + $form['buttons']['submit']['#type'] = 'submit'; |
|
| 846 | + $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
|
| 847 | + $form['buttons']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
| 848 | + $form['buttons']['submit']['#suffix'] = '</li>'; |
|
| 849 | + $form['buttons']['submit']['#weight'] = 1002; |
|
| 850 | + $form['buttons']['cancel'] = array( |
|
| 851 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit') . '</li>', |
|
| 852 | + '#weight' => 1005, |
|
| 853 | + ); |
|
| 854 | + $form['buttons']['form control tabs suffix'] = array( |
|
| 855 | + '#value' => '</ul>', |
|
| 856 | + '#weight' => 1010, |
|
| 857 | + ); |
|
| 858 | + |
|
| 859 | + return $form; |
|
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * Validation handler for revertemail form |
| 864 | 864 | */ |
| 865 | 865 | function boincuser_revertemail_validate($form, &$form_state) { |
| 866 | - // Load account and boincuser |
|
| 867 | - $account = $form_state['values']['_account']; |
|
| 868 | - $boinc_user = BoincUser::lookup_id_nocache($account->boincuser_id); |
|
| 866 | + // Load account and boincuser |
|
| 867 | + $account = $form_state['values']['_account']; |
|
| 868 | + $boinc_user = BoincUser::lookup_id_nocache($account->boincuser_id); |
|
| 869 | 869 | |
| 870 | - if (BoincUser::lookup_email_addr($boinc_user->previous_email_addr)) { |
|
| 870 | + if (BoincUser::lookup_email_addr($boinc_user->previous_email_addr)) { |
|
| 871 | 871 | rules_invoke_event('boincuser_revert_email_error', $boinc_user->previous_email_addr, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
| 872 | 872 | form_set_error('mail', |
| 873 | - bts('An account already exists for @email. Previous email address cannot be used because another account is using it as their email address. The @project administrators have been notified.', |
|
| 873 | + bts('An account already exists for @email. Previous email address cannot be used because another account is using it as their email address. The @project administrators have been notified.', |
|
| 874 | 874 | array( |
| 875 | - '@email' => $boinc_user->previous_email_addr, |
|
| 876 | - '@project' => variable_get('site_name', 'Drupal-BOINC'), |
|
| 875 | + '@email' => $boinc_user->previous_email_addr, |
|
| 876 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), |
|
| 877 | 877 | ), NULL, 'boinc:add-new-user')); |
| 878 | - } |
|
| 878 | + } |
|
| 879 | 879 | |
| 880 | 880 | } |
| 881 | 881 | |
@@ -883,25 +883,25 @@ discard block |
||
| 883 | 883 | * Submit handler for revertemail form |
| 884 | 884 | */ |
| 885 | 885 | function boincuser_revertemail_submit($form, &$form_state) { |
| 886 | - require_boinc('password_compat/password'); |
|
| 886 | + require_boinc('password_compat/password'); |
|
| 887 | 887 | |
| 888 | - // Load account and boincuser |
|
| 889 | - $account = $form_state['values']['_account']; |
|
| 890 | - $boinc_user = BoincUser::lookup_id_nocache($account->boincuser_id); |
|
| 888 | + // Load account and boincuser |
|
| 889 | + $account = $form_state['values']['_account']; |
|
| 890 | + $boinc_user = BoincUser::lookup_id_nocache($account->boincuser_id); |
|
| 891 | 891 | |
| 892 | - $pem = strtolower($boinc_user->previous_email_addr); |
|
| 892 | + $pem = strtolower($boinc_user->previous_email_addr); |
|
| 893 | 893 | |
| 894 | - // Set new password based on previous email address and entered |
|
| 895 | - // password. |
|
| 896 | - $new_passwd_hash = password_hash( md5($form_state['values']['pass'].$pem), PASSWORD_DEFAULT); |
|
| 894 | + // Set new password based on previous email address and entered |
|
| 895 | + // password. |
|
| 896 | + $new_passwd_hash = password_hash( md5($form_state['values']['pass'].$pem), PASSWORD_DEFAULT); |
|
| 897 | 897 | |
| 898 | - $boinc_user->update("email_addr='${pem}', previous_email_addr='', email_addr_change_time=0, passwd_hash='${new_passwd_hash}'"); |
|
| 898 | + $boinc_user->update("email_addr='${pem}', previous_email_addr='', email_addr_change_time=0, passwd_hash='${new_passwd_hash}'"); |
|
| 899 | 899 | |
| 900 | - // Set email in drupal database to previous email |
|
| 901 | - user_save($account, array('mail' => $pem)); |
|
| 900 | + // Set email in drupal database to previous email |
|
| 901 | + user_save($account, array('mail' => $pem)); |
|
| 902 | 902 | |
| 903 | - // delete the token |
|
| 904 | - $result = delete_token($account->boincuser_id, $form_state['values']['_token'], 'E'); |
|
| 903 | + // delete the token |
|
| 904 | + $result = delete_token($account->boincuser_id, $form_state['values']['_token'], 'E'); |
|
| 905 | 905 | |
| 906 | - drupal_goto('account'); |
|
| 906 | + drupal_goto('account'); |
|
| 907 | 907 | } |
@@ -345,8 +345,7 @@ discard block |
||
| 345 | 345 | if (!$account) { |
| 346 | 346 | global $user; |
| 347 | 347 | $account = user_load($user->id); |
| 348 | - } |
|
| 349 | - elseif (is_numeric($account)) { |
|
| 348 | + } elseif (is_numeric($account)) { |
|
| 350 | 349 | $account = user_load($account); |
| 351 | 350 | } |
| 352 | 351 | |
@@ -422,13 +421,11 @@ discard block |
||
| 422 | 421 | // (except in cases where password is being reset) |
| 423 | 422 | if (isset($_SESSION['reset_pass'])) { |
| 424 | 423 | unset($_SESSION['reset_pass']); |
| 425 | - } |
|
| 426 | - else { |
|
| 424 | + } else { |
|
| 427 | 425 | $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
| 428 | 426 | if (!$edit['current_pass']) { |
| 429 | 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')); |
| 430 | - } |
|
| 431 | - elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
| 428 | + } elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
| 432 | 429 | form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:account-credentials-change')); |
| 433 | 430 | } |
| 434 | 431 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | // Call our custom authentication function to check for an existing BOINC user |
| 36 | 36 | if (!boincuser_login_authenticate($form_state['values'])) { |
| 37 | 37 | // Authentication failed; set an error accordingly |
| 38 | - form_set_error('name', bts('Sorry, unrecognized email address or password.', array(), NULL, 'boinc:forgot-password') . ' ' . l(bts('Have you forgotten your password?', array(), NULL, 'boinc:forgot-password'), 'user/password')); |
|
| 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 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 106 | 106 | if (!empty($termsofuse)) { |
| 107 | 107 | if (!$form_state['values']['termsofuse']['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')); |
|
| 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 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | array( |
| 122 | 122 | '@email' => $lower_email_addr, |
| 123 | 123 | '@project' => variable_get('site_name', 'Drupal-BOINC') |
| 124 | - ), NULL, 'boinc:register-new-user') |
|
| 124 | + ), null, 'boinc:register-new-user') |
|
| 125 | 125 | ); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $boinc_user = BoincUser::lookup_email_addr($lower_email_addr); |
| 134 | 134 | if ($boinc_user) { |
| 135 | 135 | // User already exists |
| 136 | - 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')); |
|
| 136 | + 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')); |
|
| 137 | 137 | return false; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | function boincuser_create_drupal_user($boinc_user) { |
| 176 | 176 | require_boinc('forum_db'); |
| 177 | 177 | BoincForumPrefs::lookup($boinc_user); |
| 178 | - $account = NULL; |
|
| 178 | + $account = null; |
|
| 179 | 179 | $module = 'boincuser'; |
| 180 | 180 | |
| 181 | 181 | // Verify that this account has not already been imported |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $boinc_user->id) |
| 185 | 185 | ); |
| 186 | 186 | if ($already_imported) { |
| 187 | - return NULL; |
|
| 187 | + return null; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // Email is limited to 64 characters... |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | if ($already_imported) { |
| 199 | 199 | drupal_set_message(t('An account for @email already exists', array('@email' => $boinc_email)), 'warning'); |
| 200 | 200 | watchdog('boincimport', 'An account for @email already exists', array('@email' => $boinc_email), WATCHDOG_WARNING); |
| 201 | - return NULL; |
|
| 201 | + return null; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // Make sure name is unique |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | // Terminate if an error occured during user_save(). |
| 237 | 237 | if (!$account) { |
| 238 | 238 | drupal_set_message(t("Error saving user account."), 'error'); |
| 239 | - return NULL; |
|
| 239 | + return null; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Cross reference the Drupal and BOINC accounts |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $profile_opinions = null; |
| 268 | 268 | $profile_image = null; |
| 269 | 269 | $avatar_image = null; |
| 270 | - $profile_approved = NULL; |
|
| 270 | + $profile_approved = null; |
|
| 271 | 271 | |
| 272 | 272 | // Load the BOINC profile, if available |
| 273 | 273 | if ($boinc_user->has_profile) { |
@@ -277,17 +277,17 @@ discard block |
||
| 277 | 277 | if ($boinc_profile->has_picture) { |
| 278 | 278 | // Load picture; load validators; determine where to store it in Drupal |
| 279 | 279 | $image_path = "{$image_dir}/{$boinc_user->id}.jpg"; |
| 280 | - $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', TRUE); |
|
| 280 | + $profile_image = get_cck_image_object($image_path, 'field_profile_image', 'profile', true); |
|
| 281 | 281 | // If the user does not have a different image as an avatar, use this one |
| 282 | 282 | if (!$boinc_user->prefs->avatar) { |
| 283 | - $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
| 283 | + $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', true); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | if ($boinc_user->prefs->avatar) { |
| 287 | 287 | $image_path = "{$image_dir}/{$boinc_user->id}_avatar.jpg"; |
| 288 | - $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', TRUE); |
|
| 288 | + $avatar_image = get_cck_image_object($image_path, 'field_image', 'profile', true); |
|
| 289 | 289 | } |
| 290 | - $profile_approved = $boinc_profile->verification ? TRUE : FALSE; |
|
| 290 | + $profile_approved = $boinc_profile->verification ? true : false; |
|
| 291 | 291 | } |
| 292 | 292 | $default_input_format = db_result(db_query(" |
| 293 | 293 | SELECT format FROM {filter_formats} WHERE name = '%s'", 'Rich text')); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | node_save($profile_node); |
| 321 | 321 | |
| 322 | 322 | // Mark profile as approved if it has already been vetted somehow |
| 323 | - if ($profile_approved OR !$boinc_user->has_profile) { |
|
| 323 | + if ($profile_approved or !$boinc_user->has_profile) { |
|
| 324 | 324 | $profile_node->moderate = 0; |
| 325 | 325 | node_save($profile_node); |
| 326 | 326 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | /** |
| 342 | 342 | * Convert any BOINC forum thread subscriptions to Drupal flag subscriptions |
| 343 | 343 | */ |
| 344 | -function boincuser_pull_subscriptions($account = NULL) { |
|
| 344 | +function boincuser_pull_subscriptions($account = null) { |
|
| 345 | 345 | if (!$account) { |
| 346 | 346 | global $user; |
| 347 | 347 | $account = user_load($user->id); |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | // Include BOINC database objects library, load BOINC account data |
| 386 | 386 | require_boinc('boinc_db'); |
| 387 | 387 | $boinc_user = BoincUser::lookup_email_addr($account->mail); |
| 388 | - $changing_email = ($edit['mail'] AND $edit['mail'] != $account->mail) ? true : false; |
|
| 388 | + $changing_email = ($edit['mail'] and $edit['mail'] != $account->mail) ? true : false; |
|
| 389 | 389 | $changing_pass = ($edit['pass']) ? true : false; |
| 390 | 390 | if ($changing_email) { |
| 391 | 391 | // E-mail address is set to change; check for an existing BOINC user |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | $boinc_user_already_exists = ( BoincUser::lookup_email_addr($edit['mail']) || BoincUser::lookup_prev_email_addr($edit['mail']) ); |
| 400 | 400 | if ($boinc_user_already_exists) { |
| 401 | - form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']), NULL, 'boinc:add-new-user')); |
|
| 401 | + form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']), null, 'boinc:add-new-user')); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | // Check email has not been changed in last X days (default X=7). |
@@ -410,14 +410,14 @@ discard block |
||
| 410 | 410 | '!futuredate' => date('F j, Y \a\t H:i T', $boinc_user->email_addr_change_time + $duration), |
| 411 | 411 | '!prev_email_addr' => $boinc_user->previous_email_addr, |
| 412 | 412 | ), |
| 413 | - NULL, 'boinc:account-credentials-change') |
|
| 413 | + null, 'boinc:account-credentials-change') |
|
| 414 | 414 | ); |
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | // If user is changing email or password, require that the current |
| 419 | 419 | // password has been given as well. |
| 420 | - if (($changing_email OR $changing_pass) AND !user_access('administer users')) { |
|
| 420 | + if (($changing_email or $changing_pass) and !user_access('administer users')) { |
|
| 421 | 421 | // If changing email or password, require current password |
| 422 | 422 | // (except in cases where password is being reset) |
| 423 | 423 | if (isset($_SESSION['reset_pass'])) { |
@@ -426,10 +426,10 @@ discard block |
||
| 426 | 426 | else { |
| 427 | 427 | $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
| 428 | 428 | if (!$edit['current_pass']) { |
| 429 | - form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.', array(), NULL, 'boinc:account-credentials-change')); |
|
| 429 | + form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.', array(), null, 'boinc:account-credentials-change')); |
|
| 430 | 430 | } |
| 431 | 431 | elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
| 432 | - form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:account-credentials-change')); |
|
| 432 | + form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), null, 'boinc:account-credentials-change')); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | } |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | // If an admin tries to change the email and NOT the password, show |
| 439 | 439 | // error message. BOINC requires both to be changed together. |
| 440 | - if ($changing_email AND !$changing_pass AND user_access('administer users')) { |
|
| 441 | - 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 | + if ($changing_email and !$changing_pass and user_access('administer users')) { |
|
| 441 | + form_set_error('pass', bts('If changing a user\'s email, you must also change the password simultaneously.', array(), null, 'boinc:account-credentials-change')); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | // Expansion required to allow account key in place of passwd...? |
@@ -457,8 +457,8 @@ discard block |
||
| 457 | 457 | $edit = $form_state['values']; |
| 458 | 458 | // The Drupal submit function expects a "name" field, even though |
| 459 | 459 | // it contains an email address and we will not allow a user name |
| 460 | - if (!$edit['name']) form_set_error('name', bts('Please enter your email address', array(), NULL, 'boinc:forgot-password')); |
|
| 461 | - 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 | + if (!$edit['name']) form_set_error('name', bts('Please enter your email address', array(), null, 'boinc:forgot-password')); |
|
| 461 | + 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')); |
|
| 462 | 462 | else { |
| 463 | 463 | // set email addrress to lower case |
| 464 | 464 | $lower_email_addr = strtolower($edit['name']); |
@@ -476,8 +476,8 @@ discard block |
||
| 476 | 476 | form_set_error('name', bts('No account exists for @email -- please create an account using a BOINC client -- !instructions', |
| 477 | 477 | array( |
| 478 | 478 | '@email' => $edit['name'], |
| 479 | - '!instructions' => l(bts('Instructions', array(), NULL, 'boinc:forgot-password'), 'join') |
|
| 480 | - ), NULL, 'boinc:forgot-password')); |
|
| 479 | + '!instructions' => l(bts('Instructions', array(), null, 'boinc:forgot-password'), 'join') |
|
| 480 | + ), null, 'boinc:forgot-password')); |
|
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | } |
@@ -491,16 +491,16 @@ discard block |
||
| 491 | 491 | $project_domain = $headers['Host']; |
| 492 | 492 | $form['heading'] = array( |
| 493 | 493 | '#type' => 'markup', |
| 494 | - '#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>' |
|
| 494 | + '#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>' |
|
| 495 | 495 | ); |
| 496 | 496 | $form['instructions'] = array( |
| 497 | 497 | '#type' => 'markup', |
| 498 | 498 | '#value' => '' . |
| 499 | - '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:", array(), NULL, 'boinc:authenticator-login-page') . |
|
| 499 | + '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:", array(), null, 'boinc:authenticator-login-page') . |
|
| 500 | 500 | ' <ul>' . |
| 501 | - ' <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>' . |
|
| 502 | - ' <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>' . |
|
| 503 | - ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:", array(), NULL, 'boinc:authenticator-login-page') . |
|
| 501 | + ' <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>' . |
|
| 502 | + ' <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>' . |
|
| 503 | + ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:", array(), null, 'boinc:authenticator-login-page') . |
|
| 504 | 504 | ' <pre>' . |
| 505 | 505 | '<account>' . "\n" . |
| 506 | 506 | " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
@@ -510,18 +510,18 @@ discard block |
||
| 510 | 510 | '</account>' . |
| 511 | 511 | ' </pre>' . |
| 512 | 512 | ' </li>' . |
| 513 | - ' <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>' . |
|
| 514 | - ' <li>' . bts('Paste the string into the field below, and click OK.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
| 515 | - ' <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>' . |
|
| 513 | + ' <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>' . |
|
| 514 | + ' <li>' . bts('Paste the string into the field below, and click OK.', array(), null, 'boinc:authenticator-login-page') . '</li>' . |
|
| 515 | + ' <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>' . |
|
| 516 | 516 | ' </ul>' . |
| 517 | 517 | '</p>' |
| 518 | 518 | ); |
| 519 | 519 | $form['authenticator'] = array( |
| 520 | - '#title' => bts('Log in with authenticator', array(), NULL, 'boinc:authenticator-login-page'), |
|
| 520 | + '#title' => bts('Log in with authenticator', array(), null, 'boinc:authenticator-login-page'), |
|
| 521 | 521 | '#type' => 'textfield', |
| 522 | 522 | '#size' => 60, |
| 523 | 523 | '#maxlength' => 32, |
| 524 | - '#required' => TRUE, |
|
| 524 | + '#required' => true, |
|
| 525 | 525 | '#description' => null |
| 526 | 526 | ); |
| 527 | 527 | |
@@ -533,12 +533,12 @@ discard block |
||
| 533 | 533 | $form['submit'] = array( |
| 534 | 534 | '#prefix' => '<li class="first tab">', |
| 535 | 535 | '#type' => 'submit', |
| 536 | - '#value' => bts('OK', array(), NULL, 'boinc:form-ok'), |
|
| 536 | + '#value' => bts('OK', array(), null, 'boinc:form-ok'), |
|
| 537 | 537 | '#suffix' => '</li>', |
| 538 | 538 | '#weight' => 1002, |
| 539 | 539 | ); |
| 540 | 540 | $form['form control tabs'] = array( |
| 541 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/password') . '</li>', |
|
| 541 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), 'user/password') . '</li>', |
|
| 542 | 542 | '#weight' => 1003, |
| 543 | 543 | ); |
| 544 | 544 | $form['form control tabs suffix'] = array( |
@@ -555,11 +555,11 @@ discard block |
||
| 555 | 555 | $authenticator = $form_state['values']['authenticator']; |
| 556 | 556 | if (strlen($authenticator) != 32) { |
| 557 | 557 | // We notify the form API that this field has failed validation. |
| 558 | - form_set_error('authenticator', bts('That authenticator is not valid.', array(), NULL, 'boinc:authenticator-login-page')); |
|
| 558 | + form_set_error('authenticator', bts('That authenticator is not valid.', array(), null, 'boinc:authenticator-login-page')); |
|
| 559 | 559 | } else { |
| 560 | 560 | require_boinc('boinc_db'); |
| 561 | 561 | $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); |
| 562 | - if (!$boinc_user) form_set_error('authenticator', bts('There is no account with that authenticator.', array(), NULL, 'boinc:authenticator-login-page')); |
|
| 562 | + if (!$boinc_user) form_set_error('authenticator', bts('There is no account with that authenticator.', array(), null, 'boinc:authenticator-login-page')); |
|
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | 565 | |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | function boincuser_moderate_profile_reject_form(&$form_state, $uid) { |
| 583 | 583 | $form_state['storage']['reject_profile_uid'] = $uid; |
| 584 | 584 | $form['reason'] = array( |
| 585 | - '#title' => bts('Reason for rejecting this profile', array(), NULL, 'boinc:moderate-user'), |
|
| 585 | + '#title' => bts('Reason for rejecting this profile', array(), null, 'boinc:moderate-user'), |
|
| 586 | 586 | '#type' => 'textarea', |
| 587 | - '#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'), |
|
| 587 | + '#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'), |
|
| 588 | 588 | '#default_value' => '', |
| 589 | 589 | ); |
| 590 | 590 | |
@@ -596,12 +596,12 @@ discard block |
||
| 596 | 596 | $form['submit'] = array( |
| 597 | 597 | '#prefix' => '<li class="first tab">', |
| 598 | 598 | '#type' => 'submit', |
| 599 | - '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
|
| 599 | + '#value' => bts('Submit', array(), null, 'boinc:form-submit'), |
|
| 600 | 600 | '#suffix' => '</li>', |
| 601 | 601 | '#weight' => 1002, |
| 602 | 602 | ); |
| 603 | 603 | $form['form control tabs'] = array( |
| 604 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
|
| 604 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
|
| 605 | 605 | '#weight' => 1003, |
| 606 | 606 | ); |
| 607 | 607 | $form['form control tabs suffix'] = array( |
@@ -627,15 +627,15 @@ discard block |
||
| 627 | 627 | function boincuser_moderate_user_ban_form(&$form_state, $uid) { |
| 628 | 628 | $form_state['storage']['ban_user_uid'] = $uid; |
| 629 | 629 | $form['reason'] = array( |
| 630 | - '#title' => bts('Reason for banning this user', array(), NULL, 'boinc:moderate-user'), |
|
| 630 | + '#title' => bts('Reason for banning this user', array(), null, 'boinc:moderate-user'), |
|
| 631 | 631 | '#type' => 'textarea', |
| 632 | - '#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'), |
|
| 632 | + '#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'), |
|
| 633 | 633 | '#default_value' => '', |
| 634 | 634 | ); |
| 635 | 635 | $form['duration'] = array( |
| 636 | - '#title' => bts('Duration of the ban', array(), NULL, 'boinc:moderate-user'), |
|
| 636 | + '#title' => bts('Duration of the ban', array(), null, 'boinc:moderate-user'), |
|
| 637 | 637 | '#type' => 'textfield', |
| 638 | - '#description' => bts('The number of days until the ban expires. Set to 0 to ban permanently.', array(), NULL, 'boinc:moderate-user'), |
|
| 638 | + '#description' => bts('The number of days until the ban expires. Set to 0 to ban permanently.', array(), null, 'boinc:moderate-user'), |
|
| 639 | 639 | '#default_value' => '', |
| 640 | 640 | ); |
| 641 | 641 | |
@@ -647,12 +647,12 @@ discard block |
||
| 647 | 647 | $form['submit'] = array( |
| 648 | 648 | '#prefix' => '<li class="first tab">', |
| 649 | 649 | '#type' => 'submit', |
| 650 | - '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
|
| 650 | + '#value' => bts('Submit', array(), null, 'boinc:form-submit'), |
|
| 651 | 651 | '#suffix' => '</li>', |
| 652 | 652 | '#weight' => 1002, |
| 653 | 653 | ); |
| 654 | 654 | $form['form control tabs'] = array( |
| 655 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
|
| 655 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
|
| 656 | 656 | '#weight' => 1003, |
| 657 | 657 | ); |
| 658 | 658 | $form['form control tabs suffix'] = array( |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | drupal_goto(); |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - 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' ); |
|
| 699 | + 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' ); |
|
| 700 | 700 | |
| 701 | 701 | $form = array(); |
| 702 | 702 | drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); |
@@ -707,12 +707,12 @@ discard block |
||
| 707 | 707 | '#type' => 'fieldset', |
| 708 | 708 | '#prefix' => '<div id="termsofuse-wrapper">', // This is our wrapper div. |
| 709 | 709 | '#suffix' => '</div>', |
| 710 | - '#tree' => TRUE, |
|
| 710 | + '#tree' => true, |
|
| 711 | 711 | ); |
| 712 | 712 | |
| 713 | 713 | $form['termsofuse']['title1'] = array( |
| 714 | 714 | '#weight' => -12, |
| 715 | - '#value' => '<h2>' . bts( variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:termsofuse-form' ) . '</h2>', |
|
| 715 | + '#value' => '<h2>' . bts( variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), null, 'project:termsofuse-form' ) . '</h2>', |
|
| 716 | 716 | '#prefix' => '<div id="register-title1">', |
| 717 | 717 | '#suffix' => '</div>', |
| 718 | 718 | ); |
@@ -720,14 +720,14 @@ discard block |
||
| 720 | 720 | // Terms of use section |
| 721 | 721 | $form['termsofuse']['body'] = array( |
| 722 | 722 | '#weight' => -10, |
| 723 | - '#value' => bts($termsofuse, array(), NULL, 'project:termsofuse-form'), |
|
| 723 | + '#value' => bts($termsofuse, array(), null, 'project:termsofuse-form'), |
|
| 724 | 724 | '#prefix' => '<div id="register-termsofuse">', |
| 725 | 725 | '#suffix' => '</div>', |
| 726 | 726 | ); |
| 727 | 727 | |
| 728 | 728 | $form['termsofuse']['agreeTOU'] = array( |
| 729 | 729 | '#type' => 'checkbox', |
| 730 | - '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:termsofuse-form'), |
|
| 730 | + '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), null, 'project:termsofuse-form'), |
|
| 731 | 731 | '#weight' => -8, |
| 732 | 732 | '#prefix' => '<div id="register-checkbox">', |
| 733 | 733 | '#suffix' => '</div>', |
@@ -743,16 +743,16 @@ discard block |
||
| 743 | 743 | $form['submit'] = array( |
| 744 | 744 | '#prefix' => '<p><p><p><li class="first tab" id="register-submit">', |
| 745 | 745 | '#type' => 'submit', |
| 746 | - '#value' => bts('Yes', array(), NULL, 'boinc:form-submit'), |
|
| 746 | + '#value' => bts('Yes', array(), null, 'boinc:form-submit'), |
|
| 747 | 747 | '#suffix' => '</li>', |
| 748 | 748 | ); |
| 749 | 749 | $form['form control tabs'] = array( |
| 750 | - '#value' => '<li class="tab">' . l(bts('NO - LOGOUT', array(), NULL, 'boinc:form-cancel'), '/logout') . '</li>', |
|
| 750 | + '#value' => '<li class="tab">' . l(bts('NO - LOGOUT', array(), null, 'boinc:form-cancel'), '/logout') . '</li>', |
|
| 751 | 751 | ); |
| 752 | 752 | if (module_exists('boincuser_delete')) { |
| 753 | 753 | $deletelink = '/user/' . $user->uid . '/delete'; |
| 754 | 754 | $form['deleteaccount'] = array( |
| 755 | - '#value' => '<li class="tab">' . l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink) . '</li>', |
|
| 755 | + '#value' => '<li class="tab">' . l(bts('NO - DELETE ACCOUNT', array(), null, 'boinc:form-delete-user'), $deletelink) . '</li>', |
|
| 756 | 756 | ); |
| 757 | 757 | } |
| 758 | 758 | |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | function boincuser_termsofuse_form_validate($form, &$form_state) { |
| 769 | 769 | // Check TOU agreement |
| 770 | 770 | if (!$form_state['values']['termsofuse']['agreeTOU']) { |
| 771 | - 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')); |
|
| 771 | + 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')); |
|
| 772 | 772 | } |
| 773 | 773 | } |
| 774 | 774 | |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | if (!boincuser_consentto_termsofuse($user)) { |
| 778 | 778 | form_set_error('termsofuse', |
| 779 | 779 | bts('There was an error in agreeing to the terms of use. The @project administrators have been notified.', |
| 780 | - array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:termsofuse-form') |
|
| 780 | + array('@project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:termsofuse-form') |
|
| 781 | 781 | ); |
| 782 | 782 | } |
| 783 | 783 | |
@@ -810,9 +810,9 @@ discard block |
||
| 810 | 810 | if (!is_valid_token($boincid, $token, 'E')) { |
| 811 | 811 | drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your email address.', |
| 812 | 812 | array( |
| 813 | - '!link' => l(bts('changing', array(), NULL, 'boinc:revert-email-change'), "/account/info/edit"), |
|
| 813 | + '!link' => l(bts('changing', array(), null, 'boinc:revert-email-change'), "/account/info/edit"), |
|
| 814 | 814 | ), |
| 815 | - NULL, 'boinc:revert-email-change'), 'error'); |
|
| 815 | + null, 'boinc:revert-email-change'), 'error'); |
|
| 816 | 816 | drupal_goto(); |
| 817 | 817 | } |
| 818 | 818 | |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | array( |
| 828 | 828 | '!prev_email' => $account->boincuser_previous_email_addr, |
| 829 | 829 | ), |
| 830 | - NULL, 'boinc:revert-email-change'). |
|
| 830 | + null, 'boinc:revert-email-change'). |
|
| 831 | 831 | '</p>', |
| 832 | 832 | ); |
| 833 | 833 | |
@@ -844,11 +844,11 @@ discard block |
||
| 844 | 844 | ); |
| 845 | 845 | $form['buttons']['submit']['#type'] = 'submit'; |
| 846 | 846 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
| 847 | - $form['buttons']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
| 847 | + $form['buttons']['submit']['#value'] = bts('Submit', array(), null, 'boinc:form-submit'); |
|
| 848 | 848 | $form['buttons']['submit']['#suffix'] = '</li>'; |
| 849 | 849 | $form['buttons']['submit']['#weight'] = 1002; |
| 850 | 850 | $form['buttons']['cancel'] = array( |
| 851 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit') . '</li>', |
|
| 851 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), 'user/info/edit') . '</li>', |
|
| 852 | 852 | '#weight' => 1005, |
| 853 | 853 | ); |
| 854 | 854 | $form['buttons']['form control tabs suffix'] = array( |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | array( |
| 875 | 875 | '@email' => $boinc_user->previous_email_addr, |
| 876 | 876 | '@project' => variable_get('site_name', 'Drupal-BOINC'), |
| 877 | - ), NULL, 'boinc:add-new-user')); |
|
| 877 | + ), null, 'boinc:add-new-user')); |
|
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | } |