Completed
Push — development ( 6a24df...5afdf5 )
by Nils
07:52
created
includes/libraries/Pdf/Tfpdf/font/courierb.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,6 +3,7 @@
 block discarded – undo
3 3
 $name = 'Courier-Bold';
4 4
 $up = -100;
5 5
 $ut = 50;
6
-for ($i = 0; $i <= 255; $i++)
6
+for ($i = 0; $i <= 255; $i++) {
7 7
 	$cw[chr($i)] = 600;
8
+}
8 9
 ?>
Please login to merge, or discard this patch.
includes/libraries/Encryption/PBKDF2/PasswordHashClass.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
     public static function validate_password($password, $good_hash)
60 60
     {
61 61
         $params = explode(":", $good_hash);
62
-        if (count($params) < HASH_SECTIONS)
63
-            return false;
62
+        if (count($params) < HASH_SECTIONS) {
63
+                    return false;
64
+        }
64 65
         $pbkdf2 = base64_decode($params[HASH_PBKDF2_INDEX]);
65 66
         return self::slow_equals(
66 67
             $pbkdf2,
@@ -113,10 +114,12 @@  discard block
 block discarded – undo
113 114
     private static function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false)
114 115
     {
115 116
         $algorithm = strtolower($algorithm);
116
-        if (!in_array($algorithm, hash_algos(), true))
117
-            trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);
118
-        if ($count <= 0 || $key_length <= 0)
119
-            trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);
117
+        if (!in_array($algorithm, hash_algos(), true)) {
118
+                    trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);
119
+        }
120
+        if ($count <= 0 || $key_length <= 0) {
121
+                    trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);
122
+        }
120 123
 
121 124
         if (function_exists("hash_pbkdf2")) {
122 125
             // The output length is in NIBBLES (4-bits) if $raw_output is false!
@@ -142,10 +145,11 @@  discard block
 block discarded – undo
142 145
             $output .= $xorsum;
143 146
         }
144 147
 
145
-        if ($raw_output)
146
-            return substr($output, 0, $key_length);
147
-        else
148
-            return bin2hex(substr($output, 0, $key_length));
148
+        if ($raw_output) {
149
+                    return substr($output, 0, $key_length);
150
+        } else {
151
+                    return bin2hex(substr($output, 0, $key_length));
152
+        }
149 153
     }
150 154
 }
151 155
 ?>
152 156
\ No newline at end of file
Please login to merge, or discard this patch.
includes/libraries/Encryption/PBKDF2/PasswordHash.php 1 patch
Braces   +15 added lines, -11 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
 function validate_password($password, $correct_hash)
58 58
 {
59 59
     $params = explode(":", $correct_hash);
60
-    if (count($params) < HASH_SECTIONS)
61
-        return false;
60
+    if (count($params) < HASH_SECTIONS) {
61
+            return false;
62
+    }
62 63
     $pbkdf2 = base64_decode($params[HASH_PBKDF2_INDEX]);
63 64
     return slow_equals(
64 65
         $pbkdf2,
@@ -108,10 +109,12 @@  discard block
 block discarded – undo
108 109
 function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false)
109 110
 {
110 111
     $algorithm = strtolower($algorithm);
111
-    if (!in_array($algorithm, hash_algos(), true))
112
-        trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);
113
-    if ($count <= 0 || $key_length <= 0)
114
-        trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);
112
+    if (!in_array($algorithm, hash_algos(), true)) {
113
+            trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);
114
+    }
115
+    if ($count <= 0 || $key_length <= 0) {
116
+            trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);
117
+    }
115 118
 
116 119
     if (function_exists("hash_pbkdf2")) {
117 120
         // The output length is in NIBBLES (4-bits) if $raw_output is false!
@@ -137,9 +140,10 @@  discard block
 block discarded – undo
137 140
         $output .= $xorsum;
138 141
     }
139 142
 
140
-    if ($raw_output)
141
-        return substr($output, 0, $key_length);
142
-    else
143
-        return bin2hex(substr($output, 0, $key_length));
144
-}
143
+    if ($raw_output) {
144
+            return substr($output, 0, $key_length);
145
+    } else {
146
+            return bin2hex(substr($output, 0, $key_length));
147
+    }
148
+    }
145 149
 ?>
146 150
\ No newline at end of file
Please login to merge, or discard this patch.
includes/libraries/phpcrypt/Padding.php 1 patch
Braces   +20 added lines, -15 removed lines patch added patch discarded remove patch
@@ -67,8 +67,9 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		// if the size of padding is not greater than 1
69 69
 		// just return true, no padding will be done
70
-		if (!($bytes > 0))
71
-			return true;
70
+		if (!($bytes > 0)) {
71
+					return true;
72
+		}
72 73
 
73 74
 		switch ($type)
74 75
 		{
@@ -196,11 +197,11 @@  discard block
 block discarded – undo
196 197
 		$pos = strlen($text) - 1;
197 198
 		$c = ord($text[$pos]);
198 199
 
199
-		if ($c == 0)
200
-			return true;
201
-		else if ($c == 1)
202
-			$text = substr($text, 0, -1);
203
-		else
200
+		if ($c == 0) {
201
+					return true;
202
+		} else if ($c == 1) {
203
+					$text = substr($text, 0, -1);
204
+		} else
204 205
 		{
205 206
 			// the total null bytes are 1 less than the value of the final byte
206 207
 			$nc = $c - 1;
@@ -226,8 +227,9 @@  discard block
 block discarded – undo
226 227
 		// create the random pad bytes, we do one less than
227 228
 		// needed because the last byte is reserved for the
228 229
 		// number of padded bytes
229
-		for ($i = 0; $i < ($bytes - 1); ++$i)
230
-			$text .= chr(mt_rand(0, 255));
230
+		for ($i = 0; $i < ($bytes - 1); ++$i) {
231
+					$text .= chr(mt_rand(0, 255));
232
+		}
231 233
 
232 234
 		// add the byte to indicate the padding length
233 235
 		$text .= chr($bytes);
@@ -248,8 +250,9 @@  discard block
 block discarded – undo
248 250
 
249 251
 		// if we got a null byte at the end of the string,
250 252
 		// just return
251
-		if ($c == 0)
252
-			return true;
253
+		if ($c == 0) {
254
+					return true;
255
+		}
253 256
 
254 257
 		$text = substr($text, 0, $c);
255 258
 		return true;
@@ -285,8 +288,9 @@  discard block
 block discarded – undo
285 288
 		$pos = strlen($text) - 1;
286 289
 		$c = ord($text[$pos]);
287 290
 
288
-		if ($c == 0)
289
-			return true;
291
+		if ($c == 0) {
292
+					return true;
293
+		}
290 294
 
291 295
 		$text = preg_replace('/'.preg_quote(chr($c)).'{'.$c.'}$/', "", $text);
292 296
 		return true;
@@ -309,8 +313,9 @@  discard block
 block discarded – undo
309 313
 
310 314
 		// if we are only padding one byte, then 0x80 is all we need
311 315
 		// else we follow up with null bytes
312
-		if ($bytes > 1)
313
-			$text = str_pad($text, ($len - 1), chr(0), STR_PAD_RIGHT);
316
+		if ($bytes > 1) {
317
+					$text = str_pad($text, ($len - 1), chr(0), STR_PAD_RIGHT);
318
+		}
314 319
 
315 320
 		return true;
316 321
 	}
Please login to merge, or discard this patch.
includes/libraries/phpcrypt/ciphers/RC2.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -276,8 +276,9 @@  discard block
 block discarded – undo
276 276
         $len = $this->keySize();
277 277
 
278 278
         // the max length of the key is 128 bytes
279
-        if($len > 128)
280
-            $this->xkey = substr($this->xkey, 0, 128);
279
+        if($len > 128) {
280
+                    $this->xkey = substr($this->xkey, 0, 128);
281
+        }
281 282
 
282 283
         // now expanded the rest of the key to 128 bytes, using the sbox
283 284
         for($i = $len; $i < 128; ++$i)
@@ -288,8 +289,9 @@  discard block
 block discarded – undo
288 289
 
289 290
             // the sbox is only 255 bytes, so if we extend past that
290 291
             // we need to modulo 256 so we have a valid position
291
-            if($pos > 255)
292
-                $pos -= 256;
292
+            if($pos > 255) {
293
+                            $pos -= 256;
294
+            }
293 295
 
294 296
             $this->xkey .= chr(self::$_sbox[$pos]);
295 297
         }
Please login to merge, or discard this patch.
includes/libraries/phpcrypt/ciphers/Enigma.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -158,8 +158,9 @@  discard block
 block discarded – undo
158 158
                 $this->n1 = 0;
159 159
                 $this->n2++;
160 160
 
161
-                if($this->n2 == self::ROTORSZ)
162
-                    $this->n2 = 0;
161
+                if($this->n2 == self::ROTORSZ) {
162
+                                    $this->n2 = 0;
163
+                }
163 164
 
164 165
                 $this->nr2 = $this->n2;
165 166
             }
@@ -189,12 +190,14 @@  discard block
 block discarded – undo
189 190
         $klen = $this->keySize();
190 191
 
191 192
         // get the key to exactly 13 bytes if it's less than 13
192
-        if($klen < 13)
193
-            $this->xkey = str_pad($this->xkey, 13, chr(0), STR_PAD_RIGHT);
193
+        if($klen < 13) {
194
+                    $this->xkey = str_pad($this->xkey, 13, chr(0), STR_PAD_RIGHT);
195
+        }
194 196
 
195 197
         $seed = 123;
196
-        for($i = 0; $i < 13; ++$i)
197
-            $seed = parent::sInt32($seed) * ord($this->xkey[$i]) + $i;
198
+        for($i = 0; $i < 13; ++$i) {
199
+                    $seed = parent::sInt32($seed) * ord($this->xkey[$i]) + $i;
200
+        }
198 201
 
199 202
         // sets $t1 and $deck
200 203
         for($i = 0; $i < self::ROTORSZ; ++$i)
@@ -223,12 +226,14 @@  discard block
 block discarded – undo
223 226
             $temp = $this->t1[$k];
224 227
             $this->t1[$k] = $this->t1[$ic];
225 228
             $this->t1[$ic] = $temp;
226
-            if($this->t3[$k] != 0)
227
-                continue;
229
+            if($this->t3[$k] != 0) {
230
+                            continue;
231
+            }
228 232
 
229 233
             $ic = ($random & self::MASK) % $k;
230
-            while($this->t3[$ic] != 0)
231
-                $ic = ($ic + 1) % $k;
234
+            while($this->t3[$ic] != 0) {
235
+                            $ic = ($ic + 1) % $k;
236
+            }
232 237
 
233 238
             $this->t3[$k] = $ic;
234 239
             $this->t3[$ic] = $k;
Please login to merge, or discard this patch.
includes/libraries/phpcrypt/ciphers/SimpleXOR.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -121,8 +121,9 @@
 block discarded – undo
121 121
 		{
122 122
 			// if the current position in the key reaches the end of the key,
123 123
 			// start over at position 0 of the key
124
-			if ($pos >= $this->keySize())
125
-				$pos = 0;
124
+			if ($pos >= $this->keySize()) {
125
+							$pos = 0;
126
+			}
126 127
 
127 128
 			$text[$i] = $text[$i] ^ $key[$pos];
128 129
 			++$pos;
Please login to merge, or discard this patch.
includes/libraries/phpcrypt/ciphers/Blowfish.php 1 patch
Braces   +16 added lines, -20 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
         {
80 80
             $key = substr($key, 0, 56);
81 81
             $keylen = 56;
82
-        }
83
-        else if($keylen < 1)
82
+        } else if($keylen < 1)
84 83
         {
85 84
             $msg  = "No key given. The key must be between 1 - 56 bytes.";
86 85
             trigger_error($msg, E_USER_WARNING);
@@ -148,10 +147,11 @@  discard block
 block discarded – undo
148 147
 
149 148
         for($i = 0; $i < 16; ++$i)
150 149
         {
151
-            if($this->operation() == parent::ENCRYPT)
152
-                $xl ^= self::$_p[$i];
153
-            else
154
-                $xl ^= self::$_p[17-$i];
150
+            if($this->operation() == parent::ENCRYPT) {
151
+                            $xl ^= self::$_p[$i];
152
+            } else {
153
+                            $xl ^= self::$_p[17-$i];
154
+            }
155 155
 
156 156
             // perform F() on the left half, and XOR with the right half
157 157
             $xr = $this->F($xl) ^ $xr;
@@ -172,8 +172,7 @@  discard block
 block discarded – undo
172 172
         {
173 173
             $xr ^= self::$_p[16];
174 174
             $xl  = $xl ^ self::$_p[17];
175
-        }
176
-        else // parent::DECRYPT
175
+        } else // parent::DECRYPT
177 176
         {
178 177
             $xr ^= self::$_p[1];
179 178
             $xl ^= self::$_p[0];
@@ -243,23 +242,19 @@  discard block
 block discarded – undo
243 242
             {
244 243
                 self::$_p[$i] = $z0;
245 244
                 self::$_p[$i + 1] = $z1;
246
-            }
247
-            else if($i >= 18 && $i < 274)
245
+            } else if($i >= 18 && $i < 274)
248 246
             {
249 247
                 self::$_sbox1[$i - 18] = $z0;
250 248
                 self::$_sbox1[$i - 18 + 1] = $z1;
251
-            }
252
-            else if($i >= 274 && $i < 530)
249
+            } else if($i >= 274 && $i < 530)
253 250
             {
254 251
                 self::$_sbox2[$i - 274] = $z0;
255 252
                 self::$_sbox2[$i - 274 + 1] = $z1;
256
-            }
257
-            else if($i >= 530 && $i < 786)
253
+            } else if($i >= 530 && $i < 786)
258 254
             {
259 255
                 self::$_sbox3[$i - 530] = $z0;
260 256
                 self::$_sbox3[$i - 530 + 1] = $z1;
261
-            }
262
-            else if($i >= 786 && $i < 1042)
257
+            } else if($i >= 786 && $i < 1042)
263 258
             {
264 259
                 self::$_sbox4[$i -786] = $z0;
265 260
                 self::$_sbox4[$i - 786 + 1] = $z1;
@@ -284,8 +279,9 @@  discard block
 block discarded – undo
284 279
      */
285 280
     private function keyChunk($size = 1, $reset = false)
286 281
     {
287
-        if($reset || $this->key_pos >= $this->keySize())
288
-            $this->key_pos = 0;
282
+        if($reset || $this->key_pos >= $this->keySize()) {
283
+                    $this->key_pos = 0;
284
+        }
289 285
 
290 286
         $bytes = substr($this->key(), $this->key_pos, $size);
291 287
         $len = strlen($bytes);
@@ -293,9 +289,9 @@  discard block
 block discarded – undo
293 289
         {
294 290
             $bytes .= substr($this->key(), 0, $size - $len);
295 291
             $this->key_pos = $size - $len;
292
+        } else {
293
+                    $this->key_pos += $size;
296 294
         }
297
-        else
298
-            $this->key_pos += $size;
299 295
 
300 296
         return $bytes;
301 297
     }
Please login to merge, or discard this patch.
includes/libraries/phpcrypt/ciphers/CAST256.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
 		{
82 82
 			$key = substr($key, 0, self::BYTES_KEY_MAX);
83 83
 			$keylen = self::BYTES_KEY_MAX;
84
-		}
85
-		else if (!in_array($keylen, self::$_req_key_sizes))
84
+		} else if (!in_array($keylen, self::$_req_key_sizes))
86 85
 		{
87 86
 			$msg  = PHP_Crypt::CIPHER_CAST_256." requires a key size of 16, ";
88 87
 			$msg .= "20, 24, 28, or 32 bytes.";
@@ -298,8 +297,9 @@  discard block
 block discarded – undo
298 297
 
299 298
 		// if the key is less than 32 bytes, pad it to 32 bytes
300 299
 		// for the key expansion
301
-		if ($this->keySize() < 32)
302
-			$xkey = str_pad($xkey, 32, "\0", STR_PAD_RIGHT);
300
+		if ($this->keySize() < 32) {
301
+					$xkey = str_pad($xkey, 32, "\0", STR_PAD_RIGHT);
302
+		}
303 303
 
304 304
 		// split the key up into 4 byte parts, reverse the string,
305 305
 		// then convert each part into a 32 bit integer
Please login to merge, or discard this patch.