Passed
Branch master (1c14b0)
by Saepul
02:59
created
emailsend.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 {	$emailstatus = $_POST['emailstatus'];
8 8
 	if($emailstatus=="Sent")
9 9
 	{	$errors[] = 'You have sent this email!';
10
-	}else
10
+	} else
11 11
 	{	$to 	 = $_POST['emailto'];
12 12
 		$cc 	 = substr($_POST['emailcc'], 0, -2);
13 13
 		$subject = $_POST['emailsubject'];
Please login to merge, or discard this patch.
changepwd.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 	$userpassword	= $user['password'];
9 9
 	if ($oldpassword != $userpassword)
10 10
 	{	$errors[] = 'The old password does not match!';	
11
-	}else
11
+	} else
12 12
 	{	$newpassword1 	= $_POST['newpassword1'];
13 13
 		$users->changepwd($userid,$newpassword1);
14 14
 		$users->log_users($_SESSION['loginid'],"Change the old password");
Please login to merge, or discard this patch.
ticketlist.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 $general->logged_out_protect();
4 4
 $user = $users->userdata($_SESSION['loginid']);
5 5
 if($user['level'] == "Admin" || $user['level'] == "Manager")
6
-{$akses=true;}
7
-else 
6
+{$akses=true;} else 
8 7
 {$akses=false;}
9 8
 if ($akses=False)
10 9
 {exit("You don't have permission to access this page!");}
@@ -77,10 +76,8 @@  discard block
 block discarded – undo
77 76
 			$slagoaltime=strtotime("+$resolutiontime hours",$documenteddate);
78 77
 			$slawarningtime=strtotime("+$slawarning hours",$documenteddate);
79 78
 			if ($currenttime > $slagoaltime)
80
-			{$slabgcolor="#FF0000";$slatxtcolor="#ffffff";}
81
-			else if ($currenttime >= $slawarningtime)
82
-			{$slabgcolor="#FFFF00";$slatxtcolor="#000000";}
83
-			else {$slabgcolor="#00FF00";$slatxtcolor="#000000";}
79
+			{$slabgcolor="#FF0000";$slatxtcolor="#ffffff";} else if ($currenttime >= $slawarningtime)
80
+			{$slabgcolor="#FFFF00";$slatxtcolor="#000000";} else {$slabgcolor="#00FF00";$slatxtcolor="#000000";}
84 81
 			$customer = $customers->customer_data($ticket['idcustomer']);
85 82
 			$user = $users->userdata($ticket['assignee']);
86 83
 			echo '<tr><td><a href=ticketedit.php?id='.$ticket['id']. '>'.$ticket['ticketnumber'].'</a></td>'.
Please login to merge, or discard this patch.
userlist.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@
 block discarded – undo
62 62
 		<?php 
63 63
 		foreach ($members as $member) {
64 64
 			if ($member['confirmed']=='1')
65
-			{$locked='No';}
66
-			else
65
+			{$locked='No';} else
67 66
 			{$locked='Yes';}
68 67
 			echo '<tr><td><a href=useredit.php?id='.$member['id']. '>'.$member['username'].'</a></td>'.
69 68
 				 '<td>'.$member['level'].'</td>'.
Please login to merge, or discard this patch.
statistic/rpt001print.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,13 +21,11 @@
 block discarded – undo
21 21
 	{	header('Content-type: application/vnd.ms-word');
22 22
 		header('Content-Disposition: attachment; Filename="'.$reportname.'.doc"');
23 23
 		echo $content;
24
-	}
25
-	elseif($_POST['format']=='2')
24
+	} elseif($_POST['format']=='2')
26 25
 	{	header('Content-type: application/ms-excel');
27 26
 		header('Content-Disposition: attachment; filename="'.$reportname.'.xls"');
28 27
 		echo $content;
29
-	}
30
-	elseif($_POST['format']=='3')
28
+	} elseif($_POST['format']=='3')
31 29
 	{	$filename=$reportname.'.pdf';
32 30
 		define('FPDF_FONTPATH','pdftable/font/');
33 31
 		require('pdftable/lib/pdftable.inc.php');
Please login to merge, or discard this patch.
statistic/pdftable/font/courier.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-for($i=0;$i<=255;$i++)
2
+for($i=0;$i<=255;$i++) {
3 3
 	$fpdf_charwidths['courier'][chr($i)]=600;
4
+}
4 5
 $fpdf_charwidths['courierB']=$fpdf_charwidths['courier'];
5 6
 $fpdf_charwidths['courierI']=$fpdf_charwidths['courier'];
6 7
 $fpdf_charwidths['courierBI']=$fpdf_charwidths['courier'];
Please login to merge, or discard this patch.
statistic/pdftable/lib/pdftable.inc.php 1 patch
Braces   +383 added lines, -175 removed lines patch added patch discarded remove patch
@@ -65,9 +65,13 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 function SetHeaderFooter($header='',$footer=''){
68
-	if ($header) $this->headerTable = $header;
69
-	if ($footer) $this->footerTable = $footer;
70
-}
68
+	if ($header) {
69
+		$this->headerTable = $header;
70
+	}
71
+	if ($footer) {
72
+		$this->footerTable = $footer;
73
+	}
74
+	}
71 75
 function Header(){
72 76
 	$this->_makePageSize();
73 77
 	if ($this->headerTable){
@@ -97,7 +101,9 @@  discard block
 block discarded – undo
97 101
  * Tra ve chieu cao cua 1 dong theo font hien hanh
98 102
  */
99 103
 function getLineHeight($fontSize = 0){
100
-	if ($fontSize == 0) $fontSize = $this->FontSizePt;
104
+	if ($fontSize == 0) {
105
+		$fontSize = $this->FontSizePt;
106
+	}
101 107
 	return $fontSize*2/$this->k;
102 108
 }
103 109
 
@@ -114,19 +120,26 @@  discard block
 block discarded – undo
114 120
 	foreach ($c['font'] as &$f){
115 121
 		$this->_setFontText($f);
116 122
 		$hl = $this->getLineHeight();
117
-		if ($maxline<$hl || $x==$this->paddingCell) $maxline=$hl;
118
-		if (!isset($f['space'])) continue;
123
+		if ($maxline<$hl || $x==$this->paddingCell) {
124
+			$maxline=$hl;
125
+		}
126
+		if (!isset($f['space'])) {
127
+			continue;
128
+		}
119 129
 		$space = $f['space'];
120 130
 		foreach ($f['line'] as $i=>&$l){
121
-			if ($x!=$this->paddingCell) $x+=$space;
122
-			if (isset($l['str'])&&is_array($l['str']))
123
-			foreach ($l['str'] as &$t){
131
+			if ($x!=$this->paddingCell) {
132
+				$x+=$space;
133
+			}
134
+			if (isset($l['str'])&&is_array($l['str'])) {
135
+						foreach ($l['str'] as &$t){
124 136
 				if (!is_array($t)) continue;
137
+			}
125 138
 				if ($x==$this->paddingCell||$x+$t[1]<=$maxw){
126 139
 					$c['wlinet'][$countline][0] += $t[1];
127 140
 					$c['wlinet'][$countline][1]++;
128 141
 					$x += $t[1]+(($x>$this->paddingCell)?$space:0);
129
-				}else{//auto break line
142
+				} else{//auto break line
130 143
 					$h+=$maxline*FHR + $this->spacingLine;
131 144
 					$c['hline'][] = $maxline*FHR + $this->spacingLine;
132 145
 					$c['wlines'][$countline] = $x-$this->paddingCell;
@@ -158,8 +171,14 @@  discard block
 block discarded – undo
158 171
 	$maxw = $c['w0']-$this->paddingCell2;
159 172
 	$curh = $c['maxh'];
160 173
 	$x=$y=0; //Top by default
161
-	if ($c['va']=='M') $y = ($maxh-$curh)/2; //Middle
162
-	elseif ($c['va']=='B') $y = $maxh-$curh; //Bottom
174
+	if ($c['va']=='M') {
175
+		$y = ($maxh-$curh)/2;
176
+	}
177
+	//Middle
178
+	elseif ($c['va']=='B') {
179
+		$y = $maxh-$curh;
180
+	}
181
+	//Bottom
163 182
 	$curline = 0;
164 183
 	$morespace = 0;
165 184
 	$cl = $c['hline'][$curline];
@@ -169,15 +188,21 @@  discard block
 block discarded – undo
169 188
 		if (isset($f['color'])){
170 189
 			$color = Color::HEX2RGB($f['color']);
171 190
 			$this->SetTextColor($color[0],$color[1],$color[2]);
172
-		}else unset($color);
191
+		} else {
192
+			unset($color);
193
+		}
173 194
 		$hl = $this->getLineHeight();
174
-		if (!isset($f['space'])) continue;
195
+		if (!isset($f['space'])) {
196
+			continue;
197
+		}
175 198
 		$space = $f['space'];
176 199
 		foreach ($f['line'] as $i=>&$l){
177
-			if (isset($l['str'])&&is_array($l['str']))
178
-			foreach ($l['str'] as &$t){
200
+			if (isset($l['str'])&&is_array($l['str'])) {
201
+						foreach ($l['str'] as &$t){
179 202
 				if ($t[2]!=$curline){
180
-					$y += $cl;$curline++;$cl = $c['hline'][$curline];
203
+					$y += $cl;
204
+			}
205
+			$curline++;$cl = $c['hline'][$curline];
181 206
 					$this->_cellHorzAlignLine($c,$curline,$maxw,$x,$morespace);
182 207
 				}
183 208
 				$this->x = $x+$x0;
@@ -190,31 +215,38 @@  discard block
 block discarded – undo
190 215
 				$this->_cellHorzAlignLine($c,$curline,$maxw,$x,$morespace);
191 216
 			}
192 217
 		}
193
-		if (isset($color))
194
-			$this->SetTextColor(0);
218
+		if (isset($color)) {
219
+					$this->SetTextColor(0);
220
+		}
195 221
 	}
196 222
 }
197 223
 private function _cellHorzAlignLine(&$c,$line,$maxw,&$x,&$morespace){
198 224
 	$morespace = 0;
199 225
 	$x = $this->paddingCell;//Left by default
200
-	if (!isset($c['wlines'][$line])) return ;
226
+	if (!isset($c['wlines'][$line])) {
227
+		return ;
228
+	}
201 229
 	if ($c['a']=='C'){//Center
202 230
 		$x = ($maxw-$c['wlines'][$line])/2;
203
-	}elseif ($c['a']=='R'){
231
+	} elseif ($c['a']=='R'){
204 232
 		$x = $maxw-$c['wlines'][$line];
205
-	}elseif ($c['a']=='J' && $c['wlinet'][$line][1]>1
233
+	} elseif ($c['a']=='J' && $c['wlinet'][$line][1]>1
206 234
 		&& isset($c['autobr'][$line])){//Justify
207 235
 		$morespace = ($maxw-$c['wlines'][$line])/($c['wlinet'][$line][1]-1);
208 236
 	}
209
-	if ($x < $this->paddingCell) $x = $this->paddingCell;
210
-}
237
+	if ($x < $this->paddingCell) {
238
+		$x = $this->paddingCell;
239
+	}
240
+	}
211 241
 
212 242
 private function _calWidth($w){
213 243
 	$p = strpos($w,'%');
214 244
 	if ($p!==false){
215 245
 		return intval(substr($w,0,$p)*$this->width/100);
216
-	}else return intval($w);
217
-}
246
+	} else {
247
+		return intval($w);
248
+	}
249
+	}
218 250
 /**
219 251
  * @return array
220 252
  * @desc Parse a string in html and return array of attribute of table
@@ -229,8 +261,9 @@  discard block
 block discarded – undo
229 261
 	$tdopen = false;
230 262
 	foreach ($t->name as $i=>$element){
231 263
 		if ($fontopen && $t->type[$i]==NODE_TYPE_ENDELEMENT
232
-			&& (in_array($element,array('table','tr','td','font'))))
233
-				$fontopen = false;
264
+			&& (in_array($element,array('table','tr','td','font')))) {
265
+						$fontopen = false;
266
+		}
234 267
 		if ($tdopen && $t->type[$i]==NODE_TYPE_ENDELEMENT
235 268
 			&& (in_array($element,array('table','tr','td')))
236 269
 			&& !isset($cell[$row][$col]['miw'])){
@@ -238,16 +271,26 @@  discard block
 block discarded – undo
238 271
 				$c['miw'] = $c['maw'] = 0;
239 272
 				$tdopen = false;
240 273
 		}
241
-		if ($t->type[$i] != NODE_TYPE_ELEMENT && $t->type[$i] != NODE_TYPE_TEXT) continue;
274
+		if ($t->type[$i] != NODE_TYPE_ELEMENT && $t->type[$i] != NODE_TYPE_TEXT) {
275
+			continue;
276
+		}
242 277
 		switch ($element){
243 278
 			case 'table':
244 279
 				$tdopen = 0;
245 280
 				$a	= &$t->attribute[$i];
246
-				if (isset($a['width']))		$table['w']	= $this->_calWidth($a['width']);
247
-				if (isset($a['height']))	$table['h']	= intval($a['height']);
248
-				if (isset($a['align']))		$table['a']	= $this->getAlign(strtolower($a['align']));
281
+				if (isset($a['width'])) {
282
+					$table['w']	= $this->_calWidth($a['width']);
283
+				}
284
+				if (isset($a['height'])) {
285
+					$table['h']	= intval($a['height']);
286
+				}
287
+				if (isset($a['align'])) {
288
+					$table['a']	= $this->getAlign(strtolower($a['align']));
289
+				}
249 290
 				$table['border'] = (isset($a['border']))?	$a['border']: 0;
250
-				if (isset($a['bgcolor']))	$table['bgcolor'][-1]	= $a['bgcolor'];
291
+				if (isset($a['bgcolor'])) {
292
+					$table['bgcolor'][-1]	= $a['bgcolor'];
293
+				}
251 294
 				$table['nobreak'] = isset($a['nobreak']);
252 295
 				break;
253 296
 			case 'tr':
@@ -256,52 +299,94 @@  discard block
 block discarded – undo
256 299
 				$table['nr']++;
257 300
 				$col = -1;
258 301
 				$a	= &$t->attribute[$i];
259
-				if (isset($a['bgcolor']))	$table['bgcolor'][$row]	= $a['bgcolor'];
260
-				if (isset($a['repeat']))	$table['repeat'][]		= $row;
261
-				else{
262
-					if (isset($a['pbr']))	$table['pbr'][$row]	= 1;
263
-					if (isset($a['knext']))	$table['knext'][$row]	= 1;
302
+				if (isset($a['bgcolor'])) {
303
+					$table['bgcolor'][$row]	= $a['bgcolor'];
304
+				}
305
+				if (isset($a['repeat'])) {
306
+					$table['repeat'][]		= $row;
307
+				} else{
308
+					if (isset($a['pbr'])) {
309
+						$table['pbr'][$row]	= 1;
310
+					}
311
+					if (isset($a['knext'])) {
312
+						$table['knext'][$row]	= 1;
313
+					}
264 314
 				}
265 315
 				break;
266 316
 			case 'td':
267 317
 				$tdopen = 1;
268
-				$col++;while (isset($cell[$row][$col])) $col++;
318
+				$col++;while (isset($cell[$row][$col])) {
319
+					$col++;
320
+				}
269 321
 				//Update number column
270
-				if ($table['nc'] < $col+1)		$table['nc']		= $col+1;
322
+				if ($table['nc'] < $col+1) {
323
+					$table['nc']		= $col+1;
324
+				}
271 325
 				$cell[$row][$col] = array();
272 326
 				$c = &$cell[$row][$col];
273 327
 				$a	= &$t->attribute[$i];
274
-				if (isset($a['width']))		$c['w']		= intval($a['width']);
275
-				if (isset($a['height']))	$c['h']		= intval($a['height']);
328
+				if (isset($a['width'])) {
329
+					$c['w']		= intval($a['width']);
330
+				}
331
+				if (isset($a['height'])) {
332
+					$c['h']		= intval($a['height']);
333
+				}
276 334
 				$c['a'] = isset($a['align'])?$this->getAlign($a['align']):'L';
277 335
 				$c['va']= isset($a['valign'])?$this->getVAlign($a['valign']):'T';
278
-				if (isset($a['border']))	$c['border']	= $a['border'];
279
-					else					$c['border']	= $table['border'];
280
-				if (isset($a['bgcolor']))	$c['bgcolor']	= $a['bgcolor'];
336
+				if (isset($a['border'])) {
337
+					$c['border']	= $a['border'];
338
+				} else {
339
+						$c['border']	= $table['border'];
340
+					}
341
+				if (isset($a['bgcolor'])) {
342
+					$c['bgcolor']	= $a['bgcolor'];
343
+				}
281 344
 				$cs = $rs = 1;
282
-				if (isset($a['colspan']) && $a['colspan']>1)	$cs = $c['colspan']	= intval($a['colspan']);
283
-				if (isset($a['rowspan']) && $a['rowspan']>1)	$rs = $c['rowspan']	= intval($a['rowspan']);
284
-				if (isset($a['size']))		$c['font'][0]['size']   	= $a['size'];
285
-				if (isset($a['family']))	$c['font'][0]['family'] 	= $a['family'];
345
+				if (isset($a['colspan']) && $a['colspan']>1) {
346
+					$cs = $c['colspan']	= intval($a['colspan']);
347
+				}
348
+				if (isset($a['rowspan']) && $a['rowspan']>1) {
349
+					$rs = $c['rowspan']	= intval($a['rowspan']);
350
+				}
351
+				if (isset($a['size'])) {
352
+					$c['font'][0]['size']   	= $a['size'];
353
+				}
354
+				if (isset($a['family'])) {
355
+					$c['font'][0]['family'] 	= $a['family'];
356
+				}
286 357
 				if (isset($a['style'])){
287 358
 					$STYLE     = explode(",", strtoupper($a['style']));
288 359
 					$fontStyle = '';
289
-					foreach($STYLE AS $style)  $fontStyle .= substr(trim($style), 0, 1);
360
+					foreach($STYLE AS $style) {
361
+						$fontStyle .= substr(trim($style), 0, 1);
362
+					}
290 363
 					$c['font'][0]['style'] = $fontStyle;
291 364
 				}
292
-				if (isset($a['color']))		$c['font'][0]['color'] 		= $a['color'];
365
+				if (isset($a['color'])) {
366
+					$c['font'][0]['color'] 		= $a['color'];
367
+				}
293 368
 				//Chiem dung vi tri de danh cho cell span
294
-				for ($k=$row;$k<$row+$rs;$k++) for($l=$col;$l<$col+$cs;$l++){
295
-					if ($k-$row || $l-$col)
296
-						$cell[$k][$l] = 0;
369
+				for ($k=$row;$k<$row+$rs;$k++) {
370
+					for($l=$col;
371
+				}
372
+				$l<$col+$cs;$l++){
373
+					if ($k-$row || $l-$col) {
374
+											$cell[$k][$l] = 0;
375
+					}
376
+				}
377
+				if (isset($a['nowrap'])) {
378
+					$c['nowrap']= 1;
297 379
 				}
298
-				if (isset($a['nowrap']))	$c['nowrap']= 1;
299 380
 				$fontopen = true;
300
-				if (!isset($c['font'])) $c['font'][] = array();
381
+				if (!isset($c['font'])) {
382
+					$c['font'][] = array();
383
+				}
301 384
 				break;
302 385
 			case 'Text':
303 386
 				$c = &$cell[$row][$col];
304
-				if (!$fontopen || !isset($c['font'])) $c['font'][] = array();
387
+				if (!$fontopen || !isset($c['font'])) {
388
+					$c['font'][] = array();
389
+				}
305 390
 				$f = &$c['font'][count($c['font'])-1];
306 391
 				$this->_setTextAndSize($c,$f,$this->_html2text($t->value[$i]));
307 392
 				break;
@@ -310,15 +395,23 @@  discard block
 block discarded – undo
310 395
 				$c = &$cell[$row][$col];
311 396
 				$c['font'][] = array();
312 397
 				$f = &$c['font'][count($c['font'])-1];
313
-				if (isset($a['size']))		$f['size']   	= $a['size'];
314
-				if (isset($a['family']))	$f['family'] 	= $a['family'];
398
+				if (isset($a['size'])) {
399
+					$f['size']   	= $a['size'];
400
+				}
401
+				if (isset($a['family'])) {
402
+					$f['family'] 	= $a['family'];
403
+				}
315 404
 				if (isset($a['style'])){
316 405
 					$STYLE     = explode(",", strtoupper($a['style']));
317 406
 					$fontStyle = '';
318
-					foreach($STYLE AS $style)  $fontStyle .= substr(trim($style), 0, 1);
407
+					foreach($STYLE AS $style) {
408
+						$fontStyle .= substr(trim($style), 0, 1);
409
+					}
319 410
 					$f['style'] = $fontStyle;
320 411
 				}
321
-				if (isset($a['color']))		$f['color'] 		= $a['color'];
412
+				if (isset($a['color'])) {
413
+					$f['color'] 		= $a['color'];
414
+				}
322 415
 				break;
323 416
 			case 'img':
324 417
 				$a	= &$t->attribute[$i];
@@ -340,7 +433,9 @@  discard block
 block discarded – undo
340 433
 }
341 434
 
342 435
 private function _setTextAndSize(&$cell,&$f, $text){
343
-	if ($text=='') return;
436
+	if ($text=='') {
437
+		return;
438
+	}
344 439
 	$this->_setFontText($f);
345 440
 	if (!isset($f['line'][0])){
346 441
 		$f['line'][0]['min'] = $f['line'][0]['max'] = 0;
@@ -351,49 +446,69 @@  discard block
 block discarded – undo
351 446
 		$f['line'][] = array('min'=>0,'max'=>0,'str'=>array());
352 447
 		$l = &$f['line'][count($f['line'])-1];
353 448
 	}
354
-	if (!isset($f['space'])) $f['space'] = $this->GetStringWidth(' ');
449
+	if (!isset($f['space'])) {
450
+		$f['space'] = $this->GetStringWidth(' ');
451
+	}
355 452
 	$ct = count($text);
356 453
 	foreach ($text as $item){
357 454
 		$s = $this->GetStringWidth($item);
358
-		if ($l['min']<$s) $l['min']=$s;
455
+		if ($l['min']<$s) {
456
+			$l['min']=$s;
457
+		}
359 458
 		$l['max'] += $s;
360
-		if ($ct>1) $l['max'] += $f['space'];
459
+		if ($ct>1) {
460
+			$l['max'] += $f['space'];
461
+		}
361 462
 		$l['str'][] =  array($item,$s);
362 463
 	}
363
-	if (isset($cell['nowrap'])) $l['min'] = $l['max'];
364
-	if (!isset($cell['miw']) || $cell['miw']-$this->paddingCell2<$l['min'])
365
-		$cell['miw']=$l['min']+$this->paddingCell2;
366
-	if (!isset($cell['maw']) || $cell['maw']-$this->paddingCell2<$l['max'])
367
-		$cell['maw']=$l['max']+$this->paddingCell2;
368
-}
464
+	if (isset($cell['nowrap'])) {
465
+		$l['min'] = $l['max'];
466
+	}
467
+	if (!isset($cell['miw']) || $cell['miw']-$this->paddingCell2<$l['min']) {
468
+			$cell['miw']=$l['min']+$this->paddingCell2;
469
+	}
470
+	if (!isset($cell['maw']) || $cell['maw']-$this->paddingCell2<$l['max']) {
471
+			$cell['maw']=$l['max']+$this->paddingCell2;
472
+	}
473
+	}
369 474
 
370 475
 private function _setImage(&$c, &$a){
371 476
 	$path = $a['src'];
372 477
 	if (!is_file($path)){
373 478
 		$this->Error('Image is not exists: '.$path);
374
-	}else{
479
+	} else{
375 480
 		list($u,$d) = $this->_getResolution($path);
376 481
 		$c['img'] = $path;
377 482
 		list($c['w'],$c['h'],) = getimagesize($path);
378
-		if (isset($a['width'])) $c['w'] = $a['width'];
379
-		if (isset($a['height'])) $c['h'] = $a['height'];
483
+		if (isset($a['width'])) {
484
+			$c['w'] = $a['width'];
485
+		}
486
+		if (isset($a['height'])) {
487
+			$c['h'] = $a['height'];
488
+		}
380 489
 		$scale = 1;
381
-		if ($u==1) $scale = 25.4/$d;
382
-		elseif ($u==2) $scale = 10/$d;
490
+		if ($u==1) {
491
+			$scale = 25.4/$d;
492
+		} elseif ($u==2) {
493
+			$scale = 10/$d;
494
+		}
383 495
 		$c['w'] = intval($c['w']*$scale);
384 496
 		$c['h'] = intval($c['h']*$scale);
385 497
 	}
386 498
 }
387 499
 private function _getResolution($path){
388 500
 	$pos=strrpos($path,'.');
389
-	if(!$pos)
390
-		$this->Error('Image file has no extension and no type was specified: '.$path);
501
+	if(!$pos) {
502
+			$this->Error('Image file has no extension and no type was specified: '.$path);
503
+	}
391 504
 	$type=substr($path,$pos+1);
392 505
 	$type=strtolower($type);
393
-	if($type=='jpeg')
394
-		$type='jpg';
395
-	if ($type!='jpg')
396
-		$this->Error('Unsupported image type: '.$path);
506
+	if($type=='jpeg') {
507
+			$type='jpg';
508
+	}
509
+	if ($type!='jpg') {
510
+			$this->Error('Unsupported image type: '.$path);
511
+	}
397 512
 	$f = fopen($path,'r');
398 513
 	fseek($f,13,SEEK_SET);
399 514
 	$info = fread($f,3);
@@ -429,19 +544,35 @@  discard block
 block discarded – undo
429 544
 		for ($i=0;$i<$nr;$i++){
430 545
 			if (isset($cs[$i][$j]['miw'])){
431 546
 				$c   = &$cs[$i][$j];
432
-				if (isset($c['nowrap'])) $c['miw'] = $c['maw'];
547
+				if (isset($c['nowrap'])) {
548
+					$c['miw'] = $c['maw'];
549
+				}
433 550
 				if (isset($c['w'])){
434
-					if ($c['miw']<$c['w']) $c['miw'] = $c['w'];
435
-					elseif ($c['miw']>$c['w']) $c['w'] = $c['miw']+$this->paddingCell2;
436
-					if (!isset($wc['w'])) $wc['w'] = 1;
551
+					if ($c['miw']<$c['w']) {
552
+						$c['miw'] = $c['w'];
553
+					} elseif ($c['miw']>$c['w']) {
554
+						$c['w'] = $c['miw']+$this->paddingCell2;
555
+					}
556
+					if (!isset($wc['w'])) {
557
+						$wc['w'] = 1;
558
+					}
559
+				}
560
+				if ($c['maw']<$c['miw']) {
561
+					$c['maw'] = $c['miw'];
437 562
 				}
438
-				if ($c['maw']<$c['miw']) $c['maw'] = $c['miw'];
439 563
 				if (!isset($c['colspan'])){
440
-					if ($wc['miw'] < $c['miw']) $wc['miw']=$c['miw'];
441
-					if ($wc['maw'] < $c['maw']) $wc['maw']=$c['maw'];
442
-					if (isset($wc['w']) && $wc['w'] < $wc['miw'])
443
-						$wc['w']=$wc['miw'];
444
-				}else $listspan[] = array($i,$j);
564
+					if ($wc['miw'] < $c['miw']) {
565
+						$wc['miw']=$c['miw'];
566
+					}
567
+					if ($wc['maw'] < $c['maw']) {
568
+						$wc['maw']=$c['maw'];
569
+					}
570
+					if (isset($wc['w']) && $wc['w'] < $wc['miw']) {
571
+											$wc['w']=$wc['miw'];
572
+					}
573
+				} else {
574
+					$listspan[] = array($i,$j);
575
+				}
445 576
 			}
446 577
 		}
447 578
 	}
@@ -451,7 +582,9 @@  discard block
 block discarded – undo
451 582
 		list($i,$j) = $span;
452 583
 		$c = &$cs[$i][$j];
453 584
 		$lc = $j + $c['colspan'];
454
-		if ($lc > $nc) $lc = $nc;
585
+		if ($lc > $nc) {
586
+			$lc = $nc;
587
+		}
455 588
 
456 589
 		$wis = $wisa = 0;
457 590
 		$was = $wasa = 0;
@@ -467,28 +600,36 @@  discard block
 block discarded – undo
467 600
 		}
468 601
 		if ($c['miw'] > $wis){
469 602
 			if (!$wis){//Cac cot chua co kich thuoc => chia deu
470
-				for($k=$j;$k<$lc;$k++) $wc[$k]['miw'] = $c['miw']/$c['colspan'];
471
-			}elseif (!count($list)){//Khong co cot nao co kich thuoc auto => chia deu phan du cho tat ca
603
+				for($k=$j;$k<$lc;$k++) {
604
+					$wc[$k]['miw'] = $c['miw']/$c['colspan'];
605
+				}
606
+			} elseif (!count($list)){//Khong co cot nao co kich thuoc auto => chia deu phan du cho tat ca
472 607
 				$wi = $c['miw'] - $wis;
473
-				for($k=$j;$k<$lc;$k++)
474
-					$wc[$k]['miw'] += ($wc[$k]['miw']/$wis)*$wi;
475
-			}else{//Co mot so cot co kich thuoc auto => chia deu phan du cho cac cot auto
608
+				for($k=$j;$k<$lc;$k++) {
609
+									$wc[$k]['miw'] += ($wc[$k]['miw']/$wis)*$wi;
610
+				}
611
+			} else{//Co mot so cot co kich thuoc auto => chia deu phan du cho cac cot auto
476 612
 				$wi = $c['miw'] - $wis;
477
-				foreach ($list as $_z2=>$k)
478
-					$wc[$k]['miw'] += ($wc[$k]['miw']/$wisa)*$wi;
613
+				foreach ($list as $_z2=>$k) {
614
+									$wc[$k]['miw'] += ($wc[$k]['miw']/$wisa)*$wi;
615
+				}
479 616
 			}
480 617
 		}
481 618
 		if ($c['maw'] > $was){
482 619
 			if (!$wis){//Cac cot chua co kich thuoc => chia deu
483
-				for($k=$j;$k<$lc;$k++) $wc[$k]['maw'] = $c['maw']/$c['colspan'];
484
-			}elseif (!count($list)){//Khong co cot nao co kich thuoc auto => chia deu phan du cho tat ca
620
+				for($k=$j;$k<$lc;$k++) {
621
+					$wc[$k]['maw'] = $c['maw']/$c['colspan'];
622
+				}
623
+			} elseif (!count($list)){//Khong co cot nao co kich thuoc auto => chia deu phan du cho tat ca
485 624
 				$wi = $c['maw'] - $was;
486
-				for($k=$j;$k<$lc;$k++)
487
-					$wc[$k]['maw'] += ($wc[$k]['maw']/$was)*$wi;
488
-			}else{//Co mot so cot co kich thuoc auto => chia deu phan du cho cac cot auto
625
+				for($k=$j;$k<$lc;$k++) {
626
+									$wc[$k]['maw'] += ($wc[$k]['maw']/$was)*$wi;
627
+				}
628
+			} else{//Co mot so cot co kich thuoc auto => chia deu phan du cho cac cot auto
489 629
 				$wi = $c['maw'] - $was;
490
-				foreach ($list as $_z2=>$k)
491
-					$wc[$k]['maw'] += ($wc[$k]['maw']/$wasa)*$wi;
630
+				foreach ($list as $_z2=>$k) {
631
+									$wc[$k]['maw'] += ($wc[$k]['maw']/$wasa)*$wi;
632
+				}
492 633
 			}
493 634
 		}
494 635
 	}
@@ -504,7 +645,9 @@  discard block
 block discarded – undo
504 645
 	for ($i=0;$i<$nc;$i++){
505 646
 		$a += isset($wc[$i]['w']) ? $wc[$i]['miw'] : $wc[$i]['maw'];
506 647
 	}
507
-	if ($a > $this->width) $table['w'] = $this->width;
648
+	if ($a > $this->width) {
649
+		$table['w'] = $this->width;
650
+	}
508 651
 
509 652
 	if (isset($table['w'])){
510 653
 		$wis = $wisa = 0;
@@ -517,13 +660,15 @@  discard block
 block discarded – undo
517 660
 			if (!count($list)){
518 661
 				//Khong co cot nao co kich thuoc auto => chia deu phan du cho tat ca
519 662
 				$wi = ($table['w'] - $wis)/$nc;
520
-				for($k=0;$k<$nc;$k++)
521
-					$wc[$k]['miw'] += $wi;
522
-			}else{
663
+				for($k=0;$k<$nc;$k++) {
664
+									$wc[$k]['miw'] += $wi;
665
+				}
666
+			} else{
523 667
 				//Co mot so cot co kich thuoc auto => chia deu phan du cho cac cot auto
524 668
 				$wi = ($table['w'] - $wis)/count($list);
525
-				foreach ($list as $k)
526
-					$wc[$k]['miw'] += $wi;
669
+				foreach ($list as $k) {
670
+									$wc[$k]['miw'] += $wi;
671
+				}
527 672
 			}
528 673
 		}
529 674
 		for ($i=0;$i<$nc;$i++){
@@ -531,7 +676,7 @@  discard block
 block discarded – undo
531 676
 			unset($wc[$i]);
532 677
 			$wc[$i] = $a;
533 678
 		}
534
-	}else{
679
+	} else{
535 680
 		$table['w'] = $a;
536 681
 		for ($i=0;$i<$nc;$i++){
537 682
 			$a = isset($wc[$i]['w']) ? $wc[$i]['miw'] : $wc[$i]['maw'];
@@ -557,10 +702,15 @@  discard block
 block discarded – undo
557 702
 				$ch = $this->_cellHeight($c);
558 703
 				$c['ch'] = $ch;
559 704
 
560
-				if (isset($c['h']) && $c['h'] > $ch) $ch = $c['h'];
705
+				if (isset($c['h']) && $c['h'] > $ch) {
706
+					$ch = $c['h'];
707
+				}
561 708
 
562
-				if (isset($c['rowspan'])) $listspan[] = array($i,$j);
563
-				elseif ($hr < $ch) $hr = $ch;
709
+				if (isset($c['rowspan'])) {
710
+					$listspan[] = array($i,$j);
711
+				} elseif ($hr < $ch) {
712
+					$hr = $ch;
713
+				}
564 714
 				$c['mih'] = $ch;
565 715
 			}
566 716
 		}
@@ -570,7 +720,9 @@  discard block
 block discarded – undo
570 720
 		list($i,$j) = $span;
571 721
 		$c = &$cs[$i][$j];
572 722
 		$lr = $i + $c['rowspan'];
573
-		if ($lr > $nr) $lr = $nr;
723
+		if ($lr > $nr) {
724
+			$lr = $nr;
725
+		}
574 726
 		$hs = $hsa = 0;
575 727
 		$list = array();
576 728
 		for($k=$i;$k<$lr;$k++){
@@ -582,26 +734,36 @@  discard block
 block discarded – undo
582 734
 		}
583 735
 		if ($c['mih'] > $hs){
584 736
 			if (!$hs){//Cac dong chua co kich thuoc => chia deu
585
-				for($k=$i;$k<$lr;$k++) $hr[$k] = $c['mih']/$c['rowspan'];
586
-			}elseif (!count($list)){
737
+				for($k=$i;$k<$lr;$k++) {
738
+					$hr[$k] = $c['mih']/$c['rowspan'];
739
+				}
740
+			} elseif (!count($list)){
587 741
 				//Khong co dong nao co kich thuoc auto => chia deu phan du cho tat ca
588 742
 				$hi = $c['mih'] - $hs;
589
-				for($k=$i;$k<$lr;$k++)
590
-					$hr[$k] += ($hr[$k]/$hs)*$hi;
591
-			}else{
743
+				for($k=$i;$k<$lr;$k++) {
744
+									$hr[$k] += ($hr[$k]/$hs)*$hi;
745
+				}
746
+			} else{
592 747
 				//Co mot so dong co kich thuoc auto => chia deu phan du cho cac dong auto
593 748
 				$hi = $c['mih'] - $hsa;
594
-				foreach ($list as $k)
595
-					$hr[$k] += ($hr[$k]/$hsa)*$hi;
749
+				foreach ($list as $k) {
750
+									$hr[$k] += ($hr[$k]/$hsa)*$hi;
751
+				}
596 752
 			}
597 753
 		}
598 754
 	}
599 755
 	$table['repeatH'] = 0;
600 756
 	if (count($table['repeat'])){
601
-		foreach ($table['repeat'] as $i) $table['repeatH'] += $hr[$i];
602
-	}else $table['repeat'] = 0;
757
+		foreach ($table['repeat'] as $i) {
758
+			$table['repeatH'] += $hr[$i];
759
+		}
760
+	} else {
761
+		$table['repeat'] = 0;
762
+	}
603 763
 	$tth = 0;
604
-	foreach ($hr as $v) $tth+=$v;
764
+	foreach ($hr as $v) {
765
+		$tth+=$v;
766
+	}
605 767
 	$table['tth'] = $tth;
606 768
 }
607 769
 
@@ -611,14 +773,19 @@  discard block
 block discarded – undo
611 773
 private function _tableGetWCell(&$table, $i,$j){
612 774
 	$c = &$table['cells'][$i][$j];
613 775
 	if ($c){
614
-		if (isset($c['x0'])) return array($c['x0'], $c['w0']);
776
+		if (isset($c['x0'])) {
777
+			return array($c['x0'], $c['w0']);
778
+		}
615 779
 		$x = 0;
616 780
 		$wc = &$table['wc'];
617
-		for ($k=0;$k<$j;$k++) $x += $wc[$k];
781
+		for ($k=0;$k<$j;$k++) {
782
+			$x += $wc[$k];
783
+		}
618 784
 		$w = $wc[$j];
619 785
 		if (isset($c['colspan'])){
620
-			for ($k=$j+$c['colspan']-1;$k>$j;$k--)
621
-				$w += @$wc[$k];
786
+			for ($k=$j+$c['colspan']-1;$k>$j;$k--) {
787
+							$w += @$wc[$k];
788
+			}
622 789
 		}
623 790
 		$c['x0'] = $x;
624 791
 		$c['w0'] = $w;
@@ -630,12 +797,15 @@  discard block
 block discarded – undo
630 797
 private function _tableGetHCell(&$table, $i,$j){
631 798
 	$c = &$table['cells'][$i][$j];
632 799
 	if ($c){
633
-		if (isset($c['h0'])) return $c['h0'];
800
+		if (isset($c['h0'])) {
801
+			return $c['h0'];
802
+		}
634 803
 		$hr = &$table['hr'];
635 804
 		$h = $hr[$i];
636 805
 		if (isset($c['rowspan'])){
637
-			for ($k=$i+$c['rowspan']-1;$k>$i;$k--)
638
-				$h += $hr[$k];
806
+			for ($k=$i+$c['rowspan']-1;$k>$i;$k--) {
807
+							$h += $hr[$k];
808
+			}
639 809
 		}
640 810
 		$c['h0'] = $h;
641 811
 		return $h;
@@ -647,14 +817,21 @@  discard block
 block discarded – undo
647 817
 	if (strlen($type)==4)
648 818
 	{
649 819
 		$x2 = $x + $w; $y2 = $y + $h;
650
-		if (intval($type{0})) $this->Line($x , $y , $x2, $y );
651
-		if (intval($type{1})) $this->Line($x2, $y , $x2, $y2);
652
-		if (intval($type{2})) $this->Line($x , $y2, $x2, $y2);
653
-		if (intval($type{3})) $this->Line($x , $y , $x , $y2);
654
-	}
655
-	elseif ((int)$type===1)
656
-		$this->Rect($x, $y, $w, $h);
657
-	elseif ((int)$type>1 && (int)$type<11)
820
+		if (intval($type{0})) {
821
+			$this->Line($x , $y , $x2, $y );
822
+		}
823
+		if (intval($type{1})) {
824
+			$this->Line($x2, $y , $x2, $y2);
825
+		}
826
+		if (intval($type{2})) {
827
+			$this->Line($x , $y2, $x2, $y2);
828
+		}
829
+		if (intval($type{3})) {
830
+			$this->Line($x , $y , $x , $y2);
831
+		}
832
+	} elseif ((int)$type===1) {
833
+			$this->Rect($x, $y, $w, $h);
834
+	} elseif ((int)$type>1 && (int)$type<11)
658 835
 	{
659 836
 		$width = $this->LineWidth;
660 837
 		$this->SetLineWidth($type * $this->LineWidth);
@@ -676,7 +853,9 @@  discard block
 block discarded – undo
676 853
 	$maxh = 0;
677 854
 	for ($j=0;$j<$table['nc'];$j++){
678 855
 		$h = $this->_tableGetHCell($table, $i, $j);
679
-		if ($maxh < $h) $maxh = $h;
856
+		if ($maxh < $h) {
857
+			$maxh = $h;
858
+		}
680 859
 	}
681 860
 	return $maxh;
682 861
 }
@@ -697,19 +876,25 @@  discard block
 block discarded – undo
697 876
 	if ($table['multipage']){
698 877
 		$newpage = 0;
699 878
 		if ($table['lasty']+$maxh>$this->bottom){
700
-			if ($this->_checkLimitHeight($table, $maxh)) return;
879
+			if ($this->_checkLimitHeight($table, $maxh)) {
880
+				return;
881
+			}
701 882
 			$newpage = 1;
702
-		}elseif (isset($table['pbr'][$i])){
883
+		} elseif (isset($table['pbr'][$i])){
703 884
 			$newpage = 1;
704 885
 			unset($table['pbr'][$i]);
705
-		}elseif (isset($table['knext'][$i])&&$i<$table['nr']-1){
886
+		} elseif (isset($table['knext'][$i])&&$i<$table['nr']-1){
706 887
 			$mrowh = $maxh;
707 888
 			for($j=$i+1;$j<$table['nr'];$j++){
708 889
 				$mrowh += $this->_getRowHeight($table, $j);
709
-				if (!isset($table['knext'][$j])) break;
890
+				if (!isset($table['knext'][$j])) {
891
+					break;
892
+				}
710 893
 				unset($table['knext'][$j]);
711 894
 			}
712
-			if ($this->_checkLimitHeight($table, $mrowh)) return;
895
+			if ($this->_checkLimitHeight($table, $mrowh)) {
896
+				return;
897
+			}
713 898
 			$newpage = $table['lasty']+$mrowh>$this->bottom;
714 899
 		}
715 900
 		if ($newpage){
@@ -719,7 +904,9 @@  discard block
 block discarded – undo
719 904
 			$table['lasty'] = $this->y;
720 905
 			if ($table['repeat']){
721 906
 				foreach ($table['repeat'] as $r){
722
-					if ($r==$i) continue;
907
+					if ($r==$i) {
908
+						continue;
909
+					}
723 910
 					$this->_tableWriteRow($table,$r,$x0);
724 911
 				}
725 912
 			}
@@ -745,14 +932,15 @@  discard block
 block discarded – undo
745 932
 			//Content
746 933
 			if (isset($c['img'])){
747 934
 				$this->Image($c['img'],$x,$y,$c['w'],$c['h']);
748
-			}else{
935
+			} else{
749 936
 				$this->_drawCellAligned($x,$y,$c);
750 937
 			}
751 938
 			//Border
752 939
 			if (isset($c['border'])){
753 940
 				$table['listborder'][] = array($x,$y,$w,$h,$c['border']);
754
-			}elseif (isset($table['border']) && $table['border'])
755
-				$table['listborder'][] = array($x,$y,$w,$h,$table['border']);
941
+			} elseif (isset($table['border']) && $table['border']) {
942
+							$table['listborder'][] = array($x,$y,$w,$h,$table['border']);
943
+			}
756 944
 		}
757 945
 	}
758 946
 	$table['lasty'] += $table['hr'][$i];
@@ -770,13 +958,19 @@  discard block
 block discarded – undo
770 958
 private function _setFontText(&$f){
771 959
 	if (isset($f['size']) && ($f['size'] >0)){
772 960
 		$fontSize   = $f['size'];
773
-	}else $fontSize   = $this->defaultFontSize;
961
+	} else {
962
+		$fontSize   = $this->defaultFontSize;
963
+	}
774 964
 	if (isset($f['family'])){
775 965
 		$fontFamily = $f['family'];
776
-	}else $fontFamily = $this->defaultFontFamily;
777
-	if (isset($f['style']))
778
-		$fontStyle  = $f['style'];
779
-	else $fontStyle = $this->defaultFontStyle;
966
+	} else {
967
+		$fontFamily = $this->defaultFontFamily;
968
+	}
969
+	if (isset($f['style'])) {
970
+			$fontStyle  = $f['style'];
971
+	} else {
972
+		$fontStyle = $this->defaultFontStyle;
973
+	}
780 974
 	$this->SetFont($fontFamily, $fontStyle, $fontSize);
781 975
 	return $fontSize;
782 976
 }
@@ -784,14 +978,18 @@  discard block
 block discarded – undo
784 978
 	if ($this->CurOrientation == 'P' && $table['w']>$this->width+5){
785 979
 		$this->AddPage('L');
786 980
 	}
787
-	if ($this->x==null)$this->x = $this->lMargin;
788
-	if ($this->y==null)$this->y = $this->tMargin;
981
+	if ($this->x==null) {
982
+		$this->x = $this->lMargin;
983
+	}
984
+	if ($this->y==null) {
985
+		$this->y = $this->tMargin;
986
+	}
789 987
 	$x0 = $this->x;
790 988
 	$y0 = $this->y;
791 989
 	if (isset($table['a'])){
792 990
 		if ($table['a']=='C'){
793 991
 			$x0 += (($this->right-$x0) - $table['w'])/2;
794
-		}elseif ($table['a']=='R'){
992
+		} elseif ($table['a']=='R'){
795 993
 			$x0 = $this->right - $table['w'];
796 994
 		}
797 995
 	}
@@ -799,11 +997,14 @@  discard block
 block discarded – undo
799 997
 		&& $table['tth']+$y0>$this->bottom && $table['multipage']){
800 998
 		$this->AddPage($this->CurOrientation);
801 999
 		$table['lasty'] = $this->y;
802
-	}else
803
-		$table['lasty'] = $y0;
1000
+	} else {
1001
+			$table['lasty'] = $y0;
1002
+	}
804 1003
 	
805 1004
 	$table['listborder'] = array();
806
-	for ($i=0;$i<$table['nr'];$i++) $this->_tableWriteRow($table, $i, $x0);
1005
+	for ($i=0;$i<$table['nr'];$i++) {
1006
+		$this->_tableWriteRow($table, $i, $x0);
1007
+	}
807 1008
 	$this->_tableDrawBorder($table);
808 1009
 	$this->x = $x0;
809 1010
 }
@@ -817,7 +1018,9 @@  discard block
 block discarded – undo
817 1018
 	$x = $this->x;
818 1019
 	foreach ($HTML as $i=>$table){	
819 1020
 		$this->x = $x;
820
-		if (strlen($table)<6) continue;
1021
+		if (strlen($table)<6) {
1022
+			continue;
1023
+		}
821 1024
 		$table = '<table' . $table;
822 1025
 		$table = $this->_tableParser($table);
823 1026
 		$table['multipage'] = $multipage;
@@ -832,16 +1035,21 @@  discard block
 block discarded – undo
832 1035
 function _putinfo(){
833 1036
 	$this->_out('/Producer '.$this->_textstring('PDFTable '.
834 1037
 		PDFTABLE_VERSION.' based on FPDF '.FPDF_VERSION));
835
-	if(!empty($this->title))
836
-		$this->_out('/Title '.$this->_textstring($this->title));
837
-	if(!empty($this->subject))
838
-		$this->_out('/Subject '.$this->_textstring($this->subject));
839
-	if(!empty($this->author))
840
-		$this->_out('/Author '.$this->_textstring($this->author));
841
-	if(!empty($this->keywords))
842
-		$this->_out('/Keywords '.$this->_textstring($this->keywords));
843
-	if(!empty($this->creator))
844
-		$this->_out('/Creator '.$this->_textstring($this->creator));
1038
+	if(!empty($this->title)) {
1039
+			$this->_out('/Title '.$this->_textstring($this->title));
1040
+	}
1041
+	if(!empty($this->subject)) {
1042
+			$this->_out('/Subject '.$this->_textstring($this->subject));
1043
+	}
1044
+	if(!empty($this->author)) {
1045
+			$this->_out('/Author '.$this->_textstring($this->author));
1046
+	}
1047
+	if(!empty($this->keywords)) {
1048
+			$this->_out('/Keywords '.$this->_textstring($this->keywords));
1049
+	}
1050
+	if(!empty($this->creator)) {
1051
+			$this->_out('/Creator '.$this->_textstring($this->creator));
1052
+	}
845 1053
 	$this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis')));
846 1054
 }
847 1055
 private function getAlign($v){
Please login to merge, or discard this patch.
statistic/pdftable/lib/htmlparser.inc.php 1 patch
Braces   +78 added lines, -53 removed lines patch added patch discarded remove patch
@@ -113,8 +113,7 @@  discard block
 block discarded – undo
113 113
             $this->iNodeType = NODE_TYPE_ENDELEMENT;
114 114
             $this->iNodeName = substr ($name, 1);
115 115
             $this->iNodeValue = "";
116
-        } 
117
-        else {
116
+        } else {
118 117
             if (!$this->isValidTagIdentifier ($name)) {
119 118
                 $comment = false;
120 119
                 if ($name == "!--") {
@@ -132,14 +131,13 @@  discard block
 block discarded – undo
132 131
                     $this->iNodeValue = "<" . $name;
133 132
                 }
134 133
                 return true;
135
-            }
136
-            else {
134
+            } else {
137 135
                 $this->iNodeType = NODE_TYPE_ELEMENT;
138 136
                 $this->iNodeValue = "";
139 137
                 $nameLength = strlen($name);
140 138
                 if ($nameLength > 0 && substr($name, $nameLength - 1, 1) == "/") {
141 139
                 	$this->iNodeName = substr($name, 0, $nameLength - 1);
142
-                }else {
140
+                } else {
143 141
                     $this->iNodeName = $name;
144 142
                 }
145 143
                 $this->iNodeName = strtolower($this->iNodeName);
@@ -151,14 +149,14 @@  discard block
 block discarded – undo
151 149
 				$attrName = strtolower($attrName);
152 150
 				if (array_search($attrName, $HTML_ATTRIBUTE_STAND_ALONE)!==false){
153 151
 					$this->iNodeAttributes[$attrName] = 1;
154
-				}else{
152
+				} else{
155 153
 	                $this->skipBlanksInTag();
156 154
 	                if ($this->iCurrentChar == "=") {
157 155
 	                    $this->skipEqualsInTag();
158 156
 	                    $this->skipBlanksInTag();
159 157
 	                    $value = $this->readValueInTag();
160 158
 	                    $this->iNodeAttributes[$attrName] = $value;
161
-	                }else {
159
+	                } else {
162 160
 	                    $this->iNodeAttributes[$attrName] = "";
163 161
 	                }
164 162
 				}
@@ -195,13 +193,11 @@  discard block
 block discarded – undo
195 193
             $this->skipInTag (array ( "\"" ));
196 194
             $value = $this->skipToInTag (array ( "\"" ));
197 195
             $this->skipInTag (array ( "\"" ));
198
-        }
199
-        else if ($ch == "'") {
196
+        } else if ($ch == "'") {
200 197
             $this->skipInTag (array ( "'" ));
201 198
             $value = $this->skipToInTag (array ( "'" ));
202 199
             $this->skipInTag (array ( "'" ));
203
-        }                
204
-        else {
200
+        } else {
205 201
             $value = $this->skipToBlanksInTag();
206 202
         }
207 203
         return $value;
@@ -211,8 +207,7 @@  discard block
 block discarded – undo
211 207
         $this->iHtmlTextIndex = $index;
212 208
         if ($index >= $this->iHtmlTextLength) {
213 209
             $this->iCurrentChar = -1;
214
-        }
215
-        else {
210
+        } else {
216 211
             $this->iCurrentChar = $this->iHtmlText{$index};
217 212
         }
218 213
     }
@@ -221,8 +216,7 @@  discard block
 block discarded – undo
221 216
         if ($this->iHtmlTextIndex < $this->iHtmlTextLength) {
222 217
             $this->setTextIndex ($this->iHtmlTextIndex + 1);
223 218
             return true;
224
-        }
225
-        else {
219
+        } else {
226 220
             return false;
227 221
         }
228 222
     }
@@ -246,8 +240,9 @@  discard block
 block discarded – undo
246 240
             if ($ch == ">") {
247 241
                 return $sb;
248 242
             } else {
249
-                if (array_search($ch,$chars) === false)
250
-                	return $sb;
243
+                if (array_search($ch,$chars) === false) {
244
+                                	return $sb;
245
+                }
251 246
                 $sb .= $ch;
252 247
                 $this->moveNext();
253 248
             }
@@ -258,8 +253,9 @@  discard block
 block discarded – undo
258 253
     function skipToInTag ($chars) {
259 254
         $sb = "";
260 255
         while (($ch = $this->iCurrentChar) !== -1) {
261
-        	if ($ch == '>' || array_search($ch,$chars) !== false)
262
-               	return $sb;
256
+        	if ($ch == '>' || array_search($ch,$chars) !== false) {
257
+        	               	return $sb;
258
+        	}
263 259
             $sb .= $ch;
264 260
             $this->moveNext();
265 261
         }
@@ -343,24 +339,29 @@  discard block
 block discarded – undo
343 339
 	function TreeHTML($parser, $file=true){
344 340
 	    $i = 0;
345 341
 	    if ($file){
346
-		    while ($parser->parse())
347
-		    	if (strtolower($parser->iNodeName)=='body') break;
342
+		    while ($parser->parse()) {
343
+		    		    	if (strtolower($parser->iNodeName)=='body') break;
344
+		    }
348 345
 	    }
349 346
 	    while ($parser->parse()){
350
-	    	if ($parser->iNodeType == NODE_TYPE_ENDELEMENT && strtolower($parser->iNodeName)=='body' && $file) break;
347
+	    	if ($parser->iNodeType == NODE_TYPE_ENDELEMENT && strtolower($parser->iNodeName)=='body' && $file) {
348
+	    		break;
349
+	    	}
351 350
 
352 351
 	    	$this->type[$i] = $parser->iNodeType;
353 352
 	    	$this->name[$i] = $parser->iNodeName;
354
-	    	if ($parser->iNodeType == NODE_TYPE_TEXT)
355
-	    		$this->value[$i] = $parser->iNodeValue;
353
+	    	if ($parser->iNodeType == NODE_TYPE_TEXT) {
354
+	    		    		$this->value[$i] = $parser->iNodeValue;
355
+	    	}
356 356
 	    	if ($parser->iNodeType == NODE_TYPE_ELEMENT){
357 357
 	    		$this->attribute[$i] = $parser->iNodeAttributes;
358 358
 	    		if (isset($parser->iNodeAttributes['name'])){
359 359
 	    			$this->field[$i] = trim($parser->iNodeAttributes['name'],"\"' ");
360 360
 	    		}
361 361
 	    		if (   ($file && $parser->iNodeName == 'input' && isset($this->attribute[$i]['type']) && $this->attribute[$i]['type']=='text' && !isset($this->attribute[$i]['onkeydown']))
362
-	    			|| ($file && $parser->iNodeName == 'textarea'))
363
-	    			$this->attribute[$i]['onkeyup'] = 'initTyper(this)';
362
+	    			|| ($file && $parser->iNodeName == 'textarea')) {
363
+	    			    			$this->attribute[$i]['onkeyup'] = 'initTyper(this)';
364
+	    		}
364 365
 	    	}
365 366
 	    	$i++;
366 367
 	    }
@@ -371,7 +372,9 @@  discard block
 block discarded – undo
371 372
 	 */
372 373
 	function set($name,$attr, $value){
373 374
 		$index = array_search($name, $this->field);
374
-		if (!$index) return;
375
+		if (!$index) {
376
+			return;
377
+		}
375 378
 		$this->attribute[$index][$attr] = $value;
376 379
 	}
377 380
 	
@@ -380,8 +383,9 @@  discard block
 block discarded – undo
380 383
 	 */
381 384
 	function get($name,$attr){
382 385
 		$index = array_search($name, $this->field);
383
-		if ($index && isset($this->attribute[$index][$attr]))
384
-			return $this->attribute[$index][$attr];
386
+		if ($index && isset($this->attribute[$index][$attr])) {
387
+					return $this->attribute[$index][$attr];
388
+		}
385 389
 		return '';
386 390
 	}
387 391
 	
@@ -401,12 +405,15 @@  discard block
 block discarded – undo
401 405
 		$index = array_search($name, $this->field);
402 406
 		if ($index){
403 407
 			$t = '';
404
-			if (isset($this->attribute[$index]['tabindex']))
405
-				$t .= ' tabindex='.$this->attribute[$index]['tabindex'];
406
-			if (isset($this->attribute[$index]['size']))
407
-				$t .= ' size='.$this->attribute[$index]['size'];
408
-			if (isset($this->attribute[$index]['maxlength']))
409
-				$t .= ' maxlength='.$this->attribute[$index]['maxlength'];
408
+			if (isset($this->attribute[$index]['tabindex'])) {
409
+							$t .= ' tabindex='.$this->attribute[$index]['tabindex'];
410
+			}
411
+			if (isset($this->attribute[$index]['size'])) {
412
+							$t .= ' size='.$this->attribute[$index]['size'];
413
+			}
414
+			if (isset($this->attribute[$index]['maxlength'])) {
415
+							$t .= ' maxlength='.$this->attribute[$index]['maxlength'];
416
+			}
410 417
 			return $t;
411 418
 		}
412 419
 		return '';
@@ -417,7 +424,9 @@  discard block
 block discarded – undo
417 424
 	 */
418 425
 	function replace($name,$text){
419 426
 		$index = array_search($name, $this->field);
420
-		if (!$index) return;
427
+		if (!$index) {
428
+			return;
429
+		}
421 430
 		$this->removeIndex($index);
422 431
 		$this->type[$index] = NODE_TYPE_TEXT;
423 432
 		$this->value[$index] = $text;
@@ -428,17 +437,27 @@  discard block
 block discarded – undo
428 437
 	 */
429 438
 	function remove($name){
430 439
 		$index = array_search($name, $this->field);
431
-		if (!$index) return;
432
-		if (!isset($this->name[$index])) return;//echo "Remove: $name <br>";
440
+		if (!$index) {
441
+			return;
442
+		}
443
+		if (!isset($this->name[$index])) {
444
+			return;
445
+		}
446
+		//echo "Remove: $name <br>";
433 447
 		$rname = $this->name[$index];
434 448
 		$len = count($this->name);
435 449
 		for ($end=$index+1;$end<$len;$end++){
436
-			if (isset($this->name[$end]) && $this->name[$end] == $rname) break;
450
+			if (isset($this->name[$end]) && $this->name[$end] == $rname) {
451
+				break;
452
+			}
437 453
 		}
438 454
 		if (isset($this->type[$end]) && $this->type[$end]==NODE_TYPE_ENDELEMENT){
439
-			for ($i=$index;$i<=$end;$i++) $this->removeIndex($i);
440
-		}else
441
-			$this->removeIndex($index);
455
+			for ($i=$index;$i<=$end;$i++) {
456
+				$this->removeIndex($i);
457
+			}
458
+		} else {
459
+					$this->removeIndex($index);
460
+		}
442 461
 	}
443 462
 	
444 463
 	/**
@@ -472,23 +491,27 @@  discard block
 block discarded – undo
472 491
 				case NODE_TYPE_ELEMENT:
473 492
 					if ($name[$i] != 'textarea'){
474 493
 						$str .= '<'.$name[$i];
475
-						if (isset($attr[$i])) foreach($attr[$i] as $key => $value){
494
+						if (isset($attr[$i])) {
495
+							foreach($attr[$i] as $key => $value){
476 496
 							if (array_search($value,$HTML_ATTRIBUTE_STAND_ALONE)!==false)
477 497
 								$str .= " $key";
478
-							else
479
-								$str .= " $key=\"$value\"";
498
+						} else {
499
+															$str .= " $key=\"$value\"";
500
+							}
480 501
 						}
481 502
 						$str .= '>';
482
-					}else{//is tag ATEXTAREA
503
+					} else{//is tag ATEXTAREA
483 504
 						$content = '';
484 505
 						$str .= '<'.$name[$i];
485
-						if (isset($attr[$i])) foreach($attr[$i] as $key => $value){
506
+						if (isset($attr[$i])) {
507
+							foreach($attr[$i] as $key => $value){
486 508
 							if ($key == 'value')
487 509
 								$content = $value;
488
-							elseif (array_search($value,$HTML_ATTRIBUTE_STAND_ALONE)!==false)
489
-								$str .= " $key";
490
-							else
491
-								$str .= " $key=\"$value\"";
510
+						} elseif (array_search($value,$HTML_ATTRIBUTE_STAND_ALONE)!==false) {
511
+															$str .= " $key";
512
+							} else {
513
+															$str .= " $key=\"$value\"";
514
+							}
492 515
 						}
493 516
 						$str .= '>'.$content;
494 517
 					}
@@ -522,7 +545,7 @@  discard block
 block discarded – undo
522 545
 					$this->attribute[$i]['disabled'] = 1;
523 546
 					break;
524 547
 				}
525
-			}elseif ($name == 'textarea'){
548
+			} elseif ($name == 'textarea'){
526 549
 			 	$this->attribute[$i]['readonly'] = 'true';
527 550
 			 	$this->attribute[$i]['style'] = 'border: 1 dotted #999999';
528 551
 			}
@@ -534,7 +557,9 @@  discard block
 block discarded – undo
534 557
 	 */
535 558
 	function setReadonly($name){
536 559
 		$index = array_search($name, $this->field);
537
-		if (!$index) return;
560
+		if (!$index) {
561
+			return;
562
+		}
538 563
 		$this->attribute[$index]['readonly'] = true;
539 564
 		$this->attribute[$index]['style'] = 'border: 1 dotted #999999';
540 565
 	}
Please login to merge, or discard this patch.
statistic/pdftable/lib/color.inc.php 1 patch
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,11 +10,21 @@  discard block
 block discarded – undo
10 10
 	 * @desc Use only for function HSL2RGB()
11 11
 	 */
12 12
 	function _HSL_2_RGB( $v1, $v2, $vH ){
13
-		if ( $vH < 0 ) $vH += 1;
14
-		if ( $vH > 1 ) $vH -= 1;
15
-		if ( ( 6 * $vH ) < 1 ) return ( $v1 + ( $v2 - $v1 ) * 6 * $vH );
16
-		if ( ( 2 * $vH ) < 1 ) return ( $v2 );
17
-		if ( ( 3 * $vH ) < 2 ) return ( $v1 + ( $v2 - $v1 ) * ( ( 2 / 3 ) - $vH ) * 6 );
13
+		if ( $vH < 0 ) {
14
+			$vH += 1;
15
+		}
16
+		if ( $vH > 1 ) {
17
+			$vH -= 1;
18
+		}
19
+		if ( ( 6 * $vH ) < 1 ) {
20
+			return ( $v1 + ( $v2 - $v1 ) * 6 * $vH );
21
+		}
22
+		if ( ( 2 * $vH ) < 1 ) {
23
+			return ( $v2 );
24
+		}
25
+		if ( ( 3 * $vH ) < 2 ) {
26
+			return ( $v1 + ( $v2 - $v1 ) * ( ( 2 / 3 ) - $vH ) * 6 );
27
+		}
18 28
 		return ( $v1 );
19 29
 	}
20 30
 	/**
@@ -28,7 +38,7 @@  discard block
 block discarded – undo
28 38
 			$R = $L * 255;
29 39
 			$G = $L * 255;
30 40
 			$B = $L * 255;
31
-		}else{
41
+		} else{
32 42
 			$var_2 = ($L < 0.5)? ($L * ( 1 + $S )) : (( $L + $S ) - ( $S * $L ));
33 43
 			$var_1 = 2 * $L - $var_2;
34 44
 			$R = 255 * Color::_HSL_2_RGB( $var_1, $var_2, $H + ( 1 / 3 ) ) ;
@@ -51,7 +61,9 @@  discard block
 block discarded – undo
51 61
 	 * @desc Convert color #ffffff to RGB
52 62
 	 */
53 63
 	function HEX2RGB($c){
54
-		if (strlen($c)!=7) return 0;
64
+		if (strlen($c)!=7) {
65
+			return 0;
66
+		}
55 67
 		$r[] = hexdec($c{1}.$c{2});
56 68
 		$r[] = hexdec($c{3}.$c{4});
57 69
 		$r[] = hexdec($c{5}.$c{6});
Please login to merge, or discard this patch.