PluginProbe
HTTP Headers / 1.13.2
HTTP Headers v1.13.2
1.19.5 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.12.0 1.12.1 1.12.2 1.13.0 1.13.1 1.13.2 1.13.3 1.13.4 1.14.0 1.14.1 1.14.2 1.15.0 All 60 releases
http-headers / views / includes / csp-src.inc.php

csp-src.inc.php in HTTP Headers 1.13.2, at views/includes/csp-src.inc.php

85 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $origins = array(
3 'wildcard' => '*',
4 'self' => "'self'",
5 'none' => "'none'",
6 'unsafe-inline' => "'unsafe-inline'",
7 'unsafe-eval' => "'unsafe-eval'",
8 'strict-dynamic' => "'strict-dynamic'",
9 'report-sample' => "'report-sample'",
10 'http' => 'http:',
11 'https' => 'https:',
12 'data' => 'data:',
13 'mediastream' => 'mediastream:',
14 'blob' => 'blob:',
15 'filesystem' => 'filesystem:',
16 );
17
18 foreach ($origins as $k => $origin)
19 {
20 ?>
21 <p<?php echo $origin == '*' || !isset($csp_value[$item]['*']) ? NULL : ' style="display: none"'; ?>>
22 <input type="checkbox"
23 name="hh_content_security_policy_value[<?php echo $item; ?>][<?php echo $origin; ?>]"
24 id="csp-<?php echo $item; ?>-<?php echo $k; ?>"
25 value="1"<?php echo isset($csp_value[$item][$origin]) ? ' checked' : NULL; ?>
26 class="http-header-value"<?php echo $content_security_policy == 1 ? NULL : ' readonly'; ?>>
27 <label for="csp-<?php echo $item; ?>-<?php echo $k; ?>"><?php echo $origin; ?></label>
28 </p>
29 <?php
30 }
31
32 switch ($item) {
33 case 'script-src':
34 $host_sources = array(
35 'js.example.com',
36 'http://js.example.com',
37 'https://js.example.com',
38 );
39 break;
40 case 'style-src':
41 $host_sources = array(
42 'css.example.com',
43 'http://css.example.com',
44 'https://css.example.com',
45 );
46 break;
47 case 'img-src':
48 $host_sources = array(
49 'img.example.com',
50 'http://img.example.com',
51 'https://img.example.com',
52 );
53 break;
54 case 'font-src':
55 $host_sources = array(
56 'font.example.com',
57 'http://font.example.com',
58 'https://font.example.com',
59 );
60 break;
61 case 'default-src':
62 $host_sources = array(
63 'http://*.example.com',
64 'mail.example.com:443',
65 'https://assets.example.com',
66 'cdn.example.com',
67 );
68 break;
69 default:
70 $host_sources = array(
71 'https://store.example.com',
72 'store.example.com',
73 '*.example.com',
74 );
75 }
76 shuffle($host_sources);
77 ?>
78 <p<?php echo !isset($csp_value[$item]['*']) ? NULL : ' style="display: none"'; ?>>
79 <input type="text"
80 name="hh_content_security_policy_value[<?php echo $item; ?>][source]"
81 class="http-header-value"
82 size="40"
83 placeholder="<?php echo $host_sources[0]; ?>"
84 value="<?php echo esc_attr(@$csp_value[$item]['source']); ?>"<?php echo $content_security_policy == 1 ? NULL : ' readonly'; ?>
85 </p>