@@ -32,23 +32,23 @@ discard block |
||
32 | 32 | |
33 | 33 | // If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored. |
34 | 34 | |
35 | -if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { |
|
35 | +if ( ! defined('K_TCPDF_EXTERNAL_CONFIG')) { |
|
36 | 36 | |
37 | 37 | define('K_TCPDF_EXTERNAL_CONFIG', true); |
38 | 38 | |
39 | 39 | // DOCUMENT_ROOT fix for IIS Webserver |
40 | - if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { |
|
40 | + if (( ! isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { |
|
41 | 41 | if (isset($_SERVER['SCRIPT_FILENAME'])) { |
42 | 42 | $_SERVER['DOCUMENT_ROOT'] = str_replace( |
43 | 43 | '\\', |
44 | 44 | '/', |
45 | - substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])) |
|
45 | + substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF'])) |
|
46 | 46 | ); |
47 | 47 | } elseif (isset($_SERVER['PATH_TRANSLATED'])) { |
48 | 48 | $_SERVER['DOCUMENT_ROOT'] = str_replace( |
49 | 49 | '\\', |
50 | 50 | '/', |
51 | - substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])) |
|
51 | + substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0 - strlen($_SERVER['PHP_SELF'])) |
|
52 | 52 | ); |
53 | 53 | } else { |
54 | 54 | // define here your DOCUMENT_ROOT path if the previous fails |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | // Automatic calculation for the following K_PATH_MAIN constant |
60 | 60 | $kPathMain = str_replace('\\', '/', dirname(__FILE__)); |
61 | 61 | $kPathMain = dirname($kPathMain).'/'; // remove the current directory |
62 | - $kPathMain.= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/'; |
|
62 | + $kPathMain .= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/'; |
|
63 | 63 | define('K_PATH_MAIN', $kPathMain); |
64 | 64 | |
65 | 65 | // Automatic calculation for the following K_PATH_URL constant |
66 | - if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { |
|
67 | - if (isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') { |
|
66 | + if (isset($_SERVER['HTTP_HOST']) AND ( ! empty($_SERVER['HTTP_HOST']))) { |
|
67 | + if (isset($_SERVER['HTTPS']) AND ( ! empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS']) != 'off') { |
|
68 | 68 | $kPathUrl = 'https://'; |
69 | 69 | } else { |
70 | 70 | $kPathUrl = 'http://'; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | /** |
229 | 229 | * reduction factor for small font |
230 | 230 | */ |
231 | - define('K_SMALL_RATIO', 2/3); |
|
231 | + define('K_SMALL_RATIO', 2 / 3); |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | { |
485 | 485 | // prepare |
486 | 486 | $tagName = strtolower($tagName); |
487 | - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
487 | + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
488 | 488 | $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null; |
489 | 489 | |
490 | 490 | // read the class attribute |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | { |
555 | 555 | // prepare the informations |
556 | 556 | $tagName = strtolower($tagName); |
557 | - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
557 | + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
558 | 558 | $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null; |
559 | 559 | |
560 | 560 | // get the class names to use |
@@ -131,63 +131,63 @@ discard block |
||
131 | 131 | <li> |
132 | 132 | |
133 | 133 | <?php |
134 | - $acc_info=$this->session->userdata('accountinfo'); |
|
135 | - if($this->session->userdata('userlevel_logintype') != '0'){?> |
|
136 | - <a href="<?php echo base_url();?>dashboard/" class=""> <? } else{?> |
|
137 | - <a href="<?php echo base_url();?>user/user/" class=""> |
|
134 | + $acc_info = $this->session->userdata('accountinfo'); |
|
135 | + if ($this->session->userdata('userlevel_logintype') != '0') {?> |
|
136 | + <a href="<?php echo base_url(); ?>dashboard/" class=""> <? } else {?> |
|
137 | + <a href="<?php echo base_url(); ?>user/user/" class=""> |
|
138 | 138 | <? } |
139 | - if($this->session->userdata('logintype')!=2){ |
|
140 | - $result=(array)$this->db->get_where('accounts',array("id"=>$acc_info['id']),1)->first_row(); |
|
141 | - $variable =$result['posttoexternal']==1 ? 'Credit' : gettext('Bal'); |
|
142 | - $amount=$result['posttoexternal']==1 ? $result['credit_limit'] :$result['balance']; |
|
143 | - $value= $this->common_model->calculate_currency($amount,'','',true); |
|
144 | - if($value >0){ |
|
145 | - $color='#397A13'; |
|
139 | + if ($this->session->userdata('logintype') != 2) { |
|
140 | + $result = (array)$this->db->get_where('accounts', array("id"=>$acc_info['id']), 1)->first_row(); |
|
141 | + $variable = $result['posttoexternal'] == 1 ? 'Credit' : gettext('Bal'); |
|
142 | + $amount = $result['posttoexternal'] == 1 ? $result['credit_limit'] : $result['balance']; |
|
143 | + $value = $this->common_model->calculate_currency($amount, '', '', true); |
|
144 | + if ($value > 0) { |
|
145 | + $color = '#397A13'; |
|
146 | 146 | } |
147 | - if($value < 0){ |
|
148 | - $color='#EE0E43'; |
|
147 | + if ($value < 0) { |
|
148 | + $color = '#EE0E43'; |
|
149 | 149 | } |
150 | - if($value == 0){ |
|
151 | - $color='#1A1919'; |
|
150 | + if ($value == 0) { |
|
151 | + $color = '#1A1919'; |
|
152 | 152 | } |
153 | 153 | $balance_str = '<span style="color:'.$color.'; font-size: 10px;"><b>('.$variable.' : '.$value.')</b></span>'; |
154 | - }else{ |
|
154 | + } else { |
|
155 | 155 | $balance_str = ''; |
156 | 156 | } |
157 | 157 | |
158 | - $logged_user=$acc_info['first_name']." ".$acc_info['last_name']; |
|
158 | + $logged_user = $acc_info['first_name']." ".$acc_info['last_name']; |
|
159 | 159 | ?> |
160 | 160 | <span> |
161 | 161 | <span class="profile_name"> |
162 | 162 | <?= $logged_user?> |
163 | 163 | </span> |
164 | - <label class="profile_label no-margin"><?php echo $balance_str;?> |
|
164 | + <label class="profile_label no-margin"><?php echo $balance_str; ?> |
|
165 | 165 | </label> |
166 | 166 | </span> |
167 | 167 | </a> |
168 | 168 | <ul class="dropdown-box"> |
169 | - <? if($this->session->userdata('userlevel_logintype') != '0' && $this->session->userdata('userlevel_logintype') != '3'){?> |
|
170 | - <li><a href="<?php echo base_url();?>dashboard/"><i class="fa fa-home"></i> <?php echo gettext('Dashboard'); ?></a></li> |
|
171 | - <? } else{?> |
|
172 | - <li><a href="<?php echo base_url();?>user/user/"><i class="fa fa-home"></i> <?php echo gettext('Dashboard'); ?></a></li> |
|
169 | + <? if ($this->session->userdata('userlevel_logintype') != '0' && $this->session->userdata('userlevel_logintype') != '3') {?> |
|
170 | + <li><a href="<?php echo base_url(); ?>dashboard/"><i class="fa fa-home"></i> <?php echo gettext('Dashboard'); ?></a></li> |
|
171 | + <? } else {?> |
|
172 | + <li><a href="<?php echo base_url(); ?>user/user/"><i class="fa fa-home"></i> <?php echo gettext('Dashboard'); ?></a></li> |
|
173 | 173 | <? }?> |
174 | 174 | |
175 | -<? if($this->session->userdata('userlevel_logintype') != '-1'){ |
|
175 | +<? if ($this->session->userdata('userlevel_logintype') != '-1') { |
|
176 | 176 | ?> |
177 | - <li><a href="<?php echo base_url();?>user/user_myprofile/"><i class= "fa fa-user"></i> |
|
177 | + <li><a href="<?php echo base_url(); ?>user/user_myprofile/"><i class= "fa fa-user"></i> |
|
178 | 178 | <?php echo gettext('My Profile'); ?></a></li> |
179 | 179 | <? |
180 | 180 | }?> |
181 | 181 | |
182 | - <? if($this->session->userdata('userlevel_logintype') == '-1'){?> |
|
182 | + <? if ($this->session->userdata('userlevel_logintype') == '-1') {?> |
|
183 | 183 | <li style="-moz-border-radius: 5px 5px 5px 5px;-webkit-border-radius: 5px 5px 5px 5px;border-radius: 5px 5px 5px 5px;"><a href="http://bugs.astppbilling.org/" target="_blank"><i class= "fa fa-bug"></i> <?php echo gettext('Report a Bug'); ?></a></li> |
184 | 184 | <?}?> |
185 | - <? if($this->session->userdata('userlevel_logintype') == '-1'){?> |
|
185 | + <? if ($this->session->userdata('userlevel_logintype') == '-1') {?> |
|
186 | 186 | <li><a href="https://astppdoc.atlassian.net/wiki/display/ASTPP/Welcome+to+ASTPP" target="_blank"><i class="fa fa-file-text"></i> Documentation</a></li> |
187 | 187 | <li><a href="http://www.astppbilling.org/sip-dialer" target="_blank"><i class="fa fa-mobile fa-lg" aria-hidden="true"></i> Get App</a></li> |
188 | 188 | <?}?> |
189 | 189 | |
190 | - <li><a href="<?php echo base_url();?>logout"><i class="fa fa-power-off"></i> Log out</a></li> |
|
190 | + <li><a href="<?php echo base_url(); ?>logout"><i class="fa fa-power-off"></i> Log out</a></li> |
|
191 | 191 | </ul> |
192 | 192 | </li> |
193 | 193 | </ul> |
@@ -203,49 +203,49 @@ discard block |
||
203 | 203 | |
204 | 204 | <?php |
205 | 205 | $menu_info = unserialize($this->session->userdata("menuinfo")); |
206 | - foreach($menu_info as $menu_key => $menu_values){ |
|
206 | + foreach ($menu_info as $menu_key => $menu_values) { |
|
207 | 207 | ?> |
208 | 208 | |
209 | 209 | <?php |
210 | - if(common_model::$global_config['system_config']['opensips']== 0 && $menu_key !='SIP Devices'){ |
|
210 | + if (common_model::$global_config['system_config']['opensips'] == 0 && $menu_key != 'SIP Devices') { |
|
211 | 211 | echo '<li><a href="">'.gettext($menu_key).'<b class="caret"></b></a>'; |
212 | 212 | } |
213 | - if(common_model::$global_config['system_config']['opensips']== 1 && $menu_key != 'Opensips'){ |
|
213 | + if (common_model::$global_config['system_config']['opensips'] == 1 && $menu_key != 'Opensips') { |
|
214 | 214 | echo '<li><a href="">'.gettext($menu_key).'<b class="caret"></b></a>'; |
215 | 215 | } |
216 | 216 | ?> |
217 | 217 | |
218 | 218 | <ul class="dropdown-menu"> |
219 | - <? foreach($menu_values as $sub_menu_key => $sub_menu_values){?> |
|
219 | + <? foreach ($menu_values as $sub_menu_key => $sub_menu_values) {?> |
|
220 | 220 | |
221 | - <? if($sub_menu_key === 0){ ?> |
|
222 | - <? foreach($sub_menu_values as $sub_key => $sub_menu_lables){ |
|
223 | - if((common_model::$global_config['system_config']['paypal_status']== 1 && strtolower($sub_menu_lables["menu_label"]) =='recharge') ||(common_model::$global_config['system_config']['opensips']== 1 && $sub_menu_lables["menu_label"] =='Opensips')|| |
|
224 | - (common_model::$global_config['system_config']['opensips']== 0 && $sub_menu_lables["menu_label"] =='SIP Devices') || |
|
225 | - (($acc_info['type'] == '3' || $acc_info['type'] == '0') && $acc_info['allow_ip_management'] == '1' && strtolower($sub_menu_lables["menu_label"]) == 'ip settings')){ |
|
226 | - }else{?> |
|
227 | - <li><a href="<?php echo base_url().$sub_menu_lables["module_url"];?>"><?php echo gettext($sub_menu_lables["menu_label"]);?></a></li> |
|
221 | + <? if ($sub_menu_key === 0) { ?> |
|
222 | + <? foreach ($sub_menu_values as $sub_key => $sub_menu_lables) { |
|
223 | + if ((common_model::$global_config['system_config']['paypal_status'] == 1 && strtolower($sub_menu_lables["menu_label"]) == 'recharge') || (common_model::$global_config['system_config']['opensips'] == 1 && $sub_menu_lables["menu_label"] == 'Opensips') || |
|
224 | + (common_model::$global_config['system_config']['opensips'] == 0 && $sub_menu_lables["menu_label"] == 'SIP Devices') || |
|
225 | + (($acc_info['type'] == '3' || $acc_info['type'] == '0') && $acc_info['allow_ip_management'] == '1' && strtolower($sub_menu_lables["menu_label"]) == 'ip settings')) { |
|
226 | + } else {?> |
|
227 | + <li><a href="<?php echo base_url().$sub_menu_lables["module_url"]; ?>"><?php echo gettext($sub_menu_lables["menu_label"]); ?></a></li> |
|
228 | 228 | <?}?> |
229 | 229 | <?} ?> |
230 | - <?php }else{ |
|
231 | - if(common_model::$global_config['system_config']['opensips']==0 && $menu_key !='System Configuration'){ ?> |
|
232 | - <li><a href=""><span><?=$sub_menu_key;?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
233 | - <? } if(common_model::$global_config['system_config']['opensips']==1) {?> |
|
234 | - <li><a href=""><span><?=$sub_menu_key;?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
235 | - <?php }if(($acc_info['type']==3 || $acc_info['type']== 0) && $acc_info['allow_ip_management']== 1 && strtolower($sub_menu_lables["menu_label"]) !='ip settings'){ ?> |
|
236 | - <li><a href=""><span><?=$sub_menu_key;?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
230 | + <?php } else { |
|
231 | + if (common_model::$global_config['system_config']['opensips'] == 0 && $menu_key != 'System Configuration') { ?> |
|
232 | + <li><a href=""><span><?=$sub_menu_key; ?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
233 | + <? } if (common_model::$global_config['system_config']['opensips'] == 1) {?> |
|
234 | + <li><a href=""><span><?=$sub_menu_key; ?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
235 | + <?php }if (($acc_info['type'] == 3 || $acc_info['type'] == 0) && $acc_info['allow_ip_management'] == 1 && strtolower($sub_menu_lables["menu_label"]) != 'ip settings') { ?> |
|
236 | + <li><a href=""><span><?=$sub_menu_key; ?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
237 | 237 | <? } |
238 | 238 | ?> |
239 | 239 | <div class="col-4"><div class="col-md-6 no-padding"> |
240 | 240 | <ul class="col-12 padding-x-8"> |
241 | - <? foreach($sub_menu_values as $sub_menu_lables){ |
|
242 | - if($sub_menu_lables['menu_label'] != 'Configuration'){ |
|
243 | - if(common_model::$global_config['system_config']['opensips']==0 && $sub_menu_lables["menu_label"] !='SIP Devices'){ |
|
241 | + <? foreach ($sub_menu_values as $sub_menu_lables) { |
|
242 | + if ($sub_menu_lables['menu_label'] != 'Configuration') { |
|
243 | + if (common_model::$global_config['system_config']['opensips'] == 0 && $sub_menu_lables["menu_label"] != 'SIP Devices') { |
|
244 | 244 | ?> |
245 | - <li><a href="<?php echo base_url().$sub_menu_lables["module_url"];?>"><?php echo gettext($sub_menu_lables["menu_label"]);?></a></li> |
|
245 | + <li><a href="<?php echo base_url().$sub_menu_lables["module_url"]; ?>"><?php echo gettext($sub_menu_lables["menu_label"]); ?></a></li> |
|
246 | 246 | <? } |
247 | - if(common_model::$global_config['system_config']['opensips']== 1 && $sub_menu_key !='opensips'){ ?> |
|
248 | - <li><a href="<?php echo base_url().$sub_menu_lables["module_url"];?>"><?=$sub_menu_lables["menu_label"];?></a></li> |
|
247 | + if (common_model::$global_config['system_config']['opensips'] == 1 && $sub_menu_key != 'opensips') { ?> |
|
248 | + <li><a href="<?php echo base_url().$sub_menu_lables["module_url"]; ?>"><?=$sub_menu_lables["menu_label"]; ?></a></li> |
|
249 | 249 | <? } |
250 | 250 | } |
251 | 251 | } ?> |
@@ -61,84 +61,83 @@ |
||
61 | 61 | <div class="sidebar collapse"> |
62 | 62 | |
63 | 63 | <?php |
64 | - $uri_string= uri_string(); |
|
65 | - $uri_arr=explode("/",$uri_string); |
|
66 | - $entity_name=false; |
|
67 | - if(isset($uri_arr[1]) && !empty($uri_arr[1])){ |
|
68 | - $function_explode=explode("_",$uri_arr[1]); |
|
69 | - $entity_name = isset($function_explode[1]) && !empty($function_explode[1]) ? $function_explode[0] : false; |
|
64 | + $uri_string = uri_string(); |
|
65 | + $uri_arr = explode("/", $uri_string); |
|
66 | + $entity_name = false; |
|
67 | + if (isset($uri_arr[1]) && ! empty($uri_arr[1])) { |
|
68 | + $function_explode = explode("_", $uri_arr[1]); |
|
69 | + $entity_name = isset($function_explode[1]) && ! empty($function_explode[1]) ? $function_explode[0] : false; |
|
70 | 70 | } |
71 | 71 | |
72 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
73 | - if($accountinfo['type'] != 0 && $accountinfo['type'] !=3){ |
|
74 | - $menu_info= ($uri_arr[0]=="user" |
|
75 | - ? unserialize(RESELLERPROFILE_ARRAY):($uri_arr[0]=="accounts"&& $entity_name =='customer' |
|
76 | - ? unserialize(CUSTOMEREDIT_ARRAY) :($uri_arr[0]=="accounts"&& $entity_name =='provider' |
|
77 | - ? unserialize(PROVIDEREDIT_ARRAY) :($uri_arr[0]=="accounts"&& $entity_name =='reseller' |
|
78 | - ? unserialize(RESELLEREDIT_ARRAY) : ($uri_arr[0] =="package" ? unserialize(PACKAGEEDIT_ARRAY):false) )))); |
|
79 | - }else{ |
|
80 | - $menu_info=null; |
|
81 | - $current_menu_url=$uri_arr[0]."/".$uri_arr[1]."/"; |
|
82 | - $new_menu_info=array(); |
|
83 | - $menus= unserialize($this->session->userdata('menuinfo')); |
|
84 | - foreach($menus as $entity_key=>$entity_menu){ |
|
85 | - foreach($entity_menu as $entity_subkey=>$entity_submenu){ |
|
86 | - foreach($entity_submenu as $subkey=>$submenus){ |
|
87 | - if($submenus['module_url']==$current_menu_url){ |
|
88 | - $new_menu_info=$entity_menu; |
|
72 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
73 | + if ($accountinfo['type'] != 0 && $accountinfo['type'] != 3) { |
|
74 | + $menu_info = ($uri_arr[0] == "user" |
|
75 | + ? unserialize(RESELLERPROFILE_ARRAY) : ($uri_arr[0] == "accounts" && $entity_name == 'customer' |
|
76 | + ? unserialize(CUSTOMEREDIT_ARRAY) : ($uri_arr[0] == "accounts" && $entity_name == 'provider' |
|
77 | + ? unserialize(PROVIDEREDIT_ARRAY) : ($uri_arr[0] == "accounts" && $entity_name == 'reseller' |
|
78 | + ? unserialize(RESELLEREDIT_ARRAY) : ($uri_arr[0] == "package" ? unserialize(PACKAGEEDIT_ARRAY) : false))))); |
|
79 | + } else { |
|
80 | + $menu_info = null; |
|
81 | + $current_menu_url = $uri_arr[0]."/".$uri_arr[1]."/"; |
|
82 | + $new_menu_info = array(); |
|
83 | + $menus = unserialize($this->session->userdata('menuinfo')); |
|
84 | + foreach ($menus as $entity_key=>$entity_menu) { |
|
85 | + foreach ($entity_menu as $entity_subkey=>$entity_submenu) { |
|
86 | + foreach ($entity_submenu as $subkey=>$submenus) { |
|
87 | + if ($submenus['module_url'] == $current_menu_url) { |
|
88 | + $new_menu_info = $entity_menu; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
93 | - foreach($new_menu_info as $key=>$value){ |
|
94 | - foreach($value as $subvalue){ |
|
95 | - $menu_info[$subvalue['menu_label']]=$subvalue['module_url']; |
|
93 | + foreach ($new_menu_info as $key=>$value) { |
|
94 | + foreach ($value as $subvalue) { |
|
95 | + $menu_info[$subvalue['menu_label']] = $subvalue['module_url']; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
99 | - if($accountinfo['type']==0 || $accountinfo['type']==3){ |
|
100 | - if($uri_arr[0]=='user' && $uri_arr[1] =='user_myprofile' || $uri_arr[0]=='user' && $uri_arr[1]=='user_change_password'){ |
|
101 | - $menu_info=unserialize(CUSTOMERPROFILE_ARRAY); |
|
99 | + if ($accountinfo['type'] == 0 || $accountinfo['type'] == 3) { |
|
100 | + if ($uri_arr[0] == 'user' && $uri_arr[1] == 'user_myprofile' || $uri_arr[0] == 'user' && $uri_arr[1] == 'user_change_password') { |
|
101 | + $menu_info = unserialize(CUSTOMERPROFILE_ARRAY); |
|
102 | 102 | } |
103 | 103 | } |
104 | - if(!empty($menu_info)){ |
|
104 | + if ( ! empty($menu_info)) { |
|
105 | 105 | echo "<ul class='sidemenu'>"; |
106 | - $i=0; |
|
107 | - foreach($menu_info as $key=>$value){ |
|
108 | - $url=($entity_name=='provider'||$entity_name =='customer' || $entity_name =='reseller' || $uri_arr[0] =="package") && isset($uri_arr[2]) && !empty($uri_arr[2]) |
|
106 | + $i = 0; |
|
107 | + foreach ($menu_info as $key=>$value) { |
|
108 | + $url = ($entity_name == 'provider' || $entity_name == 'customer' || $entity_name == 'reseller' || $uri_arr[0] == "package") && isset($uri_arr[2]) && ! empty($uri_arr[2]) |
|
109 | 109 | ? |
110 | - base_url().$value.$uri_arr[2]."/" : |
|
111 | - base_url().$value; |
|
112 | - $value_flag=false; |
|
113 | - if($acc_info['type'] == '3' || $acc_info['type'] == '0'){ |
|
114 | - if($value == "user/user_ipmap/" && $acc_info['allow_ip_management'] == '1'){ |
|
115 | - $value_flag=false; |
|
116 | - }elseif(in_array('user/user_sipdevices/',$menu_info) && $value == "user/user_sipdevices/" && common_model::$global_config['system_config']['opensips']== 0){ |
|
117 | - $value_flag=false; |
|
118 | - }else{ |
|
119 | - $value_flag=true; |
|
110 | + base_url().$value.$uri_arr[2]."/" : base_url().$value; |
|
111 | + $value_flag = false; |
|
112 | + if ($acc_info['type'] == '3' || $acc_info['type'] == '0') { |
|
113 | + if ($value == "user/user_ipmap/" && $acc_info['allow_ip_management'] == '1') { |
|
114 | + $value_flag = false; |
|
115 | + }elseif (in_array('user/user_sipdevices/', $menu_info) && $value == "user/user_sipdevices/" && common_model::$global_config['system_config']['opensips'] == 0) { |
|
116 | + $value_flag = false; |
|
117 | + } else { |
|
118 | + $value_flag = true; |
|
120 | 119 | } |
121 | - }else{ |
|
122 | - if(common_model::$global_config['system_config']['opensips'] == 1 ){ |
|
123 | - if($value != "accounts/".$entity_name."_opensips/"){ |
|
124 | - $value_flag=true; |
|
125 | - }else{ |
|
126 | - $value_flag=false; |
|
120 | + } else { |
|
121 | + if (common_model::$global_config['system_config']['opensips'] == 1) { |
|
122 | + if ($value != "accounts/".$entity_name."_opensips/") { |
|
123 | + $value_flag = true; |
|
124 | + } else { |
|
125 | + $value_flag = false; |
|
127 | 126 | } |
128 | 127 | } |
129 | - if(common_model::$global_config['system_config']['opensips']== 0 ){ |
|
130 | - if($value != "accounts/".$entity_name."_sipdevices/"){ |
|
131 | - $value_flag=true; |
|
132 | - }else{ |
|
133 | - $value_flag=false; |
|
128 | + if (common_model::$global_config['system_config']['opensips'] == 0) { |
|
129 | + if ($value != "accounts/".$entity_name."_sipdevices/") { |
|
130 | + $value_flag = true; |
|
131 | + } else { |
|
132 | + $value_flag = false; |
|
134 | 133 | } |
135 | 134 | } |
136 | 135 | } |
137 | 136 | |
138 | - if($value_flag){ |
|
139 | - $class = ($value == $uri_arr[0]."/".$uri_arr[1]."/" ) ? 'active' : ''; |
|
140 | - if($i==0) |
|
141 | - $class=($uri_arr[1]== $entity_name."_save") ? 'active': $class; |
|
137 | + if ($value_flag) { |
|
138 | + $class = ($value == $uri_arr[0]."/".$uri_arr[1]."/") ? 'active' : ''; |
|
139 | + if ($i == 0) |
|
140 | + $class = ($uri_arr[1] == $entity_name."_save") ? 'active' : $class; |
|
142 | 141 | |
143 | 142 | echo "<li class='$class'><a href ='$url'>$key</a></li>"; |
144 | 143 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | } |
4 | 4 | |
5 | 5 | function create_csv_string($data) { |
6 | - if (!$fp = fopen('php://temp', 'w+')) { |
|
6 | + if ( ! $fp = fopen('php://temp', 'w+')) { |
|
7 | 7 | return FALSE; |
8 | 8 | } |
9 | 9 | foreach ($data as $line) { |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | return stream_get_contents($fp); |
14 | 14 | } |
15 | 15 | |
16 | -function send_csv_mail ($csvData, $body, $to, $subject,$file_name) { |
|
16 | +function send_csv_mail($csvData, $body, $to, $subject, $file_name) { |
|
17 | 17 | //print_r($csvData); |
18 | 18 | $where = array('group_title' =>'email'); |
19 | 19 | $query = $this->CI->db_model->getSelect("*", "system", $where); |
20 | 20 | $query = $query->result_array(); |
21 | - foreach($query as $key=>$val){ |
|
22 | - $from=$val['value']; |
|
21 | + foreach ($query as $key=>$val) { |
|
22 | + $from = $val['value']; |
|
23 | 23 | } |
24 | 24 | $multipartSep = '-----'.md5(time()).'-----'; |
25 | 25 | $headers = array( |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | "Alert Threshold"=>"user/user_alert_threshold/" |
52 | 52 | )) |
53 | 53 | ); |
54 | -define("CUSTOMEREDIT_ARRAY",serialize(array( |
|
54 | +define("CUSTOMEREDIT_ARRAY", serialize(array( |
|
55 | 55 | "Customer Profile"=>"accounts/customer_edit/", |
56 | 56 | "SIP Devices"=>"accounts/customer_sipdevices/", |
57 | 57 | "Opensips Device"=>"accounts/customer_opensips/", |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ) |
71 | 71 | )); |
72 | 72 | |
73 | -define("PROVIDEREDIT_ARRAY",serialize(array( |
|
73 | +define("PROVIDEREDIT_ARRAY", serialize(array( |
|
74 | 74 | "Provider Profile"=>"accounts/provider_edit/", |
75 | 75 | "SIP Devices"=>"accounts/provider_sipdevices/", |
76 | 76 | "Opensips Device"=>"accounts/provider_opensips/", |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | "Alert Threshold"=>"accounts/provider_alert_threshold/" |
89 | 89 | ) |
90 | 90 | )); |
91 | -define("RESELLEREDIT_ARRAY",serialize(array("Reseller Profile"=>"accounts/reseller_edit/", |
|
91 | +define("RESELLEREDIT_ARRAY", serialize(array("Reseller Profile"=>"accounts/reseller_edit/", |
|
92 | 92 | "DID"=>"accounts/reseller_dids/", |
93 | 93 | "Subscription"=>"accounts/reseller_subscription/", |
94 | 94 | "Invoice"=>"accounts/reseller_invoices/", |
@@ -100,15 +100,15 @@ discard block |
||
100 | 100 | "Emails"=>"accounts/reseller_emailhistory/", |
101 | 101 | "Alert Threshold"=>"accounts/reseller_alert_threshold/" |
102 | 102 | ))); |
103 | -define("PACKAGEEDIT_ARRAY", serialize( array( |
|
103 | +define("PACKAGEEDIT_ARRAY", serialize(array( |
|
104 | 104 | "Package Details"=>"package/package_edit/", |
105 | 105 | "Package Codes"=>"package/package_pattern_list/" |
106 | 106 | ))); |
107 | -define("CUSTOMERPROFILE_ARRAY",serialize(array( |
|
107 | +define("CUSTOMERPROFILE_ARRAY", serialize(array( |
|
108 | 108 | "My Profile"=>"user/user_myprofile/", |
109 | 109 | "Change Password"=>"user/user_change_password" |
110 | 110 | ))); |
111 | -define("DATABASE_DIRECTORY",FCPATH.'database_backup'.DIRECTORY_SEPARATOR); |
|
111 | +define("DATABASE_DIRECTORY", FCPATH.'database_backup'.DIRECTORY_SEPARATOR); |
|
112 | 112 | define('LOCALE_REQUEST_PARAM', 'lang'); |
113 | 113 | define('WEBSITE_DOMAIN', 'messages'); |
114 | 114 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('BASEPATH')) |
|
3 | +if ( ! defined('BASEPATH')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /* |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | $this->db->insert("charges", $add_array); |
64 | 64 | $insert_id = $this->db->insert_id(); |
65 | 65 | $data = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $add_array['pricelist_id'])); |
66 | - if($data->num_rows > 0){ |
|
67 | - foreach ($data->result_array() as $key => $value){ |
|
66 | + if ($data->num_rows > 0) { |
|
67 | + foreach ($data->result_array() as $key => $value) { |
|
68 | 68 | $this->common->mail_to_users('add_subscription', $value); |
69 | 69 | } |
70 | 70 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->db->where("id", $id); |
89 | 89 | $this->db->update("charges", $data); |
90 | 90 | |
91 | - if($data['pricelist_id'] == 0){ |
|
91 | + if ($data['pricelist_id'] == 0) { |
|
92 | 92 | $this->db->where("charge_id", $id); |
93 | 93 | $this->db->delete("charge_to_account"); |
94 | 94 | } |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | $data = $data->result_array(); |
104 | 104 | $data = $data[0]; |
105 | 105 | $data = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $data['pricelist_id'])); |
106 | - if($data->num_rows > 0){ |
|
107 | - foreach ($data->result_array() as $key => $value){ |
|
106 | + if ($data->num_rows > 0) { |
|
107 | + foreach ($data->result_array() as $key => $value) { |
|
108 | 108 | $this->common->mail_to_users('remove_subscription', $value); |
109 | 109 | } |
110 | 110 | } |
111 | 111 | return true; |
112 | 112 | } |
113 | 113 | |
114 | - function add_account_charges($pricelistid,$chargeid,$flag){ |
|
115 | - if($flag){ |
|
114 | + function add_account_charges($pricelistid, $chargeid, $flag) { |
|
115 | + if ($flag) { |
|
116 | 116 | $this->db->where("charge_id", $chargeid); |
117 | 117 | $this->db->delete("charge_to_account"); |
118 | 118 | } |
119 | 119 | $account = $this->db_model->getSelect("*", "accounts", array("pricelist_id"=>$pricelistid)); |
120 | - if($account->num_rows > 0){ |
|
121 | - foreach ($account->result_array() as $key => $value){ |
|
122 | - $charge_arr = array("charge_id"=>$chargeid,"accountid"=>$value['id'],"assign_date"=>gmdate("Y-m-d H:i:s")); |
|
120 | + if ($account->num_rows > 0) { |
|
121 | + foreach ($account->result_array() as $key => $value) { |
|
122 | + $charge_arr = array("charge_id"=>$chargeid, "accountid"=>$value['id'], "assign_date"=>gmdate("Y-m-d H:i:s")); |
|
123 | 123 | $this->db->insert("charge_to_account", $charge_arr); |
124 | 124 | } |
125 | 125 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $this->load->model('charges_model'); |
36 | 36 | |
37 | 37 | if ($this->session->userdata('user_login') == FALSE) |
38 | - redirect(base_url() . '/astpp/login'); |
|
38 | + redirect(base_url().'/astpp/login'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | function periodiccharges_add() { |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | $add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false); |
76 | 76 | $this->charges_model->edit_charge($add_array, $add_array['id']); |
77 | 77 | |
78 | - if($add_array['pricelist_id'] > 0){ |
|
79 | - $this->charges_model->add_account_charges($add_array['pricelist_id'],$add_array['id'],true); |
|
78 | + if ($add_array['pricelist_id'] > 0) { |
|
79 | + $this->charges_model->add_account_charges($add_array['pricelist_id'], $add_array['id'], true); |
|
80 | 80 | } |
81 | 81 | echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription updated successfully!")); |
82 | 82 | exit; |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | } else { |
91 | 91 | $add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false); |
92 | 92 | $charge_id = $this->charges_model->add_charge($add_array); |
93 | - if($add_array['pricelist_id'] > 0 && $charge_id > 0){ |
|
94 | - $this->charges_model->add_account_charges($add_array['pricelist_id'],$charge_id,false); |
|
93 | + if ($add_array['pricelist_id'] > 0 && $charge_id > 0) { |
|
94 | + $this->charges_model->add_account_charges($add_array['pricelist_id'], $charge_id, false); |
|
95 | 95 | } |
96 | 96 | echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription added successfully!")); |
97 | 97 | exit; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | function periodiccharges_delete($id) { |
105 | 105 | $this->charges_model->remove_charge($id); |
106 | 106 | $this->session->set_flashdata('astpp_notification', 'Subscription removed successfully!'); |
107 | - redirect(base_url() . 'charges/periodiccharges/'); |
|
107 | + redirect(base_url().'charges/periodiccharges/'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | function periodiccharges_search() { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->session->set_userdata('charges_list_search', $action); |
121 | 121 | } |
122 | 122 | if (@$ajax_search != 1) { |
123 | - redirect(base_url() . 'charges/periodiccharges/'); |
|
123 | + redirect(base_url().'charges/periodiccharges/'); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | function periodiccharges_delete_multiple() { |
161 | 161 | $ids = $this->input->post("selected_ids", true); |
162 | 162 | $where = "id IN ($ids)"; |
163 | - $charge_where="charge_id IN(".$ids.")"; |
|
164 | - $this->db->delete('charge_to_account',$charge_where); |
|
165 | - echo $this->db->delete("charges",$where); |
|
163 | + $charge_where = "charge_id IN(".$ids.")"; |
|
164 | + $this->db->delete('charge_to_account', $charge_where); |
|
165 | + echo $this->db->delete("charges", $where); |
|
166 | 166 | } |
167 | 167 | function customer_charge_list($accountid, $accounttype) { |
168 | 168 | |
@@ -176,18 +176,18 @@ discard block |
||
176 | 176 | $where = array('accounts.id' => $accountid); |
177 | 177 | $order_type = 'id'; |
178 | 178 | $order_by = "ASC"; |
179 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_subscription'); |
|
180 | - $like_str=!empty($instant_search) ? "(charges.description like '%$instant_search%' |
|
179 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_subscription'); |
|
180 | + $like_str = ! empty($instant_search) ? "(charges.description like '%$instant_search%' |
|
181 | 181 | OR charges.charge like '%$instant_search%' |
182 | 182 | OR charges.charge like '%$instant_search%' |
183 | 183 | )" |
184 | 184 | :null; |
185 | - if(!empty($like_str)) |
|
185 | + if ( ! empty($like_str)) |
|
186 | 186 | $this->db->where($like_str); |
187 | 187 | $count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type); |
188 | 188 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
189 | 189 | $json_data = $paging_data["json_paging"]; |
190 | - if(!empty($like_str)) |
|
190 | + if ( ! empty($like_str)) |
|
191 | 191 | $this->db->where($like_str); |
192 | 192 | $account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], $order_by, $order_type, ""); |
193 | 193 | $grid_fields = json_decode($this->charges_form->build_charges_list_for_customer($accountid, $accounttype)); |