@@ -551,12 +551,12 @@ discard block |
||
551 | 551 | */ |
552 | 552 | function boinccore_locale($op = 'groups', $group = NULL) { |
553 | 553 | switch ($op) { |
554 | - case 'groups': |
|
555 | - return array('boinc' => 'BOINC'); |
|
556 | - case 'info': |
|
557 | - //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
|
558 | - $info['boinc']['format'] = FALSE; |
|
559 | - return $info; |
|
554 | + case 'groups': |
|
555 | + return array('boinc' => 'BOINC'); |
|
556 | + case 'info': |
|
557 | + //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
|
558 | + $info['boinc']['format'] = FALSE; |
|
559 | + return $info; |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | |
@@ -1885,19 +1885,19 @@ discard block |
||
1885 | 1885 | // Transform arguments before inserting them. |
1886 | 1886 | foreach ($args as $key => $value) { |
1887 | 1887 | switch ($key [0]) { |
1888 | - case '@': |
|
1889 | - // Escaped only. |
|
1890 | - $args [$key] = check_plain($value); |
|
1891 | - break; |
|
1892 | - |
|
1893 | - case '%': |
|
1894 | - default: |
|
1895 | - // Escaped and placeholder. |
|
1896 | - $args [$key] = theme('placeholder', $value); |
|
1897 | - break; |
|
1898 | - |
|
1899 | - case '!': |
|
1900 | - // Pass-through. |
|
1888 | + case '@': |
|
1889 | + // Escaped only. |
|
1890 | + $args [$key] = check_plain($value); |
|
1891 | + break; |
|
1892 | + |
|
1893 | + case '%': |
|
1894 | + default: |
|
1895 | + // Escaped and placeholder. |
|
1896 | + $args [$key] = theme('placeholder', $value); |
|
1897 | + break; |
|
1898 | + |
|
1899 | + case '!': |
|
1900 | + // Pass-through. |
|
1901 | 1901 | } |
1902 | 1902 | } |
1903 | 1903 | return strtr($string, $args); |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | $sender = user_load($sender->uid); |
627 | 627 | |
628 | 628 | switch ($status) { |
629 | - case FLAG_FRIEND_FLAGGED: |
|
630 | - // Sender accepted recipient's friend request |
|
631 | - $email['subject'] = bts('!name accepted your friend request [!site]', array( |
|
632 | - '!name' => $sender->boincuser_name, |
|
633 | - '!site' => variable_get('site_name', 'Drupal-BOINC'), |
|
634 | - ), NULL, 'boinc:friend-request-email'); |
|
635 | - $email['body'] = bts('!name confirmed you as a friend on !site. |
|
629 | + case FLAG_FRIEND_FLAGGED: |
|
630 | + // Sender accepted recipient's friend request |
|
631 | + $email['subject'] = bts('!name accepted your friend request [!site]', array( |
|
632 | + '!name' => $sender->boincuser_name, |
|
633 | + '!site' => variable_get('site_name', 'Drupal-BOINC'), |
|
634 | + ), NULL, 'boinc:friend-request-email'); |
|
635 | + $email['body'] = bts('!name confirmed you as a friend on !site. |
|
636 | 636 | |
637 | 637 | Follow this link to view his or her profile: |
638 | 638 | !link |
@@ -641,17 +641,17 @@ discard block |
||
641 | 641 | |
642 | 642 | Thanks, |
643 | 643 | The !site team', array( |
644 | - '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
|
645 | - '!site' => variable_get('site_name', 'Drupal-BOINC'), |
|
646 | - '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '', |
|
647 | - '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
|
648 | - ), array(), NULL, 'boinc:friend-request-email'); |
|
649 | - break; |
|
644 | + '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
|
645 | + '!site' => variable_get('site_name', 'Drupal-BOINC'), |
|
646 | + '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '', |
|
647 | + '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
|
648 | + ), array(), NULL, 'boinc:friend-request-email'); |
|
649 | + break; |
|
650 | 650 | |
651 | - case FLAG_FRIEND_PENDING: |
|
652 | - // Sender is requesting to be recipient's friend |
|
653 | - $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email'); |
|
654 | - $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts. |
|
651 | + case FLAG_FRIEND_PENDING: |
|
652 | + // Sender is requesting to be recipient's friend |
|
653 | + $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email'); |
|
654 | + $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts. |
|
655 | 655 | |
656 | 656 | Follow the link below to view this request: |
657 | 657 | !link |
@@ -660,13 +660,13 @@ discard block |
||
660 | 660 | |
661 | 661 | Thanks, |
662 | 662 | The !site team', array( |
663 | - '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
|
664 | - '!site' => variable_get('site_name', 'Drupal-BOINC'), |
|
665 | - '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '', |
|
666 | - '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
|
667 | - ), |
|
668 | - array(), NULL, 'boinc:friend-request-email'); |
|
669 | - break; |
|
663 | + '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
|
664 | + '!site' => variable_get('site_name', 'Drupal-BOINC'), |
|
665 | + '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '', |
|
666 | + '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
|
667 | + ), |
|
668 | + array(), NULL, 'boinc:friend-request-email'); |
|
669 | + break; |
|
670 | 670 | } |
671 | 671 | return $email; |
672 | 672 | } |
@@ -1398,72 +1398,72 @@ |
||
1398 | 1398 | |
1399 | 1399 | switch ($op) { |
1400 | 1400 | // Return stored strings |
1401 | - case 'mem-report': |
|
1402 | - return $strings; |
|
1403 | - |
|
1404 | - // Store string in memory (only supports single strings) |
|
1405 | - case 'mem-store': |
|
1406 | - $strings[$value['msgid']] = $value['msgstr']; |
|
1407 | - return; |
|
1408 | - |
|
1409 | - // Called at end of import to inform the user |
|
1410 | - case 'db-report': |
|
1411 | - return array( |
|
1412 | - $headerdone, |
|
1413 | - $report['additions'], |
|
1414 | - $report['updates'], |
|
1415 | - $report['deletes'], |
|
1416 | - $report['skips'], |
|
1417 | - ); |
|
1401 | + case 'mem-report': |
|
1402 | + return $strings; |
|
1403 | + |
|
1404 | + // Store string in memory (only supports single strings) |
|
1405 | + case 'mem-store': |
|
1406 | + $strings[$value['msgid']] = $value['msgstr']; |
|
1407 | + return; |
|
1408 | + |
|
1409 | + // Called at end of import to inform the user |
|
1410 | + case 'db-report': |
|
1411 | + return array( |
|
1412 | + $headerdone, |
|
1413 | + $report['additions'], |
|
1414 | + $report['updates'], |
|
1415 | + $report['deletes'], |
|
1416 | + $report['skips'], |
|
1417 | + ); |
|
1418 | 1418 | |
1419 | - // Store the string we got in the database. |
|
1420 | - case 'db-store': |
|
1421 | - // We got header information. |
|
1422 | - if ($value['msgid'] == '') { |
|
1423 | - $languages = language_list(); |
|
1424 | - if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) { |
|
1425 | - // Since we only need to parse the header if we ought to update the |
|
1426 | - // plural formula, only run this if we don't need to keep existing |
|
1427 | - // data untouched or if we don't have an existing plural formula. |
|
1428 | - $header = _locale_import_parse_header($value['msgstr']); |
|
1429 | - |
|
1430 | - // Get and store the plural formula if available. |
|
1431 | - if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) { |
|
1432 | - list($nplurals, $plural) = $p; |
|
1433 | - db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang); |
|
1434 | - } |
|
1419 | + // Store the string we got in the database. |
|
1420 | + case 'db-store': |
|
1421 | + // We got header information. |
|
1422 | + if ($value['msgid'] == '') { |
|
1423 | + $languages = language_list(); |
|
1424 | + if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) { |
|
1425 | + // Since we only need to parse the header if we ought to update the |
|
1426 | + // plural formula, only run this if we don't need to keep existing |
|
1427 | + // data untouched or if we don't have an existing plural formula. |
|
1428 | + $header = _locale_import_parse_header($value['msgstr']); |
|
1429 | + |
|
1430 | + // Get and store the plural formula if available. |
|
1431 | + if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) { |
|
1432 | + list($nplurals, $plural) = $p; |
|
1433 | + db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang); |
|
1435 | 1434 | } |
1436 | - $headerdone = TRUE; |
|
1437 | 1435 | } |
1436 | + $headerdone = TRUE; |
|
1437 | + } |
|
1438 | 1438 | |
1439 | - else { |
|
1440 | - // Some real string to import. |
|
1441 | - $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); |
|
1442 | - |
|
1443 | - if (strpos($value['msgid'], "\0")) { |
|
1444 | - // This string has plural versions. |
|
1445 | - $english = explode("\0", $value['msgid'], 2); |
|
1446 | - $entries = array_keys($value['msgstr']); |
|
1447 | - for ($i = 3; $i <= count($entries); $i++) { |
|
1448 | - $english[] = $english[1]; |
|
1449 | - } |
|
1450 | - $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries); |
|
1451 | - $english = array_map('_locale_import_append_plural', $english, $entries); |
|
1452 | - foreach ($translation as $key => $trans) { |
|
1453 | - if ($key == 0) { |
|
1454 | - $plid = 0; |
|
1455 | - } |
|
1456 | - $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); |
|
1439 | + else { |
|
1440 | + // Some real string to import. |
|
1441 | + $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); |
|
1442 | + |
|
1443 | + if (strpos($value['msgid'], "\0")) { |
|
1444 | + // This string has plural versions. |
|
1445 | + $english = explode("\0", $value['msgid'], 2); |
|
1446 | + $entries = array_keys($value['msgstr']); |
|
1447 | + for ($i = 3; $i <= count($entries); $i++) { |
|
1448 | + $english[] = $english[1]; |
|
1449 | + } |
|
1450 | + $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries); |
|
1451 | + $english = array_map('_locale_import_append_plural', $english, $entries); |
|
1452 | + foreach ($translation as $key => $trans) { |
|
1453 | + if ($key == 0) { |
|
1454 | + $plid = 0; |
|
1457 | 1455 | } |
1456 | + $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); |
|
1458 | 1457 | } |
1458 | + } |
|
1459 | 1459 | |
1460 | - else { |
|
1461 | - // A simple string to import. |
|
1462 | - $english = $value['msgid']; |
|
1463 | - $translation = $value['msgstr']; |
|
1464 | - _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode); |
|
1465 | - } |
|
1460 | + else { |
|
1461 | + // A simple string to import. |
|
1462 | + $english = $value['msgid']; |
|
1463 | + $translation = $value['msgstr']; |
|
1464 | + _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode); |
|
1466 | 1465 | } |
1466 | + } |
|
1467 | 1467 | } // end of db-store operation |
1468 | 1468 | } |
1469 | 1469 |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function boinc_solr_search_block($op = 'list', $delta = 0, $edit = array()) { |
20 | 20 | switch ($op) { |
21 | - case 'list': |
|
22 | - return boinc_solr_search_block_info(); |
|
23 | - break; |
|
24 | - case 'view': |
|
25 | - return boinc_solr_search_block_view($delta); |
|
26 | - break; |
|
27 | - case 'configure': |
|
28 | - case 'save': |
|
29 | - default: |
|
21 | + case 'list': |
|
22 | + return boinc_solr_search_block_info(); |
|
23 | + break; |
|
24 | + case 'view': |
|
25 | + return boinc_solr_search_block_view($delta); |
|
26 | + break; |
|
27 | + case 'configure': |
|
28 | + case 'save': |
|
29 | + default: |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -53,26 +53,26 @@ discard block |
||
53 | 53 | function boinc_solr_search_block_view($delta = 0) { |
54 | 54 | $block = array(); |
55 | 55 | switch($delta) { |
56 | - case 'boinc_solr_search_0': |
|
57 | - $items = array( |
|
58 | - bts('By default a search matches ANY search term. Results with more than one term will be presented higher in the search results.', array(), NULL, 'boinc:search-help-sidebar-block'), |
|
59 | - bts('You may use \'AND\' to have the search engine return results with ALL search terms.', array(), NULL, 'boinc:search-help-sidebar-block'), |
|
60 | - bts('For example, searching for \'boinc AND client\' will only contain results with words boinc and client.', array(), NULL, 'boinc:search-help-sidebar-block') |
|
61 | - ); |
|
56 | + case 'boinc_solr_search_0': |
|
57 | + $items = array( |
|
58 | + bts('By default a search matches ANY search term. Results with more than one term will be presented higher in the search results.', array(), NULL, 'boinc:search-help-sidebar-block'), |
|
59 | + bts('You may use \'AND\' to have the search engine return results with ALL search terms.', array(), NULL, 'boinc:search-help-sidebar-block'), |
|
60 | + bts('For example, searching for \'boinc AND client\' will only contain results with words boinc and client.', array(), NULL, 'boinc:search-help-sidebar-block') |
|
61 | + ); |
|
62 | 62 | |
63 | - drupal_add_js('misc/collapse.js'); |
|
64 | - // For Drupal 7 the format of the array changes, see https://api.drupal.org/api/drupal/includes%21form.inc/function/theme_fieldset/7.x for details. |
|
65 | - $collapsible_item = array( |
|
66 | - '#title' => bts('Search Help', array(), NULL, 'boinc:search-help-sidebar-block'), |
|
67 | - '#description' => theme_item_list($items), |
|
68 | - '#collapsible' => TRUE, |
|
69 | - '#collapsed' => TRUE, |
|
70 | - '#attributes' => array( |
|
71 | - 'class' => 'search-help-block', |
|
72 | - ), |
|
73 | - ); |
|
74 | - $block['content'] = theme('fieldset', $collapsible_item); |
|
75 | - break; |
|
63 | + drupal_add_js('misc/collapse.js'); |
|
64 | + // For Drupal 7 the format of the array changes, see https://api.drupal.org/api/drupal/includes%21form.inc/function/theme_fieldset/7.x for details. |
|
65 | + $collapsible_item = array( |
|
66 | + '#title' => bts('Search Help', array(), NULL, 'boinc:search-help-sidebar-block'), |
|
67 | + '#description' => theme_item_list($items), |
|
68 | + '#collapsible' => TRUE, |
|
69 | + '#collapsed' => TRUE, |
|
70 | + '#attributes' => array( |
|
71 | + 'class' => 'search-help-block', |
|
72 | + ), |
|
73 | + ); |
|
74 | + $block['content'] = theme('fieldset', $collapsible_item); |
|
75 | + break; |
|
76 | 76 | } |
77 | 77 | return $block; |
78 | 78 | } |
@@ -7,15 +7,15 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | class views_handler_argument_boincuser_id extends views_handler_argument_numeric { |
10 | - function construct() { |
|
11 | - parent::construct(); |
|
12 | - } |
|
10 | +function construct() { |
|
11 | +parent::construct(); |
|
12 | +} |
|
13 | 13 | |
14 | - function set_argument($arg) { |
|
15 | - // When setting the ID argument, convert to BOINC ID |
|
16 | - $id = is_numeric($arg) ? $arg : 0; |
|
17 | - $boinc_id = db_result(db_query("SELECT boinc_id FROM {boincuser} WHERE uid = %d", $id)); |
|
18 | - $this->argument = $boinc_id; |
|
19 | - return $this->validate_arg($boinc_id); |
|
20 | - } |
|
14 | +function set_argument($arg) { |
|
15 | +// When setting the ID argument, convert to BOINC ID |
|
16 | +$id = is_numeric($arg) ? $arg : 0; |
|
17 | +$boinc_id = db_result(db_query("SELECT boinc_id FROM {boincuser} WHERE uid = %d", $id)); |
|
18 | +$this->argument = $boinc_id; |
|
19 | +return $this->validate_arg($boinc_id); |
|
20 | +} |
|
21 | 21 | } |
@@ -7,15 +7,15 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | class views_handler_argument_boincteam_id extends views_handler_argument_numeric { |
10 | - function construct() { |
|
11 | - parent::construct(); |
|
12 | - } |
|
10 | +function construct() { |
|
11 | +parent::construct(); |
|
12 | +} |
|
13 | 13 | |
14 | - function set_argument($arg) { |
|
15 | - // When setting the ID argument, convert to BOINC ID |
|
16 | - $id = is_numeric($arg) ? $arg : 0; |
|
17 | - $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id)); |
|
18 | - $this->argument = $boinc_id; |
|
19 | - return $this->validate_arg($boinc_id); |
|
20 | - } |
|
14 | +function set_argument($arg) { |
|
15 | +// When setting the ID argument, convert to BOINC ID |
|
16 | +$id = is_numeric($arg) ? $arg : 0; |
|
17 | +$boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id)); |
|
18 | +$this->argument = $boinc_id; |
|
19 | +return $this->validate_arg($boinc_id); |
|
20 | +} |
|
21 | 21 | } |
@@ -13,255 +13,255 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function boincuser_views_data() { |
15 | 15 | |
16 | - // ----------------------------------------------------------------------------------------------- |
|
17 | - // Definition for user table |
|
18 | - // ----------------------------------------------------------------------------------------------- |
|
16 | +// ----------------------------------------------------------------------------------------------- |
|
17 | +// Definition for user table |
|
18 | +// ----------------------------------------------------------------------------------------------- |
|
19 | 19 | |
20 | - $data['user']['table']['group'] = t('BOINC'); |
|
20 | +$data['user']['table']['group'] = t('BOINC'); |
|
21 | 21 | |
22 | - $data['user']['table']['base'] = array( |
|
23 | - 'field' => 'id', |
|
24 | - 'title' => t('BOINC user'), |
|
25 | - 'help' => t('BOINC account data for a user'), |
|
26 | - 'database' => 'boinc_ro' |
|
27 | - ); |
|
22 | +$data['user']['table']['base'] = array( |
|
23 | + 'field' => 'id', |
|
24 | + 'title' => t('BOINC user'), |
|
25 | + 'help' => t('BOINC account data for a user'), |
|
26 | + 'database' => 'boinc_ro' |
|
27 | +); |
|
28 | 28 | |
29 | - // Describe each of the individual fields in this table to Views. For |
|
30 | - // each field, you may define what field, sort, argument, and/or filter |
|
31 | - // handlers it supports. This will determine where in the Views interface you |
|
32 | - // may use the field. |
|
29 | +// Describe each of the individual fields in this table to Views. For |
|
30 | +// each field, you may define what field, sort, argument, and/or filter |
|
31 | +// handlers it supports. This will determine where in the Views interface you |
|
32 | +// may use the field. |
|
33 | 33 | |
34 | - // Primary keys allowed as arguments |
|
34 | +// Primary keys allowed as arguments |
|
35 | 35 | |
36 | - $data['user']['id'] = array( |
|
37 | - 'title' => bts('Id', array(), NULL, 'boinc:user-id'), |
|
38 | - 'help' => t('The BOINC ID of the user account.'), |
|
39 | - 'field' => array( |
|
40 | - 'handler' => 'views_handler_field_numeric', |
|
41 | - 'click sortable' => TRUE |
|
42 | - ), |
|
43 | - 'argument' => array( |
|
44 | - 'handler' => 'views_handler_argument_boincuser_id', // custom handler |
|
45 | - 'name field' => 'title', // the field to display in the summary. |
|
46 | - 'numeric' => TRUE, |
|
47 | - 'validate type' => 'id' |
|
48 | - ), |
|
49 | - 'filter' => array( |
|
50 | - 'handler' => 'views_handler_filter_numeric' |
|
51 | - ), |
|
52 | - 'sort' => array( |
|
53 | - 'handler' => 'views_handler_sort_numeric' |
|
54 | - ) |
|
55 | - ); |
|
56 | - $data['user']['teamid'] = array( |
|
57 | - 'title' => bts('Team ID', array(), NULL, 'boinc:team-id'), |
|
58 | - 'help' => t('The ID of the user\'s team.'), |
|
59 | - 'field' => array( |
|
60 | - 'handler' => 'views_handler_field_numeric', |
|
61 | - 'click sortable' => TRUE, |
|
62 | - ), |
|
63 | - 'argument' => array( |
|
64 | - 'handler' => 'views_handler_argument_boincteam_id', // custom handler |
|
65 | - 'name field' => 'title', // the field to display in the summary. |
|
66 | - 'numeric' => TRUE, |
|
67 | - 'validate type' => 'id' |
|
68 | - ), |
|
69 | - 'filter' => array( |
|
70 | - 'handler' => 'views_handler_filter_numeric' |
|
71 | - ), |
|
72 | - 'sort' => array( |
|
73 | - 'handler' => 'views_handler_sort_numeric' |
|
74 | - ) |
|
75 | - ); |
|
36 | +$data['user']['id'] = array( |
|
37 | +'title' => bts('Id', array(), NULL, 'boinc:user-id'), |
|
38 | +'help' => t('The BOINC ID of the user account.'), |
|
39 | +'field' => array( |
|
40 | + 'handler' => 'views_handler_field_numeric', |
|
41 | + 'click sortable' => TRUE |
|
42 | +), |
|
43 | +'argument' => array( |
|
44 | + 'handler' => 'views_handler_argument_boincuser_id', // custom handler |
|
45 | + 'name field' => 'title', // the field to display in the summary. |
|
46 | + 'numeric' => TRUE, |
|
47 | + 'validate type' => 'id' |
|
48 | +), |
|
49 | +'filter' => array( |
|
50 | + 'handler' => 'views_handler_filter_numeric' |
|
51 | +), |
|
52 | +'sort' => array( |
|
53 | + 'handler' => 'views_handler_sort_numeric' |
|
54 | +) |
|
55 | +); |
|
56 | +$data['user']['teamid'] = array( |
|
57 | +'title' => bts('Team ID', array(), NULL, 'boinc:team-id'), |
|
58 | +'help' => t('The ID of the user\'s team.'), |
|
59 | +'field' => array( |
|
60 | + 'handler' => 'views_handler_field_numeric', |
|
61 | + 'click sortable' => TRUE, |
|
62 | +), |
|
63 | +'argument' => array( |
|
64 | + 'handler' => 'views_handler_argument_boincteam_id', // custom handler |
|
65 | + 'name field' => 'title', // the field to display in the summary. |
|
66 | + 'numeric' => TRUE, |
|
67 | + 'validate type' => 'id' |
|
68 | +), |
|
69 | +'filter' => array( |
|
70 | + 'handler' => 'views_handler_filter_numeric' |
|
71 | +), |
|
72 | +'sort' => array( |
|
73 | + 'handler' => 'views_handler_sort_numeric' |
|
74 | +) |
|
75 | +); |
|
76 | 76 | |
77 | - // Descriptions of general host fields (alphabetized) |
|
77 | +// Descriptions of general host fields (alphabetized) |
|
78 | 78 | |
79 | - $data['user']['authenticator'] = array( |
|
80 | - 'title' => bts('Account Key', array(), NULL, 'boinc:user-info'), |
|
81 | - 'help' => t('The BOINC account key of the user.'), |
|
82 | - 'field' => array( |
|
83 | - 'handler' => 'views_handler_field', |
|
84 | - 'click sortable' => TRUE |
|
85 | - ), |
|
86 | - 'filter' => array( |
|
87 | - 'handler' => 'views_handler_filter_string' |
|
88 | - ), |
|
89 | - 'sort' => array( |
|
90 | - 'handler' => 'views_handler_sort_string' |
|
91 | - ) |
|
92 | - ); |
|
93 | - $data['user']['country'] = array( |
|
94 | - 'title' => bts('Country', array(), NULL, 'boinc:country-of-origin'), |
|
95 | - 'help' => t('The country of the user.'), |
|
96 | - 'field' => array( |
|
97 | - 'handler' => 'views_handler_field', |
|
98 | - 'click sortable' => TRUE |
|
99 | - ), |
|
100 | - 'filter' => array( |
|
101 | - 'handler' => 'views_handler_filter_string' |
|
102 | - ), |
|
103 | - 'sort' => array( |
|
104 | - 'handler' => 'views_handler_sort_string' |
|
105 | - ) |
|
106 | - ); |
|
107 | - $data['user']['create_time'] = array( |
|
108 | - 'title' => bts('Member since', array(), NULL, 'boinc:user-info'), |
|
109 | - 'help' => t('When the BOINC account was created.'), |
|
110 | - 'field' => array( |
|
111 | - 'handler' => 'views_handler_field_date', |
|
112 | - 'click sortable' => TRUE |
|
113 | - ), |
|
114 | - 'filter' => array( |
|
115 | - 'handler' => 'views_handler_filter_date' |
|
116 | - ), |
|
117 | - 'sort' => array( |
|
118 | - 'handler' => 'views_handler_sort_date' |
|
119 | - ) |
|
120 | - ); |
|
121 | - $data['user']['cross_project_id'] = array( |
|
122 | - 'title' => bts('CPID', array(), NULL, 'boinc:user-info'), |
|
123 | - 'help' => t('The cross project user identifier.'), |
|
124 | - 'field' => array( |
|
125 | - 'handler' => 'views_handler_field', |
|
126 | - 'click sortable' => TRUE |
|
127 | - ), |
|
128 | - 'filter' => array( |
|
129 | - 'handler' => 'views_handler_filter_string' |
|
130 | - ), |
|
131 | - 'sort' => array( |
|
132 | - 'handler' => 'views_handler_sort_string' |
|
133 | - ) |
|
134 | - ); |
|
135 | - $data['user']['email_addr'] = array( |
|
136 | - 'title' => bts('Email Address', array(), NULL, 'boinc:user-info'), |
|
137 | - 'help' => t('The BOINC account email address.'), |
|
138 | - 'field' => array( |
|
139 | - 'handler' => 'views_handler_field', |
|
140 | - 'click sortable' => TRUE |
|
141 | - ), |
|
142 | - 'filter' => array( |
|
143 | - 'handler' => 'views_handler_filter_string' |
|
144 | - ), |
|
145 | - 'sort' => array( |
|
146 | - 'handler' => 'views_handler_sort_string' |
|
147 | - ) |
|
148 | - ); |
|
149 | - $data['user']['expavg_credit'] = array( |
|
150 | - 'title' => bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC'), |
|
151 | - 'help' => t('A decaying average of credit per day for the user.'), |
|
152 | - 'field' => array( |
|
153 | - 'handler' => 'views_handler_field_numeric', |
|
154 | - 'click sortable' => TRUE, |
|
155 | - 'float' => TRUE |
|
156 | - ), |
|
157 | - 'filter' => array( |
|
158 | - 'handler' => 'views_handler_filter_numeric' |
|
159 | - ), |
|
160 | - 'sort' => array( |
|
161 | - 'handler' => 'views_handler_sort_numeric' |
|
162 | - ) |
|
163 | - ); |
|
164 | - $data['user']['name'] = array( |
|
165 | - 'title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
|
166 | - 'help' => t('The BOINC account user name.'), |
|
167 | - 'field' => array( |
|
168 | - 'handler' => 'views_handler_field', |
|
169 | - 'click sortable' => TRUE |
|
170 | - ), |
|
171 | - 'filter' => array( |
|
172 | - 'handler' => 'views_handler_filter_string' |
|
173 | - ), |
|
174 | - 'sort' => array( |
|
175 | - 'handler' => 'views_handler_sort_string' |
|
176 | - ) |
|
177 | - ); |
|
178 | - $data['user']['passwd_hash'] = array( |
|
179 | - 'title' => bts('Password Hash', array(), NULL, 'boinc:user-info'), |
|
180 | - 'help' => t('The user password hash'), |
|
181 | - 'field' => array( |
|
182 | - 'handler' => 'views_handler_field', |
|
183 | - 'click sortable' => TRUE |
|
184 | - ), |
|
185 | - 'filter' => array( |
|
186 | - 'handler' => 'views_handler_filter_string' |
|
187 | - ), |
|
188 | - 'sort' => array( |
|
189 | - 'handler' => 'views_handler_sort_string' |
|
190 | - ) |
|
191 | - ); |
|
192 | - $data['user']['postal_code'] = array( |
|
193 | - 'title' => bts('Postal Code', array(), NULL, 'boinc:user-info'), |
|
194 | - 'help' => t('The postal code of the user.'), |
|
195 | - 'field' => array( |
|
196 | - 'handler' => 'views_handler_field', |
|
197 | - 'click sortable' => TRUE |
|
198 | - ), |
|
199 | - 'filter' => array( |
|
200 | - 'handler' => 'views_handler_filter_string' |
|
201 | - ), |
|
202 | - 'sort' => array( |
|
203 | - 'handler' => 'views_handler_sort_string' |
|
204 | - ) |
|
205 | - ); |
|
206 | - $data['user']['send_email'] = array( |
|
207 | - 'title' => bts('Send Email', array(), NULL, 'boinc:user-info'), |
|
208 | - 'help' => t('User preference to allow email communications.'), |
|
209 | - 'field' => array( |
|
210 | - 'handler' => 'views_handler_field_numeric', |
|
211 | - 'click sortable' => TRUE |
|
212 | - ), |
|
213 | - 'filter' => array( |
|
214 | - 'handler' => 'views_handler_filter_numeric' |
|
215 | - ), |
|
216 | - 'sort' => array( |
|
217 | - 'handler' => 'views_handler_sort_numeric' |
|
218 | - ) |
|
219 | - ); |
|
220 | - $data['user']['show_hosts'] = array( |
|
221 | - 'title' => bts('Show Hosts', array(), NULL, 'boinc:user-info'), |
|
222 | - 'help' => t('User preference to display owned computers.'), |
|
223 | - 'field' => array( |
|
224 | - 'handler' => 'views_handler_field_numeric', |
|
225 | - 'click sortable' => TRUE |
|
226 | - ), |
|
227 | - 'filter' => array( |
|
228 | - 'handler' => 'views_handler_filter_numeric' |
|
229 | - ), |
|
230 | - 'sort' => array( |
|
231 | - 'handler' => 'views_handler_sort_numeric' |
|
232 | - ) |
|
233 | - ); |
|
234 | - $data['user']['total_credit'] = array( |
|
235 | - 'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'), |
|
236 | - 'help' => t('The total accumulated BOINC credit for the user.'), |
|
237 | - 'field' => array( |
|
238 | - 'handler' => 'views_handler_field_numeric', |
|
239 | - 'click sortable' => TRUE, |
|
240 | - 'float' => TRUE |
|
241 | - ), |
|
242 | - 'filter' => array( |
|
243 | - 'handler' => 'views_handler_filter_numeric' |
|
244 | - ), |
|
245 | - 'sort' => array( |
|
246 | - 'handler' => 'views_handler_sort_numeric' |
|
247 | - ) |
|
248 | - ); |
|
249 | - $data['user']['url'] = array( |
|
250 | - 'title' => bts('URL', array(), NULL, 'boinc:website-of-user-or-team'), |
|
251 | - 'help' => t('The URL provided by the user'), |
|
252 | - 'field' => array( |
|
253 | - 'handler' => 'views_handler_field', |
|
254 | - 'click sortable' => TRUE |
|
255 | - ), |
|
256 | - 'filter' => array( |
|
257 | - 'handler' => 'views_handler_filter_string' |
|
258 | - ), |
|
259 | - 'sort' => array( |
|
260 | - 'handler' => 'views_handler_sort_string' |
|
261 | - ) |
|
262 | - ); |
|
79 | +$data['user']['authenticator'] = array( |
|
80 | +'title' => bts('Account Key', array(), NULL, 'boinc:user-info'), |
|
81 | +'help' => t('The BOINC account key of the user.'), |
|
82 | +'field' => array( |
|
83 | + 'handler' => 'views_handler_field', |
|
84 | + 'click sortable' => TRUE |
|
85 | +), |
|
86 | +'filter' => array( |
|
87 | + 'handler' => 'views_handler_filter_string' |
|
88 | +), |
|
89 | +'sort' => array( |
|
90 | + 'handler' => 'views_handler_sort_string' |
|
91 | +) |
|
92 | +); |
|
93 | +$data['user']['country'] = array( |
|
94 | +'title' => bts('Country', array(), NULL, 'boinc:country-of-origin'), |
|
95 | +'help' => t('The country of the user.'), |
|
96 | +'field' => array( |
|
97 | + 'handler' => 'views_handler_field', |
|
98 | + 'click sortable' => TRUE |
|
99 | +), |
|
100 | +'filter' => array( |
|
101 | + 'handler' => 'views_handler_filter_string' |
|
102 | +), |
|
103 | +'sort' => array( |
|
104 | + 'handler' => 'views_handler_sort_string' |
|
105 | +) |
|
106 | +); |
|
107 | +$data['user']['create_time'] = array( |
|
108 | +'title' => bts('Member since', array(), NULL, 'boinc:user-info'), |
|
109 | +'help' => t('When the BOINC account was created.'), |
|
110 | +'field' => array( |
|
111 | + 'handler' => 'views_handler_field_date', |
|
112 | + 'click sortable' => TRUE |
|
113 | +), |
|
114 | +'filter' => array( |
|
115 | + 'handler' => 'views_handler_filter_date' |
|
116 | +), |
|
117 | +'sort' => array( |
|
118 | + 'handler' => 'views_handler_sort_date' |
|
119 | +) |
|
120 | +); |
|
121 | +$data['user']['cross_project_id'] = array( |
|
122 | +'title' => bts('CPID', array(), NULL, 'boinc:user-info'), |
|
123 | +'help' => t('The cross project user identifier.'), |
|
124 | +'field' => array( |
|
125 | + 'handler' => 'views_handler_field', |
|
126 | + 'click sortable' => TRUE |
|
127 | +), |
|
128 | +'filter' => array( |
|
129 | + 'handler' => 'views_handler_filter_string' |
|
130 | +), |
|
131 | +'sort' => array( |
|
132 | + 'handler' => 'views_handler_sort_string' |
|
133 | +) |
|
134 | +); |
|
135 | +$data['user']['email_addr'] = array( |
|
136 | + 'title' => bts('Email Address', array(), NULL, 'boinc:user-info'), |
|
137 | +'help' => t('The BOINC account email address.'), |
|
138 | +'field' => array( |
|
139 | + 'handler' => 'views_handler_field', |
|
140 | + 'click sortable' => TRUE |
|
141 | +), |
|
142 | +'filter' => array( |
|
143 | + 'handler' => 'views_handler_filter_string' |
|
144 | +), |
|
145 | +'sort' => array( |
|
146 | + 'handler' => 'views_handler_sort_string' |
|
147 | +) |
|
148 | +); |
|
149 | +$data['user']['expavg_credit'] = array( |
|
150 | +'title' => bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC'), |
|
151 | +'help' => t('A decaying average of credit per day for the user.'), |
|
152 | +'field' => array( |
|
153 | + 'handler' => 'views_handler_field_numeric', |
|
154 | + 'click sortable' => TRUE, |
|
155 | + 'float' => TRUE |
|
156 | +), |
|
157 | +'filter' => array( |
|
158 | + 'handler' => 'views_handler_filter_numeric' |
|
159 | +), |
|
160 | +'sort' => array( |
|
161 | + 'handler' => 'views_handler_sort_numeric' |
|
162 | +) |
|
163 | +); |
|
164 | +$data['user']['name'] = array( |
|
165 | +'title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
|
166 | +'help' => t('The BOINC account user name.'), |
|
167 | +'field' => array( |
|
168 | + 'handler' => 'views_handler_field', |
|
169 | + 'click sortable' => TRUE |
|
170 | +), |
|
171 | +'filter' => array( |
|
172 | + 'handler' => 'views_handler_filter_string' |
|
173 | +), |
|
174 | +'sort' => array( |
|
175 | + 'handler' => 'views_handler_sort_string' |
|
176 | +) |
|
177 | +); |
|
178 | +$data['user']['passwd_hash'] = array( |
|
179 | +'title' => bts('Password Hash', array(), NULL, 'boinc:user-info'), |
|
180 | +'help' => t('The user password hash'), |
|
181 | +'field' => array( |
|
182 | + 'handler' => 'views_handler_field', |
|
183 | + 'click sortable' => TRUE |
|
184 | +), |
|
185 | +'filter' => array( |
|
186 | + 'handler' => 'views_handler_filter_string' |
|
187 | +), |
|
188 | +'sort' => array( |
|
189 | + 'handler' => 'views_handler_sort_string' |
|
190 | +) |
|
191 | +); |
|
192 | +$data['user']['postal_code'] = array( |
|
193 | +'title' => bts('Postal Code', array(), NULL, 'boinc:user-info'), |
|
194 | +'help' => t('The postal code of the user.'), |
|
195 | +'field' => array( |
|
196 | + 'handler' => 'views_handler_field', |
|
197 | + 'click sortable' => TRUE |
|
198 | +), |
|
199 | +'filter' => array( |
|
200 | + 'handler' => 'views_handler_filter_string' |
|
201 | +), |
|
202 | +'sort' => array( |
|
203 | + 'handler' => 'views_handler_sort_string' |
|
204 | +) |
|
205 | +); |
|
206 | +$data['user']['send_email'] = array( |
|
207 | +'title' => bts('Send Email', array(), NULL, 'boinc:user-info'), |
|
208 | +'help' => t('User preference to allow email communications.'), |
|
209 | +'field' => array( |
|
210 | + 'handler' => 'views_handler_field_numeric', |
|
211 | + 'click sortable' => TRUE |
|
212 | +), |
|
213 | +'filter' => array( |
|
214 | + 'handler' => 'views_handler_filter_numeric' |
|
215 | +), |
|
216 | +'sort' => array( |
|
217 | + 'handler' => 'views_handler_sort_numeric' |
|
218 | +) |
|
219 | +); |
|
220 | +$data['user']['show_hosts'] = array( |
|
221 | +'title' => bts('Show Hosts', array(), NULL, 'boinc:user-info'), |
|
222 | +'help' => t('User preference to display owned computers.'), |
|
223 | +'field' => array( |
|
224 | + 'handler' => 'views_handler_field_numeric', |
|
225 | + 'click sortable' => TRUE |
|
226 | +), |
|
227 | +'filter' => array( |
|
228 | + 'handler' => 'views_handler_filter_numeric' |
|
229 | +), |
|
230 | +'sort' => array( |
|
231 | + 'handler' => 'views_handler_sort_numeric' |
|
232 | +) |
|
233 | +); |
|
234 | +$data['user']['total_credit'] = array( |
|
235 | +'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'), |
|
236 | +'help' => t('The total accumulated BOINC credit for the user.'), |
|
237 | +'field' => array( |
|
238 | + 'handler' => 'views_handler_field_numeric', |
|
239 | + 'click sortable' => TRUE, |
|
240 | + 'float' => TRUE |
|
241 | +), |
|
242 | +'filter' => array( |
|
243 | + 'handler' => 'views_handler_filter_numeric' |
|
244 | +), |
|
245 | +'sort' => array( |
|
246 | + 'handler' => 'views_handler_sort_numeric' |
|
247 | +) |
|
248 | +); |
|
249 | +$data['user']['url'] = array( |
|
250 | +'title' => bts('URL', array(), NULL, 'boinc:website-of-user-or-team'), |
|
251 | +'help' => t('The URL provided by the user'), |
|
252 | +'field' => array( |
|
253 | + 'handler' => 'views_handler_field', |
|
254 | + 'click sortable' => TRUE |
|
255 | +), |
|
256 | +'filter' => array( |
|
257 | + 'handler' => 'views_handler_filter_string' |
|
258 | +), |
|
259 | +'sort' => array( |
|
260 | + 'handler' => 'views_handler_sort_string' |
|
261 | +) |
|
262 | +); |
|
263 | 263 | |
264 | - return $data; |
|
264 | +return $data; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /* |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | */ |
273 | 273 | |
274 | 274 | function boincuser_views_handlers() { |
275 | - return array( |
|
276 | - 'info' => array( |
|
277 | - 'path' => drupal_get_path('module', 'boincuser') . '/views', |
|
278 | - ), |
|
279 | - 'handlers' => array( |
|
280 | - 'views_handler_argument_boincuser_id' => array( |
|
281 | - 'parent' => 'views_handler_argument_numeric' |
|
282 | - ), |
|
283 | - 'views_handler_argument_boincteam_id' => array( |
|
284 | - 'parent' => 'views_handler_argument_numeric' |
|
285 | - ), |
|
286 | - ) |
|
287 | - ); |
|
275 | +return array( |
|
276 | +'info' => array( |
|
277 | + 'path' => drupal_get_path('module', 'boincuser') . '/views', |
|
278 | +), |
|
279 | +'handlers' => array( |
|
280 | + 'views_handler_argument_boincuser_id' => array( |
|
281 | + 'parent' => 'views_handler_argument_numeric' |
|
282 | + ), |
|
283 | + 'views_handler_argument_boincteam_id' => array( |
|
284 | + 'parent' => 'views_handler_argument_numeric' |
|
285 | + ), |
|
286 | +) |
|
287 | +); |
|
288 | 288 | } |
@@ -50,47 +50,47 @@ discard block |
||
50 | 50 | } |
51 | 51 | $resultLength = 0; |
52 | 52 | switch ($algo) { |
53 | - case PASSWORD_BCRYPT: |
|
54 | - $cost = PASSWORD_BCRYPT_DEFAULT_COST; |
|
55 | - if (isset($options['cost'])) { |
|
56 | - $cost = (int) $options['cost']; |
|
57 | - if ($cost < 4 || $cost > 31) { |
|
58 | - trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING); |
|
59 | - return null; |
|
60 | - } |
|
53 | + case PASSWORD_BCRYPT: |
|
54 | + $cost = PASSWORD_BCRYPT_DEFAULT_COST; |
|
55 | + if (isset($options['cost'])) { |
|
56 | + $cost = (int) $options['cost']; |
|
57 | + if ($cost < 4 || $cost > 31) { |
|
58 | + trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING); |
|
59 | + return null; |
|
61 | 60 | } |
62 | - // The length of salt to generate |
|
63 | - $raw_salt_len = 16; |
|
64 | - // The length required in the final serialization |
|
65 | - $required_salt_len = 22; |
|
66 | - $hash_format = sprintf("$2y$%02d$", $cost); |
|
67 | - // The expected length of the final crypt() output |
|
68 | - $resultLength = 60; |
|
69 | - break; |
|
70 | - default: |
|
71 | - trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING); |
|
72 | - return null; |
|
61 | + } |
|
62 | + // The length of salt to generate |
|
63 | + $raw_salt_len = 16; |
|
64 | + // The length required in the final serialization |
|
65 | + $required_salt_len = 22; |
|
66 | + $hash_format = sprintf("$2y$%02d$", $cost); |
|
67 | + // The expected length of the final crypt() output |
|
68 | + $resultLength = 60; |
|
69 | + break; |
|
70 | + default: |
|
71 | + trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING); |
|
72 | + return null; |
|
73 | 73 | } |
74 | 74 | $salt_req_encoding = false; |
75 | 75 | if (isset($options['salt'])) { |
76 | 76 | switch (gettype($options['salt'])) { |
77 | - case 'NULL': |
|
78 | - case 'boolean': |
|
79 | - case 'integer': |
|
80 | - case 'double': |
|
81 | - case 'string': |
|
77 | + case 'NULL': |
|
78 | + case 'boolean': |
|
79 | + case 'integer': |
|
80 | + case 'double': |
|
81 | + case 'string': |
|
82 | + $salt = (string) $options['salt']; |
|
83 | + break; |
|
84 | + case 'object': |
|
85 | + if (method_exists($options['salt'], '__tostring')) { |
|
82 | 86 | $salt = (string) $options['salt']; |
83 | 87 | break; |
84 | - case 'object': |
|
85 | - if (method_exists($options['salt'], '__tostring')) { |
|
86 | - $salt = (string) $options['salt']; |
|
87 | - break; |
|
88 | - } |
|
89 | - case 'array': |
|
90 | - case 'resource': |
|
91 | - default: |
|
92 | - trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING); |
|
93 | - return null; |
|
88 | + } |
|
89 | + case 'array': |
|
90 | + case 'resource': |
|
91 | + default: |
|
92 | + trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING); |
|
93 | + return null; |
|
94 | 94 | } |
95 | 95 | if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) { |
96 | 96 | trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING); |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | return true; |
213 | 213 | } |
214 | 214 | switch ($algo) { |
215 | - case PASSWORD_BCRYPT: |
|
216 | - $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; |
|
217 | - if ($cost !== $info['options']['cost']) { |
|
218 | - return true; |
|
219 | - } |
|
220 | - break; |
|
215 | + case PASSWORD_BCRYPT: |
|
216 | + $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; |
|
217 | + if ($cost !== $info['options']['cost']) { |
|
218 | + return true; |
|
219 | + } |
|
220 | + break; |
|
221 | 221 | } |
222 | 222 | return false; |
223 | 223 | } |
@@ -13,45 +13,45 @@ discard block |
||
13 | 13 | * a form array |
14 | 14 | */ |
15 | 15 | function boincuser_delete_settings() { |
16 | - $form = array(); |
|
17 | - |
|
18 | - $default = array( |
|
19 | - 'boincuser_delete_type' => variable_get('boincuser_delete_type', ''), |
|
20 | - 'boincuser_delete_redirect' => variable_get('boincuser_delete_redirect', '<front>'), |
|
21 | - ); |
|
22 | - |
|
23 | - $form['options'] = array( |
|
24 | - '#type' => 'fieldset', |
|
25 | - '#title' => t('Options'), |
|
26 | - ); |
|
27 | - $form['options']['help'] = array( |
|
28 | - '#value' => t('When a user deletes their account, which option is shown to the user? A soft/obfusate delete, a hard/wipe delete, or let the user chose between the two.'), |
|
29 | - '#weight' => 11, |
|
30 | - ); |
|
31 | - $form['options']['boincuser_delete_type'] = array( |
|
32 | - '#type' => 'radios', |
|
33 | - '#title' => t('Type of delete'), |
|
34 | - '#default_value' => $default['boincuser_delete_type'], |
|
35 | - '#options' => array( |
|
36 | - 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
37 | - 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
38 | - 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
39 | - ), |
|
40 | - '#weight' => 21, |
|
41 | - ); |
|
42 | - |
|
43 | - $form['redirect'] = array( |
|
44 | - '#type' => 'fieldset', |
|
45 | - '#title' => t('Redirect'), |
|
46 | - ); |
|
47 | - $form['redirect']['boincuser_delete_redirect'] = array( |
|
48 | - '#type' => 'textfield', |
|
49 | - '#title' => t('Redirection page'), |
|
50 | - '#default_value' => $default['boincuser_delete_redirect'], |
|
51 | - '#description' => t('Choose where to redirect your users after account deletion. Any valid Drupal path will do, e.g. %front or %node', array('%front' => '<front>', '%node' => 'node/1')), |
|
52 | - ); |
|
53 | - |
|
54 | - return system_settings_form($form); |
|
16 | +$form = array(); |
|
17 | + |
|
18 | +$default = array( |
|
19 | +'boincuser_delete_type' => variable_get('boincuser_delete_type', ''), |
|
20 | +'boincuser_delete_redirect' => variable_get('boincuser_delete_redirect', '<front>'), |
|
21 | +); |
|
22 | + |
|
23 | +$form['options'] = array( |
|
24 | +'#type' => 'fieldset', |
|
25 | +'#title' => t('Options'), |
|
26 | +); |
|
27 | +$form['options']['help'] = array( |
|
28 | +'#value' => t('When a user deletes their account, which option is shown to the user? A soft/obfusate delete, a hard/wipe delete, or let the user chose between the two.'), |
|
29 | +'#weight' => 11, |
|
30 | +); |
|
31 | +$form['options']['boincuser_delete_type'] = array( |
|
32 | +'#type' => 'radios', |
|
33 | +'#title' => t('Type of delete'), |
|
34 | +'#default_value' => $default['boincuser_delete_type'], |
|
35 | +'#options' => array( |
|
36 | + 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
37 | + 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
38 | + 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
39 | +), |
|
40 | +'#weight' => 21, |
|
41 | +); |
|
42 | + |
|
43 | +$form['redirect'] = array( |
|
44 | +'#type' => 'fieldset', |
|
45 | +'#title' => t('Redirect'), |
|
46 | +); |
|
47 | +$form['redirect']['boincuser_delete_redirect'] = array( |
|
48 | +'#type' => 'textfield', |
|
49 | +'#title' => t('Redirection page'), |
|
50 | +'#default_value' => $default['boincuser_delete_redirect'], |
|
51 | +'#description' => t('Choose where to redirect your users after account deletion. Any valid Drupal path will do, e.g. %front or %node', array('%front' => '<front>', '%node' => 'node/1')), |
|
52 | +); |
|
53 | + |
|
54 | +return system_settings_form($form); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -60,124 +60,124 @@ discard block |
||
60 | 60 | * password checks. |
61 | 61 | */ |
62 | 62 | function boincuser_delete_admindelete(&$form_state, $uid) { |
63 | - $form = array(); |
|
64 | - |
|
65 | - $form['#uid'] = $uid; |
|
66 | - |
|
67 | - $form['account']['help'] = array( |
|
68 | - '#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>", |
|
69 | - '#weight' => -1, |
|
70 | - '#prefix' => "<div id='delete-instructions'>", |
|
71 | - '#suffix' => "</div>", |
|
63 | +$form = array(); |
|
64 | + |
|
65 | +$form['#uid'] = $uid; |
|
66 | + |
|
67 | +$form['account']['help'] = array( |
|
68 | +'#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>", |
|
69 | +'#weight' => -1, |
|
70 | +'#prefix' => "<div id='delete-instructions'>", |
|
71 | +'#suffix' => "</div>", |
|
72 | +); |
|
73 | + |
|
74 | +$account = user_load($uid); |
|
75 | +if ($account) { |
|
76 | +drupal_set_title($account->boincuser_name); |
|
77 | + |
|
78 | +$form['account']['boincuser_name'] = array( |
|
79 | + '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
80 | +); |
|
81 | +$form['account']['boincuser_id'] = array( |
|
82 | + '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
83 | +); |
|
84 | +$form['account']['drupal_name'] = array( |
|
85 | + '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
86 | +); |
|
87 | +$form['account']['user_id'] = array( |
|
88 | + '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
89 | +); |
|
90 | + |
|
91 | +$form['account']['user_delete_action'] = array( |
|
92 | + '#type' => 'radios', |
|
93 | + '#options' => array( |
|
94 | + 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | + 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
72 | 96 | ); |
73 | 97 | |
74 | - $account = user_load($uid); |
|
75 | - if ($account) { |
|
76 | - drupal_set_title($account->boincuser_name); |
|
77 | - |
|
78 | - $form['account']['boincuser_name'] = array( |
|
79 | - '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
80 | - ); |
|
81 | - $form['account']['boincuser_id'] = array( |
|
82 | - '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
83 | - ); |
|
84 | - $form['account']['drupal_name'] = array( |
|
85 | - '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
86 | - ); |
|
87 | - $form['account']['user_id'] = array( |
|
88 | - '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
89 | - ); |
|
90 | - |
|
91 | - $form['account']['user_delete_action'] = array( |
|
92 | - '#type' => 'radios', |
|
93 | - '#options' => array( |
|
94 | - 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | - 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
96 | - ); |
|
97 | - |
|
98 | - $form['account']['surecheckbox'] = array( |
|
99 | - '#type' => 'checkbox', |
|
100 | - '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
101 | - array('%name' => $account->boincuser_name) |
|
102 | - ), |
|
103 | - '#default_value' => FALSE, |
|
104 | - ); |
|
105 | - |
|
106 | - $form['account']['current_pass'] = array( |
|
107 | - '#type' => 'password', |
|
108 | - '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
109 | - '#size' => 17, |
|
110 | - '#attributes' => array( |
|
111 | - 'autocomplete' => 'off', |
|
112 | - ), |
|
113 | - '#weight' => 25, |
|
114 | - ); |
|
115 | - |
|
116 | - // Action buttons |
|
117 | - $form['actions']['submit'] = array( |
|
118 | - '#type' => 'submit', |
|
119 | - '#value' => t('Submit'), |
|
120 | - ); |
|
121 | - $form['actions']['cancel'] = array( |
|
122 | - '#type' => 'button', |
|
123 | - '#value' => t('Cancel'), |
|
124 | - '#executes_submit_callback' => TRUE, |
|
125 | - '#validate' => array(), |
|
126 | - '#submit' => array('_boincuser_delete_cancel'), |
|
127 | - ); |
|
128 | - |
|
129 | - $form['#redirect'] = 'account'; |
|
130 | - } |
|
131 | - else { |
|
132 | - $form['noaccount'] = array( |
|
133 | - '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
134 | - ); |
|
135 | - } |
|
136 | - |
|
137 | - return $form; |
|
98 | +$form['account']['surecheckbox'] = array( |
|
99 | + '#type' => 'checkbox', |
|
100 | + '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
101 | + array('%name' => $account->boincuser_name) |
|
102 | + ), |
|
103 | + '#default_value' => FALSE, |
|
104 | +); |
|
105 | + |
|
106 | +$form['account']['current_pass'] = array( |
|
107 | + '#type' => 'password', |
|
108 | + '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
109 | + '#size' => 17, |
|
110 | + '#attributes' => array( |
|
111 | + 'autocomplete' => 'off', |
|
112 | + ), |
|
113 | + '#weight' => 25, |
|
114 | +); |
|
115 | + |
|
116 | +// Action buttons |
|
117 | +$form['actions']['submit'] = array( |
|
118 | + '#type' => 'submit', |
|
119 | + '#value' => t('Submit'), |
|
120 | +); |
|
121 | +$form['actions']['cancel'] = array( |
|
122 | + '#type' => 'button', |
|
123 | + '#value' => t('Cancel'), |
|
124 | + '#executes_submit_callback' => TRUE, |
|
125 | + '#validate' => array(), |
|
126 | + '#submit' => array('_boincuser_delete_cancel'), |
|
127 | +); |
|
128 | + |
|
129 | +$form['#redirect'] = 'account'; |
|
130 | +} |
|
131 | +else { |
|
132 | +$form['noaccount'] = array( |
|
133 | + '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
134 | +); |
|
135 | +} |
|
136 | + |
|
137 | +return $form; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Validation function for admin delete user. |
142 | 142 | */ |
143 | 143 | function boincuser_delete_admindelete_validate($form, &$form_state) { |
144 | - global $user; |
|
145 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
144 | +global $user; |
|
145 | +$boinc_user = boincuser_load($user->uid, TRUE); |
|
146 | 146 | |
147 | - if ($form_state['values']['user_delete_action'] == '') { |
|
148 | - form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
|
149 | - } |
|
147 | +if ($form_state['values']['user_delete_action'] == '') { |
|
148 | +form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
|
149 | +} |
|
150 | 150 | |
151 | - if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
152 | - form_set_error('user_delete_action', t('User Delete action not a predefined value, unknown error in radio buttons.')); |
|
153 | - } |
|
151 | +if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
152 | +form_set_error('user_delete_action', t('User Delete action not a predefined value, unknown error in radio buttons.')); |
|
153 | +} |
|
154 | 154 | |
155 | - if (!($form_state['values']['surecheckbox'])) { |
|
156 | - return form_set_error('surecheckbox', t('Please confirm you are sure you want to delete this account.')); |
|
157 | - } |
|
155 | +if (!($form_state['values']['surecheckbox'])) { |
|
156 | +return form_set_error('surecheckbox', t('Please confirm you are sure you want to delete this account.')); |
|
157 | +} |
|
158 | 158 | |
159 | - if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
160 | - return true; |
|
161 | - } |
|
159 | +if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
160 | +return true; |
|
161 | +} |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Submit function for admin delete user. |
166 | 166 | */ |
167 | 167 | function boincuser_delete_admindelete_submit($form, &$form_state) { |
168 | - // This is the account to be deleted, and not the administrator's |
|
169 | - // account. |
|
170 | - $account = user_load(array('uid' => $form['#uid'])); |
|
171 | - $action = $form_state['values']['user_delete_action']; |
|
168 | +// This is the account to be deleted, and not the administrator's |
|
169 | +// account. |
|
170 | +$account = user_load(array('uid' => $form['#uid'])); |
|
171 | +$action = $form_state['values']['user_delete_action']; |
|
172 | 172 | |
173 | - drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
174 | - array( |
|
175 | - '@uid' => $form['#uid'], |
|
176 | - '@displayname' => $account->boincuser_name, |
|
177 | - )), 'warning'); |
|
173 | +drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
174 | +array( |
|
175 | + '@uid' => $form['#uid'], |
|
176 | + '@displayname' => $account->boincuser_name, |
|
177 | +)), 'warning'); |
|
178 | 178 | |
179 | - // Delete the user |
|
180 | - _boincuser_delete_deleteuser($account, $action); |
|
179 | +// Delete the user |
|
180 | +_boincuser_delete_deleteuser($account, $action); |
|
181 | 181 | |
182 | - drupal_goto('/admin/boinc/user_delete'); |
|
182 | +drupal_goto('/admin/boinc/user_delete'); |
|
183 | 183 | } |