@@ -1478,9 +1478,9 @@ |
||
1478 | 1478 | } |
1479 | 1479 | } |
1480 | 1480 | public function phn_number($str) |
1481 | - { |
|
1482 | - return (!preg_match('/^[0-9 +-]+$/', $str)) ? FALSE : TRUE; |
|
1483 | - } |
|
1481 | + { |
|
1482 | + return (!preg_match('/^[0-9 +-]+$/', $str)) ? FALSE : TRUE; |
|
1483 | + } |
|
1484 | 1484 | |
1485 | 1485 | } |
1486 | 1486 | // END Form Validation Class |
@@ -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 | |
@@ -1119,8 +1119,8 @@ discard block |
||
1119 | 1119 | */ |
1120 | 1120 | public function valid_ip($ip) |
1121 | 1121 | { |
1122 | - $explode_ip = explode('/',$ip); |
|
1123 | - $ip = (isset($explode_ip[0]) && $explode_ip[0] != '')?$explode_ip[0]:$ip; |
|
1122 | + $explode_ip = explode('/', $ip); |
|
1123 | + $ip = (isset($explode_ip[0]) && $explode_ip[0] != '') ? $explode_ip[0] : $ip; |
|
1124 | 1124 | return $this->CI->input->valid_ip($ip); |
1125 | 1125 | } |
1126 | 1126 | |
@@ -1433,53 +1433,53 @@ discard block |
||
1433 | 1433 | { |
1434 | 1434 | return ( ! preg_match("/^[A-Za-z0-9\s]+$/", $str)) ? FALSE : TRUE; |
1435 | 1435 | } |
1436 | - public function alpha_space($str){ |
|
1436 | + public function alpha_space($str) { |
|
1437 | 1437 | return ( ! preg_match("/^[A-Za-z\s]+$/", $str)) ? FALSE : TRUE; |
1438 | 1438 | // return ( ! preg_match("/^([-a-z0-9_-\s])+$/i", $str)) ? FALSE : TRUE; |
1439 | 1439 | } |
1440 | - public function currency_decimal($str){ |
|
1441 | - return (bool) preg_match('#^\d{0,15}+(?:\.\d{0,5})?$#', $str); |
|
1440 | + public function currency_decimal($str) { |
|
1441 | + return (bool)preg_match('#^\d{0,15}+(?:\.\d{0,5})?$#', $str); |
|
1442 | 1442 | // test(num) |
1443 | 1443 | } |
1444 | 1444 | /* ASTPP 3.0 |
1445 | 1445 | * For Old Password checking |
1446 | 1446 | */ |
1447 | - public function password_check($str,$table){ |
|
1447 | + public function password_check($str, $table) { |
|
1448 | 1448 | $this->CI->db->select('password'); |
1449 | - $this->CI->db->where('id',$_POST['id']); |
|
1450 | - $result=$this->CI->db->get($table); |
|
1451 | - if($result->num_rows() > 0 ){ |
|
1452 | - $result=(array)$result->first_row(); |
|
1453 | - $password=$this->CI->common->decode($result['password']); |
|
1454 | - if($password && $password == $str){ |
|
1449 | + $this->CI->db->where('id', $_POST['id']); |
|
1450 | + $result = $this->CI->db->get($table); |
|
1451 | + if ($result->num_rows() > 0) { |
|
1452 | + $result = (array)$result->first_row(); |
|
1453 | + $password = $this->CI->common->decode($result['password']); |
|
1454 | + if ($password && $password == $str) { |
|
1455 | 1455 | return true; |
1456 | - }else{ |
|
1456 | + } else { |
|
1457 | 1457 | return false; |
1458 | 1458 | } |
1459 | - }else{ |
|
1459 | + } else { |
|
1460 | 1460 | return false; |
1461 | 1461 | } |
1462 | 1462 | } |
1463 | - public function did_account_checking($str){ |
|
1464 | - $post_array=$this->CI->input->post(); |
|
1465 | - if($str > 0){ |
|
1466 | - $this->CI->db->where("id",$str); |
|
1463 | + public function did_account_checking($str) { |
|
1464 | + $post_array = $this->CI->input->post(); |
|
1465 | + if ($str > 0) { |
|
1466 | + $this->CI->db->where("id", $str); |
|
1467 | 1467 | $this->CI->db->select('posttoexternal,balance,credit_limit'); |
1468 | - $acc_result=$this->CI->db->get('accounts'); |
|
1469 | - $customer_info=(array)$acc_result->first_row(); |
|
1470 | - $available_bal = ($customer_info["posttoexternal"] == 1) ? ($customer_info["credit_limit"] - $customer_info["balance"]) :($customer_info["balance"]); |
|
1471 | - if($available_bal >= $post_array['setup']){ |
|
1468 | + $acc_result = $this->CI->db->get('accounts'); |
|
1469 | + $customer_info = (array)$acc_result->first_row(); |
|
1470 | + $available_bal = ($customer_info["posttoexternal"] == 1) ? ($customer_info["credit_limit"] - $customer_info["balance"]) : ($customer_info["balance"]); |
|
1471 | + if ($available_bal >= $post_array['setup']) { |
|
1472 | 1472 | return TRUE; |
1473 | - }else{ |
|
1473 | + } else { |
|
1474 | 1474 | return FALSE; |
1475 | 1475 | } |
1476 | - }else{ |
|
1476 | + } else { |
|
1477 | 1477 | return TRUE; |
1478 | 1478 | } |
1479 | 1479 | } |
1480 | 1480 | public function phn_number($str) |
1481 | 1481 | { |
1482 | - return (!preg_match('/^[0-9 +-]+$/', $str)) ? FALSE : TRUE; |
|
1482 | + return ( ! preg_match('/^[0-9 +-]+$/', $str)) ? FALSE : TRUE; |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | 1485 | } |
@@ -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; |
@@ -1453,10 +1451,10 @@ discard block |
||
1453 | 1451 | $password=$this->CI->common->decode($result['password']); |
1454 | 1452 | if($password && $password == $str){ |
1455 | 1453 | return true; |
1456 | - }else{ |
|
1454 | + } else{ |
|
1457 | 1455 | return false; |
1458 | 1456 | } |
1459 | - }else{ |
|
1457 | + } else{ |
|
1460 | 1458 | return false; |
1461 | 1459 | } |
1462 | 1460 | } |
@@ -1470,10 +1468,10 @@ discard block |
||
1470 | 1468 | $available_bal = ($customer_info["posttoexternal"] == 1) ? ($customer_info["credit_limit"] - $customer_info["balance"]) :($customer_info["balance"]); |
1471 | 1469 | if($available_bal >= $post_array['setup']){ |
1472 | 1470 | return TRUE; |
1473 | - }else{ |
|
1471 | + } else{ |
|
1474 | 1472 | return FALSE; |
1475 | 1473 | } |
1476 | - }else{ |
|
1474 | + } else{ |
|
1477 | 1475 | return TRUE; |
1478 | 1476 | } |
1479 | 1477 | } |
@@ -758,7 +758,7 @@ |
||
758 | 758 | if ((rand() % 100) < $this->gc_probability) |
759 | 759 | { |
760 | 760 | $expire = $this->now - $this->sess_expiration; |
761 | - $expire = $expire - 60*60*12*1; |
|
761 | + $expire = $expire - 60*60*12*1; |
|
762 | 762 | $this->CI->db->where("last_activity < {$expire}"); |
763 | 763 | $this->CI->db->delete($this->sess_table_name); |
764 | 764 |
@@ -758,7 +758,7 @@ |
||
758 | 758 | if ((rand() % 100) < $this->gc_probability) |
759 | 759 | { |
760 | 760 | $expire = $this->now - $this->sess_expiration; |
761 | - $expire = $expire - 60*60*12*1; |
|
761 | + $expire = $expire - 60 * 60 * 12 * 1; |
|
762 | 762 | $this->CI->db->where("last_activity < {$expire}"); |
763 | 763 | $this->CI->db->delete($this->sess_table_name); |
764 | 764 |
@@ -1959,26 +1959,26 @@ |
||
1959 | 1959 | $msg = ''; |
1960 | 1960 | $msg .= "Date : ".date("F j, Y, g:i a")."\n From :".$data['from']."\n To :".$data['to']."\n Subject :".$data['subject']."\n Attachment :".implode(',',$data['attachment'])."\n"; |
1961 | 1961 | $msg .= "Error : \n" ; |
1962 | - if($this->_get_protocol() == "smtp"){ |
|
1962 | + if($this->_get_protocol() == "smtp"){ |
|
1963 | 1963 | if (count($this->_debug_msg) > 0) |
1964 | - { |
|
1965 | - foreach ($this->_debug_msg as $key=>$val) |
|
1966 | - { |
|
1967 | - if(in_array($key,array(1,2,3,4,5,6,7,8,9,10,11,12,15,16,17,18))){ |
|
1968 | - $msg .= $val; |
|
1969 | - } |
|
1970 | - } |
|
1971 | - } |
|
1972 | - }else{ |
|
1973 | - if (count($this->_debug_msg) > 0) |
|
1974 | - { |
|
1975 | - foreach ($this->_debug_msg as $key=>$val) |
|
1976 | - { |
|
1977 | - $msg .= $val; |
|
1978 | - } |
|
1979 | - } |
|
1980 | - |
|
1981 | - } |
|
1964 | + { |
|
1965 | + foreach ($this->_debug_msg as $key=>$val) |
|
1966 | + { |
|
1967 | + if(in_array($key,array(1,2,3,4,5,6,7,8,9,10,11,12,15,16,17,18))){ |
|
1968 | + $msg .= $val; |
|
1969 | + } |
|
1970 | + } |
|
1971 | + } |
|
1972 | + }else{ |
|
1973 | + if (count($this->_debug_msg) > 0) |
|
1974 | + { |
|
1975 | + foreach ($this->_debug_msg as $key=>$val) |
|
1976 | + { |
|
1977 | + $msg .= $val; |
|
1978 | + } |
|
1979 | + } |
|
1980 | + |
|
1981 | + } |
|
1982 | 1982 | $fp = fopen($log_path."astpp_email.log", "a+"); |
1983 | 1983 | fwrite($fp,$msg); |
1984 | 1984 | fclose($fp); |
@@ -1953,23 +1953,23 @@ discard block |
||
1953 | 1953 | $msg .= "<pre>".$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'</pre>'; |
1954 | 1954 | return $msg; |
1955 | 1955 | } |
1956 | - public function print_debugger_email($data = '',$log_path) |
|
1956 | + public function print_debugger_email($data = '', $log_path) |
|
1957 | 1957 | { |
1958 | 1958 | |
1959 | 1959 | $msg = ''; |
1960 | - $msg .= "Date : ".date("F j, Y, g:i a")."\n From :".$data['from']."\n To :".$data['to']."\n Subject :".$data['subject']."\n Attachment :".implode(',',$data['attachment'])."\n"; |
|
1961 | - $msg .= "Error : \n" ; |
|
1962 | - if($this->_get_protocol() == "smtp"){ |
|
1960 | + $msg .= "Date : ".date("F j, Y, g:i a")."\n From :".$data['from']."\n To :".$data['to']."\n Subject :".$data['subject']."\n Attachment :".implode(',', $data['attachment'])."\n"; |
|
1961 | + $msg .= "Error : \n"; |
|
1962 | + if ($this->_get_protocol() == "smtp") { |
|
1963 | 1963 | if (count($this->_debug_msg) > 0) |
1964 | 1964 | { |
1965 | 1965 | foreach ($this->_debug_msg as $key=>$val) |
1966 | 1966 | { |
1967 | - if(in_array($key,array(1,2,3,4,5,6,7,8,9,10,11,12,15,16,17,18))){ |
|
1967 | + if (in_array($key, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 16, 17, 18))) { |
|
1968 | 1968 | $msg .= $val; |
1969 | 1969 | } |
1970 | 1970 | } |
1971 | 1971 | } |
1972 | - }else{ |
|
1972 | + } else { |
|
1973 | 1973 | if (count($this->_debug_msg) > 0) |
1974 | 1974 | { |
1975 | 1975 | foreach ($this->_debug_msg as $key=>$val) |
@@ -1980,7 +1980,7 @@ discard block |
||
1980 | 1980 | |
1981 | 1981 | } |
1982 | 1982 | $fp = fopen($log_path."astpp_email.log", "a+"); |
1983 | - fwrite($fp,$msg); |
|
1983 | + fwrite($fp, $msg); |
|
1984 | 1984 | fclose($fp); |
1985 | 1985 | return $msg; |
1986 | 1986 | } |
@@ -674,16 +674,13 @@ discard block |
||
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 | } |
@@ -1969,7 +1966,7 @@ discard block |
||
1969 | 1966 | } |
1970 | 1967 | } |
1971 | 1968 | } |
1972 | - }else{ |
|
1969 | + } else{ |
|
1973 | 1970 | if (count($this->_debug_msg) > 0) |
1974 | 1971 | { |
1975 | 1972 | foreach ($this->_debug_msg as $key=>$val) |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | * NOTE: If you change these, also change the error_reporting() code below |
18 | 18 | * |
19 | 19 | */ |
20 | -ini_set ( "date.timezone", "UTC" ); |
|
21 | -define ( 'ENVIRONMENT', 'production' ); |
|
20 | +ini_set("date.timezone", "UTC"); |
|
21 | +define('ENVIRONMENT', 'production'); |
|
22 | 22 | /* |
23 | 23 | * --------------------------------------------------------------- |
24 | 24 | * ERROR REPORTING |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | * By default development will show errors but testing and live will hide them. |
29 | 29 | */ |
30 | 30 | |
31 | -if (defined ( 'ENVIRONMENT' )) { |
|
31 | +if (defined('ENVIRONMENT')) { |
|
32 | 32 | switch (ENVIRONMENT) { |
33 | 33 | case 'development' : |
34 | - error_reporting ( E_ALL ); |
|
34 | + error_reporting(E_ALL); |
|
35 | 35 | break; |
36 | 36 | |
37 | 37 | case 'testing' : |
38 | 38 | case 'production' : |
39 | - error_reporting ( 0 ); |
|
39 | + error_reporting(0); |
|
40 | 40 | break; |
41 | 41 | |
42 | 42 | default : |
43 | - exit ( 'The application environment is not set correctly.' ); |
|
43 | + exit ('The application environment is not set correctly.'); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -140,20 +140,20 @@ discard block |
||
140 | 140 | */ |
141 | 141 | |
142 | 142 | // Set the current directory correctly for CLI requests |
143 | -if (defined ( 'STDIN' )) { |
|
144 | - chdir ( dirname ( __FILE__ ) ); |
|
143 | +if (defined('STDIN')) { |
|
144 | + chdir(dirname(__FILE__)); |
|
145 | 145 | } |
146 | 146 | |
147 | -if (realpath ( $system_path ) !== FALSE) { |
|
148 | - $system_path = realpath ( $system_path ) . '/'; |
|
147 | +if (realpath($system_path) !== FALSE) { |
|
148 | + $system_path = realpath($system_path).'/'; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // ensure there's a trailing slash |
152 | -$system_path = rtrim ( $system_path, '/' ) . '/'; |
|
152 | +$system_path = rtrim($system_path, '/').'/'; |
|
153 | 153 | |
154 | 154 | // Is the system path correct? |
155 | -if (! is_dir ( $system_path )) { |
|
156 | - exit ( "Your system folder path does not appear to be set correctly. Please open the following file and correct this: " . pathinfo ( __FILE__, PATHINFO_BASENAME ) ); |
|
155 | +if ( ! is_dir($system_path)) { |
|
156 | + exit ("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /* |
@@ -162,33 +162,33 @@ discard block |
||
162 | 162 | * ------------------------------------------------------------------- |
163 | 163 | */ |
164 | 164 | // The name of THIS file |
165 | -define ( 'SELF', pathinfo ( __FILE__, PATHINFO_BASENAME ) ); |
|
165 | +define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
|
166 | 166 | |
167 | 167 | // The PHP file extension |
168 | 168 | // this global constant is deprecated. |
169 | -define ( 'EXT', '.php' ); |
|
169 | +define('EXT', '.php'); |
|
170 | 170 | |
171 | 171 | // Path to the system folder |
172 | -define ( 'BASEPATH', str_replace ( "\\", "/", $system_path ) ); |
|
172 | +define('BASEPATH', str_replace("\\", "/", $system_path)); |
|
173 | 173 | |
174 | 174 | // Path to the front controller (this file) |
175 | -define ( 'FCPATH', str_replace ( SELF, '', __FILE__ ) ); |
|
175 | +define('FCPATH', str_replace(SELF, '', __FILE__)); |
|
176 | 176 | |
177 | 177 | // Name of the "system folder" |
178 | -define ( 'SYSDIR', trim ( strrchr ( trim ( BASEPATH, '/' ), '/' ), '/' ) ); |
|
178 | +define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); |
|
179 | 179 | |
180 | 180 | // Name of the "assets folder' |
181 | -define ( 'ASSETSDIR', realpath ( $assets_path ) . '/' ); |
|
181 | +define('ASSETSDIR', realpath($assets_path).'/'); |
|
182 | 182 | |
183 | 183 | // The path to the "application" folder |
184 | -if (is_dir ( $application_folder )) { |
|
185 | - define ( 'APPPATH', $application_folder . '/' ); |
|
184 | +if (is_dir($application_folder)) { |
|
185 | + define('APPPATH', $application_folder.'/'); |
|
186 | 186 | } else { |
187 | - if (! is_dir ( BASEPATH . $application_folder . '/' )) { |
|
188 | - exit ( "Your application folder path does not appear to be set correctly. Please open the following file and correct this: " . SELF ); |
|
187 | + if ( ! is_dir(BASEPATH.$application_folder.'/')) { |
|
188 | + exit ("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF); |
|
189 | 189 | } |
190 | 190 | |
191 | - define ( 'APPPATH', BASEPATH . $application_folder . '/' ); |
|
191 | + define('APPPATH', BASEPATH.$application_folder.'/'); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /* |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * And away we go... |
200 | 200 | * |
201 | 201 | */ |
202 | -require_once BASEPATH . 'core/CodeIgniter.php'; |
|
202 | +require_once BASEPATH.'core/CodeIgniter.php'; |
|
203 | 203 | |
204 | 204 | /* End of file index.php */ |
205 | 205 | /* Location: ./index.php */ |