@@ -68,7 +68,7 @@ |
||
68 | 68 | * as this file. |
69 | 69 | * |
70 | 70 | */ |
71 | - $assets_path='assets'; |
|
71 | + $assets_path = 'assets'; |
|
72 | 72 | /* |
73 | 73 | *--------------------------------------------------------------- |
74 | 74 | * APPLICATION FOLDER NAME |
@@ -1025,18 +1025,15 @@ |
||
1025 | 1025 | { |
1026 | 1026 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
1027 | 1027 | break; |
1028 | - } |
|
1029 | - elseif (defined('ENVIRONMENT') AND file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1028 | + } elseif (defined('ENVIRONMENT') AND file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1030 | 1029 | { |
1031 | 1030 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
1032 | 1031 | break; |
1033 | - } |
|
1034 | - elseif (file_exists($path.'config/'.strtolower($class).'.php')) |
|
1032 | + } elseif (file_exists($path.'config/'.strtolower($class).'.php')) |
|
1035 | 1033 | { |
1036 | 1034 | include($path.'config/'.strtolower($class).'.php'); |
1037 | 1035 | break; |
1038 | - } |
|
1039 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1036 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1040 | 1037 | { |
1041 | 1038 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
1042 | 1039 | break; |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | // -------------------------------------------------------------------- |
137 | 137 | |
138 | 138 | /** |
139 | - * Fetch an item from the GET array |
|
140 | - * |
|
141 | - * @access public |
|
142 | - * @param string |
|
143 | - * @param bool |
|
144 | - * @param string $index |
|
145 | - * @return string |
|
146 | - */ |
|
139 | + * Fetch an item from the GET array |
|
140 | + * |
|
141 | + * @access public |
|
142 | + * @param string |
|
143 | + * @param bool |
|
144 | + * @param string $index |
|
145 | + * @return string |
|
146 | + */ |
|
147 | 147 | function get($index = NULL, $xss_clean = FALSE) |
148 | 148 | { |
149 | 149 | // Check if a field has been provided |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | // -------------------------------------------------------------------- |
166 | 166 | |
167 | 167 | /** |
168 | - * Fetch an item from the POST array |
|
169 | - * |
|
170 | - * @access public |
|
171 | - * @param string |
|
172 | - * @param bool |
|
173 | - * @param string $index |
|
174 | - * @return string |
|
175 | - */ |
|
168 | + * Fetch an item from the POST array |
|
169 | + * |
|
170 | + * @access public |
|
171 | + * @param string |
|
172 | + * @param bool |
|
173 | + * @param string $index |
|
174 | + * @return string |
|
175 | + */ |
|
176 | 176 | function post($index = NULL, $xss_clean = FALSE) |
177 | 177 | { |
178 | 178 | // Check if a field has been provided |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | // -------------------------------------------------------------------- |
362 | 362 | |
363 | 363 | /** |
364 | - * Validate IP Address |
|
365 | - * |
|
366 | - * Updated version suggested by Geert De Deckere |
|
367 | - * |
|
368 | - * @access public |
|
369 | - * @param string |
|
370 | - * @return boolean |
|
371 | - */ |
|
364 | + * Validate IP Address |
|
365 | + * |
|
366 | + * Updated version suggested by Geert De Deckere |
|
367 | + * |
|
368 | + * @access public |
|
369 | + * @param string |
|
370 | + * @return boolean |
|
371 | + */ |
|
372 | 372 | function valid_ip($ip) |
373 | 373 | { |
374 | 374 | $ip_segments = explode('.', $ip); |
@@ -99,8 +99,7 @@ |
||
99 | 99 | if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) |
100 | 100 | { |
101 | 101 | include APPPATH.'config/'.ENVIRONMENT.'/mimes.php'; |
102 | - } |
|
103 | - else |
|
102 | + } else |
|
104 | 103 | { |
105 | 104 | include APPPATH.'config/mimes.php'; |
106 | 105 | } |
@@ -162,9 +162,9 @@ |
||
162 | 162 | $str = remove_invisible_characters($str, FALSE); |
163 | 163 | //================ITPL======================= |
164 | 164 | $pos = strpos($str, "_json"); |
165 | - if($pos > 0 && !isset($_SERVER['HTTP_X_REQUESTED_WITH'])){ |
|
165 | + if ($pos > 0 && ! isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { |
|
166 | 166 | $this->uri_string = str_replace('_json', '', trim($str, '/')); |
167 | - }else{ |
|
167 | + } else { |
|
168 | 168 | // If the URI contains only a slash we'll kill it |
169 | 169 | $this->uri_string = ($str == '/') ? '' : $str; |
170 | 170 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $pos = strpos($str, "_json"); |
165 | 165 | if($pos > 0 && !isset($_SERVER['HTTP_X_REQUESTED_WITH'])){ |
166 | 166 | $this->uri_string = str_replace('_json', '', trim($str, '/')); |
167 | - }else{ |
|
167 | + } else{ |
|
168 | 168 | // If the URI contains only a slash we'll kill it |
169 | 169 | $this->uri_string = ($str == '/') ? '' : $str; |
170 | 170 | } |
@@ -562,8 +562,7 @@ discard block |
||
562 | 562 | if ($where == 'trailing') |
563 | 563 | { |
564 | 564 | $leading = ''; |
565 | - } |
|
566 | - elseif ($where == 'leading') |
|
565 | + } elseif ($where == 'leading') |
|
567 | 566 | { |
568 | 567 | $trailing = ''; |
569 | 568 | } |
@@ -254,7 +254,7 @@ |
||
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - $_config[0] =& $config; |
|
257 | + $_config[0] = & $config; |
|
258 | 258 | return $_config[0]; |
259 | 259 | |
260 | 260 | } |
@@ -85,8 +85,7 @@ |
||
85 | 85 | if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) |
86 | 86 | { |
87 | 87 | include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); |
88 | - } |
|
89 | - elseif (is_file(APPPATH.'config/hooks.php')) |
|
88 | + } elseif (is_file(APPPATH.'config/hooks.php')) |
|
90 | 89 | { |
91 | 90 | include(APPPATH.'config/hooks.php'); |
92 | 91 | } |
@@ -674,16 +674,13 @@ |
||
674 | 674 | if ($this->mailtype == 'html' && count($this->_attach_name) == 0) |
675 | 675 | { |
676 | 676 | return 'html'; |
677 | - } |
|
678 | - elseif ($this->mailtype == 'html' && count($this->_attach_name) > 0) |
|
677 | + } elseif ($this->mailtype == 'html' && count($this->_attach_name) > 0) |
|
679 | 678 | { |
680 | 679 | return 'html-attach'; |
681 | - } |
|
682 | - elseif ($this->mailtype == 'text' && count($this->_attach_name) > 0) |
|
680 | + } elseif ($this->mailtype == 'text' && count($this->_attach_name) > 0) |
|
683 | 681 | { |
684 | 682 | return 'plain-attach'; |
685 | - } |
|
686 | - else |
|
683 | + } else |
|
687 | 684 | { |
688 | 685 | return 'plain'; |
689 | 686 | } |
@@ -640,13 +640,13 @@ discard block |
||
640 | 640 | // Users can use any native PHP function call that has one param. |
641 | 641 | if (function_exists($rule)) |
642 | 642 | { |
643 | - $str=null; |
|
644 | - if(is_array($postdata)){ |
|
645 | - foreach($postdata as $key=>$value){ |
|
646 | - $str.=$value.","; |
|
643 | + $str = null; |
|
644 | + if (is_array($postdata)) { |
|
645 | + foreach ($postdata as $key=>$value) { |
|
646 | + $str .= $value.","; |
|
647 | 647 | } |
648 | - $str=rtrim($str,','); |
|
649 | - $postdata=$str; |
|
648 | + $str = rtrim($str, ','); |
|
649 | + $postdata = $str; |
|
650 | 650 | } |
651 | 651 | $result = $rule($postdata); |
652 | 652 | |
@@ -974,20 +974,20 @@ discard block |
||
974 | 974 | */ |
975 | 975 | public function is_unique($str, $field) |
976 | 976 | { |
977 | - $id=''; |
|
978 | - $data =explode('.', $field); |
|
979 | - $table=$data[0]; |
|
980 | - $field=$data[1]; |
|
981 | - if(isset($data[2])) |
|
982 | - $id=$data[2]; |
|
983 | - $where=array($field => $str); |
|
984 | - if($id != ''){ |
|
985 | - $where['id !=']=$id; |
|
977 | + $id = ''; |
|
978 | + $data = explode('.', $field); |
|
979 | + $table = $data[0]; |
|
980 | + $field = $data[1]; |
|
981 | + if (isset($data[2])) |
|
982 | + $id = $data[2]; |
|
983 | + $where = array($field => $str); |
|
984 | + if ($id != '') { |
|
985 | + $where['id !='] = $id; |
|
986 | 986 | } |
987 | - if($table == 'accounts'){ |
|
988 | - $where['deleted']=0; |
|
987 | + if ($table == 'accounts') { |
|
988 | + $where['deleted'] = 0; |
|
989 | 989 | } |
990 | - $query = $this->CI->db->limit(1)->get_where($table,$where ); |
|
990 | + $query = $this->CI->db->limit(1)->get_where($table, $where); |
|
991 | 991 | return $query->num_rows() > 0 ? FALSE : TRUE; |
992 | 992 | } |
993 | 993 | |
@@ -1421,54 +1421,54 @@ discard block |
||
1421 | 1421 | { |
1422 | 1422 | return ( ! preg_match("/^([.a-z0-9])+$/i", $str)) ? FALSE : TRUE; |
1423 | 1423 | } |
1424 | - public function valid_decimal($str){ |
|
1425 | - return (bool) preg_match('#^\d+(?:\.\d{1,5})?$#', $str); |
|
1424 | + public function valid_decimal($str) { |
|
1425 | + return (bool)preg_match('#^\d+(?:\.\d{1,5})?$#', $str); |
|
1426 | 1426 | } |
1427 | 1427 | public function alpha_numeric_space($str) |
1428 | 1428 | { |
1429 | 1429 | return ( ! preg_match("/^[A-Za-z0-9\s]+$/", $str)) ? FALSE : TRUE; |
1430 | 1430 | } |
1431 | - public function alpha_space($str){ |
|
1431 | + public function alpha_space($str) { |
|
1432 | 1432 | return ( ! preg_match("/^[A-Za-z\s]+$/", $str)) ? FALSE : TRUE; |
1433 | 1433 | // return ( ! preg_match("/^([-a-z0-9_-\s])+$/i", $str)) ? FALSE : TRUE; |
1434 | 1434 | } |
1435 | - public function currency_decimal($str){ |
|
1436 | - return (bool) preg_match('#^\d{0,5}+(?:\.\d{1,5})?$#', $str); |
|
1435 | + public function currency_decimal($str) { |
|
1436 | + return (bool)preg_match('#^\d{0,5}+(?:\.\d{1,5})?$#', $str); |
|
1437 | 1437 | // test(num) |
1438 | 1438 | } |
1439 | 1439 | /* ASTPP 3.0 |
1440 | 1440 | * For Old Password checking |
1441 | 1441 | */ |
1442 | - public function password_check($str,$table){ |
|
1442 | + public function password_check($str, $table) { |
|
1443 | 1443 | $this->CI->db->select('password'); |
1444 | - $this->CI->db->where('id',$_POST['id']); |
|
1445 | - $result=$this->CI->db->get($table); |
|
1446 | - if($result->num_rows() > 0 ){ |
|
1447 | - $result=(array)$result->first_row(); |
|
1448 | - $password=$this->CI->common->decode($result['password']); |
|
1449 | - if($password && $password == $str){ |
|
1444 | + $this->CI->db->where('id', $_POST['id']); |
|
1445 | + $result = $this->CI->db->get($table); |
|
1446 | + if ($result->num_rows() > 0) { |
|
1447 | + $result = (array)$result->first_row(); |
|
1448 | + $password = $this->CI->common->decode($result['password']); |
|
1449 | + if ($password && $password == $str) { |
|
1450 | 1450 | return true; |
1451 | - }else{ |
|
1451 | + } else { |
|
1452 | 1452 | return false; |
1453 | 1453 | } |
1454 | - }else{ |
|
1454 | + } else { |
|
1455 | 1455 | return false; |
1456 | 1456 | } |
1457 | 1457 | } |
1458 | - public function did_account_checking($str){ |
|
1459 | - $post_array=$this->CI->input->post(); |
|
1460 | - if($str > 0){ |
|
1461 | - $this->CI->db->where("id",$str); |
|
1458 | + public function did_account_checking($str) { |
|
1459 | + $post_array = $this->CI->input->post(); |
|
1460 | + if ($str > 0) { |
|
1461 | + $this->CI->db->where("id", $str); |
|
1462 | 1462 | $this->CI->db->select('posttoexternal,balance,credit_limit'); |
1463 | - $acc_result=$this->CI->db->get('accounts'); |
|
1464 | - $customer_info=(array)$acc_result->first_row(); |
|
1463 | + $acc_result = $this->CI->db->get('accounts'); |
|
1464 | + $customer_info = (array)$acc_result->first_row(); |
|
1465 | 1465 | $available_bal = ($customer_info["balance"]) + $customer_info["posttoexternal"] * ($customer_info["credit_limit"]); |
1466 | - if($available_bal >= $post_array['setup']){ |
|
1466 | + if ($available_bal >= $post_array['setup']) { |
|
1467 | 1467 | return TRUE; |
1468 | - }else{ |
|
1468 | + } else { |
|
1469 | 1469 | return FALSE; |
1470 | 1470 | } |
1471 | - }else{ |
|
1471 | + } else { |
|
1472 | 1472 | return TRUE; |
1473 | 1473 | } |
1474 | 1474 | } |
@@ -412,13 +412,11 @@ discard block |
||
412 | 412 | if (isset($array[$keys[$i]])) |
413 | 413 | { |
414 | 414 | $array = $this->_reduce_array($array[$keys[$i]], $keys, ($i + 1)); |
415 | - } |
|
416 | - else |
|
415 | + } else |
|
417 | 416 | { |
418 | 417 | return NULL; |
419 | 418 | } |
420 | - } |
|
421 | - else |
|
419 | + } else |
|
422 | 420 | { |
423 | 421 | return $array; |
424 | 422 | } |
@@ -456,8 +454,7 @@ discard block |
||
456 | 454 | if (count($row['keys']) == 1) |
457 | 455 | { |
458 | 456 | $post_ref = & $post_ref[current($row['keys'])]; |
459 | - } |
|
460 | - else |
|
457 | + } else |
|
461 | 458 | { |
462 | 459 | foreach ($row['keys'] as $val) |
463 | 460 | { |
@@ -978,8 +975,9 @@ discard block |
||
978 | 975 | $data =explode('.', $field); |
979 | 976 | $table=$data[0]; |
980 | 977 | $field=$data[1]; |
981 | - if(isset($data[2])) |
|
982 | - $id=$data[2]; |
|
978 | + if(isset($data[2])) { |
|
979 | + $id=$data[2]; |
|
980 | + } |
|
983 | 981 | $where=array($field => $str); |
984 | 982 | if($id != ''){ |
985 | 983 | $where['id !=']=$id; |
@@ -1448,10 +1446,10 @@ discard block |
||
1448 | 1446 | $password=$this->CI->common->decode($result['password']); |
1449 | 1447 | if($password && $password == $str){ |
1450 | 1448 | return true; |
1451 | - }else{ |
|
1449 | + } else{ |
|
1452 | 1450 | return false; |
1453 | 1451 | } |
1454 | - }else{ |
|
1452 | + } else{ |
|
1455 | 1453 | return false; |
1456 | 1454 | } |
1457 | 1455 | } |
@@ -1465,10 +1463,10 @@ discard block |
||
1465 | 1463 | $available_bal = ($customer_info["balance"]) + $customer_info["posttoexternal"] * ($customer_info["credit_limit"]); |
1466 | 1464 | if($available_bal >= $post_array['setup']){ |
1467 | 1465 | return TRUE; |
1468 | - }else{ |
|
1466 | + } else{ |
|
1469 | 1467 | return FALSE; |
1470 | 1468 | } |
1471 | - }else{ |
|
1469 | + } else{ |
|
1472 | 1470 | return TRUE; |
1473 | 1471 | } |
1474 | 1472 | } |