Completed
Push — development ( dcab98...fd35b5 )
by Nils
07:48
created
install/js/crypt/aes.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
     $state = self::addRoundKey($state, $w, $Nr, $Nb);
38 38
 
39 39
     $output = array(4 * $Nb); // convert state to 1-d array before returning [é3.4]
40
-    for ($i = 0; $i < 4 * $Nb; $i++) $output[$i] = $state[$i % 4][floor($i / 4)];
40
+    for ($i = 0; $i < 4 * $Nb; $i++) {
41
+        $output[$i] = $state[$i % 4][floor($i / 4)];
42
+    }
41 43
 
42 44
     return $output;
43 45
     }
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
      */
49 51
     private static function addRoundKey($state, $w, $rnd, $Nb) {  // xor Round Key into state S [é5.1.4]
50 52
     for ($r=0; $r<4; $r++) {
51
-        for ($c=0; $c<$Nb; $c++) $state[$r][$c] ^= $w[$rnd*4+$c][$r];
53
+        for ($c=0; $c<$Nb; $c++) {
54
+            $state[$r][$c] ^= $w[$rnd*4+$c][$r];
55
+        }
52 56
     }
53 57
 
54 58
     return $state;
Please login to merge, or discard this patch.
install/js/crypt/aesctr.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,12 @@
 block discarded – undo
66 66
     for ($b = 0; $b < $blockCount; $b++) {
67 67
         // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
68 68
         // done in two stages for 32-bit ops: using two words allows us to go past 2^32 blocks (68GB)
69
-        for ($c = 0; $c < 4; $c++) $counterBlock[15 - $c] = self::urs($b, $c * 8) & 0xff;
70
-        for ($c = 0; $c < 4; $c++) $counterBlock[15 - $c - 4] = self::urs($b / 0x100000000, $c * 8);
69
+        for ($c = 0; $c < 4; $c++) {
70
+            $counterBlock[15 - $c] = self::urs($b, $c * 8) & 0xff;
71
+        }
72
+        for ($c = 0; $c < 4; $c++) {
73
+            $counterBlock[15 - $c - 4] = self::urs($b / 0x100000000, $c * 8);
74
+        }
71 75
 
72 76
         $cipherCntr = Aes::cipher($counterBlock, $keySchedule); // -- encrypt counter block --
73 77
 
Please login to merge, or discard this patch.
includes/libraries/LDAP/adLDAP/classes/adLDAPUsers.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -215,11 +215,9 @@
 block discarded – undo
215 215
         if ($isGUID === true) {
216 216
             $username = $this->adldap->utilities()->strGuidToHex($username);
217 217
             $filter = "objectguid=".$username;
218
-        }
219
-        else if (strpos($username, "@")) {
218
+        } else if (strpos($username, "@")) {
220 219
                 $filter = "userPrincipalName=".$username;
221
-        }
222
-        else {
220
+        } else {
223 221
                 $filter = "samaccountname=".$username;
224 222
         }
225 223
         $filter = "(&(objectCategory=person)({$filter}))";
Please login to merge, or discard this patch.
includes/libraries/Database/Meekrodb/db.class.php 1 patch
Braces   +114 added lines, -51 removed lines patch added patch discarded remove patch
@@ -161,12 +161,24 @@  discard block
 block discarded – undo
161 161
 
162 162
 
163 163
     public function __construct($host = null, $user = null, $password = null, $dbName = null, $port = null, $encoding = null) {
164
-    if ($host === null) $host = DB::$host;
165
-    if ($user === null) $user = DB::$user;
166
-    if ($password === null) $password = DB::$password;
167
-    if ($dbName === null) $dbName = DB::$dbName;
168
-    if ($port === null) $port = DB::$port;
169
-    if ($encoding === null) $encoding = DB::$encoding;
164
+    if ($host === null) {
165
+        $host = DB::$host;
166
+    }
167
+    if ($user === null) {
168
+        $user = DB::$user;
169
+    }
170
+    if ($password === null) {
171
+        $password = DB::$password;
172
+    }
173
+    if ($dbName === null) {
174
+        $dbName = DB::$dbName;
175
+    }
176
+    if ($port === null) {
177
+        $port = DB::$port;
178
+    }
179
+    if ($encoding === null) {
180
+        $encoding = DB::$encoding;
181
+    }
170 182
 
171 183
     $this->host = $host;
172 184
     $this->user = $user;
@@ -180,7 +192,9 @@  discard block
 block discarded – undo
180 192
     $mysql = $this->internal_mysql;
181 193
 
182 194
     if (!($mysql instanceof MySQLi)) {
183
-        if (!$this->port) $this->port = ini_get('mysqli.default_port');
195
+        if (!$this->port) {
196
+            $this->port = ini_get('mysqli.default_port');
197
+        }
184 198
         $this->current_db = $this->dbName;
185 199
       
186 200
         $mysql = new mysqli($this->host, $this->user, $this->password, $this->dbName, $this->port);
@@ -300,8 +314,11 @@  discard block
 block discarded – undo
300 314
     protected function formatTableName($table) {
301 315
     $table = trim($table, '`');
302 316
 
303
-    if (strpos($table, '.')) return implode('.', array_map(array($this, 'formatTableName'), explode('.', $table)));
304
-    else return '`'.str_replace('`', '``', $table).'`';
317
+    if (strpos($table, '.')) {
318
+        return implode('.', array_map(array($this, 'formatTableName'), explode('.', $table)));
319
+    } else {
320
+        return '`'.str_replace('`', '``', $table).'`';
321
+    }
305 322
     }
306 323
 
307 324
     public function update() {
@@ -529,21 +546,31 @@  discard block
 block discarded – undo
529 546
 
530 547
     protected function sanitize($value) {
531 548
     if (is_object($value)) {
532
-        if ($value instanceof MeekroDBEval) return $value->text;
533
-        else if ($value instanceof DateTime) return $this->escape($value->format('Y-m-d H:i:s'));
534
-        else return '';
549
+        if ($value instanceof MeekroDBEval) {
550
+            return $value->text;
551
+        } else if ($value instanceof DateTime) {
552
+            return $this->escape($value->format('Y-m-d H:i:s'));
553
+        } else {
554
+            return '';
555
+        }
535 556
     }
536 557
 
537
-    if (is_null($value)) return $this->usenull ? 'NULL' : "''";
538
-    else if (is_bool($value)) return ($value ? 1 : 0);
539
-    else if (is_int($value)) return $value;
540
-    else if (is_float($value)) return $value;
541
-
542
-    else if (is_array($value)) {
558
+    if (is_null($value)) {
559
+        return $this->usenull ? 'NULL' : "''";
560
+    } else if (is_bool($value)) {
561
+        return ($value ? 1 : 0);
562
+    } else if (is_int($value)) {
563
+        return $value;
564
+    } else if (is_float($value)) {
565
+        return $value;
566
+    } else if (is_array($value)) {
543 567
         // non-assoc array?
544 568
         if (array_values($value) === $value) {
545
-        if (is_array($value[0])) return implode(', ', array_map(array($this, 'sanitize'), $value));
546
-        else return '('.implode(', ', array_map(array($this, 'sanitize'), $value)).')';
569
+        if (is_array($value[0])) {
570
+            return implode(', ', array_map(array($this, 'sanitize'), $value));
571
+        } else {
572
+            return '('.implode(', ', array_map(array($this, 'sanitize'), $value)).')';
573
+        }
547 574
         }
548 575
 
549 576
         $pairs = array();
@@ -591,30 +618,48 @@  discard block
 block discarded – undo
591 618
 
592 619
         if ($type != '?') {
593 620
         $is_array_type = in_array($type, $array_types, true);
594
-        if ($is_array_type && !is_array($arg)) $this->nonSQLError("Badly formatted SQL query: Expected array, got scalar instead!");
595
-        else if (!$is_array_type && is_array($arg)) $this->nonSQLError("Badly formatted SQL query: Expected scalar, got array instead!");
621
+        if ($is_array_type && !is_array($arg)) {
622
+            $this->nonSQLError("Badly formatted SQL query: Expected array, got scalar instead!");
623
+        } else if (!$is_array_type && is_array($arg)) {
624
+            $this->nonSQLError("Badly formatted SQL query: Expected scalar, got array instead!");
625
+        }
596 626
         }
597 627
 
598
-        if ($type == 's') $result = $this->escape($arg);
599
-        else if ($type == 'i') $result = $this->intval($arg);
600
-        else if ($type == 'd') $result = doubleval($arg);
601
-        else if ($type == 'b') $result = $this->formatTableName($arg);
602
-        else if ($type == 'l') $result = $arg;
603
-        else if ($type == 'ss') $result = $this->escape("%".str_replace(array('%', '_'), array('\%', '\_'), $arg)."%");
604
-        else if ($type == 't') $result = $this->escape($this->parseTS($arg));
605
-
606
-        else if ($type == 'ls') $result = array_map(array($this, 'escape'), $arg);
607
-        else if ($type == 'li') $result = array_map(array($this, 'intval'), $arg);
608
-        else if ($type == 'ld') $result = array_map('doubleval', $arg);
609
-        else if ($type == 'lb') $result = array_map(array($this, 'formatTableName'), $arg);
610
-        else if ($type == 'll') $result = $arg;
611
-        else if ($type == 'lt') $result = array_map(array($this, 'escape'), array_map(array($this, 'parseTS'), $arg));
612
-
613
-        else if ($type == '?') $result = $this->sanitize($arg);
614
-
615
-        else $this->nonSQLError("Badly formatted SQL query: Invalid MeekroDB param $type");
628
+        if ($type == 's') {
629
+            $result = $this->escape($arg);
630
+        } else if ($type == 'i') {
631
+            $result = $this->intval($arg);
632
+        } else if ($type == 'd') {
633
+            $result = doubleval($arg);
634
+        } else if ($type == 'b') {
635
+            $result = $this->formatTableName($arg);
636
+        } else if ($type == 'l') {
637
+            $result = $arg;
638
+        } else if ($type == 'ss') {
639
+            $result = $this->escape("%".str_replace(array('%', '_'), array('\%', '\_'), $arg)."%");
640
+        } else if ($type == 't') {
641
+            $result = $this->escape($this->parseTS($arg));
642
+        } else if ($type == 'ls') {
643
+            $result = array_map(array($this, 'escape'), $arg);
644
+        } else if ($type == 'li') {
645
+            $result = array_map(array($this, 'intval'), $arg);
646
+        } else if ($type == 'ld') {
647
+            $result = array_map('doubleval', $arg);
648
+        } else if ($type == 'lb') {
649
+            $result = array_map(array($this, 'formatTableName'), $arg);
650
+        } else if ($type == 'll') {
651
+            $result = $arg;
652
+        } else if ($type == 'lt') {
653
+            $result = array_map(array($this, 'escape'), array_map(array($this, 'parseTS'), $arg));
654
+        } else if ($type == '?') {
655
+            $result = $this->sanitize($arg);
656
+        } else {
657
+            $this->nonSQLError("Badly formatted SQL query: Invalid MeekroDB param $type");
658
+        }
616 659
 
617
-        if (is_array($result)) $result = '('.implode(',', $result).')';
660
+        if (is_array($result)) {
661
+            $result = '('.implode(',', $result).')';
662
+        }
618 663
 
619 664
         $query .= $result;
620 665
     }
@@ -720,23 +765,33 @@  discard block
 block discarded – undo
720 765
     $this->affected_rows = $db->affected_rows;
721 766
 
722 767
     // mysqli_result->num_rows won't initially show correct results for unbuffered data
723
-    if ($is_buffered && ($result instanceof MySQLi_Result)) $this->num_rows = $result->num_rows;
724
-    else $this->num_rows = null;
768
+    if ($is_buffered && ($result instanceof MySQLi_Result)) {
769
+        $this->num_rows = $result->num_rows;
770
+    } else {
771
+        $this->num_rows = null;
772
+    }
725 773
 
726
-    if ($row_type == 'raw' || !($result instanceof MySQLi_Result)) return $result;
774
+    if ($row_type == 'raw' || !($result instanceof MySQLi_Result)) {
775
+        return $result;
776
+    }
727 777
 
728 778
     $return = array();
729 779
 
730 780
     if ($full_names) {
731 781
         $infos = array();
732 782
         foreach ($result->fetch_fields() as $info) {
733
-        if (strlen($info->table)) $infos[] = $info->table.'.'.$info->name;
734
-        else $infos[] = $info->name;
783
+        if (strlen($info->table)) {
784
+            $infos[] = $info->table.'.'.$info->name;
785
+        } else {
786
+            $infos[] = $info->name;
787
+        }
735 788
         }
736 789
     }
737 790
 
738 791
     while ($row = ($row_type == 'assoc' ? $result->fetch_assoc() : $result->fetch_row())) {
739
-        if ($full_names) $row = array_combine($infos, $row);
792
+        if ($full_names) {
793
+            $row = array_combine($infos, $row);
794
+        }
740 795
         $return[] = $row;
741 796
     }
742 797
 
@@ -929,7 +984,9 @@  discard block
 block discarded – undo
929 984
     DB::startTransaction();
930 985
     }
931 986
     function __destruct() {
932
-    if (!$this->committed) DB::rollback();
987
+    if (!$this->committed) {
988
+        DB::rollback();
989
+    }
933 990
     }
934 991
     function commit() {
935 992
     DB::commit();
@@ -963,10 +1020,14 @@  discard block
 block discarded – undo
963 1020
 
964 1021
     $R = array();
965 1022
     foreach ($array as $obj) {
966
-        if (!array_key_exists($field, $obj)) die("verticalSlice: array doesn't have requested field\n");
1023
+        if (!array_key_exists($field, $obj)) {
1024
+            die("verticalSlice: array doesn't have requested field\n");
1025
+        }
967 1026
 
968 1027
         if ($keyfield) {
969
-        if (!array_key_exists($keyfield, $obj)) die("verticalSlice: array doesn't have requested field\n");
1028
+        if (!array_key_exists($keyfield, $obj)) {
1029
+            die("verticalSlice: array doesn't have requested field\n");
1030
+        }
970 1031
         $R[$obj[$keyfield]] = $obj[$field];
971 1032
         } else {
972 1033
         $R[] = $obj[$field];
@@ -990,7 +1051,9 @@  discard block
 block discarded – undo
990 1051
         $target = & $R;
991 1052
 
992 1053
         foreach ($fields as $field) {
993
-        if (!array_key_exists($field, $obj)) die("reIndex: array doesn't have requested field\n");
1054
+        if (!array_key_exists($field, $obj)) {
1055
+            die("reIndex: array doesn't have requested field\n");
1056
+        }
994 1057
 
995 1058
         $nextkey = $obj[$field];
996 1059
         $target = & $target[$nextkey];
Please login to merge, or discard this patch.
includes/libraries/Authentication/Yubico/Yubico.php 1 patch
Braces   +25 added lines, -9 removed lines patch added patch discarded remove patch
@@ -148,15 +148,21 @@  discard block
 block discarded – undo
148 148
      */
149 149
     function getNextURLpart()
150 150
     {
151
-        if ($this->_url_list) $url_list = $this->_url_list;
152
-        else $url_list = array('api.yubico.com/wsapi/2.0/verify',
151
+        if ($this->_url_list) {
152
+            $url_list = $this->_url_list;
153
+        } else {
154
+            $url_list = array('api.yubico.com/wsapi/2.0/verify',
153 155
                     'api2.yubico.com/wsapi/2.0/verify', 
154 156
                     'api3.yubico.com/wsapi/2.0/verify', 
155 157
                     'api4.yubico.com/wsapi/2.0/verify',
156 158
                     'api5.yubico.com/wsapi/2.0/verify');
159
+        }
157 160
 	  
158
-        if ($this->_url_index >= count($url_list)) return false;
159
-        else return $url_list[$this->_url_index++];
161
+        if ($this->_url_index >= count($url_list)) {
162
+            return false;
163
+        } else {
164
+            return $url_list[$this->_url_index++];
165
+        }
160 166
     }
161 167
 
162 168
     /**
@@ -291,12 +297,20 @@  discard block
 block discarded – undo
291 297
                 'otp'=>$ret['otp'],
292 298
                 'nonce'=>md5(uniqid(rand())));
293 299
         /* Take care of protocol version 2 parameters */
294
-        if ($use_timestamp) $params['timestamp'] = 1;
295
-        if ($sl) $params['sl'] = $sl;
296
-        if ($timeout) $params['timeout'] = $timeout;
300
+        if ($use_timestamp) {
301
+            $params['timestamp'] = 1;
302
+        }
303
+        if ($sl) {
304
+            $params['sl'] = $sl;
305
+        }
306
+        if ($timeout) {
307
+            $params['timeout'] = $timeout;
308
+        }
297 309
         ksort($params);
298 310
         $parameters = '';
299
-        foreach ($params as $p=>$v) $parameters .= "&".$p."=".$v;
311
+        foreach ($params as $p=>$v) {
312
+            $parameters .= "&".$p."=".$v;
313
+        }
300 314
         $parameters = ltrim($parameters, "&");
301 315
 	  
302 316
         /* Generate signature. */
@@ -401,7 +415,9 @@  discard block
 block discarded – undo
401 415
             $check = Null;
402 416
             foreach ($parameters as $param) {
403 417
                 if (array_key_exists($param, $response)) {
404
-            if ($check) $check = $check.'&';
418
+            if ($check) {
419
+                $check = $check.'&';
420
+            }
405 421
             $check = $check.$param.'='.$response[$param];
406 422
                 }
407 423
             }
Please login to merge, or discard this patch.
includes/libraries/Pdf/Tfpdf/font/courieri.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-Oblique';
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/Pdf/Tfpdf/font/unifont/ttfonts.php 1 patch
Braces   +85 added lines, -65 removed lines patch added patch discarded remove patch
@@ -90,12 +90,15 @@  discard block
 block discarded – undo
90 90
         $this->descent = 0;
91 91
         $this->TTCFonts = array();
92 92
         $this->version = $version = $this->read_ulong();
93
-        if ($version == 0x4F54544F) 
94
-            die("Postscript outlines are not supported");
95
-        if ($version == 0x74746366) 
96
-            die("ERROR - TrueType Fonts Collections not supported");
97
-        if (!in_array($version, array(0x00010000, 0x74727565)))
98
-            die("Not a TrueType font: version=".$version);
93
+        if ($version == 0x4F54544F) {
94
+                    die("Postscript outlines are not supported");
95
+        }
96
+        if ($version == 0x74746366) {
97
+                    die("ERROR - TrueType Fonts Collections not supported");
98
+        }
99
+        if (!in_array($version, array(0x00010000, 0x74727565))) {
100
+                    die("Not a TrueType font: version=".$version);
101
+        }
99 102
         $this->readTableDirectory();
100 103
         $this->extractInfo();
101 104
         fclose($this->fh);
@@ -322,13 +325,16 @@  discard block
 block discarded – undo
322 325
                 $nameId = $this->read_ushort();
323 326
                 $length = $this->read_ushort();
324 327
                 $offset = $this->read_ushort();
325
-                if (!in_array($nameId, $K)) continue;
328
+                if (!in_array($nameId, $K)) {
329
+                    continue;
330
+                }
326 331
                 $N = '';
327 332
                 if ($platformId == 3 && $encodingId == 1 && $languageId == 0x409) { // Microsoft, Unicode, US English, PS Name
328 333
                     $opos = $this->_pos;
329 334
                     $this->seek($string_data_offset + $offset);
330
-                    if ($length % 2 != 0)
331
-                        die("PostScript name is UTF-16BE string of odd length");
335
+                    if ($length % 2 != 0) {
336
+                                            die("PostScript name is UTF-16BE string of odd length");
337
+                    }
332 338
                     $length /= 2;
333 339
                     $N = '';
334 340
                     while ($length > 0) {
@@ -347,19 +353,23 @@  discard block
 block discarded – undo
347 353
                 if ($N && $names[$nameId] == '') {
348 354
                     $names[$nameId] = $N;
349 355
                     $nameCount -= 1;
350
-                    if ($nameCount == 0) break;
356
+                    if ($nameCount == 0) {
357
+                        break;
358
+                    }
351 359
                 }
352 360
             }
353
-            if ($names[6])
354
-                $psName = $names[6];
355
-            else if ($names[4])
356
-                $psName = preg_replace('/ /', '-', $names[4]);
357
-            else if ($names[1])
358
-                $psName = preg_replace('/ /', '-', $names[1]);
359
-            else
360
-                $psName = '';
361
-            if (!$psName)
362
-                die("Could not find PostScript font name");
361
+            if ($names[6]) {
362
+                            $psName = $names[6];
363
+            } else if ($names[4]) {
364
+                            $psName = preg_replace('/ /', '-', $names[4]);
365
+            } else if ($names[1]) {
366
+                            $psName = preg_replace('/ /', '-', $names[1]);
367
+            } else {
368
+                            $psName = '';
369
+            }
370
+            if (!$psName) {
371
+                            die("Could not find PostScript font name");
372
+            }
363 373
             $this->name = $psName;
364 374
             if ($names[1]) { $this->familyName = $names[1]; } else { $this->familyName = $psName; }
365 375
             if ($names[2]) { $this->styleName = $names[2]; } else { $this->styleName = 'Regular'; }
@@ -423,21 +433,27 @@  discard block
 block discarded – undo
423 433
             $this->skip(26);
424 434
             $sTypoAscender = $this->read_short();
425 435
             $sTypoDescender = $this->read_short();
426
-            if (!$this->ascent) $this->ascent = ($sTypoAscender * $scale);
427
-            if (!$this->descent) $this->descent = ($sTypoDescender * $scale);
436
+            if (!$this->ascent) {
437
+                $this->ascent = ($sTypoAscender * $scale);
438
+            }
439
+            if (!$this->descent) {
440
+                $this->descent = ($sTypoDescender * $scale);
441
+            }
428 442
             if ($version > 1) {
429 443
                 $this->skip(16);
430 444
                 $sCapHeight = $this->read_short();
431 445
                 $this->capHeight = ($sCapHeight * $scale);
432
-            }
433
-            else {
446
+            } else {
434 447
                 $this->capHeight = $this->ascent;
435 448
             }
436
-        }
437
-        else {
449
+        } else {
438 450
             $usWeightClass = 500;
439
-            if (!$this->ascent) $this->ascent = ($yMax * $scale);
440
-            if (!$this->descent) $this->descent = ($yMin * $scale);
451
+            if (!$this->ascent) {
452
+                $this->ascent = ($yMax * $scale);
453
+            }
454
+            if (!$this->descent) {
455
+                $this->descent = ($yMin * $scale);
456
+            }
441 457
             $this->capHeight = $this->ascent;
442 458
         }
443 459
         $this->stemV = 50 + intval(pow(($usWeightClass / 65.0), 2));
@@ -454,12 +470,15 @@  discard block
 block discarded – undo
454 470
 
455 471
         $this->flags = 4;
456 472
 
457
-        if ($this->italicAngle != 0) 
458
-            $this->flags = $this->flags | 64;
459
-        if ($usWeightClass >= 600)
460
-            $this->flags = $this->flags | 262144;
461
-        if ($isFixedPitch)
462
-            $this->flags = $this->flags | 1;
473
+        if ($this->italicAngle != 0) {
474
+                    $this->flags = $this->flags | 64;
475
+        }
476
+        if ($usWeightClass >= 600) {
477
+                    $this->flags = $this->flags | 262144;
478
+        }
479
+        if ($isFixedPitch) {
480
+                    $this->flags = $this->flags | 1;
481
+        }
463 482
 
464 483
         ///////////////////////////////////
465 484
         // hhea - Horizontal header table
@@ -498,14 +517,17 @@  discard block
 block discarded – undo
498 517
             if (($platformID == 3 && $encodingID == 1) || $platformID == 0) { // Microsoft, Unicode
499 518
                 $format = $this->get_ushort($cmap_offset + $offset);
500 519
                 if ($format == 4) {
501
-                    if (!$unicode_cmap_offset) $unicode_cmap_offset = $cmap_offset + $offset;
520
+                    if (!$unicode_cmap_offset) {
521
+                        $unicode_cmap_offset = $cmap_offset + $offset;
522
+                    }
502 523
                     break;
503 524
                 }
504 525
             }
505 526
             $this->seek($save_pos);
506 527
         }
507
-        if (!$unicode_cmap_offset)
508
-            die('Font ('.$this->filename.') does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)');
528
+        if (!$unicode_cmap_offset) {
529
+                    die('Font ('.$this->filename.') does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)');
530
+        }
509 531
 
510 532
 
511 533
         $glyphToChar = array();
@@ -589,8 +611,9 @@  discard block
 block discarded – undo
589 611
             $this->seek($save_pos);
590 612
         }
591 613
 
592
-        if (!$unicode_cmap_offset)
593
-            die('Font ('.$this->filename.') does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)');
614
+        if (!$unicode_cmap_offset) {
615
+                    die('Font ('.$this->filename.') does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)');
616
+        }
594 617
 
595 618
 
596 619
         $glyphToChar = array();
@@ -775,10 +798,12 @@  discard block
 block discarded – undo
775 798
             $glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
776 799
             if ($glyfLength < $this->maxStrLenRead) {
777 800
                 $data = substr($glyphData, $glyphPos, $glyphLen);
778
-            }
779
-            else {
780
-                if ($glyphLen > 0) $data = $this->get_chunk($glyfOffset + $glyphPos, $glyphLen);
781
-                else $data = '';
801
+            } else {
802
+                if ($glyphLen > 0) {
803
+                    $data = $this->get_chunk($glyfOffset + $glyphPos, $glyphLen);
804
+                } else {
805
+                    $data = '';
806
+                }
782 807
             }
783 808
 
784 809
             if ($glyphLen > 0) {
@@ -824,8 +849,7 @@  discard block
 block discarded – undo
824 849
         if ((($pos + 1) >> 1) > 0xFFFF) {
825 850
             $indexToLocFormat = 1; // long format
826 851
             foreach ($offsets AS $offset) { $locastr .= pack("N", $offset); }
827
-        }
828
-        else {
852
+        } else {
829 853
             $indexToLocFormat = 0; // short format
830 854
             foreach ($offsets AS $offset) { $locastr .= pack("n", ($offset / 2)); }
831 855
         }
@@ -931,14 +955,12 @@  discard block
 block discarded – undo
931 955
         if (($numberOfHMetrics * 4) < $this->maxStrLenRead) {
932 956
             $data = $this->get_chunk($start, ($numberOfHMetrics * 4));
933 957
             $arr = unpack("n*", $data);
934
-        }
935
-        else { $this->seek($start); }
958
+        } else { $this->seek($start); }
936 959
         for ($glyph = 0; $glyph < $numberOfHMetrics; $glyph++) {
937 960
 
938 961
             if (($numberOfHMetrics * 4) < $this->maxStrLenRead) {
939 962
                 $aw = $arr[($glyph * 2) + 1];
940
-            }
941
-            else {
963
+            } else {
942 964
                 $aw = $this->read_ushort();
943 965
                 $lsb = $this->read_ushort();
944 966
             }
@@ -996,8 +1018,7 @@  discard block
 block discarded – undo
996 1018
         if ($gid < $numberOfHMetrics) {
997 1019
             $this->seek($start + ($gid * 4));
998 1020
             $hm = fread($this->fh, 4);
999
-        }
1000
-        else {
1021
+        } else {
1001 1022
             $this->seek($start + (($numberOfHMetrics - 1) * 4));
1002 1023
             $hm = fread($this->fh, 2);
1003 1024
             $this->seek($start + ($numberOfHMetrics * 2) + ($gid * 2));
@@ -1019,16 +1040,15 @@  discard block
 block discarded – undo
1019 1040
             for ($n = 0; $n <= $numGlyphs; $n++) {
1020 1041
                 $this->glyphPos[] = ($arr[$n + 1] * 2);
1021 1042
             }
1022
-        }
1023
-        else if ($indexToLocFormat == 1) {
1043
+        } else if ($indexToLocFormat == 1) {
1024 1044
             $data = $this->get_chunk($start, ($numGlyphs * 4) + 4);
1025 1045
             $arr = unpack("N*", $data);
1026 1046
             for ($n = 0; $n <= $numGlyphs; $n++) {
1027 1047
                 $this->glyphPos[] = ($arr[$n + 1]);
1028 1048
             }
1049
+        } else {
1050
+                    die('Unknown location table format '.$indexToLocFormat);
1029 1051
         }
1030
-        else 
1031
-            die('Unknown location table format '.$indexToLocFormat);
1032 1052
     }
1033 1053
 
1034 1054
 
@@ -1060,17 +1080,18 @@  discard block
 block discarded – undo
1060 1080
         for ($n = 0; $n < $segCount; $n++) {
1061 1081
             $endpoint = ($endCount[$n] + 1);
1062 1082
             for ($unichar = $startCount[$n]; $unichar < $endpoint; $unichar++) {
1063
-                if ($idRangeOffset[$n] == 0)
1064
-                    $glyph = ($unichar + $idDelta[$n]) & 0xFFFF;
1065
-                else {
1083
+                if ($idRangeOffset[$n] == 0) {
1084
+                                    $glyph = ($unichar + $idDelta[$n]) & 0xFFFF;
1085
+                } else {
1066 1086
                     $offset = ($unichar - $startCount[$n]) * 2 + $idRangeOffset[$n];
1067 1087
                     $offset = $idRangeOffset_start + 2 * $n + $offset;
1068
-                    if ($offset >= $limit)
1069
-                        $glyph = 0;
1070
-                    else {
1088
+                    if ($offset >= $limit) {
1089
+                                            $glyph = 0;
1090
+                    } else {
1071 1091
                         $glyph = $this->get_ushort($offset);
1072
-                        if ($glyph != 0)
1073
-                            $glyph = ($glyph + $idDelta[$n]) & 0xFFFF;
1092
+                        if ($glyph != 0) {
1093
+                                                    $glyph = ($glyph + $idDelta[$n]) & 0xFFFF;
1094
+                        }
1074 1095
                     }
1075 1096
                 }
1076 1097
                 $charToGlyph[$unichar] = $glyph;
@@ -1101,8 +1122,7 @@  discard block
 block discarded – undo
1101 1122
         // Header
1102 1123
         if (_TTF_MAC_HEADER) {
1103 1124
             $stm .= (pack("Nnnnn", 0x74727565, $numTables, $searchRange, $entrySelector, $rangeShift)); // Mac
1104
-        }
1105
-        else {
1125
+        } else {
1106 1126
             $stm .= (pack("Nnnnn", 0x00010000, $numTables, $searchRange, $entrySelector, $rangeShift)); // Windows
1107 1127
         }
1108 1128
 
Please login to merge, or discard this patch.
includes/libraries/Pdf/Tfpdf/font/courier.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';
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/Pdf/Tfpdf/tfpdf.class.php 1 patch
Braces   +29 added lines, -26 removed lines patch added patch discarded remove patch
@@ -224,15 +224,17 @@  discard block
 block discarded – undo
224 224
 function SetDisplayMode($zoom, $layout = 'default')
225 225
 {
226 226
     // Set display mode in viewer
227
-    if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom))
228
-        $this->ZoomMode = $zoom;
229
-    else
230
-        $this->Error('Incorrect zoom display mode: '.$zoom);
231
-    if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default')
232
-        $this->LayoutMode = $layout;
233
-    else
234
-        $this->Error('Incorrect layout display mode: '.$layout);
235
-}
227
+    if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) {
228
+            $this->ZoomMode = $zoom;
229
+    } else {
230
+            $this->Error('Incorrect zoom display mode: '.$zoom);
231
+    }
232
+    if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') {
233
+            $this->LayoutMode = $layout;
234
+    } else {
235
+            $this->Error('Incorrect layout display mode: '.$layout);
236
+    }
237
+    }
236 238
 
237 239
 /**
238 240
  * @param boolean $compress
@@ -513,23 +515,23 @@  discard block
 block discarded – undo
513 515
     // Add a TrueType, OpenType or Type1 font
514 516
     $family = strtolower($family);
515 517
     $style = strtoupper($style);
516
-    if ($style == 'IB')
517
-        $style = 'BI';
518
+    if ($style == 'IB') {
519
+            $style = 'BI';
520
+    }
518 521
     if ($file == '') {
519 522
         if ($uni) {
520 523
         $file = str_replace(' ', '', $family).strtolower($style).'.ttf';
521
-        }
522
-        else {
524
+        } else {
523 525
         $file = str_replace(' ', '', $family).strtolower($style).'.php';
524 526
         }
525 527
     }
526 528
     $fontkey = $family.$style;
527
-    if (isset($this->fonts[$fontkey]))
528
-        return;
529
+    if (isset($this->fonts[$fontkey])) {
530
+            return;
531
+    }
529 532
 
530 533
     if ($uni) {
531
-        if (defined("_SYSTEM_TTFONTS") && file_exists(_SYSTEM_TTFONTS.$file)) { $ttffilename = _SYSTEM_TTFONTS.$file; }
532
-        else { $ttffilename = $this->_getfontpath().'unifont/'.$file; }
534
+        if (defined("_SYSTEM_TTFONTS") && file_exists(_SYSTEM_TTFONTS.$file)) { $ttffilename = _SYSTEM_TTFONTS.$file; } else { $ttffilename = $this->_getfontpath().'unifont/'.$file; }
533 535
         $unifilename = $this->_getfontpath().'unifont/'.strtolower(substr($file, 0, (strpos($file, '.'))));
534 536
         $name = '';
535 537
         $originalsize = 0;
@@ -2410,18 +2412,19 @@  discard block
 block discarded – undo
2410 2412
     for ($i = 0; $i < $len; $i++) {
2411 2413
     $uni = -1;
2412 2414
         $h = ord($str[$i]);
2413
-        if ($h <= 0x7F)
2414
-            $uni = $h;
2415
-        elseif ($h >= 0xC2) {
2416
-            if (($h <= 0xDF) && ($i < $len - 1))
2417
-            $uni = ($h & 0x1F) << 6 | (ord($str[++$i]) & 0x3F);
2418
-            elseif (($h <= 0xEF) && ($i < $len - 2))
2419
-            $uni = ($h & 0x0F) << 12 | (ord($str[++$i]) & 0x3F) << 6
2415
+        if ($h <= 0x7F) {
2416
+                    $uni = $h;
2417
+        } elseif ($h >= 0xC2) {
2418
+            if (($h <= 0xDF) && ($i < $len - 1)) {
2419
+                        $uni = ($h & 0x1F) << 6 | (ord($str[++$i]) & 0x3F);
2420
+            } elseif (($h <= 0xEF) && ($i < $len - 2)) {
2421
+                        $uni = ($h & 0x0F) << 12 | (ord($str[++$i]) & 0x3F) << 6
2420 2422
                                         | (ord($str[++$i]) & 0x3F);
2421
-            elseif (($h <= 0xF4) && ($i < $len - 3))
2422
-            $uni = ($h & 0x0F) << 18 | (ord($str[++$i]) & 0x3F) << 12
2423
+            } elseif (($h <= 0xF4) && ($i < $len - 3)) {
2424
+                        $uni = ($h & 0x0F) << 18 | (ord($str[++$i]) & 0x3F) << 12
2423 2425
                                         | (ord($str[++$i]) & 0x3F) << 6
2424 2426
                                         | (ord($str[++$i]) & 0x3F);
2427
+            }
2425 2428
         }
2426 2429
     if ($uni >= 0) {
2427 2430
         $out[] = $uni;
Please login to merge, or discard this patch.