Compare commits
802 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fad607c6e8 | ||
|
|
d6b56262ce | ||
|
|
c409d8a6ba | ||
|
|
4274b8a737 | ||
|
|
60c1babd93 | ||
|
|
ec6ddd054d | ||
|
|
76c200a56c | ||
|
|
a44be363a6 | ||
|
|
304926260f | ||
|
|
462fca7328 | ||
|
|
884b2ed913 | ||
|
|
af77453bfe | ||
|
|
fa45de6586 | ||
|
|
b4e8458076 | ||
|
|
979b1b0ad8 | ||
|
|
2bee58166b | ||
|
|
3597a89da3 | ||
|
|
f406962dfd | ||
|
|
ce31a0b3fd | ||
|
|
fc2ae594cb | ||
|
|
58c14376d6 | ||
|
|
91c2d4efbe | ||
|
|
e4c12b2c77 | ||
|
|
75d8d0b397 | ||
|
|
f1f7d7dd14 | ||
|
|
06e44b6e2b | ||
|
|
41c07d5b71 | ||
|
|
d198729222 | ||
|
|
4a3e02c1f0 | ||
|
|
074d85b40f | ||
|
|
2e198dbe5c | ||
|
|
ed0ede645a | ||
|
|
79b839c024 | ||
|
|
02797d9abc | ||
|
|
97d035eee9 | ||
|
|
9799e05ce4 | ||
|
|
98c8f519a6 | ||
|
|
6197a97dc1 | ||
|
|
6a85c37b48 | ||
|
|
a1e4374ada | ||
|
|
58835ef81f | ||
|
|
16751d7446 | ||
|
|
e95710d599 | ||
|
|
b366f04743 | ||
|
|
f3c74bd718 | ||
|
|
8e1a1043a5 | ||
|
|
1664896062 | ||
|
|
ec474e2b4c | ||
|
|
84ee5a2192 | ||
|
|
a24db0ca6d | ||
|
|
56c8e90700 | ||
|
|
e9d438f8cf | ||
|
|
41e769d681 | ||
|
|
d8b6d87ade | ||
|
|
506c5ac27a | ||
|
|
c6ba9df18a | ||
|
|
4229d8dda4 | ||
|
|
3b157a8c66 | ||
|
|
b8c2047379 | ||
|
|
28461de7bc | ||
|
|
c51840e760 | ||
|
|
a21d19bdcd | ||
|
|
6c4d9ccbf7 | ||
|
|
d56afda274 | ||
|
|
b8bfd7ff4c | ||
|
|
d1a3defef0 | ||
|
|
08f36243e9 | ||
|
|
e4887362ec | ||
|
|
290d06e2c4 | ||
|
|
9260319ac1 | ||
|
|
78ab90f469 | ||
|
|
34767a14d5 | ||
|
|
d7388f20e6 | ||
|
|
8f488d7701 | ||
|
|
7f56e98009 | ||
|
|
a840905166 | ||
|
|
3757db28f4 | ||
|
|
d31589ba99 | ||
|
|
45b6d8d571 | ||
|
|
11b2d0e1d2 | ||
|
|
d7fc9cde57 | ||
|
|
b162fb6e99 | ||
|
|
2f6e34d878 | ||
|
|
a47ab55cdd | ||
|
|
dd4cfebe75 | ||
|
|
818268482e | ||
|
|
8431a82f2c | ||
|
|
2444158bbb | ||
|
|
003005f295 | ||
|
|
731427255e | ||
|
|
468d20ee57 | ||
|
|
d994379130 | ||
|
|
cd806b19f7 | ||
|
|
e17a2eff4a | ||
|
|
690b25a6f5 | ||
|
|
e31c828f35 | ||
|
|
cdd97b142f | ||
|
|
b2f815617c | ||
|
|
11d358133e | ||
|
|
0e77d5ab94 | ||
|
|
51152ef026 | ||
|
|
f5dc8aa1c9 | ||
|
|
ceaa0fcf5c | ||
|
|
cc372ba89b | ||
|
|
526eb84b71 | ||
|
|
14e54ff41a | ||
|
|
aa76ae4ddc | ||
|
|
f1b7d731bd | ||
|
|
e3587fb346 | ||
|
|
e5c649aba3 | ||
|
|
4a3b64b497 | ||
|
|
54e2f83b17 | ||
|
|
a95233041e | ||
|
|
5165cac4e2 | ||
|
|
d31c4fa37c | ||
|
|
084e72968a | ||
|
|
6ab8cb1d7c | ||
|
|
6589653667 | ||
|
|
c3753478f2 | ||
|
|
b63fc5b508 | ||
|
|
3d2cb879b0 | ||
|
|
8366e57512 | ||
|
|
1c369e5503 | ||
|
|
83f40401be | ||
|
|
19456e9b30 | ||
|
|
7d2c64ce63 | ||
|
|
3f790bc334 | ||
|
|
164e1108e5 | ||
|
|
8fe20251f3 | ||
|
|
a121363dd2 | ||
|
|
7ec777c9dd | ||
|
|
77aa58a0a3 | ||
|
|
1e8bc553b8 | ||
|
|
6df08f6b9a | ||
|
|
5e9e2996d7 | ||
|
|
6f8aa1cbc0 | ||
|
|
b22e70804b | ||
|
|
5789e9a8a4 | ||
|
|
6c55a40606 | ||
|
|
b4f90730cc | ||
|
|
50317da185 | ||
|
|
631e36f4d5 | ||
|
|
a400fc9c65 | ||
|
|
5f9962b6ba | ||
|
|
d6dc71436a | ||
|
|
b6f99958fd | ||
|
|
9a89f06bf0 | ||
|
|
843845a825 | ||
|
|
0b93ba3dde | ||
|
|
bd36145ad6 | ||
|
|
88ccf5b869 | ||
|
|
5866293a25 | ||
|
|
d2711889de | ||
|
|
82af43f598 | ||
|
|
7a36f5edac | ||
|
|
480d21f555 | ||
|
|
2e7133d619 | ||
|
|
85f707af8a | ||
|
|
970a119f23 | ||
|
|
7faebbb197 | ||
|
|
08d505b308 | ||
|
|
1b0649d0cf | ||
|
|
e5c16439e1 | ||
|
|
151d8f8c5c | ||
|
|
08563e9298 | ||
|
|
b51f0821cb | ||
|
|
339d84736e | ||
|
|
7ea1de2a92 | ||
|
|
be373e278f | ||
|
|
61eab6fd93 | ||
|
|
c2b0714b4a | ||
|
|
5c1079e04b | ||
|
|
257f65bd1b | ||
|
|
96ff346e54 | ||
|
|
076b6143ce | ||
|
|
1e3262d691 | ||
|
|
94af32fb82 | ||
|
|
1f63ea10a0 | ||
|
|
fa60c17dbc | ||
|
|
b4c7fb574c | ||
|
|
83fa0059de | ||
|
|
d97957e558 | ||
|
|
9d16790f5b | ||
|
|
b14ab6b1c1 | ||
|
|
b029fe113e | ||
|
|
6ea4655fd8 | ||
|
|
477c99b4de | ||
|
|
eb70e619c9 | ||
|
|
41e4135f71 | ||
|
|
1ce5cf6c00 | ||
|
|
f7441df895 | ||
|
|
69443d95d5 | ||
|
|
11e923453e | ||
|
|
b03eab897a | ||
|
|
25ff78e295 | ||
|
|
6e2b1773a3 | ||
|
|
f3e05742b5 | ||
|
|
001f10f74e | ||
|
|
712aebb864 | ||
|
|
0ae0178b4c | ||
|
|
1d4211a5ce | ||
|
|
28115e6b1d | ||
|
|
68fa0e6576 | ||
|
|
8d8da0986a | ||
|
|
e0e748a0bc | ||
|
|
da785500cc | ||
|
|
02654a256d | ||
|
|
552c6e6cf9 | ||
|
|
86dc57c2cc | ||
|
|
11eb08e031 | ||
|
|
4a4acc5c01 | ||
|
|
899663350d | ||
|
|
689a1fdbd2 | ||
|
|
cec5f33870 | ||
|
|
bd9ef50e94 | ||
|
|
68d579b629 | ||
|
|
0404618c24 | ||
|
|
9b5ce83e8b | ||
|
|
7379398d22 | ||
|
|
d1106dd984 | ||
|
|
b775c2f60e | ||
|
|
407a7c01aa | ||
|
|
bb9331904e | ||
|
|
64d068659f | ||
|
|
e33d7b756f | ||
|
|
283e272b99 | ||
|
|
31d08d532c | ||
|
|
5acd51fdd3 | ||
|
|
6369e160b8 | ||
|
|
5e09d56871 | ||
|
|
0e79e8d670 | ||
|
|
941a25ec9d | ||
|
|
2210d3de12 | ||
|
|
ae01f2cdb9 | ||
|
|
e8e980509f | ||
|
|
b2cd992f92 | ||
|
|
7c44c5ea75 | ||
|
|
b1446d366e | ||
|
|
9bfd5eb17e | ||
|
|
fb555027fd | ||
|
|
05974de4d5 | ||
|
|
9c9bbb81de | ||
|
|
ef7da53806 | ||
|
|
a26ebb375b | ||
|
|
c8bbefb2bb | ||
|
|
a485d9f4f9 | ||
|
|
f8be36d229 | ||
|
|
28f0c3eac4 | ||
|
|
e8f5fc1a8a | ||
|
|
a014b5cc2b | ||
|
|
84f1d94ad6 | ||
|
|
8565dbce8b | ||
|
|
72d1282651 | ||
|
|
d474f2ec8f | ||
|
|
252b42ee57 | ||
|
|
0dfaf376c0 | ||
|
|
2a05b89cc8 | ||
|
|
576c94f83c | ||
|
|
5331127204 | ||
|
|
57f9c439f2 | ||
|
|
c14017c244 | ||
|
|
82cd5986a0 | ||
|
|
032a991b8f | ||
|
|
200f589252 | ||
|
|
3405c7e313 | ||
|
|
30bd81064c | ||
|
|
924a607183 | ||
|
|
f1460d169d | ||
|
|
f5e2afaa0a | ||
|
|
228d07ca66 | ||
|
|
3294bbf9b4 | ||
|
|
a849f35469 | ||
|
|
104383d31e | ||
|
|
1dd9bcbbe0 | ||
|
|
05d57a8af7 | ||
|
|
630ecfb148 | ||
|
|
d545734072 | ||
|
|
c903b759bb | ||
|
|
579854f5a5 | ||
|
|
6b032839ce | ||
|
|
be1d9a045a | ||
|
|
8bc19e3893 | ||
|
|
f9740ff545 | ||
|
|
2b2ca99a2b | ||
|
|
641ee1f8a6 | ||
|
|
52448571ea | ||
|
|
7bba4112b9 | ||
|
|
efd64300c4 | ||
|
|
1f3c208f95 | ||
|
|
4330b08c04 | ||
|
|
1c80118117 | ||
|
|
65fd6ac191 | ||
|
|
291fae1744 | ||
|
|
c458ed8b0c | ||
|
|
7ec62401e7 | ||
|
|
be83c99334 | ||
|
|
7c8dbd370f | ||
|
|
604f37bd17 | ||
|
|
9d6ee0d08f | ||
|
|
7dc2e6cb5f | ||
|
|
fb5fd5a279 | ||
|
|
d3bf80342d | ||
|
|
77502efce7 | ||
|
|
ca34f7a78a | ||
|
|
eae8b8835b | ||
|
|
58c6b4edb1 | ||
|
|
86252a22a0 | ||
|
|
964a1716d7 | ||
|
|
06862240f0 | ||
|
|
3119510ef4 | ||
|
|
b4a8ed8828 | ||
|
|
c182664167 | ||
|
|
4bba24801c | ||
|
|
274e556989 | ||
|
|
74758818e7 | ||
|
|
69a191d4e2 | ||
|
|
f9d949f90c | ||
|
|
130d3e7b16 | ||
|
|
f6e519d779 | ||
|
|
ca807583df | ||
|
|
e6df2d5d40 | ||
|
|
82c1f29eba | ||
|
|
fc78a51235 | ||
|
|
28b3eb9585 | ||
|
|
e9e9214910 | ||
|
|
03a1f9b9b1 | ||
|
|
bee529b7fa | ||
|
|
6e9615261e | ||
|
|
1fad30a43a | ||
|
|
3d5e6152cd | ||
|
|
24f7d88a5c | ||
|
|
d6f42dc88c | ||
|
|
42c28e6590 | ||
|
|
6d8d01058b | ||
|
|
2efe715aa0 | ||
|
|
4c4916a661 | ||
|
|
cf8fbe2224 | ||
|
|
573fd69c95 | ||
|
|
71f502f508 | ||
|
|
f4a9152d8f | ||
|
|
319668d384 | ||
|
|
101e791add | ||
|
|
088eef9728 | ||
|
|
aa592c7369 | ||
|
|
b67749bcdc | ||
|
|
b05105bfdf | ||
|
|
6a10020e9b | ||
|
|
9f85074876 | ||
|
|
45bf41db4c | ||
|
|
06f4907053 | ||
|
|
4f2ee129fd | ||
|
|
373cb912d8 | ||
|
|
f284d67843 | ||
|
|
75172f9e8d | ||
|
|
48a1b9489a | ||
|
|
2e0cb5050f | ||
|
|
6ddbb10b5a | ||
|
|
802e12cf7b | ||
|
|
82b43948b4 | ||
|
|
36cf003ed6 | ||
|
|
2286ea751e | ||
|
|
deb19f2625 | ||
|
|
83fd1ab0ca | ||
|
|
f00a1ca092 | ||
|
|
152b407cb7 | ||
|
|
5c5e736776 | ||
|
|
dc71a582fc | ||
|
|
fc92e2655c | ||
|
|
abe253bc31 | ||
|
|
0559f3c4d6 | ||
|
|
ae2bad5ab4 | ||
|
|
55df79a79c | ||
|
|
32c32a7e7a | ||
|
|
d7ca3a0f1c | ||
|
|
e8489e55a1 | ||
|
|
5c90c3aa97 | ||
|
|
b5e739620d | ||
|
|
a328a95c01 | ||
|
|
11b3ac67b0 | ||
|
|
b8e7122452 | ||
|
|
a6bd323a0e | ||
|
|
4bec449a26 | ||
|
|
2176482e4f | ||
|
|
9c7092292b | ||
|
|
46eeb65ff0 | ||
|
|
dd79a3a78a | ||
|
|
fef9e51c9a | ||
|
|
c27589e8c2 | ||
|
|
1ace011ad2 | ||
|
|
c269a3d363 | ||
|
|
387be846f1 | ||
|
|
a788660efe | ||
|
|
73c8643218 | ||
|
|
cd7b65395f | ||
|
|
1c467d71c7 | ||
|
|
a641dfbfc8 | ||
|
|
268b188133 | ||
|
|
4692d7ef2a | ||
|
|
3b9201fb91 | ||
|
|
6e0f18b200 | ||
|
|
dfee6873da | ||
|
|
50e7311390 | ||
|
|
1c4b88d014 | ||
|
|
0935a9c193 | ||
|
|
8a99bd1d51 | ||
|
|
be1a12821e | ||
|
|
bc9bc84f23 | ||
|
|
e5bb58cd91 | ||
|
|
074b425ee0 | ||
|
|
59e599a952 | ||
|
|
3f523a8b58 | ||
|
|
b4667c92e7 | ||
|
|
2ce488c03c | ||
|
|
e1448859c9 | ||
|
|
8abd041f36 | ||
|
|
dabd4a4a4e | ||
|
|
6ac274a706 | ||
|
|
3d2b672feb | ||
|
|
e621e02f92 | ||
|
|
e3a594f3e7 | ||
|
|
5982f86db4 | ||
|
|
b071b8c2d9 | ||
|
|
185178a91e | ||
|
|
9ca31c10ae | ||
|
|
8784efd063 | ||
|
|
c828e3b0d9 | ||
|
|
45c081990a | ||
|
|
51b2dc7c23 | ||
|
|
9f54e60056 | ||
|
|
5151f50d49 | ||
|
|
9b08d67ea7 | ||
|
|
b002d687c0 | ||
|
|
1d2b697742 | ||
|
|
ac52802caa | ||
|
|
ef3ab72082 | ||
|
|
aede590af0 | ||
|
|
c229c11bdf | ||
|
|
8356860945 | ||
|
|
dd5fa3bfff | ||
|
|
7b29d43c66 | ||
|
|
8d56478187 | ||
|
|
60740973d7 | ||
|
|
453f11dcc4 | ||
|
|
a090e44403 | ||
|
|
a68effe4e7 | ||
|
|
2fb091939f | ||
|
|
71248f0adf | ||
|
|
ca80b6372b | ||
|
|
e306425428 | ||
|
|
f86a115c6a | ||
|
|
ddaadf81d6 | ||
|
|
f65af0067d | ||
|
|
5109443346 | ||
|
|
29a2c78b3f | ||
|
|
9ee661d44c | ||
|
|
ea2fa3be15 | ||
|
|
d7ec7a42ba | ||
|
|
722aed5148 | ||
|
|
17100ad56a | ||
|
|
a76032f668 | ||
|
|
d8d244541a | ||
|
|
ba5d4f2f5d | ||
|
|
dce80c4611 | ||
|
|
eae9c4d78a | ||
|
|
3f606cd953 | ||
|
|
ae581c2da7 | ||
|
|
0fbbd8dae7 | ||
|
|
f4ef5af63b | ||
|
|
3244c968b5 | ||
|
|
dd0689c13f | ||
|
|
e327a39eac | ||
|
|
e2b908ed8b | ||
|
|
aac9ee3ba7 | ||
|
|
1cd776f660 | ||
|
|
427b7492dc | ||
|
|
627e22a2e6 | ||
|
|
7bf8b74693 | ||
|
|
c7f4dc9045 | ||
|
|
f8ed70c5f2 | ||
|
|
94f34aada6 | ||
|
|
2472a52fed | ||
|
|
172915b5be | ||
|
|
ae276a2a59 | ||
|
|
ae115216f6 | ||
|
|
5691b3a8db | ||
|
|
c9815be0c7 | ||
|
|
1814407bfd | ||
|
|
40f2fa432b | ||
|
|
e10732c058 | ||
|
|
cdb00a76ce | ||
|
|
efc5f37850 | ||
|
|
ba1181e8ff | ||
|
|
6023e65f7d | ||
|
|
eff978e5f6 | ||
|
|
daf32b8ac4 | ||
|
|
5228e0f3d6 | ||
|
|
9fc47f55b8 | ||
|
|
435edd53f2 | ||
|
|
c36fb7e809 | ||
|
|
e74a418405 | ||
|
|
7814499b87 | ||
|
|
b62f4ef911 | ||
|
|
b32c2bb994 | ||
|
|
dd9e540ca3 | ||
|
|
272ba3f74e | ||
|
|
d87fc4c717 | ||
|
|
c189ad759b | ||
|
|
f3a7a9c342 | ||
|
|
51d554ab14 | ||
|
|
cb97ff0dc7 | ||
|
|
7b5a425913 | ||
|
|
44d08d6aa9 | ||
|
|
e0e1085c73 | ||
|
|
67df9dbf6b | ||
|
|
2e7dd6f212 | ||
|
|
ed2837f1db | ||
|
|
d45e9e63e6 | ||
|
|
4f0c1894a3 | ||
|
|
a3032fc62a | ||
|
|
6eeaf66e2c | ||
|
|
7f82549e23 | ||
|
|
2bb8f707eb | ||
|
|
37176aa022 | ||
|
|
ad302fb5c2 | ||
|
|
da4ec3e1b5 | ||
|
|
ebedb97fae | ||
|
|
ddd4c2ad3d | ||
|
|
007242e341 | ||
|
|
0932b38364 | ||
|
|
5c0ba566e0 | ||
|
|
67b97dbefd | ||
|
|
4d2f72a814 | ||
|
|
9d1108c2f4 | ||
|
|
cd75bb843a | ||
|
|
fb6393ad8f | ||
|
|
1ba2800a30 | ||
|
|
9d78ad70e6 | ||
|
|
98c675792e | ||
|
|
39b50d05ec | ||
|
|
a6182e2def | ||
|
|
efdb3623e1 | ||
|
|
eef6102088 | ||
|
|
9fe55cb729 | ||
|
|
13870f3ae8 | ||
|
|
ca9670e832 | ||
|
|
29494b71fa | ||
|
|
f2c3b3f165 | ||
|
|
4e402b6378 | ||
|
|
6a22fbbf78 | ||
|
|
27f2217139 | ||
|
|
038bb803db | ||
|
|
67b85e5708 | ||
|
|
a21b1f7df5 | ||
|
|
eb6e66cbf2 | ||
|
|
778fe718ed | ||
|
|
ef080cd80e | ||
|
|
22a4a1824a | ||
|
|
56163f66d8 | ||
|
|
73a7e438ec | ||
|
|
27f4e226f3 | ||
|
|
7357029a28 | ||
|
|
accfd6fa14 | ||
|
|
77dcc37b33 | ||
|
|
5df4b3e7df | ||
|
|
997141efea | ||
|
|
6fe0f56e41 | ||
|
|
8c3b7b518f | ||
|
|
6996f6516c | ||
|
|
60cc071031 | ||
|
|
fe5ab0d8da | ||
|
|
0939d032a5 | ||
|
|
d21391e8ba | ||
|
|
0651dc28c8 | ||
|
|
5b8fea9378 | ||
|
|
eda055acca | ||
|
|
7fb3918773 | ||
|
|
4e38f614f2 | ||
|
|
c7d8cb6d33 | ||
|
|
e211fb891b | ||
|
|
05f3e8f433 | ||
|
|
b6949e12b1 | ||
|
|
0772952e71 | ||
|
|
dc4d5c6953 | ||
|
|
9d45f4d534 | ||
|
|
2b8a9a74be | ||
|
|
d226af5314 | ||
|
|
be5a13fbb1 | ||
|
|
94b43021ff | ||
|
|
0b901af0f0 | ||
|
|
5ead5e9c90 | ||
|
|
1cdaa1d727 | ||
|
|
2c38bca1b5 | ||
|
|
7c45ca220b | ||
|
|
bdb2115c16 | ||
|
|
e23bf72006 | ||
|
|
7c63b78bbb | ||
|
|
b611ebcccb | ||
|
|
722d17b211 | ||
|
|
afbfb810fd | ||
|
|
1d3ae4f2c8 | ||
|
|
9bf784f64e | ||
|
|
116c0e19b2 | ||
|
|
7939187916 | ||
|
|
9d40e0903b | ||
|
|
320adad154 | ||
|
|
c52df5b286 | ||
|
|
30a25c0e8c | ||
|
|
95035afe38 | ||
|
|
62559dd2b4 | ||
|
|
a6473695eb | ||
|
|
edd60d3331 | ||
|
|
c9e4819f3f | ||
|
|
7cf321b24a | ||
|
|
3b96efc04d | ||
|
|
8a17a90b1a | ||
|
|
4da3a87772 | ||
|
|
ab9b92112d | ||
|
|
161e11a8dd | ||
|
|
967bd45a63 | ||
|
|
e1b80b513d | ||
|
|
6abe0bdaec | ||
|
|
7b5069f1b9 | ||
|
|
4429c5e8b2 | ||
|
|
5136824844 | ||
|
|
918e9ed408 | ||
|
|
8e8c97f7f9 | ||
|
|
d86fb7ed23 | ||
|
|
819db2583b | ||
|
|
089fb25da7 | ||
|
|
3d01947f3d | ||
|
|
19d94471d9 | ||
|
|
8d26f583e9 | ||
|
|
12723d4941 | ||
|
|
0455cb96ca | ||
|
|
532c5d1b9f | ||
|
|
565bb55b13 | ||
|
|
744d85ec4c | ||
|
|
5e60b96cd6 | ||
|
|
8b6f708b7c | ||
|
|
5096e2d68d | ||
|
|
b0325983a1 | ||
|
|
7cd6651895 | ||
|
|
4ec376b296 | ||
|
|
8558533a91 | ||
|
|
de4a953bb7 | ||
|
|
26a41a0672 | ||
|
|
a1d38dc05f | ||
|
|
222841f09b | ||
|
|
fce9de7372 | ||
|
|
8332b77fcc | ||
|
|
f4f1315715 | ||
|
|
5d423c9e63 | ||
|
|
895be02237 | ||
|
|
95475f7b52 | ||
|
|
c3da264cfe | ||
|
|
89c4b969d1 | ||
|
|
9dbc04678c | ||
|
|
ed9e524e03 | ||
|
|
c2d75c7030 | ||
|
|
de84419035 | ||
|
|
d9e0854bb7 | ||
|
|
558b779944 | ||
|
|
628b45efeb | ||
|
|
92cf4c16e3 | ||
|
|
3cad16d2b7 | ||
|
|
e7503c3c7a | ||
|
|
db8e643c62 | ||
|
|
a1337df44f | ||
|
|
ee73eaee5c | ||
|
|
94f3b99ad0 | ||
|
|
d0c4d5616a | ||
|
|
38f36841e3 | ||
|
|
340f3bcf8c | ||
|
|
cd1e03c033 | ||
|
|
ba002a1683 | ||
|
|
457e378d1e | ||
|
|
9781674849 | ||
|
|
d9660e66a8 | ||
|
|
25f4f3900e | ||
|
|
83e904c9f7 | ||
|
|
9bbdb1b3b9 | ||
|
|
f6cdc0575b | ||
|
|
2017bc9cf6 | ||
|
|
7e8e28fc90 | ||
|
|
30c883c85d | ||
|
|
16568c11f1 | ||
|
|
f90982347a | ||
|
|
bd5647351e | ||
|
|
ec77e47cd6 | ||
|
|
565866c529 | ||
|
|
e4a262eb7b | ||
|
|
a3f2fa1b16 | ||
|
|
e0ef3e9984 | ||
|
|
bf30c1a3d7 | ||
|
|
c2c573902f | ||
|
|
d874ebf1b0 | ||
|
|
8ef6032570 | ||
|
|
b32a6951da | ||
|
|
b7bc347323 | ||
|
|
07e49e53c5 | ||
|
|
b87db2a82b | ||
|
|
c150d559c7 | ||
|
|
5dce0db661 | ||
|
|
27514d32de | ||
|
|
fe718ef67f | ||
|
|
e132723475 | ||
|
|
72fc9db38d | ||
|
|
1374e08cd4 | ||
|
|
03e48927a3 | ||
|
|
bbf05fa6fd | ||
|
|
6dad29cae7 | ||
|
|
52afba5a86 | ||
|
|
913a53e436 | ||
|
|
4fd68a4153 | ||
|
|
fae58078f8 | ||
|
|
1d319e001c | ||
|
|
927e6fe23a | ||
|
|
b85eb98303 | ||
|
|
643f124e8b | ||
|
|
6fe4027de5 | ||
|
|
f9d79ba5a6 | ||
|
|
2382f526b2 | ||
|
|
1581e08594 | ||
|
|
37ca78913c | ||
|
|
df3b97c5dd | ||
|
|
953e3f5ba6 | ||
|
|
74b73c6446 | ||
|
|
bc80fb71df | ||
|
|
b0279025d0 | ||
|
|
a45712198b | ||
|
|
704a0fce08 | ||
|
|
d6c708e6ee | ||
|
|
1f24ca9ba2 | ||
|
|
c482db8c89 | ||
|
|
c356639ce9 | ||
|
|
8b0572add1 | ||
|
|
61b1adfb3d | ||
|
|
2f5ea4b305 | ||
|
|
ccc321be8a | ||
|
|
b68861c175 | ||
|
|
2ffcba78cc | ||
|
|
855226d01a | ||
|
|
b8e548d1df | ||
|
|
095f1df947 | ||
|
|
4bd91a811d | ||
|
|
c3b45a62ca | ||
|
|
7b354eec0f | ||
|
|
677ed371a9 | ||
|
|
987caa632b | ||
|
|
3df581152d | ||
|
|
f0ca931dfc | ||
|
|
52541f18f1 | ||
|
|
4ee200e9f6 | ||
|
|
47ef9f74a7 | ||
|
|
92478d0e4f | ||
|
|
0fc73b2bbb | ||
|
|
909c6a8bdf | ||
|
|
be387ccf35 | ||
|
|
6f73afe265 | ||
|
|
65d548d4f9 | ||
|
|
682b27fdd8 | ||
|
|
d213d65a24 | ||
|
|
36780d53c2 | ||
|
|
5a3bbd928a | ||
|
|
69854a8e0c | ||
|
|
78667ce08b | ||
|
|
0ef5749925 | ||
|
|
218104e6e2 | ||
|
|
38b7d44e3a | ||
|
|
332cb64b71 | ||
|
|
f1360d8792 | ||
|
|
269c24a398 | ||
|
|
bad427bfba | ||
|
|
4256546115 | ||
|
|
67fb2e1f59 | ||
|
|
8fab2ae8f0 | ||
|
|
2f80477f7d | ||
|
|
71bb3ccc40 | ||
|
|
4d89dbfaa3 | ||
|
|
2b9d6dc9c4 | ||
|
|
75fb18bcec | ||
|
|
44bf843797 | ||
|
|
37cedafa8f | ||
|
|
09adbf8717 | ||
|
|
56b619b777 | ||
|
|
96e7a3ad8c | ||
|
|
859665fbd0 | ||
|
|
d6f3bf112b | ||
|
|
67c02dcc40 | ||
|
|
4fccc86b03 | ||
|
|
a5d041926a | ||
|
|
c971d3fafe | ||
|
|
7c153d5e76 | ||
|
|
7071b812b6 | ||
|
|
a0a2977b7f | ||
|
|
a63cc0759f | ||
|
|
4c10eed3b1 | ||
|
|
827b3cc5f6 | ||
|
|
ac34bfdad2 | ||
|
|
72ce20224d | ||
|
|
609bd557c5 | ||
|
|
87fe3669a1 |
13
.gitignore
vendored
13
.gitignore
vendored
@@ -1,8 +1,17 @@
|
||||
templates/*
|
||||
logs/*
|
||||
install/update.log
|
||||
templates/*
|
||||
lib/userdata.inc.php
|
||||
logs/*
|
||||
.buildpath
|
||||
.project
|
||||
.settings/
|
||||
*.diff
|
||||
*~
|
||||
.well-known
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
!templates/Froxlor/
|
||||
!templates/Sparkle/
|
||||
!templates/misc/
|
||||
templates/Froxlor/assets/img/logo_custom.png
|
||||
|
||||
16
README.md
16
README.md
@@ -51,10 +51,24 @@ http://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](http://files.froxl
|
||||
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationdebian)
|
||||
|
||||
/etc/apt/sources.list.d/froxlor.list
|
||||
> deb http://debian.froxlor.org [squeeze|wheezy] main
|
||||
> deb http://debian.froxlor.org {wheezy|jessie} main
|
||||
|
||||
### Gentoo repository
|
||||
|
||||
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationgentoo)
|
||||
|
||||
http://files.froxlor.org/gentoo/repositories.xml
|
||||
|
||||
## Let's Encrypt support
|
||||
|
||||
This version of Froxlor contains a test implementation of support for [Let's Encrypt](https://letsencrypt.org). This is (as Let's Encrypt is in itself)
|
||||
still a beta version and may break your system. The way it currently works is by creating a (sub-)domain with the default system - certificate,
|
||||
after which the Let's Encrypt cronjob orders the certificate for this (sub-)domain and inserts the certificates in the database. With the next run
|
||||
of the default cronjob, the certificates will be updated on the disk and the webserver reloaded.
|
||||
|
||||
This has 2 known side-effects at the moment:
|
||||
* The basic ip/port combinations don't work with the Froxlor - integration of Let's Encrypt, since it needs a certificate for the very first creation
|
||||
* After creating a domain, it will have the default certificate for a short time (by default 5 minutes until the cronjob runs the next time)
|
||||
|
||||
It may be possible to fix these issues, but they are not a priority at the moment
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ return array(
|
||||
'settinggroup' => 'admin',
|
||||
'varname' => 'show_news_feed',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customer_show_news_feed' => array(
|
||||
@@ -190,7 +190,7 @@ return array(
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'show_news_feed',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customer_news_feed_url' => array(
|
||||
@@ -227,6 +227,31 @@ return array(
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_customer_hide_options' => array(
|
||||
'label' => $lng['serversettings']['panel_customer_hide_options'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'customer_hide_options',
|
||||
'type' => 'option',
|
||||
'default' => '',
|
||||
'option_mode' => 'multiple',
|
||||
'option_emptyallowed' => true,
|
||||
'option_options' => array(
|
||||
'email' => $lng['menue']['email']['email'],
|
||||
'mysql' => $lng['menue']['mysql']['mysql'],
|
||||
'domains' => $lng['menue']['domains']['domains'],
|
||||
'ftp' => $lng['menue']['ftp']['ftp'],
|
||||
'extras' => $lng['menue']['extras']['extras'],
|
||||
'extras.directoryprotection' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['directoryprotection'],
|
||||
'extras.pathoptions' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['pathoptions'],
|
||||
'extras.logger' => $lng['menue']['extras']['extras']." / ".$lng['menue']['logger']['logger'],
|
||||
'extras.backup' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['backup'],
|
||||
'traffic' => $lng['menue']['traffic']['traffic'],
|
||||
'traffic.http' => $lng['menue']['traffic']['traffic']." / HTTP",
|
||||
'traffic.ftp' => $lng['menue']['traffic']['traffic']." / FTP",
|
||||
'traffic.mail' => $lng['menue']['traffic']['traffic']." / Mail",
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -107,7 +107,7 @@ return array(
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'password_special_char',
|
||||
'type' => 'string',
|
||||
'default' => '!?<>§$%&+#=@',
|
||||
'default' => '!?<>§$%+#=@',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_password_regex' => array(
|
||||
@@ -183,11 +183,19 @@ return array(
|
||||
'varname' => 'allow_preset',
|
||||
),
|
||||
'onlyif' => 1
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'system_backupenabled' => array(
|
||||
'label' => $lng['serversettings']['backupenabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'backupenabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'cronmodule' => 'froxlor/backup',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -55,7 +55,7 @@ return array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'defaultip',
|
||||
'type' => 'option',
|
||||
'option_mode' => 'one',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options_method' => 'getIpPortCombinations',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingDefaultIp',
|
||||
@@ -69,14 +69,6 @@ return array(
|
||||
'save_method' => 'storeSettingHostname',
|
||||
'plausibility_check_method' => 'checkHostname',
|
||||
),
|
||||
'system_froxlordirectlyviahostname' => array(
|
||||
'label' => $lng['serversettings']['froxlordirectlyviahostname'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'froxlordirectlyviahostname',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_validatedomain' => array(
|
||||
'label' => $lng['serversettings']['validate_domain'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -145,7 +137,7 @@ return array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'report_webmax',
|
||||
'type' => 'int',
|
||||
'int_min' => 1,
|
||||
'int_min' => 0,
|
||||
'int_max' => 150,
|
||||
'default' => 90,
|
||||
'save_method' => 'storeSettingField',
|
||||
@@ -155,11 +147,70 @@ return array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'report_trafficmax',
|
||||
'type' => 'int',
|
||||
'int_min' => 1,
|
||||
'int_min' => 0,
|
||||
'int_max' => 150,
|
||||
'default' => 90,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
|
||||
'system_mail_use_smtp' => array(
|
||||
'label' => $lng['serversettings']['mail_use_smtp'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_use_smtp',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_smtp_host' => array(
|
||||
'label' => $lng['serversettings']['mail_smtp_host'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_smtp_host',
|
||||
'type' => 'string',
|
||||
'default' => 'localhost',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_smtp_port' => array(
|
||||
'label' => $lng['serversettings']['mail_smtp_port'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_smtp_port',
|
||||
'type' => 'int',
|
||||
'int_min' => 1,
|
||||
'int_max' => 65535,
|
||||
'default' => 25,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_smtp_usetls' => array(
|
||||
'label' => $lng['serversettings']['mail_smtp_usetls'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_smtp_usetls',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_smtp_auth' => array(
|
||||
'label' => $lng['serversettings']['mail_smtp_auth'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_smtp_auth',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_smtp_user' => array(
|
||||
'label' => $lng['serversettings']['mail_smtp_user'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_smtp_user',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_smtp_passwd' => array(
|
||||
'label' => $lng['serversettings']['mail_smtp_passwd'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_smtp_passwd',
|
||||
'type' => 'hiddenString',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
163
actions/admin/settings/122.froxlorvhost.php
Normal file
163
actions/admin/settings/122.froxlorvhost.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2016 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2016-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'groups' => array(
|
||||
'froxlorvhost' => array(
|
||||
'title' => $lng['admin']['froxlorvhost'],
|
||||
'fields' => array(
|
||||
/**
|
||||
* Webserver-Vhost
|
||||
*/
|
||||
'system_froxlordirectlyviahostname' => array(
|
||||
'label' => $lng['serversettings']['froxlordirectlyviahostname'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'froxlordirectlyviahostname',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
/**
|
||||
* SSL / Let's Encrypt
|
||||
*/
|
||||
'system_le_froxlor_enabled' => array(
|
||||
'label' => $lng['serversettings']['le_froxlor_enabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'le_froxlor_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingClearCertificates',
|
||||
'visible' => Settings::Get('system.leenabled')
|
||||
),
|
||||
'system_le_froxlor_redirect' => array(
|
||||
'label' => $lng['serversettings']['le_froxlor_redirect'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'le_froxlor_redirect',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'visible' => Settings::Get('system.leenabled')
|
||||
),
|
||||
/**
|
||||
* FCGID
|
||||
*/
|
||||
'system_mod_fcgid_enabled_ownvhost' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid_ownvhost'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_ownvhost',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
),
|
||||
'visible' => Settings::Get('system.mod_fcgid')
|
||||
),
|
||||
'system_mod_fcgid_httpuser' => array(
|
||||
'label' => $lng['admin']['mod_fcgid_user'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_httpuser',
|
||||
'type' => 'string',
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingWebserverFcgidFpmUser',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
),
|
||||
'visible' => Settings::Get('system.mod_fcgid')
|
||||
),
|
||||
'system_mod_fcgid_httpgroup' => array(
|
||||
'label' => $lng['admin']['mod_fcgid_group'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_httpgroup',
|
||||
'type' => 'string',
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
),
|
||||
'visible' => Settings::Get('system.mod_fcgid')
|
||||
),
|
||||
'system_mod_fcgid_defaultini_ownvhost' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_defaultini_ownvhost',
|
||||
'type' => 'option',
|
||||
'default' => '2',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
),
|
||||
'visible' => Settings::Get('system.mod_fcgid')
|
||||
),
|
||||
/**
|
||||
* php-fpm
|
||||
*/
|
||||
'system_phpfpm_enabled_ownvhost' => array(
|
||||
'label' => $lng['phpfpm']['ownvhost'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'enabled_ownvhost',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
'visible' => Settings::Get('phpfpm.enabled')
|
||||
),
|
||||
'system_phpfpm_httpuser' => array(
|
||||
'label' => $lng['phpfpm']['vhost_httpuser'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'vhost_httpuser',
|
||||
'type' => 'string',
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingWebserverFcgidFpmUser',
|
||||
'visible' => Settings::Get('phpfpm.enabled')
|
||||
),
|
||||
'system_phpfpm_httpgroup' => array(
|
||||
'label' => $lng['phpfpm']['vhost_httpgroup'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'vhost_httpgroup',
|
||||
'type' => 'string',
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingField',
|
||||
'visible' => Settings::Get('phpfpm.enabled')
|
||||
),
|
||||
'system_phpfpm_defaultini_ownvhost' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'vhost_defaultini',
|
||||
'type' => 'option',
|
||||
'default' => '2',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField',
|
||||
'visible' => Settings::Get('phpfpm.enabled')
|
||||
),
|
||||
/**
|
||||
* DNS
|
||||
*/
|
||||
'system_dns_createhostnameentry' => array(
|
||||
'label' => $lng['serversettings']['dns_createhostnameentry'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dns_createhostnameentry',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'visible' => Settings::Get('system.bind_enable')
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -29,20 +29,12 @@ return array(
|
||||
'default' => '/etc/cron.d/froxlor',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_send_cron_errors' => array(
|
||||
'label' => $lng['serversettings']['system_send_cron_errors'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'send_cron_errors',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_croncmdline' => array(
|
||||
'label' => $lng['serversettings']['system_croncmdline'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'croncmdline',
|
||||
'type' => 'string',
|
||||
'default' => '/usr/bin/nice -n 5 /usr/bin/php5 -q',
|
||||
'default' => '/usr/bin/nice -n 5 /usr/bin/php -q',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_crondreload' => array(
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* @package Settings
|
||||
*
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'webserver' => array(
|
||||
@@ -29,11 +28,15 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => 'apache2',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array('apache2' => 'Apache 2', 'lighttpd' => 'ligHTTPd', 'nginx' => 'Nginx'),
|
||||
'option_options' => array(
|
||||
'apache2' => 'Apache 2',
|
||||
'lighttpd' => 'ligHTTPd',
|
||||
'nginx' => 'Nginx'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
'plausibility_check_method' => 'checkPhpInterfaceSetting',
|
||||
'overview_option' => true
|
||||
),
|
||||
),
|
||||
'system_apache_24' => array(
|
||||
'label' => $lng['serversettings']['apache_24'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -41,24 +44,38 @@ return array(
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2')
|
||||
),
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_apache_itksupport' => array(
|
||||
'label' => $lng['serversettings']['apache_itksupport'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apacheitksupport',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0),
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_httpuser' => array(
|
||||
'label' => $lng['admin']['webserver_user'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpuser',
|
||||
'type' => 'string',
|
||||
'default' => 'www-data',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingWebserverFcgidFpmUser'
|
||||
),
|
||||
'system_httpgroup' => array(
|
||||
'label' => $lng['admin']['webserver_group'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpgroup',
|
||||
'type' => 'string',
|
||||
'default' => 'www-data',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_apacheconf_vhost' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_vhost'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -66,8 +83,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'filedir',
|
||||
'default' => '/etc/apache2/sites-enabled/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_apacheconf_diroptions' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_diroptions'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -75,8 +92,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'filedir',
|
||||
'default' => '/etc/apache2/sites-enabled/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_apacheconf_htpasswddir' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_htpasswddir'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -84,8 +101,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'confdir',
|
||||
'default' => '/etc/apache2/htpasswd/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_logfiles_directory' => array(
|
||||
'label' => $lng['serversettings']['logfiles_directory'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -93,8 +110,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/logs/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_customersslpath' => array(
|
||||
'label' => $lng['serversettings']['customerssl_directory'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -102,8 +119,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'confdir',
|
||||
'default' => '/etc/ssl/froxlor-custom/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpappendopenbasedir' => array(
|
||||
'label' => $lng['serversettings']['phpappendopenbasedir'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -111,8 +128,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_deactivateddocroot' => array(
|
||||
'label' => $lng['serversettings']['deactivateddocroot'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -121,24 +138,36 @@ return array(
|
||||
'string_type' => 'dir',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_default_vhostconf' => array(
|
||||
'label' => $lng['serversettings']['default_vhostconf'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'default_vhostconf',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_apache_globaldiropt' => array(
|
||||
'label' => $lng['serversettings']['apache_globaldiropt'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apacheglobaldiropt',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0),
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_apachereload_command' => array(
|
||||
'label' => $lng['serversettings']['apachereload_command'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apachereload_command',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/apache2 reload',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpreload_command' => array(
|
||||
'label' => $lng['serversettings']['phpreload_command'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -146,8 +175,10 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('nginx')
|
||||
),
|
||||
'websrv_avail' => array(
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'system_nginx_php_backend' => array(
|
||||
'label' => $lng['serversettings']['nginx_php_backend'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -155,8 +186,10 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '127.0.0.1:8888',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('nginx')
|
||||
),
|
||||
'websrv_avail' => array(
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'nginx_fastcgiparams' => array(
|
||||
'label' => $lng['serversettings']['nginx_fastcgiparams'],
|
||||
'settinggroup' => 'nginx',
|
||||
@@ -165,16 +198,18 @@ return array(
|
||||
'string_type' => 'file',
|
||||
'default' => '/etc/nginx/fastcgi_params',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('nginx')
|
||||
),
|
||||
'websrv_avail' => array(
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'defaultwebsrverrhandler_enabled' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'defaultwebsrverrhandler_err401' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_err401'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
@@ -182,8 +217,11 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2', 'nginx')
|
||||
),
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'defaultwebsrverrhandler_err403' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
@@ -191,16 +229,19 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2', 'nginx')
|
||||
),
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'defaultwebsrverrhandler_err404' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
'varname' => 'err404',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'defaultwebsrverrhandler_err500' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_err500'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
@@ -208,17 +249,19 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2', 'nginx')
|
||||
),
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'customredirect_enabled' => array(
|
||||
'label' => $lng['serversettings']['customredirect_enabled'],
|
||||
'settinggroup' => 'customredirect',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2', 'lighttpd')
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'customredirect_default' => array(
|
||||
'label' => $lng['serversettings']['customredirect_default'],
|
||||
'settinggroup' => 'customredirect',
|
||||
@@ -227,10 +270,9 @@ return array(
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getRedirectCodes',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2', 'lighttpd')
|
||||
)
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
)
|
||||
);
|
||||
|
||||
@@ -16,71 +16,171 @@
|
||||
* @package Settings
|
||||
*
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'ssl' => array(
|
||||
'title' => $lng['admin']['sslsettings'],
|
||||
'fields' => array(
|
||||
'system_ssl_enabled' => array(
|
||||
'label' => $lng['serversettings']['ssl']['use_ssl'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'use_ssl',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_ssl_cipher_list' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_cipher_list'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cipher_list',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => 'ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_cert_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cert_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/etc/apache2/apache2.pem',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_key_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_key_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_key_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/etc/apache2/apache2.key',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_cert_chainfile' => array(
|
||||
'label' => $lng['admin']['ipsandports']['ssl_cert_chainfile'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cert_chainfile',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_ca_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_ca_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
)
|
||||
)
|
||||
'ssl' => array(
|
||||
'title' => $lng['admin']['sslsettings'],
|
||||
'fields' => array(
|
||||
'system_ssl_enabled' => array(
|
||||
'label' => $lng['serversettings']['ssl']['use_ssl'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'use_ssl',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_ssl_cipher_list' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_cipher_list'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cipher_list',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_ssl_cert_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cert_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/etc/apache2/apache2.pem',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_ssl_key_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_key_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_key_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/etc/apache2/apache2.key',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_ssl_cert_chainfile' => array(
|
||||
'label' => $lng['admin']['ipsandports']['ssl_cert_chainfile'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cert_chainfile',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_ssl_ca_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_ca_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_leenabled' => array(
|
||||
'label' => $lng['serversettings']['leenabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'leenabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'cronmodule' => 'froxlor/letsencrypt',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_letsencryptacmeconf' => array(
|
||||
'label' => $lng['serversettings']['letsencryptacmeconf'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptacmeconf',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'default' => '/etc/apache2/conf-enabled/acme.conf',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_letsencryptca' => array(
|
||||
'label' => $lng['serversettings']['letsencryptca'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptca',
|
||||
'type' => 'option',
|
||||
'default' => 'testing',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'testing' => 'https://acme-staging.api.letsencrypt.org (Test)',
|
||||
'production' => 'https://acme-v01.api.letsencrypt.org (Live)'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_letsencryptcountrycode' => array(
|
||||
'label' => $lng['serversettings']['letsencryptcountrycode'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptcountrycode',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => 'DE',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_letsencryptstate' => array(
|
||||
'label' => $lng['serversettings']['letsencryptstate'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptstate',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => 'Hessen',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_letsencryptchallengepath' => array(
|
||||
'label' => $lng['serversettings']['letsencryptchallengepath'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptchallengepath',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => FROXLOR_INSTALL_DIR,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_letsencryptkeysize' => array(
|
||||
'label' => $lng['serversettings']['letsencryptkeysize'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptkeysize',
|
||||
'type' => 'int',
|
||||
'int_min' => 2048,
|
||||
'default' => 4096,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_letsencryptreuseold' => array(
|
||||
'label' => $lng['serversettings']['letsencryptreuseold'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptreuseold',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_hsts_maxage' => array(
|
||||
'label' => $lng['admin']['domain_hsts_maxage'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'hsts_maxage',
|
||||
'type' => 'int',
|
||||
'int_min' => 0,
|
||||
'int_max' => 94608000, // 3-years
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_hsts_incsub' => array(
|
||||
'label' => $lng['admin']['domain_hsts_incsub'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'hsts_incsub',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_hsts_preload' => array(
|
||||
'label' => $lng['admin']['domain_hsts_preload'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'hsts_preload',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
)
|
||||
);
|
||||
|
||||
@@ -97,44 +97,6 @@ return array(
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_enabled_ownvhost' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid_ownvhost'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_ownvhost',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2')
|
||||
),
|
||||
'system_mod_fcgid_httpuser' => array(
|
||||
'label' => $lng['admin']['mod_fcgid_user'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_httpuser',
|
||||
'type' => 'string',
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2')
|
||||
),
|
||||
'system_mod_fcgid_httpgroup' => array(
|
||||
'label' => $lng['admin']['mod_fcgid_group'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_httpgroup',
|
||||
'type' => 'string',
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2')
|
||||
),
|
||||
'system_mod_fcgid_defaultini_ownvhost' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_defaultini_ownvhost',
|
||||
'type' => 'option',
|
||||
'default' => '2',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array('apache2')
|
||||
),
|
||||
'system_mod_fcgid_idle_timeout' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['idle_timeout'],
|
||||
'settinggroup' => 'system',
|
||||
|
||||
@@ -30,30 +30,6 @@ return array(
|
||||
'plausibility_check_method' => 'checkFcgidPhpFpm',
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_phpfpm_enabled_ownvhost' => array(
|
||||
'label' => $lng['phpfpm']['ownvhost'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'enabled_ownvhost',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_httpuser' => array(
|
||||
'label' => $lng['phpfpm']['vhost_httpuser'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'vhost_httpuser',
|
||||
'type' => 'string',
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_httpgroup' => array(
|
||||
'label' => $lng['phpfpm']['vhost_httpgroup'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'vhost_httpgroup',
|
||||
'type' => 'string',
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_defaultini' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
@@ -64,16 +40,6 @@ return array(
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_defaultini_ownvhost' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'vhost_defaultini',
|
||||
'type' => 'option',
|
||||
'default' => '2',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_configdir' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
|
||||
@@ -31,6 +31,24 @@ return array(
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_dnsenabled' => array(
|
||||
'label' => $lng['serversettings']['dnseditorenable'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dnsenabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_dns_server' => array(
|
||||
'label' => $lng['serversettings']['dns_server'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dns_server',
|
||||
'type' => 'option',
|
||||
'default' => 'bind',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array('bind' => 'Bind9', 'pdns' => 'PowerDNS'),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_bindconf_directory' => array(
|
||||
'label' => $lng['serversettings']['bindconf_directory'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -73,20 +91,12 @@ return array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'axfrservers',
|
||||
'type' => 'string',
|
||||
'string_type' => 'validate_ip',
|
||||
'string_type' => 'validate_ip_incl_private',
|
||||
'string_delimiter' => ',',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_dns_createhostnameentry' => array(
|
||||
'label' => $lng['serversettings']['dns_createhostnameentry'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dns_createhostnameentry',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_dns_createmailentry' => array(
|
||||
'label' => $lng['serversettings']['mail_also_with_mxservers'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -109,5 +119,3 @@ return array(
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -65,8 +65,14 @@ return array(
|
||||
'label' => $lng['serversettings']['logger']['logcron'],
|
||||
'settinggroup' => 'logger',
|
||||
'varname' => 'log_cron',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'type' => 'option',
|
||||
'default' => 0,
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
0 => $lng['serversettings']['logger']['logcronoption']['never'],
|
||||
1 => $lng['serversettings']['logger']['logcronoption']['once'],
|
||||
2 => $lng['serversettings']['logger']['logcronoption']['always']
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
|
||||
@@ -34,7 +34,7 @@ return array(
|
||||
'settinggroup' => 'spf',
|
||||
'varname' => 'spf_entry',
|
||||
'type' => 'string',
|
||||
'default' => '@ IN TXT "v=spf1 a mx -all"',
|
||||
'default' => '"v=spf1 a mx -all"',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
|
||||
@@ -63,6 +63,23 @@ return array(
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_allow_customer_shell' => array(
|
||||
'label' => $lng['serversettings']['allow_allow_customer_shell'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'allow_customer_shell',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_available_shells' => array(
|
||||
'label' => $lng['serversettings']['available_shells'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'available_shells',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -155,7 +155,6 @@ if ($page == 'admins'
|
||||
if ($result['loginname'] != '') {
|
||||
if ($result['adminid'] == $userinfo['userid']) {
|
||||
standard_error('youcantdeleteyourself');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['send'])
|
||||
@@ -446,19 +445,12 @@ if ($page == 'admins'
|
||||
}
|
||||
|
||||
$ipaddress = makeoption($lng['admin']['allips'], "-1");
|
||||
$ips = array();
|
||||
$ipsandports_stmt = Database::query("
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip`, `port` ASC
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip` ASC
|
||||
");
|
||||
|
||||
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
if (!in_array($row['ip'], $ips)) {
|
||||
$ipaddress.= makeoption($row['ip'], $row['id']);
|
||||
$ips[] = $row['ip'];
|
||||
}
|
||||
$ipaddress.= makeoption($row['ip'], $row['id']);
|
||||
}
|
||||
|
||||
$customers_ul = makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
@@ -853,19 +845,12 @@ if ($page == 'admins'
|
||||
}
|
||||
|
||||
$ipaddress = makeoption($lng['admin']['allips'], "-1", $result['ip']);
|
||||
$ips = array();
|
||||
$ipsandports_stmt = Database::query("
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip`, `port` ASC
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip`, `port` ASC
|
||||
");
|
||||
|
||||
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
if (!in_array($row['ip'], $ips)) {
|
||||
$ipaddress.= makeoption($row['ip'], $row['id'], $result['ip']);
|
||||
$ips[] = $row['ip'];
|
||||
}
|
||||
$ipaddress.= makeoption($row['ip'], $row['id'], $result['ip']);
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
|
||||
415
admin_apcuinfo.php
Normal file
415
admin_apcuinfo.php
Normal file
@@ -0,0 +1,415 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| APC |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2006-2011 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Ralf Becker <beckerr@php.net> |
|
||||
| Rasmus Lerdorf <rasmus@php.net> |
|
||||
| Ilia Alshanetsky <ilia@prohost.org> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
All other licensing and usage conditions are those of the PHP Group.
|
||||
|
||||
Based on https://github.com/krakjoe/apcu/blob/master/apc.php
|
||||
Implemented into Froxlor: Janos Muzsi <muzsij@hypernics.hu>
|
||||
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
|
||||
$horizontal_bar_size = 950; // 1280px window width
|
||||
|
||||
if ($action == 'delete' &&
|
||||
function_exists('apcu_clear_cache') &&
|
||||
$userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
apcu_clear_cache();
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "cleared APCu cache");
|
||||
header('Location: ' . $linker->getLink(array('section' => 'apcuinfo', 'page' => 'showinfo')));
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!function_exists('apcu_cache_info') ||
|
||||
!function_exists('apcu_sma_info')
|
||||
) {
|
||||
standard_error($lng['error']['no_apcuinfo']);
|
||||
}
|
||||
|
||||
if ($page == 'showinfo'
|
||||
) {
|
||||
$cache = apcu_cache_info();
|
||||
$mem = apcu_sma_info();
|
||||
$time = time();
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_apcuinfo");
|
||||
|
||||
$passtime = $time - $cache['start_time'] > 0 ? $time - $cache['start_time'] : 1; // zero division
|
||||
$mem_size = $mem['num_seg'] * $mem['seg_size'];
|
||||
$mem_avail = $mem['avail_mem'];
|
||||
$mem_used = $mem_size - $mem_avail;
|
||||
$seg_size = bsize($mem['seg_size']);
|
||||
$sharedmem = sprintf($lng['apcuinfo']['sharedmemval'], $mem['num_seg'], $seg_size, $cache['memory_type']);
|
||||
$req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'] + $cache['num_misses']) / $passtime) : 0);
|
||||
$hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']) / $passtime) : 0);
|
||||
$miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses']) / $passtime) : 0);
|
||||
$insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts']) / $passtime) : 0);
|
||||
$apcversion = phpversion('apcu');
|
||||
$phpversion = phpversion();
|
||||
$number_vars = $cache['num_entries'];
|
||||
$starttime = date('Y-m-d H:i:s', $cache['start_time']);
|
||||
$uptime_duration = duration($cache['start_time']);
|
||||
$size_vars = bsize($cache['mem_size']);
|
||||
|
||||
// check for possible empty values that are used in the templates
|
||||
if (!isset($cache['file_upload_progress'])) {
|
||||
$cache['file_upload_progress'] = $lng['logger']['unknown'];
|
||||
}
|
||||
|
||||
if (!isset($cache['num_expunges'])) {
|
||||
$cache['num_expunges'] = $lng['logger']['unknown'];
|
||||
}
|
||||
|
||||
$runtimelines = '';
|
||||
foreach (ini_get_all('apcu') as $name => $v) {
|
||||
$value = $v['local_value'];
|
||||
eval("\$runtimelines.=\"" . getTemplate("settings/apcuinfo/runtime_line") . "\";");
|
||||
}
|
||||
|
||||
$freemem = bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size);
|
||||
$usedmem = bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size);
|
||||
$hits = $cache['num_hits'] . @sprintf(" (%.1f%%)", $cache['num_hits'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
|
||||
$misses = $cache['num_misses'] . @sprintf(" (%.1f%%)", $cache['num_misses'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
|
||||
|
||||
// Fragementation: (freeseg - 1) / total_seg
|
||||
$nseg = $freeseg = $fragsize = $freetotal = 0;
|
||||
for ($i = 0; $i < $mem['num_seg']; $i++) {
|
||||
$ptr = 0;
|
||||
foreach ($mem['block_lists'][$i] as $block) {
|
||||
if ($block['offset'] != $ptr) {
|
||||
++$nseg;
|
||||
}
|
||||
$ptr = $block['offset'] + $block['size'];
|
||||
/* Only consider blocks <5M for the fragmentation % */
|
||||
if ($block['size'] < (5 * 1024 * 1024))
|
||||
$fragsize+=$block['size'];
|
||||
$freetotal+=$block['size'];
|
||||
}
|
||||
$freeseg += count($mem['block_lists'][$i]);
|
||||
}
|
||||
|
||||
if ($freeseg > 1) {
|
||||
$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize / $freetotal) * 100, bsize($fragsize), bsize($freetotal), $freeseg);
|
||||
} else {
|
||||
$frag = "0%";
|
||||
}
|
||||
|
||||
foreach (ini_get_all('apcu') as $name => $v) {
|
||||
$value = $v['local_value'];
|
||||
}
|
||||
|
||||
$img_src1 = '';
|
||||
$img_src2 = '';
|
||||
$img_src3 = '';
|
||||
if (graphics_avail()) {
|
||||
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img1', 'action' => mt_rand(0, 1000000)));
|
||||
eval("\$img_src1=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
|
||||
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img2', 'action' => mt_rand(0, 1000000)));
|
||||
eval("\$img_src2=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
|
||||
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img3', 'action' => mt_rand(0, 1000000)));
|
||||
eval("\$img_src3=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("settings/apcuinfo/showinfo") . "\";");
|
||||
|
||||
} elseif ($page == 'img1'
|
||||
) {
|
||||
|
||||
$mem = apcu_sma_info();
|
||||
|
||||
$size = 460;
|
||||
$image = imagecreate($size + 5, $size + 5);
|
||||
|
||||
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
|
||||
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
|
||||
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
|
||||
$col_black = imagecolorallocate($image, 0, 0, 0);
|
||||
|
||||
imagecolortransparent($image, $col_white);
|
||||
|
||||
$s = $mem['num_seg'] * $mem['seg_size'];
|
||||
$a = $mem['avail_mem'];
|
||||
$x = $y = $size / 2;
|
||||
$fuzz = 0.000001;
|
||||
|
||||
// This block of code creates the pie chart. It is a lot more complex than you
|
||||
// would expect because we try to visualize any memory fragmentation as well.
|
||||
$angle_from = 0;
|
||||
$string_placement = array();
|
||||
for ($i = 0; $i < $mem['num_seg']; $i++) {
|
||||
$ptr = 0;
|
||||
$free = $mem['block_lists'][$i];
|
||||
uasort($free, 'block_sort');
|
||||
foreach ($free as $block) {
|
||||
if ($block['offset'] != $ptr) { // Used block
|
||||
$angle_to = $angle_from + ($block['offset'] - $ptr) / $s;
|
||||
if (($angle_to + $fuzz) > 1)
|
||||
$angle_to = 1;
|
||||
if (($angle_to * 360) - ($angle_from * 360) >= 1) {
|
||||
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
|
||||
if (($angle_to - $angle_from) > 0.05) {
|
||||
array_push($string_placement, array($angle_from, $angle_to));
|
||||
}
|
||||
}
|
||||
$angle_from = $angle_to;
|
||||
}
|
||||
$angle_to = $angle_from + ($block['size']) / $s;
|
||||
if (($angle_to + $fuzz) > 1)
|
||||
$angle_to = 1;
|
||||
if (($angle_to * 360) - ($angle_from * 360) >= 1) {
|
||||
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_green);
|
||||
if (($angle_to - $angle_from) > 0.05) {
|
||||
array_push($string_placement, array($angle_from, $angle_to));
|
||||
}
|
||||
}
|
||||
$angle_from = $angle_to;
|
||||
$ptr = $block['offset'] + $block['size'];
|
||||
}
|
||||
if ($ptr < $mem['seg_size']) { // memory at the end
|
||||
$angle_to = $angle_from + ($mem['seg_size'] - $ptr) / $s;
|
||||
if (($angle_to + $fuzz) > 1)
|
||||
$angle_to = 1;
|
||||
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
|
||||
if (($angle_to - $angle_from) > 0.05) {
|
||||
array_push($string_placement, array($angle_from, $angle_to));
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($string_placement as $angle) {
|
||||
text_arc($image, $x, $y, $size, $angle[0] * 360, $angle[1] * 360, $col_black, bsize($s * ($angle[1] - $angle[0])));
|
||||
}
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
exit;
|
||||
} elseif ($page == 'img2'
|
||||
) {
|
||||
|
||||
$cache = apcu_cache_info();
|
||||
|
||||
$size = $horizontal_bar_size;
|
||||
$image = imagecreate($size + 5, 140);
|
||||
|
||||
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
|
||||
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
|
||||
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
|
||||
$col_black = imagecolorallocate($image, 0, 0, 0);
|
||||
|
||||
imagecolortransparent($image, $col_white);
|
||||
|
||||
$s = $cache['num_hits'] + $cache['num_misses'];
|
||||
$a = $cache['num_hits'];
|
||||
|
||||
fill_box($image, 1, 10, $s ? ($a * ($size - 21) / $s) : $size, 50, $col_black, $col_green/* , sprintf("%.1f%%", $s ? $cache['num_hits'] * 100 / $s : 0) */);
|
||||
fill_box($image, 1, 80, $s ? max(4, ($s - $a) * ($size - 21) / $s) : $size, 50, $col_black, $col_red/* , sprintf("%.1f%%", $s ? $cache['num_misses'] * 100 / $s : 0) */);
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
exit;
|
||||
} elseif ($page == 'img3'
|
||||
) {
|
||||
|
||||
$mem = apcu_sma_info();
|
||||
|
||||
$size = $horizontal_bar_size;
|
||||
$image = imagecreate($size, 70);
|
||||
|
||||
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
|
||||
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
|
||||
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
|
||||
$col_black = imagecolorallocate($image, 0, 0, 0);
|
||||
|
||||
imagecolortransparent($image, $col_white);
|
||||
|
||||
$s = $mem['num_seg'] * $mem['seg_size'];
|
||||
$a = $mem['avail_mem'];
|
||||
$x = 10;
|
||||
$y = 0;
|
||||
|
||||
// This block of code creates the bar chart. It is a lot more complex than you
|
||||
// would expect because we try to visualize any memory fragmentation as well.
|
||||
for ($i = 0; $i < $mem['num_seg']; $i++) {
|
||||
$ptr = 0;
|
||||
$free = $mem['block_lists'][$i];
|
||||
uasort($free, 'block_sort');
|
||||
foreach ($free as $block) {
|
||||
if ($block['offset'] != $ptr) { // Used block
|
||||
$h = ($size - 5) * ($block['offset'] - $ptr) / $s;
|
||||
if ($h > 0) {
|
||||
fill_box($image, $y, $x, $h, 50, $col_black, $col_red);
|
||||
}
|
||||
$y+=$h;
|
||||
}
|
||||
$h = ($size - 5) * ($block['size']) / $s;
|
||||
if ($h > 0) {
|
||||
fill_box($image, $y, $x, $h, 50, $col_black, $col_green);
|
||||
}
|
||||
$y+=$h;
|
||||
$ptr = $block['offset'] + $block['size'];
|
||||
}
|
||||
if ($ptr < $mem['seg_size']) { // memory at the end
|
||||
$h = ($size - 5) * ($mem['seg_size'] - $ptr) / $s;
|
||||
if ($h > 0) {
|
||||
fill_box($image, $y, $x, $h, 50, $col_black, $col_red, bsize($mem['seg_size'] - $ptr), $j++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
exit;
|
||||
}
|
||||
|
||||
function graphics_avail() {
|
||||
return extension_loaded('gd');
|
||||
}
|
||||
|
||||
// pretty printer for byte values
|
||||
//
|
||||
function bsize($s) {
|
||||
foreach (array('', 'K', 'M', 'G') as $i => $k) {
|
||||
if ($s < 1024)
|
||||
break;
|
||||
$s/=1024;
|
||||
}
|
||||
return sprintf("%5.1f %sBytes", $s, $k);
|
||||
}
|
||||
|
||||
function duration($ts) {
|
||||
global $time;
|
||||
$years = (int) ((($time - $ts) / (7 * 86400)) / 52.177457);
|
||||
$rem = (int) (($time - $ts) - ($years * 52.177457 * 7 * 86400));
|
||||
$weeks = (int) (($rem) / (7 * 86400));
|
||||
$days = (int) (($rem) / 86400) - $weeks * 7;
|
||||
$hours = (int) (($rem) / 3600) - $days * 24 - $weeks * 7 * 24;
|
||||
$mins = (int) (($rem) / 60) - $hours * 60 - $days * 24 * 60 - $weeks * 7 * 24 * 60;
|
||||
$str = '';
|
||||
if ($years == 1)
|
||||
$str .= "$years year, ";
|
||||
if ($years > 1)
|
||||
$str .= "$years years, ";
|
||||
if ($weeks == 1)
|
||||
$str .= "$weeks week, ";
|
||||
if ($weeks > 1)
|
||||
$str .= "$weeks weeks, ";
|
||||
if ($days == 1)
|
||||
$str .= "$days day,";
|
||||
if ($days > 1)
|
||||
$str .= "$days days,";
|
||||
if ($hours == 1)
|
||||
$str .= " $hours hour and";
|
||||
if ($hours > 1)
|
||||
$str .= " $hours hours and";
|
||||
if ($mins == 1)
|
||||
$str .= " 1 minute";
|
||||
else
|
||||
$str .= " $mins minutes";
|
||||
return $str;
|
||||
}
|
||||
|
||||
function block_sort($array1, $array2) {
|
||||
if ($array1['offset'] > $array2['offset']) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text = '', $placeindex = 0) {
|
||||
$r = $diameter / 2;
|
||||
$w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
|
||||
|
||||
|
||||
if (function_exists("imagefilledarc")) {
|
||||
// exists only if GD 2.0.1 is available
|
||||
imagefilledarc($im, $centerX + 1, $centerY + 1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
|
||||
imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE);
|
||||
imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL | IMG_ARC_EDGED);
|
||||
} else {
|
||||
imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2);
|
||||
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
|
||||
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start + 1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
|
||||
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end - 1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
|
||||
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
|
||||
imagefill($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $color2);
|
||||
}
|
||||
if ($text) {
|
||||
if ($placeindex > 0) {
|
||||
imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
|
||||
imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
|
||||
} else {
|
||||
imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $text, $placeindex = 0) {
|
||||
$r = $diameter / 2;
|
||||
$w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
|
||||
|
||||
if ($placeindex > 0) {
|
||||
imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
|
||||
imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
|
||||
} else {
|
||||
imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
|
||||
}
|
||||
}
|
||||
|
||||
function fill_box($im, $x, $y, $w, $h, $color1, $color2, $text = '', $placeindex = '') {
|
||||
global $col_black;
|
||||
$x1 = $x + $w - 1;
|
||||
$y1 = $y + $h - 1;
|
||||
|
||||
imagerectangle($im, $x, $y1, $x1 + 1, $y + 1, $col_black);
|
||||
if ($y1 > $y)
|
||||
imagefilledrectangle($im, $x, $y, $x1, $y1, $color2);
|
||||
else
|
||||
imagefilledrectangle($im, $x, $y1, $x1, $y, $color2);
|
||||
imagerectangle($im, $x, $y1, $x1, $y, $color1);
|
||||
if ($text) {
|
||||
if ($placeindex > 0) {
|
||||
|
||||
if ($placeindex < 16) {
|
||||
$px = 5;
|
||||
$py = $placeindex * 12 + 6;
|
||||
imagefilledrectangle($im, $px + 90, $py + 3, $px + 90 - 4, $py - 3, $color2);
|
||||
imageline($im, $x, $y + $h / 2, $px + 90, $py, $color2);
|
||||
imagestring($im, 2, $px, $py - 6, $text, $color1);
|
||||
} else {
|
||||
if ($placeindex < 31) {
|
||||
$px = $x + 40 * 2;
|
||||
$py = ($placeindex - 15) * 12 + 6;
|
||||
} else {
|
||||
$px = $x + 40 * 2 + 100 * intval(($placeindex - 15) / 15);
|
||||
$py = ($placeindex % 15) * 12 + 6;
|
||||
}
|
||||
imagefilledrectangle($im, $px, $py + 3, $px - 4, $py - 3, $color2);
|
||||
imageline($im, $x + $w, $y + $h / 2, $px, $py, $color2);
|
||||
imagestring($im, 2, $px + 2, $py - 6, $text, $color1);
|
||||
}
|
||||
} else {
|
||||
imagestring($im, 4, $x + 5, $y1 - 16, $text, $color1);
|
||||
}
|
||||
}
|
||||
}
|
||||
209
admin_autoupdate.php
Normal file
209
admin_autoupdate.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2016 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Frontend
|
||||
*
|
||||
* @since 0.9.35
|
||||
*
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
// define update-uri
|
||||
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/legacy/" . $version);
|
||||
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
|
||||
define('CHECKSUM_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip.sha256");
|
||||
|
||||
// check for allow_url_fopen
|
||||
if (ini_get('allow_url_fopen') === false) {
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 1));
|
||||
}
|
||||
|
||||
// check for archive-stuff
|
||||
if (! extension_loaded('zip')) {
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 2));
|
||||
}
|
||||
|
||||
// display initial version check
|
||||
if ($page == 'overview') {
|
||||
|
||||
// log our actions
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "checking auto-update");
|
||||
|
||||
// check for new version
|
||||
$latestversion = @file(UPDATE_URI);
|
||||
|
||||
if (isset($latestversion[0])) {
|
||||
$latestversion = explode('|', $latestversion[0]);
|
||||
|
||||
if (is_array($latestversion)
|
||||
&& count($latestversion) >= 1
|
||||
) {
|
||||
$_version = $latestversion[0];
|
||||
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
|
||||
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
||||
|
||||
// add the branding so debian guys are not gettings confused
|
||||
// about their version-number
|
||||
$version_label = $_version.$branding;
|
||||
$version_link = $_link;
|
||||
$message_addinfo = $_message;
|
||||
|
||||
// not numeric -> error-message
|
||||
if (!preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
|
||||
// check for customized version to not output
|
||||
// "There is a newer version of froxlor" besides the error-message
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 3));
|
||||
} elseif (version_compare2($version, $_version) == -1) {
|
||||
// there is a newer version - yay
|
||||
$isnewerversion = 1;
|
||||
} else {
|
||||
// nothing new
|
||||
$isnewerversion = 0;
|
||||
}
|
||||
|
||||
// anzeige über version-status mit ggfls. formular
|
||||
// zum update schritt #1 -> download
|
||||
if ($isnewerversion == 1) {
|
||||
$text = 'There is a newer version available. Update to version <b>'.$_version.'</b> now?<br/>(Your current version is: '.$version.')';
|
||||
$hiddenparams = '<input type="hidden" name="newversion" value="'.$_version.'" />';
|
||||
$yesfile = $filename.'?s='.$s.'&page=getdownload';
|
||||
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
|
||||
exit;
|
||||
}
|
||||
elseif ($isnewerversion == 0) {
|
||||
// all good
|
||||
standard_success ('noupdatesavail');
|
||||
} else {
|
||||
standard_error ('customized_version');
|
||||
}
|
||||
}
|
||||
}
|
||||
// error (something weird came from version.froxlor.org)
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 5));
|
||||
}
|
||||
// download the new archive
|
||||
elseif ($page == 'getdownload') {
|
||||
|
||||
// retrieve the new version from the form
|
||||
$newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null;
|
||||
|
||||
// valid?
|
||||
if ($newversion !== null) {
|
||||
|
||||
// define files to get
|
||||
$toLoad = str_replace('{version}', $newversion, RELEASE_URI);
|
||||
$toCheck = str_replace('{version}', $newversion, CHECKSUM_URI);
|
||||
|
||||
// get archive data
|
||||
$newArchive = @file_get_contents($toLoad);
|
||||
|
||||
// check for local destination folder
|
||||
if (!is_dir(FROXLOR_INSTALL_DIR.'/updates/')) {
|
||||
mkdir(FROXLOR_INSTALL_DIR.'/updates/');
|
||||
}
|
||||
|
||||
// name archive
|
||||
$localArchive = FROXLOR_INSTALL_DIR.'/updates/'.basename($toLoad);
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "Downloading ".$toLoad." to ".$localArchive);
|
||||
|
||||
// remove old archive
|
||||
if (file_exists($localArchive)) {
|
||||
@unlink($localArchive);
|
||||
}
|
||||
|
||||
// store archive
|
||||
$fh = fopen($localArchive, 'w');
|
||||
if (!fwrite($fh, $newArchive)) {
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 4));
|
||||
}
|
||||
|
||||
// close file-handle
|
||||
fclose($fh);
|
||||
|
||||
// validate the integrity of the downloaded file
|
||||
$_shouldsum = @file_get_contents($toCheck);
|
||||
if (!empty($_shouldsum)) {
|
||||
$_t = explode(" ", $_shouldsum);
|
||||
$shouldsum = $_t[0];
|
||||
} else {
|
||||
$shouldsum = null;
|
||||
}
|
||||
$filesum = hash_file('sha256', $localArchive);
|
||||
|
||||
if ($filesum != $shouldsum) {
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 9));
|
||||
}
|
||||
|
||||
// to the next step
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'extract', 'archive' => basename($localArchive)));
|
||||
}
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 6));
|
||||
}
|
||||
// extract and install new version
|
||||
elseif ($page == 'extract') {
|
||||
|
||||
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
|
||||
$localArchive = FROXLOR_INSTALL_DIR.'/updates/'.$toExtract;
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
// decompress from zip
|
||||
$zip = new ZipArchive;
|
||||
$res = $zip->open($localArchive);
|
||||
if ($res === true) {
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting ".$localArchive." to ".FROXLOR_INSTALL_DIR);
|
||||
$zip->extractTo(FROXLOR_INSTALL_DIR);
|
||||
$zip->close();
|
||||
// success - remove unused archive
|
||||
@unlink($localArchive);
|
||||
} else {
|
||||
// error
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 8));
|
||||
}
|
||||
|
||||
// redirect to update-page?
|
||||
redirectTo('admin_updates.php', array('s' => $s));
|
||||
}
|
||||
|
||||
if (!file_exists($localArchive)) {
|
||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 7));
|
||||
}
|
||||
|
||||
$text = 'Extract downloaded archive "'.$toExtract.'"?';
|
||||
$hiddenparams = '';
|
||||
$yesfile = $filename.'?s='.$s.'&page=extract&archive='.$toExtract;
|
||||
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
|
||||
}
|
||||
|
||||
// display error
|
||||
elseif ($page == 'error') {
|
||||
|
||||
// retrieve error-number via url-parameter
|
||||
$errno = isset($_GET['errno']) ? (int)$_GET['errno'] : 0;
|
||||
|
||||
// 1 = no allow_url_fopen
|
||||
// 2 = no Zlib
|
||||
// 3 = custom version detected
|
||||
// 4 = could not store archive to local hdd
|
||||
// 5 = some weird value came from version.froxlor.org
|
||||
// 6 = download without valid version
|
||||
// 7 = local archive does not exist
|
||||
// 8 = could not extract archive
|
||||
// 9 = checksum mismatch
|
||||
standard_error ('autoupdate_'.$errno);
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
@@ -10,174 +9,219 @@
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @since 0.9.34
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
$need_db_sql_data = true;
|
||||
require './lib/init.php';
|
||||
require './lib/configfiles_index.inc.php';
|
||||
|
||||
$distribution = '';
|
||||
$distributions_select = '';
|
||||
$service = '';
|
||||
$services_select = '';
|
||||
$daemon = '';
|
||||
$daemons_select = '';
|
||||
if ($userinfo['change_serversettings'] == '1') {
|
||||
|
||||
if($userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_GET['distribution'])
|
||||
&& $_GET['distribution'] != ''
|
||||
&& isset($configfiles[$_GET['distribution']])
|
||||
&& is_array($configfiles[$_GET['distribution']]))
|
||||
$customer_tmpdir = '/tmp/';
|
||||
if (Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_tmpdir') != '')
|
||||
{
|
||||
$distribution = $_GET['distribution'];
|
||||
$customer_tmpdir = Settings::Get('system.mod_fcgid_tmpdir');
|
||||
}
|
||||
elseif (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.tmpdir') != '')
|
||||
{
|
||||
$customer_tmpdir = Settings::Get('phpfpm.tmpdir');
|
||||
}
|
||||
|
||||
if(isset($_GET['service'])
|
||||
&& $_GET['service'] != ''
|
||||
&& isset($configfiles[$distribution]['services'][$_GET['service']])
|
||||
&& is_array($configfiles[$distribution]['services'][$_GET['service']]))
|
||||
{
|
||||
$service = $_GET['service'];
|
||||
$replace_arr = Array(
|
||||
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
|
||||
'<SQL_UNPRIVILEGED_PASSWORD>' => 'MYSQL_PASSWORD',
|
||||
'<SQL_DB>' => $sql['db'],
|
||||
'<SQL_HOST>' => $sql['host'],
|
||||
'<SQL_SOCKET>' => isset($sql['socket']) ? $sql['socket'] : null,
|
||||
'<SERVERNAME>' => Settings::Get('system.hostname'),
|
||||
'<SERVERIP>' => Settings::Get('system.ipaddress'),
|
||||
'<NAMESERVERS>' => Settings::Get('system.nameservers'),
|
||||
'<VIRTUAL_MAILBOX_BASE>' => Settings::Get('system.vmail_homedir'),
|
||||
'<VIRTUAL_UID_MAPS>' => Settings::Get('system.vmail_uid'),
|
||||
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
|
||||
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
|
||||
'<CUSTOMER_TMP>' => makeCorrectDir($customer_tmpdir),
|
||||
'<BASE_PATH>' => makeCorrectDir(FROXLOR_INSTALL_DIR),
|
||||
'<BIND_CONFIG_PATH>' => makeCorrectDir(Settings::Get('system.bindconf_directory')),
|
||||
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
|
||||
'<CUSTOMER_LOGS>' => makeCorrectDir(Settings::Get('system.logfiles_directory')),
|
||||
'<FPM_IPCDIR>' => makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
|
||||
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
|
||||
);
|
||||
|
||||
if(isset($_GET['daemon'])
|
||||
&& $_GET['daemon'] != ''
|
||||
&& isset($configfiles[$distribution]['services'][$service]['daemons'][$_GET['daemon']])
|
||||
&& is_array($configfiles[$distribution]['services'][$service]['daemons'][$_GET['daemon']]))
|
||||
{
|
||||
$daemon = $_GET['daemon'];
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($configfiles[$distribution]['services'][$service]['daemons'] as $daemon_name => $daemon_details)
|
||||
{
|
||||
$daemons_select.= makeoption($daemon_details['label'], $daemon_name);
|
||||
// get distro from URL param
|
||||
$distribution = (isset($_GET['distribution']) && $_GET['distribution'] != 'choose') ? $_GET['distribution'] : "";
|
||||
$service = (isset($_GET['service']) && $_GET['service'] != 'choose') ? $_GET['service'] : "";
|
||||
$daemon = (isset($_GET['daemon']) && $_GET['daemon'] != 'choose') ? $_GET['daemon'] : "";
|
||||
$distributions_select = "";
|
||||
$services_select = "";
|
||||
$daemons_select = "";
|
||||
|
||||
$configfiles = "";
|
||||
$services = "";
|
||||
$daemons = "";
|
||||
|
||||
$config_dir = makeCorrectDir(FROXLOR_INSTALL_DIR . '/lib/configfiles/');
|
||||
|
||||
if ($distribution != "") {
|
||||
// create configparser object
|
||||
$configfiles = new ConfigParser($config_dir . '/' . $distribution . ".xml");
|
||||
|
||||
// get distro-info
|
||||
$dist_display = getCompleteDistroName($configfiles);
|
||||
|
||||
// get all the services from the distro
|
||||
$services = $configfiles->getServices();
|
||||
|
||||
if ($service != "") {
|
||||
|
||||
$daemons = $services[$service]->getDaemons();
|
||||
|
||||
if ($daemon == "") {
|
||||
foreach ($daemons as $di => $dd) {
|
||||
$title = $dd->title;
|
||||
if ($dd->default) {
|
||||
$title = $title . " (" . strtolower($lng['panel']['default']) . ")";
|
||||
}
|
||||
$daemons_select .= makeoption($title, $di);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($configfiles[$distribution]['services'] as $service_name => $service_details)
|
||||
{
|
||||
$services_select.= makeoption($service_details['label'], $service_name);
|
||||
} else {
|
||||
foreach ($services as $si => $sd) {
|
||||
$services_select .= makeoption($sd->title, $si);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($configfiles as $distribution_name => $distribution_details)
|
||||
{
|
||||
$distributions_select.= makeoption($distribution_details['label'], $distribution_name);
|
||||
} else {
|
||||
|
||||
// show list of available distro's
|
||||
$distros = glob($config_dir . '*.xml');
|
||||
// tmp array
|
||||
$distributions_select_data = array();
|
||||
// read in all the distros
|
||||
foreach ($distros as $_distribution) {
|
||||
// get configparser object
|
||||
$dist = new ConfigParser($_distribution);
|
||||
// get distro-info
|
||||
$dist_display = getCompleteDistroName($dist);
|
||||
// store in tmp array
|
||||
$distributions_select_data[$dist_display] = str_replace(".xml", "", strtolower(basename($_distribution)));
|
||||
}
|
||||
|
||||
// sort by distribution name
|
||||
ksort($distributions_select_data);
|
||||
|
||||
foreach ($distributions_select_data as $dist_display => $dist_index) {
|
||||
// create select-box-option
|
||||
$distributions_select .= makeoption($dist_display, $dist_index);
|
||||
}
|
||||
}
|
||||
|
||||
if($distribution != ''
|
||||
&& $service != ''
|
||||
&& $daemon != '')
|
||||
{
|
||||
$replace_arr = Array(
|
||||
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
|
||||
'<SQL_UNPRIVILEGED_PASSWORD>' => 'MYSQL_PASSWORD',
|
||||
'<SQL_DB>' => $sql['db'],
|
||||
'<SQL_HOST>' => $sql['host'],
|
||||
'<SERVERNAME>' => Settings::Get('system.hostname'),
|
||||
'<SERVERIP>' => Settings::Get('system.ipaddress'),
|
||||
'<NAMESERVERS>' => Settings::Get('system.nameservers'),
|
||||
'<VIRTUAL_MAILBOX_BASE>' => Settings::Get('system.vmail_homedir'),
|
||||
'<VIRTUAL_UID_MAPS>' => Settings::Get('system.vmail_uid'),
|
||||
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
|
||||
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
|
||||
'<CUSTOMER_TMP>' => (Settings::Get('system.mod_fcgid_tmpdir') != '') ? makeCorrectDir(Settings::Get('system.mod_fcgid_tmpdir')) : '/tmp/',
|
||||
'<BASE_PATH>' => makeCorrectDir(FROXLOR_INSTALL_DIR),
|
||||
'<BIND_CONFIG_PATH>' => makeCorrectDir(Settings::Get('system.bindconf_directory')),
|
||||
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
|
||||
'<CUSTOMER_LOGS>' => makeCorrectDir(Settings::Get('system.logfiles_directory')),
|
||||
'<FPM_IPCDIR>' => makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
|
||||
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
|
||||
);
|
||||
$files = '';
|
||||
if ($distribution != "" && $service != "" && $daemon != "") {
|
||||
|
||||
$confarr = $daemons[$daemon]->getConfig();
|
||||
|
||||
$configpage = '';
|
||||
foreach($configfiles[$distribution]['services'][$service]['daemons'][$daemon] as $action => $value)
|
||||
{
|
||||
if(substr($action, 0, 8) == 'commands')
|
||||
{
|
||||
|
||||
$distro_editor = $configfiles->distributionEditor;
|
||||
|
||||
$commands_pre = "";
|
||||
$commands_file = "";
|
||||
$commands_post = "";
|
||||
|
||||
$lasttype = '';
|
||||
$commands = '';
|
||||
foreach ($confarr as $idx => $action) {
|
||||
if ($lasttype != '' && $lasttype != $action['type']) {
|
||||
$commands = trim($commands);
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
$lasttype = '';
|
||||
$commands = '';
|
||||
|
||||
if(is_array($value))
|
||||
{
|
||||
$commands = implode("\n", $value);
|
||||
$commands = str_replace("\n\n", "\n", $commands);
|
||||
|
||||
if($commands != '')
|
||||
{
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif(substr($action, 0, 5) == 'files')
|
||||
{
|
||||
$files = '';
|
||||
|
||||
if(is_array($value))
|
||||
{
|
||||
while(list($filename, $realname) = each($value))
|
||||
{
|
||||
$file_content = file_get_contents('./templates/misc/configfiles/' . $distribution . '/' . $daemon . '/' . $filename);
|
||||
$file_content = strtr($file_content, $replace_arr);
|
||||
$file_content = htmlspecialchars($file_content);
|
||||
$numbrows = count(explode("\n", $file_content));
|
||||
eval("\$files.=\"" . getTemplate("configfiles/configfiles_file") . "\";");
|
||||
switch ($action['type']) {
|
||||
case "install":
|
||||
$commands .= strtr($action['content'], $replace_arr) . "\n";
|
||||
$lasttype = "install";
|
||||
break;
|
||||
case "command":
|
||||
$commands .= strtr($action['content'], $replace_arr) . "\n";
|
||||
$lasttype = "command";
|
||||
break;
|
||||
case "file":
|
||||
if (array_key_exists('content', $action)) {
|
||||
$commands_file = getFileContentContainer($action['content'], $replace_arr, $action['name'], $distro_editor);
|
||||
} elseif (array_key_exists('subcommands', $action)) {
|
||||
foreach ($action['subcommands'] as $fileaction) {
|
||||
if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") {
|
||||
$commands_pre .= $fileaction['content'] . "\n";
|
||||
} elseif (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "post") {
|
||||
$commands_post .= $fileaction['content'] . "\n";
|
||||
} elseif ($fileaction['type'] == 'file') {
|
||||
$commands_file = getFileContentContainer($fileaction['content'], $replace_arr, $action['name'], $distro_editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_files") . "\";");
|
||||
}
|
||||
$realname = $action['name'];
|
||||
$commands = trim($commands_pre);
|
||||
if ($commands != "") {
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$commands_pre=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
}
|
||||
$commands = trim($commands_post);
|
||||
if ($commands != "") {
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$commands_post=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
}
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_subfileblock") . "\";");
|
||||
$commands = '';
|
||||
$commands_pre = '';
|
||||
$commands_post = '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart'])
|
||||
&& is_array($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']))
|
||||
{
|
||||
$restart = implode("\n", $configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']);
|
||||
$commands = trim($commands);
|
||||
if ($commands != '') {
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
$restart = '';
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("configfiles/configfiles") . "\";");
|
||||
}
|
||||
elseif($page == 'overview')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_configfiles");
|
||||
$distributions = '';
|
||||
foreach($configfiles as $distribution_name => $distribution_details)
|
||||
{
|
||||
$services = '';
|
||||
foreach($distribution_details['services'] as $service_name => $service_details)
|
||||
{
|
||||
$daemons = '';
|
||||
foreach($service_details['daemons'] as $daemon_name => $daemon_details)
|
||||
{
|
||||
eval("\$daemons.=\"" . getTemplate("configfiles/choose_daemon") . "\";");
|
||||
}
|
||||
|
||||
eval("\$services.=\"" . getTemplate("configfiles/choose_service") . "\";");
|
||||
}
|
||||
|
||||
eval("\$distributions.=\"" . getTemplate("configfiles/choose_distribution") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("configfiles/choose") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
eval("echo \"" . getTemplate("configfiles/wizard") . "\";");
|
||||
}
|
||||
} else {
|
||||
die('not allowed to see this page');
|
||||
// redirect or similar here
|
||||
}
|
||||
|
||||
?>
|
||||
// helper functions
|
||||
function getFileContentContainer($file_content, &$replace_arr, $realname, $distro_editor)
|
||||
{
|
||||
$files = "";
|
||||
$file_content = trim($file_content);
|
||||
if ($file_content != '') {
|
||||
$file_content = strtr($file_content, $replace_arr);
|
||||
$file_content = htmlspecialchars($file_content);
|
||||
$numbrows = count(explode("\n", $file_content));
|
||||
eval("\$files=\"" . getTemplate("configfiles/configfiles_file") . "\";");
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
function getCompleteDistroName($cparser)
|
||||
{
|
||||
// get distro-info
|
||||
$dist_display = $cparser->distributionName;
|
||||
if ($cparser->distributionCodename != '') {
|
||||
$dist_display .= " " . $cparser->distributionCodename;
|
||||
}
|
||||
if ($cparser->distributionVersion != '') {
|
||||
$dist_display .= " (" . $cparser->distributionVersion . ")";
|
||||
}
|
||||
if ($cparser->deprecated) {
|
||||
$dist_display .= " [deprecated]";
|
||||
}
|
||||
return $dist_display;
|
||||
}
|
||||
|
||||
@@ -84,6 +84,15 @@ if ($page == 'customers'
|
||||
$domains = $domains_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$row['domains'] = intval($domains['domains']);
|
||||
$dec_places = Settings::Get('panel.decimal_places');
|
||||
|
||||
// get disk-space usages for web, mysql and mail
|
||||
$usages_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_DISKSPACE."` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
|
||||
$usages = Database::pexecute_first($usages_stmt, array('cid' => $row['customerid']));
|
||||
|
||||
$row['webspace_used'] = round($usages['webspace'] / 1024, $dec_places);
|
||||
$row['mailspace_used'] = round($usages['mail'] / 1024, $dec_places);
|
||||
$row['dbspace_used'] = round($usages['mysql'] / 1024, $dec_places);
|
||||
|
||||
$row['traffic_used'] = round($row['traffic_used'] / (1024 * 1024), $dec_places);
|
||||
$row['traffic'] = round($row['traffic'] / (1024 * 1024), $dec_places);
|
||||
$row['diskspace_used'] = round($row['diskspace_used'] / 1024, $dec_places);
|
||||
@@ -278,12 +287,14 @@ if ($page == 'customers'
|
||||
Database::pexecute($stmt, array('id' => $id));
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid` = :id");
|
||||
Database::pexecute($stmt, array('id' => $id));
|
||||
// first gather all domain-id's to clean up panel_domaintoip accordingly
|
||||
// first gather all domain-id's to clean up panel_domaintoip and dns-entries accordingly
|
||||
$did_stmt = Database::prepare("SELECT `id` FROM `".TABLE_PANEL_DOMAINS."` WHERE `customerid` = :id");
|
||||
Database::pexecute($did_stmt, array('id' => $id));
|
||||
while ($row = $did_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_domain` = :did");
|
||||
Database::pexecute($stmt, array('did' => $row['id']));
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_DOMAIN_DNS . "` WHERE `domain_id` = :did");
|
||||
Database::pexecute($stmt, array('did' => $row['id']));
|
||||
}
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid` = :id");
|
||||
Database::pexecute($stmt, array('id' => $id));
|
||||
@@ -526,6 +537,11 @@ if ($page == 'customers'
|
||||
$perlenabled = intval($_POST['perlenabled']);
|
||||
}
|
||||
|
||||
$dnsenabled = 0;
|
||||
if (isset($_POST['dnsenabled'])) {
|
||||
$dnsenabled = intval($_POST['dnsenabled']);
|
||||
}
|
||||
|
||||
$store_defaultindex = 0;
|
||||
if (isset($_POST['store_defaultindex'])) {
|
||||
$store_defaultindex = intval($_POST['store_defaultindex']);
|
||||
@@ -554,7 +570,6 @@ if ($page == 'customers'
|
||||
|| ($subdomains == '-1' && $userinfo['subdomains'] != '-1')
|
||||
) {
|
||||
standard_error('youcantallocatemorethanyouhave');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Either $name and $firstname or the $company must be inserted
|
||||
@@ -639,6 +654,10 @@ if ($page == 'customers'
|
||||
$perlenabled = '1';
|
||||
}
|
||||
|
||||
if ($dnsenabled != '0') {
|
||||
$dnsenabled = '1';
|
||||
}
|
||||
|
||||
if ($password == '') {
|
||||
$password = generatePassword();
|
||||
}
|
||||
@@ -677,6 +696,7 @@ if ($page == 'customers'
|
||||
'imap' => $email_imap,
|
||||
'pop3' => $email_pop3,
|
||||
'perlenabled' => $perlenabled,
|
||||
'dnsenabled' => $dnsenabled,
|
||||
'theme' => $_theme,
|
||||
'custom_notes' => $custom_notes,
|
||||
'custom_notes_show' => $custom_notes_show
|
||||
@@ -716,6 +736,7 @@ if ($page == 'customers'
|
||||
`imap` = :imap,
|
||||
`pop3` = :pop3,
|
||||
`perlenabled` = :perlenabled,
|
||||
`dnsenabled` = :dnsenabled,
|
||||
`theme` = :theme,
|
||||
`custom_notes` = :custom_notes,
|
||||
`custom_notes_show` = :custom_notes_show"
|
||||
@@ -855,7 +876,11 @@ if ($page == 'customers'
|
||||
} else {
|
||||
$local_user = Settings::Get('phpfpm.vhost_httpuser');
|
||||
}
|
||||
$ins_data['members'] .= ','.$local_user;
|
||||
// check froxlor-local user membership in ftp-group
|
||||
// without this check addition may duplicate user in list if httpuser == local_user
|
||||
if (strpos($ins_data['members'], $local_user) == false) {
|
||||
$ins_data['members'] .= ','.$local_user;
|
||||
}
|
||||
}
|
||||
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
@@ -909,10 +934,13 @@ if ($page == 'customers'
|
||||
$domainid = Database::lastInsertId();
|
||||
|
||||
// set ip <-> domain connection
|
||||
$defaultips = explode(',', Settings::Get('system.defaultip'));
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `".TABLE_DOMAINTOIP."` SET `id_domain` = :domainid, `id_ipandports` = :ipid"
|
||||
INSERT INTO `" . TABLE_DOMAINTOIP . "` SET `id_domain` = :domainid, `id_ipandports` = :ipid"
|
||||
);
|
||||
Database::pexecute($ins_stmt, array('domainid' => $domainid, 'ipid' => Settings::Get('system.defaultip')));
|
||||
foreach ($defaultips as $defaultip) {
|
||||
Database::pexecute($ins_stmt, array('domainid' => $domainid, 'ipid' => $defaultip));
|
||||
}
|
||||
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `standardsubdomain` = :domainid WHERE `customerid` = :customerid"
|
||||
@@ -933,7 +961,9 @@ if ($page == 'customers'
|
||||
SELECT ip, port FROM `".TABLE_PANEL_IPSANDPORTS."`
|
||||
WHERE `id` = :defaultip
|
||||
");
|
||||
$srv_ip = Database::pexecute_first($srv_ip_stmt, array('defaultip' => Settings::Get('system.defaultip')));
|
||||
$default_ips = Settings::Get('system.defaultip');
|
||||
$default_ips = explode(',', $default_ips);
|
||||
$srv_ip = Database::pexecute_first($srv_ip_stmt, array('defaultip' => reset($default_ips)));
|
||||
|
||||
$replace_arr = array(
|
||||
'FIRSTNAME' => $firstname,
|
||||
@@ -1178,6 +1208,11 @@ if ($page == 'customers'
|
||||
$perlenabled = intval($_POST['perlenabled']);
|
||||
}
|
||||
|
||||
$dnsenabled = 0;
|
||||
if (isset($_POST['dnsenabled'])) {
|
||||
$dnsenabled = intval($_POST['dnsenabled']);
|
||||
}
|
||||
|
||||
$diskspace = $diskspace * 1024;
|
||||
$traffic = $traffic * 1024 * 1024;
|
||||
|
||||
@@ -1201,7 +1236,6 @@ if ($page == 'customers'
|
||||
|| ($subdomains == '-1' && $userinfo['subdomains'] != '-1')
|
||||
) {
|
||||
standard_error('youcantallocatemorethanyouhave');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Either $name and $firstname or the $company must be inserted
|
||||
@@ -1268,10 +1302,13 @@ if ($page == 'customers'
|
||||
$domainid = Database::lastInsertId();
|
||||
|
||||
// set ip <-> domain connection
|
||||
$defaultips = explode(',', Settings::Get('system.defaultip'));
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `".TABLE_DOMAINTOIP."` SET `id_domain` = :domainid, `id_ipandports` = :ipid"
|
||||
INSERT INTO `" . TABLE_DOMAINTOIP . "` SET `id_domain` = :domainid, `id_ipandports` = :ipid"
|
||||
);
|
||||
Database::pexecute($ins_stmt, array('domainid' => $domainid, 'ipid' => Settings::Get('system.defaultip')));
|
||||
foreach ($defaultips as $defaultip) {
|
||||
Database::pexecute($ins_stmt, array('domainid' => $domainid, 'ipid' => $defaultip));
|
||||
}
|
||||
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `standardsubdomain` = :domainid WHERE `customerid` = :customerid"
|
||||
@@ -1307,6 +1344,10 @@ if ($page == 'customers'
|
||||
$perlenabled = '1';
|
||||
}
|
||||
|
||||
if ($dnsenabled != '0') {
|
||||
$dnsenabled = '1';
|
||||
}
|
||||
|
||||
if ($phpenabled != $result['phpenabled']
|
||||
|| $perlenabled != $result['perlenabled']
|
||||
) {
|
||||
@@ -1417,6 +1458,7 @@ if ($page == 'customers'
|
||||
'imap' => $email_imap,
|
||||
'pop3' => $email_pop3,
|
||||
'perlenabled' => $perlenabled,
|
||||
'dnsenabled' => $dnsenabled,
|
||||
'custom_notes' => $custom_notes,
|
||||
'custom_notes_show' => $custom_notes_show
|
||||
);
|
||||
@@ -1450,6 +1492,7 @@ if ($page == 'customers'
|
||||
`imap` = :imap,
|
||||
`pop3` = :pop3,
|
||||
`perlenabled` = :perlenabled,
|
||||
`dnsenabled` = :dnsenabled,
|
||||
`custom_notes` = :custom_notes,
|
||||
`custom_notes_show` = :custom_notes_show
|
||||
WHERE `customerid` = :customerid"
|
||||
|
||||
1168
admin_domains.php
1168
admin_domains.php
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,6 @@ if ($action == 'logout') {
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
@@ -145,6 +144,15 @@ if ($page == 'overview') {
|
||||
$cron_last_runs = getCronjobsLastRun();
|
||||
$outstanding_tasks = getOutstandingTasks();
|
||||
|
||||
$system_hostname = gethostname();
|
||||
$meminfo= explode("\n", @file_get_contents("/proc/meminfo"));
|
||||
$memory = "";
|
||||
for ($i = 0; $i < sizeof($meminfo); ++$i) {
|
||||
if (substr($meminfo[$i], 0, 3) === "Mem") {
|
||||
$memory.= $meminfo[$i] . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('sys_getloadavg')) {
|
||||
$loadArray = sys_getloadavg();
|
||||
$load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', '');
|
||||
@@ -201,7 +209,6 @@ if ($page == 'overview') {
|
||||
|
||||
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_ADMINS,'adminid')) {
|
||||
standard_error('oldpasswordnotcorrect');
|
||||
exit;
|
||||
}
|
||||
|
||||
$new_password = validate($_POST['new_password'], 'new password');
|
||||
@@ -362,7 +369,8 @@ if ($page == 'overview') {
|
||||
$mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n";
|
||||
$mail_body .= "Trace:\n".trim($_error['trace'])."\n\n";
|
||||
$mail_body .= "-------------------------------------------------------------\n\n";
|
||||
$mail_body .= "Froxlor-version: ".$version."\n\n";
|
||||
$mail_body .= "Froxlor-version: ".$version."\n";
|
||||
$mail_body .= "DB-version: ".$dbversion."\n\n";
|
||||
$mail_body .= "End of report";
|
||||
$mail_html = nl2br($mail_body);
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ if (isset($_POST['id'])) {
|
||||
if ($page == 'ipsandports'
|
||||
|| $page == 'overview'
|
||||
) {
|
||||
// Do not display attributes that are not used by the current webserver
|
||||
$websrv = Settings::Get('system.webserver');
|
||||
$is_nginx = ($websrv == 'nginx');
|
||||
$is_apache = ($websrv == 'apache2');
|
||||
$is_apache24 = $is_apache && (Settings::Get('system.apache24') === '1');
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
@@ -79,7 +84,7 @@ if ($page == 'ipsandports'
|
||||
$result_checkdomain = Database::pexecute_first($result_checkdomain_stmt, array('id' => $id));
|
||||
|
||||
if ($result_checkdomain['id'] == '') {
|
||||
if ($result['id'] != Settings::Get('system.defaultip')) {
|
||||
if (!in_array($result['id'], explode(',', Settings::Get('system.defaultip')))) {
|
||||
|
||||
$result_sameipotherport_stmt = Database::prepare("
|
||||
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
|
||||
@@ -34,7 +34,8 @@ if ($page == 'log'
|
||||
$result_stmt = Database::query('
|
||||
SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit()
|
||||
);
|
||||
$paging->setEntries(Database::num_rows());
|
||||
$logs_count = Database::num_rows();
|
||||
$paging->setEntries($logs_count);
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -100,35 +101,12 @@ if ($page == 'log'
|
||||
}
|
||||
|
||||
$log_count++;
|
||||
$type = $row['type'];
|
||||
$_type = 'unknown';
|
||||
|
||||
switch ($type) {
|
||||
case LOG_INFO:
|
||||
$_type = 'Information';
|
||||
break;
|
||||
case LOG_NOTICE:
|
||||
$_type = 'Notice';
|
||||
break;
|
||||
case LOG_WARNING:
|
||||
$_type = 'Warning';
|
||||
break;
|
||||
case LOG_ERR:
|
||||
$_type = 'Error';
|
||||
break;
|
||||
case LOG_CRIT:
|
||||
$_type = 'Critical';
|
||||
break;
|
||||
default:
|
||||
$_type = 'Unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
$row['type'] = $_type;
|
||||
$row['type'] = getLogLevelDesc($row['type']);
|
||||
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
|
||||
$count++;
|
||||
$_action = $action;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
158
admin_opcacheinfo.php
Normal file
158
admin_opcacheinfo.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Janos Muzsi <muzsij@hypernics.hu> (2016)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* Based on https://github.com/amnuts/opcache-gui
|
||||
*
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
|
||||
if ($action == 'reset' &&
|
||||
function_exists('opcache_reset') &&
|
||||
$userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
opcache_reset();
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "reseted OPcache");
|
||||
header('Location: ' . $linker->getLink(array('section' => 'opcacheinfo', 'page' => 'showinfo')));
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!function_exists('opcache_get_configuration')
|
||||
) {
|
||||
standard_error($lng['error']['no_opcacheinfo']);
|
||||
}
|
||||
|
||||
if ($page == 'showinfo'
|
||||
) {
|
||||
|
||||
$opcache_info = opcache_get_configuration();
|
||||
$opcache_status = opcache_get_status(false);
|
||||
$time = time();
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed OPcache info");
|
||||
|
||||
$runtimelines = '';
|
||||
if (isset($opcache_info['directives']) && is_array($opcache_info['directives'])) {
|
||||
foreach ($opcache_info['directives'] as $name => $value) {
|
||||
$linkname= str_replace('_', '-', $name);
|
||||
if ($name=='opcache.optimization_level' && is_integer($value)) {
|
||||
$value='0x'.dechex($value);
|
||||
}
|
||||
if ($name=='opcache.memory_consumption' && is_integer($value) && $value%(1024*1024)==0) {
|
||||
$value=$value/(1024*1024);
|
||||
}
|
||||
if ($value===null || $value==='') {
|
||||
$value=$lng['opcacheinfo']['novalue'];
|
||||
}
|
||||
if ($value===true) {
|
||||
$value=$lng['opcacheinfo']['true'];
|
||||
}
|
||||
if ($value===false) {
|
||||
$value=$lng['opcacheinfo']['false'];
|
||||
}
|
||||
if (is_integer($value)) {
|
||||
$value=number_format($value,0,'.',' ');
|
||||
}
|
||||
$name=str_replace('_', ' ', $name);
|
||||
eval("\$runtimelines.=\"" . getTemplate("settings/opcacheinfo/runtime_line") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
$cachehits=@$opcache_status['opcache_statistics']['hits'] ?: 0;
|
||||
$cachemiss=@$opcache_status['opcache_statistics']['misses'] ?: 0;
|
||||
$blacklistmiss=@$opcache_status['opcache_statistics']['blacklist_misses'] ?: 0;
|
||||
$cachetotal=$cachehits+$cachemiss+$blacklistmiss;
|
||||
|
||||
$general=array(
|
||||
'version' => (isset($opcache_info['version']['opcache_product_name']) ? $opcache_info['version']['opcache_product_name'].' ' : '').$opcache_info['version']['version'],
|
||||
'phpversion' => phpversion(),
|
||||
'start_time' => @$opcache_status['opcache_statistics']['start_time'] ? date('Y-m-d H:i:s',$opcache_status['opcache_statistics']['start_time']) : '',
|
||||
'last_restart_time' => @$opcache_status['opcache_statistics']['last_restart_time'] ? date('Y-m-d H:i:s',$opcache_status['opcache_statistics']['last_restart_time']) : $lng['opcacheinfo']['never'],
|
||||
'oom_restarts' => number_format(@$opcache_status['opcache_statistics']['oom_restarts'] ?: 0,0,'.',' '),
|
||||
'hash_restarts' => number_format(@$opcache_status['opcache_statistics']['hash_restarts'] ?: 0,0,'.',' '),
|
||||
'manual_restarts' => number_format(@$opcache_status['opcache_statistics']['manual_restarts'] ?: 0,0,'.',' '),
|
||||
'status' => (@$opcache_status['restart_in_progress'] ? $lng['opcacheinfo']['restartinprogress'] :
|
||||
(@$opcache_status['restart_pending'] ? $lng['opcacheinfo']['restartpending'] :
|
||||
(@$opcache_status['cache_full'] ? $lng['opcacheinfo']['cachefull'] :
|
||||
(@$opcache_status['opcache_enabled'] ? $lng['opcacheinfo']['enabled'] : $lng['opcacheinfo']['novalue'])))),
|
||||
'cachedscripts' => number_format(@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0,0,'.',' '),
|
||||
'cachehits' => number_format($cachehits,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $cachehits/($cachetotal)*100) : ''),
|
||||
'cachemiss' => number_format($cachemiss,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $cachemiss/($cachetotal)*100) : ''),
|
||||
'blacklistmiss' => number_format($blacklistmiss,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $blacklistmiss/($cachetotal)*100) : ''),
|
||||
);
|
||||
|
||||
$usedmem=@$opcache_status['memory_usage']['used_memory'] ?: 0;
|
||||
$usedmemstr=bsize($usedmem);
|
||||
$freemem=@$opcache_status['memory_usage']['free_memory'] ?: 0;
|
||||
$freememstr=bsize($freemem);
|
||||
$totalmem=$usedmem+$freemem;
|
||||
$wastedmem=@$opcache_status['memory_usage']['wasted_memory'] ?: 0;
|
||||
$wastedmemstr=bsize($wastedmem);
|
||||
if ($totalmem) {
|
||||
$memory=array(
|
||||
'total' => bsize($totalmem),
|
||||
'used' => $usedmemstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $usedmem/($totalmem)*100) : ''),
|
||||
'free' => $freememstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $freemem/($totalmem)*100) : ''),
|
||||
'wasted' => $wastedmemstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $wastedmem/($totalmem)*100) : ''),
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($opcache_status['interned_strings_usage'])) {
|
||||
$usedstring=@$opcache_status['interned_strings_usage']['used_memory'] ?: 0;
|
||||
$usedstringstr=bsize($usedstring);
|
||||
$freestring=@$opcache_status['interned_strings_usage']['free_memory'] ?: 0;
|
||||
$freestringstr=bsize($freestring);
|
||||
$totalstring=$usedstring+$freestring;
|
||||
$stringbuffer=array(
|
||||
'total' => bsize($totalstring),
|
||||
'used' => $usedstringstr . ($totalstring>0 ? sprintf(" (%.1f %%)", $usedstring/$totalstring*100) : ''),
|
||||
'free' => $freestringstr . ($totalstring>0 ? sprintf(" (%.1f %%)", $freestring/$totalstring*100) : ''),
|
||||
'strcount' => number_format(@$opcache_status['interned_strings_usage']['number_of_strings'] ?: 0,0,'.',' '),
|
||||
);
|
||||
}
|
||||
|
||||
$usedkey=@$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0;
|
||||
$usedkeystr=number_format($usedkey,0,'.',' ');
|
||||
$totalkey=@$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0;
|
||||
$wastedkey=$usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0);
|
||||
if (isset($opcache_status['opcache_statistics'])) {
|
||||
$keystat=array(
|
||||
'total' => number_format($totalkey,0,'.',' '),
|
||||
'used' => $usedkeystr . ($totalkey>0 ? sprintf(" (%.1f %%)", $usedkey/($totalkey)*100) : ''),
|
||||
'wasted' => number_format($wastedkey,0,'.',' ') . ($totalkey>0 ? sprintf(" (%.1f %%)", $wastedkey/($totalkey)*100) : ''),
|
||||
);
|
||||
}
|
||||
|
||||
$blacklistlines = '';
|
||||
if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) {
|
||||
foreach ($opcache_info['blacklist'] as $value) {
|
||||
eval("\$blacklistlines.=\"" . getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("settings/opcacheinfo/showinfo") . "\";");
|
||||
|
||||
}
|
||||
|
||||
function bsize($s) {
|
||||
foreach (array('', 'K', 'M', 'G') as $i => $k) {
|
||||
if ($s < 1024)
|
||||
break;
|
||||
$s/=1024;
|
||||
}
|
||||
return sprintf("%5.1f %sBytes", $s, $k);
|
||||
}
|
||||
@@ -115,6 +115,7 @@ if ($page == 'overview') {
|
||||
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
|
||||
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
|
||||
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
|
||||
$mod_fcgid_umask = validate($_POST['mod_fcgid_umask'], 'mod_fcgid_umask', '/^[0-9]*$/');
|
||||
// disable fpm stuff
|
||||
$fpm_enableslowlog = 0;
|
||||
$fpm_reqtermtimeout = 0;
|
||||
@@ -129,6 +130,7 @@ if ($page == 'overview') {
|
||||
$file_extensions = 'php';
|
||||
$mod_fcgid_starter = 0;
|
||||
$mod_fcgid_maxrequests = 0;
|
||||
$mod_fcgid_umask = "022";
|
||||
}
|
||||
|
||||
if (strlen($description) == 0
|
||||
@@ -144,6 +146,7 @@ if ($page == 'overview') {
|
||||
`file_extensions` = :fext,
|
||||
`mod_fcgid_starter` = :starter,
|
||||
`mod_fcgid_maxrequests` = :mreq,
|
||||
`mod_fcgid_umask` = :umask,
|
||||
`fpm_slowlog` = :fpmslow,
|
||||
`fpm_reqterm` = :fpmreqterm,
|
||||
`fpm_reqslow` = :fpmreqslow,
|
||||
@@ -155,6 +158,7 @@ if ($page == 'overview') {
|
||||
'fext' => $file_extensions,
|
||||
'starter' => $mod_fcgid_starter,
|
||||
'mreq' => $mod_fcgid_maxrequests,
|
||||
'umask' => $mod_fcgid_umask,
|
||||
'fpmslow' => $fpm_enableslowlog,
|
||||
'fpmreqterm' => $fpm_reqtermtimeout,
|
||||
'fpmreqslow' => $fpm_reqslowtimeout,
|
||||
@@ -265,6 +269,7 @@ if ($page == 'overview') {
|
||||
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
|
||||
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
|
||||
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
|
||||
$mod_fcgid_umask = validate($_POST['mod_fcgid_umask'], 'mod_fcgid_umask', '/^[0-9]*$/');
|
||||
// disable fpm stuff
|
||||
$fpm_enableslowlog = 0;
|
||||
$fpm_reqtermtimeout = 0;
|
||||
@@ -279,6 +284,7 @@ if ($page == 'overview') {
|
||||
$file_extensions = 'php';
|
||||
$mod_fcgid_starter = 0;
|
||||
$mod_fcgid_maxrequests = 0;
|
||||
$mod_fcgid_umask = "022";
|
||||
}
|
||||
|
||||
if (strlen($description) == 0
|
||||
@@ -294,6 +300,7 @@ if ($page == 'overview') {
|
||||
`file_extensions` = :fext,
|
||||
`mod_fcgid_starter` = :starter,
|
||||
`mod_fcgid_maxrequests` = :mreq,
|
||||
`mod_fcgid_umask` = :umask,
|
||||
`fpm_slowlog` = :fpmslow,
|
||||
`fpm_reqterm` = :fpmreqterm,
|
||||
`fpm_reqslow` = :fpmreqslow,
|
||||
@@ -306,6 +313,7 @@ if ($page == 'overview') {
|
||||
'fext' => $file_extensions,
|
||||
'starter' => $mod_fcgid_starter,
|
||||
'mreq' => $mod_fcgid_maxrequests,
|
||||
'umask' => $mod_fcgid_umask,
|
||||
'fpmslow' => $fpm_enableslowlog,
|
||||
'fpmreqterm' => $fpm_reqtermtimeout,
|
||||
'fpmreqslow' => $fpm_reqslowtimeout,
|
||||
|
||||
@@ -160,6 +160,8 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
inserttask('10');
|
||||
// Using nameserver, insert a task which rebuilds the server config
|
||||
inserttask('4');
|
||||
// cron.d file
|
||||
inserttask('99');
|
||||
|
||||
standard_success('rebuildingconfigs', '', array('filename' => 'admin_index.php'));
|
||||
|
||||
@@ -283,6 +285,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
foreach ($integrity->available as $id => $check) {
|
||||
$displayid = $id + 1;
|
||||
$result = $integrity->$check();
|
||||
$checkdesc = $lng['integrity_check'][$check];
|
||||
eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";");
|
||||
}
|
||||
eval("echo \"" . getTemplate("settings/integritycheck") . "\";");
|
||||
|
||||
@@ -201,7 +201,6 @@ if ($action == '') {
|
||||
|
||||
} else {
|
||||
standard_error('templatenotfound');
|
||||
exit;
|
||||
}
|
||||
|
||||
} elseif($action == 'add') {
|
||||
@@ -214,7 +213,7 @@ if ($action == '') {
|
||||
&& $_POST['prepare'] == 'prepare'
|
||||
) {
|
||||
//email templates
|
||||
$language = validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect');
|
||||
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
|
||||
$template = validate($_POST['template'], 'template');
|
||||
|
||||
$lng_bak = $lng;
|
||||
@@ -244,7 +243,7 @@ if ($action == '') {
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
//email templates
|
||||
$language = validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect');
|
||||
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
|
||||
$template = validate($_POST['template'], 'template');
|
||||
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
|
||||
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
|
||||
@@ -358,7 +357,6 @@ if ($action == '') {
|
||||
eval("echo \"" . getTemplate("templates/templates_add_1") . "\";");
|
||||
} else {
|
||||
standard_error('alltemplatesdefined');
|
||||
exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -371,7 +369,6 @@ if ($action == '') {
|
||||
|
||||
if (Database::num_rows() == count($file_templates)) {
|
||||
standard_error('alltemplatesdefined');
|
||||
exit;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -452,6 +449,8 @@ if ($action == '') {
|
||||
|
||||
$template_name = str_replace('_mailbody', '', $result['varname']);
|
||||
|
||||
// don't escape the already escaped language-string so save up before htmlentities()
|
||||
$language = $result['language'];
|
||||
$result = htmlentities_array($result);
|
||||
$mailbody = $result['value'];
|
||||
|
||||
@@ -512,6 +511,5 @@ if ($action == '') {
|
||||
|
||||
} else {
|
||||
standard_error('templatenotfound');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ if ($action == 'logout') {
|
||||
);
|
||||
Database::pexecute($logout_stmt, array('adminid' => $userinfo['adminid']));
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUpdates($version)) {
|
||||
if (hasDbUpdates($dbversion) || hasUpdates($version)) {
|
||||
$successful_update = false;
|
||||
$message = '';
|
||||
|
||||
@@ -85,15 +85,26 @@ if ($page == 'overview') {
|
||||
|
||||
if (!$successful_update) {
|
||||
$current_version = Settings::Get('panel.version');
|
||||
$current_db_version = Settings::Get('panel.db_version');
|
||||
if (empty($current_db_version)) {
|
||||
$current_db_version = "0";
|
||||
}
|
||||
$new_version = $version;
|
||||
$new_db_version = $dbversion;
|
||||
|
||||
$ui_text = $lng['update']['update_information']['part_a'];
|
||||
$ui_text = str_replace('%curversion', $current_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_version, $ui_text);
|
||||
if ($version != $current_version) {
|
||||
$ui_text = str_replace('%curversion', $current_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_version, $ui_text);
|
||||
} else {
|
||||
// show db version
|
||||
$ui_text = str_replace('%curversion', $current_db_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_db_version, $ui_text);
|
||||
}
|
||||
$update_information = $ui_text;
|
||||
|
||||
include_once './install/updates/preconfig.php';
|
||||
$preconfig = getPreConfig($current_version);
|
||||
$preconfig = getPreConfig($current_version, $current_db_version);
|
||||
if ($preconfig != '') {
|
||||
$update_information .= '<br />' . $preconfig . $message;
|
||||
}
|
||||
|
||||
1
cache/.gitignore
vendored
1
cache/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
*
|
||||
0
cache/.keep
vendored
0
cache/.keep
vendored
@@ -20,6 +20,11 @@
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','domains')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
@@ -36,7 +41,7 @@ if ($page == 'overview') {
|
||||
'd.domain' => $lng['domains']['domainname']
|
||||
);
|
||||
$paging = new paging($userinfo, TABLE_PANEL_DOMAINS, $fields);
|
||||
$domains_stmt = Database::prepare("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isemaildomain`, `d`.`caneditdomain`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias` FROM `" . TABLE_PANEL_DOMAINS . "` `d`
|
||||
$domains_stmt = Database::prepare("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isbinddomain`, `d`.`isemaildomain`, `d`.`caneditdomain`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `d`.`letsencrypt`, `d`.`termination_date`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias` FROM `" . TABLE_PANEL_DOMAINS . "` `d`
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id`
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `da` ON `da`.`aliasdomain`=`d`.`id`
|
||||
WHERE `d`.`customerid`= :customerid
|
||||
@@ -87,6 +92,18 @@ if ($page == 'overview') {
|
||||
}
|
||||
}
|
||||
|
||||
$row['termination_date'] = str_replace("0000-00-00", "", $row['termination_date']);
|
||||
if($row['termination_date'] != "") {
|
||||
$cdate = strtotime($row['termination_date'] . " 23:59:59");
|
||||
$today = time();
|
||||
|
||||
if($cdate < $today) {
|
||||
$row['termination_css'] = 'domain-expired';
|
||||
} else {
|
||||
$row['termination_css'] = 'domain-canceled';
|
||||
}
|
||||
}
|
||||
|
||||
$domains_count++;
|
||||
$domain_array[$row['domain']] = $row;
|
||||
}
|
||||
@@ -102,6 +119,11 @@ if ($page == 'overview') {
|
||||
if ($row['parentdomainid'] == 0) {
|
||||
$domain_sort_array[$sortkey][$sortkey] = $row;
|
||||
} else {
|
||||
// when searching and the results are subdomains only, we need to get
|
||||
// the parent domain to this subdomain
|
||||
if (!isset($domain_id_array[$row['parentdomainid']])) {
|
||||
$domain_id_array[$row['parentdomainid']] = "[parent-domain]";
|
||||
}
|
||||
$domain_sort_array[$domain_id_array[$row['parentdomainid']]][$sortkey] = $row;
|
||||
}
|
||||
}
|
||||
@@ -117,13 +139,16 @@ if ($page == 'overview') {
|
||||
$i = 0;
|
||||
foreach ($domain_sort_array as $sortkey => $domain_array) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($domain_array[$sortkey]);
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$statsapp = 'awstats';
|
||||
} else {
|
||||
$statsapp = 'webalizer';
|
||||
|
||||
if (isset($domain_array[$sortkey])) {
|
||||
$row = htmlentities_array($domain_array[$sortkey]);
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$statsapp = 'awstats';
|
||||
} else {
|
||||
$statsapp = 'webalizer';
|
||||
}
|
||||
eval("\$domains.=\"" . getTemplate("domains/domains_delimiter") . "\";");
|
||||
}
|
||||
eval("\$domains.=\"" . getTemplate("domains/domains_delimiter") . "\";");
|
||||
|
||||
if ($paging->sortfield == 'd.domain' && $paging->sortorder == 'asc') {
|
||||
ksort($domain_array);
|
||||
@@ -133,12 +158,12 @@ if ($page == 'overview') {
|
||||
|
||||
foreach ($domain_array as $row) {
|
||||
if (strpos($row['documentroot'], $userinfo['documentroot']) === 0) {
|
||||
$row['documentroot'] = makeCorrectDir(substr($row['documentroot'], strlen($userinfo['documentroot'])));
|
||||
$row['documentroot'] = makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['documentroot']));
|
||||
}
|
||||
|
||||
// get ssl-ips if activated
|
||||
$show_ssledit = false;
|
||||
if (Settings::Get('system.use_ssl') == '1' && domainHasSslIpPort($row['id']) && $row['caneditdomain'] == '1') {
|
||||
if (Settings::Get('system.use_ssl') == '1' && domainHasSslIpPort($row['id']) && $row['caneditdomain'] == '1' && $row['letsencrypt'] == 0) {
|
||||
$show_ssledit = true;
|
||||
}
|
||||
$row = htmlentities_array($row);
|
||||
@@ -151,7 +176,7 @@ if ($page == 'overview') {
|
||||
|
||||
eval("echo \"" . getTemplate("domains/domainlist") . "\";");
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
$stmt = Database::prepare("SELECT `id`, `customerid`, `domain`, `documentroot`, `isemaildomain`, `parentdomainid` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
$stmt = Database::prepare("SELECT `id`, `customerid`, `domain`, `documentroot`, `isemaildomain`, `parentdomainid`, `aliasdomain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid` = :customerid
|
||||
AND `id` = :id"
|
||||
);
|
||||
@@ -177,6 +202,8 @@ if ($page == 'overview') {
|
||||
}
|
||||
}
|
||||
|
||||
triggerLetsEncryptCSRForAliasDestinationDomain($result['aliasdomain'], $log);
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted subdomain '" . $idna_convert->decode($result['domain']) . "'");
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE
|
||||
`customerid` = :customerid
|
||||
@@ -203,6 +230,20 @@ if ($page == 'overview') {
|
||||
);
|
||||
Database::pexecute($del_stmt, array('domainid' => $id));
|
||||
|
||||
// remove certificate from domain_ssl_settings, fixes #1596
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "`
|
||||
WHERE `domainid` = :domainid"
|
||||
);
|
||||
Database::pexecute($del_stmt, array('domainid' => $id));
|
||||
|
||||
// remove possible existing DNS entries
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_DOMAIN_DNS . "`
|
||||
WHERE `domain_id` = :domainid
|
||||
");
|
||||
Database::pexecute($del_stmt, array('domainid' => $id));
|
||||
|
||||
inserttask('1');
|
||||
|
||||
// Using nameserver, insert a task which rebuilds the server config
|
||||
@@ -218,8 +259,13 @@ if ($page == 'overview') {
|
||||
} elseif ($action == 'add') {
|
||||
if ($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
if (strpos($_POST['subdomain'], '--') !== false) {
|
||||
standard_error('domain_nopunycode');
|
||||
}
|
||||
|
||||
$subdomain = $idna_convert->encode(preg_replace(array('/\:(\d)+$/', '/^https?\:\/\//'), '', validate($_POST['subdomain'], 'subdomain', '', 'subdomainiswrong')));
|
||||
$domain = $idna_convert->encode($_POST['domain']);
|
||||
$domain = $_POST['domain'];
|
||||
$domain_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `domain` = :domain
|
||||
AND `customerid` = :customerid
|
||||
@@ -231,9 +277,15 @@ if ($page == 'overview') {
|
||||
|
||||
$completedomain = $subdomain . '.' . $domain;
|
||||
|
||||
if (Settings::Get('system.validate_domain') && ! validateDomain($completedomain)) {
|
||||
standard_error(array(
|
||||
'stringiswrong',
|
||||
'mydomain'
|
||||
));
|
||||
}
|
||||
|
||||
if ($completedomain == Settings::Get('system.hostname')) {
|
||||
standard_error('admin_domain_emailsystemhostname');
|
||||
exit;
|
||||
}
|
||||
|
||||
$completedomain_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
@@ -264,16 +316,17 @@ if ($page == 'overview') {
|
||||
ORDER BY `d`.`domain` ASC;"
|
||||
);
|
||||
$aliasdomain_check = Database::pexecute_first($aliasdomain_stmt, array("id" => $aliasdomain, "customerid" => $userinfo['customerid']));
|
||||
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log);
|
||||
}
|
||||
|
||||
if (isset($_POST['url']) && $_POST['url'] != '' && validateUrl($idna_convert->encode($_POST['url']))) {
|
||||
if (isset($_POST['url']) && $_POST['url'] != '' && validateUrl($_POST['url'])) {
|
||||
$path = $_POST['url'];
|
||||
$_doredirect = true;
|
||||
} else {
|
||||
$path = validate($_POST['path'], 'path');
|
||||
}
|
||||
|
||||
if (!preg_match('/^https?\:\/\//', $path) || !validateUrl($idna_convert->encode($path))) {
|
||||
if (!preg_match('/^https?\:\/\//', $path) || !validateUrl($path)) {
|
||||
// If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
|
||||
// set default path to subdomain or domain name
|
||||
if ((($path == '') || ($path == '/')) && Settings::Get('system.documentroot_use_default_value') == 1) {
|
||||
@@ -295,15 +348,37 @@ if ($page == 'overview') {
|
||||
|
||||
$ssl_redirect = '0';
|
||||
if (isset($_POST['ssl_redirect']) && $_POST['ssl_redirect'] == '1') {
|
||||
// a ssl-redirect only works of there actually is a
|
||||
// a ssl-redirect only works if there actually is a
|
||||
// ssl ip/port assigned to the domain
|
||||
if (domainHasSslIpPort($domain_check['id']) == true) {
|
||||
$ssl_redirect = '1';
|
||||
$_doredirect = true;
|
||||
} else {
|
||||
standard_error('sslredirectonlypossiblewithsslipport');
|
||||
}
|
||||
}
|
||||
|
||||
$letsencrypt = '0';
|
||||
if (isset($_POST['letsencrypt']) && $_POST['letsencrypt'] == '1') {
|
||||
// let's encrypt only works if there actually is a
|
||||
// ssl ip/port assigned to the domain
|
||||
if (domainHasSslIpPort($domain_check['id']) == true) {
|
||||
$letsencrypt = '1';
|
||||
} else {
|
||||
standard_error('letsencryptonlypossiblewithsslipport');
|
||||
}
|
||||
}
|
||||
|
||||
// Temporarily deactivate ssl_redirect until Let's Encrypt certificate was generated
|
||||
if ($ssl_redirect > 0 && $letsencrypt == 1) {
|
||||
$ssl_redirect = 2;
|
||||
}
|
||||
|
||||
// HSTS
|
||||
$hsts_maxage = isset($_POST['hsts_maxage']) ? (int)$_POST['hsts_maxage'] : 0;
|
||||
$hsts_sub = isset($_POST['hsts_sub']) && (int)$_POST['hsts_sub'] == 1 ? 1 : 0;
|
||||
$hsts_preload = isset($_POST['hsts_preload']) && (int)$_POST['hsts_preload'] == 1 ? 1 : 0;
|
||||
|
||||
if ($path == '') {
|
||||
standard_error('patherror');
|
||||
} elseif ($subdomain == '') {
|
||||
@@ -345,7 +420,11 @@ if ($page == 'overview') {
|
||||
`speciallogfile` = :speciallogfile,
|
||||
`specialsettings` = :specialsettings,
|
||||
`ssl_redirect` = :ssl_redirect,
|
||||
`phpsettingid` = :phpsettingid"
|
||||
`phpsettingid` = :phpsettingid,
|
||||
`letsencrypt` = :letsencrypt,
|
||||
`hsts` = :hsts,
|
||||
`hsts_sub` = :hsts_sub,
|
||||
`hsts_preload` = :hsts_preload"
|
||||
);
|
||||
$params = array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
@@ -361,7 +440,11 @@ if ($page == 'overview') {
|
||||
"speciallogfile" => $domain_check['speciallogfile'],
|
||||
"specialsettings" => $domain_check['specialsettings'],
|
||||
"ssl_redirect" => $ssl_redirect,
|
||||
"phpsettingid" => $phpsid_result['phpsettingid']
|
||||
"phpsettingid" => $phpsid_result['phpsettingid'],
|
||||
"letsencrypt" => $letsencrypt,
|
||||
"hsts" => $hsts_maxage,
|
||||
"hsts_sub" => $hsts_sub,
|
||||
"hsts_preload" => $hsts_preload
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
@@ -394,7 +477,7 @@ if ($page == 'overview') {
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
}
|
||||
} else {
|
||||
$stmt = Database::prepare("SELECT `id`, `domain`, `documentroot`, `ssl_redirect`,`isemaildomain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
$stmt = Database::prepare("SELECT `id`, `domain`, `documentroot`, `ssl_redirect`,`isemaildomain`,`letsencrypt` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid` = :customerid
|
||||
AND `parentdomainid` = '0'
|
||||
AND `email_only` = '0'
|
||||
@@ -455,8 +538,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
|
||||
$stmt = Database::prepare("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isemaildomain`, `d`.`wwwserveralias`, `d`.`iswildcarddomain`,
|
||||
`d`.`parentdomainid`, `d`.`ssl_redirect`, `d`.`aliasdomain`, `d`.`openbasedir`, `d`.`openbasedir_path`, `pd`.`subcanemaildomain`
|
||||
$stmt = Database::prepare("SELECT `d`.*, `pd`.`subcanemaildomain`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_DOMAINS . "` `pd`
|
||||
WHERE `d`.`customerid` = :customerid
|
||||
AND `d`.`id` = :id
|
||||
@@ -474,14 +556,14 @@ if ($page == 'overview') {
|
||||
|
||||
if (isset($result['customerid']) && $result['customerid'] == $userinfo['customerid']) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
if (isset($_POST['url']) && $_POST['url'] != '' && validateUrl($idna_convert->encode($_POST['url']))) {
|
||||
if (isset($_POST['url']) && $_POST['url'] != '' && validateUrl($_POST['url'])) {
|
||||
$path = $_POST['url'];
|
||||
$_doredirect = true;
|
||||
} else {
|
||||
$path = validate($_POST['path'], 'path');
|
||||
}
|
||||
|
||||
if (!preg_match('/^https?\:\/\//', $path) || !validateUrl($idna_convert->encode($path))) {
|
||||
if (!preg_match('/^https?\:\/\//', $path) || !validateUrl($path)) {
|
||||
// If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
|
||||
// set default path to subdomain or domain name
|
||||
if ((($path == '') || ($path == '/')) && Settings::Get('system.documentroot_use_default_value') == 1) {
|
||||
@@ -496,9 +578,9 @@ if ($page == 'overview') {
|
||||
$_doredirect = true;
|
||||
}
|
||||
|
||||
$aliasdomain = intval($_POST['alias']);
|
||||
$aliasdomain = isset($_POST['alias']) ? intval($_POST['alias']) : 0;
|
||||
|
||||
if (isset($_POST['selectserveralias']) && $result['parentdomainid'] == '0' ) {
|
||||
if (isset($_POST['selectserveralias'])) {
|
||||
$iswildcarddomain = ($_POST['selectserveralias'] == '0') ? '1' : '0';
|
||||
$wwwserveralias = ($_POST['selectserveralias'] == '1') ? '1' : '0';
|
||||
} else {
|
||||
@@ -536,10 +618,11 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
if (isset($_POST['ssl_redirect']) && $_POST['ssl_redirect'] == '1') {
|
||||
// a ssl-redirect only works of there actually is a
|
||||
// a ssl-redirect only works if there actually is a
|
||||
// ssl ip/port assigned to the domain
|
||||
if (domainHasSslIpPort($id) == true) {
|
||||
$ssl_redirect = '1';
|
||||
$_doredirect = true;
|
||||
} else {
|
||||
standard_error('sslredirectonlypossiblewithsslipport');
|
||||
}
|
||||
@@ -547,6 +630,33 @@ if ($page == 'overview') {
|
||||
$ssl_redirect = '0';
|
||||
}
|
||||
|
||||
if (isset($_POST['letsencrypt']) && $_POST['letsencrypt'] == '1') {
|
||||
// let's encrypt only works if there actually is a
|
||||
// ssl ip/port assigned to the domain
|
||||
if (domainHasSslIpPort($id) == true) {
|
||||
$letsencrypt = '1';
|
||||
} else {
|
||||
standard_error('letsencryptonlypossiblewithsslipport');
|
||||
}
|
||||
} else {
|
||||
$letsencrypt = '0';
|
||||
}
|
||||
|
||||
// We can't enable let's encrypt for wildcard - domains
|
||||
if ($iswildcarddomain == '1' && $letsencrypt == '1') {
|
||||
standard_error('nowildcardwithletsencrypt');
|
||||
}
|
||||
|
||||
// Temporarily deactivate ssl_redirect until Let's Encrypt certificate was generated
|
||||
if ($ssl_redirect > 0 && $letsencrypt == 1 && $result['letsencrypt'] != $letsencrypt) {
|
||||
$ssl_redirect = 2;
|
||||
}
|
||||
|
||||
// HSTS
|
||||
$hsts_maxage = isset($_POST['hsts_maxage']) ? (int)$_POST['hsts_maxage'] : 0;
|
||||
$hsts_sub = isset($_POST['hsts_sub']) && (int)$_POST['hsts_sub'] == 1 ? 1 : 0;
|
||||
$hsts_preload = isset($_POST['hsts_preload']) && (int)$_POST['hsts_preload'] == 1 ? 1 : 0;
|
||||
|
||||
if ($path == '') {
|
||||
standard_error('patherror');
|
||||
} else {
|
||||
@@ -570,7 +680,12 @@ if ($page == 'overview') {
|
||||
|| $iswildcarddomain != $result['iswildcarddomain']
|
||||
|| $aliasdomain != $result['aliasdomain']
|
||||
|| $openbasedir_path != $result['openbasedir_path']
|
||||
|| $ssl_redirect != $result['ssl_redirect']) {
|
||||
|| $ssl_redirect != $result['ssl_redirect']
|
||||
|| $letsencrypt != $result['letsencrypt']
|
||||
|| $hsts_maxage != $result['hsts']
|
||||
|| $hsts_sub != $result['hsts_sub']
|
||||
|| $hsts_preload != $result['hsts_preload']
|
||||
) {
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited domain '" . $idna_convert->decode($result['domain']) . "'");
|
||||
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
|
||||
@@ -580,7 +695,11 @@ if ($page == 'overview') {
|
||||
`iswildcarddomain`= :iswildcarddomain,
|
||||
`aliasdomain`= :aliasdomain,
|
||||
`openbasedir_path`= :openbasedir_path,
|
||||
`ssl_redirect`= :ssl_redirect
|
||||
`ssl_redirect`= :ssl_redirect,
|
||||
`letsencrypt`= :letsencrypt,
|
||||
`hsts` = :hsts,
|
||||
`hsts_sub` = :hsts_sub,
|
||||
`hsts_preload` = :hsts_preload
|
||||
WHERE `customerid`= :customerid
|
||||
AND `id`= :id"
|
||||
);
|
||||
@@ -592,10 +711,34 @@ if ($page == 'overview') {
|
||||
"aliasdomain" => ($aliasdomain != 0 && $alias_check == 0) ? $aliasdomain : null,
|
||||
"openbasedir_path" => $openbasedir_path,
|
||||
"ssl_redirect" => $ssl_redirect,
|
||||
"letsencrypt" => $letsencrypt,
|
||||
"hsts" => $hsts_maxage,
|
||||
"hsts_sub" => $hsts_sub,
|
||||
"hsts_preload" => $hsts_preload,
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"id" => $id
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
if ($result['aliasdomain'] != $aliasdomain) {
|
||||
// trigger when domain id for alias destination has changed: both for old and new destination
|
||||
triggerLetsEncryptCSRForAliasDestinationDomain($result['aliasdomain'], $log);
|
||||
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log);
|
||||
} elseif ($result['wwwserveralias'] != $wwwserveralias || $result['letsencrypt'] != $letsencrypt) {
|
||||
// or when wwwserveralias or letsencrypt was changed
|
||||
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log);
|
||||
}
|
||||
|
||||
// check whether LE has been disabled, so we remove the certificate
|
||||
if ($letsencrypt == '0' && $result['letsencrypt'] == '1') {
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :id
|
||||
");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
}
|
||||
|
||||
inserttask('1');
|
||||
|
||||
// Using nameserver, insert a task which rebuilds the server config
|
||||
@@ -621,7 +764,7 @@ if ($page == 'overview') {
|
||||
AND `dip`.`id_ipandports`
|
||||
IN (SELECT `id_ipandports` FROM `".TABLE_DOMAINTOIP."`
|
||||
WHERE `id_domain` = :id)
|
||||
GROUP BY `d`.`domain`
|
||||
GROUP BY `d`.`id`, `d`.`domain`
|
||||
ORDER BY `d`.`domain` ASC"
|
||||
);
|
||||
Database::pexecute($domains_stmt, array("id" => $result['id'], "customerid" => $userinfo['customerid']));
|
||||
@@ -630,7 +773,7 @@ if ($page == 'overview') {
|
||||
$domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']);
|
||||
}
|
||||
|
||||
if (preg_match('/^https?\:\/\//', $result['documentroot']) && validateUrl($idna_convert->encode($result['documentroot']))) {
|
||||
if (preg_match('/^https?\:\/\//', $result['documentroot']) && validateUrl($result['documentroot'])) {
|
||||
if (Settings::Get('panel.pathedit') == 'Dropdown') {
|
||||
$urlvalue = $result['documentroot'];
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||
@@ -661,6 +804,10 @@ if ($page == 'overview') {
|
||||
$ssl_ipsandports = 'notempty';
|
||||
}
|
||||
|
||||
// Fudge the result for ssl_redirect to hide the Let's Encrypt steps
|
||||
$result['temporary_ssl_redirect'] = $result['ssl_redirect'];
|
||||
$result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1);
|
||||
|
||||
$openbasedir = makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true);
|
||||
|
||||
// create serveralias options
|
||||
@@ -819,4 +966,12 @@ if ($page == 'overview') {
|
||||
|
||||
eval("echo \"" . getTemplate("domains/domain_ssleditor") . "\";");
|
||||
}
|
||||
} elseif ($page == 'domaindnseditor' && $userinfo['dnsenabled'] == '1' && Settings::Get('system.dnsenabled') == '1') {
|
||||
|
||||
require_once __DIR__.'/dns_editor.php';
|
||||
|
||||
} elseif ($page == 'sslcertificates') {
|
||||
|
||||
require_once __DIR__.'/ssl_certificates.php';
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','email')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
@@ -200,7 +205,8 @@ if ($page == 'overview') {
|
||||
if ($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$email_part = $_POST['email_part'];
|
||||
$domain = $idna_convert->encode(validate($_POST['domain'], 'domain'));
|
||||
// domain does not need idna encoding as the value of the select-box is already Punycode
|
||||
$domain = validate($_POST['domain'], 'domain');
|
||||
$stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `domain`= :domain
|
||||
AND `customerid`= :customerid
|
||||
@@ -244,7 +250,6 @@ if ($page == 'overview') {
|
||||
standard_error('emailexistalready', $email_full);
|
||||
} elseif ($email_check['email'] == $email) {
|
||||
standard_error('youhavealreadyacatchallforthisdomain');
|
||||
exit;
|
||||
} else {
|
||||
$stmt = Database::prepare("INSERT INTO `" . TABLE_MAIL_VIRTUAL . "`
|
||||
(`customerid`, `email`, `email_full`, `iscatchall`, `domainid`)
|
||||
@@ -377,7 +382,6 @@ if ($page == 'overview') {
|
||||
|
||||
if ($email_check['email'] == $email) {
|
||||
standard_error('youhavealreadyacatchallforthisdomain');
|
||||
exit;
|
||||
} else {
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_MAIL_VIRTUAL . "`
|
||||
SET `email` = :email , `iscatchall` = '1'
|
||||
@@ -414,10 +418,11 @@ if ($page == 'overview') {
|
||||
standard_error('notallowedtouseaccounts');
|
||||
}
|
||||
|
||||
$stmt = Database::prepare("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid`, `domainid` FROM `" . TABLE_MAIL_VIRTUAL . "`
|
||||
WHERE `customerid`= :cid
|
||||
AND `id`= :id"
|
||||
);
|
||||
$stmt = Database::prepare("
|
||||
SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid`, `domainid`
|
||||
FROM `" . TABLE_MAIL_VIRTUAL . "`
|
||||
WHERE `customerid`= :cid AND `id`= :id
|
||||
");
|
||||
$result = Database::pexecute_first($stmt, array("cid" => $userinfo['customerid'], "id" => $id));
|
||||
|
||||
if (isset($result['email']) && $result['email'] != '' && $result['popaccountid'] == '0') {
|
||||
@@ -461,7 +466,9 @@ if ($page == 'overview') {
|
||||
$maildirname=trim(Settings::Get('system.vmail_maildirname'));
|
||||
// Add trailing slash to Maildir if needed
|
||||
$maildirpath=$maildirname;
|
||||
if (!empty($maildirname) and substr($maildirname,-1) != "/") $maildirpath.="/";
|
||||
if (!empty($maildirname) && substr($maildirname,-1) != "/") {
|
||||
$maildirpath.="/";
|
||||
}
|
||||
|
||||
$stmt = Database::prepare("INSERT INTO `" . TABLE_MAIL_USERS . "`
|
||||
(`customerid`, `email`, `username`, " . (Settings::Get('system.mailpwcleartext') == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`, `quota`, `imap`, `pop3`) ".
|
||||
@@ -595,7 +602,7 @@ if ($page == 'overview') {
|
||||
|
||||
if ($_mailerror) {
|
||||
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||
standard_error(array('errorsendingmail', $alternative_email));
|
||||
standard_error(array('errorsendingmail'), $alternative_email);
|
||||
}
|
||||
|
||||
$mail->ClearAddresses();
|
||||
@@ -604,6 +611,11 @@ if ($page == 'overview') {
|
||||
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
} else {
|
||||
|
||||
if (checkMailAccDeletionState($result['email_full'])) {
|
||||
standard_error(array('mailaccistobedeleted'), $result['email_full']);
|
||||
}
|
||||
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
$quota = Settings::Get('system.mail_quota');
|
||||
@@ -633,11 +645,9 @@ if ($page == 'overview') {
|
||||
|
||||
if ($password == '') {
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
exit;
|
||||
}
|
||||
elseif ($password == $result['email_full']) {
|
||||
standard_error('passwordshouldnotbeusername');
|
||||
exit;
|
||||
}
|
||||
|
||||
$password = validatePassword($password);
|
||||
|
||||
@@ -16,10 +16,14 @@
|
||||
* @package Panel
|
||||
*
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','extras')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
@@ -30,6 +34,12 @@ if ($page == 'overview') {
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras");
|
||||
eval("echo \"" . getTemplate("extras/extras") . "\";");
|
||||
} elseif ($page == 'htpasswds') {
|
||||
|
||||
// redirect if this customer sub-page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','extras.directoryprotection')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if ($action == '') {
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
|
||||
$fields = array(
|
||||
@@ -38,9 +48,10 @@ if ($page == 'overview') {
|
||||
);
|
||||
$paging = new paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields);
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
|
||||
);
|
||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$paging->setEntries(Database::num_rows());
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
@@ -53,43 +64,54 @@ if ($page == 'overview') {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
if (strpos($row['path'], $userinfo['documentroot']) === 0) {
|
||||
$row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
|
||||
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
|
||||
}
|
||||
|
||||
$row['path'] = makeCorrectDir($row['path']);
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
|
||||
$count++;
|
||||
$count ++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
$i ++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("extras/htpasswds") . "\";");
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
WHERE `customerid`= :customerid
|
||||
AND `id`= :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
|
||||
AND `id`= :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"id" => $id
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (isset($result['username']) && $result['username'] != '') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
WHERE `customerid`= :customerid
|
||||
AND `id`= :id"
|
||||
);
|
||||
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
|
||||
AND `id`= :id");
|
||||
Database::pexecute($stmt, array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"id" => $id
|
||||
));
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
if (strpos($result['path'], $userinfo['documentroot']) === 0) {
|
||||
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
|
||||
}
|
||||
|
||||
ask_yesno('extras_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username'] . ' (' . $result['path'] . ')');
|
||||
ask_yesno('extras_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['username'] . ' (' . $result['path'] . ')');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
@@ -104,8 +126,7 @@ if ($page == 'overview') {
|
||||
$username_path_check_stmt = Database::prepare("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
WHERE `username`= :username
|
||||
AND `path`= :path
|
||||
AND `customerid`= :customerid"
|
||||
);
|
||||
AND `customerid`= :customerid");
|
||||
$params = array(
|
||||
"username" => $username,
|
||||
"path" => $path,
|
||||
@@ -121,16 +142,22 @@ if ($page == 'overview') {
|
||||
$password = crypt($_POST['directory_password']);
|
||||
}
|
||||
|
||||
if (!$_POST['path']) {
|
||||
if (! $_POST['path']) {
|
||||
standard_error('invalidpath');
|
||||
}
|
||||
|
||||
if ($username == '') {
|
||||
standard_error(array('stringisempty', 'myloginname'));
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'myloginname'
|
||||
));
|
||||
} elseif ($username_path_check['username'] == $username && $username_path_check['path'] == $path) {
|
||||
standard_error('userpathcombinationdupe');
|
||||
} elseif ($_POST['directory_password'] == '') {
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'mypassword'
|
||||
));
|
||||
} elseif ($path == '') {
|
||||
standard_error('patherror');
|
||||
} elseif ($_POST['directory_password'] == $username) {
|
||||
@@ -141,8 +168,7 @@ if ($page == 'overview') {
|
||||
`username` = :username,
|
||||
`password` = :password,
|
||||
`path` = :path,
|
||||
`authname` = :authname"
|
||||
);
|
||||
`authname` = :authname");
|
||||
$params = array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"username" => $username,
|
||||
@@ -153,12 +179,15 @@ if ($page == 'overview') {
|
||||
Database::pexecute($stmt, $params);
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||
|
||||
$htpasswd_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htpasswd_add.php';
|
||||
$htpasswd_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_add.php';
|
||||
$htpasswd_add_form = htmlform::genHTMLForm($htpasswd_add_data);
|
||||
|
||||
$title = $htpasswd_add_data['htpasswd_add']['title'];
|
||||
@@ -169,9 +198,11 @@ if ($page == 'overview') {
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
WHERE `customerid`= :customerid
|
||||
AND `id`= :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
|
||||
AND `id`= :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"id" => $id
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (isset($result['username']) && $result['username'] != '') {
|
||||
@@ -208,28 +239,30 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
if ($pwd_sql != '' || $auth_sql != '') {
|
||||
if ($pwd_sql !='' && $auth_sql != '') {
|
||||
$pwd_sql.= ', ';
|
||||
if ($pwd_sql != '' && $auth_sql != '') {
|
||||
$pwd_sql .= ', ';
|
||||
}
|
||||
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
SET ".$pwd_sql.$auth_sql."
|
||||
SET " . $pwd_sql . $auth_sql . "
|
||||
WHERE `customerid`= :customerid
|
||||
AND `id`= :id"
|
||||
);
|
||||
AND `id`= :id");
|
||||
Database::pexecute($stmt, $params);
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
} else {
|
||||
if (strpos($result['path'], $userinfo['documentroot']) === 0) {
|
||||
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
|
||||
$htpasswd_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htpasswd_edit.php';
|
||||
$htpasswd_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_edit.php';
|
||||
$htpasswd_edit_form = htmlform::genHTMLForm($htpasswd_edit_data);
|
||||
|
||||
$title = $htpasswd_edit_data['htpasswd_edit']['title'];
|
||||
@@ -240,6 +273,12 @@ if ($page == 'overview') {
|
||||
}
|
||||
}
|
||||
} elseif ($page == 'htaccess') {
|
||||
|
||||
// redirect if this customer sub-page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','extras.pathoptions')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if ($action == '') {
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
|
||||
$fields = array(
|
||||
@@ -252,9 +291,10 @@ if ($page == 'overview') {
|
||||
);
|
||||
$paging = new paging($userinfo, TABLE_PANEL_HTACCESS, $fields);
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
|
||||
);
|
||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$paging->setEntries(Database::num_rows());
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
@@ -269,44 +309,69 @@ if ($page == 'overview') {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
if (strpos($row['path'], $userinfo['documentroot']) === 0) {
|
||||
$row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
|
||||
// don't show nothing wehn it's the docroot, show slash
|
||||
if ($row['path'] == '') { $row['path'] = '/'; }
|
||||
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
|
||||
}
|
||||
|
||||
$row['path'] = makeCorrectDir($row['path']);
|
||||
$row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']);
|
||||
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
|
||||
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
|
||||
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";");
|
||||
$count++;
|
||||
$count ++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
$i ++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("extras/htaccess") . "\";");
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
|
||||
WHERE `customerid` = :customerid
|
||||
AND `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
|
||||
AND `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"id" => $id
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (isset($result['customerid']) && $result['customerid'] != '' && $result['customerid'] == $userinfo['customerid']) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// do we have to remove the symlink and folder in suexecpath?
|
||||
if ((int) Settings::Get('perl.suexecworkaround') == 1) {
|
||||
$loginname = getCustomerDetail($result['customerid'], 'loginname');
|
||||
$suexecpath = makeCorrectDir(Settings::Get('perl.suexecpath') . '/' . $loginname . '/' . md5($result['path']) . '/');
|
||||
$perlsymlink = makeCorrectFile($result['path'] . '/cgi-bin');
|
||||
// remove symlink
|
||||
if (file_exists($perlsymlink)) {
|
||||
safe_exec('rm -f ' . escapeshellarg($perlsymlink));
|
||||
$log->logAction(USR_ACTION, LOG_DEBUG, "deleted suexecworkaround symlink '" . $perlsymlink . "'");
|
||||
}
|
||||
// remove folder in suexec-path
|
||||
if (file_exists($suexecpath)) {
|
||||
safe_exec('rm -rf ' . escapeshellarg($suexecpath));
|
||||
$log->logAction(USR_ACTION, LOG_DEBUG, "deleted suexecworkaround path '" . $suexecpath . "'");
|
||||
}
|
||||
}
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTACCESS . "`
|
||||
WHERE `customerid`= :customerid
|
||||
AND `id`= :id"
|
||||
);
|
||||
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
|
||||
AND `id`= :id");
|
||||
Database::pexecute($stmt, array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"id" => $id
|
||||
));
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
ask_yesno('extras_reallydelete_pathoptions', $filename, array('id' => $id, 'page' => $page, 'action' => $action), str_replace($userinfo['documentroot'], '', $result['path']));
|
||||
ask_yesno('extras_reallydelete_pathoptions', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), str_replace($userinfo['documentroot'], '/', $result['path']));
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
@@ -316,16 +381,18 @@ if ($page == 'overview') {
|
||||
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
|
||||
$path_dupe_check_stmt = Database::prepare("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "`
|
||||
WHERE `path`= :path
|
||||
AND `customerid`= :customerid"
|
||||
);
|
||||
Database::pexecute($path_dupe_check_stmt, array("path" => $path, "customerid" => $userinfo['customerid']));
|
||||
AND `customerid`= :customerid");
|
||||
Database::pexecute($path_dupe_check_stmt, array(
|
||||
"path" => $path,
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$path_dupe_check = $path_dupe_check_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$_POST['path']) {
|
||||
if (! $_POST['path']) {
|
||||
standard_error('invalidpath');
|
||||
}
|
||||
|
||||
if (isset($_POST['options_cgi']) && (int)$_POST['options_cgi'] != 0) {
|
||||
if (isset($_POST['options_cgi']) && (int) $_POST['options_cgi'] != 0) {
|
||||
$options_cgi = '1';
|
||||
} else {
|
||||
$options_cgi = '0';
|
||||
@@ -358,8 +425,7 @@ if ($page == 'overview') {
|
||||
`error404path` = :error404path,
|
||||
`error403path` = :error403path,
|
||||
`error500path` = :error500path,
|
||||
`options_cgi` = :options_cgi'
|
||||
);
|
||||
`options_cgi` = :options_cgi');
|
||||
$params = array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"path" => $path,
|
||||
@@ -373,13 +439,16 @@ if ($page == 'overview') {
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
|
||||
|
||||
$htaccess_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htaccess_add.php';
|
||||
$htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php';
|
||||
$htaccess_add_form = htmlform::genHTMLForm($htaccess_add_data);
|
||||
|
||||
$title = $htaccess_add_data['htaccess_add']['title'];
|
||||
@@ -390,9 +459,11 @@ if ($page == 'overview') {
|
||||
} elseif (($action == 'edit') && ($id != 0)) {
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
|
||||
WHERE `customerid` = :customerid
|
||||
AND `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
|
||||
AND `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"id" => $id
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ((isset($result['customerid'])) && ($result['customerid'] != '') && ($result['customerid'] == $userinfo['customerid'])) {
|
||||
@@ -412,12 +483,7 @@ if ($page == 'overview') {
|
||||
$error403path = correctErrorDocument($_POST['error403path']);
|
||||
$error500path = correctErrorDocument($_POST['error500path']);
|
||||
|
||||
if (($option_indexes != $result['options_indexes'])
|
||||
|| ($error404path != $result['error404path'])
|
||||
|| ($error403path != $result['error403path'])
|
||||
|| ($error500path != $result['error500path'])
|
||||
|| ($options_cgi != $result['options_cgi'])
|
||||
) {
|
||||
if (($option_indexes != $result['options_indexes']) || ($error404path != $result['error404path']) || ($error403path != $result['error403path']) || ($error500path != $result['error500path']) || ($options_cgi != $result['options_cgi'])) {
|
||||
inserttask('1');
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTACCESS . "`
|
||||
SET `options_indexes` = :options_indexes,
|
||||
@@ -426,8 +492,7 @@ if ($page == 'overview') {
|
||||
`error500path` = :error500path,
|
||||
`options_cgi` = :options_cgi
|
||||
WHERE `customerid` = :customerid
|
||||
AND `id` = :id"
|
||||
);
|
||||
AND `id` = :id");
|
||||
$params = array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"options_indexes" => $_POST['options_indexes'] == '1' ? '1' : '0',
|
||||
@@ -438,15 +503,16 @@ if ($page == 'overview') {
|
||||
"id" => $id
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
if (strpos($result['path'], $userinfo['documentroot']) === 0) {
|
||||
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
// don't show nothing wehn it's the docroot, show slash
|
||||
if ($result['path'] == '') { $result['path'] = '/'; }
|
||||
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
|
||||
}
|
||||
|
||||
$result['error404path'] = $result['error404path'];
|
||||
@@ -454,12 +520,12 @@ if ($page == 'overview') {
|
||||
$result['error500path'] = $result['error500path'];
|
||||
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
|
||||
/*
|
||||
$options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
||||
$options_cgi = makeyesno('options_cgi', '1', '0', $result['options_cgi']);
|
||||
*/
|
||||
* $options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
||||
* $options_cgi = makeyesno('options_cgi', '1', '0', $result['options_cgi']);
|
||||
*/
|
||||
$result = htmlentities_array($result);
|
||||
|
||||
$htaccess_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htaccess_edit.php';
|
||||
$htaccess_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_edit.php';
|
||||
$htaccess_edit_form = htmlform::genHTMLForm($htaccess_edit_data);
|
||||
|
||||
$title = $htaccess_edit_data['htaccess_edit']['title'];
|
||||
@@ -469,4 +535,106 @@ if ($page == 'overview') {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($page == 'backup') {
|
||||
|
||||
// redirect if this customer sub-page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','extras.backup')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if (Settings::Get('system.backupenabled') == 1)
|
||||
{
|
||||
if ($action == 'abort' && isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob");
|
||||
$entry = isset($_POST['backup_job_entry']) ? (int)$_POST['backup_job_entry'] : 0;
|
||||
if ($entry > 0) {
|
||||
$del_stmt = Database::prepare("DELETE FROM `".TABLE_PANEL_TASKS."` WHERE `id` = :tid");
|
||||
Database::pexecute($del_stmt, array('tid' => $entry));
|
||||
standard_success('backupaborted');
|
||||
}
|
||||
redirectTo($filename, array('page' => $page, 'action' => '', 's' => $s));
|
||||
}
|
||||
if ($action == '') {
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup");
|
||||
|
||||
// check whether there is a backup-job for this customer
|
||||
$sel_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_TASKS."` WHERE `type` = '20'");
|
||||
Database::pexecute($sel_stmt);
|
||||
$existing_backupJob = null;
|
||||
while ($entry = $sel_stmt->fetch())
|
||||
{
|
||||
$data = unserialize($entry['data']);
|
||||
if ($data['customerid'] == $userinfo['customerid']) {
|
||||
$existing_backupJob = $entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
if (! $_POST['path']) {
|
||||
standard_error('invalidpath');
|
||||
}
|
||||
|
||||
$path = makeCorrectDir(validate($_POST['path'], 'path'));
|
||||
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
|
||||
|
||||
$backup_dbs = isset($_POST['backup_dbs']) ? intval($_POST['backup_dbs']) : 0;
|
||||
$backup_mail = isset($_POST['backup_mail']) ? intval($_POST['backup_mail']) : 0;
|
||||
$backup_web = isset($_POST['backup_web']) ? intval($_POST['backup_web']) : 0;
|
||||
|
||||
if ($backup_dbs != '1') {
|
||||
$backup_dbs = '0';
|
||||
}
|
||||
|
||||
if ($backup_mail != '1') {
|
||||
$backup_mail = '0';
|
||||
}
|
||||
|
||||
if ($backup_web != '1') {
|
||||
$backup_web = '0';
|
||||
}
|
||||
|
||||
$task_data = array(
|
||||
'customerid' => $userinfo['customerid'],
|
||||
'uid' => $userinfo['guid'],
|
||||
'gid' => $userinfo['guid'],
|
||||
'loginname' => $userinfo['loginname'],
|
||||
'destdir' => $path,
|
||||
'backup_dbs' => $backup_dbs,
|
||||
'backup_mail' => $backup_mail,
|
||||
'backup_web' => $backup_web
|
||||
);
|
||||
// schedule backup job
|
||||
inserttask('20', $task_data);
|
||||
|
||||
standard_success('backupscheduled');
|
||||
} else {
|
||||
|
||||
if (!empty($existing_backupJob)) {
|
||||
$action = "abort";
|
||||
$row = unserialize($entry['data']);
|
||||
$row['path'] = makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['destdir']));
|
||||
$row['backup_web'] = ($row['backup_web'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
$row['backup_mail'] = ($row['backup_mail'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
$row['backup_dbs'] = ($row['backup_dbs'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
}
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||
$backup_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.backup.php';
|
||||
$backup_form = htmlform::genHTMLForm($backup_data);
|
||||
$title = $backup_data['backup']['title'];
|
||||
$image = $backup_data['backup']['image'];
|
||||
|
||||
if (!empty($existing_backupJob)) {
|
||||
// overwrite backup_form after we took everything from it we needed
|
||||
eval("\$backup_form = \"" . getTemplate("extras/backup_listexisting") . "\";");
|
||||
}
|
||||
eval("echo \"" . getTemplate("extras/backup") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('backupfunctionnotenabled');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','ftp')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
$id = 0;
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
@@ -40,7 +45,7 @@ if ($page == 'overview') {
|
||||
);
|
||||
$paging = new paging($userinfo, TABLE_FTP_USERS, $fields);
|
||||
|
||||
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir` FROM `" . TABLE_FTP_USERS . "`
|
||||
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `shell` FROM `" . TABLE_FTP_USERS . "`
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
|
||||
);
|
||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
|
||||
@@ -57,7 +62,7 @@ if ($page == 'overview') {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
if (strpos($row['homedir'], $userinfo['documentroot']) === 0) {
|
||||
$row['documentroot'] = substr($row['homedir'], strlen($userinfo['documentroot']));
|
||||
$row['documentroot'] = str_replace($userinfo['documentroot'], "/", $row['homedir']);
|
||||
} else {
|
||||
$row['documentroot'] = $row['homedir'];
|
||||
}
|
||||
@@ -153,6 +158,10 @@ if ($page == 'overview') {
|
||||
$path = validate($_POST['path'], 'path');
|
||||
$password = validate($_POST['ftp_password'], 'password');
|
||||
$password = validatePassword($password);
|
||||
$shell = "/bin/false";
|
||||
if (Settings::Get('system.allow_customer_shell') == '1') {
|
||||
$shell = isset($_POST['shell']) ? validate($_POST['shell'], 'shell') : '/bin/false';
|
||||
}
|
||||
|
||||
$sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0;
|
||||
if ($sendinfomail != 1) {
|
||||
@@ -200,8 +209,8 @@ if ($page == 'overview') {
|
||||
$cryptPassword = makeCryptPassword($password);
|
||||
|
||||
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_USERS . "`
|
||||
(`customerid`, `username`, `description`, `password`, `homedir`, `login_enabled`, `uid`, `gid`)
|
||||
VALUES (:customerid, :username, :description, :password, :homedir, 'y', :guid, :guid)"
|
||||
(`customerid`, `username`, `description`, `password`, `homedir`, `login_enabled`, `uid`, `gid`, `shell`)
|
||||
VALUES (:customerid, :username, :description, :password, :homedir, 'y', :guid, :guid, :shell)"
|
||||
);
|
||||
$params = array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
@@ -209,7 +218,8 @@ if ($page == 'overview') {
|
||||
"description" => $description,
|
||||
"password" => $cryptPassword,
|
||||
"homedir" => $path,
|
||||
"guid" => $userinfo['guid']
|
||||
"guid" => $userinfo['guid'],
|
||||
"shell" => $shell
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
@@ -254,7 +264,7 @@ if ($page == 'overview') {
|
||||
'CUST_NAME' => getCorrectUserSalutation($userinfo), // < keep this for compatibility
|
||||
'USR_NAME' => $username,
|
||||
'USR_PASS' => $password,
|
||||
'USR_PATH' => makeCorrectDir(substr($path, strlen($userinfo['documentroot'])))
|
||||
'USR_PATH' => makeCorrectDir(str_replace($userinfo['documentroot'], "/", $path))
|
||||
);
|
||||
|
||||
$def_language = $userinfo['def_language'];
|
||||
@@ -329,6 +339,18 @@ if ($page == 'overview') {
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings::Get('system.allow_customer_shell') == '1') {
|
||||
$shells = makeoption("/bin/false", "/bin/false", "/bin/false");
|
||||
$shells_avail = Settings::Get('system.available_shells');
|
||||
if (!empty($shells_avail)) {
|
||||
$shells_avail = explode(",", $shells_avail);
|
||||
$shells_avail = array_map("trim", $shells_avail);
|
||||
foreach ($shells_avail as $_shell) {
|
||||
$shells .= makeoption($_shell, $_shell, "/bin/false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
|
||||
|
||||
$ftp_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_add.php';
|
||||
@@ -341,7 +363,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "`
|
||||
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `uid`, `gid`, `shell` FROM `" . TABLE_FTP_USERS . "`
|
||||
WHERE `customerid` = :customerid
|
||||
AND `id` = :id"
|
||||
);
|
||||
@@ -353,6 +375,11 @@ if ($page == 'overview') {
|
||||
// @FIXME use a good path-validating regex here (refs #1231)
|
||||
$path = validate($_POST['path'], 'path');
|
||||
|
||||
$shell = "/bin/false";
|
||||
if (Settings::Get('system.allow_customer_shell') == '1') {
|
||||
$shell = isset($_POST['shell']) ? validate($_POST['shell'], 'shell') : '/bin/false';
|
||||
}
|
||||
|
||||
$_setnewpass = false;
|
||||
if (isset($_POST['ftp_password']) && $_POST['ftp_password'] != '') {
|
||||
$password = validate($_POST['ftp_password'], 'password');
|
||||
@@ -363,10 +390,8 @@ if ($page == 'overview') {
|
||||
if ($_setnewpass) {
|
||||
if ($password == '') {
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
exit;
|
||||
} elseif ($result['username'] == $password) {
|
||||
standard_error('passwordshouldnotbeusername');
|
||||
exit;
|
||||
}
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account password for '" . $result['username'] . "'");
|
||||
$cryptPassword = makeCryptPassword($password);
|
||||
@@ -408,16 +433,16 @@ if ($page == 'overview') {
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited ftp-account '" . $result['username'] . "'");
|
||||
$description = validate($_POST['ftp_description'], 'description');
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
|
||||
SET `description` = :desc
|
||||
SET `description` = :desc, `shell` = :shell
|
||||
WHERE `customerid` = :customerid
|
||||
AND `id` = :id"
|
||||
);
|
||||
Database::pexecute($stmt, array("desc" => $description, "customerid" => $userinfo['customerid'], "id" => $id));
|
||||
Database::pexecute($stmt, array("desc" => $description, "shell" => $shell, "customerid" => $userinfo['customerid'], "id" => $id));
|
||||
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
} else {
|
||||
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
|
||||
$homedir = substr($result['homedir'], strlen($userinfo['documentroot']));
|
||||
$homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']);
|
||||
} else {
|
||||
$homedir = $result['homedir'];
|
||||
}
|
||||
@@ -438,6 +463,18 @@ if ($page == 'overview') {
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings::Get('system.allow_customer_shell') == '1') {
|
||||
$shells = makeoption("/bin/false", "/bin/false", $result['shell']);
|
||||
$shells_avail = Settings::Get('system.available_shells');
|
||||
if (!empty($shells_avail)) {
|
||||
$shells_avail = explode(",", $shells_avail);
|
||||
$shells_avail = array_map("trim", $shells_avail);
|
||||
foreach ($shells_avail as $_shell) {
|
||||
$shells .= makeoption($_shell, $_shell, $result['shell']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ftp_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_edit.php';
|
||||
$ftp_edit_form = htmlform::genHTMLForm($ftp_edit_data);
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ if ($action == 'logout') {
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($page == 'overview') {
|
||||
@@ -79,8 +78,15 @@ if ($page == 'overview') {
|
||||
$yesterday = time() - (60 * 60 * 24);
|
||||
$month = date('M Y', $yesterday);
|
||||
|
||||
// get disk-space usages for web, mysql and mail
|
||||
$usages_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_DISKSPACE."` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
|
||||
$usages = Database::pexecute_first($usages_stmt, array('cid' => $userinfo['customerid']));
|
||||
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['diskspace_used'] = round($usages['webspace'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['mailspace_used'] = round($usages['mail'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['dbspace_used'] = round($usages['mysql'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains');
|
||||
@@ -101,7 +107,6 @@ if ($page == 'overview') {
|
||||
$old_password = validate($_POST['old_password'], 'old password');
|
||||
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_CUSTOMERS,'customerid')) {
|
||||
standard_error('oldpasswordnotcorrect');
|
||||
exit;
|
||||
}
|
||||
|
||||
$new_password = validatePassword($_POST['new_password'], 'new password');
|
||||
@@ -269,7 +274,8 @@ if ($page == 'overview') {
|
||||
$mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n";
|
||||
$mail_body .= "Trace:\n".trim($_error['trace'])."\n\n";
|
||||
$mail_body .= "-------------------------------------------------------------\n\n";
|
||||
$mail_body .= "Froxlor-version: ".$version."\n\n";
|
||||
$mail_body .= "Froxlor-version: ".$version."\n";
|
||||
$mail_body .= "DB-version: ".$dbversion."\n\n";
|
||||
$mail_body .= "End of report";
|
||||
$mail_html = str_replace("\n", "<br />", $mail_body);
|
||||
|
||||
|
||||
122
customer_logger.php
Normal file
122
customer_logger.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','extras.logger')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if ($page == 'log'
|
||||
) {
|
||||
if ($action == '') {
|
||||
$fields = array(
|
||||
'date' => $lng['logger']['date'],
|
||||
'type' => $lng['logger']['type'],
|
||||
'user' => $lng['logger']['user'],
|
||||
'text' => $lng['logger']['action']
|
||||
);
|
||||
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc');
|
||||
$result_stmt = Database::prepare('
|
||||
SELECT * FROM `' . TABLE_PANEL_LOG . '` WHERE `user` = :loginname ' . $paging->getSqlWhere(true) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit()
|
||||
);
|
||||
Database::pexecute($result_stmt, array("loginname" => $userinfo['loginname']));
|
||||
$logs_count = Database::num_rows();
|
||||
$paging->setEntries($logs_count);
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$clog = array();
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (!isset($clog[$row['action']])
|
||||
|| !is_array($clog[$row['action']])
|
||||
) {
|
||||
$clog[$row['action']] = array();
|
||||
}
|
||||
$clog[$row['action']][$row['logid']] = $row;
|
||||
}
|
||||
|
||||
if ($paging->sortfield == 'date'
|
||||
&& $paging->sortorder == 'desc'
|
||||
) {
|
||||
krsort($clog);
|
||||
} else {
|
||||
ksort($clog);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$log_count = 0;
|
||||
$log = '';
|
||||
foreach ($clog as $action => $logrows) {
|
||||
$_action = 0;
|
||||
foreach ($logrows as $row) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
$row['date'] = date("d.m.y H:i:s", $row['date']);
|
||||
|
||||
if ($_action != $action) {
|
||||
switch ($action) {
|
||||
case USR_ACTION:
|
||||
$_action = $lng['admin']['customer'];
|
||||
break;
|
||||
case RES_ACTION:
|
||||
$_action = $lng['logger']['reseller'];
|
||||
break;
|
||||
case ADM_ACTION:
|
||||
$_action = $lng['logger']['admin'];
|
||||
break;
|
||||
case CRON_ACTION:
|
||||
$_action = $lng['logger']['cron'];
|
||||
break;
|
||||
case LOGIN_ACTION:
|
||||
$_action = $lng['logger']['login'];
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
$_action = $lng['logger']['intern'];
|
||||
break;
|
||||
default:
|
||||
$_action = $lng['logger']['unknown'];
|
||||
break;
|
||||
}
|
||||
|
||||
$row['action'] = $_action;
|
||||
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
|
||||
}
|
||||
|
||||
$log_count++;
|
||||
$row['type'] = getLogLevelDesc($row['type']);
|
||||
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
|
||||
$count++;
|
||||
$_action = $action;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate('logger/logger') . "\";");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,11 @@
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','mysql')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
// get sql-root access data
|
||||
Database::needRoot(true);
|
||||
Database::needSqlData();
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','domains')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
|
||||
$id = intval($_POST['id']);
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
define('AREA', 'customer');
|
||||
$intrafficpage = 1;
|
||||
require './lib/init.php';
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','traffic')) {
|
||||
redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
$traffic = '';
|
||||
$month = null;
|
||||
$year = null;
|
||||
@@ -109,8 +115,7 @@ if (!is_null($month) && !is_null($year)) {
|
||||
$result_stmt = Database::prepare("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE `customerid` = :customerid
|
||||
GROUP BY CONCAT(`year`,`month`)
|
||||
ORDER BY CONCAT(`year`,`month`) DESC
|
||||
GROUP BY `year` DESC, `month` DESC
|
||||
LIMIT 12"
|
||||
);
|
||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
|
||||
|
||||
306
dns_editor.php
Normal file
306
dns_editor.php
Normal file
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
if (! defined('AREA'))
|
||||
die('You cannot access this file directly!');
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2016 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2016-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
*/
|
||||
|
||||
// This file is being included in admin_domains and customer_domains
|
||||
// and therefore does not need to require lib/init.php
|
||||
|
||||
$domain_id = isset($_GET['domain_id']) ? (int) $_GET['domain_id'] : null;
|
||||
|
||||
$record = isset($_POST['record']['record']) ? trim($_POST['record']['record']) : null;
|
||||
$type = isset($_POST['record']['type']) ? $_POST['record']['type'] : 'A';
|
||||
$prio = isset($_POST['record']['prio']) ? (int) $_POST['record']['prio'] : null;
|
||||
$content = isset($_POST['record']['content']) ? trim($_POST['record']['content']) : null;
|
||||
$ttl = isset($_POST['record']['ttl']) ? (int) $_POST['record']['ttl'] : 18000;
|
||||
|
||||
// get domain-name
|
||||
$domain = getAllowedDomainEntry($domain_id, AREA, $userinfo, $idna_convert);
|
||||
|
||||
// select all entries
|
||||
$sel_stmt = Database::prepare("SELECT * FROM `" . TABLE_DOMAIN_DNS . "` WHERE domain_id = :did");
|
||||
Database::pexecute($sel_stmt, array(
|
||||
'did' => $domain_id
|
||||
));
|
||||
$dom_entries = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$errors = array();
|
||||
$success_message = "";
|
||||
|
||||
// action for adding a new entry
|
||||
if ($action == 'add_record' && ! empty($_POST)) {
|
||||
|
||||
// validation
|
||||
if (empty($record)) {
|
||||
$record = "@";
|
||||
}
|
||||
|
||||
$record = strtolower($record);
|
||||
|
||||
if ($record != '@' && $record != '*') {
|
||||
// validate record
|
||||
if (strpos($record, '--') !== false) {
|
||||
$errors[] = $lng['error']['domain_nopunycode'];
|
||||
} else {
|
||||
$record = $idna_convert->encode($record);
|
||||
if ($type != 'SRV' && $type != 'TXT') {
|
||||
$check_dom = $record . '.example.com';
|
||||
if (! validateDomain($check_dom)) {
|
||||
$errors[] = sprintf($lng['error']['subdomainiswrong'], $idna_convert->decode($record));
|
||||
}
|
||||
}
|
||||
if (strlen($record) > 63) {
|
||||
$errors[] = $lng['error']['dns_record_toolong'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO regex validate content for invalid characters
|
||||
|
||||
if ($ttl <= 0) {
|
||||
$ttl = 18000;
|
||||
}
|
||||
|
||||
if (empty($content)) {
|
||||
$errors[] = $lng['error']['dns_content_empty'];
|
||||
}
|
||||
|
||||
// types
|
||||
if ($type == 'A' && filter_var($content, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) {
|
||||
$errors[] = $lng['error']['dns_arec_noipv4'];
|
||||
} elseif ($type == 'AAAA' && filter_var($content, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
|
||||
$errors[] = $lng['error']['dns_aaaarec_noipv6'];
|
||||
} elseif ($type == 'MX') {
|
||||
if ($prio === null || $prio < 0) {
|
||||
$errors[] = $lng['error']['dns_mx_prioempty'];
|
||||
}
|
||||
// check for trailing dot
|
||||
if (substr($content, - 1) == '.') {
|
||||
// remove it for checks
|
||||
$content = substr($content, 0, - 1);
|
||||
}
|
||||
if (! validateDomain($content)) {
|
||||
$errors[] = $lng['error']['dns_mx_needdom'];
|
||||
} else {
|
||||
// check whether there is a CNAME-record for the same resource
|
||||
foreach ($dom_entries as $existing_entries) {
|
||||
$fqdn = $existing_entries['record'] . '.' . $domain;
|
||||
if ($existing_entries['type'] == 'CNAME' && $fqdn == $content) {
|
||||
$errors[] = $lng['error']['dns_mx_noalias'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// append trailing dot (again)
|
||||
$content .= '.';
|
||||
} elseif ($type == 'CNAME') {
|
||||
// check for trailing dot
|
||||
if (substr($content, - 1) == '.') {
|
||||
// remove it for checks
|
||||
$content = substr($content, 0, - 1);
|
||||
}
|
||||
if (! validateDomain($content)) {
|
||||
$errors[] = $lng['error']['dns_cname_invaliddom'];
|
||||
} else {
|
||||
// check whether there are RR-records for the same resource
|
||||
foreach ($dom_entries as $existing_entries) {
|
||||
if (($existing_entries['type'] == 'A' || $existing_entries['type'] == 'AAAA' || $existing_entries['type'] == 'MX' || $existing_entries['type'] == 'NS') && $existing_entries['record'] == $record) {
|
||||
$errors[] = $lng['error']['dns_cname_nomorerr'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// append trailing dot (again)
|
||||
$content .= '.';
|
||||
} elseif ($type == 'NS') {
|
||||
// check for trailing dot
|
||||
if (substr($content, - 1) == '.') {
|
||||
// remove it for checks
|
||||
$content = substr($content, 0, - 1);
|
||||
}
|
||||
if (! validateDomain($content)) {
|
||||
$errors[] = $lng['error']['dns_ns_invaliddom'];
|
||||
}
|
||||
// append trailing dot (again)
|
||||
$content .= '.';
|
||||
} elseif ($type == 'TXT' && ! empty($content)) {
|
||||
// check that TXT content is enclosed in " "
|
||||
$content = encloseTXTContent($content);
|
||||
} elseif ($type == 'SRV') {
|
||||
if ($prio === null || $prio < 0) {
|
||||
$errors[] = $lng['error']['dns_srv_prioempty'];
|
||||
}
|
||||
// check only last part of content, as it can look like:
|
||||
// _service._proto.name. TTL class SRV priority weight port target.
|
||||
$_split_content = explode(" ", $content);
|
||||
// SRV content must be [weight] [port] [target]
|
||||
if (count($_split_content) != 3) {
|
||||
$errors[] = $lng['error']['dns_srv_invalidcontent'];
|
||||
}
|
||||
$target = trim($_split_content[count($_split_content) - 1]);
|
||||
if ($target != '.') {
|
||||
// check for trailing dot
|
||||
if (substr($target, - 1) == '.') {
|
||||
// remove it for checks
|
||||
$target = substr($target, 0, - 1);
|
||||
}
|
||||
}
|
||||
if ($target != '.' && ! validateDomain($target)) {
|
||||
$errors[] = $lng['error']['dns_srv_needdom'];
|
||||
} else {
|
||||
// check whether there is a CNAME-record for the same resource
|
||||
foreach ($dom_entries as $existing_entries) {
|
||||
$fqdn = $existing_entries['record'] . '.' . $domain;
|
||||
if ($existing_entries['type'] == 'CNAME' && $fqdn == $target) {
|
||||
$errors[] = $lng['error']['dns_srv_noalias'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// append trailing dot (again)
|
||||
if ($target != '.') {
|
||||
$content .= '.';
|
||||
}
|
||||
}
|
||||
|
||||
$new_entry = array(
|
||||
'record' => $record,
|
||||
'type' => $type,
|
||||
'prio' => $prio,
|
||||
'content' => $content,
|
||||
'ttl' => $ttl,
|
||||
'domain_id' => $domain_id
|
||||
);
|
||||
ksort($new_entry);
|
||||
|
||||
// check for duplicate
|
||||
foreach ($dom_entries as $existing_entry) {
|
||||
// compare serialized string of array
|
||||
$check_entry = $existing_entry;
|
||||
// new entry has no ID yet
|
||||
unset($check_entry['id']);
|
||||
// sort by key
|
||||
ksort($check_entry);
|
||||
// format integer fields to real integer (as they are read as string from the DB)
|
||||
$check_entry['prio'] = (int) $check_entry['prio'];
|
||||
$check_entry['ttl'] = (int) $check_entry['ttl'];
|
||||
$check_entry['domain_id'] = (int) $check_entry['domain_id'];
|
||||
// serialize both
|
||||
$check_entry = serialize($check_entry);
|
||||
$new = serialize($new_entry);
|
||||
// compare
|
||||
if ($check_entry === $new) {
|
||||
$errors[] = $lng['error']['dns_duplicate_entry'];
|
||||
unset($check_entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_DOMAIN_DNS . "` SET
|
||||
`record` = :record,
|
||||
`type` = :type,
|
||||
`prio` = :prio,
|
||||
`content` = :content,
|
||||
`ttl` = :ttl,
|
||||
`domain_id` = :domain_id
|
||||
");
|
||||
|
||||
Database::pexecute($ins_stmt, $new_entry);
|
||||
|
||||
$new_entry_id = Database::lastInsertId();
|
||||
|
||||
// add temporary to the entries-array (no reread of DB necessary)
|
||||
$new_entry['id'] = $new_entry_id;
|
||||
$dom_entries[] = $new_entry;
|
||||
|
||||
// success message (inline)
|
||||
$success_message = $lng['success']['dns_record_added'];
|
||||
|
||||
$record = "";
|
||||
$type = 'A';
|
||||
$prio = "";
|
||||
$content = "";
|
||||
$ttl = "";
|
||||
|
||||
// re-generate bind configs
|
||||
inserttask('4');
|
||||
} else {
|
||||
// show $errors
|
||||
$errors = implode("<br>", $errors);
|
||||
}
|
||||
} elseif ($action == 'delete') {
|
||||
// remove entry
|
||||
$entry_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
||||
if ($entry_id > 0) {
|
||||
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_DOMAIN_DNS . "` WHERE `id` = :id");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'id' => $entry_id
|
||||
));
|
||||
|
||||
// remove deleted entry from internal data array (no reread of DB necessary)
|
||||
$_t = $dom_entries;
|
||||
foreach ($_t as $idx => $entry) {
|
||||
if ($entry['id'] == $entry_id) {
|
||||
unset($dom_entries[$idx]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($_t);
|
||||
// success message (inline)
|
||||
$success_message = $lng['success']['dns_record_deleted'];
|
||||
|
||||
// re-generate bind configs
|
||||
inserttask('4');
|
||||
}
|
||||
}
|
||||
|
||||
// show editor
|
||||
$record_list = "";
|
||||
$existing_entries = "";
|
||||
$type_select = "";
|
||||
$entriescount = 0;
|
||||
|
||||
if (! empty($dom_entries)) {
|
||||
$entriescount = count($dom_entries);
|
||||
foreach ($dom_entries as $entry) {
|
||||
$entry['content'] = wordwrap($entry['content'], 100, '<br>', true);
|
||||
eval("\$existing_entries.=\"" . getTemplate("dns_editor/entry_bit", true) . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
// available types
|
||||
$type_select_values = array(
|
||||
'A',
|
||||
'AAAA',
|
||||
'NS',
|
||||
'MX',
|
||||
'SRV',
|
||||
'TXT',
|
||||
'CNAME'
|
||||
);
|
||||
asort($type_select_values);
|
||||
foreach ($type_select_values as $_type) {
|
||||
$type_select .= makeoption($_type, $_type, $type);
|
||||
}
|
||||
|
||||
eval("\$record_list=\"" . getTemplate("dns_editor/list", true) . "\";");
|
||||
|
||||
$zone = createDomainZone($domain_id);
|
||||
$zonefile = (string) $zone;
|
||||
eval("echo \"" . getTemplate("dns_editor/index", true) . "\";");
|
||||
22
index.php
22
index.php
@@ -69,13 +69,13 @@ if ($action == 'login') {
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUpdates($version) && $is_admin == false) {
|
||||
if ((hasUpdates($version) || hasDbUpdates($dbversion)) && $is_admin == false) {
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($is_admin) {
|
||||
if (hasUpdates($version)) {
|
||||
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
|
||||
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "`
|
||||
WHERE `loginname`= :loginname
|
||||
AND `change_serversettings` = '1'"
|
||||
@@ -119,7 +119,7 @@ if ($action == 'login') {
|
||||
redirectTo('index.php', array('showmessage' => '3'));
|
||||
exit;
|
||||
} elseif (validatePasswordLogin($userinfo, $password, $table, $uid)) {
|
||||
// only show "you're banned" if the login was successfull
|
||||
// only show "you're banned" if the login was successful
|
||||
// because we don't want to publish that the user does exist
|
||||
if ($userinfo['deactivated']) {
|
||||
unset($userinfo);
|
||||
@@ -222,11 +222,15 @@ if ($action == 'login') {
|
||||
$qryparams['s'] = $s;
|
||||
|
||||
if ($userinfo['adminsession'] == '1') {
|
||||
if (hasUpdates($version)) {
|
||||
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
|
||||
redirectTo('admin_updates.php', array('s' => $s));
|
||||
} else {
|
||||
if (isset($_POST['script']) && $_POST['script'] != "") {
|
||||
redirectTo($_POST['script'], $qryparams);
|
||||
if (preg_match("/customer\_/", $_POST['script']) === 1) {
|
||||
redirectTo('admin_customers.php', array("page" => "customers"));
|
||||
} else {
|
||||
redirectTo($_POST['script'], $qryparams);
|
||||
}
|
||||
} else {
|
||||
redirectTo('admin_index.php', $qryparams);
|
||||
}
|
||||
@@ -283,7 +287,7 @@ if ($action == 'login') {
|
||||
}
|
||||
|
||||
$update_in_progress = '';
|
||||
if (hasUpdates($version)) {
|
||||
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
|
||||
$update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin'];
|
||||
}
|
||||
|
||||
@@ -298,7 +302,7 @@ if ($action == 'login') {
|
||||
}
|
||||
$lastqrystr = "";
|
||||
if (isset($_REQUEST['qrystr']) && $_REQUEST['qrystr'] != "") {
|
||||
$lastqrystr = strip_tags($_REQUEST['qrystr']);
|
||||
$lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES);
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate('login') . "\";");
|
||||
@@ -345,8 +349,8 @@ if ($action == 'forgotpwd') {
|
||||
if ($user !== false) {
|
||||
// build a activation code
|
||||
$timestamp = time();
|
||||
$first = substr(md5($user['loginname'] . $timestamp . rand(0, $timestamp)), 0, 15);
|
||||
$third = substr(md5($user['email'] . $timestamp . rand(0, $timestamp)), -15);
|
||||
$first = substr(md5($user['loginname'] . $timestamp . randomStr(16)), 0, 15);
|
||||
$third = substr(md5($user['email'] . $timestamp . randomStr(16)), -15);
|
||||
$activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10);
|
||||
|
||||
// Drop all existing activation codes for this user
|
||||
|
||||
@@ -23,7 +23,7 @@ CREATE TABLE `ftp_users` (
|
||||
`shell` varchar(255) NOT NULL default '/bin/false',
|
||||
`login_enabled` enum('N','Y') NOT NULL default 'N',
|
||||
`login_count` int(15) NOT NULL default '0',
|
||||
`last_login` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`last_login` datetime default NULL,
|
||||
`up_count` int(15) NOT NULL default '0',
|
||||
`up_bytes` bigint(30) NOT NULL default '0',
|
||||
`down_count` int(15) NOT NULL default '0',
|
||||
@@ -66,7 +66,7 @@ CREATE TABLE `mail_virtual` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`email` varchar(255) NOT NULL default '',
|
||||
`email_full` varchar(255) NOT NULL default '',
|
||||
`destination` text NOT NULL,
|
||||
`destination` text NOT NULL default '',
|
||||
`domainid` int(11) NOT NULL default '0',
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
`popaccountid` int(11) NOT NULL default '0',
|
||||
@@ -191,9 +191,12 @@ CREATE TABLE `panel_customers` (
|
||||
`pop3` tinyint(1) NOT NULL default '1',
|
||||
`imap` tinyint(1) NOT NULL default '1',
|
||||
`perlenabled` tinyint(1) NOT NULL default '0',
|
||||
`dnsenabled` tinyint(1) NOT NULL default '0',
|
||||
`theme` varchar(255) NOT NULL default 'Sparkle',
|
||||
`custom_notes` text,
|
||||
`custom_notes_show` tinyint(1) NOT NULL default '0',
|
||||
`lepublickey` mediumtext DEFAULT NULL,
|
||||
`leprivatekey` mediumtext DEFAULT NULL,
|
||||
PRIMARY KEY (`customerid`),
|
||||
UNIQUE KEY `loginname` (`loginname`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
@@ -233,7 +236,7 @@ CREATE TABLE `panel_domains` (
|
||||
`dkim_privkey` text,
|
||||
`dkim_pubkey` text,
|
||||
`wwwserveralias` tinyint(1) NOT NULL default '1',
|
||||
`parentdomainid` int(11) unsigned NOT NULL default '0',
|
||||
`parentdomainid` int(11) NOT NULL default '0',
|
||||
`openbasedir` tinyint(1) NOT NULL default '0',
|
||||
`openbasedir_path` tinyint(1) NOT NULL default '0',
|
||||
`speciallogfile` tinyint(1) NOT NULL default '0',
|
||||
@@ -242,11 +245,16 @@ CREATE TABLE `panel_domains` (
|
||||
`deactivated` tinyint(1) NOT NULL default '0',
|
||||
`bindserial` varchar(10) NOT NULL default '2000010100',
|
||||
`add_date` int( 11 ) NOT NULL default '0',
|
||||
`registration_date` date NOT NULL,
|
||||
`registration_date` date DEFAULT NULL,
|
||||
`termination_date` date DEFAULT NULL,
|
||||
`phpsettingid` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`mod_fcgid_starter` int(4) default '-1',
|
||||
`mod_fcgid_maxrequests` int(4) default '-1',
|
||||
`ismainbutsubto` int(11) unsigned NOT NULL default '0',
|
||||
`letsencrypt` tinyint(1) NOT NULL default '0',
|
||||
`hsts` varchar(10) NOT NULL default '0',
|
||||
`hsts_sub` tinyint(1) NOT NULL default '0',
|
||||
`hsts_preload` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`),
|
||||
KEY `parentdomain` (`parentdomainid`),
|
||||
@@ -365,11 +373,11 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('dkim', 'dkim_domains', 'domains'),
|
||||
('dkim', 'dkim_dkimkeys', 'dkim-keys.conf'),
|
||||
('dkim', 'dkimrestart_command', '/etc/init.d/dkim-filter restart'),
|
||||
('admin', 'show_news_feed', '1'),
|
||||
('admin', 'show_news_feed', '0'),
|
||||
('admin', 'show_version_login', '0'),
|
||||
('admin', 'show_version_footer', '0'),
|
||||
('spf', 'use_spf', '0'),
|
||||
('spf', 'spf_entry', '@ IN TXT "v=spf1 a mx -all"'),
|
||||
('spf', 'spf_entry', '"v=spf1 a mx -all"'),
|
||||
('dkim', 'dkim_algorithm', 'all'),
|
||||
('dkim', 'dkim_add_adsp', '1'),
|
||||
('dkim', 'dkim_keylength', '1024'),
|
||||
@@ -486,7 +494,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('system', 'mod_fcgid_defaultini_ownvhost', '2'),
|
||||
('system', 'awstats_icons', '/usr/share/awstats/icon/'),
|
||||
('system', 'ssl_cert_chainfile', ''),
|
||||
('system', 'ssl_cipher_list', 'ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH'),
|
||||
('system', 'ssl_cipher_list', 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128'),
|
||||
('system', 'nginx_php_backend', '127.0.0.1:8888'),
|
||||
('system', 'perl_server', 'unix:/var/run/nginx/cgiwrap-dispatch.sock'),
|
||||
('system', 'phpreload_command', ''),
|
||||
@@ -504,10 +512,39 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('system', 'mailtraffic_enabled', '1'),
|
||||
('system', 'cronconfig', '/etc/cron.d/froxlor'),
|
||||
('system', 'crondreload', '/etc/init.d/cron reload'),
|
||||
('system', 'croncmdline', '/usr/bin/nice -n 5 /usr/bin/php5 -q'),
|
||||
('system', 'croncmdline', '/usr/bin/nice -n 5 /usr/bin/php -q'),
|
||||
('system', 'cron_allowautoupdate', '0'),
|
||||
('system', 'dns_createhostnameentry', '0'),
|
||||
('system', 'send_cron_errors', '0'),
|
||||
('system', 'apacheitksupport', '0'),
|
||||
('system', 'leprivatekey', 'unset'),
|
||||
('system', 'lepublickey', 'unset'),
|
||||
('system', 'letsencryptca', 'production'),
|
||||
('system', 'letsencryptcountrycode', 'DE'),
|
||||
('system', 'letsencryptstate', 'Hessen'),
|
||||
('system', 'letsencryptchallengepath', '/var/www/froxlor'),
|
||||
('system', 'letsencryptkeysize', '4096'),
|
||||
('system', 'letsencryptreuseold', 0),
|
||||
('system', 'leenabled', '0'),
|
||||
('system', 'backupenabled', '0'),
|
||||
('system', 'dnsenabled', '0'),
|
||||
('system', 'dns_server', 'bind'),
|
||||
('system', 'apacheglobaldiropt', ''),
|
||||
('system', 'allow_customer_shell', '0'),
|
||||
('system', 'available_shells', ''),
|
||||
('system', 'le_froxlor_enabled', '0'),
|
||||
('system', 'le_froxlor_redirect', '0'),
|
||||
('system', 'letsencryptacmeconf', '/etc/apache2/conf-enabled/acme.conf'),
|
||||
('system', 'mail_use_smtp', '0'),
|
||||
('system', 'mail_smtp_host', 'localhost'),
|
||||
('system', 'mail_smtp_port', '25'),
|
||||
('system', 'mail_smtp_usetls', '1'),
|
||||
('system', 'mail_smtp_auth', '1'),
|
||||
('system', 'mail_smtp_user', ''),
|
||||
('system', 'mail_smtp_passwd', ''),
|
||||
('system', 'hsts_maxage', '0'),
|
||||
('system', 'hsts_sub', '0'),
|
||||
('system', 'hsts_preload', '0'),
|
||||
('panel', 'decimal_places', '4'),
|
||||
('panel', 'adminmail', 'admin@SERVERNAME'),
|
||||
('panel', 'phpmyadmin_url', ''),
|
||||
@@ -538,14 +575,16 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('panel', 'password_numeric', '0'),
|
||||
('panel', 'password_special_char_required', '0'),
|
||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||
('panel', 'version', '0.9.33.1');
|
||||
('panel', 'customer_hide_options', ''),
|
||||
('panel', 'version', '0.9.38-rc2'),
|
||||
('panel', 'db_version', '201610070');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
CREATE TABLE `panel_tasks` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`type` int(11) NOT NULL default '0',
|
||||
`data` text NOT NULL,
|
||||
`data` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
@@ -650,11 +689,11 @@ CREATE TABLE `panel_languages` (
|
||||
INSERT INTO `panel_languages` (`id`, `language`, `iso`, `file`) VALUES
|
||||
(1, 'Deutsch', 'de', 'lng/german.lng.php'),
|
||||
(2, 'English', 'en', 'lng/english.lng.php'),
|
||||
(3, 'Français', 'fr', 'lng/french.lng.php'),
|
||||
(3, 'Français', 'fr', 'lng/french.lng.php'),
|
||||
(4, 'Português', 'pt', 'lng/portugues.lng.php'),
|
||||
(5, 'Italian', 'it', 'lng/italian.lng.php'),
|
||||
(6, 'Dutch', 'nl', 'lng/dutch.lng.php'),
|
||||
(7, 'Swedish', 'sv', 'lng/swedish.lng.php');
|
||||
(5, 'Italiano', 'it', 'lng/italian.lng.php'),
|
||||
(6, 'Nederlands', 'nl', 'lng/dutch.lng.php'),
|
||||
(7, 'Svenska', 'sv', 'lng/swedish.lng.php');
|
||||
|
||||
|
||||
|
||||
@@ -712,6 +751,7 @@ CREATE TABLE `panel_phpconfigs` (
|
||||
`file_extensions` varchar(255) NOT NULL,
|
||||
`mod_fcgid_starter` int(4) NOT NULL DEFAULT '-1',
|
||||
`mod_fcgid_maxrequests` int(4) NOT NULL DEFAULT '-1',
|
||||
`mod_fcgid_umask` varchar(15) NOT NULL DEFAULT '022',
|
||||
`fpm_slowlog` tinyint(1) NOT NULL default '0',
|
||||
`fpm_reqterm` varchar(15) NOT NULL default '60s',
|
||||
`fpm_reqslow` varchar(15) NOT NULL default '5s',
|
||||
@@ -722,8 +762,8 @@ CREATE TABLE `panel_phpconfigs` (
|
||||
|
||||
|
||||
INSERT INTO `panel_phpconfigs` (`id`, `description`, `binary`, `file_extensions`, `mod_fcgid_starter`, `mod_fcgid_maxrequests`, `phpsettings`) VALUES
|
||||
(1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = Off\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_exec,curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 30\r\nmax_input_time = 60\r\nmemory_limit = 16M\r\n{OPEN_BASEDIR_C}open_basedir = "{OPEN_BASEDIR}"\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n;mail.add_x_header = On\r\n;mail.log = "/var/log/phpmail.log"\r\n'),
|
||||
(2, 'Froxlor Vhost Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = On\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 60\r\nmax_input_time = 60\r\nmemory_limit = 16M\r\nnoutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n;mail.add_x_header = On\r\n;mail.log = "/var/log/phpmail.log"\r\n');
|
||||
(1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = Off\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_exec,curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 30\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\n{OPEN_BASEDIR_C}open_basedir = "{OPEN_BASEDIR}"\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n;mail.add_x_header = On\r\n;mail.log = "/var/log/phpmail.log"\r\nopcache.restrict_api = "{DOCUMENT_ROOT}"\r\n'),
|
||||
(2, 'Froxlor Vhost Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = On\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 60\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\nnoutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n;mail.add_x_header = On\r\n;mail.log = "/var/log/phpmail.log"\r\nopcache.restrict_api = ""\r\n');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `cronjobs_run`;
|
||||
@@ -745,7 +785,9 @@ INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`,
|
||||
(3, 'froxlor/ticket', 'used_tickets_reset', '1 DAY', '1', 'cron_ticketsreset'),
|
||||
(4, 'froxlor/ticket', 'ticketarchive', '1 MONTH', '1', 'cron_ticketarchive'),
|
||||
(5, 'froxlor/reports', 'usage_report', '1 DAY', '1', 'cron_usage_report'),
|
||||
(6, 'froxlor/core', 'mailboxsize', '6 HOUR', '1', 'cron_mailboxsize');
|
||||
(6, 'froxlor/core', 'mailboxsize', '6 HOUR', '1', 'cron_mailboxsize'),
|
||||
(7, 'froxlor/letsencrypt', 'letsencrypt', '5 MINUTE', '0', 'cron_letsencrypt'),
|
||||
(8, 'froxlor/backup', 'backup', '1 DAY', '1', 'cron_backup');
|
||||
|
||||
|
||||
|
||||
@@ -816,10 +858,12 @@ DROP TABLE IF EXISTS `domain_ssl_settings`;
|
||||
CREATE TABLE IF NOT EXISTS `domain_ssl_settings` (
|
||||
`id` int(5) NOT NULL auto_increment,
|
||||
`domainid` int(11) NOT NULL,
|
||||
`ssl_cert_file` text NOT NULL,
|
||||
`ssl_key_file` text NOT NULL,
|
||||
`ssl_ca_file` text,
|
||||
`ssl_cert_chainfile` text,
|
||||
`ssl_cert_file` mediumtext NOT NULL,
|
||||
`ssl_key_file` mediumtext NOT NULL,
|
||||
`ssl_ca_file` mediumtext,
|
||||
`ssl_cert_chainfile` mediumtext,
|
||||
`ssl_csr_file` mediumtext,
|
||||
`expirationdate` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
@@ -831,3 +875,16 @@ CREATE TABLE IF NOT EXISTS `panel_domaintoip` (
|
||||
PRIMARY KEY (`id_domain`,`id_ipandports`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `domain_dns_entries`;
|
||||
CREATE TABLE `domain_dns_entries` (
|
||||
`id` int(20) NOT NULL auto_increment,
|
||||
`domain_id` int(15) NOT NULL,
|
||||
`record` varchar(255) NOT NULL,
|
||||
`type` varchar(10) NOT NULL DEFAULT 'A',
|
||||
`content` text NOT NULL,
|
||||
`ttl` int(11) NOT NULL DEFAULT '18000',
|
||||
`prio` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,7 @@ $lng['requirements']['notfound'] = 'not found';
|
||||
$lng['requirements']['notinstalled'] = 'not installed';
|
||||
$lng['requirements']['activated'] = 'enabled';
|
||||
$lng['requirements']['phpversion'] = 'PHP version >= 5.3';
|
||||
$lng['requirements']['newerphpprefered'] = 'Good, but php-5.6 is prefered.';
|
||||
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...';
|
||||
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off". We have disabled it temporary for now please fix the coresponding php.ini.';
|
||||
$lng['requirements']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...';
|
||||
@@ -32,8 +33,10 @@ $lng['requirements']['phpfilter'] = 'PHP filter-extension...';
|
||||
$lng['requirements']['phpposix'] = 'PHP posix-extension...';
|
||||
$lng['requirements']['phpbcmath'] = 'PHP bcmath-extension...';
|
||||
$lng['requirements']['phpcurl'] = 'PHP curl-extension...';
|
||||
$lng['requirements']['phpmbstring'] = 'PHP mbstring-extension...';
|
||||
$lng['requirements']['phpzip'] = 'PHP zip-extension...';
|
||||
$lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!';
|
||||
$lng['requirements']['curldescription'] = 'Version-check and news-feed may not work correctly!';
|
||||
$lng['requirements']['zipdescription'] = 'The auto-update feature requires the zip extension.';
|
||||
$lng['requirements']['openbasedir'] = 'open_basedir...';
|
||||
$lng['requirements']['openbasedirenabled'] = 'Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor in the coresponding php.ini';
|
||||
$lng['requirements']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.';
|
||||
@@ -55,11 +58,13 @@ $lng['install']['admin_account'] = 'Administrator Account';
|
||||
$lng['install']['admin_user'] = 'Administrator Username';
|
||||
$lng['install']['admin_pass1'] = 'Administrator Password';
|
||||
$lng['install']['admin_pass2'] = 'Administrator-Password (confirm)';
|
||||
$lng['install']['activate_newsfeed'] = 'Enable the official newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
|
||||
$lng['install']['serversettings'] = 'Server settings';
|
||||
$lng['install']['servername'] = 'Server name (FQDN, no ip-address)';
|
||||
$lng['install']['serverip'] = 'Server IP';
|
||||
$lng['install']['webserver'] = 'Webserver';
|
||||
$lng['install']['apache2'] = 'Apache 2';
|
||||
$lng['install']['apache24'] = 'Apache 2.4';
|
||||
$lng['install']['lighttpd'] = 'LigHTTPd';
|
||||
$lng['install']['nginx'] = 'NGINX';
|
||||
$lng['install']['httpuser'] = 'HTTP username';
|
||||
|
||||
@@ -32,8 +32,8 @@ $lng['requirements']['phpfilter'] = 'extension PHP filter ...';
|
||||
$lng['requirements']['phpposix'] = 'extension PHP posix ...';
|
||||
$lng['requirements']['phpbcmath'] = 'extension PHP bcmath ...';
|
||||
$lng['requirements']['phpcurl'] = 'extension PHP curl...';
|
||||
$lng['requirements']['phpmbstring'] = 'extension PHP mbstring...';
|
||||
$lng['requirements']['bcmathdescription'] = 'Les fonctions de calcul de traffic ne fonctionneront pas correctement!';
|
||||
$lng['requirements']['curldescription'] = 'Les vérifications de version et les flux d\'information peuvent ne pas fonctionner correctement!';
|
||||
$lng['requirements']['openbasedir'] = 'open_basedir...';
|
||||
$lng['requirements']['openbasedirenabled'] = 'Froxlor ne fonctionnera pas correctement avec open_basedir activé. Merci de désactiver open_basedir pour Froxlor dans le php.ini correspondant';
|
||||
$lng['requirements']['diedbecauseofrequirements'] = 'Impossible d\'installer Froxlor sans ces prérequis! Essayez de les corriger et essayez à nouveau.';
|
||||
@@ -60,6 +60,7 @@ $lng['install']['servername'] = 'Nom du serveur (FQDN, pas d\'adresse IP)';
|
||||
$lng['install']['serverip'] = 'Adresse IP du serveur';
|
||||
$lng['install']['webserver'] = 'Serveur Web';
|
||||
$lng['install']['apache2'] = 'Apache 2';
|
||||
$lng['install']['apache24'] = 'Apache 2.4';
|
||||
$lng['install']['lighttpd'] = 'LigHTTPd';
|
||||
$lng['install']['nginx'] = 'NGINX';
|
||||
$lng['install']['httpuser'] = 'Nom d\'utilisateur HTTP';
|
||||
|
||||
@@ -24,6 +24,7 @@ $lng['requirements']['notfound'] = 'nicht gefunden';
|
||||
$lng['requirements']['notinstalled'] = 'nicht installiert';
|
||||
$lng['requirements']['activated'] = 'ist aktiviert.';
|
||||
$lng['requirements']['phpversion'] = 'PHP Version >= 5.3';
|
||||
$lng['requirements']['newerphpprefered'] = 'Passt, aber php-5.6 wird bevorzugt.';
|
||||
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime';
|
||||
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"). Die Einstellung wurde temporär deaktiviert, bitte ändern Sie diese in der entsprechenden php.ini.';
|
||||
$lng['requirements']['phppdo'] = 'PHP PDO Erweiterung und PDO-MySQL Treiber...';
|
||||
@@ -32,8 +33,10 @@ $lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...';
|
||||
$lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...';
|
||||
$lng['requirements']['phpbcmath'] = 'PHP bcmath-Erweiterung...';
|
||||
$lng['requirements']['phpcurl'] = 'PHP curl-Erweiterung...';
|
||||
$lng['requirements']['phpmbstring'] = 'PHP mbstring-Erweiterung...';
|
||||
$lng['requirements']['phpzip'] = 'PHP zip-Erweiterung...';
|
||||
$lng['requirements']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollständig zur Verfügung!';
|
||||
$lng['requirements']['curldescription'] = 'Versions-Prüfung und News-Feed stehen nicht vollständig zur Verfügung!';
|
||||
$lng['requirements']['zipdescription'] = 'Die Auto-Update Funktion benötigt die zip Erweiterung.';
|
||||
$lng['requirements']['openbasedir'] = 'open_basedir genutzt wird...';
|
||||
$lng['requirements']['openbasedirenabled'] = 'Froxlor wird mit aktiviertem open_basedir nicht vollständig funktionieren. Bitte deaktivieren Sie open_basedir für Froxlor in der entsprechenden php.ini';
|
||||
$lng['requirements']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Beheben Sie die angezeigten Probleme und versuchen Sie es erneut.';
|
||||
@@ -55,11 +58,13 @@ $lng['install']['admin_account'] = 'Admin-Zugang';
|
||||
$lng['install']['admin_user'] = 'Administrator-Benutzername';
|
||||
$lng['install']['admin_pass1'] = 'Administrator-Passwort';
|
||||
$lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)';
|
||||
$lng['install']['activate_newsfeed'] = 'Aktiviere das offizielle Newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
|
||||
$lng['install']['serversettings'] = 'Servereinstellungen';
|
||||
$lng['install']['servername'] = 'Servername (FQDN, keine IP-Adresse)';
|
||||
$lng['install']['serverip'] = 'Server-IP';
|
||||
$lng['install']['webserver'] = 'Webserver';
|
||||
$lng['install']['apache2'] = 'Apache 2';
|
||||
$lng['install']['apache24'] = 'Apache 2.4';
|
||||
$lng['install']['lighttpd'] = 'LigHTTPd';
|
||||
$lng['install']['nginx'] = 'NGINX';
|
||||
$lng['install']['httpuser'] = 'HTTP Username';
|
||||
|
||||
@@ -19,10 +19,7 @@
|
||||
$baseLanguage = 'english.lng.php';
|
||||
|
||||
// Check if we're in the CLI
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi'
|
||||
) {
|
||||
if(@php_sapi_name() !== 'cli') {
|
||||
die('This script will only work in the shell.');
|
||||
}
|
||||
|
||||
@@ -56,7 +53,7 @@ if ($dh = opendir($path)) {
|
||||
} else {
|
||||
print "ERROR: The path you requested cannot be read! \n ";
|
||||
print "\n";
|
||||
print_help();
|
||||
print_help($argv);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -64,7 +61,7 @@ if ($dh = opendir($path)) {
|
||||
if (!isset($files[$baseLanguage])) {
|
||||
print "ERROR: The baselanguage cannot be found! \n";
|
||||
print "\n";
|
||||
print_help();
|
||||
print_help($argv);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
417
install/scripts/switch-server-ip.php
Normal file
417
install/scripts/switch-server-ip.php
Normal file
@@ -0,0 +1,417 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2016 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2016-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Cron
|
||||
*
|
||||
*/
|
||||
|
||||
// Check if we're in the CLI
|
||||
if(@php_sapi_name() !== 'cli') {
|
||||
die('This script will only work in the shell.');
|
||||
}
|
||||
|
||||
// give control to command line handler
|
||||
try {
|
||||
CmdLineHandler::processParameters($argc, $argv);
|
||||
} catch (Exception $e) {
|
||||
CmdLineHandler::printerr($e->getMessage());
|
||||
}
|
||||
|
||||
class CmdLineHandler
|
||||
{
|
||||
|
||||
/**
|
||||
* internal variable for passed arguments
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $args = null;
|
||||
|
||||
/**
|
||||
* Action object read from commandline/config
|
||||
*
|
||||
* @var Action
|
||||
*/
|
||||
private $_action = null;
|
||||
|
||||
/**
|
||||
* list of valid parameters/switches
|
||||
*/
|
||||
public static $switches = array(
|
||||
/* 'd', // debug / output information for everything */
|
||||
'h'
|
||||
);
|
||||
// same as --help
|
||||
public static $params = array(
|
||||
'switch',
|
||||
'list',
|
||||
'froxlor-dir',
|
||||
'help'
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns a CmdLineHandler object with given
|
||||
* arguments from command line
|
||||
*
|
||||
* @param int $argc
|
||||
* @param array $argv
|
||||
*
|
||||
* @return CmdLineHandler
|
||||
*/
|
||||
public static function processParameters($argc, $argv)
|
||||
{
|
||||
return new CmdLineHandler($argc, $argv);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the Action object generated in
|
||||
* the class constructor
|
||||
*
|
||||
* @return Action
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return $this->_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* class constructor, validates the command line parameters
|
||||
* and sets the Action-object if valid
|
||||
*
|
||||
* @param int $argc
|
||||
* @param string[] $argv
|
||||
*
|
||||
* @return null
|
||||
* @throws Exception
|
||||
*/
|
||||
private function __construct($argc, $argv)
|
||||
{
|
||||
self::$args = $this->_parseArgs($argv);
|
||||
$this->_action = $this->_createAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the arguments given via the command line;
|
||||
* three types are supported:
|
||||
* 1.
|
||||
* --parm1 or --parm2=value
|
||||
* 2. -xyz (multiple switches in one) or -a=value
|
||||
* 3. parm1 parm2
|
||||
*
|
||||
* The 1. will be mapped as
|
||||
* ["parm1"] => true, ["parm2"] => "value"
|
||||
* The 2. as
|
||||
* ["x"] => true, ["y"] => true, ["z"] => true, ["a"] => "value"
|
||||
* And the 3. as
|
||||
* [0] => "parm1", [1] => "parm2"
|
||||
*
|
||||
* @param array $argv
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _parseArgs($argv)
|
||||
{
|
||||
array_shift($argv);
|
||||
$o = array();
|
||||
foreach ($argv as $a) {
|
||||
if (substr($a, 0, 2) == '--') {
|
||||
$eq = strpos($a, '=');
|
||||
if ($eq !== false) {
|
||||
$o[substr($a, 2, $eq - 2)] = substr($a, $eq + 1);
|
||||
} else {
|
||||
$k = substr($a, 2);
|
||||
if (! isset($o[$k])) {
|
||||
$o[$k] = true;
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (substr($a, 0, 1) == '-') {
|
||||
if (substr($a, 2, 1) == '=') {
|
||||
$o[substr($a, 1, 1)] = substr($a, 3);
|
||||
} else {
|
||||
foreach (str_split(substr($a, 1)) as $k) {
|
||||
if (! isset($o[$k])) {
|
||||
$o[$k] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$o[] = $a;
|
||||
}
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an Action-Object for the Action-Handler
|
||||
*
|
||||
* @return Action
|
||||
* @throws Exception
|
||||
*/
|
||||
private function _createAction()
|
||||
{
|
||||
|
||||
// Test for help-switch
|
||||
if (empty(self::$args) || array_key_exists("help", self::$args) || array_key_exists("h", self::$args)) {
|
||||
self::printHelp();
|
||||
// end of execution
|
||||
}
|
||||
// check if no unknown parameters are present
|
||||
foreach (self::$args as $arg => $value) {
|
||||
|
||||
if (is_numeric($arg)) {
|
||||
throw new Exception("Unknown parameter '" . $value . "' in argument list");
|
||||
} elseif (! in_array($arg, self::$params) && ! in_array($arg, self::$switches)) {
|
||||
throw new Exception("Unknown parameter '" . $arg . "' in argument list");
|
||||
}
|
||||
}
|
||||
|
||||
// set debugger switch
|
||||
if (isset(self::$args["d"]) && self::$args["d"] == true) {
|
||||
// Debugger::getInstance()->setEnabled(true);
|
||||
// Debugger::getInstance()->debug("debug output enabled");
|
||||
}
|
||||
|
||||
return new Action(self::$args);
|
||||
}
|
||||
|
||||
public static function printHelp()
|
||||
{
|
||||
self::println("");
|
||||
self::println("Help / command line parameters:");
|
||||
self::println("");
|
||||
// commands
|
||||
self::println("--switch\t\tlets you switch ip-address A with ip-address B");
|
||||
self::println("\t\t\tExample: --switch=A,B");
|
||||
self::println("\t\t\tExample: --switch=\"A1,B1 A2,B2 A3,B3 ...\"");
|
||||
self::println("");
|
||||
self::println("--list\t\t\tshow all currently used ip-addresses in froxlor");
|
||||
self::println("");
|
||||
self::println("--froxlor-dir\t\tpath to froxlor installation");
|
||||
self::println("\t\t\tExample: --froxlor-dir=/var/www/froxlor/");
|
||||
self::println("");
|
||||
self::println("--help\t\t\tshow help screen (this)");
|
||||
self::println("");
|
||||
// switches
|
||||
// self::println("-d\t\t\tenable debug output");
|
||||
self::println("-h\t\t\tsame as --help");
|
||||
self::println("");
|
||||
|
||||
die(); // end of execution
|
||||
}
|
||||
|
||||
public static function println($msg = "")
|
||||
{
|
||||
print $msg . PHP_EOL;
|
||||
}
|
||||
|
||||
private static function _printcolor($msg = "", $color = "0")
|
||||
{
|
||||
print "\033[" . $color . "m" . $msg . "\033[0m" . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function printerr($msg = "")
|
||||
{
|
||||
self::_printcolor($msg, "31");
|
||||
}
|
||||
|
||||
public static function printsucc($msg = "")
|
||||
{
|
||||
self::_printcolor($msg, "32");
|
||||
}
|
||||
|
||||
public static function printwarn($msg = "")
|
||||
{
|
||||
self::_printcolor($msg, "33");
|
||||
}
|
||||
}
|
||||
|
||||
class Action
|
||||
{
|
||||
|
||||
private $_args = null;
|
||||
|
||||
private $_name = null;
|
||||
|
||||
private $_db = null;
|
||||
|
||||
public function __construct($args)
|
||||
{
|
||||
$this->_args = $args;
|
||||
$this->_validate();
|
||||
}
|
||||
|
||||
public function getActionName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* validates the parsed command line parameters
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private function _validate()
|
||||
{
|
||||
$need_config = false;
|
||||
if (array_key_exists("list", $this->_args) || array_key_exists("switch", $this->_args)) {
|
||||
$need_config = true;
|
||||
}
|
||||
|
||||
$this->_checkConfigParam($need_config);
|
||||
|
||||
$this->_parseConfig();
|
||||
|
||||
if (array_key_exists("list", $this->_args)) {
|
||||
$this->_listIPs();
|
||||
}
|
||||
if (array_key_exists("switch", $this->_args)) {
|
||||
$this->_switchIPs();
|
||||
}
|
||||
}
|
||||
|
||||
private function _listIPs()
|
||||
{
|
||||
$sel_stmt = Database::prepare("SELECT * FROM panel_ipsandports ORDER BY ip ASC, port ASC");
|
||||
Database::pexecute($sel_stmt);
|
||||
$ips = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$mask = "|%-10.10s |%-50.50s | %10.10s |\n";
|
||||
printf($mask, str_repeat("-", 10), str_repeat("-", 50), str_repeat("-", 10));
|
||||
printf($mask, 'id', 'IP address', 'port');
|
||||
printf($mask, str_repeat("-", 10), str_repeat("-", 50), str_repeat("-", 10));
|
||||
foreach ($ips as $ipdata) {
|
||||
printf($mask, $ipdata['id'], $ipdata['ip'], $ipdata['port']);
|
||||
}
|
||||
printf($mask, str_repeat("-", 10), str_repeat("-", 50), str_repeat("-", 10));
|
||||
echo PHP_EOL . PHP_EOL;
|
||||
}
|
||||
|
||||
private function _switchIPs()
|
||||
{
|
||||
$ip_list = $this->_args['switch'];
|
||||
|
||||
if (empty($ip_list) || is_bool($ip_list)) {
|
||||
throw new Exception("No paramters given for --switch action.");
|
||||
}
|
||||
|
||||
$ips_to_switch = array();
|
||||
$ip_list = explode(" ", $ip_list);
|
||||
foreach ($ip_list as $ips_combo) {
|
||||
$ip_pair = explode(",", $ips_combo);
|
||||
if (count($ip_pair) != 2) {
|
||||
throw new Exception("Invalid parameter given for --switch");
|
||||
} else {
|
||||
if (filter_var($ip_pair[0], FILTER_VALIDATE_IP) == false) {
|
||||
throw new Exception("Invalid source ip address: " . $ip_pair[0]);
|
||||
}
|
||||
if (filter_var($ip_pair[1], FILTER_VALIDATE_IP) == false) {
|
||||
throw new Exception("Invalid target ip address: " . $ip_pair[1]);
|
||||
}
|
||||
if ($ip_pair[0] == $ip_pair[1]) {
|
||||
throw new Exception("Source and target ip address are equal");
|
||||
}
|
||||
}
|
||||
$ips_to_switch[] = $ip_pair;
|
||||
}
|
||||
|
||||
if (count($ips_to_switch) > 0) {
|
||||
$upd_stmt = Database::prepare("UPDATE panel_ipsandports SET `ip` = :newip WHERE `ip` = :oldip");
|
||||
|
||||
// system.ipaddress
|
||||
$check_sysip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'ipaddress'");
|
||||
$check_sysip = Database::pexecute_first($check_sysip_stmt);
|
||||
|
||||
// system.mysql_access_host
|
||||
$check_mysqlip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'mysql_access_host'");
|
||||
$check_mysqlip = Database::pexecute_first($check_mysqlip_stmt);
|
||||
|
||||
// system.axfrservers
|
||||
$check_axfrip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'axfrservers'");
|
||||
$check_axfrip = Database::pexecute_first($check_axfrip_stmt);
|
||||
|
||||
foreach ($ips_to_switch as $ip_pair) {
|
||||
echo "Switching IP \033[1m" . $ip_pair[0] . "\033[0m to IP \033[1m" . $ip_pair[1] . "\033[0m" . PHP_EOL;
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'newip' => $ip_pair[1],
|
||||
'oldip' => $ip_pair[0]
|
||||
));
|
||||
$rows_updated = $upd_stmt->rowCount();
|
||||
|
||||
if ($rows_updated == 0) {
|
||||
CmdLineHandler::printwarn("Note: " . $ip_pair[0] . " not updated to " . $ip_pair[1] . " (possibly no entry found in froxlor database. Use --list to see what IP addresses are added in froxlor");
|
||||
}
|
||||
|
||||
// check whether the system.ipaddress needs updating
|
||||
if ($check_sysip['value'] == $ip_pair[0]) {
|
||||
$upd2_stmt = Database::prepare("UPDATE `panel_settings` SET `value` = :newip WHERE `settinggroup` = 'system' and `varname` = 'ipaddress'");
|
||||
Database::pexecute($upd2_stmt, array(
|
||||
'newip' => $ip_pair[1]
|
||||
));
|
||||
CmdLineHandler::printsucc("Updated system-ipaddress from '" . $ip_pair[0] . "' to '" . $ip_pair[1] . "'");
|
||||
}
|
||||
|
||||
// check whether the system.mysql_access_host needs updating
|
||||
if (strstr($check_mysqlip['value'], $ip_pair[0]) !== false) {
|
||||
$new_mysqlip = str_replace($ip_pair[0], $ip_pair[1], $check_mysqlip['value']);
|
||||
$upd2_stmt = Database::prepare("UPDATE `panel_settings` SET `value` = :newmysql WHERE `settinggroup` = 'system' and `varname` = 'mysql_access_host'");
|
||||
Database::pexecute($upd2_stmt, array(
|
||||
'newmysql' => $new_mysqlip
|
||||
));
|
||||
CmdLineHandler::printsucc("Updated mysql_access_host from '" . $check_mysqlip['value'] . "' to '" . $new_mysqlip . "'");
|
||||
}
|
||||
|
||||
// check whether the system.axfrservers needs updating
|
||||
if (strstr($check_axfrip['value'], $ip_pair[0]) !== false) {
|
||||
$new_axfrip = str_replace($ip_pair[0], $ip_pair[1], $check_axfrip['value']);
|
||||
$upd2_stmt = Database::prepare("UPDATE `panel_settings` SET `value` = :newaxfr WHERE `settinggroup` = 'system' and `varname` = 'axfrservers'");
|
||||
Database::pexecute($upd2_stmt, array(
|
||||
'newaxfr' => $new_axfrip
|
||||
));
|
||||
CmdLineHandler::printsucc("Updated axfrservers from '" . $check_axfrip['value'] . "' to '" . $new_axfrip . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
CmdLineHandler::printwarn("*** ATTENTION *** Remember to replace IP addresses in configuration files if used anywhere.");
|
||||
CmdLineHandler::printsucc("IP addresses updated");
|
||||
}
|
||||
|
||||
private function _parseConfig()
|
||||
{
|
||||
define('FROXLOR_INSTALL_DIR', $this->_args['froxlor-dir']);
|
||||
if (!file_exists(FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php')) {
|
||||
throw new Exception("Could not find froxlor's Database class. Is froxlor really installed to '".FROXLOR_INSTALL_DIR."'?");
|
||||
}
|
||||
if (!file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) {
|
||||
throw new Exception("Could not find froxlor's userdata.inc.php file. You should use this script only with a fully installed and setup froxlor system.");
|
||||
}
|
||||
require FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php';
|
||||
}
|
||||
|
||||
private function _checkConfigParam($needed = false)
|
||||
{
|
||||
if ($needed) {
|
||||
if (! isset($this->_args["froxlor-dir"])) {
|
||||
throw new Exception("No configuration given (missing --froxlor-dir parameter?)");
|
||||
} elseif (! is_dir($this->_args["froxlor-dir"])) {
|
||||
throw new Exception("Given --froxlor-dir parameter is not a directory");
|
||||
} elseif (! file_exists($this->_args["froxlor-dir"])) {
|
||||
throw new Exception("Given froxlor directory cannot be found ('" . $this->_args["froxlor-dir"] . "')");
|
||||
} elseif (! is_readable($this->_args["froxlor-dir"])) {
|
||||
throw new Exception("Given froxlor direcotry cannot be read ('" . $this->_args["froxlor-dir"] . "')");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
0
install/templates/assets/css/install.css
Executable file → Normal file
0
install/templates/assets/css/install.css
Executable file → Normal file
0
install/templates/assets/img/favicon.ico
Executable file → Normal file
0
install/templates/assets/img/favicon.ico
Executable file → Normal file
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
install/templates/assets/img/logo.png
Executable file → Normal file
0
install/templates/assets/img/logo.png
Executable file → Normal file
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
0
install/templates/assets/img/text_align_left.png
Executable file → Normal file
0
install/templates/assets/img/text_align_left.png
Executable file → Normal file
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
0
install/templates/dataform.tpl
Executable file → Normal file
0
install/templates/dataform.tpl
Executable file → Normal file
0
install/templates/dataform2.tpl
Executable file → Normal file
0
install/templates/dataform2.tpl
Executable file → Normal file
0
install/templates/dataitem.tpl
Executable file → Normal file
0
install/templates/dataitem.tpl
Executable file → Normal file
0
install/templates/dataitemchk.tpl
Executable file → Normal file
0
install/templates/dataitemchk.tpl
Executable file → Normal file
4
install/templates/dataitemyesno.tpl
Normal file
4
install/templates/dataitemyesno.tpl
Normal file
@@ -0,0 +1,4 @@
|
||||
<p>
|
||||
<label for="{$fieldname}" class="install-block {$style}">{$fieldlabel}:</label>
|
||||
<input type="checkbox" name="{$fieldname}" id="{$fieldname}" value="1" {$checked} />
|
||||
</p>
|
||||
0
install/templates/datasection.tpl
Executable file → Normal file
0
install/templates/datasection.tpl
Executable file → Normal file
0
install/templates/footer.tpl
Executable file → Normal file
0
install/templates/footer.tpl
Executable file → Normal file
0
install/templates/header.tpl
Executable file → Normal file
0
install/templates/header.tpl
Executable file → Normal file
0
install/templates/lngform.tpl
Executable file → Normal file
0
install/templates/lngform.tpl
Executable file → Normal file
0
install/templates/page.tpl
Executable file → Normal file
0
install/templates/page.tpl
Executable file → Normal file
0
install/templates/pagebottom.tpl
Executable file → Normal file
0
install/templates/pagebottom.tpl
Executable file → Normal file
0
install/templates/textarea.tpl
Executable file → Normal file
0
install/templates/textarea.tpl
Executable file → Normal file
@@ -1,124 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* tsmarty2c.php - rips gettext strings from smarty template
|
||||
*
|
||||
* ------------------------------------------------------------------------- *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library; if not, write to the Free Software *
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
* ------------------------------------------------------------------------- *
|
||||
*
|
||||
* This command line script rips gettext strings from smarty file,
|
||||
* and prints them to stdout in C format, that can later be used with the
|
||||
* standard gettext tools.
|
||||
*
|
||||
* Usage:
|
||||
* ./tsmarty2c.php <filename or directory> <file2> <..> > smarty.c
|
||||
*
|
||||
* If a parameter is a directory, the template files within will be parsed.
|
||||
*
|
||||
* @package smarty-gettext
|
||||
* @version $Id: tsmarty2c.php,v 1.3 2005/07/27 17:59:39 sagi Exp $
|
||||
* @link http://smarty-gettext.sf.net/
|
||||
* @author Sagi Bashari <sagi@boom.org.il>
|
||||
* @copyright 2004-2005 Sagi Bashari
|
||||
*/
|
||||
|
||||
// smarty open tag
|
||||
$ldq = preg_quote('{');
|
||||
|
||||
// smarty close tag
|
||||
$rdq = preg_quote('}');
|
||||
|
||||
// smarty command
|
||||
$cmd = preg_quote('t');
|
||||
|
||||
// extensions of smarty files, used when going through a directory
|
||||
$extensions = array('tpl');
|
||||
|
||||
// "fix" string - strip slashes, escape and convert new lines to \n
|
||||
function fs($str)
|
||||
{
|
||||
$str = stripslashes($str);
|
||||
$str = str_replace('"', '\"', $str);
|
||||
$str = str_replace("\n", '\n', $str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
// rips gettext strings from $file and prints them in C format
|
||||
function do_file($file)
|
||||
{
|
||||
$content = @file_get_contents($file);
|
||||
|
||||
if (empty($content)) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $ldq, $rdq, $cmd;
|
||||
|
||||
preg_match_all(
|
||||
"/{$ldq}\s*({$cmd})\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\/\\1{$rdq}/",
|
||||
$content,
|
||||
$matches
|
||||
);
|
||||
|
||||
for ($i=0; $i < count($matches[0]); $i++) {
|
||||
// TODO: add line number
|
||||
echo "/* $file */\n"; // credit: Mike van Lammeren 2005-02-14
|
||||
|
||||
if (preg_match('/plural\s*=\s*["\']?\s*(.[^\"\']*)\s*["\']?/', $matches[2][$i], $match)) {
|
||||
echo 'ngettext("'.fs($matches[3][$i]).'","'.fs($match[1]).'",x);'."\n";
|
||||
} else {
|
||||
echo 'gettext("'.fs($matches[3][$i]).'");'."\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// go through a directory
|
||||
function do_dir($dir)
|
||||
{
|
||||
$d = dir($dir);
|
||||
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if ($entry == '.' || $entry == '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$entry = $dir.'/'.$entry;
|
||||
|
||||
if (is_dir($entry)) { // if a directory, go through it
|
||||
do_dir($entry);
|
||||
} else { // if file, parse only if extension is matched
|
||||
$pi = pathinfo($entry);
|
||||
|
||||
if (isset($pi['extension']) && in_array($pi['extension'], $GLOBALS['extensions'])) {
|
||||
do_file($entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$d->close();
|
||||
}
|
||||
|
||||
for ($ac=1; $ac < $_SERVER['argc']; $ac++) {
|
||||
if (is_dir($_SERVER['argv'][$ac])) { // go through directory
|
||||
do_dir($_SERVER['argv'][$ac]);
|
||||
} else { // do file
|
||||
do_file($_SERVER['argv'][$ac]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,17 +21,18 @@
|
||||
* outputs various content before the update process
|
||||
* can be continued (askes for agreement whatever is being asked)
|
||||
*
|
||||
* @param string version
|
||||
* @param string $current_version
|
||||
* @param int $current_db_version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getPreConfig($current_version)
|
||||
function getPreConfig($current_version, $current_db_version)
|
||||
{
|
||||
$has_preconfig = false;
|
||||
$return = '<div class="preconfig"><h3 class="red">PLEASE NOTE - Important update notifications</h3>';
|
||||
|
||||
include_once makeCorrectFile(dirname(__FILE__).'/preconfig/0.9/preconfig_0.9.inc.php');
|
||||
parseAndOutputPreconfig($has_preconfig, $return, $current_version);
|
||||
parseAndOutputPreconfig($has_preconfig, $return, $current_version, $current_db_version);
|
||||
|
||||
$return .= '<br /><br />'.makecheckbox('update_changesagreed', '<strong>I have read the update notifications above and I am aware of the changes made to my system.</strong>', '1', true, '0', true);
|
||||
$return .= '</div>';
|
||||
|
||||
@@ -18,47 +18,45 @@
|
||||
/**
|
||||
* checks if the new-version has some updating to do
|
||||
*
|
||||
* @param boolean $has_preconfig pointer to check if any preconfig has to be output
|
||||
* @param string $return pointer to output string
|
||||
* @param string $current_version current froxlor version
|
||||
* @param boolean $has_preconfig
|
||||
* pointer to check if any preconfig has to be output
|
||||
* @param string $return
|
||||
* pointer to output string
|
||||
* @param string $current_version
|
||||
* current froxlor version
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
|
||||
function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $current_db_version)
|
||||
{
|
||||
global $lng;
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.4-svn2'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.4-svn2')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor now enables the usage of a domain-wildcard entry and subdomains for this domain at the same time (subdomains are parsed before the main-domain vhost container).';
|
||||
$description.= 'This makes it possible to catch all non-existing subdomains with the main vhost but also have the ability to use subdomains for that domain.<br />';
|
||||
$description.= 'If you would like Froxlor to do so with your domains, the update script can set the correct values for existing domains for you. Note: future domains will have wildcard-entries enabled by default no matter how you decide here.';
|
||||
$description .= 'This makes it possible to catch all non-existing subdomains with the main vhost but also have the ability to use subdomains for that domain.<br />';
|
||||
$description .= 'If you would like Froxlor to do so with your domains, the update script can set the correct values for existing domains for you. Note: future domains will have wildcard-entries enabled by default no matter how you decide here.';
|
||||
$question = '<strong>Do you want to use wildcard-entries for existing domains?:</strong> ';
|
||||
$question.= makeyesno('update_domainwildcardentry', '1', '0', '1');
|
||||
$question .= makeyesno('update_domainwildcardentry', '1', '0', '1');
|
||||
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.6-svn2'))
|
||||
{
|
||||
if(!PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.6-svn2')) {
|
||||
if (! PHPMailer::ValidateAddress(Settings::Get('panel.adminmail'))) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor uses a newer version of the phpMailerClass and determined that your current admin-mail address is invalid.';
|
||||
$question = '<strong>Please specify a new admin-email address:</strong> <input type="text" class="text" name="update_adminmail" value="'.Settings::Get('panel.adminmail').'" />';
|
||||
$question = '<strong>Please specify a new admin-email address:</strong> <input type="text" class="text" name="update_adminmail" value="' . Settings::Get('panel.adminmail') . '" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.6-svn3'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.6-svn3')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You now have the possibility to define default error-documents for your webserver which replace the default webserver error-messages.';
|
||||
$question = '<strong>Do you want to enable default error-documents?:</strong> ';
|
||||
$question .= makeyesno('update_deferr_enable', '1', '0', '0').'<br /><br />';
|
||||
if(Settings::Get('system.webserver') == 'apache2')
|
||||
{
|
||||
$question .= makeyesno('update_deferr_enable', '1', '0', '0') . '<br /><br />';
|
||||
if (Settings::Get('system.webserver') == 'apache2') {
|
||||
$question .= 'Path/URL for error 500: <input type="text" class="text" name="update_deferr_500" /><br /><br />';
|
||||
$question .= 'Path/URL for error 401: <input type="text" class="text" name="update_deferr_401" /><br /><br />';
|
||||
$question .= 'Path/URL for error 403: <input type="text" class="text" name="update_deferr_403" /><br /><br />';
|
||||
@@ -67,37 +65,33 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.6-svn4'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.6-svn4')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can define a default support-ticket priority level which is pre-selected for new support-tickets.';
|
||||
$question = '<strong>Which should be the default ticket-priority?:</strong> ';
|
||||
$question .= '<select name="update_deftic_priority">';
|
||||
$priorities = makeoption($lng['ticket']['high'], '1', '2');
|
||||
$priorities.= makeoption($lng['ticket']['normal'], '2', '2');
|
||||
$priorities.= makeoption($lng['ticket']['low'], '3', '2');
|
||||
$question .= $priorities.'</select>';
|
||||
$priorities .= makeoption($lng['ticket']['normal'], '2', '2');
|
||||
$priorities .= makeoption($lng['ticket']['low'], '3', '2');
|
||||
$question .= $priorities . '</select>';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.6-svn5'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.6-svn5')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'If you have more than one PHP configurations defined in Froxlor you can now set a default one which will be used for every domain.';
|
||||
$question = '<strong>Select default PHP configuration:</strong> ';
|
||||
$question .= '<select name="update_defsys_phpconfig">';
|
||||
$configs_array = getPhpConfigs();
|
||||
$configs = '';
|
||||
foreach($configs_array as $idx => $desc)
|
||||
{
|
||||
foreach ($configs_array as $idx => $desc) {
|
||||
$configs .= makeoption($desc, $idx, '1');
|
||||
}
|
||||
$question .= $configs.'</select>';
|
||||
$question .= $configs . '</select>';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.6-svn6'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.6-svn6')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'For the new FTP-quota feature, you can now chose the currently used ftpd-software.';
|
||||
$question = '<strong>Used FTPd-software:</strong> ';
|
||||
@@ -108,72 +102,63 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.7-svn1'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.7-svn1')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can now choose whether customers can select the http-redirect code and which of them acts as default.';
|
||||
$question = '<strong>Allow customer chosen redirects?:</strong> ';
|
||||
$question.= makeyesno('update_customredirect_enable', '1', '0', '1').'<br /><br />';
|
||||
$question.= '<strong>Select default redirect code (default: empty):</strong> ';
|
||||
$question.= '<select name="update_customredirect_default">';
|
||||
$redirects = makeoption('--- ('.$lng['redirect_desc']['rc_default'].')', 1, '1');
|
||||
$redirects.= makeoption('301 ('.$lng['redirect_desc']['rc_movedperm'].')', 2, '1');
|
||||
$redirects.= makeoption('302 ('.$lng['redirect_desc']['rc_found'].')', 3, '1');
|
||||
$redirects.= makeoption('303 ('.$lng['redirect_desc']['rc_seeother'].')', 4, '1');
|
||||
$redirects.= makeoption('307 ('.$lng['redirect_desc']['rc_tempred'].')', 5, '1');
|
||||
$question .= $redirects.'</select>';
|
||||
$question .= makeyesno('update_customredirect_enable', '1', '0', '1') . '<br /><br />';
|
||||
$question .= '<strong>Select default redirect code (default: empty):</strong> ';
|
||||
$question .= '<select name="update_customredirect_default">';
|
||||
$redirects = makeoption('--- (' . $lng['redirect_desc']['rc_default'] . ')', 1, '1');
|
||||
$redirects .= makeoption('301 (' . $lng['redirect_desc']['rc_movedperm'] . ')', 2, '1');
|
||||
$redirects .= makeoption('302 (' . $lng['redirect_desc']['rc_found'] . ')', 3, '1');
|
||||
$redirects .= makeoption('303 (' . $lng['redirect_desc']['rc_seeother'] . ')', 4, '1');
|
||||
$redirects .= makeoption('307 (' . $lng['redirect_desc']['rc_tempred'] . ')', 5, '1');
|
||||
$question .= $redirects . '</select>';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.7-svn2'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.7-svn2')) {
|
||||
$result = Database::query("SELECT `domain` FROM " . TABLE_PANEL_DOMAINS . " WHERE `documentroot` LIKE '%:%' AND `documentroot` NOT LIKE 'http://%' AND `openbasedir_path` = '0' AND `openbasedir` = '1'");
|
||||
$wrongOpenBasedirDomain = array();
|
||||
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$wrongOpenBasedirDomain[] = $row['domain'];
|
||||
}
|
||||
|
||||
if(count($wrongOpenBasedirDomain) > 0)
|
||||
{
|
||||
if (count($wrongOpenBasedirDomain) > 0) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Resetting the open_basedir to customer - root';
|
||||
$question = '<strong>Due to a security - issue regarding open_basedir, Froxlor will set the open_basedir for the following domains to the customers root instead of the chosen documentroot:</strong><br /> ';
|
||||
$question.= '<ul>';
|
||||
$question .= '<ul>';
|
||||
$idna_convert = new idna_convert_wrapper();
|
||||
foreach($wrongOpenBasedirDomain as $domain)
|
||||
{
|
||||
$question.= '<li>' . $idna_convert->decode($domain) . '</li>';
|
||||
foreach ($wrongOpenBasedirDomain as $domain) {
|
||||
$question .= '<li>' . $idna_convert->decode($domain) . '</li>';
|
||||
}
|
||||
$question.= '</ul>';
|
||||
$question .= '</ul>';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.9-svn1'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.9-svn1')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'When entering MX servers to Froxlor there was no mail-, imap-, pop3- and smtp-"A record" created. You can now chose whether this should be done or not.';
|
||||
$question = '<strong>Do you want these A-records to be created even with MX servers given?:</strong> ';
|
||||
$question.= makeyesno('update_defdns_mailentry', '1', '0', '0');
|
||||
$question .= makeyesno('update_defdns_mailentry', '1', '0', '0');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.10-svn1'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.10-svn1')) {
|
||||
$has_nouser = false;
|
||||
$has_nogroup = false;
|
||||
|
||||
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'httpuser'");
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if(!isset($result) || !isset($result['value']))
|
||||
{
|
||||
if (! isset($result) || ! isset($result['value'])) {
|
||||
$has_preconfig = true;
|
||||
$has_nouser = true;
|
||||
$guessed_user = 'www-data';
|
||||
if(function_exists('posix_getuid')
|
||||
&& function_exists('posix_getpwuid')
|
||||
) {
|
||||
if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
|
||||
$_httpuser = posix_getpwuid(posix_getuid());
|
||||
$guessed_user = $_httpuser['name'];
|
||||
}
|
||||
@@ -182,31 +167,24 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'");
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if(!isset($result) || !isset($result['value']))
|
||||
{
|
||||
if (! isset($result) || ! isset($result['value'])) {
|
||||
$has_preconfig = true;
|
||||
$has_nogroup = true;
|
||||
$guessed_group = 'www-data';
|
||||
if(function_exists('posix_getgid')
|
||||
&& function_exists('posix_getgrgid')
|
||||
) {
|
||||
if (function_exists('posix_getgid') && function_exists('posix_getgrgid')) {
|
||||
$_httpgroup = posix_getgrgid(posix_getgid());
|
||||
$guessed_group = $_httpgroup['name'];
|
||||
}
|
||||
}
|
||||
|
||||
if($has_nouser || $has_nogroup)
|
||||
{
|
||||
if ($has_nouser || $has_nogroup) {
|
||||
$description = 'Please enter the correct username/groupname of the webserver on your system We\'re guessing the user but it might not be correct, so please check.';
|
||||
if($has_nouser)
|
||||
{
|
||||
$question = '<strong>Please enter the webservers username:</strong> <input type="text" class="text" name="update_httpuser" value="'.$guessed_user.'" />';
|
||||
}
|
||||
elseif($has_nogroup)
|
||||
{
|
||||
$question2 = '<strong>Please enter the webservers groupname:</strong> <input type="text" class="text" name="update_httpgroup" value="'.$guessed_group.'" />';
|
||||
if($has_nouser) {
|
||||
$question .= '<br /><br />'.$question2;
|
||||
if ($has_nouser) {
|
||||
$question = '<strong>Please enter the webservers username:</strong> <input type="text" class="text" name="update_httpuser" value="' . $guessed_user . '" />';
|
||||
} elseif ($has_nogroup) {
|
||||
$question2 = '<strong>Please enter the webservers groupname:</strong> <input type="text" class="text" name="update_httpgroup" value="' . $guessed_group . '" />';
|
||||
if ($has_nouser) {
|
||||
$question .= '<br /><br />' . $question2;
|
||||
} else {
|
||||
$question = $question2;
|
||||
}
|
||||
@@ -215,227 +193,202 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.10'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.10')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'you can now decide whether Froxlor should be reached via hostname/froxlor or directly via the hostname.';
|
||||
$question = '<strong>Do you want Froxlor to be reached directly via the hostname?:</strong> ';
|
||||
$question.= makeyesno('update_directlyviahostname', '1', '0', '0');
|
||||
$question .= makeyesno('update_directlyviahostname', '1', '0', '0');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.11-svn1'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.11-svn1')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'It is possible to enhance security with setting a regular expression to force your customers to enter more complex passwords.';
|
||||
$question = '<strong>Enter a regular expression to force a higher password complexity (leave empty for none):</strong> ';
|
||||
$question.= '<input type="text" class="text" name="update_pwdregex" value="" />';
|
||||
$question .= '<input type="text" class="text" name="update_pwdregex" value="" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.11-svn3'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.11-svn3')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'As Froxlor can now handle perl, you have to specify where the perl executable is (only if you\'re running lighttpd, else just leave empty).';
|
||||
$question = '<strong>Path to perl (default \'/usr/bin/perl\'):</strong> ';
|
||||
$question.= '<input type="text" class="text" name="update_perlpath" value="/usr/bin/perl" />';
|
||||
$question .= '<input type="text" class="text" name="update_perlpath" value="/usr/bin/perl" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.12-svn1'))
|
||||
{
|
||||
if(Settings::Get('system.mod_fcgid') == 1)
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.12-svn1')) {
|
||||
if (Settings::Get('system.mod_fcgid') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can chose whether you want Froxlor to use FCGID itself too now.';
|
||||
$question = '<strong>Use FCGID for the Froxlor Panel?:</strong> ';
|
||||
$question.= makeyesno('update_fcgid_ownvhost', '1', '0', '0').'<br /><br />';
|
||||
$question.= '<strong>If \'yes\', please specify local user/group (have to exist, Froxlor does not add them automatically):</strong><br /><br />';
|
||||
$question.= 'Local user: ';
|
||||
$question.= '<input type="text" class="text" name="update_fcgid_httpuser" value="froxlorlocal" /><br /><br />';
|
||||
$question.= 'Local group: ';
|
||||
$question.= '<input type="text" class="text" name="update_fcgid_httpgroup" value="froxlorlocal" /><br />';
|
||||
$question .= makeyesno('update_fcgid_ownvhost', '1', '0', '0') . '<br /><br />';
|
||||
$question .= '<strong>If \'yes\', please specify local user/group (have to exist, Froxlor does not add them automatically):</strong><br /><br />';
|
||||
$question .= 'Local user: ';
|
||||
$question .= '<input type="text" class="text" name="update_fcgid_httpuser" value="froxlorlocal" /><br /><br />';
|
||||
$question .= 'Local group: ';
|
||||
$question .= '<input type="text" class="text" name="update_fcgid_httpgroup" value="froxlorlocal" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.12-svn2'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.12-svn2')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Many apache user will have problems using perl/CGI as the customer docroots are not within the suexec path. Froxlor provides a simple workaround for that.';
|
||||
$question = '<strong>Enable Apache/SuExec/Perl workaround?:</strong> ';
|
||||
$question.= makeyesno('update_perl_suexecworkaround', '1', '0', '0').'<br /><br />';
|
||||
$question.= '<strong>If \'yes\', please specify a path within the suexec path where Froxlor will create symlinks to customer perl-enabled paths:</strong><br /><br />';
|
||||
$question.= 'Path for symlinks (must be within suexec path): ';
|
||||
$question.= '<input type="text" class="text" name="update_perl_suexecpath" value="/var/www/cgi-bin/" /><br />';
|
||||
$question .= makeyesno('update_perl_suexecworkaround', '1', '0', '0') . '<br /><br />';
|
||||
$question .= '<strong>If \'yes\', please specify a path within the suexec path where Froxlor will create symlinks to customer perl-enabled paths:</strong><br /><br />';
|
||||
$question .= 'Path for symlinks (must be within suexec path): ';
|
||||
$question .= '<input type="text" class="text" name="update_perl_suexecpath" value="/var/www/cgi-bin/" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.12-svn4'))
|
||||
{
|
||||
if((int)Settings::Get('system.awstats_enabled') == 1)
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.12-svn4')) {
|
||||
if ((int) Settings::Get('system.awstats_enabled') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Due to different paths of awstats_buildstaticpages.pl and awstats.pl you can set a different path for awstats.pl now.';
|
||||
$question = '<strong>Path to \'awstats.pl\'?:</strong> ';
|
||||
$question.= '<input type="text" class="text" name="update_awstats_awstatspath" value="'.Settings::Get('system.awstats_path').'" /><br />';
|
||||
$question .= '<input type="text" class="text" name="update_awstats_awstatspath" value="' . Settings::Get('system.awstats_path') . '" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.13-svn1'))
|
||||
{
|
||||
if((int)Settings::Get('autoresponder.autoresponder_active') == 1)
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.13-svn1')) {
|
||||
if ((int) Settings::Get('autoresponder.autoresponder_active') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor can now limit the number of autoresponder-entries for each user. Here you can set the value which will be available for each customer (Of course you can change the value for each customer separately after the update).';
|
||||
$question = '<strong>How many autoresponders should your customers be able to add?:</strong> ';
|
||||
$question.= '<input type="text" class="text" name="update_autoresponder_default" value="0" /> '.makecheckbox('update_autoresponder_default', $lng['customer']['unlimited'], '-1', false, 0, true, true).'<br />';
|
||||
$question .= '<input type="text" class="text" name="update_autoresponder_default" value="0" /> ' . makecheckbox('update_autoresponder_default', $lng['customer']['unlimited'], '-1', false, 0, true, true) . '<br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.13.1'))
|
||||
{
|
||||
if((int)Settings::Get('system.mod_fcgid_ownvhost') == 1)
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.13.1')) {
|
||||
if ((int) Settings::Get('system.mod_fcgid_ownvhost') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You have FCGID for Froxlor itself activated. You can now specify a PHP-configuration for this.';
|
||||
$question = '<strong>Select Froxlor-vhost PHP configuration:</strong> ';
|
||||
$question .= '<select name="update_defaultini_ownvhost">';
|
||||
$configs_array = getPhpConfigs();
|
||||
$configs = '';
|
||||
foreach($configs_array as $idx => $desc)
|
||||
{
|
||||
foreach ($configs_array as $idx => $desc) {
|
||||
$configs .= makeoption($desc, $idx, '1');
|
||||
}
|
||||
$question .= $configs.'</select>';
|
||||
$question .= $configs . '</select>';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.14-svn3'))
|
||||
{
|
||||
if((int)Settings::Get('system.awstats_enabled') == 1)
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.14-svn3')) {
|
||||
if ((int) Settings::Get('system.awstats_enabled') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'To have icons in AWStats statistic-pages please enter the path to AWStats icons folder.';
|
||||
$question = '<strong>Path to AWSTats icons folder:</strong> ';
|
||||
$question.= '<input type="text" class="text" name="update_awstats_icons" value="'.Settings::Get('system.awstats_icons').'" />';
|
||||
$question .= '<input type="text" class="text" name="update_awstats_icons" value="' . Settings::Get('system.awstats_icons') . '" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.14-svn4'))
|
||||
{
|
||||
if((int)Settings::Get('system.use_ssl') == 1)
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.14-svn4')) {
|
||||
if ((int) Settings::Get('system.use_ssl') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor now has the possibility to set \'SSLCertificateChainFile\' for the apache webserver.';
|
||||
$question = '<strong>Enter filename (leave empty for none):</strong> ';
|
||||
$question.= '<input type="text" class="text" name="update_ssl_cert_chainfile" value="'.Settings::Get('system.ssl_cert_chainfile').'" />';
|
||||
$question .= '<input type="text" class="text" name="update_ssl_cert_chainfile" value="' . Settings::Get('system.ssl_cert_chainfile') . '" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.14-svn6'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.14-svn6')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can now allow customers to use any of their domains as username for the login.';
|
||||
$question = '<strong>Do you want to enable domain-login for all customers?:</strong> ';
|
||||
$question.= makeyesno('update_allow_domain_login', '1', '0', '0');
|
||||
$question .= makeyesno('update_allow_domain_login', '1', '0', '0');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.14-svn10'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.14-svn10')) {
|
||||
$has_preconfig = true;
|
||||
$description = '<strong>This update removes the unsupported real-time option. Additionally the deprecated tables for navigation and cronscripts are removed, any modules using these tables need to be updated to the new structure!</strong>';
|
||||
$question = '';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.16-svn1'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.16-svn1')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor now features support for php-fpm.';
|
||||
$question = '<strong>Do you want to enable php-fpm?:</strong> ';
|
||||
$question.= makeyesno('update_phpfpm_enabled', '1', '0', '0').'<br /><br />';
|
||||
$question.= 'If \'yes\', please specify the configuration directory: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_configdir" value="/etc/php-fpm.d/" /><br /><br />';
|
||||
$question.= 'Please specify the temporary files directory: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_tmpdir" value="/var/customers/tmp/" /><br /><br />';
|
||||
$question.= 'Please specify the PEAR directory: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_peardir" value="/usr/share/php/:/usr/share/php5/" /><br /><br />';
|
||||
$question.= 'Please specify the php-fpm restart-command: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_reload" value="/etc/init.d/php-fpm restart" /><br /><br />';
|
||||
$question.= 'Please specify the php-fpm rocess manager control: ';
|
||||
$question.= '<select name="update_phpfpm_pm">';
|
||||
$question .= makeyesno('update_phpfpm_enabled', '1', '0', '0') . '<br /><br />';
|
||||
$question .= 'If \'yes\', please specify the configuration directory: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_configdir" value="/etc/php-fpm.d/" /><br /><br />';
|
||||
$question .= 'Please specify the temporary files directory: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_tmpdir" value="/var/customers/tmp/" /><br /><br />';
|
||||
$question .= 'Please specify the PEAR directory: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_peardir" value="/usr/share/php/:/usr/share/php5/" /><br /><br />';
|
||||
$question .= 'Please specify the php-fpm restart-command: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_reload" value="/etc/init.d/php-fpm restart" /><br /><br />';
|
||||
$question .= 'Please specify the php-fpm rocess manager control: ';
|
||||
$question .= '<select name="update_phpfpm_pm">';
|
||||
$redirects = makeoption('static', 'static', 'static');
|
||||
$redirects.= makeoption('dynamic', 'dynamic', 'static');
|
||||
$question .= $redirects.'</select><br /><br />';
|
||||
$question.= 'Please specify the number of child processes: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_max_children" value="1" /><br /><br />';
|
||||
$question.= 'Please specify the number of requests per child before respawning: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_max_requests" value="0" /><br /><br />';
|
||||
$question.= '<em>The following settings are only required if you chose process manager = dynamic</em><br /><br />';
|
||||
$question.= 'Please specify the number of child processes created on startup: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_start_servers" value="20" /><br /><br />';
|
||||
$question.= 'Please specify the desired minimum number of idle server processes: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_min_spare_servers" value="5" /><br /><br />';
|
||||
$question.= 'Please specify the desired maximum number of idle server processes: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_max_spare_servers" value="35" /><br />';
|
||||
$redirects .= makeoption('dynamic', 'dynamic', 'static');
|
||||
$question .= $redirects . '</select><br /><br />';
|
||||
$question .= 'Please specify the number of child processes: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_max_children" value="1" /><br /><br />';
|
||||
$question .= 'Please specify the number of requests per child before respawning: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_max_requests" value="0" /><br /><br />';
|
||||
$question .= '<em>The following settings are only required if you chose process manager = dynamic</em><br /><br />';
|
||||
$question .= 'Please specify the number of child processes created on startup: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_start_servers" value="20" /><br /><br />';
|
||||
$question .= 'Please specify the desired minimum number of idle server processes: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_min_spare_servers" value="5" /><br /><br />';
|
||||
$question .= 'Please specify the desired maximum number of idle server processes: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_max_spare_servers" value="35" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.16-svn2'))
|
||||
{
|
||||
if((int)Settings::Get('phpfpm.enabled') == 1)
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.16-svn2')) {
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can chose whether you want Froxlor to use PHP-FPM itself too now.';
|
||||
$question = '<strong>Use PHP-FPM for the Froxlor Panel?:</strong> ';
|
||||
$question.= makeyesno('update_phpfpm_enabled_ownvhost', '1', '0', '0').'<br /><br />';
|
||||
$question.= '<strong>If \'yes\', please specify local user/group (have to exist, Froxlor does not add them automatically):</strong><br /><br />';
|
||||
$question.= 'Local user: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_httpuser" value="'.Settings::Get('system.mod_fcgid_httpuser').'" /><br /><br />';
|
||||
$question.= 'Local group: ';
|
||||
$question.= '<input type="text" class="text" name="update_phpfpm_httpgroup" value="'.Settings::Get('system.mod_fcgid_httpgroup').'" /><br />';
|
||||
$question .= makeyesno('update_phpfpm_enabled_ownvhost', '1', '0', '0') . '<br /><br />';
|
||||
$question .= '<strong>If \'yes\', please specify local user/group (have to exist, Froxlor does not add them automatically):</strong><br /><br />';
|
||||
$question .= 'Local user: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_httpuser" value="' . Settings::Get('system.mod_fcgid_httpuser') . '" /><br /><br />';
|
||||
$question .= 'Local group: ';
|
||||
$question .= '<input type="text" class="text" name="update_phpfpm_httpgroup" value="' . Settings::Get('system.mod_fcgid_httpgroup') . '" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.17-svn1'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.17-svn1')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Select if you want to enable the web- and traffic-reports';
|
||||
$question = '<strong>Enable?:</strong> ';
|
||||
$question.= makeyesno('update_system_report_enable', '1', '0', '1').'<br /><br />';
|
||||
$question.= '<strong>If \'yes\', please specify a percentage value for web- and traffic when reports are to be sent:</strong><br /><br />';
|
||||
$question.= 'Webusage warning level: ';
|
||||
$question.= '<input type="text" class="text" name="update_system_report_webmax" value="90" /><br /><br />';
|
||||
$question.= 'Traffic warning level: ';
|
||||
$question.= '<input type="text" class="text" name="update_system_report_trafficmax" value="90" /><br />';
|
||||
$question .= makeyesno('update_system_report_enable', '1', '0', '1') . '<br /><br />';
|
||||
$question .= '<strong>If \'yes\', please specify a percentage value for web- and traffic when reports are to be sent:</strong><br /><br />';
|
||||
$question .= 'Webusage warning level: ';
|
||||
$question .= '<input type="text" class="text" name="update_system_report_webmax" value="90" /><br /><br />';
|
||||
$question .= 'Traffic warning level: ';
|
||||
$question .= '<input type="text" class="text" name="update_system_report_trafficmax" value="90" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.18-svn2'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.18-svn2')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'As you can (obviously) see, Froxlor now comes with a new theme. You also have the possibility to switch back to "Classic" if you want to.';
|
||||
$question = '<strong>Select default panel theme:</strong> ';
|
||||
$question.= '<select name="update_default_theme">';
|
||||
$question .= '<select name="update_default_theme">';
|
||||
$themes = getThemes();
|
||||
foreach($themes as $cur_theme) // $theme is already in use
|
||||
{
|
||||
$question.= makeoption($cur_theme, $cur_theme, 'Froxlor');
|
||||
foreach ($themes as $cur_theme) // $theme is already in use
|
||||
{
|
||||
$question .= makeoption($cur_theme, $cur_theme, 'Froxlor');
|
||||
}
|
||||
$question.= '</select>';
|
||||
$question .= '</select>';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.28-svn4'))
|
||||
{
|
||||
if (versionInUpdate($current_version, '0.9.28-svn4')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'This version introduces a lot of profound changes:';
|
||||
$description .= '<br /><ul><li>Improving the whole template system</li><li>Full UTF-8 support</li><li><strong>Removing support for the former default theme \'Classic\'</strong></li></ul>';
|
||||
@@ -444,13 +397,12 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
$description .= 'test this update in a testing environment using your existing data.<br /><br />';
|
||||
|
||||
$question = '<strong>Select your preferred Classic Theme replacement:</strong> ';
|
||||
$question.= '<select name="classic_theme_replacement">';
|
||||
$question .= '<select name="classic_theme_replacement">';
|
||||
$themes = getThemes();
|
||||
foreach($themes as $cur_theme)
|
||||
{
|
||||
$question.= makeoption($cur_theme, $cur_theme, 'Froxlor');
|
||||
foreach ($themes as $cur_theme) {
|
||||
$question .= makeoption($cur_theme, $cur_theme, 'Froxlor');
|
||||
}
|
||||
$question.= '</select>';
|
||||
$question .= '</select>';
|
||||
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
@@ -460,16 +412,16 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
if (Settings::Get('system.webserver') == 'apache2') {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor now supports the new Apache 2.4. Please be aware that you need to load additional apache-modules in ordner to use it.<br />';
|
||||
$description.= '<pre>LoadModule authz_core_module modules/mod_authz_core.so
|
||||
$description .= '<pre>LoadModule authz_core_module modules/mod_authz_core.so
|
||||
LoadModule authz_host_module modules/mod_authz_host.so</pre><br />';
|
||||
$question = '<strong>Do you want to enable the Apache-2.4 modification?:</strong> ';
|
||||
$question.= makeyesno('update_system_apache24', '1', '0', '0');
|
||||
$question .= makeyesno('update_system_apache24', '1', '0', '0');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
} elseif (Settings::Get('system.webserver') == 'nginx') {
|
||||
$has_preconfig = true;
|
||||
$description = 'The path to nginx\'s fastcgi_params file is now customizable.<br /><br />';
|
||||
$question = '<strong>Please enter full path to you nginx/fastcgi_params file (including filename):</strong> ';
|
||||
$question.= '<input type="text" class="text" name="nginx_fastcgi_params" value="/etc/nginx/fastcgi_params" />';
|
||||
$question .= '<input type="text" class="text" name="nginx_fastcgi_params" value="/etc/nginx/fastcgi_params" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
@@ -478,11 +430,11 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
|
||||
$has_preconfig = true;
|
||||
|
||||
$description = 'This version adds an option to append the domain-name to the document-root for domains and subdomains.<br />';
|
||||
$description = 'This version adds an option to append the domain-name to the document-root for domains and subdomains.<br />';
|
||||
$description .= 'You can enable or disable this feature anytime from settings -> system settings.<br />';
|
||||
|
||||
$question = '<strong>Do you want to automatically append the domain-name to the documentroot of newly created domains?:</strong> ';
|
||||
$question.= makeyesno('update_system_documentroot_use_default_value', '1', '0', '0');
|
||||
$question .= makeyesno('update_system_documentroot_use_default_value', '1', '0', '0');
|
||||
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
@@ -491,12 +443,10 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
|
||||
$has_preconfig = true;
|
||||
// just an information about the new sendmail parameter (#1134)
|
||||
$description = 'Froxlor changed the default parameter-set of sendmail (php.ini)<br />';
|
||||
$description = 'Froxlor changed the default parameter-set of sendmail (php.ini)<br />';
|
||||
$description .= 'sendmail_path = "/usr/sbin/sendmail -t <strong>-i</strong> -f {CUSTOMER_EMAIL}"<br /><br />';
|
||||
$description .= 'If you don\'t have any problems with sending mails, you don\'t need to change this';
|
||||
if (Settings::Get('system.mod_fcgid') == '1'
|
||||
|| Settings::Get('phpfpm.enabled') == '1'
|
||||
) {
|
||||
if (Settings::Get('system.mod_fcgid') == '1' || Settings::Get('phpfpm.enabled') == '1') {
|
||||
// information about removal of php's safe_mode
|
||||
$description .= '<br /><br />The php safe_mode flag has been removed as current versions of PHP<br />';
|
||||
$description .= 'do not support it anymore.<br /><br />';
|
||||
@@ -509,45 +459,43 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.29-dev1')) {
|
||||
// we only need to ask if fcgid|php-fpm is enabled
|
||||
if (Settings::Get('system.mod_fcgid') == '1'
|
||||
|| Settings::Get('phpfpm.enabled') == '1'
|
||||
) {
|
||||
if (Settings::Get('system.mod_fcgid') == '1' || Settings::Get('phpfpm.enabled') == '1') {
|
||||
$has_preconfig = true;
|
||||
$description = 'Standard-subdomains can now be hidden from the php-configuration overview.<br />';
|
||||
$description = 'Standard-subdomains can now be hidden from the php-configuration overview.<br />';
|
||||
$question = '<strong>Do you want to hide the standard-subdomains (this can be changed in the settings any time)?:</strong> ';
|
||||
$question.= makeyesno('hide_stdsubdomains', '1', '0', '0');
|
||||
$question .= makeyesno('hide_stdsubdomains', '1', '0', '0');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.29-dev2')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can now decide whether admins/customers are able to change the theme<br />';
|
||||
$description = 'You can now decide whether admins/customers are able to change the theme<br />';
|
||||
$question = '<strong>If you want to disallow theme-changing, select "no" from the dropdowns:</strong> ';
|
||||
$question.= "Admins: ". makeyesno('allow_themechange_a', '1', '0', '1').' ';
|
||||
$question.= "Customers: ".makeyesno('allow_themechange_c', '1', '0', '1');
|
||||
$question .= "Admins: " . makeyesno('allow_themechange_a', '1', '0', '1') . ' ';
|
||||
$question .= "Customers: " . makeyesno('allow_themechange_c', '1', '0', '1');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.29-dev3')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'There is now a possibility to specify AXFR servers for your bind zone-configuration<br />';
|
||||
$description = 'There is now a possibility to specify AXFR servers for your bind zone-configuration<br />';
|
||||
$question = '<strong>Enter a comma-separated list of AXFR servers or leave empty (default):</strong> ';
|
||||
$question.= '<input type="text" class="text" name="system_afxrservers" value="" />';
|
||||
$question .= '<input type="text" class="text" name="system_afxrservers" value="" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.29-dev4')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'As customers can now specify ssl-certificate data for their domains, you need to specify where the generated files are stored<br />';
|
||||
$description = 'As customers can now specify ssl-certificate data for their domains, you need to specify where the generated files are stored<br />';
|
||||
$question = '<strong>Specify the directory for customer ssl-certificates:</strong> ';
|
||||
$question.= '<input type="text" class="text" name="system_customersslpath" value="/etc/ssl/froxlor-custom/" />';
|
||||
$question .= '<input type="text" class="text" name="system_customersslpath" value="/etc/ssl/froxlor-custom/" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.29.1-dev3')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'The build in logrotation-feature has been removed. Please follow the configuration-instructions for your system to enable logrotating again.';
|
||||
$description = 'The build in logrotation-feature has been removed. Please follow the configuration-instructions for your system to enable logrotating again.';
|
||||
$question = '';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
@@ -555,11 +503,9 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
// let the apache+fpm users know that they MUST change their config
|
||||
// for the domains / webserver to work after the update
|
||||
if (versionInUpdate($current_version, '0.9.30-dev1')) {
|
||||
if (Settings::Get('system.webserver') == 'apache2'
|
||||
&& Settings::Get('phpfpm.enabled') == '1'
|
||||
) {
|
||||
if (Settings::Get('system.webserver') == 'apache2' && Settings::Get('phpfpm.enabled') == '1') {
|
||||
$has_preconfig = true;
|
||||
$description = 'The PHP-FPM implementation for apache2 has changed. Please look for the "<b>fastcgi.conf</b>" (Debian/Ubuntu) or "<b>70_fastcgi.conf</b>" (Gentoo) within /etc/apache2/ and change it as shown below:<br /><br />';
|
||||
$description = 'The PHP-FPM implementation for apache2 has changed. Please look for the "<b>fastcgi.conf</b>" (Debian/Ubuntu) or "<b>70_fastcgi.conf</b>" (Gentoo) within /etc/apache2/ and change it as shown below:<br /><br />';
|
||||
$description .= '<pre class="code-block"><IfModule mod_fastcgi.c>
|
||||
FastCgiIpcDir /var/lib/apache2/fastcgi/
|
||||
<Location "/fastcgiphp">
|
||||
@@ -575,11 +521,9 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.31-dev2')) {
|
||||
if (Settings::Get('system.webserver') == 'apache2'
|
||||
&& Settings::Get('phpfpm.enabled') == '1'
|
||||
) {
|
||||
if (Settings::Get('system.webserver') == 'apache2' && Settings::Get('phpfpm.enabled') == '1') {
|
||||
$has_preconfig = true;
|
||||
$description = 'The FPM socket directory is now a setting in froxlor. Its default is <b>/var/lib/apache2/fastcgi/</b>.<br/>If you are using <b>/var/run/apache2</b> in the "<b>fastcgi.conf</b>" (Debian/Ubuntu) or "<b>70_fastcgi.conf</b>" (Gentoo) please correct this path accordingly<br />';
|
||||
$description = 'The FPM socket directory is now a setting in froxlor. Its default is <b>/var/lib/apache2/fastcgi/</b>.<br/>If you are using <b>/var/run/apache2</b> in the "<b>fastcgi.conf</b>" (Debian/Ubuntu) or "<b>70_fastcgi.conf</b>" (Gentoo) please correct this path accordingly<br />';
|
||||
$question = '';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
@@ -587,50 +531,50 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.31-dev4')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'The template-variable {PASSWORD} has been replaced with {LINK}. Please update your password reset templates!<br />';
|
||||
$description = 'The template-variable {PASSWORD} has been replaced with {LINK}. Please update your password reset templates!<br />';
|
||||
$question = '';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.31-dev5')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can enable/disable error-reporting for admins and customers!<br /><br />';
|
||||
$description = 'You can enable/disable error-reporting for admins and customers!<br /><br />';
|
||||
$question = '<strong>Do you want to enable error-reporting for admins? (default: yes):</strong> ';
|
||||
$question.= makeyesno('update_error_report_admin', '1', '0', '1').'<br />';
|
||||
$question.= '<strong>Do you want to enable error-reporting for customers? (default: no):</strong> ';
|
||||
$question.= makeyesno('update_error_report_customer', '1', '0', '0');
|
||||
$question .= makeyesno('update_error_report_admin', '1', '0', '1') . '<br />';
|
||||
$question .= '<strong>Do you want to enable error-reporting for customers? (default: no):</strong> ';
|
||||
$question .= makeyesno('update_error_report_customer', '1', '0', '0');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.31-rc2')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can enable/disable the display/usage of the news-feed for admins<br /><br />';
|
||||
$description = 'You can enable/disable the display/usage of the news-feed for admins<br /><br />';
|
||||
$question = '<strong>Do you want to enable the news-feed for admins? (default: yes):</strong> ';
|
||||
$question.= makeyesno('update_admin_news_feed', '1', '0', '1').'<br />';
|
||||
$question .= makeyesno('update_admin_news_feed', '1', '0', '1') . '<br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.32-dev2')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'To enable logging of the mail-traffic, you need to set the following settings accordingly<br /><br />';
|
||||
$description = 'To enable logging of the mail-traffic, you need to set the following settings accordingly<br /><br />';
|
||||
$question = '<strong>Do you want to enable the traffic collection for mail? (default: yes):</strong> ';
|
||||
$question.= makeyesno('mailtraffic_enabled', '1', '0', '1').'<br />';
|
||||
$question.= '<strong>Mail Transfer Agent</strong><br />';
|
||||
$question.= 'Type of your MTA: ';
|
||||
$question.= '<select name="mtaserver">';
|
||||
$question.= makeoption('Postfix', 'postfix', 'postfix');
|
||||
$question.= makeoption('Exim4', 'exim4', 'postfix');
|
||||
$question.= '</select><br />';
|
||||
$question.= 'Logfile for your MTA: ';
|
||||
$question.= '<input type="text" class="text" name="mtalog" value="/var/log/mail.log" /><br />';
|
||||
$question.= '<strong>Mail Delivery Agent</strong><br />';
|
||||
$question.= 'Type of your MDA: ';
|
||||
$question.= '<select name="mdaserver">';
|
||||
$question.= makeoption('Dovecot', 'dovecot', 'dovecot');
|
||||
$question.= makeoption('Courier', 'courier', 'dovecot');
|
||||
$question.= '</select><br /><br />';
|
||||
$question.= 'Logfile for your MDA: ';
|
||||
$question.= '<input type="text" class="text" name="mdalog" value="/var/log/mail.log" /><br />';
|
||||
$question .= makeyesno('mailtraffic_enabled', '1', '0', '1') . '<br />';
|
||||
$question .= '<strong>Mail Transfer Agent</strong><br />';
|
||||
$question .= 'Type of your MTA: ';
|
||||
$question .= '<select name="mtaserver">';
|
||||
$question .= makeoption('Postfix', 'postfix', 'postfix');
|
||||
$question .= makeoption('Exim4', 'exim4', 'postfix');
|
||||
$question .= '</select><br />';
|
||||
$question .= 'Logfile for your MTA: ';
|
||||
$question .= '<input type="text" class="text" name="mtalog" value="/var/log/mail.log" /><br />';
|
||||
$question .= '<strong>Mail Delivery Agent</strong><br />';
|
||||
$question .= 'Type of your MDA: ';
|
||||
$question .= '<select name="mdaserver">';
|
||||
$question .= makeoption('Dovecot', 'dovecot', 'dovecot');
|
||||
$question .= makeoption('Courier', 'courier', 'dovecot');
|
||||
$question .= '</select><br /><br />';
|
||||
$question .= 'Logfile for your MDA: ';
|
||||
$question .= '<input type="text" class="text" name="mdalog" value="/var/log/mail.log" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
@@ -638,7 +582,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor now generates a cron-configuration file for the cron-daemon. Please set a filename which will be included automatically by your crond (e.g. files in /etc/cron.d/)<br /><br />';
|
||||
$question = '<strong>Path to the cron-service configuration-file.</strong> This file will be updated regularly and automatically by froxlor.<br />Note: please <b>be sure</b> to use the same filename as for the main froxlor cronjob (default: /etc/cron.d/froxlor)!<br />';
|
||||
$question.= '<input type="text" class="text" name="crondfile" value="/etc/cron.d/froxlor" /><br />';
|
||||
$question .= '<input type="text" class="text" name="crondfile" value="/etc/cron.d/froxlor" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
@@ -646,7 +590,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
$has_preconfig = true;
|
||||
$description = 'In order for the new cron.d file to work properly, we need to know about the cron-service reload command.<br /><br />';
|
||||
$question = '<strong>Please specify the reload-command of your cron-daemon</strong> (default: /etc/init.d/cron reload)<br />';
|
||||
$question.= '<input type="text" class="text" name="crondreload" value="/etc/init.d/cron reload" /><br />';
|
||||
$question .= '<input type="text" class="text" name="crondreload" value="/etc/init.d/cron reload" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
@@ -654,17 +598,17 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
$has_preconfig = true;
|
||||
$description = 'To customize the command which executes the cronjob (php - basically) change the path below according to your system.<br /><br />';
|
||||
$question = '<strong>Please specify the command to execute cronscripts</strong> (default: "/usr/bin/nice -n 5 /usr/bin/php5 -q")<br />';
|
||||
$question.= '<input type="text" class="text" name="croncmdline" value="/usr/bin/nice -n 5 /usr/bin/php5 -q" /><br />';
|
||||
$question .= '<input type="text" class="text" name="croncmdline" value="/usr/bin/nice -n 5 /usr/bin/php5 -q" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.33-dev1')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can enable/disable the display/usage of the custom newsfeed for customers.<br /><br />';
|
||||
$description = 'You can enable/disable the display/usage of the custom newsfeed for customers.<br /><br />';
|
||||
$question = '<strong>Do you want to enable the custom newsfeed for customer? (default: no):</strong> ';
|
||||
$question.= makeyesno('customer_show_news_feed', '1', '0', '0').'<br />';
|
||||
$question.= '<strong>You have to set the URL for your RSS-feed here, if you have choosen to enable the custom newsfeed on the customer-dashboard:</strong> ';
|
||||
$question.= '<input type="text" class="text" name="customer_news_feed_url" value="" /><br />';
|
||||
$question .= makeyesno('customer_show_news_feed', '1', '0', '0') . '<br />';
|
||||
$question .= '<strong>You have to set the URL for your RSS-feed here, if you have chosen to enable the custom newsfeed on the customer-dashboard:</strong> ';
|
||||
$question .= '<input type="text" class="text" name="customer_news_feed_url" value="" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
@@ -672,18 +616,97 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
|
||||
// only if bind is used - if not the default will be set, which is '0' (off)
|
||||
if (Settings::get('system.bind_enable') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can enable/disable the generation of the bind-zone / config for the system hostname.<br /><br />';
|
||||
$description = 'You can enable/disable the generation of the bind-zone / config for the system hostname.<br /><br />';
|
||||
$question = '<strong>Do you want to generate a bind-zone for the system-hostname? (default: no):</strong> ';
|
||||
$question.= makeyesno('dns_createhostnameentry', '1', '0', '0').'<br />';
|
||||
$question .= makeyesno('dns_createhostnameentry', '1', '0', '0') . '<br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.33-rc2')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can chose whether you want to receive an e-mail on cronjob errors. Keep in mind that this can lead to an e-mail being sent every 5 minutes.<br /><br />';
|
||||
$description = 'You can chose whether you want to receive an e-mail on cronjob errors. Keep in mind that this can lead to an e-mail being sent every 5 minutes.<br /><br />';
|
||||
$question = '<strong>Do you want to receive cron-errors via mail? (default: no):</strong> ';
|
||||
$question.= makeyesno('system_send_cron_errors', '1', '0', '0').'<br />';
|
||||
$question .= makeyesno('system_send_cron_errors', '1', '0', '0') . '<br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.34-dev3')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor now requires the PHP mbstring-extension as we need to be multibyte-character safe in some cases';
|
||||
$question = '<strong>PHP mbstring</strong> is currently: ';
|
||||
if (! extension_loaded('mbstring')) {
|
||||
$question .= '<span class="red">not installed/loaded</span>';
|
||||
$question .= '<br>Please install the PHP mbstring extension in order to finish the update';
|
||||
} else {
|
||||
$question .= '<span class="green">installed/loaded</span>';
|
||||
}
|
||||
$question .= '<br>';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_db_version, '201603070')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can chose whether you want to enable or disable our Let\'s Encrypt implementation.<br />Please remember that you need to go through the webserver-configuration when enabled because this feature needs a special configuration.<br /><br />';
|
||||
$question = '<strong>Do you want to enable Let\'s Encrypt? (default: yes):</strong> ';
|
||||
$question .= makeyesno('enable_letsencrypt', '1', '0', '1') . '<br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_db_version, '201604270')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can chose whether you want to enable or disable our backup function.<br /><br />';
|
||||
$question = '<strong>Do you want to enable Backup? (default: no):</strong> ';
|
||||
$question .= makeyesno('enable_backup', '1', '0', '0') . '<br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_db_version, '201605090')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can chose whether you want to enable or disable our DNS editor<br /><br />';
|
||||
$question = '<strong>Do you want to enable the DNS editor? (default: no):</strong> ';
|
||||
$question .= makeyesno('enable_dns', '1', '0', '0') . '<br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_db_version, '201605170')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor now supports the dns-daemon Power-DNS, you can chose between bind and powerdns now.';
|
||||
$question = '<strong>Select dns-daemon you want to use:</strong> ';
|
||||
$question .= '<select name="new_dns_daemon">';
|
||||
$dnsdaemons = makeoption('Bind9', 'bind', 'bind');
|
||||
$dnsdaemons .= makeoption('PowerDNS', 'pdns', 'bind');
|
||||
$question .= $dnsdaemons . '</select>';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_db_version, '201609120')) {
|
||||
if (Settings::Get('system.leenabled') == 1) {
|
||||
$has_preconfig = true;
|
||||
$description = 'You can now customize the path to your acme.conf file (global alias for Let\'s Encrypt). If you already set up Let\'s Encrypt and the acme.conf file, please set this to the complete path to the file!<br /><br />';
|
||||
$question = '<strong>Path to the acme.conf alias-file.</strong><br />';
|
||||
$question .= '<input type="text" class="text" name="acmeconffile" value="/etc/apache2/conf-enabled/acme.conf" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_db_version, '201609200')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'Specify SMTP settings which froxlor should use to send mail (optional)<br /><br />';
|
||||
$question = '<strong>Enable sending mails via SMTP?</strong><br />';
|
||||
$question .= makeyesno('smtp_enable', '1', '0', '0') . '<br />';
|
||||
$question .= '<strong>Enable sending mails via SMTP?</strong><br />';
|
||||
$question .= '<input type="text" class="text" name="smtp_host" value="localhost" /><br />';
|
||||
$question .= '<strong>TCP port to connect to?</strong><br />';
|
||||
$question .= '<input type="text" class="text" name="smtp_port" value="25" /><br />';
|
||||
$question .= '<strong>Enable TLS encryption?</strong><br />';
|
||||
$question .= makeyesno('smtp_usetls', '1', '0', '1') . '<br />';
|
||||
$question .= '<strong>Enable SMTP authentication?</strong><br />';
|
||||
$question .= makeyesno('smtp_auth', '1', '0', '1') . '<br />';
|
||||
$question .= '<strong>SMTP user?</strong><br />';
|
||||
$question .= '<input type="text" class="text" name="smtp_user" value="" /><br />';
|
||||
$question .= '<strong>SMTP password?</strong><br />';
|
||||
$question .= '<input type="password" class="text" name="smtp_passwd" value="" /><br />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +59,12 @@ if (isFroxlor()) {
|
||||
|
||||
$integrity = new IntegrityCheck();
|
||||
if (!$integrity->checkAll()) {
|
||||
lastStepStatus(2, 'Monkeys ate the integrity');
|
||||
lastStepStatus(1, 'Monkeys ate the integrity');
|
||||
showUpdateStep("Trying to remove monkeys, feeding bananas");
|
||||
if(!$integrity->fixAll()) {
|
||||
lastStepStatus(2, 'Some monkeys just would not move');
|
||||
lastStepStatus(2, 'Some monkeys just would not move, you should contact team@froxlor.org');
|
||||
} else {
|
||||
lastStepStatus(0);
|
||||
lastStepStatus(0, 'Integrity restored');
|
||||
}
|
||||
} else {
|
||||
lastStepStatus(0);
|
||||
|
||||
0
js/jquery-ui.min.js
vendored
Executable file → Normal file
0
js/jquery-ui.min.js
vendored
Executable file → Normal file
1
lib/.gitignore
vendored
1
lib/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
userdata.inc.php
|
||||
@@ -40,7 +40,7 @@ if ($action == "newsfeed") {
|
||||
if (isset($_GET['role']) && $_GET['role'] == "customer") {
|
||||
$feed = Settings::Get("customer.news_feed_url");
|
||||
} else {
|
||||
$feed = "http://inside.froxlor.org/news/";
|
||||
$feed = "https://inside.froxlor.org/news/";
|
||||
}
|
||||
|
||||
if (function_exists("simplexml_load_file") == false) {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Smarty-3.1.21/libs/
|
||||
@@ -1,165 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -1,574 +0,0 @@
|
||||
Smarty 3.1.21
|
||||
|
||||
Author: Monte Ohrt <monte at ohrt dot com >
|
||||
Author: Uwe Tews
|
||||
|
||||
AN INTRODUCTION TO SMARTY 3
|
||||
|
||||
NOTICE FOR 3.1 release:
|
||||
|
||||
Please see the SMARTY_3.1_NOTES.txt file that comes with the distribution.
|
||||
|
||||
NOTICE for 3.0.5 release:
|
||||
|
||||
Smarty now follows the PHP error_reporting level by default. If PHP does not mask E_NOTICE and you try to access an unset template variable, you will now get an E_NOTICE warning. To revert to the old behavior:
|
||||
|
||||
$smarty->error_reporting = E_ALL & ~E_NOTICE;
|
||||
|
||||
NOTICE for 3.0 release:
|
||||
|
||||
IMPORTANT: Some API adjustments have been made between the RC4 and 3.0 release.
|
||||
We felt it is better to make these now instead of after a 3.0 release, then have to
|
||||
immediately deprecate APIs in 3.1. Online documentation has been updated
|
||||
to reflect these changes. Specifically:
|
||||
|
||||
---- API CHANGES RC4 -> 3.0 ----
|
||||
|
||||
$smarty->register->*
|
||||
$smarty->unregister->*
|
||||
$smarty->utility->*
|
||||
$samrty->cache->*
|
||||
|
||||
Have all been changed to local method calls such as:
|
||||
|
||||
$smarty->clearAllCache()
|
||||
$smarty->registerFoo()
|
||||
$smarty->unregisterFoo()
|
||||
$smarty->testInstall()
|
||||
etc.
|
||||
|
||||
Registration of function, block, compiler, and modifier plugins have been
|
||||
consolidated under two API calls:
|
||||
|
||||
$smarty->registerPlugin(...)
|
||||
$smarty->unregisterPlugin(...)
|
||||
|
||||
Registration of pre, post, output and variable filters have been
|
||||
consolidated under two API calls:
|
||||
|
||||
$smarty->registerFilter(...)
|
||||
$smarty->unregisterFilter(...)
|
||||
|
||||
Please refer to the online documentation for all specific changes:
|
||||
|
||||
http://www.smarty.net/documentation
|
||||
|
||||
----
|
||||
|
||||
The Smarty 3 API has been refactored to a syntax geared
|
||||
for consistency and modularity. The Smarty 2 API syntax is still supported, but
|
||||
will throw a deprecation notice. You can disable the notices, but it is highly
|
||||
recommended to adjust your syntax to Smarty 3, as the Smarty 2 syntax must run
|
||||
through an extra rerouting wrapper.
|
||||
|
||||
Basically, all Smarty methods now follow the "fooBarBaz" camel case syntax. Also,
|
||||
all Smarty properties now have getters and setters. So for example, the property
|
||||
$smarty->cache_dir can be set with $smarty->setCacheDir('foo/') and can be
|
||||
retrieved with $smarty->getCacheDir().
|
||||
|
||||
Some of the Smarty 3 APIs have been revoked such as the "is*" methods that were
|
||||
just duplicate functions of the now available "get*" methods.
|
||||
|
||||
Here is a rundown of the Smarty 3 API:
|
||||
|
||||
$smarty->fetch($template, $cache_id = null, $compile_id = null, $parent = null)
|
||||
$smarty->display($template, $cache_id = null, $compile_id = null, $parent = null)
|
||||
$smarty->isCached($template, $cache_id = null, $compile_id = null)
|
||||
$smarty->createData($parent = null)
|
||||
$smarty->createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
|
||||
$smarty->enableSecurity()
|
||||
$smarty->disableSecurity()
|
||||
$smarty->setTemplateDir($template_dir)
|
||||
$smarty->addTemplateDir($template_dir)
|
||||
$smarty->templateExists($resource_name)
|
||||
$smarty->loadPlugin($plugin_name, $check = true)
|
||||
$smarty->loadFilter($type, $name)
|
||||
$smarty->setExceptionHandler($handler)
|
||||
$smarty->addPluginsDir($plugins_dir)
|
||||
$smarty->getGlobal($varname = null)
|
||||
$smarty->getRegisteredObject($name)
|
||||
$smarty->getDebugTemplate()
|
||||
$smarty->setDebugTemplate($tpl_name)
|
||||
$smarty->assign($tpl_var, $value = null, $nocache = false)
|
||||
$smarty->assignGlobal($varname, $value = null, $nocache = false)
|
||||
$smarty->assignByRef($tpl_var, &$value, $nocache = false)
|
||||
$smarty->append($tpl_var, $value = null, $merge = false, $nocache = false)
|
||||
$smarty->appendByRef($tpl_var, &$value, $merge = false)
|
||||
$smarty->clearAssign($tpl_var)
|
||||
$smarty->clearAllAssign()
|
||||
$smarty->configLoad($config_file, $sections = null)
|
||||
$smarty->getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
|
||||
$smarty->getConfigVariable($variable)
|
||||
$smarty->getStreamVariable($variable)
|
||||
$smarty->getConfigVars($varname = null)
|
||||
$smarty->clearConfig($varname = null)
|
||||
$smarty->getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
|
||||
$smarty->clearAllCache($exp_time = null, $type = null)
|
||||
$smarty->clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
|
||||
|
||||
$smarty->registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = array())
|
||||
|
||||
$smarty->registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
|
||||
|
||||
$smarty->registerFilter($type, $function_name)
|
||||
$smarty->registerResource($resource_type, $function_names)
|
||||
$smarty->registerDefaultPluginHandler($function_name)
|
||||
$smarty->registerDefaultTemplateHandler($function_name)
|
||||
|
||||
$smarty->unregisterPlugin($type, $tag)
|
||||
$smarty->unregisterObject($object_name)
|
||||
$smarty->unregisterFilter($type, $function_name)
|
||||
$smarty->unregisterResource($resource_type)
|
||||
|
||||
$smarty->compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
|
||||
$smarty->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
|
||||
$smarty->testInstall()
|
||||
|
||||
// then all the getters/setters, available for all properties. Here are a few:
|
||||
|
||||
$caching = $smarty->getCaching(); // get $smarty->caching
|
||||
$smarty->setCaching(true); // set $smarty->caching
|
||||
$smarty->setDeprecationNotices(false); // set $smarty->deprecation_notices
|
||||
$smarty->setCacheId($id); // set $smarty->cache_id
|
||||
$debugging = $smarty->getDebugging(); // get $smarty->debugging
|
||||
|
||||
|
||||
FILE STRUCTURE
|
||||
|
||||
The Smarty 3 file structure is similar to Smarty 2:
|
||||
|
||||
/libs/
|
||||
Smarty.class.php
|
||||
/libs/sysplugins/
|
||||
internal.*
|
||||
/libs/plugins/
|
||||
function.mailto.php
|
||||
modifier.escape.php
|
||||
...
|
||||
|
||||
A lot of Smarty 3 core functionality lies in the sysplugins directory; you do
|
||||
not need to change any files here. The /libs/plugins/ folder is where Smarty
|
||||
plugins are located. You can add your own here, or create a separate plugin
|
||||
directory, just the same as Smarty 2. You will still need to create your own
|
||||
/cache/, /templates/, /templates_c/, /configs/ folders. Be sure /cache/ and
|
||||
/templates_c/ are writable.
|
||||
|
||||
The typical way to use Smarty 3 should also look familiar:
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('foo','bar');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
|
||||
However, Smarty 3 works completely different on the inside. Smarty 3 is mostly
|
||||
backward compatible with Smarty 2, except for the following items:
|
||||
|
||||
*) Smarty 3 is PHP 5 only. It will not work with PHP 4.
|
||||
*) The {php} tag is disabled by default. Enable with $smarty->allow_php_tag=true.
|
||||
*) Delimiters surrounded by whitespace are no longer treated as Smarty tags.
|
||||
Therefore, { foo } will not compile as a tag, you must use {foo}. This change
|
||||
Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
|
||||
This can be disabled by setting $smarty->auto_literal = false;
|
||||
*) The Smarty 3 API is a bit different. Many Smarty 2 API calls are deprecated
|
||||
but still work. You will want to update your calls to Smarty 3 for maximum
|
||||
efficiency.
|
||||
|
||||
|
||||
There are many things that are new to Smarty 3. Here are the notable items:
|
||||
|
||||
LEXER/PARSER
|
||||
============
|
||||
|
||||
Smarty 3 now uses a lexing tokenizer for its parser/compiler. Basically, this
|
||||
means Smarty has some syntax additions that make life easier such as in-template
|
||||
math, shorter/intuitive function parameter options, infinite function recursion,
|
||||
more accurate error handling, etc.
|
||||
|
||||
|
||||
WHAT IS NEW IN SMARTY TEMPLATE SYNTAX
|
||||
=====================================
|
||||
|
||||
Smarty 3 allows expressions almost anywhere. Expressions can include PHP
|
||||
functions as long as they are not disabled by the security policy, object
|
||||
methods and properties, etc. The {math} plugin is no longer necessary but
|
||||
is still supported for BC.
|
||||
|
||||
Examples:
|
||||
{$x+$y} will output the sum of x and y.
|
||||
{$foo = strlen($bar)} function in assignment
|
||||
{assign var=foo value= $x+$y} in attributes
|
||||
{$foo = myfunct( ($x+$y)*3 )} as function parameter
|
||||
{$foo[$x+3]} as array index
|
||||
|
||||
Smarty tags can be used as values within other tags.
|
||||
Example: {$foo={counter}+3}
|
||||
|
||||
Smarty tags can also be used inside double quoted strings.
|
||||
Example: {$foo="this is message {counter}"}
|
||||
|
||||
You can define arrays within templates.
|
||||
Examples:
|
||||
{assign var=foo value=[1,2,3]}
|
||||
{assign var=foo value=['y'=>'yellow','b'=>'blue']}
|
||||
Arrays can be nested.
|
||||
{assign var=foo value=[1,[9,8],3]}
|
||||
|
||||
There is a new short syntax supported for assigning variables.
|
||||
Example: {$foo=$bar+2}
|
||||
|
||||
You can assign a value to a specific array element. If the variable exists but
|
||||
is not an array, it is converted to an array before the new values are assigned.
|
||||
Examples:
|
||||
{$foo['bar']=1}
|
||||
{$foo['bar']['blar']=1}
|
||||
|
||||
You can append values to an array. If the variable exists but is not an array,
|
||||
it is converted to an array before the new values are assigned.
|
||||
Example: {$foo[]=1}
|
||||
|
||||
You can use a PHP-like syntax for accessing array elements, as well as the
|
||||
original "dot" notation.
|
||||
Examples:
|
||||
{$foo[1]} normal access
|
||||
{$foo['bar']}
|
||||
{$foo['bar'][1]}
|
||||
{$foo[$x+$x]} index may contain any expression
|
||||
{$foo[$bar[1]]} nested index
|
||||
{$foo[section_name]} smarty section access, not array access!
|
||||
|
||||
The original "dot" notation stays, and with improvements.
|
||||
Examples:
|
||||
{$foo.a.b.c} => $foo['a']['b']['c']
|
||||
{$foo.a.$b.c} => $foo['a'][$b]['c'] with variable index
|
||||
{$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c'] with expression as index
|
||||
{$foo.a.{$b.c}} => $foo['a'][$b['c']] with nested index
|
||||
|
||||
note that { and } are used to address ambiguties when nesting the dot syntax.
|
||||
|
||||
Variable names themselves can be variable and contain expressions.
|
||||
Examples:
|
||||
$foo normal variable
|
||||
$foo_{$bar} variable name containing other variable
|
||||
$foo_{$x+$y} variable name containing expressions
|
||||
$foo_{$bar}_buh_{$blar} variable name with multiple segments
|
||||
{$foo_{$x}} will output the variable $foo_1 if $x has a value of 1.
|
||||
|
||||
Object method chaining is implemented.
|
||||
Example: {$object->method1($x)->method2($y)}
|
||||
|
||||
{for} tag added for looping (replacement for {section} tag):
|
||||
{for $x=0, $y=count($foo); $x<$y; $x++} .... {/for}
|
||||
Any number of statements can be used separated by comma as the first
|
||||
inital expression at {for}.
|
||||
|
||||
{for $x = $start to $end step $step} ... {/for}is in the SVN now .
|
||||
You can use also
|
||||
{for $x = $start to $end} ... {/for}
|
||||
In this case the step value will be automaticall 1 or -1 depending on the start and end values.
|
||||
Instead of $start and $end you can use any valid expression.
|
||||
Inside the loop the following special vars can be accessed:
|
||||
$x@iteration = number of iteration
|
||||
$x@total = total number of iterations
|
||||
$x@first = true on first iteration
|
||||
$x@last = true on last iteration
|
||||
|
||||
|
||||
The Smarty 2 {section} syntax is still supported.
|
||||
|
||||
New shorter {foreach} syntax to loop over an array.
|
||||
Example: {foreach $myarray as $var}...{/foreach}
|
||||
|
||||
Within the foreach loop, properties are access via:
|
||||
|
||||
$var@key foreach $var array key
|
||||
$var@iteration foreach current iteration count (1,2,3...)
|
||||
$var@index foreach current index count (0,1,2...)
|
||||
$var@total foreach $var array total
|
||||
$var@first true on first iteration
|
||||
$var@last true on last iteration
|
||||
|
||||
The Smarty 2 {foreach} tag syntax is still supported.
|
||||
|
||||
NOTE: {$bar[foo]} still indicates a variable inside of a {section} named foo.
|
||||
If you want to access an array element with index foo, you must use quotes
|
||||
such as {$bar['foo']}, or use the dot syntax {$bar.foo}.
|
||||
|
||||
while block tag is now implemented:
|
||||
{while $foo}...{/while}
|
||||
{while $x lt 10}...{/while}
|
||||
|
||||
Direct access to PHP functions:
|
||||
Just as you can use PHP functions as modifiers directly, you can now access
|
||||
PHP functions directly, provided they are permitted by security settings:
|
||||
{time()}
|
||||
|
||||
There is a new {function}...{/function} block tag to implement a template function.
|
||||
This enables reuse of code sequences like a plugin function. It can call itself recursively.
|
||||
Template function must be called with the new {call name=foo...} tag.
|
||||
|
||||
Example:
|
||||
|
||||
Template file:
|
||||
{function name=menu level=0}
|
||||
<ul class="level{$level}">
|
||||
{foreach $data as $entry}
|
||||
{if is_array($entry)}
|
||||
<li>{$entry@key}</li>
|
||||
{call name=menu data=$entry level=$level+1}
|
||||
{else}
|
||||
<li>{$entry}</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/function}
|
||||
|
||||
{$menu = ['item1','item2','item3' => ['item3-1','item3-2','item3-3' =>
|
||||
['item3-3-1','item3-3-2']],'item4']}
|
||||
|
||||
{call name=menu data=$menu}
|
||||
|
||||
|
||||
Generated output:
|
||||
* item1
|
||||
* item2
|
||||
* item3
|
||||
o item3-1
|
||||
o item3-2
|
||||
o item3-3
|
||||
+ item3-3-1
|
||||
+ item3-3-2
|
||||
* item4
|
||||
|
||||
The function tag itself must have the "name" attribute. This name is the tag
|
||||
name when calling the function. The function tag may have any number of
|
||||
additional attributes. These will be default settings for local variables.
|
||||
|
||||
New {nocache} block function:
|
||||
{nocache}...{/nocache} will declare a section of the template to be non-cached
|
||||
when template caching is enabled.
|
||||
|
||||
New nocache attribute:
|
||||
You can declare variable/function output as non-cached with the nocache attribute.
|
||||
Examples:
|
||||
|
||||
{$foo nocache=true}
|
||||
{$foo nocache} /* same */
|
||||
|
||||
{foo bar="baz" nocache=true}
|
||||
{foo bar="baz" nocache} /* same */
|
||||
|
||||
{time() nocache=true}
|
||||
{time() nocache} /* same */
|
||||
|
||||
Or you can also assign the variable in your script as nocache:
|
||||
$smarty->assign('foo',$something,true); // third param is nocache setting
|
||||
{$foo} /* non-cached */
|
||||
|
||||
$smarty.current_dir returns the directory name of the current template.
|
||||
|
||||
You can use strings directly as templates with the "string" resource type.
|
||||
Examples:
|
||||
$smarty->display('string:This is my template, {$foo}!'); // php
|
||||
{include file="string:This is my template, {$foo}!"} // template
|
||||
|
||||
|
||||
|
||||
VARIABLE SCOPE / VARIABLE STORAGE
|
||||
=================================
|
||||
|
||||
In Smarty 2, all assigned variables were stored within the Smarty object.
|
||||
Therefore, all variables assigned in PHP were accessible by all subsequent
|
||||
fetch and display template calls.
|
||||
|
||||
In Smarty 3, we have the choice to assign variables to the main Smarty object,
|
||||
to user-created data objects, and to user-created template objects.
|
||||
These objects can be chained. The object at the end of a chain can access all
|
||||
variables belonging to that template and all variables within the parent objects.
|
||||
The Smarty object can only be the root of a chain, but a chain can be isolated
|
||||
from the Smarty object.
|
||||
|
||||
All known Smarty assignment interfaces will work on the data and template objects.
|
||||
|
||||
Besides the above mentioned objects, there is also a special storage area for
|
||||
global variables.
|
||||
|
||||
A Smarty data object can be created as follows:
|
||||
$data = $smarty->createData(); // create root data object
|
||||
$data->assign('foo','bar'); // assign variables as usual
|
||||
$data->config_load('my.conf'); // load config file
|
||||
|
||||
$data= $smarty->createData($smarty); // create data object having a parent link to
|
||||
the Smarty object
|
||||
|
||||
$data2= $smarty->createData($data); // create data object having a parent link to
|
||||
the $data data object
|
||||
|
||||
A template object can be created by using the createTemplate method. It has the
|
||||
same parameter assignments as the fetch() or display() method.
|
||||
Function definition:
|
||||
function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
|
||||
|
||||
The first parameter can be a template name, a smarty object or a data object.
|
||||
|
||||
Examples:
|
||||
$tpl = $smarty->createTemplate('mytpl.tpl'); // create template object not linked to any parent
|
||||
$tpl->assign('foo','bar'); // directly assign variables
|
||||
$tpl->config_load('my.conf'); // load config file
|
||||
|
||||
$tpl = $smarty->createTemplate('mytpl.tpl',$smarty); // create template having a parent link to the Smarty object
|
||||
$tpl = $smarty->createTemplate('mytpl.tpl',$data); // create template having a parent link to the $data object
|
||||
|
||||
The standard fetch() and display() methods will implicitly create a template object.
|
||||
If the $parent parameter is not specified in these method calls, the template object
|
||||
is will link back to the Smarty object as it's parent.
|
||||
|
||||
If a template is called by an {include...} tag from another template, the
|
||||
subtemplate links back to the calling template as it's parent.
|
||||
|
||||
All variables assigned locally or from a parent template are accessible. If the
|
||||
template creates or modifies a variable by using the {assign var=foo...} or
|
||||
{$foo=...} tags, these new values are only known locally (local scope). When the
|
||||
template exits, none of the new variables or modifications can be seen in the
|
||||
parent template(s). This is same behavior as in Smarty 2.
|
||||
|
||||
With Smarty 3, we can assign variables with a scope attribute which allows the
|
||||
availablility of these new variables or modifications globally (ie in the parent
|
||||
templates.)
|
||||
|
||||
Possible scopes are local, parent, root and global.
|
||||
Examples:
|
||||
{assign var=foo value='bar'} // no scope is specified, the default 'local'
|
||||
{$foo='bar'} // same, local scope
|
||||
{assign var=foo value='bar' scope='local'} // same, local scope
|
||||
|
||||
{assign var=foo value='bar' scope='parent'} // Values will be available to the parent object
|
||||
{$foo='bar' scope='parent'} // (normally the calling template)
|
||||
|
||||
{assign var=foo value='bar' scope='root'} // Values will be exported up to the root object, so they can
|
||||
{$foo='bar' scope='root'} // be seen from all templates using the same root.
|
||||
|
||||
{assign var=foo value='bar' scope='global'} // Values will be exported to global variable storage,
|
||||
{$foo='bar' scope='global'} // they are available to any and all templates.
|
||||
|
||||
|
||||
The scope attribute can also be attached to the {include...} tag. In this case,
|
||||
the specified scope will be the default scope for all assignments within the
|
||||
included template.
|
||||
|
||||
|
||||
PLUGINS
|
||||
=======
|
||||
|
||||
Smarty3 are following the same coding rules as in Smarty2.
|
||||
The only difference is that the template object is passed as additional third parameter.
|
||||
|
||||
smarty_plugintype_name (array $params, object $smarty, object $template)
|
||||
|
||||
The Smarty 2 plugins are still compatible as long as they do not make use of specific Smarty2 internals.
|
||||
|
||||
|
||||
TEMPLATE INHERITANCE:
|
||||
=====================
|
||||
|
||||
With template inheritance you can define blocks, which are areas that can be
|
||||
overriden by child templates, so your templates could look like this:
|
||||
|
||||
parent.tpl:
|
||||
<html>
|
||||
<head>
|
||||
<title>{block name='title'}My site name{/block}</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>{block name='page-title'}Default page title{/block}</h1>
|
||||
<div id="content">
|
||||
{block name='content'}
|
||||
Default content
|
||||
{/block}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
child.tpl:
|
||||
{extends file='parent.tpl'}
|
||||
{block name='title'}
|
||||
Child title
|
||||
{/block}
|
||||
|
||||
grandchild.tpl:
|
||||
{extends file='child.tpl'}
|
||||
{block name='title'}Home - {$smarty.block.parent}{/block}
|
||||
{block name='page-title'}My home{/block}
|
||||
{block name='content'}
|
||||
{foreach $images as $img}
|
||||
<img src="{$img.url}" alt="{$img.description}" />
|
||||
{/foreach}
|
||||
{/block}
|
||||
|
||||
We redefined all the blocks here, however in the title block we used {$smarty.block.parent},
|
||||
which tells Smarty to insert the default content from the parent template in its place.
|
||||
The content block was overriden to display the image files, and page-title has also be
|
||||
overriden to display a completely different title.
|
||||
|
||||
If we render grandchild.tpl we will get this:
|
||||
<html>
|
||||
<head>
|
||||
<title>Home - Child title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>My home</h1>
|
||||
<div id="content">
|
||||
<img src="/example.jpg" alt="image" />
|
||||
<img src="/example2.jpg" alt="image" />
|
||||
<img src="/example3.jpg" alt="image" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
NOTE: In the child templates everything outside the {extends} or {block} tag sections
|
||||
is ignored.
|
||||
|
||||
The inheritance tree can be as big as you want (meaning you can extend a file that
|
||||
extends another one that extends another one and so on..), but be aware that all files
|
||||
have to be checked for modifications at runtime so the more inheritance the more overhead you add.
|
||||
|
||||
Instead of defining the parent/child relationships with the {extends} tag in the child template you
|
||||
can use the resource as follow:
|
||||
|
||||
$smarty->display('extends:parent.tpl|child.tpl|grandchild.tpl');
|
||||
|
||||
Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content
|
||||
is appended or prepended to the child block content.
|
||||
|
||||
{block name='title' append} My title {/block}
|
||||
|
||||
|
||||
PHP STREAMS:
|
||||
============
|
||||
|
||||
(see online documentation)
|
||||
|
||||
VARIBLE FILTERS:
|
||||
================
|
||||
|
||||
(see online documentation)
|
||||
|
||||
|
||||
STATIC CLASS ACCESS AND NAMESPACE SUPPORT
|
||||
=========================================
|
||||
|
||||
You can register a class with optional namespace for the use in the template like:
|
||||
|
||||
$smarty->register->templateClass('foo','name\name2\myclass');
|
||||
|
||||
In the template you can use it like this:
|
||||
{foo::method()} etc.
|
||||
|
||||
|
||||
=======================
|
||||
|
||||
Please look through it and send any questions/suggestions/etc to the forums.
|
||||
|
||||
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=14168
|
||||
|
||||
Monte and Uwe
|
||||
@@ -1,109 +0,0 @@
|
||||
= Known incompatibilities with Smarty 2 =
|
||||
|
||||
== Syntax ==
|
||||
|
||||
Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported
|
||||
by a wrapper but deprecated. See the README that comes with Smarty 3 for more
|
||||
information.
|
||||
|
||||
The {$array|@mod} syntax has always been a bit confusing, where an "@" is required
|
||||
to apply a modifier to an array instead of the individual elements. Normally you
|
||||
always want the modifier to apply to the variable regardless of its type. In Smarty 3,
|
||||
{$array|mod} and {$array|@mod} behave identical. It is safe to drop the "@" and the
|
||||
modifier will still apply to the array. If you really want the modifier to apply to
|
||||
each array element, you must loop the array in-template, or use a custom modifier that
|
||||
supports array iteration. Most smarty functions already escape values where necessary
|
||||
such as {html_options}
|
||||
|
||||
== PHP Version ==
|
||||
Smarty 3 is PHP 5 only. It will not work with PHP 4.
|
||||
|
||||
== {php} Tag ==
|
||||
The {php} tag is disabled by default. The use of {php} tags is
|
||||
deprecated. It can be enabled with $smarty->allow_php_tag=true.
|
||||
|
||||
But if you scatter PHP code which belongs together into several
|
||||
{php} tags it may not work any longer.
|
||||
|
||||
== Delimiters and whitespace ==
|
||||
Delimiters surrounded by whitespace are no longer treated as Smarty tags.
|
||||
Therefore, { foo } will not compile as a tag, you must use {foo}. This change
|
||||
Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
|
||||
This can be disabled by setting $smarty->auto_literal = false;
|
||||
|
||||
== Unquoted Strings ==
|
||||
Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings
|
||||
in parameters. Smarty3 is more restrictive. You can still pass strings without quotes
|
||||
so long as they contain no special characters. (anything outside of A-Za-z0-9_)
|
||||
|
||||
For example filename strings must be quoted
|
||||
<source lang="smarty">
|
||||
{include file='path/foo.tpl'}
|
||||
</source>
|
||||
|
||||
== Extending the Smarty class ==
|
||||
Smarty 3 makes use of the __construct method for initialization. If you are extending
|
||||
the Smarty class, its constructor is not called implicitly if the your child class defines
|
||||
its own constructor. In order to run Smarty's constructor, a call to parent::__construct()
|
||||
within your child constructor is required.
|
||||
|
||||
<source lang="php">
|
||||
class MySmarty extends Smarty {
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// your initialization code goes here
|
||||
|
||||
}
|
||||
}
|
||||
</source>
|
||||
|
||||
== Autoloader ==
|
||||
Smarty 3 does register its own autoloader with spl_autoload_register. If your code has
|
||||
an existing __autoload function then this function must be explicitly registered on
|
||||
the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php
|
||||
for further details.
|
||||
|
||||
== Plugin Filenames ==
|
||||
Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames
|
||||
to be lower case. Because of this, Smarty plugin file names must also be lowercase.
|
||||
In Smarty 2, mixed case file names did work.
|
||||
|
||||
== Scope of Special Smarty Variables ==
|
||||
In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach...
|
||||
had global scope. If you had loops with the same name in subtemplates you could accidentally
|
||||
overwrite values of parent template.
|
||||
|
||||
In Smarty 3 these special Smarty variable have only local scope in the template which
|
||||
is defining the loop. If you need their value in a subtemplate you have to pass them
|
||||
as parameter.
|
||||
<source lang="smarty">
|
||||
{include file='path/foo.tpl' index=$smarty.section.foo.index}
|
||||
</source>
|
||||
|
||||
== SMARTY_RESOURCE_CHAR_SET ==
|
||||
Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset.
|
||||
This is now used also on modifiers like escape as default charset. If your templates use
|
||||
other charsets make sure that you define the constant accordingly. Otherwise you may not
|
||||
get any output.
|
||||
|
||||
== newline at {if} tags ==
|
||||
A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source.
|
||||
If one of the {if} tags is at the line end you will now get a newline in the HTML output.
|
||||
|
||||
== trigger_error() ==
|
||||
The API function trigger_error() has been removed because it did just map to PHP trigger_error.
|
||||
However it's still included in the Smarty2 API wrapper.
|
||||
|
||||
== Smarty constants ==
|
||||
The constants
|
||||
SMARTY_PHP_PASSTHRU
|
||||
SMARTY_PHP_QUOTE
|
||||
SMARTY_PHP_REMOVE
|
||||
SMARTY_PHP_ALLOW
|
||||
have been replaced with class constants
|
||||
Smarty::PHP_PASSTHRU
|
||||
Smarty::PHP_QUOTE
|
||||
Smarty::PHP_REMOVE
|
||||
Smarty::PHP_ALLOW
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
== Smarty2 backward compatibility ==
|
||||
All Smarty2 specific API functions and deprecated functionallity has been moved
|
||||
to the SmartyBC class.
|
||||
|
||||
== {php} Tag ==
|
||||
The {php} tag is no longer available in the standard Smarty calls.
|
||||
The use of {php} tags is deprecated and only available in the SmartyBC class.
|
||||
|
||||
== {include_php} Tag ==
|
||||
The {include_php} tag is no longer available in the standard Smarty calls.
|
||||
The use of {include_php} tags is deprecated and only available in the SmartyBC class.
|
||||
|
||||
== php template resource ==
|
||||
The support of the php template resource is removed.
|
||||
|
||||
== $cache_dir, $compile_dir, $config_dir, $template_dir access ==
|
||||
The mentioned properties can't be accessed directly any longer. You must use
|
||||
corresponding getter/setters like addConfigDir(), setConfigDir(), getConfigDir()
|
||||
|
||||
== obsolete Smarty class properties ==
|
||||
The following no longer used properties are removed:
|
||||
$allow_php_tag
|
||||
$allow_php_template
|
||||
$deprecation_notices
|
||||
@@ -1,306 +0,0 @@
|
||||
Smarty 3.1 Notes
|
||||
================
|
||||
|
||||
Smarty 3.1 is a departure from 2.0 compatibility. Most notably, all
|
||||
backward compatibility has been moved to a separate class file named
|
||||
SmartyBC.class.php. If you require compatibility with 2.0, you will
|
||||
need to use this class.
|
||||
|
||||
Some differences from 3.0 are also present. 3.1 begins the journey of
|
||||
requiring setters/getters for property access. So far this is only
|
||||
implemented on the five directory properties: template_dir,
|
||||
plugins_dir, configs_dir, compile_dir and cache_dir. These properties
|
||||
are now protected, it is required to use the setters/getters instead.
|
||||
That said, direct property access will still work, however slightly
|
||||
slower since they will now fall through __set() and __get() and in
|
||||
turn passed through the setter/getter methods. 3.2 will exhibit a full
|
||||
list of setter/getter methods for all (currently) public properties,
|
||||
so code-completion in your IDE will work as expected.
|
||||
|
||||
There is absolutely no PHP allowed in templates any more. All
|
||||
deprecated features of Smarty 2.0 are gone. Again, use the SmartyBC
|
||||
class if you need any backward compatibility.
|
||||
|
||||
Internal Changes
|
||||
|
||||
Full UTF-8 Compatibility
|
||||
|
||||
The plugins shipped with Smarty 3.1 have been rewritten to fully
|
||||
support UTF-8 strings if Multibyte String is available. Without
|
||||
MBString UTF-8 cannot be handled properly. For those rare cases where
|
||||
templates themselves have to juggle encodings, the new modifiers
|
||||
to_charset and from_charset may come in handy.
|
||||
|
||||
Plugin API and Performance
|
||||
|
||||
All Plugins (modifiers, functions, blocks, resources,
|
||||
default_template_handlers, etc) are now receiving the
|
||||
Smarty_Internal_Template instance, where they were supplied with the
|
||||
Smarty instance in Smarty 3.0. *. As The Smarty_Internal_Template
|
||||
mimics the behavior of Smarty, this API simplification should not
|
||||
require any changes to custom plugins.
|
||||
|
||||
The plugins shipped with Smarty 3.1 have been rewritten for better
|
||||
performance. Most notably {html_select_date} and {html_select_time}
|
||||
have been improved vastly. Performance aside, plugins have also been
|
||||
reviewed and generalized in their API. {html_select_date} and
|
||||
{html_select_time} now share almost all available options.
|
||||
|
||||
The escape modifier now knows the $double_encode option, which will
|
||||
prevent entities from being encoded again.
|
||||
|
||||
The capitalize modifier now know the $lc_rest option, which makes sure
|
||||
all letters following a captial letter are lower-cased.
|
||||
|
||||
The count_sentences modifier now accepts (.?!) as
|
||||
legitimate endings of a sentence - previously only (.) was
|
||||
accepted
|
||||
|
||||
The new unescape modifier is there to reverse the effects of the
|
||||
escape modifier. This applies to the escape formats html, htmlall and
|
||||
entity.
|
||||
|
||||
default_template_handler_func
|
||||
|
||||
The invocation of $smarty->$default_template_handler_func had to be
|
||||
altered. Instead of a Smarty_Internal_Template, the fifth argument is
|
||||
now provided with the Smarty instance. New footprint:
|
||||
|
||||
|
||||
/**
|
||||
* Default Template Handler
|
||||
*
|
||||
* called when Smarty's file: resource is unable to load a requested file
|
||||
*
|
||||
* @param string $type resource type (e.g. "file", "string", "eval", "resource")
|
||||
* @param string $name resource name (e.g. "foo/bar.tpl")
|
||||
* @param string &$content template's content
|
||||
* @param integer &$modified template's modification time
|
||||
* @param Smarty $smarty Smarty instance
|
||||
* @return string|boolean path to file or boolean true if $content and $modified
|
||||
* have been filled, boolean false if no default template
|
||||
* could be loaded
|
||||
*/
|
||||
function default_template_handler_func($type, $name, &$content, &$modified, Smarty $smarty) {
|
||||
if (false) {
|
||||
// return corrected filepath
|
||||
return "/tmp/some/foobar.tpl";
|
||||
} elseif (false) {
|
||||
// return a template directly
|
||||
$content = "the template source";
|
||||
$modified = time();
|
||||
return true;
|
||||
} else {
|
||||
// tell smarty that we failed
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Stuff done to the compiler
|
||||
|
||||
Many performance improvements have happened internally. One notable
|
||||
improvement is that all compiled templates are now handled as PHP
|
||||
functions. This speeds up repeated templates tremendously, as each one
|
||||
calls an (in-memory) PHP function instead of performing another file
|
||||
include/scan.
|
||||
|
||||
New Features
|
||||
|
||||
Template syntax
|
||||
|
||||
{block}..{/block}
|
||||
|
||||
The {block} tag has a new hide option flag. It does suppress the block
|
||||
content if no corresponding child block exists.
|
||||
EXAMPLE:
|
||||
parent.tpl
|
||||
{block name=body hide} child content "{$smarty.block.child}" was
|
||||
inserted {block}
|
||||
In the above example the whole block will be suppressed if no child
|
||||
block "body" is existing.
|
||||
|
||||
{setfilter}..{/setfilter}
|
||||
|
||||
The new {setfilter} block tag allows the definition of filters which
|
||||
run on variable output.
|
||||
SYNTAX:
|
||||
{setfilter filter1|filter2|filter3....}
|
||||
Smarty3 will lookup up matching filters in the following search order:
|
||||
1. varibale filter plugin in plugins_dir.
|
||||
2. a valid modifier. A modifier specification will also accept
|
||||
additional parameter like filter2:'foo'
|
||||
3. a PHP function
|
||||
{/setfilter} will turn previous filter setting off again.
|
||||
{setfilter} tags can be nested.
|
||||
EXAMPLE:
|
||||
{setfilter filter1}
|
||||
{$foo}
|
||||
{setfilter filter2}
|
||||
{$bar}
|
||||
{/setfilter}
|
||||
{$buh}
|
||||
{/setfilter}
|
||||
{$blar}
|
||||
In the above example filter1 will run on the output of $foo, filter2
|
||||
on $bar, filter1 again on $buh and no filter on $blar.
|
||||
NOTES:
|
||||
- {$foo nofilter} will suppress the filters
|
||||
- These filters will run in addition to filters defined by
|
||||
registerFilter('variable',...), autoLoadFilter('variable',...) and
|
||||
defined default modifier.
|
||||
- {setfilter} will effect only the current template, not included
|
||||
subtemplates.
|
||||
|
||||
Resource API
|
||||
|
||||
Smarty 3.1 features a new approach to resource management. The
|
||||
Smarty_Resource API allows simple, yet powerful integration of custom
|
||||
resources for templates and configuration files. It offers simple
|
||||
functions for loading data from a custom resource (e.g. database) as
|
||||
well as define new template types adhering to the special
|
||||
non-compiling (e,g, plain php) and non-compile-caching (e.g. eval:
|
||||
resource type) resources.
|
||||
|
||||
See demo/plugins/resource.mysql.php for an example custom database
|
||||
resource.
|
||||
|
||||
Note that old-fashioned registration of callbacks for resource
|
||||
management has been deprecated but is still possible with SmartyBC.
|
||||
|
||||
CacheResource API
|
||||
|
||||
In line with the Resource API, the CacheResource API offers a more
|
||||
comfortable handling of output-cache data. With the
|
||||
Smarty_CacheResource_Custom accessing databases is made simple. With
|
||||
the introduction of Smarty_CacheResource_KeyValueStore the
|
||||
implementation of resources like memcache or APC became a no-brainer;
|
||||
simple hash-based storage systems are now supporting hierarchical
|
||||
output-caches.
|
||||
|
||||
See demo/plugins/cacheresource.mysql.php for an example custom
|
||||
database CacheResource.
|
||||
See demo/plugins/cacheresource.memcache.php for an example custom
|
||||
memcache CacheResource using the KeyValueStore helper.
|
||||
|
||||
Note that old-fashioned registration of $cache_handler is not possible
|
||||
anymore. As the functionality had not been ported to Smarty 3.0.x
|
||||
properly, it has been dropped from 3.1 completely.
|
||||
|
||||
Locking facilities have been implemented to avoid concurrent cache
|
||||
generation. Enable cache locking by setting
|
||||
$smarty->cache_locking = true;
|
||||
|
||||
Relative Paths in Templates (File-Resource)
|
||||
|
||||
As of Smarty 3.1 {include file="../foo.tpl"} and {include
|
||||
file="./foo.tpl"} will resolve relative to the template they're in.
|
||||
Relative paths are available with {include file="..."} and
|
||||
{extends file="..."}. As $smarty->fetch('../foo.tpl') and
|
||||
$smarty->fetch('./foo.tpl') cannot be relative to a template, an
|
||||
exception is thrown.
|
||||
|
||||
Addressing a specific $template_dir
|
||||
|
||||
Smarty 3.1 introduces the $template_dir index notation.
|
||||
$smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"}
|
||||
require the template bar.tpl to be loaded from $template_dir['foo'];
|
||||
Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to
|
||||
define indexes along with the actual directories.
|
||||
|
||||
Mixing Resources in extends-Resource
|
||||
|
||||
Taking the php extends: template resource one step further, it is now
|
||||
possible to mix resources within an extends: call like
|
||||
$smarty->fetch("extends:file:foo.tpl|db:bar.tpl");
|
||||
|
||||
To make eval: and string: resources available to the inheritance
|
||||
chain, eval:base64:TPL_STRING and eval:urlencode:TPL_STRING have been
|
||||
introduced. Supplying the base64 or urlencode flags will trigger
|
||||
decoding the TPL_STRING in with either base64_decode() or urldecode().
|
||||
|
||||
extends-Resource in template inheritance
|
||||
|
||||
Template based inheritance may now inherit from php's extends:
|
||||
resource like {extends file="extends:foo.tpl|db:bar.tpl"}.
|
||||
|
||||
New Smarty property escape_html
|
||||
|
||||
$smarty->escape_html = true will autoescape all template variable
|
||||
output by calling htmlspecialchars({$output}, ENT_QUOTES,
|
||||
SMARTY_RESOURCE_CHAR_SET).
|
||||
NOTE:
|
||||
This is a compile time option. If you change the setting you must make
|
||||
sure that the templates get recompiled.
|
||||
|
||||
New option at Smarty property compile_check
|
||||
|
||||
The automatic recompilation of modified templates can now be
|
||||
controlled by the following settings:
|
||||
$smarty->compile_check = COMPILECHECK_OFF (false) - template files
|
||||
will not be checked
|
||||
$smarty->compile_check = COMPILECHECK_ON (true) - template files will
|
||||
always be checked
|
||||
$smarty->compile_check = COMPILECHECK_CACHEMISS - template files will
|
||||
be checked if caching is enabled and there is no existing cache file
|
||||
or it has expired
|
||||
|
||||
Automatic recompilation on Smarty version change
|
||||
|
||||
Templates will now be automatically recompiled on Smarty version
|
||||
changes to avoide incompatibillities in the compiled code. Compiled
|
||||
template checked against the current setting of the SMARTY_VERSION
|
||||
constant.
|
||||
|
||||
default_config_handler_func()
|
||||
|
||||
Analogous to the default_template_handler_func()
|
||||
default_config_handler_func() has been introduced.
|
||||
|
||||
default_plugin_handler_func()
|
||||
|
||||
An optional default_plugin_handler_func() can be defined which gets called
|
||||
by the compiler on tags which can't be resolved internally or by plugins.
|
||||
The default_plugin_handler() can map tags to plugins on the fly.
|
||||
|
||||
New getters/setters
|
||||
|
||||
The following setters/getters will be part of the official
|
||||
documentation, and will be strongly recommended. Direct property
|
||||
access will still work for the foreseeable future... it will be
|
||||
transparently routed through the setters/getters, and consequently a
|
||||
bit slower.
|
||||
|
||||
array|string getTemplateDir( [string $index] )
|
||||
replaces $smarty->template_dir; and $smarty->template_dir[$index];
|
||||
Smarty setTemplateDir( array|string $path )
|
||||
replaces $smarty->template_dir = "foo"; and $smarty->template_dir =
|
||||
array("foo", "bar");
|
||||
Smarty addTemplateDir( array|string $path, [string $index])
|
||||
replaces $smarty->template_dir[] = "bar"; and
|
||||
$smarty->template_dir[$index] = "bar";
|
||||
|
||||
array|string getConfigDir( [string $index] )
|
||||
replaces $smarty->config_dir; and $smarty->config_dir[$index];
|
||||
Smarty setConfigDir( array|string $path )
|
||||
replaces $smarty->config_dir = "foo"; and $smarty->config_dir =
|
||||
array("foo", "bar");
|
||||
Smarty addConfigDir( array|string $path, [string $index])
|
||||
replaces $smarty->config_dir[] = "bar"; and
|
||||
$smarty->config_dir[$index] = "bar";
|
||||
|
||||
array getPluginsDir()
|
||||
replaces $smarty->plugins_dir;
|
||||
Smarty setPluginsDir( array|string $path )
|
||||
replaces $smarty->plugins_dir = "foo";
|
||||
Smarty addPluginsDir( array|string $path )
|
||||
replaces $smarty->plugins_dir[] = "bar";
|
||||
|
||||
string getCompileDir()
|
||||
replaces $smarty->compile_dir;
|
||||
Smarty setCompileDir( string $path )
|
||||
replaces $smarty->compile_dir = "foo";
|
||||
|
||||
string getCacheDir()
|
||||
replaces $smarty->cache_dir;
|
||||
Smarty setCacheDir( string $path )
|
||||
replaces $smarty->cache_dir;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
||||
title = Welcome to Smarty!
|
||||
cutoff_size = 40
|
||||
|
||||
[setup]
|
||||
bold = true
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Example Application
|
||||
*
|
||||
* @package Example-application
|
||||
*/
|
||||
|
||||
require '../libs/Smarty.class.php';
|
||||
|
||||
$smarty = new Smarty;
|
||||
|
||||
//$smarty->force_compile = true;
|
||||
$smarty->debugging = true;
|
||||
$smarty->caching = true;
|
||||
$smarty->cache_lifetime = 120;
|
||||
|
||||
$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
|
||||
$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
|
||||
$smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
|
||||
$smarty->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"),
|
||||
array("I", "J", "K", "L"), array("M", "N", "O", "P")));
|
||||
|
||||
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
|
||||
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
|
||||
|
||||
$smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
|
||||
$smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
|
||||
$smarty->assign("option_selected", "NE");
|
||||
|
||||
$smarty->display('index.tpl');
|
||||
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* APC CacheResource
|
||||
* CacheResource Implementation based on the KeyValueStore API to use
|
||||
* memcache as the storage resource for Smarty's output caching.
|
||||
* *
|
||||
*
|
||||
* @package CacheResource-examples
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// test if APC is present
|
||||
if (!function_exists('apc_cache_info')) {
|
||||
throw new Exception('APC Template Caching Error: APC is not installed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read values for a set of keys from cache
|
||||
*
|
||||
* @param array $keys list of keys to fetch
|
||||
*
|
||||
* @return array list of values with the given keys used as indexes
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected function read(array $keys)
|
||||
{
|
||||
$_res = array();
|
||||
$res = apc_fetch($keys);
|
||||
foreach ($res as $k => $v) {
|
||||
$_res[$k] = $v;
|
||||
}
|
||||
|
||||
return $_res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save values for a set of keys to cache
|
||||
*
|
||||
* @param array $keys list of values to save
|
||||
* @param int $expire expiration time
|
||||
*
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected function write(array $keys, $expire = null)
|
||||
{
|
||||
foreach ($keys as $k => $v) {
|
||||
apc_store($k, $v, $expire);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove values from cache
|
||||
*
|
||||
* @param array $keys list of keys to delete
|
||||
*
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected function delete(array $keys)
|
||||
{
|
||||
foreach ($keys as $k) {
|
||||
apc_delete($k);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove *all* values from cache
|
||||
*
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected function purge()
|
||||
{
|
||||
return apc_clear_cache('user');
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Memcache CacheResource
|
||||
* CacheResource Implementation based on the KeyValueStore API to use
|
||||
* memcache as the storage resource for Smarty's output caching.
|
||||
* Note that memcache has a limitation of 256 characters per cache-key.
|
||||
* To avoid complications all cache-keys are translated to a sha1 hash.
|
||||
*
|
||||
* @package CacheResource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
|
||||
{
|
||||
/**
|
||||
* memcache instance
|
||||
*
|
||||
* @var Memcache
|
||||
*/
|
||||
protected $memcache = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->memcache = new Memcache();
|
||||
$this->memcache->addServer('127.0.0.1', 11211);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read values for a set of keys from cache
|
||||
*
|
||||
* @param array $keys list of keys to fetch
|
||||
*
|
||||
* @return array list of values with the given keys used as indexes
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected function read(array $keys)
|
||||
{
|
||||
$_keys = $lookup = array();
|
||||
foreach ($keys as $k) {
|
||||
$_k = sha1($k);
|
||||
$_keys[] = $_k;
|
||||
$lookup[$_k] = $k;
|
||||
}
|
||||
$_res = array();
|
||||
$res = $this->memcache->get($_keys);
|
||||
foreach ($res as $k => $v) {
|
||||
$_res[$lookup[$k]] = $v;
|
||||
}
|
||||
|
||||
return $_res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save values for a set of keys to cache
|
||||
*
|
||||
* @param array $keys list of values to save
|
||||
* @param int $expire expiration time
|
||||
*
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected function write(array $keys, $expire = null)
|
||||
{
|
||||
foreach ($keys as $k => $v) {
|
||||
$k = sha1($k);
|
||||
$this->memcache->set($k, $v, 0, $expire);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove values from cache
|
||||
*
|
||||
* @param array $keys list of keys to delete
|
||||
*
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected function delete(array $keys)
|
||||
{
|
||||
foreach ($keys as $k) {
|
||||
$k = sha1($k);
|
||||
$this->memcache->delete($k);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove *all* values from cache
|
||||
*
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected function purge()
|
||||
{
|
||||
$this->memcache->flush();
|
||||
}
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MySQL CacheResource
|
||||
* CacheResource Implementation based on the Custom API to use
|
||||
* MySQL as the storage resource for Smarty's output caching.
|
||||
* Table definition:
|
||||
* <pre>CREATE TABLE IF NOT EXISTS `output_cache` (
|
||||
* `id` CHAR(40) NOT NULL COMMENT 'sha1 hash',
|
||||
* `name` VARCHAR(250) NOT NULL,
|
||||
* `cache_id` VARCHAR(250) NULL DEFAULT NULL,
|
||||
* `compile_id` VARCHAR(250) NULL DEFAULT NULL,
|
||||
* `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
* `content` LONGTEXT NOT NULL,
|
||||
* PRIMARY KEY (`id`),
|
||||
* INDEX(`name`),
|
||||
* INDEX(`cache_id`),
|
||||
* INDEX(`compile_id`),
|
||||
* INDEX(`modified`)
|
||||
* ) ENGINE = InnoDB;</pre>
|
||||
*
|
||||
* @package CacheResource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
protected $fetch;
|
||||
protected $fetchTimestamp;
|
||||
protected $save;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
|
||||
}
|
||||
$this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id');
|
||||
$this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id');
|
||||
$this->save = $this->db->prepare('REPLACE INTO output_cache (id, name, cache_id, compile_id, content)
|
||||
VALUES (:id, :name, :cache_id, :compile_id, :content)');
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch cached content and its modification time from data source
|
||||
*
|
||||
* @param string $id unique cache content identifier
|
||||
* @param string $name template name
|
||||
* @param string $cache_id cache id
|
||||
* @param string $compile_id compile id
|
||||
* @param string $content cached content
|
||||
* @param integer $mtime cache modification timestamp (epoch)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime)
|
||||
{
|
||||
$this->fetch->execute(array('id' => $id));
|
||||
$row = $this->fetch->fetch();
|
||||
$this->fetch->closeCursor();
|
||||
if ($row) {
|
||||
$content = $row['content'];
|
||||
$mtime = strtotime($row['modified']);
|
||||
} else {
|
||||
$content = null;
|
||||
$mtime = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch cached content's modification timestamp from data source
|
||||
*
|
||||
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content.
|
||||
*
|
||||
* @param string $id unique cache content identifier
|
||||
* @param string $name template name
|
||||
* @param string $cache_id cache id
|
||||
* @param string $compile_id compile id
|
||||
*
|
||||
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
|
||||
*/
|
||||
protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
|
||||
{
|
||||
$this->fetchTimestamp->execute(array('id' => $id));
|
||||
$mtime = strtotime($this->fetchTimestamp->fetchColumn());
|
||||
$this->fetchTimestamp->closeCursor();
|
||||
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save content to cache
|
||||
*
|
||||
* @param string $id unique cache content identifier
|
||||
* @param string $name template name
|
||||
* @param string $cache_id cache id
|
||||
* @param string $compile_id compile id
|
||||
* @param integer|null $exp_time seconds till expiration time in seconds or null
|
||||
* @param string $content content to cache
|
||||
*
|
||||
* @return boolean success
|
||||
*/
|
||||
protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content)
|
||||
{
|
||||
$this->save->execute(array(
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
'cache_id' => $cache_id,
|
||||
'compile_id' => $compile_id,
|
||||
'content' => $content,
|
||||
));
|
||||
|
||||
return !!$this->save->rowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete content from cache
|
||||
*
|
||||
* @param string $name template name
|
||||
* @param string $cache_id cache id
|
||||
* @param string $compile_id compile id
|
||||
* @param integer|null $exp_time seconds till expiration or null
|
||||
*
|
||||
* @return integer number of deleted caches
|
||||
*/
|
||||
protected function delete($name, $cache_id, $compile_id, $exp_time)
|
||||
{
|
||||
// delete the whole cache
|
||||
if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) {
|
||||
// returning the number of deleted caches would require a second query to count them
|
||||
$query = $this->db->query('TRUNCATE TABLE output_cache');
|
||||
|
||||
return - 1;
|
||||
}
|
||||
// build the filter
|
||||
$where = array();
|
||||
// equal test name
|
||||
if ($name !== null) {
|
||||
$where[] = 'name = ' . $this->db->quote($name);
|
||||
}
|
||||
// equal test compile_id
|
||||
if ($compile_id !== null) {
|
||||
$where[] = 'compile_id = ' . $this->db->quote($compile_id);
|
||||
}
|
||||
// range test expiration time
|
||||
if ($exp_time !== null) {
|
||||
$where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)';
|
||||
}
|
||||
// equal test cache_id and match sub-groups
|
||||
if ($cache_id !== null) {
|
||||
$where[] = '(cache_id = ' . $this->db->quote($cache_id)
|
||||
. ' OR cache_id LIKE ' . $this->db->quote($cache_id . '|%') . ')';
|
||||
}
|
||||
// run delete query
|
||||
$query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where));
|
||||
|
||||
return $query->rowCount();
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Extends All Resource
|
||||
* Resource Implementation modifying the extends-Resource to walk
|
||||
* through the template_dirs and inherit all templates of the same name
|
||||
*
|
||||
* @package Resource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
|
||||
{
|
||||
/**
|
||||
* populate Source Object with meta data from Resource
|
||||
*
|
||||
* @param Smarty_Template_Source $source source object
|
||||
* @param Smarty_Internal_Template $_template template object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
|
||||
{
|
||||
$uid = '';
|
||||
$sources = array();
|
||||
$exists = true;
|
||||
foreach ($_template->smarty->getTemplateDir() as $key => $directory) {
|
||||
try {
|
||||
$s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name);
|
||||
if (!$s->exists) {
|
||||
continue;
|
||||
}
|
||||
$sources[$s->uid] = $s;
|
||||
$uid .= $s->filepath;
|
||||
}
|
||||
catch (SmartyException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$sources) {
|
||||
$source->exists = false;
|
||||
$source->template = $_template;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$sources = array_reverse($sources, true);
|
||||
reset($sources);
|
||||
$s = current($sources);
|
||||
|
||||
$source->components = $sources;
|
||||
$source->filepath = $s->filepath;
|
||||
$source->uid = sha1($uid);
|
||||
$source->exists = $exists;
|
||||
if ($_template && $_template->smarty->compile_check) {
|
||||
$source->timestamp = $s->timestamp;
|
||||
}
|
||||
// need the template at getContent()
|
||||
$source->template = $_template;
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MySQL Resource
|
||||
* Resource Implementation based on the Custom API to use
|
||||
* MySQL as the storage resource for Smarty's templates and configs.
|
||||
* Table definition:
|
||||
* <pre>CREATE TABLE IF NOT EXISTS `templates` (
|
||||
* `name` varchar(100) NOT NULL,
|
||||
* `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
* `source` text,
|
||||
* PRIMARY KEY (`name`)
|
||||
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
|
||||
* Demo data:
|
||||
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>
|
||||
*
|
||||
* @package Resource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Resource_Mysql extends Smarty_Resource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
// prepared fetch() statement
|
||||
protected $fetch;
|
||||
// prepared fetchTimestamp() statement
|
||||
protected $mtime;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
|
||||
}
|
||||
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
|
||||
$this->mtime = $this->db->prepare('SELECT modified FROM templates WHERE name = :name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a template and its modification time from database
|
||||
*
|
||||
* @param string $name template name
|
||||
* @param string $source template source
|
||||
* @param integer $mtime template modification timestamp (epoch)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function fetch($name, &$source, &$mtime)
|
||||
{
|
||||
$this->fetch->execute(array('name' => $name));
|
||||
$row = $this->fetch->fetch();
|
||||
$this->fetch->closeCursor();
|
||||
if ($row) {
|
||||
$source = $row['source'];
|
||||
$mtime = strtotime($row['modified']);
|
||||
} else {
|
||||
$source = null;
|
||||
$mtime = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a template's modification time from database
|
||||
*
|
||||
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the comple template source.
|
||||
*
|
||||
* @param string $name template name
|
||||
*
|
||||
* @return integer timestamp (epoch) the template was modified
|
||||
*/
|
||||
protected function fetchTimestamp($name)
|
||||
{
|
||||
$this->mtime->execute(array('name' => $name));
|
||||
$mtime = $this->mtime->fetchColumn();
|
||||
$this->mtime->closeCursor();
|
||||
|
||||
return strtotime($mtime);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MySQL Resource
|
||||
* Resource Implementation based on the Custom API to use
|
||||
* MySQL as the storage resource for Smarty's templates and configs.
|
||||
* Note that this MySQL implementation fetches the source and timestamps in
|
||||
* a single database query, instead of two separate like resource.mysql.php does.
|
||||
* Table definition:
|
||||
* <pre>CREATE TABLE IF NOT EXISTS `templates` (
|
||||
* `name` varchar(100) NOT NULL,
|
||||
* `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
* `source` text,
|
||||
* PRIMARY KEY (`name`)
|
||||
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
|
||||
* Demo data:
|
||||
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>
|
||||
*
|
||||
* @package Resource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
// prepared fetch() statement
|
||||
protected $fetch;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
|
||||
}
|
||||
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a template and its modification time from database
|
||||
*
|
||||
* @param string $name template name
|
||||
* @param string $source template source
|
||||
* @param integer $mtime template modification timestamp (epoch)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function fetch($name, &$source, &$mtime)
|
||||
{
|
||||
$this->fetch->execute(array('name' => $name));
|
||||
$row = $this->fetch->fetch();
|
||||
$this->fetch->closeCursor();
|
||||
if ($row) {
|
||||
$source = $row['source'];
|
||||
$mtime = strtotime($row['modified']);
|
||||
} else {
|
||||
$source = null;
|
||||
$mtime = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,5 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>{$title} - {$Name}</TITLE>
|
||||
</HEAD>
|
||||
<BODY bgcolor="#ffffff">
|
||||
@@ -1,87 +0,0 @@
|
||||
{config_load file="test.conf" section="setup"}
|
||||
{include file="header.tpl" title=foo}
|
||||
|
||||
<PRE>
|
||||
|
||||
{* bold and title are read from the config file *}
|
||||
{if #bold#}<b>{/if}
|
||||
{* capitalize the first letters of each word of the title *}
|
||||
Title: {#title#|capitalize}
|
||||
{if #bold#}</b>{/if}
|
||||
|
||||
The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
|
||||
|
||||
The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
|
||||
|
||||
Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
|
||||
|
||||
The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
|
||||
|
||||
variable modifier example of {ldelim}$Name|upper{rdelim}
|
||||
|
||||
<b>{$Name|upper}</b>
|
||||
|
||||
|
||||
An example of a section loop:
|
||||
|
||||
{section name=outer
|
||||
loop=$FirstName}
|
||||
{if $smarty.section.outer.index is odd by 2}
|
||||
{$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
|
||||
{else}
|
||||
{$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
|
||||
{/if}
|
||||
{sectionelse}
|
||||
none
|
||||
{/section}
|
||||
|
||||
An example of section looped key values:
|
||||
|
||||
{section name=sec1 loop=$contacts}
|
||||
phone: {$contacts[sec1].phone}
|
||||
<br>
|
||||
|
||||
fax: {$contacts[sec1].fax}
|
||||
<br>
|
||||
|
||||
cell: {$contacts[sec1].cell}
|
||||
<br>
|
||||
{/section}
|
||||
<p>
|
||||
|
||||
testing strip tags
|
||||
{strip}
|
||||
<table border=0>
|
||||
<tr>
|
||||
<td>
|
||||
<A HREF="{$SCRIPT_NAME}">
|
||||
<font color="red">This is a test </font>
|
||||
</A>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/strip}
|
||||
|
||||
</PRE>
|
||||
|
||||
This is an example of the html_select_date function:
|
||||
|
||||
<form>
|
||||
{html_select_date start_year=1998 end_year=2010}
|
||||
</form>
|
||||
|
||||
This is an example of the html_select_time function:
|
||||
|
||||
<form>
|
||||
{html_select_time use_24_hours=false}
|
||||
</form>
|
||||
|
||||
This is an example of the html_options function:
|
||||
|
||||
<form>
|
||||
<select name=states>
|
||||
{html_options values=$option_values selected=$option_selected output=$option_output}
|
||||
</select>
|
||||
</form>
|
||||
|
||||
{include file="footer.tpl"}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,467 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Project: Smarty: the PHP compiling template engine
|
||||
* File: SmartyBC.class.php
|
||||
* SVN: $Id: $
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Smarty mailing list. Send a blank e-mail to
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link http://www.smarty.net/
|
||||
* @copyright 2008 New Digital Group, Inc.
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Uwe Tews
|
||||
* @author Rodney Rehm
|
||||
* @package Smarty
|
||||
*/
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/Smarty.class.php');
|
||||
|
||||
/**
|
||||
* Smarty Backward Compatability Wrapper Class
|
||||
*
|
||||
* @package Smarty
|
||||
*/
|
||||
class SmartyBC extends Smarty
|
||||
{
|
||||
/**
|
||||
* Smarty 2 BC
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $_version = self::SMARTY_VERSION;
|
||||
|
||||
/**
|
||||
* Initialize new SmartyBC object
|
||||
*
|
||||
* @param array $options options to set during initialization, e.g. array( 'forceCompile' => false )
|
||||
*/
|
||||
public function __construct(array $options = array())
|
||||
{
|
||||
parent::__construct($options);
|
||||
// register {php} tag
|
||||
$this->registerPlugin('block', 'php', 'smarty_php_tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* wrapper for assign_by_ref
|
||||
*
|
||||
* @param string $tpl_var the template variable name
|
||||
* @param mixed &$value the referenced value to assign
|
||||
*/
|
||||
public function assign_by_ref($tpl_var, &$value)
|
||||
{
|
||||
$this->assignByRef($tpl_var, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* wrapper for append_by_ref
|
||||
*
|
||||
* @param string $tpl_var the template variable name
|
||||
* @param mixed &$value the referenced value to append
|
||||
* @param boolean $merge flag if array elements shall be merged
|
||||
*/
|
||||
public function append_by_ref($tpl_var, &$value, $merge = false)
|
||||
{
|
||||
$this->appendByRef($tpl_var, $value, $merge);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear the given assigned template variable.
|
||||
*
|
||||
* @param string $tpl_var the template variable to clear
|
||||
*/
|
||||
public function clear_assign($tpl_var)
|
||||
{
|
||||
$this->clearAssign($tpl_var);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers custom function to be used in templates
|
||||
*
|
||||
* @param string $function the name of the template function
|
||||
* @param string $function_impl the name of the PHP function to register
|
||||
* @param bool $cacheable
|
||||
* @param mixed $cache_attrs
|
||||
*/
|
||||
public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
|
||||
{
|
||||
$this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters custom function
|
||||
*
|
||||
* @param string $function name of template function
|
||||
*/
|
||||
public function unregister_function($function)
|
||||
{
|
||||
$this->unregisterPlugin('function', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers object to be used in templates
|
||||
*
|
||||
* @param string $object name of template object
|
||||
* @param object $object_impl the referenced PHP object to register
|
||||
* @param array $allowed list of allowed methods (empty = all)
|
||||
* @param boolean $smarty_args smarty argument format, else traditional
|
||||
* @param array $block_methods list of methods that are block format
|
||||
*
|
||||
* @throws SmartyException
|
||||
* @internal param array $block_functs list of methods that are block format
|
||||
*/
|
||||
public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
|
||||
{
|
||||
settype($allowed, 'array');
|
||||
settype($smarty_args, 'boolean');
|
||||
$this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters object
|
||||
*
|
||||
* @param string $object name of template object
|
||||
*/
|
||||
public function unregister_object($object)
|
||||
{
|
||||
$this->unregisterObject($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers block function to be used in templates
|
||||
*
|
||||
* @param string $block name of template block
|
||||
* @param string $block_impl PHP function to register
|
||||
* @param bool $cacheable
|
||||
* @param mixed $cache_attrs
|
||||
*/
|
||||
public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
|
||||
{
|
||||
$this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters block function
|
||||
*
|
||||
* @param string $block name of template function
|
||||
*/
|
||||
public function unregister_block($block)
|
||||
{
|
||||
$this->unregisterPlugin('block', $block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers compiler function
|
||||
*
|
||||
* @param string $function name of template function
|
||||
* @param string $function_impl name of PHP function to register
|
||||
* @param bool $cacheable
|
||||
*/
|
||||
public function register_compiler_function($function, $function_impl, $cacheable = true)
|
||||
{
|
||||
$this->registerPlugin('compiler', $function, $function_impl, $cacheable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters compiler function
|
||||
*
|
||||
* @param string $function name of template function
|
||||
*/
|
||||
public function unregister_compiler_function($function)
|
||||
{
|
||||
$this->unregisterPlugin('compiler', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers modifier to be used in templates
|
||||
*
|
||||
* @param string $modifier name of template modifier
|
||||
* @param string $modifier_impl name of PHP function to register
|
||||
*/
|
||||
public function register_modifier($modifier, $modifier_impl)
|
||||
{
|
||||
$this->registerPlugin('modifier', $modifier, $modifier_impl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters modifier
|
||||
*
|
||||
* @param string $modifier name of template modifier
|
||||
*/
|
||||
public function unregister_modifier($modifier)
|
||||
{
|
||||
$this->unregisterPlugin('modifier', $modifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a resource to fetch a template
|
||||
*
|
||||
* @param string $type name of resource
|
||||
* @param array $functions array of functions to handle resource
|
||||
*/
|
||||
public function register_resource($type, $functions)
|
||||
{
|
||||
$this->registerResource($type, $functions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a resource
|
||||
*
|
||||
* @param string $type name of resource
|
||||
*/
|
||||
public function unregister_resource($type)
|
||||
{
|
||||
$this->unregisterResource($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a prefilter function to apply
|
||||
* to a template before compiling
|
||||
*
|
||||
* @param callable $function
|
||||
*/
|
||||
public function register_prefilter($function)
|
||||
{
|
||||
$this->registerFilter('pre', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a prefilter function
|
||||
*
|
||||
* @param callable $function
|
||||
*/
|
||||
public function unregister_prefilter($function)
|
||||
{
|
||||
$this->unregisterFilter('pre', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a postfilter function to apply
|
||||
* to a compiled template after compilation
|
||||
*
|
||||
* @param callable $function
|
||||
*/
|
||||
public function register_postfilter($function)
|
||||
{
|
||||
$this->registerFilter('post', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a postfilter function
|
||||
*
|
||||
* @param callable $function
|
||||
*/
|
||||
public function unregister_postfilter($function)
|
||||
{
|
||||
$this->unregisterFilter('post', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an output filter function to apply
|
||||
* to a template output
|
||||
*
|
||||
* @param callable $function
|
||||
*/
|
||||
public function register_outputfilter($function)
|
||||
{
|
||||
$this->registerFilter('output', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters an outputfilter function
|
||||
*
|
||||
* @param callable $function
|
||||
*/
|
||||
public function unregister_outputfilter($function)
|
||||
{
|
||||
$this->unregisterFilter('output', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* load a filter of specified type and name
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
*/
|
||||
public function load_filter($type, $name)
|
||||
{
|
||||
$this->loadFilter($type, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear cached content for the given template and cache id
|
||||
*
|
||||
* @param string $tpl_file name of template file
|
||||
* @param string $cache_id name of cache_id
|
||||
* @param string $compile_id name of compile_id
|
||||
* @param string $exp_time expiration time
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
|
||||
{
|
||||
return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear the entire contents of cache (all templates)
|
||||
*
|
||||
* @param string $exp_time expire time
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function clear_all_cache($exp_time = null)
|
||||
{
|
||||
return $this->clearCache(null, null, null, $exp_time);
|
||||
}
|
||||
|
||||
/**
|
||||
* test to see if valid cache exists for this template
|
||||
*
|
||||
* @param string $tpl_file name of template file
|
||||
* @param string $cache_id
|
||||
* @param string $compile_id
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
|
||||
{
|
||||
return $this->isCached($tpl_file, $cache_id, $compile_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear all the assigned template variables.
|
||||
*/
|
||||
public function clear_all_assign()
|
||||
{
|
||||
$this->clearAllAssign();
|
||||
}
|
||||
|
||||
/**
|
||||
* clears compiled version of specified template resource,
|
||||
* or all compiled template files if one is not specified.
|
||||
* This function is for advanced use only, not normally needed.
|
||||
*
|
||||
* @param string $tpl_file
|
||||
* @param string $compile_id
|
||||
* @param string $exp_time
|
||||
*
|
||||
* @return boolean results of {@link smarty_core_rm_auto()}
|
||||
*/
|
||||
public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
|
||||
{
|
||||
return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether requested template exists.
|
||||
*
|
||||
* @param string $tpl_file
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function template_exists($tpl_file)
|
||||
{
|
||||
return $this->templateExists($tpl_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing template variables
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_template_vars($name = null)
|
||||
{
|
||||
return $this->getTemplateVars($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing config variables
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_config_vars($name = null)
|
||||
{
|
||||
return $this->getConfigVars($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* load configuration values
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $section
|
||||
* @param string $scope
|
||||
*/
|
||||
public function config_load($file, $section = null, $scope = 'global')
|
||||
{
|
||||
$this->ConfigLoad($file, $section, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
* return a reference to a registered object
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function get_registered_object($name)
|
||||
{
|
||||
return $this->getRegisteredObject($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear configuration values
|
||||
*
|
||||
* @param string $var
|
||||
*/
|
||||
public function clear_config($var = null)
|
||||
{
|
||||
$this->clearConfig($var);
|
||||
}
|
||||
|
||||
/**
|
||||
* trigger Smarty error
|
||||
*
|
||||
* @param string $error_msg
|
||||
* @param integer $error_type
|
||||
*/
|
||||
public function trigger_error($error_msg, $error_type = E_USER_WARNING)
|
||||
{
|
||||
trigger_error("Smarty error: $error_msg", $error_type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Smarty {php}{/php} block function
|
||||
*
|
||||
* @param array $params parameter list
|
||||
* @param string $content contents of the block
|
||||
* @param object $template template object
|
||||
* @param boolean &$repeat repeat flag
|
||||
*
|
||||
* @return string content re-formatted
|
||||
*/
|
||||
function smarty_php_tag($params, $content, $template, &$repeat)
|
||||
{
|
||||
eval($content);
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
{capture name='_smarty_debug' assign=debug_output}
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>Smarty Debug Console</title>
|
||||
<style type="text/css">
|
||||
{literal}
|
||||
body, h1, h2, td, th, p {
|
||||
font-family: sans-serif;
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
margin: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
padding: 2px;
|
||||
background-color: #f0c040;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
background-color: #9B410E;
|
||||
color: white;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
padding: 2px;
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
body {
|
||||
background: black;
|
||||
}
|
||||
|
||||
p, table, div {
|
||||
background: #f0ead8;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
font-style: italic;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th, td {
|
||||
font-family: monospace;
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
td {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.odd {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.even {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.exectime {
|
||||
font-size: 0.8em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#table_assigned_vars th {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
#table_config_vars th {
|
||||
color: maroon;
|
||||
}
|
||||
|
||||
{/literal}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Smarty Debug Console
|
||||
- {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
|
||||
|
||||
{if !empty($template_data)}
|
||||
<h2>included templates & config files (load time in seconds)</h2>
|
||||
<div>
|
||||
{foreach $template_data as $template}
|
||||
<font color=brown>{$template.name}</font>
|
||||
<span class="exectime">
|
||||
(compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"}
|
||||
)
|
||||
</span>
|
||||
<br>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<h2>assigned template variables</h2>
|
||||
|
||||
<table id="table_assigned_vars">
|
||||
{foreach $assigned_vars as $vars}
|
||||
<tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
|
||||
<th>${$vars@key|escape:'html'}</th>
|
||||
<td>{$vars|debug_print_var nofilter}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
<h2>assigned config file variables (outer template scope)</h2>
|
||||
|
||||
<table id="table_config_vars">
|
||||
{foreach $config_vars as $vars}
|
||||
<tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
|
||||
<th>{$vars@key|escape:'html'}</th>
|
||||
<td>{$vars|debug_print_var nofilter}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
{/capture}
|
||||
<script type="text/javascript">
|
||||
{$id = $template_name|default:''|md5}
|
||||
_smarty_console = window.open("", "console{$id}", "width=680,height=600,resizable,scrollbars=yes");
|
||||
_smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
|
||||
_smarty_console.document.close();
|
||||
</script>
|
||||
@@ -1,110 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin to format text blocks
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsBlock
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {textformat}{/textformat} block plugin
|
||||
* Type: block function<br>
|
||||
* Name: textformat<br>
|
||||
* Purpose: format text a certain way with preset styles
|
||||
* or custom wrap/indent settings<br>
|
||||
* Params:
|
||||
* <pre>
|
||||
* - style - string (email)
|
||||
* - indent - integer (0)
|
||||
* - wrap - integer (80)
|
||||
* - wrap_char - string ("\n")
|
||||
* - indent_char - string (" ")
|
||||
* - wrap_boundary - boolean (true)
|
||||
* </pre>
|
||||
*
|
||||
* @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
|
||||
* (Smarty online manual)
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param string $content contents of the block
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
* @param boolean &$repeat repeat flag
|
||||
*
|
||||
* @return string content re-formatted
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*/
|
||||
function smarty_block_textformat($params, $content, $template, &$repeat)
|
||||
{
|
||||
if (is_null($content)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$style = null;
|
||||
$indent = 0;
|
||||
$indent_first = 0;
|
||||
$indent_char = ' ';
|
||||
$wrap = 80;
|
||||
$wrap_char = "\n";
|
||||
$wrap_cut = false;
|
||||
$assign = null;
|
||||
|
||||
foreach ($params as $_key => $_val) {
|
||||
switch ($_key) {
|
||||
case 'style':
|
||||
case 'indent_char':
|
||||
case 'wrap_char':
|
||||
case 'assign':
|
||||
$$_key = (string) $_val;
|
||||
break;
|
||||
|
||||
case 'indent':
|
||||
case 'indent_first':
|
||||
case 'wrap':
|
||||
$$_key = (int) $_val;
|
||||
break;
|
||||
|
||||
case 'wrap_cut':
|
||||
$$_key = (bool) $_val;
|
||||
break;
|
||||
|
||||
default:
|
||||
trigger_error("textformat: unknown attribute '$_key'");
|
||||
}
|
||||
}
|
||||
|
||||
if ($style == 'email') {
|
||||
$wrap = 72;
|
||||
}
|
||||
// split into paragraphs
|
||||
$_paragraphs = preg_split('![\r\n]{2}!', $content);
|
||||
|
||||
foreach ($_paragraphs as &$_paragraph) {
|
||||
if (!$_paragraph) {
|
||||
continue;
|
||||
}
|
||||
// convert mult. spaces & special chars to single space
|
||||
$_paragraph = preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER), array(' ', ''), $_paragraph);
|
||||
// indent first line
|
||||
if ($indent_first > 0) {
|
||||
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
||||
}
|
||||
// wordwrap sentences
|
||||
if (Smarty::$_MBSTRING) {
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');
|
||||
$_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
||||
} else {
|
||||
$_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
||||
}
|
||||
// indent lines
|
||||
if ($indent > 0) {
|
||||
$_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);
|
||||
}
|
||||
}
|
||||
$_output = implode($wrap_char . $wrap_char, $_paragraphs);
|
||||
|
||||
if ($assign) {
|
||||
$template->assign($assign, $_output);
|
||||
} else {
|
||||
return $_output;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {counter} function plugin
|
||||
* Type: function<br>
|
||||
* Name: counter<br>
|
||||
* Purpose: print out a counter value
|
||||
*
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @link http://www.smarty.net/manual/en/language.function.counter.php {counter}
|
||||
* (Smarty online manual)
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function smarty_function_counter($params, $template)
|
||||
{
|
||||
static $counters = array();
|
||||
|
||||
$name = (isset($params['name'])) ? $params['name'] : 'default';
|
||||
if (!isset($counters[$name])) {
|
||||
$counters[$name] = array(
|
||||
'start' => 1,
|
||||
'skip' => 1,
|
||||
'direction' => 'up',
|
||||
'count' => 1
|
||||
);
|
||||
}
|
||||
$counter =& $counters[$name];
|
||||
|
||||
if (isset($params['start'])) {
|
||||
$counter['start'] = $counter['count'] = (int) $params['start'];
|
||||
}
|
||||
|
||||
if (!empty($params['assign'])) {
|
||||
$counter['assign'] = $params['assign'];
|
||||
}
|
||||
|
||||
if (isset($counter['assign'])) {
|
||||
$template->assign($counter['assign'], $counter['count']);
|
||||
}
|
||||
|
||||
if (isset($params['print'])) {
|
||||
$print = (bool) $params['print'];
|
||||
} else {
|
||||
$print = empty($counter['assign']);
|
||||
}
|
||||
|
||||
if ($print) {
|
||||
$retval = $counter['count'];
|
||||
} else {
|
||||
$retval = null;
|
||||
}
|
||||
|
||||
if (isset($params['skip'])) {
|
||||
$counter['skip'] = $params['skip'];
|
||||
}
|
||||
|
||||
if (isset($params['direction'])) {
|
||||
$counter['direction'] = $params['direction'];
|
||||
}
|
||||
|
||||
if ($counter['direction'] == "down") {
|
||||
$counter['count'] -= $counter['skip'];
|
||||
} else {
|
||||
$counter['count'] += $counter['skip'];
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {cycle} function plugin
|
||||
* Type: function<br>
|
||||
* Name: cycle<br>
|
||||
* Date: May 3, 2002<br>
|
||||
* Purpose: cycle through given values<br>
|
||||
* Params:
|
||||
* <pre>
|
||||
* - name - name of cycle (optional)
|
||||
* - values - comma separated list of values to cycle, or an array of values to cycle
|
||||
* (this can be left out for subsequent calls)
|
||||
* - reset - boolean - resets given var to true
|
||||
* - print - boolean - print var or not. default is true
|
||||
* - advance - boolean - whether or not to advance the cycle
|
||||
* - delimiter - the value delimiter, default is ","
|
||||
* - assign - boolean, assigns to template var instead of printed.
|
||||
* </pre>
|
||||
* Examples:<br>
|
||||
* <pre>
|
||||
* {cycle values="#eeeeee,#d0d0d0d"}
|
||||
* {cycle name=row values="one,two,three" reset=true}
|
||||
* {cycle name=row}
|
||||
* </pre>
|
||||
*
|
||||
* @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credit to Mark Priatel <mpriatel@rogers.com>
|
||||
* @author credit to Gerard <gerard@interfold.com>
|
||||
* @author credit to Jason Sweat <jsweat_php@yahoo.com>
|
||||
* @version 1.3
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
|
||||
function smarty_function_cycle($params, $template)
|
||||
{
|
||||
static $cycle_vars;
|
||||
|
||||
$name = (empty($params['name'])) ? 'default' : $params['name'];
|
||||
$print = (isset($params['print'])) ? (bool) $params['print'] : true;
|
||||
$advance = (isset($params['advance'])) ? (bool) $params['advance'] : true;
|
||||
$reset = (isset($params['reset'])) ? (bool) $params['reset'] : false;
|
||||
|
||||
if (!isset($params['values'])) {
|
||||
if (!isset($cycle_vars[$name]['values'])) {
|
||||
trigger_error("cycle: missing 'values' parameter");
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (isset($cycle_vars[$name]['values'])
|
||||
&& $cycle_vars[$name]['values'] != $params['values']
|
||||
) {
|
||||
$cycle_vars[$name]['index'] = 0;
|
||||
}
|
||||
$cycle_vars[$name]['values'] = $params['values'];
|
||||
}
|
||||
|
||||
if (isset($params['delimiter'])) {
|
||||
$cycle_vars[$name]['delimiter'] = $params['delimiter'];
|
||||
} elseif (!isset($cycle_vars[$name]['delimiter'])) {
|
||||
$cycle_vars[$name]['delimiter'] = ',';
|
||||
}
|
||||
|
||||
if (is_array($cycle_vars[$name]['values'])) {
|
||||
$cycle_array = $cycle_vars[$name]['values'];
|
||||
} else {
|
||||
$cycle_array = explode($cycle_vars[$name]['delimiter'], $cycle_vars[$name]['values']);
|
||||
}
|
||||
|
||||
if (!isset($cycle_vars[$name]['index']) || $reset) {
|
||||
$cycle_vars[$name]['index'] = 0;
|
||||
}
|
||||
|
||||
if (isset($params['assign'])) {
|
||||
$print = false;
|
||||
$template->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]);
|
||||
}
|
||||
|
||||
if ($print) {
|
||||
$retval = $cycle_array[$cycle_vars[$name]['index']];
|
||||
} else {
|
||||
$retval = null;
|
||||
}
|
||||
|
||||
if ($advance) {
|
||||
if ($cycle_vars[$name]['index'] >= count($cycle_array) - 1) {
|
||||
$cycle_vars[$name]['index'] = 0;
|
||||
} else {
|
||||
$cycle_vars[$name]['index'] ++;
|
||||
}
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {fetch} plugin
|
||||
* Type: function<br>
|
||||
* Name: fetch<br>
|
||||
* Purpose: fetch file, web or ftp data and display results
|
||||
*
|
||||
* @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @throws SmartyException
|
||||
* @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable
|
||||
*/
|
||||
function smarty_function_fetch($params, $template)
|
||||
{
|
||||
if (empty($params['file'])) {
|
||||
trigger_error("[plugin] fetch parameter 'file' cannot be empty", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// strip file protocol
|
||||
if (stripos($params['file'], 'file://') === 0) {
|
||||
$params['file'] = substr($params['file'], 7);
|
||||
}
|
||||
|
||||
$protocol = strpos($params['file'], '://');
|
||||
if ($protocol !== false) {
|
||||
$protocol = strtolower(substr($params['file'], 0, $protocol));
|
||||
}
|
||||
|
||||
if (isset($template->smarty->security_policy)) {
|
||||
if ($protocol) {
|
||||
// remote resource (or php stream, …)
|
||||
if (!$template->smarty->security_policy->isTrustedUri($params['file'])) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// local file
|
||||
if (!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$content = '';
|
||||
if ($protocol == 'http') {
|
||||
// http fetch
|
||||
if ($uri_parts = parse_url($params['file'])) {
|
||||
// set defaults
|
||||
$host = $server_name = $uri_parts['host'];
|
||||
$timeout = 30;
|
||||
$accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
|
||||
$agent = "Smarty Template Engine " . Smarty::SMARTY_VERSION;
|
||||
$referer = "";
|
||||
$uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
|
||||
$uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
|
||||
$_is_proxy = false;
|
||||
if (empty($uri_parts['port'])) {
|
||||
$port = 80;
|
||||
} else {
|
||||
$port = $uri_parts['port'];
|
||||
}
|
||||
if (!empty($uri_parts['user'])) {
|
||||
$user = $uri_parts['user'];
|
||||
}
|
||||
if (!empty($uri_parts['pass'])) {
|
||||
$pass = $uri_parts['pass'];
|
||||
}
|
||||
// loop through parameters, setup headers
|
||||
foreach ($params as $param_key => $param_value) {
|
||||
switch ($param_key) {
|
||||
case "file":
|
||||
case "assign":
|
||||
case "assign_headers":
|
||||
break;
|
||||
case "user":
|
||||
if (!empty($param_value)) {
|
||||
$user = $param_value;
|
||||
}
|
||||
break;
|
||||
case "pass":
|
||||
if (!empty($param_value)) {
|
||||
$pass = $param_value;
|
||||
}
|
||||
break;
|
||||
case "accept":
|
||||
if (!empty($param_value)) {
|
||||
$accept = $param_value;
|
||||
}
|
||||
break;
|
||||
case "header":
|
||||
if (!empty($param_value)) {
|
||||
if (!preg_match('![\w\d-]+: .+!', $param_value)) {
|
||||
trigger_error("[plugin] invalid header format '" . $param_value . "'", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
} else {
|
||||
$extra_headers[] = $param_value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "proxy_host":
|
||||
if (!empty($param_value)) {
|
||||
$proxy_host = $param_value;
|
||||
}
|
||||
break;
|
||||
case "proxy_port":
|
||||
if (!preg_match('!\D!', $param_value)) {
|
||||
$proxy_port = (int) $param_value;
|
||||
} else {
|
||||
trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "agent":
|
||||
if (!empty($param_value)) {
|
||||
$agent = $param_value;
|
||||
}
|
||||
break;
|
||||
case "referer":
|
||||
if (!empty($param_value)) {
|
||||
$referer = $param_value;
|
||||
}
|
||||
break;
|
||||
case "timeout":
|
||||
if (!preg_match('!\D!', $param_value)) {
|
||||
$timeout = (int) $param_value;
|
||||
} else {
|
||||
trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
trigger_error("[plugin] unrecognized attribute '" . $param_key . "'", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!empty($proxy_host) && !empty($proxy_port)) {
|
||||
$_is_proxy = true;
|
||||
$fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout);
|
||||
} else {
|
||||
$fp = fsockopen($server_name, $port, $errno, $errstr, $timeout);
|
||||
}
|
||||
|
||||
if (!$fp) {
|
||||
trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
} else {
|
||||
if ($_is_proxy) {
|
||||
fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n");
|
||||
} else {
|
||||
fputs($fp, "GET $uri HTTP/1.0\r\n");
|
||||
}
|
||||
if (!empty($host)) {
|
||||
fputs($fp, "Host: $host\r\n");
|
||||
}
|
||||
if (!empty($accept)) {
|
||||
fputs($fp, "Accept: $accept\r\n");
|
||||
}
|
||||
if (!empty($agent)) {
|
||||
fputs($fp, "User-Agent: $agent\r\n");
|
||||
}
|
||||
if (!empty($referer)) {
|
||||
fputs($fp, "Referer: $referer\r\n");
|
||||
}
|
||||
if (isset($extra_headers) && is_array($extra_headers)) {
|
||||
foreach ($extra_headers as $curr_header) {
|
||||
fputs($fp, $curr_header . "\r\n");
|
||||
}
|
||||
}
|
||||
if (!empty($user) && !empty($pass)) {
|
||||
fputs($fp, "Authorization: BASIC " . base64_encode("$user:$pass") . "\r\n");
|
||||
}
|
||||
|
||||
fputs($fp, "\r\n");
|
||||
while (!feof($fp)) {
|
||||
$content .= fgets($fp, 4096);
|
||||
}
|
||||
fclose($fp);
|
||||
$csplit = preg_split("!\r\n\r\n!", $content, 2);
|
||||
|
||||
$content = $csplit[1];
|
||||
|
||||
if (!empty($params['assign_headers'])) {
|
||||
$template->assign($params['assign_headers'], preg_split("!\r\n!", $csplit[0]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$content = @file_get_contents($params['file']);
|
||||
if ($content === false) {
|
||||
throw new SmartyException("{fetch} cannot read resource '" . $params['file'] . "'");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params['assign'])) {
|
||||
$template->assign($params['assign'], $content);
|
||||
} else {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {html_checkboxes} function plugin
|
||||
* File: function.html_checkboxes.php<br>
|
||||
* Type: function<br>
|
||||
* Name: html_checkboxes<br>
|
||||
* Date: 24.Feb.2003<br>
|
||||
* Purpose: Prints out a list of checkbox input types<br>
|
||||
* Examples:
|
||||
* <pre>
|
||||
* {html_checkboxes values=$ids output=$names}
|
||||
* {html_checkboxes values=$ids name='box' separator='<br>' output=$names}
|
||||
* {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
|
||||
* </pre>
|
||||
* Params:
|
||||
* <pre>
|
||||
* - name (optional) - string default "checkbox"
|
||||
* - values (required) - array
|
||||
* - options (optional) - associative array
|
||||
* - checked (optional) - array default not set
|
||||
* - separator (optional) - ie <br> or
|
||||
* - output (optional) - the output next to each checkbox
|
||||
* - assign (optional) - assign the output as an array to this variable
|
||||
* - escape (optional) - escape the content (not value), defaults to true
|
||||
* </pre>
|
||||
*
|
||||
* @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
|
||||
* (Smarty online manual)
|
||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
||||
* @version 1.0
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param object $template template object
|
||||
*
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
*/
|
||||
function smarty_function_html_checkboxes($params, $template)
|
||||
{
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
|
||||
|
||||
$name = 'checkbox';
|
||||
$values = null;
|
||||
$options = null;
|
||||
$selected = array();
|
||||
$separator = '';
|
||||
$escape = true;
|
||||
$labels = true;
|
||||
$label_ids = false;
|
||||
$output = null;
|
||||
|
||||
$extra = '';
|
||||
|
||||
foreach ($params as $_key => $_val) {
|
||||
switch ($_key) {
|
||||
case 'name':
|
||||
case 'separator':
|
||||
$$_key = (string) $_val;
|
||||
break;
|
||||
|
||||
case 'escape':
|
||||
case 'labels':
|
||||
case 'label_ids':
|
||||
$$_key = (bool) $_val;
|
||||
break;
|
||||
|
||||
case 'options':
|
||||
$$_key = (array) $_val;
|
||||
break;
|
||||
|
||||
case 'values':
|
||||
case 'output':
|
||||
$$_key = array_values((array) $_val);
|
||||
break;
|
||||
|
||||
case 'checked':
|
||||
case 'selected':
|
||||
if (is_array($_val)) {
|
||||
$selected = array();
|
||||
foreach ($_val as $_sel) {
|
||||
if (is_object($_sel)) {
|
||||
if (method_exists($_sel, "__toString")) {
|
||||
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
|
||||
} else {
|
||||
trigger_error("html_checkboxes: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$_sel = smarty_function_escape_special_chars((string) $_sel);
|
||||
}
|
||||
$selected[$_sel] = true;
|
||||
}
|
||||
} elseif (is_object($_val)) {
|
||||
if (method_exists($_val, "__toString")) {
|
||||
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
||||
} else {
|
||||
trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
|
||||
}
|
||||
} else {
|
||||
$selected = smarty_function_escape_special_chars((string) $_val);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'checkboxes':
|
||||
trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
|
||||
$options = (array) $_val;
|
||||
break;
|
||||
|
||||
case 'assign':
|
||||
break;
|
||||
|
||||
case 'strict':
|
||||
break;
|
||||
|
||||
case 'disabled':
|
||||
case 'readonly':
|
||||
if (!empty($params['strict'])) {
|
||||
if (!is_scalar($_val)) {
|
||||
trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
|
||||
}
|
||||
|
||||
if ($_val === true || $_val === $_key) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// omit break; to fall through!
|
||||
|
||||
default:
|
||||
if (!is_array($_val)) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
|
||||
} else {
|
||||
trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($options) && !isset($values)) {
|
||||
return '';
|
||||
} /* raise error here? */
|
||||
|
||||
$_html_result = array();
|
||||
|
||||
if (isset($options)) {
|
||||
foreach ($options as $_key => $_val) {
|
||||
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $_i => $_key) {
|
||||
$_val = isset($output[$_i]) ? $output[$_i] : '';
|
||||
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params['assign'])) {
|
||||
$template->assign($params['assign'], $_html_result);
|
||||
} else {
|
||||
return implode("\n", $_html_result);
|
||||
}
|
||||
}
|
||||
|
||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape = true)
|
||||
{
|
||||
$_output = '';
|
||||
|
||||
if (is_object($value)) {
|
||||
if (method_exists($value, "__toString")) {
|
||||
$value = (string) $value->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
$value = (string) $value;
|
||||
}
|
||||
|
||||
if (is_object($output)) {
|
||||
if (method_exists($output, "__toString")) {
|
||||
$output = (string) $output->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
$output = (string) $output;
|
||||
}
|
||||
|
||||
if ($labels) {
|
||||
if ($label_ids) {
|
||||
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value));
|
||||
$_output .= '<label for="' . $_id . '">';
|
||||
} else {
|
||||
$_output .= '<label>';
|
||||
}
|
||||
}
|
||||
|
||||
$name = smarty_function_escape_special_chars($name);
|
||||
$value = smarty_function_escape_special_chars($value);
|
||||
if ($escape) {
|
||||
$output = smarty_function_escape_special_chars($output);
|
||||
}
|
||||
|
||||
$_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
|
||||
|
||||
if ($labels && $label_ids) {
|
||||
$_output .= ' id="' . $_id . '"';
|
||||
}
|
||||
|
||||
if (is_array($selected)) {
|
||||
if (isset($selected[$value])) {
|
||||
$_output .= ' checked="checked"';
|
||||
}
|
||||
} elseif ($value === $selected) {
|
||||
$_output .= ' checked="checked"';
|
||||
}
|
||||
|
||||
$_output .= $extra . ' />' . $output;
|
||||
if ($labels) {
|
||||
$_output .= '</label>';
|
||||
}
|
||||
|
||||
$_output .= $separator;
|
||||
|
||||
return $_output;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user