@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | if ($this->pw_length < 5) { |
88 | 88 | $this->pwgen = 'pwRand'; |
89 | 89 | } |
90 | - if ($this->pw_length <= 2) { |
|
90 | + if ($this->pw_length <= 2) { |
|
91 | 91 | $this->setCapitalize(false); |
92 | 92 | } |
93 | - if ($this->pw_length <= 1) { |
|
93 | + if ($this->pw_length <= 1) { |
|
94 | 94 | $this->setNumerals(false); |
95 | 95 | } |
96 | 96 | } else { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | public function generate() |
198 | 198 | { |
199 | - if ($this->pwgen == 'pwPhonemes') { |
|
199 | + if ($this->pwgen == 'pwPhonemes') { |
|
200 | 200 | $this->pwPhonemes(); |
201 | 201 | } else { // $this->pwgen == 'pwRand' |
202 | 202 | $this->pwRand(); |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | $first = 1; |
218 | 218 | |
219 | 219 | while ($c < $this->pw_length) { |
220 | - $i = self::myRand(0, count(self::$elements)-1); |
|
220 | + $i = self::myRand(0, count(self::$elements) - 1); |
|
221 | 221 | $str = self::$elements[$i]->str; |
222 | 222 | $len = strlen($str); |
223 | 223 | $flags = self::$elements[$i]->flags; |
224 | 224 | |
225 | 225 | // Filter on the basic type of the next element |
226 | - if (($flags & $should_be) == 0) { |
|
226 | + if (($flags & $should_be) == 0) { |
|
227 | 227 | continue; |
228 | 228 | } |
229 | 229 | // Handle the NOT_FIRST flag |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | continue; |
240 | 240 | } |
241 | 241 | // Don't allow us to overflow the buffer |
242 | - if ($len > $this->pw_length-$c) { |
|
242 | + if ($len > $this->pw_length - $c) { |
|
243 | 243 | continue; |
244 | 244 | } |
245 | 245 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * let's do it! |
256 | 256 | */ |
257 | 257 | for ($j = 0; $j < $len; $j++) { |
258 | - $this->password[$c+$j] = $str[$j]; |
|
258 | + $this->password[$c + $j] = $str[$j]; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // Handle PW_UPPERS |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - $c += $len; |
|
269 | + $c += $len; |
|
270 | 270 | |
271 | 271 | // Time to stop? |
272 | - if ($c >= $this->pw_length) { |
|
272 | + if ($c >= $this->pw_length) { |
|
273 | 273 | break; |
274 | 274 | } |
275 | 275 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | if ($this->pwgen_flags & self::PW_SYMBOLS) { |
295 | 295 | if (!$first && (self::myRand(0, 9) < 2)) { |
296 | 296 | do { |
297 | - $ch = self::$pw_symbols[self::myRand(0, strlen(self::$pw_symbols)-1)]; |
|
297 | + $ch = self::$pw_symbols[self::myRand(0, strlen(self::$pw_symbols) - 1)]; |
|
298 | 298 | } while (($this->pwgen_flags & self::PW_AMBIGUOUS) && |
299 | 299 | strpos(self::$pw_ambiguous, $ch) !== false); |
300 | 300 | $this->password[$c++] = $ch; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | |
305 | 305 | // OK, figure out what the next element should be |
306 | - if ($should_be == self::CONSONANT) { |
|
306 | + if ($should_be == self::CONSONANT) { |
|
307 | 307 | $should_be = self::VOWEL; |
308 | 308 | } else { // should_be = = VOWEL |
309 | 309 | if (($prev & self::VOWEL) || ($flags & self::DIPHTHONG) || (self::myRand(0, 9) > 3) |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $i = 0; |
344 | 344 | |
345 | 345 | while ($i < $this->pw_length) { |
346 | - $ch = $chars[self::myRand(0, $len-1)]; |
|
346 | + $ch = $chars[self::myRand(0, $len - 1)]; |
|
347 | 347 | if (($this->pwgen_flags & self::PW_AMBIGUOUS) && |
348 | 348 | strpos(self::$pw_ambiguous, $ch) !== false) { |
349 | 349 | continue; |
@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | { |
51 | 51 | if (Core::ourStrlen($ctr) !== Core::BLOCK_BYTE_SIZE) { |
52 | 52 | throw new Ex\EnvironmentIsBrokenException( |
53 | - 'Trying to increment a nonce of the wrong size.' |
|
53 | + 'Trying to increment a nonce of the wrong size.' |
|
54 | 54 | ); |
55 | 55 | } |
56 | 56 | |
57 | 57 | if (! \is_int($inc)) { |
58 | 58 | throw new Ex\EnvironmentIsBrokenException( |
59 | - 'Trying to increment nonce by a non-integer.' |
|
59 | + 'Trying to increment nonce by a non-integer.' |
|
60 | 60 | ); |
61 | 61 | } |
62 | 62 | |
63 | 63 | if ($inc < 0) { |
64 | 64 | throw new Ex\EnvironmentIsBrokenException( |
65 | - 'Trying to increment nonce by a negative amount.' |
|
65 | + 'Trying to increment nonce by a negative amount.' |
|
66 | 66 | ); |
67 | 67 | } |
68 | 68 | |
69 | 69 | if ($inc > PHP_INT_MAX - 255) { |
70 | 70 | throw new Ex\EnvironmentIsBrokenException( |
71 | - 'Integer overflow may occur.' |
|
71 | + 'Integer overflow may occur.' |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /* Detect integer overflow and fail. */ |
83 | 83 | if (! \is_int($sum)) { |
84 | 84 | throw new Ex\EnvironmentIsBrokenException( |
85 | - 'Integer overflow in CTR mode nonce increment.' |
|
85 | + 'Integer overflow in CTR mode nonce increment.' |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ); |
55 | 55 | } |
56 | 56 | |
57 | - if (! \is_int($inc)) { |
|
57 | + if (!\is_int($inc)) { |
|
58 | 58 | throw new Ex\EnvironmentIsBrokenException( |
59 | 59 | 'Trying to increment nonce by a non-integer.' |
60 | 60 | ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $sum = \ord($ctr[$i]) + $inc; |
81 | 81 | |
82 | 82 | /* Detect integer overflow and fail. */ |
83 | - if (! \is_int($sum)) { |
|
83 | + if (!\is_int($sum)) { |
|
84 | 84 | throw new Ex\EnvironmentIsBrokenException( |
85 | 85 | 'Integer overflow in CTR mode nonce increment.' |
86 | 86 | ); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $digest_length = Core::ourStrlen(\hash_hmac($hash, '', '', true)); |
133 | 133 | |
134 | 134 | // Sanity-check the desired output length. |
135 | - if (empty($length) || ! \is_int($length) || |
|
135 | + if (empty($length) || !\is_int($length) || |
|
136 | 136 | $length < 0 || $length > 255 * $digest_length) { |
137 | 137 | throw new Ex\EnvironmentIsBrokenException( |
138 | 138 | 'Bad output length requested of HKDF.' |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // T(i) = HMAC-Hash(PRK, T(i-1) | info | 0x??) |
164 | 164 | $last_block = \hash_hmac( |
165 | 165 | $hash, |
166 | - $last_block . $info . \chr($block_index), |
|
166 | + $last_block.$info.\chr($block_index), |
|
167 | 167 | $prk, |
168 | 168 | true |
169 | 169 | ); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public static function ensureConstantExists($name) |
229 | 229 | { |
230 | - if (! \defined($name)) { |
|
230 | + if (!\defined($name)) { |
|
231 | 231 | throw new Ex\EnvironmentIsBrokenException(); |
232 | 232 | } |
233 | 233 | } |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | // manage specific case of random_bytes |
245 | 245 | if ($name === "random_bytes") { |
246 | 246 | // random_bytes is a PHP7 new function required |
247 | - require_once(substr(realpath(dirname(__FILE__)),0, strpos(realpath(dirname(__FILE__)), "Encryption")).'/misc/random_compat/random.php'); |
|
247 | + require_once(substr(realpath(dirname(__FILE__)), 0, strpos(realpath(dirname(__FILE__)), "Encryption")).'/misc/random_compat/random.php'); |
|
248 | 248 | } |
249 | - if (! \function_exists($name)) { |
|
249 | + if (!\function_exists($name)) { |
|
250 | 250 | throw new Ex\EnvironmentIsBrokenException(); |
251 | 251 | } |
252 | 252 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | if ($exists) { |
305 | 305 | // mb_substr($str, 0, NULL, '8bit') returns an empty string on PHP |
306 | 306 | // 5.3, so we have to find the length ourselves. |
307 | - if (! isset($length)) { |
|
307 | + if (!isset($length)) { |
|
308 | 308 | if ($start >= 0) { |
309 | 309 | $length = Core::ourStrlen($str) - $start; |
310 | 310 | } else { |
@@ -363,17 +363,17 @@ discard block |
||
363 | 363 | public static function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false) |
364 | 364 | { |
365 | 365 | // Type checks: |
366 | - if (! \is_string($algorithm)) { |
|
366 | + if (!\is_string($algorithm)) { |
|
367 | 367 | throw new \InvalidArgumentException( |
368 | 368 | 'pbkdf2(): algorithm must be a string' |
369 | 369 | ); |
370 | 370 | } |
371 | - if (! \is_string($password)) { |
|
371 | + if (!\is_string($password)) { |
|
372 | 372 | throw new \InvalidArgumentException( |
373 | 373 | 'pbkdf2(): password must be a string' |
374 | 374 | ); |
375 | 375 | } |
376 | - if (! \is_string($salt)) { |
|
376 | + if (!\is_string($salt)) { |
|
377 | 377 | throw new \InvalidArgumentException( |
378 | 378 | 'pbkdf2(): salt must be a string' |
379 | 379 | ); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $key_length += 0; |
384 | 384 | |
385 | 385 | $algorithm = \strtolower($algorithm); |
386 | - if (! \in_array($algorithm, \hash_algos(), true)) { |
|
386 | + if (!\in_array($algorithm, \hash_algos(), true)) { |
|
387 | 387 | throw new Ex\EnvironmentIsBrokenException( |
388 | 388 | 'Invalid or unsupported hash algorithm.' |
389 | 389 | ); |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', |
395 | 395 | 'ripemd160', 'ripemd256', 'ripemd320', 'whirlpool', |
396 | 396 | ]; |
397 | - if (! \in_array($algorithm, $ok_algorithms, true)) { |
|
397 | + if (!\in_array($algorithm, $ok_algorithms, true)) { |
|
398 | 398 | throw new Ex\EnvironmentIsBrokenException( |
399 | 399 | 'Algorithm is not a secure cryptographic hash function.' |
400 | 400 | ); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | if (\function_exists('hash_pbkdf2')) { |
410 | 410 | // The output length is in NIBBLES (4-bits) if $raw_output is false! |
411 | - if (! $raw_output) { |
|
411 | + if (!$raw_output) { |
|
412 | 412 | $key_length = $key_length * 2; |
413 | 413 | } |
414 | 414 | return \hash_pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $output = ''; |
421 | 421 | for ($i = 1; $i <= $block_count; $i++) { |
422 | 422 | // $i encoded as 4 bytes, big endian. |
423 | - $last = $salt . \pack('N', $i); |
|
423 | + $last = $salt.\pack('N', $i); |
|
424 | 424 | // first iteration |
425 | 425 | $last = $xorsum = \hash_hmac($algorithm, $last, $password, true); |
426 | 426 | // perform the other $count - 1 iterations |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | $keys = $secret->deriveKeys($salt); |
187 | 187 | $ekey = $keys->getEncryptionKey(); |
188 | 188 | $akey = $keys->getAuthenticationKey(); |
189 | - $iv = Core::secureRandom(Core::BLOCK_BYTE_SIZE); |
|
189 | + $iv = Core::secureRandom(Core::BLOCK_BYTE_SIZE); |
|
190 | 190 | |
191 | - $ciphertext = Core::CURRENT_VERSION . $salt . $iv . self::plainEncrypt($plaintext, $ekey, $iv); |
|
191 | + $ciphertext = Core::CURRENT_VERSION.$salt.$iv.self::plainEncrypt($plaintext, $ekey, $iv); |
|
192 | 192 | $auth = \hash_hmac(Core::HASH_FUNCTION_NAME, $ciphertext, $akey, true); |
193 | - $ciphertext = $ciphertext . $auth; |
|
193 | + $ciphertext = $ciphertext.$auth; |
|
194 | 194 | |
195 | 195 | if ($raw_binary) { |
196 | 196 | return $ciphertext; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | { |
215 | 215 | RuntimeTests::runtimeTest(); |
216 | 216 | |
217 | - if (! $raw_binary) { |
|
217 | + if (!$raw_binary) { |
|
218 | 218 | try { |
219 | 219 | $ciphertext = Encoding::hexToBin($ciphertext); |
220 | 220 | } catch (Ex\BadFormatException $ex) { |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | // or password, whichever it is. |
285 | 285 | $keys = $secret->deriveKeys($salt); |
286 | 286 | |
287 | - if (self::verifyHMAC($hmac, $header . $salt . $iv . $encrypted, $keys->getAuthenticationKey())) { |
|
287 | + if (self::verifyHMAC($hmac, $header.$salt.$iv.$encrypted, $keys->getAuthenticationKey())) { |
|
288 | 288 | $plaintext = self::plainDecrypt($encrypted, $keys->getEncryptionKey(), $iv, Core::CIPHER_METHOD); |
289 | 289 | return $plaintext; |
290 | 290 | } else { |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | Core::ensureFunctionExists('openssl_get_cipher_methods'); |
47 | 47 | if (\in_array(Core::CIPHER_METHOD, \openssl_get_cipher_methods()) === false) { |
48 | 48 | throw new Ex\EnvironmentIsBrokenException( |
49 | - 'Cipher method not supported. This is normally caused by an outdated ' . |
|
50 | - 'version of OpenSSL (and/or OpenSSL compiled for FIPS compliance). ' . |
|
51 | - 'Please upgrade to a newer version of OpenSSL that supports ' . |
|
52 | - Core::CIPHER_METHOD . ' to use this library.' |
|
49 | + 'Cipher method not supported. This is normally caused by an outdated '. |
|
50 | + 'version of OpenSSL (and/or OpenSSL compiled for FIPS compliance). '. |
|
51 | + 'Please upgrade to a newer version of OpenSSL that supports '. |
|
52 | + Core::CIPHER_METHOD.' to use this library.' |
|
53 | 53 | ); |
54 | 54 | } |
55 | 55 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | // Modifying the ciphertext: Appending a string. |
103 | 103 | try { |
104 | - Crypto::decrypt($ciphertext . 'a', $key, true); |
|
104 | + Crypto::decrypt($ciphertext.'a', $key, true); |
|
105 | 105 | throw new Ex\EnvironmentIsBrokenException(); |
106 | 106 | } catch (Ex\WrongKeyOrModifiedCiphertextException $e) { /* expected */ |
107 | 107 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $info = Encoding::hexToBin('f0f1f2f3f4f5f6f7f8f9'); |
160 | 160 | $length = 42; |
161 | 161 | $okm = Encoding::hexToBin( |
162 | - '3cb25f25faacd57a90434f64d0362f2a' . |
|
163 | - '2d2d0a90cf1a5a4c5db02d56ecc4c5bf' . |
|
162 | + '3cb25f25faacd57a90434f64d0362f2a'. |
|
163 | + '2d2d0a90cf1a5a4c5db02d56ecc4c5bf'. |
|
164 | 164 | '34007208d5b887185865' |
165 | 165 | ); |
166 | 166 | $computed_okm = Core::HKDF('sha256', $ikm, $length, $info, $salt); |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | $ikm = \str_repeat("\x0c", 22); |
173 | 173 | $length = 42; |
174 | 174 | $okm = Encoding::hexToBin( |
175 | - '2c91117204d745f3500d636a62f64f0a' . |
|
176 | - 'b3bae548aa53d423b0d1f27ebba6f5e5' . |
|
175 | + '2c91117204d745f3500d636a62f64f0a'. |
|
176 | + 'b3bae548aa53d423b0d1f27ebba6f5e5'. |
|
177 | 177 | '673a081d70cce7acfc48' |
178 | 178 | ); |
179 | 179 | $computed_okm = Core::HKDF('sha1', $ikm, $length, '', null); |
@@ -207,20 +207,20 @@ discard block |
||
207 | 207 | { |
208 | 208 | // AES CTR mode test vector from NIST SP 800-38A |
209 | 209 | $key = Encoding::hexToBin( |
210 | - '603deb1015ca71be2b73aef0857d7781' . |
|
210 | + '603deb1015ca71be2b73aef0857d7781'. |
|
211 | 211 | '1f352c073b6108d72d9810a30914dff4' |
212 | 212 | ); |
213 | 213 | $iv = Encoding::hexToBin('f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff'); |
214 | 214 | $plaintext = Encoding::hexToBin( |
215 | - '6bc1bee22e409f96e93d7e117393172a' . |
|
216 | - 'ae2d8a571e03ac9c9eb76fac45af8e51' . |
|
217 | - '30c81c46a35ce411e5fbc1191a0a52ef' . |
|
215 | + '6bc1bee22e409f96e93d7e117393172a'. |
|
216 | + 'ae2d8a571e03ac9c9eb76fac45af8e51'. |
|
217 | + '30c81c46a35ce411e5fbc1191a0a52ef'. |
|
218 | 218 | 'f69f2445df4f9b17ad2b417be66c3710' |
219 | 219 | ); |
220 | 220 | $ciphertext = Encoding::hexToBin( |
221 | - '601ec313775789a5b7a7f504bbf3d228' . |
|
222 | - 'f443e3ca4d62b59aca84e990cacaf5c5' . |
|
223 | - '2b0930daa23de94ce87017ba2d84988d' . |
|
221 | + '601ec313775789a5b7a7f504bbf3d228'. |
|
222 | + 'f443e3ca4d62b59aca84e990cacaf5c5'. |
|
223 | + '2b0930daa23de94ce87017ba2d84988d'. |
|
224 | 224 | 'dfc9c58db67aada613c2dd08457941a6' |
225 | 225 | ); |
226 | 226 |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | // being a prefix of another type's header, leading to ambiguity. |
125 | 125 | if (Core::ourStrlen($header) !== self::SERIALIZE_HEADER_BYTES) { |
126 | 126 | throw new Ex\EnvironmentIsBrokenException( |
127 | - 'Header must be ' . self::SERIALIZE_HEADER_BYTES . ' bytes.' |
|
127 | + 'Header must be '.self::SERIALIZE_HEADER_BYTES.' bytes.' |
|
128 | 128 | ); |
129 | 129 | } |
130 | 130 | |
131 | 131 | return Encoding::binToHex( |
132 | - $header . |
|
133 | - $bytes . |
|
132 | + $header. |
|
133 | + $bytes. |
|
134 | 134 | \hash( |
135 | 135 | self::CHECKSUM_HASH_ALGO, |
136 | - $header . $bytes, |
|
136 | + $header.$bytes, |
|
137 | 137 | true |
138 | 138 | ) |
139 | 139 | ); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $checksum_b = \hash(self::CHECKSUM_HASH_ALGO, $checked_bytes, true); |
198 | 198 | |
199 | 199 | /* Check if the checksum matches. */ |
200 | - if (! Core::hashEquals($checksum_a, $checksum_b)) { |
|
200 | + if (!Core::hashEquals($checksum_a, $checksum_b)) { |
|
201 | 201 | throw new Ex\BadFormatException( |
202 | 202 | "Data is corrupted, the checksum doesn't match" |
203 | 203 | ); |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * here in order to make the API simpler, avoiding the need to |
95 | 95 | * document that this method might throw an Ex\BadFormatException. */ |
96 | 96 | throw new Ex\WrongKeyOrModifiedCiphertextException( |
97 | - "The decrypted key was found to be in an invalid format. " . |
|
97 | + "The decrypted key was found to be in an invalid format. ". |
|
98 | 98 | "This very likely indicates it was modified by an attacker." |
99 | 99 | ); |
100 | 100 | } |
@@ -38,24 +38,24 @@ discard block |
||
38 | 38 | abstract class adLDAPCollection |
39 | 39 | { |
40 | 40 | /** |
41 | - * The current adLDAP connection via dependency injection |
|
42 | - * |
|
43 | - * @var adLDAP |
|
44 | - */ |
|
41 | + * The current adLDAP connection via dependency injection |
|
42 | + * |
|
43 | + * @var adLDAP |
|
44 | + */ |
|
45 | 45 | protected $adldap; |
46 | 46 | |
47 | 47 | /** |
48 | - * The current object being modifed / called |
|
49 | - * |
|
50 | - * @var mixed |
|
51 | - */ |
|
48 | + * The current object being modifed / called |
|
49 | + * |
|
50 | + * @var mixed |
|
51 | + */ |
|
52 | 52 | protected $currentObject; |
53 | 53 | |
54 | 54 | /** |
55 | - * The raw info array from Active Directory |
|
56 | - * |
|
57 | - * @var array |
|
58 | - */ |
|
55 | + * The raw info array from Active Directory |
|
56 | + * |
|
57 | + * @var array |
|
58 | + */ |
|
59 | 59 | protected $info; |
60 | 60 | |
61 | 61 | public function __construct($info, adLDAP $adldap) { |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | - * Set the raw info array from Active Directory |
|
68 | - * |
|
69 | - * @param array $info |
|
70 | - */ |
|
67 | + * Set the raw info array from Active Directory |
|
68 | + * |
|
69 | + * @param array $info |
|
70 | + */ |
|
71 | 71 | public function setInfo(array $info) { |
72 | 72 | if ($this->info && sizeof($info) >= 1) { |
73 | 73 | unset($this->info); |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | - * Magic get method to retrieve data from the raw array in a formatted way |
|
80 | - * |
|
81 | - * @param string $attribute |
|
82 | - * @return mixed |
|
83 | - */ |
|
79 | + * Magic get method to retrieve data from the raw array in a formatted way |
|
80 | + * |
|
81 | + * @param string $attribute |
|
82 | + * @return mixed |
|
83 | + */ |
|
84 | 84 | public function __get($attribute) { |
85 | 85 | if (isset($this->info[0]) && is_array($this->info[0])) { |
86 | 86 | foreach ($this->info[0] as $keyAttr => $valueAttr) { |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | - * Magic set method to update an attribute |
|
110 | - * |
|
111 | - * @param string $attribute |
|
112 | - * @param string $value |
|
113 | - * @return bool |
|
114 | - */ |
|
109 | + * Magic set method to update an attribute |
|
110 | + * |
|
111 | + * @param string $attribute |
|
112 | + * @param string $value |
|
113 | + * @return bool |
|
114 | + */ |
|
115 | 115 | abstract public function __set($attribute, $value); |
116 | 116 | |
117 | 117 | /** |
118 | - * Magic isset method to check for the existence of an attribute |
|
119 | - * |
|
120 | - * @param string $attribute |
|
121 | - * @return bool |
|
122 | - */ |
|
118 | + * Magic isset method to check for the existence of an attribute |
|
119 | + * |
|
120 | + * @param string $attribute |
|
121 | + * @return bool |
|
122 | + */ |
|
123 | 123 | public function __isset($attribute) { |
124 | 124 | if (isset($this->info[0]) && is_array($this->info[0])) { |
125 | 125 | foreach ($this->info[0] as $keyAttr => $valueAttr) { |
@@ -129,6 +129,6 @@ discard block |
||
129 | 129 | } |
130 | 130 | } |
131 | 131 | return false; |
132 | - } |
|
132 | + } |
|
133 | 133 | } |
134 | 134 | ?> |
@@ -91,7 +91,7 @@ |
||
91 | 91 | else { |
92 | 92 | $array = array(); |
93 | 93 | foreach ($this->info[0][strtolower($attribute)] as $key => $value) { |
94 | - if ((string)$key != 'count') { |
|
94 | + if ((string) $key != 'count') { |
|
95 | 95 | $array[$key] = $value; |
96 | 96 | } |
97 | 97 | } |
@@ -87,8 +87,7 @@ discard block |
||
87 | 87 | if (strtolower($keyAttr) == strtolower($attribute)) { |
88 | 88 | if ($this->info[0][strtolower($attribute)]['count'] == 1) { |
89 | 89 | return $this->info[0][strtolower($attribute)][0]; |
90 | - } |
|
91 | - else { |
|
90 | + } else { |
|
92 | 91 | $array = array(); |
93 | 92 | foreach ($this->info[0][strtolower($attribute)] as $key => $value) { |
94 | 93 | if ((string)$key != 'count') { |
@@ -99,8 +98,7 @@ discard block |
||
99 | 98 | } |
100 | 99 | } |
101 | 100 | } |
102 | - } |
|
103 | - else { |
|
101 | + } else { |
|
104 | 102 | return NULL; |
105 | 103 | } |
106 | 104 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | function exportItemsToFile() |
167 | 167 | { |
168 | - $("#export_information").html('<i class="fa fa-cog fa-spin"></i> <?php echo $LANG['please_wait'];?> ... <span id="export_progress">0%</span>').attr("class","").show(); |
|
168 | + $("#export_information").html('<i class="fa fa-cog fa-spin"></i> <?php echo $LANG['please_wait']; ?> ... <span id="export_progress">0%</span>').attr("class","").show(); |
|
169 | 169 | |
170 | 170 | //Get list of selected folders |
171 | 171 | var ids = ""; |
@@ -175,20 +175,20 @@ discard block |
||
175 | 175 | }); |
176 | 176 | |
177 | 177 | if (ids == "") { |
178 | - $("#export_information").show().html("<i class='fa fa-exclamation-circle'></i> <?php echo $LANG['error_no_selected_folder'];?>").attr("class","ui-state-error"); |
|
178 | + $("#export_information").show().html("<i class='fa fa-exclamation-circle'></i> <?php echo $LANG['error_no_selected_folder']; ?>").attr("class","ui-state-error"); |
|
179 | 179 | setTimeout(function(){$("#export_information").effect( "fade", "slow" );}, 1000); |
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | 183 | if ($("input[name='export_format']:checked").length == 0) { |
184 | - $("#export_information").show().html("<i class='fa fa-exclamation-circle'></i> <?php echo $LANG['error_export_format_not_selected'];?>").attr("class","ui-state-error"); |
|
184 | + $("#export_information").show().html("<i class='fa fa-exclamation-circle'></i> <?php echo $LANG['error_export_format_not_selected']; ?>").attr("class","ui-state-error"); |
|
185 | 185 | setTimeout(function(){$("#export_information").effect( "fade", "slow" );}, 1000); |
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
189 | 189 | // Get PDF encryption password and make sure it is set |
190 | 190 | if (($("#export_pdf_password").val() == "") && ($("input[name='export_format']:checked").val() == "pdf")) { |
191 | - $("#export_information").show().html("<i class='fa fa-exclamation-circle'></i> <?php echo $LANG['pdf_password_warning'];?>").attr("class","ui-state-error"); |
|
191 | + $("#export_information").show().html("<i class='fa fa-exclamation-circle'></i> <?php echo $LANG['pdf_password_warning']; ?>").attr("class","ui-state-error"); |
|
192 | 192 | setTimeout(function(){$("#export_information").effect( "fade", "slow" );}, 1000); |
193 | 193 | return; |
194 | 194 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | type : "open_kb", |
33 | 33 | id : id, |
34 | - key : "<?php echo $_SESSION['key'];?>" |
|
34 | + key : "<?php echo $_SESSION['key']; ?>" |
|
35 | 35 | }, |
36 | 36 | function(data) { |
37 | 37 | data = $.parseJSON(data); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | type : "duplicate_suggestion", |
73 | 73 | id : $("#suggestion_id").val(), |
74 | - key : "<?php echo $_SESSION['key'];?>" |
|
74 | + key : "<?php echo $_SESSION['key']; ?>" |
|
75 | 75 | }, |
76 | 76 | function(data) { |
77 | 77 | if (data[0].status == "no") { |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | { |
102 | 102 | type : "get_complexity_level", |
103 | 103 | folder_id : $("#suggestion_folder").val(), |
104 | - key : "<?php echo $_SESSION['key'];?>" |
|
104 | + key : "<?php echo $_SESSION['key']; ?>" |
|
105 | 105 | }, |
106 | 106 | function(data) { |
107 | 107 | if (data[0].status == "ok") { |
108 | 108 | $("#complexity_required").val(data[0].complexity); |
109 | - $("#complexity_required_text").html("[<?php echo $LANG['complex_asked'];?> <span style=\"color:#D04806; font-weight:bold;\">"+data[0].complexity_text+"</span>]"); |
|
109 | + $("#complexity_required_text").html("[<?php echo $LANG['complex_asked']; ?> <span style=\"color:#D04806; font-weight:bold;\">"+data[0].complexity_text+"</span>]"); |
|
110 | 110 | } |
111 | 111 | $("#pw_wait").hide(); |
112 | 112 | }, |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | "sAjaxSource": "sources/datatable/datatable.suggestion.php", |
139 | 139 | "bJQueryUI": true, |
140 | 140 | "oLanguage": { |
141 | - "sUrl": "includes/language/datatables.<?php echo $_SESSION['user_language'];?>.txt" |
|
141 | + "sUrl": "includes/language/datatables.<?php echo $_SESSION['user_language']; ?>.txt" |
|
142 | 142 | }, |
143 | 143 | "columns": [ |
144 | 144 | {"width": "7%", className: "dt-body-left"}, |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | "sAjaxSource": "sources/datatable/datatable.suggestion.php", |
165 | 165 | "bJQueryUI": true, |
166 | 166 | "oLanguage": { |
167 | - "sUrl": "includes/language/datatables.<?php echo $_SESSION['user_language'];?>.txt" |
|
167 | + "sUrl": "includes/language/datatables.<?php echo $_SESSION['user_language']; ?>.txt" |
|
168 | 168 | }, |
169 | 169 | "columns": [ |
170 | 170 | {"width": "7%", className: "dt-body-left"}, |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | "sAjaxSource": "sources/datatable/datatable.items_change.php", |
187 | 187 | "bJQueryUI": true, |
188 | 188 | "oLanguage": { |
189 | - "sUrl": "includes/language/datatables.<?php echo $_SESSION['user_language'];?>.txt" |
|
189 | + "sUrl": "includes/language/datatables.<?php echo $_SESSION['user_language']; ?>.txt" |
|
190 | 190 | }, |
191 | 191 | "columns": [ |
192 | 192 | {"width": "5%", className: "dt-body-left"}, |
@@ -211,15 +211,15 @@ discard block |
||
211 | 211 | autoOpen: false, |
212 | 212 | width: 300, |
213 | 213 | height: 150, |
214 | - title: "<?php echo $LANG['suggestion_delete_confirm'];?>", |
|
214 | + title: "<?php echo $LANG['suggestion_delete_confirm']; ?>", |
|
215 | 215 | buttons: { |
216 | - "<?php echo $LANG['del_button'];?>": function() { |
|
216 | + "<?php echo $LANG['del_button']; ?>": function() { |
|
217 | 217 | $.post( |
218 | 218 | "sources/suggestion.queries.php", |
219 | 219 | { |
220 | 220 | type : "delete_suggestion", |
221 | 221 | id : $("#suggestion_id").val(), |
222 | - key : "<?php echo $_SESSION['key'];?>" |
|
222 | + key : "<?php echo $_SESSION['key']; ?>" |
|
223 | 223 | }, |
224 | 224 | function(data) { |
225 | 225 | $("#div_suggestion_delete").dialog("close"); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | ) |
230 | 230 | }, |
231 | - "<?php echo $LANG['cancel_button'];?>": function() { |
|
231 | + "<?php echo $LANG['cancel_button']; ?>": function() { |
|
232 | 232 | $(this).dialog("close"); |
233 | 233 | } |
234 | 234 | } |
@@ -241,19 +241,19 @@ discard block |
||
241 | 241 | autoOpen: false, |
242 | 242 | width: 400, |
243 | 243 | height: 240, |
244 | - title: "<?php echo $LANG['suggestion_validate_confirm'];?>", |
|
244 | + title: "<?php echo $LANG['suggestion_validate_confirm']; ?>", |
|
245 | 245 | open: function( event, ui ) { |
246 | 246 | $("#suggestion_edit_wait").hide(); |
247 | 247 | }, |
248 | 248 | buttons: { |
249 | - "<?php echo $LANG['confirm'];?>": function() { |
|
249 | + "<?php echo $LANG['confirm']; ?>": function() { |
|
250 | 250 | $("#suggestion_edit_wait").show(); |
251 | 251 | $.post( |
252 | 252 | "sources/suggestion.queries.php", |
253 | 253 | { |
254 | 254 | type : "validate_suggestion", |
255 | 255 | id : $("#suggestion_id").val(), |
256 | - key : "<?php echo $_SESSION['key'];?>" |
|
256 | + key : "<?php echo $_SESSION['key']; ?>" |
|
257 | 257 | }, |
258 | 258 | function(data) { |
259 | 259 | if (data[0].status == "done") { |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | oTable.fnDraw(); |
262 | 262 | $("#div_suggestion_validate").dialog("close"); |
263 | 263 | } else if (data[0].status = "error_when_creating") { |
264 | - $("#suggestion_error").show().html("<?php echo $LANG['suggestion_error_cannot_add'];?>").addClass("ui-state-error"); |
|
264 | + $("#suggestion_error").show().html("<?php echo $LANG['suggestion_error_cannot_add']; ?>").addClass("ui-state-error"); |
|
265 | 265 | } |
266 | 266 | }, |
267 | 267 | "json" |
268 | 268 | ) |
269 | 269 | }, |
270 | - "<?php echo $LANG['cancel_button'];?>": function() { |
|
270 | + "<?php echo $LANG['cancel_button']; ?>": function() { |
|
271 | 271 | $(this).dialog("close"); |
272 | 272 | } |
273 | 273 | } |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | autoOpen: false, |
281 | 281 | width: 450, |
282 | 282 | height: 550, |
283 | - title: "<?php echo $LANG['suggestion_add'];?>", |
|
283 | + title: "<?php echo $LANG['suggestion_add']; ?>", |
|
284 | 284 | buttons: { |
285 | - "<?php echo $LANG['save_button'];?>": function() { |
|
285 | + "<?php echo $LANG['save_button']; ?>": function() { |
|
286 | 286 | $("#suggestion_error").hide(); |
287 | 287 | if ($("#suggestion_label").val() == "") { |
288 | 288 | $("#suggestion_label").addClass("ui-state-error"); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } else if ($("#suggestion_folder").val() == "") { |
292 | 292 | $("#suggestion_folder").addClass("ui-state-error"); |
293 | 293 | } else if (parseInt($("#password_complexity").val()) < parseInt($("#complexity_required").val())) { |
294 | - $("#suggestion_error").show().html("<?php echo $LANG['error_complex_not_enought'];?>").addClass("ui-state-error"); |
|
294 | + $("#suggestion_error").show().html("<?php echo $LANG['error_complex_not_enought']; ?>").addClass("ui-state-error"); |
|
295 | 295 | } else { |
296 | 296 | $("#add_suggestion_wait").show(); |
297 | 297 | var data = '{"label":"'+sanitizeString($("#suggestion_label").val())+ |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | $.post("sources/suggestion.queries.php", |
304 | 304 | { |
305 | 305 | type : "add_new", |
306 | - data : prepareExchangedData(data, "encode", "<?php echo $_SESSION['key'];?>"), |
|
307 | - key : "<?php echo $_SESSION['key'];?>" |
|
306 | + data : prepareExchangedData(data, "encode", "<?php echo $_SESSION['key']; ?>"), |
|
307 | + key : "<?php echo $_SESSION['key']; ?>" |
|
308 | 308 | }, |
309 | 309 | function(data) { |
310 | 310 | if (data[0].status == "done") { |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | oTable.fnDraw(); |
313 | 313 | $("#suggestion_form").dialog("close"); |
314 | 314 | } else if (data[0].status = "duplicate_suggestion") { |
315 | - $("#suggestion_error").show().html("<?php echo $LANG['suggestion_error_duplicate'];?>").addClass("ui-state-error"); |
|
315 | + $("#suggestion_error").show().html("<?php echo $LANG['suggestion_error_duplicate']; ?>").addClass("ui-state-error"); |
|
316 | 316 | } |
317 | 317 | $("#add_suggestion_wait").hide(); |
318 | 318 | }, |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | ); |
321 | 321 | } |
322 | 322 | }, |
323 | - "<?php echo $LANG['cancel_button'];?>": function() { |
|
323 | + "<?php echo $LANG['cancel_button']; ?>": function() { |
|
324 | 324 | $(this).dialog("close"); |
325 | 325 | } |
326 | 326 | }, |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | autoOpen: false, |
344 | 344 | width: 700, |
345 | 345 | height: 400, |
346 | - title: "<?php echo $LANG['suggestion_delete_confirm'];?>", |
|
346 | + title: "<?php echo $LANG['suggestion_delete_confirm']; ?>", |
|
347 | 347 | buttons: { |
348 | - "<?php echo $LANG['approve'];?>": function() { |
|
349 | - $("#suggestion_view_wait").html("<?php echo "<i class='fa fa-cog fa-spin fa-lg'></i> ".addslashes($LANG['please_wait'])."...";?>").show(); |
|
348 | + "<?php echo $LANG['approve']; ?>": function() { |
|
349 | + $("#suggestion_view_wait").html("<?php echo "<i class='fa fa-cog fa-spin fa-lg'></i> ".addslashes($LANG['please_wait'])."..."; ?>").show(); |
|
350 | 350 | |
351 | 351 | // select fields to update |
352 | 352 | var fields_to_update = ""; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | type : "approve_item_change", |
363 | 363 | id : $("#suggestion_id").val(), |
364 | 364 | data : fields_to_update, |
365 | - key : "<?php echo $_SESSION['key'];?>" |
|
365 | + key : "<?php echo $_SESSION['key']; ?>" |
|
366 | 366 | }, |
367 | 367 | function(data) { |
368 | 368 | if (data[0].error === "") { |
@@ -382,18 +382,18 @@ discard block |
||
382 | 382 | "json" |
383 | 383 | ) |
384 | 384 | }, |
385 | - "<?php echo $LANG['reject'];?>": function() { |
|
386 | - $("#suggestion_view_wait").html("<?php echo "<i class='fa fa-cog fa-spin fa-lg'></i> ".addslashes($LANG['please_wait'])."...";?>").show(); |
|
385 | + "<?php echo $LANG['reject']; ?>": function() { |
|
386 | + $("#suggestion_view_wait").html("<?php echo "<i class='fa fa-cog fa-spin fa-lg'></i> ".addslashes($LANG['please_wait'])."..."; ?>").show(); |
|
387 | 387 | $.post( |
388 | 388 | "sources/suggestion.queries.php", |
389 | 389 | { |
390 | 390 | type : "reject_item_change", |
391 | 391 | id : $("#suggestion_id").val(), |
392 | - key : "<?php echo $_SESSION['key'];?>" |
|
392 | + key : "<?php echo $_SESSION['key']; ?>" |
|
393 | 393 | }, |
394 | 394 | function(data) { |
395 | 395 | |
396 | - $("#suggestion_view_wait").html("<?php echo $LANG['alert_message_done'];?>"); |
|
396 | + $("#suggestion_view_wait").html("<?php echo $LANG['alert_message_done']; ?>"); |
|
397 | 397 | oTable = $("#t_change").dataTable(); |
398 | 398 | oTable.fnDraw(); |
399 | 399 | setTimeout( |
@@ -405,24 +405,24 @@ discard block |
||
405 | 405 | } |
406 | 406 | ) |
407 | 407 | }, |
408 | - "<?php echo $LANG['cancel_button'];?>": function() { |
|
408 | + "<?php echo $LANG['cancel_button']; ?>": function() { |
|
409 | 409 | $(this).dialog("close"); |
410 | 410 | } |
411 | 411 | }, |
412 | 412 | open: function (event, ui) { |
413 | - $("#div_suggestion_html").html("<?php echo "<i class='fa fa-cog fa-spin fa-lg'></i> ".addslashes($LANG['please_wait'])."...";?>"); |
|
413 | + $("#div_suggestion_html").html("<?php echo "<i class='fa fa-cog fa-spin fa-lg'></i> ".addslashes($LANG['please_wait'])."..."; ?>"); |
|
414 | 414 | |
415 | 415 | // load change |
416 | 416 | $.post("sources/suggestion.queries.php", |
417 | 417 | { |
418 | 418 | type : "get_item_change_detail", |
419 | 419 | id : $("#suggestion_id").val(), |
420 | - key : "<?php echo $_SESSION['key'];?>" |
|
420 | + key : "<?php echo $_SESSION['key']; ?>" |
|
421 | 421 | }, |
422 | 422 | function(data) { |
423 | 423 | //decrypt data |
424 | 424 | try { |
425 | - data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key'];?>"); |
|
425 | + data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key']; ?>"); |
|
426 | 426 | } catch (e) { |
427 | 427 | // error |
428 | 428 | return; |
@@ -451,35 +451,35 @@ discard block |
||
451 | 451 | $("#suggestion_pwd").simplePassMeter({ |
452 | 452 | "requirements": {}, |
453 | 453 | "container": "#pw_strength", |
454 | - "defaultText" : "<?php echo $LANG['index_pw_level_txt'];?>", |
|
454 | + "defaultText" : "<?php echo $LANG['index_pw_level_txt']; ?>", |
|
455 | 455 | "ratings": [ |
456 | 456 | {"minScore": 0, |
457 | 457 | "className": "meterFail", |
458 | - "text": "<?php echo $LANG['complex_level0'];?>" |
|
458 | + "text": "<?php echo $LANG['complex_level0']; ?>" |
|
459 | 459 | }, |
460 | 460 | {"minScore": 25, |
461 | 461 | "className": "meterWarn", |
462 | - "text": "<?php echo $LANG['complex_level1'];?>" |
|
462 | + "text": "<?php echo $LANG['complex_level1']; ?>" |
|
463 | 463 | }, |
464 | 464 | {"minScore": 50, |
465 | 465 | "className": "meterWarn", |
466 | - "text": "<?php echo $LANG['complex_level2'];?>" |
|
466 | + "text": "<?php echo $LANG['complex_level2']; ?>" |
|
467 | 467 | }, |
468 | 468 | {"minScore": 60, |
469 | 469 | "className": "meterGood", |
470 | - "text": "<?php echo $LANG['complex_level3'];?>" |
|
470 | + "text": "<?php echo $LANG['complex_level3']; ?>" |
|
471 | 471 | }, |
472 | 472 | {"minScore": 70, |
473 | 473 | "className": "meterGood", |
474 | - "text": "<?php echo $LANG['complex_level4'];?>" |
|
474 | + "text": "<?php echo $LANG['complex_level4']; ?>" |
|
475 | 475 | }, |
476 | 476 | {"minScore": 80, |
477 | 477 | "className": "meterExcel", |
478 | - "text": "<?php echo $LANG['complex_level5'];?>" |
|
478 | + "text": "<?php echo $LANG['complex_level5']; ?>" |
|
479 | 479 | }, |
480 | 480 | {"minScore": 90, |
481 | 481 | "className": "meterExcel", |
482 | - "text": "<?php echo $LANG['complex_level6'];?>" |
|
482 | + "text": "<?php echo $LANG['complex_level6']; ?>" |
|
483 | 483 | } |
484 | 484 | ] |
485 | 485 | }); |