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 | use hipanel\modules\client\widgets\combo\ClientCombo; |
||
4 | use hipanel\modules\finance\models\Plan; |
||
5 | use hipanel\modules\finance\models\PriceSuggestionRequestForm; |
||
6 | use hipanel\modules\finance\widgets\combo\TargetCombo; |
||
7 | use hipanel\modules\finance\widgets\combo\TemplatePlanCombo; |
||
8 | use hipanel\modules\server\widgets\combo\HubCombo; |
||
9 | use hipanel\modules\server\widgets\combo\ServerCombo; |
||
10 | use hiqdev\combo\StaticCombo; |
||
11 | use yii\bootstrap\ActiveForm; |
||
12 | use yii\helpers\Html; |
||
13 | use yii\web\View; |
||
14 | |||
15 | /** |
||
16 | * @var View $this |
||
17 | * @var Plan $plan |
||
18 | * @var PriceSuggestionRequestForm $model |
||
19 | */ |
||
20 | ?> |
||
21 | |||
22 | <?php $form = ActiveForm::begin(['id' => 'create-prices', 'action' => ['@price/suggest'], 'method' => 'GET']) ?> |
||
23 | |||
24 | <?= $form->field($model, 'plan_id')->hiddenInput()->label(false) ?> |
||
25 | |||
26 | <?php |
||
27 | // TODO: think about splitting to multiple files, if files becomes monstrous. |
||
28 | // $this->render("../{$model->type}/suggestPricesModal", compact('form', 'model', 'plan')); |
||
29 | ?> |
||
30 | |||
31 | <?php if ($plan->type === Plan::TYPE_SERVER): ?> |
||
32 | View Code Duplication | <?php if ($model->isObjectPredefined()) : ?> |
|
0 ignored issues
–
show
|
|||
33 | <?= $form->field($model, 'object_id')->hiddenInput()->label(false) ?> |
||
34 | <?php else : ?> |
||
35 | <?= $form->field($model, 'object_id')->widget(ServerCombo::class, ['primaryFilter' => 'name_like']) ?> |
||
36 | <?php endif; ?> |
||
37 | <?= $form->field($model, 'template_plan_id')->widget(TemplatePlanCombo::class, [ |
||
38 | 'plan_id' => $plan->id, |
||
39 | 'object_input_type' => $model->isObjectPredefined() ? null : 'server/server', |
||
40 | ]) ?> |
||
41 | <?= $form->field($model, 'type')->widget(StaticCombo::class, [ |
||
42 | 'data' => [ |
||
43 | 'default' => Yii::t('hipanel.finance.suggestionTypes', 'default'), |
||
44 | 'services' => Yii::t('hipanel.finance.suggestionTypes', 'services'), |
||
45 | 'parts' => Yii::t('hipanel.finance.suggestionTypes', 'parts'), |
||
46 | ], |
||
47 | ]) ?> |
||
48 | <?php elseif (in_array($plan->type, [ |
||
49 | Plan::TYPE_VPS, |
||
50 | Plan::TYPE_SNAPSHOT, |
||
51 | Plan::TYPE_VOLUME, |
||
52 | Plan::TYPE_STORAGE, |
||
53 | Plan::TYPE_PRIVATE_CLOUD_BACKUP, |
||
54 | Plan::TYPE_PRIVATE_CLOUD, |
||
55 | ], true)) : ?> |
||
56 | View Code Duplication | <?php if ($model->isObjectPredefined()) : ?> |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
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.
Loading history...
|
|||
57 | <?= $form->field($model, 'object_id')->hiddenInput()->label(false) ?> |
||
58 | <?php else : ?> |
||
59 | <?= $form->field($model, 'object_id')->widget(TargetCombo::class) ?> |
||
60 | <?php endif; ?> |
||
61 | <?= $form->field($model, 'template_plan_id')->widget(TemplatePlanCombo::class, [ |
||
62 | 'plan_id' => $plan->id, |
||
63 | 'object_input_type' => $model->isObjectPredefined() ? null : 'target/name', |
||
64 | ]) ?> |
||
65 | <?= $form->field($model, 'type')->widget(StaticCombo::class, [ |
||
66 | 'data' => ['default' => Yii::t('hipanel.finance.suggestionTypes', 'default')], |
||
67 | ]) ?> |
||
68 | <?php elseif ($plan->type === Plan::TYPE_SWITCH): ?> |
||
69 | View Code Duplication | <?php if ($model->isObjectPredefined()) : ?> |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
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.
Loading history...
|
|||
70 | <?= $form->field($model, 'object_id')->hiddenInput()->label(false) ?> |
||
71 | <?php else : ?> |
||
72 | <?= $form->field($model, 'object_id')->widget(HubCombo::class) ?> |
||
73 | <?php endif; ?> |
||
74 | <?= $form->field($model, 'template_plan_id')->widget(TemplatePlanCombo::class, [ |
||
75 | 'plan_id' => $plan->id, |
||
76 | 'object_input_type' => $model->isObjectPredefined() ? null : 'server/hub', |
||
77 | ]) ?> |
||
78 | <?= $form->field($model, 'type')->widget(StaticCombo::class, [ |
||
79 | 'data' => [ |
||
80 | 'default' => Yii::t('hipanel.finance.suggestionTypes', 'default'), |
||
81 | 'services' => Yii::t('hipanel.finance.suggestionTypes', 'services'), |
||
82 | 'parts' => Yii::t('hipanel.finance.suggestionTypes', 'parts'), |
||
83 | ], |
||
84 | ]) ?> |
||
85 | <?php elseif ($plan->type === Plan::TYPE_TEMPLATE): ?> |
||
86 | <?= $form->field($model, 'object_id')->hiddenInput(['value' => $model->plan_id])->label(false) ?> |
||
87 | <?= $form->field($model, 'type')->widget(StaticCombo::class, [ |
||
88 | 'data' => [ |
||
89 | 'model_groups' => Yii::t('hipanel.finance.suggestionTypes', 'model_groups'), |
||
90 | 'dedicated_server' => Yii::t('hipanel.finance.suggestionTypes', 'dedicated_server'), |
||
91 | 'switch' => Yii::t('hipanel.finance.suggestionTypes', 'switch'), |
||
92 | 'v_cdn' => Yii::t('hipanel.finance.suggestionTypes', 'v_cdn'), |
||
93 | 'p_cdn' => Yii::t('hipanel.finance.suggestionTypes', 'p_cdn'), |
||
94 | 'anycastcdn' => Yii::t('hipanel.finance.suggestionTypes', 'anycast_cdn'), |
||
95 | 'referral' => Yii::t('hipanel.finance.suggestionTypes', 'referral'), |
||
96 | 'vps' => Yii::t('hipanel.finance.suggestionTypes', 'vps'), |
||
97 | 'snapshot' => Yii::t('hipanel.finance.suggestionTypes', 'snapshot'), |
||
98 | 'volume' => Yii::t('hipanel.finance.suggestionTypes', 'volume'), |
||
99 | 'storage' => Yii::t('hipanel.finance.suggestionTypes', 'storage'), |
||
100 | 'private_cloud_backup' => Yii::t('hipanel.finance.suggestionTypes', 'private_cloud_backup'), |
||
101 | 'private_cloud' => Yii::t('hipanel.finance.suggestionTypes', 'private_cloud'), |
||
102 | ], |
||
103 | ]) ?> |
||
104 | <?php elseif (in_array($plan->type, [Plan::TYPE_VCDN, Plan::TYPE_PCDN, Plan::TYPE_ANYCASTCDN], true)): ?> |
||
105 | View Code Duplication | <?php if ($model->isObjectPredefined()) : ?> |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
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.
Loading history...
|
|||
106 | <?= $form->field($model, 'object_id')->hiddenInput()->label(false) ?> |
||
107 | <?php else : ?> |
||
108 | <?= $form->field($model, 'object_id')->widget(ServerCombo::class, [ |
||
109 | 'primaryFilter' => 'name_like', |
||
110 | /// XXX Looks like managers need CDN tariffs to be applicable to any servers |
||
111 | /// 'filter' => ['type' => ['format' => $plan->type === Plan::TYPE_PCDN ? 'cdnpix' : 'cdn']], |
||
112 | ]) ?> |
||
113 | <?php endif; ?> |
||
114 | <?= $form->field($model, 'template_plan_id')->widget(TemplatePlanCombo::class, [ |
||
115 | 'plan_id' => $plan->id, |
||
116 | 'object_input_type' => $model->isObjectPredefined() ? null : 'server/server', |
||
117 | ]) ?> |
||
118 | <?= $form->field($model, 'type')->widget(StaticCombo::class, [ |
||
119 | 'data' => [ |
||
120 | 'default' => Yii::t('hipanel.finance.suggestionTypes', 'default'), |
||
121 | ], |
||
122 | ]) ?> |
||
123 | <?php elseif (in_array($plan->type, [Plan::TYPE_CERTIFICATE, Plan::TYPE_DOMAIN], true)): ?> |
||
124 | <?= $form->field($model, 'template_plan_id')->widget(TemplatePlanCombo::class, [ |
||
125 | 'plan_id' => $plan->id, |
||
126 | ]) ?> |
||
127 | <?php $form->action = ['@plan/create-prices', 'id' => $plan->id]; ?> |
||
128 | <?php elseif ($plan->type === Plan::TYPE_HARDWARE): ?> |
||
129 | <?= $form->field($model, 'object_id')->widget(ClientCombo::class) ?> |
||
130 | <?= $form->field($model, 'template_plan_id')->widget(TemplatePlanCombo::class, ['plan_id' => $plan->id]) ?> |
||
131 | <?php elseif ($plan->type === Plan::TYPE_REFERRAL): ?> |
||
132 | <?= Html::activeHiddenInput($model, 'type', ['value' => Plan::TYPE_REFERRAL]) ?> |
||
133 | <?= $form->field($model, 'template_plan_id')->widget(TemplatePlanCombo::class, ['plan_id' => $plan->id]) ?> |
||
134 | <?php else: ?> |
||
135 | <p class="text-center bg-warning" |
||
136 | style="padding: 1rem;"><?= Yii::t('hipanel.finance.plan', 'This plan doesn\'t support detailed prices') ?></p> |
||
137 | <?php endif ?> |
||
138 | |||
139 | <?= Html::submitButton(Yii::t('hipanel.finance.price', 'Proceed to creation'), [ |
||
140 | 'class' => 'btn btn-block btn-success', |
||
141 | ]) ?> |
||
142 | |||
143 | <?php ActiveForm::end(); ?> |
||
144 |
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.