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 | /** |
||
4 | * @var \yii\web\View $this |
||
5 | * @var \hipanel\modules\finance\models\DomainZonePrice[][] $zonePrices |
||
6 | * @var \hipanel\modules\finance\models\DomainServicePrice[][] $servicePrices |
||
7 | * @var \hipanel\modules\finance\models\DomainZonePrice[][] $parentZonePrices |
||
8 | * @var \hipanel\modules\finance\models\DomainServicePrice[] $parentServicePrices |
||
9 | * @var \hipanel\modules\finance\models\Plan $plan |
||
10 | */ |
||
11 | |||
12 | use hipanel\modules\finance\models\DomainZonePrice; |
||
13 | use hipanel\modules\finance\models\DomainServicePrice; |
||
14 | use hipanel\widgets\Box; |
||
15 | use hipanel\modules\finance\widgets\PriceInput; |
||
16 | use yii\bootstrap\ActiveForm; |
||
17 | use yii\helpers\Html; |
||
18 | use hipanel\helpers\Url; |
||
19 | |||
20 | $this->registerJs(" |
||
21 | $('#tariff-create-form').on('afterValidate', function (event, messages) { |
||
22 | if(typeof $('.has-error').first().offset() !== 'undefined') { |
||
23 | $('html, body').animate({ |
||
24 | scrollTop: $('.has-error').first().offset().top |
||
25 | }, 1000); |
||
26 | } |
||
27 | }); |
||
28 | "); |
||
29 | |||
30 | $this->registerCss(<<<'CSS' |
||
31 | .text-gray { |
||
32 | color: gray !important; |
||
33 | } |
||
34 | .price-table input::-webkit-outer-spin-button, |
||
35 | .price-table input::-webkit-inner-spin-button { |
||
36 | -webkit-appearance: none; |
||
37 | margin: 0; |
||
38 | } |
||
39 | .price-table input[type=number] { |
||
40 | -moz-appearance: textfield; |
||
41 | } |
||
42 | #main-table input { |
||
43 | padding: 5px 3px !important; |
||
44 | } |
||
45 | #main-table div.col-md-6 { |
||
46 | padding-left: 4px !important; |
||
47 | } |
||
48 | CSS |
||
49 | ); |
||
50 | ?> |
||
51 | <?php if (!empty($zonePrices)) : ?> |
||
52 | <div class="tariff-create"> |
||
53 | <?php $form = ActiveForm::begin(array_filter([ |
||
54 | 'id' => 'tariff-create-form', |
||
55 | 'action' => $action ?? null, |
||
56 | 'validateOnChange' => true, |
||
57 | ])) ?> |
||
58 | |||
59 | <?php Box::begin() ?> |
||
60 | <div class="row"> |
||
61 | <div class="col-md-12"> |
||
62 | <table id="main-table" class="table table-condensed price-table"> |
||
63 | <thead> |
||
64 | <tr> |
||
65 | <th> |
||
66 | <h4 class="box-title" style="display: inline-block;"> |
||
67 | <?= Yii::t('hipanel:finance', 'Prices') ?> |
||
68 | </h4> |
||
69 | </th> |
||
70 | </tr> |
||
71 | <tr> |
||
72 | <?= Html::tag('th', ''); ?> |
||
73 | <?php foreach (DomainZonePrice::getTypes() as $name) : ?> |
||
74 | <?= Html::tag('th', $name); ?> |
||
75 | <?php endforeach; ?> |
||
76 | </tr> |
||
77 | </thead> |
||
78 | <tbody> |
||
79 | <?php $i = 0; ?> |
||
80 | <?php foreach ($zonePrices as $zone => $group) : ?> |
||
81 | <tr> |
||
82 | <td><?= current($group)->object->name ?></td> |
||
83 | <?php foreach (DomainZonePrice::getTypes() as $type => $name) : ?> |
||
84 | <?php $originalPrice = $parentZonePrices[$zone][$type] ?? null; ?> |
||
85 | <?php $price = $group[$type] ?? $originalPrice ?? null; ?> |
||
86 | |||
87 | <?php if ($price === null): ?> |
||
88 | <td></td> |
||
89 | <?php continue; ?> |
||
90 | <?php endif; ?> |
||
91 | |||
92 | <?php $price->plan_id = $plan_id ?? $price->plan_id; ?> |
||
93 | <?= Html::activeHiddenInput($price, "[$i]id") ?> |
||
94 | <?= Html::activeHiddenInput($price, "[$i]plan_id") ?> |
||
95 | <?= Html::activeHiddenInput($price, "[$i]object_id") ?> |
||
96 | <?= Html::activeHiddenInput($price, "[$i]currency") ?> |
||
97 | <?= Html::activeHiddenInput($price, "[$i]type") ?> |
||
98 | <?= Html::activeHiddenInput($price, "[$i]unit") ?> |
||
99 | <td> |
||
100 | <?= PriceInput::widget([ |
||
101 | 'basePrice' => $price->getMoney(), |
||
102 | 'originalPrice' => ($originalPrice ?? $price)->getMoney(), |
||
103 | 'activeField' => $form->field($price, "[$i]price")]) ?> |
||
104 | </td> |
||
105 | <?php ++$i; ?> |
||
106 | <?php endforeach; ?> |
||
107 | </tr> |
||
108 | <?php endforeach; ?> |
||
109 | </tbody> |
||
110 | </table> |
||
111 | <?php foreach ($servicePrices as $groupLabel => $servicePriceGroup) : ?> |
||
112 | <table class="table table-condensed price-table"> |
||
113 | <thead> |
||
114 | <tr> |
||
115 | <th> |
||
116 | <h4 class="box-title" style="display: inline-block;"> |
||
117 | <?= DomainServicePrice::getLabel($groupLabel) ?> |
||
118 | </h4> |
||
119 | </th> |
||
120 | </tr> |
||
121 | <tr> |
||
122 | <?php foreach (DomainServicePrice::getOperations() as $name) : ?> |
||
123 | <?= Html::tag('th', $name); ?> |
||
124 | <?php endforeach; ?> |
||
125 | </tr> |
||
126 | </thead> |
||
127 | <tbody> |
||
128 | <?php $i = 0; ?> |
||
129 | <tr> |
||
130 | <?php foreach ($servicePriceGroup as $type => $price) : ?> |
||
131 | <?php $originalPrice = $parentServicePrices[$type] ?? null; ?> |
||
132 | <?php $price->plan_id = $plan_id ?? $price->plan_id; ?> |
||
133 | <?= Html::activeHiddenInput($price, "[$i]id") ?> |
||
134 | <?= Html::activeHiddenInput($price, "[$i]plan_id") ?> |
||
135 | <?= Html::activeHiddenInput($price, "[$i]currency") ?> |
||
136 | <?= Html::activeHiddenInput($price, "[$i]type") ?> |
||
137 | <?= Html::activeHiddenInput($price, "[$i]unit") ?> |
||
138 | <td> |
||
139 | <?= PriceInput::widget([ |
||
140 | 'basePrice' => $price->getMoney(), |
||
141 | 'originalPrice' => ($originalPrice ?? $price)->getMoney(), |
||
142 | 'activeField' => $form->field($price, "[$i]price")]) ?> |
||
143 | </td> |
||
144 | <?php ++$i; ?> |
||
145 | <?php endforeach; ?> |
||
146 | </tr> |
||
147 | </tbody> |
||
148 | </table> |
||
149 | <?php endforeach; ?> |
||
150 | </div> |
||
151 | </div> |
||
152 | |||
153 | <?php Box::end() ?> |
||
154 | |||
155 | <?php Box::begin(['options' => ['class' => 'box-solid']]) ?> |
||
156 | <div class="row"> |
||
157 | <div class="col-md-12 no"> |
||
158 | <?= Html::submitButton(Yii::t('hipanel', 'Save'), ['class' => 'btn btn-success']) ?> |
||
159 | <?= Html::button(Yii::t('hipanel', 'Cancel'), ['class' => 'btn btn-default', 'onclick' => 'history.go(-1)']) ?> |
||
160 | </div> |
||
161 | </div> |
||
162 | <?php Box::end() ?> |
||
163 | <?php ActiveForm::end(); ?> |
||
164 | </div> |
||
165 | View Code Duplication | <?php else: ?> |
|
0 ignored issues
–
show
|
|||
166 | <?php $box = Box::begin([ |
||
167 | 'title' => Yii::t('hipanel.finance.price', 'No price suggestions for this object'), |
||
168 | ]) ?> |
||
169 | <?= Yii::t('hipanel.finance.price', 'We could not suggest any new prices of type "{suggestionType}" for the selected object. Probably, they were already created earlier or this suggestion type is not compatible with this object type', [ |
||
170 | 'suggestionType' => Yii::t('hipanel.finance.suggestionTypes', 'domain'), |
||
171 | ]) ?> |
||
172 | |||
173 | <br/> |
||
174 | |||
175 | <?= Yii::t('hipanel.finance.price', 'You can return back to plan {backToPlan}', [ |
||
176 | 'backToPlan' => Html::a($plan->name, Url::to(['@plan/view', 'id' => $plan->id])), |
||
177 | ]) ?> |
||
178 | <?= $box->endBody(); ?> |
||
179 | <?php endif ?> |
||
180 |
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.