@@ -20,8 +20,9 @@ |
||
| 20 | 20 | # You should have received a copy of the GNU Affero General Public License |
| 21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | ############################################################################### |
| 23 | -if (!defined('BASEPATH')) |
|
| 23 | +if (!defined('BASEPATH')) { |
|
| 24 | 24 | exit('No direct script access allowed'); |
| 25 | +} |
|
| 25 | 26 | |
| 26 | 27 | class Refill_coupon_form { |
| 27 | 28 | function __construct($library_name = '') { |
@@ -20,8 +20,9 @@ |
||
| 20 | 20 | # You should have received a copy of the GNU Affero General Public License |
| 21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | ############################################################################### |
| 23 | -if (!defined('BASEPATH')) |
|
| 23 | +if (!defined('BASEPATH')) { |
|
| 24 | 24 | exit('No direct script access allowed'); |
| 25 | +} |
|
| 25 | 26 | |
| 26 | 27 | class Refill_coupon_form { |
| 27 | 28 | function __construct($library_name = '') { |
@@ -25,8 +25,9 @@ |
||
| 25 | 25 | function __construct() |
| 26 | 26 | { |
| 27 | 27 | parent::__construct(); |
| 28 | - if(!defined( 'CRON' ) ) |
|
| 29 | - exit(); |
|
| 28 | + if(!defined( 'CRON' ) ) { |
|
| 29 | + exit(); |
|
| 30 | + } |
|
| 30 | 31 | $this->load->model("db_model"); |
| 31 | 32 | $this->load->library("astpp/common"); |
| 32 | 33 | } |
@@ -25,8 +25,9 @@ |
||
| 25 | 25 | function __construct() |
| 26 | 26 | { |
| 27 | 27 | parent::__construct(); |
| 28 | - if(!defined( 'CRON' ) ) |
|
| 29 | - exit(); |
|
| 28 | + if(!defined( 'CRON' ) ) { |
|
| 29 | + exit(); |
|
| 30 | + } |
|
| 30 | 31 | $this->load->model("db_model"); |
| 31 | 32 | $this->load->library("astpp/common"); |
| 32 | 33 | } |
@@ -20,8 +20,9 @@ |
||
| 20 | 20 | # You should have received a copy of the GNU Affero General Public License |
| 21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | ############################################################################### |
| 23 | -if (!defined('BASEPATH')) |
|
| 23 | +if (!defined('BASEPATH')) { |
|
| 24 | 24 | exit('No direct script access allowed'); |
| 25 | +} |
|
| 25 | 26 | |
| 26 | 27 | class Refill_coupon_form { |
| 27 | 28 | function __construct($library_name = '') { |
@@ -51,10 +51,11 @@ discard block |
||
| 51 | 51 | $this->db->where("id", $id); |
| 52 | 52 | $query = $this->db->get("system"); |
| 53 | 53 | |
| 54 | - if ($query->num_rows() > 0) |
|
| 55 | - return $query->row_array(); |
|
| 56 | - else |
|
| 57 | - return false; |
|
| 54 | + if ($query->num_rows() > 0) { |
|
| 55 | + return $query->row_array(); |
|
| 56 | + } else { |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 58 | 59 | } |
| 59 | 60 | |
| 60 | 61 | function remove_config($data) { |
@@ -89,10 +90,11 @@ discard block |
||
| 89 | 90 | $this->db->where("taxes_id", $id); |
| 90 | 91 | $query = $this->db->get("taxes"); |
| 91 | 92 | |
| 92 | - if ($query->num_rows() > 0) |
|
| 93 | - return $query->row_array(); |
|
| 94 | - else |
|
| 95 | - return false; |
|
| 93 | + if ($query->num_rows() > 0) { |
|
| 94 | + return $query->row_array(); |
|
| 95 | + } else { |
|
| 96 | + return false; |
|
| 97 | + } |
|
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | function remove_tax($data) { |
@@ -373,10 +375,11 @@ discard block |
||
| 373 | 375 | function get_template_by_id_all($id) { |
| 374 | 376 | $this->db->where('id', $id); |
| 375 | 377 | $query = $this->db->get('templates'); |
| 376 | - if ($query->num_rows() > 0) |
|
| 377 | - return $query->row_array(); |
|
| 378 | - else |
|
| 379 | - return false; |
|
| 378 | + if ($query->num_rows() > 0) { |
|
| 379 | + return $query->row_array(); |
|
| 380 | + } else { |
|
| 381 | + return false; |
|
| 382 | + } |
|
| 380 | 383 | } |
| 381 | 384 | |
| 382 | 385 | function edit_template($edit_id, $data) { |
@@ -48,10 +48,11 @@ discard block |
||
| 48 | 48 | function save($tableName, $arr, $val = 'false') { |
| 49 | 49 | $str = $this->db->insert_string($tableName, $arr); |
| 50 | 50 | $rs = $this->db->query($str); |
| 51 | - if ($val == true) |
|
| 52 | - return $this->db->insert_id(); |
|
| 53 | - else |
|
| 54 | - return $rs; |
|
| 51 | + if ($val == true) { |
|
| 52 | + return $this->db->insert_id(); |
|
| 53 | + } else { |
|
| 54 | + return $rs; |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | /* * ******************************************************** |
@@ -134,15 +135,18 @@ discard block |
||
| 134 | 135 | $this->db->where($where); |
| 135 | 136 | } |
| 136 | 137 | |
| 137 | - if ($paging_limit) |
|
| 138 | - $this->db->limit($paging_limit, $start_limit); |
|
| 139 | - if (!empty($groupby)) |
|
| 140 | - $this->db->group_by($groupby); |
|
| 138 | + if ($paging_limit) { |
|
| 139 | + $this->db->limit($paging_limit, $start_limit); |
|
| 140 | + } |
|
| 141 | + if (!empty($groupby)) { |
|
| 142 | + $this->db->group_by($groupby); |
|
| 143 | + } |
|
| 141 | 144 | if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
| 142 | 145 | $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
| 143 | - }else{ |
|
| 144 | - if($order_by) |
|
| 145 | - $this->db->order_by($order_by, $order_type); |
|
| 146 | + } else{ |
|
| 147 | + if($order_by) { |
|
| 148 | + $this->db->order_by($order_by, $order_type); |
|
| 149 | + } |
|
| 146 | 150 | } |
| 147 | 151 | $query = $this->db->get(); |
| 148 | 152 | return $query; |
@@ -160,10 +164,12 @@ discard block |
||
| 160 | 164 | } |
| 161 | 165 | $this->db->where_in($key, $where_in); |
| 162 | 166 | $this->db->order_by($order_by, $order_type); |
| 163 | - if ($paging_limit) |
|
| 164 | - $this->db->limit($paging_limit, $start_limit); |
|
| 165 | - if (!empty($groupby)) |
|
| 166 | - $this->db->groupby($groupby); |
|
| 167 | + if ($paging_limit) { |
|
| 168 | + $this->db->limit($paging_limit, $start_limit); |
|
| 169 | + } |
|
| 170 | + if (!empty($groupby)) { |
|
| 171 | + $this->db->groupby($groupby); |
|
| 172 | + } |
|
| 167 | 173 | $query = $this->db->get(); |
| 168 | 174 | |
| 169 | 175 | return $query; |
@@ -254,9 +260,10 @@ discard block |
||
| 254 | 260 | } |
| 255 | 261 | if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
| 256 | 262 | $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
| 257 | - }else{ |
|
| 258 | - if($order_by) |
|
| 259 | - $this->db->order_by($order_by, $order_type); |
|
| 263 | + } else{ |
|
| 264 | + if($order_by) { |
|
| 265 | + $this->db->order_by($order_by, $order_type); |
|
| 266 | + } |
|
| 260 | 267 | } |
| 261 | 268 | |
| 262 | 269 | if ($group_by != '') { |
@@ -306,9 +313,10 @@ discard block |
||
| 306 | 313 | } |
| 307 | 314 | if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
| 308 | 315 | $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
| 309 | - }else{ |
|
| 310 | - if($order_by) |
|
| 311 | - $this->db->order_by($order_by, $order_type); |
|
| 316 | + } else{ |
|
| 317 | + if($order_by) { |
|
| 318 | + $this->db->order_by($order_by, $order_type); |
|
| 319 | + } |
|
| 312 | 320 | } |
| 313 | 321 | |
| 314 | 322 | if ($group_by != '') { |
@@ -572,7 +580,7 @@ discard block |
||
| 572 | 580 | $name=explode("as",$select); |
| 573 | 581 | if(isset($name[3])){ |
| 574 | 582 | $name=trim($name[3]); |
| 575 | - }else{ |
|
| 583 | + } else{ |
|
| 576 | 584 | $name=trim($name[1]); |
| 577 | 585 | } |
| 578 | 586 | |
@@ -583,7 +591,7 @@ discard block |
||
| 583 | 591 | if(isset($dele[1])) |
| 584 | 592 | { |
| 585 | 593 | $drp_list['Deleted'][$drp_value->$select_params[0]] = str_replace("^","",$drp_value->$name); |
| 586 | - }else{ |
|
| 594 | + } else{ |
|
| 587 | 595 | $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name; |
| 588 | 596 | } |
| 589 | 597 | } |
@@ -645,7 +653,7 @@ discard block |
||
| 645 | 653 | if($field == 'invoice_date'){ |
| 646 | 654 | $this->db->where($field . ' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01"); |
| 647 | 655 | $this->db->where($field . ' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59"); |
| 648 | - }else{ |
|
| 656 | + } else{ |
|
| 649 | 657 | $this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0]))); |
| 650 | 658 | } |
| 651 | 659 | } |
@@ -734,20 +742,23 @@ discard block |
||
| 734 | 742 | if (array_key_exists($key . "-integer", $value)) { |
| 735 | 743 | $string=null; |
| 736 | 744 | $string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]); |
| 737 | - if($string) |
|
| 738 | - $where.= "$string AND "; |
|
| 745 | + if($string) { |
|
| 746 | + $where.= "$string AND "; |
|
| 747 | + } |
|
| 739 | 748 | } |
| 740 | 749 | if (array_key_exists($key . "-string", $value)) { |
| 741 | 750 | $string=null; |
| 742 | 751 | $string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]); |
| 743 | - if($string) |
|
| 744 | - $where.= "$string AND "; |
|
| 752 | + if($string) { |
|
| 753 | + $where.= "$string AND "; |
|
| 754 | + } |
|
| 745 | 755 | } |
| 746 | 756 | if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') { |
| 747 | 757 | $string=null; |
| 748 | 758 | $string=$this->build_date_where($key, $value); |
| 749 | - if($string) |
|
| 750 | - $where.= "$string AND "; |
|
| 759 | + if($string) { |
|
| 760 | + $where.= "$string AND "; |
|
| 761 | + } |
|
| 751 | 762 | } |
| 752 | 763 | } else { |
| 753 | 764 | $where.="$key = '$value'AND "; |
@@ -779,14 +790,14 @@ discard block |
||
| 779 | 790 | case "5": |
| 780 | 791 | if($field == "pattern"){ |
| 781 | 792 | $where = $field . " LIKE '^".$search_array."%'"; |
| 782 | - }else{ |
|
| 793 | + } else{ |
|
| 783 | 794 | $where = $field . " LIKE '".$search_array."%'"; |
| 784 | 795 | } |
| 785 | 796 | break; |
| 786 | 797 | case "6": |
| 787 | 798 | if($field == "pattern"){ |
| 788 | 799 | $str1 = $field . " LIKE '%".$search_array.".*'"; |
| 789 | - }else{ |
|
| 800 | + } else{ |
|
| 790 | 801 | $str1 = $field . " LIKE '%".$search_array."'"; |
| 791 | 802 | } |
| 792 | 803 | break; |
@@ -820,8 +831,7 @@ discard block |
||
| 820 | 831 | $where = "$field <= '$search_array'"; |
| 821 | 832 | break; |
| 822 | 833 | } |
| 823 | - } |
|
| 824 | - else |
|
| 834 | + } else |
|
| 825 | 835 | { |
| 826 | 836 | $this->db->where("$field IS NULL"); |
| 827 | 837 | $where= "$field IS NULL"; |
@@ -835,14 +845,16 @@ discard block |
||
| 835 | 845 | if (!empty($value[0])) { |
| 836 | 846 | $string=null; |
| 837 | 847 | $string="$field >= '$value[0]'"; |
| 838 | - if($string) |
|
| 839 | - $where.=$string." AND "; |
|
| 848 | + if($string) { |
|
| 849 | + $where.=$string." AND "; |
|
| 850 | + } |
|
| 840 | 851 | } |
| 841 | 852 | if (!empty($value[1])) { |
| 842 | 853 | $string=null; |
| 843 | 854 | $string="$field <= '$value[1]'"; |
| 844 | - if($string) |
|
| 845 | - $where.=$string." AND "; |
|
| 855 | + if($string) { |
|
| 856 | + $where.=$string." AND "; |
|
| 857 | + } |
|
| 846 | 858 | } |
| 847 | 859 | } |
| 848 | 860 | if($where){ |
@@ -994,9 +1006,9 @@ discard block |
||
| 994 | 1006 | if($drp_value->type == 3) |
| 995 | 1007 | { |
| 996 | 1008 | $drp_list['Provider'][$drp_value->id] = $drp_value->first_name; |
| 997 | - }elseif($drp_value->type == 1){ |
|
| 1009 | + } elseif($drp_value->type == 1){ |
|
| 998 | 1010 | $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name; |
| 999 | - }else{ |
|
| 1011 | + } else{ |
|
| 1000 | 1012 | $drp_list['Customer'][$drp_value->id] = $drp_value->first_name; |
| 1001 | 1013 | } |
| 1002 | 1014 | } |
@@ -127,8 +127,9 @@ discard block |
||
| 127 | 127 | $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1; |
| 128 | 128 | $amount = str_replace( ',', '', $amount ); |
| 129 | 129 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
| 130 | - if ($format_currency) |
|
| 131 | - $cal_amount = $this->format_currency($cal_amount); |
|
| 130 | + if ($format_currency) { |
|
| 131 | + $cal_amount = $this->format_currency($cal_amount); |
|
| 132 | + } |
|
| 132 | 133 | if ($append_currency){ |
| 133 | 134 | $cal_amount = $cal_amount . " " . $to_currency; |
| 134 | 135 | } |
@@ -146,10 +147,12 @@ discard block |
||
| 146 | 147 | $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1; |
| 147 | 148 | $amount = str_replace( ',', '', $amount ); |
| 148 | 149 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
| 149 | - if ($format_currency) |
|
| 150 | - $cal_amount = $this->format_currency($cal_amount); |
|
| 151 | - if ($append_currency) |
|
| 152 | - $cal_amount = $cal_amount ; |
|
| 150 | + if ($format_currency) { |
|
| 151 | + $cal_amount = $this->format_currency($cal_amount); |
|
| 152 | + } |
|
| 153 | + if ($append_currency) { |
|
| 154 | + $cal_amount = $cal_amount ; |
|
| 155 | + } |
|
| 153 | 156 | $cal_amount = str_replace( ',', '', $cal_amount ); |
| 154 | 157 | return $cal_amount; |
| 155 | 158 | } |
@@ -163,13 +166,15 @@ discard block |
||
| 163 | 166 | $to_currency = ($to_currency == '') ? self::$global_config['system_config']['base_currency'] : $to_currency; |
| 164 | 167 | if(self::$global_config['currency_list'][$from_currency] > 0){ |
| 165 | 168 | $cal_amount = ($amount * self::$global_config['currency_list'][$to_currency]) / self::$global_config['currency_list'][$from_currency]; |
| 166 | - }else{ |
|
| 169 | + } else{ |
|
| 167 | 170 | $cal_amount=$amount; |
| 168 | 171 | } |
| 169 | - if ($format_currency) |
|
| 170 | - $cal_amount = $this->format_currency($cal_amount); |
|
| 171 | - if ($append_currency) |
|
| 172 | - $cal_amount = $cal_amount . " " . $to_currency; |
|
| 172 | + if ($format_currency) { |
|
| 173 | + $cal_amount = $this->format_currency($cal_amount); |
|
| 174 | + } |
|
| 175 | + if ($append_currency) { |
|
| 176 | + $cal_amount = $cal_amount . " " . $to_currency; |
|
| 177 | + } |
|
| 173 | 178 | $cal_amount = str_replace( ',', '', $cal_amount ); |
| 174 | 179 | return $cal_amount; |
| 175 | 180 | } |
@@ -185,10 +190,12 @@ discard block |
||
| 185 | 190 | $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1; |
| 186 | 191 | $amount = str_replace( ',', '', $amount ); |
| 187 | 192 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
| 188 | - if ($format_currency) |
|
| 189 | - $cal_amount = $this->format_currency($cal_amount); |
|
| 190 | - if ($append_currency) |
|
| 191 | - $cal_amount = $cal_amount . " " . $to_currency; |
|
| 193 | + if ($format_currency) { |
|
| 194 | + $cal_amount = $this->format_currency($cal_amount); |
|
| 195 | + } |
|
| 196 | + if ($append_currency) { |
|
| 197 | + $cal_amount = $cal_amount . " " . $to_currency; |
|
| 198 | + } |
|
| 192 | 199 | $cal_amount = str_replace( ',', '', $cal_amount ); |
| 193 | 200 | return $cal_amount; |
| 194 | 201 | } |
@@ -318,7 +325,7 @@ discard block |
||
| 318 | 325 | $account_result=(array)$account_result->first_row(); |
| 319 | 326 | if(isset($account_result['reseller_id']) && $account_result['reseller_id']> 0){ |
| 320 | 327 | return $account_result['reseller_id']; |
| 321 | - }else{ |
|
| 328 | + } else{ |
|
| 322 | 329 | return '0'; |
| 323 | 330 | } |
| 324 | 331 | |
@@ -38,27 +38,34 @@ |
||
| 38 | 38 | public function load($langfile, $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '') {
|
| 39 | 39 | |
| 40 | 40 | if (is_array($langfile)) {
|
| 41 | - foreach ($langfile as $_lang) $this->load($_lang); |
|
| 41 | + foreach ($langfile as $_lang) { |
|
| 42 | + $this->load($_lang); |
|
| 43 | + } |
|
| 42 | 44 | return $this->language; |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | 47 | $deft_lang = CI::$APP->config->item('language');
|
| 46 | 48 | $idiom = ($lang == '') ? $deft_lang : $lang; |
| 47 | 49 | |
| 48 | - if (in_array($langfile.'_lang'.EXT, $this->is_loaded, TRUE)) |
|
| 49 | - return $this->language; |
|
| 50 | + if (in_array($langfile.'_lang'.EXT, $this->is_loaded, TRUE)) { |
|
| 51 | + return $this->language; |
|
| 52 | + } |
|
| 50 | 53 | |
| 51 | 54 | $_module OR $_module = CI::$APP->router->fetch_module(); |
| 52 | 55 | list($path, $_langfile) = Modules::find($langfile.'_lang', $_module, 'language/'.$idiom.'/'); |
| 53 | 56 | |
| 54 | 57 | if ($path === FALSE) {
|
| 55 | 58 | |
| 56 | - if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) return $lang; |
|
| 59 | + if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) { |
|
| 60 | + return $lang; |
|
| 61 | + } |
|
| 57 | 62 | |
| 58 | 63 | } else {
|
| 59 | 64 | |
| 60 | 65 | if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
|
| 61 | - if ($return) return $lang; |
|
| 66 | + if ($return) { |
|
| 67 | + return $lang; |
|
| 68 | + } |
|
| 62 | 69 | $this->language = array_merge($this->language, $lang); |
| 63 | 70 | $this->is_loaded[] = $langfile.'_lang'.EXT; |
| 64 | 71 | unset($lang); |