@@ -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 | } |
@@ -59,37 +59,37 @@ |
||
| 59 | 59 | // hook_user() functions. |
| 60 | 60 | |
| 61 | 61 | switch ($action) { |
| 62 | - case 'soft_obfuscate': |
|
| 63 | - obfuscate_account($boinc_user); |
|
| 64 | - _boincuser_delete_comment_reassign($account); |
|
| 65 | - _boincuser_delete_node_reassign($account); |
|
| 66 | - _boincuser_delete_privatemsg_delete($account); |
|
| 67 | - _boincuser_delete_friends($account); |
|
| 68 | - // delete the user's profile |
|
| 69 | - $profile = content_profile_load('profile', $account->uid); |
|
| 70 | - node_delete($profile->nid); |
|
| 71 | - // Drupal account - |
|
| 72 | - // * 'block'/disable the account |
|
| 73 | - // * set name, mail, pass, and init to deleted |
|
| 74 | - // * erase signature |
|
| 75 | - $myarray = array( |
|
| 76 | - 'status' => 0, |
|
| 77 | - 'name' => 'deleted_' . time() . '_' . random_string(), |
|
| 78 | - 'mail' => 'deleted_' . time() . '_' . random_string(), |
|
| 79 | - 'pass' => 'deleted_' . time() . '_' . random_string(), |
|
| 80 | - 'signature' => '', |
|
| 81 | - 'init' => 'deleted_' . time() . '_' . random_string(), |
|
| 82 | - ); |
|
| 83 | - user_save($account, $myarray); |
|
| 84 | - break; |
|
| 85 | - case 'hard_wipe': |
|
| 86 | - wipe_account($boinc_user); |
|
| 87 | - user_delete(array(), $account->uid); |
|
| 88 | - break; |
|
| 89 | - default: |
|
| 90 | - watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
|
| 91 | - '%action' => $action, |
|
| 92 | - ), WATCHDOG_ERROR); |
|
| 62 | + case 'soft_obfuscate': |
|
| 63 | + obfuscate_account($boinc_user); |
|
| 64 | + _boincuser_delete_comment_reassign($account); |
|
| 65 | + _boincuser_delete_node_reassign($account); |
|
| 66 | + _boincuser_delete_privatemsg_delete($account); |
|
| 67 | + _boincuser_delete_friends($account); |
|
| 68 | + // delete the user's profile |
|
| 69 | + $profile = content_profile_load('profile', $account->uid); |
|
| 70 | + node_delete($profile->nid); |
|
| 71 | + // Drupal account - |
|
| 72 | + // * 'block'/disable the account |
|
| 73 | + // * set name, mail, pass, and init to deleted |
|
| 74 | + // * erase signature |
|
| 75 | + $myarray = array( |
|
| 76 | + 'status' => 0, |
|
| 77 | + 'name' => 'deleted_' . time() . '_' . random_string(), |
|
| 78 | + 'mail' => 'deleted_' . time() . '_' . random_string(), |
|
| 79 | + 'pass' => 'deleted_' . time() . '_' . random_string(), |
|
| 80 | + 'signature' => '', |
|
| 81 | + 'init' => 'deleted_' . time() . '_' . random_string(), |
|
| 82 | + ); |
|
| 83 | + user_save($account, $myarray); |
|
| 84 | + break; |
|
| 85 | + case 'hard_wipe': |
|
| 86 | + wipe_account($boinc_user); |
|
| 87 | + user_delete(array(), $account->uid); |
|
| 88 | + break; |
|
| 89 | + default: |
|
| 90 | + watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
|
| 91 | + '%action' => $action, |
|
| 92 | + ), WATCHDOG_ERROR); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |