@@ -11,21 +11,25 @@ discard block |
||
11 | 11 | |
12 | 12 | |
13 | 13 | $this->page++; |
14 | - if(!isset($this->pages[$this->page])) // solves the problem of overwriting a page if it already exists |
|
14 | + if(!isset($this->pages[$this->page])) { |
|
15 | + // solves the problem of overwriting a page if it already exists |
|
15 | 16 | $this->pages[$this->page] = ''; |
17 | + } |
|
16 | 18 | $this->state =2; |
17 | 19 | $this->x = $this->lMargin; |
18 | 20 | $this->y = $this->tMargin; |
19 | 21 | $this->FontFamily = ''; |
20 | 22 | // Check page size and orientation |
21 | - if($orientation=='') |
|
22 | - $orientation = $this->DefOrientation; |
|
23 | - else |
|
24 | - $orientation = strtoupper($orientation[0]); |
|
25 | - if($size=='') |
|
26 | - $size = $this->DefPageSize; |
|
27 | - else |
|
28 | - $size = $this->_getpagesize($size); |
|
23 | + if($orientation=='') { |
|
24 | + $orientation = $this->DefOrientation; |
|
25 | + } else { |
|
26 | + $orientation = strtoupper($orientation[0]); |
|
27 | + } |
|
28 | + if($size=='') { |
|
29 | + $size = $this->DefPageSize; |
|
30 | + } else { |
|
31 | + $size = $this->_getpagesize($size); |
|
32 | + } |
|
29 | 33 | if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
30 | 34 | { |
31 | 35 | // New size or orientation |
@@ -33,8 +37,7 @@ discard block |
||
33 | 37 | { |
34 | 38 | $this->w = $size[0]; |
35 | 39 | $this->h = $size[1]; |
36 | - } |
|
37 | - else |
|
40 | + } else |
|
38 | 41 | { |
39 | 42 | $this->w = $size[1]; |
40 | 43 | $this->h = $size[0]; |
@@ -45,9 +48,10 @@ discard block |
||
45 | 48 | $this->CurOrientation = $orientation; |
46 | 49 | $this->CurPageSize = $size; |
47 | 50 | } |
48 | - if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
49 | - $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); |
|
50 | -} |
|
51 | + if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) { |
|
52 | + $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); |
|
53 | + } |
|
54 | + } |
|
51 | 55 | |
52 | 56 | function Footer() { |
53 | 57 | // Check if Footer for this page already exists (do the same for Header()) |
@@ -82,19 +86,22 @@ discard block |
||
82 | 86 | $this->page = $currpage; |
83 | 87 | $this->SetXY($l,$h); |
84 | 88 | |
85 | - if($col == 5) |
|
86 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
87 | - else |
|
88 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
89 | + if($col == 5) { |
|
90 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
91 | + } else { |
|
92 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
93 | + } |
|
89 | 94 | $l += $this->tablewidths[$col]; |
90 | 95 | |
91 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
92 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
96 | + if(!isset($tmpheight[$row.'-'.$this->page])) { |
|
97 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
98 | + } |
|
93 | 99 | if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
94 | 100 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
95 | 101 | } |
96 | - if($this->page > $maxpage) |
|
97 | - $maxpage = $this->page; |
|
102 | + if($this->page > $maxpage) { |
|
103 | + $maxpage = $this->page; |
|
104 | + } |
|
98 | 105 | } |
99 | 106 | |
100 | 107 | // get the height we were in the last used page |
@@ -142,30 +149,35 @@ discard block |
||
142 | 149 | foreach($datas AS $row => $data) { |
143 | 150 | $this->page = $currpage; |
144 | 151 | // write the horizontal borders |
145 | - if($data != "") |
|
146 | - $this->Line(100,$h,200,$h); |
|
152 | + if($data != "") { |
|
153 | + $this->Line(100,$h,200,$h); |
|
154 | + } |
|
147 | 155 | // write the content and remember the height of the highest col |
148 | 156 | foreach($data AS $col => $txt) { |
149 | 157 | $this->page = $currpage; |
150 | 158 | $this->SetXY($l,$h); |
151 | 159 | |
152 | - if($col == 3) |
|
153 | - $this->SetFont('Arial', 'B', 8); |
|
154 | - else |
|
155 | - $this->SetFont('Arial', '', 8); |
|
156 | - if($col == 5) |
|
157 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
158 | - else |
|
159 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
160 | + if($col == 3) { |
|
161 | + $this->SetFont('Arial', 'B', 8); |
|
162 | + } else { |
|
163 | + $this->SetFont('Arial', '', 8); |
|
164 | + } |
|
165 | + if($col == 5) { |
|
166 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
167 | + } else { |
|
168 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
169 | + } |
|
160 | 170 | $l += $this->tablewidths[$col]; |
161 | 171 | |
162 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
163 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
172 | + if(!isset($tmpheight[$row.'-'.$this->page])) { |
|
173 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
174 | + } |
|
164 | 175 | if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
165 | 176 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
166 | 177 | } |
167 | - if($this->page > $maxpage) |
|
168 | - $maxpage = $this->page; |
|
178 | + if($this->page > $maxpage) { |
|
179 | + $maxpage = $this->page; |
|
180 | + } |
|
169 | 181 | } |
170 | 182 | |
171 | 183 | // get the height we were in the last used page |
@@ -224,19 +236,22 @@ discard block |
||
224 | 236 | $this->page = $currpage; |
225 | 237 | $this->SetXY($l,$h); |
226 | 238 | |
227 | - if($col == 5) |
|
228 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
229 | - else |
|
230 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
239 | + if($col == 5) { |
|
240 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
241 | + } else { |
|
242 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
243 | + } |
|
231 | 244 | $l += $this->tablewidths[$col]; |
232 | 245 | |
233 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
234 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
246 | + if(!isset($tmpheight[$row.'-'.$this->page])) { |
|
247 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
248 | + } |
|
235 | 249 | if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
236 | 250 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
237 | 251 | } |
238 | - if($this->page > $maxpage) |
|
239 | - $maxpage = $this->page; |
|
252 | + if($this->page > $maxpage) { |
|
253 | + $maxpage = $this->page; |
|
254 | + } |
|
240 | 255 | } |
241 | 256 | |
242 | 257 | // get the height we were in the last used page |
@@ -443,14 +443,12 @@ discard block |
||
443 | 443 | // error |
444 | 444 | $this->errno = $code; |
445 | 445 | $this->errstr = htmlentities($fstr); |
446 | - } |
|
447 | - else if ( ! is_object($val)) |
|
446 | + } else if ( ! is_object($val)) |
|
448 | 447 | { |
449 | 448 | // programmer error, not an object |
450 | 449 | error_log("Invalid type '".gettype($val)."' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); |
451 | 450 | $this->val = new XML_RPC_Values(); |
452 | - } |
|
453 | - else |
|
451 | + } else |
|
454 | 452 | { |
455 | 453 | $this->val = $val; |
456 | 454 | } |
@@ -979,50 +977,42 @@ discard block |
||
979 | 977 | if ($name == 'STRING') |
980 | 978 | { |
981 | 979 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
982 | - } |
|
983 | - elseif ($name == 'DATETIME.ISO8601') |
|
980 | + } elseif ($name == 'DATETIME.ISO8601') |
|
984 | 981 | { |
985 | 982 | $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; |
986 | 983 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
987 | - } |
|
988 | - elseif ($name == 'BASE64') |
|
984 | + } elseif ($name == 'BASE64') |
|
989 | 985 | { |
990 | 986 | $this->xh[$the_parser]['value'] = base64_decode($this->xh[$the_parser]['ac']); |
991 | - } |
|
992 | - elseif ($name == 'BOOLEAN') |
|
987 | + } elseif ($name == 'BOOLEAN') |
|
993 | 988 | { |
994 | 989 | // Translated BOOLEAN values to TRUE AND FALSE |
995 | 990 | if ($this->xh[$the_parser]['ac'] == '1') |
996 | 991 | { |
997 | 992 | $this->xh[$the_parser]['value'] = TRUE; |
998 | - } |
|
999 | - else |
|
993 | + } else |
|
1000 | 994 | { |
1001 | 995 | $this->xh[$the_parser]['value'] = FALSE; |
1002 | 996 | } |
1003 | - } |
|
1004 | - elseif ($name == 'DOUBLE') |
|
997 | + } elseif ($name == 'DOUBLE') |
|
1005 | 998 | { |
1006 | 999 | // we have a DOUBLE |
1007 | 1000 | // we must check that only 0123456789-.<space> are characters here |
1008 | 1001 | if ( ! preg_match('/^[+-]?[eE0-9\t \.]+$/', $this->xh[$the_parser]['ac'])) |
1009 | 1002 | { |
1010 | 1003 | $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
1011 | - } |
|
1012 | - else |
|
1004 | + } else |
|
1013 | 1005 | { |
1014 | 1006 | $this->xh[$the_parser]['value'] = (double)$this->xh[$the_parser]['ac']; |
1015 | 1007 | } |
1016 | - } |
|
1017 | - else |
|
1008 | + } else |
|
1018 | 1009 | { |
1019 | 1010 | // we have an I4/INT |
1020 | 1011 | // we must check that only 0123456789-<space> are characters here |
1021 | 1012 | if ( ! preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac'])) |
1022 | 1013 | { |
1023 | 1014 | $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
1024 | - } |
|
1025 | - else |
|
1015 | + } else |
|
1026 | 1016 | { |
1027 | 1017 | $this->xh[$the_parser]['value'] = (int)$this->xh[$the_parser]['ac']; |
1028 | 1018 | } |
@@ -1219,12 +1209,10 @@ discard block |
||
1219 | 1209 | if ($this->xmlrpcTypes[$type] == 1) |
1220 | 1210 | { |
1221 | 1211 | $this->addScalar($val, $type); |
1222 | - } |
|
1223 | - elseif ($this->xmlrpcTypes[$type] == 2) |
|
1212 | + } elseif ($this->xmlrpcTypes[$type] == 2) |
|
1224 | 1213 | { |
1225 | 1214 | $this->addArray($val); |
1226 | - } |
|
1227 | - elseif ($this->xmlrpcTypes[$type] == 3) |
|
1215 | + } elseif ($this->xmlrpcTypes[$type] == 3) |
|
1228 | 1216 | { |
1229 | 1217 | $this->addStruct($val); |
1230 | 1218 | } |
@@ -1121,8 +1121,7 @@ discard block |
||
1121 | 1121 | if ($escape === FALSE) |
1122 | 1122 | { |
1123 | 1123 | $this->ar_set[] = '('.implode(',', $row).')'; |
1124 | - } |
|
1125 | - else |
|
1124 | + } else |
|
1126 | 1125 | { |
1127 | 1126 | $clean = array(); |
1128 | 1127 | |
@@ -2132,8 +2131,9 @@ discard block |
||
2132 | 2131 | */ |
2133 | 2132 | function _insert_on_duplicate_update_batch($table, $keys, $values) |
2134 | 2133 | { |
2135 | - foreach($keys as $key) |
|
2136 | - $update_fields[] = $key.'=VALUES('.$key.')'; |
|
2134 | + foreach($keys as $key) { |
|
2135 | + $update_fields[] = $key.'=VALUES('.$key.')'; |
|
2136 | + } |
|
2137 | 2137 | |
2138 | 2138 | return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values)." ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields); |
2139 | 2139 | } |
@@ -338,13 +338,15 @@ |
||
338 | 338 | */ |
339 | 339 | function count_all($table = '') |
340 | 340 | { |
341 | - if ($table == '') |
|
342 | - return '0'; |
|
341 | + if ($table == '') { |
|
342 | + return '0'; |
|
343 | + } |
|
343 | 344 | |
344 | 345 | $query = $this->query("SELECT COUNT(*) AS numrows FROM ".$this->dbprefix.$table); |
345 | 346 | |
346 | - if ($query->num_rows() == 0) |
|
347 | - return '0'; |
|
347 | + if ($query->num_rows() == 0) { |
|
348 | + return '0'; |
|
349 | + } |
|
348 | 350 | |
349 | 351 | $row = $query->row(); |
350 | 352 | $this->_reset_select(); |
@@ -338,20 +338,17 @@ |
||
338 | 338 | if ($table == NULL && $v >= '8.1') |
339 | 339 | { |
340 | 340 | $sql = 'SELECT LASTVAL() as ins_id'; |
341 | - } |
|
342 | - elseif ($table != NULL && $column != NULL && $v >= '8.0') |
|
341 | + } elseif ($table != NULL && $column != NULL && $v >= '8.0') |
|
343 | 342 | { |
344 | 343 | $sql = sprintf("SELECT pg_get_serial_sequence('%s','%s') as seq", $table, $column); |
345 | 344 | $query = $this->query($sql); |
346 | 345 | $row = $query->row(); |
347 | 346 | $sql = sprintf("SELECT CURRVAL('%s') as ins_id", $row->seq); |
348 | - } |
|
349 | - elseif ($table != NULL) |
|
347 | + } elseif ($table != NULL) |
|
350 | 348 | { |
351 | 349 | // seq_name passed in table parameter |
352 | 350 | $sql = sprintf("SELECT CURRVAL('%s') as ins_id", $table); |
353 | - } |
|
354 | - else |
|
351 | + } else |
|
355 | 352 | { |
356 | 353 | return pg_last_oid($this->result_id); |
357 | 354 | } |
@@ -42,8 +42,7 @@ |
||
42 | 42 | if ($this->conn_id) |
43 | 43 | { |
44 | 44 | return "SELECT '".$this->database."'"; |
45 | - } |
|
46 | - else |
|
45 | + } else |
|
47 | 46 | { |
48 | 47 | return FALSE; |
49 | 48 | } |
@@ -318,31 +318,26 @@ |
||
318 | 318 | if ($index_page === TRUE) |
319 | 319 | { |
320 | 320 | $link .= 'href="'.$CI->config->site_url($v).'" '; |
321 | - } |
|
322 | - else |
|
321 | + } else |
|
323 | 322 | { |
324 | 323 | $link .= 'href="'.$CI->config->slash_item('base_url').$v.'" '; |
325 | 324 | } |
326 | - } |
|
327 | - else |
|
325 | + } else |
|
328 | 326 | { |
329 | 327 | $link .= "$k=\"$v\" "; |
330 | 328 | } |
331 | 329 | } |
332 | 330 | |
333 | 331 | $link .= "/>"; |
334 | - } |
|
335 | - else |
|
332 | + } else |
|
336 | 333 | { |
337 | 334 | if (strpos($href, '://') !== FALSE) |
338 | 335 | { |
339 | 336 | $link .= 'href="'.$href.'" '; |
340 | - } |
|
341 | - elseif ($index_page === TRUE) |
|
337 | + } elseif ($index_page === TRUE) |
|
342 | 338 | { |
343 | 339 | $link .= 'href="'.$CI->config->site_url($href).'" '; |
344 | - } |
|
345 | - else |
|
340 | + } else |
|
346 | 341 | { |
347 | 342 | $link .= 'href="'.$CI->config->slash_item('base_url').$href.'" '; |
348 | 343 | } |
@@ -232,8 +232,7 @@ |
||
232 | 232 | if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) |
233 | 233 | { |
234 | 234 | include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); |
235 | - } |
|
236 | - elseif (file_exists(APPPATH.'config/smileys.php')) |
|
235 | + } elseif (file_exists(APPPATH.'config/smileys.php')) |
|
237 | 236 | { |
238 | 237 | include(APPPATH.'config/smileys.php'); |
239 | 238 | } |
@@ -465,8 +465,7 @@ discard block |
||
465 | 465 | if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex['2'])) |
466 | 466 | { |
467 | 467 | $sec = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; |
468 | - } |
|
469 | - else |
|
468 | + } else |
|
470 | 469 | { |
471 | 470 | // Unless specified, seconds get set to zero. |
472 | 471 | $sec = '00'; |
@@ -476,14 +475,17 @@ discard block |
||
476 | 475 | { |
477 | 476 | $ampm = strtolower($split['2']); |
478 | 477 | |
479 | - if (substr($ampm, 0, 1) == 'p' AND $hour < 12) |
|
480 | - $hour = $hour + 12; |
|
478 | + if (substr($ampm, 0, 1) == 'p' AND $hour < 12) { |
|
479 | + $hour = $hour + 12; |
|
480 | + } |
|
481 | 481 | |
482 | - if (substr($ampm, 0, 1) == 'a' AND $hour == 12) |
|
483 | - $hour = '00'; |
|
482 | + if (substr($ampm, 0, 1) == 'a' AND $hour == 12) { |
|
483 | + $hour = '00'; |
|
484 | + } |
|
484 | 485 | |
485 | - if (strlen($hour) == 1) |
|
486 | - $hour = '0'.$hour; |
|
486 | + if (strlen($hour) == 1) { |
|
487 | + $hour = '0'.$hour; |
|
488 | + } |
|
487 | 489 | } |
488 | 490 | |
489 | 491 | return mktime($hour, $min, $sec, $month, $day, $year); |