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 | * @var \Spiral\Snapshotter\AggregationHandler\Database\SnapshotRecord $snapshot |
||
4 | * @var \Spiral\Snapshotter\AggregationHandler\Database\IncidentRecord $entity |
||
5 | * @var \Spiral\Snapshotter\Helpers\Timestamps $timestamps |
||
6 | * @var array $occurred |
||
7 | * @var \Spiral\ORM\Entities\RecordSelector $selector |
||
8 | */ |
||
9 | ?> |
||
10 | <extends:vault:layout title="[[Vault : Snapshots]]" class="wide-content"/> |
||
11 | |||
12 | <!--Shared keeper elements--> |
||
13 | <dark:use bundle="vault:bundle"/> |
||
14 | |||
15 | <define:scripts> |
||
16 | <block:scripts/> |
||
17 | <script> |
||
18 | function resizeIframe(obj) { |
||
19 | obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; |
||
20 | obj.contentWindow.document.body.style.padding = 0; |
||
21 | } |
||
22 | </script> |
||
23 | </define:scripts> |
||
24 | |||
25 | <define:styles> |
||
26 | <define:styles/> |
||
27 | <style> |
||
28 | dl dt { |
||
29 | width: 150px; |
||
30 | } |
||
31 | </style> |
||
32 | </define:styles> |
||
33 | |||
34 | <define:actions> |
||
35 | <vault:guard permission="vault.snapshots.remove"> |
||
36 | <?php if ($selector->count()) { ?> |
||
37 | <vault:uri target="snapshots:remove" icon="delete" |
||
38 | class="btn red waves-effect waves-light" |
||
39 | options="<?= ['id' => $snapshot->primaryKey(), 'backToList' => 1] ?>"> |
||
40 | [[Remove]] |
||
41 | </vault:uri> |
||
42 | <?php } ?> |
||
43 | </vault:guard> |
||
44 | <vault:uri target="snapshots" class="btn-flat waves-effect" post-icon="trending_flat"> |
||
45 | [[BACK]] |
||
46 | </vault:uri> |
||
47 | </define:actions> |
||
48 | |||
49 | <define:content> |
||
50 | <tab:wrapper> |
||
51 | <tab:item id="last" title="[[Snapshot]]" icon="announcement"> |
||
52 | <vault:guard permission="vault.snapshots.view"> |
||
53 | <vault:block> |
||
54 | <iframe src="<?= vault()->uri('snapshots:iframe', |
||
55 | ['id' => $snapshot->primaryKey()]) ?>" width="100%" height="100%" |
||
56 | frameborder="0" scrolling="no" |
||
57 | onload="javascript:resizeIframe(this);"></iframe> |
||
58 | </vault:block> |
||
59 | </vault:guard> |
||
60 | </tab:item> |
||
61 | |||
62 | <tab:item id="caption" title="[[Information]]" icon="timeline"> |
||
63 | <div class="row"> |
||
64 | <div class="col s12 m4"> |
||
65 | <vault:block title="[[Statistics:]]"> |
||
66 | <dl> |
||
67 | <dt>[[First occurrence:]]</dt> |
||
68 | <dd> |
||
69 | <?= $timestamps->getTime($snapshot->time_created) ?> |
||
70 | <span class="grey-text"> |
||
71 | (<?= $timestamps->getTime($snapshot->time_created, true) ?>) |
||
72 | </span> |
||
73 | </dd> |
||
74 | <dt>[[Last occurrence:]]</dt> |
||
75 | <?php if ($snapshot->count_occurred > 1) { ?> |
||
76 | <dd> |
||
77 | <?= $timestamps->getTime( |
||
78 | $snapshot->getLastIncident()->time_created |
||
79 | ) ?> |
||
80 | <span class="grey-text"> |
||
81 | (<?= $timestamps->getTime( |
||
82 | $snapshot->getLastIncident()->time_created, |
||
83 | true |
||
84 | ) ?>) |
||
85 | </span> |
||
86 | </dd> |
||
87 | <?php } ?> |
||
88 | |||
89 | <dt>[[Total occurred:]]</dt> |
||
90 | <dd><?= $snapshot->count_occurred ?></dd> |
||
91 | |||
92 | <dt title="[[Daily / Weekly / Monthly / Yearly]]">[[D / W / M / Y:]]</dt> |
||
93 | <dd> |
||
94 | <?= join(' / ', $occurred) ?> |
||
95 | </dd> |
||
96 | </dl> |
||
97 | </vault:block> |
||
98 | <vault:block title="[[Suppression:]]"> |
||
99 | <?php if (spiral(\Spiral\Security\GuardInterface::class)->allows('vault.snapshots.edit')) { |
||
100 | $formAction = vault()->uri('snapshots:suppress', [ |
||
101 | 'id' => $snapshot->primaryKey() |
||
102 | ]); ?> |
||
103 | <spiral:form action="<?= $formAction ?>"> |
||
104 | <input type="checkbox" name="suppression" value="1" id="suppression" |
||
105 | <?= $snapshot->isSuppressionEnabled() ? 'checked' : '' ?>/> |
||
106 | <label for="suppression">[[Enable]]</label> |
||
107 | <p class="grey-text">[[When enabled, snapshot incident history records will be created without source stored.]]</p> |
||
108 | <div class="right-align"> |
||
109 | <input type="submit" value="[[Update]]" |
||
110 | class="btn waves-effect"/> |
||
111 | </div> |
||
112 | </spiral:form> |
||
113 | <?php } else { |
||
114 | $suppressionState = $snapshot->isSuppressionEnabled(); |
||
115 | ?> |
||
116 | <spiral:form> |
||
117 | <input type="checkbox" <?= $suppressionState ? 'checked' : '' ?>/> |
||
118 | <label> |
||
119 | <?= $suppressionState ? '[[Enable]]' : '[[Disabled]]' ?> |
||
120 | </label> |
||
121 | <p class="grey-text">[[When enabled, snapshot incident history records will be created without source stored.]]</p> |
||
122 | </spiral:form> |
||
123 | <?php } ?> |
||
124 | </vault:block> |
||
125 | </div> |
||
126 | <div class="col s12 m8"> |
||
127 | <vault:block title="[[Graphs:]]"> |
||
128 | <div id="chart_div"> |
||
129 | |||
130 | </div> |
||
131 | </vault:block> |
||
132 | </div> |
||
133 | </div> |
||
134 | </tab:item> |
||
135 | |||
136 | <tab:item id="history" title="[[History]]" icon="list"> |
||
137 | <?php if (!$selector->count()) { ?> |
||
138 | <p class="card-panel-title">[[You have only |
||
139 | <a href="#last">one</a> snapshot occurred.]]</p> |
||
140 | <?php } else { ?> |
||
141 | <vault:grid source="<?= $selector ?>" as="entity" color=""> |
||
142 | <grid:cell label="[[ID:]]" value="<?= $entity->primaryKey() ?>"/> |
||
143 | |||
144 | <grid:cell label="[[Occurred:]]"> |
||
145 | <?= $timestamps->getTime($entity->time_created) ?> |
||
146 | <span class="grey-text"> |
||
147 | (<?= $timestamps->getTime($entity->time_created, true) ?>) |
||
148 | </span> |
||
149 | </grid:cell> |
||
150 | |||
151 | <grid:cell label="[[Status:]]" value="<?= e($entity->status) ?>"/> |
||
152 | <grid:cell label="[[Code:]]" value="<?= e($entity->getExceptionCode()) ?>"/> |
||
153 | |||
154 | <grid:cell style="text-align:right"> |
||
155 | <?php if ($entity->status->isStored()) { ?> |
||
156 | <vault:guard permission="vault.snapshots.view"> |
||
157 | <vault:uri target="snapshots:incident" icon="import_contacts" |
||
158 | title="[[View incident]]" |
||
159 | class="btn waves-effect text-left" options="<?= [ |
||
160 | 'id' => $snapshot->primaryKey(), |
||
161 | 'incident' => $entity->primaryKey(), |
||
162 | ] ?>"/> |
||
163 | </vault:guard> |
||
164 | <vault:guard permission="vault.snapshots.edit"> |
||
165 | <vault:uri target="snapshots:suppressIncident" icon="archive" |
||
166 | title="[[Suppress incident]]" |
||
167 | class="btn blue-grey darken-2 waves-effect waves-light" |
||
168 | options="<?= [ |
||
169 | 'id' => $snapshot->primaryKey(), |
||
170 | 'incident' => $entity->primaryKey(), |
||
171 | ] ?>"></vault:uri> |
||
172 | </vault:guard> |
||
173 | <?php } |
||
174 | |||
175 | View Code Duplication | if (!$entity->status->isDeleted()) { ?> |
|
0 ignored issues
–
show
|
|||
176 | <vault:guard permission="vault.snapshots.edit"> |
||
177 | <vault:uri target="snapshots:removeIncident" icon="delete" |
||
178 | title="[[Remove incident]]" |
||
179 | class="btn red waves-effect waves-light" options="<?= [ |
||
180 | 'id' => $snapshot->primaryKey(), |
||
181 | 'incident' => $entity->primaryKey(), |
||
182 | ] ?>"/> |
||
183 | </vault:guard> |
||
184 | <?php } ?> |
||
185 | </grid:cell> |
||
186 | </vault:grid> |
||
187 | <?php } ?> |
||
188 | </tab:item> |
||
189 | </tab:wrapper> |
||
190 | </define:content> |
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.