This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @author Alexey Tatarinov <[email protected]> |
||
4 | * @link https://github.com/shogodev/argilla/ |
||
5 | * @copyright Copyright © 2003-2014 Shogo |
||
6 | * @license http://argilla.ru/LICENSE |
||
7 | * @package frontend.controllers |
||
8 | */ |
||
9 | class UserProfileController extends FController |
||
10 | { |
||
11 | public $pageSize = 10; |
||
12 | |||
13 | 12 | public function filters() |
|
14 | { |
||
15 | 12 | return array('accessControl'); |
|
16 | } |
||
17 | |||
18 | 12 | public function accessRules() |
|
19 | { |
||
20 | return array( |
||
21 | 12 | array('deny', |
|
22 | 12 | 'users' => array('?'), |
|
23 | 12 | ), |
|
24 | 12 | ); |
|
25 | } |
||
26 | |||
27 | 1 | View Code Duplication | public function actionProfile() |
0 ignored issues
–
show
|
|||
28 | { |
||
29 | 1 | $this->breadcrumbs = array( |
|
30 | 1 | 'Личный кабинет', |
|
31 | 1 | 'Мой профиль', |
|
32 | ); |
||
33 | |||
34 | 1 | $model = User::model()->findByPk(Yii::app()->user->getId()); |
|
35 | |||
36 | 1 | $this->render('profile', array( |
|
37 | 1 | 'model' => $model, |
|
38 | 1 | )); |
|
39 | 1 | } |
|
40 | |||
41 | 3 | public function actionData() |
|
42 | { |
||
43 | 3 | $this->breadcrumbs = array( |
|
44 | 3 | 'Личный кабинет', |
|
45 | 3 | 'Личные данные', |
|
46 | ); |
||
47 | |||
48 | 3 | if( empty(Yii::app()->user->data->login) ) |
|
49 | 3 | { |
|
50 | 3 | Yii::app()->user->data->scenario = User::SCENARIO_REGISTRATION; |
|
51 | 3 | if( !empty(Yii::app()->user->data->socials) ) |
|
52 | 3 | { |
|
53 | if( empty(Yii::app()->user->data->email) ) |
||
54 | Yii::app()->user->data->email = Yii::app()->user->getEmail(); |
||
55 | |||
56 | if( empty(Yii::app()->user->profile->name) ) |
||
57 | Yii::app()->user->profile->name = Yii::app()->user->getName(); |
||
58 | } |
||
59 | 3 | } |
|
60 | else |
||
61 | Yii::app()->user->data->scenario = User::SCENARIO_CHANGE_EMAIL; |
||
62 | |||
63 | 3 | $userForm = new FForm('UserData', Yii::app()->user->data); |
|
64 | 3 | $userForm['profile']->model = Yii::app()->user->profile; |
|
65 | 3 | $userForm['profile']->elements['birthday']->form = $userForm['profile']; |
|
66 | 3 | $userForm->ajaxValidation(); |
|
67 | |||
68 | 3 | if( Yii::app()->request->isAjaxRequest && $userForm->save() ) |
|
69 | 2 | { |
|
70 | 1 | $userForm->responseSuccess(Yii::app()->controller->textBlockRegister( |
|
71 | 1 | 'Успешное изменение пользовательских данных', |
|
72 | 'Изменения сохранены' |
||
73 | 1 | )); |
|
74 | } |
||
75 | |||
76 | 1 | $this->render('data', array('form' => $userForm)); |
|
77 | 1 | } |
|
78 | |||
79 | 3 | public function actionChangePassword() |
|
80 | { |
||
81 | 3 | $this->breadcrumbs = array( |
|
82 | 3 | 'Личный кабинет', |
|
83 | 3 | 'Сменить пароль', |
|
84 | ); |
||
85 | 3 | $model = User::model()->findByPk(Yii::app()->user->getId()); |
|
86 | 3 | $model->scenario = User::SCENARIO_CHANGE_PASSWORD; |
|
87 | |||
88 | 3 | $form = new FForm('UserChangePassword', $model); |
|
89 | 3 | $form->ajaxValidation(); |
|
90 | |||
91 | 3 | if( Yii::app()->request->isAjaxRequest && $form->save() ) |
|
92 | 2 | { |
|
93 | 1 | Yii::app()->notification->send('UserChangePassword', array('model' => $form->model), $form->model->email); |
|
94 | 1 | $form->responseSuccess(Yii::app()->controller->textBlockRegister( |
|
95 | 1 | 'Успешное изменение пароля', |
|
96 | 'Изменения сохранены' |
||
97 | 1 | )); |
|
98 | } |
||
99 | |||
100 | 1 | $this->render('change_password', array('form' => $form)); |
|
101 | 1 | } |
|
102 | |||
103 | public function actionHistoryOrders() |
||
104 | { |
||
105 | $this->breadcrumbs = array( |
||
106 | 'Личный кабинет', |
||
107 | 'История заказов', |
||
108 | ); |
||
109 | |||
110 | $orderDataProvider = new FActiveDataProvider('OrderHistory'); |
||
111 | |||
112 | $this->render('history_orders', array('orderDataProvider' => $orderDataProvider)); |
||
113 | } |
||
114 | |||
115 | public function actionSocial() |
||
116 | { |
||
117 | $this->breadcrumbs = array( |
||
118 | 'Мой профиль', |
||
119 | 'Мои социальные сети', |
||
120 | ); |
||
121 | |||
122 | $socialManager = new SocialManager(); |
||
123 | |||
124 | $this->render('social', array('socials' => $socialManager->getSocialList())); |
||
125 | } |
||
126 | |||
127 | public function actionBindSocial($service) |
||
128 | { |
||
129 | if( isset($service) ) |
||
130 | { |
||
131 | /** |
||
132 | * @var $eauth EAuthServiceBase |
||
133 | */ |
||
134 | $eauth = Yii::app()->eauth->getIdentity($service); |
||
135 | $eauth->redirectUrl = $this->createAbsoluteUrl('userProfile/social'); |
||
0 ignored issues
–
show
The property
redirectUrl cannot be accessed from this context as it is declared private in class EAuthServiceBase .
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. ![]() |
|||
136 | $eauth->cancelUrl = $this->createAbsoluteUrl('userProfile/social'); |
||
0 ignored issues
–
show
The property
cancelUrl cannot be accessed from this context as it is declared private in class EAuthServiceBase .
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. ![]() |
|||
137 | |||
138 | try |
||
139 | { |
||
140 | if( $eauth->authenticate() ) |
||
141 | { |
||
142 | if( $eauth->isAuthenticated ) |
||
143 | { |
||
144 | $socialManager = new SocialManager(); |
||
145 | |||
146 | if( $socialManager->isAllowedUnbind() && $socialManager->isBinded($eauth) ) |
||
147 | $socialManager->unbindSocial($eauth); |
||
148 | else |
||
149 | $socialManager->bingSocial($eauth); |
||
150 | } |
||
151 | else |
||
152 | { |
||
153 | $eauth->cancel(); |
||
154 | } |
||
155 | } |
||
156 | |||
157 | $this->redirect($this->createAbsoluteUrl('userProfile/social')); |
||
158 | } |
||
159 | catch(EAuthException $e) |
||
160 | { |
||
161 | Yii::app()->user->setFlash('error', 'EAuthException: '.$e->getMessage()); |
||
162 | |||
163 | $eauth->redirect($eauth->getCancelUrl()); |
||
164 | } |
||
165 | } |
||
166 | } |
||
167 | 3 | public function getMenu() |
|
168 | { |
||
169 | $menu = array( |
||
170 | array( |
||
171 | 3 | 'label' => 'Личные данные', |
|
172 | 3 | 'url' => array('userProfile/data') |
|
173 | 3 | ), |
|
174 | array( |
||
175 | 3 | 'label' => 'История заказов', |
|
176 | 3 | 'url' => array('userProfile/historyOrders') |
|
177 | 3 | ), |
|
178 | array( |
||
179 | 3 | 'label' => 'Мои социальный сети', |
|
180 | 3 | 'url' => array('userProfile/social') |
|
181 | 3 | ), |
|
182 | array( |
||
183 | 3 | 'label' => 'Сменить пароль', |
|
184 | 3 | 'url' => array('userProfile/changePassword') |
|
185 | 3 | ), |
|
186 | 3 | ); |
|
187 | |||
188 | 3 | return $menu; |
|
189 | } |
||
190 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.