@@ -141,18 +141,23 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function languages($languages) {
|
| 144 | - foreach ($languages as $_language) $this->language($_language); |
|
| 144 | + foreach ($languages as $_language) { |
|
| 145 | + $this->language($_language); |
|
| 146 | + } |
|
| 145 | 147 | } |
| 146 | 148 | |
| 147 | 149 | /** Load a module library **/ |
| 148 | 150 | public function library($library = '', $params = NULL, $object_name = NULL) {
|
| 149 | 151 | |
| 150 | - if (is_array($library)) return $this->libraries($library); |
|
| 152 | + if (is_array($library)) { |
|
| 153 | + return $this->libraries($library); |
|
| 154 | + } |
|
| 151 | 155 | |
| 152 | 156 | $class = strtolower(basename($library)); |
| 153 | 157 | |
| 154 | - if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class]) |
|
| 155 | - return CI::$APP->$_alias; |
|
| 158 | + if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class]) { |
|
| 159 | + return CI::$APP->$_alias; |
|
| 160 | + } |
|
| 156 | 161 | |
| 157 | 162 | ($_alias = strtolower($object_name)) OR $_alias = $class; |
| 158 | 163 | |
@@ -234,13 +239,17 @@ discard block |
||
| 234 | 239 | |
| 235 | 240 | /** Load an array of models **/ |
| 236 | 241 | public function models($models) {
|
| 237 | - foreach ($models as $_model) $this->model($_model); |
|
| 242 | + foreach ($models as $_model) { |
|
| 243 | + $this->model($_model); |
|
| 244 | + } |
|
| 238 | 245 | } |
| 239 | 246 | |
| 240 | 247 | /** Load a module controller **/ |
| 241 | 248 | public function module($module, $params = NULL) {
|
| 242 | 249 | |
| 243 | - if (is_array($module)) return $this->modules($module); |
|
| 250 | + if (is_array($module)) { |
|
| 251 | + return $this->modules($module); |
|
| 252 | + } |
|
| 244 | 253 | |
| 245 | 254 | $_alias = strtolower(basename($module)); |
| 246 | 255 | CI::$APP->$_alias = Modules::load(array($module => $params)); |
@@ -249,16 +258,21 @@ discard block |
||
| 249 | 258 | |
| 250 | 259 | /** Load an array of controllers **/ |
| 251 | 260 | public function modules($modules) {
|
| 252 | - foreach ($modules as $_module) $this->module($_module); |
|
| 261 | + foreach ($modules as $_module) { |
|
| 262 | + $this->module($_module); |
|
| 263 | + } |
|
| 253 | 264 | } |
| 254 | 265 | |
| 255 | 266 | /** Load a module plugin **/ |
| 256 | 267 | public function plugin($plugin) {
|
| 257 | 268 | |
| 258 | - if (is_array($plugin)) return $this->plugins($plugin); |
|
| 269 | + if (is_array($plugin)) { |
|
| 270 | + return $this->plugins($plugin); |
|
| 271 | + } |
|
| 259 | 272 | |
| 260 | - if (isset($this->_ci_plugins[$plugin])) |
|
| 261 | - return; |
|
| 273 | + if (isset($this->_ci_plugins[$plugin])) { |
|
| 274 | + return; |
|
| 275 | + } |
|
| 262 | 276 | |
| 263 | 277 | list($path, $_plugin) = Modules::find($plugin.'_pi', $this->_module, 'plugins/'); |
| 264 | 278 | |
@@ -314,20 +328,26 @@ discard block |
||
| 314 | 328 | break; |
| 315 | 329 | } |
| 316 | 330 | |
| 317 | - if ( ! $cascade) break; |
|
| 331 | + if ( ! $cascade) { |
|
| 332 | + break; |
|
| 333 | + } |
|
| 318 | 334 | } |
| 319 | 335 | |
| 320 | 336 | } elseif (isset($_ci_path)) {
|
| 321 | 337 | |
| 322 | 338 | $_ci_file = basename($_ci_path); |
| 323 | - if ( ! file_exists($_ci_path)) $_ci_path = ''; |
|
| 339 | + if ( ! file_exists($_ci_path)) { |
|
| 340 | + $_ci_path = ''; |
|
| 341 | + } |
|
| 324 | 342 | } |
| 325 | 343 | |
| 326 | - if (empty($_ci_path)) |
|
| 327 | - show_error('Unable to load the requested file: '.$_ci_file);
|
|
| 344 | + if (empty($_ci_path)) { |
|
| 345 | + show_error('Unable to load the requested file: '.$_ci_file); |
|
| 346 | + } |
|
| 328 | 347 | |
| 329 | - if (isset($_ci_vars)) |
|
| 330 | - $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars); |
|
| 348 | + if (isset($_ci_vars)) { |
|
| 349 | + $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars); |
|
| 350 | + } |
|
| 331 | 351 | |
| 332 | 352 | extract($this->_ci_cached_vars); |
| 333 | 353 | |
@@ -31,11 +31,11 @@ |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - function customer_list_status($id){ |
|
| 34 | + function customer_list_status($id) { |
|
| 35 | 35 | $post_data = $this->input->post(); |
| 36 | - $post_data['table']=$this->common->decode($post_data['table']); |
|
| 37 | - $data['status']=$post_data['status'] =='true'? 0:1; |
|
| 38 | - $result=$post_data['table'] =='accounts' && $post_data['id'] == 1 ? null:$this->db->update($post_data['table'],$data,array("id"=>$post_data['id'])); |
|
| 36 | + $post_data['table'] = $this->common->decode($post_data['table']); |
|
| 37 | + $data['status'] = $post_data['status'] == 'true' ? 0 : 1; |
|
| 38 | + $result = $post_data['table'] == 'accounts' && $post_data['id'] == 1 ? null : $this->db->update($post_data['table'], $data, array("id"=>$post_data['id'])); |
|
| 39 | 39 | echo TRUE; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -25,19 +25,19 @@ |
||
| 25 | 25 | function __construct() |
| 26 | 26 | { |
| 27 | 27 | parent::__construct(); |
| 28 | - if(!defined( 'CRON' ) ) |
|
| 28 | + if ( ! defined('CRON')) |
|
| 29 | 29 | exit(); |
| 30 | 30 | $this->load->model("db_model"); |
| 31 | 31 | $this->load->library("astpp/common"); |
| 32 | 32 | } |
| 33 | - function low_creditlimit(){ |
|
| 34 | - $where = array("posttoexternal"=>1,"deleted" => "0","status"=>"0"); |
|
| 33 | + function low_creditlimit() { |
|
| 34 | + $where = array("posttoexternal"=>1, "deleted" => "0", "status"=>"0"); |
|
| 35 | 35 | $query = $this->db_model->getSelect("*", "accounts", $where); |
| 36 | - if($query->num_rows >0){ |
|
| 36 | + if ($query->num_rows > 0) { |
|
| 37 | 37 | $account_data = $query->result_array(); |
| 38 | - foreach($account_data as $data_key =>$account_value){ |
|
| 39 | - if(($account_value["balance"]) >= $account_value["credit_limit"]){ |
|
| 40 | - $this->common->mail_to_users("email_low_balance",$account_value); |
|
| 38 | + foreach ($account_data as $data_key =>$account_value) { |
|
| 39 | + if (($account_value["balance"]) >= $account_value["credit_limit"]) { |
|
| 40 | + $this->common->mail_to_users("email_low_balance", $account_value); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -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,19 +25,19 @@ |
||
| 25 | 25 | function __construct() |
| 26 | 26 | { |
| 27 | 27 | parent::__construct(); |
| 28 | - if(!defined( 'CRON' ) ) |
|
| 28 | + if ( ! defined('CRON')) |
|
| 29 | 29 | exit(); |
| 30 | 30 | $this->load->model("db_model"); |
| 31 | 31 | $this->load->library("astpp/common"); |
| 32 | 32 | } |
| 33 | - function low_balance(){ |
|
| 34 | - $where = array("posttoexternal"=>0,"notify_flag"=>0,"deleted" => "0","status"=>"0"); |
|
| 33 | + function low_balance() { |
|
| 34 | + $where = array("posttoexternal"=>0, "notify_flag"=>0, "deleted" => "0", "status"=>"0"); |
|
| 35 | 35 | $query = $this->db_model->getSelect("*", "accounts", $where); |
| 36 | - if($query->num_rows >0){ |
|
| 36 | + if ($query->num_rows > 0) { |
|
| 37 | 37 | $account_data = $query->result_array(); |
| 38 | - foreach($account_data as $data_key =>$accountinfo){ |
|
| 39 | - if(($accountinfo["balance"]) <= $accountinfo["notify_credit_limit"]){ |
|
| 40 | - $this->common->mail_to_users("email_low_balance",$accountinfo); |
|
| 38 | + foreach ($account_data as $data_key =>$accountinfo) { |
|
| 39 | + if (($accountinfo["balance"]) <= $accountinfo["notify_credit_limit"]) { |
|
| 40 | + $this->common->mail_to_users("email_low_balance", $accountinfo); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -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 | } |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | function __construct() |
| 42 | 42 | { |
| 43 | 43 | parent::__construct(); |
| 44 | - if ( ! defined('CRON')) |
|
| 45 | - exit(); |
|
| 44 | + if ( ! defined('CRON')) { |
|
| 45 | + exit(); |
|
| 46 | + } |
|
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | |
@@ -76,8 +77,9 @@ discard block |
||
| 76 | 77 | function generate_sitemap() |
| 77 | 78 | { |
| 78 | 79 | // Live Mode: |
| 79 | - if ( ! CRON_BETA_MODE) |
|
| 80 | - $cron_id = $this->cron->create('Sitemap (Google|Bing|Ask|Yahoo!)'); |
|
| 80 | + if ( ! CRON_BETA_MODE) { |
|
| 81 | + $cron_id = $this->cron->create('Sitemap (Google|Bing|Ask|Yahoo!)'); |
|
| 82 | + } |
|
| 81 | 83 | |
| 82 | 84 | // Example Code |
| 83 | 85 | |
@@ -89,8 +91,9 @@ discard block |
||
| 89 | 91 | // ... |
| 90 | 92 | |
| 91 | 93 | // Sandbox Mode: |
| 92 | - if (CRON_BETA_MODE) |
|
| 93 | - $this->sitemap->generate_xml(null, false); |
|
| 94 | + if (CRON_BETA_MODE) { |
|
| 95 | + $this->sitemap->generate_xml(null, false); |
|
| 96 | + } |
|
| 94 | 97 | |
| 95 | 98 | // Live Mode: |
| 96 | 99 | else { |
@@ -31,83 +31,83 @@ |
||
| 31 | 31 | $this->load->model('db_model'); |
| 32 | 32 | $this->load->model('Astpp_common'); |
| 33 | 33 | } |
| 34 | - function index($sipnumber=''){ |
|
| 35 | - $opensips_flag=common_model::$global_config['system_config']['opensips']; |
|
| 36 | - $accountid_arr=0; |
|
| 37 | - if($opensips_flag == '1'){ |
|
| 38 | - $where=array('username'=>$sipnumber); |
|
| 39 | - $accountid_arr=$this->db_model->getSelect('accountid','sip_devices',$where); |
|
| 34 | + function index($sipnumber = '') { |
|
| 35 | + $opensips_flag = common_model::$global_config['system_config']['opensips']; |
|
| 36 | + $accountid_arr = 0; |
|
| 37 | + if ($opensips_flag == '1') { |
|
| 38 | + $where = array('username'=>$sipnumber); |
|
| 39 | + $accountid_arr = $this->db_model->getSelect('accountid', 'sip_devices', $where); |
|
| 40 | 40 | } |
| 41 | - else{ |
|
| 41 | + else { |
|
| 42 | 42 | $db_config = Common_model::$global_config['system_config']; |
| 43 | - $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
| 43 | + $opensipdsn = "mysql://".$db_config['opensips_dbuser'].":".$db_config['opensips_dbpass']."@".$db_config['opensips_dbhost']."/".$db_config['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
| 44 | 44 | $this->opensips_db = $this->load->database($opensipdsn, true); |
| 45 | 45 | $this->opensips_db->where(array("username"=>$sipnumber)); |
| 46 | - $accountnum_arr=$this->opensips_db->get("subscriber"); |
|
| 47 | - $accountnum_arr=$accountnum_arr->result_array(); |
|
| 48 | - foreach($accountnum_arr as $value_num){ |
|
| 49 | - $accountid_arr = $this->db_model->getSelect('id','accounts',array('number'=>$value_num['accountcode'])); |
|
| 46 | + $accountnum_arr = $this->opensips_db->get("subscriber"); |
|
| 47 | + $accountnum_arr = $accountnum_arr->result_array(); |
|
| 48 | + foreach ($accountnum_arr as $value_num) { |
|
| 49 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', array('number'=>$value_num['accountcode'])); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | - if($accountid_arr == ''){ |
|
| 52 | + if ($accountid_arr == '') { |
|
| 53 | 53 | echo "Please enter proper username of SIP Account"; |
| 54 | 54 | } |
| 55 | - if($accountid_arr->num_rows()==0 ){ |
|
| 56 | - $where=array('number'=>$sipnumber); |
|
| 57 | - $accountid_arr=$this->db_model->getSelect('id','accounts',$where); |
|
| 55 | + if ($accountid_arr->num_rows() == 0) { |
|
| 56 | + $where = array('number'=>$sipnumber); |
|
| 57 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', $where); |
|
| 58 | 58 | } |
| 59 | - if($accountid_arr->num_rows()>0){ |
|
| 60 | - $accountid_arr=$accountid_arr->result_array(); |
|
| 61 | - if($opensips_flag == '1'){ |
|
| 62 | - foreach($accountid_arr[0] as $key=>$value){ |
|
| 59 | + if ($accountid_arr->num_rows() > 0) { |
|
| 60 | + $accountid_arr = $accountid_arr->result_array(); |
|
| 61 | + if ($opensips_flag == '1') { |
|
| 62 | + foreach ($accountid_arr[0] as $key=>$value) { |
|
| 63 | 63 | } |
| 64 | - if($key== 'id'){ |
|
| 65 | - $accountid=$accountid_arr[0]['id']; |
|
| 66 | - } else{ |
|
| 67 | - $accountid=$accountid_arr[0]['accountid']; |
|
| 64 | + if ($key == 'id') { |
|
| 65 | + $accountid = $accountid_arr[0]['id']; |
|
| 66 | + } else { |
|
| 67 | + $accountid = $accountid_arr[0]['accountid']; |
|
| 68 | 68 | } |
| 69 | - } else{ |
|
| 70 | - $accountid=$accountid_arr[0]['id']; |
|
| 69 | + } else { |
|
| 70 | + $accountid = $accountid_arr[0]['id']; |
|
| 71 | 71 | } |
| 72 | 72 | $to_currency = common_model::$global_config['system_config']['base_currency']; |
| 73 | - if($accountid > 0){ |
|
| 74 | - $where=array('id'=>$accountid); |
|
| 75 | - $balance=$this->db_model->getSelect('balance,currency_id','accounts',$where); |
|
| 76 | - if($balance->num_rows() > 0){ |
|
| 73 | + if ($accountid > 0) { |
|
| 74 | + $where = array('id'=>$accountid); |
|
| 75 | + $balance = $this->db_model->getSelect('balance,currency_id', 'accounts', $where); |
|
| 76 | + if ($balance->num_rows() > 0) { |
|
| 77 | 77 | //get balance,currency using by user from account number. |
| 78 | 78 | $balance_arr = $balance->result_array(); |
| 79 | - $balance=$balance_arr['0']['balance']; |
|
| 80 | - $currency=$balance_arr['0']['currency_id']; |
|
| 79 | + $balance = $balance_arr['0']['balance']; |
|
| 80 | + $currency = $balance_arr['0']['currency_id']; |
|
| 81 | 81 | //Get Base Currency From System which is main currency of system. |
| 82 | - $base_currency_arr=$this->db_model->getSelect('value','system',array('name'=>'base_currency')); |
|
| 83 | - $base_currency_arr=$base_currency_arr->result_array(); |
|
| 84 | - $base_currency=$base_currency_arr['0']['value']; |
|
| 82 | + $base_currency_arr = $this->db_model->getSelect('value', 'system', array('name'=>'base_currency')); |
|
| 83 | + $base_currency_arr = $base_currency_arr->result_array(); |
|
| 84 | + $base_currency = $base_currency_arr['0']['value']; |
|
| 85 | 85 | //Get basse Currency rate from Currency Name. |
| 86 | - $base_currency_info=$this->db_model->getSelect('*','currency',array('currency'=>$base_currency)); |
|
| 87 | - $base_currency_info=$base_currency_info->result_array(); |
|
| 88 | - $base_currency_rate=$base_currency_info['0']['currencyrate']; |
|
| 89 | - $base_currency_name=$base_currency_info['0']['currency']; |
|
| 86 | + $base_currency_info = $this->db_model->getSelect('*', 'currency', array('currency'=>$base_currency)); |
|
| 87 | + $base_currency_info = $base_currency_info->result_array(); |
|
| 88 | + $base_currency_rate = $base_currency_info['0']['currencyrate']; |
|
| 89 | + $base_currency_name = $base_currency_info['0']['currency']; |
|
| 90 | 90 | //Find Currency Rate of user Currency from its currency_id |
| 91 | - $where= array('id'=>$currency); |
|
| 92 | - $user_currency_info=$this->db_model->getSelect("*",'currency',$where); |
|
| 91 | + $where = array('id'=>$currency); |
|
| 92 | + $user_currency_info = $this->db_model->getSelect("*", 'currency', $where); |
|
| 93 | 93 | //user Currency Is deleted or Not |
| 94 | - if($user_currency_info->num_rows() > 0){ |
|
| 95 | - $user_currency_info=$user_currency_info->result_array(); |
|
| 96 | - $user_currency=$user_currency_info['0']['currencyrate']; |
|
| 97 | - $user_currency_name=$user_currency_info['0']['currency']; |
|
| 98 | - } else{ |
|
| 99 | - $user_currency=$base_currency_rate; |
|
| 100 | - $user_currency_name=$base_currency_name; |
|
| 94 | + if ($user_currency_info->num_rows() > 0) { |
|
| 95 | + $user_currency_info = $user_currency_info->result_array(); |
|
| 96 | + $user_currency = $user_currency_info['0']['currencyrate']; |
|
| 97 | + $user_currency_name = $user_currency_info['0']['currency']; |
|
| 98 | + } else { |
|
| 99 | + $user_currency = $base_currency_rate; |
|
| 100 | + $user_currency_name = $base_currency_name; |
|
| 101 | 101 | } |
| 102 | 102 | // Convert Balance of user in user currency |
| 103 | - $convert_balance=round(($balance * $user_currency)/$base_currency_rate,2); |
|
| 104 | - $convert_balance=sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
| 103 | + $convert_balance = round(($balance * $user_currency) / $base_currency_rate, 2); |
|
| 104 | + $convert_balance = sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
| 105 | 105 | echo "Balance : ".$convert_balance; |
| 106 | 106 | } |
| 107 | - } else{ |
|
| 107 | + } else { |
|
| 108 | 108 | echo "0.00 ".$to_currency; |
| 109 | 109 | } |
| 110 | - } else{ |
|
| 110 | + } else { |
|
| 111 | 111 | echo "Please enter proper username of SIP Account"; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -37,8 +37,7 @@ |
||
| 37 | 37 | if($opensips_flag == '1'){ |
| 38 | 38 | $where=array('username'=>$sipnumber); |
| 39 | 39 | $accountid_arr=$this->db_model->getSelect('accountid','sip_devices',$where); |
| 40 | - } |
|
| 41 | - else{ |
|
| 40 | + } else{ |
|
| 42 | 41 | $db_config = Common_model::$global_config['system_config']; |
| 43 | 42 | $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
| 44 | 43 | $this->opensips_db = $this->load->database($opensipdsn, true); |
@@ -28,59 +28,59 @@ discard block |
||
| 28 | 28 | parent::__construct(); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - function index(){ |
|
| 31 | + function index() { |
|
| 32 | 32 | $data['account_info'] = $this->session->userdata['accountinfo']; |
| 33 | 33 | $data['username'] = $this->session->userdata('user_name'); |
| 34 | 34 | $data['page_title'] = "Feedback"; |
| 35 | - $this->load->view('view_feedback',$data); |
|
| 35 | + $this->load->view('view_feedback', $data); |
|
| 36 | 36 | } |
| 37 | - function customer_feedback_result($flag=FALSE){ |
|
| 38 | - if($flag){ |
|
| 37 | + function customer_feedback_result($flag = FALSE) { |
|
| 38 | + if ($flag) { |
|
| 39 | 39 | $account_info = array(); |
| 40 | - $this->db->where("accountid","1"); |
|
| 40 | + $this->db->where("accountid", "1"); |
|
| 41 | 41 | $res = $this->db->get('invoice_conf'); |
| 42 | - if($res->num_rows > 0){ |
|
| 42 | + if ($res->num_rows > 0) { |
|
| 43 | 43 | $masterdata = $res->result_array(); |
| 44 | 44 | $account_info = $masterdata['0']; |
| 45 | 45 | |
| 46 | - $company_name=$account_info['company_name']; |
|
| 47 | - $address=$account_info['address']; |
|
| 48 | - $city=$account_info['city']; |
|
| 49 | - $province=$account_info['province']; |
|
| 50 | - $country=$account_info['country']; |
|
| 51 | - $zipcode=$account_info['zipcode']; |
|
| 52 | - $telephone=$account_info['telephone']; |
|
| 53 | - $fax=$account_info['fax']; |
|
| 54 | - $emailaddress=$account_info['emailaddress']; |
|
| 55 | - $website=$account_info['website']; |
|
| 46 | + $company_name = $account_info['company_name']; |
|
| 47 | + $address = $account_info['address']; |
|
| 48 | + $city = $account_info['city']; |
|
| 49 | + $province = $account_info['province']; |
|
| 50 | + $country = $account_info['country']; |
|
| 51 | + $zipcode = $account_info['zipcode']; |
|
| 52 | + $telephone = $account_info['telephone']; |
|
| 53 | + $fax = $account_info['fax']; |
|
| 54 | + $emailaddress = $account_info['emailaddress']; |
|
| 55 | + $website = $account_info['website']; |
|
| 56 | 56 | |
| 57 | - $data=array("name"=>"Admin","company_name"=>$company_name,"address"=>$address,"city"=>$city,"province"=>$province,"country"=>$country,"zipcode"=>$zipcode,"telephone"=>$telephone,"fax"=>$fax,"emailaddress"=>$emailaddress,"website"=>$website,"serverip"=>$_SERVER['SERVER_NAME'],"FLAG"=>"TRUE"); |
|
| 57 | + $data = array("name"=>"Admin", "company_name"=>$company_name, "address"=>$address, "city"=>$city, "province"=>$province, "country"=>$country, "zipcode"=>$zipcode, "telephone"=>$telephone, "fax"=>$fax, "emailaddress"=>$emailaddress, "website"=>$website, "serverip"=>$_SERVER['SERVER_NAME'], "FLAG"=>"TRUE"); |
|
| 58 | 58 | } |
| 59 | - } else{ |
|
| 59 | + } else { |
|
| 60 | 60 | $account_info = array(); |
| 61 | - $this->db->where("type","-1"); |
|
| 61 | + $this->db->where("type", "-1"); |
|
| 62 | 62 | $res = $this->db->get('accounts'); |
| 63 | - if($res->num_rows > 0){ |
|
| 63 | + if ($res->num_rows > 0) { |
|
| 64 | 64 | $masterdata = $res->result_array(); |
| 65 | 65 | $account_info = $masterdata['0']; |
| 66 | 66 | |
| 67 | - $name=$_REQUEST['name']="Admin"; |
|
| 68 | - $email=$_REQUEST['email']=$account_info['email']; |
|
| 69 | - $feedback=$_REQUEST['feedback']; |
|
| 70 | - $first_name=$account_info['first_name']; |
|
| 71 | - $last_name=$account_info['last_name']; |
|
| 72 | - $city=$account_info['city']; |
|
| 73 | - $telephone_1=$account_info['telephone_1']; |
|
| 74 | - $account_email=$account_info['email']; |
|
| 75 | - $company_name=$account_info['company_name']; |
|
| 76 | - $address_1=$account_info['address_1']; |
|
| 77 | - $address_2=$account_info['address_2']; |
|
| 78 | - $telephone_2=$account_info['telephone_2']; |
|
| 79 | - $province=$account_info['province']; |
|
| 67 | + $name = $_REQUEST['name'] = "Admin"; |
|
| 68 | + $email = $_REQUEST['email'] = $account_info['email']; |
|
| 69 | + $feedback = $_REQUEST['feedback']; |
|
| 70 | + $first_name = $account_info['first_name']; |
|
| 71 | + $last_name = $account_info['last_name']; |
|
| 72 | + $city = $account_info['city']; |
|
| 73 | + $telephone_1 = $account_info['telephone_1']; |
|
| 74 | + $account_email = $account_info['email']; |
|
| 75 | + $company_name = $account_info['company_name']; |
|
| 76 | + $address_1 = $account_info['address_1']; |
|
| 77 | + $address_2 = $account_info['address_2']; |
|
| 78 | + $telephone_2 = $account_info['telephone_2']; |
|
| 79 | + $province = $account_info['province']; |
|
| 80 | 80 | |
| 81 | - $data=array("name"=>$name,"email"=>$email,"feedback"=>$feedback,"first_name"=>$first_name,"last_name"=>$last_name,"city"=>$city,"telephone_1"=>$telephone_1,"account_email"=>$account_email,"company_name"=>$company_name,"address_1"=>$address_1,"address_2"=>$address_2,"telephone_2"=>$telephone_2,"province"=>$province,"serverip"=>$_SERVER['SERVER_ADDR'],"FLAG"=>"FALSE"); |
|
| 81 | + $data = array("name"=>$name, "email"=>$email, "feedback"=>$feedback, "first_name"=>$first_name, "last_name"=>$last_name, "city"=>$city, "telephone_1"=>$telephone_1, "account_email"=>$account_email, "company_name"=>$company_name, "address_1"=>$address_1, "address_2"=>$address_2, "telephone_2"=>$telephone_2, "province"=>$province, "serverip"=>$_SERVER['SERVER_ADDR'], "FLAG"=>"FALSE"); |
|
| 82 | 82 | |
| 83 | - $data_new= json_encode($data); |
|
| 83 | + $data_new = json_encode($data); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | $ch = curl_init(); |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
| 97 | 97 | |
| 98 | 98 | $response = curl_exec($ch); |
| 99 | - if(!$flag) |
|
| 100 | - redirect(base_url() . 'feedback/thanks'); |
|
| 99 | + if ( ! $flag) |
|
| 100 | + redirect(base_url().'feedback/thanks'); |
|
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | } |
| 104 | - function thanks(){ |
|
| 104 | + function thanks() { |
|
| 105 | 105 | $this->load->view('view_feedback_response'); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -96,8 +96,9 @@ |
||
| 96 | 96 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
| 97 | 97 | |
| 98 | 98 | $response = curl_exec($ch); |
| 99 | - if(!$flag) |
|
| 100 | - redirect(base_url() . 'feedback/thanks'); |
|
| 99 | + if(!$flag) { |
|
| 100 | + redirect(base_url() . 'feedback/thanks'); |
|
| 101 | + } |
|
| 101 | 102 | |
| 102 | 103 | |
| 103 | 104 | } |
@@ -21,48 +21,48 @@ discard block |
||
| 21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | ############################################################################### |
| 23 | 23 | class Currencyupdate extends CI_Controller { |
| 24 | - function __construct() |
|
| 25 | - { |
|
| 26 | - parent::__construct(); |
|
| 27 | - // if(!defined( 'CRON' ) ) |
|
| 28 | - // exit(); |
|
| 29 | - $this->load->model("db_model"); |
|
| 30 | - $this->load->library("astpp/common"); |
|
| 31 | - } |
|
| 32 | - function update_currency() { |
|
| 33 | - $where = array("currency <>"=> Common_model::$global_config['system_config']['base_currency']); |
|
| 34 | - $query = $this->db_model->getSelect("*", "currency", $where); |
|
| 24 | + function __construct() |
|
| 25 | + { |
|
| 26 | + parent::__construct(); |
|
| 27 | + // if(!defined( 'CRON' ) ) |
|
| 28 | + // exit(); |
|
| 29 | + $this->load->model("db_model"); |
|
| 30 | + $this->load->library("astpp/common"); |
|
| 31 | + } |
|
| 32 | + function update_currency() { |
|
| 33 | + $where = array("currency <>"=> Common_model::$global_config['system_config']['base_currency']); |
|
| 34 | + $query = $this->db_model->getSelect("*", "currency", $where); |
|
| 35 | 35 | |
| 36 | - if ($query->num_rows > 0) { |
|
| 37 | - $currency_data = $query->result_array(); |
|
| 38 | - $url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s="; |
|
| 39 | - foreach ($currency_data as $currency_value) { |
|
| 40 | - $url .= Common_model::$global_config['system_config']['base_currency'].$currency_value['currency'].'=X+'; |
|
| 41 | - } |
|
| 42 | - $url .= '&f=l1'; |
|
| 36 | + if ($query->num_rows > 0) { |
|
| 37 | + $currency_data = $query->result_array(); |
|
| 38 | + $url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s="; |
|
| 39 | + foreach ($currency_data as $currency_value) { |
|
| 40 | + $url .= Common_model::$global_config['system_config']['base_currency'].$currency_value['currency'].'=X+'; |
|
| 41 | + } |
|
| 42 | + $url .= '&f=l1'; |
|
| 43 | 43 | |
| 44 | - $sql = ''; |
|
| 45 | - $response = $this->curl_response($url); |
|
| 46 | - $content_data = explode(' ', $response); |
|
| 44 | + $sql = ''; |
|
| 45 | + $response = $this->curl_response($url); |
|
| 46 | + $content_data = explode(' ', $response); |
|
| 47 | 47 | |
| 48 | - foreach ($content_data as $content_data1) { |
|
| 49 | - $currency_arr = explode("\n", $content_data1); |
|
| 50 | - foreach ($currency_arr as $final_val) |
|
| 51 | - { |
|
| 52 | - $currency_final = array(); |
|
| 53 | - $currency_final = explode(',', $final_val); |
|
| 54 | - if (isset($currency_final[1]) && $currency_final[1] != "" && $currency_final[0] != '' && $currency_final[1] != 'N/A') { |
|
| 55 | - $sql = "UPDATE currency SET currencyRate = ".$currency_final[1]." WHERE currency = '".substr($currency_final[0], 4, 3)."'"; |
|
| 56 | - $this->db->query($sql); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - $sql = "UPDATE currency SET currencyRate = '1' WHERE currency = '".Common_model::$global_config['system_config']['base_currency']."'"; |
|
| 61 | - $this->db->query($sql); |
|
| 62 | - } |
|
| 63 | - $this->session->set_flashdata("astpp_errormsg", "Currency exchange rates successfully updated."); |
|
| 64 | - redirect(base_url()."/systems/currency_list/"); |
|
| 65 | - exit; |
|
| 48 | + foreach ($content_data as $content_data1) { |
|
| 49 | + $currency_arr = explode("\n", $content_data1); |
|
| 50 | + foreach ($currency_arr as $final_val) |
|
| 51 | + { |
|
| 52 | + $currency_final = array(); |
|
| 53 | + $currency_final = explode(',', $final_val); |
|
| 54 | + if (isset($currency_final[1]) && $currency_final[1] != "" && $currency_final[0] != '' && $currency_final[1] != 'N/A') { |
|
| 55 | + $sql = "UPDATE currency SET currencyRate = ".$currency_final[1]." WHERE currency = '".substr($currency_final[0], 4, 3)."'"; |
|
| 56 | + $this->db->query($sql); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + $sql = "UPDATE currency SET currencyRate = '1' WHERE currency = '".Common_model::$global_config['system_config']['base_currency']."'"; |
|
| 61 | + $this->db->query($sql); |
|
| 62 | + } |
|
| 63 | + $this->session->set_flashdata("astpp_errormsg", "Currency exchange rates successfully updated."); |
|
| 64 | + redirect(base_url()."/systems/currency_list/"); |
|
| 65 | + exit; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -70,15 +70,15 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | function curl_response($url) |
| 72 | 72 | { |
| 73 | - $ch = curl_init(); // Initialising cURL |
|
| 74 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
| 75 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
| 76 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 77 | - curl_setopt($ch, CURLOPT_ENCODING, ""); |
|
| 78 | - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"); |
|
| 79 | - $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable |
|
| 80 | - curl_close($ch); // Closing cURL |
|
| 81 | - return $data; |
|
| 73 | + $ch = curl_init(); // Initialising cURL |
|
| 74 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 75 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
| 76 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 77 | + curl_setopt($ch, CURLOPT_ENCODING, ""); |
|
| 78 | + curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"); |
|
| 79 | + $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable |
|
| 80 | + curl_close($ch); // Closing cURL |
|
| 81 | + return $data; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | ?> |
@@ -25,21 +25,21 @@ |
||
| 25 | 25 | function __construct() |
| 26 | 26 | { |
| 27 | 27 | parent::__construct(); |
| 28 | - if(!defined( 'CRON' ) ) |
|
| 28 | + if ( ! defined('CRON')) |
|
| 29 | 29 | exit(); |
| 30 | 30 | $this->load->model("db_model"); |
| 31 | 31 | $this->load->library("astpp/email_lib"); |
| 32 | 32 | } |
| 33 | - function broadcast_email(){ |
|
| 33 | + function broadcast_email() { |
|
| 34 | 34 | |
| 35 | 35 | $where = array("status"=>"1"); |
| 36 | 36 | $query = $this->db_model->getSelect("*", "mail_details", $where); |
| 37 | - if($query->num_rows >0){ |
|
| 37 | + if ($query->num_rows > 0) { |
|
| 38 | 38 | $account_data = $query->result_array(); |
| 39 | - foreach($account_data as $data_key =>$account_value){ |
|
| 40 | - $account_value['history_id']=$account_value['id']; |
|
| 39 | + foreach ($account_data as $data_key =>$account_value) { |
|
| 40 | + $account_value['history_id'] = $account_value['id']; |
|
| 41 | 41 | unset($account_value['id']); |
| 42 | - $this->email_lib->send_email('',$account_value,'',$account_value['attachment'],1,0,1); |
|
| 42 | + $this->email_lib->send_email('', $account_value, '', $account_value['attachment'], 1, 0, 1); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -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/email_lib"); |
| 32 | 33 | } |