Passed
Branch v3.5 (f0ef26)
by Samir
36:09
created
web_interface/astpp/application/modules/did/libraries/did_form.php 2 patches
Spacing   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 // You should have received a copy of the GNU Affero General Public License
22 22
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 23
 // ##############################################################################
24
-if (! defined ( 'BASEPATH' ))
25
-	exit ( 'No direct script access allowed' );
24
+if ( ! defined('BASEPATH'))
25
+	exit ('No direct script access allowed');
26 26
 class did_form {
27 27
 	function __construct() {
28
-		$this->CI = & get_instance ();
28
+		$this->CI = & get_instance();
29 29
 	}
30 30
 	function get_dids_form_fields($id = false, $parent_id = '0', $account_id = '0', $country_id = false) {
31 31
 		if ($id != 0) {
32 32
 			if ($parent_id > 0) {
33
-				$account_dropdown = array (
33
+				$account_dropdown = array(
34 34
 						'Reseller',
35
-						array (
35
+						array(
36 36
 								'name' => 'parent_id',
37 37
 								'disabled' => 'disabled',
38 38
 								'class' => 'accountid',
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 						'accounts',
49 49
 						'build_concat_dropdown',
50 50
 						'where_arr',
51
-						array (
51
+						array(
52 52
 								"reseller_id" => "0",
53 53
 								"type" => "1",
54 54
 								"deleted" => "0",
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 				);
58 58
 			} else {
59 59
 				if ($account_id > 0) {
60
-					$account_dropdown = array (
60
+					$account_dropdown = array(
61 61
 							'Account ',
62
-							array (
62
+							array(
63 63
 									'name' => 'accountid',
64 64
 									'disabled' => 'disabled',
65 65
 									'class' => 'accountid',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 							'accounts',
76 76
 							'build_concat_dropdown',
77 77
 							'where_arr',
78
-							array (
78
+							array(
79 79
 									"reseller_id" => "0",
80 80
 									"type" => "0,3",
81 81
 									"deleted" => "0",
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 							) 
84 84
 					);
85 85
 				} else {
86
-					$account_dropdown = array (
86
+					$account_dropdown = array(
87 87
 							'Account',
88 88
 							'accountid',
89 89
 							'SELECT',
90 90
 							'',
91
-							array (
91
+							array(
92 92
 									"name" => "accountid",
93 93
 									"rules" => "did_account_checking" 
94 94
 							),
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 							'accounts',
100 100
 							'build_concat_dropdown',
101 101
 							'where_arr',
102
-							array (
102
+							array(
103 103
 									"reseller_id" => "0",
104 104
 									"type" => "0,3",
105 105
 									"deleted" => "0",
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
 				}
110 110
 			}
111 111
 		} else {
112
-			$account_dropdown = array (
112
+			$account_dropdown = array(
113 113
 					'Account',
114 114
 					'accountid',
115 115
 					'SELECT',
116 116
 					'',
117
-					array (
117
+					array(
118 118
 							"name" => "accountid",
119 119
 							"rules" => "did_account_checking" 
120 120
 					),
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 					'accounts',
126 126
 					'build_concat_dropdown',
127 127
 					'where_arr',
128
-					array (
128
+					array(
129 129
 							"reseller_id" => "0",
130 130
 							"type" => "0,3",
131 131
 							"deleted" => "0",
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 					) 
134 134
 			);
135 135
 		}
136
-		if (! $country_id) {
136
+		if ( ! $country_id) {
137 137
 			
138
-			$country = array (
138
+			$country = array(
139 139
 					'Country',
140
-					array (
140
+					array(
141 141
 							'name' => 'country_id',
142 142
 							'class' => 'country_id' 
143 143
 					),
144 144
 					'SELECT',
145 145
 					'',
146
-					array (
146
+					array(
147 147
 							"name" => "country_id",
148 148
 							"rules" => "required" 
149 149
 					),
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
 					'' 
158 158
 			);
159 159
 		} else {
160
-			$country = array (
160
+			$country = array(
161 161
 					'Country',
162
-					array (
162
+					array(
163 163
 							'name' => 'country_id',
164 164
 							'class' => 'country_id',
165 165
 							'vlaue' => $country_id 
166 166
 					),
167 167
 					'SELECT',
168 168
 					'',
169
-					array (
169
+					array(
170 170
 							"name" => "country_id",
171 171
 							"rules" => "required",
172 172
 							'selected' => 'selected' 
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
 			);
183 183
 		}
184 184
 		
185
-		$val = $id > 0 ? 'dids.number.' . $id : 'dids.number';
186
-		$form ['forms'] = array (
187
-				base_url () . '/did/did_save/',
188
-				array (
185
+		$val = $id > 0 ? 'dids.number.'.$id : 'dids.number';
186
+		$form ['forms'] = array(
187
+				base_url().'/did/did_save/',
188
+				array(
189 189
 						'id' => 'did_form',
190 190
 						'method' => 'POST',
191 191
 						'name' => 'did_form' 
192 192
 				) 
193 193
 		);
194
-		$form ['DID Information'] = array (
195
-				array (
194
+		$form ['DID Information'] = array(
195
+				array(
196 196
 						'',
197 197
 						'HIDDEN',
198
-						array (
198
+						array(
199 199
 								'name' => 'id' 
200 200
 						),
201 201
 						'',
@@ -203,24 +203,24 @@  discard block
 block discarded – undo
203 203
 						'',
204 204
 						'' 
205 205
 				),
206
-				array (
207
-						gettext ( 'DID' ),
206
+				array(
207
+						gettext('DID'),
208 208
 						'INPUT',
209
-						array (
209
+						array(
210 210
 								'name' => 'number',
211 211
 								'size' => '20',
212 212
 								'class' => "text field medium" 
213 213
 						),
214
-						'trim|required|is_numeric|xss_clean|integer|is_unique[' . $val . ']',
214
+						'trim|required|is_numeric|xss_clean|integer|is_unique['.$val.']',
215 215
 						'tOOL TIP',
216 216
 						'Please Enter account number' 
217 217
 				),
218 218
 				$country,
219 219
 				
220
-				array (
221
-						gettext ( 'City' ),
220
+				array(
221
+						gettext('City'),
222 222
 						'INPUT',
223
-						array (
223
+						array(
224 224
 								'name' => 'city',
225 225
 								'size' => '20',
226 226
 								'class' => "text field medium" 
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 						'tOOL TIP',
230 230
 						'Please Enter Password' 
231 231
 				),
232
-				array (
233
-						gettext ( 'Province' ),
232
+				array(
233
+						gettext('Province'),
234 234
 						'INPUT',
235
-						array (
235
+						array(
236 236
 								'name' => 'province',
237 237
 								'size' => '15',
238 238
 								'class' => "text field medium" 
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 						'tOOL TIP',
242 242
 						'Please Enter Password' 
243 243
 				),
244
-				array (
245
-						gettext ( 'Provider' ),
244
+				array(
245
+						gettext('Provider'),
246 246
 						'provider_id',
247 247
 						'SELECT',
248 248
 						'',
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 						'accounts',
255 255
 						'build_concat_dropdown',
256 256
 						'where_arr',
257
-						array (
257
+						array(
258 258
 								"type" => "3",
259 259
 								"deleted" => "0",
260 260
 								"status" => "0" 
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 				) 
263 263
 		);
264 264
 		
265
-		$form ['Billing Information'] = array (
265
+		$form ['Billing Information'] = array(
266 266
 				$account_dropdown,
267
-				array (
268
-						gettext ( 'Connection Cost' ),
267
+				array(
268
+						gettext('Connection Cost'),
269 269
 						'INPUT',
270
-						array (
270
+						array(
271 271
 								'name' => 'connectcost',
272 272
 								'size' => '15',
273 273
 								'class' => "text field medium" 
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 						'tOOL TIP',
277 277
 						'Please Enter Password' 
278 278
 				),
279
-				array (
280
-						gettext ( 'Included Seconds' ),
279
+				array(
280
+						gettext('Included Seconds'),
281 281
 						'INPUT',
282
-						array (
282
+						array(
283 283
 								'name' => 'includedseconds',
284 284
 								'size' => '50',
285 285
 								'class' => "text field medium" 
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 						'tOOL TIP',
289 289
 						'Please Enter Password' 
290 290
 				),
291
-				array (
292
-						gettext ( 'Per Minute Cost' ),
291
+				array(
292
+						gettext('Per Minute Cost'),
293 293
 						'INPUT',
294
-						array (
294
+						array(
295 295
 								'name' => 'cost',
296 296
 								'size' => '15',
297 297
 								'class' => "text field medium" 
@@ -300,10 +300,10 @@  discard block
 block discarded – undo
300 300
 						'tOOL TIP',
301 301
 						'Please Enter Password' 
302 302
 				),
303
-				array (
304
-						gettext ( 'Initial Increment' ),
303
+				array(
304
+						gettext('Initial Increment'),
305 305
 						'INPUT',
306
-						array (
306
+						array(
307 307
 								'name' => 'init_inc',
308 308
 								'size' => '20',
309 309
 								'class' => "text field medium" 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 						'tOOL TIP',
313 313
 						'Please Enter Initial Increment' 
314 314
 				),
315
-				array (
316
-						gettext ( 'Increment' ),
315
+				array(
316
+						gettext('Increment'),
317 317
 						'INPUT',
318
-						array (
318
+						array(
319 319
 								'name' => 'inc',
320 320
 								'size' => '20',
321 321
 								'class' => "text field medium" 
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 						'tOOL TIP',
325 325
 						'Please Enter Increment' 
326 326
 				),
327
-				array (
328
-						gettext ( 'Setup Fee' ),
327
+				array(
328
+						gettext('Setup Fee'),
329 329
 						'INPUT',
330
-						array (
330
+						array(
331 331
 								'name' => 'setup',
332 332
 								'size' => '15',
333 333
 								'class' => 'text field medium' 
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 						'tOOL TIP',
337 337
 						'' 
338 338
 				),
339
-				array (
340
-						gettext ( 'Monthly<br>Fee' ),
339
+				array(
340
+						gettext('Monthly<br>Fee'),
341 341
 						'INPUT',
342
-						array (
342
+						array(
343 343
 								'name' => 'monthlycost',
344 344
 								'size' => '15',
345 345
 								'class' => "text field medium" 
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
 						'Please Enter Password' 
350 350
 				),
351 351
 				// Added call leg_timeout parameter to timeout the calls.
352
-				array (
352
+				array(
353 353
 						'Call Timeout (Sec.)',
354 354
 						'INPUT',
355
-						array (
355
+						array(
356 356
 								'name' => 'leg_timeout',
357 357
 								'size' => '4',
358 358
 								'class' => "text field medium" 
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
 				) 
364 364
 		);
365 365
 		
366
-		$form ['DID Setting'] = array (
367
-				array (
368
-						gettext ( 'Call Type' ),
366
+		$form ['DID Setting'] = array(
367
+				array(
368
+						gettext('Call Type'),
369 369
 						'call_type',
370 370
 						'SELECT',
371 371
 						'',
@@ -378,10 +378,10 @@  discard block
 block discarded – undo
378 378
 						'set_call_type',
379 379
 						'' 
380 380
 				),
381
-				array (
382
-						gettext ( 'Destination' ),
381
+				array(
382
+						gettext('Destination'),
383 383
 						'INPUT',
384
-						array (
384
+						array(
385 385
 								'name' => 'extensions',
386 386
 								'size' => '20',
387 387
 								'class' => "text field medium" 
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
 						'tOOL TIP',
391 391
 						'Please Enter Password' 
392 392
 				),
393
-				array (
394
-						gettext ( 'Concurrent Calls' ),
393
+				array(
394
+						gettext('Concurrent Calls'),
395 395
 						'INPUT',
396
-						array (
396
+						array(
397 397
 								'name' => 'maxchannels',
398 398
 								'size' => '20',
399 399
 								'class' => "text field medium" 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 						'tOOL TIP',
403 403
 						'Please Enter account number' 
404 404
 				),
405
-				array (
406
-						gettext ( 'Status' ),
405
+				array(
406
+						gettext('Status'),
407 407
 						'status',
408 408
 						'SELECT',
409 409
 						'',
@@ -418,18 +418,18 @@  discard block
 block discarded – undo
418 418
 		)
419 419
 		;
420 420
 		
421
-		$form ['button_save'] = array (
421
+		$form ['button_save'] = array(
422 422
 				'name' => 'action',
423
-				'content' => gettext ( 'Save' ),
423
+				'content' => gettext('Save'),
424 424
 				'value' => 'save',
425 425
 				'id' => 'submit',
426 426
 				'type' => 'button',
427 427
 				'class' => 'btn btn-line-parrot' 
428 428
 		);
429
-		$form ['button_cancel'] = array (
429
+		$form ['button_cancel'] = array(
430 430
 				'name' => 'action',
431 431
 				'content' => 'Close',
432
-				gettext ( 'value' ) => 'cancel',
432
+				gettext('value') => 'cancel',
433 433
 				'type' => 'button',
434 434
 				'class' => 'btn btn-line-sky margin-x-10',
435 435
 				'onclick' => 'return redirect_page(\'NULL\')' 
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
 	 * ************************************************************************
442 442
 	 */
443 443
 	function get_search_did_form() {
444
-		$form ['forms'] = array (
444
+		$form ['forms'] = array(
445 445
 				"",
446
-				array (
446
+				array(
447 447
 						'id' => "did_search" 
448 448
 				) 
449 449
 		);
450
-		$form ['Search'] = array (
451
-				array (
452
-						gettext ( 'DID' ),
450
+		$form ['Search'] = array(
451
+				array(
452
+						gettext('DID'),
453 453
 						'INPUT',
454
-						array (
454
+						array(
455 455
 								'name' => 'number[number]',
456 456
 								'',
457 457
 								'size' => '20',
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
 						'search_string_type',
468 468
 						'' 
469 469
 				),
470
-				array (
471
-						gettext ( 'Country' ),
470
+				array(
471
+						gettext('Country'),
472 472
 						'country_id',
473 473
 						'SELECT',
474 474
 						'',
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 						'',
483 483
 						'' 
484 484
 				),
485
-				array (
486
-						gettext ( 'Account' ),
485
+				array(
486
+						gettext('Account'),
487 487
 						'accountid',
488 488
 						'SELECT',
489 489
 						'',
@@ -495,16 +495,16 @@  discard block
 block discarded – undo
495 495
 						'accounts',
496 496
 						'build_concat_dropdown',
497 497
 						'where_arr',
498
-						array (
498
+						array(
499 499
 								"reseller_id" => "0",
500 500
 								"type" => "0",
501 501
 								"deleted" => "0" 
502 502
 						) 
503 503
 				),
504
-				array (
505
-						gettext ( 'Initial Increment' ),
504
+				array(
505
+						gettext('Initial Increment'),
506 506
 						'INPUT',
507
-						array (
507
+						array(
508 508
 								'name' => 'init_inc[init_inc]',
509 509
 								'',
510 510
 								'size' => '20',
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 						'search_int_type',
521 521
 						'' 
522 522
 				),
523
-				array (
524
-						gettext ( 'Call Type' ),
523
+				array(
524
+						gettext('Call Type'),
525 525
 						'call_type',
526 526
 						'SELECT',
527 527
 						'',
@@ -535,10 +535,10 @@  discard block
 block discarded – undo
535 535
 						'',
536 536
 						'' 
537 537
 				),
538
-				array (
539
-						gettext ( 'Destination' ),
538
+				array(
539
+						gettext('Destination'),
540 540
 						'INPUT',
541
-						array (
541
+						array(
542 542
 								'name' => 'extensions[extensions]',
543 543
 								'',
544 544
 								'size' => '20',
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 						'search_string_type',
555 555
 						'' 
556 556
 				),
557
-				array (
558
-						gettext ( 'Status' ),
557
+				array(
558
+						gettext('Status'),
559 559
 						'status',
560 560
 						'SELECT',
561 561
 						'',
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 						'' 
571 571
 				),
572 572
 				
573
-				array (
573
+				array(
574 574
 						'',
575 575
 						'HIDDEN',
576 576
 						'ajax_search',
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 						'',
580 580
 						'' 
581 581
 				),
582
-				array (
582
+				array(
583 583
 						'',
584 584
 						'HIDDEN',
585 585
 						'advance_search',
@@ -590,18 +590,18 @@  discard block
 block discarded – undo
590 590
 				) 
591 591
 		);
592 592
 		
593
-		$form ['button_search'] = array (
593
+		$form ['button_search'] = array(
594 594
 				'name' => 'action',
595 595
 				'id' => "did_search_btn",
596
-				'content' => gettext ( 'Search' ),
596
+				'content' => gettext('Search'),
597 597
 				'value' => 'save',
598 598
 				'type' => 'button',
599 599
 				'class' => 'btn btn-line-parrot pull-right' 
600 600
 		);
601
-		$form ['button_reset'] = array (
601
+		$form ['button_reset'] = array(
602 602
 				'name' => 'action',
603 603
 				'id' => "id_reset",
604
-				'content' => gettext ( 'Clear' ),
604
+				'content' => gettext('Clear'),
605 605
 				'value' => 'cancel',
606 606
 				'type' => 'reset',
607 607
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -610,17 +610,17 @@  discard block
 block discarded – undo
610 610
 		return $form;
611 611
 	}
612 612
 	function get_search_did_form_for_reseller() {
613
-		$form ['forms'] = array (
613
+		$form ['forms'] = array(
614 614
 				"",
615
-				array (
615
+				array(
616 616
 						'id' => "did_search" 
617 617
 				) 
618 618
 		);
619
-		$form ['Search'] = array (
620
-				array (
621
-						gettext ( 'DID' ),
619
+		$form ['Search'] = array(
620
+				array(
621
+						gettext('DID'),
622 622
 						'INPUT',
623
-						array (
623
+						array(
624 624
 								'name' => 'note[note]',
625 625
 								'',
626 626
 								'size' => '20',
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
 						'search_string_type',
637 637
 						'' 
638 638
 				),
639
-				array (
640
-						gettext ( 'Account' ),
639
+				array(
640
+						gettext('Account'),
641 641
 						'accountid',
642 642
 						'SELECT',
643 643
 						'',
@@ -649,14 +649,14 @@  discard block
 block discarded – undo
649 649
 						'accounts',
650 650
 						'build_concat_dropdown',
651 651
 						'where_arr',
652
-						array (
652
+						array(
653 653
 								"reseller_id" => "0",
654 654
 								"type" => "0",
655 655
 								"deleted" => "0" 
656 656
 						) 
657 657
 				),
658
-				array (
659
-						gettext ( 'Call Type' ),
658
+				array(
659
+						gettext('Call Type'),
660 660
 						'call_type',
661 661
 						'SELECT',
662 662
 						'',
@@ -670,10 +670,10 @@  discard block
 block discarded – undo
670 670
 						'',
671 671
 						'' 
672 672
 				),
673
-				array (
674
-						gettext ( 'Destination' ),
673
+				array(
674
+						gettext('Destination'),
675 675
 						'INPUT',
676
-						array (
676
+						array(
677 677
 								'name' => 'extensions[extensions]',
678 678
 								'',
679 679
 								'size' => '20',
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
 						'search_string_type',
690 690
 						'' 
691 691
 				),
692
-				array (
693
-						gettext ( 'Status' ),
692
+				array(
693
+						gettext('Status'),
694 694
 						'status',
695 695
 						'SELECT',
696 696
 						'',
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 						'',
705 705
 						'' 
706 706
 				),
707
-				array (
707
+				array(
708 708
 						'',
709 709
 						'HIDDEN',
710 710
 						'ajax_search',
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 						'',
714 714
 						'' 
715 715
 				),
716
-				array (
716
+				array(
717 717
 						'',
718 718
 						'HIDDEN',
719 719
 						'advance_search',
@@ -724,18 +724,18 @@  discard block
 block discarded – undo
724 724
 				) 
725 725
 		);
726 726
 		
727
-		$form ['button_search'] = array (
727
+		$form ['button_search'] = array(
728 728
 				'name' => 'action',
729 729
 				'id' => "did_search_btn",
730
-				'content' => gettext ( 'Search' ),
730
+				'content' => gettext('Search'),
731 731
 				'value' => 'save',
732 732
 				'type' => 'button',
733 733
 				'class' => 'btn btn-line-parrot pull-right' 
734 734
 		);
735
-		$form ['button_reset'] = array (
735
+		$form ['button_reset'] = array(
736 736
 				'name' => 'action',
737 737
 				'id' => "id_reset",
738
-				'content' => gettext ( 'Clear' ),
738
+				'content' => gettext('Clear'),
739 739
 				'value' => 'cancel',
740 740
 				'type' => 'reset',
741 741
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -748,13 +748,13 @@  discard block
 block discarded – undo
748 748
 	 * ASTPP 3.0 grid size is change.
749 749
 	 */
750 750
 	function build_did_list_for_admin() {
751
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
751
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
752 752
 		$currency_id = $account_info ['currency_id'];
753
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
753
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
754 754
 		
755 755
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
756
-		$grid_field_arr = json_encode ( array (
757
-				array (
756
+		$grid_field_arr = json_encode(array(
757
+				array(
758 758
 						"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
759 759
 						"30",
760 760
 						"",
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
 				 * For DID edit on DID number
772 772
 				 * *
773 773
 				 */
774
-				array (
775
-						gettext ( "DID" ),
774
+				array(
775
+						gettext("DID"),
776 776
 						"80",
777 777
 						"number",
778 778
 						"",
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 						"true",
783 783
 						"center" 
784 784
 				),
785
-				array (
786
-						gettext ( "Country" ),
785
+				array(
786
+						gettext("Country"),
787 787
 						"60",
788 788
 						"country_id",
789 789
 						"country",
@@ -793,16 +793,16 @@  discard block
 block discarded – undo
793 793
 						"true",
794 794
 						"center" 
795 795
 				),
796
-				array (
797
-						gettext ( "Account" ),
796
+				array(
797
+						gettext("Account"),
798 798
 						"95",
799 799
 						"accountid",
800 800
 						"first_name,last_name,number",
801 801
 						"accounts",
802 802
 						"get_field_name_coma_new" 
803 803
 				),
804
-				array (
805
-						gettext ( "Per Minute <br>Cost($currency)" ),
804
+				array(
805
+						gettext("Per Minute <br>Cost($currency)"),
806 806
 						"85",
807 807
 						"cost",
808 808
 						"cost",
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 						"true",
813 813
 						"right" 
814 814
 				),
815
-				array (
816
-						gettext ( "Initial <br>Increment" ),
815
+				array(
816
+						gettext("Initial <br>Increment"),
817 817
 						"80",
818 818
 						"init_inc",
819 819
 						"",
@@ -823,8 +823,8 @@  discard block
 block discarded – undo
823 823
 						"true",
824 824
 						"center" 
825 825
 				),
826
-				array (
827
-						gettext ( "Increment" ),
826
+				array(
827
+						gettext("Increment"),
828 828
 						"90",
829 829
 						"inc",
830 830
 						"",
@@ -834,8 +834,8 @@  discard block
 block discarded – undo
834 834
 						"true",
835 835
 						"center" 
836 836
 				),
837
-				array (
838
-						gettext ( "Setup <br>Fee($currency)" ),
837
+				array(
838
+						gettext("Setup <br>Fee($currency)"),
839 839
 						"70",
840 840
 						"setup",
841 841
 						"setup",
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
 						"true",
846 846
 						"right" 
847 847
 				),
848
-				array (
849
-						gettext ( "Monthly<br>Fee($currency)" ),
848
+				array(
849
+						gettext("Monthly<br>Fee($currency)"),
850 850
 						"90",
851 851
 						"monthlycost",
852 852
 						"monthlycost",
@@ -856,8 +856,8 @@  discard block
 block discarded – undo
856 856
 						"true",
857 857
 						"right" 
858 858
 				),
859
-				array (
860
-						gettext ( "Call Type" ),
859
+				array(
860
+						gettext("Call Type"),
861 861
 						"90",
862 862
 						"call_type",
863 863
 						"call_type",
@@ -867,8 +867,8 @@  discard block
 block discarded – undo
867 867
 						"true",
868 868
 						"center" 
869 869
 				),
870
-				array (
871
-						gettext ( "Destination" ),
870
+				array(
871
+						gettext("Destination"),
872 872
 						"80",
873 873
 						"extensions",
874 874
 						"",
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 						"true",
879 879
 						"center" 
880 880
 				),
881
-				array (
882
-						gettext ( "Status" ),
881
+				array(
882
+						gettext("Status"),
883 883
 						"90",
884 884
 						"status",
885 885
 						"status",
@@ -889,8 +889,8 @@  discard block
 block discarded – undo
889 889
 						"true",
890 890
 						"center" 
891 891
 				),
892
-				array (
893
-						gettext ( "Modified <br/>Date" ),
892
+				array(
893
+						gettext("Modified <br/>Date"),
894 894
 						"90",
895 895
 						"last_modified_date",
896 896
 						"last_modified_date",
@@ -900,8 +900,8 @@  discard block
 block discarded – undo
900 900
 						"true",
901 901
 						"center" 
902 902
 				),
903
-				array (
904
-						gettext ( "Is Purchased?" ),
903
+				array(
904
+						gettext("Is Purchased?"),
905 905
 						"110",
906 906
 						"number",
907 907
 						"number",
@@ -911,25 +911,25 @@  discard block
 block discarded – undo
911 911
 						"true",
912 912
 						"center" 
913 913
 				),
914
-				array (
915
-						gettext ( "Action" ),
914
+				array(
915
+						gettext("Action"),
916 916
 						"100",
917 917
 						"",
918 918
 						"",
919 919
 						"",
920
-						array (
921
-								"EDIT" => array (
920
+						array(
921
+								"EDIT" => array(
922 922
 										"url" => "did/did_edit/",
923 923
 										"mode" => "popup",
924 924
 										"layout" => "medium" 
925 925
 								),
926
-								"DELETE" => array (
926
+								"DELETE" => array(
927 927
 										"url" => "did/did_remove/",
928 928
 										"mode" => "single" 
929 929
 								) 
930 930
 						) 
931 931
 				) 
932
-		) );
932
+		));
933 933
 		return $grid_field_arr;
934 934
 	}
935 935
 	/**
@@ -940,13 +940,13 @@  discard block
 block discarded – undo
940 940
 	 * change in grid size
941 941
 	 */
942 942
 	function build_did_list_for_reseller_login() {
943
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
943
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
944 944
 		$currency_id = $account_info ['currency_id'];
945
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
945
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
946 946
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
947
-		$grid_field_arr = json_encode ( array (
948
-				array (
949
-						gettext ( "DID" ),
947
+		$grid_field_arr = json_encode(array(
948
+				array(
949
+						gettext("DID"),
950 950
 						"90",
951 951
 						"number",
952 952
 						"",
@@ -957,8 +957,8 @@  discard block
 block discarded – undo
957 957
 						"true",
958 958
 						"center" 
959 959
 				),
960
-				array (
961
-						gettext ( "Account" ),
960
+				array(
961
+						gettext("Account"),
962 962
 						"100",
963 963
 						"accountid",
964 964
 						"first_name,last_name,number",
@@ -968,8 +968,8 @@  discard block
 block discarded – undo
968 968
 						"true",
969 969
 						"center" 
970 970
 				),
971
-				array (
972
-						gettext ( "Per Minute<br>Cost($currency)" ),
971
+				array(
972
+						gettext("Per Minute<br>Cost($currency)"),
973 973
 						"80",
974 974
 						"cost",
975 975
 						"cost",
@@ -979,8 +979,8 @@  discard block
 block discarded – undo
979 979
 						"true",
980 980
 						"right" 
981 981
 				),
982
-				array (
983
-						gettext ( "Initial <br>Increment" ),
982
+				array(
983
+						gettext("Initial <br>Increment"),
984 984
 						"100",
985 985
 						"init_inc",
986 986
 						"",
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
 						"true",
991 991
 						"center" 
992 992
 				),
993
-				array (
994
-						gettext ( "Increment" ),
993
+				array(
994
+						gettext("Increment"),
995 995
 						"95",
996 996
 						"inc",
997 997
 						"",
@@ -1001,8 +1001,8 @@  discard block
 block discarded – undo
1001 1001
 						"true",
1002 1002
 						"center" 
1003 1003
 				),
1004
-				array (
1005
-						gettext ( "Setup <br> Fee($currency)" ),
1004
+				array(
1005
+						gettext("Setup <br> Fee($currency)"),
1006 1006
 						"90",
1007 1007
 						"setup",
1008 1008
 						"setup",
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
 						"true",
1013 1013
 						"right" 
1014 1014
 				),
1015
-				array (
1016
-						gettext ( "Monthly<br> fee($currency)" ),
1015
+				array(
1016
+						gettext("Monthly<br> fee($currency)"),
1017 1017
 						"90",
1018 1018
 						"monthlycost",
1019 1019
 						"monthlycost",
@@ -1023,8 +1023,8 @@  discard block
 block discarded – undo
1023 1023
 						"true",
1024 1024
 						"right" 
1025 1025
 				),
1026
-				array (
1027
-						gettext ( "Call Type" ),
1026
+				array(
1027
+						gettext("Call Type"),
1028 1028
 						"80",
1029 1029
 						"call_type",
1030 1030
 						"call_type",
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
 						"true",
1035 1035
 						"center" 
1036 1036
 				),
1037
-				array (
1038
-						gettext ( "Destination" ),
1037
+				array(
1038
+						gettext("Destination"),
1039 1039
 						"95",
1040 1040
 						"extensions",
1041 1041
 						"",
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
 						"true",
1046 1046
 						"center" 
1047 1047
 				),
1048
-				array (
1049
-						gettext ( "Status" ),
1048
+				array(
1049
+						gettext("Status"),
1050 1050
 						"90",
1051 1051
 						"status",
1052 1052
 						"status",
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 						"true",
1057 1057
 						"center" 
1058 1058
 				),
1059
-				array (
1060
-						gettext ( "Modified Date" ),
1059
+				array(
1060
+						gettext("Modified Date"),
1061 1061
 						"130",
1062 1062
 						"last_modified_date",
1063 1063
 						"last_modified_date",
@@ -1067,8 +1067,8 @@  discard block
 block discarded – undo
1067 1067
 						"true",
1068 1068
 						"center" 
1069 1069
 				),
1070
-				array (
1071
-						gettext ( "Is purchased?" ),
1070
+				array(
1071
+						gettext("Is purchased?"),
1072 1072
 						"100",
1073 1073
 						"number",
1074 1074
 						"number",
@@ -1078,33 +1078,33 @@  discard block
 block discarded – undo
1078 1078
 						"true",
1079 1079
 						"center" 
1080 1080
 				),
1081
-				array (
1082
-						gettext ( "Action" ),
1081
+				array(
1082
+						gettext("Action"),
1083 1083
 						"90",
1084 1084
 						"",
1085 1085
 						"",
1086 1086
 						"",
1087
-						array (
1088
-								"EDIT" => array (
1087
+						array(
1088
+								"EDIT" => array(
1089 1089
 										"url" => "did/did_reseller_edit/edit/",
1090 1090
 										"mode" => "popup" 
1091 1091
 								),
1092
-								"DELETE" => array (
1092
+								"DELETE" => array(
1093 1093
 										"url" => "did/did_reseller_edit/delete/",
1094 1094
 										"mode" => "single" 
1095 1095
 								) 
1096 1096
 						) 
1097 1097
 				) 
1098
-		) );
1098
+		));
1099 1099
 		return $grid_field_arr;
1100 1100
 	}
1101 1101
 	/**
1102 1102
 	 * *********************************************************************
1103 1103
 	 */
1104 1104
 	function build_grid_buttons() {
1105
-		$buttons_json = json_encode ( array (
1106
-				array (
1107
-						gettext ( "Create" ),
1105
+		$buttons_json = json_encode(array(
1106
+				array(
1107
+						gettext("Create"),
1108 1108
 						"btn btn-line-warning btn",
1109 1109
 						"fa fa-plus-circle fa-lg",
1110 1110
 						"button_action",
@@ -1112,15 +1112,15 @@  discard block
 block discarded – undo
1112 1112
 						"popup",
1113 1113
 						"medium" 
1114 1114
 				),
1115
-				array (
1116
-						gettext ( "Delete" ),
1115
+				array(
1116
+						gettext("Delete"),
1117 1117
 						"btn btn-line-danger",
1118 1118
 						"fa fa-times-circle fa-lg",
1119 1119
 						"button_action",
1120 1120
 						"/did/did_delete_multiple/" 
1121 1121
 				),
1122
-				array (
1123
-						gettext ( "Import" ),
1122
+				array(
1123
+						gettext("Import"),
1124 1124
 						"btn btn-line-blue",
1125 1125
 						"fa fa-upload fa-lg",
1126 1126
 						"button_action",
@@ -1128,25 +1128,25 @@  discard block
 block discarded – undo
1128 1128
 						'',
1129 1129
 						"small" 
1130 1130
 				),
1131
-				array (
1132
-						gettext ( "Export" ),
1131
+				array(
1132
+						gettext("Export"),
1133 1133
 						"btn btn-xing",
1134 1134
 						"fa fa-download fa-lg",
1135 1135
 						"button_action",
1136 1136
 						"/did/did_export_data_xls",
1137 1137
 						'single' 
1138 1138
 				) 
1139
-		) );
1139
+		));
1140 1140
 		return $buttons_json;
1141 1141
 	}
1142 1142
 	function build_did_list_for_customer($accountid, $accounttype) {
1143
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1143
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1144 1144
 		$currency_id = $account_info ['currency_id'];
1145
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1145
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1146 1146
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
1147
-		$grid_field_arr = json_encode ( array (
1148
-				array (
1149
-						gettext ( "DID" ),
1147
+		$grid_field_arr = json_encode(array(
1148
+				array(
1149
+						gettext("DID"),
1150 1150
 						"110",
1151 1151
 						"number",
1152 1152
 						"",
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
 						"true",
1157 1157
 						"center" 
1158 1158
 				),
1159
-				array (
1160
-						gettext ( "Country" ),
1159
+				array(
1160
+						gettext("Country"),
1161 1161
 						"110",
1162 1162
 						"country_id",
1163 1163
 						"country",
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
 						"true",
1168 1168
 						"center" 
1169 1169
 				),
1170
-				array (
1171
-						gettext ( "Per Minute Cost($currency)" ),
1170
+				array(
1171
+						gettext("Per Minute Cost($currency)"),
1172 1172
 						"150",
1173 1173
 						"cost",
1174 1174
 						"cost",
@@ -1178,8 +1178,8 @@  discard block
 block discarded – undo
1178 1178
 						"true",
1179 1179
 						"right" 
1180 1180
 				),
1181
-				array (
1182
-						gettext ( "Initial Increment" ),
1181
+				array(
1182
+						gettext("Initial Increment"),
1183 1183
 						"140",
1184 1184
 						"init_inc",
1185 1185
 						"",
@@ -1189,8 +1189,8 @@  discard block
 block discarded – undo
1189 1189
 						"true",
1190 1190
 						"center" 
1191 1191
 				),
1192
-				array (
1193
-						gettext ( "Increment" ),
1192
+				array(
1193
+						gettext("Increment"),
1194 1194
 						"120",
1195 1195
 						"inc",
1196 1196
 						"",
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 						"true",
1201 1201
 						"center" 
1202 1202
 				),
1203
-				array (
1204
-						gettext ( "Setup Fee($currency)" ),
1203
+				array(
1204
+						gettext("Setup Fee($currency)"),
1205 1205
 						"140",
1206 1206
 						"setup",
1207 1207
 						"setup",
@@ -1211,8 +1211,8 @@  discard block
 block discarded – undo
1211 1211
 						"true",
1212 1212
 						"right" 
1213 1213
 				),
1214
-				array (
1215
-						gettext ( "Monthly Fee($currency)" ),
1214
+				array(
1215
+						gettext("Monthly Fee($currency)"),
1216 1216
 						"140",
1217 1217
 						"monthlycost",
1218 1218
 						"monthlycost",
@@ -1222,26 +1222,26 @@  discard block
 block discarded – undo
1222 1222
 						"true",
1223 1223
 						"right" 
1224 1224
 				),
1225
-				array (
1226
-						gettext ( "Action" ),
1225
+				array(
1226
+						gettext("Action"),
1227 1227
 						"110",
1228 1228
 						"",
1229 1229
 						"",
1230 1230
 						"",
1231
-						array (
1232
-								"DELETE" => array (
1233
-										"url" => "accounts/" . $accounttype . "_dids_action/delete/$accountid/$accounttype/",
1231
+						array(
1232
+								"DELETE" => array(
1233
+										"url" => "accounts/".$accounttype."_dids_action/delete/$accountid/$accounttype/",
1234 1234
 										"mode" => "single" 
1235 1235
 								) 
1236 1236
 						) 
1237 1237
 				) 
1238
-		) );
1238
+		));
1239 1239
 		return $grid_field_arr;
1240 1240
 	}
1241 1241
 	function build_did_list_for_reseller($accountid, $accounttype) {
1242 1242
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
1243
-		$grid_field_arr = json_encode ( array (
1244
-				array (
1243
+		$grid_field_arr = json_encode(array(
1244
+				array(
1245 1245
 						"DID Number",
1246 1246
 						"120",
1247 1247
 						"number",
@@ -1249,84 +1249,84 @@  discard block
 block discarded – undo
1249 1249
 						"",
1250 1250
 						"" 
1251 1251
 				),
1252
-				array (
1253
-						gettext ( "Increment" ),
1252
+				array(
1253
+						gettext("Increment"),
1254 1254
 						"120",
1255 1255
 						"inc",
1256 1256
 						"",
1257 1257
 						"",
1258 1258
 						"" 
1259 1259
 				),
1260
-				array (
1261
-						gettext ( "Is purchased?" ),
1260
+				array(
1261
+						gettext("Is purchased?"),
1262 1262
 						"120",
1263 1263
 						"number",
1264 1264
 						"number",
1265 1265
 						"number",
1266 1266
 						"check_did_avl_reseller" 
1267 1267
 				),
1268
-				array (
1269
-						gettext ( "Per Minute Cost" ),
1268
+				array(
1269
+						gettext("Per Minute Cost"),
1270 1270
 						"120",
1271 1271
 						"cost",
1272 1272
 						"cost",
1273 1273
 						"cost",
1274 1274
 						"convert_to_currency" 
1275 1275
 				),
1276
-				array (
1277
-						gettext ( "Included<br> Seconds" ),
1276
+				array(
1277
+						gettext("Included<br> Seconds"),
1278 1278
 						"100",
1279 1279
 						"includedseconds",
1280 1280
 						"",
1281 1281
 						"",
1282 1282
 						"" 
1283 1283
 				),
1284
-				array (
1285
-						gettext ( "Setup <br> Fee" ),
1284
+				array(
1285
+						gettext("Setup <br> Fee"),
1286 1286
 						"109",
1287 1287
 						"setup",
1288 1288
 						"setup",
1289 1289
 						"setup",
1290 1290
 						"convert_to_currency" 
1291 1291
 				),
1292
-				array (
1293
-						gettext ( "Monthly<br> Fee" ),
1292
+				array(
1293
+						gettext("Monthly<br> Fee"),
1294 1294
 						"140",
1295 1295
 						"monthlycost",
1296 1296
 						"monthlycost",
1297 1297
 						"monthlycost",
1298 1298
 						"convert_to_currency" 
1299 1299
 				),
1300
-				array (
1301
-						gettext ( "Connection Cost" ),
1300
+				array(
1301
+						gettext("Connection Cost"),
1302 1302
 						"149",
1303 1303
 						"connectcost",
1304 1304
 						"connectcost",
1305 1305
 						"connectcost",
1306 1306
 						"convert_to_currency" 
1307 1307
 				),
1308
-				array (
1309
-						gettext ( "Disconnection <br> Fee" ),
1308
+				array(
1309
+						gettext("Disconnection <br> Fee"),
1310 1310
 						"140",
1311 1311
 						"disconnectionfee",
1312 1312
 						"disconnectionfee",
1313 1313
 						"disconnectionfee",
1314 1314
 						"convert_to_currency" 
1315 1315
 				),
1316
-				array (
1317
-						gettext ( "Action" ),
1316
+				array(
1317
+						gettext("Action"),
1318 1318
 						"100",
1319 1319
 						"",
1320 1320
 						"",
1321 1321
 						"",
1322
-						array (
1323
-								"DELETE" => array (
1322
+						array(
1323
+								"DELETE" => array(
1324 1324
 										"url" => "/accounts/reseller_did_action/delete/$accountid/$accounttype/",
1325 1325
 										"mode" => "single" 
1326 1326
 								) 
1327 1327
 						) 
1328 1328
 				) 
1329
-		) );
1329
+		));
1330 1330
 		return $grid_field_arr;
1331 1331
 	}
1332 1332
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@
 block discarded – undo
21 21
 // You should have received a copy of the GNU Affero General Public License
22 22
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 23
 // ##############################################################################
24
-if (! defined ( 'BASEPATH' ))
24
+if (! defined ( 'BASEPATH' )) {
25 25
 	exit ( 'No direct script access allowed' );
26
+}
26 27
 class did_form {
27 28
 	function __construct() {
28 29
 		$this->CI = & get_instance ();
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/login/controllers/login.php 1 patch
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -22,243 +22,243 @@  discard block
 block discarded – undo
22 22
 // ##############################################################################
23 23
 class Login extends MX_Controller {
24 24
 	function Login() {
25
-		parent::__construct ();
26
-		$this->load->helper ( 'form' );
27
-		$this->load->library ( 'astpp/permission' );
28
-		$this->load->library ( 'encrypt' );
29
-		$this->load->model ( 'Auth_model' );
30
-		$this->load->model ( 'db_model' );
25
+		parent::__construct();
26
+		$this->load->helper('form');
27
+		$this->load->library('astpp/permission');
28
+		$this->load->library('encrypt');
29
+		$this->load->model('Auth_model');
30
+		$this->load->model('db_model');
31 31
 	}
32 32
 	function set_lang_global($post = false) {
33
-		if (! is_array ( $post )) {
34
-			$str = trim ( $post );
33
+		if ( ! is_array($post)) {
34
+			$str = trim($post);
35 35
 			$new_arr [$str] = $str;
36 36
 			$post = $new_arr;
37 37
 		}
38
-		if (isset ( $post ['fr_FR'] )) {
38
+		if (isset ($post ['fr_FR'])) {
39 39
 			$language = $post ['fr_FR'];
40
-			$this->session->set_userdata ( 'user_language', $language );
40
+			$this->session->set_userdata('user_language', $language);
41 41
 		}
42
-		if (isset ( $post ['es_ES'] )) {
42
+		if (isset ($post ['es_ES'])) {
43 43
 			$language = $post ['es_ES'];
44
-			$this->session->set_userdata ( 'user_language', $language );
44
+			$this->session->set_userdata('user_language', $language);
45 45
 		}
46
-		if (isset ( $post ['en_EN'] )) {
46
+		if (isset ($post ['en_EN'])) {
47 47
 			$language = $post ['en_EN'];
48
-			$this->session->unset_userdata ( 'user_language', $language );
48
+			$this->session->unset_userdata('user_language', $language);
49 49
 		}
50
-		$this->locale->set_lang ();
50
+		$this->locale->set_lang();
51 51
 		return true;
52 52
 	}
53 53
 	function index() {
54
-		if ($this->session->userdata ( 'user_login' ) == FALSE) {
55
-			if (! empty ( $_POST ) && trim ( $_POST ['username'] ) != '' && trim ( $_POST ['password'] ) != '') {
56
-				$_POST ['password'] = $this->common->encode ( $_POST ['password'] );
57
-				$user_valid = $this->Auth_model->verify_login ( $_POST ['username'], $_POST ['password'] );
54
+		if ($this->session->userdata('user_login') == FALSE) {
55
+			if ( ! empty ($_POST) && trim($_POST ['username']) != '' && trim($_POST ['password']) != '') {
56
+				$_POST ['password'] = $this->common->encode($_POST ['password']);
57
+				$user_valid = $this->Auth_model->verify_login($_POST ['username'], $_POST ['password']);
58 58
 				
59 59
 				if ($user_valid == 1) {
60
-					$this->session->set_userdata ( 'user_login', TRUE );
61
-					$where = "number = '" . $this->db->escape_str ( $_POST ['username'] ) . "' OR email = '" . $this->db->escape_str ( $_POST ['username'] ) . "'";
62
-					$result = $this->db_model->getSelect ( "*", "accounts", $where );
63
-					$result = $result->result_array ();
60
+					$this->session->set_userdata('user_login', TRUE);
61
+					$where = "number = '".$this->db->escape_str($_POST ['username'])."' OR email = '".$this->db->escape_str($_POST ['username'])."'";
62
+					$result = $this->db_model->getSelect("*", "accounts", $where);
63
+					$result = $result->result_array();
64 64
 					$result = $result [0];
65 65
 					$logintype = $result ['type'] == - 1 ? 2 : $result ['type'];
66
-					$this->session->set_userdata ( 'logintype', $logintype );
67
-					$this->session->set_userdata ( 'userlevel_logintype', $result ['type'] );
68
-					$this->session->set_userdata ( 'username', $_POST ['username'] );
69
-					$this->session->set_userdata ( 'accountinfo', $result );
66
+					$this->session->set_userdata('logintype', $logintype);
67
+					$this->session->set_userdata('userlevel_logintype', $result ['type']);
68
+					$this->session->set_userdata('username', $_POST ['username']);
69
+					$this->session->set_userdata('accountinfo', $result);
70 70
 					/*
71 71
 					 *
72 72
 					 * Purpose : Display logo based on domain name
73 73
 					 *
74 74
 					 */
75
-					$this->db->select ( "*" );
75
+					$this->db->select("*");
76 76
 					if ($result ['type'] == '2' || $result ['type'] == '-1') {
77
-						$this->db->where ( array (
77
+						$this->db->where(array(
78 78
 								"accountid" => "1"
79
-						) );
79
+						));
80 80
 					} else if ($result ['type'] == '0') {
81 81
 						if ($result ['reseller_id'] == 0) {
82
-							$this->db->where ( array (
82
+							$this->db->where(array(
83 83
 									"accountid" => "1" 
84
-							) );
84
+							));
85 85
 						} else {
86
-							$this->db->where ( array (
86
+							$this->db->where(array(
87 87
 									"accountid" => $result ["reseller_id"] 
88
-							) );
88
+							));
89 89
 						}
90 90
 					} else if ($result ['type'] == '1') {
91 91
 						if ($result ['reseller_id'] == 0) {
92
-							$result_invoice = $this->common->get_field_name ( 'id', 'invoice_conf', array (
92
+							$result_invoice = $this->common->get_field_name('id', 'invoice_conf', array(
93 93
 									"accountid" => $result ['id'] 
94
-							) );
94
+							));
95 95
 							
96 96
 							if ($result_invoice) {
97
-								$this->db->where ( array (
97
+								$this->db->where(array(
98 98
 										"accountid" => $result ["id"] 
99
-								) );
99
+								));
100 100
 							} else {
101
-								$this->db->where ( array (
101
+								$this->db->where(array(
102 102
 										"accountid" => "1" 
103
-								) );
103
+								));
104 104
 							}
105 105
 						} else {
106
-							$result_invoice = $this->common->get_field_name ( 'id', 'invoice_conf', array (
106
+							$result_invoice = $this->common->get_field_name('id', 'invoice_conf', array(
107 107
 									"accountid" => $result ['reseller_id'] 
108
-							) );
108
+							));
109 109
 							if ($result_invoice) {
110
-								$this->db->where ( array (
110
+								$this->db->where(array(
111 111
 										"accountid" => $result ["reseller_id"] 
112
-								) );
112
+								));
113 113
 							} else {
114
-								$this->db->where ( array (
114
+								$this->db->where(array(
115 115
 										"accountid" => "1" 
116
-								) );
116
+								));
117 117
 							}
118 118
 						}
119 119
 					} else {
120
-						$this->db->where ( array (
120
+						$this->db->where(array(
121 121
 								"accountid" => "1" 
122
-						) );
122
+						));
123 123
 					}
124
-					$res = $this->db->get ( "invoice_conf" );
125
-					$logo_arr = $res->result ();
126
-					$data ['user_logo'] = (isset ( $logo_arr [0]->logo ) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid . "_" . $logo_arr [0]->logo : "logo.png";
127
-					$data ['user_header'] = (isset ( $logo_arr [0]->website_title ) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution";
128
-					$data ['user_footer'] = (isset ( $logo_arr [0]->website_footer ) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
129
-					$data ['user_favicon'] = (isset ( $logo_arr [0]->favicon ) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid . "_" .$logo_arr [0]->favicon : "favicon.ico";
130
-					$this->session->set_userdata ( 'user_logo', $data ['user_logo'] );
131
-					$this->session->set_userdata ( 'user_header', $data ['user_header'] );
132
-					$this->session->set_userdata ( 'user_footer', $data ['user_footer'] );
133
-					$this->session->set_userdata ( 'user_favicon', $data ['user_favicon'] );
124
+					$res = $this->db->get("invoice_conf");
125
+					$logo_arr = $res->result();
126
+					$data ['user_logo'] = (isset ($logo_arr [0]->logo) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->logo : "logo.png";
127
+					$data ['user_header'] = (isset ($logo_arr [0]->website_title) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution";
128
+					$data ['user_footer'] = (isset ($logo_arr [0]->website_footer) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
129
+					$data ['user_favicon'] = (isset ($logo_arr [0]->favicon) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->favicon : "favicon.ico";
130
+					$this->session->set_userdata('user_logo', $data ['user_logo']);
131
+					$this->session->set_userdata('user_header', $data ['user_header']);
132
+					$this->session->set_userdata('user_footer', $data ['user_footer']);
133
+					$this->session->set_userdata('user_favicon', $data ['user_favicon']);
134 134
 					// echo $data['user_header'];exit;
135 135
 					/**
136 136
 					 * ************************************************************************************
137 137
 					 */
138 138
 					if ($result ['type'] == 0 || $result ['type'] == 1) {
139
-						$menu_list = $this->permission->get_module_access ( $result ['type'] );
140
-						$this->session->set_userdata ( 'mode_cur', 'user' );
139
+						$menu_list = $this->permission->get_module_access($result ['type']);
140
+						$this->session->set_userdata('mode_cur', 'user');
141 141
 						if ($result ['type'] == 1) {
142
-							redirect ( base_url () . 'dashboard/' );
142
+							redirect(base_url().'dashboard/');
143 143
 						} else {
144
-							redirect ( base_url () . 'user/user/' );
144
+							redirect(base_url().'user/user/');
145 145
 						}
146 146
 					} else {
147
-						$menu_list = $this->permission->get_module_access ( $result ['type'] );
148
-						$this->session->set_userdata ( 'mode_cur', 'admin' );
149
-						redirect ( base_url () . 'dashboard/' );
147
+						$menu_list = $this->permission->get_module_access($result ['type']);
148
+						$this->session->set_userdata('mode_cur', 'admin');
149
+						redirect(base_url().'dashboard/');
150 150
 					}
151 151
 				} else {
152 152
 					$data ['astpp_notification'] = "Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active";
153 153
 				}
154 154
 			} else {
155
-				if (! empty ( $_POST ) && ($_POST ['password'] == '' || $_POST ['username'] == '')) {
155
+				if ( ! empty ($_POST) && ($_POST ['password'] == '' || $_POST ['username'] == '')) {
156 156
 					$data ['astpp_notification'] = "Please enter Username/email and Password.";
157 157
 				}
158 158
 			}
159 159
 			/*
160 160
 			 * Purpose : Display logo based on domain name
161 161
 			 */
162
-			$this->db->select ( "*" );
163
-			$this->db->where ( array (
162
+			$this->db->select("*");
163
+			$this->db->where(array(
164 164
 					"domain" => $_SERVER ["HTTP_HOST"] 
165
-			) );
166
-			$res = $this->db->get ( "invoice_conf" );
167
-			$logo_arr = $res->result ();
168
-			$data ['user_logo'] = (isset ( $logo_arr [0]->logo ) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid . "_" . $logo_arr [0]->logo : "logo.png";
169
-			$data ['website_header'] = (isset ( $logo_arr [0]->website_title ) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution";
170
-			$data ['website_footer'] = (isset ( $logo_arr [0]->website_footer ) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
171
-			$data ['user_favicon'] = (isset ( $logo_arr [0]->favicon ) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid . "_" .$logo_arr [0]->favicon : "favicon.ico";
172
-			$this->session->set_userdata ( 'user_logo', $data ['user_logo'] );
173
-			$this->session->set_userdata ( 'user_header', $data ['website_header'] );
174
-			$this->session->set_userdata ( 'user_footer', $data ['website_footer'] );
175
-			$this->session->set_userdata ( 'user_favicon', $data ['user_favicon'] );
165
+			));
166
+			$res = $this->db->get("invoice_conf");
167
+			$logo_arr = $res->result();
168
+			$data ['user_logo'] = (isset ($logo_arr [0]->logo) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->logo : "logo.png";
169
+			$data ['website_header'] = (isset ($logo_arr [0]->website_title) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution";
170
+			$data ['website_footer'] = (isset ($logo_arr [0]->website_footer) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
171
+			$data ['user_favicon'] = (isset ($logo_arr [0]->favicon) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->favicon : "favicon.ico";
172
+			$this->session->set_userdata('user_logo', $data ['user_logo']);
173
+			$this->session->set_userdata('user_header', $data ['website_header']);
174
+			$this->session->set_userdata('user_footer', $data ['website_footer']);
175
+			$this->session->set_userdata('user_favicon', $data ['user_favicon']);
176 176
 			
177 177
 			// echo $data['user_logo'];exit;
178 178
 			/**
179 179
 			 * ************************************************************************************
180 180
 			 */
181
-			$this->session->set_userdata ( 'user_login', FALSE );
181
+			$this->session->set_userdata('user_login', FALSE);
182 182
 			$data ['app_name'] = 'ASTPP - Open Source Billing Solution';
183
-			$this->load->view ( 'view_login', $data );
183
+			$this->load->view('view_login', $data);
184 184
 		} else {
185 185
 			/*
186 186
 			 *
187 187
 			 * Purpose : Display logo based on domain name
188 188
 			 *
189 189
 			 */
190
-			$this->db->select ( "*" );
191
-			$this->db->where ( array (
190
+			$this->db->select("*");
191
+			$this->db->where(array(
192 192
 					"domain" => $_SERVER ["HTTP_HOST"] 
193
-			) );
194
-			$res = $this->db->get ( "invoice_conf" );
195
-			$logo_arr = $res->result ();
193
+			));
194
+			$res = $this->db->get("invoice_conf");
195
+			$logo_arr = $res->result();
196 196
 			// print_r( $logo_arr );exit;
197 197
 			
198
-			$data ['user_logo'] = (isset ( $logo_arr [0]->logo ) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid . "_" . $logo_arr [0]->logo : "logo.png";
199
-			$data ['user_header'] = (isset ( $logo_arr [0]->website_title ) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution";
200
-			$data ['user_footer'] = (isset ( $logo_arr [0]->website_footer ) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
201
-			$data ['user_favicon'] = (isset ( $logo_arr [0]->favicon ) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid . "_" .$logo_arr [0]->favicon : "favicon.ico";
198
+			$data ['user_logo'] = (isset ($logo_arr [0]->logo) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->logo : "logo.png";
199
+			$data ['user_header'] = (isset ($logo_arr [0]->website_title) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution";
200
+			$data ['user_footer'] = (isset ($logo_arr [0]->website_footer) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
201
+			$data ['user_favicon'] = (isset ($logo_arr [0]->favicon) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->favicon : "favicon.ico";
202 202
 			
203
-			$this->session->set_userdata ( 'user_logo', $data ['user_logo'] );
204
-			$this->session->set_userdata ( 'user_header', $data ['user_header'] );
205
-			$this->session->set_userdata ( 'user_footer', $data ['user_footer'] );
206
-			$this->session->set_userdata ( 'user_favicon', $data ['user_favicon'] );
203
+			$this->session->set_userdata('user_logo', $data ['user_logo']);
204
+			$this->session->set_userdata('user_header', $data ['user_header']);
205
+			$this->session->set_userdata('user_footer', $data ['user_footer']);
206
+			$this->session->set_userdata('user_favicon', $data ['user_favicon']);
207 207
 			// echo $data['user_logo'];exit;
208 208
 			/**
209 209
 			 * ************************************************************************************
210 210
 			 */
211
-			if ($this->session->userdata ( 'logintype' ) == '2') {
212
-				redirect ( base_url () . 'dashboard/' );
211
+			if ($this->session->userdata('logintype') == '2') {
212
+				redirect(base_url().'dashboard/');
213 213
 			} else {
214
-				redirect ( base_url () . 'user/user/' );
214
+				redirect(base_url().'user/user/');
215 215
 			}
216 216
 		}
217 217
 	}
218 218
 	function logout() {
219
-		$this->session->sess_destroy ();
220
-		redirect ( base_url () );
219
+		$this->session->sess_destroy();
220
+		redirect(base_url());
221 221
 	}
222 222
 	function paypal_response() {
223
-		if (count ( $_POST ) > 0) {
223
+		if (count($_POST) > 0) {
224 224
 			$response_arr = $_POST;
225 225
 			
226
-			$logger = ( array ) $this->db->get_where ( "system", array (
226
+			$logger = (array)$this->db->get_where("system", array(
227 227
 					"name" => "log_path",
228 228
 					"group_title" => "global" 
229
-			) )->first_row ();
229
+			))->first_row();
230 230
 			$logger_path = $logger ['value'];
231
-			$fp = fopen ( $logger_path . "astpp_payment.log", "a+" );
232
-			$date = date ( "Y-m-d H:i:s" );
233
-			fwrite ( $fp, "====================" . $date . "===============================\n" );
234
-			foreach ( $response_arr as $key => $value ) {
235
-				fwrite ( $fp, $key . ":::>" . $value . "\n" );
231
+			$fp = fopen($logger_path."astpp_payment.log", "a+");
232
+			$date = date("Y-m-d H:i:s");
233
+			fwrite($fp, "====================".$date."===============================\n");
234
+			foreach ($response_arr as $key => $value) {
235
+				fwrite($fp, $key.":::>".$value."\n");
236 236
 			}
237
-			$payment_check = $this->db_model->countQuery ( "txn_id", "payments", array (
237
+			$payment_check = $this->db_model->countQuery("txn_id", "payments", array(
238 238
 					"txn_id" => $response_arr ['txn_id'] 
239
-			) );
239
+			));
240 240
 			if (($response_arr ["payment_status"] == "Pending" || $response_arr ["payment_status"] == "Complete" || $response_arr ["payment_status"] == "Completed") && $payment_check == 0) {
241 241
 				
242
-				$paypal_tax = ( array ) $this->db->get_where ( "system", array (
242
+				$paypal_tax = (array)$this->db->get_where("system", array(
243 243
 						"name" => "paypal_tax",
244 244
 						"group_title" => "paypal" 
245
-				) )->first_row ();
245
+				))->first_row();
246 246
 				$paypal_tax = $paypal_tax ['value'];
247 247
 				$balance_amt = $actual_amount = $response_arr ["custom"];
248
-				$paypal_fee = ( array ) $this->db->get_where ( "system", array (
248
+				$paypal_fee = (array)$this->db->get_where("system", array(
249 249
 						"name" => "paypal_fee",
250 250
 						"group_title" => "paypal" 
251
-				) )->first_row ();
251
+				))->first_row();
252 252
 				$paypal_fee = $paypal_fee ['value'];
253 253
 				$paypalfee = ($paypal_fee == 0) ? '0' : $response_arr ["mc_gross"];
254
-				$account_data = ( array ) $this->db->get_where ( "accounts", array (
254
+				$account_data = (array)$this->db->get_where("accounts", array(
255 255
 						"id" => $response_arr ["item_number"] 
256
-				) )->first_row ();
257
-				$currency = ( array ) $this->db->get_where ( 'currency', array (
256
+				))->first_row();
257
+				$currency = (array)$this->db->get_where('currency', array(
258 258
 						"id" => $account_data ["currency_id"] 
259
-				) )->first_row ();
260
-				$date = date ( 'Y-m-d H:i:s' );
261
-				$payment_trans_array = array (
259
+				))->first_row();
260
+				$date = date('Y-m-d H:i:s');
261
+				$payment_trans_array = array(
262 262
 						"accountid" => $response_arr ["item_number"],
263 263
 						"amount" => $response_arr ["payment_gross"],
264 264
 						"tax" => "1",
@@ -267,54 +267,54 @@  discard block
 block discarded – undo
267 267
 						"paypal_fee" => $paypalfee,
268 268
 						"user_currency" => $currency ["currency"],
269 269
 						"currency_rate" => $currency ["currencyrate"],
270
-						"transaction_details" => json_encode ( $response_arr ),
270
+						"transaction_details" => json_encode($response_arr),
271 271
 						"date" => $date 
272 272
 				);
273
-				$paymentid = $this->db->insert ( 'payment_transaction', $payment_trans_array );
273
+				$paymentid = $this->db->insert('payment_transaction', $payment_trans_array);
274 274
 				$parent_id = $account_data ['reseller_id'] > 0 ? $account_data ['reseller_id'] : '-1';
275
-				$payment_arr = array (
275
+				$payment_arr = array(
276 276
 						"accountid" => $response_arr ["item_number"],
277 277
 						"payment_mode" => "1",
278 278
 						"credit" => $balance_amt,
279 279
 						"type" => "PAYPAL",
280 280
 						"payment_by" => $parent_id,
281
-						"notes" => "Payment Made by Paypal on date:-" . $date,
281
+						"notes" => "Payment Made by Paypal on date:-".$date,
282 282
 						"paypalid" => $paymentid,
283 283
 						"txn_id" => $response_arr ["txn_id"],
284
-						'payment_date' => gmdate ( 'Y-m-d H:i:s', strtotime ( $response_arr ['payment_date'] ) ) 
284
+						'payment_date' => gmdate('Y-m-d H:i:s', strtotime($response_arr ['payment_date'])) 
285 285
 				);
286
-				$this->db->insert ( 'payments', $payment_arr );
287
-				$this->db->select ( 'invoiceid' );
288
-				$this->db->order_by ( 'id', 'desc' );
289
-				$this->db->limit ( 1 );
290
-				$last_invoice_result = ( array ) $this->db->get ( 'invoices' )->first_row ();
291
-				$last_invoice_ID = isset ( $last_invoice_result ['invoiceid'] ) && $last_invoice_result ['invoiceid'] > 0 ? $last_invoice_result ['invoiceid'] : 1;
286
+				$this->db->insert('payments', $payment_arr);
287
+				$this->db->select('invoiceid');
288
+				$this->db->order_by('id', 'desc');
289
+				$this->db->limit(1);
290
+				$last_invoice_result = (array)$this->db->get('invoices')->first_row();
291
+				$last_invoice_ID = isset ($last_invoice_result ['invoiceid']) && $last_invoice_result ['invoiceid'] > 0 ? $last_invoice_result ['invoiceid'] : 1;
292 292
 				$reseller_id = $account_data ['reseller_id'] > 0 ? $account_data ['reseller_id'] : 0;
293
-				$where = "accountid IN ('" . $reseller_id . "','1')";
294
-				$this->db->where ( $where );
295
-				$this->db->select ( '*' );
296
-				$this->db->order_by ( 'accountid', 'desc' );
297
-				$this->db->limit ( 1 );
298
-				$invoiceconf = $this->db->get ( 'invoice_conf' );
299
-				$invoiceconf = ( array ) $invoiceconf->first_row ();
293
+				$where = "accountid IN ('".$reseller_id."','1')";
294
+				$this->db->where($where);
295
+				$this->db->select('*');
296
+				$this->db->order_by('accountid', 'desc');
297
+				$this->db->limit(1);
298
+				$invoiceconf = $this->db->get('invoice_conf');
299
+				$invoiceconf = (array)$invoiceconf->first_row();
300 300
 				$invoice_prefix = $invoiceconf ['invoice_prefix'];
301 301
 				
302
-				$due_date = gmdate ( "Y-m-d H:i:s", strtotime ( gmdate ( "Y-m-d H:i:s" ) . " +" . $invoiceconf ['interval'] . " days" ) );
303
-				$invoice_id = $this->generate_receipt ( $account_data ['id'], $balance_amt, $account_data, $last_invoice_ID + 1, $invoice_prefix, $due_date );
304
-				$details_insert = array (
302
+				$due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf ['interval']." days"));
303
+				$invoice_id = $this->generate_receipt($account_data ['id'], $balance_amt, $account_data, $last_invoice_ID + 1, $invoice_prefix, $due_date);
304
+				$details_insert = array(
305 305
 						'created_date' => $date,
306 306
 						'credit' => $balance_amt,
307 307
 						'debit' => '-',
308 308
 						'accountid' => $account_data ["id"],
309 309
 						'reseller_id' => $account_data ['reseller_id'],
310 310
 						'invoiceid' => $invoice_id,
311
-						'description' => "Payment Made by Paypal on date:-" . $date,
311
+						'description' => "Payment Made by Paypal on date:-".$date,
312 312
 						'item_type' => 'PAYMENT',
313 313
 						'before_balance' => $account_data ['balance'],
314 314
 						'after_balance' => $account_data ['balance'] + $balance_amt 
315 315
 				);
316
-				$this->db->insert ( "invoice_details", $details_insert );
317
-				$this->db_model->update_balance ( $balance_amt, $account_data ["id"], "credit" );
316
+				$this->db->insert("invoice_details", $details_insert);
317
+				$this->db_model->update_balance($balance_amt, $account_data ["id"], "credit");
318 318
 				/*
319 319
 				 * if($parent_id > 0){
320 320
 				 * $reseller_ids=$this->common->get_parent_info($parent_id,0);
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 				 * }
369 369
 				 * }
370 370
 				 */
371
-				redirect ( base_url () . 'user/user/' );
371
+				redirect(base_url().'user/user/');
372 372
 			}
373 373
 		}
374
-		redirect ( base_url () . 'user/user/' );
374
+		redirect(base_url().'user/user/');
375 375
 	}
376 376
 	
377 377
 	/**
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
 	 * @param string $due_date        	
381 381
 	 */
382 382
 	function generate_receipt($accountid, $amount, $accountinfo, $last_invoice_ID, $invoice_prefix, $due_date) {
383
-		$invoice_data = array (
383
+		$invoice_data = array(
384 384
 				"accountid" => $accountid,
385 385
 				"invoice_prefix" => $invoice_prefix,
386
-				"invoiceid" => '0000' . $last_invoice_ID,
386
+				"invoiceid" => '0000'.$last_invoice_ID,
387 387
 				"reseller_id" => $accountinfo ['reseller_id'],
388
-				"invoice_date" => gmdate ( "Y-m-d H:i:s" ),
389
-				"from_date" => gmdate ( "Y-m-d H:i:s" ),
390
-				"to_date" => gmdate ( "Y-m-d H:i:s" ),
388
+				"invoice_date" => gmdate("Y-m-d H:i:s"),
389
+				"from_date" => gmdate("Y-m-d H:i:s"),
390
+				"to_date" => gmdate("Y-m-d H:i:s"),
391 391
 				"due_date" => $due_date,
392 392
 				"status" => 1,
393 393
 				"balance" => $accountinfo ['balance'],
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 				"type" => 'R',
396 396
 				"confirm" => '1' 
397 397
 		);
398
-		$this->db->insert ( "invoices", $invoice_data );
399
-		$invoiceid = $this->db->insert_id ();
398
+		$this->db->insert("invoices", $invoice_data);
399
+		$invoiceid = $this->db->insert_id();
400 400
 		return $invoiceid;
401 401
 	}
402 402
 	function get_language_text() {
403 403
 		// echo '<pre>'; print_r($_POST); exit;
404
-		echo gettext ( $_POST ['display'] );
404
+		echo gettext($_POST ['display']);
405 405
 	}
406 406
 }
407 407
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/opensips/models/opensips_model.php 2 patches
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -22,61 +22,61 @@  discard block
 block discarded – undo
22 22
 // ##############################################################################
23 23
 class Opensips_model extends CI_Model {
24 24
 	function Opensips_model() {
25
-		parent::__construct ();
25
+		parent::__construct();
26 26
 		$db_config = Common_model::$global_config ['system_config'];
27
-		$opensipdsn = "mysql://" . $db_config ['opensips_dbuser'] . ":" . $db_config ['opensips_dbpass'] . "@" . $db_config ['opensips_dbhost'] . "/" . $db_config ['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
28
-		$this->opensips_db = $this->load->database ( $opensipdsn, true );
27
+		$opensipdsn = "mysql://".$db_config ['opensips_dbuser'].":".$db_config ['opensips_dbpass']."@".$db_config ['opensips_dbhost']."/".$db_config ['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
28
+		$this->opensips_db = $this->load->database($opensipdsn, true);
29 29
 	}
30 30
 	function getopensipsdevice_list($flag, $start = 0, $limit = 0) {
31
-		$this->db_model->build_search_opensips ( $this->opensips_db, 'opensipsdevice_list_search' );
32
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
31
+		$this->db_model->build_search_opensips($this->opensips_db, 'opensipsdevice_list_search');
32
+		$accountinfo = $this->session->userdata('accountinfo');
33 33
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
34
-		$this->opensips_db->where ( 'reseller_id', $reseller_id );
34
+		$this->opensips_db->where('reseller_id', $reseller_id);
35 35
 		if ($flag) {
36
-			$this->opensips_db->limit ( $limit, $start );
37
-			if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') {
38
-				$this->opensips_db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] );
36
+			$this->opensips_db->limit($limit, $start);
37
+			if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') {
38
+				$this->opensips_db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']);
39 39
 			} else {
40
-				$this->opensips_db->order_by ( 'username', 'asc' );
40
+				$this->opensips_db->order_by('username', 'asc');
41 41
 			}
42
-			$query = $this->opensips_db->get ( "subscriber" );
42
+			$query = $this->opensips_db->get("subscriber");
43 43
 		} else {
44
-			$query = $this->opensips_db->get ( "subscriber" );
45
-			$query = $query->num_rows ();
44
+			$query = $this->opensips_db->get("subscriber");
45
+			$query = $query->num_rows();
46 46
 		}
47 47
 		return $query;
48 48
 	}
49 49
 	function getopensipsdevice_customer_list($flag, $accountid = "", $accounttype, $start = "0", $limit = "0") {
50 50
 		if ($accountid != "") {
51
-			$where = array (
52
-					"accountcode" => $this->common->get_field_name ( 'number', 'accounts', array (
51
+			$where = array(
52
+					"accountcode" => $this->common->get_field_name('number', 'accounts', array(
53 53
 							'id' => $accountid 
54
-					) ) 
54
+					)) 
55 55
 			);
56 56
 		}
57
-		$instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_opensips' );
58
-		$like_str = ! empty ( $instant_search ) ? "(username like '%$instant_search%'
57
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_opensips');
58
+		$like_str = ! empty ($instant_search) ? "(username like '%$instant_search%'
59 59
                                             OR  password like '%$instant_search%'
60 60
                                             OR  domain like '%$instant_search%'
61 61
                                             OR  effective_caller_id_name like '%$instant_search%'
62 62
                                             OR  effective_caller_id_number like '%$instant_search%'
63 63
                                                 )" : null;
64
-		if (! empty ( $like_str ))
65
-			$this->opensips_db->where ( $like_str );
66
-		$this->opensips_db->where ( $where );
64
+		if ( ! empty ($like_str))
65
+			$this->opensips_db->where($like_str);
66
+		$this->opensips_db->where($where);
67 67
 		if ($flag) {
68
-			$this->opensips_db->limit ( $limit, $start );
68
+			$this->opensips_db->limit($limit, $start);
69 69
 		}
70
-		$result = $this->opensips_db->get ( "subscriber" );
71
-		if ($result->num_rows () > 0) {
70
+		$result = $this->opensips_db->get("subscriber");
71
+		if ($result->num_rows() > 0) {
72 72
 			if ($flag) {
73 73
 				return $result;
74 74
 			} else {
75
-				return $result->num_rows ();
75
+				return $result->num_rows();
76 76
 			}
77 77
 		} else {
78 78
 			if ($flag) {
79
-				$result = ( object ) array (
79
+				$result = (object)array(
80 80
 						'num_rows' => 0 
81 81
 				);
82 82
 			} else {
@@ -86,32 +86,32 @@  discard block
 block discarded – undo
86 86
 		}
87 87
 	}
88 88
 	function getopensipsdispatcher_list($flag, $start = '', $limit = '') {
89
-		$this->db_model->build_search_opensips ( $this->opensips_db, 'opensipsdispatcher_list_search' );
89
+		$this->db_model->build_search_opensips($this->opensips_db, 'opensipsdispatcher_list_search');
90 90
 		if ($flag) {
91
-			$this->opensips_db->limit ( $limit, $start );
92
-			if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') {
93
-				$this->opensips_db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] );
91
+			$this->opensips_db->limit($limit, $start);
92
+			if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') {
93
+				$this->opensips_db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']);
94 94
 			} else {
95
-				$this->opensips_db->order_by ( 'setid', 'asc' );
95
+				$this->opensips_db->order_by('setid', 'asc');
96 96
 			}
97
-			$query = $this->opensips_db->get ( "dispatcher" );
97
+			$query = $this->opensips_db->get("dispatcher");
98 98
 		} else {
99
-			$query = $this->opensips_db->get ( "dispatcher" );
100
-			$query = $query->num_rows ();
99
+			$query = $this->opensips_db->get("dispatcher");
100
+			$query = $query->num_rows();
101 101
 		}
102 102
 		return $query;
103 103
 	}
104 104
 	function add_opensipsdevices($data) {
105
-		unset ( $data ["action"] );
106
-		$data ['creation_date'] = gmdate ( "Y-m-d H:i:s" );
107
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
105
+		unset ($data ["action"]);
106
+		$data ['creation_date'] = gmdate("Y-m-d H:i:s");
107
+		$accountinfo = $this->session->userdata('accountinfo');
108 108
 		$data ['reseller_id'] = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
109
-		unset ( $data ["id"] );
110
-		$this->opensips_db->insert ( "subscriber", $data );
109
+		unset ($data ["id"]);
110
+		$this->opensips_db->insert("subscriber", $data);
111 111
 	}
112 112
 	function edit_opensipsdevices($data, $id) {
113
-		unset ( $data ["action"] );
114
-		$data = array (
113
+		unset ($data ["action"]);
114
+		$data = array(
115 115
 				"username" => $data ['username'],
116 116
 				"password" => $data ['password'],
117 117
 				"accountcode" => $data ['accountcode'],
@@ -120,50 +120,50 @@  discard block
 block discarded – undo
120 120
 				"effective_caller_id_number" => $data ['effective_caller_id_number'],
121 121
 				"status" => $data ['status'] 
122 122
 		);
123
-		$this->opensips_db->where ( "id", $id );
124
-		$data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" );
125
-		$this->opensips_db->update ( "subscriber", $data );
123
+		$this->opensips_db->where("id", $id);
124
+		$data ['last_modified_date'] = gmdate("Y-m-d H:i:s");
125
+		$this->opensips_db->update("subscriber", $data);
126 126
 	}
127 127
 	function delete_opensips_devices($id) {
128
-		$this->opensips_db->where ( "id", $id );
129
-		$this->opensips_db->delete ( "subscriber" );
128
+		$this->opensips_db->where("id", $id);
129
+		$this->opensips_db->delete("subscriber");
130 130
 		return true;
131 131
 	}
132 132
 	function remove_opensips($id) {
133
-		$this->opensips_db->where ( "id", $id );
134
-		$this->opensips_db->delete ( "subscriber" );
133
+		$this->opensips_db->where("id", $id);
134
+		$this->opensips_db->delete("subscriber");
135 135
 		return true;
136 136
 	}
137 137
 	function add_opensipsdispatcher($data) {
138
-		unset ( $data ["action"] );
139
-		$this->opensips_db->insert ( "dispatcher", $data );
138
+		unset ($data ["action"]);
139
+		$this->opensips_db->insert("dispatcher", $data);
140 140
 	}
141 141
 	function edit_opensipsdispatcher($data, $id) {
142
-		unset ( $data ["action"] );
143
-		$this->opensips_db->where ( "id", $id );
144
-		$this->opensips_db->update ( "dispatcher", $data );
142
+		unset ($data ["action"]);
143
+		$this->opensips_db->where("id", $id);
144
+		$this->opensips_db->update("dispatcher", $data);
145 145
 	}
146 146
 	function remove_dispatcher($id) {
147
-		$this->opensips_db->where ( "id", $id );
148
-		$this->opensips_db->delete ( "dispatcher" );
147
+		$this->opensips_db->where("id", $id);
148
+		$this->opensips_db->delete("dispatcher");
149 149
 		return true;
150 150
 	}
151 151
 	function build_search_opensips($accounts_list_search) {
152
-		if ($this->session->userdata ( 'advance_search' ) == 1) {
153
-			$account_search = $this->session->userdata ( $accounts_list_search );
154
-			unset ( $account_search ["ajax_search"] );
155
-			unset ( $account_search ["advance_search"] );
156
-			foreach ( $account_search as $key => $value ) {
152
+		if ($this->session->userdata('advance_search') == 1) {
153
+			$account_search = $this->session->userdata($accounts_list_search);
154
+			unset ($account_search ["ajax_search"]);
155
+			unset ($account_search ["advance_search"]);
156
+			foreach ($account_search as $key => $value) {
157 157
 				if ($value != "") {
158
-					if (is_array ( $value )) {
159
-						if (array_key_exists ( $key . "-integer", $value )) {
160
-							$this->get_interger_array ( $key, $value [$key . "-integer"], $value [$key] );
158
+					if (is_array($value)) {
159
+						if (array_key_exists($key."-integer", $value)) {
160
+							$this->get_interger_array($key, $value [$key."-integer"], $value [$key]);
161 161
 						}
162
-						if (array_key_exists ( $key . "-string", $value )) {
163
-							$this->get_string_array ( $key, $value [$key . "-string"], $value [$key] );
162
+						if (array_key_exists($key."-string", $value)) {
163
+							$this->get_string_array($key, $value [$key."-string"], $value [$key]);
164 164
 						}
165 165
 					} else {
166
-						$this->opensips_db->where ( $key, $value );
166
+						$this->opensips_db->where($key, $value);
167 167
 					}
168 168
 				}
169 169
 			}
@@ -173,22 +173,22 @@  discard block
 block discarded – undo
173 173
 		if ($search_array != '') {
174 174
 			switch ($value) {
175 175
 				case "1" :
176
-					$this->opensips_db->where ( $field, $search_array );
176
+					$this->opensips_db->where($field, $search_array);
177 177
 					break;
178 178
 				case "2" :
179
-					$this->opensips_db->where ( $field . ' <>', $search_array );
179
+					$this->opensips_db->where($field.' <>', $search_array);
180 180
 					break;
181 181
 				case "3" :
182
-					$this->opensips_db->where ( $field . ' > ', $search_array );
182
+					$this->opensips_db->where($field.' > ', $search_array);
183 183
 					break;
184 184
 				case "4" :
185
-					$this->opensips_db->where ( $field . ' < ', $search_array );
185
+					$this->opensips_db->where($field.' < ', $search_array);
186 186
 					break;
187 187
 				case "5" :
188
-					$this->opensips_db->where ( $field . ' >= ', $search_array );
188
+					$this->opensips_db->where($field.' >= ', $search_array);
189 189
 					break;
190 190
 				case "6" :
191
-					$this->opensips_db->where ( $field . ' <= ', $search_array );
191
+					$this->opensips_db->where($field.' <= ', $search_array);
192 192
 					break;
193 193
 			}
194 194
 		}
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
 		if ($search_array != '') {
198 198
 			switch ($value) {
199 199
 				case "1" :
200
-					$this->opensips_db->like ( $field, $search_array );
200
+					$this->opensips_db->like($field, $search_array);
201 201
 					break;
202 202
 				case "2" :
203
-					$this->opensips_db->not_like ( $field, $search_array );
203
+					$this->opensips_db->not_like($field, $search_array);
204 204
 					break;
205 205
 				case "3" :
206
-					$this->opensips_db->where ( $field, $search_array );
206
+					$this->opensips_db->where($field, $search_array);
207 207
 					break;
208 208
 				case "4" :
209
-					$this->opensips_db->where ( $field . ' <>', $search_array );
209
+					$this->opensips_db->where($field.' <>', $search_array);
210 210
 					break;
211 211
 			}
212 212
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@
 block discarded – undo
61 61
                                             OR  effective_caller_id_name like '%$instant_search%'
62 62
                                             OR  effective_caller_id_number like '%$instant_search%'
63 63
                                                 )" : null;
64
-		if (! empty ( $like_str ))
65
-			$this->opensips_db->where ( $like_str );
64
+		if (! empty ( $like_str )) {
65
+					$this->opensips_db->where ( $like_str );
66
+		}
66 67
 		$this->opensips_db->where ( $where );
67 68
 		if ($flag) {
68 69
 			$this->opensips_db->limit ( $limit, $start );
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/opensips/controllers/opensips.php 2 patches
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -22,223 +22,223 @@  discard block
 block discarded – undo
22 22
 // ##############################################################################
23 23
 class Opensips extends MX_Controller {
24 24
 	function Opensips() {
25
-		parent::__construct ();
25
+		parent::__construct();
26 26
 		
27
-		$this->load->helper ( 'template_inheritance' );
28
-		$this->load->library ( 'session' );
29
-		$this->load->library ( "opensips_form" );
30
-		$this->load->library ( 'astpp/form' );
31
-		$this->load->model ( 'opensips_model' );
27
+		$this->load->helper('template_inheritance');
28
+		$this->load->library('session');
29
+		$this->load->library("opensips_form");
30
+		$this->load->library('astpp/form');
31
+		$this->load->model('opensips_model');
32 32
 		$db_config = Common_model::$global_config ['system_config'];
33
-		$opensipdsn = "mysql://" . $db_config ['opensips_dbuser'] . ":" . $db_config ['opensips_dbpass'] . "@" . $db_config ['opensips_dbhost'] . "/" . $db_config ['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
34
-		$this->opensips_db = $this->load->database ( $opensipdsn, true );
35
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
36
-			redirect ( base_url () . '/astpp/login' );
33
+		$opensipdsn = "mysql://".$db_config ['opensips_dbuser'].":".$db_config ['opensips_dbpass']."@".$db_config ['opensips_dbhost']."/".$db_config ['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
34
+		$this->opensips_db = $this->load->database($opensipdsn, true);
35
+		if ($this->session->userdata('user_login') == FALSE)
36
+			redirect(base_url().'/astpp/login');
37 37
 	}
38 38
 	function opensips_add() {
39 39
 		// echo 'dd';
40
-		$data ['username'] = $this->session->userdata ( 'user_name' );
40
+		$data ['username'] = $this->session->userdata('user_name');
41 41
 		$data ['flag'] = 'create';
42
-		$data ['page_title'] = gettext ( 'Add  Opensips' );
43
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields (), '' );
44
-		$this->load->view ( 'view_opensips_add_edit', $data );
42
+		$data ['page_title'] = gettext('Add  Opensips');
43
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields(), '');
44
+		$this->load->view('view_opensips_add_edit', $data);
45 45
 	}
46 46
 	function opensips_edit($edit_id = '') {
47
-		$data ['page_title'] = gettext ( 'Edit Opensips' );
48
-		$this->opensips_db->where ( 'id', $edit_id );
49
-		$account = $this->opensips_db->get ( "subscriber" );
50
-		foreach ( $account->result_array () as $key => $value ) {
47
+		$data ['page_title'] = gettext('Edit Opensips');
48
+		$this->opensips_db->where('id', $edit_id);
49
+		$account = $this->opensips_db->get("subscriber");
50
+		foreach ($account->result_array() as $key => $value) {
51 51
 			$edit_data = $value;
52 52
 		}
53 53
 		
54
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields ( $edit_id ), $edit_data );
55
-		$this->load->view ( 'view_opensips_add_edit', $data );
54
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields($edit_id), $edit_data);
55
+		$this->load->view('view_opensips_add_edit', $data);
56 56
 	}
57 57
 	function customer_opensips_edit($accountid, $edit_id) {
58
-		$data ['page_title'] = gettext ( 'Edit Opensips' );
59
-		$where = array (
58
+		$data ['page_title'] = gettext('Edit Opensips');
59
+		$where = array(
60 60
 				'id' => $edit_id 
61 61
 		);
62
-		$this->opensips_db->where ( $where );
63
-		$account = $this->opensips_db->get ( "subscriber" );
64
-		foreach ( $account->result_array () as $key => $value ) {
62
+		$this->opensips_db->where($where);
63
+		$account = $this->opensips_db->get("subscriber");
64
+		foreach ($account->result_array() as $key => $value) {
65 65
 			$edit_data = $value;
66 66
 		}
67
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields_for_customer ( $accountid ), $edit_data );
68
-		$this->load->view ( 'view_opensips_add_edit', $data );
67
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), $edit_data);
68
+		$this->load->view('view_opensips_add_edit', $data);
69 69
 	}
70 70
 	function customer_opensips_add($accountid = '') {
71
-		$data ['username'] = $this->session->userdata ( 'user_name' );
71
+		$data ['username'] = $this->session->userdata('user_name');
72 72
 		$data ['flag'] = 'create';
73
-		$data ['page_title'] = gettext ( 'Create Opensips' );
74
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields_for_customer ( $accountid ), '' );
73
+		$data ['page_title'] = gettext('Create Opensips');
74
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), '');
75 75
 		
76
-		$this->load->view ( 'view_opensips_add_edit', $data );
76
+		$this->load->view('view_opensips_add_edit', $data);
77 77
 	}
78 78
 	function opensips_save() {
79
-		$add_array = $this->input->post ();
80
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields ( $add_array ['id'] ), $add_array );
79
+		$add_array = $this->input->post();
80
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields($add_array ['id']), $add_array);
81 81
 		if ($add_array ['id'] != '') {
82
-			$data ['page_title'] = gettext ( 'Edit Opensips' );
83
-			if ($this->form_validation->run () == FALSE) {
84
-				$data ['validation_errors'] = validation_errors ();
82
+			$data ['page_title'] = gettext('Edit Opensips');
83
+			if ($this->form_validation->run() == FALSE) {
84
+				$data ['validation_errors'] = validation_errors();
85 85
 				echo $data ['validation_errors'];
86 86
 				exit ();
87 87
 			} else {
88
-				$auth_flag = $this->validate_device_data ( $add_array );
88
+				$auth_flag = $this->validate_device_data($add_array);
89 89
 				if ($auth_flag == "TRUE") {
90
-					$this->opensips_model->edit_opensipsdevices ( $add_array, $add_array ['id'] );
91
-					echo json_encode ( array (
90
+					$this->opensips_model->edit_opensipsdevices($add_array, $add_array ['id']);
91
+					echo json_encode(array(
92 92
 							"SUCCESS" => " OpenSips updated successfully!" 
93
-					) );
93
+					));
94 94
 					exit ();
95 95
 				} else {
96
-					echo json_encode ( $auth_flag );
96
+					echo json_encode($auth_flag);
97 97
 					exit ();
98 98
 				}
99 99
 			}
100 100
 		} else {
101
-			$data ['page_title'] = gettext ( 'Add Opensips' );
102
-			if ($this->form_validation->run () == FALSE) {
103
-				$data ['validation_errors'] = validation_errors ();
101
+			$data ['page_title'] = gettext('Add Opensips');
102
+			if ($this->form_validation->run() == FALSE) {
103
+				$data ['validation_errors'] = validation_errors();
104 104
 				echo $data ['validation_errors'];
105 105
 				exit ();
106 106
 			} else {
107
-				$auth_flag = $this->validate_device_data ( $add_array );
107
+				$auth_flag = $this->validate_device_data($add_array);
108 108
 				if ($auth_flag == "TRUE") {
109
-					$this->opensips_model->add_opensipsdevices ( $add_array );
110
-					echo json_encode ( array (
109
+					$this->opensips_model->add_opensipsdevices($add_array);
110
+					echo json_encode(array(
111 111
 							"SUCCESS" => "OpenSips added successfully!" 
112
-					) );
112
+					));
113 113
 					exit ();
114 114
 				} else {
115
-					echo json_encode ( $auth_flag );
115
+					echo json_encode($auth_flag);
116 116
 					exit ();
117 117
 				}
118 118
 			}
119 119
 		}
120 120
 	}
121 121
 	function validate_device_data($data) {
122
-		if (isset ( $data ["username"] ) && $data ["username"] != "") {
122
+		if (isset ($data ["username"]) && $data ["username"] != "") {
123 123
 			$db_config = Common_model::$global_config ['system_config'];
124
-			$opensipdsn = "mysql://" . $db_config ['opensips_dbuser'] . ":" . $db_config ['opensips_dbpass'] . "@" . $db_config ['opensips_dbhost'] . "/" . $db_config ['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
125
-			$this->opensips_db = $this->load->database ( $opensipdsn, true );
126
-			$where = array (
124
+			$opensipdsn = "mysql://".$db_config ['opensips_dbuser'].":".$db_config ['opensips_dbpass']."@".$db_config ['opensips_dbhost']."/".$db_config ['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
125
+			$this->opensips_db = $this->load->database($opensipdsn, true);
126
+			$where = array(
127 127
 					"username" => $data ["username"] 
128 128
 			);
129 129
 			if ($data ['id'] != "") {
130
-				$this->opensips_db->where ( "id <>", $data ['id'] );
130
+				$this->opensips_db->where("id <>", $data ['id']);
131 131
 			}
132
-			$this->opensips_db->where ( $where );
133
-			$auth_flag = $this->opensips_db->get ( "subscriber" );
134
-			$auth_flag = $auth_flag->num_rows ();
132
+			$this->opensips_db->where($where);
133
+			$auth_flag = $this->opensips_db->get("subscriber");
134
+			$auth_flag = $auth_flag->num_rows();
135 135
 			if ($auth_flag == 0) {
136 136
 				return "TRUE";
137 137
 			} else {
138
-				return array (
138
+				return array(
139 139
 						"username_error" => "Duplicate Email Address Found Email Must Be Unique." 
140 140
 				);
141 141
 			}
142 142
 		} else {
143
-			return array (
143
+			return array(
144 144
 					"username_error" => "User name is required field." 
145 145
 			);
146 146
 		}
147 147
 		return "0";
148 148
 	}
149 149
 	function user_opensips_save($user_flg = false) {
150
-		$array_add = $this->input->post ();
150
+		$array_add = $this->input->post();
151 151
 		//
152
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields_for_customer ( $array_add ["accountcode"] ), $array_add );
152
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($array_add ["accountcode"]), $array_add);
153 153
 		if ($array_add ['id'] != '') {
154
-			$data ['page_title'] = gettext ( 'Edit Opensips' );
155
-			if ($this->form_validation->run () == FALSE) {
156
-				$data ['validation_errors'] = validation_errors ();
154
+			$data ['page_title'] = gettext('Edit Opensips');
155
+			if ($this->form_validation->run() == FALSE) {
156
+				$data ['validation_errors'] = validation_errors();
157 157
 				echo $data ['validation_errors'];
158 158
 				exit ();
159 159
 			} else {
160
-				$this->opensips_model->edit_opensipsdevices ( $array_add, $array_add ['id'] );
161
-				echo json_encode ( array (
160
+				$this->opensips_model->edit_opensipsdevices($array_add, $array_add ['id']);
161
+				echo json_encode(array(
162 162
 						"SUCCESS" => "Opensips Updated Successfully!" 
163
-				) );
163
+				));
164 164
 				exit ();
165 165
 			}
166 166
 		} else {
167
-			$data ['page_title'] = gettext ( 'Add Opensips' );
168
-			if ($this->form_validation->run () == FALSE) {
169
-				$data ['validation_errors'] = validation_errors ();
167
+			$data ['page_title'] = gettext('Add Opensips');
168
+			if ($this->form_validation->run() == FALSE) {
169
+				$data ['validation_errors'] = validation_errors();
170 170
 				echo $data ['validation_errors'];
171 171
 				exit ();
172 172
 			} else {
173
-				$this->opensips_model->add_opensipsdevices ( $array_add );
174
-				echo json_encode ( array (
173
+				$this->opensips_model->add_opensipsdevices($array_add);
174
+				echo json_encode(array(
175 175
 						"SUCCESS" => "Opensips Added Successfully!" 
176
-				) );
176
+				));
177 177
 				exit ();
178 178
 			}
179 179
 		}
180 180
 	}
181 181
 	function customer_opensips_save($user_flg = false) {
182
-		$add_array = $this->input->post ();
182
+		$add_array = $this->input->post();
183 183
 		// print_r($array_add);exit;
184
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields_for_customer ( $add_array ["accountcode"] ), $add_array );
184
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($add_array ["accountcode"]), $add_array);
185 185
 		if ($add_array ['id'] != '') {
186
-			$data ['page_title'] = gettext ( 'Edit Opensips' );
187
-			if ($this->form_validation->run () == FALSE) {
188
-				$data ['validation_errors'] = validation_errors ();
186
+			$data ['page_title'] = gettext('Edit Opensips');
187
+			if ($this->form_validation->run() == FALSE) {
188
+				$data ['validation_errors'] = validation_errors();
189 189
 				echo $data ['validation_errors'];
190 190
 				exit ();
191 191
 			} else {
192
-				$this->opensips_model->edit_opensipsdevices ( $add_array, $add_array ['id'] );
193
-				echo json_encode ( array (
192
+				$this->opensips_model->edit_opensipsdevices($add_array, $add_array ['id']);
193
+				echo json_encode(array(
194 194
 						"SUCCESS" => "OpenSips Updated Successfully!" 
195
-				) );
195
+				));
196 196
 				exit ();
197 197
 			}
198 198
 		} else {
199
-			$data ['page_title'] = gettext ( 'Add Opensips' );
200
-			if ($this->form_validation->run () == FALSE) {
201
-				$data ['validation_errors'] = validation_errors ();
199
+			$data ['page_title'] = gettext('Add Opensips');
200
+			if ($this->form_validation->run() == FALSE) {
201
+				$data ['validation_errors'] = validation_errors();
202 202
 				echo $data ['validation_errors'];
203 203
 				exit ();
204 204
 			} else {
205
-				$this->opensips_model->add_opensipsdevices ( $add_array );
206
-				echo json_encode ( array (
205
+				$this->opensips_model->add_opensipsdevices($add_array);
206
+				echo json_encode(array(
207 207
 						"SUCCESS" => "OpenSips Added Successfully!" 
208
-				) );
208
+				));
209 209
 				exit ();
210 210
 			}
211 211
 		}
212 212
 	}
213 213
 	function customer_opensips_json($accountid, $accounttype) {
214
-		$json_data = array ();
215
-		$count_all = $this->opensips_model->getopensipsdevice_customer_list ( false, $accountid, $accounttype );
216
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
214
+		$json_data = array();
215
+		$count_all = $this->opensips_model->getopensipsdevice_customer_list(false, $accountid, $accounttype);
216
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
217 217
 		$json_data = $paging_data ["json_paging"];
218 218
 		
219
-		$query = $this->opensips_model->getopensipsdevice_customer_list ( true, $accountid, $accounttype, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
220
-		$grid_fields = json_decode ( $this->opensips_form->opensips_customer_build_opensips_list ( $accountid ) );
221
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
219
+		$query = $this->opensips_model->getopensipsdevice_customer_list(true, $accountid, $accounttype, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
220
+		$grid_fields = json_decode($this->opensips_form->opensips_customer_build_opensips_list($accountid));
221
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
222 222
 		
223
-		echo json_encode ( $json_data );
223
+		echo json_encode($json_data);
224 224
 	}
225 225
 	function opensips_add_customer($add_data) {
226
-		$this->opensips_model->add_opensipsdevices ( $add_array );
226
+		$this->opensips_model->add_opensipsdevices($add_array);
227 227
 	}
228 228
 	function opensips_remove($id) {
229
-		$this->opensips_model->remove_opensips ( $id );
230
-		$this->session->set_flashdata ( 'astpp_notification', 'OpenSips Removed Successfully!' );
231
-		redirect ( base_url () . 'opensips/opensips_list/' );
229
+		$this->opensips_model->remove_opensips($id);
230
+		$this->session->set_flashdata('astpp_notification', 'OpenSips Removed Successfully!');
231
+		redirect(base_url().'opensips/opensips_list/');
232 232
 	}
233 233
 	function opensips_list() {
234
-		$data ['username'] = $this->session->userdata ( 'user_name' );
235
-		$data ['page_title'] = gettext ( 'Opensips Devices List' );
234
+		$data ['username'] = $this->session->userdata('user_name');
235
+		$data ['page_title'] = gettext('Opensips Devices List');
236 236
 		$data ['search_flag'] = true;
237
-		$this->session->set_userdata ( 'advance_search', 0 );
238
-		$data ['grid_fields'] = $this->opensips_form->build_opensips_list ();
239
-		$data ["grid_buttons"] = $this->opensips_form->build_grid_buttons ();
240
-		$data ['form_search'] = $this->form->build_serach_form ( $this->opensips_form->get_search_opensips_form () );
241
-		$this->load->view ( 'view_opensips_list', $data );
237
+		$this->session->set_userdata('advance_search', 0);
238
+		$data ['grid_fields'] = $this->opensips_form->build_opensips_list();
239
+		$data ["grid_buttons"] = $this->opensips_form->build_grid_buttons();
240
+		$data ['form_search'] = $this->form->build_serach_form($this->opensips_form->get_search_opensips_form());
241
+		$this->load->view('view_opensips_list', $data);
242 242
 	}
243 243
 	
244 244
 	/**
@@ -246,105 +246,105 @@  discard block
 block discarded – undo
246 246
 	 * Listing of Accounts table data through php function json_encode
247 247
 	 */
248 248
 	function opensips_list_json() {
249
-		$json_data = array ();
250
-		$count_all = $this->opensips_model->getopensipsdevice_list ( false );
251
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
249
+		$json_data = array();
250
+		$count_all = $this->opensips_model->getopensipsdevice_list(false);
251
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
252 252
 		$json_data = $paging_data ["json_paging"];
253
-		$query = $this->opensips_model->getopensipsdevice_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
254
-		$grid_fields = json_decode ( $this->opensips_form->build_opensips_list () );
255
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
256
-		$result = $this->opensips_db->get ( "subscriber" );
257
-		if ($result->num_rows () <= 0) {
253
+		$query = $this->opensips_model->getopensipsdevice_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
254
+		$grid_fields = json_decode($this->opensips_form->build_opensips_list());
255
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
256
+		$result = $this->opensips_db->get("subscriber");
257
+		if ($result->num_rows() <= 0) {
258 258
 			$json_data ['page'] = 0;
259 259
 			$json_data ['total'] = 0;
260 260
 		}
261
-		echo json_encode ( $json_data );
261
+		echo json_encode($json_data);
262 262
 	}
263 263
 	function opensips_list_search() {
264 264
 		// alert('hgjgh');
265
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
265
+		$ajax_search = $this->input->post('ajax_search', 0);
266 266
 		// alert();
267
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
268
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
269
-			$action = $this->input->post ();
270
-			unset ( $action ['action'] );
271
-			unset ( $action ['advance_search'] );
272
-			$this->session->set_userdata ( 'opensipsdevice_list_search', $action );
267
+		if ($this->input->post('advance_search', TRUE) == 1) {
268
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
269
+			$action = $this->input->post();
270
+			unset ($action ['action']);
271
+			unset ($action ['advance_search']);
272
+			$this->session->set_userdata('opensipsdevice_list_search', $action);
273 273
 		}
274 274
 		if (@$ajax_search != 1) {
275
-			redirect ( base_url () . 'opensips/opensips_list/' );
275
+			redirect(base_url().'opensips/opensips_list/');
276 276
 		}
277 277
 	}
278 278
 	function opensips_list_clearsearchfilter() {
279
-		$this->session->set_userdata ( 'advance_search', '' );
280
-		$this->session->set_userdata ( 'opensipsdevice_list_search', '' );
279
+		$this->session->set_userdata('advance_search', '');
280
+		$this->session->set_userdata('opensipsdevice_list_search', '');
281 281
 	}
282 282
 	
283 283
 	// dispather List add edit delete
284 284
 	function dispatcher_add() {
285
-		$data ['username'] = $this->session->userdata ( 'user_name' );
285
+		$data ['username'] = $this->session->userdata('user_name');
286 286
 		$data ['flag'] = 'create';
287
-		$data ['page_title'] = gettext ( 'Dispatcher' );
288
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_dispatcher_form_fields (), '' );
287
+		$data ['page_title'] = gettext('Dispatcher');
288
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), '');
289 289
 		
290
-		$this->load->view ( 'view_dispatcher_add_edit', $data );
290
+		$this->load->view('view_dispatcher_add_edit', $data);
291 291
 	}
292 292
 	function dispatcher_edit($edit_id = '') {
293
-		$data ['page_title'] = gettext ( 'Dispatcher' );
294
-		$this->opensips_db->where ( 'id', $edit_id );
295
-		$account = $this->opensips_db->get ( "dispatcher" );
296
-		foreach ( $account->result_array () as $key => $value ) {
293
+		$data ['page_title'] = gettext('Dispatcher');
294
+		$this->opensips_db->where('id', $edit_id);
295
+		$account = $this->opensips_db->get("dispatcher");
296
+		foreach ($account->result_array() as $key => $value) {
297 297
 			$edit_data = $value;
298 298
 		}
299 299
 		
300
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_dispatcher_form_fields (), $edit_data );
301
-		$this->load->view ( 'view_dispatcher_add_edit', $data );
300
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), $edit_data);
301
+		$this->load->view('view_dispatcher_add_edit', $data);
302 302
 	}
303 303
 	function dispatcher_save() {
304
-		$add_array = $this->input->post ();
305
-		$data ['form'] = $this->form->build_form ( $this->opensips_form->get_dispatcher_form_fields (), $add_array );
304
+		$add_array = $this->input->post();
305
+		$data ['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), $add_array);
306 306
 		if ($add_array ['id'] != '') {
307
-			$data ['page_title'] = gettext ( 'Edit Dispatcher' );
308
-			if ($this->form_validation->run () == FALSE) {
309
-				$data ['validation_errors'] = validation_errors ();
307
+			$data ['page_title'] = gettext('Edit Dispatcher');
308
+			if ($this->form_validation->run() == FALSE) {
309
+				$data ['validation_errors'] = validation_errors();
310 310
 				echo $data ['validation_errors'];
311 311
 				exit ();
312 312
 			} else {
313
-				$this->opensips_model->edit_opensipsdispatcher ( $add_array, $add_array ['id'] );
314
-				echo json_encode ( array (
313
+				$this->opensips_model->edit_opensipsdispatcher($add_array, $add_array ['id']);
314
+				echo json_encode(array(
315 315
 						"SUCCESS" => "Dispatcher Updated Successfully!" 
316
-				) );
316
+				));
317 317
 				exit ();
318 318
 			}
319 319
 		} else {
320
-			$data ['page_title'] = gettext ( 'Add Dispatcher' );
321
-			if ($this->form_validation->run () == FALSE) {
322
-				$data ['validation_errors'] = validation_errors ();
320
+			$data ['page_title'] = gettext('Add Dispatcher');
321
+			if ($this->form_validation->run() == FALSE) {
322
+				$data ['validation_errors'] = validation_errors();
323 323
 				echo $data ['validation_errors'];
324 324
 				exit ();
325 325
 			} else {
326
-				$this->opensips_model->add_opensipsdispatcher ( $add_array );
327
-				echo json_encode ( array (
326
+				$this->opensips_model->add_opensipsdispatcher($add_array);
327
+				echo json_encode(array(
328 328
 						"SUCCESS" => "Dispatcher Added Successfully!" 
329
-				) );
329
+				));
330 330
 				exit ();
331 331
 			}
332 332
 		}
333 333
 	}
334 334
 	function dispatcher_remove($id) {
335
-		$this->opensips_model->remove_dispatcher ( $id );
336
-		$this->session->set_flashdata ( 'astpp_notification', 'Dispatcher Removed Successfully!' );
337
-		redirect ( base_url () . 'opensips/dispatcher_list/' );
335
+		$this->opensips_model->remove_dispatcher($id);
336
+		$this->session->set_flashdata('astpp_notification', 'Dispatcher Removed Successfully!');
337
+		redirect(base_url().'opensips/dispatcher_list/');
338 338
 	}
339 339
 	function dispatcher_list() {
340
-		$data ['username'] = $this->session->userdata ( 'user_name' );
341
-		$data ['page_title'] = gettext ( 'Opensips Dispatcher List' );
340
+		$data ['username'] = $this->session->userdata('user_name');
341
+		$data ['page_title'] = gettext('Opensips Dispatcher List');
342 342
 		$data ['search_flag'] = true;
343
-		$this->session->set_userdata ( 'advance_search', 0 );
344
-		$data ['grid_fields'] = $this->opensips_form->build_opensipsdispatcher_list ();
345
-		$data ["grid_buttons"] = $this->opensips_form->build_grid_dispatcherbuttons ();
346
-		$data ['form_search'] = $this->form->build_serach_form ( $this->opensips_form->get_search_dispatcher_form () );
347
-		$this->load->view ( 'view_dispatcher_list', $data );
343
+		$this->session->set_userdata('advance_search', 0);
344
+		$data ['grid_fields'] = $this->opensips_form->build_opensipsdispatcher_list();
345
+		$data ["grid_buttons"] = $this->opensips_form->build_grid_dispatcherbuttons();
346
+		$data ['form_search'] = $this->form->build_serach_form($this->opensips_form->get_search_dispatcher_form());
347
+		$this->load->view('view_dispatcher_list', $data);
348 348
 	}
349 349
 	
350 350
 	/**
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 	 * Listing of Accounts table data through php function json_encode
353 353
 	 */
354 354
 	function dispatcher_list_json() {
355
-		$json_data = array ();
356
-		$count_all = $this->opensips_model->getopensipsdispatcher_list ( false );
357
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
355
+		$json_data = array();
356
+		$count_all = $this->opensips_model->getopensipsdispatcher_list(false);
357
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
358 358
 		$json_data = $paging_data ["json_paging"];
359 359
 		
360
-		$query = $this->opensips_model->getopensipsdispatcher_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
361
-		$grid_fields = json_decode ( $this->opensips_form->build_opensipsdispatcher_list () );
362
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
360
+		$query = $this->opensips_model->getopensipsdispatcher_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
361
+		$grid_fields = json_decode($this->opensips_form->build_opensipsdispatcher_list());
362
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
363 363
 		/*
364 364
 		 * $result = $this->opensips_db->get("subscriber");
365 365
 		 * if($result->num_rows() <= 0){
@@ -367,23 +367,23 @@  discard block
 block discarded – undo
367 367
 		 * $json_data['total'] = 0;
368 368
 		 * }
369 369
 		 */
370
-		echo json_encode ( $json_data );
370
+		echo json_encode($json_data);
371 371
 	}
372 372
 	function dispatcher_list_search() {
373
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
374
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
375
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
376
-			unset ( $_POST ['action'] );
377
-			unset ( $_POST ['advance_search'] );
378
-			$this->session->set_userdata ( 'opensipsdispatcher_list_search', $this->input->post () );
373
+		$ajax_search = $this->input->post('ajax_search', 0);
374
+		if ($this->input->post('advance_search', TRUE) == 1) {
375
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
376
+			unset ($_POST ['action']);
377
+			unset ($_POST ['advance_search']);
378
+			$this->session->set_userdata('opensipsdispatcher_list_search', $this->input->post());
379 379
 		}
380 380
 		if (@$ajax_search != 1) {
381
-			redirect ( base_url () . 'opensips/dispatcher_list/' );
381
+			redirect(base_url().'opensips/dispatcher_list/');
382 382
 		}
383 383
 	}
384 384
 	function dispatcher_list_clearsearchfilter() {
385
-		$this->session->set_userdata ( 'advance_search', 0 );
386
-		$this->session->set_userdata ( 'opensipsdispatcher_list_search', "" );
385
+		$this->session->set_userdata('advance_search', 0);
386
+		$this->session->set_userdata('opensipsdispatcher_list_search', "");
387 387
 	}
388 388
 }
389 389
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@
 block discarded – undo
32 32
 		$db_config = Common_model::$global_config ['system_config'];
33 33
 		$opensipdsn = "mysql://" . $db_config ['opensips_dbuser'] . ":" . $db_config ['opensips_dbpass'] . "@" . $db_config ['opensips_dbhost'] . "/" . $db_config ['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
34 34
 		$this->opensips_db = $this->load->database ( $opensipdsn, true );
35
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
36
-			redirect ( base_url () . '/astpp/login' );
35
+		if ($this->session->userdata ( 'user_login' ) == FALSE) {
36
+					redirect ( base_url () . '/astpp/login' );
37
+		}
37 38
 	}
38 39
 	function opensips_add() {
39 40
 		// echo 'dd';
Please login to merge, or discard this patch.
astpp/application/modules/opensips/libraries/opensips_form.php 2 patches
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -20,33 +20,33 @@  discard block
 block discarded – undo
20 20
 // You should have received a copy of the GNU Affero General Public License
21 21
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 22
 // ##############################################################################
23
-if (! defined ( 'BASEPATH' ))
24
-	exit ( 'No direct script access allowed' );
23
+if ( ! defined('BASEPATH'))
24
+	exit ('No direct script access allowed');
25 25
 class Opensips_form {
26 26
 	function __construct() {
27
-		$this->CI = & get_instance ();
27
+		$this->CI = & get_instance();
28 28
 	}
29 29
 	function get_opensips_form_fields($id = false) {
30
-		$accountinfo = $this->CI->session->userdata ( "accountinfo" );
30
+		$accountinfo = $this->CI->session->userdata("accountinfo");
31 31
 		
32
-		$uname_user = $this->CI->common->find_uniq_rendno ( '10', '', '' );
33
-		$password = $this->CI->common->generate_password ();
34
-		$val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username';
32
+		$uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
33
+		$password = $this->CI->common->generate_password();
34
+		$val = $id > 0 ? 'subscriber.username.'.$id : 'subscriber.username';
35 35
 		
36 36
 		// echo '<pre>'; print_r($val); exit;
37
-		$loginid = $this->CI->session->userdata ( 'logintype' ) == 2 ? 0 : $accountinfo ['id'];
38
-		$form ['forms'] = array (
39
-				base_url () . 'opensips/opensips_save/',
40
-				array (
37
+		$loginid = $this->CI->session->userdata('logintype') == 2 ? 0 : $accountinfo ['id'];
38
+		$form ['forms'] = array(
39
+				base_url().'opensips/opensips_save/',
40
+				array(
41 41
 						"id" => "opensips_form",
42 42
 						"name" => "opensips_form" 
43 43
 				) 
44 44
 		);
45
-		$form ['Opensips Device'] = array (
46
-				array (
45
+		$form ['Opensips Device'] = array(
46
+				array(
47 47
 						'',
48 48
 						'HIDDEN',
49
-						array (
49
+						array(
50 50
 								'name' => 'id' 
51 51
 						),
52 52
 						'',
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 						'',
55 55
 						'' 
56 56
 				),
57
-				array (
58
-						gettext ( 'Username' ),
57
+				array(
58
+						gettext('Username'),
59 59
 						'INPUT',
60
-						array (
60
+						array(
61 61
 								'name' => 'username',
62 62
 								'size' => '30',
63 63
 								'value' => $uname_user,
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 						'Please Enter account number',
70 70
 						'<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>' 
71 71
 				),
72
-				array (
73
-						gettext ( 'Password' ),
72
+				array(
73
+						gettext('Password'),
74 74
 						'INPUT',
75
-						array (
75
+						array(
76 76
 								'name' => 'password',
77 77
 								'size' => '30',
78 78
 								'value' => $password,
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 						'Please Enter Password',
85 85
 						'<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_pass fa fa-refresh"></i>' 
86 86
 				),
87
-				array (
88
-						gettext ( 'Account' ),
87
+				array(
88
+						gettext('Account'),
89 89
 						'accountcode',
90 90
 						'SELECT',
91 91
 						'',
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 						'accounts',
98 98
 						'build_dropdown',
99 99
 						'where_arr',
100
-						array (
100
+						array(
101 101
 								"reseller_id" => $loginid,
102 102
 								"type" => "GLOBAL",
103 103
 								"deleted" => "0" 
104 104
 						) 
105 105
 				),
106
-				array (
107
-						gettext ( 'Domain' ),
106
+				array(
107
+						gettext('Domain'),
108 108
 						'INPUT',
109
-						array (
109
+						array(
110 110
 								'name' => 'domain',
111 111
 								'size' => '20',
112 112
 								'class' => "text field medium" 
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 						'tOOL TIP',
116 116
 						'' 
117 117
 				),
118
-				array (
119
-						gettext ( 'Caller Name' ),
118
+				array(
119
+						gettext('Caller Name'),
120 120
 						'INPUT',
121
-						array (
121
+						array(
122 122
 								'name' => 'effective_caller_id_name',
123 123
 								'size' => '20',
124 124
 								'class' => "text field medium" 
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 						'tOOL TIP',
128 128
 						'Please Enter account number' 
129 129
 				),
130
-				array (
131
-						gettext ( 'Caller Number' ),
130
+				array(
131
+						gettext('Caller Number'),
132 132
 						'INPUT',
133
-						array (
133
+						array(
134 134
 								'name' => 'effective_caller_id_number',
135 135
 								'size' => '20',
136 136
 								'class' => "text field medium" 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 						'tOOL TIP',
140 140
 						'Please Enter account number' 
141 141
 				),
142
-				array (
143
-						gettext ( 'Status' ),
142
+				array(
143
+						gettext('Status'),
144 144
 						'status',
145 145
 						'SELECT',
146 146
 						'',
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 						'set_status' 
154 154
 				) 
155 155
 		);
156
-		$form ['button_save'] = array (
156
+		$form ['button_save'] = array(
157 157
 				'name' => 'action',
158
-				'content' => gettext ( 'Save' ),
158
+				'content' => gettext('Save'),
159 159
 				'value' => 'save',
160 160
 				'type' => 'button',
161 161
 				'id' => 'submit',
162 162
 				'class' => 'btn btn-line-parrot' 
163 163
 		);
164
-		$form ['button_cancel'] = array (
164
+		$form ['button_cancel'] = array(
165 165
 				'name' => 'action',
166
-				'content' => gettext ( 'Close' ),
166
+				'content' => gettext('Close'),
167 167
 				'value' => 'cancel',
168 168
 				'type' => 'button',
169 169
 				'class' => 'btn btn-line-sky margin-x-10',
@@ -173,18 +173,18 @@  discard block
 block discarded – undo
173 173
 		return $form;
174 174
 	}
175 175
 	function get_dispatcher_form_fields() {
176
-		$form ['forms'] = array (
177
-				base_url () . 'opensips/dispatcher_save/',
178
-				array (
176
+		$form ['forms'] = array(
177
+				base_url().'opensips/dispatcher_save/',
178
+				array(
179 179
 						"id" => "opensips_dispatcher_form",
180 180
 						"name" => "opensips_dispatcher_form" 
181 181
 				) 
182 182
 		);
183
-		$form ['Dispatcher Information'] = array (
184
-				array (
183
+		$form ['Dispatcher Information'] = array(
184
+				array(
185 185
 						'',
186 186
 						'HIDDEN',
187
-						array (
187
+						array(
188 188
 								'name' => 'id' 
189 189
 						),
190 190
 						'',
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 						'',
193 193
 						'' 
194 194
 				),
195
-				array (
196
-						gettext ( 'Setid' ),
195
+				array(
196
+						gettext('Setid'),
197 197
 						'INPUT',
198
-						array (
198
+						array(
199 199
 								'name' => 'setid',
200 200
 								'size' => '20',
201 201
 								'class' => "text field medium" 
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
 						'tOOL TIP',
205 205
 						'' 
206 206
 				),
207
-				array (
208
-						gettext ( 'Destination' ),
207
+				array(
208
+						gettext('Destination'),
209 209
 						'INPUT',
210
-						array (
210
+						array(
211 211
 								'name' => 'destination',
212 212
 								'size' => '20',
213 213
 								'class' => "text field medium" 
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 						'tOOL TIP',
217 217
 						'' 
218 218
 				),
219
-				array (
220
-						gettext ( 'Weight' ),
219
+				array(
220
+						gettext('Weight'),
221 221
 						'INPUT',
222
-						array (
222
+						array(
223 223
 								'name' => 'weight',
224 224
 								'size' => '20',
225 225
 								'class' => "text field medium" 
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 						'tOOL TIP',
229 229
 						'' 
230 230
 				),
231
-				array (
232
-						gettext ( 'Attrs' ),
231
+				array(
232
+						gettext('Attrs'),
233 233
 						'INPUT',
234
-						array (
234
+						array(
235 235
 								'name' => 'attrs',
236 236
 								'size' => '20',
237 237
 								'class' => "text field medium" 
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 						'tOOL TIP',
241 241
 						'' 
242 242
 				),
243
-				array (
244
-						gettext ( 'Description' ),
243
+				array(
244
+						gettext('Description'),
245 245
 						'INPUT',
246
-						array (
246
+						array(
247 247
 								'name' => 'description',
248 248
 								'size' => '100',
249 249
 								'class' => "text field medium" 
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
 						'' 
254 254
 				) 
255 255
 		);
256
-		$form ['button_save'] = array (
256
+		$form ['button_save'] = array(
257 257
 				'name' => 'action',
258
-				'content' => gettext ( 'Save' ),
258
+				'content' => gettext('Save'),
259 259
 				'value' => 'save',
260 260
 				'type' => 'button',
261 261
 				'id' => 'submit',
262 262
 				'class' => 'btn btn-line-parrot' 
263 263
 		);
264
-		$form ['button_cancel'] = array (
264
+		$form ['button_cancel'] = array(
265 265
 				'name' => 'action',
266
-				'content' => gettext ( 'Close' ),
266
+				'content' => gettext('Close'),
267 267
 				'value' => 'cancel',
268 268
 				'type' => 'button',
269 269
 				'class' => 'btn btn-line-sky margin-x-10',
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 		return $form;
273 273
 	}
274 274
 	function get_search_dispatcher_form() {
275
-		$form ['forms'] = array (
275
+		$form ['forms'] = array(
276 276
 				"",
277
-				array (
277
+				array(
278 278
 						'id' => "dispatcher_search" 
279 279
 				) 
280 280
 		);
281
-		$form ['Search'] = array (
282
-				array (
283
-						gettext ( 'Description' ),
281
+		$form ['Search'] = array(
282
+				array(
283
+						gettext('Description'),
284 284
 						'INPUT',
285
-						array (
285
+						array(
286 286
 								'name' => 'description[description]',
287 287
 								'',
288 288
 								'size' => '20',
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 						'search_string_type',
299 299
 						'' 
300 300
 				),
301
-				array (
301
+				array(
302 302
 						'',
303 303
 						'HIDDEN',
304 304
 						'ajax_search',
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 						'',
308 308
 						'' 
309 309
 				),
310
-				array (
310
+				array(
311 311
 						'',
312 312
 						'HIDDEN',
313 313
 						'advance_search',
@@ -318,19 +318,19 @@  discard block
 block discarded – undo
318 318
 				) 
319 319
 		);
320 320
 		
321
-		$form ['button_search'] = array (
321
+		$form ['button_search'] = array(
322 322
 				'name' => 'action',
323 323
 				'id' => "opensipsdispatcher_search_btn",
324
-				'content' => gettext ( 'Search' ),
324
+				'content' => gettext('Search'),
325 325
 				'value' => 'save',
326 326
 				'type' => 'button',
327 327
 				'class' => 'btn btn-line-parrot pull-right' 
328 328
 		);
329
-		$form ['button_reset'] = array (
329
+		$form ['button_reset'] = array(
330 330
 				'name' => 'action',
331 331
 				'id' => "id_reset",
332 332
 				'content' => 'Clear',
333
-				'value' => gettext ( 'cancel' ),
333
+				'value' => gettext('cancel'),
334 334
 				'type' => 'reset',
335 335
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
336 336
 		);
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
 		return $form;
339 339
 	}
340 340
 	function get_search_opensips_form() {
341
-		$form ['forms'] = array (
341
+		$form ['forms'] = array(
342 342
 				"",
343
-				array (
343
+				array(
344 344
 						'id' => "opensips_list_search" 
345 345
 				) 
346 346
 		);
347
-		$form ['Search'] = array (
348
-				array (
349
-						gettext ( 'Username' ),
347
+		$form ['Search'] = array(
348
+				array(
349
+						gettext('Username'),
350 350
 						'INPUT',
351
-						array (
351
+						array(
352 352
 								'name' => 'username[username]',
353 353
 								'',
354 354
 								'size' => '20',
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 						'search_string_type',
365 365
 						'' 
366 366
 				),
367
-				array (
367
+				array(
368 368
 						'',
369 369
 						'HIDDEN',
370 370
 						'ajax_search',
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 						'',
374 374
 						'' 
375 375
 				),
376
-				array (
376
+				array(
377 377
 						'',
378 378
 						'HIDDEN',
379 379
 						'advance_search',
@@ -384,19 +384,19 @@  discard block
 block discarded – undo
384 384
 				) 
385 385
 		);
386 386
 		
387
-		$form ['button_search'] = array (
387
+		$form ['button_search'] = array(
388 388
 				'name' => 'action',
389 389
 				'id' => "opensipsdevice_search_btn",
390
-				'content' => gettext ( 'Search' ),
390
+				'content' => gettext('Search'),
391 391
 				'value' => 'save',
392 392
 				'type' => 'button',
393 393
 				'class' => 'btn btn-line-parrot pull-right' 
394 394
 		);
395
-		$form ['button_reset'] = array (
395
+		$form ['button_reset'] = array(
396 396
 				'name' => 'action',
397 397
 				'id' => "id_reset",
398 398
 				'content' => 'Clear',
399
-				'value' => gettext ( 'cancel' ),
399
+				'value' => gettext('cancel'),
400 400
 				'type' => 'reset',
401 401
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
402 402
 		);
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 	}
406 406
 	function build_opensips_list() {
407 407
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
408
-		$grid_field_arr = json_encode ( array (
409
-				array (
410
-						gettext ( "Username" ),
408
+		$grid_field_arr = json_encode(array(
409
+				array(
410
+						gettext("Username"),
411 411
 						"150",
412 412
 						"username",
413 413
 						"",
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 						"true",
418 418
 						"center" 
419 419
 				),
420
-				array (
421
-						gettext ( "Password" ),
420
+				array(
421
+						gettext("Password"),
422 422
 						"150",
423 423
 						"password",
424 424
 						"",
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 						"true",
429 429
 						"center" 
430 430
 				),
431
-				array (
432
-						gettext ( "Account" ),
431
+				array(
432
+						gettext("Account"),
433 433
 						"150",
434 434
 						"accountcode",
435 435
 						"",
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 						"true",
440 440
 						"center" 
441 441
 				),
442
-				array (
443
-						gettext ( "Domain" ),
442
+				array(
443
+						gettext("Domain"),
444 444
 						"317",
445 445
 						"domain",
446 446
 						"",
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 						"true",
451 451
 						"center" 
452 452
 				),
453
-				array (
454
-						gettext ( "Caller Name" ),
453
+				array(
454
+						gettext("Caller Name"),
455 455
 						"200",
456 456
 						"effective_caller_id_name",
457 457
 						"",
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 						"true",
462 462
 						"center" 
463 463
 				),
464
-				array (
465
-						gettext ( "Caller Number" ),
464
+				array(
465
+						gettext("Caller Number"),
466 466
 						"200",
467 467
 						"effective_caller_id_number",
468 468
 						"",
@@ -472,31 +472,31 @@  discard block
 block discarded – undo
472 472
 						"true",
473 473
 						"center" 
474 474
 				),
475
-				array (
476
-						gettext ( "Action" ),
475
+				array(
476
+						gettext("Action"),
477 477
 						"100",
478 478
 						"",
479 479
 						"",
480 480
 						"",
481
-						array (
482
-								"EDIT" => array (
481
+						array(
482
+								"EDIT" => array(
483 483
 										"url" => "/opensips/opensips_edit/",
484 484
 										"mode" => "popup" 
485 485
 								),
486
-								"DELETE" => array (
486
+								"DELETE" => array(
487 487
 										"url" => "/opensips/opensips_remove/",
488 488
 										"mode" => "single" 
489 489
 								) 
490 490
 						) 
491 491
 				) 
492
-		) );
492
+		));
493 493
 		return $grid_field_arr;
494 494
 	}
495 495
 	function build_opensipsdispatcher_list() {
496 496
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
497
-		$grid_field_arr = json_encode ( array (
498
-				array (
499
-						gettext ( "Set Id" ),
497
+		$grid_field_arr = json_encode(array(
498
+				array(
499
+						gettext("Set Id"),
500 500
 						"160",
501 501
 						"setid",
502 502
 						"",
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 						"true",
507 507
 						"center" 
508 508
 				),
509
-				array (
510
-						gettext ( "Destination" ),
509
+				array(
510
+						gettext("Destination"),
511 511
 						"160",
512 512
 						"destination",
513 513
 						"",
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 						"true",
518 518
 						"center" 
519 519
 				),
520
-				array (
521
-						gettext ( "Weight" ),
520
+				array(
521
+						gettext("Weight"),
522 522
 						"190",
523 523
 						"weight",
524 524
 						"",
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
 						"true",
529 529
 						"center" 
530 530
 				),
531
-				array (
532
-						gettext ( "Attrs" ),
531
+				array(
532
+						gettext("Attrs"),
533 533
 						"180",
534 534
 						"attrs",
535 535
 						"",
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
 						"true",
540 540
 						"center" 
541 541
 				),
542
-				array (
543
-						gettext ( "Description" ),
542
+				array(
543
+						gettext("Description"),
544 544
 						"190",
545 545
 						"description",
546 546
 						"",
@@ -550,29 +550,29 @@  discard block
 block discarded – undo
550 550
 						"true",
551 551
 						"center" 
552 552
 				),
553
-				array (
554
-						gettext ( "Action" ),
553
+				array(
554
+						gettext("Action"),
555 555
 						"170",
556 556
 						"",
557 557
 						"",
558 558
 						"",
559
-						array (
560
-								"EDIT" => array (
559
+						array(
560
+								"EDIT" => array(
561 561
 										"url" => "/opensips/dispatcher_edit/",
562 562
 										"mode" => "popup" 
563 563
 								),
564
-								"DELETE" => array (
564
+								"DELETE" => array(
565 565
 										"url" => "/opensips/dispatcher_remove/",
566 566
 										"mode" => "single" 
567 567
 								) 
568 568
 						) 
569 569
 				) 
570
-		) );
570
+		));
571 571
 		return $grid_field_arr;
572 572
 	}
573 573
 	function build_grid_buttons() {
574
-		$buttons_json = json_encode ( array (
575
-				array (
574
+		$buttons_json = json_encode(array(
575
+				array(
576 576
 						"Create",
577 577
 						"btn btn-line-warning btn",
578 578
 						"fa fa-plus-circle fa-lg",
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 		return $buttons_json;
587 587
 	}
588 588
 	function build_grid_dispatcherbuttons() {
589
-		$buttons_json = json_encode ( array (
590
-				array (
589
+		$buttons_json = json_encode(array(
590
+				array(
591 591
 						"Create",
592 592
 						"btn btn-line-warning btn",
593 593
 						"fa fa-plus-circle fa-lg",
@@ -601,23 +601,23 @@  discard block
 block discarded – undo
601 601
 		return $buttons_json;
602 602
 	}
603 603
 	function get_opensips_form_fields_for_customer($accountid, $id = false) {
604
-		$val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username';
605
-		$uname_user = $this->CI->common->find_uniq_rendno ( '10', '', '' );
606
-		$password = $this->CI->common->generate_password ();
607
-		$accountinfo = $this->CI->session->userdata ( 'accountinfo' );
608
-		$link = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 3) ? base_url () . 'opensips/user_opensips_save/true/' : base_url () . 'opensips/customer_opensips_save/true/';
609
-		$form ['forms'] = array (
604
+		$val = $id > 0 ? 'subscriber.username.'.$id : 'subscriber.username';
605
+		$uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
606
+		$password = $this->CI->common->generate_password();
607
+		$accountinfo = $this->CI->session->userdata('accountinfo');
608
+		$link = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 3) ? base_url ().'opensips/user_opensips_save/true/' : base_url().'opensips/customer_opensips_save/true/';
609
+		$form ['forms'] = array(
610 610
 				$link,
611
-				array (
611
+				array(
612 612
 						"id" => "opensips_form",
613 613
 						"name" => "opensips_form" 
614 614
 				) 
615 615
 		);
616
-		$form ['Opensips Device'] = array (
617
-				array (
616
+		$form ['Opensips Device'] = array(
617
+				array(
618 618
 						'',
619 619
 						'HIDDEN',
620
-						array (
620
+						array(
621 621
 								'name' => 'id' 
622 622
 						),
623 623
 						'',
@@ -625,24 +625,24 @@  discard block
 block discarded – undo
625 625
 						'',
626 626
 						'' 
627 627
 				),
628
-				array (
628
+				array(
629 629
 						'',
630 630
 						'HIDDEN',
631
-						array (
631
+						array(
632 632
 								'name' => 'accountcode',
633
-								'value' => $this->CI->common->get_field_name ( 'number', 'accounts', array (
633
+								'value' => $this->CI->common->get_field_name('number', 'accounts', array(
634 634
 										'id' => $accountid 
635
-								) ) 
635
+								)) 
636 636
 						),
637 637
 						'',
638 638
 						'',
639 639
 						'',
640 640
 						'' 
641 641
 				),
642
-				array (
643
-						gettext ( 'Username' ),
642
+				array(
643
+						gettext('Username'),
644 644
 						'INPUT',
645
-						array (
645
+						array(
646 646
 								'name' => 'username',
647 647
 								'size' => '20',
648 648
 								'id' => 'username',
@@ -654,10 +654,10 @@  discard block
 block discarded – undo
654 654
 						'Please Enter account number',
655 655
 						'<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>' 
656 656
 				),
657
-				array (
658
-						gettext ( 'Password' ),
657
+				array(
658
+						gettext('Password'),
659 659
 						'PASSWORD',
660
-						array (
660
+						array(
661 661
 								'name' => 'password',
662 662
 								'size' => '20',
663 663
 								'id' => 'password1',
@@ -669,10 +669,10 @@  discard block
 block discarded – undo
669 669
 						'Please Enter Password',
670 670
 						'<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_pass fa fa-refresh"></i>' 
671 671
 				),
672
-				array (
673
-						gettext ( 'Domain' ),
672
+				array(
673
+						gettext('Domain'),
674 674
 						'INPUT',
675
-						array (
675
+						array(
676 676
 								'name' => 'domain',
677 677
 								'size' => '20',
678 678
 								'class' => "text field medium" 
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
 						'tOOL TIP',
682 682
 						'Please Enter account number' 
683 683
 				),
684
-				array (
685
-						gettext ( 'Caller Name' ),
684
+				array(
685
+						gettext('Caller Name'),
686 686
 						'INPUT',
687
-						array (
687
+						array(
688 688
 								'name' => 'effective_caller_id_name',
689 689
 								'size' => '20',
690 690
 								'class' => "text field medium" 
@@ -693,10 +693,10 @@  discard block
 block discarded – undo
693 693
 						'tOOL TIP',
694 694
 						'Please Enter account number' 
695 695
 				),
696
-				array (
697
-						gettext ( 'Caller Number' ),
696
+				array(
697
+						gettext('Caller Number'),
698 698
 						'INPUT',
699
-						array (
699
+						array(
700 700
 								'name' => 'effective_caller_id_number',
701 701
 								'size' => '20',
702 702
 								'class' => "text field medium" 
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 						'tOOL TIP',
706 706
 						'Please Enter account number' 
707 707
 				),
708
-				array (
709
-						gettext ( 'Status' ),
708
+				array(
709
+						gettext('Status'),
710 710
 						'status',
711 711
 						'SELECT',
712 712
 						'',
@@ -719,18 +719,18 @@  discard block
 block discarded – undo
719 719
 						'set_status' 
720 720
 				) 
721 721
 		);
722
-		$form ['button_save'] = array (
722
+		$form ['button_save'] = array(
723 723
 				'name' => 'action',
724
-				'content' => gettext ( 'Save' ),
724
+				'content' => gettext('Save'),
725 725
 				'value' => 'save',
726 726
 				'type' => 'button',
727 727
 				'id' => 'submit',
728 728
 				'class' => 'btn btn-line-parrot' 
729 729
 		);
730
-		$form ['button_cancel'] = array (
730
+		$form ['button_cancel'] = array(
731 731
 				'name' => 'action',
732 732
 				'content' => 'Close',
733
-				gettext ( 'value' ) => 'cancel',
733
+				gettext('value') => 'cancel',
734 734
 				'type' => 'button',
735 735
 				'class' => 'btn btn-line-sky margin-x-10',
736 736
 				'onclick' => 'return redirect_page(\'NULL\')' 
@@ -739,54 +739,54 @@  discard block
 block discarded – undo
739 739
 	}
740 740
 	function user_opensips() {
741 741
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
742
-		$grid_field_arr = json_encode ( array (
743
-				array (
744
-						gettext ( "Username" ),
742
+		$grid_field_arr = json_encode(array(
743
+				array(
744
+						gettext("Username"),
745 745
 						"130",
746 746
 						"username",
747 747
 						"",
748 748
 						"",
749 749
 						"" 
750 750
 				),
751
-				array (
752
-						gettext ( "Password" ),
751
+				array(
752
+						gettext("Password"),
753 753
 						"130",
754 754
 						"password",
755 755
 						"",
756 756
 						"",
757 757
 						"" 
758 758
 				),
759
-				array (
760
-						gettext ( "Domain" ),
759
+				array(
760
+						gettext("Domain"),
761 761
 						"130",
762 762
 						"domain",
763 763
 						"",
764 764
 						"",
765 765
 						"" 
766 766
 				),
767
-				array (
768
-						gettext ( "Action" ),
767
+				array(
768
+						gettext("Action"),
769 769
 						"120",
770 770
 						"",
771 771
 						"",
772 772
 						"",
773
-						array (
774
-								"EDIT" => array (
773
+						array(
774
+								"EDIT" => array(
775 775
 										"url" => 'user/user_opensips_action/edit/',
776 776
 										"mode" => "popup" 
777 777
 								),
778
-								"DELETE" => array (
778
+								"DELETE" => array(
779 779
 										"url" => 'user/user_opensips_action/delete/',
780 780
 										"mode" => "popup" 
781 781
 								) 
782 782
 						) 
783 783
 				) 
784
-		) );
784
+		));
785 785
 		return $grid_field_arr;
786 786
 	}
787 787
 	function opensips_customer_build_grid_buttons($accountid) {
788
-		$buttons_json = json_encode ( array (
789
-				array (
788
+		$buttons_json = json_encode(array(
789
+				array(
790 790
 						"Add Devices",
791 791
 						"btn btn-line-warning btn",
792 792
 						"fa fa-plus-circle fa-lg",
@@ -802,33 +802,33 @@  discard block
 block discarded – undo
802 802
 	function opensips_customer_build_opensips_list($accountid) {
803 803
 		// echo $accountid;
804 804
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
805
-		$grid_field_arr = json_encode ( array (
806
-				array (
807
-						gettext ( "Username" ),
805
+		$grid_field_arr = json_encode(array(
806
+				array(
807
+						gettext("Username"),
808 808
 						"200",
809 809
 						"username",
810 810
 						"",
811 811
 						"",
812 812
 						"" 
813 813
 				),
814
-				array (
815
-						gettext ( "Password" ),
814
+				array(
815
+						gettext("Password"),
816 816
 						"200",
817 817
 						"password",
818 818
 						"",
819 819
 						"",
820 820
 						"" 
821 821
 				),
822
-				array (
823
-						gettext ( "Domain" ),
822
+				array(
823
+						gettext("Domain"),
824 824
 						"200",
825 825
 						"domain",
826 826
 						"",
827 827
 						"",
828 828
 						"" 
829 829
 				),
830
-				array (
831
-						gettext ( "Caller Name" ),
830
+				array(
831
+						gettext("Caller Name"),
832 832
 						"150",
833 833
 						"effective_caller_id_name",
834 834
 						"",
@@ -838,8 +838,8 @@  discard block
 block discarded – undo
838 838
 						"true",
839 839
 						"center" 
840 840
 				),
841
-				array (
842
-						gettext ( "Caller Number" ),
841
+				array(
842
+						gettext("Caller Number"),
843 843
 						"150",
844 844
 						"effective_caller_id_number",
845 845
 						"",
@@ -849,24 +849,24 @@  discard block
 block discarded – undo
849 849
 						"true",
850 850
 						"center" 
851 851
 				),
852
-				array (
853
-						gettext ( "Action" ),
852
+				array(
853
+						gettext("Action"),
854 854
 						"100",
855 855
 						"",
856 856
 						"",
857 857
 						"",
858
-						array (
859
-								"EDIT" => array (
860
-										"url" => 'accounts/customer_opensips_action/edit/' . $accountid . '/',
858
+						array(
859
+								"EDIT" => array(
860
+										"url" => 'accounts/customer_opensips_action/edit/'.$accountid.'/',
861 861
 										"mode" => "popup" 
862 862
 								),
863
-								"DELETE" => array (
864
-										"url" => 'accounts/customer_opensips_action/delete/' . $accountid . "/",
863
+								"DELETE" => array(
864
+										"url" => 'accounts/customer_opensips_action/delete/'.$accountid."/",
865 865
 										"mode" => "popup" 
866 866
 								) 
867 867
 						) 
868 868
 				) 
869
-		) );
869
+		));
870 870
 		
871 871
 		return $grid_field_arr;
872 872
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@
 block discarded – undo
20 20
 // You should have received a copy of the GNU Affero General Public License
21 21
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 22
 // ##############################################################################
23
-if (! defined ( 'BASEPATH' ))
23
+if (! defined ( 'BASEPATH' )) {
24 24
 	exit ( 'No direct script access allowed' );
25
+}
25 26
 class Opensips_form {
26 27
 	function __construct() {
27 28
 		$this->CI = & get_instance ();
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/models/signup_model.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -23,74 +23,74 @@
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class Signup_model extends CI_Model {
25 25
 	function Signup_model() {
26
-		parent::__construct ();
26
+		parent::__construct();
27 27
 		
28
-		$this->load->model ( 'Astpp_common' );
29
-		$this->load->helper ( 'form' );
30
-		$this->load->model ( 'common_model' );
31
-		$this->load->library ( 'session' );
28
+		$this->load->model('Astpp_common');
29
+		$this->load->helper('form');
30
+		$this->load->model('common_model');
31
+		$this->load->library('session');
32 32
 	}
33 33
 	function get_rate() {
34
-		$data = array ();
35
-		$this->load->database ();
34
+		$data = array();
35
+		$this->load->database();
36 36
 		
37
-		$this->db->select ( "id,name" );
38
-		$this->db->from ( 'pricelists' );
39
-		$this->db->where ( "status", "0" );
40
-		$query = $this->db->get ();
41
-		return $query->row ();
37
+		$this->db->select("id,name");
38
+		$this->db->from('pricelists');
39
+		$this->db->where("status", "0");
40
+		$query = $this->db->get();
41
+		return $query->row();
42 42
 	}
43 43
 	function add_user($data) {
44 44
 		$data ['reseller_id'] = $data ['key_unique'];
45
-		unset ( $data ['agreeCheck'] );
46
-		unset ( $data ['key_unique'] );
47
-		$data ['creation'] = gmdate ( 'Y-m-d H:i:s' );
48
-		$data ['expiry'] = date ( 'Y-m-d H:i:s', strtotime ( '+10 years' ) );
49
-		$this->db->insert ( "accounts", $data );
50
-		return $this->db->insert_id ();
45
+		unset ($data ['agreeCheck']);
46
+		unset ($data ['key_unique']);
47
+		$data ['creation'] = gmdate('Y-m-d H:i:s');
48
+		$data ['expiry'] = date('Y-m-d H:i:s', strtotime('+10 years'));
49
+		$this->db->insert("accounts", $data);
50
+		return $this->db->insert_id();
51 51
 	}
52 52
 	function check_user($accno, $email, $balance) {
53
-		$info = array (
53
+		$info = array(
54 54
 				"number" => $accno,
55 55
 				"email" => $email,
56 56
 				"status" => 1 
57 57
 		);
58
-		$this->db->where ( $info );
59
-		$this->db->select ( '*' );
60
-		$acc_res = $this->db->get ( 'accounts' );
61
-		if ($acc_res->num_rows () > 0) {
62
-			$acc_res = $acc_res->result_array ();
58
+		$this->db->where($info);
59
+		$this->db->select('*');
60
+		$acc_res = $this->db->get('accounts');
61
+		if ($acc_res->num_rows() > 0) {
62
+			$acc_res = $acc_res->result_array();
63 63
 			$acc_res = $acc_res [0];
64
-			$this->db->where ( 'pricelist_id', $acc_res ['pricelist_id'] );
65
-			$this->db->select ( "*" );
66
-			$charge_res = $this->db->get ( 'charges' );
64
+			$this->db->where('pricelist_id', $acc_res ['pricelist_id']);
65
+			$this->db->select("*");
66
+			$charge_res = $this->db->get('charges');
67 67
 			
68
-			if ($charge_res->num_rows () > 0) {
69
-				$charge_res = $charge_res->result_array ();
68
+			if ($charge_res->num_rows() > 0) {
69
+				$charge_res = $charge_res->result_array();
70 70
 				$charge_res = $charge_res [0];
71
-				$charge_acc_arr = array (
71
+				$charge_acc_arr = array(
72 72
 						"charge_id" => $charge_res ['id'],
73 73
 						"accountid" => $acc_res ['id'],
74 74
 						"status" => 0,
75
-						"assign_date" => date ( 'Y-m-d H:i:s' ) 
75
+						"assign_date" => date('Y-m-d H:i:s') 
76 76
 				);
77 77
 			} else {
78
-				$charge_res = $charge_res->result_array ();
78
+				$charge_res = $charge_res->result_array();
79 79
 				// echo "<pre>"; print_r($charge_res); exit;
80
-				$charge_acc_arr = array (
80
+				$charge_acc_arr = array(
81 81
 						"charge_id" => 'id',
82 82
 						"accountid" => $acc_res ['id'],
83
-						"assign_date" => date ( 'Y-m-d H:i:s' ) 
83
+						"assign_date" => date('Y-m-d H:i:s') 
84 84
 				);
85 85
 			}
86
-			$result = $this->db->insert ( "charge_to_account", $charge_acc_arr );
87
-			$update = array (
86
+			$result = $this->db->insert("charge_to_account", $charge_acc_arr);
87
+			$update = array(
88 88
 					"status" => 0,
89 89
 					"balance" => $balance 
90 90
 			);
91
-			$this->db->where ( $info );
92
-			$result = $this->db->update ( 'accounts', $update );
93
-			$sip_device_update = array (
91
+			$this->db->where($info);
92
+			$result = $this->db->update('accounts', $update);
93
+			$sip_device_update = array(
94 94
 					'username' => $accno,
95 95
 					"status" => 1 
96 96
 			);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/controllers/signup.php 1 patch
Spacing   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -23,49 +23,49 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class Signup extends MX_Controller {
25 25
 	function signup() {
26
-		parent::__construct ();
27
-		$this->load->model ( 'signup_model' );
28
-		$this->load->helper ( 'captcha' );
29
-		$this->load->helper ( 'template_inheritance' );
26
+		parent::__construct();
27
+		$this->load->model('signup_model');
28
+		$this->load->helper('captcha');
29
+		$this->load->helper('template_inheritance');
30 30
 		// $this->load->library('form_validation');
31
-		$this->load->library ( 'astpp/common' );
32
-		$this->load->library ( 'astpp/email_lib' );
33
-		$this->load->model ( 'db_model' );
34
-		$this->load->model ( 'common_model' );
35
-		$this->load->library ( 'session' );
36
-		$this->load->library ( 'encrypt' );
37
-		$this->load->model ( 'Astpp_common' );
31
+		$this->load->library('astpp/common');
32
+		$this->load->library('astpp/email_lib');
33
+		$this->load->model('db_model');
34
+		$this->load->model('common_model');
35
+		$this->load->library('session');
36
+		$this->load->library('encrypt');
37
+		$this->load->model('Astpp_common');
38 38
 		
39
-		error_reporting ( - 1 );
40
-		ini_set ( 'display_errors', 'On' );
39
+		error_reporting( -1 );
40
+		ini_set('display_errors', 'On');
41 41
 		
42
-		$data ['row'] = $this->signup_model->get_rate ();
42
+		$data ['row'] = $this->signup_model->get_rate();
43 43
 	}
44 44
 	function index($key = "") {
45 45
 		if (Common_model::$global_config ['system_config'] ['enable_signup'] == 1) {
46
-			redirect ( base_url () );
46
+			redirect(base_url());
47 47
 		}
48 48
 		
49
-		$userCaptcha = $this->input->post ( 'userCaptcha' );
50
-		$random_number = substr ( number_format ( time () * rand (), 0, '', '' ), 0, 6 );
51
-		$accountinfo = ( array ) $this->db->get_where ( 'accounts', array (
52
-				'type' => - 1 
53
-		) )->first_row ();
54
-		$data ['timezone_id'] = (! $accountinfo ['timezone_id']) ? 1 : $accountinfo ['timezone_id'];
55
-		$data ['currency_id'] = (! $accountinfo ['currency_id']) ? 1 : $accountinfo ['currency_id'];
56
-		$data ['country_id'] = (! $accountinfo ['country_id']) ? 1 : $accountinfo ['country_id'];
49
+		$userCaptcha = $this->input->post('userCaptcha');
50
+		$random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6);
51
+		$accountinfo = (array)$this->db->get_where('accounts', array(
52
+				'type' => -1 
53
+		))->first_row();
54
+		$data ['timezone_id'] = ( ! $accountinfo ['timezone_id']) ? 1 : $accountinfo ['timezone_id'];
55
+		$data ['currency_id'] = ( ! $accountinfo ['currency_id']) ? 1 : $accountinfo ['currency_id'];
56
+		$data ['country_id'] = ( ! $accountinfo ['country_id']) ? 1 : $accountinfo ['country_id'];
57 57
 		
58
-		$vals = array (
58
+		$vals = array(
59 59
 				'word' => $random_number,
60
-				'img_path' => getcwd () . '/assets/captcha/',
61
-				'img_url' => base_url () . 'assets/captcha/',
60
+				'img_path' => getcwd().'/assets/captcha/',
61
+				'img_url' => base_url().'assets/captcha/',
62 62
 				// 'font_path' => './fonts/impact.ttf',
63 63
 				'img_width' => '243',
64 64
 				'img_height' => '50',
65 65
 				'expiration' => '3600' 
66 66
 		);
67 67
 		
68
-		if (isset ( $key ) && $key != '') {
68
+		if (isset ($key) && $key != '') {
69 69
 			$data ['key_unique'] = $key;
70 70
 		} else {
71 71
 			$data ['key_unique'] = "admin";
@@ -73,122 +73,122 @@  discard block
 block discarded – undo
73 73
 		$unique = $data ['key_unique'];
74 74
 		
75 75
 		if ($unique != "admin") {
76
-			$unique = $this->common->decode_params ( trim ( $unique ) );
77
-			$decoded_str = $this->common->decode ( $unique );
76
+			$unique = $this->common->decode_params(trim($unique));
77
+			$decoded_str = $this->common->decode($unique);
78 78
 			$unique = $decoded_str;
79
-			$query = $this->db_model->getSelect ( "*", 'accounts', array (
79
+			$query = $this->db_model->getSelect("*", 'accounts', array(
80 80
 					'id' => $unique,
81 81
 					"deleted" => "0" 
82
-			) );
83
-			if ($query->num_rows () == 0) {
84
-				redirect ( base_url () . "signup/signup_inactive" );
82
+			));
83
+			if ($query->num_rows() == 0) {
84
+				redirect(base_url()."signup/signup_inactive");
85 85
 			}
86
-			if ($query->num_rows () > 0) {
87
-				$query = $query->result_array ();
86
+			if ($query->num_rows() > 0) {
87
+				$query = $query->result_array();
88 88
 				$query = $query [0];
89 89
 				
90 90
 				if ($query ['status'] != 0) {
91
-					redirect ( base_url () . "signup/signup_inactive" );
91
+					redirect(base_url()."signup/signup_inactive");
92 92
 				}
93 93
 			}
94 94
 		}
95
-		$data ['captcha'] = create_captcha ( $vals );
96
-		$this->session->set_userdata ( 'captchaWord', $data ['captcha'] ['word'] );
97
-		$this->db->select ( "*" );
98
-		$this->db->where ( array (
95
+		$data ['captcha'] = create_captcha($vals);
96
+		$this->session->set_userdata('captchaWord', $data ['captcha'] ['word']);
97
+		$this->db->select("*");
98
+		$this->db->where(array(
99 99
 				"domain" => $_SERVER ["HTTP_HOST"] 
100
-		) );
101
-		$res = $this->db->get ( "invoice_conf" );
102
-		$logo_arr = $res->result ();
100
+		));
101
+		$res = $this->db->get("invoice_conf");
102
+		$logo_arr = $res->result();
103 103
 		// ~ echo "<pre>"; print_r($_SERVER); exit;
104
-		$data ['user_logo'] = (isset ( $logo_arr [0]->logo ) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid . "_" . $logo_arr [0]->logo : "logo.png";
105
-		$data ['website_header'] = (isset ( $logo_arr [0]->website_title ) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution";
106
-		$data ['website_footer'] = (isset ( $logo_arr [0]->website_footer ) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
107
-		$this->session->set_userdata ( 'user_logo', $data ['user_logo'] );
108
-		$this->session->set_userdata ( 'user_header', $data ['website_header'] );
109
-		$this->session->set_userdata ( 'user_footer', $data ['website_footer'] );
110
-		$this->load->view ( 'view_signup', $data );
104
+		$data ['user_logo'] = (isset ($logo_arr [0]->logo) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->logo : "logo.png";
105
+		$data ['website_header'] = (isset ($logo_arr [0]->website_title) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution";
106
+		$data ['website_footer'] = (isset ($logo_arr [0]->website_footer) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
107
+		$this->session->set_userdata('user_logo', $data ['user_logo']);
108
+		$this->session->set_userdata('user_header', $data ['website_header']);
109
+		$this->session->set_userdata('user_footer', $data ['website_footer']);
110
+		$this->load->view('view_signup', $data);
111 111
 	}
112 112
 	public function check_captcha($str) {
113
-		$word = $this->session->userdata ( 'captchaWord' );
114
-		if (strcmp ( strtoupper ( $str ), strtoupper ( $word ) ) == 0) {
113
+		$word = $this->session->userdata('captchaWord');
114
+		if (strcmp(strtoupper($str), strtoupper($word)) == 0) {
115 115
 			return true;
116 116
 		} else {
117
-			$this->form_validation->set_message ( 'check_captcha', 'Please enter correct words!' );
117
+			$this->form_validation->set_message('check_captcha', 'Please enter correct words!');
118 118
 			return false;
119 119
 		}
120 120
 	}
121 121
 	function terms_check() {
122
-		if (isset ( $_POST ['agreeCheck'] )) {
122
+		if (isset ($_POST ['agreeCheck'])) {
123 123
 			return true;
124 124
 		}
125
-		$this->form_validation->set_message ( 'terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!' );
125
+		$this->form_validation->set_message('terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!');
126 126
 		return false;
127 127
 	}
128 128
 	function signup_save($id = "") {
129
-		if (empty ( $_POST )) {
130
-			redirect ( base_url () . "signup/" );
129
+		if (empty ($_POST)) {
130
+			redirect(base_url()."signup/");
131 131
 		} else {
132
-			$post_values = $this->input->post ();
133
-			$userCaptcha = $this->input->post ( 'userCaptcha' );
134
-			$cnt_result = $this->db_model->countQuery ( "*", 'accounts', array (
132
+			$post_values = $this->input->post();
133
+			$userCaptcha = $this->input->post('userCaptcha');
134
+			$cnt_result = $this->db_model->countQuery("*", 'accounts', array(
135 135
 					'email' => $post_values ['email'],
136 136
 					'deleted' => 0 
137
-			) );
137
+			));
138 138
 			
139
-			if ($userCaptcha != $this->session->userdata ( 'captchaWord' ) || ! filter_var ( $this->input->post ( 'email' ), FILTER_VALIDATE_EMAIL ) || $cnt_result > 0) {
140
-				if (! filter_var ( $this->input->post ( 'email' ), FILTER_VALIDATE_EMAIL )) {
139
+			if ($userCaptcha != $this->session->userdata('captchaWord') || ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL) || $cnt_result > 0) {
140
+				if ( ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL)) {
141 141
 					$data ['error'] ['email'] = "<div style='color: red;'> Please enter proper email </div>";
142 142
 				}
143
-				if ($userCaptcha != $this->session->userdata ( 'captchaWord' )) {
143
+				if ($userCaptcha != $this->session->userdata('captchaWord')) {
144 144
 					$data ['error'] ['userCaptcha'] = "<div id='capcha_error' style='color: red;'>Please enter valid Captcha code</div>";
145 145
 				}
146 146
 				if ($cnt_result > 0) {
147 147
 					$data ['error'] ['email'] = "<div id= 'email_error' style='color: red;'>Email Address already exists</div>";
148 148
 				}
149
-				$random_number = substr ( number_format ( time () * rand (), 0, '', '' ), 0, 6 );
150
-				$vals = array (
149
+				$random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6);
150
+				$vals = array(
151 151
 						'word' => $random_number,
152
-						'img_path' => getcwd () . '/assets/captcha/',
153
-						'img_url' => base_url () . 'assets/captcha/',
152
+						'img_path' => getcwd().'/assets/captcha/',
153
+						'img_url' => base_url().'assets/captcha/',
154 154
 						// 'font_path' => './fonts/impact.ttf',
155 155
 						'img_width' => '243',
156 156
 						'img_height' => '50',
157 157
 						'expiration' => '3600' 
158 158
 				);
159 159
 				// echo "<pre>"; print_r($_POST); exit;
160
-				if (isset ( $_POST ['key_unique'] ) && $_POST ['key_unique'] == "admin") {
160
+				if (isset ($_POST ['key_unique']) && $_POST ['key_unique'] == "admin") {
161 161
 					$data ['key_unique'] = $_POST ['key_unique'];
162 162
 				}
163 163
 				
164
-				$accountinfo = ( array ) $this->db->get_where ( 'accounts', array (
165
-						'type' => - 1 
166
-				) )->first_row ();
167
-				$data ['timezone_id'] = (! $accountinfo ['timezone_id']) ? 1 : $accountinfo ['timezone_id'];
168
-				$data ['currency_id'] = (! $accountinfo ['currency_id']) ? 1 : $accountinfo ['currency_id'];
169
-				$data ['country_id'] = (! $accountinfo ['country_id']) ? 1 : $accountinfo ['country_id'];
164
+				$accountinfo = (array)$this->db->get_where('accounts', array(
165
+						'type' => -1 
166
+				))->first_row();
167
+				$data ['timezone_id'] = ( ! $accountinfo ['timezone_id']) ? 1 : $accountinfo ['timezone_id'];
168
+				$data ['currency_id'] = ( ! $accountinfo ['currency_id']) ? 1 : $accountinfo ['currency_id'];
169
+				$data ['country_id'] = ( ! $accountinfo ['country_id']) ? 1 : $accountinfo ['country_id'];
170 170
 				
171
-				$data ['timezone_id'] = (! $data ['timezone_id']) ? 1 : $data ['timezone_id'];
172
-				$data ['currency_id'] = (! $data ['currency_id']) ? 1 : $data ['currency_id'];
173
-				$data ['country_id'] = (! $data ['country_id']) ? 1 : $data ['country_id'];
171
+				$data ['timezone_id'] = ( ! $data ['timezone_id']) ? 1 : $data ['timezone_id'];
172
+				$data ['currency_id'] = ( ! $data ['currency_id']) ? 1 : $data ['currency_id'];
173
+				$data ['country_id'] = ( ! $data ['country_id']) ? 1 : $data ['country_id'];
174 174
 				
175 175
 				$data ['value'] = $post_values;
176
-				$data ['captcha'] = create_captcha ( $vals );
176
+				$data ['captcha'] = create_captcha($vals);
177 177
 				
178
-				$this->session->set_userdata ( 'captchaWord', $data ['captcha'] ['word'] );
178
+				$this->session->set_userdata('captchaWord', $data ['captcha'] ['word']);
179 179
 				$data ['key_unique'] = $_POST ['key_unique'];
180
-				$this->load->view ( 'view_signup', $data );
180
+				$this->load->view('view_signup', $data);
181 181
 			} else {
182 182
 				// AVTLATP
183
-				$user_data = $this->input->post ();
183
+				$user_data = $this->input->post();
184 184
 				
185
-				if (! isset ( $_POST ['key_unique'] ) || ! isset ( $_POST ['email'] )) {
186
-					redirect ( base_url () . "signup/" );
185
+				if ( ! isset ($_POST ['key_unique']) || ! isset ($_POST ['email'])) {
186
+					redirect(base_url()."signup/");
187 187
 				}
188 188
 				$reseller_id = 0;
189
-				if (isset ( $_POST ['key_unique'] ) && $_POST ['key_unique'] != "admin") {
190
-					$_POST ['key_unique'] = $this->common->decode_params ( trim ( $_POST ['key_unique'] ) );
191
-					$decoded_str = $this->common->decode ( $_POST ['key_unique'] );
189
+				if (isset ($_POST ['key_unique']) && $_POST ['key_unique'] != "admin") {
190
+					$_POST ['key_unique'] = $this->common->decode_params(trim($_POST ['key_unique']));
191
+					$decoded_str = $this->common->decode($_POST ['key_unique']);
192 192
 					$_POST ['key_unique'] = $decoded_str;
193 193
 					$user_data ['key_unique'] = $_POST ['key_unique'];
194 194
 					$reseller_id = $user_data ['key_unique'];
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 				// AVTLATP
198 198
 				// Data want to insert or update
199 199
 				$user_data ['status'] = "1";
200
-				$user_data ['number'] = $this->common->find_uniq_rendno_customer ( common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts' );
200
+				$user_data ['number'] = $this->common->find_uniq_rendno_customer(common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts');
201 201
 				
202
-				$user_data ['password'] = $this->common->encode ( $this->common->generate_password () );
203
-				$user_data ['pin'] = $this->common->generate_password ();
202
+				$user_data ['password'] = $this->common->encode($this->common->generate_password());
203
+				$user_data ['pin'] = $this->common->generate_password();
204 204
 				$user_data ['reseller_id'] = $reseller_id;
205 205
 				$user_data ['posttoexternal'] = "0";
206 206
 				
207
-				unset ( $user_data ['userCaptcha'] );
208
-				unset ( $user_data ['action'] );
207
+				unset ($user_data ['userCaptcha']);
208
+				unset ($user_data ['action']);
209 209
 				
210 210
 				$system_config = common_model::$global_config ['system_config'];
211 211
 				$balance = $system_config ["balance"];
@@ -222,16 +222,16 @@  discard block
 block discarded – undo
222 222
 				$selection_rategroup_signup = $system_config ["default_signup_rategroup"];
223 223
 				
224 224
 				if ($reseller_id != 0) {
225
-					$result = $this->db_model->getSelect ( "*", "pricelists", array (
225
+					$result = $this->db_model->getSelect("*", "pricelists", array(
226 226
 							"reseller_id" => $reseller_id 
227
-					), "ASC" );
228
-					$result_arr = $result->result_array ();
227
+					), "ASC");
228
+					$result_arr = $result->result_array();
229 229
 					$selection_rategroup_signup = $result_arr [0] ['id'];
230
-					$user_data ['pricelist_id'] = (isset ( $selection_rategroup_signup ) && $selection_rategroup_signup > 0) ? $selection_rategroup_signup : 0;
230
+					$user_data ['pricelist_id'] = (isset ($selection_rategroup_signup) && $selection_rategroup_signup > 0) ? $selection_rategroup_signup : 0;
231 231
 				} else {
232
-					$pricelist_id = $this->common->get_field_name ( 'id', 'pricelists', array (
232
+					$pricelist_id = $this->common->get_field_name('id', 'pricelists', array(
233 233
 							'name' => $selection_rategroup_signup 
234
-					) );
234
+					));
235 235
 					/*
236 236
 					 * if($pricelis_id != "")
237 237
 					 * $user_data['pricelist_id'] = $pricelis_id;
@@ -244,21 +244,21 @@  discard block
 block discarded – undo
244 244
 				// Insert or Update record
245 245
 				$signup_sipdevice_flag = $system_config ['create_sipdevice'];
246 246
 				$user_data ['is_recording'] = 1;
247
-				$last_id = $this->signup_model->add_user ( $user_data );
247
+				$last_id = $this->signup_model->add_user($user_data);
248 248
 				if ($last_id == "") {
249
-					redirect ( base_url () . "signup/signup_inactive" );
249
+					redirect(base_url()."signup/signup_inactive");
250 250
 				}
251 251
 				if ($signup_sipdevice_flag == '0') {
252
-					$query = $this->db_model->select ( "*", "sip_profiles", array (
252
+					$query = $this->db_model->select("*", "sip_profiles", array(
253 253
 							'name' => "default" 
254
-					), "id", "ASC", '1', '0' );
255
-					$sip_id = $query->result_array ();
254
+					), "id", "ASC", '1', '0');
255
+					$sip_id = $query->result_array();
256 256
 					if ($reseller_id > 0) {
257 257
 						$reseller_id = $reseller_id;
258 258
 					} else {
259 259
 						$reseller_id = '0';
260 260
 					}
261
-					$free_switch_array = array (
261
+					$free_switch_array = array(
262 262
 							'fs_username' => $user_data ['number'],
263 263
 							'fs_password' => $user_data ['password'],
264 264
 							'context' => 'default',
@@ -276,204 +276,204 @@  discard block
 block discarded – undo
276 276
 							'vm_keep_local_after_email' => true,
277 277
 							'vm_send_all_message' => true 
278 278
 					);
279
-					$user_custom_array = array_merge ( $user_data, $free_switch_array );
279
+					$user_custom_array = array_merge($user_data, $free_switch_array);
280 280
 					$user_custom_array ['id'] = $last_id;
281 281
 					$user_custom_array ['email'] = $user_data ['email'];
282 282
 					
283
-					$this->load->model ( 'freeswitch/freeswitch_model' );
284
-					$this->freeswitch_model->add_freeswith ( $user_custom_array );
283
+					$this->load->model('freeswitch/freeswitch_model');
284
+					$this->freeswitch_model->add_freeswith($user_custom_array);
285 285
 				}
286 286
 				// echo "<pre>"; print_r ($user_data); exit;
287
-				$activation = $this->encrypt->encode ( $user_data ['number'] );
288
-				$message = base_url () . 'signup/signup_confirm?email=' . urlencode ( $user_data ['email'] ) . "&key=" . urlencode ( $activation );
287
+				$activation = $this->encrypt->encode($user_data ['number']);
288
+				$message = base_url().'signup/signup_confirm?email='.urlencode($user_data ['email'])."&key=".urlencode($activation);
289 289
 				$user_data ['confirm'] = $message;
290 290
 				
291
-				$this->send_mail ( $last_id, 'email_signup_confirmation', $user_data );
292
-				redirect ( base_url () . "signup/signup_success" );
291
+				$this->send_mail($last_id, 'email_signup_confirmation', $user_data);
292
+				redirect(base_url()."signup/signup_success");
293 293
 			}
294 294
 		}
295 295
 	}
296 296
 	function signup_confirm() {
297
-		if (! empty ( $_GET )) {
297
+		if ( ! empty ($_GET)) {
298 298
 			
299 299
 			$system_config = common_model::$global_config ['system_config'];
300 300
 			$balance = $system_config ["balance"];
301
-			$accno = $this->encrypt->decode ( $_GET ['key'] );
301
+			$accno = $this->encrypt->decode($_GET ['key']);
302 302
 			$email = $_GET ['email'];
303
-			$success = $this->signup_model->check_user ( $accno, $email, $balance );
304
-			$query = $this->db_model->getSelect ( "*", "accounts", array (
303
+			$success = $this->signup_model->check_user($accno, $email, $balance);
304
+			$query = $this->db_model->getSelect("*", "accounts", array(
305 305
 					'number' => $accno 
306
-			) );
307
-			$data = $query->result_array ();
306
+			));
307
+			$data = $query->result_array();
308 308
 			$user_data = $data [0];
309 309
 			$user_data ['accountid'] = $user_data ['id'];
310 310
 			$user_data ['success'] = $success;
311 311
 			$user_data ['balance'] = $balance;
312
-			$user_data ['confirm'] = base_url ();
313
-			$this->active ( $user_data, $success );
312
+			$user_data ['confirm'] = base_url();
313
+			$this->active($user_data, $success);
314 314
 		} else {
315
-			redirect ( base_url () );
315
+			redirect(base_url());
316 316
 		}
317 317
 	}
318 318
 	function signup_success() {
319
-		$this->load->view ( 'view_signup_success' );
319
+		$this->load->view('view_signup_success');
320 320
 	}
321 321
 	function signup_inactive() {
322
-		$this->load->view ( 'view_signup_inactive' );
322
+		$this->load->view('view_signup_inactive');
323 323
 	}
324 324
 	function active($user_data, $success) {
325 325
 		$data ['user_data'] = $user_data;
326 326
 		$data ['user_data'] ['success'] = $success;
327 327
 		
328 328
 		if ($user_data ['success']) {
329
-			$user_data ['password'] = $this->common->decode ( $user_data ['password'] );
330
-			$this->send_mail ( $user_data ['id'], 'email_add_user', $user_data );
329
+			$user_data ['password'] = $this->common->decode($user_data ['password']);
330
+			$this->send_mail($user_data ['id'], 'email_add_user', $user_data);
331 331
 		}
332
-		$this->load->view ( 'view_signup_active', $data );
332
+		$this->load->view('view_signup_active', $data);
333 333
 	}
334 334
 	function forgotpassword() {
335
-		$this->load->view ( 'view_forgotpassword' );
335
+		$this->load->view('view_forgotpassword');
336 336
 	}
337 337
 	function confirmpassword() {
338 338
 		$email = $_POST ['email'];
339
-		unset ( $_POST ['action'] );
340
-		$where = array (
339
+		unset ($_POST ['action']);
340
+		$where = array(
341 341
 				'email' => $email 
342 342
 		);
343
-		$this->db->where ( $where );
344
-		$this->db->or_where ( 'number', $email );
345
-		$cnt_result = $this->db_model->countQuery ( "*", 'accounts', "" );
346
-		if (! empty ( $email )) {
347
-			$names = array (
343
+		$this->db->where($where);
344
+		$this->db->or_where('number', $email);
345
+		$cnt_result = $this->db_model->countQuery("*", 'accounts', "");
346
+		if ( ! empty ($email)) {
347
+			$names = array(
348 348
 					'0',
349 349
 					'1',
350 350
 					'3' 
351 351
 			);
352
-			$this->db->where_in ( 'type', $names );
353
-			$where_arr = array (
352
+			$this->db->where_in('type', $names);
353
+			$where_arr = array(
354 354
 					"email" => $email 
355 355
 			);
356
-			$this->db->where ( $where_arr );
357
-			$this->db->or_where ( 'number', $email );
358
-			$acountdata = $this->db_model->getSelect ( "*", "accounts", "" );
359
-			if ($acountdata->num_rows () > 0) {
360
-				$user_data = $acountdata->result_array ();
356
+			$this->db->where($where_arr);
357
+			$this->db->or_where('number', $email);
358
+			$acountdata = $this->db_model->getSelect("*", "accounts", "");
359
+			if ($acountdata->num_rows() > 0) {
360
+				$user_data = $acountdata->result_array();
361 361
 				$user_data = $user_data [0];
362 362
 				if ($user_data ['deleted'] == 1) {
363 363
 					$data ['error'] ['email'] = "<div id='error_mail' style='color:red; margin: 1% 22%; float: left;'>Your account has been deleted. Please contact administrator for more information</div>";
364
-					$this->load->view ( 'view_forgotpassword', $data );
364
+					$this->load->view('view_forgotpassword', $data);
365 365
 					exit ();
366 366
 				}
367 367
 				if ($user_data ['status'] > 0) {
368 368
 					$data ['error'] ['email'] = "<div id='error_mail' style='color:red; margin: 1% 22%; float: left;'>Your account is inactive. Please contact administrator for more information</div>";
369
-					$this->load->view ( 'view_forgotpassword', $data );
369
+					$this->load->view('view_forgotpassword', $data);
370 370
 					exit ();
371 371
 				}
372 372
 			}
373
-			if ($acountdata->num_rows () == 0 && ! filter_var ( $email, FILTER_VALIDATE_EMAIL )) {
374
-				if (! filter_var ( $email, FILTER_VALIDATE_EMAIL )) {
373
+			if ($acountdata->num_rows() == 0 && ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
374
+				if ( ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
375 375
 					$data ['error'] ['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>";
376 376
 					
377
-					$this->load->view ( 'view_forgotpassword', $data );
377
+					$this->load->view('view_forgotpassword', $data);
378 378
 				} else {
379 379
 					$data ['error'] ['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left;width:100%;'>This Username or Email is not valid</div>";
380 380
 					
381
-					$this->load->view ( 'view_forgotpassword', $data );
381
+					$this->load->view('view_forgotpassword', $data);
382 382
 				}
383
-			} else if ($acountdata->num_rows () == 0) {
383
+			} else if ($acountdata->num_rows() == 0) {
384 384
 				$data ['error'] ['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>";
385
-				$this->load->view ( 'view_forgotpassword', $data );
385
+				$this->load->view('view_forgotpassword', $data);
386 386
 			} else {
387
-				$acountdata = $acountdata->result_array ();
387
+				$acountdata = $acountdata->result_array();
388 388
 				$user_data = $acountdata [0];
389 389
 				
390
-				$email = $this->encrypt->encode ( $user_data ['email'] );
391
-				$activation = $this->encrypt->encode ( $user_data ['number'] );
392
-				$message = base_url () . 'confirm_pass?email=' . urlencode ( $email ) . "&key=" . urlencode ( $activation );
390
+				$email = $this->encrypt->encode($user_data ['email']);
391
+				$activation = $this->encrypt->encode($user_data ['number']);
392
+				$message = base_url().'confirm_pass?email='.urlencode($email)."&key=".urlencode($activation);
393 393
 				$user_data ['confirm'] = $message;
394
-				$where = array (
394
+				$where = array(
395 395
 						"email" => $user_data ['email'] 
396 396
 				);
397
-				$data = array (
397
+				$data = array(
398 398
 						"pass_link_status" => 1 
399 399
 				);
400
-				$this->db->where ( $where );
401
-				$this->db->update ( 'accounts', $data );
400
+				$this->db->where($where);
401
+				$this->db->update('accounts', $data);
402 402
 				$system_config = common_model::$global_config ['system_config'];
403 403
 				$balance = $system_config ["balance"];
404
-				$this->send_mail ( $user_data ['id'], 'email_forgot_confirmation', $user_data );
405
-				$this->load->view ( 'view_forgot_success' );
404
+				$this->send_mail($user_data ['id'], 'email_forgot_confirmation', $user_data);
405
+				$this->load->view('view_forgot_success');
406 406
 			}
407 407
 		} else {
408
-			redirect ( base_url () );
408
+			redirect(base_url());
409 409
 		}
410 410
 	}
411 411
 	function confirm_pass() {
412 412
 		$confirm_pass = $_GET;
413 413
 		$accno = '';
414 414
 		$balance = '';
415
-		$email1 = $this->encrypt->decode ( $confirm_pass ['email'] );
416
-		$success = $this->signup_model->check_user ( $accno, $email1, $balance );
417
-		if (! empty ( $confirm_pass )) {
418
-			$where_arr = array (
415
+		$email1 = $this->encrypt->decode($confirm_pass ['email']);
416
+		$success = $this->signup_model->check_user($accno, $email1, $balance);
417
+		if ( ! empty ($confirm_pass)) {
418
+			$where_arr = array(
419 419
 					"email" => $email1,
420 420
 					"status" => 0 
421 421
 			);
422
-			$acountdata = $this->db_model->getSelect ( "*", "accounts", $where_arr );
423
-			if ($acountdata->num_rows () > 0) {
424
-				$acountdata = $acountdata->result_array ();
422
+			$acountdata = $this->db_model->getSelect("*", "accounts", $where_arr);
423
+			if ($acountdata->num_rows() > 0) {
424
+				$acountdata = $acountdata->result_array();
425 425
 				$user_data = $acountdata [0];
426
-				$updateArr = array (
426
+				$updateArr = array(
427 427
 						"pass_link_status" => 0 
428 428
 				);
429
-				$this->db->where ( array (
429
+				$this->db->where(array(
430 430
 						"email" => $email1 
431
-				) );
432
-				$this->db->update ( "accounts", $updateArr );
431
+				));
432
+				$this->db->update("accounts", $updateArr);
433 433
 				if ($user_data ['pass_link_status'] == '0') {
434 434
 					$user_data ['success'] = $success;
435 435
 					$data ['user_data'] = $user_data;
436
-					$this->active ( $user_data, $success );
436
+					$this->active($user_data, $success);
437 437
 				} else {
438 438
 					$data ['email'] = $_GET ['email'];
439
-					$this->load->view ( 'view_confirmpassword', $data );
439
+					$this->load->view('view_confirmpassword', $data);
440 440
 				}
441 441
 			}
442 442
 		}
443 443
 	}
444 444
 	function confirmpass() {
445 445
 		$passwordconf = $_POST;
446
-		$email1 = $this->encrypt->decode ( $passwordconf ['email'] );
447
-		if (! empty ( $passwordconf )) {
448
-			$acountdata = $this->db_model->getSelect ( "*", "accounts", array (
446
+		$email1 = $this->encrypt->decode($passwordconf ['email']);
447
+		if ( ! empty ($passwordconf)) {
448
+			$acountdata = $this->db_model->getSelect("*", "accounts", array(
449 449
 					"email" => $email1 
450
-			) );
450
+			));
451 451
 			// echo $this->db->last_query();exit;
452
-			if ($acountdata->num_rows () > 0) {
453
-				$acountdata = $acountdata->result_array ();
452
+			if ($acountdata->num_rows() > 0) {
453
+				$acountdata = $acountdata->result_array();
454 454
 				$user_data = $acountdata [0];
455 455
 			}
456
-			$user_data ['password'] = $this->common->encode ( $passwordconf ['password'] );
457
-			$updateArr = array (
456
+			$user_data ['password'] = $this->common->encode($passwordconf ['password']);
457
+			$updateArr = array(
458 458
 					"password" => $user_data ['password'] 
459 459
 			);
460
-			$where_arr = array (
460
+			$where_arr = array(
461 461
 					"email" => $email1,
462 462
 					"status" => 0 
463 463
 			);
464
-			$this->db->where ( $where_arr );
465
-			$this->db->update ( "accounts", $updateArr );
464
+			$this->db->where($where_arr);
465
+			$this->db->update("accounts", $updateArr);
466 466
 			// $activation = $this->encrypt->encode($user_data['number']);
467
-			$message = base_url ();
467
+			$message = base_url();
468 468
 			$user_data ['confirm'] = $message;
469 469
 			$user_data ['password'] = $passwordconf ['password'];
470 470
 			
471 471
 			$system_config = common_model::$global_config ['system_config'];
472 472
 			$balance = $system_config ["balance"];
473 473
 			
474
-			$this->send_mail ( $user_data ['id'], 'email_forgot_user', $user_data );
474
+			$this->send_mail($user_data ['id'], 'email_forgot_user', $user_data);
475 475
 			
476
-			$this->successpassword ();
476
+			$this->successpassword();
477 477
 		}
478 478
 	}
479 479
 	
@@ -488,39 +488,39 @@  discard block
 block discarded – undo
488 488
 		// $command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail";
489 489
 		// exec($command);
490 490
 		
491
-		$where = array (
491
+		$where = array(
492 492
 				'name' => $temp_name 
493 493
 		);
494
-		$EmailTemplate = $this->db_model->getSelect ( "*", "default_templates", $where );
494
+		$EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where);
495 495
 		$reseller_id = ($user_data ['reseller_id'] > 0) ? $user_data ['reseller_id'] : 1;
496
-		$where = "accountid IN ('" . $reseller_id . "','1')";
497
-		$this->db->where ( $where );
498
-		$this->db->select ( '*' );
499
-		$this->db->order_by ( 'accountid', 'desc' );
500
-		$this->db->limit ( 1 );
501
-		$invoiceconf = $this->db->get ( 'invoice_conf' );
502
-		$invoiceconf = ( array ) $invoiceconf->first_row ();
496
+		$where = "accountid IN ('".$reseller_id."','1')";
497
+		$this->db->where($where);
498
+		$this->db->select('*');
499
+		$this->db->order_by('accountid', 'desc');
500
+		$this->db->limit(1);
501
+		$invoiceconf = $this->db->get('invoice_conf');
502
+		$invoiceconf = (array)$invoiceconf->first_row();
503 503
 		$company_email = $invoiceconf ['emailaddress'];
504 504
 		$company_website = $invoiceconf ["website"];
505 505
 		$company_name = $invoiceconf ["company_name"];
506 506
 		
507
-		$TemplateData = array ();
507
+		$TemplateData = array();
508 508
 		
509
-		foreach ( $EmailTemplate->result_array () as $value ) {
509
+		foreach ($EmailTemplate->result_array() as $value) {
510 510
 			$TemplateData = $value;
511
-			$message = str_replace ( "<p>", "", $TemplateData ['template'] );
512
-			$message = str_replace ( "</p>", "", $TemplateData ['template'] );
511
+			$message = str_replace("<p>", "", $TemplateData ['template']);
512
+			$message = str_replace("</p>", "", $TemplateData ['template']);
513 513
 			
514
-			$TemplateData ['subject'] = str_replace ( '#NAME#', $user_data ['first_name'] . " " . $user_data ['last_name'], $TemplateData ['subject'] );
515
-			$TemplateData ['template'] = str_replace ( '#NAME#', $user_data ['first_name'] . " " . $user_data ['last_name'], $TemplateData ['template'] );
516
-			$TemplateData ['template'] = str_replace ( '#NUMBER#', $user_data ['number'], $TemplateData ['template'] );
517
-			$TemplateData ['template'] = str_replace ( '#PASSWORD#', $user_data ['password'], $TemplateData ['template'] );
518
-			$TemplateData ['template'] = str_replace ( '#COMPANY_WEBSITE#', $company_website, $TemplateData ['template'] );
519
-			$TemplateData ['template'] = str_replace ( '#LINK#', $user_data ['confirm'], $TemplateData ['template'] );
520
-			$TemplateData ['template'] = str_replace ( '#COMPANY_EMAIL#', $company_email, $TemplateData ['template'] );
521
-			$TemplateData ['template'] = str_replace ( '#COMPANY_NAME#', $company_name, $TemplateData ['template'] );
514
+			$TemplateData ['subject'] = str_replace('#NAME#', $user_data ['first_name']." ".$user_data ['last_name'], $TemplateData ['subject']);
515
+			$TemplateData ['template'] = str_replace('#NAME#', $user_data ['first_name']." ".$user_data ['last_name'], $TemplateData ['template']);
516
+			$TemplateData ['template'] = str_replace('#NUMBER#', $user_data ['number'], $TemplateData ['template']);
517
+			$TemplateData ['template'] = str_replace('#PASSWORD#', $user_data ['password'], $TemplateData ['template']);
518
+			$TemplateData ['template'] = str_replace('#COMPANY_WEBSITE#', $company_website, $TemplateData ['template']);
519
+			$TemplateData ['template'] = str_replace('#LINK#', $user_data ['confirm'], $TemplateData ['template']);
520
+			$TemplateData ['template'] = str_replace('#COMPANY_EMAIL#', $company_email, $TemplateData ['template']);
521
+			$TemplateData ['template'] = str_replace('#COMPANY_NAME#', $company_name, $TemplateData ['template']);
522 522
 		}
523
-		$email_array = array (
523
+		$email_array = array(
524 524
 				'accountid' => $account_id,
525 525
 				'subject' => $TemplateData ['subject'],
526 526
 				'body' => $TemplateData ['template'],
@@ -531,11 +531,11 @@  discard block
 block discarded – undo
531 531
 				'template' => '' 
532 532
 		);
533 533
 		// echo "<pre>"; print_r($TemplateData); exit;
534
-		$this->db->insert ( "mail_details", $email_array );
534
+		$this->db->insert("mail_details", $email_array);
535 535
 		return true;
536 536
 	}
537 537
 	function successpassword() {
538
-		$this->load->view ( 'view_successpassword' );
538
+		$this->load->view('view_successpassword');
539 539
 	}
540 540
 }
541 541
 ?>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/models/ipmap_model.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -23,41 +23,41 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class IPMAP_model extends CI_Model {
25 25
 	function IPMAP_model() {
26
-		parent::__construct ();
26
+		parent::__construct();
27 27
 	}
28 28
 	function ipmap_list($flag, $start = 0, $limit = 0) {
29
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
30
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
31
-			$qry = $this->db_model->getselect ( 'id', 'accounts', array (
29
+		$accountinfo = $this->session->userdata('accountinfo');
30
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
31
+			$qry = $this->db_model->getselect('id', 'accounts', array(
32 32
 					'reseller_id' => $accountinfo ['id'] 
33
-			) );
34
-			$result = $qry->result_array ();
35
-			foreach ( $result as $value1 ) {
33
+			));
34
+			$result = $qry->result_array();
35
+			foreach ($result as $value1) {
36 36
 				$value [] = $value1 ['id'];
37 37
 			}
38
-			if (! empty ( $value )) {
39
-				$this->db->where_in ( 'accountid', $value );
38
+			if ( ! empty ($value)) {
39
+				$this->db->where_in('accountid', $value);
40 40
 			} else {
41
-				$this->db->where_in ( 'accountid', '0' );
41
+				$this->db->where_in('accountid', '0');
42 42
 			}
43 43
 		} else {
44 44
 			
45
-			$qry = $this->db_model->getselect ( 'id', 'accounts', array (
45
+			$qry = $this->db_model->getselect('id', 'accounts', array(
46 46
 					'reseller_id' => 0 
47
-			) );
48
-			$result = $qry->result_array ();
47
+			));
48
+			$result = $qry->result_array();
49 49
 			
50
-			foreach ( $result as $value1 ) {
50
+			foreach ($result as $value1) {
51 51
 				$value [] = $value1 ['id'];
52 52
 			}
53 53
 			// $this->db->where_in('accountid', $value);
54
-			if (! empty ( $value )) {
55
-				$this->db->where_in ( 'accountid', $value );
54
+			if ( ! empty ($value)) {
55
+				$this->db->where_in('accountid', $value);
56 56
 			} else {
57
-				$this->db->where_in ( 'accountid', '0' );
57
+				$this->db->where_in('accountid', '0');
58 58
 			}
59 59
 		}
60
-		$this->db_model->build_search ( 'ipmap_list_search' );
60
+		$this->db_model->build_search('ipmap_list_search');
61 61
 		/**
62 62
 		 * *****
63 63
 		 * ASTPP 3.0
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		 * *****
66 66
 		 */
67 67
 		if ($accountinfo ['type'] == '0') {
68
-			$where = array (
68
+			$where = array(
69 69
 					'accountid' => $accountinfo ['id'] 
70 70
 			);
71 71
 		} else {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			 * in customer login show ipmap (ACL) module
82 82
 			 * *****
83 83
 			 */
84
-			$query = $this->db_model->select ( "*", "ip_map", $where, "id", "ASC", $limit, $start );
84
+			$query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start);
85 85
 		/**
86 86
 		 * ****************************************************************************************
87 87
 		 */
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 			 * in customer login show ipmap (ACL) module
93 93
 			 * *****
94 94
 			 */
95
-			$query = $this->db_model->countQuery ( "*", "ip_map", $where );
95
+			$query = $this->db_model->countQuery("*", "ip_map", $where);
96 96
 		/**
97 97
 		 * **********************************************************************************************************
98 98
 		 */
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
 		 * in customer login show ipmap (ACL) module
108 108
 		 * *****
109 109
 		 */
110
-		$account_data = $this->session->userdata ( "accountinfo" );
110
+		$account_data = $this->session->userdata("accountinfo");
111 111
 		if ($account_data ['type'] == '0') {
112 112
 			$add_array ['accountid'] = $account_data ['id'];
113 113
 		}
114 114
 		/**
115 115
 		 * ****************************************************************
116 116
 		 */
117
-		$data = array (
118
-				'created_date' => gmdate ( 'Y-m-d H:i:s' ),
117
+		$data = array(
118
+				'created_date' => gmdate('Y-m-d H:i:s'),
119 119
 				'name' => $add_array ['name'],
120 120
 				'ip' => $add_array ['ip'],
121 121
 				'prefix' => $add_array ['prefix'],
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 				'status' => $add_array ['status'],
124 124
 				'context' => 'default' 
125 125
 		);
126
-		$this->db->insert ( "ip_map", $data );
127
-		return $this->db->insert_id ();
126
+		$this->db->insert("ip_map", $data);
127
+		return $this->db->insert_id();
128 128
 	}
129 129
 	function edit_ipmap($add_array, $id) {
130 130
 		/**
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 		 * in customer login show ipmap (ACL) module
134 134
 		 * *****
135 135
 		 */
136
-		$account_data = $this->session->userdata ( "accountinfo" );
136
+		$account_data = $this->session->userdata("accountinfo");
137 137
 		if ($account_data ['type'] == '0') {
138 138
 			$add_array ['accountid'] = $account_data ['id'];
139 139
 		}
140 140
 		/**
141 141
 		 * *********************************************************************************************
142 142
 		 */
143
-		$data = array (
144
-				'last_modified_date' => gmdate ( 'Y-m-d H:i:s' ),
143
+		$data = array(
144
+				'last_modified_date' => gmdate('Y-m-d H:i:s'),
145 145
 				'name' => $add_array ['name'],
146 146
 				'ip' => $add_array ['ip'],
147 147
 				'prefix' => $add_array ['prefix'],
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 				'status' => $add_array ['status'],
150 150
 				'context' => 'default' 
151 151
 		);
152
-		$this->db->where ( "id", $id );
153
-		return $this->db->update ( "ip_map", $data );
152
+		$this->db->where("id", $id);
153
+		return $this->db->update("ip_map", $data);
154 154
 	}
155 155
 	function remove_ipmap($id) {
156
-		$this->db->where ( "id", $id );
157
-		$this->db->delete ( "ip_map" );
156
+		$this->db->where("id", $id);
157
+		$this->db->delete("ip_map");
158 158
 		return true;
159 159
 	}
160 160
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/controllers/ipmap.php 2 patches
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -23,30 +23,30 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class IPMAP extends MX_Controller {
25 25
 	function IPMAP() {
26
-		parent::__construct ();
27
-		$this->load->helper ( 'template_inheritance' );
28
-		$this->load->library ( 'session' );
29
-		$this->load->library ( "ipmap_form" );
30
-		$this->load->library ( 'astpp/form' );
31
-		$this->load->model ( 'ipmap_model' );
32
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
33
-			redirect ( base_url () . '/astpp/login' );
26
+		parent::__construct();
27
+		$this->load->helper('template_inheritance');
28
+		$this->load->library('session');
29
+		$this->load->library("ipmap_form");
30
+		$this->load->library('astpp/form');
31
+		$this->load->model('ipmap_model');
32
+		if ($this->session->userdata('user_login') == FALSE)
33
+			redirect(base_url().'/astpp/login');
34 34
 	}
35 35
 	function ipmap_add() {
36
-		$data ['username'] = $this->session->userdata ( 'user_name' );
36
+		$data ['username'] = $this->session->userdata('user_name');
37 37
 		$data ['flag'] = 'create';
38
-		$data ['page_title'] = gettext ( 'Add IP Map' );
39
-		$data ['form'] = $this->form->build_form ( $this->ipmap_form->get_ipmap_form_fields (), '' );
40
-		$this->load->view ( 'ipmap_add_edit', $data );
38
+		$data ['page_title'] = gettext('Add IP Map');
39
+		$data ['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), '');
40
+		$this->load->view('ipmap_add_edit', $data);
41 41
 	}
42 42
 	function ipmap_edit($edit_id = '') {
43
-		$data ['page_title'] = gettext ( 'Edit IP Map' );
44
-		$where = array (
43
+		$data ['page_title'] = gettext('Edit IP Map');
44
+		$where = array(
45 45
 				'id' => $edit_id 
46 46
 		);
47
-		$account = $this->db_model->getSelect ( "*", "ip_map", $where );
47
+		$account = $this->db_model->getSelect("*", "ip_map", $where);
48 48
 		// echo $this->db->last_query(); exit;
49
-		foreach ( $account->result_array () as $key => $value ) {
49
+		foreach ($account->result_array() as $key => $value) {
50 50
 			/**
51 51
 			 * *******************
52 52
 			 * ASTPP 3.0
@@ -58,100 +58,100 @@  discard block
 block discarded – undo
58 58
 		/**
59 59
 		 * **********************************************************************************************
60 60
 		 */
61
-		$data ['form'] = $this->form->build_form ( $this->ipmap_form->get_ipmap_form_fields (), $edit_data );
62
-		$this->load->view ( 'ipmap_add_edit', $data );
61
+		$data ['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $edit_data);
62
+		$this->load->view('ipmap_add_edit', $data);
63 63
 	}
64 64
 	function ipmap_save() {
65
-		$add_array = $this->input->post ();
65
+		$add_array = $this->input->post();
66 66
 		$ip = $add_array ['ip'];
67
-		if (strpos ( $ip, '/' ) !== false) {
67
+		if (strpos($ip, '/') !== false) {
68 68
 			$add_array ['ip'] = $add_array ['ip'];
69 69
 		} else {
70
-			$add_array ['ip'] = $add_array ['ip'] . '/32';
70
+			$add_array ['ip'] = $add_array ['ip'].'/32';
71 71
 		}
72
-		$data ['form'] = $this->form->build_form ( $this->ipmap_form->get_ipmap_form_fields (), $add_array );
72
+		$data ['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array);
73 73
 		if ($add_array ['id'] != '') {
74
-			$data ['page_title'] = gettext ( 'Add IP Map' );
75
-			if ($this->form_validation->run () == FALSE) {
76
-				$data ['validation_errors'] = validation_errors ();
74
+			$data ['page_title'] = gettext('Add IP Map');
75
+			if ($this->form_validation->run() == FALSE) {
76
+				$data ['validation_errors'] = validation_errors();
77 77
 				echo $data ['validation_errors'];
78 78
 				exit ();
79 79
 			}
80
-			$this->db->select ( 'prefix,ip' );
81
-			$this->db->where ( [ 
80
+			$this->db->select('prefix,ip');
81
+			$this->db->where([ 
82 82
 					'prefix' => $add_array ['prefix'],
83 83
 					'ip' => $add_array ['ip'],
84 84
 					'id <>' => $add_array ['id'] 
85
-			] );
86
-			$ip_prefix = ( array ) $this->db->get ( 'ip_map' )->first_row ();
87
-			if (! empty ( $ip_prefix )) {
88
-				echo json_encode ( array (
85
+			]);
86
+			$ip_prefix = (array)$this->db->get('ip_map')->first_row();
87
+			if ( ! empty ($ip_prefix)) {
88
+				echo json_encode(array(
89 89
 						"prefix_error" => "The Prefix field must contain a unique value.
90 90
 ",
91 91
 						"ip_error" => "The IP field must contain a unique value." 
92
-				) );
92
+				));
93 93
 				exit ();
94 94
 			} else {
95
-				$ip_free = $this->ipmap_model->edit_ipmap ( $add_array, $add_array ['id'] );
95
+				$ip_free = $this->ipmap_model->edit_ipmap($add_array, $add_array ['id']);
96 96
 				if ($ip_free) {
97
-					$this->load->library ( 'freeswitch_lib' );
98
-					$this->load->module ( 'freeswitch/freeswitch' );
97
+					$this->load->library('freeswitch_lib');
98
+					$this->load->module('freeswitch/freeswitch');
99 99
 					$command = "api reloadacl";
100
-					$response = $this->freeswitch_model->reload_freeswitch ( $command );
101
-					$this->session->set_userdata ( 'astpp_notification', $response );
100
+					$response = $this->freeswitch_model->reload_freeswitch($command);
101
+					$this->session->set_userdata('astpp_notification', $response);
102 102
 				}
103
-				echo json_encode ( array (
103
+				echo json_encode(array(
104 104
 						"SUCCESS" => " IP Map updated successfully!" 
105
-				) );
105
+				));
106 106
 				exit ();
107 107
 			}
108 108
 		} else {
109 109
 			
110
-			if ($this->form_validation->run () == FALSE) {
111
-				$data ['validation_errors'] = validation_errors ();
110
+			if ($this->form_validation->run() == FALSE) {
111
+				$data ['validation_errors'] = validation_errors();
112 112
 				echo $data ['validation_errors'];
113 113
 				exit ();
114 114
 			}
115
-			$this->db->select ( 'prefix,ip' );
116
-			$this->db->where ( [ 
115
+			$this->db->select('prefix,ip');
116
+			$this->db->where([ 
117 117
 					'prefix' => $add_array ['prefix'],
118 118
 					'ip' => $add_array ['ip'] 
119
-			] );
120
-			$ip_prefix = ( array ) $this->db->get ( 'ip_map' )->first_row ();
119
+			]);
120
+			$ip_prefix = (array)$this->db->get('ip_map')->first_row();
121 121
 			
122
-			if (! empty ( $ip_prefix )) {
123
-				echo json_encode ( array (
122
+			if ( ! empty ($ip_prefix)) {
123
+				echo json_encode(array(
124 124
 						"prefix_error" => "The Prefix field must contain a unique value.
125 125
 ",
126 126
 						"ip_error" => "The IP field must contain a unique value." 
127
-				) );
127
+				));
128 128
 				exit ();
129 129
 			} else {
130
-				$ip_free = $this->ipmap_model->add_ipmap ( $add_array );
130
+				$ip_free = $this->ipmap_model->add_ipmap($add_array);
131 131
 				if ($ip_free) {
132
-					$this->load->library ( 'freeswitch_lib' );
133
-					$this->load->module ( 'freeswitch/freeswitch' );
132
+					$this->load->library('freeswitch_lib');
133
+					$this->load->module('freeswitch/freeswitch');
134 134
 					$command = "api reloadacl";
135
-					$response = $this->freeswitch_model->reload_freeswitch ( $command );
136
-					$this->session->set_userdata ( 'astpp_notification', $response );
135
+					$response = $this->freeswitch_model->reload_freeswitch($command);
136
+					$this->session->set_userdata('astpp_notification', $response);
137 137
 				}
138
-				echo json_encode ( array (
138
+				echo json_encode(array(
139 139
 						"SUCCESS" => " IP Map added successfully!" 
140
-				) );
140
+				));
141 141
 				exit ();
142 142
 			}
143 143
 		}
144 144
 	}
145 145
 	function ipmap_delete($id) {
146
-		$ip_free = $this->ipmap_model->remove_ipmap ( $id );
146
+		$ip_free = $this->ipmap_model->remove_ipmap($id);
147 147
 		if ($ip_free) {
148
-			$this->load->library ( 'freeswitch_lib' );
149
-			$this->load->module ( 'freeswitch/freeswitch' );
148
+			$this->load->library('freeswitch_lib');
149
+			$this->load->module('freeswitch/freeswitch');
150 150
 			$command = "api reloadacl";
151
-			$response = $this->freeswitch_model->reload_freeswitch ( $command );
152
-			$this->session->set_userdata ( 'astpp_notification', $response );
151
+			$response = $this->freeswitch_model->reload_freeswitch($command);
152
+			$this->session->set_userdata('astpp_notification', $response);
153 153
 		}
154
-		$this->session->set_flashdata ( 'astpp_notification', 'IP Map removed successfully!' );
154
+		$this->session->set_flashdata('astpp_notification', 'IP Map removed successfully!');
155 155
 		/**
156 156
 		 * *******************
157 157
 		 * ASTPP 3.0
@@ -160,40 +160,40 @@  discard block
 block discarded – undo
160 160
 		 */
161 161
 		$accountdata = $this->session->userdata ['accountinfo'];
162 162
 		if ($accountdata ['type'] == '0') {
163
-			redirect ( base_url () . 'user/user_ipmap_detail/' );
163
+			redirect(base_url().'user/user_ipmap_detail/');
164 164
 		} else {
165
-			redirect ( base_url () . 'ipmap/ipmap_detail/' );
165
+			redirect(base_url().'ipmap/ipmap_detail/');
166 166
 		}
167 167
 	/**
168 168
 	 * ******************************************************************
169 169
 	 */
170 170
 	}
171 171
 	function ipmap_detail_search() {
172
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
173
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
174
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
175
-			$action = $this->input->post ();
176
-			unset ( $action ['action'] );
177
-			unset ( $action ['advance_search'] );
178
-			$this->session->set_userdata ( 'ipmap_list_search', $action );
172
+		$ajax_search = $this->input->post('ajax_search', 0);
173
+		if ($this->input->post('advance_search', TRUE) == 1) {
174
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
175
+			$action = $this->input->post();
176
+			unset ($action ['action']);
177
+			unset ($action ['advance_search']);
178
+			$this->session->set_userdata('ipmap_list_search', $action);
179 179
 		}
180 180
 		if (@$ajax_search != 1) {
181
-			redirect ( base_url () . 'ipmap/ipmap_list/' );
181
+			redirect(base_url().'ipmap/ipmap_list/');
182 182
 		}
183 183
 	}
184 184
 	function ipmap_detail_clearsearchfilter() {
185
-		$this->session->set_userdata ( 'advance_search', 0 );
186
-		$this->session->set_userdata ( 'ipmap_list_search', "" );
185
+		$this->session->set_userdata('advance_search', 0);
186
+		$this->session->set_userdata('ipmap_list_search', "");
187 187
 	}
188 188
 	function ipmap_detail() {
189
-		$data ['username'] = $this->session->userdata ( 'user_name' );
190
-		$data ['page_title'] = gettext ( 'IP Map(ACL)' );
189
+		$data ['username'] = $this->session->userdata('user_name');
190
+		$data ['page_title'] = gettext('IP Map(ACL)');
191 191
 		$data ['search_flag'] = true;
192
-		$this->session->set_userdata ( 'advance_search', 0 );
193
-		$data ['grid_fields'] = $this->ipmap_form->build_ipmap_list_for_admin ();
194
-		$data ["grid_buttons"] = $this->ipmap_form->build_grid_buttons ();
195
-		$data ['form_search'] = $this->form->build_serach_form ( $this->ipmap_form->get_ipmap_search_form () );
196
-		$this->load->view ( 'ipmap_view', $data );
192
+		$this->session->set_userdata('advance_search', 0);
193
+		$data ['grid_fields'] = $this->ipmap_form->build_ipmap_list_for_admin();
194
+		$data ["grid_buttons"] = $this->ipmap_form->build_grid_buttons();
195
+		$data ['form_search'] = $this->form->build_serach_form($this->ipmap_form->get_ipmap_search_form());
196
+		$this->load->view('ipmap_view', $data);
197 197
 	}
198 198
 	
199 199
 	/**
@@ -203,44 +203,44 @@  discard block
 block discarded – undo
203 203
 	 * ***************************************
204 204
 	 */
205 205
 	function ipmap_detail_json() {
206
-		$json_data = array ();
207
-		$account_data = $this->session->userdata ( "accountinfo" );
208
-		$count_all = $this->ipmap_model->ipmap_list ( false );
209
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
206
+		$json_data = array();
207
+		$account_data = $this->session->userdata("accountinfo");
208
+		$count_all = $this->ipmap_model->ipmap_list(false);
209
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
210 210
 		$json_data = $paging_data ["json_paging"];
211
-		$query = $this->ipmap_model->ipmap_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
212
-		$query = $query->result_array ();
213
-		foreach ( $query as $key => $value ) {
214
-			$ipmap_checkbox = '<input type="checkbox" name="chkAll" id="' . $value ['id'] . '" class="ace chkRefNos" onclick="clickchkbox(' . $value ['id'] . ')" value=' . $value ['id'] . '><lable class="lbl"></lable>';
211
+		$query = $this->ipmap_model->ipmap_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
212
+		$query = $query->result_array();
213
+		foreach ($query as $key => $value) {
214
+			$ipmap_checkbox = '<input type="checkbox" name="chkAll" id="'.$value ['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value ['id'].')" value='.$value ['id'].'><lable class="lbl"></lable>';
215 215
 			if ($account_data ['type'] == '0') {
216
-				$ret_url = '<a href="' . base_url () . 'user/user_ipmap_edit/' . $value ['id'] . '" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="' . base_url () . 'user/user_ipmap_delete/' . $value ['id'] . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
216
+				$ret_url = '<a href="'.base_url().'user/user_ipmap_edit/'.$value ['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'.base_url().'user/user_ipmap_delete/'.$value ['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
217 217
 				$account_name = '';
218
-				$json_data ['rows'] [] = array (
219
-						'cell' => array (
218
+				$json_data ['rows'] [] = array(
219
+						'cell' => array(
220 220
 								$ipmap_checkbox,
221 221
 								$value ['name'],
222 222
 								$value ['ip'],
223 223
 								$value ['prefix'],
224
-								$this->common->get_status ( 'status', 'ip_map', $value ),
225
-								$this->common->convert_GMT_to ( '', '', $value ['created_date'] ),
226
-								$this->common->convert_GMT_to ( '', '', $value ['last_modified_date'] ),
224
+								$this->common->get_status('status', 'ip_map', $value),
225
+								$this->common->convert_GMT_to('', '', $value ['created_date']),
226
+								$this->common->convert_GMT_to('', '', $value ['last_modified_date']),
227 227
 								$ret_url 
228 228
 						)
229 229
 						 
230 230
 				);
231 231
 			} else {
232
-				$ret_url = '<a href="' . base_url () . 'ipmap/ipmap_edit/' . $value ['id'] . '" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="' . base_url () . 'ipmap/ipmap_delete/' . $value ['id'] . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
233
-				$account_name = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $value ['accountid'] );
234
-				$json_data ['rows'] [] = array (
235
-						'cell' => array (
232
+				$ret_url = '<a href="'.base_url().'ipmap/ipmap_edit/'.$value ['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'.base_url().'ipmap/ipmap_delete/'.$value ['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
233
+				$account_name = $this->common->build_concat_string("first_name,last_name,number", "accounts", $value ['accountid']);
234
+				$json_data ['rows'] [] = array(
235
+						'cell' => array(
236 236
 								$ipmap_checkbox,
237 237
 								$account_name,
238 238
 								$value ['name'],
239 239
 								$value ['ip'],
240 240
 								$value ['prefix'],
241
-								$this->common->get_status ( 'status', 'ip_map', $value ),
242
-								$this->common->convert_GMT_to ( '', '', $value ['created_date'] ),
243
-								$this->common->convert_GMT_to ( '', '', $value ['last_modified_date'] ),
241
+								$this->common->get_status('status', 'ip_map', $value),
242
+								$this->common->convert_GMT_to('', '', $value ['created_date']),
243
+								$this->common->convert_GMT_to('', '', $value ['last_modified_date']),
244 244
 								$ret_url 
245 245
 						)
246 246
 						 
@@ -248,16 +248,16 @@  discard block
 block discarded – undo
248 248
 			}
249 249
 		}
250 250
 		
251
-		echo json_encode ( $json_data );
251
+		echo json_encode($json_data);
252 252
 	}
253 253
 	/**
254 254
 	 * **********************************************************
255 255
 	 */
256 256
 	function ipmap_delete_multiple() {
257
-		$ids = $this->input->post ( "selected_ids", true );
257
+		$ids = $this->input->post("selected_ids", true);
258 258
 		$where = "id IN ($ids)";
259
-		$this->db->where ( $where );
260
-		echo $this->db->delete ( "ip_map" );
259
+		$this->db->where($where);
260
+		echo $this->db->delete("ip_map");
261 261
 	}
262 262
 }
263 263
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
 		$this->load->library ( "ipmap_form" );
30 30
 		$this->load->library ( 'astpp/form' );
31 31
 		$this->load->model ( 'ipmap_model' );
32
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
33
-			redirect ( base_url () . '/astpp/login' );
32
+		if ($this->session->userdata ( 'user_login' ) == FALSE) {
33
+					redirect ( base_url () . '/astpp/login' );
34
+		}
34 35
 	}
35 36
 	function ipmap_add() {
36 37
 		$data ['username'] = $this->session->userdata ( 'user_name' );
Please login to merge, or discard this patch.