11<?php
2+
23/**
34 * =======================================
45 * ###################################
@@ -52,7 +53,8 @@ public function actionLogin()
5253 [
5354 'condition ' => $ condition ,
5455 'params ' => [':user ' => $ user , ':pass ' => $ password ],
55- ]);
56+ ]
57+ );
5658
5759 $ loginkey = isset ($ _POST ['loginkey ' ]) ? $ _POST ['loginkey ' ] : false ;
5860
@@ -65,7 +67,7 @@ public function actionLogin()
6567 $ mail ->send ();
6668 }
6769
68- if ( ! isset ($ modelUser ->id )) {
70+ if (! isset ($ modelUser ->id )) {
6971 Yii::app ()->session ['logged ' ] = false ;
7072 echo json_encode ([
7173 'success ' => false ,
@@ -145,20 +147,21 @@ public function actionLogin()
145147 }
146148 Yii::app ()->session ['googleAuthenticatorKey ' ] = $ ga ->getQRCodeGoogleUrl ('VoIP- ' . $ modelUser ->username . '- ' . $ modelUser ->id , $ secret );
147149
148- $ modelLogUsers = LogUsers::model ()->count ('id_user = :key AND ip = :key1 AND description = :key2 AND date > :key3 ' ,
150+ $ modelLogUsers = LogUsers::model ()->count (
151+ 'id_user = :key AND ip = :key1 AND description = :key2 AND date > :key3 ' ,
149152 [
150153 ':key ' => $ modelUser ->id ,
151154 ':key1 ' => $ _SERVER ['REMOTE_ADDR ' ],
152155 ':key2 ' => 'Username Login on the panel - User ' . $ modelUser ->username ,
153156 ':key3 ' => date ('Y-m-d ' ),
154- ]);
157+ ]
158+ );
155159 if ($ modelLogUsers > 0 ) {
156160 Yii::app ()->session ['checkGoogleAuthenticator ' ] = false ;
157161 } else {
158162 Yii::app ()->session ['checkGoogleAuthenticator ' ] = true ;
159163 }
160164 }
161-
162165 } else {
163166 Yii::app ()->session ['showGoogleCode ' ] = false ;
164167 Yii::app ()->session ['newGoogleAuthenticator ' ] = false ;
@@ -177,7 +180,6 @@ public function actionLogin()
177180 'success ' => Yii::app ()->session ['username ' ],
178181 'msg ' => Yii::app ()->session ['name_user ' ],
179182 ]);
180-
181183 }
182184
183185 private function mountMenu ()
@@ -229,8 +231,10 @@ public function actionCheck()
229231 if (Yii::app ()->session ['logged ' ]) {
230232
231233 $ this ->mountMenu ();
232- $ modelGroupUserGroup = GroupUserGroup::model ()->count ('id_group_user = :key ' ,
233- [':key ' => Yii::app ()->session ['id_group ' ]]);
234+ $ modelGroupUserGroup = GroupUserGroup::model ()->count (
235+ 'id_group_user = :key ' ,
236+ [':key ' => Yii::app ()->session ['id_group ' ]]
237+ );
234238
235239 $ modelGroupUser = GroupUser::model ()->findByPk (Yii::app ()->session ['id_group ' ]);
236240
@@ -410,7 +414,6 @@ public function actionGoogleAuthenticator()
410414 'success ' => $ sussess ,
411415 'msg ' => Yii::app ()->session ['name_user ' ],
412416 ]);
413-
414417 }
415418
416419 public function actionChangePassword ()
@@ -422,18 +425,18 @@ public function actionChangePassword()
422425 $ isClient = Yii::app ()->session ['isClient ' ];
423426 $ errors = '' ;
424427
425- $ modelUser = User::model ()->find ("id LIKE :id_user AND password LIKE :currentPassword " ,
428+ $ modelUser = User::model ()->find (
429+ "id LIKE :id_user AND password LIKE :currentPassword " ,
426430 [
427431 ":id_user " => $ id_user ,
428432 ":currentPassword " => $ currentPassword ,
429- ]);
433+ ]
434+ );
430435
431436 if (isset ($ modelUser ->id )) {
432- try
433- {
437+ try {
434438 $ modelUser ->password = $ newPassword ;
435439 $ passwordChanged = $ modelUser ->save ();
436-
437440 } catch (Exception $ e ) {
438441 $ errors = $ this ->getErrorMySql ($ e );
439442 }
@@ -460,7 +463,7 @@ public function actionImportLogo()
460463 } else {
461464 $ uploadfile = $ uploaddir . 'logo_custom.png ' ;
462465 }
463- $ typefile = Util::valid_extension ( $ _FILES ["logo " ]["name " ], ['png ' ]);
466+ Util::validExtension ( $ _FILES [ ' logo ' ][ ' tmp_name ' ], $ _FILES ["logo " ]["name " ], ['png ' ]);
464467
465468 move_uploaded_file ($ _FILES ["logo " ]["tmp_name " ], $ uploadfile );
466469 }
@@ -476,7 +479,7 @@ public function actionImportWallpapers()
476479 if (isset ($ _FILES ['wallpaper ' ]['tmp_name ' ]) && strlen ($ _FILES ['wallpaper ' ]['tmp_name ' ]) > 3 ) {
477480
478481 $ uploaddir = "resources/images/wallpapers/ " ;
479- $ typefile = Util::valid_extension ( $ _FILES ["wallpaper " ]["name " ], ['jpg ' ]);
482+ Util::validExtension ( $ _FILES [ ' wallpaper ' ][ ' tmp_name ' ], $ _FILES ["wallpaper " ]["name " ], ['jpg ' ]);
480483
481484 $ uploadfile = $ uploaddir . 'Customization.jpg ' ;
482485 move_uploaded_file ($ _FILES ["wallpaper " ]["tmp_name " ], $ uploadfile );
@@ -495,7 +498,6 @@ public function actionImportWallpapers()
495498 'success ' => $ success ,
496499 'msg ' => $ msg ,
497500 ]);
498-
499501 }
500502
501503 public function actionImportLoginBackground ()
@@ -505,7 +507,7 @@ public function actionImportLoginBackground()
505507
506508 if (isset ($ _FILES ['loginbackground ' ]['tmp_name ' ]) && strlen ($ _FILES ['loginbackground ' ]['tmp_name ' ]) > 3 ) {
507509
508- $ typefile = Util::valid_extension ( $ _FILES ["loginbackground " ]["name " ], ['jpg ' ]);
510+ Util::validExtension ( $ _FILES [ ' loginbackground ' ][ ' tmp_name ' ], $ _FILES ["loginbackground " ]["name " ], ['jpg ' ]);
509511
510512 $ uploadfile = 'resources/images/lock-screen-background.jpg ' ;
511513 try {
@@ -514,17 +516,7 @@ public function actionImportLoginBackground()
514516 $ msg = 'Refresh the system to see the new wallpaper ' ;
515517 } catch (Exception $ e ) {
516518 }
517-
518519 }
519-
520- $ colors = ['black ' , 'blue ' , 'gray ' , 'orange ' , 'purple ' , 'red ' , 'yellow ' , 'green ' ];
521- foreach ($ colors as $ key => $ color ) {
522- $ types = ['crisp ' , 'neptune ' , 'triton ' ];
523- foreach ($ types as $ key => $ type ) {
524- copy ("/var/www/html/mbilling/resources/images/lock-screen-background.jpg " , "/var/www/html/mbilling/ $ color- $ type/resources/images/lock-screen-background.jpg " );
525- }
526- }
527-
528520 echo json_encode ([
529521 'success ' => $ success ,
530522 'msg ' => $ msg ,
@@ -569,7 +561,6 @@ public function actionForgetPassword()
569561 'success ' => $ success ,
570562 'msg ' => $ msg ,
571563 ]);
572-
573564 }
574565
575566 public function actionCancelCreditNotification ()
@@ -648,11 +639,12 @@ public function checkCaptcha()
648639 ]
649640 );
650641
651- $ opts = ['http ' => [
652- 'method ' => 'POST ' ,
653- 'header ' => 'Content-type: application/x-www-form-urlencoded ' ,
654- 'content ' => $ post_data ,
655- ],
642+ $ opts = [
643+ 'http ' => [
644+ 'method ' => 'POST ' ,
645+ 'header ' => 'Content-type: application/x-www-form-urlencoded ' ,
646+ 'content ' => $ post_data ,
647+ ],
656648 ];
657649
658650 $ context = stream_context_create ($ opts );
0 commit comments