@@ -8,21 +8,21 @@ |
||
8 | 8 | BoincToken::insert("(token,userid,type,expire_time) values ('$token', 0, 'T', unix_timestamp()+3600)"); |
9 | 9 | |
10 | 10 | $boincTokens = BoincToken::enum("userid=0"); |
11 | -foreach($boincTokens as $boincToken) { |
|
12 | - echo $boincToken->token . "\n"; |
|
13 | - echo $boincToken->userid . "\n"; |
|
14 | - echo $boincToken->type . "\n"; |
|
15 | - echo $boincToken->create_time . "\n"; |
|
16 | - echo $boincToken->expire_time . "\n"; |
|
11 | +foreach ($boincTokens as $boincToken) { |
|
12 | + echo $boincToken->token."\n"; |
|
13 | + echo $boincToken->userid."\n"; |
|
14 | + echo $boincToken->type."\n"; |
|
15 | + echo $boincToken->create_time."\n"; |
|
16 | + echo $boincToken->expire_time."\n"; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | echo "---------------\n"; |
20 | 20 | $boincToken = BoincToken::lookup("userid=0"); |
21 | -echo $boincToken->token . "\n"; |
|
22 | -echo $boincToken->userid . "\n"; |
|
23 | -echo $boincToken->type . "\n"; |
|
24 | -echo $boincToken->create_time . "\n"; |
|
25 | -echo $boincToken->expire_time . "\n"; |
|
21 | +echo $boincToken->token."\n"; |
|
22 | +echo $boincToken->userid."\n"; |
|
23 | +echo $boincToken->type."\n"; |
|
24 | +echo $boincToken->create_time."\n"; |
|
25 | +echo $boincToken->expire_time."\n"; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | ?> |
@@ -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)) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $fp = fopen('/dev/urandom', 'rb'); |
59 | 59 | if (!empty($fp)) { |
60 | 60 | $st = fstat($fp); |
61 | - if (($st['mode'] & 0170000) !== 020000) { |
|
61 | + if (($st['mode']&0170000) !== 020000) { |
|
62 | 62 | fclose($fp); |
63 | 63 | $fp = false; |
64 | 64 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * @var string|bool |
143 | 143 | */ |
144 | - $buf = $buf . $read; |
|
144 | + $buf = $buf.$read; |
|
145 | 145 | } while ($remaining > 0); |
146 | 146 | |
147 | 147 | /** |
@@ -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; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | if (!is_callable('RandomCompat_strlen')) { |
30 | 30 | if ( |
31 | 31 | defined('MB_OVERLOAD_STRING') && |
32 | - ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING |
|
32 | + ini_get('mbstring.func_overload')&MB_OVERLOAD_STRING |
|
33 | 33 | ) { |
34 | 34 | /** |
35 | 35 | * strlen() implementation that isn't brittle to mbstring.func_overload |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
54 | - return (int) mb_strlen($binary_string, '8bit'); |
|
54 | + return (int)mb_strlen($binary_string, '8bit'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | } else { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'RandomCompat_strlen() expects a string' |
74 | 74 | ); |
75 | 75 | } |
76 | - return (int) strlen($binary_string); |
|
76 | + return (int)strlen($binary_string); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if ( |
84 | 84 | defined('MB_OVERLOAD_STRING') |
85 | 85 | && |
86 | - ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING |
|
86 | + ini_get('mbstring.func_overload')&MB_OVERLOAD_STRING |
|
87 | 87 | ) { |
88 | 88 | /** |
89 | 89 | * substr() implementation that isn't brittle to mbstring.func_overload |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return ''; |
134 | 134 | } |
135 | 135 | |
136 | - return (string) mb_substr($binary_string, $start, $length, '8bit'); |
|
136 | + return (string)mb_substr($binary_string, $start, $length, '8bit'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | } else { |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | - return (string) substr($binary_string, $start, $length); |
|
175 | + return (string)substr($binary_string, $start, $length); |
|
176 | 176 | } |
177 | 177 | |
178 | - return (string) substr($binary_string, $start); |
|
178 | + return (string)substr($binary_string, $start); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | } |