Passed
Push — v3.0 ( 899e51...9a38f9 )
by Samir
11:16
created
web_interface/astpp/application/controllers/updateBalance.php 1 patch
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -133,22 +133,25 @@
 block discarded – undo
133 133
                             if (($parent_id == $reseller_dids['reseller_id'] && $did_value['accountid'] > 0) || $reseller_dids['parent_id'] == 0) {
134 134
                                 //Apply charges to resellers customers.
135 135
                                 $lastdate = $this->calculate_charges($reseller_acc_data, $itemArr, $reseller_dids["monthlycost"], $fromdate, $todate, "1");
136
-                                if ($lastdate)
137
-                                    $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"]));
136
+                                if ($lastdate) {
137
+                                                                    $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"]));
138
+                                }
138 139
                             } else {
139 140
                                 //Apply charges to Resellers.
140 141
                                 $lastdate = $this->calculate_charges($reseller_acc_data, $itemArr, $reseller_dids["monthlycost"], $fromdate, $todate, "1");
141
-                                if ($lastdate)
142
-                                    $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"]));
142
+                                if ($lastdate) {
143
+                                                                    $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"]));
144
+                                }
143 145
                             }
144 146
                             $parent_id = $reseller_dids['parent_id'];
145 147
                         }
146 148
                     }
147 149
 //   		else{
148 150
                     $lastdate = $this->calculate_charges($AccountDATA, $itemArr, $did_value["monthlycost"], $fromdate, $todate, "1");
149
-                    if ($lastdate)
150
-                      $this->db->update("dids", array("charge_upto" => $lastdate), array("id" => $did_value["id"], "accountid" => $AccountDATA["id"]));
151
-//            	}
151
+                    if ($lastdate) {
152
+                                          $this->db->update("dids", array("charge_upto" => $lastdate), array("id" => $did_value["id"], "accountid" => $AccountDATA["id"]));
153
+                    }
154
+                    //            	}
152 155
                 }
153 156
             }
154 157
         }
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/csvreader.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * CSVReader Class
4 6
 *
@@ -94,8 +96,9 @@  discard block
 block discarded – undo
94 96
 			$field_key_value =$config_variable[$field_name_arr[$j]];
95 97
 		$value= strip_slashes(trim($value));
96 98
 				$value = preg_replace('#<script.*</script>#is', '', $value);
97
-				if(isset($field_key_value) && !empty($field_key_value))
98
-		  $content[$field_key_value] =  strip_tags(filter_var($value, FILTER_SANITIZE_STRING));                  
99
+				if(isset($field_key_value) && !empty($field_key_value)) {
100
+						  $content[$field_key_value] =  strip_tags(filter_var($value, FILTER_SANITIZE_STRING));
101
+				}
99 102
 		$j++;
100 103
 		}  
101 104
 	  }
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/astpp/form.php 1 patch
Braces   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if ( ! defined('BASEPATH'))
24
+if ( ! defined('BASEPATH')) {
25 25
     exit('No direct script access allowed');
26
+}
26 27
 
27 28
 /**
28 29
  * Dynamically build forms for display
@@ -137,10 +138,11 @@  discard block
 block discarded – undo
137 138
             foreach ($form_fileds as $fieldkey => $fieldvalue) {
138 139
                 $form_contents .= '<li class="col-md-12">';
139 140
                 if ($fieldvalue[1] == 'HIDDEN') {
140
-                    if (isset($this->CI->input->post))
141
-                        $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
142
-                    else
143
-                        $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : '');
141
+                    if (isset($this->CI->input->post)) {
142
+                                            $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
143
+                    } else {
144
+                                            $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : '');
145
+                    }
144 146
                     $form_contents .= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']);
145 147
                 } else {
146 148
 		      $validation_arr = array();
@@ -148,8 +150,7 @@  discard block
 block discarded – undo
148 150
 		        if ( ! empty($fieldvalue[3])) {
149 151
 		          $validation_arr = explode("|", $fieldvalue[3]);
150 152
 		        }
151
-		      }
152
-		      elseif ($fieldvalue[2] == 'SELECT') {
153
+		      } elseif ($fieldvalue[2] == 'SELECT') {
153 154
 
154 155
 		        if (is_array($fieldvalue[4])) {
155 156
 		          $validation_arr = explode("|", $fieldvalue[4]['rules']);
@@ -199,16 +200,16 @@  discard block
 block discarded – undo
199 200
 								
200 201
 								if(isset($fieldvalue[1]['name'])){
201 202
 									$fieldvalue_pass=$fieldvalue[1]['name'];
202
-								}else{
203
+								} else{
203 204
 									$fieldvalue_pass=$fieldvalue[1];
204 205
 								}
205 206
 								
206 207
 								$this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']);
207
-							}else{
208
+							} else{
208 209
 								
209 210
 								if(isset($fieldvalue[1]['name'])){
210 211
 									$fieldvalue_pass=$fieldvalue[1]['name'];
211
-								}else{
212
+								} else{
212 213
 									$fieldvalue_pass=$fieldvalue[1];
213 214
 								}
214 215
 								
@@ -244,10 +245,11 @@  discard block
 block discarded – undo
244 245
 					/* For multi select code */
245 246
 					$str = $fieldvalue[7] . "," . $fieldvalue[8];
246 247
 
247
-					if (isset($this->CI->input->post))
248
-						$fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]);
249
-					else
250
-						$fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1];
248
+					if (isset($this->CI->input->post)) {
249
+											$fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]);
250
+					} else {
251
+											$fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1];
252
+					}
251 253
 
252 254
 					$drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12]));
253 255
 					if ($fieldset_key === 'System Configuration Information') {
@@ -264,9 +266,9 @@  discard block
 block discarded – undo
264 266
 				} else if ($fieldvalue[1] == 'INPUT') {
265 267
 
266 268
 
267
-					if (isset($this->CI->input->post))
268
-						$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
269
-					else{
269
+					if (isset($this->CI->input->post)) {
270
+											$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
271
+					} else{
270 272
 						$fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :'');
271 273
 					}    
272 274
 					$form_contents.= form_input($fieldvalue[2], 'readonly');
@@ -282,11 +284,11 @@  discard block
 block discarded – undo
282 284
                  * Image upload from invoice configuration code.
283 285
                  */
284 286
 				else if ($fieldvalue[1] == 'IMAGE') {
285
-					if (isset($this->CI->input->post))
286
-						$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
287
-                       
288
-					else
289
-						$fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value'];
287
+					if (isset($this->CI->input->post)) {
288
+											$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
289
+					} else {
290
+											$fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value'];
291
+					}
290 292
 						$fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : "";
291 293
 					$form_contents.= form_image($fieldvalue[2], 'readonly',$fieldvalue[2]['style']);
292 294
 						 $form_contents.=@$fieldvalue[6];
@@ -294,13 +296,12 @@  discard block
 block discarded – undo
294 296
 					$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>';
295 297
 					$form_contents.= '<span class="popup_error error  no-padding" id="'.$fieldvalue[2]['name'].'_error">
296 298
                     </span></div>';
297
-				}
298
-				else if ($fieldvalue[1] == 'DEL_BUTTON') {
299
-					if (isset($this->CI->input->post))
300
-						$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
301
-                       
302
-					else
303
-						$fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value'];
299
+				} else if ($fieldvalue[1] == 'DEL_BUTTON') {
300
+					if (isset($this->CI->input->post)) {
301
+											$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
302
+					} else {
303
+											$fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value'];
304
+					}
304 305
 						$fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : "";
305 306
 					$form_contents.= form_img_delete($fieldvalue[2], 'readonly',$fieldvalue[2]['style']);
306 307
 						 $form_contents.=@$fieldvalue[6];
@@ -311,10 +312,11 @@  discard block
 block discarded – undo
311 312
 				}
312 313
 				/**********************************************************************************/
313 314
 				else if ($fieldvalue[1] == 'PASSWORD') {
314
-					if (isset($this->CI->input->post))
315
-						$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
316
-					else
317
-						$fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value'];
315
+					if (isset($this->CI->input->post)) {
316
+											$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
317
+					} else {
318
+											$fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value'];
319
+					}
318 320
 					$form_contents.= form_password($fieldvalue[2]);
319 321
 					$this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]);
320 322
 					$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>';
@@ -323,12 +325,12 @@  discard block
 block discarded – undo
323 325
 				} else if ($fieldvalue[2] == 'CHECKBOX') {
324 326
 					$OptionArray = array();
325 327
 
326
-					if(isset($fieldvalue[7]) && $fieldvalue[7] != '')
327
-					$OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6]));
328
+					if(isset($fieldvalue[7]) && $fieldvalue[7] != '') {
329
+										$OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6]));
330
+					}
328 331
 					if (isset($this->CI->input->post)){
329 332
 						$fieldvalue[3]['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[3]['value'] : $this->CI->input->post($fieldvalue[1]);
330
-					}    
331
-					else
333
+					} else
332 334
 					{
333 335
 						$fieldvalue[3]['value'] = ($values) ? (isset($values[$fieldvalue[1]]) && $values[$fieldvalue[1]] ? 1: 0) : @$fieldvalue[3]['value'];
334 336
 					}
@@ -340,18 +342,18 @@  discard block
 block discarded – undo
340 342
 					if(isset($fieldvalue[3]['table_name']) && $fieldvalue[3]['table_name'] != ""){
341 343
 							
342 344
 						 $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked , $OptionArray);
343
-					}else{
345
+					} else{
344 346
 						 $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked ,$OptionArray);
345 347
 					}
346 348
 				} else if ($fieldvalue[1] == 'TEXTAREA') {
347 349
 
348
-					if (isset($this->CI->input->post))
349
-						$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
350
-					else
351
-						$fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value'];
350
+					if (isset($this->CI->input->post)) {
351
+											$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']);
352
+					} else {
353
+											$fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value'];
354
+					}
352 355
 					$form_contents.= form_textarea($fieldvalue[2]);
353
-				}
354
-				else if ($fieldvalue[2] == 'RADIO') {
356
+				} else if ($fieldvalue[2] == 'RADIO') {
355 357
 
356 358
 					$form_contents.= form_radio($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']);
357 359
 				}
@@ -581,8 +583,9 @@  discard block
 block discarded – undo
581 583
 		$json_data["json_paging"]['total'] = $config['total_rows'];
582 584
 		$perpage = $config['per_page'];
583 585
 		$start = ($page_no - 1) * $perpage;
584
-		if ($start < 0)
585
-			$start = 0;
586
+		if ($start < 0) {
587
+					$start = 0;
588
+		}
586 589
 		$json_data["paging"]['start'] = $start;
587 590
 		$json_data["paging"]['page_no'] = $perpage;
588 591
 		return $json_data;
@@ -611,7 +614,7 @@  discard block
 block discarded – undo
611 614
 						   if($field_arr[2]=="status"){
612 615
 							$row['id'] = $row_id;
613 616
 							$jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row));
614
-			   }else{
617
+			   } else{
615 618
 							$jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]]));
616 619
 			   }
617 620
 
@@ -636,13 +639,13 @@  discard block
 block discarded – undo
636 639
 				$fieldstr = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]);
637 640
 				if($acctype != ''){
638 641
 					$jsn_tmp[$field_key] = $fieldstr."<br/>".$acctype;
639
-				}else{
642
+				} else{
640 643
 					$jsn_tmp[$field_key] = $fieldstr;
641 644
 				}
642 645
 			    
643 646
 
644 647
 /*********************************/
645
-			  }else {
648
+			  } else {
646 649
 							$jsn_tmp[$field_key] = $row[$field_arr[2]];
647 650
 				  }                  				
648 651
 			} else {
@@ -676,15 +679,13 @@  discard block
 block discarded – undo
676 679
 */			   
677 680
 							$jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row_id);
678 681
 							/****************************************************************************/
679
-						}
680
-						elseif($field_arr[0] == gettext("Profile Action"))
682
+						} elseif($field_arr[0] == gettext("Profile Action"))
681 683
 						{
682 684
 						   if(isset($field_arr[5]) && isset($field_arr[5]->START) && isset($field_arr[5]->STOP) && isset($field_arr[5]->RELOAD) && isset($field_arr[5]->RESCAN)){
683 685
 							}
684 686
 						   $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]);
685 687
                         
686
-						}
687
-						else {
688
+						} else {
688 689
 							$className = (isset($field_arr['9']) && $field_arr['9'] != '')?$field_arr['9']:"chkRefNos";
689 690
 							$jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace '.$className.'" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>';                        }
690 691
 					}
@@ -713,7 +714,7 @@  discard block
 block discarded – undo
713 714
 						 if($field_arr[2]=="status"){
714 715
 							$row['id'] = $row_id;
715 716
 							$jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row));
716
-						 }else{
717
+						 } else{
717 718
 							$jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]]));
718 719
 						 }
719 720
 /**
@@ -731,14 +732,13 @@  discard block
 block discarded – undo
731 732
 				}
732 733
 				$jsn_tmp[$field_key] = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]);
733 734
 /*******************************/
734
-			}else {
735
+			} else {
735 736
 						$jsn_tmp[$field_key] = isset($row[$field_arr[2]]) ? $row[$field_arr[2]] : "";
736 737
 					}
737 738
 				} else {
738 739
 					if ($field_arr[0] == "Action") {
739 740
 						$jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]);
740
-					}
741
-			  else {
741
+					} else {
742 742
 							$jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>';
743 743
 						}
744 744
 				}
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/astpp/common.php 1 patch
Braces   +32 added lines, -29 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if ( ! defined('BASEPATH'))
25
+if ( ! defined('BASEPATH')) {
26 26
     exit('No direct script access allowed');
27
+}
27 28
 
28 29
 /**
29 30
  * Dynamically build forms for display
@@ -113,8 +114,9 @@  discard block
 block discarded – undo
113 114
             $flag = false;
114 115
             $uname = $this->random_string($length);
115 116
             $uname = strtolower($uname);
116
-            if (isset($default))
117
-                $uname = $default.$uname;
117
+            if (isset($default)) {
118
+                            $uname = $default.$uname;
119
+            }
118 120
             if ( ! in_array($uname, $number)) {
119 121
                 $where = array($field => $uname);
120 122
                 $acc_result = $this->CI->db_model->getSelect('Count(id) as count', $tablename, $where);
@@ -243,8 +245,7 @@  discard block
 block discarded – undo
243 245
       $accountinfo = $this->CI->session->userdata('accountinfo');
244 246
       if ($did_info['accountid'] == 0 && $did_info['parent_id'] == 0) {
245 247
 	$status = 'Not in use';
246
-      }
247
-      elseif ($accountinfo['type'] != 1) {
248
+      } elseif ($accountinfo['type'] != 1) {
248 249
 	if ($did_info['accountid'] == 0 && $did_info['parent_id'] > 0) {
249 250
 	  $status = 'Purchase by Reseller';
250 251
 	}
@@ -274,8 +275,7 @@  discard block
 block discarded – undo
274 275
         $did_info = (array)$this->CI->db->get('dids')->first_row();
275 276
         if ($did_info['accountid'] > 0 && $did_info['parent_id'] == $accountinfo['id']) {
276 277
 	    $flag_status = "<a href='../did_list_release/".$did_info['id']."' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(C)<span></a>";
277
-	}
278
-        else if ($accountinfo['type'] != 1 && $did_info['parent_id'] != $accountinfo['id']) {
278
+	} else if ($accountinfo['type'] != 1 && $did_info['parent_id'] != $accountinfo['id']) {
279 279
 	    $flag_status = "<a href='../did_list_release/".$did_info['id']."' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>";
280 280
         } else {
281 281
 	    $reseller_id = $accountinfo['type'] != 1 ? 0 : $accountinfo['id'];
@@ -870,9 +870,9 @@  discard block
 block discarded – undo
870 870
 			$rel = (isset($button_params->layout) && $button_params->layout != '')?"facebox_".$button_params->layout:"facebox";
871 871
 			return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="'.$rel.'" title="Edit" ="small"><i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
872 872
             
873
-		}else if(strpos($link,'customer_edit') !== false){
873
+		} else if(strpos($link,'customer_edit') !== false){
874 874
 		return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
875
-		}else {
875
+		} else {
876 876
 			return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
877 877
 		}
878 878
 	}
@@ -913,14 +913,18 @@  discard block
 block discarded – undo
913 913
 		$data=  explode("/",$url);
914 914
 		$link = base_url() . $url . "" . $linkid;
915 915
 		foreach($data as $key=>$value){
916
-			if($value == 'price_delete')
917
-				$flag = '1';
918
-			if($value == 'trunk_remove')
919
-				$flag='2';
920
-			if($value == 'customer_delete' ||$value =='provider_delete')
921
-				$flag='3';
922
-			if($value == 'reseller_delete')
923
-				$flag='4';
916
+			if($value == 'price_delete') {
917
+							$flag = '1';
918
+			}
919
+			if($value == 'trunk_remove') {
920
+							$flag='2';
921
+			}
922
+			if($value == 'customer_delete' ||$value =='provider_delete') {
923
+							$flag='3';
924
+			}
925
+			if($value == 'reseller_delete') {
926
+							$flag='4';
927
+			}
924 928
 			}    
925 929
 			if($flag=='1'){
926 930
 				$where=array('pricelist_id'=>$linkid,'deleted !=' =>'1');
@@ -930,8 +934,7 @@  discard block
 block discarded – undo
930 934
 					if($rategroup_cnt > 0 || $customer_cnt > 0 ){
931 935
                         
932 936
 						return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$rategroup_cnt.','.$customer_cnt.','.$linkid.',1);"><i class="fa fa-trash fa-fw"></i></a>';
933
-					}
934
-					else{
937
+					} else{
935 938
 						return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>';
936 939
 					}
937 940
 			}
@@ -940,8 +943,7 @@  discard block
 block discarded – undo
940 943
 				$trunk_cnt=$this->get_field_count('id','outbound_routes',$where);
941 944
 				if($trunk_cnt > 0){
942 945
 					return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$trunk_cnt.',null,'.$linkid.',2);"><i class="fa fa-trash fa-fw"></i></a>';
943
-				}
944
-				else{
946
+				} else{
945 947
 					return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>';
946 948
 				}
947 949
 			}
@@ -2045,7 +2047,7 @@  discard block
 block discarded – undo
2045 2047
 
2046 2048
 		$ACCOUNT_DESCRIPTION .= '<td style="width:20%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;text-align:right;">'.$this->currency_decimal($this->CI->common_model->calculate_currency($charge_res['debit'])).'</td>';
2047 2049
 		$ACCOUNT_DESCRIPTION .= '</tr>';
2048
-		 }else{
2050
+		 } else{
2049 2051
 			$cdrs_data = $this->CI->db_model->getSelect("sum(billseconds) as billseconds,count(*) as count", "cdrs", array("accountid" => $charge_res['accountid'],"calltype" => $charge_res['item_type']));
2050 2052
 			$cdrs_result = $cdrs_data->result_array();
2051 2053
 		if($cdrs_result[0]['count'] > 0 ){
@@ -2185,7 +2187,7 @@  discard block
 block discarded – undo
2185 2187
 		$download_path = $invoicedata['invoice_prefix'].$invoicedata['invoiceid'].".pdf";
2186 2188
        
2187 2189
 		$this->CI->html2pdf->Output($download_path,"D");        
2188
-	   }else{
2190
+	   } else{
2189 2191
 		$current_dir = getcwd()."/invoices/";
2190 2192
 		$dir_name = $accountdata["id"];
2191 2193
 		if(!is_dir($current_dir.$dir_name)){
@@ -2208,16 +2210,17 @@  discard block
 block discarded – undo
2208 2210
 		$select = "concat($cnt_str) as $select_params[2] ";
2209 2211
 		$drp_array = $this->CI->db_model->getSelect($select, $table, $where);
2210 2212
 		$drp_array = $drp_array->result();
2211
-		if (isset($drp_array[0]))
2212
-			return $drp_array[0]->$select_params[2];
2213
-	else
2214
-	   return 'Admin';
2213
+		if (isset($drp_array[0])) {
2214
+					return $drp_array[0]->$select_params[2];
2215
+		} else {
2216
+		   return 'Admin';
2217
+	}
2215 2218
 	}
2216 2219
     
2217 2220
 	function get_subreseller_info($parent_id){
2218 2221
 		if(!empty($parent_id)){
2219 2222
 	  $str=$parent_id.",";
2220
-		}else{
2223
+		} else{
2221 2224
 		  $str=null;
2222 2225
 		}
2223 2226
 		$query = "select id from accounts where reseller_id = '$parent_id' AND deleted =0 AND type=1";
@@ -2235,7 +2238,7 @@  discard block
 block discarded – undo
2235 2238
 	function get_parent_info($child_id,$parent_id){
2236 2239
 		if(!empty($child_id)){
2237 2240
 	  $str=$child_id.",";
2238
-		}else{
2241
+		} else{
2239 2242
 		  $str=null;
2240 2243
 		}
2241 2244
 		if($child_id > 0){
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/astpp/email_lib.php 1 patch
Braces   +20 added lines, -15 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if (!defined('BASEPATH')) {
25 25
 	exit('No direct script access allowed');
26
+}
26 27
 
27 28
 /**
28 29
  * Dynamically build forms for display
@@ -121,9 +122,9 @@  discard block
 block discarded – undo
121 122
 	}
122 123
 
123 124
 	function build_template($template_type,$detail,$detail_type='') {
124
-	if(!is_array($template_type))
125
-		$this->get_template($template_type);
126
-	else{
125
+	if(!is_array($template_type)) {
126
+			$this->get_template($template_type);
127
+	} else{
127 128
 		$this->message=$template_type['message'];
128 129
 		$this->subject=$template_type['subject'];
129 130
 		$template_type='';
@@ -226,7 +227,9 @@  discard block
 block discarded – undo
226 227
 	}
227 228
 	function get_smtp_details()
228 229
 	{
229
-	if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='')exit;
230
+	if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='') {
231
+		exit;
232
+	}
230 233
 		$config['protocol'] = "smtp";
231 234
 		$config['smtp_host'] = $this->smtp_host;
232 235
 		$config['smtp_port'] = $this->smtp_port;
@@ -243,14 +246,15 @@  discard block
 block discarded – undo
243 246
 	if(!$this->email){
244 247
 		if(!$resend){
245 248
 			$this->build_template($template_type,$details,$detail_type);
246
-		}else{
249
+		} else{
247 250
 			$this->set_email_paramenters($details);
248 251
 		}
249 252
 
250
-		if(!$brodcast)
251
-				$history_id=$this->mail_history($attachment);
252
-		else	
253
-			$history_id=$details['history_id'];
253
+		if(!$brodcast) {
254
+						$history_id=$this->mail_history($attachment);
255
+		} else {
256
+					$history_id=$details['history_id'];
257
+		}
254 258
 		if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){
255 259
 			if(!$this->smtp){
256 260
 				$this->get_smtp_details();
@@ -287,14 +291,15 @@  discard block
 block discarded – undo
287 291
 		
288 292
 		if(!$resend){
289 293
 			$this->build_template($template_type,$details,$detail_type);
290
-		}else{
294
+		} else{
291 295
 			$this->set_email_paramenters($details);
292 296
 		}
293 297
 
294
-		if(!$brodcast)
295
-				$history_id=$this->mail_history($attachment);
296
-		else	
297
-			$history_id=$details['history_id'];
298
+		if(!$brodcast) {
299
+						$history_id=$this->mail_history($attachment);
300
+		} else {
301
+					$history_id=$details['history_id'];
302
+		}
298 303
 		if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){
299 304
 			if(!$this->smtp){
300 305
 				$this->get_smtp_details();
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/html2pdf/_class/myPdf.class.php 1 patch
Braces   +58 added lines, -23 removed lines patch added patch discarded remove patch
@@ -549,8 +549,12 @@  discard block
 block discarded – undo
549 549
     public function setRotation($angle, $xC = null, $yC = null)
550 550
     {
551 551
         // if no center, rotate around the current posiition
552
-        if ($xC === null) $xC = $this->x;
553
-        if ($yC === null) $yC = $this->y;
552
+        if ($xC === null) {
553
+        	$xC = $this->x;
554
+        }
555
+        if ($yC === null) {
556
+        	$yC = $this->y;
557
+        }
554 558
 
555 559
         // prepare the coordinate
556 560
         $yC = ($this->h - $yC) * $this->k;
@@ -592,8 +596,9 @@  discard block
 block discarded – undo
592 596
      */
593 597
     public function SetY($y, $resetx = true, $rtloff = false)
594 598
     {
595
-        if ($resetx)
596
-            $this->x = $this->lMargin;
599
+        if ($resetx) {
600
+                    $this->x = $this->lMargin;
601
+        }
597 602
 
598 603
         $this->y = $y;
599 604
     }
@@ -726,9 +731,13 @@  discard block
 block discarded – undo
726 731
         $y4 = $y + $h;
727 732
 
728 733
         // get the Closing operator from the PDF Style
729
-        if ($style == 'F') $op = 'f';
730
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
731
-        else $op = 'S';
734
+        if ($style == 'F') {
735
+        	$op = 'f';
736
+        } elseif ($style == 'FD' || $style == 'DF') {
737
+        	$op = 'B';
738
+        } else {
739
+        	$op = 'S';
740
+        }
732 741
 
733 742
         // drawing
734 743
         $this->_Point($x1, $y1, true);
@@ -772,9 +781,13 @@  discard block
 block discarded – undo
772 781
     public function svgEllipse($x0, $y0, $rx, $ry, $style)
773 782
     {
774 783
         // get the Closing operator from the PDF Style
775
-        if ($style == 'F') $op = 'f';
776
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
777
-        else $op = 'S';
784
+        if ($style == 'F') {
785
+        	$op = 'f';
786
+        } elseif ($style == 'FD' || $style == 'DF') {
787
+        	$op = 'B';
788
+        } else {
789
+        	$op = 'S';
790
+        }
778 791
 
779 792
         // drawing
780 793
         $this->_Arc($x0, $y0, $rx, $ry, 0, 2 * M_PI, true, true, true);
@@ -791,9 +804,13 @@  discard block
 block discarded – undo
791 804
     public function svgPolygone($actions, $style)
792 805
     {
793 806
         // get the Closing operator from the PDF Style
794
-        if ($style == 'F') $op = 'f';
795
-        elseif ($style == 'FD' || $style == 'DF') $op = 'B';
796
-        else $op = 'S';
807
+        if ($style == 'F') {
808
+        	$op = 'f';
809
+        } elseif ($style == 'FD' || $style == 'DF') {
810
+        	$op = 'B';
811
+        } else {
812
+        	$op = 'S';
813
+        }
797 814
 
798 815
         // To save the First action and the last point
799 816
         $first = array('', 0, 0);
@@ -1004,7 +1021,9 @@  discard block
 block discarded – undo
1004 1021
         $trans = false)
1005 1022
     {
1006 1023
         // if we want the no trigo direction : add 2PI to the begin angle, to invert the direction
1007
-        if ( ! $direction) $angleBegin += M_PI * 2.;
1024
+        if ( ! $direction) {
1025
+        	$angleBegin += M_PI * 2.;
1026
+        }
1008 1027
 
1009 1028
         // cut in segment to convert in berize curv
1010 1029
         $dt = ($angleEnd - $angleBegin) / self::ARC_NB_SEGMENT;
@@ -1110,7 +1129,9 @@  discard block
 block discarded – undo
1110 1129
         $v['s1']['y'] = -$v['s1']['xr'] * sin($angle) + $v['s1']['yr'] * cos($angle);
1111 1130
         $v['s1']['a1'] = atan2($v['y1'] - $v['s1']['y'], $v['x1'] - $v['s1']['x']);
1112 1131
         $v['s1']['a2'] = atan2($v['y2'] - $v['s1']['y'], $v['x2'] - $v['s1']['x']);
1113
-        if ($v['s1']['a1'] > $v['s1']['a2']) $v['s1']['a1'] -= 2 * M_PI;
1132
+        if ($v['s1']['a1'] > $v['s1']['a2']) {
1133
+        	$v['s1']['a1'] -= 2 * M_PI;
1134
+        }
1114 1135
 
1115 1136
         $v['s2'] = array();
1116 1137
         $v['s2']['t'] = -$v['s1']['t'];
@@ -1122,7 +1143,9 @@  discard block
 block discarded – undo
1122 1143
         $v['s2']['y'] = -$v['s2']['xr'] * sin($angle) + $v['s2']['yr'] * cos($angle);
1123 1144
         $v['s2']['a1'] = atan2($v['y1'] - $v['s2']['y'], $v['x1'] - $v['s2']['x']);
1124 1145
         $v['s2']['a2'] = atan2($v['y2'] - $v['s2']['y'], $v['x2'] - $v['s2']['x']);
1125
-        if ($v['s2']['a1'] > $v['s2']['a2']) $v['s2']['a1'] -= 2 * M_PI;
1146
+        if ($v['s2']['a1'] > $v['s2']['a2']) {
1147
+        	$v['s2']['a1'] -= 2 * M_PI;
1148
+        }
1126 1149
 
1127 1150
         if ( ! $l) {
1128 1151
             if ($s) {
@@ -1170,8 +1193,11 @@  discard block
 block discarded – undo
1170 1193
     {
1171 1194
         // load the last Transfomation Matrix
1172 1195
         $nb = count($this->_transf);
1173
-        if ($nb)    $m = $this->_transf[$nb - 1];
1174
-        else        $m = array(1, 0, 0, 1, 0, 0);
1196
+        if ($nb) {
1197
+        	$m = $this->_transf[$nb - 1];
1198
+        } else {
1199
+        	$m = array(1, 0, 0, 1, 0, 0);
1200
+        }
1175 1201
 
1176 1202
         // apply the Transformation Matrix
1177 1203
         list($x, $y) = array(($x * $m[0] + $y * $m[2] + $m[4]), ($x * $m[1] + $y * $m[3] + $m[5]));
@@ -1195,11 +1221,16 @@  discard block
 block discarded – undo
1195 1221
     {
1196 1222
         // get the last Transformation Matrix
1197 1223
         $nb = count($this->_transf);
1198
-        if ($nb)    $m = $this->_transf[$nb - 1];
1199
-        else        $m = array(1, 0, 0, 1, 0, 0);
1224
+        if ($nb) {
1225
+        	$m = $this->_transf[$nb - 1];
1226
+        } else {
1227
+        	$m = array(1, 0, 0, 1, 0, 0);
1228
+        }
1200 1229
 
1201 1230
         // if no transform, get the Identity Matrix
1202
-        if ( ! $n) $n = array(1, 0, 0, 1, 0, 0);
1231
+        if ( ! $n) {
1232
+        	$n = array(1, 0, 0, 1, 0, 0);
1233
+        }
1203 1234
 
1204 1235
         // create the new Transformation Matrix
1205 1236
         $this->_transf[] = array(
@@ -1249,7 +1280,9 @@  discard block
 block discarded – undo
1249 1280
         $this->write1DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N');
1250 1281
 
1251 1282
         // it Label => add the FontSize to the height
1252
-        if ($labelFontsize) $h += ($labelFontsize);
1283
+        if ($labelFontsize) {
1284
+        	$h += ($labelFontsize);
1285
+        }
1253 1286
 
1254 1287
         // return the size of the barcode
1255 1288
         return array($w, $h);
@@ -1307,7 +1340,9 @@  discard block
 block discarded – undo
1307 1340
 
1308 1341
             // Offset of the current level
1309 1342
             $level = $this->outlines[$i]['l'];
1310
-            if ($level > 0) $this->Cell($level * 8);
1343
+            if ($level > 0) {
1344
+            	$this->Cell($level * 8);
1345
+            }
1311 1346
 
1312 1347
             // Caption (cut to fit on the width page)
1313 1348
             $str = $this->outlines[$i]['t'];
Please login to merge, or discard this patch.
astpp/application/libraries/html2pdf/_class/parsingHtml.class.php 1 patch
Braces   +65 added lines, -34 removed lines patch added patch discarded remove patch
@@ -115,12 +115,13 @@  discard block
 block discarded – undo
115 115
                         // if it is a closure tag
116 116
                         if ($res['close']) {
117 117
                             // HTML validation
118
-                            if (count($parents) < 1)
119
-                                throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos']));
120
-                            else if ($parents[count($parents) - 1] != $res['name'])
121
-                                throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos']));
122
-                            else
123
-                                unset($parents[count($parents) - 1]);
118
+                            if (count($parents) < 1) {
119
+                                                            throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos']));
120
+                            } else if ($parents[count($parents) - 1] != $res['name']) {
121
+                                                            throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos']));
122
+                            } else {
123
+                                                            unset($parents[count($parents) - 1]);
124
+                            }
124 125
                         } else {
125 126
                             // if it is a autoclosed tag
126 127
                             if ($res['autoclose']) {
@@ -171,7 +172,9 @@  discard block
 block discarded – undo
171 172
                         $txt = str_replace(' ', '&nbsp;', $txt);
172 173
 
173 174
                         // add a break line
174
-                        if ($k > 0) $actions[] = $tagPreBr;
175
+                        if ($k > 0) {
176
+                        	$actions[] = $tagPreBr;
177
+                        }
175 178
 
176 179
                         // save the action
177 180
                         $actions[] = array(
@@ -204,21 +207,26 @@  discard block
 block discarded – undo
204 207
             // if it is a Text
205 208
             if ($actions[$k]['name'] == 'write') {
206 209
                 // if the tag before the text is a tag to clean => ltrim on the text
207
-                if ($k > 0 && in_array($actions[$k - 1]['name'], $tagsToClean))
208
-                    $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']);
210
+                if ($k > 0 && in_array($actions[$k - 1]['name'], $tagsToClean)) {
211
+                                    $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']);
212
+                }
209 213
 
210 214
                 // if the tag after the text is a tag to clean => rtrim on the text
211
-                if ($k < $nb - 1 && in_array($actions[$k + 1]['name'], $tagsToClean))
212
-                    $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']);
215
+                if ($k < $nb - 1 && in_array($actions[$k + 1]['name'], $tagsToClean)) {
216
+                                    $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']);
217
+                }
213 218
 
214 219
                 // if the text is empty => remove the action
215
-                if ( ! strlen($actions[$k]['param']['txt']))
216
-                    unset($actions[$k]);
220
+                if ( ! strlen($actions[$k]['param']['txt'])) {
221
+                                    unset($actions[$k]);
222
+                }
217 223
             }
218 224
         }
219 225
 
220 226
         // if we are not on the level 0 => HTML validator ERROR
221
-        if (count($parents)) throw new HTML2PDF_exception(5, $parents);
227
+        if (count($parents)) {
228
+        	throw new HTML2PDF_exception(5, $parents);
229
+        }
222 230
 
223 231
         // save the actions to do
224 232
         $this->code = array_values($actions);
@@ -265,7 +273,9 @@  discard block
 block discarded – undo
265 273
             // if it is a tag
266 274
             if ($parse[1][0]) {
267 275
                 // save the previous text if it exists
268
-                if ($str !== '')    $tmp[] = array('txt', $str);
276
+                if ($str !== '') {
277
+                	$tmp[] = array('txt', $str);
278
+                }
269 279
 
270 280
                 // save the tag, with the offset
271 281
                 $tmp[] = array('code', trim($parse[1][0]), $offset);
@@ -282,7 +292,9 @@  discard block
 block discarded – undo
282 292
             unset($parse);
283 293
         }
284 294
         // if a text is present in the end, we save it
285
-        if ($str != '') $tmp[] = array('txt', $str);
295
+        if ($str != '') {
296
+        	$tmp[] = array('txt', $str);
297
+        }
286 298
         unset($str);
287 299
     }
288 300
 
@@ -296,7 +308,9 @@  discard block
 block discarded – undo
296 308
     {
297 309
         // name of the tag, opening, closure, autoclosure
298 310
         $tag = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)';
299
-        if ( ! preg_match('/'.$tag.'/isU', $code, $match)) return null;
311
+        if ( ! preg_match('/'.$tag.'/isU', $code, $match)) {
312
+        	return null;
313
+        }
300 314
         $close     = ($match[1] == '/' ? true : false);
301 315
         $autoclose = preg_match('/\/>$/isU', $code);
302 316
         $name      = strtolower($match[2]);
@@ -315,20 +329,23 @@  discard block
 block discarded – undo
315 329
         // read the parameters : nom=valeur
316 330
         $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)';
317 331
         preg_match_all('/'.$prop.'/is', $code, $match);
318
-        for ($k = 0; $k < count($match[0]); $k++)
319
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
332
+        for ($k = 0; $k < count($match[0]); $k++) {
333
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
334
+        }
320 335
 
321 336
         // read the parameters : nom="valeur"
322 337
         $prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]';
323 338
         preg_match_all('/'.$prop.'/is', $code, $match);
324
-        for ($k = 0; $k < count($match[0]); $k++)
325
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
339
+        for ($k = 0; $k < count($match[0]); $k++) {
340
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
341
+        }
326 342
 
327 343
         // read the parameters : nom='valeur'
328 344
         $prop = "([a-zA-Z0-9_]+)=[']([^']*)[']";
329 345
         preg_match_all('/'.$prop.'/is', $code, $match);
330
-        for ($k = 0; $k < count($match[0]); $k++)
331
-            $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
346
+        for ($k = 0; $k < count($match[0]); $k++) {
347
+                    $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
348
+        }
332 349
 
333 350
         // compliance of each parameter
334 351
         $color  = "#000000";
@@ -374,19 +391,25 @@  discard block
 block discarded – undo
374 391
 
375 392
                 case 'border':
376 393
                     unset($param[$key]);
377
-                    if (preg_match('/^[0-9]+$/isU', $val)) $val = $val.'px';
394
+                    if (preg_match('/^[0-9]+$/isU', $val)) {
395
+                    	$val = $val.'px';
396
+                    }
378 397
                     $border = $val;
379 398
                     break;
380 399
 
381 400
                 case 'cellpadding':
382 401
                 case 'cellspacing':
383
-                    if (preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px';
402
+                    if (preg_match('/^([0-9]+)$/isU', $val)) {
403
+                    	$param[$key] = $val.'px';
404
+                    }
384 405
                     break;
385 406
 
386 407
                 case 'colspan':
387 408
                 case 'rowspan':
388 409
                     $val = preg_replace('/[^0-9]/isU', '', $val);
389
-                    if ( ! $val) $val = 1;
410
+                    if ( ! $val) {
411
+                    	$val = 1;
412
+                    }
390 413
                     $param[$key] = $val;
391 414
                     break;
392 415
             }
@@ -394,8 +417,11 @@  discard block
 block discarded – undo
394 417
 
395 418
         // compliance of the border
396 419
         if ($border !== null) {
397
-            if ($border)    $border = 'border: solid '.$border.' '.$color;
398
-            else            $border = 'border: none';
420
+            if ($border) {
421
+            	$border = 'border: solid '.$border.' '.$color;
422
+            } else {
423
+            	$border = 'border: none';
424
+            }
399 425
 
400 426
             $param['style'] .= $border.'; ';
401 427
             $param['border'] = $border;
@@ -458,7 +484,9 @@  discard block
 block discarded – undo
458 484
     public function getLevel($k)
459 485
     {
460 486
         // if the code does not exist => return empty
461
-        if ( ! isset($this->code[$k])) return array();
487
+        if ( ! isset($this->code[$k])) {
488
+        	return array();
489
+        }
462 490
 
463 491
         // the tag to detect
464 492
         $detect = $this->code[$k]['name'];
@@ -503,16 +531,19 @@  discard block
 block discarded – undo
503 531
 
504 532
                 // if we can takin into account the current tag => save it
505 533
                 if ( ! $not) {
506
-                    if (isset($row['style']['text-align'])) unset($row['style']['text-align']);
534
+                    if (isset($row['style']['text-align'])) {
535
+                    	unset($row['style']['text-align']);
536
+                    }
507 537
                     $code[] = $row;
508 538
                 }
509 539
             }
510 540
 
511 541
             // it continues as long as there has code to analise
512
-            if (isset($this->code[$k + 1]))
513
-                $k++;
514
-            else
515
-                $end = true;
542
+            if (isset($this->code[$k + 1])) {
543
+                            $k++;
544
+            } else {
545
+                            $end = true;
546
+            }
516 547
         }
517 548
 
518 549
         // return the extract
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/html2pdf/_class/locale.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@
 block discarded – undo
65 65
 		$handle = fopen($file, 'r');
66 66
 		while (!feof($handle)) {
67 67
 			$line = fgetcsv($handle);
68
-			if (count($line)!=2) continue;
68
+			if (count($line)!=2) {
69
+				continue;
70
+			}
69 71
 			self::$_list[trim($line[0])] = trim($line[1]);
70 72
 		}
71 73
 		fclose($handle);
Please login to merge, or discard this patch.
astpp/application/libraries/html2pdf/_class/parsingCss.class.php 1 patch
Braces   +319 added lines, -128 removed lines patch added patch discarded remove patch
@@ -183,7 +183,9 @@  discard block
 block discarded – undo
183 183
 
184 184
         // prepare the Collapse attribute
185 185
         $collapse = isset($this->value['border']['collapse']) ? $this->value['border']['collapse'] : false;
186
-        if ( ! in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) $collapse = false;
186
+        if ( ! in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) {
187
+        	$collapse = false;
188
+        }
187 189
 
188 190
         // set the global css values
189 191
         $this->value['position']   = null;
@@ -319,20 +321,23 @@  discard block
 block discarded – undo
319 321
         $style = $b.$i;
320 322
 
321 323
         if ($this->_defaultFont) {
322
-            if ($family == 'arial')
323
-                $family = 'helvetica';
324
-            elseif ($family == 'symbol' || $family == 'zapfdingbats')
325
-                $style = '';
324
+            if ($family == 'arial') {
325
+                            $family = 'helvetica';
326
+            } elseif ($family == 'symbol' || $family == 'zapfdingbats') {
327
+                            $style = '';
328
+            }
326 329
 
327 330
             $fontkey = $family.$style;
328
-            if ( ! $this->_pdf->isLoadedFont($fontkey))
329
-                $family = $this->_defaultFont;
331
+            if ( ! $this->_pdf->isLoadedFont($fontkey)) {
332
+                            $family = $this->_defaultFont;
333
+            }
330 334
         }
331 335
 
332
-        if ($family == 'arial')
333
-            $family = 'helvetica';
334
-        elseif ($family == 'symbol' || $family == 'zapfdingbats')
335
-            $style = '';
336
+        if ($family == 'arial') {
337
+                    $family = 'helvetica';
338
+        } elseif ($family == 'symbol' || $family == 'zapfdingbats') {
339
+                    $style = '';
340
+        }
336 341
 
337 342
         // complete style
338 343
         $style .= $u.$d.$o;
@@ -380,7 +385,9 @@  discard block
 block discarded – undo
380 385
      */
381 386
     public function restorePosition()
382 387
     {
383
-        if ($this->value['y'] == $this->_pdf->getY()) $this->_pdf->setY($this->value['yc'], false);
388
+        if ($this->value['y'] == $this->_pdf->getY()) {
389
+        	$this->_pdf->setY($this->value['yc'], false);
390
+        }
384 391
     }
385 392
 
386 393
      /**
@@ -401,18 +408,26 @@  discard block
 block discarded – undo
401 408
         if ($this->value['position'] == 'relative' || $this->value['position'] == 'absolute') {
402 409
             if ($this->value['right'] !== null) {
403 410
                 $x = $this->getLastWidth(true) - $this->value['right'] - $this->value['width'];
404
-                if ($this->value['margin']['r']) $x -= $this->value['margin']['r'];
411
+                if ($this->value['margin']['r']) {
412
+                	$x -= $this->value['margin']['r'];
413
+                }
405 414
             } else {
406 415
                 $x = $this->value['left'];
407
-                if ($this->value['margin']['l']) $x += $this->value['margin']['l'];
416
+                if ($this->value['margin']['l']) {
417
+                	$x += $this->value['margin']['l'];
418
+                }
408 419
             }
409 420
 
410 421
             if ($this->value['bottom'] !== null) {
411 422
                 $y = $this->getLastHeight(true) - $this->value['bottom'] - $this->value['height'];
412
-                if ($this->value['margin']['b']) $y -= $this->value['margin']['b'];
423
+                if ($this->value['margin']['b']) {
424
+                	$y -= $this->value['margin']['b'];
425
+                }
413 426
             } else {
414 427
                 $y = $this->value['top'];
415
-                if ($this->value['margin']['t']) $y += $this->value['margin']['t'];
428
+                if ($this->value['margin']['t']) {
429
+                	$y += $this->value['margin']['t'];
430
+                }
416 431
             }
417 432
 
418 433
             if ($this->value['position'] == 'relative') {
@@ -425,8 +440,12 @@  discard block
 block discarded – undo
425 440
         } else {
426 441
             $this->value['x'] = $currentX;
427 442
             $this->value['y'] = $currentY;
428
-            if ($this->value['margin']['l']) $this->value['x'] += $this->value['margin']['l'];
429
-            if ($this->value['margin']['t']) $this->value['y'] += $this->value['margin']['t'];
443
+            if ($this->value['margin']['l']) {
444
+            	$this->value['x'] += $this->value['margin']['l'];
445
+            }
446
+            if ($this->value['margin']['t']) {
447
+            	$this->value['y'] += $this->value['margin']['t'];
448
+            }
430 449
         }
431 450
 
432 451
         // save the new position
@@ -484,8 +503,12 @@  discard block
 block discarded – undo
484 503
     {
485 504
         // prepare
486 505
         $tagName = strtolower($tagName);
487
-        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id)   $id   = null;
488
-        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null;
506
+        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) {
507
+        	$id   = null;
508
+        }
509
+        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) {
510
+        	$name = null;
511
+        }
489 512
 
490 513
         // read the class attribute
491 514
         $class = array();
@@ -534,10 +557,18 @@  discard block
 block discarded – undo
534 557
         // adding the style from the tag
535 558
         $styles = array_merge($styles, $param['style']);
536 559
 
537
-        if (isset($styles['stroke']))        $this->value['svg']['stroke']       = $this->convertToColor($styles['stroke'], $res);
538
-        if (isset($styles['stroke-width']))  $this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']);
539
-        if (isset($styles['fill']))          $this->value['svg']['fill']         = $this->convertToColor($styles['fill'], $res);
540
-        if (isset($styles['fill-opacity']))  $this->value['svg']['fill-opacity'] = 1. * $styles['fill-opacity'];
560
+        if (isset($styles['stroke'])) {
561
+        	$this->value['svg']['stroke']       = $this->convertToColor($styles['stroke'], $res);
562
+        }
563
+        if (isset($styles['stroke-width'])) {
564
+        	$this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']);
565
+        }
566
+        if (isset($styles['fill'])) {
567
+        	$this->value['svg']['fill']         = $this->convertToColor($styles['fill'], $res);
568
+        }
569
+        if (isset($styles['fill-opacity'])) {
570
+        	$this->value['svg']['fill-opacity'] = 1. * $styles['fill-opacity'];
571
+        }
541 572
 
542 573
         return $this->value['svg'];
543 574
     }
@@ -554,8 +585,12 @@  discard block
 block discarded – undo
554 585
     {
555 586
         // prepare the informations
556 587
         $tagName = strtolower($tagName);
557
-        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id)   $id   = null;
558
-        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null;
588
+        $id   = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) {
589
+        	$id   = null;
590
+        }
591
+        $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) {
592
+        	$name = null;
593
+        }
559 594
 
560 595
         // get the class names to use
561 596
         $class = array();
@@ -594,7 +629,9 @@  discard block
 block discarded – undo
594 629
 
595 630
         // merge with the css styles from tag
596 631
         $styles = array_merge($styles, $param['style']);
597
-        if (isset($param['allwidth']) && ! isset($styles['width'])) $styles['width'] = '100%';
632
+        if (isset($param['allwidth']) && ! isset($styles['width'])) {
633
+        	$styles['width'] = '100%';
634
+        }
598 635
 
599 636
         // reset some styles, depending on the tag name
600 637
         $this->resetStyle($tagName);
@@ -603,8 +640,9 @@  discard block
 block discarded – undo
603 640
         if ($legacy) {
604 641
             foreach ($legacy as $legacyName => $legacyValue) {
605 642
                 if (is_array($legacyValue)) {
606
-                    foreach ($legacyValue as $legacy2Name => $legacy2Value)
607
-                        $this->value[$legacyName][$legacy2Name] = $legacy2Value;
643
+                    foreach ($legacyValue as $legacy2Name => $legacy2Value) {
644
+                                            $this->value[$legacyName][$legacy2Name] = $legacy2Value;
645
+                    }
608 646
                 } else {
609 647
                     $this->value[$legacyName] = $legacyValue;
610 648
                 }
@@ -647,13 +685,17 @@  discard block
 block discarded – undo
647 685
                     break;
648 686
 
649 687
                 case 'text-transform':
650
-                    if ( ! in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) $val = 'none';
688
+                    if ( ! in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) {
689
+                    	$val = 'none';
690
+                    }
651 691
                     $this->value['text-transform'] = $val;
652 692
                     break;
653 693
 
654 694
                 case 'font-size':
655 695
                     $val = $this->convertToMM($val, $this->value['font-size']);
656
-                    if ($val) $this->value['font-size'] = $val;
696
+                    if ($val) {
697
+                    	$this->value['font-size'] = $val;
698
+                    }
657 699
                     break;
658 700
 
659 701
                 case 'color':
@@ -669,7 +711,9 @@  discard block
 block discarded – undo
669 711
 
670 712
                 case 'text-align':
671 713
                     $val = strtolower($val);
672
-                    if ( ! in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) $val = 'left';
714
+                    if ( ! in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) {
715
+                    	$val = 'left';
716
+                    }
673 717
                     $this->value['text-align'] = $val;
674 718
                     break;
675 719
 
@@ -679,7 +723,9 @@  discard block
 block discarded – undo
679 723
 
680 724
                 case 'width':
681 725
                     $this->value['width'] = $this->convertToMM($val, $this->getLastWidth());
682
-                    if ($this->value['width'] && substr($val, -1) == '%') $correctWidth = true;
726
+                    if ($this->value['width'] && substr($val, -1) == '%') {
727
+                    	$correctWidth = true;
728
+                    }
683 729
                     $noWidth = false;
684 730
                     break;
685 731
 
@@ -688,18 +734,26 @@  discard block
 block discarded – undo
688 734
                     break;
689 735
 
690 736
                 case 'line-height':
691
-                    if (preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val * 100).'%';
737
+                    if (preg_match('/^[0-9\.]+$/isU', $val)) {
738
+                    	$val = floor($val * 100).'%';
739
+                    }
692 740
                     $this->value['line-height'] = $val;
693 741
                     break;
694 742
 
695 743
                 case 'rotate':
696
-                    if ( ! in_array($val, array(0, -90, 90, 180, 270, -180, -270))) $val = null;
697
-                    if ($val < 0) $val += 360;
744
+                    if ( ! in_array($val, array(0, -90, 90, 180, 270, -180, -270))) {
745
+                    	$val = null;
746
+                    }
747
+                    if ($val < 0) {
748
+                    	$val += 360;
749
+                    }
698 750
                     $this->value['rotate'] = $val;
699 751
                     break;
700 752
 
701 753
                 case 'overflow':
702
-                    if ( ! in_array($val, array('visible', 'hidden'))) $val = 'visible';
754
+                    if ( ! in_array($val, array('visible', 'hidden'))) {
755
+                    	$val = 'visible';
756
+                    }
703 757
                     $this->value['overflow'] = $val;
704 758
                     break;
705 759
 
@@ -893,34 +947,52 @@  discard block
 block discarded – undo
893 947
                             $val[$valK] = $this->convertToMM($valV, 0);
894 948
                     }
895 949
                     $this->_duplicateBorder($val);
896
-                    if ($val[0]) $this->value['border']['t']['width'] = $val[0];
897
-                    if ($val[1]) $this->value['border']['r']['width'] = $val[1];
898
-                    if ($val[2]) $this->value['border']['b']['width'] = $val[2];
899
-                    if ($val[3]) $this->value['border']['l']['width'] = $val[3];
950
+                    if ($val[0]) {
951
+                    	$this->value['border']['t']['width'] = $val[0];
952
+                    }
953
+                    if ($val[1]) {
954
+                    	$this->value['border']['r']['width'] = $val[1];
955
+                    }
956
+                    if ($val[2]) {
957
+                    	$this->value['border']['b']['width'] = $val[2];
958
+                    }
959
+                    if ($val[3]) {
960
+                    	$this->value['border']['l']['width'] = $val[3];
961
+                    }
900 962
                     break;
901 963
 
902 964
                 case 'border-top-width':
903 965
                     $val = $this->convertToMM($val, 0);
904
-                    if ($val) $this->value['border']['t']['width'] = $val;
966
+                    if ($val) {
967
+                    	$this->value['border']['t']['width'] = $val;
968
+                    }
905 969
                     break;
906 970
 
907 971
                 case 'border-right-width':
908 972
                     $val = $this->convertToMM($val, 0);
909
-                    if ($val) $this->value['border']['r']['width'] = $val;
973
+                    if ($val) {
974
+                    	$this->value['border']['r']['width'] = $val;
975
+                    }
910 976
                     break;
911 977
 
912 978
                 case 'border-bottom-width':
913 979
                     $val = $this->convertToMM($val, 0);
914
-                    if ($val) $this->value['border']['b']['width'] = $val;
980
+                    if ($val) {
981
+                    	$this->value['border']['b']['width'] = $val;
982
+                    }
915 983
                     break;
916 984
 
917 985
                 case 'border-left-width':
918 986
                     $val = $this->convertToMM($val, 0);
919
-                    if ($val) $this->value['border']['l']['width'] = $val;
987
+                    if ($val) {
988
+                    	$this->value['border']['l']['width'] = $val;
989
+                    }
920 990
                     break;
921 991
 
922 992
                 case 'border-collapse':
923
-                    if ($tagName == 'table') $this->value['border']['collapse'] = ($val == 'collapse');
993
+                    if ($tagName == 'table') {
994
+                    	$this->value['border']['collapse'] = ($val == 'collapse');
995
+                    }
924 996
                     break;
925 997
 
926 998
                 case 'border-radius':
@@ -932,17 +1004,29 @@  discard block
 block discarded – undo
932 1004
                     if (count($valH) < 1 || count($valH) > 4) {
933 1005
                         break;
934 1006
                     }
935
-                    if ( ! isset($valH[1])) $valH[1] = $valH[0];
936
-                    if ( ! isset($valH[2])) $valH = array($valH[0], $valH[0], $valH[1], $valH[1]);
937
-                    if ( ! isset($valH[3])) $valH[3] = $valH[1];
1007
+                    if ( ! isset($valH[1])) {
1008
+                    	$valH[1] = $valH[0];
1009
+                    }
1010
+                    if ( ! isset($valH[2])) {
1011
+                    	$valH = array($valH[0], $valH[0], $valH[1], $valH[1]);
1012
+                    }
1013
+                    if ( ! isset($valH[3])) {
1014
+                    	$valH[3] = $valH[1];
1015
+                    }
938 1016
                     if (isset($val[1])) {
939 1017
                         $valV = $this->convertToRadius(trim($val[1]));
940 1018
                         if (count($valV) < 1 || count($valV) > 4) {
941 1019
                             break;
942 1020
                         }
943
-                        if ( ! isset($valV[1])) $valV[1] = $valV[0];
944
-                        if ( ! isset($valV[2])) $valV = array($valV[0], $valV[0], $valV[1], $valV[1]);
945
-                        if ( ! isset($valV[3])) $valV[3] = $valV[1];
1021
+                        if ( ! isset($valV[1])) {
1022
+                        	$valV[1] = $valV[0];
1023
+                        }
1024
+                        if ( ! isset($valV[2])) {
1025
+                        	$valV = array($valV[0], $valV[0], $valV[1], $valV[1]);
1026
+                        }
1027
+                        if ( ! isset($valV[3])) {
1028
+                        	$valV[3] = $valV[1];
1029
+                        }
946 1030
                     } else {
947 1031
                         $valV = $valH;
948 1032
                     }
@@ -1024,22 +1108,35 @@  discard block
 block discarded – undo
1024 1108
                     break;
1025 1109
 
1026 1110
                 case 'position':
1027
-                    if ($val == 'absolute')       $this->value['position'] = 'absolute';
1028
-                    else if ($val == 'relative')  $this->value['position'] = 'relative';
1029
-                    else                        $this->value['position'] = null;
1111
+                    if ($val == 'absolute') {
1112
+                    	$this->value['position'] = 'absolute';
1113
+                    } else if ($val == 'relative') {
1114
+                    	$this->value['position'] = 'relative';
1115
+                    } else {
1116
+                    	$this->value['position'] = null;
1117
+                    }
1030 1118
                     break;
1031 1119
 
1032 1120
                 case 'float':
1033
-                    if ($val == 'left')           $this->value['float'] = 'left';
1034
-                    else if ($val == 'right')     $this->value['float'] = 'right';
1035
-                    else                        $this->value['float'] = null;
1121
+                    if ($val == 'left') {
1122
+                    	$this->value['float'] = 'left';
1123
+                    } else if ($val == 'right') {
1124
+                    	$this->value['float'] = 'right';
1125
+                    } else {
1126
+                    	$this->value['float'] = null;
1127
+                    }
1036 1128
                     break;
1037 1129
 
1038 1130
                 case 'display':
1039
-                    if ($val == 'inline')         $this->value['display'] = 'inline';
1040
-                    else if ($val == 'block')     $this->value['display'] = 'block';
1041
-                    else if ($val == 'none')      $this->value['display'] = 'none';
1042
-                    else                        $this->value['display'] = null;
1131
+                    if ($val == 'inline') {
1132
+                    	$this->value['display'] = 'inline';
1133
+                    } else if ($val == 'block') {
1134
+                    	$this->value['display'] = 'block';
1135
+                    } else if ($val == 'none') {
1136
+                    	$this->value['display'] = 'none';
1137
+                    } else {
1138
+                    	$this->value['display'] = null;
1139
+                    }
1043 1140
                     break;
1044 1141
 
1045 1142
                 case 'top':
@@ -1052,7 +1149,9 @@  discard block
 block discarded – undo
1052 1149
                 case 'list-style':
1053 1150
                 case 'list-style-type':
1054 1151
                 case 'list-style-image':
1055
-                    if ($nom == 'list-style') $nom = 'list-style-type';
1152
+                    if ($nom == 'list-style') {
1153
+                    	$nom = 'list-style-type';
1154
+                    }
1056 1155
                     $this->value[$nom] = $val;
1057 1156
                     break;
1058 1157
 
@@ -1064,11 +1163,17 @@  discard block
 block discarded – undo
1064 1163
         $return = true;
1065 1164
 
1066 1165
         // only for P tag
1067
-        if ($this->value['margin']['t'] === null) $this->value['margin']['t'] = $this->value['font-size'];
1068
-        if ($this->value['margin']['b'] === null) $this->value['margin']['b'] = $this->value['font-size'];
1166
+        if ($this->value['margin']['t'] === null) {
1167
+        	$this->value['margin']['t'] = $this->value['font-size'];
1168
+        }
1169
+        if ($this->value['margin']['b'] === null) {
1170
+        	$this->value['margin']['b'] = $this->value['font-size'];
1171
+        }
1069 1172
 
1070 1173
         // force the text align to left, if asked by html2pdf
1071
-        if ($this->_onlyLeft) $this->value['text-align'] = 'left';
1174
+        if ($this->_onlyLeft) {
1175
+        	$this->value['text-align'] = 'left';
1176
+        }
1072 1177
 
1073 1178
         // correction on the width (quick box)
1074 1179
         if ($noWidth && in_array($tagName, array('div', 'blockquote', 'fieldset')) && $this->value['position'] != 'absolute') {
@@ -1084,30 +1189,60 @@  discard block
 block discarded – undo
1084 1189
                     $this->value['width'] -= $this->convertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
1085 1190
                     $return = false;
1086 1191
                 }
1087
-                if ($this->value['width'] < 0) $this->value['width'] = 0;
1192
+                if ($this->value['width'] < 0) {
1193
+                	$this->value['width'] = 0;
1194
+                }
1088 1195
             } else {
1089 1196
                 if ($this->value['width']) {
1090
-                    if ($this->value['border']['l']['width']) $this->value['width'] += $this->value['border']['l']['width'];
1091
-                    if ($this->value['border']['r']['width']) $this->value['width'] += $this->value['border']['r']['width'];
1092
-                    if ($this->value['padding']['l'])         $this->value['width'] += $this->value['padding']['l'];
1093
-                    if ($this->value['padding']['r'])         $this->value['width'] += $this->value['padding']['r'];
1197
+                    if ($this->value['border']['l']['width']) {
1198
+                    	$this->value['width'] += $this->value['border']['l']['width'];
1199
+                    }
1200
+                    if ($this->value['border']['r']['width']) {
1201
+                    	$this->value['width'] += $this->value['border']['r']['width'];
1202
+                    }
1203
+                    if ($this->value['padding']['l']) {
1204
+                    	$this->value['width'] += $this->value['padding']['l'];
1205
+                    }
1206
+                    if ($this->value['padding']['r']) {
1207
+                    	$this->value['width'] += $this->value['padding']['r'];
1208
+                    }
1094 1209
                 }
1095 1210
             }
1096 1211
         }
1097 1212
         if ($this->value['height']) {
1098
-            if ($this->value['border']['b']['width']) $this->value['height'] += $this->value['border']['b']['width'];
1099
-            if ($this->value['border']['t']['width']) $this->value['height'] += $this->value['border']['t']['width'];
1100
-            if ($this->value['padding']['b'])         $this->value['height'] += $this->value['padding']['b'];
1101
-            if ($this->value['padding']['t'])         $this->value['height'] += $this->value['padding']['t'];
1213
+            if ($this->value['border']['b']['width']) {
1214
+            	$this->value['height'] += $this->value['border']['b']['width'];
1215
+            }
1216
+            if ($this->value['border']['t']['width']) {
1217
+            	$this->value['height'] += $this->value['border']['t']['width'];
1218
+            }
1219
+            if ($this->value['padding']['b']) {
1220
+            	$this->value['height'] += $this->value['padding']['b'];
1221
+            }
1222
+            if ($this->value['padding']['t']) {
1223
+            	$this->value['height'] += $this->value['padding']['t'];
1224
+            }
1102 1225
         }
1103 1226
 
1104
-        if ($this->value['top'] != null)      $this->value['top']     = $this->convertToMM($this->value['top'], $this->getLastHeight(true));
1105
-        if ($this->value['bottom'] != null)   $this->value['bottom']  = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true));
1106
-        if ($this->value['left'] != null)     $this->value['left']    = $this->convertToMM($this->value['left'], $this->getLastWidth(true));
1107
-        if ($this->value['right'] != null)    $this->value['right']   = $this->convertToMM($this->value['right'], $this->getLastWidth(true));
1227
+        if ($this->value['top'] != null) {
1228
+        	$this->value['top']     = $this->convertToMM($this->value['top'], $this->getLastHeight(true));
1229
+        }
1230
+        if ($this->value['bottom'] != null) {
1231
+        	$this->value['bottom']  = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true));
1232
+        }
1233
+        if ($this->value['left'] != null) {
1234
+        	$this->value['left']    = $this->convertToMM($this->value['left'], $this->getLastWidth(true));
1235
+        }
1236
+        if ($this->value['right'] != null) {
1237
+        	$this->value['right']   = $this->convertToMM($this->value['right'], $this->getLastWidth(true));
1238
+        }
1108 1239
 
1109
-        if ($this->value['top'] && $this->value['bottom'] && $this->value['height'])    $this->value['bottom']  = null;
1110
-        if ($this->value['left'] && $this->value['right'] && $this->value['width'])     $this->value['right']   = null;
1240
+        if ($this->value['top'] && $this->value['bottom'] && $this->value['height']) {
1241
+        	$this->value['bottom']  = null;
1242
+        }
1243
+        if ($this->value['left'] && $this->value['right'] && $this->value['width']) {
1244
+        	$this->value['right']   = null;
1245
+        }
1111 1246
 
1112 1247
         return $return;
1113 1248
     }
@@ -1121,7 +1256,9 @@  discard block
 block discarded – undo
1121 1256
     public function getLineHeight()
1122 1257
     {
1123 1258
         $val = $this->value['line-height'];
1124
-        if ($val == 'normal') $val = '108%';
1259
+        if ($val == 'normal') {
1260
+        	$val = '108%';
1261
+        }
1125 1262
         return $this->convertToMM($val, $this->value['font-size']);
1126 1263
     }
1127 1264
 
@@ -1177,8 +1314,12 @@  discard block
 block discarded – undo
1177 1314
      */
1178 1315
     public function getFloat()
1179 1316
     {
1180
-        if ($this->value['float'] == 'left')    return 'left';
1181
-        if ($this->value['float'] == 'right')   return 'right';
1317
+        if ($this->value['float'] == 'left') {
1318
+        	return 'left';
1319
+        }
1320
+        if ($this->value['float'] == 'right') {
1321
+        	return 'right';
1322
+        }
1182 1323
         return null;
1183 1324
     }
1184 1325
 
@@ -1208,7 +1349,9 @@  discard block
 block discarded – undo
1208 1349
     protected function _getLastAbsoluteX()
1209 1350
     {
1210 1351
         for ($k = count($this->table) - 1; $k >= 0; $k--) {
1211
-            if ($this->table[$k]['x'] && $this->table[$k]['position']) return $this->table[$k]['x'];
1352
+            if ($this->table[$k]['x'] && $this->table[$k]['position']) {
1353
+            	return $this->table[$k]['x'];
1354
+            }
1212 1355
         }
1213 1356
         return $this->_pdf->getlMargin();
1214 1357
     }
@@ -1222,7 +1365,9 @@  discard block
 block discarded – undo
1222 1365
     protected function _getLastAbsoluteY()
1223 1366
     {
1224 1367
         for ($k = count($this->table) - 1; $k >= 0; $k--) {
1225
-            if ($this->table[$k]['y'] && $this->table[$k]['position']) return $this->table[$k]['y'];
1368
+            if ($this->table[$k]['y'] && $this->table[$k]['position']) {
1369
+            	return $this->table[$k]['y'];
1370
+            }
1226 1371
         }
1227 1372
         return $this->_pdf->gettMargin();
1228 1373
     }
@@ -1364,12 +1509,16 @@  discard block
 block discarded – undo
1364 1509
             // else, it could be the color
1365 1510
             } else {
1366 1511
                 $tmp = $this->convertToColor($value, $res);
1367
-                if ($res) $color = $tmp;
1512
+                if ($res) {
1513
+                	$color = $tmp;
1514
+                }
1368 1515
             }
1369 1516
         }
1370 1517
 
1371 1518
         // if no witdh => return none
1372
-        if ( ! $width) return $none;
1519
+        if ( ! $width) {
1520
+        	return $none;
1521
+        }
1373 1522
 
1374 1523
         // return the border properties
1375 1524
         return array('type' => $type, 'width' => $width, 'color' => $color);
@@ -1474,8 +1623,11 @@  discard block
 block discarded – undo
1474 1623
     public function convertBackgroundColor($css)
1475 1624
     {
1476 1625
         $res = null;
1477
-        if ($css == 'transparent') return null;
1478
-        else                     return $this->convertToColor($css, $res);
1626
+        if ($css == 'transparent') {
1627
+        	return null;
1628
+        } else {
1629
+        	return $this->convertToColor($css, $res);
1630
+        }
1479 1631
     }
1480 1632
 
1481 1633
     /**
@@ -1487,12 +1639,13 @@  discard block
 block discarded – undo
1487 1639
      */
1488 1640
     public function convertBackgroundImage($css)
1489 1641
     {
1490
-        if ($css == 'none')
1491
-            return null;
1492
-        else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match))
1493
-            return $match[1];
1494
-        else
1495
-            return null;
1642
+        if ($css == 'none') {
1643
+                    return null;
1644
+        } else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match)) {
1645
+                    return $match[1];
1646
+        } else {
1647
+                    return null;
1648
+        }
1496 1649
     }
1497 1650
 
1498 1651
     /**
@@ -1513,10 +1666,14 @@  discard block
 block discarded – undo
1513 1666
 
1514 1667
         // we must have 2 values. if 0 or >2 : error. if 1 => put center for 2
1515 1668
         if (count($css) < 2) {
1516
-            if ( ! $css[0]) return null;
1669
+            if ( ! $css[0]) {
1670
+            	return null;
1671
+            }
1517 1672
             $css[1] = 'center';
1518 1673
         }
1519
-        if (count($css) > 2) return null;
1674
+        if (count($css) > 2) {
1675
+        	return null;
1676
+        }
1520 1677
 
1521 1678
         // prepare the values
1522 1679
         $x = 0;
@@ -1524,24 +1681,42 @@  discard block
 block discarded – undo
1524 1681
         $res = true;
1525 1682
 
1526 1683
         // convert the first value
1527
-        if ($css[0] == 'left')        $x = '0%';
1528
-        else if ($css[0] == 'center') $x = '50%';
1529
-        else if ($css[0] == 'right')  $x = '100%';
1530
-        else if ($css[0] == 'top')    $y = '0%';
1531
-        else if ($css[0] == 'bottom') $y = '100%';
1532
-        else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) $x = $css[0];
1533
-        else if ($this->convertToMM($css[0])) $x = $this->convertToMM($css[0]);
1534
-        else $res = false;
1684
+        if ($css[0] == 'left') {
1685
+        	$x = '0%';
1686
+        } else if ($css[0] == 'center') {
1687
+        	$x = '50%';
1688
+        } else if ($css[0] == 'right') {
1689
+        	$x = '100%';
1690
+        } else if ($css[0] == 'top') {
1691
+        	$y = '0%';
1692
+        } else if ($css[0] == 'bottom') {
1693
+        	$y = '100%';
1694
+        } else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) {
1695
+        	$x = $css[0];
1696
+        } else if ($this->convertToMM($css[0])) {
1697
+        	$x = $this->convertToMM($css[0]);
1698
+        } else {
1699
+        	$res = false;
1700
+        }
1535 1701
 
1536 1702
         // convert the second value
1537
-        if ($css[1] == 'left')        $x = '0%';
1538
-        else if ($css[1] == 'right')  $x = '100%';
1539
-        else if ($css[1] == 'top')    $y = '0%';
1540
-        else if ($css[1] == 'center') $y = '50%';
1541
-        else if ($css[1] == 'bottom') $y = '100%';
1542
-        else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) $y = $css[1];
1543
-        else if ($this->convertToMM($css[1])) $y = $this->convertToMM($css[1]);
1544
-        else $res = false;
1703
+        if ($css[1] == 'left') {
1704
+        	$x = '0%';
1705
+        } else if ($css[1] == 'right') {
1706
+        	$x = '100%';
1707
+        } else if ($css[1] == 'top') {
1708
+        	$y = '0%';
1709
+        } else if ($css[1] == 'center') {
1710
+        	$y = '50%';
1711
+        } else if ($css[1] == 'bottom') {
1712
+        	$y = '100%';
1713
+        } else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) {
1714
+        	$y = $css[1];
1715
+        } else if ($this->convertToMM($css[1])) {
1716
+        	$y = $this->convertToMM($css[1]);
1717
+        } else {
1718
+        	$res = false;
1719
+        }
1545 1720
 
1546 1721
         // return the values
1547 1722
         return array($x, $y);
@@ -1581,13 +1756,22 @@  discard block
 block discarded – undo
1581 1756
     public function convertToMM($css, $old = 0.)
1582 1757
     {
1583 1758
         $css = trim($css);
1584
-        if (preg_match('/^[0-9\.\-]+$/isU', $css))        $css .= 'px';
1585
-        if (preg_match('/^[0-9\.\-]+px$/isU', $css))      $css = 25.4 / 96. * str_replace('px', '', $css);
1586
-        else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) $css = 25.4 / 72. * str_replace('pt', '', $css);
1587
-        else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) $css = 25.4 * str_replace('in', '', $css);
1588
-        else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) $css = 1. * str_replace('mm', '', $css);
1589
-        else if (preg_match('/^[0-9\.\-]+%$/isU', $css))  $css = 1. * $old * str_replace('%', '', $css) / 100.;
1590
-        else                                              $css = null;
1759
+        if (preg_match('/^[0-9\.\-]+$/isU', $css)) {
1760
+        	$css .= 'px';
1761
+        }
1762
+        if (preg_match('/^[0-9\.\-]+px$/isU', $css)) {
1763
+        	$css = 25.4 / 96. * str_replace('px', '', $css);
1764
+        } else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) {
1765
+        	$css = 25.4 / 72. * str_replace('pt', '', $css);
1766
+        } else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) {
1767
+        	$css = 25.4 * str_replace('in', '', $css);
1768
+        } else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) {
1769
+        	$css = 1. * str_replace('mm', '', $css);
1770
+        } else if (preg_match('/^[0-9\.\-]+%$/isU', $css)) {
1771
+        	$css = 1. * $old * str_replace('%', '', $css) / 100.;
1772
+        } else {
1773
+        	$css = null;
1774
+        }
1591 1775
 
1592 1776
         return $css;
1593 1777
     }
@@ -1636,7 +1820,9 @@  discard block
 block discarded – undo
1636 1820
         $res = true;
1637 1821
 
1638 1822
         // if transparent => return null
1639
-        if (strtolower($css) == 'transparent') return array(null, null, null);
1823
+        if (strtolower($css) == 'transparent') {
1824
+        	return array(null, null, null);
1825
+        }
1640 1826
 
1641 1827
         // HTML color
1642 1828
         if (isset($this->_htmlColor[strtolower($css)])) {
@@ -1697,7 +1883,9 @@  discard block
 block discarded – undo
1697 1883
             $c = floatVal(substr($c, 0, -1)) / 100.;
1698 1884
         } else {
1699 1885
             $c = floatVal($c);
1700
-            if ($c > 1) $c = $c / 255.;
1886
+            if ($c > 1) {
1887
+            	$c = $c / 255.;
1888
+            }
1701 1889
         }
1702 1890
 
1703 1891
         return $c;
@@ -1751,13 +1939,16 @@  discard block
 block discarded – undo
1751 1939
                 $name = trim($name);
1752 1940
 
1753 1941
                 // if a selector with somethink lige :hover => continue
1754
-                if (strpos($name, ':') !== false) continue;
1942
+                if (strpos($name, ':') !== false) {
1943
+                	continue;
1944
+                }
1755 1945
 
1756 1946
                 // save the value
1757
-                if ( ! isset($this->css[$name]))
1758
-                    $this->css[$name] = $css;
1759
-                else
1760
-                    $this->css[$name] = array_merge($this->css[$name], $css);
1947
+                if ( ! isset($this->css[$name])) {
1948
+                                    $this->css[$name] = $css;
1949
+                } else {
1950
+                                    $this->css[$name] = array_merge($this->css[$name], $css);
1951
+                }
1761 1952
 
1762 1953
             }
1763 1954
         }
Please login to merge, or discard this patch.