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 | * @link http://www.writesdown.com/ |
||
4 | * @author Agiel K. Saputra <[email protected]> |
||
5 | * @copyright Copyright (c) 2015 WritesDown |
||
6 | * @license http://www.writesdown.com/license/ |
||
7 | */ |
||
8 | |||
9 | use common\components\TimeZoneHelper; |
||
10 | use dosamigos\selectize\SelectizeDropDownList; |
||
11 | use yii\helpers\ArrayHelper; |
||
12 | use yii\helpers\Html; |
||
13 | use yii\widgets\ActiveForm; |
||
14 | |||
15 | /* @var $this yii\web\View */ |
||
16 | /* @var $model common\models\Option */ |
||
17 | /* @var $form yii\widgets\ActiveForm */ |
||
18 | /* @var $group string */ |
||
19 | /* @var $model object */ |
||
20 | |||
21 | $this->title = Yii::t('writesdown', 'General Settings'); |
||
22 | |||
23 | $this->params['breadcrumbs'][] = ['label' => Yii::t('writesdown', 'Settings'), 'url' => ['index']]; |
||
24 | $this->params['breadcrumbs'][] = $this->title; |
||
25 | ?> |
||
26 | <div class="options-form"> |
||
27 | <?php $form = ActiveForm::begin(['id' => 'option-general-form', 'options' => ['class' => 'form-horizontal']]) ?> |
||
28 | |||
29 | <div class="form-group"> |
||
30 | <?= Html::label( |
||
31 | Yii::t('writesdown', 'Site Title'), |
||
32 | 'option-sitetitle', |
||
33 | ['class' => 'col-sm-2 control-label'] |
||
34 | ) ?> |
||
35 | |||
36 | <div class="col-sm-7"> |
||
37 | <?= Html::textInput('Option[sitetitle][value]', $model->sitetitle->value, [ |
||
38 | 'class' => 'form-control', |
||
39 | 'id' => 'option-sitetitle', |
||
40 | ]) ?> |
||
41 | |||
42 | </div> |
||
43 | </div> |
||
44 | <div class="form-group"> |
||
45 | <?= Html::label(Yii::t('writesdown', 'Tagline'), 'option-tagline', ['class' => 'col-sm-2 control-label']) ?> |
||
46 | |||
47 | <div class="col-sm-7"> |
||
48 | <?= Html::textInput('Option[tagline][value]', $model->tagline->value, [ |
||
49 | 'class' => 'form-control', |
||
50 | 'id' => 'option-tagline', |
||
51 | ]) ?> |
||
52 | |||
53 | <p class="description"> |
||
54 | <?= Yii::t('writesdown', 'In a few words, explain what this site is about.') ?> |
||
55 | |||
56 | </p> |
||
57 | </div> |
||
58 | </div> |
||
59 | <div class="form-group"> |
||
60 | <?= Html::label( |
||
61 | Yii::t('writesdown', 'E-mail Address'), |
||
62 | 'option-admin_email', |
||
63 | ['class' => 'col-sm-2 control-label'] |
||
64 | ) ?> |
||
65 | |||
66 | <div class="col-sm-7"> |
||
67 | <?= Html::textInput('Option[admin_email][value]', $model->admin_email->value, [ |
||
68 | 'class' => 'form-control', |
||
69 | 'id' => 'option-admin_email', |
||
70 | ]) ?> |
||
71 | |||
72 | <p class="description"> |
||
73 | <?= Yii::t('writesdown', 'This address is used for admin purposes, like new user notification.') ?> |
||
74 | |||
75 | </p> |
||
76 | </div> |
||
77 | </div> |
||
78 | <div class="form-group"> |
||
79 | <?= Html::label( |
||
80 | Yii::t('writesdown', 'Allow New Membership'), |
||
81 | 'option-allow_signup', |
||
82 | ['class' => 'col-sm-2 control-label'] |
||
83 | ) ?> |
||
84 | |||
85 | <div class="col-sm-7"> |
||
86 | <div class="checkbox"> |
||
87 | <?= Html::label( |
||
88 | Html::checkbox( |
||
89 | 'Option[allow_signup][value]', |
||
90 | $model->allow_signup->value, |
||
91 | ['uncheck' => 0, 'id' => 'option-allow_signup'] |
||
92 | ) . Yii::t('writesdown', ' Allow guest to register on this site') |
||
93 | ) ?> |
||
94 | |||
95 | </div> |
||
96 | </div> |
||
97 | </div> |
||
98 | <div class="form-group"> |
||
99 | <?= Html::label( |
||
100 | Yii::t('writesdown', 'New User Default Role'), |
||
101 | 'option-default_role', |
||
102 | ['class' => 'col-sm-2 control-label'] |
||
103 | ) ?> |
||
104 | |||
105 | <div class="col-sm-7"> |
||
106 | <?php |
||
107 | $role = ArrayHelper::map(Yii::$app->authManager->getRoles(), 'name', 'name'); |
||
108 | unset($role['superadmin']); |
||
109 | |||
110 | View Code Duplication | if (Yii::$app->user->can('administrator') |
|
0 ignored issues
–
show
|
|||
111 | && !Yii::$app->authManager->checkAccess(Yii::$app->user->id, 'superadmin') |
||
112 | ) { |
||
113 | unset($role['administrator']); |
||
114 | } |
||
115 | |||
116 | echo Html::dropDownList('Option[default_role][value]', $model->default_role->value, $role, |
||
117 | ['id' => 'option-default_role', 'class' => 'form-control']) |
||
118 | ?> |
||
119 | |||
120 | </div> |
||
121 | </div> |
||
122 | |||
123 | <div class="form-group"> |
||
124 | <?= Html::label( |
||
125 | Yii::t('writesdown', 'Time Zone'), |
||
126 | 'option-time_zone', |
||
127 | ['class' => 'col-sm-2 control-label'] |
||
128 | ) ?> |
||
129 | |||
130 | <div class="col-sm-7"> |
||
131 | <?= SelectizeDropDownList::widget([ |
||
132 | 'name' => 'Option[time_zone][value]', |
||
133 | 'value' => $model->time_zone->value, |
||
134 | 'items' => TimeZoneHelper::listTimeZone(), |
||
135 | 'options' => [ |
||
136 | 'class' => 'form-control', |
||
137 | 'id' => 'option-time_zone', |
||
138 | ], |
||
139 | ]) ?> |
||
140 | |||
141 | <p class="description"><?= Yii::t('writesdown', 'Choose a city in the same timezone as you.') ?></p> |
||
142 | </div> |
||
143 | </div> |
||
144 | |||
145 | <div class="form-group"> |
||
146 | <?= Html::label(Yii::t('writesdown', 'Date Format'), null, ['class' => 'col-sm-2 control-label']) ?> |
||
147 | |||
148 | <div class="col-sm-7"> |
||
149 | <?= Html::radioList('radio-date_format', $model->date_format->value, [ |
||
150 | 'F d, Y' => date('F d, Y'), |
||
151 | 'M d, Y' => date('M d, Y'), |
||
152 | 'Y-m-d' => date('Y-m-d'), |
||
153 | 'm/d/Y' => date('m/d/Y'), |
||
154 | 'custom' => Yii::t('writesdown', 'Custom') |
||
155 | . ': ' |
||
156 | . Html::textInput('Option[date_format][value]', $model->date_format->value, [ |
||
157 | 'class' => 'value-date_format', |
||
158 | 'readonly' => 'readonly', |
||
159 | ]), |
||
160 | ], [ |
||
161 | 'separator' => '<br />', |
||
162 | 'encode' => false, |
||
163 | 'class' => 'radio', |
||
164 | 'itemOptions' => ['class' => 'radio-date_format'], |
||
165 | ]) ?> |
||
166 | |||
167 | <p class="description"> |
||
168 | <?= Html::a( |
||
169 | Yii::t('writesdown', 'Read documentation for more info.'), |
||
170 | 'http://php.net/manual/en/function.date.php', |
||
171 | ['rel' => 'external, nofollow', 'target' => '_blank'] |
||
172 | ) ?> |
||
173 | |||
174 | </p> |
||
175 | </div> |
||
176 | </div> |
||
177 | <div class="form-group"> |
||
178 | <?= Html::label(Yii::t('writesdown', 'Time Format'), null, ['class' => 'col-sm-2 control-label']) ?> |
||
179 | |||
180 | <div class="col-sm-7"> |
||
181 | <?= Html::radioList('radio-time_format', $model->time_format->value, [ |
||
182 | 'g:i:s a' => date('g:i:s a'), |
||
183 | 'g:i:s A' => date('g:i:s A'), |
||
184 | 'H:i:s' => date('H:i:s'), |
||
185 | 'custom' => Yii::t('writesdown', 'Custom') |
||
186 | . ': ' |
||
187 | . Html::textInput('Option[time_format][value]', $model->time_format->value, [ |
||
188 | 'class' => 'value-time_format', |
||
189 | 'readonly' => 'readonly', |
||
190 | ]), |
||
191 | ], [ |
||
192 | 'separator' => '<br />', |
||
193 | 'encode' => false, |
||
194 | 'class' => 'radio', |
||
195 | 'itemOptions' => ['class' => 'radio-time_format'], |
||
196 | ]) ?> |
||
197 | <p class="description"> |
||
198 | <?= Html::a( |
||
199 | Yii::t('writesdown', 'Read documentation for more info.'), |
||
200 | 'http://php.net/manual/en/function.date.php', |
||
201 | ['rel' => 'external, nofollow', 'target' => '_blank'] |
||
202 | ) ?> |
||
203 | |||
204 | </p> |
||
205 | </div> |
||
206 | </div> |
||
207 | <div class="form-group"> |
||
208 | <div class="col-sm-offset-2 col-sm-10"> |
||
209 | <?= Html::submitButton(Yii::t('writesdown', 'Save'), ['class' => 'btn btn-flat btn-success']) ?> |
||
210 | |||
211 | </div> |
||
212 | </div> |
||
213 | <?php ActiveForm::end() ?> |
||
214 | |||
215 | </div> |
||
216 | <?php $this->registerJs('(function($){ |
||
217 | $(".radio-time_format").click(function(){ |
||
218 | if($(this).val() !== "custom"){ |
||
219 | $(".value-time_format").val(($(this).val())); |
||
220 | }else{ |
||
221 | $(".value-time_format").attr("readonly", false); |
||
222 | } |
||
223 | }); |
||
224 | $(".radio-date_format").click(function(){ |
||
225 | if($(this).val() !== "custom"){ |
||
226 | $(".value-date_format").val(($(this).val())); |
||
227 | }else{ |
||
228 | $(".value-date_format").attr("readonly", false); |
||
229 | } |
||
230 | }); |
||
231 | }(jQuery));') ?> |
||
232 |
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.