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 |
||
5 | * @var $model \hipanel\modules\finance\forms\VdsTariffForm |
||
6 | * @var string $action |
||
7 | */ |
||
8 | use hipanel\helpers\Url; |
||
9 | use hipanel\widgets\Box; |
||
10 | use hipanel\widgets\Pjax; |
||
11 | use yii\bootstrap\ActiveForm; |
||
12 | use yii\helpers\Html; |
||
13 | |||
14 | ?> |
||
15 | |||
16 | <?php Pjax::begin(['id' => 'tariff-pjax-container']) ?> |
||
17 | |||
18 | <?php $form = ActiveForm::begin(array_filter([ |
||
19 | 'id' => 'tariff-create-form', |
||
20 | 'action' => isset($action) ? $action : null, |
||
21 | ])) ?> |
||
22 | |||
23 | <?php Box::begin(['options' => ['class' => 'box-solid']]) ?> |
||
24 | <div class="row"> |
||
25 | <div class="col-md-12 no"> |
||
26 | <?= Html::submitButton(Yii::t('hipanel', 'Save'), ['class' => 'btn btn-success']) ?> |
||
27 | <?= Html::button(Yii::t('hipanel', 'Cancel'), ['class' => 'btn btn-default', 'onclick' => 'history.go(-1)']) ?> |
||
28 | </div> |
||
29 | </div> |
||
30 | <?php Box::end() ?> |
||
31 | |||
32 | <?php Box::begin() ?> |
||
33 | <div class="row"> |
||
34 | <div class="col-md-12"> |
||
35 | <?= Html::activeHiddenInput($model, 'id') ?> |
||
36 | <?= Html::activeHiddenInput($model, 'parent_id') ?> |
||
37 | <?= $form->field($model, 'parent_id')->widget(\hipanel\modules\finance\widgets\TariffCombo::class, [ |
||
38 | 'tariffType' => $model->getTariff()->type, |
||
39 | 'inputOptions' => [ |
||
40 | 'id' => 'tariff-parent_id', |
||
41 | 'data-url' => Url::current(['parent_id' => null]), |
||
42 | 'readonly' => isset($model->id), |
||
43 | ], |
||
44 | ]); ?> |
||
45 | <?= $form->field($model, 'name') ?> |
||
46 | <?= $form->field($model, 'note') ?> |
||
47 | <?= $form->field($model, 'label') ?> |
||
48 | </div> |
||
49 | </div> |
||
50 | <?php Box::end() ?> |
||
51 | |||
52 | <?php if (isset($model->parentTariff)): ?> |
||
53 | <div class="row"> |
||
54 | <div class="col-md-4"> |
||
55 | <?php Box::begin(['title' => Yii::t('hipanel:finance:tariff', 'Hardware')]) ?> |
||
56 | <table class="table table-condensed"> |
||
57 | <thead> |
||
58 | <tr> |
||
59 | <th><?= Yii::t('hipanel:finance:tariff', 'Resource') ?></th> |
||
60 | <th><?= Yii::t('hipanel:finance:tariff', 'Model') ?></th> |
||
61 | <th><?= Yii::t('hipanel:finance:tariff', 'Price per period') ?></th> |
||
62 | </tr> |
||
63 | </thead> |
||
64 | <tbody> |
||
65 | <?php $i = 0; ?> |
||
66 | View Code Duplication | <?php foreach ($model->getHardwareResources() as $resource) : ?> |
|
0 ignored issues
–
show
|
|||
67 | <tr> |
||
68 | <td><?= $resource->decorator()->displayTitle() ?></td> |
||
69 | <td><?= $resource->decorator()->displayPrepaidAmount() ?></td> |
||
70 | <td> |
||
71 | <?= Html::activeHiddenInput($resource, "[$i]object_id", [ |
||
72 | 'value' => $resource->realObjectId(), |
||
73 | ]) ?> |
||
74 | <?= Html::activeHiddenInput($resource, "[$i]type") ?> |
||
75 | <?= \hipanel\modules\finance\widgets\ResourcePriceInput::widget([ |
||
76 | 'basePrice' => $model->getParentHardwareResource($resource->object_id)->fee, |
||
77 | 'activeField' => $form->field($resource, "[$i]fee"), |
||
78 | ]) ?> |
||
79 | </td> |
||
80 | </tr> |
||
81 | <?php ++$i; ?> |
||
82 | <?php endforeach ?> |
||
83 | </tbody> |
||
84 | </table> |
||
85 | <?php Box::end() ?> |
||
86 | </div> |
||
87 | <div class="col-md-8"> |
||
88 | <?php Box::begin(['title' => Yii::t('hipanel:finance:tariff', 'Resources')]) ?> |
||
89 | <table class="table table-condensed"> |
||
90 | <thead> |
||
91 | <tr> |
||
92 | <th><?= Yii::t('hipanel:finance:tariff', 'Resource') ?></th> |
||
93 | <th><?= Yii::t('hipanel:finance:tariff', 'Price per period') ?></th> |
||
94 | <th><?= Yii::t('hipanel:finance:tariff', 'Prepaid amount') ?></th> |
||
95 | <th><?= Yii::t('hipanel:finance:tariff', 'Overuse price') ?></th> |
||
96 | </tr> |
||
97 | </thead> |
||
98 | <tbody> |
||
99 | <?php foreach ($model->getOveruseResources() as $resource) : ?> |
||
100 | <tr> |
||
101 | <?php $baseResource = $model->getParentOveruseResource($resource->type_id) ?> |
||
102 | <td><?= $resource->decorator()->displayTitle() ?></td> |
||
103 | <td style="width: 20%"> |
||
104 | <?= Html::activeHiddenInput($resource, "[$i]object_id") ?> |
||
105 | <?= Html::activeHiddenInput($resource, "[$i]type") ?> |
||
106 | <?= \hipanel\modules\finance\widgets\ResourcePriceInput::widget([ |
||
107 | 'basePrice' => $baseResource->fee, |
||
108 | 'activeField' => $form->field($resource, "[$i]fee"), |
||
109 | ]) ?> |
||
110 | </td> |
||
111 | <td> |
||
112 | <div class="row"> |
||
113 | <div class="col-md-6"> |
||
114 | <?php |
||
115 | $activeField = $form->field($resource, "[$i]quantity")->label(false); |
||
116 | |||
117 | echo \hipanel\modules\finance\widgets\PrepaidAmountWidget::widget([ |
||
118 | 'activeField' => $activeField, |
||
119 | 'resource' => $resource, |
||
120 | ]); ?> |
||
121 | </div> |
||
122 | <div class="col-md-6"> |
||
123 | <?= Html::tag('span', '', [ |
||
124 | 'class' => 'base-price text-bold', |
||
125 | 'data-original-price' => $baseResource->decorator()->getPrepaidQuantity(), |
||
126 | ]); ?> |
||
127 | </div> |
||
128 | </div> |
||
129 | <?php |
||
130 | ?> |
||
131 | </td> |
||
132 | <td> |
||
133 | <?= \hipanel\modules\finance\widgets\ResourcePriceInput::widget([ |
||
134 | 'basePrice' => $baseResource->price, |
||
135 | 'activeField' => $form->field($resource, "[$i]price"), |
||
136 | ]) ?> |
||
137 | </td> |
||
138 | </tr> |
||
139 | <?php ++$i; ?> |
||
140 | <?php endforeach; ?> |
||
141 | </tbody> |
||
142 | </table> |
||
143 | |||
144 | <?php Box::end() ?> |
||
145 | </div> |
||
146 | </div> |
||
147 | <?php endif ?> |
||
148 | |||
149 | <?php ActiveForm::end(); ?> |
||
150 | |||
151 | <?php |
||
152 | $this->registerJs(<<<'JS' |
||
153 | $('#tariff-parent_id').on('change', function () { |
||
154 | var fakeInput = $('<input>').attr({'name': 'parent_id', 'value': $(this).val()}); |
||
155 | var formAction = $(this).closest('select').attr('data-url'); |
||
156 | var fakeForm = $('<form>').attr({'method': 'get', 'action': formAction}).html(fakeInput).on('submit', function(event) { |
||
157 | $.pjax.submit(event, '#tariff-pjax-container'); |
||
158 | event.preventDefault(); |
||
159 | }).trigger('submit'); |
||
160 | }); |
||
161 | JS |
||
162 | ); |
||
163 | |||
164 | Pjax::end(); |
||
165 | ?> |
||
166 |
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.