@@ -24,77 +24,77 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | class Signup extends MX_Controller { |
| 26 | 26 | |
| 27 | - function signup() { |
|
| 28 | - parent::__construct(); |
|
| 29 | - $this->load->model('signup_model'); |
|
| 30 | - $this->load->helper('captcha'); |
|
| 31 | - $this->load->helper('template_inheritance'); |
|
| 32 | - //$this->load->library('form_validation'); |
|
| 33 | - $this->load->library('astpp/common'); |
|
| 34 | - $this->load->library('astpp/email_lib'); |
|
| 35 | - $this->load->model('db_model'); |
|
| 36 | - $this->load->model('common_model'); |
|
| 37 | - $this->load->library('session'); |
|
| 38 | - $this->load->library('encrypt'); |
|
| 39 | - $this->load->model('Astpp_common'); |
|
| 40 | - |
|
| 41 | - error_reporting(-1); |
|
| 42 | - ini_set('display_errors', 'On'); |
|
| 43 | - |
|
| 44 | - $data['row'] = $this->signup_model->get_rate(); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - function index($key = "") { |
|
| 48 | - |
|
| 49 | - if (Common_model::$global_config['system_config']['enable_signup'] == 1) |
|
| 27 | + function signup() { |
|
| 28 | + parent::__construct(); |
|
| 29 | + $this->load->model('signup_model'); |
|
| 30 | + $this->load->helper('captcha'); |
|
| 31 | + $this->load->helper('template_inheritance'); |
|
| 32 | + //$this->load->library('form_validation'); |
|
| 33 | + $this->load->library('astpp/common'); |
|
| 34 | + $this->load->library('astpp/email_lib'); |
|
| 35 | + $this->load->model('db_model'); |
|
| 36 | + $this->load->model('common_model'); |
|
| 37 | + $this->load->library('session'); |
|
| 38 | + $this->load->library('encrypt'); |
|
| 39 | + $this->load->model('Astpp_common'); |
|
| 40 | + |
|
| 41 | + error_reporting(-1); |
|
| 42 | + ini_set('display_errors', 'On'); |
|
| 43 | + |
|
| 44 | + $data['row'] = $this->signup_model->get_rate(); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + function index($key = "") { |
|
| 48 | + |
|
| 49 | + if (Common_model::$global_config['system_config']['enable_signup'] == 1) |
|
| 50 | 50 | { |
| 51 | - redirect(base_url()); |
|
| 51 | + redirect(base_url()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $userCaptcha = $this->input->post('userCaptcha'); |
|
| 55 | - $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6); |
|
| 56 | - $accountinfo = (array)$this->db->get_where('accounts', array('type'=>-1))->first_row(); |
|
| 57 | - $data['timezone_id'] = ( ! $accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id']; |
|
| 58 | - $data['currency_id'] = ( ! $accountinfo['currency_id']) ? 1 : $accountinfo['currency_id']; |
|
| 59 | - $data['country_id'] = ( ! $accountinfo['country_id']) ? 1 : $accountinfo['country_id']; |
|
| 60 | - |
|
| 61 | - $vals = array( |
|
| 62 | - 'word' => $random_number, |
|
| 63 | - 'img_path' => getcwd().'/assets/captcha/', |
|
| 64 | - 'img_url' => base_url().'assets/captcha/', |
|
| 65 | - //'font_path' => './fonts/impact.ttf', |
|
| 66 | - 'img_width' => '243', |
|
| 67 | - 'img_height' => '50', |
|
| 68 | - 'expiration' => '3600' |
|
| 69 | - ); |
|
| 70 | - |
|
| 71 | - if (isset($key) && $key != '') { |
|
| 72 | - $data['key_unique'] = $key; |
|
| 73 | - } else { |
|
| 74 | - $data['key_unique'] = "admin"; |
|
| 75 | - } |
|
| 76 | - $unique = $data['key_unique']; |
|
| 77 | - |
|
| 78 | - if ($unique != "admin") { |
|
| 79 | - $unique = $this->common->decode_params(trim($unique)); |
|
| 80 | - $decoded_str = $this->common->decode($unique); |
|
| 81 | - $unique = $decoded_str; |
|
| 82 | - $query = $this->db_model->getSelect("*", 'accounts', array('id' => $unique, "deleted" => "0")); |
|
| 83 | - if ($query->num_rows() == 0) { |
|
| 84 | - redirect(base_url()."signup/signup_inactive"); |
|
| 85 | - } |
|
| 86 | - if ($query->num_rows() > 0) { |
|
| 87 | - $query = $query->result_array(); |
|
| 88 | - $query = $query[0]; |
|
| 89 | - |
|
| 90 | - if ($query['status'] != 0) { |
|
| 91 | - redirect(base_url()."signup/signup_inactive"); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - } |
|
| 95 | - $data['captcha'] = create_captcha($vals); |
|
| 96 | - $this->session->set_userdata('captchaWord', $data['captcha']['word']); |
|
| 97 | - $this->db->select("*"); |
|
| 54 | + $userCaptcha = $this->input->post('userCaptcha'); |
|
| 55 | + $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6); |
|
| 56 | + $accountinfo = (array)$this->db->get_where('accounts', array('type'=>-1))->first_row(); |
|
| 57 | + $data['timezone_id'] = ( ! $accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id']; |
|
| 58 | + $data['currency_id'] = ( ! $accountinfo['currency_id']) ? 1 : $accountinfo['currency_id']; |
|
| 59 | + $data['country_id'] = ( ! $accountinfo['country_id']) ? 1 : $accountinfo['country_id']; |
|
| 60 | + |
|
| 61 | + $vals = array( |
|
| 62 | + 'word' => $random_number, |
|
| 63 | + 'img_path' => getcwd().'/assets/captcha/', |
|
| 64 | + 'img_url' => base_url().'assets/captcha/', |
|
| 65 | + //'font_path' => './fonts/impact.ttf', |
|
| 66 | + 'img_width' => '243', |
|
| 67 | + 'img_height' => '50', |
|
| 68 | + 'expiration' => '3600' |
|
| 69 | + ); |
|
| 70 | + |
|
| 71 | + if (isset($key) && $key != '') { |
|
| 72 | + $data['key_unique'] = $key; |
|
| 73 | + } else { |
|
| 74 | + $data['key_unique'] = "admin"; |
|
| 75 | + } |
|
| 76 | + $unique = $data['key_unique']; |
|
| 77 | + |
|
| 78 | + if ($unique != "admin") { |
|
| 79 | + $unique = $this->common->decode_params(trim($unique)); |
|
| 80 | + $decoded_str = $this->common->decode($unique); |
|
| 81 | + $unique = $decoded_str; |
|
| 82 | + $query = $this->db_model->getSelect("*", 'accounts', array('id' => $unique, "deleted" => "0")); |
|
| 83 | + if ($query->num_rows() == 0) { |
|
| 84 | + redirect(base_url()."signup/signup_inactive"); |
|
| 85 | + } |
|
| 86 | + if ($query->num_rows() > 0) { |
|
| 87 | + $query = $query->result_array(); |
|
| 88 | + $query = $query[0]; |
|
| 89 | + |
|
| 90 | + if ($query['status'] != 0) { |
|
| 91 | + redirect(base_url()."signup/signup_inactive"); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | + $data['captcha'] = create_captcha($vals); |
|
| 96 | + $this->session->set_userdata('captchaWord', $data['captcha']['word']); |
|
| 97 | + $this->db->select("*"); |
|
| 98 | 98 | $this->db->where(array("domain"=>$_SERVER["HTTP_HOST"])); |
| 99 | 99 | $res = $this->db->get("invoice_conf"); |
| 100 | 100 | $logo_arr = $res->result(); |
@@ -105,399 +105,399 @@ discard block |
||
| 105 | 105 | $this->session->set_userdata('user_logo', $data['user_logo']); |
| 106 | 106 | $this->session->set_userdata('user_header', $data['website_header']); |
| 107 | 107 | $this->session->set_userdata('user_footer', $data['website_footer']); |
| 108 | - $this->load->view('view_signup', $data); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - public function check_captcha($str) { |
|
| 112 | - $word = $this->session->userdata('captchaWord'); |
|
| 113 | - if (strcmp(strtoupper($str), strtoupper($word)) == 0) { |
|
| 114 | - return true; |
|
| 115 | - } else { |
|
| 116 | - $this->form_validation->set_message('check_captcha', 'Please enter correct words!'); |
|
| 117 | - return false; |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - function terms_check() { |
|
| 122 | - if (isset($_POST['agreeCheck'])) { |
|
| 123 | - return true; |
|
| 124 | - } |
|
| 125 | - $this->form_validation->set_message('terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!'); |
|
| 126 | - return false; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - function signup_save($id = "") { |
|
| 130 | - if (empty($_POST)) { |
|
| 131 | - redirect(base_url()."signup/"); |
|
| 132 | - } else { |
|
| 133 | - $post_values = $this->input->post(); |
|
| 134 | - $userCaptcha = $this->input->post('userCaptcha'); |
|
| 135 | - $cnt_result = $this->db_model->countQuery("*", 'accounts', array('email' => $post_values['email'])); |
|
| 136 | - |
|
| 137 | - if ($userCaptcha != $this->session->userdata('captchaWord') || ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL) || $cnt_result > 0) { |
|
| 138 | - if ( ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL)) { |
|
| 139 | - $data['error']['email'] = "<div style='color: red;'> Please enter proper email </div>"; |
|
| 140 | - } |
|
| 141 | - if ($userCaptcha != $this->session->userdata('captchaWord')) { |
|
| 142 | - $data['error']['userCaptcha'] = "<div style='color: red;'>Please enter valid Captcha code</div>"; |
|
| 143 | - } |
|
| 144 | - if ($cnt_result > 0) { |
|
| 145 | - $data['error']['email'] = "<div style='color: red;'>Email Address already exists</div>"; |
|
| 146 | - } |
|
| 147 | - $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6); |
|
| 148 | - $vals = array( |
|
| 149 | - 'word' => $random_number, |
|
| 150 | - 'img_path' => getcwd().'/assets/captcha/', |
|
| 151 | - 'img_url' => base_url().'assets/captcha/', |
|
| 152 | - //'font_path' => './fonts/impact.ttf', |
|
| 153 | - 'img_width' => '243', |
|
| 154 | - 'img_height' => '50', |
|
| 155 | - 'expiration' => '3600' |
|
| 156 | - ); |
|
| 157 | - //echo "<pre>"; print_r($_POST); exit; |
|
| 158 | - if (isset($_POST['key_unique']) && $_POST['key_unique'] == "admin") { |
|
| 159 | - $data['key_unique'] = $_POST['key_unique']; |
|
| 160 | - } |
|
| 108 | + $this->load->view('view_signup', $data); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + public function check_captcha($str) { |
|
| 112 | + $word = $this->session->userdata('captchaWord'); |
|
| 113 | + if (strcmp(strtoupper($str), strtoupper($word)) == 0) { |
|
| 114 | + return true; |
|
| 115 | + } else { |
|
| 116 | + $this->form_validation->set_message('check_captcha', 'Please enter correct words!'); |
|
| 117 | + return false; |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + function terms_check() { |
|
| 122 | + if (isset($_POST['agreeCheck'])) { |
|
| 123 | + return true; |
|
| 124 | + } |
|
| 125 | + $this->form_validation->set_message('terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!'); |
|
| 126 | + return false; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + function signup_save($id = "") { |
|
| 130 | + if (empty($_POST)) { |
|
| 131 | + redirect(base_url()."signup/"); |
|
| 132 | + } else { |
|
| 133 | + $post_values = $this->input->post(); |
|
| 134 | + $userCaptcha = $this->input->post('userCaptcha'); |
|
| 135 | + $cnt_result = $this->db_model->countQuery("*", 'accounts', array('email' => $post_values['email'])); |
|
| 136 | + |
|
| 137 | + if ($userCaptcha != $this->session->userdata('captchaWord') || ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL) || $cnt_result > 0) { |
|
| 138 | + if ( ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL)) { |
|
| 139 | + $data['error']['email'] = "<div style='color: red;'> Please enter proper email </div>"; |
|
| 140 | + } |
|
| 141 | + if ($userCaptcha != $this->session->userdata('captchaWord')) { |
|
| 142 | + $data['error']['userCaptcha'] = "<div style='color: red;'>Please enter valid Captcha code</div>"; |
|
| 143 | + } |
|
| 144 | + if ($cnt_result > 0) { |
|
| 145 | + $data['error']['email'] = "<div style='color: red;'>Email Address already exists</div>"; |
|
| 146 | + } |
|
| 147 | + $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6); |
|
| 148 | + $vals = array( |
|
| 149 | + 'word' => $random_number, |
|
| 150 | + 'img_path' => getcwd().'/assets/captcha/', |
|
| 151 | + 'img_url' => base_url().'assets/captcha/', |
|
| 152 | + //'font_path' => './fonts/impact.ttf', |
|
| 153 | + 'img_width' => '243', |
|
| 154 | + 'img_height' => '50', |
|
| 155 | + 'expiration' => '3600' |
|
| 156 | + ); |
|
| 157 | + //echo "<pre>"; print_r($_POST); exit; |
|
| 158 | + if (isset($_POST['key_unique']) && $_POST['key_unique'] == "admin") { |
|
| 159 | + $data['key_unique'] = $_POST['key_unique']; |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | $accountinfo = (array)$this->db->get_where('accounts', array('type'=>-1))->first_row(); |
| 163 | 163 | $data['timezone_id'] = ( ! $accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id']; |
| 164 | 164 | $data['currency_id'] = ( ! $accountinfo['currency_id']) ? 1 : $accountinfo['currency_id']; |
| 165 | 165 | $data['country_id'] = ( ! $accountinfo['country_id']) ? 1 : $accountinfo['country_id']; |
| 166 | 166 | |
| 167 | - $data['timezone_id'] = ( ! $data['timezone_id']) ? 1 : $data['timezone_id']; |
|
| 168 | - $data['currency_id'] = ( ! $data['currency_id']) ? 1 : $data['currency_id']; |
|
| 169 | - $data['country_id'] = ( ! $data['country_id']) ? 1 : $data['country_id']; |
|
| 167 | + $data['timezone_id'] = ( ! $data['timezone_id']) ? 1 : $data['timezone_id']; |
|
| 168 | + $data['currency_id'] = ( ! $data['currency_id']) ? 1 : $data['currency_id']; |
|
| 169 | + $data['country_id'] = ( ! $data['country_id']) ? 1 : $data['country_id']; |
|
| 170 | 170 | |
| 171 | - $data['value'] = $post_values; |
|
| 172 | - $data['captcha'] = create_captcha($vals); |
|
| 171 | + $data['value'] = $post_values; |
|
| 172 | + $data['captcha'] = create_captcha($vals); |
|
| 173 | 173 | |
| 174 | - $this->session->set_userdata('captchaWord', $data['captcha']['word']); |
|
| 175 | - $data['key_unique'] = $_POST['key_unique']; |
|
| 176 | - $this->load->view('view_signup', $data); |
|
| 177 | - } else { |
|
| 178 | - //AVTLATP |
|
| 179 | - $user_data = $this->input->post(); |
|
| 174 | + $this->session->set_userdata('captchaWord', $data['captcha']['word']); |
|
| 175 | + $data['key_unique'] = $_POST['key_unique']; |
|
| 176 | + $this->load->view('view_signup', $data); |
|
| 177 | + } else { |
|
| 178 | + //AVTLATP |
|
| 179 | + $user_data = $this->input->post(); |
|
| 180 | 180 | |
| 181 | - if ( ! isset($_POST['key_unique']) || ! isset($_POST['email'])) { |
|
| 182 | - redirect(base_url()."signup/"); |
|
| 183 | - } |
|
| 184 | - $reseller_id = 0; |
|
| 185 | - if (isset($_POST['key_unique']) && $_POST['key_unique'] != "admin") { |
|
| 186 | - $_POST['key_unique'] = $this->common->decode_params(trim($_POST['key_unique'])); |
|
| 187 | - $decoded_str = $this->common->decode($_POST['key_unique']); |
|
| 188 | - $_POST['key_unique'] = $decoded_str; |
|
| 189 | - $user_data['key_unique'] = $_POST['key_unique']; |
|
| 190 | - $reseller_id = $user_data['key_unique']; |
|
| 191 | - } |
|
| 192 | - //echo "<pre>"; print_r($_POST); exit; |
|
| 193 | - //AVTLATP |
|
| 194 | - //Data want to insert or update |
|
| 195 | - $user_data['status'] = "1"; |
|
| 196 | - $user_data['number'] = $this->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
| 197 | - |
|
| 198 | - $user_data['password'] = $this->common->encode($this->common->generate_password()); |
|
| 199 | - $user_data['pin'] = $this->common->generate_password(); |
|
| 200 | - $user_data['reseller_id'] = $reseller_id; |
|
| 201 | - $user_data['posttoexternal'] = "0"; |
|
| 202 | - |
|
| 203 | - unset($user_data['userCaptcha']); |
|
| 204 | - unset($user_data['action']); |
|
| 205 | - |
|
| 206 | - $system_config = common_model::$global_config['system_config']; |
|
| 207 | - $balance = $system_config["balance"]; |
|
| 208 | - |
|
| 209 | - /* $query = $this->db_model->getSelect("*", 'invoice_conf ', array('id' => $unique ,"deleted" => "0")); |
|
| 181 | + if ( ! isset($_POST['key_unique']) || ! isset($_POST['email'])) { |
|
| 182 | + redirect(base_url()."signup/"); |
|
| 183 | + } |
|
| 184 | + $reseller_id = 0; |
|
| 185 | + if (isset($_POST['key_unique']) && $_POST['key_unique'] != "admin") { |
|
| 186 | + $_POST['key_unique'] = $this->common->decode_params(trim($_POST['key_unique'])); |
|
| 187 | + $decoded_str = $this->common->decode($_POST['key_unique']); |
|
| 188 | + $_POST['key_unique'] = $decoded_str; |
|
| 189 | + $user_data['key_unique'] = $_POST['key_unique']; |
|
| 190 | + $reseller_id = $user_data['key_unique']; |
|
| 191 | + } |
|
| 192 | + //echo "<pre>"; print_r($_POST); exit; |
|
| 193 | + //AVTLATP |
|
| 194 | + //Data want to insert or update |
|
| 195 | + $user_data['status'] = "1"; |
|
| 196 | + $user_data['number'] = $this->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
| 197 | + |
|
| 198 | + $user_data['password'] = $this->common->encode($this->common->generate_password()); |
|
| 199 | + $user_data['pin'] = $this->common->generate_password(); |
|
| 200 | + $user_data['reseller_id'] = $reseller_id; |
|
| 201 | + $user_data['posttoexternal'] = "0"; |
|
| 202 | + |
|
| 203 | + unset($user_data['userCaptcha']); |
|
| 204 | + unset($user_data['action']); |
|
| 205 | + |
|
| 206 | + $system_config = common_model::$global_config['system_config']; |
|
| 207 | + $balance = $system_config["balance"]; |
|
| 208 | + |
|
| 209 | + /* $query = $this->db_model->getSelect("*", 'invoice_conf ', array('id' => $unique ,"deleted" => "0")); |
|
| 210 | 210 | $query = $query->result_array(); */ |
| 211 | 211 | |
| 212 | - $company_website = $system_config["company_website"]; |
|
| 213 | - $company_name = $system_config["company_name"]; |
|
| 212 | + $company_website = $system_config["company_website"]; |
|
| 213 | + $company_name = $system_config["company_name"]; |
|
| 214 | 214 | |
| 215 | - //echo $company_name; exit; |
|
| 216 | - $selection_rategroup_signup = $system_config["default_signup_rategroup"]; |
|
| 215 | + //echo $company_name; exit; |
|
| 216 | + $selection_rategroup_signup = $system_config["default_signup_rategroup"]; |
|
| 217 | 217 | |
| 218 | - if ($reseller_id != 0) { |
|
| 219 | - $result = $this->db_model->getSelect("*", "pricelists", array("reseller_id" => $reseller_id), "ASC"); |
|
| 220 | - $result_arr = $result->result_array(); |
|
| 221 | - $selection_rategroup_signup = $result_arr[0]['id']; |
|
| 222 | - $user_data['pricelist_id'] = (isset($selection_rategroup_signup) && $selection_rategroup_signup > 0) ? $selection_rategroup_signup : 0; |
|
| 223 | - } else { |
|
| 224 | - //$pricelist_id = $this->common->get_field_name('id', 'pricelists', array('name' => $selection_rategroup_signup)); |
|
| 225 | - /* if($pricelis_id != "") |
|
| 218 | + if ($reseller_id != 0) { |
|
| 219 | + $result = $this->db_model->getSelect("*", "pricelists", array("reseller_id" => $reseller_id), "ASC"); |
|
| 220 | + $result_arr = $result->result_array(); |
|
| 221 | + $selection_rategroup_signup = $result_arr[0]['id']; |
|
| 222 | + $user_data['pricelist_id'] = (isset($selection_rategroup_signup) && $selection_rategroup_signup > 0) ? $selection_rategroup_signup : 0; |
|
| 223 | + } else { |
|
| 224 | + //$pricelist_id = $this->common->get_field_name('id', 'pricelists', array('name' => $selection_rategroup_signup)); |
|
| 225 | + /* if($pricelis_id != "") |
|
| 226 | 226 | $user_data['pricelist_id'] = $pricelis_id; |
| 227 | 227 | else |
| 228 | 228 | $user_data['pricelist_id'] = 0; */ |
| 229 | - //$user_data['pricelist_id'] = ($pricelist_id != "") ? $pricelist_id : 0; |
|
| 230 | - $user_data['pricelist_id']=$selection_rategroup_signup; |
|
| 231 | - } |
|
| 232 | - $last_id = '0'; |
|
| 233 | - //Insert or Update record |
|
| 234 | - $signup_sipdevice_flag = $system_config['create_sipdevice']; |
|
| 235 | - $last_id = $this->signup_model->add_user($user_data); |
|
| 236 | - if ($last_id == "") { |
|
| 237 | - redirect(base_url()."signup/signup_inactive"); |
|
| 238 | - } |
|
| 239 | - if ($signup_sipdevice_flag == '0') { |
|
| 240 | - $query = $this->db_model->select("*", "sip_profiles", array('name' => "default"), "id", "ASC", '1', '0'); |
|
| 241 | - $sip_id = $query->result_array(); |
|
| 242 | - if ($reseller_id > 0) { |
|
| 229 | + //$user_data['pricelist_id'] = ($pricelist_id != "") ? $pricelist_id : 0; |
|
| 230 | + $user_data['pricelist_id']=$selection_rategroup_signup; |
|
| 231 | + } |
|
| 232 | + $last_id = '0'; |
|
| 233 | + //Insert or Update record |
|
| 234 | + $signup_sipdevice_flag = $system_config['create_sipdevice']; |
|
| 235 | + $last_id = $this->signup_model->add_user($user_data); |
|
| 236 | + if ($last_id == "") { |
|
| 237 | + redirect(base_url()."signup/signup_inactive"); |
|
| 238 | + } |
|
| 239 | + if ($signup_sipdevice_flag == '0') { |
|
| 240 | + $query = $this->db_model->select("*", "sip_profiles", array('name' => "default"), "id", "ASC", '1', '0'); |
|
| 241 | + $sip_id = $query->result_array(); |
|
| 242 | + if ($reseller_id > 0) { |
|
| 243 | 243 | $reseller_id = $reseller_id; |
| 244 | 244 | } else { |
| 245 | 245 | $reseller_id = '0'; |
| 246 | 246 | } |
| 247 | - $free_switch_array = array('fs_username' => $user_data['number'], |
|
| 248 | - 'fs_password' => $user_data['password'], |
|
| 249 | - 'context' => 'default', |
|
| 250 | - 'effective_caller_id_name' => $user_data['number'], |
|
| 251 | - 'effective_caller_id_number' => $user_data['number'], |
|
| 252 | - 'sip_profile_id' => $sip_id[0]['id'], |
|
| 253 | - 'reseller_id' => $reseller_id, |
|
| 254 | - 'pricelist_id' => $user_data['pricelist_id'], |
|
| 255 | - 'accountcode' => $last_id, |
|
| 256 | - 'status' => $user_data['status'], |
|
| 257 | - 'voicemail_enabled'=>true, |
|
| 258 | - 'voicemail_password'=>'', |
|
| 259 | - 'voicemail_mail_to'=>'', |
|
| 260 | - 'voicemail_attach_file'=>true, |
|
| 261 | - 'vm_keep_local_after_email'=>true, |
|
| 262 | - 'vm_send_all_message'=>true, |
|
| 263 | - ); |
|
| 264 | - $user_custom_array = array_merge($user_data, $free_switch_array); |
|
| 265 | - $user_custom_array['id'] = $last_id; |
|
| 266 | - $user_custom_array['email'] = $user_data['email']; |
|
| 247 | + $free_switch_array = array('fs_username' => $user_data['number'], |
|
| 248 | + 'fs_password' => $user_data['password'], |
|
| 249 | + 'context' => 'default', |
|
| 250 | + 'effective_caller_id_name' => $user_data['number'], |
|
| 251 | + 'effective_caller_id_number' => $user_data['number'], |
|
| 252 | + 'sip_profile_id' => $sip_id[0]['id'], |
|
| 253 | + 'reseller_id' => $reseller_id, |
|
| 254 | + 'pricelist_id' => $user_data['pricelist_id'], |
|
| 255 | + 'accountcode' => $last_id, |
|
| 256 | + 'status' => $user_data['status'], |
|
| 257 | + 'voicemail_enabled'=>true, |
|
| 258 | + 'voicemail_password'=>'', |
|
| 259 | + 'voicemail_mail_to'=>'', |
|
| 260 | + 'voicemail_attach_file'=>true, |
|
| 261 | + 'vm_keep_local_after_email'=>true, |
|
| 262 | + 'vm_send_all_message'=>true, |
|
| 263 | + ); |
|
| 264 | + $user_custom_array = array_merge($user_data, $free_switch_array); |
|
| 265 | + $user_custom_array['id'] = $last_id; |
|
| 266 | + $user_custom_array['email'] = $user_data['email']; |
|
| 267 | 267 | |
| 268 | - $this->load->model('freeswitch/freeswitch_model'); |
|
| 269 | - $this->freeswitch_model->add_freeswith($user_custom_array); |
|
| 270 | - } |
|
| 271 | - // echo "<pre>"; print_r ($user_data); exit; |
|
| 272 | - $activation = $this->encrypt->encode($user_data['number']); |
|
| 273 | - $message = base_url().'signup/signup_confirm?email='.urlencode($user_data['email'])."&key=".urlencode($activation); |
|
| 274 | - $user_data['confirm'] = $message; |
|
| 275 | - |
|
| 276 | - $this->send_mail($last_id, 'email_signup_confirmation', $user_data); |
|
| 277 | - redirect(base_url()."signup/signup_success"); |
|
| 278 | - } |
|
| 279 | - } |
|
| 280 | - } |
|
| 281 | - |
|
| 282 | - function signup_confirm() { |
|
| 283 | - if ( ! empty($_GET)) { |
|
| 284 | - |
|
| 285 | - $system_config = common_model::$global_config['system_config']; |
|
| 286 | - $balance = $system_config["balance"]; |
|
| 287 | - $accno = $this->encrypt->decode($_GET['key']); |
|
| 288 | - $email = $_GET['email']; |
|
| 289 | - $success = $this->signup_model->check_user($accno, $email, $balance); |
|
| 290 | - $query = $this->db_model->getSelect("*", "accounts", array('number' => $accno)); |
|
| 291 | - $data = $query->result_array(); |
|
| 292 | - $user_data = $data[0]; |
|
| 293 | - $user_data['accountid'] = $user_data['id']; |
|
| 294 | - $user_data['success'] = $success; |
|
| 295 | - $user_data['balance'] = $balance; |
|
| 296 | - $user_data['confirm'] = base_url(); |
|
| 297 | - $this->active($user_data, $success); |
|
| 298 | - } else { |
|
| 299 | - redirect(base_url()); |
|
| 300 | - } |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - function signup_success() { |
|
| 304 | - $this->load->view('view_signup_success'); |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - function signup_inactive() { |
|
| 308 | - $this->load->view('view_signup_inactive'); |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - function active($user_data, $success) { |
|
| 312 | - $data['user_data'] = $user_data; |
|
| 313 | - $data['user_data']['success'] = $success; |
|
| 314 | - |
|
| 315 | - if ($user_data['success']) { |
|
| 268 | + $this->load->model('freeswitch/freeswitch_model'); |
|
| 269 | + $this->freeswitch_model->add_freeswith($user_custom_array); |
|
| 270 | + } |
|
| 271 | + // echo "<pre>"; print_r ($user_data); exit; |
|
| 272 | + $activation = $this->encrypt->encode($user_data['number']); |
|
| 273 | + $message = base_url().'signup/signup_confirm?email='.urlencode($user_data['email'])."&key=".urlencode($activation); |
|
| 274 | + $user_data['confirm'] = $message; |
|
| 275 | + |
|
| 276 | + $this->send_mail($last_id, 'email_signup_confirmation', $user_data); |
|
| 277 | + redirect(base_url()."signup/signup_success"); |
|
| 278 | + } |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + |
|
| 282 | + function signup_confirm() { |
|
| 283 | + if ( ! empty($_GET)) { |
|
| 284 | + |
|
| 285 | + $system_config = common_model::$global_config['system_config']; |
|
| 286 | + $balance = $system_config["balance"]; |
|
| 287 | + $accno = $this->encrypt->decode($_GET['key']); |
|
| 288 | + $email = $_GET['email']; |
|
| 289 | + $success = $this->signup_model->check_user($accno, $email, $balance); |
|
| 290 | + $query = $this->db_model->getSelect("*", "accounts", array('number' => $accno)); |
|
| 291 | + $data = $query->result_array(); |
|
| 292 | + $user_data = $data[0]; |
|
| 293 | + $user_data['accountid'] = $user_data['id']; |
|
| 294 | + $user_data['success'] = $success; |
|
| 295 | + $user_data['balance'] = $balance; |
|
| 296 | + $user_data['confirm'] = base_url(); |
|
| 297 | + $this->active($user_data, $success); |
|
| 298 | + } else { |
|
| 299 | + redirect(base_url()); |
|
| 300 | + } |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + function signup_success() { |
|
| 304 | + $this->load->view('view_signup_success'); |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + function signup_inactive() { |
|
| 308 | + $this->load->view('view_signup_inactive'); |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + function active($user_data, $success) { |
|
| 312 | + $data['user_data'] = $user_data; |
|
| 313 | + $data['user_data']['success'] = $success; |
|
| 314 | + |
|
| 315 | + if ($user_data['success']) { |
|
| 316 | 316 | $user_data['password'] = $this->common->decode($user_data['password']); |
| 317 | - $this->send_mail($user_data['id'], 'email_add_user', $user_data); |
|
| 318 | - } |
|
| 319 | - $this->load->view('view_signup_active', $data); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - function forgotpassword() { |
|
| 323 | - $this->load->view('view_forgotpassword'); |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - function confirmpassword() { |
|
| 327 | - $email = $_POST['email']; |
|
| 328 | - unset($_POST['action']); |
|
| 329 | - $where = array('email' => $email); |
|
| 330 | - $this->db->where($where); |
|
| 331 | - $this->db->or_where('number', $email); |
|
| 332 | - $cnt_result = $this->db_model->countQuery("*", 'accounts', ""); |
|
| 333 | - if ( ! empty($email)) { |
|
| 334 | - $names = array('0', '1', '3'); |
|
| 335 | - $this->db->where_in('type', $names); |
|
| 336 | - $where_arr = array("email" => $email); |
|
| 337 | - $this->db->where($where_arr); |
|
| 317 | + $this->send_mail($user_data['id'], 'email_add_user', $user_data); |
|
| 318 | + } |
|
| 319 | + $this->load->view('view_signup_active', $data); |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + function forgotpassword() { |
|
| 323 | + $this->load->view('view_forgotpassword'); |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + function confirmpassword() { |
|
| 327 | + $email = $_POST['email']; |
|
| 328 | + unset($_POST['action']); |
|
| 329 | + $where = array('email' => $email); |
|
| 330 | + $this->db->where($where); |
|
| 331 | + $this->db->or_where('number', $email); |
|
| 332 | + $cnt_result = $this->db_model->countQuery("*", 'accounts', ""); |
|
| 333 | + if ( ! empty($email)) { |
|
| 334 | + $names = array('0', '1', '3'); |
|
| 335 | + $this->db->where_in('type', $names); |
|
| 336 | + $where_arr = array("email" => $email); |
|
| 337 | + $this->db->where($where_arr); |
|
| 338 | 338 | $this->db->or_where('number', $email); |
| 339 | - $acountdata = $this->db_model->getSelect("*", "accounts", ""); |
|
| 340 | - if ($acountdata->num_rows() > 0) { |
|
| 341 | - $user_data = $acountdata->result_array(); |
|
| 342 | - $user_data = $user_data[0]; |
|
| 343 | - if ($user_data['status'] > 0) { |
|
| 344 | - $data['error']['email'] = "<div id='error_mail' style='color:red; margin: 1% 22%; float: left;'>This account is not Active.</div>"; |
|
| 345 | - $this->load->view('view_forgotpassword', $data); |
|
| 346 | - exit; |
|
| 347 | - } |
|
| 348 | - } |
|
| 349 | - if ($acountdata->num_rows() == 0 && ! filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
| 350 | - if ( ! filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
| 351 | - $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>"; |
|
| 352 | - |
|
| 353 | - $this->load->view('view_forgotpassword', $data); |
|
| 354 | - } else { |
|
| 355 | - $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left;width:100%;'>This Username or Email is not valid</div>"; |
|
| 356 | - |
|
| 357 | - $this->load->view('view_forgotpassword', $data); |
|
| 358 | - } |
|
| 359 | - } else if ($acountdata->num_rows() == 0) { |
|
| 360 | - $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>"; |
|
| 361 | - $this->load->view('view_forgotpassword', $data); |
|
| 362 | - } else { |
|
| 363 | - $acountdata = $acountdata->result_array(); |
|
| 364 | - $user_data = $acountdata[0]; |
|
| 339 | + $acountdata = $this->db_model->getSelect("*", "accounts", ""); |
|
| 340 | + if ($acountdata->num_rows() > 0) { |
|
| 341 | + $user_data = $acountdata->result_array(); |
|
| 342 | + $user_data = $user_data[0]; |
|
| 343 | + if ($user_data['status'] > 0) { |
|
| 344 | + $data['error']['email'] = "<div id='error_mail' style='color:red; margin: 1% 22%; float: left;'>This account is not Active.</div>"; |
|
| 345 | + $this->load->view('view_forgotpassword', $data); |
|
| 346 | + exit; |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | + if ($acountdata->num_rows() == 0 && ! filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
| 350 | + if ( ! filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
| 351 | + $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>"; |
|
| 352 | + |
|
| 353 | + $this->load->view('view_forgotpassword', $data); |
|
| 354 | + } else { |
|
| 355 | + $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left;width:100%;'>This Username or Email is not valid</div>"; |
|
| 356 | + |
|
| 357 | + $this->load->view('view_forgotpassword', $data); |
|
| 358 | + } |
|
| 359 | + } else if ($acountdata->num_rows() == 0) { |
|
| 360 | + $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>"; |
|
| 361 | + $this->load->view('view_forgotpassword', $data); |
|
| 362 | + } else { |
|
| 363 | + $acountdata = $acountdata->result_array(); |
|
| 364 | + $user_data = $acountdata[0]; |
|
| 365 | 365 | |
| 366 | - $email = $this->encrypt->encode($user_data['email']); |
|
| 367 | - $activation = $this->encrypt->encode($user_data['number']); |
|
| 368 | - $message = base_url().'confirm_pass?email='.urlencode($email)."&key=".urlencode($activation); |
|
| 369 | - $user_data['confirm'] = $message; |
|
| 370 | - $where = array("email" => $user_data['email']); |
|
| 371 | - $data = array("pass_link_status" => 1); |
|
| 372 | - $this->db->where($where); |
|
| 373 | - $this->db->update('accounts', $data); |
|
| 374 | - $system_config = common_model::$global_config['system_config']; |
|
| 375 | - $balance = $system_config["balance"]; |
|
| 376 | - $this->send_mail($user_data['id'], 'email_forgot_confirmation', $user_data); |
|
| 377 | - $this->load->view('view_forgot_success'); |
|
| 378 | - } |
|
| 379 | - } else { |
|
| 380 | - redirect(base_url()); |
|
| 381 | - } |
|
| 382 | - } |
|
| 383 | - |
|
| 384 | - function confirm_pass() { |
|
| 385 | - $confirm_pass = $_GET; |
|
| 386 | - $accno = ''; |
|
| 387 | - $balance = ''; |
|
| 388 | - $email1 = $this->encrypt->decode($confirm_pass['email']); |
|
| 389 | - $success = $this->signup_model->check_user($accno, $email1, $balance); |
|
| 390 | - if ( ! empty($confirm_pass)) { |
|
| 391 | - $where_arr = array("email" => $email1, "status" => 0); |
|
| 392 | - $acountdata = $this->db_model->getSelect("*", "accounts", $where_arr); |
|
| 393 | - if ($acountdata->num_rows() > 0) { |
|
| 394 | - $acountdata = $acountdata->result_array(); |
|
| 395 | - $user_data = $acountdata[0]; |
|
| 396 | - $updateArr = array("pass_link_status" => 0); |
|
| 397 | - $this->db->where(array("email" => $email1)); |
|
| 398 | - $this->db->update("accounts", $updateArr); |
|
| 399 | - if ($user_data['pass_link_status'] == '0') { |
|
| 400 | - $user_data['success'] = $success; |
|
| 401 | - $data['user_data'] = $user_data; |
|
| 402 | - $this->active($user_data, $success); |
|
| 403 | - } else { |
|
| 404 | - $data['email'] = $_GET['email']; |
|
| 405 | - $this->load->view('view_confirmpassword', $data); |
|
| 406 | - } |
|
| 407 | - } |
|
| 408 | - } |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - function confirmpass() { |
|
| 412 | - $passwordconf = $_POST; |
|
| 413 | - $email1 = $this->encrypt->decode($passwordconf['email']); |
|
| 414 | - if ( ! empty($passwordconf)) { |
|
| 415 | - $acountdata = $this->db_model->getSelect("*", "accounts", array("email" => $email1)); |
|
| 416 | - //echo $this->db->last_query();exit; |
|
| 417 | - if ($acountdata->num_rows() > 0) { |
|
| 418 | - $acountdata = $acountdata->result_array(); |
|
| 419 | - $user_data = $acountdata[0]; |
|
| 420 | - } |
|
| 421 | - $user_data['password'] = $this->common->encode($passwordconf['password']); |
|
| 422 | - $updateArr = array("password" => $user_data['password']); |
|
| 423 | - $where_arr = array("email" => $email1, "status" => 0); |
|
| 424 | - $this->db->where($where_arr); |
|
| 425 | - $this->db->update("accounts", $updateArr); |
|
| 426 | - //$activation = $this->encrypt->encode($user_data['number']); |
|
| 427 | - $message = base_url(); |
|
| 428 | - $user_data['confirm'] = $message; |
|
| 429 | - $user_data['password'] = $passwordconf['password']; |
|
| 430 | - |
|
| 431 | - |
|
| 432 | - |
|
| 433 | - $system_config = common_model::$global_config['system_config']; |
|
| 434 | - $balance = $system_config["balance"]; |
|
| 435 | - |
|
| 436 | - $this->send_mail($user_data['id'], 'email_forgot_user', $user_data); |
|
| 437 | - |
|
| 438 | - $this->successpassword(); |
|
| 439 | - } |
|
| 440 | - } |
|
| 441 | - |
|
| 442 | - /** |
|
| 443 | - * @param string $temp_name |
|
| 444 | - */ |
|
| 445 | - function send_mail($account_id, $temp_name, $user_data) { |
|
| 366 | + $email = $this->encrypt->encode($user_data['email']); |
|
| 367 | + $activation = $this->encrypt->encode($user_data['number']); |
|
| 368 | + $message = base_url().'confirm_pass?email='.urlencode($email)."&key=".urlencode($activation); |
|
| 369 | + $user_data['confirm'] = $message; |
|
| 370 | + $where = array("email" => $user_data['email']); |
|
| 371 | + $data = array("pass_link_status" => 1); |
|
| 372 | + $this->db->where($where); |
|
| 373 | + $this->db->update('accounts', $data); |
|
| 374 | + $system_config = common_model::$global_config['system_config']; |
|
| 375 | + $balance = $system_config["balance"]; |
|
| 376 | + $this->send_mail($user_data['id'], 'email_forgot_confirmation', $user_data); |
|
| 377 | + $this->load->view('view_forgot_success'); |
|
| 378 | + } |
|
| 379 | + } else { |
|
| 380 | + redirect(base_url()); |
|
| 381 | + } |
|
| 382 | + } |
|
| 383 | + |
|
| 384 | + function confirm_pass() { |
|
| 385 | + $confirm_pass = $_GET; |
|
| 386 | + $accno = ''; |
|
| 387 | + $balance = ''; |
|
| 388 | + $email1 = $this->encrypt->decode($confirm_pass['email']); |
|
| 389 | + $success = $this->signup_model->check_user($accno, $email1, $balance); |
|
| 390 | + if ( ! empty($confirm_pass)) { |
|
| 391 | + $where_arr = array("email" => $email1, "status" => 0); |
|
| 392 | + $acountdata = $this->db_model->getSelect("*", "accounts", $where_arr); |
|
| 393 | + if ($acountdata->num_rows() > 0) { |
|
| 394 | + $acountdata = $acountdata->result_array(); |
|
| 395 | + $user_data = $acountdata[0]; |
|
| 396 | + $updateArr = array("pass_link_status" => 0); |
|
| 397 | + $this->db->where(array("email" => $email1)); |
|
| 398 | + $this->db->update("accounts", $updateArr); |
|
| 399 | + if ($user_data['pass_link_status'] == '0') { |
|
| 400 | + $user_data['success'] = $success; |
|
| 401 | + $data['user_data'] = $user_data; |
|
| 402 | + $this->active($user_data, $success); |
|
| 403 | + } else { |
|
| 404 | + $data['email'] = $_GET['email']; |
|
| 405 | + $this->load->view('view_confirmpassword', $data); |
|
| 406 | + } |
|
| 407 | + } |
|
| 408 | + } |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + function confirmpass() { |
|
| 412 | + $passwordconf = $_POST; |
|
| 413 | + $email1 = $this->encrypt->decode($passwordconf['email']); |
|
| 414 | + if ( ! empty($passwordconf)) { |
|
| 415 | + $acountdata = $this->db_model->getSelect("*", "accounts", array("email" => $email1)); |
|
| 416 | + //echo $this->db->last_query();exit; |
|
| 417 | + if ($acountdata->num_rows() > 0) { |
|
| 418 | + $acountdata = $acountdata->result_array(); |
|
| 419 | + $user_data = $acountdata[0]; |
|
| 420 | + } |
|
| 421 | + $user_data['password'] = $this->common->encode($passwordconf['password']); |
|
| 422 | + $updateArr = array("password" => $user_data['password']); |
|
| 423 | + $where_arr = array("email" => $email1, "status" => 0); |
|
| 424 | + $this->db->where($where_arr); |
|
| 425 | + $this->db->update("accounts", $updateArr); |
|
| 426 | + //$activation = $this->encrypt->encode($user_data['number']); |
|
| 427 | + $message = base_url(); |
|
| 428 | + $user_data['confirm'] = $message; |
|
| 429 | + $user_data['password'] = $passwordconf['password']; |
|
| 430 | + |
|
| 431 | + |
|
| 432 | + |
|
| 433 | + $system_config = common_model::$global_config['system_config']; |
|
| 434 | + $balance = $system_config["balance"]; |
|
| 435 | + |
|
| 436 | + $this->send_mail($user_data['id'], 'email_forgot_user', $user_data); |
|
| 437 | + |
|
| 438 | + $this->successpassword(); |
|
| 439 | + } |
|
| 440 | + } |
|
| 441 | + |
|
| 442 | + /** |
|
| 443 | + * @param string $temp_name |
|
| 444 | + */ |
|
| 445 | + function send_mail($account_id, $temp_name, $user_data) { |
|
| 446 | 446 | |
| 447 | 447 | |
| 448 | - $system_config = common_model::$global_config['system_config']; |
|
| 449 | - //$screen_path = getcwd()."/cron"; |
|
| 450 | - //$screen_filename = "Email_Broadcast_".strtotime('now'); |
|
| 451 | - //$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
| 452 | - //exec($command); |
|
| 448 | + $system_config = common_model::$global_config['system_config']; |
|
| 449 | + //$screen_path = getcwd()."/cron"; |
|
| 450 | + //$screen_filename = "Email_Broadcast_".strtotime('now'); |
|
| 451 | + //$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
| 452 | + //exec($command); |
|
| 453 | 453 | |
| 454 | 454 | |
| 455 | 455 | |
| 456 | 456 | |
| 457 | - $where = array('name' => $temp_name); |
|
| 458 | - $EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where); |
|
| 459 | - $reseller_id = ($user_data['reseller_id'] > 0) ? $user_data['reseller_id'] : 1; |
|
| 460 | - $where = "accountid IN ('".$reseller_id."','1')"; |
|
| 461 | - $this->db->where($where); |
|
| 462 | - $this->db->select('*'); |
|
| 463 | - $this->db->order_by('accountid', 'desc'); |
|
| 464 | - $this->db->limit(1); |
|
| 465 | - $invoiceconf = $this->db->get('invoice_conf'); |
|
| 466 | - $invoiceconf = (array)$invoiceconf->first_row(); |
|
| 467 | - $company_email = $invoiceconf['emailaddress']; |
|
| 468 | - $company_website = $invoiceconf["website"]; |
|
| 469 | - $company_name = $invoiceconf["company_name"]; |
|
| 457 | + $where = array('name' => $temp_name); |
|
| 458 | + $EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where); |
|
| 459 | + $reseller_id = ($user_data['reseller_id'] > 0) ? $user_data['reseller_id'] : 1; |
|
| 460 | + $where = "accountid IN ('".$reseller_id."','1')"; |
|
| 461 | + $this->db->where($where); |
|
| 462 | + $this->db->select('*'); |
|
| 463 | + $this->db->order_by('accountid', 'desc'); |
|
| 464 | + $this->db->limit(1); |
|
| 465 | + $invoiceconf = $this->db->get('invoice_conf'); |
|
| 466 | + $invoiceconf = (array)$invoiceconf->first_row(); |
|
| 467 | + $company_email = $invoiceconf['emailaddress']; |
|
| 468 | + $company_website = $invoiceconf["website"]; |
|
| 469 | + $company_name = $invoiceconf["company_name"]; |
|
| 470 | 470 | |
| 471 | - $TemplateData = array(); |
|
| 471 | + $TemplateData = array(); |
|
| 472 | 472 | |
| 473 | 473 | |
| 474 | - foreach ($EmailTemplate->result_array() as $value) { |
|
| 475 | - $TemplateData = $value; |
|
| 476 | - $TemplateData['subject'] = str_replace('#NAME#', $user_data['first_name']." ".$user_data['last_name'], $TemplateData['subject']); |
|
| 477 | - $TemplateData['template'] = str_replace('#NAME#', $user_data['first_name']." ".$user_data['last_name'], $TemplateData['template']); |
|
| 478 | - $TemplateData['template'] = str_replace('#NUMBER#', $user_data['number'], $TemplateData['template']); |
|
| 479 | - $TemplateData['template'] = str_replace('#PASSWORD#', $user_data['password'], $TemplateData['template']); |
|
| 480 | - $TemplateData['template'] = str_replace('#COMPANY_WEBSITE#', $company_website, $TemplateData['template']); |
|
| 481 | - $TemplateData['template'] = str_replace('#LINK#', $user_data['confirm'], $TemplateData['template']); |
|
| 482 | - $TemplateData['template'] = str_replace('#COMPANY_EMAIL#', $company_email, $TemplateData['template']); |
|
| 483 | - $TemplateData['template'] = str_replace('#COMPANY_NAME#', $company_name, $TemplateData['template']); |
|
| 484 | - } |
|
| 485 | - $email_array = array('accountid' => $account_id, |
|
| 486 | - 'subject' => $TemplateData['subject'], |
|
| 487 | - 'body' => $TemplateData['template'], |
|
| 488 | - 'from' => $invoiceconf['emailaddress'], |
|
| 489 | - 'to' => $user_data['email'], |
|
| 490 | - 'status' => "1", |
|
| 491 | - //'attachment'=> $Filenm, |
|
| 492 | - 'template' => ''); |
|
| 493 | - //echo "<pre>"; print_r($TemplateData); exit; |
|
| 494 | - $this->db->insert("mail_details", $email_array); |
|
| 495 | - return true; |
|
| 496 | - } |
|
| 497 | - |
|
| 498 | - function successpassword() { |
|
| 499 | - $this->load->view('view_successpassword'); |
|
| 500 | - } |
|
| 474 | + foreach ($EmailTemplate->result_array() as $value) { |
|
| 475 | + $TemplateData = $value; |
|
| 476 | + $TemplateData['subject'] = str_replace('#NAME#', $user_data['first_name']." ".$user_data['last_name'], $TemplateData['subject']); |
|
| 477 | + $TemplateData['template'] = str_replace('#NAME#', $user_data['first_name']." ".$user_data['last_name'], $TemplateData['template']); |
|
| 478 | + $TemplateData['template'] = str_replace('#NUMBER#', $user_data['number'], $TemplateData['template']); |
|
| 479 | + $TemplateData['template'] = str_replace('#PASSWORD#', $user_data['password'], $TemplateData['template']); |
|
| 480 | + $TemplateData['template'] = str_replace('#COMPANY_WEBSITE#', $company_website, $TemplateData['template']); |
|
| 481 | + $TemplateData['template'] = str_replace('#LINK#', $user_data['confirm'], $TemplateData['template']); |
|
| 482 | + $TemplateData['template'] = str_replace('#COMPANY_EMAIL#', $company_email, $TemplateData['template']); |
|
| 483 | + $TemplateData['template'] = str_replace('#COMPANY_NAME#', $company_name, $TemplateData['template']); |
|
| 484 | + } |
|
| 485 | + $email_array = array('accountid' => $account_id, |
|
| 486 | + 'subject' => $TemplateData['subject'], |
|
| 487 | + 'body' => $TemplateData['template'], |
|
| 488 | + 'from' => $invoiceconf['emailaddress'], |
|
| 489 | + 'to' => $user_data['email'], |
|
| 490 | + 'status' => "1", |
|
| 491 | + //'attachment'=> $Filenm, |
|
| 492 | + 'template' => ''); |
|
| 493 | + //echo "<pre>"; print_r($TemplateData); exit; |
|
| 494 | + $this->db->insert("mail_details", $email_array); |
|
| 495 | + return true; |
|
| 496 | + } |
|
| 497 | + |
|
| 498 | + function successpassword() { |
|
| 499 | + $this->load->view('view_successpassword'); |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | 502 | } |
| 503 | 503 | ?> |
@@ -227,7 +227,7 @@ |
||
| 227 | 227 | else |
| 228 | 228 | $user_data['pricelist_id'] = 0; */ |
| 229 | 229 | //$user_data['pricelist_id'] = ($pricelist_id != "") ? $pricelist_id : 0; |
| 230 | - $user_data['pricelist_id']=$selection_rategroup_signup; |
|
| 230 | + $user_data['pricelist_id'] = $selection_rategroup_signup; |
|
| 231 | 231 | } |
| 232 | 232 | $last_id = '0'; |
| 233 | 233 | //Insert or Update record |