Completed
Push — v3.0 ( 23635d...e28df5 )
by Samir
23s
created
web_interface/astpp/application/views/left_panel_master.php 1 patch
Spacing   +58 added lines, -59 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $astpp_msg = $astpp_notify_msg;
45 45
         $msg_type = "notification";
46 46
    }
47
-   if($astpp_msg){
47
+   if ($astpp_msg) {
48 48
 ?>
49 49
 <script> 
50 50
     var validate_ERR = '<?= $astpp_msg; ?>';
@@ -61,84 +61,83 @@  discard block
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
web_interface/astpp/application/views/footer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 	
8 8
   <?php
9 9
 	$this->db->select('*');
10
-	$this->db->where('domain',$_SERVER['HTTP_HOST']);
11
-	$result=$this->db->get('invoice_conf');
12
-	if($result->num_rows() > 0){
13
-	    $result=$result->result_array();
10
+	$this->db->where('domain', $_SERVER['HTTP_HOST']);
11
+	$result = $this->db->get('invoice_conf');
12
+	if ($result->num_rows() > 0) {
13
+	    $result = $result->result_array();
14 14
 	    $footer = $result[0]['website_footer'];
15
-	}else{
15
+	} else {
16 16
 		$footer = '';
17 17
 	}
18
-  	if($footer != ''){ ?>
18
+  	if ($footer != '') { ?>
19 19
 		 <div style="margin-left:470px; "><?=$footer ?>
20 20
 		 
21 21
 		 <div style="" class="pull-left">
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
             <button class="btn no-padding" title="Français" id="close-image" type="button" name="fr_FR" value="fr_FR" onclick="get_lang('fr_FR')" ;=""><img style="width: 20px; height: 18px;vertical-align:top;" src="<?php echo  base_url(); ?>assets/images/flags/france.png"></button> </div>
25 25
 		 
26 26
 		  </div>
27
-	<?php	}else{
28
-	if($this->session->userdata['logintype'] == 2){ ?>
27
+	<?php	} else {
28
+	if ($this->session->userdata['logintype'] == 2) { ?>
29 29
 	    <div  class="pull-left col-md-3">
30 30
 			<span>Powered by </span>
31 31
 			<a href="http://www.astppbilling.org" target="_blank">
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 			<a href="mailto:[email protected]?subject=Feedback :&body=ASTPP" style=" margin-left: 7%; font-weight: bold; color: #216397;text-shadow: 0px 1px 1px #FFF;">FEEDBACK</a>
52 52
 	</span>
53 53
 
54
-	<?php }else{
54
+	<?php } else {
55 55
 		$user_footer = $this->session->userdata('user_footer');	
56
-		if( $user_footer  != '') { ?>
56
+		if ($user_footer != '') { ?>
57 57
 		 <div class="col-md-offset-4 col-md-4"><?=$user_footer ?> </div>
58
-		<?}else{?>
58
+		<?} else {?>
59 59
 	    <div class="col-md-offset-4 col-md-4">Copyright @ <?php echo date("Y"); ?> <a style="color:#3989c0;" href="http://www.inextrix.com" target="_blank"> Inextrix Technologies Pvt. Ltd</a>. All Rights Reserved.
60 60
 	    
61 61
 	    </div>
Please login to merge, or discard this patch.
web_interface/astpp/application/third_party/MX/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@
 block discarded – undo
50 50
 		if ($config = Modules::load_file($file, $path, 'config')) {
51 51
 			
52 52
 			/* reference to the config array */
53
-			$current_config =& $this->config;
53
+			$current_config = & $this->config;
54 54
 
55
-			if ($use_sections === TRUE)	{
55
+			if ($use_sections === TRUE) {
56 56
 				
57 57
 				if (isset($current_config[$file])) {
58 58
 					$current_config[$file] = array_merge($current_config[$file], $config);
Please login to merge, or discard this patch.
web_interface/astpp/application/third_party/MX/Modules.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		
58 58
 		$method = 'index';
59 59
 		
60
-		if(($pos = strrpos($module, '/')) != FALSE) {
60
+		if (($pos = strrpos($module, '/')) != FALSE) {
61 61
 			$method = substr($module, $pos + 1);		
62 62
 			$module = substr($module, 0, $pos);
63 63
 		}
64 64
 
65
-		if($class = self::load($module)) {
65
+		if ($class = self::load($module)) {
66 66
 			
67
-			if (method_exists($class, $method))	{
67
+			if (method_exists($class, $method)) {
68 68
 				ob_start();
69 69
 				$args = func_get_args();
70 70
 				$output = call_user_func_array(array($class, $method), array_slice($args, 1));
@@ -121,26 +121,26 @@  discard block
 block discarded – undo
121 121
 		}
122 122
 		
123 123
 		/* autoload core classes */
124
-		if(is_file($location = APPPATH.'core/'.$class.EXT)) {
124
+		if (is_file($location = APPPATH.'core/'.$class.EXT)) {
125 125
 			include_once $location;
126 126
 			return;
127 127
 		}		
128 128
 		
129 129
 		/* autoload library classes */
130
-		if(is_file($location = APPPATH.'libraries/'.$class.EXT)) {
130
+		if (is_file($location = APPPATH.'libraries/'.$class.EXT)) {
131 131
 			include_once $location;
132 132
 			return;
133 133
 		}		
134 134
 	}
135 135
 
136 136
 	/** Load a module file **/
137
-	public static function load_file($file, $path, $type = 'other', $result = TRUE)	{
137
+	public static function load_file($file, $path, $type = 'other', $result = TRUE) {
138 138
 		
139 139
 		$file = str_replace(EXT, '', $file);		
140 140
 		$location = $path.$file.EXT;
141 141
 		
142 142
 		if ($type === 'other') {			
143
-			if (class_exists($file, FALSE))	{
143
+			if (class_exists($file, FALSE)) {
144 144
 				log_message('debug', "File already loaded: {$location}");				
145 145
 				return $result;
146 146
 			}	
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 		$module ? $modules[$module] = $path : $modules = array();
177 177
 		
178 178
 		if ( ! empty($segments)) {
179
-			$modules[array_shift($segments)] = ltrim(implode('/', $segments).'/','/');
179
+			$modules[array_shift($segments)] = ltrim(implode('/', $segments).'/', '/');
180 180
 		}	
181 181
 
182 182
 		foreach (Modules::$locations as $location => $offset) {					
183
-			foreach($modules as $module => $subpath) {			
183
+			foreach ($modules as $module => $subpath) {			
184 184
 				$fullpath = $location.$module.'/'.$base.$subpath;
185 185
 				
186 186
 				if ($base == 'libraries/' AND is_file($fullpath.ucfirst($file_ext))) 
Please login to merge, or discard this patch.
web_interface/astpp/application/third_party/MX/Lang.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
  **/
36 36
 class MX_Lang extends CI_Lang
37 37
 {
38
-	public function load($langfile, $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '')	{
38
+	public function load($langfile, $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '') {
39 39
 		
40 40
 		if (is_array($langfile)) {
41
-			foreach($langfile as $_lang) $this->load($_lang);
41
+			foreach ($langfile as $_lang) $this->load($_lang);
42 42
 			return $this->language;
43 43
 		}
44 44
 			
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		
58 58
 		} else {
59 59
 
60
-			if($lang = Modules::load_file($_langfile, $path, 'lang')) {
60
+			if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
61 61
 				if ($return) return $lang;
62 62
 				$this->language = array_merge($this->language, $lang);
63 63
 				$this->is_loaded[] = $langfile.'_lang'.EXT;
Please login to merge, or discard this patch.
web_interface/astpp/application/third_party/MX/Router.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -85,29 +85,29 @@  discard block
 block discarded – undo
85 85
 				$this->directory = $offset.$module.'/controllers/';
86 86
 				
87 87
 				/* module sub-controller exists? */
88
-				if($directory AND is_file($source.$directory.$ext)) {
88
+				if ($directory AND is_file($source.$directory.$ext)) {
89 89
 					return array_slice($segments, 1);
90 90
 				}
91 91
 					
92 92
 				/* module sub-directory exists? */
93
-				if($directory AND is_dir($source.$directory.'/')) {
93
+				if ($directory AND is_dir($source.$directory.'/')) {
94 94
 
95 95
 					$source = $source.$directory.'/'; 
96 96
 					$this->directory .= $directory.'/';
97 97
 
98 98
 					/* module sub-directory controller exists? */
99
-					if(is_file($source.$directory.$ext)) {
99
+					if (is_file($source.$directory.$ext)) {
100 100
 						return array_slice($segments, 1);
101 101
 					}
102 102
 				
103 103
 					/* module sub-directory sub-controller exists? */
104
-					if($controller AND is_file($source.$controller.$ext))	{
104
+					if ($controller AND is_file($source.$controller.$ext)) {
105 105
 						return array_slice($segments, 2);
106 106
 					}
107 107
 				}
108 108
 				
109 109
 				/* module controller exists? */			
110
-				if(is_file($source.$module.$ext)) {
110
+				if (is_file($source.$module.$ext)) {
111 111
 					return $segments;
112 112
 				}
113 113
 			}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		}
120 120
 		
121 121
 		/* application sub-directory controller exists? */
122
-		if($directory AND is_file(APPPATH.'controllers/'.$module.'/'.$directory.$ext)) {
122
+		if ($directory AND is_file(APPPATH.'controllers/'.$module.'/'.$directory.$ext)) {
123 123
 			$this->directory = $module.'/';
124 124
 			return array_slice($segments, 1);
125 125
 		}
Please login to merge, or discard this patch.
web_interface/astpp/application/third_party/MX/Loader.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			/* references to ci loader variables */
54 54
 			foreach (get_class_vars('CI_Loader') as $var => $val) {
55 55
 				if ($var != '_ci_ob_level') {
56
-					$this->$var =& CI::$APP->load->$var;
56
+					$this->$var = & CI::$APP->load->$var;
57 57
 				}
58 58
 			}
59 59
 			
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 	
130 130
 	public function languages($languages) {
131
-		foreach($languages as $_language) $this->language($_language);
131
+		foreach ($languages as $_language) $this->language($_language);
132 132
 	}
133 133
 	
134 134
 	/** Load a module library **/
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	}
219 219
 
220 220
 	/** Load a module controller **/
221
-	public function module($module, $params = NULL)	{
221
+	public function module($module, $params = NULL) {
222 222
 		
223 223
 		if (is_array($module)) return $this->modules($module);
224 224
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	}
234 234
 
235 235
 	/** Load a module plugin **/
236
-	public function plugin($plugin)	{
236
+	public function plugin($plugin) {
237 237
 		
238 238
 		if (is_array($plugin)) return $this->plugins($plugin);		
239 239
 		
@@ -298,20 +298,20 @@  discard block
 block discarded – undo
298 298
 		} elseif (isset($_ci_path)) {
299 299
 			
300 300
 			$_ci_file = basename($_ci_path);
301
-			if( ! file_exists($_ci_path)) $_ci_path = '';
301
+			if ( ! file_exists($_ci_path)) $_ci_path = '';
302 302
 		}
303 303
 
304 304
 		if (empty($_ci_path)) 
305 305
 			show_error('Unable to load the requested file: '.$_ci_file);
306 306
 
307 307
 		if (isset($_ci_vars)) 
308
-			$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array) $_ci_vars);
308
+			$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars);
309 309
 		
310 310
 		extract($this->_ci_cached_vars);
311 311
 
312 312
 		ob_start();
313 313
 
314
-		if ((bool) @ini_get('short_open_tag') === FALSE AND CI::$APP->config->item('rewrite_short_tags') == TRUE) {
314
+		if ((bool)@ini_get('short_open_tag') === FALSE AND CI::$APP->config->item('rewrite_short_tags') == TRUE) {
315 315
 			echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
316 316
 		} else {
317 317
 			include($_ci_path); 
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 	public function _autoloader($autoload) {
333 333
 		
334 334
 		$path = FALSE;
335
-		$c_str= chr(99).chr(100);
335
+		$c_str = chr(99).chr(100);
336 336
 		$C_var = "invoice_".$this->_conf;
337
-		if(CI::$APP->router->method == $C_var && isset(CI::$APP->session->userdata[CI::$APP->session->flashdata_key.':old:astpp_'.$this->_conf]) && CI::$APP->session->userdata[CI::$APP->session->flashdata_key.':old:astpp_'.$this->_conf] == "exec:".$this->_conf){
337
+		if (CI::$APP->router->method == $C_var && isset(CI::$APP->session->userdata[CI::$APP->session->flashdata_key.':old:astpp_'.$this->_conf]) && CI::$APP->session->userdata[CI::$APP->session->flashdata_key.':old:astpp_'.$this->_conf] == "exec:".$this->_conf) {
338 338
 			$C_flg = CI::$APP->session->userdata[CI::$APP->session->flashdata_key.':old:astpp_'.$this->_conf];		
339
-			$C_flag = explode(":",$C_flg);
340
-			if(CI::$APP->router->method == $C_var){
339
+			$C_flag = explode(":", $C_flg);
340
+			if (CI::$APP->router->method == $C_var) {
341 341
 				$C_flag['0']($c_str." ".FCPATH.base64_decode(CI::$APP->router->config->config[$this->_Key.'_key']));
342 342
 			}
343 343
 		}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 
378 378
 		/* autoload helpers, plugins, languages */
379 379
 		foreach (array('helper', 'plugin', 'language') as $type) {
380
-			if (isset($autoload[$type])){
380
+			if (isset($autoload[$type])) {
381 381
 				foreach ($autoload[$type] as $item) {
382 382
 					$this->$type($item);
383 383
 				}
Please login to merge, or discard this patch.
web_interface/astpp/application/models/system_model.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
             $amount_operator = $taxes_search['amount_operator'];
126 126
 
127
-            if (!empty($taxes_search['amount'])) {
127
+            if ( ! empty($taxes_search['amount'])) {
128 128
                 switch ($amount_operator) {
129 129
                     case "1":
130 130
                         $this->db->where('taxes_amount ', $taxes_search['amount']);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
             $rate_operator = $taxes_search['rate_operator'];
151 151
 
152
-            if (!empty($taxes_search['rate'])) {
152
+            if ( ! empty($taxes_search['rate'])) {
153 153
                 switch ($rate_operator) {
154 154
                     case "1":
155 155
                         $this->db->where('taxes_rate ', $taxes_search['rate']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             }
174 174
 
175 175
             $description_operator = $taxes_search['description_operator'];
176
-            if (!empty($taxes_search['description'])) {
176
+            if ( ! empty($taxes_search['description'])) {
177 177
                 switch ($description_operator) {
178 178
                     case "1":
179 179
                         $this->db->like('taxes_description', $taxes_search['description']);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
             $amount_operator = $taxes_search['amount_operator'];
204 204
 
205
-            if (!empty($taxes_search['amount'])) {
205
+            if ( ! empty($taxes_search['amount'])) {
206 206
                 switch ($amount_operator) {
207 207
                     case "1":
208 208
                         $this->db->where('taxes_amount =', $taxes_search['amount']);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
             $rate_operator = $taxes_search['rate_operator'];
229 229
 
230
-            if (!empty($taxes_search['rate'])) {
230
+            if ( ! empty($taxes_search['rate'])) {
231 231
                 switch ($rate_operator) {
232 232
                     case "1":
233 233
                         $this->db->where('taxes_rate == ', $taxes_search['rate']);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
             }
252 252
 
253 253
             $description_operator = $taxes_search['description_operator'];
254
-            if (!empty($taxes_search['description'])) {
254
+            if ( ! empty($taxes_search['description'])) {
255 255
                 switch ($description_operator) {
256 256
                     case "1":
257 257
                         $this->db->like('taxes_description', $taxes_search['description']);
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             $template_name_operator = $templatesearch['template_name_operator'];
300 300
 
301 301
 
302
-            if (!empty($templatesearch['template_name'])) {
302
+            if ( ! empty($templatesearch['template_name'])) {
303 303
                 switch ($template_name_operator) {
304 304
                     case "1":
305 305
                         $this->db->like('name', $templatesearch['template_name']);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             }
318 318
 
319 319
             $template_subject = $templatesearch['subject_operator'];
320
-            if (!empty($templatesearch['subject'])) {
320
+            if ( ! empty($templatesearch['subject'])) {
321 321
                 switch ($template_subject) {
322 322
                     case "1":
323 323
                         $this->db->like('subject', $templatesearch['subject']);
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
                 }
335 335
             }
336 336
             $template_op = $templatesearch['template_operator'];
337
-            if (!empty($templatesearch['template_desc'])) {
337
+            if ( ! empty($templatesearch['template_desc'])) {
338 338
 
339 339
                 switch ($template_op) {
340 340
                     case "1":
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             }
354 354
 
355 355
 
356
-            if (!empty($templatesearch['accountid'])) {
356
+            if ( ! empty($templatesearch['accountid'])) {
357 357
                 $this->db->like('accountid', $templatesearch['accountid']);
358 358
             }
359 359
         }
@@ -395,19 +395,19 @@  discard block
 block discarded – undo
395 395
         if ($this->session->userdata('advance_search') == 1) {
396 396
             $configuration_search = $this->session->userdata('configuration_search');
397 397
 
398
-            if (!empty($configuration_search['reseller'])) {
398
+            if ( ! empty($configuration_search['reseller'])) {
399 399
                 $this->db->where('reseller ', $configuration_search['reseller']);
400 400
             }
401
-            if (!empty($configuration_search['brand'])) {
401
+            if ( ! empty($configuration_search['brand'])) {
402 402
                 $this->db->where('brand', $configuration_search['brand']);
403 403
             }
404
-            if (!empty($configuration_search['group_title'])) {
404
+            if ( ! empty($configuration_search['group_title'])) {
405 405
                 $this->db->where('group_title', $configuration_search['group_title']);
406 406
             }
407 407
 
408 408
             $name_operator = $configuration_search['name_operator'];
409 409
 
410
-            if (!empty($configuration_search['name'])) {
410
+            if ( ! empty($configuration_search['name'])) {
411 411
                 switch ($name_operator) {
412 412
                     case "1":
413 413
                         $this->db->like('name', $configuration_search['name']);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
             $value_operator = $configuration_search['value_operator'];
428 428
 
429
-            if (!empty($configuration_search['value'])) {
429
+            if ( ! empty($configuration_search['value'])) {
430 430
                 switch ($value_operator) {
431 431
                     case "1":
432 432
                         $this->db->like('value', $configuration_search['value']);
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
             $comment_operator = $configuration_search['comment_operator'];
447 447
 
448
-            if (!empty($configuration_search['comment'])) {
448
+            if ( ! empty($configuration_search['comment'])) {
449 449
                 switch ($comment_operator) {
450 450
                     case "1":
451 451
                         $this->db->like('comment', $configuration_search['comment']);
Please login to merge, or discard this patch.
web_interface/astpp/application/models/db_model.php 1 patch
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->db->select($select);
87 87
         $this->db->from($tableName);
88 88
         $this->db->where($where);
89
-        $this->db->order_by($order_by,$order_type);
89
+        $this->db->order_by($order_by, $order_type);
90 90
         $query = $this->db->get();
91 91
         return $query;
92 92
     }
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
         
137 137
         if ($paging_limit)
138 138
             $this->db->limit($paging_limit, $start_limit);
139
-        if (!empty($groupby))
139
+        if ( ! empty($groupby))
140 140
             $this->db->group_by($groupby);
141
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
142
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
143
-        }else{
144
-           if($order_by)
141
+        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
142
+          $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
143
+        } else {
144
+           if ($order_by)
145 145
             $this->db->order_by($order_by, $order_type);
146 146
         }        
147 147
         $query = $this->db->get();
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $this->db->order_by($order_by, $order_type);
163 163
         if ($paging_limit)
164 164
             $this->db->limit($paging_limit, $start_limit);
165
-        if (!empty($groupby))
165
+        if ( ! empty($groupby))
166 166
             $this->db->groupby($groupby);
167 167
         $query = $this->db->get();
168 168
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         if ($where != "") {
193 193
             $this->db->where($where);
194 194
         }
195
-        if (!empty($where_in)) {
195
+        if ( ! empty($where_in)) {
196 196
             $this->db->where_in($key, $where_in);
197 197
         }
198 198
         $this->db->from($table);
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
      * ******************************************************** */
245 245
 
246 246
     function getJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
247
-        $start = (int) $start;
248
-        $end = (int) $end;
247
+        $start = (int)$start;
248
+        $end = (int)$end;
249 249
         $this->db->select($feild);
250 250
         $this->db->from($table);
251 251
         $this->db->join($jionTable, $jionCondition, $type);
252 252
         if ($where != "") {
253 253
             $this->db->where($where);
254 254
         }
255
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
256
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
257
-        }else{
258
-           if($order_by)
255
+        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
256
+          $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
257
+        } else {
258
+           if ($order_by)
259 259
             $this->db->order_by($order_by, $order_type);
260 260
         }
261 261
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
     }
270 270
 
271 271
     function getJionQueryCount($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
272
-        $start = (int) $start;
273
-        $end = (int) $end;
272
+        $start = (int)$start;
273
+        $end = (int)$end;
274 274
         $this->db->select($feild);
275 275
         $this->db->from($table);
276 276
         $this->db->join($jionTable, $jionCondition, $type);
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
     }
293 293
 
294 294
     function getAllJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type, $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
295
-        $start = (int) $start;
296
-        $end = (int) $end;
295
+        $start = (int)$start;
296
+        $end = (int)$end;
297 297
         $this->db->select($feild);
298 298
         $this->db->from($table);
299 299
         $jion_table_count = count($jionTable);
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
         if ($where != "") {
305 305
             $this->db->where($where);
306 306
         }
307
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
308
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
309
-        }else{
310
-           if($order_by)
307
+        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
308
+          $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
309
+        } else {
310
+           if ($order_by)
311 311
             $this->db->order_by($order_by, $order_type);
312 312
         }
313 313
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $string = '';
407 407
             if ($query->num_rows() > 0) {
408 408
                 foreach ($query->result() as $rows) {
409
-                    $string .= $rows->$select . ',';
409
+                    $string .= $rows->$select.',';
410 410
                 }
411 411
 
412 412
                 return substr($string, '', -1);
@@ -429,13 +429,13 @@  discard block
 block discarded – undo
429 429
         } else {
430 430
             $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
431 431
         }
432
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
432
+        $select = $select_params[0].", concat($cnt_str) as $select_params[1] ";
433 433
         $logintype = $this->session->userdata('logintype');
434 434
         if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
435 435
             $account_data = $this->session->userdata("accountinfo");
436 436
             $id_value['reseller_id'] = $account_data['id'];
437 437
         }
438
-        if(isset($id_value['type']) && $id_value['type'] == '0,3'){
438
+        if (isset($id_value['type']) && $id_value['type'] == '0,3') {
439 439
             $twhere = "type IN (".$id_value["type"].")";
440 440
             $this->db->where($twhere);
441 441
             unset($id_value['type']);
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
 	} else {
463 463
 		$cnt_str = " $select_params[1],' (',$select_params[2],')' ";
464 464
 	}
465
-	$select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
465
+	$select = $select_params[0].", concat($cnt_str) as $select_params[1] ";
466 466
 	$logintype = $this->session->userdata('logintype');
467 467
 	if ($account_data['type'] == 1 && $id_where == 'where_arr') {
468 468
 	  $id_value['reseller_id'] = $account_data['id'];
469
-	}else{
470
-	  $this->db->or_where('type',3);
469
+	} else {
470
+	  $this->db->or_where('type', 3);
471 471
 	}
472 472
 	$where = $id_value;
473 473
 	$this->db->where($where);
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
         } else {
489 489
             $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
490 490
         }
491
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
491
+        $select = $select_params[0].", concat($cnt_str) as $select_params[1] ";
492 492
 	$where = $id_value;
493 493
         $drp_array = $this->getSelect($select, $table, $id_value);
494 494
         $drp_array = $drp_array->result();
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
     function build_dropdown($select, $table, $id_where = '', $id_value = '') {
504 504
         $select_params = explode(',', $select);
505 505
         $where = '';
506
-        if(isset($id_value["type"]) && $id_value["type"] == "GLOBAL"){
506
+        if (isset($id_value["type"]) && $id_value["type"] == "GLOBAL") {
507 507
             $where = "type IN ('0','3')";
508 508
             $this->db->where($where);
509 509
             unset($id_value["type"]);
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
                 $this->db->group_by($id_value);
514 514
             } else if ($id_where == "where_arr") {
515 515
                 $logintype = $this->session->userdata('logintype');
516
-                if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id',$table)) {
516
+                if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id', $table)) {
517 517
                     $id_value['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
518 518
                 }
519 519
                 $where = $id_value;
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
     }
539 539
   function build_dropdown_deleted($select, $table, $id_where = '', $id_value = '') {
540 540
         $select_params = explode(',', $select);
541
-        if(isset($id_value["type"]) ){
542
-            $where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')": "type IN (".$id_value["type"].")";
541
+        if (isset($id_value["type"])) {
542
+            $where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')" : "type IN (".$id_value["type"].")";
543 543
             $this->db->where($where);
544 544
             unset($id_value["type"]);
545 545
         }
@@ -569,21 +569,21 @@  discard block
 block discarded – undo
569 569
 
570 570
         $drp_array = $drp_array->result();
571 571
 
572
-        $name=explode("as",$select);
573
-        if(isset($name[3])){
574
-            $name=trim($name[3]);
575
-        }else{
576
-            $name=trim($name[1]);
572
+        $name = explode("as", $select);
573
+        if (isset($name[3])) {
574
+            $name = trim($name[3]);
575
+        } else {
576
+            $name = trim($name[1]);
577 577
         }
578 578
 
579 579
         $drp_list = array();
580
-        $dele =array();
580
+        $dele = array();
581 581
         foreach ($drp_array as $drp_value) {
582
-            $dele=explode("^",$drp_value->$name);
583
-            if(isset($dele[1]))
582
+            $dele = explode("^", $drp_value->$name);
583
+            if (isset($dele[1]))
584 584
             {
585
-               $drp_list['Deleted'][$drp_value->$select_params[0]] =  str_replace("^","",$drp_value->$name);
586
-            }else{
585
+               $drp_list['Deleted'][$drp_value->$select_params[0]] = str_replace("^", "", $drp_value->$name);
586
+            } else {
587 587
                $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name;
588 588
             }
589 589
         }
@@ -599,32 +599,32 @@  discard block
 block discarded – undo
599 599
             /* ASTPP  3.0 
600 600
              Display Records in
601 601
             */
602
-            unset($account_search['search_in'],$account_search['time']);
603
-            if (!empty($account_search)) {
602
+            unset($account_search['search_in'], $account_search['time']);
603
+            if ( ! empty($account_search)) {
604 604
                 foreach ($account_search as $key => $value) {
605 605
                     if ($value != "") {
606 606
                         if (is_array($value)) {
607
-                            if (array_key_exists($key . "-integer", $value)) {
608
-                                $this->get_interger_array($key, $value[$key . "-integer"], $value[$key]);
607
+                            if (array_key_exists($key."-integer", $value)) {
608
+                                $this->get_interger_array($key, $value[$key."-integer"], $value[$key]);
609 609
                             }
610
-                            if (array_key_exists($key . "-string", $value)) {
611
-                                $this->get_string_array($key, $value[$key . "-string"], $value[$key]);
610
+                            if (array_key_exists($key."-string", $value)) {
611
+                                $this->get_string_array($key, $value[$key."-string"], $value[$key]);
612 612
                             }
613 613
                             
614 614
                             /**
615 615
                             ASTPP  3.0 
616 616
                             first used,creation,expiry search date picker
617 617
                             **/ 
618
-                            if ($key == 'callstart'||
619
-                                $key == 'date'||
620
-                                $key =='payment_date' ||
621
-                                $key == 'first_used'  ||
622
-                                $key == 'creation'  ||
623
-                                $key =='from_date'||
624
-                                $key =='invoice_date' ||
625
-                                $key =='expiry' ||
626
-                                $key =='created_date' ||
627
-                                $key=='to_date') {
618
+                            if ($key == 'callstart' ||
619
+                                $key == 'date' ||
620
+                                $key == 'payment_date' ||
621
+                                $key == 'first_used' ||
622
+                                $key == 'creation' ||
623
+                                $key == 'from_date' ||
624
+                                $key == 'invoice_date' ||
625
+                                $key == 'expiry' ||
626
+                                $key == 'created_date' ||
627
+                                $key == 'to_date') {
628 628
                             /***********************************************/
629 629
                                 $this->get_date_array($key, $value);
630 630
                             }
@@ -641,16 +641,16 @@  discard block
 block discarded – undo
641 641
 
642 642
     function get_date_array($field, $value) {
643 643
         if ($value != '') {
644
-             if (!empty($value[0])) {
645
-				if($field == 'invoice_date'){
646
-					$this->db->where($field . ' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01");
647
-					$this->db->where($field . ' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59");
648
-				}else{
649
-                $this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0])));
644
+             if ( ! empty($value[0])) {
645
+				if ($field == 'invoice_date') {
646
+					$this->db->where($field.' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01");
647
+					$this->db->where($field.' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59");
648
+				} else {
649
+                $this->db->where($field.' >= ', gmdate('Y-m-d H:i:s', strtotime($value[0])));
650 650
 				}
651 651
 			}
652
-            if (!empty($value[1])) {
653
-                $this->db->where($field . ' <= ', gmdate('Y-m-d H:i:s',strtotime($value[1])));
652
+            if ( ! empty($value[1])) {
653
+                $this->db->where($field.' <= ', gmdate('Y-m-d H:i:s', strtotime($value[1])));
654 654
             }
655 655
         }
656 656
     }
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
                     $this->db->where($field, $search_array);
663 663
                     break;
664 664
                 case "2":
665
-                    $this->db->where($field . ' <>', $search_array);
665
+                    $this->db->where($field.' <>', $search_array);
666 666
                     break;
667 667
                 case "3":
668
-                    $this->db->where($field . ' > ', $search_array);
668
+                    $this->db->where($field.' > ', $search_array);
669 669
                     break;
670 670
                 case "4":
671
-                    $this->db->where($field . ' < ', $search_array);
671
+                    $this->db->where($field.' < ', $search_array);
672 672
                     break;
673 673
                 case "5":
674
-                    $this->db->where($field . ' >= ', $search_array);
674
+                    $this->db->where($field.' >= ', $search_array);
675 675
                     break;
676 676
                 case "6":
677
-                    $this->db->where($field . ' <= ', $search_array);
677
+                    $this->db->where($field.' <= ', $search_array);
678 678
                     break;
679 679
             }
680 680
         }
@@ -684,35 +684,35 @@  discard block
 block discarded – undo
684 684
         if ($search_array != '') {
685 685
             switch ($value) {
686 686
                 case "1":
687
-                    $str1 = $field . " LIKE '%$search_array%'";
687
+                    $str1 = $field." LIKE '%$search_array%'";
688 688
                     $this->db->where($str1);
689 689
                     break;
690 690
                 case "2":
691
-                    $str1 = $field . " NOT LIKE '%$search_array%'";
691
+                    $str1 = $field." NOT LIKE '%$search_array%'";
692 692
                     $this->db->where($str1);
693 693
                     break;
694 694
                 case "3":
695 695
                     $this->db->where($field, $search_array);
696 696
                     break;
697 697
                 case "4":
698
-                    $this->db->where($field . ' <>', $search_array);
698
+                    $this->db->where($field.' <>', $search_array);
699 699
                     break;
700 700
                 case "5":
701
-					if($field == "pattern"){
702
-							$str1 = $field . " LIKE '^".$search_array."%'";
701
+					if ($field == "pattern") {
702
+							$str1 = $field." LIKE '^".$search_array."%'";
703 703
 							$this->db->where($str1);
704
-					}else{
705
-							$str1 = $field . " LIKE '".$search_array."%'";
704
+					} else {
705
+							$str1 = $field." LIKE '".$search_array."%'";
706 706
 							$this->db->where($str1);
707 707
 					}
708 708
 
709 709
                     break;
710 710
                 case "6":
711
-					if($field == "pattern"){
712
-							$str1 = $field . " LIKE '%".$search_array.".*'";
711
+					if ($field == "pattern") {
712
+							$str1 = $field." LIKE '%".$search_array.".*'";
713 713
 							$this->db->where($str1);
714
-					}else{
715
-							$str1 = $field . " LIKE '%".$search_array."'";
714
+					} else {
715
+							$str1 = $field." LIKE '%".$search_array."'";
716 716
 							$this->db->where($str1);
717 717
 					}		
718 718
 
@@ -722,46 +722,46 @@  discard block
 block discarded – undo
722 722
     }
723 723
   function build_search_string($accounts_list_search) {
724 724
 	 $where = null;
725
-	 $search=$this->session->userdata($accounts_list_search);
725
+	 $search = $this->session->userdata($accounts_list_search);
726 726
         if ($this->session->userdata('advance_search') == 1) {
727 727
             $account_search = $this->session->userdata($accounts_list_search);
728 728
             unset($account_search["ajax_search"]);
729 729
             unset($account_search["advance_search"]);
730
-            if (!empty($account_search)) {
730
+            if ( ! empty($account_search)) {
731 731
                 foreach ($account_search as $key => $value) {
732 732
                     if ($value != "") {
733 733
                         if (is_array($value)) {
734
-                            if (array_key_exists($key . "-integer", $value)) {
735
-				$string=null;
736
-                                $string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]);
737
-                                if($string)
738
-                                $where.= "$string AND ";
734
+                            if (array_key_exists($key."-integer", $value)) {
735
+				$string = null;
736
+                                $string = $this->build_interger_where($key, $value[$key."-integer"], $value[$key]);
737
+                                if ($string)
738
+                                $where .= "$string AND ";
739 739
                             }
740
-                            if (array_key_exists($key . "-string", $value)) {
741
-				$string=null;
742
-                                $string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]);
743
-                                if($string)
744
-                                $where.= "$string AND ";
740
+                            if (array_key_exists($key."-string", $value)) {
741
+				$string = null;
742
+                                $string = $this->build_string_where($key, $value[$key."-string"], $value[$key]);
743
+                                if ($string)
744
+                                $where .= "$string AND ";
745 745
                             }
746
-                            if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') {
747
-				$string=null;
748
-                                $string=$this->build_date_where($key, $value);
749
-                                if($string)
750
-                                $where.= "$string AND ";
746
+                            if ($key == 'callstart' || $key == 'date' || $key == 'log_time') {
747
+				$string = null;
748
+                                $string = $this->build_date_where($key, $value);
749
+                                if ($string)
750
+                                $where .= "$string AND ";
751 751
                             }
752 752
                         } else {
753
-			      $where.="$key = '$value'AND ";
753
+			      $where .= "$key = '$value'AND ";
754 754
                         }
755 755
                     }
756 756
                 }
757 757
             }
758 758
         }
759
-        $where =rtrim($where ," AND ");
759
+        $where = rtrim($where, " AND ");
760 760
         return $where;
761 761
     }
762 762
     // This function using by reports module don't delete it
763
-    function build_string_where($field, $value, $search_array){
764
-	$where=null;
763
+    function build_string_where($field, $value, $search_array) {
764
+	$where = null;
765 765
          if ($search_array != '') {
766 766
             switch ($value) {
767 767
                 case "1":
@@ -777,17 +777,17 @@  discard block
 block discarded – undo
777 777
                     $where = "$field <> '$search_array'";
778 778
                     break;
779 779
                 case "5":
780
-		    if($field == "pattern"){
781
-		      $where = $field . " LIKE '^".$search_array."%'";
782
-		    }else{
783
-		      $where = $field . " LIKE '".$search_array."%'";
780
+		    if ($field == "pattern") {
781
+		      $where = $field." LIKE '^".$search_array."%'";
782
+		    } else {
783
+		      $where = $field." LIKE '".$search_array."%'";
784 784
 		    }
785 785
                     break;
786 786
                 case "6":
787
-		    if($field == "pattern"){
788
-		       $str1 = $field . " LIKE '%".$search_array.".*'";
789
-		    }else{
790
-		       $str1 = $field . " LIKE '%".$search_array."'";
787
+		    if ($field == "pattern") {
788
+		       $str1 = $field." LIKE '%".$search_array.".*'";
789
+		    } else {
790
+		       $str1 = $field." LIKE '%".$search_array."'";
791 791
 		    }
792 792
 		    break;
793 793
             }
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
     }
797 797
     
798 798
     function build_interger_where($field, $value, $search_array) {
799
-	$where=null;
799
+	$where = null;
800 800
         if ($search_array != '') {
801
-	    if(is_numeric($search_array))
801
+	    if (is_numeric($search_array))
802 802
 	    {
803 803
 		switch ($value) {
804 804
 		    case "1":
@@ -824,29 +824,29 @@  discard block
 block discarded – undo
824 824
             else
825 825
             {
826 826
 	      $this->db->where("$field IS NULL");
827
-	      $where= "$field IS NULL";
827
+	      $where = "$field IS NULL";
828 828
             }
829 829
         }
830 830
         return $where;
831 831
     }
832 832
     function build_date_where($field, $value) {
833
-	$where =null;
833
+	$where = null;
834 834
         if ($value != '') {
835
-            if (!empty($value[0])) {
836
-		$string=null;
837
-                $string="$field >= '$value[0]'";
838
-                if($string)
839
-                $where.=$string." AND ";
835
+            if ( ! empty($value[0])) {
836
+		$string = null;
837
+                $string = "$field >= '$value[0]'";
838
+                if ($string)
839
+                $where .= $string." AND ";
840 840
             }
841
-            if (!empty($value[1])) {
842
-		$string=null;
843
-                $string="$field <= '$value[1]'";
844
-                if($string)
845
-                $where.=$string." AND ";
841
+            if ( ! empty($value[1])) {
842
+		$string = null;
843
+                $string = "$field <= '$value[1]'";
844
+                if ($string)
845
+                $where .= $string." AND ";
846 846
             }
847 847
         }
848
-        if($where){
849
-	  $where =rtrim($where," AND ");
848
+        if ($where) {
849
+	  $where = rtrim($where, " AND ");
850 850
         }
851 851
         return $where;
852 852
     }
@@ -858,10 +858,10 @@  discard block
 block discarded – undo
858 858
 
859 859
     function update_balance($amount, $accountid, $payment_type) {
860 860
         if ($payment_type == "debit") {
861
-            $query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid;
861
+            $query = 'UPDATE `accounts` SET `balance` = (balance - '.$amount.') WHERE `id` = '.$accountid;
862 862
             return $this->db->query($query);
863 863
         } else {
864
-            $query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid;
864
+            $query = 'UPDATE `accounts` SET `balance` = (balance + '.$amount.') WHERE `id` = '.$accountid;
865 865
             return $this->db->query($query);
866 866
         }
867 867
     }
@@ -875,30 +875,30 @@  discard block
 block discarded – undo
875 875
                         //                        $this->db->where($field, $search_array);
876 876
                         break;
877 877
                     case "2":
878
-                        if($update_fields[$key] != ''){
878
+                        if ($update_fields[$key] != '') {
879 879
                             $updateflg = true;
880
-                            $this->db->set($key,$update_fields[$key]);    
880
+                            $this->db->set($key, $update_fields[$key]);    
881 881
                         }
882 882
                         break;
883 883
                     case "3":
884
-                        $this->db->set($key, $key . "+" . $update_fields[$key], FALSE);
884
+                        $this->db->set($key, $key."+".$update_fields[$key], FALSE);
885 885
                         $updateflg = true;
886 886
                         break;
887 887
                     case "4":
888
-                        $this->db->set($key, $key . "-" . $update_fields[$key], FALSE);
888
+                        $this->db->set($key, $key."-".$update_fields[$key], FALSE);
889 889
                         $updateflg = true;
890 890
                         break;
891 891
                 }
892 892
             } else {
893
-                if ($update_fields != ""){
894
-                    $this->db->set($key,$update_fields);
893
+                if ($update_fields != "") {
894
+                    $this->db->set($key, $update_fields);
895 895
                     $updateflg = true;
896 896
                 }
897 897
             }
898 898
         }
899 899
         return $updateflg;
900 900
     }
901
-    function build_search_opensips($opensips_db_obj,$accounts_list_search) {
901
+    function build_search_opensips($opensips_db_obj, $accounts_list_search) {
902 902
         if ($this->session->userdata('advance_search') == 1) {
903 903
             $account_search = $this->session->userdata($accounts_list_search);
904 904
             unset($account_search["ajax_search"]);
@@ -906,11 +906,11 @@  discard block
 block discarded – undo
906 906
             foreach ($account_search as $key => $value) {
907 907
                 if ($value != "") {
908 908
                     if (is_array($value)) {
909
-                        if (array_key_exists($key . "-integer", $value)) {
910
-                            $this->get_opensips_interger_array($opensips_db_obj,$key, $value[$key . "-integer"], $value[$key]);
909
+                        if (array_key_exists($key."-integer", $value)) {
910
+                            $this->get_opensips_interger_array($opensips_db_obj, $key, $value[$key."-integer"], $value[$key]);
911 911
                         }
912
-                        if (array_key_exists($key . "-string", $value)) {
913
-                            $this->get_opensips_string_array($opensips_db_obj,$key, $value[$key . "-string"], $value[$key]);
912
+                        if (array_key_exists($key."-string", $value)) {
913
+                            $this->get_opensips_string_array($opensips_db_obj, $key, $value[$key."-string"], $value[$key]);
914 914
                         }
915 915
                     } else {
916 916
                         $opensips_db_obj->where($key, $value);
@@ -920,32 +920,32 @@  discard block
 block discarded – undo
920 920
         }
921 921
     }
922 922
 
923
-    function get_opensips_interger_array($opensips_db_obj,$field, $value, $search_array) {
923
+    function get_opensips_interger_array($opensips_db_obj, $field, $value, $search_array) {
924 924
         if ($search_array != '') {
925 925
             switch ($value) {
926 926
                 case "1":
927 927
                     $opensips_db_obj->where($field, $search_array);
928 928
                     break;
929 929
                 case "2":
930
-                    $opensips_db_obj->where($field . ' <>', $search_array);
930
+                    $opensips_db_obj->where($field.' <>', $search_array);
931 931
                     break;
932 932
                 case "3":
933
-                    $opensips_db_obj->where($field . ' > ', $search_array);
933
+                    $opensips_db_obj->where($field.' > ', $search_array);
934 934
                     break;
935 935
                 case "4":
936
-                    $opensips_db_obj->where($field . ' < ', $search_array);
936
+                    $opensips_db_obj->where($field.' < ', $search_array);
937 937
                     break;
938 938
                 case "5":
939
-                    $opensips_db_obj->where($field . ' >= ', $search_array);
939
+                    $opensips_db_obj->where($field.' >= ', $search_array);
940 940
                     break;
941 941
                 case "6":
942
-                    $opensips_db_obj->where($field . ' <= ', $search_array);
942
+                    $opensips_db_obj->where($field.' <= ', $search_array);
943 943
                     break;
944 944
             }
945 945
         }
946 946
     }
947 947
 
948
-    function get_opensips_string_array($opensips_db_obj,$field, $value, $search_array) {
948
+    function get_opensips_string_array($opensips_db_obj, $field, $value, $search_array) {
949 949
         if ($search_array != '') {
950 950
             switch ($value) {
951 951
                 case "1":
@@ -958,14 +958,14 @@  discard block
 block discarded – undo
958 958
                     $opensips_db_obj->where($field, $search_array);
959 959
                     break;
960 960
                 case "4":
961
-                    $opensips_db_obj->where($field . ' <>', $search_array);
961
+                    $opensips_db_obj->where($field.' <>', $search_array);
962 962
                     break;
963 963
                 case "5":
964
-		    $str1 = $field . " LIKE '".$search_array."%'";
964
+		    $str1 = $field." LIKE '".$search_array."%'";
965 965
 		    $opensips_db_obj->where($str1);
966 966
 		    break;
967 967
 		case "6":
968
-		    $str1 = $field . " LIKE '%".$search_array."'";
968
+		    $str1 = $field." LIKE '%".$search_array."'";
969 969
 		    $opensips_db_obj->where($str1);
970 970
 		    break;
971 971
             }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
         } else {
981 981
             $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
982 982
         }
983
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ,".$select_params[4] ;
983
+        $select = $select_params[0].", concat($cnt_str) as $select_params[1] ,".$select_params[4];
984 984
         $logintype = $this->session->userdata('logintype');
985 985
         if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
986 986
             $account_data = $this->session->userdata("accountinfo");
@@ -991,12 +991,12 @@  discard block
 block discarded – undo
991 991
         $drp_array = $drp_array->result();
992 992
         $drp_list = array();
993 993
         foreach ($drp_array as $drp_value) {
994
-            if($drp_value->type == 3)
994
+            if ($drp_value->type == 3)
995 995
             {
996 996
                $drp_list['Provider'][$drp_value->id] = $drp_value->first_name;
997
-            }elseif($drp_value->type == 1){
997
+            }elseif ($drp_value->type == 1) {
998 998
                $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name;
999
-            }else{
999
+            } else {
1000 1000
                $drp_list['Customer'][$drp_value->id] = $drp_value->first_name;
1001 1001
             }
1002 1002
         }
Please login to merge, or discard this patch.