@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function boinctranslate_initialize_languages() { |
17 | 17 | |
18 | - require_once(getcwd() . '/includes/locale.inc'); |
|
18 | + require_once(getcwd().'/includes/locale.inc'); |
|
19 | 19 | |
20 | 20 | $api_base_url = 'https://www.transifex.com/api/2'; |
21 | 21 | $project_name = variable_get( |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | } |
148 | 148 | if ($disabled_languages) { |
149 | - drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages)); |
|
149 | + drupal_set_message('The following languages were not found in Transifex and were disabled: '.implode(' ', $disabled_languages)); |
|
150 | 150 | } |
151 | 151 | if ($process_batches) { |
152 | 152 | $batch = array( |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | */ |
197 | 197 | function boinctranslate_export_translations() { |
198 | - require_once(getcwd() . '/includes/locale.inc'); |
|
198 | + require_once(getcwd().'/includes/locale.inc'); |
|
199 | 199 | $project_name = variable_get( |
200 | 200 | 'boinc_translate_transifex_project_name', '' |
201 | 201 | ); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * |
298 | 298 | */ |
299 | 299 | function boinctranslate_update_official_boinc_translations() { |
300 | - require_once(getcwd() . '/includes/locale.inc'); |
|
300 | + require_once(getcwd().'/includes/locale.inc'); |
|
301 | 301 | $project_name = variable_get( |
302 | 302 | 'boinc_translate_transifex_standard_name', '' |
303 | 303 | ); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | |
406 | 406 | $url = "{$api_base_url}/{$path}"; |
407 | 407 | $headers = array( |
408 | - 'Authorization' => 'Basic ' . base64_encode($username . ":" . $password), |
|
408 | + 'Authorization' => 'Basic '.base64_encode($username.":".$password), |
|
409 | 409 | ); |
410 | 410 | $data = NULL; |
411 | 411 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | return json_decode($response->data, TRUE); |
434 | 434 | } |
435 | 435 | else { |
436 | - return (string) $response->data; |
|
436 | + return (string)$response->data; |
|
437 | 437 | } |
438 | 438 | break; |
439 | 439 | case 404: |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | function boinctranslate_get_po($langcode, $type = 'standard') { |
458 | 458 | |
459 | - require_once(getcwd() . '/includes/locale.inc'); |
|
459 | + require_once(getcwd().'/includes/locale.inc'); |
|
460 | 460 | |
461 | 461 | $all_languages = language_list(); |
462 | 462 | $language = $langcode ? $all_languages[$langcode] : NULL; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | */ |
516 | 516 | function boinctranslate_export_po_generate($language = NULL, $strings = array(), $header = NULL, $type = NULL) { |
517 | 517 | |
518 | - require_once(getcwd() . '/includes/locale.inc'); |
|
518 | + require_once(getcwd().'/includes/locale.inc'); |
|
519 | 519 | global $user; |
520 | 520 | |
521 | 521 | // unset $language to indicate template creation |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $header = "# BOINC drupal localization template\n"; |
532 | 532 | $header .= "# Copyright (C) ".date("Y")." University of California\n"; |
533 | 533 | } |
534 | - $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n"; |
|
534 | + $header .= '# Generated by '.$user->name.' <'.$user->mail.">\n"; |
|
535 | 535 | $header .= "#\n"; |
536 | 536 | $header .= "# This file is distributed under the same license as BOINC.\n"; |
537 | 537 | $header .= "#\n"; |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here |
544 | 544 | } |
545 | 545 | $header .= "\"Report-Msgid-Bugs-To: BOINC translation team <[email protected]>\\n\"\n"; |
546 | - $header .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; |
|
546 | + $header .= "\"POT-Creation-Date: ".date("Y-m-d H:iO")."\\n\"\n"; |
|
547 | 547 | if (isset($language)) { |
548 | - $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; |
|
548 | + $header .= "\"PO-Revision-Date: ".date("Y-m-d H:iO")."\\n\"\n"; |
|
549 | 549 | } |
550 | 550 | $header .= "\"Last-Translator: Generated automatically from Drupal translate interface\\n\"\n"; |
551 | 551 | $header .= "\"MIME-Version: 1.0\\n\"\n"; |
@@ -554,31 +554,31 @@ discard block |
||
554 | 554 | if (isset($language)) { |
555 | 555 | $header .= "\"Language: ".$language->language."\\n\""; |
556 | 556 | if ($language->formula && $language->plurals) { |
557 | - $header .= "\"Plural-Forms: nplurals=" . $language->plurals . "; plural=" . strtr($language->formula, array('$' => '')) . ";\\n\"\n"; |
|
557 | + $header .= "\"Plural-Forms: nplurals=".$language->plurals."; plural=".strtr($language->formula, array('$' => '')).";\\n\"\n"; |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | $header .= "\"X-Poedit-SourceCharset: utf-8\\n\"\n"; |
561 | 561 | } |
562 | 562 | |
563 | - $output = $header . "\n"; |
|
563 | + $output = $header."\n"; |
|
564 | 564 | |
565 | 565 | foreach ($strings as $lid => $string) { |
566 | 566 | // Only process non-children, children are output below their parent. |
567 | 567 | if (!isset($string['child'])) { |
568 | 568 | if ($string['comment']) { |
569 | - $output .= '#: ' . $string['comment'] . "\n"; |
|
569 | + $output .= '#: '.$string['comment']."\n"; |
|
570 | 570 | } |
571 | 571 | if ($string['context']) { |
572 | - $output .= 'msgctxt "' . $string['context'] . "\"\n"; |
|
572 | + $output .= 'msgctxt "'.$string['context']."\"\n"; |
|
573 | 573 | } |
574 | - $output .= 'msgid ' . _locale_export_string($string['source']); |
|
574 | + $output .= 'msgid '._locale_export_string($string['source']); |
|
575 | 575 | if (!empty($string['plural'])) { |
576 | 576 | $plural = $string['plural']; |
577 | - $output .= 'msgid_plural ' . _locale_export_string($strings[$plural]['source']); |
|
577 | + $output .= 'msgid_plural '._locale_export_string($strings[$plural]['source']); |
|
578 | 578 | if (isset($language)) { |
579 | 579 | $translation = $string['translation']; |
580 | 580 | for ($i = 0; $i < $language->plurals; $i++) { |
581 | - $output .= 'msgstr[' . $i . '] ' . _locale_export_string($translation); |
|
581 | + $output .= 'msgstr['.$i.'] '._locale_export_string($translation); |
|
582 | 582 | if ($plural) { |
583 | 583 | $translation = _locale_export_remove_plural($strings[$plural]['translation']); |
584 | 584 | $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0; |
@@ -589,12 +589,12 @@ discard block |
||
589 | 589 | } |
590 | 590 | } |
591 | 591 | else { |
592 | - $output .= 'msgstr[0] ""' . "\n"; |
|
593 | - $output .= 'msgstr[1] ""' . "\n"; |
|
592 | + $output .= 'msgstr[0] ""'."\n"; |
|
593 | + $output .= 'msgstr[1] ""'."\n"; |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | else { |
597 | - $output .= 'msgstr ' . _locale_export_string($string['translation']); |
|
597 | + $output .= 'msgstr '._locale_export_string($string['translation']); |
|
598 | 598 | } |
599 | 599 | $output .= "\n"; |
600 | 600 | } |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * |
607 | 607 | */ |
608 | 608 | function boinctranslate_refresh_translations() { |
609 | - require_once(getcwd() . '/includes/locale.inc'); |
|
609 | + require_once(getcwd().'/includes/locale.inc'); |
|
610 | 610 | $errors = array(); |
611 | 611 | $languages = locale_language_list(); |
612 | 612 | $translation_resources = array(); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | ), |
654 | 654 | ); |
655 | 655 | // Be sure any strings from the override file are added to the boinc group |
656 | - $override_file = './' . drupal_get_path('module', 'boinctranslate') . '/includes/other-boinc-translation-strings.txt'; |
|
656 | + $override_file = './'.drupal_get_path('module', 'boinctranslate').'/includes/other-boinc-translation-strings.txt'; |
|
657 | 657 | $other_strings = file($override_file); |
658 | 658 | if ($other_strings) { |
659 | 659 | foreach ($other_strings as $string) { |
@@ -666,13 +666,13 @@ discard block |
||
666 | 666 | // Use '|' as delimiter to split string and context info. |
667 | 667 | $line = explode("|", $string); |
668 | 668 | if ($line) { |
669 | - if (count($line)==1) { |
|
669 | + if (count($line) == 1) { |
|
670 | 670 | $tl0 = trim($line[0]); |
671 | 671 | if ($tl0) { |
672 | 672 | bts($tl0); |
673 | 673 | } |
674 | 674 | } |
675 | - elseif (count($line)>1) { |
|
675 | + elseif (count($line) > 1) { |
|
676 | 676 | $tl0 = trim($line[0]); |
677 | 677 | $tl1 = trim($line[1]); |
678 | 678 | if ($tl0 and $tl1) { |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | */ |
742 | 742 | function boinctranslate_refresh_translations_op($project, $resource, $langcode, $language, $textgroups, $debug_mode, &$context) { |
743 | 743 | |
744 | - require_once(getcwd() . '/includes/locale.inc'); |
|
744 | + require_once(getcwd().'/includes/locale.inc'); |
|
745 | 745 | |
746 | 746 | if ($debug_mode) { |
747 | 747 | watchdog( |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | $file->filename = basename($file->filepath); |
773 | 773 | if (!$file->filepath) { |
774 | 774 | $message = 'Unable to create temporary file in ' |
775 | - . file_directory_temp() . " for {$language} translation " |
|
775 | + . file_directory_temp()." for {$language} translation " |
|
776 | 776 | . "resource {$project}:{$resource}"; |
777 | 777 | } |
778 | 778 | |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $context['finished'] = 1; |
850 | 850 | } |
851 | 851 | else { |
852 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
852 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | // An error occurred. |
873 | 873 | // $operations contains the operations that remained unprocessed. |
874 | 874 | $error_operation = reset($operations); |
875 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
875 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
876 | 876 | watchdog( |
877 | 877 | 'boinctranslate', |
878 | 878 | $message, |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | @set_time_limit(240); |
894 | 894 | } |
895 | 895 | |
896 | - require_once(getcwd() . '/includes/locale.inc'); |
|
896 | + require_once(getcwd().'/includes/locale.inc'); |
|
897 | 897 | |
898 | 898 | // Check if we have the language already in the database. |
899 | 899 | if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) { |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | */ |
936 | 936 | function _boinctranslate_locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') { |
937 | 937 | |
938 | - require_once(getcwd() . '/includes/locale.inc'); |
|
938 | + require_once(getcwd().'/includes/locale.inc'); |
|
939 | 939 | |
940 | 940 | $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return |
941 | 941 | if (!$fd) { |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | $lineno = 0; // Current line |
956 | 956 | |
957 | 957 | while (!feof($fd)) { |
958 | - $line = fgets($fd, 10 * 1024); // A line should not be this long |
|
958 | + $line = fgets($fd, 10*1024); // A line should not be this long |
|
959 | 959 | if ($lineno == 0) { |
960 | 960 | // The first line might come with a UTF-8 BOM, which should be removed. |
961 | 961 | $line = str_replace("\xEF\xBB\xBF", '', $line); |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1038 | 1038 | return FALSE; |
1039 | 1039 | } |
1040 | - $current["msgid"] = $current["msgid"] . "\0" . $quoted; |
|
1040 | + $current["msgid"] = $current["msgid"]."\0".$quoted; |
|
1041 | 1041 | $context = "MSGID_PLURAL"; |
1042 | 1042 | } |
1043 | 1043 | elseif (!strncmp("msgid", $line, 5)) { |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | */ |
1191 | 1191 | function _boinctranslate_locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') { |
1192 | 1192 | |
1193 | - require_once(getcwd() . '/includes/locale.inc'); |
|
1193 | + require_once(getcwd().'/includes/locale.inc'); |
|
1194 | 1194 | |
1195 | 1195 | static $report = array( |
1196 | 1196 | 'additions' => 0, |
@@ -1323,13 +1323,13 @@ discard block |
||
1323 | 1323 | |
1324 | 1324 | $lid = $row['lid']; |
1325 | 1325 | // Check of if one or more translations exist for this lid in locales_target table. |
1326 | - $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1326 | + $exists = (bool)db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1327 | 1327 | if (!$exists) { |
1328 | 1328 | // No translation in this language, insert translation into locales_target table. |
1329 | 1329 | db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural); |
1330 | 1330 | $report['additions']++; |
1331 | 1331 | } |
1332 | - else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) { |
|
1332 | + else if (($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite)) { |
|
1333 | 1333 | // Translation exists, only overwrite if instructed. |
1334 | 1334 | db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid); |
1335 | 1335 | $report['updates']++; |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | // Loop over db results from locales_source table. |
1346 | 1346 | while ($row = db_fetch_array($resource)) { |
1347 | 1347 | $lid = $row['lid']; |
1348 | - $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1348 | + $exists = (bool)db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1349 | 1349 | if ($exists) { |
1350 | 1350 | // Empty translation, remove existing if instructed. |
1351 | 1351 | db_query("DELETE FROM {locales_target} WHERE language = '%s' AND lid = %d AND plid = %d AND plural = %d", $langcode, $lid, $plid, $plural); |
@@ -1403,5 +1403,5 @@ discard block |
||
1403 | 1403 | * database. |
1404 | 1404 | */ |
1405 | 1405 | function _boinctranslate_supertrim($instr) { |
1406 | - return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) ); |
|
1406 | + return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr))); |
|
1407 | 1407 | } |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | return null; |
39 | 39 | } |
40 | 40 | if (is_null($password) || is_int($password)) { |
41 | - $password = (string) $password; |
|
41 | + $password = (string)$password; |
|
42 | 42 | } |
43 | 43 | if (!is_string($password)) { |
44 | 44 | trigger_error("password_hash(): Password must be a string", E_USER_WARNING); |
45 | 45 | return null; |
46 | 46 | } |
47 | 47 | if (!is_int($algo)) { |
48 | - trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING); |
|
48 | + trigger_error("password_hash() expects parameter 2 to be long, ".gettype($algo)." given", E_USER_WARNING); |
|
49 | 49 | return null; |
50 | 50 | } |
51 | 51 | $resultLength = 0; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | case PASSWORD_BCRYPT: |
54 | 54 | $cost = PASSWORD_BCRYPT_DEFAULT_COST; |
55 | 55 | if (isset($options['cost'])) { |
56 | - $cost = (int) $options['cost']; |
|
56 | + $cost = (int)$options['cost']; |
|
57 | 57 | if ($cost < 4 || $cost > 31) { |
58 | 58 | trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING); |
59 | 59 | return null; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | case 'integer': |
80 | 80 | case 'double': |
81 | 81 | case 'string': |
82 | - $salt = (string) $options['salt']; |
|
82 | + $salt = (string)$options['salt']; |
|
83 | 83 | break; |
84 | 84 | case 'object': |
85 | 85 | if (method_exists($options['salt'], '__tostring')) { |
86 | - $salt = (string) $options['salt']; |
|
86 | + $salt = (string)$options['salt']; |
|
87 | 87 | break; |
88 | 88 | } |
89 | 89 | case 'array': |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | if ($read >= $raw_salt_len) { |
127 | 127 | $buffer_valid = true; |
128 | 128 | } |
129 | - $buffer = str_pad($buffer, $raw_salt_len, "\0") ^ str_pad($local_buffer, $raw_salt_len, "\0"); |
|
129 | + $buffer = str_pad($buffer, $raw_salt_len, "\0")^str_pad($local_buffer, $raw_salt_len, "\0"); |
|
130 | 130 | } |
131 | 131 | if (!$buffer_valid || PasswordCompat\binary\_strlen($buffer) < $raw_salt_len) { |
132 | 132 | $buffer_length = PasswordCompat\binary\_strlen($buffer); |
133 | 133 | for ($i = 0; $i < $raw_salt_len; $i++) { |
134 | 134 | if ($i < $buffer_length) { |
135 | - $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255)); |
|
135 | + $buffer[$i] = $buffer[$i]^chr(mt_rand(0, 255)); |
|
136 | 136 | } else { |
137 | 137 | $buffer .= chr(mt_rand(0, 255)); |
138 | 138 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | $salt = PasswordCompat\binary\_substr($salt, 0, $required_salt_len); |
155 | 155 | |
156 | - $hash = $hash_format . $salt; |
|
156 | + $hash = $hash_format.$salt; |
|
157 | 157 | |
158 | 158 | $ret = crypt($password, $hash); |
159 | 159 | |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | */ |
209 | 209 | function password_needs_rehash($hash, $algo, array $options = array()) { |
210 | 210 | $info = password_get_info($hash); |
211 | - if ($info['algo'] !== (int) $algo) { |
|
211 | + if ($info['algo'] !== (int)$algo) { |
|
212 | 212 | return true; |
213 | 213 | } |
214 | 214 | switch ($algo) { |
215 | 215 | case PASSWORD_BCRYPT: |
216 | - $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; |
|
216 | + $cost = isset($options['cost']) ? (int)$options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; |
|
217 | 217 | if ($cost !== $info['options']['cost']) { |
218 | 218 | return true; |
219 | 219 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $status = 0; |
244 | 244 | for ($i = 0; $i < PasswordCompat\binary\_strlen($ret); $i++) { |
245 | - $status |= (ord($ret[$i]) ^ ord($hash[$i])); |
|
245 | + $status |= (ord($ret[$i])^ord($hash[$i])); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | return $status === 0; |
@@ -70,10 +70,10 @@ |
||
70 | 70 | $n = ($bytes - $i) > 1073741824 |
71 | 71 | ? 1073741824 |
72 | 72 | : $bytes - $i; |
73 | - $buf .= Sodium::randombytes_buf((int) $n); |
|
73 | + $buf .= Sodium::randombytes_buf((int)$n); |
|
74 | 74 | } |
75 | 75 | } else { |
76 | - $buf .= Sodium::randombytes_buf((int) $bytes); |
|
76 | + $buf .= Sodium::randombytes_buf((int)$bytes); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if (is_string($buf)) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | if ($max === $min) { |
81 | - return (int) $min; |
|
81 | + return (int)$min; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | * type juggling |
125 | 125 | */ |
126 | 126 | while ($range > 0) { |
127 | - if ($bits % 8 === 0) { |
|
127 | + if ($bits%8 === 0) { |
|
128 | 128 | ++$bytes; |
129 | 129 | } |
130 | 130 | ++$bits; |
131 | 131 | $range >>= 1; |
132 | - $mask = $mask << 1 | 1; |
|
132 | + $mask = $mask << 1|1; |
|
133 | 133 | } |
134 | 134 | $valueShift = $min; |
135 | 135 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | $val &= 0; |
169 | 169 | for ($i = 0; $i < $bytes; ++$i) { |
170 | - $val |= ord($randomByteString[$i]) << ($i * 8); |
|
170 | + $val |= ord($randomByteString[$i]) << ($i*8); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -185,6 +185,6 @@ discard block |
||
185 | 185 | */ |
186 | 186 | } while (!is_int($val) || $val > $max || $val < $min); |
187 | 187 | |
188 | - return (int) $val; |
|
188 | + return (int)$val; |
|
189 | 189 | } |
190 | 190 | } |
@@ -60,11 +60,11 @@ |
||
60 | 60 | && |
61 | 61 | $number < PHP_INT_MAX |
62 | 62 | ) { |
63 | - $number = (int) $number; |
|
63 | + $number = (int)$number; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if (is_int($number)) { |
67 | - return (int) $number; |
|
67 | + return (int)$number; |
|
68 | 68 | } elseif (!$fail_open) { |
69 | 69 | throw new TypeError( |
70 | 70 | 'Expected an integer.' |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION)); |
35 | 35 | define( |
36 | 36 | 'PHP_VERSION_ID', |
37 | - $RandomCompatversion[0] * 10000 |
|
38 | - + $RandomCompatversion[1] * 100 |
|
37 | + $RandomCompatversion[0]*10000 |
|
38 | + + $RandomCompatversion[1]*100 |
|
39 | 39 | + $RandomCompatversion[2] |
40 | 40 | ); |
41 | 41 | $RandomCompatversion = null; |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | $RandomCompatDIR = dirname(__FILE__); |
56 | 56 | |
57 | -require_once $RandomCompatDIR . '/byte_safe_strings.inc'; |
|
58 | -require_once $RandomCompatDIR . '/cast_to_int.inc'; |
|
59 | -require_once $RandomCompatDIR . '/error_polyfill.inc'; |
|
57 | +require_once $RandomCompatDIR.'/byte_safe_strings.inc'; |
|
58 | +require_once $RandomCompatDIR.'/cast_to_int.inc'; |
|
59 | +require_once $RandomCompatDIR.'/error_polyfill.inc'; |
|
60 | 60 | |
61 | 61 | if (!is_callable('random_bytes')) { |
62 | 62 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | if (extension_loaded('libsodium')) { |
77 | 77 | // See random_bytes_libsodium.php |
78 | 78 | if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { |
79 | - require_once $RandomCompatDIR . '/random_bytes_libsodium.inc'; |
|
79 | + require_once $RandomCompatDIR.'/random_bytes_libsodium.inc'; |
|
80 | 80 | } elseif (method_exists('Sodium', 'randombytes_buf')) { |
81 | - require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.inc'; |
|
81 | + require_once $RandomCompatDIR.'/random_bytes_libsodium_legacy.inc'; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // place, that is not helpful to us here. |
118 | 118 | |
119 | 119 | // See random_bytes_dev_urandom.php |
120 | - require_once $RandomCompatDIR . '/random_bytes_dev_urandom.inc'; |
|
120 | + require_once $RandomCompatDIR.'/random_bytes_dev_urandom.inc'; |
|
121 | 121 | } |
122 | 122 | // Unset variables after use |
123 | 123 | $RandomCompat_basedir = null; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | extension_loaded('mcrypt') |
160 | 160 | ) { |
161 | 161 | // See random_bytes_mcrypt.php |
162 | - require_once $RandomCompatDIR . '/random_bytes_mcrypt.inc'; |
|
162 | + require_once $RandomCompatDIR.'/random_bytes_mcrypt.inc'; |
|
163 | 163 | } |
164 | 164 | $RandomCompatUrandom = null; |
165 | 165 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); |
185 | 185 | if (method_exists($RandomCompatCOMtest, 'GetRandom')) { |
186 | 186 | // See random_bytes_com_dotnet.php |
187 | - require_once $RandomCompatDIR . '/random_bytes_com_dotnet.inc'; |
|
187 | + require_once $RandomCompatDIR.'/random_bytes_com_dotnet.inc'; |
|
188 | 188 | } |
189 | 189 | } catch (com_exception $e) { |
190 | 190 | // Don't try to use it. |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | if (!is_callable('random_int')) { |
222 | - require_once $RandomCompatDIR . '/random_int.inc'; |
|
222 | + require_once $RandomCompatDIR.'/random_int.inc'; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | $RandomCompatDIR = null; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $expiration = $now + $duration; |
32 | 32 | $type = BoincDb::escape_string($type); |
33 | 33 | $ret = BoincToken::insert("(token,userid,type,create_time,expire_time) values ('$token', $userid, '$type', $now, $expiration)"); |
34 | - if ( !$ret ) { |
|
34 | + if (!$ret) { |
|
35 | 35 | return null; |
36 | 36 | } |
37 | 37 | return $token; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | function is_valid_token($userid, $token, $type) { |
41 | 41 | $boincToken = BoincToken::lookup_valid_token($userid, $token, $type); |
42 | - if ( $boincToken == null ) { |
|
42 | + if ($boincToken == null) { |
|
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | return true; |
@@ -62,7 +62,7 @@ |
||
62 | 62 | echo tra("Invalid password."); |
63 | 63 | } else { |
64 | 64 | $passwd_hash = md5($passwd.$email_addr); |
65 | - $database_passwd_hash = password_hash($passwd_hash , PASSWORD_DEFAULT); |
|
65 | + $database_passwd_hash = password_hash($passwd_hash, PASSWORD_DEFAULT); |
|
66 | 66 | $email_addr = BoincDb::escape_string($email_addr); |
67 | 67 | $user->email_addr_change_time = time(); |
68 | 68 | $result = $user->update( |
@@ -50,7 +50,7 @@ |
||
50 | 50 | } else { |
51 | 51 | echo tra("Email address has been reverted.")."<br /><br />".tra("You need to reset your password: ")."<a href=\"".secure_url_base()."get_passwd.php\">".secure_url_base()."get_passwd.php</a>"; |
52 | 52 | |
53 | - $database_passwd_hash = password_hash(random_string() , PASSWORD_DEFAULT); |
|
53 | + $database_passwd_hash = password_hash(random_string(), PASSWORD_DEFAULT); |
|
54 | 54 | //Change previous_email |
55 | 55 | $result = $tmpuser->update( |
56 | 56 | "email_addr=previous_email_addr, previous_email_addr='', email_addr_change_time=0, passwd_hash='$database_passwd_hash', email_validated=0" |