@@ -57,92 +57,92 @@ |
||
57 | 57 | $transform = isset($this->argument->options['validate_argument_transform']) ? $this->argument->options['validate_argument_transform'] : FALSE; |
58 | 58 | |
59 | 59 | switch ($type) { |
60 | - case 'tid': |
|
61 | - if (!is_numeric($argument)) { |
|
62 | - return FALSE; |
|
63 | - } |
|
64 | - |
|
65 | - $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t WHERE t.tid = %d", 't', 'tid', array($argument)), $argument)); |
|
66 | - if (!$result) { |
|
67 | - return FALSE; |
|
68 | - } |
|
69 | - |
|
70 | - return empty($vids) || !empty($vids[$result->vid]); |
|
71 | - case 'tids': |
|
72 | - // An empty argument is not a term so doesn't pass. |
|
73 | - if (empty($argument)) { |
|
74 | - return FALSE; |
|
75 | - } |
|
76 | - |
|
77 | - $tids = new stdClass(); |
|
78 | - $tids->value = $argument; |
|
79 | - $tids = views_break_phrase($argument, $tids); |
|
80 | - if ($tids->value == array(-1)) { |
|
81 | - return FALSE; |
|
82 | - } |
|
83 | - |
|
84 | - $test = drupal_map_assoc($tids->value); |
|
85 | - $titles = array(); |
|
86 | - |
|
87 | - // check, if some tids already verified |
|
88 | - static $validated_cache = array(); |
|
89 | - foreach ($test as $tid) { |
|
90 | - if (isset($validated_cache[$tid])) { |
|
91 | - if ($validated_cache[$tid] === FALSE) { |
|
92 | - return FALSE; |
|
93 | - } |
|
94 | - else { |
|
95 | - $titles[] = $validated_cache[$tid]; |
|
96 | - unset($test[$tid]); |
|
97 | - } |
|
60 | + case 'tid': |
|
61 | + if (!is_numeric($argument)) { |
|
62 | + return FALSE; |
|
63 | + } |
|
64 | + |
|
65 | + $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t WHERE t.tid = %d", 't', 'tid', array($argument)), $argument)); |
|
66 | + if (!$result) { |
|
67 | + return FALSE; |
|
68 | + } |
|
69 | + |
|
70 | + return empty($vids) || !empty($vids[$result->vid]); |
|
71 | + case 'tids': |
|
72 | + // An empty argument is not a term so doesn't pass. |
|
73 | + if (empty($argument)) { |
|
74 | + return FALSE; |
|
75 | + } |
|
76 | + |
|
77 | + $tids = new stdClass(); |
|
78 | + $tids->value = $argument; |
|
79 | + $tids = views_break_phrase($argument, $tids); |
|
80 | + if ($tids->value == array(-1)) { |
|
81 | + return FALSE; |
|
82 | + } |
|
83 | + |
|
84 | + $test = drupal_map_assoc($tids->value); |
|
85 | + $titles = array(); |
|
86 | + |
|
87 | + // check, if some tids already verified |
|
88 | + static $validated_cache = array(); |
|
89 | + foreach ($test as $tid) { |
|
90 | + if (isset($validated_cache[$tid])) { |
|
91 | + if ($validated_cache[$tid] === FALSE) { |
|
92 | + return FALSE; |
|
93 | + } |
|
94 | + else { |
|
95 | + $titles[] = $validated_cache[$tid]; |
|
96 | + unset($test[$tid]); |
|
98 | 97 | } |
99 | 98 | } |
99 | + } |
|
100 | 100 | |
101 | 101 | |
102 | - // if unverified tids left - verify them and cache results |
|
103 | - if (count($test)) { |
|
104 | - $placeholders = implode(', ', array_fill(0, count($test), '%d')); |
|
102 | + // if unverified tids left - verify them and cache results |
|
103 | + if (count($test)) { |
|
104 | + $placeholders = implode(', ', array_fill(0, count($test), '%d')); |
|
105 | 105 | |
106 | - $result = db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t WHERE t.tid IN ($placeholders)", 't', 'tid', array($test)), $test); |
|
107 | - while ($term = db_fetch_object($result)) { |
|
108 | - if ($vids && empty($vids[$term->vid])) { |
|
109 | - $validated_cache[$term->tid] = FALSE; |
|
110 | - return FALSE; |
|
111 | - } |
|
112 | - |
|
113 | - $titles[] = $validated_cache[$term->tid] = check_plain($term->name); |
|
114 | - unset($test[$term->tid]); |
|
106 | + $result = db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t WHERE t.tid IN ($placeholders)", 't', 'tid', array($test)), $test); |
|
107 | + while ($term = db_fetch_object($result)) { |
|
108 | + if ($vids && empty($vids[$term->vid])) { |
|
109 | + $validated_cache[$term->tid] = FALSE; |
|
110 | + return FALSE; |
|
115 | 111 | } |
116 | - } |
|
117 | - |
|
118 | - // Remove duplicate titles |
|
119 | - $titles = array_unique($titles); |
|
120 | - |
|
121 | - $this->argument->validated_title = implode($tids->operator == 'or' ? ' + ' : ', ', $titles); |
|
122 | - // If this is not empty, we did not find a tid. |
|
123 | - return empty($test); |
|
124 | - case 'name': |
|
125 | - case 'convert': |
|
126 | - $and = ''; |
|
127 | - if (!empty($vids)) { |
|
128 | - $and = " AND t.vid IN(" . implode(', ', $vids) . ')'; |
|
129 | - } |
|
130 | - if ($transform) { |
|
131 | - $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t LEFT JOIN {term_synonym} ts ON ts.tid = t.tid WHERE (replace(t.name, ' ', '-') = '%s' OR replace(ts.name, ' ', '-') = '%s')$and", 't', 'tid', array($argument, $argument)), $argument, $argument)); |
|
132 | - } |
|
133 | - else { |
|
134 | - $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t LEFT JOIN {term_synonym} ts ON ts.tid = t.tid WHERE (t.name = '%s' OR ts.name = '%s')$and", 't', 'tid', array($argument, $argument)), $argument, $argument)); |
|
135 | - } |
|
136 | - if (!$result) { |
|
137 | - return FALSE; |
|
138 | - } |
|
139 | 112 | |
140 | - if ($type == 'convert') { |
|
141 | - $this->argument->argument = $result->tid; |
|
113 | + $titles[] = $validated_cache[$term->tid] = check_plain($term->name); |
|
114 | + unset($test[$term->tid]); |
|
142 | 115 | } |
143 | - $this->argument->validated_title = check_plain($result->name); |
|
144 | - |
|
145 | - return TRUE; |
|
116 | + } |
|
117 | + |
|
118 | + // Remove duplicate titles |
|
119 | + $titles = array_unique($titles); |
|
120 | + |
|
121 | + $this->argument->validated_title = implode($tids->operator == 'or' ? ' + ' : ', ', $titles); |
|
122 | + // If this is not empty, we did not find a tid. |
|
123 | + return empty($test); |
|
124 | + case 'name': |
|
125 | + case 'convert': |
|
126 | + $and = ''; |
|
127 | + if (!empty($vids)) { |
|
128 | + $and = " AND t.vid IN(" . implode(', ', $vids) . ')'; |
|
129 | + } |
|
130 | + if ($transform) { |
|
131 | + $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t LEFT JOIN {term_synonym} ts ON ts.tid = t.tid WHERE (replace(t.name, ' ', '-') = '%s' OR replace(ts.name, ' ', '-') = '%s')$and", 't', 'tid', array($argument, $argument)), $argument, $argument)); |
|
132 | + } |
|
133 | + else { |
|
134 | + $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t LEFT JOIN {term_synonym} ts ON ts.tid = t.tid WHERE (t.name = '%s' OR ts.name = '%s')$and", 't', 'tid', array($argument, $argument)), $argument, $argument)); |
|
135 | + } |
|
136 | + if (!$result) { |
|
137 | + return FALSE; |
|
138 | + } |
|
139 | + |
|
140 | + if ($type == 'convert') { |
|
141 | + $this->argument->argument = $result->tid; |
|
142 | + } |
|
143 | + $this->argument->validated_title = check_plain($result->name); |
|
144 | + |
|
145 | + return TRUE; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | } |
@@ -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 |
@@ -643,9 +643,9 @@ discard block |
||
643 | 643 | } |
644 | 644 | break; |
645 | 645 | |
646 | - default: |
|
647 | - // Don't generate form elements for things that aren't explicitly form |
|
648 | - // elements (i.e. 'title', '@attributes' keys, and the like) |
|
646 | + default: |
|
647 | + // Don't generate form elements for things that aren't explicitly form |
|
648 | + // elements (i.e. 'title', '@attributes' keys, and the like) |
|
649 | 649 | } |
650 | 650 | } |
651 | 651 | |
@@ -1863,29 +1863,29 @@ discard block |
||
1863 | 1863 | */ |
1864 | 1864 | function pretty_application_version($appverid, $vernum, $plan_class, $plfm) { |
1865 | 1865 | switch ($appverid) { |
1866 | - case ANON_PLATFORM_UNKNOWN: |
|
1867 | - return "Anonymous platform"; |
|
1868 | - case ANON_PLATFORM_CPU: |
|
1869 | - return "Anonymous platform CPU"; |
|
1870 | - case ANON_PLATFORM_NVIDIA: |
|
1871 | - return "Anonymous platform NVIDIA GPU"; |
|
1872 | - case ANON_PLATFORM_ATI: |
|
1873 | - return "Anonymous platform ATI GPU"; |
|
1874 | - case ANON_PLATFORM_INTEL: |
|
1875 | - return "Anonymous platform Intel GPU"; |
|
1876 | - case 0: |
|
1877 | - return "---"; |
|
1878 | - default: |
|
1879 | - // Handle the case where the appversid is still negative. This |
|
1880 | - // may be cause BOINC has introduced a new anonymous platform |
|
1881 | - // that is not handled by the above case statements. |
|
1882 | - if ($appverid < 0) { |
|
1883 | - return "Unknown Anonymous platform"; |
|
1884 | - } |
|
1885 | - else { |
|
1886 | - $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100); |
|
1887 | - $prettyc = ($plan_class) ? "($av->plan_class)" : ''; |
|
1888 | - return "v$prettyv $prettyc $plfm"; |
|
1889 | - } |
|
1866 | + case ANON_PLATFORM_UNKNOWN: |
|
1867 | + return "Anonymous platform"; |
|
1868 | + case ANON_PLATFORM_CPU: |
|
1869 | + return "Anonymous platform CPU"; |
|
1870 | + case ANON_PLATFORM_NVIDIA: |
|
1871 | + return "Anonymous platform NVIDIA GPU"; |
|
1872 | + case ANON_PLATFORM_ATI: |
|
1873 | + return "Anonymous platform ATI GPU"; |
|
1874 | + case ANON_PLATFORM_INTEL: |
|
1875 | + return "Anonymous platform Intel GPU"; |
|
1876 | + case 0: |
|
1877 | + return "---"; |
|
1878 | + default: |
|
1879 | + // Handle the case where the appversid is still negative. This |
|
1880 | + // may be cause BOINC has introduced a new anonymous platform |
|
1881 | + // that is not handled by the above case statements. |
|
1882 | + if ($appverid < 0) { |
|
1883 | + return "Unknown Anonymous platform"; |
|
1884 | + } |
|
1885 | + else { |
|
1886 | + $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100); |
|
1887 | + $prettyc = ($plan_class) ? "($av->plan_class)" : ''; |
|
1888 | + return "v$prettyv $prettyc $plfm"; |
|
1889 | + } |
|
1890 | 1890 | } |
1891 | 1891 | } |
@@ -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 | } |
@@ -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 | } |
@@ -50,11 +50,11 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | switch ($this->options['format']) { |
53 | - case 'raw': |
|
54 | - $output = $value; |
|
55 | - break; |
|
56 | - default: |
|
57 | - $output = theme('filefield_meta_samplerate', $value); |
|
53 | + case 'raw': |
|
54 | + $output = $value; |
|
55 | + break; |
|
56 | + default: |
|
57 | + $output = theme('filefield_meta_samplerate', $value); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return check_plain($this->options['prefix']) . $output . check_plain($this->options['suffix']); |
@@ -48,20 +48,20 @@ |
||
48 | 48 | $value = $values->{$this->field_alias}; |
49 | 49 | |
50 | 50 | switch ($this->options['format']) { |
51 | - case 'hours': |
|
52 | - $output = date('g', (int) $value); |
|
53 | - break; |
|
54 | - case 'minutes': |
|
55 | - $output = date('i', (int) $value); |
|
56 | - break; |
|
57 | - case 'seconds': |
|
58 | - $output = date('s', (int) $value); |
|
59 | - break; |
|
60 | - case 'total': |
|
61 | - $output = check_plain($value); |
|
62 | - break; |
|
63 | - default: |
|
64 | - $output = theme('filefield_meta_duration', $value); |
|
51 | + case 'hours': |
|
52 | + $output = date('g', (int) $value); |
|
53 | + break; |
|
54 | + case 'minutes': |
|
55 | + $output = date('i', (int) $value); |
|
56 | + break; |
|
57 | + case 'seconds': |
|
58 | + $output = date('s', (int) $value); |
|
59 | + break; |
|
60 | + case 'total': |
|
61 | + $output = check_plain($value); |
|
62 | + break; |
|
63 | + default: |
|
64 | + $output = theme('filefield_meta_duration', $value); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // Check to see if hiding should happen before adding prefix and suffix. |
@@ -50,11 +50,11 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | switch ($this->options['format']) { |
53 | - case 'raw': |
|
54 | - $output = $value; |
|
55 | - break; |
|
56 | - default: |
|
57 | - $output = theme('filefield_meta_bitrate', $value); |
|
53 | + case 'raw': |
|
54 | + $output = $value; |
|
55 | + break; |
|
56 | + default: |
|
57 | + $output = theme('filefield_meta_bitrate', $value); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return check_plain($this->options['prefix']) . $output . check_plain($this->options['suffix']); |